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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +84 -2520
  2. package/dist/index.checkout.esm.js +16940 -0
  3. package/dist/index.esm.js +24189 -20939
  4. package/dist/ssr-stub.checkout.esm.js +18 -0
  5. package/dist/ssr-stub.esm.js +270 -0
  6. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  7. package/dist/types/auto-initialize/shared-utils.d.ts +50 -0
  8. package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +15 -2
  9. package/dist/types/clients/builder.d.ts +3 -0
  10. package/dist/types/clients/checkout.d.ts +6 -0
  11. package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +2 -1
  12. package/dist/types/clients/main.d.ts +3 -0
  13. package/dist/types/constants/core.constant.d.ts +2 -6
  14. package/dist/types/core/api/api-client.service.d.ts +20 -18
  15. package/dist/types/core/api/api-result.d.ts +19 -0
  16. package/dist/types/core/api/auth-client.service.d.ts +37 -13
  17. package/dist/types/core/api/http-client.service.d.ts +0 -8
  18. package/dist/types/core/base-component.service.d.ts +2 -1
  19. package/dist/types/core/client/actions/base-action.service.d.ts +22 -0
  20. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  21. package/dist/types/core/client/actions/client-cart-action.service.d.ts +38 -0
  22. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +69 -0
  23. package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
  24. package/dist/types/core/client/client-action.service.d.ts +6 -74
  25. package/dist/types/core/client/client-config.service.d.ts +8 -5
  26. package/dist/types/core/google-tag-manager.service.d.ts +2 -1
  27. package/dist/types/core/logger/logger.service.d.ts +1 -1
  28. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -0
  29. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -1
  30. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +36 -51
  31. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +11 -6
  32. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  33. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  34. package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
  35. package/dist/types/core/store/interfaces/checkout.interface.d.ts +18 -108
  36. package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
  37. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  38. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  39. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  40. package/dist/types/core/store/store.constant.d.ts +5 -0
  41. package/dist/types/core/store/store.service.d.ts +1 -0
  42. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  43. package/dist/types/enums/core.enum.d.ts +39 -1
  44. package/dist/types/enums/index.d.ts +0 -1
  45. package/dist/types/index.checkout.d.ts +8 -0
  46. package/dist/types/index.checkout.umd.d.ts +4 -0
  47. package/dist/types/index.d.ts +8 -3
  48. package/dist/types/interfaces/api/cart.interface.d.ts +12 -7
  49. package/dist/types/interfaces/api/checkout.interface.d.ts +239 -0
  50. package/dist/types/interfaces/api/index.d.ts +5 -0
  51. package/dist/types/interfaces/api/product-list.interface.d.ts +39 -0
  52. package/dist/types/interfaces/api/product.interface.d.ts +10 -4
  53. package/dist/types/interfaces/client.interface.d.ts +72 -0
  54. package/dist/types/interfaces/component.interface.d.ts +7 -0
  55. package/dist/types/interfaces/config.interface.d.ts +40 -0
  56. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  57. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  58. package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
  59. package/dist/types/interfaces/configs/global.interface.d.ts +5 -3
  60. package/dist/types/interfaces/configs/index.d.ts +1 -0
  61. package/dist/types/interfaces/configs/product-list.interface.d.ts +49 -0
  62. package/dist/types/interfaces/configs/product.interface.d.ts +3 -1
  63. package/dist/types/interfaces/injection.interface.d.ts +49 -0
  64. package/dist/types/modules/address/address.command.d.ts +2 -1
  65. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  66. package/dist/types/modules/cart/cart.commands.d.ts +4 -4
  67. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  68. package/dist/types/modules/checkout/checkout.commands.d.ts +26 -10
  69. package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
  70. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  71. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +3 -0
  72. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  73. package/dist/types/modules/checkout/components/checkout-item-quantity.component.d.ts +3 -0
  74. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  75. package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +1 -1
  76. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
  77. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  78. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  79. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
  80. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  81. package/dist/types/modules/checkout/constant.d.ts +3 -0
  82. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  83. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  84. package/dist/types/modules/product/components/product-description.component.d.ts +1 -0
  85. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
  86. package/dist/types/modules/product/components/product-options.component.d.ts +2 -1
  87. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
  88. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +5 -2
  89. package/dist/types/modules/product/product.commands.d.ts +3 -3
  90. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  91. package/dist/types/modules/product-list/components/card-components/index.d.ts +5 -0
  92. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
  93. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
  94. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
  95. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +10 -0
  96. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +13 -0
  97. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  98. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  99. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  100. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  101. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +14 -0
  102. package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-price-filter.components.d.ts → filter-components/product-list-price-filter.d.ts} +1 -1
  103. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
  104. package/dist/types/modules/product-list/components/index.d.ts +6 -2
  105. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +3 -1
  106. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +39 -31
  107. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
  108. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +55 -36
  109. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
  110. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +50 -0
  111. package/dist/types/modules/product-list/components/product-list-search.component.d.ts +25 -0
  112. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
  113. package/dist/types/modules/product-list/product-list-query-params.utils.d.ts +3 -0
  114. package/dist/types/modules/product-list/product-list.commands.d.ts +23 -8
  115. package/dist/types/modules/product-list/product-list.component.d.ts +14 -47
  116. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  117. package/dist/types/modules/product-list/product-list.interface.d.ts +20 -35
  118. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  119. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  120. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  121. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  122. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  123. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  124. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  125. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  126. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  127. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
  128. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +6 -1
  129. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +6 -1
  130. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  131. package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
  132. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  133. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  134. package/dist/types/modules/ui-components/ui.commands.d.ts +5 -1
  135. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  136. package/dist/types/ssr/stub.d.ts +10 -0
  137. package/dist/types/static/icon/check.icon.d.ts +2 -0
  138. package/dist/types/static/icon/index.d.ts +1 -0
  139. package/dist/types/utils/dom-compat.d.ts +2 -0
  140. package/dist/types/utils/format.d.ts +0 -14
  141. package/dist/types/utils/product-selection.d.ts +16 -0
  142. package/dist/types/utils/product.d.ts +15 -0
  143. package/docs/v1/README.md +210 -0
  144. package/docs/v1/api/actions/address-actions.md +286 -0
  145. package/docs/v1/api/actions/cart-actions.md +357 -0
  146. package/docs/v1/api/actions/checkout-actions.md +525 -0
  147. package/docs/v1/api/actions/product-actions.md +204 -0
  148. package/docs/v1/api/client.md +517 -0
  149. package/docs/v1/api/configuration.md +532 -0
  150. package/docs/v1/api/injection-methods.md +292 -0
  151. package/docs/v1/api/typescript-types.md +419 -0
  152. package/docs/v1/api/ui-helpers.md +200 -0
  153. package/docs/v1/examples/advanced-patterns.md +199 -0
  154. package/docs/v1/examples/checkout-flow.md +90 -0
  155. package/docs/v1/examples/custom-theming.md +63 -0
  156. package/docs/v1/examples/multi-product-page.md +90 -0
  157. package/docs/v1/examples/simple-product-page.md +89 -0
  158. package/docs/v1/getting-started/concepts.md +502 -0
  159. package/docs/v1/getting-started/installation.md +328 -0
  160. package/docs/v1/getting-started/quick-start.md +405 -0
  161. package/docs/v1/guides/address-component.md +435 -0
  162. package/docs/v1/guides/best-practices.md +365 -0
  163. package/docs/v1/guides/cart-component.md +725 -0
  164. package/docs/v1/guides/checkout-component.md +670 -0
  165. package/docs/v1/guides/events.md +926 -0
  166. package/docs/v1/guides/product-component.md +731 -0
  167. package/docs/v1/guides/product-list-component.md +631 -0
  168. package/docs/v1/guides/theming.md +213 -0
  169. package/docs/v1/integration/angular.md +39 -0
  170. package/docs/v1/integration/laravel.md +41 -0
  171. package/docs/v1/integration/nextjs.md +69 -0
  172. package/docs/v1/integration/proxy-setup.md +106 -0
  173. package/docs/v1/integration/react.md +64 -0
  174. package/docs/v1/integration/vanilla-js.md +84 -0
  175. package/docs/v1/integration/vue.md +58 -0
  176. package/docs/v1/reference/browser-support.md +45 -0
  177. package/docs/v1/reference/error-handling.md +75 -0
  178. package/docs/v1/reference/performance.md +52 -0
  179. package/docs/v1/reference/troubleshooting.md +136 -0
  180. package/package.json +33 -37
  181. package/dist/types/elements-builder-client.d.ts +0 -2
  182. package/dist/types/elements-client.d.ts +0 -2
  183. package/dist/types/enums/cloud.enum.d.ts +0 -106
  184. package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -42
  185. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  186. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  187. package/dist/types/interfaces/cloud/index.d.ts +0 -4
  188. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  189. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  190. package/dist/types/interfaces/core.interface.d.ts +0 -111
  191. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  192. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  193. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  194. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  195. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
  196. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  197. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  198. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  199. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  200. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  201. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  202. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  203. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  204. package/dist/types/utils/helper.d.ts +0 -28
  205. package/docs/ACTIONS.md +0 -1300
  206. package/docs/BROWSER_SUPPORT.md +0 -279
  207. package/docs/CONFIGURATION.md +0 -853
  208. package/docs/DOCUMENTATION_INDEX.md +0 -311
  209. package/docs/EVENTS.md +0 -798
  210. package/docs/PROXY.md +0 -228
  211. package/docs/THEMING.md +0 -592
  212. package/docs/TROUBLESHOOTING.md +0 -793
  213. package/umd/elements.js +0 -1
  214. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  215. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  216. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  217. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  218. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  219. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  220. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  221. /package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts → filter-components/product-list-checkbox-filter.d.ts} +0 -0
  222. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  223. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  224. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  225. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,670 @@
