@liquidcommerce/elements-sdk 2.6.0-beta.6 → 2.6.0-beta.61
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 +16576 -0
- package/dist/index.esm.js +23632 -21083
- package/dist/ssr-stub.checkout.esm.js +18 -0
- package/dist/ssr-stub.esm.js +270 -0
- package/dist/types/auto-initialize/checkout.d.ts +2 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +46 -0
- package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +15 -2
- package/dist/types/clients/builder.d.ts +3 -0
- package/dist/types/clients/checkout.d.ts +6 -0
- package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +2 -1
- package/dist/types/clients/main.d.ts +3 -0
- package/dist/types/constants/core.constant.d.ts +2 -6
- package/dist/types/core/api/api-client.service.d.ts +21 -20
- package/dist/types/core/api/api-result.d.ts +19 -0
- package/dist/types/core/api/auth-client.service.d.ts +40 -13
- package/dist/types/core/api/http-client.service.d.ts +0 -1
- package/dist/types/core/base-component.service.d.ts +2 -1
- 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 +56 -0
- package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
- package/dist/types/core/client/client-action.service.d.ts +6 -70
- package/dist/types/core/client/client-config.service.d.ts +8 -2
- package/dist/types/core/command/common-command.service.d.ts +2 -1
- package/dist/types/core/google-tag-manager.service.d.ts +4 -1
- package/dist/types/core/logger/logger.service.d.ts +1 -1
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +27 -64
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +45 -50
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +9 -4
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -75
- package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
- package/dist/types/core/singleton-manager.service.d.ts +12 -8
- package/dist/types/core/store/interfaces/cart.interface.d.ts +16 -56
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
- package/dist/types/core/store/interfaces/core.interface.d.ts +14 -3
- package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
- package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
- package/dist/types/core/store/store.constant.d.ts +5 -0
- package/dist/types/core/store/store.service.d.ts +1 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +39 -1
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/index.checkout.d.ts +8 -0
- package/dist/types/index.checkout.umd.d.ts +4 -0
- package/dist/types/index.d.ts +8 -3
- package/dist/types/interfaces/api/cart.interface.d.ts +95 -0
- package/dist/types/interfaces/api/checkout.interface.d.ts +238 -0
- package/dist/types/interfaces/api/index.d.ts +5 -0
- package/dist/types/interfaces/api/product-list.interface.d.ts +39 -0
- package/dist/types/interfaces/api/product.interface.d.ts +9 -4
- package/dist/types/interfaces/client.interface.d.ts +72 -0
- package/dist/types/interfaces/component.interface.d.ts +7 -0
- package/dist/types/interfaces/config.interface.d.ts +41 -0
- package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
- package/dist/types/interfaces/configs/global.interface.d.ts +5 -3
- package/dist/types/interfaces/configs/index.d.ts +1 -0
- package/dist/types/interfaces/configs/product-list.interface.d.ts +47 -0
- package/dist/types/interfaces/configs/product.interface.d.ts +2 -1
- package/dist/types/interfaces/injection.interface.d.ts +47 -0
- package/dist/types/modules/address/address.command.d.ts +2 -1
- package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/cart/cart.commands.d.ts +4 -5
- package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
- package/dist/types/modules/cart/components/cart-footer.component.d.ts +0 -1
- package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +0 -2
- package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +23 -9
- package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +3 -0
- package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
- package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
- package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
- package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
- package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
- package/dist/types/modules/checkout/constant.d.ts +3 -0
- package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +5 -2
- package/dist/types/modules/product/product.commands.d.ts +2 -3
- package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/index.d.ts +5 -0
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
- package/dist/types/modules/product-list/components/card-components/product-button.d.ts +9 -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 +9 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +13 -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 +7 -0
- package/dist/types/modules/product-list/components/index.d.ts +6 -2
- 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-card.component.d.ts +27 -30
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +55 -36
- package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +47 -0
- package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-search.component.d.ts → product-list-search.component.d.ts} +11 -4
- package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +23 -8
- package/dist/types/modules/product-list/product-list.component.d.ts +10 -45
- package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
- package/dist/types/modules/product-list/product-list.interface.d.ts +20 -35
- 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 -2
- package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +6 -1
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +5 -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/lce-element/lce-element.component.d.ts +2 -1
- package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
- package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +0 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +5 -1
- package/dist/types/ssr/stub.checkout.d.ts +6 -0
- package/dist/types/ssr/stub.d.ts +10 -0
- package/dist/types/static/icon/check.icon.d.ts +2 -0
- package/dist/types/static/icon/index.d.ts +1 -0
- package/dist/types/utils/dom-compat.d.ts +2 -0
- package/dist/types/utils/format.d.ts +0 -14
- package/dist/types/utils/product-selection.d.ts +16 -0
- package/dist/types/utils/product.d.ts +10 -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 +926 -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 +69 -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 +58 -0
- package/docs/v1/reference/browser-support.md +44 -0
- package/docs/v1/reference/error-handling.md +70 -0
- package/docs/v1/reference/performance.md +54 -0
- package/docs/v1/reference/troubleshooting.md +72 -0
- package/package.json +28 -17
- package/dist/types/elements-builder-client.d.ts +0 -2
- package/dist/types/elements-client.d.ts +0 -2
- package/dist/types/enums/cloud.enum.d.ts +0 -106
- package/dist/types/interfaces/cloud/cart.interface.d.ts +0 -132
- package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -42
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -211
- package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
- package/dist/types/interfaces/cloud/index.d.ts +0 -5
- package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
- package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
- package/dist/types/interfaces/core.interface.d.ts +0 -111
- package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -9
- package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
- 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-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/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +0 -7
- package/dist/types/utils/helper.d.ts +0 -27
- 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/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,247 @@
|
|
|
1
|
+
# Injection Methods API
|
|
2
|
+
|
|
3
|
+
Methods for injecting SDK components into your page.
|
|
4
|
+
|
|
5
|
+
## injectProductElement()
|
|
6
|
+
|
|
7
|
+
Inject one or more product displays.
|
|
8
|
+
|
|
9
|
+
### Signature
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Parameters
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
interface IInjectProductElement {
|
|
19
|
+
containerId: string; // ID of container element
|
|
20
|
+
identifier: string; // Product Identifier
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Example
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
await client.injectProductElement([
|
|
28
|
+
{ containerId: 'product-1', identifier: '00619947000020' },
|
|
29
|
+
{ containerId: 'product-2', identifier: '08504405135' }
|
|
30
|
+
]);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Returns
|
|
34
|
+
|
|
35
|
+
Array of injected component objects.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## injectAddressElement()
|
|
40
|
+
|
|
41
|
+
Inject standalone address component.
|
|
42
|
+
|
|
43
|
+
### Signature
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
injectAddressElement(
|
|
47
|
+
containerId: string,
|
|
48
|
+
options?: IAddressOptions
|
|
49
|
+
): Promise<IInjectedComponent | null>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
await client.injectAddressElement('address-container', {
|
|
56
|
+
onAddressSet: (address) => {
|
|
57
|
+
console.log('Address set:', address);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## injectCartElement()
|
|
65
|
+
|
|
66
|
+
Inject standalone cart (rarely needed - cart drawer is automatic).
|
|
67
|
+
|
|
68
|
+
### Signature
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
injectCartElement(containerId: string): Promise<IInjectedComponent | null>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Example
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
await client.injectCartElement('cart-container');
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## injectCheckoutElement()
|
|
83
|
+
|
|
84
|
+
Inject hosted checkout page.
|
|
85
|
+
|
|
86
|
+
### Signature
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Parameters
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
interface IInjectCheckoutParams {
|
|
96
|
+
containerId: string;
|
|
97
|
+
checkoutId?: string; // Optional checkout token to load
|
|
98
|
+
hideHeader?: boolean; // Hide checkout header
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Example
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
await client.injectCheckoutElement({
|
|
106
|
+
containerId: 'checkout',
|
|
107
|
+
checkoutId: 'cart_abc123',
|
|
108
|
+
hideHeader: false
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## injectProductList()
|
|
115
|
+
|
|
116
|
+
Inject product catalog/listing.
|
|
117
|
+
|
|
118
|
+
### Signature
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
injectProductList(params: IInjectProductListParams): Promise<void>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Parameters
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
interface IInjectProductListParams {
|
|
128
|
+
containerId: string;
|
|
129
|
+
rows?: number; // Default: 3
|
|
130
|
+
columns?: number; // Default: 4
|
|
131
|
+
filters?: ProductListFilterType[];
|
|
132
|
+
productUrl?: string; // URL pattern with {identifier}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Example
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
await client.injectProductList({
|
|
140
|
+
containerId: 'products',
|
|
141
|
+
rows: 4,
|
|
142
|
+
columns: 3,
|
|
143
|
+
filters: ['price', 'brand', 'category'],
|
|
144
|
+
productUrl: '/product/{identifier}'
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## injectProductListSearch()
|
|
151
|
+
|
|
152
|
+
Inject product search box.
|
|
153
|
+
|
|
154
|
+
### Signature
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Parameters
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
interface IInjectProductListSearchParams {
|
|
164
|
+
containerId: string;
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Example
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
await client.injectProductListSearch({
|
|
172
|
+
containerId: 'search-box'
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## injectProductListFilters()
|
|
179
|
+
|
|
180
|
+
Inject product filter panel.
|
|
181
|
+
|
|
182
|
+
### Signature
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Parameters
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
interface IInjectProductListFiltersParams {
|
|
192
|
+
containerId: string;
|
|
193
|
+
filters: ProductListFilterType[];
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Example
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
await client.injectProductListFilters({
|
|
201
|
+
containerId: 'filters',
|
|
202
|
+
filters: ['price', 'brand', 'fulfillment']
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Component Management
|
|
209
|
+
|
|
210
|
+
### getInjectedComponents()
|
|
211
|
+
|
|
212
|
+
Retrieve all injected components.
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
getInjectedComponents(): Map<string, IInjectedComponent>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
const components = client.getInjectedComponents();
|
|
220
|
+
|
|
221
|
+
// Get specific component
|
|
222
|
+
const product = components.get('product-1');
|
|
223
|
+
|
|
224
|
+
// Rerender component
|
|
225
|
+
product.rerender();
|
|
226
|
+
|
|
227
|
+
// Get container element
|
|
228
|
+
const container = product.getElement();
|
|
229
|
+
|
|
230
|
+
// Get component type
|
|
231
|
+
const type = product.getType(); // 'product'
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### IInjectedComponent Interface
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
interface IInjectedComponent {
|
|
238
|
+
getType(): ComponentType;
|
|
239
|
+
getElement(): HTMLElement;
|
|
240
|
+
rerender(): void;
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## See Also
|
|
245
|
+
|
|
246
|
+
- [Client API](./client.md)
|
|
247
|
+
- [Component Guides](../guides/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
to be created...
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# UI Helpers API
|
|
2
|
+
|
|
3
|
+
UI helper methods for creating cart buttons and displaying cart information.
|
|
4
|
+
|
|
5
|
+
## ui.cartButton()
|
|
6
|
+
|
|
7
|
+
Create a cart button in a specific container.
|
|
8
|
+
|
|
9
|
+
### Signature
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
cartButton(containerId: string, showItemsCount?: boolean): void
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Required | Description |
|
|
18
|
+
|-----------|------|----------|-------------|
|
|
19
|
+
| `containerId` | string | Yes | ID of container element |
|
|
20
|
+
| `showItemsCount` | boolean | No | Show item count badge (default: false) |
|
|
21
|
+
|
|
22
|
+
### Example
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
// Simple cart button
|
|
26
|
+
window.LiquidCommerce.elements.ui.cartButton('header-cart');
|
|
27
|
+
|
|
28
|
+
// Cart button with item count badge
|
|
29
|
+
window.LiquidCommerce.elements.ui.cartButton('header-cart', true);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## ui.floatingCartButton()
|
|
35
|
+
|
|
36
|
+
Create a floating cart button (bottom-right corner).
|
|
37
|
+
|
|
38
|
+
### Signature
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
floatingCartButton(showItemsCount?: boolean): void
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Parameters
|
|
45
|
+
|
|
46
|
+
| Parameter | Type | Required | Description |
|
|
47
|
+
|-----------|------|----------|-------------|
|
|
48
|
+
| `showItemsCount` | boolean | No | Show item count badge (default: false) |
|
|
49
|
+
|
|
50
|
+
### Example
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Floating button without badge
|
|
54
|
+
window.LiquidCommerce.elements.ui.floatingCartButton();
|
|
55
|
+
|
|
56
|
+
// Floating button with badge
|
|
57
|
+
window.LiquidCommerce.elements.ui.floatingCartButton(true);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## ui.cartSubtotal()
|
|
63
|
+
|
|
64
|
+
Display cart subtotal in an element.
|
|
65
|
+
|
|
66
|
+
### Signature
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
cartSubtotal(elementId: string): void
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Parameters
|
|
73
|
+
|
|
74
|
+
| Parameter | Type | Required | Description |
|
|
75
|
+
|-----------|------|----------|-------------|
|
|
76
|
+
| `elementId` | string | Yes | ID of element to update |
|
|
77
|
+
|
|
78
|
+
### Example
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<div>Total: <span id="cart-total"></span></div>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
window.LiquidCommerce.elements.ui.cartSubtotal('cart-total');
|
|
86
|
+
// Element now shows: "$49.99"
|
|
87
|
+
// Updates automatically when cart changes
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## ui.cartItemsCount()
|
|
93
|
+
|
|
94
|
+
Display number of items in cart.
|
|
95
|
+
|
|
96
|
+
### Signature
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
cartItemsCount(elementId: string, options?: { hideZero: boolean }): void
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Parameters
|
|
103
|
+
|
|
104
|
+
| Parameter | Type | Required | Description |
|
|
105
|
+
|-----------|------|----------|-------------|
|
|
106
|
+
| `elementId` | string | Yes | ID of element to update |
|
|
107
|
+
| `options.hideZero` | boolean | No | Hide when cart is empty (default: true) |
|
|
108
|
+
|
|
109
|
+
### Example
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<div>Cart (<span id="items-count"></span>)</div>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
// Hide when cart is empty
|
|
117
|
+
window.LiquidCommerce.elements.ui.cartItemsCount('items-count', { hideZero: true });
|
|
118
|
+
|
|
119
|
+
// Always show count (even "0")
|
|
120
|
+
window.LiquidCommerce.elements.ui.cartItemsCount('items-count', { hideZero: false });
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Use Cases
|
|
124
|
+
|
|
125
|
+
### Header Cart Button
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<header>
|
|
129
|
+
<nav>
|
|
130
|
+
<a href="/">Home</a>
|
|
131
|
+
<a href="/products">Products</a>
|
|
132
|
+
<div id="cart-btn"></div>
|
|
133
|
+
</nav>
|
|
134
|
+
</header>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
window.addEventListener('lce:actions.client_ready', () => {
|
|
138
|
+
window.LiquidCommerce.elements.ui.cartButton('cart-btn', true);
|
|
139
|
+
});
|
|
140
|
+
</script>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Cart Summary Widget
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<aside class="cart-summary">
|
|
147
|
+
<h3>Your Cart</h3>
|
|
148
|
+
<p>Items: <span id="item-count"></span></p>
|
|
149
|
+
<p>Total: <span id="cart-total"></span></p>
|
|
150
|
+
</aside>
|
|
151
|
+
|
|
152
|
+
<script>
|
|
153
|
+
window.addEventListener('lce:actions.client_ready', () => {
|
|
154
|
+
window.LiquidCommerce.elements.ui.cartItemsCount('item-count');
|
|
155
|
+
window.LiquidCommerce.elements.ui.cartSubtotal('cart-total');
|
|
156
|
+
});
|
|
157
|
+
</script>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Floating Cart for Mobile
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
// Show floating button only on mobile
|
|
164
|
+
if (window.innerWidth < 768) {
|
|
165
|
+
window.LiquidCommerce.elements.ui.floatingCartButton(true);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Styling
|
|
170
|
+
|
|
171
|
+
Cart buttons and UI elements can be styled with CSS:
|
|
172
|
+
|
|
173
|
+
```css
|
|
174
|
+
/* Cart button container */
|
|
175
|
+
.lce-cart-desktop-button-container {
|
|
176
|
+
/* Your styles */
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Cart items count */
|
|
180
|
+
.lce-cart-items-count {
|
|
181
|
+
font-weight: bold;
|
|
182
|
+
color: #007bff;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* When cart is empty */
|
|
186
|
+
.lce-cart-items-count.no-items {
|
|
187
|
+
opacity: 0.5;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Cart subtotal */
|
|
191
|
+
.lce-cart-subtotal {
|
|
192
|
+
font-size: 1.2em;
|
|
193
|
+
font-weight: bold;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## See Also
|
|
198
|
+
|
|
199
|
+
- [Cart Component Guide](../guides/cart-component.md)
|
|
200
|
+
- [Cart Actions](./actions/cart-actions.md)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Advanced Patterns
|
|
2
|
+
|
|
3
|
+
A collection of common production patterns using events, programmatic injection, address prefill, and checkout redirects.
|
|
4
|
+
|
|
5
|
+
## 1) Dynamic Product Injection
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import { Elements } from '@liquidcommerce/elements-sdk';
|
|
9
|
+
|
|
10
|
+
const client = await Elements('YOUR_API_KEY', { env: 'production' });
|
|
11
|
+
|
|
12
|
+
const products = ['00619947000020', '08504405135', '08068660001'];
|
|
13
|
+
|
|
14
|
+
await client.injectProductElement(
|
|
15
|
+
products.map((identifier, index) => ({
|
|
16
|
+
containerId: `product-${index}`,
|
|
17
|
+
identifier
|
|
18
|
+
}))
|
|
19
|
+
);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2) Pre-Set Address (Skip Prompt)
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
await window.LiquidCommerce.elements.actions.address.setAddressManually(
|
|
26
|
+
{
|
|
27
|
+
one: '123 Main St',
|
|
28
|
+
two: 'Apt 4',
|
|
29
|
+
city: 'New York',
|
|
30
|
+
state: 'NY',
|
|
31
|
+
zip: '10001'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
latitude: 40.7128,
|
|
35
|
+
longitude: -74.0060
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 3) Custom Cart Button
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<button data-lce-cart-toggle-button>
|
|
44
|
+
View Cart
|
|
45
|
+
</button>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 4) Analytics With Events
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
window.addEventListener('lce:actions.product_loaded', (event) => {
|
|
52
|
+
const { identifier, name, price } = event.detail.data;
|
|
53
|
+
gtag('event', 'view_item', {
|
|
54
|
+
items: [{ item_id: identifier, item_name: name, price: price / 100 }]
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
|
|
59
|
+
const { orderId, total } = event.detail.data;
|
|
60
|
+
gtag('event', 'purchase', {
|
|
61
|
+
transaction_id: orderId,
|
|
62
|
+
value: total / 100,
|
|
63
|
+
currency: 'USD'
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 5) Redirect Checkout to Your Page
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
const client = await Elements('YOUR_API_KEY', {
|
|
72
|
+
env: 'production',
|
|
73
|
+
checkout: {
|
|
74
|
+
pageUrl: 'https://yoursite.com/checkout?lce_checkout={token}'
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 6) Debugging Helpers
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
const client = await Elements('YOUR_API_KEY', {
|
|
83
|
+
env: 'production',
|
|
84
|
+
debugMode: 'console',
|
|
85
|
+
development: {
|
|
86
|
+
openShadowDom: true
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Related Docs
|
|
92
|
+
|
|
93
|
+
- [Events Guide](../guides/events.md)
|
|
94
|
+
- [Product Component](../guides/product-component.md)
|
|
95
|
+
- [Checkout Component](../guides/checkout-component.md)
|
|
96
|
+
- [Client API](../api/client.md)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Complete Checkout Flow
|
|
2
|
+
|
|
3
|
+
A two-page setup: a product page that adds to cart and redirects to a dedicated checkout page.
|
|
4
|
+
|
|
5
|
+
## What You'll Build
|
|
6
|
+
|
|
7
|
+
- Product page with cart and checkout redirect
|
|
8
|
+
- Dedicated checkout page that loads by URL parameter
|
|
9
|
+
|
|
10
|
+
## Page 1: Product Page
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<!DOCTYPE html>
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<head>
|
|
16
|
+
<meta charset="UTF-8" />
|
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
18
|
+
<title>Product Page</title>
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
defer
|
|
22
|
+
data-liquid-commerce-elements
|
|
23
|
+
data-token="YOUR_API_KEY"
|
|
24
|
+
data-env="production"
|
|
25
|
+
data-container-1="product"
|
|
26
|
+
data-product-1="00619947000020"
|
|
27
|
+
data-cart-badge-button="header-cart"
|
|
28
|
+
data-checkout-url="https://yoursite.com/checkout?lce_checkout={token}"
|
|
29
|
+
type="text/javascript"
|
|
30
|
+
src="https://assets-elements.liquidcommerce.us/all/elements.js"
|
|
31
|
+
></script>
|
|
32
|
+
</head>
|
|
33
|
+
<body>
|
|
34
|
+
<header>
|
|
35
|
+
<h1>Premium Spirits</h1>
|
|
36
|
+
<div id="header-cart"></div>
|
|
37
|
+
</header>
|
|
38
|
+
|
|
39
|
+
<main>
|
|
40
|
+
<div id="product"></div>
|
|
41
|
+
</main>
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
When users click checkout, the cart redirects to your hosted checkout page with a `lce_checkout` ID in the URL.
|
|
47
|
+
|
|
48
|
+
## Page 2: Checkout Page
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<!DOCTYPE html>
|
|
52
|
+
<html lang="en">
|
|
53
|
+
<head>
|
|
54
|
+
<meta charset="UTF-8" />
|
|
55
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
56
|
+
<title>Checkout</title>
|
|
57
|
+
|
|
58
|
+
<script
|
|
59
|
+
defer
|
|
60
|
+
data-liquid-commerce-elements
|
|
61
|
+
data-token="YOUR_API_KEY"
|
|
62
|
+
data-env="production"
|
|
63
|
+
data-checkout-container="checkout"
|
|
64
|
+
data-checkout-param="lce_checkout"
|
|
65
|
+
type="text/javascript"
|
|
66
|
+
src="https://assets-elements.liquidcommerce.us/all/elements.js"
|
|
67
|
+
></script>
|
|
68
|
+
</head>
|
|
69
|
+
<body>
|
|
70
|
+
<div id="checkout"></div>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Optional: Skip Cart and Go Directly to Checkout
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
await window.LiquidCommerce.elements.actions.checkout.addProduct([
|
|
79
|
+
{
|
|
80
|
+
identifier: '00619947000020',
|
|
81
|
+
fulfillmentType: 'shipping',
|
|
82
|
+
quantity: 1
|
|
83
|
+
}
|
|
84
|
+
], true);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Related Docs
|
|
88
|
+
|
|
89
|
+
- [Checkout Component](../guides/checkout-component.md)
|
|
90
|
+
- [Cart Component](../guides/cart-component.md)
|
|
91
|
+
- [Client API](../api/client.md)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Custom Theming
|
|
2
|
+
|
|
3
|
+
Apply a branded theme across product, cart, and checkout components using `customTheme`.
|
|
4
|
+
|
|
5
|
+
## Example (NPM)
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import { Elements } from '@liquidcommerce/elements-sdk';
|
|
9
|
+
|
|
10
|
+
const client = await Elements('YOUR_API_KEY', {
|
|
11
|
+
env: 'production',
|
|
12
|
+
customTheme: {
|
|
13
|
+
global: {
|
|
14
|
+
theme: {
|
|
15
|
+
primaryColor: '#1f4f91',
|
|
16
|
+
accentColor: '#f39c12',
|
|
17
|
+
defaultTextColor: '#1c1c1c',
|
|
18
|
+
buttonCornerRadius: '10px',
|
|
19
|
+
cardCornerRadius: '14px',
|
|
20
|
+
headingFont: {
|
|
21
|
+
name: 'Poppins',
|
|
22
|
+
weights: [400, 600, 700]
|
|
23
|
+
},
|
|
24
|
+
paragraphFont: {
|
|
25
|
+
name: 'Inter',
|
|
26
|
+
weights: [400, 500]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
layout: {
|
|
30
|
+
allowPromoCodes: true,
|
|
31
|
+
inputFieldStyle: 'outlined',
|
|
32
|
+
showPoweredBy: false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
product: {
|
|
36
|
+
layout: {
|
|
37
|
+
addToCartButtonText: 'Add to Bag',
|
|
38
|
+
fulfillmentDisplay: 'popup',
|
|
39
|
+
showOnlyMainImage: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
cart: {
|
|
43
|
+
layout: {
|
|
44
|
+
drawerHeaderText: 'Your Cart',
|
|
45
|
+
goToCheckoutButtonText: 'Checkout Now'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
checkout: {
|
|
49
|
+
layout: {
|
|
50
|
+
placeOrderButtonText: 'Place Order',
|
|
51
|
+
exitUrl: 'https://yoursite.com/shop'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> If you use custom fonts, make sure the font is available on the page.
|
|
59
|
+
|
|
60
|
+
## Related Docs
|
|
61
|
+
|
|
62
|
+
- [Theming Guide](../guides/theming.md)
|
|
63
|
+
- [Configuration Reference](../api/configuration.md)
|