@liquidcommerce/elements-sdk 2.6.0-beta.13 → 2.6.0-beta.131

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 (304) hide show
  1. package/README.md +102 -2518
  2. package/dist/index.checkout.esm.js +22524 -0
  3. package/dist/index.esm.js +30689 -20632
  4. package/dist/ssr-stub.checkout.esm.js +17 -0
  5. package/dist/ssr-stub.esm.js +281 -0
  6. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  7. package/dist/types/auto-initialize/shared-utils.d.ts +51 -0
  8. package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +16 -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/clients/helpers.d.ts +8 -0
  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/constants/index.d.ts +1 -0
  15. package/dist/types/constants/prop65.constant.d.ts +8 -0
  16. package/dist/types/core/a11y/announcer.service.d.ts +16 -0
  17. package/dist/types/core/a11y/focus-manager.service.d.ts +21 -0
  18. package/dist/types/core/a11y/focusable.d.ts +5 -0
  19. package/dist/types/core/a11y/glyph-button.d.ts +8 -0
  20. package/dist/types/core/a11y/index.d.ts +6 -0
  21. package/dist/types/core/a11y/required.d.ts +1 -0
  22. package/dist/types/core/a11y/single-select.d.ts +20 -0
  23. package/dist/types/core/api/api-client.service.d.ts +23 -18
  24. package/dist/types/core/api/api-result.d.ts +20 -0
  25. package/dist/types/core/api/auth-client.service.d.ts +37 -13
  26. package/dist/types/core/api/http-client.service.d.ts +0 -8
  27. package/dist/types/core/base-component.service.d.ts +4 -1
  28. package/dist/types/core/client/actions/base-action.service.d.ts +22 -0
  29. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  30. package/dist/types/core/client/actions/client-analytics-action.service.d.ts +35 -0
  31. package/dist/types/core/client/actions/client-cart-action.service.d.ts +38 -0
  32. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +81 -0
  33. package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
  34. package/dist/types/core/client/client-action.service.d.ts +7 -74
  35. package/dist/types/core/client/client-config.service.d.ts +12 -5
  36. package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -1
  37. package/dist/types/core/google-tag-manager.service.d.ts +13 -3
  38. package/dist/types/core/logger/logger.service.d.ts +1 -1
  39. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -0
  40. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +6 -1
  41. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +54 -48
  42. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +18 -7
  43. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  44. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  45. package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
  46. package/dist/types/core/store/interfaces/checkout.interface.d.ts +40 -107
  47. package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
  48. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  49. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  50. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  51. package/dist/types/core/store/store.constant.d.ts +5 -0
  52. package/dist/types/core/store/store.service.d.ts +1 -0
  53. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  54. package/dist/types/enums/core.enum.d.ts +51 -2
  55. package/dist/types/enums/index.d.ts +0 -1
  56. package/dist/types/index.checkout.d.ts +11 -0
  57. package/dist/types/index.checkout.umd.d.ts +4 -0
  58. package/dist/types/index.d.ts +9 -3
  59. package/dist/types/interfaces/analytics.interface.d.ts +41 -0
  60. package/dist/types/interfaces/api/cart.interface.d.ts +14 -7
  61. package/dist/types/interfaces/api/checkout.interface.d.ts +277 -0
  62. package/dist/types/interfaces/api/delivery.interface.d.ts +24 -0
  63. package/dist/types/interfaces/api/index.d.ts +6 -0
  64. package/dist/types/interfaces/api/product-list.interface.d.ts +15 -6
  65. package/dist/types/interfaces/api/product.interface.d.ts +12 -4
  66. package/dist/types/interfaces/client.interface.d.ts +79 -0
  67. package/dist/types/interfaces/component.interface.d.ts +7 -0
  68. package/dist/types/interfaces/config.interface.d.ts +45 -0
  69. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  70. package/dist/types/interfaces/configs/cart.interface.d.ts +2 -1
  71. package/dist/types/interfaces/configs/checkout.interface.d.ts +3 -1
  72. package/dist/types/interfaces/configs/global.interface.d.ts +9 -3
  73. package/dist/types/interfaces/configs/index.d.ts +1 -0
  74. package/dist/types/interfaces/configs/product-list.interface.d.ts +49 -0
  75. package/dist/types/interfaces/configs/product.interface.d.ts +7 -1
  76. package/dist/types/interfaces/injection.interface.d.ts +56 -0
  77. package/dist/types/modules/address/address-display.component.d.ts +3 -1
  78. package/dist/types/modules/address/address-input.component.d.ts +11 -1
  79. package/dist/types/modules/address/address.command.d.ts +3 -2
  80. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  81. package/dist/types/modules/cart/cart.commands.d.ts +11 -5
  82. package/dist/types/modules/cart/components/cart-body.component.d.ts +1 -0
  83. package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +1 -1
  84. package/dist/types/modules/cart/components/cart-item-quantity-price.component.d.ts +5 -0
  85. package/dist/types/modules/cart/components/cart-item.component.d.ts +8 -0
  86. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  87. package/dist/types/modules/checkout/checkout.commands.d.ts +134 -12
  88. package/dist/types/modules/checkout/checkout.component.d.ts +7 -1
  89. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +5 -2
  90. package/dist/types/modules/checkout/components/checkout-buyer.component.d.ts +1 -0
  91. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +9 -0
  92. package/dist/types/modules/checkout/components/checkout-deliver-to.component.d.ts +1 -0
  93. package/dist/types/modules/checkout/components/checkout-delivery-method.component.d.ts +24 -0
  94. package/dist/types/modules/checkout/components/checkout-delivery-scheduling.component.d.ts +53 -0
  95. package/dist/types/modules/checkout/components/checkout-express-checkout.component.d.ts +63 -0
  96. package/dist/types/modules/checkout/components/checkout-express-completion.component.d.ts +21 -0
  97. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  98. package/dist/types/modules/checkout/components/checkout-item-quantity.component.d.ts +4 -0
  99. package/dist/types/modules/checkout/components/checkout-item.component.d.ts +2 -0
  100. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  101. package/dist/types/modules/checkout/components/checkout-order-summary.component.d.ts +3 -0
  102. package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +9 -1
  103. package/dist/types/modules/checkout/components/checkout-place-order-button.component.d.ts +1 -5
  104. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +15 -1
  105. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  106. package/dist/types/modules/checkout/components/checkout-prop65-warning.component.d.ts +8 -0
  107. package/dist/types/modules/checkout/components/checkout-send-as-gift.component.d.ts +3 -0
  108. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +7 -3
  109. package/dist/types/modules/checkout/components/checkout-stripe-handler.component.d.ts +4 -0
  110. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +4 -2
  111. package/dist/types/modules/checkout/components/index.d.ts +5 -0
  112. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  113. package/dist/types/modules/checkout/components/required-fields-legend.d.ts +1 -0
  114. package/dist/types/modules/checkout/constant.d.ts +15 -0
  115. package/dist/types/modules/checkout/customer-prefill.d.ts +5 -0
  116. package/dist/types/modules/checkout/express-wallet.d.ts +12 -0
  117. package/dist/types/modules/checkout/payment-session-error.d.ts +4 -0
  118. package/dist/types/modules/checkout/stripe-js.d.ts +2 -0
  119. package/dist/types/modules/checkout/styles/delivery-method.style.d.ts +1 -0
  120. package/dist/types/modules/checkout/styles/express-checkout.style.d.ts +1 -0
  121. package/dist/types/modules/checkout/styles/express-completion.style.d.ts +1 -0
  122. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  123. package/dist/types/modules/product/components/components.d.ts +26 -2
  124. package/dist/types/modules/product/components/index.d.ts +1 -0
  125. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +8 -1
  126. package/dist/types/modules/product/components/product-delivery-estimate.component.d.ts +11 -0
  127. package/dist/types/modules/product/components/product-description.component.d.ts +1 -0
  128. package/dist/types/modules/product/components/product-drawer.component.d.ts +6 -0
  129. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +5 -0
  130. package/dist/types/modules/product/components/product-options.component.d.ts +2 -1
  131. package/dist/types/modules/product/components/product-prop65-warning.d.ts +1 -0
  132. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +6 -0
  133. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +12 -2
  134. package/dist/types/modules/product/components/product-retailers-popup.component.d.ts +1 -0
  135. package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
  136. package/dist/types/modules/product/product.commands.d.ts +5 -5
  137. package/dist/types/modules/product/product.component.d.ts +3 -0
  138. package/dist/types/modules/product/styles/prop65-warning.style.d.ts +1 -0
  139. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  140. package/dist/types/modules/product-list/components/card-components/index.d.ts +6 -0
  141. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
  142. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
  143. package/dist/types/modules/product-list/components/card-components/product-fulfillment-text.d.ts +2 -0
  144. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +14 -0
  145. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +11 -0
  146. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +14 -0
  147. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  148. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  149. 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
  150. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  151. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  152. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +15 -0
  153. 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
  154. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
  155. package/dist/types/modules/product-list/components/index.d.ts +6 -2
  156. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +3 -1
  157. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +39 -31
  158. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
  159. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +58 -36
  160. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
  161. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +54 -0
  162. package/dist/types/modules/product-list/components/product-list-search.component.d.ts +25 -0
  163. package/dist/types/modules/product-list/product-list-filter.registry.d.ts +42 -0
  164. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +7 -0
  165. package/dist/types/modules/product-list/product-list-order.utils.d.ts +3 -0
  166. package/dist/types/modules/product-list/product-list-query-params.utils.d.ts +3 -0
  167. package/dist/types/modules/product-list/product-list.commands.d.ts +27 -7
  168. package/dist/types/modules/product-list/product-list.component.d.ts +23 -47
  169. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  170. package/dist/types/modules/product-list/product-list.interface.d.ts +17 -28
  171. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  172. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  173. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  174. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  175. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  176. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  177. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  178. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  179. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  180. package/dist/types/modules/ui-components/alert/alert.component.d.ts +10 -10
  181. package/dist/types/modules/ui-components/buttons/buttons-open-cart.component.d.ts +5 -0
  182. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +15 -0
  183. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +9 -1
  184. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +7 -1
  185. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  186. package/dist/types/modules/ui-components/input/input.component.d.ts +15 -2
  187. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  188. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  189. package/dist/types/modules/ui-components/ui.commands.d.ts +7 -1
  190. package/dist/types/ssr/stub.checkout.d.ts +8 -0
  191. package/dist/types/ssr/stub.d.ts +12 -0
  192. package/dist/types/static/icon/arrow-right.icon.d.ts +1 -1
  193. package/dist/types/static/icon/bag.icon.d.ts +1 -1
  194. package/dist/types/static/icon/check.icon.d.ts +2 -0
  195. package/dist/types/static/icon/checkbox.icon.d.ts +1 -1
  196. package/dist/types/static/icon/chevron-down.icon.d.ts +1 -1
  197. package/dist/types/static/icon/chevron-left.icon.d.ts +1 -1
  198. package/dist/types/static/icon/chevron-up.icon.d.ts +1 -1
  199. package/dist/types/static/icon/close.icon.d.ts +1 -1
  200. package/dist/types/static/icon/error-info.icon.d.ts +1 -1
  201. package/dist/types/static/icon/filter.icon.d.ts +1 -1
  202. package/dist/types/static/icon/icon.a11y.d.ts +1 -0
  203. package/dist/types/static/icon/icon.types.d.ts +1 -0
  204. package/dist/types/static/icon/index.d.ts +2 -0
  205. package/dist/types/static/icon/info.icon.d.ts +1 -1
  206. package/dist/types/static/icon/loading-spinner.icon.d.ts +1 -1
  207. package/dist/types/static/icon/search.icon.d.ts +1 -1
  208. package/dist/types/static/icon/success.icon.d.ts +1 -1
  209. package/dist/types/static/icon/trash.icon.d.ts +1 -1
  210. package/dist/types/static/icon/warning.icon.d.ts +1 -1
  211. package/dist/types/utils/delivery-scheduling.d.ts +72 -0
  212. package/dist/types/utils/dom-compat.d.ts +2 -0
  213. package/dist/types/utils/format.d.ts +9 -14
  214. package/dist/types/utils/image-bg-removal.d.ts +3 -0
  215. package/dist/types/utils/places-session-token.d.ts +1 -0
  216. package/dist/types/utils/product-selection.d.ts +16 -0
  217. package/dist/types/utils/product.d.ts +21 -0
  218. package/dist/types/utils/timezone.d.ts +6 -0
  219. package/docs/v1/README.md +214 -0
  220. package/docs/v1/api/actions/address-actions.md +290 -0
  221. package/docs/v1/api/actions/analytics-actions.md +326 -0
  222. package/docs/v1/api/actions/cart-actions.md +364 -0
  223. package/docs/v1/api/actions/checkout-actions.md +629 -0
  224. package/docs/v1/api/actions/product-actions.md +205 -0
  225. package/docs/v1/api/client.md +671 -0
  226. package/docs/v1/api/configuration.md +587 -0
  227. package/docs/v1/api/injection-methods.md +331 -0
  228. package/docs/v1/api/typescript-types.md +610 -0
  229. package/docs/v1/api/ui-helpers.md +200 -0
  230. package/docs/v1/examples/advanced-patterns.md +199 -0
  231. package/docs/v1/examples/checkout-flow.md +90 -0
  232. package/docs/v1/examples/custom-theming.md +76 -0
  233. package/docs/v1/examples/multi-product-page.md +90 -0
  234. package/docs/v1/examples/simple-product-page.md +89 -0
  235. package/docs/v1/getting-started/concepts.md +521 -0
  236. package/docs/v1/getting-started/installation.md +351 -0
  237. package/docs/v1/getting-started/quick-start.md +410 -0
  238. package/docs/v1/guides/accessibility.md +298 -0
  239. package/docs/v1/guides/address-component.md +441 -0
  240. package/docs/v1/guides/best-practices.md +365 -0
  241. package/docs/v1/guides/cart-component.md +802 -0
  242. package/docs/v1/guides/checkout-component.md +920 -0
  243. package/docs/v1/guides/events.md +1061 -0
  244. package/docs/v1/guides/product-component.md +767 -0
  245. package/docs/v1/guides/product-list-component.md +730 -0
  246. package/docs/v1/guides/theming.md +243 -0
  247. package/docs/v1/integration/angular.md +39 -0
  248. package/docs/v1/integration/laravel.md +41 -0
  249. package/docs/v1/integration/nextjs.md +69 -0
  250. package/docs/v1/integration/proxy-setup.md +106 -0
  251. package/docs/v1/integration/react.md +64 -0
  252. package/docs/v1/integration/vanilla-js.md +84 -0
  253. package/docs/v1/integration/vue.md +58 -0
  254. package/docs/v1/reference/analytics.md +176 -0
  255. package/docs/v1/reference/browser-support.md +47 -0
  256. package/docs/v1/reference/error-handling.md +83 -0
  257. package/docs/v1/reference/performance.md +52 -0
  258. package/docs/v1/reference/telemetry.md +85 -0
  259. package/docs/v1/reference/troubleshooting.md +135 -0
  260. package/package.json +75 -45
  261. package/dist/types/elements-builder-client.d.ts +0 -2
  262. package/dist/types/elements-client-helper.d.ts +0 -4
  263. package/dist/types/elements-client.d.ts +0 -2
  264. package/dist/types/enums/cloud.enum.d.ts +0 -97
  265. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  266. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  267. package/dist/types/interfaces/cloud/index.d.ts +0 -3
  268. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  269. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  270. package/dist/types/interfaces/core.interface.d.ts +0 -111
  271. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  272. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  273. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  274. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  275. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
  276. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  277. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  278. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  279. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  280. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  281. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  282. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  283. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  284. package/dist/types/utils/helper.d.ts +0 -28
  285. package/docs/ACTIONS.md +0 -1300
  286. package/docs/BROWSER_SUPPORT.md +0 -279
  287. package/docs/CONFIGURATION.md +0 -853
  288. package/docs/DOCUMENTATION_INDEX.md +0 -311
  289. package/docs/EVENTS.md +0 -798
  290. package/docs/PROXY.md +0 -228
  291. package/docs/THEMING.md +0 -592
  292. package/docs/TROUBLESHOOTING.md +0 -793
  293. package/umd/elements.js +0 -1
  294. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  295. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  296. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  297. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  298. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  299. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  300. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  301. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  302. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  303. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  304. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,802 @@
