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

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 +18210 -0
  3. package/dist/index.esm.js +26253 -20673
  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 +214 -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,349 @@
1
+ # Installation
2
+
3
+ The LiquidCommerce Elements SDK can be integrated into your website using either a CDN script tag or as an NPM package.
4
+
5
+ ## Browser Requirements
6
+
7
+ The SDK requires:
8
+ - Modern browser with Web Components support (Chrome 66+, Firefox 60+, Safari 12+, Edge 79+)
9
+ - Shadow DOM support
10
+ - JavaScript enabled
11
+
12
+ For older browsers, you'll need to include Web Components and Shadow DOM polyfills.
13
+
14
+ ## CDN Installation (Recommended)
15
+
16
+ The simplest way to get started is by adding the SDK script tag to your HTML.
17
+
18
+ ### Basic Setup
19
+
20
+ Add the following script tag to your page's `<head>` section:
21
+
22
+ ```html
23
+ <script
24
+ defer
25
+ data-liquid-commerce-elements
26
+ data-token="YOUR_API_KEY"
27
+ data-env="production"
28
+ type="text/javascript"
29
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
30
+ ></script>
31
+ ```
32
+
33
+ > **Note:** The host `elements.reservebar-worker.workers.dev` shown above is an example, partner-specific endpoint. Use the CDN URL provided by your LiquidCommerce representative in place of this host.
34
+
35
+ The path segment selects which bundle is served:
36
+
37
+ | Path | Bundle |
38
+ |------|--------|
39
+ | `/all/elements.js` | Full SDK bundle (product, cart, checkout, and all other elements) |
40
+ | `/checkout/checkout.js` | Checkout-only bundle (tree-shaken, smaller) |
41
+ | `/all/beta/elements.js` | Beta channel of the full SDK bundle |
42
+
43
+ ### Script Attributes
44
+
45
+ | Attribute | Required | Description |
46
+ |-----------|----------|-------------|
47
+ | `data-liquid-commerce-elements` | Yes | Identifies this as the Elements SDK script |
48
+ | `data-token` | Yes | Your LiquidCommerce API key |
49
+ | `data-env` | No | Environment: `staging` or `production`. Defaults to `production` if omitted. |
50
+ | `defer` | Recommended | Allows non-blocking script loading |
51
+
52
+ ### Where to Place the Script
53
+
54
+ While the `<head>` section is recommended, the script can be placed anywhere on your page:
55
+
56
+ ```html
57
+ <!DOCTYPE html>
58
+ <html>
59
+ <head>
60
+ <title>My Store</title>
61
+ <!-- SDK script in head (recommended) -->
62
+ <script
63
+ defer
64
+ data-liquid-commerce-elements
65
+ data-token="YOUR_API_KEY"
66
+ data-env="production"
67
+ type="text/javascript"
68
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
69
+ ></script>
70
+ </head>
71
+ <body>
72
+ <!-- Your content -->
73
+ </body>
74
+ </html>
75
+ ```
76
+
77
+ The `defer` attribute ensures the script loads asynchronously without blocking page content, keeping your site fast regardless of placement.
78
+
79
+ ### Checkout-Only Build
80
+
81
+ If you only need checkout functionality (without product displays or cart), use the lighter checkout-only build:
82
+
83
+ ```html
84
+ <script
85
+ defer
86
+ data-liquid-commerce-elements
87
+ data-token="YOUR_API_KEY"
88
+ data-env="production"
89
+ type="text/javascript"
90
+ src="https://elements.reservebar-worker.workers.dev/checkout/checkout.js"
91
+ ></script>
92
+ ```
93
+
94
+ This build is tree-shaken and significantly smaller, ideal for dedicated checkout pages.
95
+
96
+ ## NPM Installation
97
+
98
+ For JavaScript/TypeScript projects using a bundler (Webpack, Rollup, Vite, etc.), install via NPM:
99
+
100
+ ```bash
101
+ npm install @liquidcommerce/elements-sdk
102
+ ```
103
+
104
+ ### Basic Usage
105
+
106
+ ```javascript
107
+ import { Elements } from '@liquidcommerce/elements-sdk';
108
+
109
+ // Initialize the client
110
+ const client = await Elements('YOUR_API_KEY', {
111
+ env: 'production'
112
+ });
113
+
114
+ // Client is ready to use
115
+ console.log('Elements SDK initialized');
116
+ ```
117
+
118
+ ### Checkout-Only Import
119
+
120
+ For tree-shaking benefits in checkout-only scenarios:
121
+
122
+ ```javascript
123
+ import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
124
+
125
+ const client = await ElementsCheckout('YOUR_API_KEY', {
126
+ env: 'production'
127
+ });
128
+ ```
129
+
130
+ ### TypeScript Support
131
+
132
+ The SDK includes full TypeScript definitions. Import types as needed:
133
+
134
+ ```typescript
135
+ import { Elements } from '@liquidcommerce/elements-sdk';
136
+ import type {
137
+ ILiquidCommerceElementsClient,
138
+ ILiquidCommerceElementsConfig,
139
+ IInjectProductElement
140
+ } from '@liquidcommerce/elements-sdk';
141
+
142
+ const config: ILiquidCommerceElementsConfig = {
143
+ env: 'production',
144
+ customTheme: {
145
+ global: {
146
+ theme: {
147
+ primaryColor: '#007bff'
148
+ }
149
+ }
150
+ }
151
+ };
152
+
153
+ // Elements() returns `null` in SSR / non-browser environments, so the
154
+ // client is typed as `ILiquidCommerceElementsClient | null`.
155
+ const client: ILiquidCommerceElementsClient | null = await Elements('YOUR_API_KEY', config);
156
+
157
+ if (client) {
158
+ // Safe to use the client here
159
+ client.injectProductElement([
160
+ { containerId: 'product-1', identifier: '00619947000020' }
161
+ ]);
162
+ }
163
+ ```
164
+
165
+ ## Framework Integration
166
+
167
+ ### React
168
+
169
+ ```jsx
170
+ import { Elements } from '@liquidcommerce/elements-sdk';
171
+ import { useEffect, useState } from 'react';
172
+
173
+ function App() {
174
+ const [elementsClient, setElementsClient] = useState(null);
175
+
176
+ useEffect(() => {
177
+ async function initElements() {
178
+ const client = await Elements('YOUR_API_KEY', {
179
+ env: 'production'
180
+ });
181
+ setElementsClient(client);
182
+ }
183
+
184
+ initElements();
185
+ }, []);
186
+
187
+ useEffect(() => {
188
+ if (elementsClient) {
189
+ elementsClient.injectProductElement([
190
+ { containerId: 'product-1', identifier: '00619947000020' }
191
+ ]);
192
+ }
193
+ }, [elementsClient]);
194
+
195
+ return (
196
+ <div>
197
+ <div id="product-1"></div>
198
+ </div>
199
+ );
200
+ }
201
+ ```
202
+
203
+ ### Vue
204
+
205
+ ```vue
206
+ <template>
207
+ <div id="product-1"></div>
208
+ </template>
209
+
210
+ <script>
211
+ import { Elements } from '@liquidcommerce/elements-sdk';
212
+
213
+ export default {
214
+ async mounted() {
215
+ const client = await Elements('YOUR_API_KEY', {
216
+ env: 'production'
217
+ });
218
+
219
+ await client.injectProductElement([
220
+ { containerId: 'product-1', identifier: '00619947000020' }
221
+ ]);
222
+ }
223
+ }
224
+ </script>
225
+ ```
226
+
227
+ ### Next.js
228
+
229
+ In Next.js, initialize the SDK in a client component:
230
+
231
+ ```jsx
232
+ 'use client';
233
+
234
+ import { Elements } from '@liquidcommerce/elements-sdk';
235
+ import { useEffect } from 'react';
236
+
237
+ export default function ProductPage() {
238
+ useEffect(() => {
239
+ async function init() {
240
+ const client = await Elements('YOUR_API_KEY', {
241
+ env: 'production',
242
+ proxy: {
243
+ baseUrl: '/api/elements-proxy'
244
+ }
245
+ });
246
+
247
+ await client.injectProductElement([
248
+ { containerId: 'product', identifier: '00619947000020' }
249
+ ]);
250
+ }
251
+
252
+ init();
253
+ }, []);
254
+
255
+ return <div id="product"></div>;
256
+ }
257
+ ```
258
+
259
+ > **Note:** The SDK is SSR-safe. When imported in a Node.js / SSR environment, a lightweight stub is resolved automatically — factory functions return `null` and no browser APIs are accessed. Initialize on the client (e.g., `useEffect`, `onMounted`) to get the real client.
260
+
261
+ ## Configuration Options
262
+
263
+ The SDK accepts a configuration object during initialization:
264
+
265
+ ```javascript
266
+ const client = await Elements('YOUR_API_KEY', {
267
+ env: 'production', // Optional (defaults to 'production'): 'staging' | 'production'
268
+ debugMode: 'console', // Optional: 'none' | 'console' | 'panel'
269
+ customTheme: { /* ... */ }, // Optional: Theme customization
270
+ promoTicker: [ /* ... */ ], // Optional: Promo ticker configuration
271
+ proxy: { /* ... */ }, // Optional: Proxy configuration
272
+ checkout: { /* ... */ }, // Optional: Checkout configuration
273
+ development: { /* ... */ } // Optional: Development/testing options
274
+ });
275
+ ```
276
+
277
+ > **Note:** `debugMode` is ignored when `env` is `'production'`. Debug logging and the debug panel are only activated outside production (`staging`).
278
+
279
+ See [Configuration Reference](../api/configuration.md) for complete configuration options.
280
+
281
+ ## Verification
282
+
283
+ After installation, verify the SDK is loaded correctly:
284
+
285
+ ### CDN Verification
286
+
287
+ Open your browser's console and check for:
288
+
289
+ ```javascript
290
+ // The client is available globally
291
+ console.log(window.LiquidCommerce.elements);
292
+ // Should output: { injectProductElement: ƒ, ui: {...}, actions: {...}, ... }
293
+ ```
294
+
295
+ ### NPM Verification
296
+
297
+ ```javascript
298
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
299
+ console.log(client); // Should output the client object
300
+ ```
301
+
302
+ ## Troubleshooting Installation
303
+
304
+ ### Script Not Loading
305
+
306
+ If the SDK script fails to load:
307
+
308
+ 1. **Check the network tab** in browser DevTools for 404 or CORS errors
309
+ 2. **Verify the script URL** is correct and accessible
310
+ 3. **Check ad blockers** - they may block scripts with "commerce" in the name (see [Proxy Setup](../integration/proxy-setup.md))
311
+
312
+ ### Web Components Not Supported
313
+
314
+ If you see an error about Web Components:
315
+
316
+ ```
317
+ [LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.
318
+ ```
319
+
320
+ Include a Web Components polyfill before the SDK script:
321
+
322
+ ```html
323
+ <script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-bundle.js"></script>
324
+ <script defer data-liquid-commerce-elements ...></script>
325
+ ```
326
+
327
+ ### TypeScript Errors
328
+
329
+ If you encounter TypeScript errors:
330
+
331
+ 1. Ensure TypeScript version is 4.5 or higher
332
+ 2. Check that `@liquidcommerce/elements-sdk` is in your `dependencies` (not `devDependencies`)
333
+ 3. Verify your `tsconfig.json` includes:
334
+
335
+ ```json
336
+ {
337
+ "compilerOptions": {
338
+ "moduleResolution": "node",
339
+ "esModuleInterop": true
340
+ }
341
+ }
342
+ ```
343
+
344
+ ## Next Steps
345
+
346
+ - **Quick Start**: [Build your first product page in 5 minutes](./quick-start.md)
347
+ - **Core Concepts**: [Understand how the SDK works](./concepts.md)
348
+ - **Component Guides**: [Product](../guides/product-component.md), [Cart](../guides/cart-component.md), [Checkout](../guides/checkout-component.md)
349
+ - **API Reference**: [Full API documentation](../api/client.md)