@liquidcommerce/elements-sdk 2.6.7 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -2519
- package/dist/index.checkout.esm.js +16086 -0
- package/dist/index.esm.js +16267 -13788
- package/dist/types/auto-initialize/checkout.d.ts +2 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +27 -0
- package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +11 -1
- package/dist/types/clients/checkout.d.ts +13 -0
- package/dist/types/constants/core.constant.d.ts +5 -3
- package/dist/types/core/api/api-client.service.d.ts +0 -2
- package/dist/types/core/client/actions/base-action.service.d.ts +15 -0
- package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
- package/dist/types/core/client/actions/client-cart-action.service.d.ts +37 -0
- package/dist/types/core/client/actions/client-checkout-action.service.d.ts +50 -0
- package/dist/types/core/client/actions/client-product-action.service.d.ts +12 -0
- package/dist/types/core/client/client-action.service.d.ts +6 -73
- package/dist/types/core/client/client-config.service.d.ts +3 -4
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +1 -0
- package/dist/types/core/store/interfaces/core.interface.d.ts +14 -1
- package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +45 -0
- package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
- package/dist/types/core/store/store.constant.d.ts +4 -0
- package/dist/types/enums/core.enum.d.ts +14 -1
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/index.checkout.d.ts +7 -0
- package/dist/types/index.checkout.umd.d.ts +4 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/interfaces/api/checkout.interface.d.ts +2 -1
- package/dist/types/interfaces/api/product-list.interface.d.ts +13 -5
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -0
- package/dist/types/interfaces/configs/global.interface.d.ts +4 -2
- package/dist/types/interfaces/configs/index.d.ts +1 -0
- package/dist/types/interfaces/configs/product-list.interface.d.ts +28 -0
- package/dist/types/interfaces/core.interface.d.ts +28 -6
- package/dist/types/modules/address/address-input.component.d.ts +11 -0
- package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +6 -2
- package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
- package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/index.d.ts +7 -0
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +8 -0
- package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +12 -0
- package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
- package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +10 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -0
- package/dist/types/modules/product-list/components/card-components/product-title.d.ts +6 -0
- package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +14 -0
- package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-price-filter.components.d.ts → filter-components/product-list-price-filter.d.ts} +1 -1
- package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +13 -0
- package/dist/types/modules/product-list/components/index.d.ts +7 -3
- package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +2 -1
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +10 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +58 -37
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +28 -0
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +26 -0
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +22 -0
- package/dist/types/modules/product-list/product-list-card.component.d.ts +30 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +62 -3
- package/dist/types/modules/product-list/product-list.component.d.ts +16 -43
- package/dist/types/{enums/cloud.enum.d.ts → modules/product-list/product-list.constants.d.ts} +20 -1
- package/dist/types/modules/product-list/product-list.interface.d.ts +33 -24
- package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
- package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
- package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
- package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -1
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -1
- package/dist/types/modules/ui-components/input/index.d.ts +0 -1
- package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +23 -0
- package/dist/types/modules/ui-components/styles/modal.style.d.ts +1 -0
- package/dist/types/modules/ui-components/ui.commands.d.ts +3 -1
- package/dist/types/static/icon/check.icon.d.ts +2 -0
- package/dist/types/static/icon/index.d.ts +1 -0
- package/docs/gitbook/actions.md +160 -0
- package/docs/gitbook/address.md +48 -0
- package/docs/gitbook/cart.md +65 -0
- package/docs/gitbook/checkout.md +131 -0
- package/docs/gitbook/events.md +137 -0
- package/docs/gitbook/overview.md +166 -0
- package/docs/gitbook/product.md +64 -0
- package/docs/gitbook/quick-start-guide.md +393 -0
- package/docs/v1/README.md +210 -0
- package/docs/v1/api/actions/address-actions.md +281 -0
- package/docs/v1/api/actions/cart-actions.md +337 -0
- package/docs/v1/api/actions/checkout-actions.md +387 -0
- package/docs/v1/api/actions/product-actions.md +115 -0
- package/docs/v1/api/client.md +482 -0
- package/docs/v1/api/configuration.md +1 -0
- package/docs/v1/api/injection-methods.md +247 -0
- package/docs/v1/api/typescript-types.md +1 -0
- package/docs/v1/api/ui-helpers.md +200 -0
- package/docs/v1/examples/advanced-patterns.md +96 -0
- package/docs/v1/examples/checkout-flow.md +91 -0
- package/docs/v1/examples/custom-theming.md +63 -0
- package/docs/v1/examples/multi-product-page.md +90 -0
- package/docs/v1/examples/simple-product-page.md +89 -0
- package/docs/v1/getting-started/concepts.md +507 -0
- package/docs/v1/getting-started/installation.md +328 -0
- package/docs/v1/getting-started/quick-start.md +405 -0
- package/docs/v1/guides/address-component.md +431 -0
- package/docs/v1/guides/best-practices.md +324 -0
- package/docs/v1/guides/cart-component.md +737 -0
- package/docs/v1/guides/checkout-component.md +672 -0
- package/docs/v1/guides/events.md +191 -0
- package/docs/v1/guides/product-component.md +686 -0
- package/docs/v1/guides/product-list-component.md +598 -0
- package/docs/v1/guides/theming.md +216 -0
- package/docs/v1/integration/angular.md +39 -0
- package/docs/v1/integration/laravel.md +41 -0
- package/docs/v1/integration/nextjs.md +60 -0
- package/docs/v1/integration/proxy-setup.md +89 -0
- package/docs/v1/integration/react.md +64 -0
- package/docs/v1/integration/vanilla-js.md +84 -0
- package/docs/v1/integration/vue.md +34 -0
- package/docs/v1/reference/browser-support.md +35 -0
- package/docs/v1/reference/error-handling.md +70 -0
- package/docs/v1/reference/performance.md +54 -0
- package/docs/v1/reference/troubleshooting.md +64 -0
- package/package.json +19 -12
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +0 -37
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
- package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
- package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
- package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
- package/docs/ACTIONS.md +0 -1300
- package/docs/BROWSER_SUPPORT.md +0 -279
- package/docs/CONFIGURATION.md +0 -853
- package/docs/DOCUMENTATION_INDEX.md +0 -311
- package/docs/EVENTS.md +0 -798
- package/docs/PROXY.md +0 -228
- package/docs/THEMING.md +0 -592
- package/docs/TROUBLESHOOTING.md +0 -793
- package/umd/elements.js +0 -1
- /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
- /package/dist/types/{elements-builder-client.d.ts → clients/builder.d.ts} +0 -0
- /package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +0 -0
- /package/dist/types/{elements-client.d.ts → clients/main.d.ts} +0 -0
- /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
- /package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts → filter-components/product-list-checkbox-filter.d.ts} +0 -0
- /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Events Guide
|
|
2
|
+
|
|
3
|
+
The SDK publishes events for all user interactions and state changes.
|
|
4
|
+
|
|
5
|
+
## Event Format
|
|
6
|
+
|
|
7
|
+
All SDK events follow this pattern:
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
window.addEventListener('lce:actions.event_name', (event) => {
|
|
11
|
+
const {
|
|
12
|
+
namespace, // 'lce:actions'
|
|
13
|
+
event: eventName, // 'cart_item_added'
|
|
14
|
+
timestamp, // Unix timestamp
|
|
15
|
+
id, // Unique event ID
|
|
16
|
+
data // Event-specific data
|
|
17
|
+
} = event.detail;
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Event Namespaces
|
|
22
|
+
|
|
23
|
+
- `lce:actions.*` - User actions and state changes
|
|
24
|
+
- `lce:forms.*` - Form interactions (checkout)
|
|
25
|
+
|
|
26
|
+
## Core Events
|
|
27
|
+
|
|
28
|
+
### Client Ready
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
window.addEventListener('lce:actions.client_ready', (event) => {
|
|
32
|
+
const { isReady, version, timestamp } = event.detail.data;
|
|
33
|
+
console.log(`Elements SDK v${version} is ready`);
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Product Events
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
// Product loaded
|
|
41
|
+
window.addEventListener('lce:actions.product_loaded', (event) => {
|
|
42
|
+
const { identifier, name, price } = event.detail.data;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Add to cart clicked
|
|
46
|
+
window.addEventListener('lce:actions.product_add_to_cart', (event) => {
|
|
47
|
+
const { identifier, quantity, fulfillmentType } = event.detail.data;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Size changed
|
|
51
|
+
window.addEventListener('lce:actions.product_size_changed', (event) => {
|
|
52
|
+
const { identifier, selectedSize } = event.detail.data;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Fulfillment type changed
|
|
56
|
+
window.addEventListener('lce:actions.product_fulfillment_type_changed', (event) => {
|
|
57
|
+
const { identifier, fulfillmentType } = event.detail.data;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Retailer changed
|
|
61
|
+
window.addEventListener('lce:actions.product_fulfillment_changed', (event) => {
|
|
62
|
+
const { identifier, selectedRetailer } = event.detail.data;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Quantity changed
|
|
66
|
+
window.addEventListener('lce:actions.product_quantity_increase', (event) => {});
|
|
67
|
+
window.addEventListener('lce:actions.product_quantity_decrease', (event) => {});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Address Events
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
// Address set
|
|
74
|
+
window.addEventListener('lce:actions.address_updated', (event) => {
|
|
75
|
+
const { address, coordinates, formattedAddress } = event.detail.data;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Address cleared
|
|
79
|
+
window.addEventListener('lce:actions.address_cleared', (event) => {});
|
|
80
|
+
|
|
81
|
+
// Address error
|
|
82
|
+
window.addEventListener('lce:actions.address_failed', (event) => {
|
|
83
|
+
const { error } = event.detail.data;
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Cart Events
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
// Cart loaded
|
|
91
|
+
window.addEventListener('lce:actions.cart_loaded', (event) => {
|
|
92
|
+
const { cartId, itemsCount } = event.detail.data;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Cart opened/closed
|
|
96
|
+
window.addEventListener('lce:actions.cart_opened', (event) => {});
|
|
97
|
+
window.addEventListener('lce:actions.cart_closed', (event) => {});
|
|
98
|
+
|
|
99
|
+
// Cart updated
|
|
100
|
+
window.addEventListener('lce:actions.cart_updated', (event) => {
|
|
101
|
+
const { cartId, itemsCount, subtotal } = event.detail.data;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Item added/removed
|
|
105
|
+
window.addEventListener('lce:actions.cart_item_added', (event) => {});
|
|
106
|
+
window.addEventListener('lce:actions.cart_item_removed', (event) => {});
|
|
107
|
+
|
|
108
|
+
// Quantity changed
|
|
109
|
+
window.addEventListener('lce:actions.cart_item_quantity_increase', (event) => {});
|
|
110
|
+
window.addEventListener('lce:actions.cart_item_quantity_decrease', (event) => {});
|
|
111
|
+
|
|
112
|
+
// Promo code events
|
|
113
|
+
window.addEventListener('lce:actions.cart_promo_code_applied', (event) => {
|
|
114
|
+
const { discount, newSubtotal } = event.detail.data;
|
|
115
|
+
});
|
|
116
|
+
window.addEventListener('lce:actions.cart_promo_code_removed', (event) => {});
|
|
117
|
+
window.addEventListener('lce:actions.cart_promo_code_failed', (event) => {});
|
|
118
|
+
|
|
119
|
+
// Product add success/failure
|
|
120
|
+
window.addEventListener('lce:actions.cart_product_add_success', (event) => {
|
|
121
|
+
const { itemsAdded, identifiers } = event.detail.data;
|
|
122
|
+
});
|
|
123
|
+
window.addEventListener('lce:actions.cart_product_add_failed', (event) => {
|
|
124
|
+
const { error } = event.detail.data;
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Checkout Events
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
// Lifecycle
|
|
132
|
+
window.addEventListener('lce:actions.checkout_loaded', (event) => {});
|
|
133
|
+
window.addEventListener('lce:actions.checkout_opened', (event) => {});
|
|
134
|
+
window.addEventListener('lce:actions.checkout_closed', (event) => {});
|
|
135
|
+
|
|
136
|
+
// Form updates
|
|
137
|
+
window.addEventListener('lce:actions.checkout_customer_information_updated', (event) => {});
|
|
138
|
+
window.addEventListener('lce:actions.checkout_billing_information_updated', (event) => {});
|
|
139
|
+
window.addEventListener('lce:actions.checkout_gift_information_updated', (event) => {});
|
|
140
|
+
|
|
141
|
+
// Toggles
|
|
142
|
+
window.addEventListener('lce:actions.checkout_is_gift_toggled', (event) => {
|
|
143
|
+
const { isGift } = event.detail.data;
|
|
144
|
+
});
|
|
145
|
+
window.addEventListener('lce:actions.checkout_billing_same_as_shipping_toggled', (event) => {});
|
|
146
|
+
window.addEventListener('lce:actions.checkout_marketing_preferences_toggled', (event) => {});
|
|
147
|
+
|
|
148
|
+
// Submission
|
|
149
|
+
window.addEventListener('lce:actions.checkout_submit_started', (event) => {});
|
|
150
|
+
window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
|
|
151
|
+
const { orderId, total } = event.detail.data;
|
|
152
|
+
});
|
|
153
|
+
window.addEventListener('lce:actions.checkout_submit_failed', (event) => {
|
|
154
|
+
const { error } = event.detail.data;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Promo codes & gift cards
|
|
158
|
+
window.addEventListener('lce:actions.checkout_promo_code_applied', (event) => {});
|
|
159
|
+
window.addEventListener('lce:actions.checkout_gift_card_applied', (event) => {});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Use Cases
|
|
163
|
+
|
|
164
|
+
### Analytics Integration
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
// Track page views
|
|
168
|
+
window.addEventListener('lce:actions.product_loaded', (event) => {
|
|
169
|
+
gtag('event', 'view_item', {
|
|
170
|
+
items: [{
|
|
171
|
+
item_id: event.detail.data.identifier,
|
|
172
|
+
item_name: event.detail.data.name,
|
|
173
|
+
price: event.detail.data.price / 100
|
|
174
|
+
}]
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Track purchases
|
|
179
|
+
window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
|
|
180
|
+
gtag('event', 'purchase', {
|
|
181
|
+
transaction_id: event.detail.data.orderId,
|
|
182
|
+
value: event.detail.data.total / 100,
|
|
183
|
+
currency: 'USD'
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## See Also
|
|
189
|
+
|
|
190
|
+
- [Component Guides](../guides/)
|
|
191
|
+
- [Actions API](../api/actions/)
|