Skip to content

Listeners

Here is the angular stone of Webserial, the listeners. With them, you can listen to the events that the device emits.

When you create a new instance of the JSD class, you can listen to the events that the device emits.

machine.on("serial:message", (data) => {
console.log(data);
});

Each event has a different data structure, so you need to check the data structure for each event.

Locale Dropdown

For JSD class there events that you can listen to, of course only listen to the events that you need.

To get all the available listeners, you can use the availableListeners property.

console.log(machine.availableListeners);

The result will be an object with the available listeners, and if you are listen each event

[
{
"type": "debug",
"listening": false
},
{
"type": "licensing:feature-status",
"listening": false
},
{
"type": "licensing:identification",
"listening": false
},
{
"type": "licensing:report",
"listening": false
},
{
"type": "licensing:seed",
"listening": true
},
{
"type": "licensing:temporary-license-status",
"listening": false
},
{
"type": "licensing:wrong-cmd",
"listening": false
},
{
"type": "manifest:block",
"listening": false
},
{
"type": "manifest:completed",
"listening": false
},
{
"type": "manifest:log",
"listening": false
},
{
"type": "manifest:wrong-cmd",
"listening": false
},
{
"type": "mdbCardHolder:authorization",
"listening": false
},
{
"type": "mdbCardHolder:balance-statement",
"listening": false
},
{
"type": "mdbCardHolder:condition-status",
"listening": false
},
{
"type": "mdbCardHolder:configuration-data",
"listening": false
},
{
"type": "mdbCardHolder:display-message",
"listening": false
},
{
"type": "mdbCardHolder:end-session",
"listening": false
},
{
"type": "mdbCardHolder:feature-configuration",
"listening": false
},
{
"type": "mdbCardHolder:identification",
"listening": false
},
{
"type": "mdbCardHolder:jsd-license-error",
"listening": false
},
{
"type": "mdbCardHolder:revalue",
"listening": false
},
{
"type": "mdbCardHolder:sale-approval",
"listening": false
},
{
"type": "mdbCardHolder:sale-cancellation",
"listening": false
},
{
"type": "mdbCardHolder:sale-failure-confirmation",
"listening": false
},
{
"type": "mdbCardHolder:sale-success-confirmation",
"listening": false
},
{
"type": "mdbCardHolder:selection-request",
"listening": false
},
{
"type": "mdbCardHolder:wrong-cmd",
"listening": false
},
{
"type": "serial:connected",
"listening": true
},
{
"type": "serial:connecting",
"listening": false
},
{
"type": "serial:corrupt-message",
"listening": false
},
{
"type": "serial:disconnected",
"listening": false
},
{
"type": "serial:error",
"listening": false
},
{
"type": "serial:jsd-ack",
"listening": false
},
{
"type": "serial:jsd-data",
"listening": false
},
{
"type": "serial:jsd-error",
"listening": false
},
{
"type": "serial:jsd-nack",
"listening": false
},
{
"type": "serial:lost",
"listening": false
},
{
"type": "serial:message",
"listening": true
},
{
"type": "serial:need-permission",
"listening": false
},
{
"type": "serial:reconnect",
"listening": false
},
{
"type": "serial:sent",
"listening": false
},
{
"type": "serial:soft-reload",
"listening": false
},
{
"type": "serial:timeout",
"listening": false
},
{
"type": "serial:unsupported",
"listening": false
},
{
"type": "unknown",
"listening": false
},
{
"type": "vision:active-faults",
"listening": false
},
{
"type": "vision:active-faults-list",
"listening": false
},
{
"type": "vision:alarm-faults-events",
"listening": false
},
{
"type": "vision:channel-status",
"listening": false
},
{
"type": "vision:channels",
"listening": false
},
{
"type": "vision:channels-linked-to-selection",
"listening": false
},
{
"type": "vision:channels-progress",
"listening": false
},
{
"type": "vision:collect",
"listening": false
},
{
"type": "vision:connection",
"listening": false
},
{
"type": "vision:current-temperature",
"listening": false
},
{
"type": "vision:dispense-status",
"listening": false
},
{
"type": "vision:door",
"listening": false
},
{
"type": "vision:extended-dispense-status-data",
"listening": false
},
{
"type": "vision:jsd-dispensing-queue",
"listening": false
},
{
"type": "vision:jsd-license-error",
"listening": false
},
{
"type": "vision:jsd-status-reset",
"listening": false
},
{
"type": "vision:jsd-version",
"listening": false
},
{
"type": "vision:machine-id",
"listening": false
},
{
"type": "vision:machine-status",
"listening": false
},
{
"type": "vision:perishable-products-config",
"listening": false
},
{
"type": "vision:reset-sold-out-channels",
"listening": false
},
{
"type": "vision:selection-dispense-config",
"listening": false
},
{
"type": "vision:special-characteristics-selection",
"listening": false
},
{
"type": "vision:status-selection",
"listening": false
},
{
"type": "vision:time-waiting-after-product-collection",
"listening": false
},
{
"type": "vision:time-waiting-for-product-collection",
"listening": false
},
{
"type": "vision:trays-positioning-phototransistors-status",
"listening": false
},
{
"type": "vision:waiting-collection",
"listening": false
},
{
"type": "vision:wrong-cmd",
"listening": false
}
]

