@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,736 @@
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
+ primaryFulfillmentMethod: 'shipping', // or 'onDemand'
379
+ addToCartButtonText: 'Add to Cart',
380
+ addToCartButtonShowTotalPrice: true,
381
+ buyNowButtonText: 'Buy Now',
382
+ preSaleButtonText: 'Pre-Order',
383
+ prioritizeEngraving: false, // Show engraving option before add-to-cart
384
+ noAvailabilityText: 'Not available in your area'
385
+ }
386
+ }
387
+ }
388
+ });
389
+ ```
390
+
391
+ ### Global Theme
392
+
393
+ Set colors, fonts, and styles that apply to all components:
394
+
395
+ ```javascript
396
+ customTheme: {
397
+ global: {
398
+ theme: {
399
+ primaryColor: '#007bff',
400
+ accentColor: '#28a745',
401
+ buttonCornerRadius: '8px',
402
+ cardCornerRadius: '12px',
403
+ headingFont: {
404
+ name: 'Poppins',
405
+ weights: [400, 600, 700]
406
+ },
407
+ paragraphFont: {
408
+ name: 'Inter',
409
+ weights: [400, 500]
410
+ }
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ See [Theming Guide](./theming.md) for complete theming options.
417
+
418
+ ## Address Requirement
419
+
420
+ Products require a delivery address for:
421
+ - Availability checking
422
+ - Accurate pricing
423
+ - Delivery options
424
+
425
+ ### Automatic Address Collection
426
+
427
+ If no address is set, the SDK automatically:
428
+ 1. Prompts for address when user clicks "Add to Cart"
429
+ 2. Shows address input drawer
430
+ 3. Validates and saves address
431
+ 4. Completes the add-to-cart action
432
+
433
+ ### Pre-set Address
434
+
435
+ Set address programmatically to skip prompting:
436
+
437
+ ```javascript
438
+ // Using Google Places ID
439
+ await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId('ChIJ...');
440
+
441
+ // Or manually
442
+ await window.LiquidCommerce.elements.actions.address.setAddressManually(
443
+ {
444
+ one: '123 Main St',
445
+ two: 'Apt 4',
446
+ city: 'New York',
447
+ state: 'NY',
448
+ zip: '10001',
449
+ country: 'US'
450
+ },
451
+ {
452
+ latitude: 40.7128,
453
+ longitude: -74.0060
454
+ }
455
+ );
456
+ ```
457
+
458
+ ## Presale Products
459
+
460
+ Products in presale mode:
461
+ - Display "Pre-Order" button (customizable text)
462
+ - Cannot be added to cart, it will send the user to checkout directly
463
+ - Show presale countdown if configured
464
+ - Display expected availability date
465
+
466
+ Presale products are handled automatically; no special configuration needed.
467
+
468
+ ## Component Management
469
+
470
+ ### Rerender Product
471
+
472
+ Force a product to reload and rerender:
473
+
474
+ ```javascript
475
+ const components = window.LiquidCommerce.elements.getInjectedComponents();
476
+ const productComponent = components.get('product-1');
477
+
478
+ if (productComponent) {
479
+ productComponent.rerender();
480
+ }
481
+ ```
482
+
483
+ ### Get Component Type
484
+
485
+ Check if a component is a product:
486
+
487
+ ```javascript
488
+ const component = components.get('product-1');
489
+ const type = component.getType();
490
+ console.log(type); // 'product'
491
+ ```
492
+
493
+ ### Get Container Element
494
+
495
+ Access the container DOM element:
496
+
497
+ ```javascript
498
+ const component = components.get('product-1');
499
+ const container = component.getElement();
500
+ console.log(container); // <div id="product-1">...</div>
501
+ ```
502
+
503
+ ## Error Handling
504
+
505
+ ### Product Not Found
506
+
507
+ If a product identifier doesn't exist:
508
+
509
+ ```javascript
510
+ // An error view is shown in the container, and the store entry's `error`
511
+ // is set to 'Product data not found'. In debug/logging mode the SDK warns:
512
+ // "No product data found for the provided product IDs."
513
+ ```
514
+
515
+ ### No Availability
516
+
517
+ If a product isn't available in the user's location:
518
+
519
+ ```javascript
520
+ // Shows: "Not available in your area" (customizable)
521
+ // User cannot add to cart
522
+ ```
523
+
524
+ ### Loading Errors
525
+
526
+ If product data fails to load:
527
+
528
+ ```javascript
529
+ // Shows error view with retry option
530
+ // Console logs detailed error information
531
+ ```
532
+
533
+ ## Use Cases
534
+
535
+ ### Basic Product Page
536
+
537
+ ```html
538
+ <!DOCTYPE html>
539
+ <html>
540
+ <head>
541
+ <script
542
+ defer
543
+ data-liquid-commerce-elements
544
+ data-token="YOUR_API_KEY"
545
+ data-env="production"
546
+ data-container-1="product"
547
+ data-product-1="00619947000020"
548
+ type="text/javascript"
549
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
550
+ ></script>
551
+ </head>
552
+ <body>
553
+ <div id="product"></div>
554
+ </body>
555
+ </html>
556
+ ```
557
+
558
+ ### Dynamic Product Selection
559
+
560
+ ```javascript
561
+ import { Elements } from '@liquidcommerce/elements-sdk';
562
+
563
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
564
+
565
+ // User selects product from dropdown
566
+ document.getElementById('product-selector').addEventListener('change', async (e) => {
567
+ const selectedId = e.target.value;
568
+
569
+ // Clear existing product
570
+ document.getElementById('product').innerHTML = '';
571
+
572
+ // Inject new product
573
+ await client.injectProductElement([
574
+ { containerId: 'product', identifier: selectedId }
575
+ ]);
576
+ });
577
+ ```
578
+
579
+ ### Analytics Integration
580
+
581
+ ```javascript
582
+ // Track product views
583
+ window.addEventListener('lce:actions.product_loaded', (event) => {
584
+ gtag('event', 'view_item', {
585
+ items: [{
586
+ item_id: event.detail.data.identifier,
587
+ item_name: event.detail.data.name,
588
+ price: event.detail.data.priceInfo.minimum / 100
589
+ }]
590
+ });
591
+ });
592
+
593
+ // Track add to cart
594
+ window.addEventListener('lce:actions.product_add_to_cart', (event) => {
595
+ gtag('event', 'add_to_cart', {
596
+ items: [{
597
+ item_id: event.detail.data.identifier,
598
+ quantity: event.detail.data.quantity
599
+ }]
600
+ });
601
+ });
602
+ ```
603
+
604
+ ### Multi-Product Gallery
605
+
606
+ ```javascript
607
+ const products = [
608
+ '00619947000020',
609
+ '08504405135',
610
+ '08068660001',
611
+ '07549900125'
612
+ ];
613
+
614
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
615
+
616
+ // Create containers
617
+ const gallery = document.getElementById('product-gallery');
618
+ const productParams = products.map((id, index) => {
619
+ const container = document.createElement('div');
620
+ container.className = 'product-card';
621
+ container.id = `product-${index}`;
622
+ gallery.appendChild(container);
623
+
624
+ return { containerId: `product-${index}`, identifier: id };
625
+ });
626
+
627
+ // Inject all products
628
+ await client.injectProductElement(productParams);
629
+ ```
630
+
631
+ ## Best Practices
632
+
633
+ ### Container Sizing
634
+
635
+ Provide adequate space for the product component:
636
+
637
+ ```css
638
+ #product-display {
639
+ min-height: 600px; /* Prevents layout shift */
640
+ max-width: 1200px;
641
+ margin: 0 auto;
642
+ }
643
+ ```
644
+
645
+ ### Loading States
646
+
647
+ Show a loading indicator while the product loads:
648
+
649
+ ```javascript
650
+ // Show loader
651
+ document.getElementById('product').innerHTML = '<div class="loader">Loading...</div>';
652
+
653
+ await client.injectProductElement([
654
+ { containerId: 'product', identifier: '00619947000020' }
655
+ ]);
656
+
657
+ // Loader is automatically replaced when product loads
658
+ ```
659
+
660
+ ### Error Handling
661
+
662
+ Listen for errors and provide fallback:
663
+
664
+ ```javascript
665
+ try {
666
+ await client.injectProductElement([
667
+ { containerId: 'product', identifier: productId }
668
+ ]);
669
+ } catch (error) {
670
+ console.error('Failed to load product:', error);
671
+ document.getElementById('product').innerHTML =
672
+ '<p>Unable to load product. Please try again later.</p>';
673
+ }
674
+ ```
675
+
676
+ ### Performance
677
+
678
+ For product listings, lazy load products as they come into view:
679
+
680
+ ```javascript
681
+ const observer = new IntersectionObserver(async (entries) => {
682
+ for (const entry of entries) {
683
+ if (entry.isIntersecting) {
684
+ const container = entry.target;
685
+ const productId = container.dataset.productId;
686
+
687
+ await client.injectProductElement([
688
+ { containerId: container.id, identifier: productId }
689
+ ]);
690
+
691
+ observer.unobserve(container);
692
+ }
693
+ }
694
+ });
695
+
696
+ // Observe all product containers
697
+ document.querySelectorAll('.product-placeholder').forEach(el => {
698
+ observer.observe(el);
699
+ });
700
+ ```
701
+
702
+ ## Troubleshooting
703
+
704
+ ### Product Not Displaying
705
+
706
+ 1. Check browser console for errors
707
+ 2. Verify container ID exists in the DOM
708
+ 3. Confirm product identifier is valid
709
+ 4. Check that SDK is initialized (`window.LiquidCommerce.elements` exists)
710
+
711
+ ### Wrong Pricing
712
+
713
+ - Ensure user's address is set correctly
714
+ - Verify product has availability in user's location
715
+ - Check that fulfillment type is supported
716
+
717
+ ### Images Not Loading
718
+
719
+ - Check network tab for 404 errors
720
+ - Verify product has images in the catalog
721
+ - Ensure no ad blockers are interfering
722
+
723
+ ### Size Selector Not Showing
724
+
725
+ - Product must have multiple sizes to show selector
726
+ - Check that sizes have availability
727
+ - Verify theme config hasn't hidden the selector
728
+
729
+ ## See Also
730
+
731
+ - [Cart Component](./cart-component.md) - Shopping cart functionality
732
+ - [Address Component](./address-component.md) - Location management
733
+ - [Checkout Component](./checkout-component.md) - Complete purchase flow
734
+ - [Theming](./theming.md) - Customize appearance
735
+ - [Events](./events.md) - All available events
736
+ - [Actions API](../api/actions/product-actions.md) - Product actions reference