@liquidcommerce/elements-sdk 2.6.0-beta.7 → 2.6.0-beta.71

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 (224) hide show
  1. package/README.md +83 -2519
  2. package/dist/index.checkout.esm.js +16607 -0
  3. package/dist/index.esm.js +23556 -20638
  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 +46 -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} +3 -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 +40 -13
  17. package/dist/types/core/api/http-client.service.d.ts +0 -1
  18. package/dist/types/core/base-component.service.d.ts +2 -1
  19. package/dist/types/core/client/actions/base-action.service.d.ts +15 -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 +37 -0
  22. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +56 -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 -70
  25. package/dist/types/core/client/client-config.service.d.ts +8 -2
  26. package/dist/types/core/command/common-command.service.d.ts +1 -0
  27. package/dist/types/core/google-tag-manager.service.d.ts +2 -1
  28. package/dist/types/core/logger/logger.service.d.ts +1 -1
  29. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +27 -52
  30. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +45 -51
  31. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +9 -4
  32. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -74
  33. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  34. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  35. package/dist/types/core/store/interfaces/cart.interface.d.ts +3 -4
  36. package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
  37. package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
  38. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  39. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  40. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  41. package/dist/types/core/store/store.constant.d.ts +5 -0
  42. package/dist/types/core/store/store.service.d.ts +1 -0
  43. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  44. package/dist/types/enums/core.enum.d.ts +39 -1
  45. package/dist/types/enums/index.d.ts +0 -1
  46. package/dist/types/index.checkout.d.ts +8 -0
  47. package/dist/types/index.checkout.umd.d.ts +4 -0
  48. package/dist/types/index.d.ts +8 -3
  49. package/dist/types/interfaces/api/cart.interface.d.ts +13 -8
  50. package/dist/types/interfaces/api/checkout.interface.d.ts +239 -0
  51. package/dist/types/interfaces/api/index.d.ts +5 -0
  52. package/dist/types/interfaces/api/product-list.interface.d.ts +39 -0
  53. package/dist/types/interfaces/api/product.interface.d.ts +10 -4
  54. package/dist/types/interfaces/client.interface.d.ts +72 -0
  55. package/dist/types/interfaces/component.interface.d.ts +7 -0
  56. package/dist/types/interfaces/config.interface.d.ts +41 -0
  57. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  58. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  59. package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
  60. package/dist/types/interfaces/configs/global.interface.d.ts +5 -3
  61. package/dist/types/interfaces/configs/index.d.ts +1 -0
  62. package/dist/types/interfaces/configs/product-list.interface.d.ts +47 -0
  63. package/dist/types/interfaces/configs/product.interface.d.ts +4 -1
  64. package/dist/types/interfaces/injection.interface.d.ts +47 -0
  65. package/dist/types/modules/address/address.command.d.ts +2 -1
  66. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  67. package/dist/types/modules/cart/cart.commands.d.ts +4 -4
  68. package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
  69. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  70. package/dist/types/modules/checkout/checkout.commands.d.ts +23 -9
  71. package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
  72. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  73. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +3 -0
  74. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  75. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  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 +2 -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 +9 -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 +9 -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 +2 -1
  106. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +27 -30
  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 +49 -0
  111. package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-search.component.d.ts → product-list-search.component.d.ts} +11 -4
  112. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
  113. package/dist/types/modules/product-list/product-list.commands.d.ts +23 -8
  114. package/dist/types/modules/product-list/product-list.component.d.ts +10 -45
  115. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  116. package/dist/types/modules/product-list/product-list.interface.d.ts +20 -35
  117. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  118. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  119. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  120. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  121. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  122. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  123. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  124. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  125. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  126. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
  127. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +6 -1
  128. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +6 -1
  129. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  130. package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
  131. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  132. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  133. package/dist/types/modules/ui-components/ui.commands.d.ts +5 -1
  134. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  135. package/dist/types/ssr/stub.d.ts +10 -0
  136. package/dist/types/static/icon/check.icon.d.ts +2 -0
  137. package/dist/types/static/icon/index.d.ts +1 -0
  138. package/dist/types/utils/dom-compat.d.ts +2 -0
  139. package/dist/types/utils/format.d.ts +0 -14
  140. package/dist/types/utils/product-selection.d.ts +16 -0
  141. package/dist/types/utils/product.d.ts +10 -0
  142. package/docs/v1/README.md +210 -0
  143. package/docs/v1/api/actions/address-actions.md +281 -0
  144. package/docs/v1/api/actions/cart-actions.md +337 -0
  145. package/docs/v1/api/actions/checkout-actions.md +427 -0
  146. package/docs/v1/api/actions/product-actions.md +158 -0
  147. package/docs/v1/api/client.md +495 -0
  148. package/docs/v1/api/configuration.md +528 -0
  149. package/docs/v1/api/injection-methods.md +261 -0
  150. package/docs/v1/api/typescript-types.md +398 -0
  151. package/docs/v1/api/ui-helpers.md +200 -0
  152. package/docs/v1/examples/advanced-patterns.md +198 -0
  153. package/docs/v1/examples/checkout-flow.md +91 -0
  154. package/docs/v1/examples/custom-theming.md +63 -0
  155. package/docs/v1/examples/multi-product-page.md +90 -0
  156. package/docs/v1/examples/simple-product-page.md +89 -0
  157. package/docs/v1/getting-started/concepts.md +507 -0
  158. package/docs/v1/getting-started/installation.md +328 -0
  159. package/docs/v1/getting-started/quick-start.md +405 -0
  160. package/docs/v1/guides/address-component.md +431 -0
  161. package/docs/v1/guides/best-practices.md +353 -0
  162. package/docs/v1/guides/cart-component.md +737 -0
  163. package/docs/v1/guides/checkout-component.md +672 -0
  164. package/docs/v1/guides/events.md +926 -0
  165. package/docs/v1/guides/product-component.md +686 -0
  166. package/docs/v1/guides/product-list-component.md +507 -0
  167. package/docs/v1/guides/theming.md +216 -0
  168. package/docs/v1/integration/angular.md +39 -0
  169. package/docs/v1/integration/laravel.md +41 -0
  170. package/docs/v1/integration/nextjs.md +69 -0
  171. package/docs/v1/integration/proxy-setup.md +89 -0
  172. package/docs/v1/integration/react.md +64 -0
  173. package/docs/v1/integration/vanilla-js.md +84 -0
  174. package/docs/v1/integration/vue.md +58 -0
  175. package/docs/v1/reference/browser-support.md +44 -0
  176. package/docs/v1/reference/error-handling.md +70 -0
  177. package/docs/v1/reference/performance.md +54 -0
  178. package/docs/v1/reference/troubleshooting.md +136 -0
  179. package/package.json +31 -27
  180. package/dist/types/elements-builder-client.d.ts +0 -2
  181. package/dist/types/elements-client.d.ts +0 -2
  182. package/dist/types/enums/cloud.enum.d.ts +0 -106
  183. package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -42
  184. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  185. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  186. package/dist/types/interfaces/cloud/index.d.ts +0 -4
  187. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  188. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  189. package/dist/types/interfaces/core.interface.d.ts +0 -111
  190. package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -4
  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-toggle-filters.components.d.ts +0 -18
  196. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  197. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  198. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  199. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  200. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  201. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  202. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  203. package/dist/types/utils/helper.d.ts +0 -28
  204. package/docs/ACTIONS.md +0 -1300
  205. package/docs/BROWSER_SUPPORT.md +0 -279
  206. package/docs/CONFIGURATION.md +0 -853
  207. package/docs/DOCUMENTATION_INDEX.md +0 -311
  208. package/docs/EVENTS.md +0 -798
  209. package/docs/PROXY.md +0 -228
  210. package/docs/THEMING.md +0 -592
  211. package/docs/TROUBLESHOOTING.md +0 -793
  212. package/umd/elements.js +0 -1
  213. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  214. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  215. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  216. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  217. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  218. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  219. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  220. /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
  221. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  222. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  223. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  224. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,427 @@