But sometimes you don’t want the object you want only an array with the available listeners, you can do this:

machine.availableListeners.map((el) => el.type);

And one more time here is the result

[
"debug",
"licensing:feature-status",
"licensing:identification",
"licensing:report",
"licensing:seed",
"licensing:temporary-license-status",
"licensing:wrong-cmd",
"manifest:block",
"manifest:completed",
"manifest:log",
"manifest:wrong-cmd",
"mdbCardHolder:authorization",
"mdbCardHolder:balance-statement",
"mdbCardHolder:condition-status",
"mdbCardHolder:configuration-data",
"mdbCardHolder:display-message",
"mdbCardHolder:end-session",
"mdbCardHolder:feature-configuration",
"mdbCardHolder:identification",
"mdbCardHolder:jsd-license-error",
"mdbCardHolder:revalue",
"mdbCardHolder:sale-approval",
"mdbCardHolder:sale-cancellation",
"mdbCardHolder:sale-failure-confirmation",
"mdbCardHolder:sale-success-confirmation",
"mdbCardHolder:selection-request",
"mdbCardHolder:wrong-cmd",
"serial:connected",
"serial:connecting",
"serial:corrupt-message",
"serial:disconnected",
"serial:error",
"serial:jsd-ack",
"serial:jsd-data",
"serial:jsd-error",
"serial:jsd-nack",
"serial:lost",
"serial:message",
"serial:need-permission",
"serial:reconnect",
"serial:sent",
"serial:soft-reload",
"serial:timeout",
"serial:unsupported",
"unknown",
"vision:active-faults",
"vision:active-faults-list",
"vision:alarm-faults-events",
"vision:channel-status",
"vision:channels",
"vision:channels-linked-to-selection",
"vision:channels-progress",
"vision:collect",
"vision:connection",
"vision:current-temperature",
"vision:dispense-status",
"vision:door",
"vision:extended-dispense-status-data",
"vision:jsd-dispensing-queue",
"vision:jsd-license-error",
"vision:jsd-status-reset",
"vision:jsd-version",
"vision:machine-id",
"vision:machine-status",
"vision:perishable-products-config",
"vision:reset-sold-out-channels",
"vision:selection-dispense-config",
"vision:special-characteristics-selection",
"vision:status-selection",
"vision:time-waiting-after-product-collection",
"vision:time-waiting-for-product-collection",
"vision:trays-positioning-phototransistors-status",
"vision:waiting-collection",
"vision:wrong-cmd"
]

Warning

Don’t use this event in production, only for debug. The amount of data can be huge and slow down the application.

