@liquidcommerce/elements-sdk 2.6.0-beta.11 → 2.6.0-beta.111

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 (270) hide show
  1. package/README.md +99 -2518
  2. package/dist/index.checkout.esm.js +18212 -0
  3. package/dist/index.esm.js +26222 -20637
  4. package/dist/ssr-stub.checkout.esm.js +17 -0
  5. package/dist/ssr-stub.esm.js +269 -0
  6. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  7. package/dist/types/auto-initialize/shared-utils.d.ts +50 -0
  8. package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +15 -2
  9. package/dist/types/clients/builder.d.ts +3 -0
  10. package/dist/types/clients/checkout.d.ts +6 -0
  11. package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +2 -1
  12. package/dist/types/clients/main.d.ts +3 -0
  13. package/dist/types/constants/core.constant.d.ts +13 -18
  14. package/dist/types/core/a11y/announcer.service.d.ts +16 -0
  15. package/dist/types/core/a11y/focus-manager.service.d.ts +21 -0
  16. package/dist/types/core/a11y/focusable.d.ts +5 -0
  17. package/dist/types/core/a11y/glyph-button.d.ts +8 -0
  18. package/dist/types/core/a11y/index.d.ts +6 -0
  19. package/dist/types/core/a11y/required.d.ts +1 -0
  20. package/dist/types/core/a11y/single-select.d.ts +20 -0
  21. package/dist/types/core/api/api-client.service.d.ts +19 -18
  22. package/dist/types/core/api/api-result.d.ts +19 -0
  23. package/dist/types/core/api/auth-client.service.d.ts +37 -13
  24. package/dist/types/core/api/http-client.service.d.ts +0 -8
  25. package/dist/types/core/base-component.service.d.ts +4 -1
  26. package/dist/types/core/client/actions/base-action.service.d.ts +22 -0
  27. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  28. package/dist/types/core/client/actions/client-cart-action.service.d.ts +38 -0
  29. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +69 -0
  30. package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
  31. package/dist/types/core/client/client-action.service.d.ts +6 -74
  32. package/dist/types/core/client/client-config.service.d.ts +8 -5
  33. package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -1
  34. package/dist/types/core/google-tag-manager.service.d.ts +3 -1
  35. package/dist/types/core/logger/logger.service.d.ts +1 -1
  36. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -0
  37. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -1
  38. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +36 -51
  39. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +11 -6
  40. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  41. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  42. package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
  43. package/dist/types/core/store/interfaces/checkout.interface.d.ts +19 -108
  44. package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
  45. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  46. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  47. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  48. package/dist/types/core/store/store.constant.d.ts +5 -0
  49. package/dist/types/core/store/store.service.d.ts +1 -0
  50. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  51. package/dist/types/enums/core.enum.d.ts +39 -2
  52. package/dist/types/enums/index.d.ts +0 -1
  53. package/dist/types/index.checkout.d.ts +8 -0
  54. package/dist/types/index.checkout.umd.d.ts +4 -0
  55. package/dist/types/index.d.ts +8 -3
  56. package/dist/types/interfaces/api/cart.interface.d.ts +12 -7
  57. package/dist/types/interfaces/api/checkout.interface.d.ts +239 -0
  58. package/dist/types/interfaces/api/index.d.ts +5 -0
  59. package/dist/types/interfaces/api/product-list.interface.d.ts +15 -6
  60. package/dist/types/interfaces/api/product.interface.d.ts +10 -4
  61. package/dist/types/interfaces/client.interface.d.ts +72 -0
  62. package/dist/types/interfaces/component.interface.d.ts +7 -0
  63. package/dist/types/interfaces/config.interface.d.ts +40 -0
  64. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  65. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  66. package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
  67. package/dist/types/interfaces/configs/global.interface.d.ts +9 -3
  68. package/dist/types/interfaces/configs/index.d.ts +1 -0
  69. package/dist/types/interfaces/configs/product-list.interface.d.ts +49 -0
  70. package/dist/types/interfaces/configs/product.interface.d.ts +5 -1
  71. package/dist/types/interfaces/injection.interface.d.ts +50 -0
  72. package/dist/types/modules/address/address-display.component.d.ts +3 -1
  73. package/dist/types/modules/address/address-input.component.d.ts +10 -1
  74. package/dist/types/modules/address/address.command.d.ts +2 -1
  75. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  76. package/dist/types/modules/cart/cart.commands.d.ts +4 -4
  77. package/dist/types/modules/cart/components/cart-body.component.d.ts +1 -0
  78. package/dist/types/modules/cart/components/cart-item-quantity-price.component.d.ts +5 -0
  79. package/dist/types/modules/cart/components/cart-item.component.d.ts +6 -0
  80. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  81. package/dist/types/modules/checkout/checkout.commands.d.ts +34 -11
  82. package/dist/types/modules/checkout/checkout.component.d.ts +6 -1
  83. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +5 -2
  84. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +5 -0
  85. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  86. package/dist/types/modules/checkout/components/checkout-item-quantity.component.d.ts +4 -0
  87. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  88. package/dist/types/modules/checkout/components/checkout-order-summary.component.d.ts +2 -0
  89. package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +2 -1
  90. package/dist/types/modules/checkout/components/checkout-place-order-button.component.d.ts +2 -0
  91. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +15 -1
  92. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  93. package/dist/types/modules/checkout/components/checkout-send-as-gift.component.d.ts +3 -0
  94. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +4 -2
  95. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +4 -2
  96. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  97. package/dist/types/modules/checkout/components/required-fields-legend.d.ts +1 -0
  98. package/dist/types/modules/checkout/constant.d.ts +3 -0
  99. package/dist/types/modules/checkout/payment-session-error.d.ts +4 -0
  100. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  101. package/dist/types/modules/product/components/components.d.ts +26 -2
  102. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +7 -1
  103. package/dist/types/modules/product/components/product-description.component.d.ts +1 -0
  104. package/dist/types/modules/product/components/product-drawer.component.d.ts +6 -0
  105. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +5 -0
  106. package/dist/types/modules/product/components/product-options.component.d.ts +2 -1
  107. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +6 -0
  108. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +12 -2
  109. package/dist/types/modules/product/product.commands.d.ts +5 -5
  110. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  111. package/dist/types/modules/product-list/components/card-components/index.d.ts +5 -0
  112. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
  113. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
  114. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +14 -0
  115. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +11 -0
  116. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +14 -0
  117. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  118. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  119. 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} +1 -0
  120. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  121. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  122. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +15 -0
  123. 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} +2 -1
  124. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
  125. package/dist/types/modules/product-list/components/index.d.ts +6 -2
  126. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +3 -1
  127. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +37 -31
  128. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
  129. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +58 -36
  130. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
  131. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +53 -0
  132. package/dist/types/modules/product-list/components/product-list-search.component.d.ts +25 -0
  133. package/dist/types/modules/product-list/product-list-filter.registry.d.ts +42 -0
  134. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +7 -0
  135. package/dist/types/modules/product-list/product-list-order.utils.d.ts +3 -0
  136. package/dist/types/modules/product-list/product-list-query-params.utils.d.ts +3 -0
  137. package/dist/types/modules/product-list/product-list.commands.d.ts +22 -7
  138. package/dist/types/modules/product-list/product-list.component.d.ts +23 -47
  139. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  140. package/dist/types/modules/product-list/product-list.interface.d.ts +17 -28
  141. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  142. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  143. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  144. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  145. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  146. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  147. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  148. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  149. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  150. package/dist/types/modules/ui-components/alert/alert.component.d.ts +1 -1
  151. package/dist/types/modules/ui-components/buttons/buttons-open-cart.component.d.ts +5 -0
  152. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +15 -0
  153. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +8 -1
  154. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +7 -1
  155. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  156. package/dist/types/modules/ui-components/input/input.component.d.ts +14 -1
  157. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  158. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  159. package/dist/types/modules/ui-components/ui.commands.d.ts +7 -1
  160. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  161. package/dist/types/ssr/stub.d.ts +10 -0
  162. package/dist/types/static/icon/arrow-right.icon.d.ts +1 -1
  163. package/dist/types/static/icon/bag.icon.d.ts +1 -1
  164. package/dist/types/static/icon/check.icon.d.ts +2 -0
  165. package/dist/types/static/icon/checkbox.icon.d.ts +1 -1
  166. package/dist/types/static/icon/chevron-down.icon.d.ts +1 -1
  167. package/dist/types/static/icon/chevron-left.icon.d.ts +1 -1
  168. package/dist/types/static/icon/chevron-up.icon.d.ts +1 -1
  169. package/dist/types/static/icon/close.icon.d.ts +1 -1
  170. package/dist/types/static/icon/error-info.icon.d.ts +1 -1
  171. package/dist/types/static/icon/filter.icon.d.ts +1 -1
  172. package/dist/types/static/icon/icon.a11y.d.ts +1 -0
  173. package/dist/types/static/icon/icon.types.d.ts +1 -0
  174. package/dist/types/static/icon/index.d.ts +2 -0
  175. package/dist/types/static/icon/info.icon.d.ts +1 -1
  176. package/dist/types/static/icon/loading-spinner.icon.d.ts +1 -1
  177. package/dist/types/static/icon/search.icon.d.ts +1 -1
  178. package/dist/types/static/icon/success.icon.d.ts +1 -1
  179. package/dist/types/static/icon/trash.icon.d.ts +1 -1
  180. package/dist/types/static/icon/warning.icon.d.ts +1 -1
  181. package/dist/types/utils/dom-compat.d.ts +2 -0
  182. package/dist/types/utils/format.d.ts +5 -14
  183. package/dist/types/utils/image-bg-removal.d.ts +3 -0
  184. package/dist/types/utils/product-selection.d.ts +16 -0
  185. package/dist/types/utils/product.d.ts +18 -0
  186. package/dist/types/utils/timezone.d.ts +6 -0
  187. package/docs/v1/README.md +213 -0
  188. package/docs/v1/api/actions/address-actions.md +286 -0
  189. package/docs/v1/api/actions/cart-actions.md +364 -0
  190. package/docs/v1/api/actions/checkout-actions.md +527 -0
  191. package/docs/v1/api/actions/product-actions.md +204 -0
  192. package/docs/v1/api/client.md +596 -0
  193. package/docs/v1/api/configuration.md +557 -0
  194. package/docs/v1/api/injection-methods.md +331 -0
  195. package/docs/v1/api/typescript-types.md +424 -0
  196. package/docs/v1/api/ui-helpers.md +200 -0
  197. package/docs/v1/examples/advanced-patterns.md +199 -0
  198. package/docs/v1/examples/checkout-flow.md +90 -0
  199. package/docs/v1/examples/custom-theming.md +63 -0
  200. package/docs/v1/examples/multi-product-page.md +90 -0
  201. package/docs/v1/examples/simple-product-page.md +89 -0
  202. package/docs/v1/getting-started/concepts.md +521 -0
  203. package/docs/v1/getting-started/installation.md +349 -0
  204. package/docs/v1/getting-started/quick-start.md +410 -0
  205. package/docs/v1/guides/accessibility.md +219 -0
  206. package/docs/v1/guides/address-component.md +435 -0
  207. package/docs/v1/guides/best-practices.md +365 -0
  208. package/docs/v1/guides/cart-component.md +757 -0
  209. package/docs/v1/guides/checkout-component.md +670 -0
  210. package/docs/v1/guides/events.md +939 -0
  211. package/docs/v1/guides/product-component.md +736 -0
  212. package/docs/v1/guides/product-list-component.md +730 -0
  213. package/docs/v1/guides/theming.md +229 -0
  214. package/docs/v1/integration/angular.md +39 -0
  215. package/docs/v1/integration/laravel.md +41 -0
  216. package/docs/v1/integration/nextjs.md +69 -0
  217. package/docs/v1/integration/proxy-setup.md +106 -0
  218. package/docs/v1/integration/react.md +64 -0
  219. package/docs/v1/integration/vanilla-js.md +84 -0
  220. package/docs/v1/integration/vue.md +58 -0
  221. package/docs/v1/reference/analytics.md +107 -0
  222. package/docs/v1/reference/browser-support.md +47 -0
  223. package/docs/v1/reference/error-handling.md +83 -0
  224. package/docs/v1/reference/performance.md +52 -0
  225. package/docs/v1/reference/telemetry.md +85 -0
  226. package/docs/v1/reference/troubleshooting.md +135 -0
  227. package/package.json +75 -45
  228. package/dist/types/elements-builder-client.d.ts +0 -2
  229. package/dist/types/elements-client.d.ts +0 -2
  230. package/dist/types/enums/cloud.enum.d.ts +0 -97
  231. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  232. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  233. package/dist/types/interfaces/cloud/index.d.ts +0 -3
  234. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  235. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  236. package/dist/types/interfaces/core.interface.d.ts +0 -111
  237. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  238. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  239. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  240. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  241. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
  242. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  243. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  244. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  245. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  246. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  247. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  248. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  249. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  250. package/dist/types/utils/helper.d.ts +0 -28
  251. package/docs/ACTIONS.md +0 -1300
  252. package/docs/BROWSER_SUPPORT.md +0 -279
  253. package/docs/CONFIGURATION.md +0 -853
  254. package/docs/DOCUMENTATION_INDEX.md +0 -311
  255. package/docs/EVENTS.md +0 -798
  256. package/docs/PROXY.md +0 -228
  257. package/docs/THEMING.md +0 -592
  258. package/docs/TROUBLESHOOTING.md +0 -793
  259. package/umd/elements.js +0 -1
  260. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  261. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  262. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  263. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  264. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  265. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  266. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  267. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  268. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  269. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  270. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,199 @@
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
+ country: 'US'
33
+ },
34
+ {
35
+ latitude: 40.7128,
36
+ longitude: -74.0060
37
+ }
38
+ );
39
+ ```
40
+
41
+ ## 3) Custom Cart Button
42
+
43
+ ```html
44
+ <button data-lce-cart-toggle-button>
45
+ View Cart
46
+ </button>
47
+ ```
48
+
49
+ ## 4) Analytics With Events
50
+
51
+ ```javascript
52
+ window.addEventListener('lce:actions.product_loaded', (event) => {
53
+ const { identifier, name, priceInfo } = event.detail.data;
54
+ gtag('event', 'view_item', {
55
+ items: [{ item_id: identifier, item_name: name, price: (priceInfo?.minimum ?? 0) / 100 }]
56
+ });
57
+ });
58
+
59
+ window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
60
+ const { orderNumber, orderTotal } = event.detail.data;
61
+ gtag('event', 'purchase', {
62
+ transaction_id: orderNumber,
63
+ value: orderTotal / 100,
64
+ currency: 'USD'
65
+ });
66
+ });
67
+ ```
68
+
69
+ ## 5) Redirect Checkout to Your Page
70
+
71
+ ```javascript
72
+ const client = await Elements('YOUR_API_KEY', {
73
+ env: 'production',
74
+ checkout: {
75
+ pageUrl: 'https://yoursite.com/checkout?lce_checkout={token}'
76
+ }
77
+ });
78
+ ```
79
+
80
+ ## 6) Debugging Helpers
81
+
82
+ ```javascript
83
+ const client = await Elements('YOUR_API_KEY', {
84
+ env: 'production',
85
+ debugMode: 'console',
86
+ development: {
87
+ openShadowDom: true
88
+ }
89
+ });
90
+ ```
91
+
92
+ ## 7) Cleanup on SPA Navigation
93
+
94
+ ```javascript
95
+ let client = null;
96
+
97
+ async function mountElements() {
98
+ client = await Elements('YOUR_API_KEY', { env: 'production' });
99
+ await client.injectProductElement([
100
+ { containerId: 'product', identifier: '00619947000020' }
101
+ ]);
102
+ }
103
+
104
+ function unmountElements() {
105
+ if (client) {
106
+ client.destroy();
107
+ client = null;
108
+ }
109
+ }
110
+
111
+ // React example
112
+ useEffect(() => {
113
+ mountElements();
114
+ return () => unmountElements();
115
+ }, []);
116
+ ```
117
+
118
+ ## 8) Checkout-Only Page
119
+
120
+ For a dedicated checkout page, use the tree-shaken checkout build:
121
+
122
+ ```javascript
123
+ import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
124
+
125
+ const client = await ElementsCheckout('YOUR_API_KEY', {
126
+ env: 'production'
127
+ });
128
+
129
+ await client.injectCheckout({
130
+ containerId: 'checkout',
131
+ checkoutId: new URLSearchParams(window.location.search).get('lce_checkout'),
132
+ hideHeader: false
133
+ });
134
+ ```
135
+
136
+ ## 9) Promo Ticker with Time Windows
137
+
138
+ ```javascript
139
+ const client = await Elements('YOUR_API_KEY', {
140
+ env: 'production',
141
+ promoTicker: [
142
+ {
143
+ promoCode: 'SUMMER20',
144
+ text: ['20% Off Summer Sale', 'Free Shipping on $50+'],
145
+ separator: '|',
146
+ activeFrom: '2026-06-01T00:00:00Z',
147
+ activeUntil: '2026-08-31T23:59:59Z'
148
+ },
149
+ {
150
+ promoCode: 'FALL10',
151
+ text: ['10% Off Fall Collection'],
152
+ separator: '|',
153
+ activeFrom: '2026-09-01T00:00:00Z',
154
+ activeUntil: '2026-11-30T23:59:59Z'
155
+ }
156
+ ]
157
+ });
158
+ ```
159
+
160
+ ## 10) Product List with Filters and Search
161
+
162
+ ```javascript
163
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
164
+
165
+ await client.injectProductListSearch({
166
+ containerId: 'search-box',
167
+ slug: 'whiskey-collection'
168
+ });
169
+
170
+ await client.injectProductListFilters({
171
+ containerId: 'sidebar-filters',
172
+ slug: 'whiskey-collection',
173
+ filters: ['price', 'brands', 'sizes', 'fulfillment']
174
+ });
175
+
176
+ await client.injectProductList({
177
+ containerId: 'product-grid',
178
+ slug: 'whiskey-collection',
179
+ rows: 4,
180
+ columns: 3,
181
+ productUrl: '/products/{grouping}'
182
+ });
183
+ ```
184
+
185
+ ## 11) Check Product Availability by State
186
+
187
+ ```javascript
188
+ const availability = await window.LiquidCommerce.elements.actions.product
189
+ .getProductAvailabilityByState(['00619947000020', '08504405135'], 'CA');
190
+
191
+ console.log('Availability in CA:', availability);
192
+ ```
193
+
194
+ ## Related Docs
195
+
196
+ - [Events Guide](../guides/events.md)
197
+ - [Product Component](../guides/product-component.md)
198
+ - [Checkout Component](../guides/checkout-component.md)
199
+ - [Client API](../api/client.md)
@@ -0,0 +1,90 @@
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://elements.reservebar-worker.workers.dev/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-param="lce_checkout"
64
+ type="text/javascript"
65
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
66
+ ></script>
67
+ </head>
68
+ <body>
69
+ <div data-lce-checkout></div>
70
+ </body>
71
+ </html>
72
+ ```
73
+
74
+ ## Optional: Skip Cart and Go Directly to Checkout
75
+
76
+ ```javascript
77
+ await window.LiquidCommerce.elements.actions.checkout.addProduct([
78
+ {
79
+ identifier: '00619947000020',
80
+ fulfillmentType: 'shipping',
81
+ quantity: 1
82
+ }
83
+ ], true);
84
+ ```
85
+
86
+ ## Related Docs
87
+
88
+ - [Checkout Component](../guides/checkout-component.md)
89
+ - [Cart Component](../guides/cart-component.md)
90
+ - [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)
@@ -0,0 +1,90 @@
1
+ # Multi-Product Page
2
+
3
+ Show multiple products on a single page using declarative attributes or programmatic injection.
4
+
5
+ ## Option A: Declarative (Data Attributes)
6
+
7
+ ```html
8
+ <!DOCTYPE html>
9
+ <html lang="en">
10
+ <head>
11
+ <meta charset="UTF-8" />
12
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
13
+ <title>Multi-Product Page</title>
14
+
15
+ <script
16
+ defer
17
+ data-liquid-commerce-elements
18
+ data-token="YOUR_API_KEY"
19
+ data-env="production"
20
+ data-container-1="product-1"
21
+ data-product-1="00619947000020"
22
+ data-container-2="product-2"
23
+ data-product-2="08504405135"
24
+ data-container-3="product-3"
25
+ data-product-3="08068660001"
26
+ type="text/javascript"
27
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
28
+ ></script>
29
+
30
+ <style>
31
+ body { font-family: Arial, sans-serif; margin: 0; padding: 24px; background: #f7f7f7; }
32
+ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
33
+ .card { background: #fff; border-radius: 10px; padding: 16px; min-height: 520px; }
34
+ </style>
35
+ </head>
36
+ <body>
37
+ <h1>Featured Products</h1>
38
+ <div class="grid">
39
+ <div id="product-1" class="card"></div>
40
+ <div id="product-2" class="card"></div>
41
+ <div id="product-3" class="card"></div>
42
+ </div>
43
+ </body>
44
+ </html>
45
+ ```
46
+
47
+ ## Option B: JSON Configuration
48
+
49
+ ```html
50
+ <script
51
+ defer
52
+ data-liquid-commerce-elements
53
+ data-token="YOUR_API_KEY"
54
+ data-env="production"
55
+ type="text/javascript"
56
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
57
+ ></script>
58
+
59
+ <script data-liquid-commerce-elements-products type="application/json">
60
+ [
61
+ { "containerId": "product-1", "identifier": "00619947000020" },
62
+ { "containerId": "product-2", "identifier": "08504405135" },
63
+ { "containerId": "product-3", "identifier": "08068660001" }
64
+ ]
65
+ </script>
66
+ ```
67
+
68
+ ## Option C: Programmatic Injection (NPM)
69
+
70
+ ```javascript
71
+ import { Elements } from '@liquidcommerce/elements-sdk';
72
+
73
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
74
+
75
+ await client.injectProductElement([
76
+ { containerId: 'product-1', identifier: '00619947000020' },
77
+ { containerId: 'product-2', identifier: '08504405135' },
78
+ { containerId: 'product-3', identifier: '08068660001' }
79
+ ]);
80
+ ```
81
+
82
+ ## Tips
83
+
84
+ - Give each container a `min-height` to reduce layout shift while data loads.
85
+ - Add a cart button once per page (see [Cart Component](../guides/cart-component.md)).
86
+
87
+ ## Related Docs
88
+
89
+ - [Product Component](../guides/product-component.md)
90
+ - [Quick Start](../getting-started/quick-start.md)
@@ -0,0 +1,89 @@
1
+ # Simple Product Page
2
+
3
+ A minimal, production-ready product page using the CDN build with a single Product component and the default cart drawer.
4
+
5
+ ## What You'll Build
6
+
7
+ - One product component
8
+ - Optional cart button with item count
9
+ - Default cart and checkout flow
10
+
11
+ ## Prerequisites
12
+
13
+ - LiquidCommerce API key
14
+ - One product identifier (UPC or grouping ID)
15
+
16
+ ## HTML (CDN)
17
+
18
+ ```html
19
+ <!DOCTYPE html>
20
+ <html lang="en">
21
+ <head>
22
+ <meta charset="UTF-8" />
23
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
24
+ <title>Simple Product Page</title>
25
+
26
+ <script
27
+ defer
28
+ data-liquid-commerce-elements
29
+ data-token="YOUR_API_KEY"
30
+ data-env="production"
31
+ data-container-1="product"
32
+ data-product-1="00619947000020"
33
+ data-cart-badge-button="header-cart"
34
+ type="text/javascript"
35
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
36
+ ></script>
37
+
38
+ <style>
39
+ body {
40
+ font-family: Arial, sans-serif;
41
+ margin: 0;
42
+ padding: 0;
43
+ background: #f7f7f7;
44
+ }
45
+ header {
46
+ background: #fff;
47
+ padding: 16px 24px;
48
+ box-shadow: 0 2px 6px rgba(0,0,0,0.08);
49
+ display: flex;
50
+ justify-content: space-between;
51
+ align-items: center;
52
+ }
53
+ main {
54
+ max-width: 1100px;
55
+ margin: 24px auto;
56
+ padding: 0 24px;
57
+ }
58
+ #product {
59
+ background: #fff;
60
+ border-radius: 10px;
61
+ padding: 20px;
62
+ min-height: 600px;
63
+ }
64
+ </style>
65
+ </head>
66
+ <body>
67
+ <header>
68
+ <h1>Premium Spirits</h1>
69
+ <div id="header-cart"></div>
70
+ </header>
71
+
72
+ <main>
73
+ <div id="product"></div>
74
+ </main>
75
+ </body>
76
+ </html>
77
+ ```
78
+
79
+ ## What to Tweak Next
80
+
81
+ - Change the product identifier: `data-product-1="YOUR_PRODUCT_ID"`
82
+ - Add a second product (see [Multi-Product Page](./multi-product-page.md))
83
+ - Customize styling via theming (see [Theming Guide](../guides/theming.md))
84
+
85
+ ## Related Docs
86
+
87
+ - [Product Component](../guides/product-component.md)
88
+ - [Cart Component](../guides/cart-component.md)
89
+ - [Quick Start](../getting-started/quick-start.md)