@liquidcommerce/elements-sdk 2.6.0-beta.9 → 2.6.0-beta.90

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