If you want to know all events dispatched, you need to enable the debug mode.

machine.__debug__ = true; // enable debug mode

So then you can listen to the debug event.

machine.on("debug", (event) => {
// event.detail = {
// type: 'event',
// data: 'data of event'
// }
console.log(event.detail);
});

When the serial is connected, this event is dispatched.

machine.on("serial:connected", (event) => {
console.log(event.detail);
});

When the serial is trying to connect, this event is dispatched.

machine.on("serial:connecting", (event) => {
if (event.detail.active) {
console.log("Connecting to serial...");
} else {
console.log("Connecting finished.");
}
});

When the serial is disconnected, this event is dispatched.

machine.on("serial:disconnected", (event) => {
console.log(event.detail);
});

When the serial has an error, this event is dispatched.

machine.on("serial:error", (event) => {
console.log(event.detail);
});

When the serial is lost, this event is dispatched.

machine.on("serial:lost", (event) => {
console.log(event.detail);
});

When the serial receives a message, this event is dispatched.

machine.on("serial:message", (event) => {
console.log(event.detail);
});

When the serial needs permission, this event is dispatched. This occurs because user interaction is needed to request the serial.

Recommendation: Use a button or a screen to show what is happening.

machine.on("serial:need-permission", (event) => {
console.log(event.detail);
});

When the serial is trying to reconnect, this event is dispatched.

machine.on("serial:reconnect", (event) => {
// without data
});

When the serial sends a message to machine, this event is dispatched.

machine.on("serial:sent", (event) => {
console.log(event.detail);
});
structure event.detail
{
"event": "string",
"bytes": []
}

When the serial is trying to soft reload, this event is dispatched.

machine.on("serial:soft-reload", (event) => {
// without data
});

When the serial has a timeout, this event is dispatched.

machine.on("serial:timeout", (event) => {
console.log(event.detail);
});

When the serial is unsupported, this event is dispatched.

machine.on("serial:unsupported", (event) => {
console.log(event.detail);
});

When receives a wrong command, this event is dispatched.

machine.on("licensing:wrong-cmd", (event) => {
console.log(event.detail);
});
event.detail
{
"opcodeName": "string",
"opcode": 0,
"params": ["string"]
}

When request feature status, this event is dispatched.

machine.on("licensing:feature-status", (event) => {
console.log(event.detail);
});
event.detail
{
"feature": "string",
"active": true
}

When request identification of JSD

machine.on('licensing:identification', (event) => {
console.log(event.detail)
});
event.detail
{
"idJSuite": "string",
"uid": "string",
}

When success/fail upload license of JSD this message is emitted

machine.on('licensing:report', (event) => {
console.log(event.detail)
});
event.detail
{
"isSuccess": true,
"status": "string",
"reason": "string",
}

When request seed, this event is dispatched.

machine.on("licensing:seed", (event) => {
console.log(event.detail);
});
event.detail
{
"seed": "string",
"hex": "string"
}

When request temporary license status, this event is dispatched.

machine.on("licensing:temporary-license-status", (event) => {
console.log(event.detail);
});
event.detail
{
"status": "string",
"remainingDays": 0,
"daysSinceExpiration": 0,
"isPermanent": true,
"active": true,
"expired": false,
}

When receives a JSD error, this event is dispatched.

machine.on("serial:jsd-error", (event) => {
console.log(event.detail);
});
event.detail
{
"parsed": "string"
}

When receives a JSD ACK, NACK or DATA, this event is dispatched.

machine.on("serial:jsd-ack", (event) => {
console.log(event.detail);
});
machine.on("serial:jsd-nack", (event) => {
console.log(event.detail);
});
machine.on("serial:jsd-data", (event) => {
console.log(event.detail);
});
event.detail
{
type: 'ACK' | 'NACK' | 'DATA';
id: number;
opcode?: number;
appId?: number;
noBytes?: number;
params?: string[];
rawAscii?: string;
}

