@liquidcommerce/elements-sdk 2.6.0-beta.7 → 2.6.0-beta.71
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 +16607 -0
- package/dist/index.esm.js +23556 -20638
- 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} +3 -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 +20 -18
- 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 +1 -0
- package/dist/types/core/google-tag-manager.service.d.ts +2 -1
- package/dist/types/core/logger/logger.service.d.ts +1 -1
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +27 -52
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +45 -51
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +9 -4
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -74
- 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 +3 -4
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
- package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
- 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 +13 -8
- package/dist/types/interfaces/api/checkout.interface.d.ts +239 -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 +10 -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 +4 -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 -4
- package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
- 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-add-to-cart-section.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-description.component.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-options.component.d.ts +2 -1
- 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 +49 -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 +6 -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/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 +427 -0
- package/docs/v1/api/actions/product-actions.md +158 -0
- package/docs/v1/api/client.md +495 -0
- package/docs/v1/api/configuration.md +528 -0
- package/docs/v1/api/injection-methods.md +261 -0
- package/docs/v1/api/typescript-types.md +398 -0
- package/docs/v1/api/ui-helpers.md +200 -0
- package/docs/v1/examples/advanced-patterns.md +198 -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 +353 -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 +507 -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 +136 -0
- package/package.json +31 -27
- 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/catalog.interface.d.ts +0 -42
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
- package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
- package/dist/types/interfaces/cloud/index.d.ts +0 -4
- 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 -4
- 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/utils/helper.d.ts +0 -28
- 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,261 @@
|
|
|
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
|
+
slug: string; // Product list slug identifier
|
|
130
|
+
rows?: number; // Default: 3
|
|
131
|
+
columns?: number; // Default: 4
|
|
132
|
+
filters?: ProductListFilterType[];
|
|
133
|
+
productUrl?: string; // URL pattern with {identifier}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Example
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
await client.injectProductList({
|
|
141
|
+
containerId: 'products',
|
|
142
|
+
slug: 'best-sellers',
|
|
143
|
+
rows: 4,
|
|
144
|
+
columns: 3,
|
|
145
|
+
filters: ['price', 'brands', 'categories'],
|
|
146
|
+
productUrl: '/product/{identifier}'
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## injectProductListSearch()
|
|
153
|
+
|
|
154
|
+
Inject product search box.
|
|
155
|
+
|
|
156
|
+
### Signature
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Parameters
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
interface IInjectProductListSearchParams {
|
|
166
|
+
containerId: string;
|
|
167
|
+
slug: string; // Product list slug identifier
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Example
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
await client.injectProductListSearch({
|
|
175
|
+
containerId: 'search-box',
|
|
176
|
+
slug: 'best-sellers'
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## injectProductListFilters()
|
|
183
|
+
|
|
184
|
+
Inject product filter panel.
|
|
185
|
+
|
|
186
|
+
### Signature
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Parameters
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
interface IInjectProductListFiltersParams {
|
|
196
|
+
containerId: string;
|
|
197
|
+
slug: string; // Product list slug identifier
|
|
198
|
+
filters?: ProductListFilterType[];
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Example
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
await client.injectProductListFilters({
|
|
206
|
+
containerId: 'filters',
|
|
207
|
+
slug: 'best-sellers',
|
|
208
|
+
filters: ['price', 'brands', 'fulfillment']
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Component Management
|
|
215
|
+
|
|
216
|
+
### getInjectedComponents()
|
|
217
|
+
|
|
218
|
+
Retrieve all injected components.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
getInjectedComponents(): Map<string, IInjectedComponent>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
const components = client.getInjectedComponents();
|
|
226
|
+
|
|
227
|
+
// Get specific component
|
|
228
|
+
const product = components.get('product-1');
|
|
229
|
+
|
|
230
|
+
// Rerender component
|
|
231
|
+
product.rerender();
|
|
232
|
+
|
|
233
|
+
// Get container element
|
|
234
|
+
const container = product.getElement();
|
|
235
|
+
|
|
236
|
+
// Get component type
|
|
237
|
+
const type = product.getType(); // 'product'
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### IInjectedComponent Interface
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
interface IInjectedComponent {
|
|
244
|
+
getType(): ComponentType;
|
|
245
|
+
getElement(): HTMLElement;
|
|
246
|
+
rerender(): void;
|
|
247
|
+
destroy(): void;
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
| Method | Returns | Description |
|
|
252
|
+
|--------|---------|-------------|
|
|
253
|
+
| `getType()` | `ComponentType` | Returns the type of the injected component |
|
|
254
|
+
| `getElement()` | `HTMLElement` | Returns the container element where the component is injected |
|
|
255
|
+
| `rerender()` | `void` | Re-renders the component with the latest data and configurations |
|
|
256
|
+
| `destroy()` | `void` | Removes the component from the DOM and cleans up internal tracking |
|
|
257
|
+
|
|
258
|
+
## See Also
|
|
259
|
+
|
|
260
|
+
- [Client API](./client.md)
|
|
261
|
+
- [Component Guides](../guides/)
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# TypeScript Types Reference
|
|
2
|
+
|
|
3
|
+
All public types are exported from the main package entry point. Import them using the `type` keyword for optimal tree-shaking.
|
|
4
|
+
|
|
5
|
+
## Importing Types
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Elements } from '@liquidcommerce/elements-sdk';
|
|
9
|
+
import type {
|
|
10
|
+
ILiquidCommerceElementsClient,
|
|
11
|
+
ILiquidCommerceElementsConfig,
|
|
12
|
+
IInjectProductElement,
|
|
13
|
+
IInjectedComponent
|
|
14
|
+
} from '@liquidcommerce/elements-sdk';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
For the checkout-only build:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
|
|
21
|
+
import type {
|
|
22
|
+
IElementsCheckoutClient,
|
|
23
|
+
IElementsCheckoutActions,
|
|
24
|
+
ILiquidCommerceElementsCheckoutClientConfig,
|
|
25
|
+
IInjectedComponent
|
|
26
|
+
} from '@liquidcommerce/elements-sdk/checkout';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Client Types
|
|
32
|
+
|
|
33
|
+
### ILiquidCommerceElementsClient
|
|
34
|
+
|
|
35
|
+
Main SDK client interface returned by `Elements()`.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
interface ILiquidCommerceElementsClient {
|
|
39
|
+
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
40
|
+
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
41
|
+
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
42
|
+
injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
43
|
+
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
44
|
+
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
45
|
+
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
46
|
+
ui: ILiquidCommerceElementsUIMethod;
|
|
47
|
+
actions: ILiquidCommerceElementsActions;
|
|
48
|
+
getInjectedComponents(): Map<string, IInjectedComponent>;
|
|
49
|
+
destroy(): void;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### ILiquidCommerceElementsBuilderClient
|
|
54
|
+
|
|
55
|
+
Builder-pattern client interface returned by `ElementsBuilder()`.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
interface ILiquidCommerceElementsBuilderClient {
|
|
59
|
+
updateComponentGlobalConfigs(configs: UpdateComponentGlobalConfigs): Promise<void>;
|
|
60
|
+
updateProductComponent(configs: UpdateProductComponent): Promise<void>;
|
|
61
|
+
updateAddressComponent(configs: UpdateAddressComponent): void;
|
|
62
|
+
updateCartComponent(configs: UpdateCartComponent): void;
|
|
63
|
+
updateCheckoutComponent(configs: UpdateCheckoutComponent): void;
|
|
64
|
+
updateProductListComponent(configs: UpdateProductListComponent): void;
|
|
65
|
+
injectElement(params: IBuilderInjectElementParams): Promise<IInjectedComponent | null>;
|
|
66
|
+
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
67
|
+
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
68
|
+
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
69
|
+
injectCheckoutElement(params: IInjectCheckoutBuilderParams): Promise<IInjectedComponent | null>;
|
|
70
|
+
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
71
|
+
actions: ILiquidCommerceElementsActions;
|
|
72
|
+
destroy(): void;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### IElementsCheckoutClient
|
|
77
|
+
|
|
78
|
+
Checkout-only client interface returned by `ElementsCheckout()`.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
interface IElementsCheckoutClient {
|
|
82
|
+
injectCheckout(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
83
|
+
actions: { checkout: IElementsCheckoutActions };
|
|
84
|
+
destroy(): void;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Configuration Types
|
|
91
|
+
|
|
92
|
+
### ILiquidCommerceElementsConfig
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
interface ILiquidCommerceElementsConfig {
|
|
96
|
+
env?: ElementsEnv;
|
|
97
|
+
promoTicker?: IPromoTicker[];
|
|
98
|
+
customTheme?: IClientCustomThemeConfig;
|
|
99
|
+
debugMode?: DebugMode;
|
|
100
|
+
checkout?: ILiquidCommerceElementsCheckoutConfig;
|
|
101
|
+
proxy?: IElementsProxyConfig;
|
|
102
|
+
development?: ILiquidCommerceElementsDevelopmentConfig;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### ILiquidCommerceElementsCheckoutClientConfig
|
|
107
|
+
|
|
108
|
+
Same shape as `ILiquidCommerceElementsConfig`, used for the checkout-only client.
|
|
109
|
+
|
|
110
|
+
### IClientCustomThemeConfig
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
interface IClientCustomThemeConfig {
|
|
114
|
+
global?: UpdateComponentGlobalConfigs;
|
|
115
|
+
product?: UpdateProductComponent;
|
|
116
|
+
address?: UpdateAddressComponent;
|
|
117
|
+
cart?: UpdateCartComponent;
|
|
118
|
+
checkout?: UpdateCheckoutComponent;
|
|
119
|
+
productList?: UpdateProductListComponent;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### IElementsProxyConfig
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
interface IElementsProxyConfig {
|
|
127
|
+
baseUrl: string;
|
|
128
|
+
headers?: Record<string, string>;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### ILiquidCommerceElementsDevelopmentConfig
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
interface ILiquidCommerceElementsDevelopmentConfig {
|
|
136
|
+
customApiUrl?: string;
|
|
137
|
+
paymentMethodId?: string;
|
|
138
|
+
openShadowDom?: boolean;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### ILiquidCommerceElementsCheckoutConfig
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
interface ILiquidCommerceElementsCheckoutConfig {
|
|
146
|
+
pageUrl?: string;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
See [Configuration Reference](./configuration.md) for detailed property descriptions.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Injection Types
|
|
155
|
+
|
|
156
|
+
### IInjectProductElement
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
interface IInjectProductElement {
|
|
160
|
+
containerId: string;
|
|
161
|
+
identifier: string;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### IInjectCheckoutParams
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
interface IInjectCheckoutParams {
|
|
169
|
+
containerId: string;
|
|
170
|
+
checkoutId?: string;
|
|
171
|
+
hideHeader?: boolean;
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### IInjectCheckoutBuilderParams
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
interface IInjectCheckoutBuilderParams extends IInjectCheckoutParams {
|
|
179
|
+
simulatePresale?: boolean;
|
|
180
|
+
presaleExpiresInMinutes?: number;
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### IInjectProductListParams
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface IInjectProductListParams {
|
|
188
|
+
containerId: string;
|
|
189
|
+
slug: string;
|
|
190
|
+
rows?: number;
|
|
191
|
+
columns?: number;
|
|
192
|
+
filters?: ProductListFilterType[];
|
|
193
|
+
productUrl?: string;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### IInjectProductListSearchParams
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
interface IInjectProductListSearchParams {
|
|
201
|
+
containerId: string;
|
|
202
|
+
slug: string;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### IInjectProductListFiltersParams
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
interface IInjectProductListFiltersParams {
|
|
210
|
+
containerId: string;
|
|
211
|
+
slug: string;
|
|
212
|
+
filters?: ProductListFilterType[];
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### IBuilderInjectElementParams
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
interface IBuilderInjectElementParams {
|
|
220
|
+
type: ComponentType;
|
|
221
|
+
containerId: string;
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Component Types
|
|
229
|
+
|
|
230
|
+
### IInjectedComponent
|
|
231
|
+
|
|
232
|
+
Returned by all injection methods. Provides control over the injected component.
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
interface IInjectedComponent {
|
|
236
|
+
getType(): ComponentType;
|
|
237
|
+
getElement(): HTMLElement;
|
|
238
|
+
rerender(): void;
|
|
239
|
+
destroy(): void;
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## UI Types
|
|
246
|
+
|
|
247
|
+
### ILiquidCommerceElementsUIMethod
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
interface ILiquidCommerceElementsUIMethod {
|
|
251
|
+
cartButton(containerId: string, showItemsCount?: boolean): void;
|
|
252
|
+
floatingCartButton(showItemsCount?: boolean): void;
|
|
253
|
+
cartSubtotal(elementId: string): void;
|
|
254
|
+
cartItemsCount(elementId: string, options?: { hideZero: boolean }): void;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Action Types
|
|
261
|
+
|
|
262
|
+
### ILiquidCommerceElementsActions
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
interface ILiquidCommerceElementsActions {
|
|
266
|
+
product: IProductActions;
|
|
267
|
+
address: IAddressActions;
|
|
268
|
+
cart: ICartActions;
|
|
269
|
+
checkout: ICheckoutActions;
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### IElementsCheckoutActions
|
|
274
|
+
|
|
275
|
+
Checkout actions available in the checkout-only client. Omits drawer-related methods.
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
interface IElementsCheckoutActions extends Omit<ICheckoutActions, 'openCheckout' | 'closeCheckout' | 'toggleCheckout'> {}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
See [Actions API](./actions/) for detailed method signatures.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Enum Types
|
|
286
|
+
|
|
287
|
+
### ElementsEnv
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
type ElementsEnv = 'development' | 'staging' | 'production';
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### DebugMode
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
type DebugMode = 'none' | 'console' | 'panel';
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### FulfillmentType
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
type FulfillmentType = 'onDemand' | 'shipping';
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### ComponentType
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
type ComponentType =
|
|
309
|
+
| 'address' | 'product' | 'cart' | 'checkout'
|
|
310
|
+
| 'product-list' | 'product-list-card' | 'product-list-filters' | 'product-list-search'
|
|
311
|
+
| 'drawer' | 'input' | 'engraving-form' | 'engraving-view'
|
|
312
|
+
| 'buttons-cart-open' | 'powered-by' | 'lce-element'
|
|
313
|
+
| 'purchase-min-alert' | 'alert' | 'promo-code-ticker'
|
|
314
|
+
// ...and additional internal component types
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### DisplayModeType
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
type DisplayModeType = 'modal' | 'drawer';
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Theme Configuration Types
|
|
326
|
+
|
|
327
|
+
### UpdateComponentGlobalConfigs
|
|
328
|
+
|
|
329
|
+
`DeepPartial<IComponentGlobalConfigs>` -- all properties optional.
|
|
330
|
+
|
|
331
|
+
### UpdateProductComponent
|
|
332
|
+
|
|
333
|
+
`DeepPartial<IProductComponent>` -- all properties optional.
|
|
334
|
+
|
|
335
|
+
### UpdateCartComponent
|
|
336
|
+
|
|
337
|
+
`DeepPartial<ICartComponent>` -- all properties optional.
|
|
338
|
+
|
|
339
|
+
### UpdateCheckoutComponent
|
|
340
|
+
|
|
341
|
+
`DeepPartial<ICheckoutComponent>` -- all properties optional.
|
|
342
|
+
|
|
343
|
+
### UpdateAddressComponent
|
|
344
|
+
|
|
345
|
+
`DeepPartial<IAddressComponent>` -- all properties optional.
|
|
346
|
+
|
|
347
|
+
### UpdateProductListComponent
|
|
348
|
+
|
|
349
|
+
Special structure for updating product list configuration by slug:
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
interface UpdateProductListComponent {
|
|
353
|
+
theme?: { backgroundColor?: string };
|
|
354
|
+
layout?: {
|
|
355
|
+
lists?: Record<string, DeepPartial<IPLCList>>;
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
See [Configuration Reference](./configuration.md) for detailed theme property descriptions.
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Promo Ticker Type
|
|
365
|
+
|
|
366
|
+
### IPromoTicker
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
interface IPromoTicker {
|
|
370
|
+
promoCode: string;
|
|
371
|
+
text: string[];
|
|
372
|
+
separator: string;
|
|
373
|
+
activeFrom: string; // ISO 8601 UTC
|
|
374
|
+
activeUntil: string; // ISO 8601 UTC
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Utility Types
|
|
381
|
+
|
|
382
|
+
### DeepPartial
|
|
383
|
+
|
|
384
|
+
Used internally for theme update types. Makes all properties in `T` recursively optional.
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
type DeepPartial<T> = {
|
|
388
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
389
|
+
};
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## See Also
|
|
395
|
+
|
|
396
|
+
- [Client API](./client.md) - Client initialization and usage
|
|
397
|
+
- [Configuration Reference](./configuration.md) - Detailed config options
|
|
398
|
+
- [Injection Methods](./injection-methods.md) - Component injection API
|