@liquidcommerce/elements-sdk 2.7.1 → 2.7.3

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.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/dist/index.checkout.esm.js +6788 -6890
  3. package/dist/index.esm.js +10440 -10643
  4. package/dist/ssr-stub.checkout.esm.js +18 -0
  5. package/dist/ssr-stub.esm.js +270 -0
  6. package/dist/types/auto-initialize/shared-utils.d.ts +3 -1
  7. package/dist/types/clients/base.d.ts +6 -4
  8. package/dist/types/clients/builder.d.ts +2 -1
  9. package/dist/types/clients/checkout.d.ts +2 -10
  10. package/dist/types/clients/main.d.ts +2 -1
  11. package/dist/types/constants/core.constant.d.ts +0 -5
  12. package/dist/types/core/api/api-client.service.d.ts +16 -15
  13. package/dist/types/core/api/api-result.d.ts +19 -0
  14. package/dist/types/core/api/auth-client.service.d.ts +13 -5
  15. package/dist/types/core/base-component.service.d.ts +2 -1
  16. package/dist/types/core/client/client-action.service.d.ts +1 -1
  17. package/dist/types/core/client/client-config.service.d.ts +1 -1
  18. package/dist/types/core/pubsub/pubsub.service.d.ts +0 -2
  19. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  20. package/dist/types/core/store/interfaces/core.interface.d.ts +7 -11
  21. package/dist/types/core/store/interfaces/product-list.interface.d.ts +12 -28
  22. package/dist/types/core/store/store.service.d.ts +1 -0
  23. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  24. package/dist/types/enums/core.enum.d.ts +5 -4
  25. package/dist/types/index.checkout.d.ts +3 -2
  26. package/dist/types/index.checkout.umd.d.ts +1 -1
  27. package/dist/types/index.d.ts +4 -1
  28. package/dist/types/interfaces/client.interface.d.ts +72 -0
  29. package/dist/types/interfaces/component.interface.d.ts +7 -0
  30. package/dist/types/interfaces/config.interface.d.ts +46 -0
  31. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  32. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  33. package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
  34. package/dist/types/interfaces/configs/global.interface.d.ts +1 -1
  35. package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -1
  36. package/dist/types/interfaces/configs/product.interface.d.ts +1 -1
  37. package/dist/types/interfaces/injection.interface.d.ts +44 -0
  38. package/dist/types/modules/address/address-input.component.d.ts +0 -11
  39. package/dist/types/modules/address/address.command.d.ts +1 -1
  40. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +1 -0
  41. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  42. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
  43. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
  44. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +3 -2
  45. package/dist/types/modules/product/product.commands.d.ts +1 -3
  46. package/dist/types/modules/product-list/components/card-components/index.d.ts +0 -2
  47. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +1 -0
  48. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -3
  49. package/dist/types/modules/product-list/components/index.d.ts +1 -1
  50. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +2 -5
  51. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +3 -3
  52. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +21 -0
  53. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +30 -14
  54. package/dist/types/modules/product-list/components/product-list-search.component.d.ts +0 -2
  55. package/dist/types/modules/product-list/product-list-card.component.d.ts +18 -16
  56. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
  57. package/dist/types/modules/product-list/product-list.commands.d.ts +7 -54
  58. package/dist/types/modules/product-list/product-list.component.d.ts +2 -11
  59. package/dist/types/modules/product-list/product-list.interface.d.ts +0 -30
  60. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
  61. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -10
  62. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -1
  63. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  64. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  65. package/dist/types/modules/ui-components/ui.commands.d.ts +6 -4
  66. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  67. package/dist/types/ssr/stub.d.ts +10 -0
  68. package/dist/types/utils/dom-compat.d.ts +2 -0
  69. package/dist/types/utils/product-selection.d.ts +16 -0
  70. package/dist/types/utils/product.d.ts +10 -0
  71. package/docs/v1/README.md +2 -2
  72. package/docs/v1/api/actions/address-actions.md +11 -11
  73. package/docs/v1/api/actions/cart-actions.md +13 -13
  74. package/docs/v1/api/actions/checkout-actions.md +23 -23
  75. package/docs/v1/api/actions/product-actions.md +6 -6
  76. package/docs/v1/api/client.md +11 -11
  77. package/docs/v1/api/ui-helpers.md +11 -11
  78. package/docs/v1/examples/advanced-patterns.md +1 -1
  79. package/docs/v1/examples/checkout-flow.md +1 -1
  80. package/docs/v1/getting-started/concepts.md +7 -7
  81. package/docs/v1/getting-started/installation.md +2 -2
  82. package/docs/v1/getting-started/quick-start.md +3 -3
  83. package/docs/v1/guides/address-component.md +11 -11
  84. package/docs/v1/guides/best-practices.md +14 -14
  85. package/docs/v1/guides/cart-component.md +23 -23
  86. package/docs/v1/guides/checkout-component.md +24 -24
  87. package/docs/v1/guides/events.md +812 -77
  88. package/docs/v1/guides/product-component.md +5 -5
  89. package/docs/v1/integration/nextjs.md +11 -2
  90. package/docs/v1/integration/react.md +3 -3
  91. package/docs/v1/integration/vanilla-js.md +1 -1
  92. package/docs/v1/integration/vue.md +24 -0
  93. package/docs/v1/reference/browser-support.md +9 -0
  94. package/docs/v1/reference/error-handling.md +2 -2
  95. package/docs/v1/reference/troubleshooting.md +10 -2
  96. package/package.json +17 -13
  97. package/dist/types/interfaces/core.interface.d.ts +0 -139
  98. package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +0 -12
  99. package/dist/types/modules/product-list/components/card-components/product-title.d.ts +0 -6
  100. package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +0 -26
  101. package/dist/types/modules/ui-components/modal/modal.component.d.ts +0 -23
  102. package/dist/types/modules/ui-components/styles/modal.style.d.ts +0 -1
  103. package/docs/gitbook/actions.md +0 -160
  104. package/docs/gitbook/address.md +0 -48
  105. package/docs/gitbook/cart.md +0 -65
  106. package/docs/gitbook/checkout.md +0 -131
  107. package/docs/gitbook/events.md +0 -137
  108. package/docs/gitbook/overview.md +0 -166
  109. package/docs/gitbook/product.md +0 -64
  110. package/docs/gitbook/quick-start-guide.md +0 -393