When receives a wrong command, this event is dispatched.

machine.on("manifest:wrong-cmd", (event) => {
console.log(event.detail);
});
event.detail
{
"opcodeName": "string",
"opcode": 0,
"params": ["string"]
}

When receives a log, this event is dispatched.

machine.on("manifest:log", (event) => {
console.log(event.detail);
});
event.detail
{
"type": "log" | "end",
"log": ["string"]
}

When receives a block, this event is dispatched.

machine.on("manifest:block", (event) => {
console.log(event.detail);
});
event.detail
{
"blockId": 0,
"indexFile": 0,
"quantity": 0
}

When receives a completed, this event is dispatched.

machine.on("manifest:completed", (event) => {
console.log(event.detail);
});
event.detail
{
"result": "string",
"resultKey": 0
}

When receives a wrong command, this event is dispatched.

machine.on("vision:wrong-cmd", (event) => {
console.log(event.detail);
});
event.detail
{
"opcodeName": "string",
"opcode": 0,
"params": ["string"]
}

When receives a machine status, this event is dispatched.

machine.on("vision:machine-status", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1,
"status": "string",
"machineInService": true,
"doorOpen": true,
"availabilityToDispense": 0,
"hasLightsOn": true,
"temperature": "string"
}

When receives a door event, this event is dispatched.

machine.on("vision:door", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1,
"open": true
}

When receives a machine event related to connection, this event is dispatched.

machine.on("vision:connection", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1,
"connected": true,
}

When receives a waiting collection, this event is dispatched.

machine.on("vision:waiting-collection", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // or null if something went wrong
}

When receives a channels progress, this event is dispatched.

machine.on("vision:channels-progress", (event) => {
console.log(event.detail);
});
event.detail
{
"progress": 0,
"current": 0,
"verified": 0
}

When receives a channels, this event is dispatched.

machine.on("vision:channels", (event) => {
console.log(event.detail);
});
event.detail
{
[
{
"selection": 0,
"active": true,
"machine": 1 // 1|2|3|4
}
] /// ...[...]
}

When receives a channel status, this event is dispatched.

machine.on("vision:channel-status", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"selection": 0,
"active": true
}

When receives a status selection, this event is dispatched.

machine.on("vision:status-selection", (event) => {
console.log(event.detail);
});
event.detail
{
"selection": 0,
"status": "string"
}

When receives a dispense status, this event is dispatched.

machine.on("vision:dispense-status", (event) => {
console.log(event.detail);
});
event.detail
{
"token": "string",
"status": "string",
"machine": 1, // 1|2|3|4
"tray": 0,
"channel": 0,
"extendedStatus": "string"
}

When receives a selection dispense config, this event is dispatched.

machine.on("vision:selection-dispense-config", (event) => {
console.log(event.detail);
});
event.detail
{
"selection": 0,
"speed": 0,
"timePostRun": 1
}

When receives a channels linked to selection, this event is dispatched.

machine.on("vision:channels-linked-to-selection", (event) => {
console.log(event.detail);
});
event.detail
{
"selection": 0,
"linkedChannels": [
{
"machine": 1, // 1|2|3|4
"tray": 0,
"channel": 0
}
],
"status": "string"
}

When receives a machine ID, this event is dispatched.

machine.on("vision:machine-id", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"model": "string",
"serialNumber": "string",
"firmwareVersion": "string"
}

When receives a current temperature, this event is dispatched.

machine.on("vision:current-temperature", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"workingTemperature": "string",
"currentTemperatureInsideMachine": "string",
"currentTemperatureAir": "string",
"coolUnitStatus": "ON" | "OFF"
}

When receives a alarm faults events, this event is dispatched.

machine.on("vision:alarm-faults-events", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"event": "string",
"status": "ACTIVE" | "CLEARED"
}

When receives a time waiting for product collection, this event is dispatched.