1
+ # Cart Component
2
+
3
+ The Cart component provides a slide-out drawer for managing shopping cart items, applying promo codes, and proceeding to checkout.
4
+
5
+ ## Overview
6
+
7
+ The Cart component automatically:
8
+ - Displays cart items with images and details
9
+ - Removes white / near-white backgrounds from item images so products blend into the drawer (automatic, not host-configurable)
10
+ - Groups items by retailer
11
+ - Shows real-time pricing and totals
12
+ - Supports quantity updates
13
+ - Handles promo code application
14
+ - Persists cart across sessions and tabs
15
+ - Provides checkout navigation
16
+
17
+ A same-day line from a store that is closed now but takes orders for later (its fulfillment's `deliveryAvailability` says it cannot deliver now and can schedule) shows "Schedule delivery" in place of the delivery estimate. The shopper chooses the delivery window in checkout.
18
+
19
+ ## Basic Usage
20
+
21
+ The cart is automatically available when using the SDK - no explicit injection needed for the drawer. However, you need a way for users to open it.
22
+
23
+ ### Cart Buttons
24
+
25
+ #### Declarative Cart Button
26
+
27
+ Add a cart button using data attributes on the SDK script:
28
+
29
+ ```html
30
+ <script
31
+ defer
32
+ data-liquid-commerce-elements
33
+ data-token="YOUR_API_KEY"
34
+ data-env="production"
35
+ data-cart-button="header-cart"
36
+ type="text/javascript"
37
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
38
+ ></script>
39
+
40
+ <div id="header-cart"></div>
41
+ ```
42
+
43
+ #### Cart Button with Item Count Badge
44
+
45
+ Show the number of items in the cart:
46
+
47
+ ```html
48
+ <script
49
+ defer
50
+ data-liquid-commerce-elements
51
+ data-token="YOUR_API_KEY"
52
+ data-env="production"
53
+ data-cart-badge-button="header-cart"
54
+ type="text/javascript"
55
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
56
+ ></script>
57
+
58
+ <div id="header-cart"></div>
59
+ ```
60
+
61
+ #### Floating Cart Button
62
+
63
+ Create a floating button (top-right corner):
64
+
65
+ ```html
66
+ <script
67
+ defer
68
+ data-liquid-commerce-elements
69
+ data-token="YOUR_API_KEY"
70
+ data-env="production"
71
+ data-cart-button
72
+ type="text/javascript"
73
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
74
+ ></script>
75
+ ```
76
+
77
+ Leaving `data-cart-button` empty creates a floating button automatically.
78
+
79
+ #### Positional Cart Button
80
+
81
+ Control where the cart button appears:
82
+
83
+ ```html
84
+ <!-- Inside an element -->
85
+ <script data-cart-button="inside:#header"></script>
86
+
87
+ <!-- Above an element -->
88
+ <script data-cart-button="above:.navigation"></script>
89
+
90
+ <!-- Below an element -->
91
+ <script data-cart-button="below:#logo"></script>
92
+
93
+ <!-- Replace an element -->
94
+ <script data-cart-button="replace:#cart-placeholder"></script>
95
+ ```
96
+
97
+ #### Hide Cart Button
98
+
99
+ If you want to control cart opening manually:
100
+
101
+ ```html
102
+ <script
103
+ defer
104
+ data-liquid-commerce-elements
105
+ data-token="YOUR_API_KEY"
106
+ data-env="production"
107
+ data-cart-button-hidden
108
+ type="text/javascript"
109
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
110
+ ></script>
111
+ ```
112
+
113
+ #### Programmatic Cart Button
114
+
115
+ Create cart buttons using JavaScript:
116
+
117
+ ```javascript
118
+ // Button in a container
119
+ window.LiquidCommerce.elements.ui.cartButton('my-container', false); // No badge
120
+
121
+ // Button with item count
122
+ window.LiquidCommerce.elements.ui.cartButton('my-container', true); // With badge
123
+
124
+ // Floating button
125
+ window.LiquidCommerce.elements.ui.floatingCartButton(true); // With badge
126
+ ```
127
+
128
+ ### Custom Toggle Buttons
129
+
130
+ Use your own button to toggle the cart:
131
+
132
+ ```html
133
+ <button data-lce-cart-toggle-button>
134
+ View Cart
135
+ </button>
136
+ ```
137
+
138
+ The SDK automatically adds click handlers to elements with `data-lce-cart-toggle-button`.
139
+
140
+ ## Cart Actions
141
+
142
+ ### Open Cart
143
+
144
+ ```javascript
145
+ window.LiquidCommerce.elements.actions.cart.openCart();
146
+ ```
147
+
148
+ ### Close Cart
149
+
150
+ ```javascript
151
+ window.LiquidCommerce.elements.actions.cart.closeCart();
152
+ ```
153
+
154
+ ### Toggle Cart
155
+
156
+ ```javascript
157
+ window.LiquidCommerce.elements.actions.cart.toggleCart();
158
+ ```
159
+
160
+ ### Add Product to Cart
161
+
162
+ Add products programmatically:
163
+
164
+ ```javascript
165
+ await window.LiquidCommerce.elements.actions.cart.addProduct([
166
+ {
167
+ identifier: '00619947000020',
168
+ fulfillmentType: 'shipping', // or 'onDemand'
169
+ quantity: 2
170
+ },
171
+ {
172
+ identifier: '08504405135',
173
+ fulfillmentType: 'onDemand',
174
+ quantity: 1
175
+ }
176
+ ], true); // true = open cart after adding
177
+ ```
178
+
179
+ **Parameters:**
180
+ - `identifier` (string): Product UPC, size ID, or salsifyGrouping ID
181
+ - `fulfillmentType` (string): `'shipping'` or `'onDemand'`
182
+ - `quantity` (number): Number of items (default: 1)
183
+ - `engravingLines` (string[], optional): Engraving text lines for the product (applied when the product/variant supports engraving; ignored otherwise)
184
+ - Second parameter (boolean): Open cart after adding (default: false)
185
+
186
+ ### Apply Promo Code
187
+
188
+ ```javascript
189
+ await window.LiquidCommerce.elements.actions.cart.applyPromoCode('SUMMER20');
190
+ ```
191
+
192
+ The SDK automatically:
193
+ - Validates the promo code
194
+ - Calculates discount
195
+ - Updates cart totals
196
+ - Shows success/error message
197
+
198
+ ### Remove Promo Code
199
+
200
+ ```javascript
201
+ await window.LiquidCommerce.elements.actions.cart.removePromoCode();
202
+ ```
203
+
204
+ ### Reset Cart
205
+
206
+ Clear all items from the cart:
207
+
208
+ ```javascript
209
+ await window.LiquidCommerce.elements.actions.cart.resetCart();
210
+ ```
211
+
212
+ ### Get Cart Details
213
+
214
+ Retrieve current cart information:
215
+
216
+ ```javascript
217
+ const cartData = window.LiquidCommerce.elements.actions.cart.getDetails();
218
+
219
+ console.log(cartData);
220
+ // {
221
+ // cartId: 'cart_abc123',
222
+ // promoCodeDiscount: 1000, // number | null
223
+ // subtotal: 9998, // in cents
224
+ // itemCount: 5,
225
+ // items: {...}, // Record<itemId, ICartItem>
226
+ // retailers: {...}, // Record<retailerId, ICartRetailer>
227
+ // location: {...}, // or null
228
+ // ...
229
+ // }
230
+ ```
231
+
232
+ ## Cart UI Helpers
233
+
234
+ ### Display Cart Subtotal
235
+
236
+ Show cart subtotal anywhere on your page:
237
+
238
+ ```html
239
+ <div>
240
+ Cart Total: <span id="cart-total"></span>
241
+ </div>
242
+
243
+ <script>
244
+ window.addEventListener('lce:actions.client_ready', () => {
245
+ window.LiquidCommerce.elements.ui.cartSubtotal('cart-total');
246
+ }, { once: true });
247
+ </script>
248
+ ```
249
+
250
+ The element automatically updates when the cart changes.
251
+
252
+ ### Display Items Count
253
+
254
+ Show the number of items in the cart:
255
+
256
+ ```html
257
+ <div>
258
+ Items: <span id="items-count"></span>
259
+ </div>
260
+
261
+ <script>
262
+ window.addEventListener('lce:actions.client_ready', () => {
263
+ window.LiquidCommerce.elements.ui.cartItemsCount('items-count', {
264
+ hideZero: true // Hide when cart is empty
265
+ });
266
+ }, { once: true });
267
+ </script>
268
+ ```
269
+
270
+ Or using data attributes:
271
+
272
+ ```html
273
+ <!-- Always show count, even when 0 -->
274
+ <span data-lce-cart-items-count="keep-zero"></span>
275
+
276
+ <!-- Hide when 0 (default behavior) -->
277
+ <span data-lce-cart-items-count></span>
278
+ ```
279
+
280
+ ## Events
281
+
282
+ ### `lce:actions.cart_shop_retailer`
283
+
284
+ A shopper activated **Shop {retailer}** from an unmet cart fulfillment minimum. Opt in with
285
+ `customTheme.cart.layout.showShopRetailerButton: true` (default `false`). The cart command
286
+ revalidates the fulfillment, its current retailer and items, fulfillment type, and remaining
287
+ minimum before emitting. Unsupported, empty, stale or already-satisfied fulfillments emit nothing.
288
+
289
+ ```typescript
290
+ interface ICartShopRetailerEventData {
291
+ retailerId: string;
292
+ fulfillmentId: string;
293
+ fulfillmentType: 'onDemand' | 'shipping';
294
+ }
295
+ ```
296
+
297
+ Listen with the exported constant; the usual event envelope is `{ data, metadata }`:
298
+
299
+ ```javascript
300
+ window.addEventListener(`lce:actions.${ELEMENTS_ACTIONS_EVENT.CART_SHOP_RETAILER}`, (event) => {
301
+ const { retailerId, fulfillmentId, fulfillmentType } = event.detail.data;
302
+ // Revalidate against client.actions.cart.getDetails(), then close the drawer
303
+ // and route to your catalog scoped to this retailer and fulfillment type.
304
+ });
305
+ ```
306
+
307
+ The SDK leaves the drawer open and does not navigate. The host handles routing and derives
308
+ retailer names, totals and minimums from current cart details. The event is also sent to `lce:actions`.
309
+
310
+
311
+
312
+ ### Cart Loaded
313
+
314
+ Fired when cart data is loaded:
315
+
316
+ ```javascript
317
+ window.addEventListener('lce:actions.cart_loaded', (event) => {
318
+ const { cartId, itemCount, subtotal } = event.detail.data;
319
+ console.log(`Cart loaded: ${itemCount} items, total: $${subtotal / 100}`);
320
+ });
321
+ ```
322
+
323
+ ### Cart Opened/Closed
324
+
325
+ ```javascript
326
+ window.addEventListener('lce:actions.cart_opened', (event) => {
327
+ console.log('Cart drawer opened');
328
+ });
329
+
330
+ window.addEventListener('lce:actions.cart_closed', (event) => {
331
+ console.log('Cart drawer closed');
332
+ });
333
+ ```
334
+
335
+ ### Cart Updated
336
+
337
+ Fired whenever cart contents change:
338
+
339
+ ```javascript
340
+ window.addEventListener('lce:actions.cart_updated', (event) => {
341
+ const { cartId, itemCount, subtotal } = event.detail.data.current;
342
+ console.log('Cart updated:', itemCount, 'items');
343
+ });
344
+ ```
345
+
346
+ ### Item Added
347
+
348
+ ```javascript
349
+ window.addEventListener('lce:actions.cart_item_added', (event) => {
350
+ const { cartId, itemId, quantity } = event.detail.data;
351
+ console.log(`Item ${itemId} added (quantity: ${quantity})`);
352
+ });
353
+ ```
354
+
355
+ ### Item Removed
356
+
357
+ ```javascript
358
+ window.addEventListener('lce:actions.cart_item_removed', (event) => {
359
+ const { cartId, itemId } = event.detail.data;
360
+ console.log(`Item ${itemId} removed`);
361
+ });
362
+ ```
363
+
364
+ ### Quantity Changed
365
+
366
+ ```javascript
367
+ window.addEventListener('lce:actions.cart_item_quantity_increase', (event) => {
368
+ const { cartId, itemId, quantity } = event.detail.data;
369
+ console.log(`Item ${itemId} quantity increased to ${quantity}`);
370
+ });
371
+
372
+ window.addEventListener('lce:actions.cart_item_quantity_decrease', (event) => {
373
+ const { cartId, itemId, quantity } = event.detail.data;
374
+ console.log(`Item ${itemId} quantity decreased to ${quantity}`);
375
+ });
376
+ ```
377
+
378
+ ### Engraving Updated
379
+
380
+ Fired when a cart line item's engraving is added or edited from the drawer (see [Engraving](#engraving)):
381
+
382
+ ```javascript
383
+ window.addEventListener('lce:actions.cart_item_engraving_updated', (event) => {
384
+ const { cartId, itemId, engravingLines, previousEngravingLines } = event.detail.data;
385
+ console.log(`Engraving updated for ${itemId}:`, engravingLines);
386
+ });
387
+ ```
388
+
389
+ ### Promo Code Events
390
+
391
+ ```javascript
392
+ window.addEventListener('lce:actions.cart_promo_code_applied', (event) => {
393
+ const { cartId, discount, newSubtotal } = event.detail.data;
394
+ console.log(`Promo code applied: $${discount / 100} off`);
395
+ });
396
+
397
+ window.addEventListener('lce:actions.cart_promo_code_removed', (event) => {
398
+ const { cartId, newSubtotal } = event.detail.data;
399
+ console.log('Promo code removed');
400
+ });
401
+
402
+ window.addEventListener('lce:actions.cart_promo_code_failed', (event) => {
403
+ const { cartId, error } = event.detail.data;
404
+ console.error('Promo code failed:', error);
405
+ });
406
+ ```
407
+
408
+ ### Product Add Success/Failure
409
+
410
+ ```javascript
411
+ window.addEventListener('lce:actions.cart_product_add_success', (event) => {
412
+ const { cartId, itemsAdded, identifiers } = event.detail.data;
413
+ console.log(`Successfully added ${itemsAdded} products`);
414
+ });
415
+
416
+ window.addEventListener('lce:actions.cart_product_add_failed', (event) => {
417
+ const { cartId, identifiers, error } = event.detail.data;
418
+ console.error('Failed to add products:', error);
419
+ });
420
+ ```
421
+
422
+ ### Cart Reset
423
+
424
+ ```javascript
425
+ window.addEventListener('lce:actions.cart_reset', (event) => {
426
+ console.log('Cart has been reset');
427
+ });
428
+ ```
429
+
430
+ ## Customization
431
+
432
+ ### Theme Configuration
433
+
434
+ Customize cart appearance:
435
+
436
+ ```javascript
437
+ const client = await Elements('YOUR_API_KEY', {
438
+ env: 'production',
439
+ customTheme: {
440
+ cart: {
441
+ theme: {
442
+ backgroundColor: '#ffffff'
443
+ },
444
+ layout: {
445
+ showShopRetailerButton: false, // Enable only with a cart_shop_retailer event handler
446
+ showQuantityCounter: true,
447
+ quantityCounterStyle: 'outlined', // or 'ghost'
448
+ drawerHeaderText: 'My Bag',
449
+ goToCheckoutButtonText: 'Checkout'
450
+ }
451
+ }
452
+ }
453
+ });
454
+ ```
455
+
456
+ ### Shop the same retailer
457
+
458
+ Set `customTheme.cart.layout.showShopRetailerButton: true` to show a native **Shop {retailer}**
459
+ button beside each unmet order-minimum warning (below it on mobile). The default is `false`,
460
+ including when the server theme predates this option. It only appears for a current, nonempty
461
+ `onDemand` or `shipping` fulfillment with a positive amount remaining and valid retailer ownership.
462
+
463
+ Handle `ELEMENTS_ACTIONS_EVENT.CART_SHOP_RETAILER` (`lce:actions.cart_shop_retailer`) to close the
464
+ cart and open your retailer-filtered catalog. The SDK emits identifiers only and performs no
465
+ navigation. Revalidate them against `client.actions.cart.getDetails()` before navigating; see
466
+ [Events](./events.md) for the payload.
467
+
468
+ ## State Persistence
469
+
470
+ ### Local Storage
471
+
472
+ The cart automatically persists to `localStorage`
473
+
474
+ This allows the cart to survive:
475
+ - Page refreshes
476
+ - Browser restarts
477
+ - Navigation between pages
478
+
479
+ ### Cross-Tab Persistence
480
+
481
+ The cart is persisted to `localStorage` and reloaded on a fresh page load. The SDK does **not** provide live cross-tab synchronization — changes made in one tab will not automatically appear in other already-open tabs (there is no `storage` listener, `BroadcastChannel`, or polling). Another tab reflects the change only after it reloads.
482
+
483
+ ### Session Duration
484
+
485
+ Cart and address session IDs are persisted in `localStorage` (with an API fallback) and are not automatically cleared by the SDK; cart lifetime/expiry is governed by server-side policy.
486
+
487
+ ## Address Requirement
488
+
489
+ The cart requires a delivery address for:
490
+ - Accurate availability
491
+ - Correct pricing
492
+ - Shipping calculations
493
+
494
+ ### Automatic Address Prompt
495
+
496
+ If no address is set when adding to cart, the SDK:
497
+ 1. Opens address input drawer
498
+ 2. Waits for user to set address
499
+ 3. Retries the add-to-cart operation
500
+
501
+ ### Pre-set Address
502
+
503
+ Set address before adding to cart:
504
+
505
+ ```javascript
506
+ await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId('ChIJ...');
507
+
508
+ // Now add to cart
509
+ await window.LiquidCommerce.elements.actions.cart.addProduct([...]);
510
+ ```
511
+
512
+ ## Promo Codes
513
+
514
+ ### Configuration
515
+
516
+ Enable/disable promo codes globally:
517
+
518
+ ```javascript
519
+ customTheme: {
520
+ global: {
521
+ layout: {
522
+ allowPromoCodes: true // or false to disable
523
+ }
524
+ }
525
+ }
526
+ ```
527
+
528
+ ### Promo Ticker
529
+
530
+ Show promotional codes in a scrolling ticker:
531
+
532
+ ```javascript
533
+ const client = await Elements('YOUR_API_KEY', {
534
+ env: 'production',
535
+ promoTicker: [
536
+ {
537
+ promoCode: 'SUMMER20',
538
+ text: ['20% Off Summer Sale', 'Free Shipping on Orders Over $50'],
539
+ separator: '•',
540
+ activeFrom: '2024-06-01T00:00:00Z',
541
+ activeUntil: '2024-08-31T23:59:59Z'
542
+ }
543
+ ]
544
+ });
545
+ ```
546
+
547
+ Or with data attributes:
548
+
549
+ ```html
550
+ <script
551
+ defer
552
+ data-liquid-commerce-elements
553
+ data-token="YOUR_API_KEY"
554
+ data-env="production"
555
+ data-promo-code="SUMMER20"
556
+ data-promo-text="20% Off Summer Sale | Free Shipping on Orders Over $50"
557
+ data-promo-separator="•"
558
+ data-promo-active-from="2024-06-01T00:00:00Z"
559
+ data-promo-active-until="2024-08-31T23:59:59Z"
560
+ type="text/javascript"
561
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
562
+ ></script>
563
+ ```
564
+
565
+ ### Auto-Apply from URL
566
+
567
+ Apply promo codes automatically via URL parameters:
568
+
569
+ ```html
570
+ <script
571
+ defer
572
+ data-liquid-commerce-elements
573
+ data-token="YOUR_API_KEY"
574
+ data-env="production"
575
+ data-promo-code-param="lce_promo"
576
+ type="text/javascript"
577
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
578
+ ></script>
579
+ ```
580
+
581
+ Now visiting `https://yoursite.com?lce_promo=SUMMER20` automatically applies the code.
582
+
583
+ **Security Note:** Query parameters must start with `lce_` prefix to prevent conflicts with your application.
584
+
585
+ ## Retailer Grouping
586
+
587
+ Items are automatically grouped by retailer in the cart:
588
+
589
+ ```
590
+ ┌─────────────────────────────────────┐
591
+ │ Cart (3 items) │
592
+ ├─────────────────────────────────────┤
593
+ │ Spirits Shop │
594
+ │ • Premium Whiskey (750ml) $49 │
595
+ │ • Bourbon Bottle (1L) $65 │
596
+ │ │
597
+ │ Wine & More │
598
+ │ • Red Wine (750ml) $25 │
599
+ ├─────────────────────────────────────┤
600
+ │ Subtotal: $139 │
601
+ │ Promo Code (SUMMER20): -$28 │
602
+ │ Total: $111 │
603
+ └─────────────────────────────────────┘
604
+ ```
605
+
606
+ ## Order Minimums
607
+
608
+ Retailers can require a minimum purchase amount before their items can be checked out. The cart enforces this per retailer:
609
+
610
+ - When a retailer's minimum is not met, the cart drawer shows a per-retailer alert reading `+$X needed for order minimum`, where `$X` is the remaining amount required for that retailer.
611
+ - The **Checkout** button is disabled until every retailer's minimum is met. (It is also disabled while the cart is loading/updating or when the cart is empty.)
612
+
613
+ No configuration is required — the minimums are defined by each retailer and enforced automatically.
614
+
615
+ ## Engraving
616
+
617
+ For engravable items, shoppers can add or edit engraving directly from a cart line item, without leaving the drawer.
618
+
619
+ - If an engravable item has no engraving yet, the line item shows an **Add personalization** action (with the engraving fee) that opens the engraving form.
620
+ - If the item already has engraving, its engraving is shown on the line item with an **Edit** button that reopens the form.
621
+
622
+ The form respects the item's engraving constraints — `maxLines`, `maxCharsPerLine`, and the per-item `fee`. Saving emits [`lce:actions.cart_item_engraving_updated`](#engraving-updated) with the item's `engravingLines` and `previousEngravingLines`.
623
+
624
+ **Note:** This in-drawer editing is distinct from the `engravingLines` array passed to [`addProduct`](#add-product-to-cart), which pre-fills engraving at the time an item is added.
625
+
626
+ ## Checkout Navigation
627
+
628
+ ### Checkout Drawer (Default)
629
+
630
+ By default, clicking "Checkout" opens the checkout drawer:
631
+
632
+ ```javascript
633
+ // User clicks checkout
634
+ // Checkout drawer slides in
635
+ ```
636
+
637
+ ### Checkout Page (Custom URL)
638
+
639
+ Redirect to a custom checkout page:
640
+
641
+ ```javascript
642
+ const client = await Elements('YOUR_API_KEY', {
643
+ env: 'production',
644
+ checkout: {
645
+ pageUrl: 'https://yoursite.com/checkout/{token}'
646
+ }
647
+ });
648
+ ```
649
+
650
+ Or with data attributes:
651
+
652
+ ```html
653
+ <script
654
+ defer
655
+ data-liquid-commerce-elements
656
+ data-token="YOUR_API_KEY"
657
+ data-env="production"
658
+ data-checkout-url="https://yoursite.com/checkout/{token}"
659
+ type="text/javascript"
660
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
661
+ ></script>
662
+ ```
663
+
664
+ The `{token}` placeholder is replaced with the session checkout token.
665
+
666
+ ## Use Cases
667
+
668
+ ### E-commerce Site
669
+
670
+ ```javascript
671
+ // Track cart events for analytics
672
+ window.addEventListener('lce:actions.cart_item_added', (event) => {
673
+ const { itemId, quantity } = event.detail.data;
674
+ gtag('event', 'add_to_cart', {
675
+ items: [{ item_id: itemId, quantity }],
676
+ currency: 'USD'
677
+ });
678
+ });
679
+
680
+ window.addEventListener('lce:actions.cart_updated', (event) => {
681
+ // Update header cart count
682
+ document.getElementById('cart-badge').textContent =
683
+ event.detail.data.current.itemCount;
684
+ });
685
+ ```
686
+
687
+ ### Marketing Campaign
688
+
689
+ ```javascript
690
+ // Check URL for campaign parameter
691
+ const params = new URLSearchParams(window.location.search);
692
+ const campaign = params.get('campaign');
693
+
694
+ if (campaign === 'summer-sale') {
695
+ await window.LiquidCommerce.elements.actions.cart.applyPromoCode('SUMMER20');
696
+ window.LiquidCommerce.elements.actions.cart.openCart();
697
+ }
698
+ ```
699
+
700
+ ### Abandoned Cart Recovery
701
+
702
+ ```javascript
703
+ // Store cart ID in your system
704
+ window.addEventListener('lce:actions.cart_updated', (event) => {
705
+ const { cartId, itemCount } = event.detail.data.current;
706
+
707
+ if (itemCount > 0) {
708
+ // Send cart ID to your backend for abandoned cart emails
709
+ fetch('/api/track-cart', {
710
+ method: 'POST',
711
+ body: JSON.stringify({ cartId, userId: currentUserId })
712
+ });
713
+ }
714
+ });
715
+ ```
716
+
717
+ ## Best Practices
718
+
719
+ ### Initialize Cart Early
720
+
721
+ Pre-load cart on page load for faster access:
722
+
723
+ ```javascript
724
+ window.addEventListener('lce:actions.client_ready', () => {
725
+ // Cart loads automatically, but you can pre-fetch if needed
726
+ window.LiquidCommerce.elements.actions.cart.getDetails();
727
+ }, { once: true });
728
+ ```
729
+
730
+ ### Provide Visual Feedback
731
+
732
+ Show loading states when adding to cart:
733
+
734
+ ```javascript
735
+ async function addToCart(productId) {
736
+ const button = document.getElementById('add-to-cart-btn');
737
+ button.disabled = true;
738
+ button.textContent = 'Adding...';
739
+
740
+ try {
741
+ await window.LiquidCommerce.elements.actions.cart.addProduct([
742
+ { identifier: productId, fulfillmentType: 'shipping', quantity: 1 }
743
+ ], true);
744
+
745
+ button.textContent = 'Added!';
746
+ setTimeout(() => {
747
+ button.disabled = false;
748
+ button.textContent = 'Add to Cart';
749
+ }, 2000);
750
+ } catch (error) {
751
+ button.textContent = 'Failed';
752
+ button.disabled = false;
753
+ }
754
+ }
755
+ ```
756
+
757
+ ### Handle Empty Cart
758
+
759
+ Show appropriate messaging for empty carts:
760
+
761
+ ```javascript
762
+ window.addEventListener('lce:actions.cart_updated', (event) => {
763
+ const { itemCount } = event.detail.data.current;
764
+
765
+ if (itemCount === 0) {
766
+ // Show empty state in your UI
767
+ document.getElementById('cart-status').textContent =
768
+ 'Your cart is empty';
769
+ }
770
+ });
771
+ ```
772
+
773
+ ## Troubleshooting
774
+
775
+ ### Cart Not Opening
776
+
777
+ 1. Check that SDK is initialized: `console.log(window.LiquidCommerce.elements)`
778
+ 2. Verify no JavaScript errors in console
779
+ 3. Ensure cart button is properly configured
780
+ 4. Try manually: `window.LiquidCommerce.elements.actions.cart.openCart()`
781
+
782
+ ### Items Not Adding
783
+
784
+ 1. Check that address is set: `window.LiquidCommerce.elements.actions.address.getDetails()`
785
+ 2. Verify product identifier is valid
786
+ 3. Check fulfillment type is available for the product
787
+ 4. Look for errors in browser console
788
+
789
+ ### Promo Code Not Working
790
+
791
+ 1. Verify promo codes are enabled in configuration
792
+ 2. Check code is valid and active
793
+ 3. Ensure code hasn't already been applied
794
+ 4. Check console for error messages
795
+
796
+ ## See Also
797
+
798
+ - [Product Component](./product-component.md) - Add products to cart
799
+ - [Checkout Component](./checkout-component.md) - Complete purchase
800
+ - [Actions API](../api/actions/cart-actions.md) - Cart actions reference
801
+ - [Events](./events.md) - All available events
802
+ - [Theming](./theming.md) - Customize appearance