Methods
Lifecycle and UI
await widget.init(config)
Initializes the widget and mounts an iframe into the given container.
await widget.destroy()
Destroys the widget, removes listeners and iframe, and resets internal state.
widget.isReady()
Returns whether the widget is initialized and ready.
widget.show() / widget.hide()
Toggles iframe visibility.
Data and communication
widget.updateUserCart(cart)
Pushes latest cart state to widget runtime.
widget.updateUserCart({
cardId: "cart-001",
items: [
{ productId: "p1", variantId: "v1", quantity: 1 },
{ productId: "p2", variantId: "v2", quantity: 2 },
],
});
Events API
widget.on(event, handler)
Registers an event listener.
widget.off(event, handler)
Removes a previously registered listener.