machine.on("vision:time-waiting-for-product-collection", (event) => {
console.log(event.detail);
});
event.detail
{
"minutesProductCollection": 0,
"secondsTimeBetweenDispenseManoeuvres": 0,
"secondsBetweenCollectAndStartNextDispense": 0
}

When receives a collect, this event is dispatched.

machine.on("vision:collect", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"status": "string"
}

When receives a reset sold out channels, this event is dispatched.

machine.on("vision:reset-sold-out-channels", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"status": "string"
}

When receives a time waiting after product collection, this event is dispatched.

machine.on("vision:time-waiting-after-product-collection", (event) => {
console.log(event.detail);
});
event.detail
{
"secondsBetweenCollectAndStartNextDispense": 0
}

When receives a JSD version, this event is dispatched.

machine.on("vision:jsd-version", (event) => {
console.log(event.detail);
});
event.detail
{
"name": "string",
"compileNumber": "string",
"compileDate": "string",
"description": "string"
}

When receives a active faults, this event is dispatched.

machine.on("vision:active-faults", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"status": "string",
"fault": 0,
"appearancesNumber": 0,
"partialNumberActivated": 0,
"minutesActive": 0,
"date": "string"
}

When receives a JSD dispensing queue, this event is dispatched.

machine.on("vision:jsd-dispensing-queue", (event) => {
console.log(event.detail);
});
event.detail
{
"free": 0,
"processed": 0,
"notProcessed": 0
}

When receives a special characteristics selection, this event is dispatched.

machine.on("vision:special-characteristics-selection", (event) => {
console.log(event.detail);
});
event.detail
{
"selection": 0,
"perishable": true,
"fragileOrHeavy": true,
"typeAdjustElevator": "lower" | "upper",
"timeAdjustElevator": 0
}

When receives a perishable products config, this event is dispatched.

machine.on("vision:perishable-products-config", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"perishableActive": true,
"alarmPerisableTriggered": true,
"maxTemperature": "string",
"minutesBeforeExpire": 0
}

When receives a active faults list, this event is dispatched.

machine.on("vision:active-faults-list", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"faults": [
{
"code": 0,
"description": "string"
}
],
"ok": true
}

When receives a JSD status reset, this event is dispatched.

machine.on("vision:jsd-status-reset", (event) => {
console.log(event.detail);
});
event.detail
{
"type": "string"
}

When receives a extended dispense status data, this event is dispatched.

machine.on("vision:extended-dispense-status-data", (event) => {
console.log(event.detail);
});
event.detail
{
"enabled": true
}

When receives a trays positioning phototransistors status, this event is dispatched.

machine.on("vision:trays-positioning-phototransistors-status", (event) => {
console.log(event.detail);
});
event.detail
{
"machine": 1, // 1|2|3|4
"trays": {
"0": "string",
"1": "string",
"2": "string",
"3": "string"
}
}

When receives a JSD license error, this event is dispatched.

machine.on("vision:jsd-license-error", (event) => {
console.log(event.detail);
});
event.detail
{
"type": "unknown" | "expired-license" | "app-number-not-licensed" | "price-control-active-direct-dispense-not-allowed",
"opcode": 0,
"actionName": "string",
"params": ["string"]
}

When receives card holder authorization.

machine.on("mdbCardHolder:authorization", (event) => {
console.log(event.detail);
});
event.detail
{
"deviceNumber": "1|2|3|4",
"success": "boolean",
"reason": "string|null",
}

When request balance statement of card holder.

machine.on("mdbCardHolder:balance-statement", (event) => {
console.log(event.detail);
});
event.detail
{
"deviceNumber": "1|2|3|4",
"tokenBalanceStatus": "idle|active",
"customerBalance": "number",
"maxCardRecharge": "number",
"paymentMethod": {
"isKnown": "boolean",
"id": "string|null"
},
"groupWhichCardBelongs": "string"
}

Card holder condition status.