1
+ # Checkout Actions API
2
+
3
+ Checkout actions allow you to programmatically control the checkout flow.
4
+
5
+ ## Navigation Actions
6
+
7
+ ### actions.checkout.openCheckout()
8
+
9
+ ```typescript
10
+ openCheckout(): void
11
+ ```
12
+
13
+ Opens the checkout drawer or navigates to checkout page.
14
+
15
+ ```javascript
16
+ window.LiquidCommerce.elements.actions.checkout.openCheckout();
17
+ ```
18
+
19
+ ### actions.checkout.closeCheckout()
20
+
21
+ ```typescript
22
+ closeCheckout(): void
23
+ ```
24
+
25
+ Closes the checkout drawer.
26
+
27
+ ```javascript
28
+ window.LiquidCommerce.elements.actions.checkout.closeCheckout();
29
+ ```
30
+
31
+ ### actions.checkout.toggleCheckout()
32
+
33
+ ```typescript
34
+ toggleCheckout(): void
35
+ ```
36
+
37
+ Toggles checkout open/closed.
38
+
39
+ ```javascript
40
+ window.LiquidCommerce.elements.actions.checkout.toggleCheckout();
41
+ ```
42
+
43
+ ### actions.checkout.exitCheckout()
44
+
45
+ ```typescript
46
+ exitCheckout(): void
47
+ ```
48
+
49
+ Navigates away from checkout (requires `exitUrl` configuration).
50
+
51
+ ```javascript
52
+ window.LiquidCommerce.elements.actions.checkout.exitCheckout();
53
+ ```
54
+
55
+ ## Product Actions
56
+
57
+ ### actions.checkout.addProduct()
58
+
59
+ ```typescript
60
+ addProduct(params: IAddProductParams[], openCheckout?: boolean): Promise<void>
61
+ ```
62
+
63
+ Add products directly to checkout, bypassing the cart.
64
+
65
+ ```javascript
66
+ await window.LiquidCommerce.elements.actions.checkout.addProduct([
67
+ {
68
+ identifier: '00619947000020',
69
+ fulfillmentType: 'shipping',
70
+ quantity: 1
71
+ }
72
+ ], true); // Open checkout after adding
73
+ ```
74
+
75
+ ### actions.checkout.addAnonymousProduct()
76
+
77
+ ```typescript
78
+ addAnonymousProduct(
79
+ params: IAnonymousCheckoutAddProductParams
80
+ ): Promise<IAnonymousCheckoutAddProductResponse>
81
+ ```
82
+
83
+ Add a product to checkout without requiring a cart session. Used for direct-to-checkout flows.
84
+
85
+ ```javascript
86
+ const result = await window.LiquidCommerce.elements.actions.checkout
87
+ .addAnonymousProduct({
88
+ identifier: '00619947000020',
89
+ fulfillmentType: 'shipping',
90
+ quantity: 1
91
+ });
92
+ ```
93
+
94
+ ## Promo & Gift Card Actions
95
+
96
+ ### actions.checkout.applyPromoCode()
97
+
98
+ ```typescript
99
+ applyPromoCode(promoCode: string): Promise<void>
100
+ ```
101
+
102
+ Apply a promo code during checkout.
103
+
104
+ ```javascript
105
+ await window.LiquidCommerce.elements.actions.checkout.applyPromoCode('WELCOME10');
106
+ ```
107
+
108
+ ### actions.checkout.removePromoCode()
109
+
110
+ ```typescript
111
+ removePromoCode(): Promise<void>
112
+ ```
113
+
114
+ Remove the active promo code.
115
+
116
+ ```javascript
117
+ await window.LiquidCommerce.elements.actions.checkout.removePromoCode();
118
+ ```
119
+
120
+ ### actions.checkout.applyGiftCard()
121
+
122
+ ```typescript
123
+ applyGiftCard(code: string): Promise<void>
124
+ ```
125
+
126
+ Apply a gift card.
127
+
128
+ ```javascript
129
+ await window.LiquidCommerce.elements.actions.checkout.applyGiftCard('GIFT-1234-5678-9012');
130
+ ```
131
+
132
+ ### actions.checkout.removeGiftCard()
133
+
134
+ ```typescript
135
+ removeGiftCard(code: string): Promise<void>
136
+ ```
137
+
138
+ Remove a gift card.
139
+
140
+ ```javascript
141
+ await window.LiquidCommerce.elements.actions.checkout.removeGiftCard('GIFT-1234-5678-9012');
142
+ ```
143
+
144
+ ## Toggle Actions
145
+
146
+ ### actions.checkout.toggleIsGift()
147
+
148
+ ```typescript
149
+ toggleIsGift(active?: boolean): Promise<void>
150
+ ```
151
+
152
+ Enable/disable gift mode.
153
+
154
+ ```javascript
155
+ // Enable
156
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(true);
157
+
158
+ // Disable
159
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(false);
160
+
161
+ // Toggle
162
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift();
163
+ ```
164
+
165
+ ### actions.checkout.toggleBillingSameAsShipping()
166
+
167
+ ```typescript
168
+ toggleBillingSameAsShipping(active?: boolean): Promise<void>
169
+ ```
170
+
171
+ Set whether billing address matches shipping.
172
+
173
+ ```javascript
174
+ // Use shipping address for billing
175
+ await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(true);
176
+
177
+ // Use different billing address
178
+ await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(false);
179
+ ```
180
+
181
+ ### actions.checkout.toggleMarketingPreferences()
182
+
183
+ ```typescript
184
+ toggleMarketingPreferences(field: 'canEmail' | 'canSms', active: boolean): Promise<void>
185
+ ```
186
+
187
+ Set marketing opt-in preferences.
188
+
189
+ ```javascript
190
+ // Opt into email marketing
191
+ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
192
+
193
+ // Opt into SMS marketing
194
+ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
195
+ ```
196
+
197
+ ## Form Update Actions
198
+
199
+ ### actions.checkout.updateCustomerInfo()
200
+
201
+ ```typescript
202
+ updateCustomerInfo(params: Record<CustomerFieldName, string>): void
203
+ ```
204
+
205
+ Pre-fill customer information.
206
+
207
+ **Available fields:**
208
+ - `firstName`, `lastName`
209
+ - `email`, `phone`
210
+ - `birthdate`, `addressTwo`
211
+ - `company`
212
+
213
+ ```javascript
214
+ window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
215
+ firstName: 'John',
216
+ lastName: 'Doe',
217
+ email: 'john@example.com',
218
+ phone: '+15551234567',
219
+ birthdate: '1990-01-01',
220
+ addressTwo: 'Apt 4B',
221
+ company: 'Acme Corp'
222
+ });
223
+ ```
224
+
225
+ ### actions.checkout.updateBillingInfo()
226
+
227
+ ```typescript
228
+ updateBillingInfo(params: Record<BillingFieldName, string>): void
229
+ ```
230
+
231
+ Pre-fill billing address.
232
+
233
+ **Available fields:**
234
+ - `firstName`, `lastName`
235
+ - `email`, `phone`, `company`
236
+ - `addressOne`, `addressTwo`
237
+ - `city`, `state`, `zipCode`
238
+
239
+ ```javascript
240
+ window.LiquidCommerce.elements.actions.checkout.updateBillingInfo({
241
+ firstName: 'John',
242
+ lastName: 'Doe',
243
+ email: 'john@example.com',
244
+ phone: '+15551234567',
245
+ company: 'Acme Corp',
246
+ addressOne: '123 Main St',
247
+ addressTwo: 'Apt 4B',
248
+ city: 'New York',
249
+ state: 'NY',
250
+ zipCode: '10001'
251
+ });
252
+ ```
253
+
254
+ ### actions.checkout.updateGiftInfo()
255
+
256
+ ```typescript
257
+ updateGiftInfo(params: Record<GiftFieldName, string>): void
258
+ ```
259
+
260
+ Pre-fill gift recipient information.
261
+
262
+ **Available fields:**
263
+ - `firstName`, `lastName`
264
+ - `email`, `phone`
265
+ - `message`, `addressTwo`
266
+
267
+ ```javascript
268
+ window.LiquidCommerce.elements.actions.checkout.updateGiftInfo({
269
+ firstName: 'Jane',
270
+ lastName: 'Smith',
271
+ email: 'jane@example.com',
272
+ phone: '+15559876543',
273
+ addressTwo: 'Suite 200',
274
+ message: 'Happy Birthday!',
275
+ });
276
+ ```
277
+
278
+ ## Data Retrieval
279
+
280
+ ### actions.checkout.getDetails()
281
+
282
+ ```typescript
283
+ getDetails(): ICheckoutDetailsEventData
284
+ ```
285
+
286
+ Retrieve current checkout information.
287
+
288
+ ```javascript
289
+ const checkout = window.LiquidCommerce.elements.actions.checkout.getDetails();
290
+
291
+ console.log(`Cart ID: ${checkout.cartId}`);
292
+ console.log(`Total: $${checkout.amounts.total / 100}`);
293
+ console.log(`Items: ${checkout.items.length}`);
294
+ console.log(`Is Gift: ${checkout.isGift}`);
295
+ ```
296
+
297
+ **Returns:**
298
+
299
+ ```typescript
300
+ interface ICheckoutDetailsEventData {
301
+ cartId: string;
302
+ items: ICheckoutItem[];
303
+ amounts: {
304
+ subtotal: number;
305
+ tax: number;
306
+ shipping: number;
307
+ tip: number;
308
+ total: number;
309
+ };
310
+ customer: ICustomerInfo;
311
+ shippingAddress: IAddress;
312
+ billingAddress?: IAddress;
313
+ isGift: boolean;
314
+ giftRecipient?: IGiftRecipient;
315
+ promoCode?: IPromoCode;
316
+ giftCards: IGiftCard[];
317
+ // ... additional fields
318
+ }
319
+ ```
320
+
321
+ ### actions.checkout.getProductAvailabilityByState()
322
+
323
+ ```typescript
324
+ getProductAvailabilityByState(
325
+ identifiers: string[],
326
+ state?: string
327
+ ): Promise<IProductAvailabilityResponse>
328
+ ```
329
+
330
+ Check product availability across states from the checkout context.
331
+
332
+ ```javascript
333
+ const availability = await window.LiquidCommerce.elements.actions.checkout
334
+ .getProductAvailabilityByState(['00619947000020'], 'CA');
335
+ ```
336
+
337
+ | Parameter | Type | Required | Description |
338
+ |---------------|----------|----------|--------------------------------------|
339
+ | `identifiers` | string[] | Yes | Array of product UPCs, SKUs, or IDs |
340
+ | `state` | string | No | Two-letter state code (e.g., `'NY'`) |
341
+
342
+ ## Use Cases
343
+
344
+ ### Pre-fill for Logged-In Users
345
+
346
+ ```javascript
347
+ window.addEventListener('lce:actions.checkout_opened', () => {
348
+ if (userIsLoggedIn) {
349
+ window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
350
+ firstName: currentUser.firstName,
351
+ lastName: currentUser.lastName,
352
+ email: currentUser.email,
353
+ phone: currentUser.phone
354
+ });
355
+ }
356
+ });
357
+ ```
358
+
359
+ ### Track Checkout Progress
360
+
361
+ ```javascript
362
+ window.addEventListener('lce:actions.checkout_customer_information_updated', () => {
363
+ gtag('event', 'checkout_progress', { step: 'customer_info' });
364
+ });
365
+
366
+ window.addEventListener('lce:actions.checkout_submit_started', () => {
367
+ gtag('event', 'checkout_progress', { step: 'payment' });
368
+ });
369
+
370
+ window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
371
+ const { orderId, total } = event.detail.data;
372
+
373
+ gtag('event', 'purchase', {
374
+ transaction_id: orderId,
375
+ value: total / 100,
376
+ currency: 'USD'
377
+ });
378
+ });
379
+ ```
380
+
381
+ ### Gift Flow
382
+
383
+ ```javascript
384
+ document.getElementById('gift-checkbox').addEventListener('change', async (e) => {
385
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(e.target.checked);
386
+
387
+ if (e.target.checked) {
388
+ showGiftForm();
389
+ } else {
390
+ hideGiftForm();
391
+ }
392
+ });
393
+ ```
394
+
395
+ ### Auto-Apply Campaign Codes
396
+
397
+ ```javascript
398
+ const params = new URLSearchParams(window.location.search);
399
+ const campaignCode = params.get('promo');
400
+
401
+ if (campaignCode) {
402
+ window.addEventListener('lce:actions.checkout_opened', async () => {
403
+ try {
404
+ await window.LiquidCommerce.elements.actions.checkout.applyPromoCode(campaignCode);
405
+ } catch (error) {
406
+ console.log('Invalid campaign code');
407
+ }
408
+ });
409
+ }
410
+ ```
411
+
412
+ ## Events
413
+
414
+ Checkout actions trigger numerous events. See [Checkout Events](../../guides/events.md#checkout-events) for complete list.
415
+
416
+ Key events:
417
+ - `checkout_opened`, `checkout_closed`
418
+ - `checkout_customer_information_updated`
419
+ - `checkout_submit_started`, `checkout_submit_completed`, `checkout_submit_failed`
420
+ - `checkout_promo_code_applied`, `checkout_promo_code_failed`
421
+ - `checkout_gift_card_applied`, `checkout_gift_card_failed`
422
+
423
+ ## See Also
424
+
425
+ - [Checkout Component Guide](../../guides/checkout-component.md)
426
+ - [Checkout Events](../../guides/events.md#checkout-events)
427
+ - [Cart Actions](./cart-actions.md)
@@ -0,0 +1,158 @@
1
+ # Product Actions API
2
+
3
+ Product actions allow you to programmatically retrieve product information.
4
+
5
+ ## actions.product.getDetails()
6
+
7
+ Retrieve details of a loaded product.
8
+
9
+ ### Signature
10
+
11
+ ```typescript
12
+ getDetails(identifier: string): IBaseProductEventData
13
+ ```
14
+
15
+ ### Parameters
16
+
17
+ | Parameter | Type | Required | Description |
18
+ |--------------|--------|----------|-------------------------|
19
+ | `identifier` | string | Yes | Product UPC, SKU, or ID |
20
+
21
+ ### Returns
22
+
23
+ ```typescript
24
+ interface IBaseProductEventData {
25
+ identifier: string;
26
+ name: string;
27
+ description: string;
28
+ price: number; // in cents
29
+ selectedSize: IProductSize;
30
+ selectedFulfillmentType: FulfillmentType;
31
+ selectedRetailer: IRetailer;
32
+ quantity: number;
33
+ images: string[];
34
+ brand: string;
35
+ category: string;
36
+ // ... additional fields
37
+ }
38
+ ```
39
+
40
+ ### Example
41
+
42
+ ```javascript
43
+ const productData = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
44
+
45
+ console.log(productData.name); // "Premium Whiskey"
46
+ console.log(productData.price / 100); // 49.99
47
+ console.log(productData.selectedSize.name); // "750ml"
48
+ console.log(productData.quantity); // 1
49
+ ```
50
+
51
+ ### Errors
52
+
53
+ **Throws `SDKError` if:**
54
+ - Identifier is empty or invalid
55
+ - Product has not been loaded yet
56
+ - Product does not exist
57
+
58
+ ```javascript
59
+ try {
60
+ const data = window.LiquidCommerce.elements.actions.product.getDetails('invalid_id');
61
+ } catch (error) {
62
+ console.error('Product not found:', error.message);
63
+ }
64
+ ```
65
+
66
+ ### Use Cases
67
+
68
+ #### Display Product Info Elsewhere
69
+
70
+ ```javascript
71
+ const product = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
72
+
73
+ document.getElementById('product-name').textContent = product.name;
74
+ document.getElementById('product-price').textContent = `$${product.price / 100}`;
75
+ ```
76
+
77
+ #### Sync with Analytics
78
+
79
+ ```javascript
80
+ window.addEventListener('lce:actions.product_loaded', () => {
81
+ const product = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
82
+
83
+ gtag('event', 'view_item', {
84
+ items: [{
85
+ item_id: product.identifier,
86
+ item_name: product.name,
87
+ price: product.price / 100,
88
+ item_brand: product.brand
89
+ }]
90
+ });
91
+ });
92
+ ```
93
+
94
+ #### Custom Product Comparison
95
+
96
+ ```javascript
97
+ const product1 = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
98
+ const product2 = window.LiquidCommerce.elements.actions.product.getDetails('08504405135');
99
+
100
+ if (product1.price < product2.price) {
101
+ console.log(`${product1.name} is cheaper`);
102
+ }
103
+ ```
104
+
105
+ ---
106
+
107
+ ## actions.product.getProductAvailabilityByState()
108
+
109
+ Check product availability across states.
110
+
111
+ ### Signature
112
+
113
+ ```typescript
114
+ getProductAvailabilityByState(
115
+ identifiers: string[],
116
+ state?: string
117
+ ): Promise<IProductAvailabilityResponse>
118
+ ```
119
+
120
+ ### Parameters
121
+
122
+ | Parameter | Type | Required | Description |
123
+ |---------------|----------|----------|------------------------------------------|
124
+ | `identifiers` | string[] | Yes | Array of product UPCs, SKUs, or IDs |
125
+ | `state` | string | No | Two-letter state code (e.g., `'NY'`) |
126
+
127
+ ### Example
128
+
129
+ ```javascript
130
+ // Check availability in a specific state
131
+ const availability = await window.LiquidCommerce.elements.actions.product
132
+ .getProductAvailabilityByState(['00619947000020', '08504405135'], 'CA');
133
+
134
+ // Check availability in the user's current state (uses address if set)
135
+ const availability = await window.LiquidCommerce.elements.actions.product
136
+ .getProductAvailabilityByState(['00619947000020']);
137
+ ```
138
+
139
+ ### Errors
140
+
141
+ **Throws `SDKError` if:**
142
+ - No identifiers provided or array is empty
143
+ - API request fails
144
+
145
+ ---
146
+
147
+ ## Notes
148
+
149
+ - Product must be injected and loaded before calling `getDetails()`
150
+ - `getDetails()` is synchronous - returns immediately
151
+ - `getProductAvailabilityByState()` is async - returns a Promise
152
+ - Prices are always in cents (divide by 100 for dollars)
153
+ - Selected values reflect current user selection in the component
154
+
155
+ ## See Also
156
+
157
+ - [Product Component Guide](../../guides/product-component.md)
158
+ - [Product Events](../../guides/events.md#product-events)