@liquidcommerce/elements-sdk 2.6.0-beta.10 → 2.6.0-beta.100

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 (261) hide show
  1. package/README.md +99 -2518
  2. package/dist/index.checkout.esm.js +17794 -0
  3. package/dist/index.esm.js +25957 -20987
  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/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 +2 -6
  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 +5 -0
  19. package/dist/types/core/a11y/single-select.d.ts +16 -0
  20. package/dist/types/core/api/api-client.service.d.ts +19 -18
  21. package/dist/types/core/api/api-result.d.ts +19 -0
  22. package/dist/types/core/api/auth-client.service.d.ts +37 -13
  23. package/dist/types/core/api/http-client.service.d.ts +0 -8
  24. package/dist/types/core/base-component.service.d.ts +4 -1
  25. package/dist/types/core/client/actions/base-action.service.d.ts +22 -0
  26. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  27. package/dist/types/core/client/actions/client-cart-action.service.d.ts +38 -0
  28. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +69 -0
  29. package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
  30. package/dist/types/core/client/client-action.service.d.ts +6 -74
  31. package/dist/types/core/client/client-config.service.d.ts +8 -5
  32. package/dist/types/core/google-tag-manager.service.d.ts +3 -1
  33. package/dist/types/core/logger/logger.service.d.ts +1 -1
  34. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -0
  35. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -1
  36. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +36 -51
  37. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +11 -6
  38. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  39. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  40. package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
  41. package/dist/types/core/store/interfaces/checkout.interface.d.ts +18 -108
  42. package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
  43. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  44. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  45. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  46. package/dist/types/core/store/store.constant.d.ts +5 -0
  47. package/dist/types/core/store/store.service.d.ts +1 -0
  48. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  49. package/dist/types/enums/core.enum.d.ts +39 -1
  50. package/dist/types/enums/index.d.ts +0 -1
  51. package/dist/types/index.checkout.d.ts +8 -0
  52. package/dist/types/index.checkout.umd.d.ts +4 -0
  53. package/dist/types/index.d.ts +8 -3
  54. package/dist/types/interfaces/api/cart.interface.d.ts +12 -7
  55. package/dist/types/interfaces/api/checkout.interface.d.ts +239 -0
  56. package/dist/types/interfaces/api/index.d.ts +5 -0
  57. package/dist/types/interfaces/api/product-list.interface.d.ts +14 -5
  58. package/dist/types/interfaces/api/product.interface.d.ts +10 -4
  59. package/dist/types/interfaces/client.interface.d.ts +72 -0
  60. package/dist/types/interfaces/component.interface.d.ts +7 -0
  61. package/dist/types/interfaces/config.interface.d.ts +40 -0
  62. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  63. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  64. package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
  65. package/dist/types/interfaces/configs/global.interface.d.ts +9 -3
  66. package/dist/types/interfaces/configs/index.d.ts +1 -0
  67. package/dist/types/interfaces/configs/product-list.interface.d.ts +49 -0
  68. package/dist/types/interfaces/configs/product.interface.d.ts +3 -1
  69. package/dist/types/interfaces/injection.interface.d.ts +49 -0
  70. package/dist/types/modules/address/address-display.component.d.ts +3 -1
  71. package/dist/types/modules/address/address-input.component.d.ts +10 -1
  72. package/dist/types/modules/address/address.command.d.ts +2 -1
  73. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  74. package/dist/types/modules/cart/cart.commands.d.ts +4 -4
  75. package/dist/types/modules/cart/components/cart-body.component.d.ts +1 -0
  76. package/dist/types/modules/cart/components/cart-item-quantity-price.component.d.ts +5 -0
  77. package/dist/types/modules/cart/components/cart-item.component.d.ts +6 -0
  78. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  79. package/dist/types/modules/checkout/checkout.commands.d.ts +27 -10
  80. package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
  81. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  82. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +5 -0
  83. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  84. package/dist/types/modules/checkout/components/checkout-item-quantity.component.d.ts +4 -0
  85. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  86. package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +2 -1
  87. package/dist/types/modules/checkout/components/checkout-place-order-button.component.d.ts +2 -0
  88. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
  89. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  90. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  91. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
  92. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  93. package/dist/types/modules/checkout/constant.d.ts +3 -0
  94. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  95. package/dist/types/modules/product/components/components.d.ts +6 -1
  96. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +7 -1
  97. package/dist/types/modules/product/components/product-description.component.d.ts +1 -0
  98. package/dist/types/modules/product/components/product-drawer.component.d.ts +6 -0
  99. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +5 -0
  100. package/dist/types/modules/product/components/product-options.component.d.ts +2 -1
  101. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +4 -0
  102. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +10 -2
  103. package/dist/types/modules/product/product.commands.d.ts +5 -5
  104. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  105. package/dist/types/modules/product-list/components/card-components/index.d.ts +5 -0
  106. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
  107. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
  108. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +14 -0
  109. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +11 -0
  110. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +14 -0
  111. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  112. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  113. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  114. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  115. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +15 -0
  116. 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
  117. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
  118. package/dist/types/modules/product-list/components/index.d.ts +6 -2
  119. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +3 -1
  120. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +36 -31
  121. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
  122. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +56 -36
  123. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
  124. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +53 -0
  125. package/dist/types/modules/product-list/components/product-list-search.component.d.ts +25 -0
  126. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
  127. package/dist/types/modules/product-list/product-list-query-params.utils.d.ts +3 -0
  128. package/dist/types/modules/product-list/product-list.commands.d.ts +22 -7
  129. package/dist/types/modules/product-list/product-list.component.d.ts +17 -47
  130. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  131. package/dist/types/modules/product-list/product-list.interface.d.ts +16 -28
  132. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  133. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  134. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  135. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  136. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  137. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  138. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  139. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  140. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  141. package/dist/types/modules/ui-components/alert/alert.component.d.ts +1 -1
  142. package/dist/types/modules/ui-components/buttons/buttons-open-cart.component.d.ts +5 -0
  143. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +15 -0
  144. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +8 -1
  145. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +7 -1
  146. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  147. package/dist/types/modules/ui-components/input/input.component.d.ts +14 -1
  148. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  149. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  150. package/dist/types/modules/ui-components/ui.commands.d.ts +7 -1
  151. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  152. package/dist/types/ssr/stub.d.ts +10 -0
  153. package/dist/types/static/icon/arrow-right.icon.d.ts +1 -1
  154. package/dist/types/static/icon/bag.icon.d.ts +1 -1
  155. package/dist/types/static/icon/check.icon.d.ts +2 -0
  156. package/dist/types/static/icon/checkbox.icon.d.ts +1 -1
  157. package/dist/types/static/icon/chevron-down.icon.d.ts +1 -1
  158. package/dist/types/static/icon/chevron-left.icon.d.ts +1 -1
  159. package/dist/types/static/icon/chevron-up.icon.d.ts +1 -1
  160. package/dist/types/static/icon/close.icon.d.ts +1 -1
  161. package/dist/types/static/icon/error-info.icon.d.ts +1 -1
  162. package/dist/types/static/icon/filter.icon.d.ts +1 -1
  163. package/dist/types/static/icon/icon.a11y.d.ts +1 -0
  164. package/dist/types/static/icon/icon.types.d.ts +1 -0
  165. package/dist/types/static/icon/index.d.ts +2 -0
  166. package/dist/types/static/icon/info.icon.d.ts +1 -1
  167. package/dist/types/static/icon/loading-spinner.icon.d.ts +1 -1
  168. package/dist/types/static/icon/search.icon.d.ts +1 -1
  169. package/dist/types/static/icon/success.icon.d.ts +1 -1
  170. package/dist/types/static/icon/trash.icon.d.ts +1 -1
  171. package/dist/types/static/icon/warning.icon.d.ts +1 -1
  172. package/dist/types/utils/dom-compat.d.ts +2 -0
  173. package/dist/types/utils/format.d.ts +4 -14
  174. package/dist/types/utils/image-bg-removal.d.ts +3 -0
  175. package/dist/types/utils/product-selection.d.ts +16 -0
  176. package/dist/types/utils/product.d.ts +15 -0
  177. package/docs/v1/README.md +213 -0
  178. package/docs/v1/api/actions/address-actions.md +286 -0
  179. package/docs/v1/api/actions/cart-actions.md +364 -0
  180. package/docs/v1/api/actions/checkout-actions.md +527 -0
  181. package/docs/v1/api/actions/product-actions.md +204 -0
  182. package/docs/v1/api/client.md +596 -0
  183. package/docs/v1/api/configuration.md +555 -0
  184. package/docs/v1/api/injection-methods.md +292 -0
  185. package/docs/v1/api/typescript-types.md +423 -0
  186. package/docs/v1/api/ui-helpers.md +200 -0
  187. package/docs/v1/examples/advanced-patterns.md +199 -0
  188. package/docs/v1/examples/checkout-flow.md +90 -0
  189. package/docs/v1/examples/custom-theming.md +63 -0
  190. package/docs/v1/examples/multi-product-page.md +90 -0
  191. package/docs/v1/examples/simple-product-page.md +89 -0
  192. package/docs/v1/getting-started/concepts.md +521 -0
  193. package/docs/v1/getting-started/installation.md +349 -0
  194. package/docs/v1/getting-started/quick-start.md +410 -0
  195. package/docs/v1/guides/accessibility.md +173 -0
  196. package/docs/v1/guides/address-component.md +435 -0
  197. package/docs/v1/guides/best-practices.md +365 -0
  198. package/docs/v1/guides/cart-component.md +757 -0
  199. package/docs/v1/guides/checkout-component.md +670 -0
  200. package/docs/v1/guides/events.md +939 -0
  201. package/docs/v1/guides/product-component.md +735 -0
  202. package/docs/v1/guides/product-list-component.md +630 -0
  203. package/docs/v1/guides/theming.md +228 -0
  204. package/docs/v1/integration/angular.md +39 -0
  205. package/docs/v1/integration/laravel.md +41 -0
  206. package/docs/v1/integration/nextjs.md +69 -0
  207. package/docs/v1/integration/proxy-setup.md +106 -0
  208. package/docs/v1/integration/react.md +64 -0
  209. package/docs/v1/integration/vanilla-js.md +84 -0
  210. package/docs/v1/integration/vue.md +58 -0
  211. package/docs/v1/reference/analytics.md +108 -0
  212. package/docs/v1/reference/browser-support.md +47 -0
  213. package/docs/v1/reference/error-handling.md +83 -0
  214. package/docs/v1/reference/performance.md +52 -0
  215. package/docs/v1/reference/telemetry.md +85 -0
  216. package/docs/v1/reference/troubleshooting.md +135 -0
  217. package/package.json +69 -44
  218. package/dist/types/elements-builder-client.d.ts +0 -2
  219. package/dist/types/elements-client.d.ts +0 -2
  220. package/dist/types/enums/cloud.enum.d.ts +0 -97
  221. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  222. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  223. package/dist/types/interfaces/cloud/index.d.ts +0 -3
  224. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  225. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  226. package/dist/types/interfaces/core.interface.d.ts +0 -111
  227. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  228. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  229. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  230. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  231. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
  232. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  233. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  234. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  235. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  236. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  237. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  238. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  239. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  240. package/dist/types/utils/helper.d.ts +0 -28
  241. package/docs/ACTIONS.md +0 -1300
  242. package/docs/BROWSER_SUPPORT.md +0 -279
  243. package/docs/CONFIGURATION.md +0 -853
  244. package/docs/DOCUMENTATION_INDEX.md +0 -311
  245. package/docs/EVENTS.md +0 -798
  246. package/docs/PROXY.md +0 -228
  247. package/docs/THEMING.md +0 -592
  248. package/docs/TROUBLESHOOTING.md +0 -793
  249. package/umd/elements.js +0 -1
  250. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  251. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  252. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  253. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  254. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  255. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  256. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  257. /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
  258. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  259. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  260. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  261. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,735 @@
