Overview
Communication between CFS/Pages and third-party POS systems (Clover, PAX) is implemented via JavaScript iframe events usingwindow.postMessage()
Event Model:
Output Events (Sent by CFS → External System)
init
DescriptionTriggered on CFS application initialization. Post Message Example
| Field | Description |
|---|---|
| projectName | Static string “cfs” – identifies the source project |
buttonClick
DescriptionEmitted when a button is clicked in CFS. Used to request external scanner usage (e.g., Check-In UI). Post Message Example
| Field | Description |
|---|---|
| targetId | HTML element ID of the clicked button (e.g., “scan”) |
| buttonId | Deprecated. Legacy support only (use targetId instead). |
inputFocus
DescriptionEmitted when an input field in CFS gains focus. Can notify the external POS to prepare for login/check-in actions. Post Message Example
| Field | Description |
|---|---|
| targetId | HTML element ID of the input field (e.g., “search”) |
| inputId | Deprecated. Legacy support only (use targetId instead). |
inputBlur
DescriptionEmitted when an input field in CFS loses focus. Post Message Example
| Field | Description |
|---|---|
| targetId | HTML element ID of the input field (e.g., “search”) |
| inputId | Deprecated. Legacy support only (use targetId instead). |
Input Events (Received by CFS ← External System)
formSubmitted
DescriptionInstructs CFS to close the current iframe window (e.g., after external form submit in CFS Template iframe). Parameters
No additional parameters.
userActivity
DescriptionUsed to prolong user activity inside the iframe (prevent “Are you still here?” prompts). Parameters
No additional parameters.
setWindowClass
DescriptionPreviously used to set CSS class on iframe window.
Currently considered deprecated.
scanCompleted
DescriptionDelivers the result of an external scan (barcode, QR, username, email). Used for login/check-in. Example Payload
| Field | Description |
|---|---|
| data | String value representing scan result (username, code, email) |
scanCancelled
DescriptionIndicates cancellation of a scan request. Typically results in:
- Showing a toast message to the user.
- Resending cancellation notice to the external system.
No additional parameters.