@@ -1,393 +0,0 @@
1
- # Quick Start Guide (Auto-Setup)
2
-
3
- Most partners use the auto-setup approach because it is the fastest path to production. This guide covers the full data-attribute setup and all supported combinations.
4
-
5
- ## 1) Main script tag
6
- The main SDK auto-initializes when it finds a script tag with `data-liquid-commerce-elements`.
7
-
8
- ```html
9
- <script
10
- defer
11
- data-liquid-commerce-elements
12
- data-token="YOUR_API_KEY"
13
- data-env="production"
14
- type="text/javascript"
15
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
16
- ></script>
17
- ```
18
-
19
- ### Core configuration
20
- **Attribute:** `data-liquid-commerce-elements`
21
- Marks the script tag for auto-initialization.
22
-
23
- **Attribute:** `data-token` (required)
24
- Your API key.
25
-
26
- **Attribute:** `data-env` (optional)
27
- `development`, `staging`, or `production` (default: `production`).
28
-
29
- ## 2) Product injection options
30
- You can inject products in three different ways. All can be used together.
31
-
32
- ### A) Paired attributes on the main script tag
33
- Use `data-product-*` with `data-container-*` pairs.
34
-
35
- **Attribute:** `data-product-*` + `data-container-*`
36
- Pairs product identifiers to container IDs by matching the numeric suffix.
37
-
38
- ```html
39
- <script
40
- defer
41
- data-liquid-commerce-elements
42
- data-token="YOUR_API_KEY"
43
- data-env="production"
44
- data-container-1="product-1"
45
- data-product-1="00619947000020"
46
- data-container-2="product-2"
47
- data-product-2="08504405135"
48
- type="text/javascript"
49
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
50
- ></script>
51
-
52
- <div id="product-1"></div>
53
- <div id="product-2"></div>
54
- ```
55
-
56
- ### B) Attributed product elements
57
- Any `div` with `data-lce-product` is treated as a product container.
58
-
59
- **Attribute:** `data-lce-product`
60
- Injects a product into the element and auto-generates a container ID.
61
-
62
- ```html
63
- <div data-lce-product="00619947000020"></div>
64
- <div data-lce-product="08504405135"></div>
65
- ```
66
-
67
- The SDK auto-generates unique container IDs for these elements.
68
-
69
- ### C) JSON script tag
70
- Provide an array of objects with `containerId` and `identifier`.
71
-
72
- **Attribute:** `data-liquid-commerce-elements-products`
73
- Reads a JSON array of product definitions.
74
-
75
- ```html
76
- <script data-liquid-commerce-elements-products type="application/json">
77
- [
78
- { "containerId": "product-1", "identifier": "00619947000020" },
79
- { "containerId": "product-2", "identifier": "08504405135" }
80
- ]
81
- </script>
82
- ```
83
-
84
- ## 3) Cart options (auto-UI + custom UI)
85
- Cart buttons are configured from the main script tag.
86
-
87
- ### Basic cart button
88
- **Attribute:** `data-cart-button`
89
- Renders a cart button in the specified container (by ID or selector).
90
- ```html
91
- <script
92
- defer
93
- data-liquid-commerce-elements
94
- data-token="YOUR_API_KEY"
95
- data-cart-button="header-cart"
96
- type="text/javascript"
97
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
98
- ></script>
99
-
100
- <div id="header-cart"></div>
101
- ```
102
-
103
- ### Cart button with badge
104
- **Attribute:** `data-cart-badge-button`
105
- Renders a cart button with item count badge.
106
- ```html
107
- <script
108
- defer
109
- data-liquid-commerce-elements
110
- data-token="YOUR_API_KEY"
111
- data-cart-badge-button="header-cart"
112
- type="text/javascript"
113
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
114
- ></script>
115
- ```
116
-
117
- ### Floating cart button
118
- Provide the attribute with no value.
119
-
120
- **Attribute:** `data-cart-button` (no value)
121
- Creates a floating cart button.
122
-
123
- ```html
124
- <script
125
- defer
126
- data-liquid-commerce-elements
127
- data-token="YOUR_API_KEY"
128
- data-cart-button
129
- type="text/javascript"
130
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
131
- ></script>
132
- ```
133
-
134
- ### Positioning cart buttons
135
- You can position the cart button relative to any element using:
136
- - `inside:` (default)
137
- - `above:`
138
- - `below:`
139
- - `replace:`
140
-
141
- ```html
142
- <script
143
- defer
144
- data-liquid-commerce-elements
145
- data-token="YOUR_API_KEY"
146
- data-cart-button="above:.nav"
147
- type="text/javascript"
148
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
149
- ></script>
150
- ```
151
-
152
- ### Mobile-specific cart buttons
153
- Use the mobile attributes to target mobile placement separately:
154
- - `data-cart-mobile-button`
155
- - `data-cart-mobile-badge-button`
156
-
157
- **Attribute:** `data-cart-mobile-button`
158
- Places a mobile-specific cart button.
159
-
160
- **Attribute:** `data-cart-mobile-badge-button`
161
- Places a mobile-specific cart button with badge.
162
-
163
- ```html
164
- <script
165
- defer
166
- data-liquid-commerce-elements
167
- data-token="YOUR_API_KEY"
168
- data-cart-mobile-button="inside:#mobile-nav"
169
- type="text/javascript"
170
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
171
- ></script>
172
- ```
173
-
174
- ### Hide cart buttons entirely
175
- **Attribute:** `data-cart-button-hidden`
176
- Disables auto-created cart buttons.
177
- ```html
178
- <script
179
- defer
180
- data-liquid-commerce-elements
181
- data-token="YOUR_API_KEY"
182
- data-cart-button-hidden
183
- type="text/javascript"
184
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
185
- ></script>
186
- ```
187
-
188
- ### Cart toggle buttons (custom UI)
189
- Any element with `data-lce-cart-toggle-button` will toggle the cart drawer.
190
-
191
- **Attribute:** `data-lce-cart-toggle-button`
192
- Toggles the cart drawer on click.
193
-
194
- ```html
195
- <button data-lce-cart-toggle-button>View Cart</button>
196
- ```
197
-
198
- ### Cart items count (custom UI)
199
- Use `data-lce-cart-items-count` on any element to show item count.
200
-
201
- **Attribute:** `data-lce-cart-items-count`
202
- Renders a live cart item count.
203
-
204
- ```html
205
- <span data-lce-cart-items-count></span>
206
- ```
207
-
208
- By default it hides when the cart is empty. To keep it visible with `0`, set:
209
-
210
- ```html
211
- <span data-lce-cart-items-count="keep-zero"></span>
212
- ```
213
-
214
- ## 4) Checkout (hosted injection + checkout-only build)
215
- Hosted checkout needs two things working together:
216
- 1) A **checkout URL** so the cart can redirect to your hosted checkout page.
217
- 2) A **checkout param name** so the hosted page can read the checkout ID from the URL and load it.
218
-
219
- ### Checkout container
220
- **Attribute:** `data-lce-checkout`
221
- Injects the hosted checkout into this container on the checkout page.
222
- ```html
223
- <div data-lce-checkout></div>
224
- ```
225
-
226
- ### Hide checkout header
227
- **Attribute:** `hide-header`
228
- Hides the SDK header so you can render your own header and layout.
229
- ```html
230
- <div data-lce-checkout hide-header></div>
231
- ```
232
-
233
- ### Exit checkout button
234
- **Attribute:** `data-lce-exit-checkout`
235
- Lets you build your own “Exit checkout” UI. The SDK wires the click to the checkout exit action.
236
- ```html
237
- <button data-lce-exit-checkout>Exit checkout</button>
238
- ```
239
-
240
- ### Checkout ID from query params (required for hosted checkout)
241
- Use `data-checkout-param` on the script tag to control which query param provides the checkout ID.
242
- **Attribute:** `data-checkout-param`
243
- Sets the query parameter name (must start with `lce_`). The hosted page reads this param to load the checkout.
244
-
245
- ```html
246
- <script
247
- defer
248
- data-liquid-commerce-elements
249
- data-token="YOUR_API_KEY"
250
- data-checkout-param="lce_checkout"
251
- type="text/javascript"
252
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
253
- ></script>
254
- ```
255
-
256
- Notes:
257
- - Query parameter names must start with `lce_` or they are ignored.
258
- - Default is `lce_checkout` if not provided.
259
-
260
- ### Checkout redirect URL (required for hosted checkout)
261
- **Attribute:** `data-checkout-url`
262
- Defines the hosted checkout page URL pattern. The cart drawer redirects to this URL and injects the checkout token into `{token}`.
263
-
264
- ```html
265
- <script
266
- defer
267
- data-liquid-commerce-elements
268
- data-token="YOUR_API_KEY"
269
- data-env="production"
270
- data-checkout-url="https://yoursite.com/checkout?lce_checkout={token}"
271
- data-checkout-param="lce_checkout"
272
- type="text/javascript"
273
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
274
- ></script>
275
- ```
276
-
277
- ### Checkout-only auto-initialize
278
- Use the checkout-only build when you only need checkout on the hosted checkout page. It supports the same hosted-checkout attributes (`data-lce-checkout`, `data-checkout-param`, `hide-header`, `data-lce-exit-checkout`) but ships a smaller script for faster load time.
279
-
280
- ```html
281
- <script
282
- defer
283
- data-liquid-commerce-elements
284
- data-token="YOUR_API_KEY"
285
- data-env="production"
286
- type="text/javascript"
287
- src="https://assets-elements.liquidcommerce.us/checkout/elements.js"
288
- ></script>
289
- ```
290
-
291
- Supported attributes on checkout-only script:
292
- - `data-token` (required)
293
- - `data-env` (optional)
294
- - `data-debug-mode` (optional, non-production only)
295
- - `data-checkout-url` (optional)
296
-
297
- The checkout-only build also supports `data-lce-checkout` containers and `data-checkout-param` query parameter handling.
298
-
299
- ## 5) Auto actions from query parameters
300
- Auto-init can read query params to add a product or apply a promo code.
301
-
302
- ### Add product to cart via query params
303
- - `data-product-param` (required)
304
- - `data-product-fulfillment-type-param` (optional, `shipping` or `onDemand`)
305
-
306
- **Attribute:** `data-product-param`
307
- Name of query param that contains the product identifier (must start with `lce_`).
308
-
309
- **Attribute:** `data-product-fulfillment-type-param`
310
- Name of query param that contains fulfillment type (must start with `lce_`).
311
-
312
- ```html
313
- <script
314
- defer
315
- data-liquid-commerce-elements
316
- data-token="YOUR_API_KEY"
317
- data-product-param="lce_product"
318
- data-product-fulfillment-type-param="lce_fulfillment"
319
- type="text/javascript"
320
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
321
- ></script>
322
- ```
323
-
324
- Example URL:
325
- ```
326
- https://yoursite.com?lce_product=00619947000020&lce_fulfillment=shipping
327
- ```
328
-
329
- ### Apply promo code via query params
330
- - `data-promo-code-param`
331
-
332
- **Attribute:** `data-promo-code-param`
333
- Name of query param that contains the promo code (must start with `lce_`).
334
-
335
- ```html
336
- <script
337
- defer
338
- data-liquid-commerce-elements
339
- data-token="YOUR_API_KEY"
340
- data-promo-code-param="lce_promo"
341
- type="text/javascript"
342
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
343
- ></script>
344
- ```
345
-
346
- Example URL:
347
- ```
348
- https://yoursite.com?lce_promo=SUMMER20
349
- ```
350
-
351
- Notes:
352
- - Query parameter names must start with `lce_` or they are ignored.
353
-
354
- ## 6) Advanced script options (optional)
355
- These are supported but not required for most implementations.
356
-
357
- ### Promo ticker
358
- All four of these must be present to enable the promo ticker.
359
-
360
- **Attributes:** `data-promo-code`, `data-promo-text`, `data-promo-separator`, `data-promo-active-from`, `data-promo-active-until`
361
- Enables the promo ticker. `data-promo-text` is pipe-separated (e.g. `"Text A|Text B"`).
362
-
363
- ```html
364
- <script
365
- defer
366
- data-liquid-commerce-elements
367
- data-token="YOUR_API_KEY"
368
- data-env="production"
369
- data-promo-code="SUMMER20"
370
- data-promo-text="20% Off|Free shipping over $50"
371
- data-promo-separator="•"
372
- data-promo-active-from="2026-06-01T00:00:00Z"
373
- data-promo-active-until="2026-08-31T23:59:59Z"
374
- type="text/javascript"
375
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
376
- ></script>
377
- ```
378
-
379
- ### Development config
380
- For local development or testing, you can inject development overrides via a JSON script tag:
381
-
382
- **Attribute:** `data-liquid-commerce-elements-development`
383
- Reads JSON for development overrides.
384
-
385
- ```html
386
- <script data-liquid-commerce-elements-development type="application/json">
387
- {
388
- "customApiUrl": "http://localhost:3000/api",
389
- "paymentMethodId": "pm_test_123",
390
- "openShadowDom": true
391
- }
392
- </script>
393
- ```