machine.on("mdbCardHolder:condition-status", (event) => {
console.log(event.detail);
});
event.detail
{
"deviceNumber": "1|2|3|4",
"connectionStatus": "disconnected|connected|loss of communication",
"cardHolderStatus": "inactive|disabled|enabled|on hold|selling|reevaluate",
}

response of configuration data requestConfiguration

machine.on("mdbCardHolder:configuration-data", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"countryCurrencyCode": "string",
"canReloadFunds": "boolean",
"canRestoreFunds": "boolean",
"canMakeMultipleSales": "boolean",
"hasDisplay": "boolean",
"canRecorCashSales": "boolean",
}

Current message in display

machine.on("mdbCardHolder:display-message", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"displayTimeSeconds": "number",
"message": {
"line1": "string",
"line2": "string",
};
}

Response to Request to end session of the MDB Card Holder device

machine.on("mdbCardHolder:end-session", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"status": "unable to execute | petition initiated",
"currentCardHolderStatus": "'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate' | null",
}

Response to request functionalities configuration

machine.on("mdbCardHolder:feature-configuration", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"alwaysIdle": {
"available": "boolean",
"enabled": "boolean",
},
"remoteVend": {
"available": "boolean",
"enabled": "boolean",
},
}

Response to request for identification of the MDB Card Holder device.

machine.on("mdbCardHolder:identification", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"manufacturerCode": "string",
"serialNumber": "string",
"model": "string",
"softwareVersion": "string",
}

When receives a JSD license error, this event is dispatched.

machine.on("mdbCardHolder:jsd-license-error", (event) => {
console.log(event.detail);
})
event.detail
{
"type": "unknown" | "expired-license" | "app-number-not-licensed" | "price-control-active-direct-dispense-not-allowed",
"opcode": "number",
"actionName": "string",
"params": ["string"]
}

Response to Request for revalue of the MDB Card Holder device

machine.on("mdbCardHolder:revalue", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"status": "'revalue denied' | 'revalue approved' | 'unable to execute' | 'petition initiated'",
"currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",
}

Response to request for sale approval of the MDB Card Holder device.

machine.on("mdbCardHolder:sale-approval", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"status": "'sale denied' | 'sale approved' | 'unable to execute' | 'petition initiated'",
"currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",
"amountCharged": "undefined | number",
}

Response to request for sale cancellation of the MDB Card Holder device.

machine.on("mdbCardHolder:sale-cancellation", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"status": "success | failure",
"currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",
}

Response to Request for sale failure confirmation of the MDB Card Holder device.

machine.on("mdbCardHolder:sale-failure-confirmation", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"status": "'refund error' | 'refund made' | 'unable to execute' | 'petition initiated'",
"currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",
}

Response to Request for sale success confirmation of the MDB Card Holder device.

machine.on("mdbCardHolder:sale-success-confirmation", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"status": "'the card has been updated' | 'unable to execute' | 'petition initiated'",
"currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",
}

Response to selection dispense or requestSelectionRequestDenied

machine.on("mdbCardHolder:selection-request", (event) => {
console.log(event.detail);
})
event.detail
{
"deviceNumber": "1|2|3|4",
"tokenBalanceStatus": "'idle' | 'active'",
"customerBalance": "number",
"paymentMethod": {
"isKnown": "boolean",
"id": "string | null",
},
"product": {
"id": "number | null",
"withLid": "boolean",
"sugarLevel": "'default' | 'sugar-free' | 'intermediate' | 'sugar-max'",
}
}

When receives a wrong command, this event is dispatched.

machine.on("mdbCardHolder:wrong-cmd", (event) => {
console.log(event.detail);
})
event.detail
{
"opcodeName": "string",
"opcode": "number",
"params": ["string"]
}

This event is dispatched?.

machine.on("unknown", (event) => {
console.log(event.detail);
});

This event is dispatched when the machine receives a corrupt message.

machine.on("corrupt:message", (event) => {
console.log(event.detail);
});