Bundle SelectorReference
Events
bundle:selected
When: A bundle card is clicked. Fires after the selection state is updated but before the cart write completes (in swap mode).
Payload:
| Field | Type | Description |
|---|---|---|
selectorId | string | The data-next-selector-id of the container |
items | array | The resolved bundle items for the selected card. Each entry is { packageId: number, quantity: number }. In select mode, pass this directly to window.next.cart.swapCart(items) |
bundle:selection-changed
When: Internal selection state is updated — fires on init, after a card click, and after cart-sync recovery.
Payload:
| Field | Type | Description |
|---|---|---|
selectorId | string | The data-next-selector-id of the container |
items | array | The resolved bundle items for the selected card. Each entry is { packageId: number, quantity: number }. In select mode, pass this directly to window.next.cart.swapCart(items) |
bundle:price-updated
When: A price fetch completes for a bundle card.
Payload:
| Field | Type | Description |
|---|---|---|
selectorId | string | The data-next-selector-id of the container |
Listening to Events
window.nextReady.push(() => {
window.next.on('bundle:selection-changed', ({ selectorId, items }) => {
console.log('Selected bundle:', selectorId, items);
});
window.next.on('bundle:price-updated', ({ selectorId }) => {
console.log('Price updated for selector:', selectorId);
});
});