1
+ # Product Component
2
+
3
+ The Product component displays product information with add-to-cart functionality, image carousel, size selection, and fulfillment options.
4
+
5
+ ## Overview
6
+
7
+ The Product component automatically:
8
+ - Displays product images in a carousel
9
+ - Shows product name, description, and pricing
10
+ - Provides size selection
11
+ - Offers fulfillment type options (shipping/on-demand delivery)
12
+ - Handles retailer selection
13
+ - Includes add-to-cart functionality
14
+ - Supports product personalization/engraving
15
+ - Adjusts pricing based on delivery location
16
+
17
+ ## Basic Usage
18
+
19
+ ### Declarative Setup
20
+
21
+ The simplest way to add a product is using HTML data attributes:
22
+
23
+ ```html
24
+ <script
25
+ defer
26
+ data-liquid-commerce-elements
27
+ data-token="YOUR_API_KEY"
28
+ data-env="production"
29
+ data-container-1="product-display"
30
+ data-product-1="00619947000020"
31
+ type="text/javascript"
32
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
33
+ ></script>
34
+
35
+ <div id="product-display"></div>
36
+ ```
37
+
38
+ **Multiple products:**
39
+
40
+ ```html
41
+ <script
42
+ defer
43
+ data-liquid-commerce-elements
44
+ data-token="YOUR_API_KEY"
45
+ data-env="production"
46
+ data-container-1="product-1"
47
+ data-product-1="00619947000020"
48
+ data-container-2="product-2"
49
+ data-product-2="08504405135"
50
+ type="text/javascript"
51
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
52
+ ></script>
53
+
54
+ <div id="product-1"></div>
55
+ <div id="product-2"></div>
56
+ ```
57
+
58
+ ### Alternative: Annotated Elements
59
+
60
+ Use `data-lce-product` on any div:
61
+
62
+ ```html
63
+ <script
64
+ defer
65
+ data-liquid-commerce-elements
66
+ data-token="YOUR_API_KEY"
67
+ data-env="production"
68
+ type="text/javascript"
69
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
70
+ ></script>
71
+
72
+ <div data-lce-product="00619947000020"></div>
73
+ <div data-lce-product="08504405135"></div>
74
+ ```
75
+
76
+ The SDK automatically generates IDs and injects products into these elements.
77
+
78
+ ### Alternative: JSON Configuration
79
+
80
+ For many products, use a JSON script tag:
81
+
82
+ ```html
83
+ <script
84
+ defer
85
+ data-liquid-commerce-elements
86
+ data-token="YOUR_API_KEY"
87
+ data-env="production"
88
+ type="text/javascript"
89
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
90
+ ></script>
91
+
92
+ <script data-liquid-commerce-elements-products type="application/json">
93
+ [
94
+ { "containerId": "product-1", "identifier": "00619947000020" },
95
+ { "containerId": "product-2", "identifier": "08504405135" },
96
+ { "containerId": "product-3", "identifier": "08068660001" }
97
+ ]
98
+ </script>
99
+
100
+ <div id="product-1"></div>
101
+ <div id="product-2"></div>
102
+ <div id="product-3"></div>
103
+ ```
104
+
105
+ ### Programmatic Setup
106
+
107
+ Use the JavaScript API for dynamic product injection:
108
+
109
+ ```javascript
110
+ const client = await Elements('YOUR_API_KEY', {
111
+ env: 'production'
112
+ });
113
+
114
+ await client.injectProductElement([
115
+ { containerId: 'product-display', identifier: '00619947000020' }
116
+ ]);
117
+ ```
118
+
119
+ **With NPM:**
120
+
121
+ ```javascript
122
+ import { Elements } from '@liquidcommerce/elements-sdk';
123
+
124
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
125
+
126
+ await client.injectProductElement([
127
+ { containerId: 'product-1', identifier: '00619947000020' },
128
+ { containerId: 'product-2', identifier: '08504405135' }
129
+ ]);
130
+ ```
131
+
132
+ ## Product Identifiers
133
+
134
+ Products can be identified using:
135
+
136
+ - **UPC**: `00619947000020`
137
+ - **Salsify Grouping**: `GROUPING-12345`
138
+
139
+ The SDK automatically resolves any of these identifier types.
140
+
141
+ ## Features
142
+
143
+ ### Image Carousel
144
+
145
+ Products with multiple images display in an interactive carousel:
146
+
147
+ - Swipe/arrow navigation
148
+ - Thumbnail preview
149
+ - Lazy loading for performance
150
+
151
+ **Background removal:** Product images (the main detail image and the gallery) automatically have their white/near-white background removed so photos blend into the surrounding page background instead of sitting on a white box. The SDK picks the technique per image based on the host background — blending the white away on light backgrounds, or keying it out to true transparency on dark or transparent backgrounds — and skips SVG artwork, which is already transparent. This is applied automatically and is not currently host-configurable.
152
+
153
+ ### Size Selection
154
+
155
+ For products with multiple sizes:
156
+
157
+ - Size selector
158
+ - Price updates per size
159
+ - Availability checking per size
160
+ - Out-of-stock indication
161
+
162
+ #### Preselect a Size via URL
163
+
164
+ Use the `lce_size` query parameter to preselect a size when the product page loads:
165
+
166
+ ```
167
+ https://yoursite.com/products/buffalo-trace?lce_size=750ml
168
+ ```
169
+
170
+ - The value is compared against each size's full label as shown on the page.
171
+ - Matching is case-insensitive and ignores spacing and punctuation — only letters, digits, and decimal points are compared — so `750 ML`, `750ml`, and `750ML` all select a `750ml` size, while decimals are kept so `1.0L` and `1.75L` stay distinct.
172
+ - If the value matches no size, the default size selection is used.
173
+
174
+ **Pack sizes:** the label includes the pack description when present (e.g. `50 ML (12PK)`). To select that size, include the pack in the value:
175
+
176
+ ```
177
+ https://yoursite.com/products/mini-bottles?lce_size=50ml(12pk)
178
+ ```
179
+
180
+ Both `50ml(12pk)` and `50ml12pk` match `50 ML (12PK)` (punctuation is ignored). A value of just `50ml` only matches a size whose label is `50 ML` with no pack.
181
+
182
+ `lce_size` is a fixed parameter name (not configured through a script attribute) and only applies to the product page.
183
+
184
+ ### Fulfillment Types
185
+
186
+ Two fulfillment options:
187
+
188
+ **Shipping**
189
+ - Standard delivery
190
+ - Nationwide availability
191
+ - Carrier-based shipping
192
+
193
+ **On-Demand Delivery**
194
+ - Same-day or scheduled delivery
195
+ - Local availability only
196
+ - Location-dependent pricing
197
+
198
+ The component shows only available fulfillment types based on the user's location.
199
+
200
+ ### Retailer Selection
201
+
202
+ For products with multiple retailers:
203
+
204
+ **Carousel View** (default)
205
+ - Swipeable carousel of retailer cards
206
+ - Shows retailer address, shipping/delivery expectation time, and pricing
207
+ - Select with one tap
208
+
209
+ **Popup View**
210
+ - "See Delivery Options" button (shows the available fulfillment count, e.g. "See Delivery Options (3)")
211
+ - Opens a plain, scrollable list of the available delivery/retailer options
212
+ - No filtering or search — select a retailer from the list to choose it
213
+
214
+ ### Personalization/Engraving
215
+
216
+ For products that support personalization:
217
+
218
+ - Engraving form appears automatically
219
+ - Character limits enforced
220
+ - Additional fees displayed
221
+
222
+ ### Quantity Selection
223
+
224
+ Adjust product quantity before adding to cart:
225
+
226
+ - Increment/decrement buttons
227
+ - Direct input field
228
+ - Inventory limits enforced
229
+
230
+ ## Actions API
231
+
232
+ Programmatically interact with products:
233
+
234
+ ### Get Product Details
235
+
236
+ Retrieve product information:
237
+
238
+ ```javascript
239
+ const productData = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
240
+
241
+ console.log(productData);
242
+ // {
243
+ // identifier: '00619947000020',
244
+ // name: 'Premium Whiskey',
245
+ // priceInfo: { currency: 'USD', minimum: 4999, average: 4999, maximum: 4999 },
246
+ // selectedSizeId: '750ml',
247
+ // selectedFulfillmentType: 'shipping',
248
+ // selectedFulfillmentId: 'fulfillment_123',
249
+ // productHasAvailability: true,
250
+ // fulfillmentHasAvailability: true,
251
+ // sizes: { '750ml': { ... } },
252
+ // ...
253
+ // }
254
+ ```
255
+
256
+ **Note:** The product must be injected and loaded before calling `getDetails()`. If the product hasn't been loaded, an error is thrown.
257
+
258
+ ### Get Product Availability by State
259
+
260
+ Check availability for one or more products in a given state. Returns a `Promise<IProductAvailabilityResponse>`:
261
+
262
+ ```javascript
263
+ const availability = await window.LiquidCommerce.elements.actions.product.getProductAvailabilityByState(
264
+ ['00619947000020', '08504405135'],
265
+ 'NY'
266
+ );
267
+
268
+ console.log(availability);
269
+ // {
270
+ // products: [...],
271
+ // retailers: { ... }
272
+ // }
273
+ ```
274
+
275
+ The `state` argument is optional; at least one product identifier is required.
276
+
277
+ ## Events
278
+
279
+ Listen for product-related events:
280
+
281
+ ### Product Loaded
282
+
283
+ Fired when product data is successfully loaded:
284
+
285
+ ```javascript
286
+ window.addEventListener('lce:actions.product_loaded', (event) => {
287
+ const { identifier, name, priceInfo } = event.detail.data;
288
+ console.log(`Product loaded: ${name} - $${priceInfo.minimum / 100}`);
289
+ });
290
+ ```
291
+
292
+ ### Product Add to Cart
293
+
294
+ Fired when user clicks "Add to Cart":
295
+
296
+ ```javascript
297
+ window.addEventListener('lce:actions.product_add_to_cart', (event) => {
298
+ const { identifier, quantity, fulfillmentId } = event.detail.data;
299
+ console.log(`Adding ${quantity}x ${identifier} (${fulfillmentId})`);
300
+ });
301
+ ```
302
+
303
+ ### Size Changed
304
+
305
+ Fired when user selects a different size:
306
+
307
+ ```javascript
308
+ window.addEventListener('lce:actions.product_size_changed', (event) => {
309
+ const { identifier, selectedSizeId, selectedSize } = event.detail.data;
310
+ console.log(`Size changed to ${selectedSize} (${selectedSizeId})`);
311
+ });
312
+ ```
313
+
314
+ ### Fulfillment Type Changed
315
+
316
+ Fired when user switches between shipping and on-demand:
317
+
318
+ ```javascript
319
+ window.addEventListener('lce:actions.product_fulfillment_type_changed', (event) => {
320
+ const { identifier, selectedFulfillmentType } = event.detail.data;
321
+ console.log(`Fulfillment type changed to: ${selectedFulfillmentType}`);
322
+ });
323
+ ```
324
+
325
+ ### Fulfillment (Retailer) Changed
326
+
327
+ Fired when user selects a different retailer:
328
+
329
+ ```javascript
330
+ window.addEventListener('lce:actions.product_fulfillment_changed', (event) => {
331
+ const { identifier, selectedFulfillmentId, selectedFulfillmentType } = event.detail.data;
332
+ console.log(`Fulfillment changed to ${selectedFulfillmentId} (${selectedFulfillmentType})`);
333
+ });
334
+ ```
335
+
336
+ ### Quantity Increased/Decreased
337
+
338
+ Fired when user adjusts quantity:
339
+
340
+ ```javascript
341
+ window.addEventListener('lce:actions.product_quantity_increase', (event) => {
342
+ const { identifier, quantity } = event.detail.data;
343
+ console.log(`Quantity increased to: ${quantity}`);
344
+ });
345
+
346
+ window.addEventListener('lce:actions.product_quantity_decrease', (event) => {
347
+ const { identifier, quantity } = event.detail.data;
348
+ console.log(`Quantity decreased to: ${quantity}`);
349
+ });
350
+ ```
351
+
352
+ ## Customization
353
+
354
+ ### Theme Configuration
355
+
356
+ Customize product appearance globally:
357
+
358
+ ```javascript
359
+ const client = await Elements('YOUR_API_KEY', {
360
+ env: 'production',
361
+ customTheme: {
362
+ product: {
363
+ theme: {
364
+ backgroundColor: '#ffffff'
365
+ },
366
+ layout: {
367
+ showImages: true,
368
+ showOnlyMainImage: false, // Show all images or just the main one
369
+ showTitle: true,
370
+ showDescription: true,
371
+ descriptionPosition: 'below', // Description placement: 'above' or 'below'
372
+ showQuantityCounter: true,
373
+ showOffHours: true, // Show when retailer is closed
374
+ quantityCounterStyle: 'outlined', // or 'ghost'
375
+ fulfillmentDisplay: 'carousel', // or 'popup'
376
+ enableShippingFulfillment: true,
377
+ enableOnDemandFulfillment: true,
378
+ addToCartButtonText: 'Add to Cart',
379
+ addToCartButtonShowTotalPrice: true,
380
+ buyNowButtonText: 'Buy Now',
381
+ preSaleButtonText: 'Pre-Order',
382
+ prioritizeEngraving: false, // Show engraving option before add-to-cart
383
+ noAvailabilityText: 'Not available in your area'
384
+ }
385
+ }
386
+ }
387
+ });
388
+ ```
389
+
390
+ ### Global Theme
391
+
392
+ Set colors, fonts, and styles that apply to all components:
393
+
394
+ ```javascript
395
+ customTheme: {
396
+ global: {
397
+ theme: {
398
+ primaryColor: '#007bff',
399
+ accentColor: '#28a745',
400
+ buttonCornerRadius: '8px',
401
+ cardCornerRadius: '12px',
402
+ headingFont: {
403
+ name: 'Poppins',
404
+ weights: [400, 600, 700]
405
+ },
406
+ paragraphFont: {
407
+ name: 'Inter',
408
+ weights: [400, 500]
409
+ }
410
+ }
411
+ }
412
+ }
413
+ ```
414
+
415
+ See [Theming Guide](./theming.md) for complete theming options.
416
+
417
+ ## Address Requirement
418
+
419
+ Products require a delivery address for:
420
+ - Availability checking
421
+ - Accurate pricing
422
+ - Delivery options
423
+
424
+ ### Automatic Address Collection
425
+
426
+ If no address is set, the SDK automatically:
427
+ 1. Prompts for address when user clicks "Add to Cart"
428
+ 2. Shows address input drawer
429
+ 3. Validates and saves address
430
+ 4. Completes the add-to-cart action
431
+
432
+ ### Pre-set Address
433
+
434
+ Set address programmatically to skip prompting:
435
+
436
+ ```javascript
437
+ // Using Google Places ID
438
+ await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId('ChIJ...');
439
+
440
+ // Or manually
441
+ await window.LiquidCommerce.elements.actions.address.setAddressManually(
442
+ {
443
+ one: '123 Main St',
444
+ two: 'Apt 4',
445
+ city: 'New York',
446
+ state: 'NY',
447
+ zip: '10001',
448
+ country: 'US'
449
+ },
450
+ {
451
+ latitude: 40.7128,
452
+ longitude: -74.0060
453
+ }
454
+ );
455
+ ```
456
+
457
+ ## Presale Products
458
+
459
+ Products in presale mode:
460
+ - Display "Pre-Order" button (customizable text)
461
+ - Cannot be added to cart, it will send the user to checkout directly
462
+ - Show presale countdown if configured
463
+ - Display expected availability date
464
+
465
+ Presale products are handled automatically; no special configuration needed.
466
+
467
+ ## Component Management
468
+
469
+ ### Rerender Product
470
+
471
+ Force a product to reload and rerender:
472
+
473
+ ```javascript
474
+ const components = window.LiquidCommerce.elements.getInjectedComponents();
475
+ const productComponent = components.get('product-1');
476
+
477
+ if (productComponent) {
478
+ productComponent.rerender();
479
+ }
480
+ ```
481
+
482
+ ### Get Component Type
483
+
484
+ Check if a component is a product:
485
+
486
+ ```javascript
487
+ const component = components.get('product-1');
488
+ const type = component.getType();
489
+ console.log(type); // 'product'
490
+ ```
491
+
492
+ ### Get Container Element
493
+
494
+ Access the container DOM element:
495
+
496
+ ```javascript
497
+ const component = components.get('product-1');
498
+ const container = component.getElement();
499
+ console.log(container); // <div id="product-1">...</div>
500
+ ```
501
+
502
+ ## Error Handling
503
+
504
+ ### Product Not Found
505
+
506
+ If a product identifier doesn't exist:
507
+
508
+ ```javascript
509
+ // An error view is shown in the container, and the store entry's `error`
510
+ // is set to 'Product data not found'. In debug/logging mode the SDK warns:
511
+ // "No product data found for the provided product IDs."
512
+ ```
513
+
514
+ ### No Availability
515
+
516
+ If a product isn't available in the user's location:
517
+
518
+ ```javascript
519
+ // Shows: "Not available in your area" (customizable)
520
+ // User cannot add to cart
521
+ ```
522
+
523
+ ### Loading Errors
524
+
525
+ If product data fails to load:
526
+
527
+ ```javascript
528
+ // Shows error view with retry option
529
+ // Console logs detailed error information
530
+ ```
531
+
532
+ ## Use Cases
533
+
534
+ ### Basic Product Page
535
+
536
+ ```html
537
+ <!DOCTYPE html>
538
+ <html>
539
+ <head>
540
+ <script
541
+ defer
542
+ data-liquid-commerce-elements
543
+ data-token="YOUR_API_KEY"
544
+ data-env="production"
545
+ data-container-1="product"
546
+ data-product-1="00619947000020"
547
+ type="text/javascript"
548
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
549
+ ></script>
550
+ </head>
551
+ <body>
552
+ <div id="product"></div>
553
+ </body>
554
+ </html>
555
+ ```
556
+
557
+ ### Dynamic Product Selection
558
+
559
+ ```javascript
560
+ import { Elements } from '@liquidcommerce/elements-sdk';
561
+
562
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
563
+
564
+ // User selects product from dropdown
565
+ document.getElementById('product-selector').addEventListener('change', async (e) => {
566
+ const selectedId = e.target.value;
567
+
568
+ // Clear existing product
569
+ document.getElementById('product').innerHTML = '';
570
+
571
+ // Inject new product
572
+ await client.injectProductElement([
573
+ { containerId: 'product', identifier: selectedId }
574
+ ]);
575
+ });
576
+ ```
577
+
578
+ ### Analytics Integration
579
+
580
+ ```javascript
581
+ // Track product views
582
+ window.addEventListener('lce:actions.product_loaded', (event) => {
583
+ gtag('event', 'view_item', {
584
+ items: [{
585
+ item_id: event.detail.data.identifier,
586
+ item_name: event.detail.data.name,
587
+ price: event.detail.data.priceInfo.minimum / 100
588
+ }]
589
+ });
590
+ });
591
+
592
+ // Track add to cart
593
+ window.addEventListener('lce:actions.product_add_to_cart', (event) => {
594
+ gtag('event', 'add_to_cart', {
595
+ items: [{
596
+ item_id: event.detail.data.identifier,
597
+ quantity: event.detail.data.quantity
598
+ }]
599
+ });
600
+ });
601
+ ```
602
+
603
+ ### Multi-Product Gallery
604
+
605
+ ```javascript
606
+ const products = [
607
+ '00619947000020',
608
+ '08504405135',
609
+ '08068660001',
610
+ '07549900125'
611
+ ];
612
+
613
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
614
+
615
+ // Create containers
616
+ const gallery = document.getElementById('product-gallery');
617
+ const productParams = products.map((id, index) => {
618
+ const container = document.createElement('div');
619
+ container.className = 'product-card';
620
+ container.id = `product-${index}`;
621
+ gallery.appendChild(container);
622
+
623
+ return { containerId: `product-${index}`, identifier: id };
624
+ });
625
+
626
+ // Inject all products
627
+ await client.injectProductElement(productParams);
628
+ ```
629
+
630
+ ## Best Practices
631
+
632
+ ### Container Sizing
633
+
634
+ Provide adequate space for the product component:
635
+
636
+ ```css
637
+ #product-display {
638
+ min-height: 600px; /* Prevents layout shift */
639
+ max-width: 1200px;
640
+ margin: 0 auto;
641
+ }
642
+ ```
643
+
644
+ ### Loading States
645
+
646
+ Show a loading indicator while the product loads:
647
+
648
+ ```javascript
649
+ // Show loader
650
+ document.getElementById('product').innerHTML = '<div class="loader">Loading...</div>';
651
+
652
+ await client.injectProductElement([
653
+ { containerId: 'product', identifier: '00619947000020' }
654
+ ]);
655
+
656
+ // Loader is automatically replaced when product loads
657
+ ```
658
+
659
+ ### Error Handling
660
+
661
+ Listen for errors and provide fallback:
662
+
663
+ ```javascript
664
+ try {
665
+ await client.injectProductElement([
666
+ { containerId: 'product', identifier: productId }
667
+ ]);
668
+ } catch (error) {
669
+ console.error('Failed to load product:', error);
670
+ document.getElementById('product').innerHTML =
671
+ '<p>Unable to load product. Please try again later.</p>';
672
+ }
673
+ ```
674
+
675
+ ### Performance
676
+
677
+ For product listings, lazy load products as they come into view:
678
+
679
+ ```javascript
680
+ const observer = new IntersectionObserver(async (entries) => {
681
+ for (const entry of entries) {
682
+ if (entry.isIntersecting) {
683
+ const container = entry.target;
684
+ const productId = container.dataset.productId;
685
+
686
+ await client.injectProductElement([
687
+ { containerId: container.id, identifier: productId }
688
+ ]);
689
+
690
+ observer.unobserve(container);
691
+ }
692
+ }
693
+ });
694
+
695
+ // Observe all product containers
696
+ document.querySelectorAll('.product-placeholder').forEach(el => {
697
+ observer.observe(el);
698
+ });
699
+ ```
700
+
701
+ ## Troubleshooting
702
+
703
+ ### Product Not Displaying
704
+
705
+ 1. Check browser console for errors
706
+ 2. Verify container ID exists in the DOM
707
+ 3. Confirm product identifier is valid
708
+ 4. Check that SDK is initialized (`window.LiquidCommerce.elements` exists)
709
+
710
+ ### Wrong Pricing
711
+
712
+ - Ensure user's address is set correctly
713
+ - Verify product has availability in user's location
714
+ - Check that fulfillment type is supported
715
+
716
+ ### Images Not Loading
717
+
718
+ - Check network tab for 404 errors
719
+ - Verify product has images in the catalog
720
+ - Ensure no ad blockers are interfering
721
+
722
+ ### Size Selector Not Showing
723
+
724
+ - Product must have multiple sizes to show selector
725
+ - Check that sizes have availability
726
+ - Verify theme config hasn't hidden the selector
727
+
728
+ ## See Also
729
+
730
+ - [Cart Component](./cart-component.md) - Shopping cart functionality
731
+ - [Address Component](./address-component.md) - Location management
732
+ - [Checkout Component](./checkout-component.md) - Complete purchase flow
733
+ - [Theming](./theming.md) - Customize appearance
734
+ - [Events](./events.md) - All available events
735
+ - [Actions API](../api/actions/product-actions.md) - Product actions reference