1
+ # Checkout Component
2
+
3
+ The Checkout component provides a complete purchase flow including customer information collection, payment processing, and order confirmation.
4
+
5
+ ## Overview
6
+
7
+ The Checkout component handles:
8
+ - Customer information (email, phone, address)
9
+ - Gift recipient details (optional)
10
+ - Payment processing (Stripe integration)
11
+ - Billing address
12
+ - Promo codes and gift cards
13
+ - Order summary and totals
14
+ - Marketing preferences
15
+ - Tip options
16
+ - Order confirmation
17
+
18
+ ## Basic Usage
19
+
20
+ ### Checkout Drawer (Default)
21
+
22
+ The checkout drawer opens automatically when users click "Checkout" from the cart. No additional setup required.
23
+
24
+ ### Hosted Checkout Page
25
+
26
+ For a full-page checkout experience, inject checkout into a dedicated container:
27
+
28
+ ```javascript
29
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
30
+
31
+ await client.injectCheckoutElement({
32
+ containerId: 'checkout-container',
33
+ checkoutId: 'optional_checkout_id', // Optional: load specific checkout
34
+ hideHeader: false // Optional: hide checkout header
35
+ });
36
+ ```
37
+
38
+ #### With URL Parameter
39
+
40
+ Configure checkout to load from URL parameter:
41
+
42
+ ```html
43
+ <script
44
+ defer
45
+ data-liquid-commerce-elements
46
+ data-token="YOUR_API_KEY"
47
+ data-env="production"
48
+ data-checkout-param="lce_checkout"
49
+ type="text/javascript"
50
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
51
+ ></script>
52
+
53
+ <div data-lce-checkout></div>
54
+ ```
55
+
56
+ Visit `https://yoursite.com/checkout?lce_checkout=checkout_abc123` to load that checkout.
57
+
58
+ ### Redirect to Custom Checkout Page
59
+
60
+ Configure the cart to redirect to your checkout page instead of opening the drawer:
61
+
62
+ ```javascript
63
+ const client = await Elements('YOUR_API_KEY', {
64
+ env: 'production',
65
+ checkout: {
66
+ pageUrl: 'https://yoursite.com/checkout?lce_checkout={token}'
67
+ }
68
+ });
69
+ ```
70
+
71
+ Or with data attributes:
72
+
73
+ ```html
74
+ <script
75
+ defer
76
+ data-liquid-commerce-elements
77
+ data-token="YOUR_API_KEY"
78
+ data-env="production"
79
+ data-checkout-url="https://yoursite.com/checkout?lce_checkout={token}"
80
+ type="text/javascript"
81
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
82
+ ></script>
83
+ ```
84
+
85
+ The `{token}` placeholder is replaced with the checkout token.
86
+
87
+ ## Checkout Actions
88
+
89
+ ### Open Checkout
90
+
91
+ ```javascript
92
+ window.LiquidCommerce.elements.actions.checkout.openCheckout();
93
+ ```
94
+
95
+ ### Close Checkout
96
+
97
+ ```javascript
98
+ window.LiquidCommerce.elements.actions.checkout.closeCheckout();
99
+ ```
100
+
101
+ ### Toggle Checkout
102
+
103
+ ```javascript
104
+ window.LiquidCommerce.elements.actions.checkout.toggleCheckout();
105
+ ```
106
+
107
+ ### Exit Checkout
108
+
109
+ Navigate away from checkout (requires `exitUrl` configuration):
110
+
111
+ ```javascript
112
+ window.LiquidCommerce.elements.actions.checkout.exitCheckout();
113
+ ```
114
+
115
+ Configure exit URL:
116
+
117
+ ```javascript
118
+ customTheme: {
119
+ checkout: {
120
+ layout: {
121
+ exitUrl: 'https://yoursite.com/shop'
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### Add Product to Checkout
128
+
129
+ Skip the cart and go directly to checkout:
130
+
131
+ ```javascript
132
+ await window.LiquidCommerce.elements.actions.checkout.addProduct([
133
+ {
134
+ identifier: '00619947000020',
135
+ fulfillmentType: 'shipping',
136
+ quantity: 1
137
+ }
138
+ ], true); // true = open checkout after adding
139
+ ```
140
+
141
+ ### Apply Promo Code
142
+
143
+ ```javascript
144
+ await window.LiquidCommerce.elements.actions.checkout.applyPromoCode('WELCOME10');
145
+ ```
146
+
147
+ ### Remove Promo Code
148
+
149
+ ```javascript
150
+ await window.LiquidCommerce.elements.actions.checkout.removePromoCode();
151
+ ```
152
+
153
+ ### Apply Gift Card
154
+
155
+ ```javascript
156
+ await window.LiquidCommerce.elements.actions.checkout.applyGiftCard('GIFT-1234-5678');
157
+ ```
158
+
159
+ ### Remove Gift Card
160
+
161
+ ```javascript
162
+ await window.LiquidCommerce.elements.actions.checkout.removeGiftCard('GIFT-1234-5678');
163
+ ```
164
+
165
+ ### Toggle Gift Mode
166
+
167
+ Enable/disable "Send as Gift" mode:
168
+
169
+ ```javascript
170
+ // Enable gift mode
171
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(true);
172
+
173
+ // Disable gift mode
174
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(false);
175
+
176
+ // Toggle current state
177
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift();
178
+ ```
179
+
180
+ ### Toggle Billing Same As Shipping
181
+
182
+ ```javascript
183
+ // Use shipping address for billing
184
+ await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(true);
185
+
186
+ // Use different billing address
187
+ await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(false);
188
+ ```
189
+
190
+ ### Toggle Marketing Preferences
191
+
192
+ ```javascript
193
+ // Opt into email marketing
194
+ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
195
+
196
+ // Opt into SMS marketing
197
+ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
198
+ ```
199
+
200
+ ### Update Customer Information
201
+
202
+ Pre-fill customer information:
203
+
204
+ ```javascript
205
+ window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
206
+ firstName: 'John',
207
+ lastName: 'Doe',
208
+ email: 'john@example.com',
209
+ phone: '+15551234567',
210
+ birthDate: '1990-01-15',
211
+ addressTwo: 'Apt 4',
212
+ company: 'Acme Corp'
213
+ });
214
+ ```
215
+
216
+ **Available fields:**
217
+ - `firstName`, `lastName`
218
+ - `email`, `phone`
219
+ - `birthDate`, `addressTwo`
220
+ - `company`
221
+
222
+ ### Update Gift Information
223
+
224
+ Pre-fill gift recipient information:
225
+
226
+ ```javascript
227
+ window.LiquidCommerce.elements.actions.checkout.updateGiftInfo({
228
+ firstName: 'Jane',
229
+ lastName: 'Smith',
230
+ email: 'jane@example.com',
231
+ phone: '+15559876543',
232
+ message: 'Happy Birthday!',
233
+ addressTwo: 'Suite 5B'
234
+ });
235
+ ```
236
+
237
+ **Available fields:**
238
+ - `firstName`, `lastName`
239
+ - `email`, `phone`
240
+ - `message`
241
+ - `addressTwo`
242
+
243
+ ### Update Billing Information
244
+
245
+ Pre-fill billing address:
246
+
247
+ ```javascript
248
+ window.LiquidCommerce.elements.actions.checkout.updateBillingInfo({
249
+ firstName: 'John',
250
+ lastName: 'Doe',
251
+ email: 'john@example.com',
252
+ phone: '+15551234567',
253
+ addressOne: '789 Elm St',
254
+ addressTwo: 'Floor 2',
255
+ city: 'Chicago',
256
+ state: 'IL',
257
+ zipCode: '60601'
258
+ });
259
+ ```
260
+
261
+ **Available fields:**
262
+ - `firstName`, `lastName`
263
+ - `email`, `phone`, `company`
264
+ - `addressOne`, `addressTwo`
265
+ - `city`, `state`, `zipCode`
266
+
267
+ ### Get Checkout Details
268
+
269
+ ```javascript
270
+ const checkoutData = window.LiquidCommerce.elements.actions.checkout.getDetails();
271
+
272
+ console.log(checkoutData);
273
+ // {
274
+ // token: 'abc123xyz',
275
+ // cartId: 'cart_abc123',
276
+ // items: { 'cart_item_id': { ... } },
277
+ // amounts: {
278
+ // subtotal: 9998,
279
+ // tax: 800,
280
+ // shipping: 500,
281
+ // tip: 200,
282
+ // total: 11498
283
+ // },
284
+ // isGift: false,
285
+ // ...
286
+ // }
287
+ ```
288
+
289
+ ## Events
290
+
291
+ ### Checkout Lifecycle
292
+
293
+ ```javascript
294
+ window.addEventListener('lce:actions.checkout_loaded', (event) => {
295
+ console.log('Checkout loaded');
296
+ });
297
+
298
+ window.addEventListener('lce:actions.checkout_opened', (event) => {
299
+ console.log('Checkout opened');
300
+ });
301
+
302
+ window.addEventListener('lce:actions.checkout_closed', (event) => {
303
+ console.log('Checkout closed');
304
+ });
305
+
306
+ window.addEventListener('lce:actions.checkout_failed', (event) => {
307
+ console.error('Checkout failed:', event.detail.data.message);
308
+ });
309
+ ```
310
+
311
+ ### Customer Information
312
+
313
+ ```javascript
314
+ window.addEventListener('lce:actions.checkout_customer_information_updated', (event) => {
315
+ const { cartId } = event.detail.data;
316
+ console.log('Customer info updated for cart:', cartId);
317
+ });
318
+ ```
319
+
320
+ ### Gift Information
321
+
322
+ ```javascript
323
+ window.addEventListener('lce:actions.checkout_is_gift_toggled', (event) => {
324
+ const { isActive } = event.detail.data;
325
+ console.log('Gift mode:', isActive ? 'enabled' : 'disabled');
326
+ });
327
+
328
+ window.addEventListener('lce:actions.checkout_gift_information_updated', (event) => {
329
+ console.log('Gift recipient updated');
330
+ });
331
+ ```
332
+
333
+ ### Billing Information
334
+
335
+ ```javascript
336
+ window.addEventListener('lce:actions.checkout_billing_same_as_shipping_toggled', (event) => {
337
+ const { isActive } = event.detail.data;
338
+ console.log('Billing same as shipping:', isActive);
339
+ });
340
+
341
+ window.addEventListener('lce:actions.checkout_billing_information_updated', (event) => {
342
+ console.log('Billing address updated');
343
+ });
344
+ ```
345
+
346
+ ### Marketing Preferences
347
+
348
+ ```javascript
349
+ window.addEventListener('lce:actions.checkout_marketing_preferences_toggled', (event) => {
350
+ const { fieldName, isActive } = event.detail.data;
351
+ console.log(`Marketing ${fieldName}:`, isActive);
352
+ });
353
+ ```
354
+
355
+ ### Items Management
356
+
357
+ ```javascript
358
+ window.addEventListener('lce:actions.checkout_item_removed', (event) => {
359
+ const { cartItemId } = event.detail.data;
360
+ console.log('Item removed:', cartItemId);
361
+ });
362
+
363
+ window.addEventListener('lce:actions.checkout_item_quantity_increase', (event) => {
364
+ const { cartItemId, quantity } = event.detail.data;
365
+ console.log(`Item ${cartItemId} quantity: ${quantity}`);
366
+ });
367
+
368
+ window.addEventListener('lce:actions.checkout_item_quantity_decrease', (event) => {
369
+ const { cartItemId, quantity } = event.detail.data;
370
+ console.log(`Item ${cartItemId} quantity: ${quantity}`);
371
+ });
372
+ ```
373
+
374
+ ### Tips
375
+
376
+ ```javascript
377
+ window.addEventListener('lce:actions.checkout_tip_updated', (event) => {
378
+ const { deliveryTips } = event.detail.data;
379
+ const total = deliveryTips.reduce((sum, t) => sum + t.tip, 0);
380
+ console.log('Tip amount:', total / 100);
381
+ });
382
+ ```
383
+
384
+ ### Payment & Submission
385
+
386
+ ```javascript
387
+ window.addEventListener('lce:actions.checkout_submit_started', (event) => {
388
+ console.log('Processing payment...');
389
+ // Show loading state
390
+ });
391
+
392
+ window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
393
+ const { orderNumber } = event.detail.data;
394
+ console.log('Order completed:', orderNumber);
395
+ // Redirect to confirmation page
396
+ });
397
+
398
+ window.addEventListener('lce:actions.checkout_submit_failed', (event) => {
399
+ const { message } = event.detail.data;
400
+ console.error('Payment failed:', message);
401
+ // Show error message
402
+ });
403
+ ```
404
+
405
+ ### Promo Codes
406
+
407
+ ```javascript
408
+ window.addEventListener('lce:actions.checkout_promo_code_applied', (event) => {
409
+ const { discount, newTotal } = event.detail.data;
410
+ console.log(`Promo applied: $${discount / 100} off`);
411
+ });
412
+
413
+ window.addEventListener('lce:actions.checkout_promo_code_removed', (event) => {
414
+ console.log('Promo code removed');
415
+ });
416
+
417
+ window.addEventListener('lce:actions.checkout_promo_code_failed', (event) => {
418
+ const { error } = event.detail.data;
419
+ console.error('Promo code failed:', error);
420
+ });
421
+ ```
422
+
423
+ ### Gift Cards
424
+
425
+ ```javascript
426
+ window.addEventListener('lce:actions.checkout_gift_card_applied', (event) => {
427
+ const { newTotal } = event.detail.data;
428
+ console.log('Gift card applied, new total:', newTotal / 100);
429
+ });
430
+
431
+ window.addEventListener('lce:actions.checkout_gift_card_removed', (event) => {
432
+ console.log('Gift card removed');
433
+ });
434
+
435
+ window.addEventListener('lce:actions.checkout_gift_card_failed', (event) => {
436
+ const { error } = event.detail.data;
437
+ console.error('Gift card failed:', error);
438
+ });
439
+ ```
440
+
441
+ ### Product Add to Checkout
442
+
443
+ ```javascript
444
+ window.addEventListener('lce:actions.checkout_product_add_success', (event) => {
445
+ const { itemsAdded, identifiers } = event.detail.data;
446
+ console.log(`Added ${itemsAdded} items to checkout`);
447
+ });
448
+
449
+ window.addEventListener('lce:actions.checkout_product_add_failed', (event) => {
450
+ const { error } = event.detail.data;
451
+ console.error('Failed to add to checkout:', error);
452
+ });
453
+ ```
454
+
455
+ ## Customization
456
+
457
+ ### Theme Configuration
458
+
459
+ ```javascript
460
+ const client = await Elements('YOUR_API_KEY', {
461
+ env: 'production',
462
+ customTheme: {
463
+ checkout: {
464
+ theme: {
465
+ backgroundColor: '#ffffff'
466
+ },
467
+ layout: {
468
+ allowGiftCards: true,
469
+ exitUrl: 'https://yoursite.com/shop',
470
+ continueShoppingUrl: 'https://yoursite.com/shop',
471
+ drawerHeaderText: 'Checkout',
472
+ placeOrderButtonText: 'Complete Purchase'
473
+ }
474
+ }
475
+ }
476
+ });
477
+ ```
478
+
479
+ ## Payment Integration
480
+
481
+ The SDK uses Stripe for payment processing. Payment form is embedded and handles:
482
+ - Credit/debit cards
483
+ - Apple Pay (when available)
484
+ - Google Pay (when available)
485
+ - PCI compliance
486
+ - 3D Secure authentication
487
+
488
+ No additional Stripe integration code needed - it's built-in.
489
+
490
+ ## Checkout Flow
491
+
492
+ ### Standard Flow
493
+
494
+ 1. Customer opens checkout (from cart or direct)
495
+ 2. Reviews order summary
496
+ 3. Enters shipping information
497
+ 4. Enters payment information
498
+ 5. Optionally enters billing address
499
+ 6. Reviews total (with promo codes, gift cards, tips)
500
+ 7. Places order
501
+ 8. Sees order confirmation
502
+
503
+ ### Gift Flow
504
+
505
+ 1. Customer enables "Send as Gift"
506
+ 2. Enters their billing/payment information
507
+ 3. Enters recipient's shipping information
508
+ 4. Adds gift message (optional)
509
+ 5. Places order
510
+ 6. Confirmation shows gift delivery details
511
+
512
+ ## Presale Products
513
+
514
+ Checkouts with presale items show:
515
+ - Countdown timer for presale expiration
516
+ - Expected delivery date
517
+ - Special handling for presale orders
518
+
519
+ When presale expires:
520
+ - Shows expiration notice
521
+ - Disables checkout submission
522
+
523
+ ## Best Practices
524
+
525
+ ### Pre-fill Known Information
526
+
527
+ If you have customer data, pre-fill it:
528
+
529
+ ```javascript
530
+ // After user logs in
531
+ if (userIsLoggedIn) {
532
+ window.addEventListener('lce:actions.checkout_opened', () => {
533
+ window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
534
+ firstName: currentUser.firstName,
535
+ lastName: currentUser.lastName,
536
+ email: currentUser.email,
537
+ phone: currentUser.phone
538
+ });
539
+ });
540
+ }
541
+ ```
542
+
543
+ ### Track Conversion Funnel
544
+
545
+ ```javascript
546
+ const checkoutFunnel = {
547
+ loaded: false,
548
+ infoEntered: false,
549
+ paymentEntered: false,
550
+ submitted: false
551
+ };
552
+
553
+ window.addEventListener('lce:actions.checkout_loaded', () => {
554
+ checkoutFunnel.loaded = true;
555
+ gtag('event', 'begin_checkout');
556
+ });
557
+
558
+ window.addEventListener('lce:actions.checkout_customer_information_updated', () => {
559
+ if (!checkoutFunnel.infoEntered) {
560
+ checkoutFunnel.infoEntered = true;
561
+ gtag('event', 'checkout_progress', { step: 'customer_info' });
562
+ }
563
+ });
564
+
565
+ window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
566
+ gtag('event', 'purchase', {
567
+ transaction_id: event.detail.data.orderNumber,
568
+ value: event.detail.data.orderTotal / 100,
569
+ currency: 'USD'
570
+ });
571
+ });
572
+ ```
573
+
574
+ ### Handle Submission States
575
+
576
+ ```javascript
577
+ window.addEventListener('lce:actions.checkout_submit_started', () => {
578
+ // Disable navigation
579
+ window.onbeforeunload = () => 'Payment in progress...';
580
+
581
+ // Show loading overlay
582
+ showGlobalLoadingOverlay('Processing your order...');
583
+ });
584
+
585
+ window.addEventListener('lce:actions.checkout_submit_completed', () => {
586
+ // Re-enable navigation
587
+ window.onbeforeunload = null;
588
+
589
+ // Redirect to confirmation
590
+ window.location.href = '/order-confirmation';
591
+ });
592
+
593
+ window.addEventListener('lce:actions.checkout_submit_failed', () => {
594
+ // Re-enable navigation
595
+ window.onbeforeunload = null;
596
+
597
+ // Hide loading
598
+ hideGlobalLoadingOverlay();
599
+ });
600
+ ```
601
+
602
+ ## Configuration Options
603
+
604
+ ### Enable/Disable Features
605
+
606
+ ```javascript
607
+ checkout: {
608
+ layout: {
609
+ allowGiftCards: true, // Show gift card input
610
+ emailOptIn: {
611
+ show: true, // Show email opt-in checkbox
612
+ checked: false, // Default unchecked
613
+ text: 'Subscribe to our newsletter'
614
+ },
615
+ smsOptIn: {
616
+ show: false, // Hide SMS opt-in checkbox
617
+ checked: false, // Default unchecked
618
+ text: 'Receive SMS updates'
619
+ }
620
+ }
621
+ }
622
+ ```
623
+
624
+ ### Button Text
625
+
626
+ ```javascript
627
+ checkout: {
628
+ layout: {
629
+ placeOrderButtonText: 'Complete Purchase'
630
+ }
631
+ }
632
+ ```
633
+
634
+ ## Troubleshooting
635
+
636
+ ### Checkout Not Opening
637
+
638
+ 1. Verify cart has items: `window.LiquidCommerce.elements.actions.cart.getDetails()`
639
+ 2. Check for JavaScript errors in console
640
+ 3. Ensure SDK is initialized: `window.LiquidCommerce.elements`
641
+ 4. Try manually: `window.LiquidCommerce.elements.actions.checkout.openCheckout()`
642
+
643
+ ### Payment Form Not Loading
644
+
645
+ 1. Check internet connection (Stripe requires network)
646
+ 2. Verify Stripe is not blocked by ad blockers
647
+ 3. Check browser console for Stripe errors
648
+ 4. Ensure your API key is valid
649
+
650
+ ### Customer Info Not Pre-filling
651
+
652
+ 1. Verify you're calling `updateCustomerInfo()` after checkout loads
653
+ 2. Check field names match exactly (case-sensitive)
654
+ 3. Ensure values are strings, not other types
655
+ 4. Listen for checkout_opened event before updating
656
+
657
+ ### Order Submission Failing
658
+
659
+ 1. Check all required fields are filled
660
+ 2. Verify payment information is valid
661
+ 3. Look for validation errors in UI
662
+ 4. Check console for detailed error messages
663
+ 5. Ensure products are still available
664
+
665
+ ## See Also
666
+
667
+ - [Cart Component](./cart-component.md) - Shopping cart functionality
668
+ - [Actions API](../api/actions/checkout-actions.md) - Checkout actions reference
669
+ - [Events](./events.md) - All available events
670
+ - [Theming](./theming.md) - Customize appearance