Basket
Commands
open
open
Opens the basket.
close
close
Closes the basket.
getState
getState
Gets the current state of the basket.
The command will return an object with the following properties:
Property | Type | Description |
---|---|---|
|
| Is the basket currently open |
addProduct
addProduct
Adds a product to the basket. The command accepts a single argument, consisting of the properties below:
Property | Type | Description |
---|---|---|
|
| Product title |
|
| Product description |
|
| Product Id |
|
| Product price |
|
| Page where the product is located on |
|
| Quanity of product to add |
Below is an example use:
Events
onOpened
onOpened
This subscription will trigger every time the basket is opened.
onClosed
onClosed
This subscription will trigger every time the basket is closed.
onToggled
onToggled
This subscription will trigger every time the basket is toggled between open and closed state.
onProductAdd
onProductAdd
This subscription will trigger whenever a product is added to the basket.
Note:
Products added through the addProduct
API command will not trigger this subscription.
The callback contains a value/result of the product that was added, containing the following properties:
Property | Type | Description |
---|---|---|
|
| Product title |
|
| Product description |
|
| Product ID |
|
| Product price |
|
| Page index where the product is located* (see note) |
|
| Page where the product is located on |
|
| Quanity of product added |
|
| Number of items per package |
Note:
Please note that pageIndex
starts at 0
. So the 1st page of your flipbook will have a pageIndex
of 0
, page 2 a pageIndex
of 1
and so on. To get the actual pagenumber you should use originPage
instead.
Last updated