@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,495 @@
1
+ # Client API
2
+
3
+ The Elements client is the main interface for interacting with the SDK. It provides methods for injecting components, managing UI elements, and performing actions.
4
+
5
+ ## Initialization
6
+
7
+ ### Elements()
8
+
9
+ Initialize the full SDK client.
10
+
11
+ ```typescript
12
+ function Elements(
13
+ apiKey: string,
14
+ config: ILiquidCommerceElementsConfig
15
+ ): Promise<ILiquidCommerceElementsClient | null>
16
+ ```
17
+
18
+ **Parameters:**
19
+
20
+ | Parameter | Type | Required | Description |
21
+ |-----------|-------------------------------|----------|-----------------------------|
22
+ | `apiKey` | string | Yes | Your LiquidCommerce API key |
23
+ | `config` | ILiquidCommerceElementsConfig | Yes | Configuration object |
24
+
25
+ **Returns:** Promise that resolves to the client instance, or `null` if initialization fails.
26
+
27
+ **Example:**
28
+
29
+ ```javascript
30
+ import { Elements } from '@liquidcommerce/elements-sdk';
31
+
32
+ const client = await Elements('YOUR_API_KEY', {
33
+ env: 'production',
34
+ debugMode: 'console',
35
+ customTheme: { /* theme config */ }
36
+ });
37
+ ```
38
+
39
+ ### ElementsCheckout()
40
+
41
+ Initialize the checkout-only client (tree-shaken build).
42
+
43
+ ```typescript
44
+ function ElementsCheckout(
45
+ apiKey: string,
46
+ config: ILiquidCommerceElementsCheckoutClientConfig
47
+ ): Promise<IElementsCheckoutClient | null>
48
+ ```
49
+
50
+ **Parameters:**
51
+
52
+ | Parameter | Type | Required | Description |
53
+ |-----------|---------------------------------------------|----------|-----------------------------|
54
+ | `apiKey` | string | Yes | Your LiquidCommerce API key |
55
+ | `config` | ILiquidCommerceElementsCheckoutClientConfig | Yes | Checkout configuration |
56
+
57
+ **Example:**
58
+
59
+ ```javascript
60
+ import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
61
+
62
+ const client = await ElementsCheckout('YOUR_API_KEY', {
63
+ env: 'production'
64
+ });
65
+ ```
66
+
67
+ ## Configuration
68
+
69
+ ### ILiquidCommerceElementsConfig
70
+
71
+ Complete configuration interface for the full SDK.
72
+
73
+ ```typescript
74
+ interface ILiquidCommerceElementsConfig {
75
+ // Required
76
+ env: ElementsEnv; // 'development' | 'staging' | 'production'
77
+
78
+ // Optional
79
+ debugMode?: DebugMode; // 'none' | 'console' | 'panel'
80
+ customTheme?: IClientCustomThemeConfig;
81
+ promoTicker?: IPromoTicker[];
82
+ proxy?: IElementsProxyConfig;
83
+ checkout?: ILiquidCommerceElementsCheckoutConfig;
84
+ development?: ILiquidCommerceElementsDevelopmentConfig;
85
+ }
86
+ ```
87
+
88
+ #### Environment
89
+
90
+ ```typescript
91
+ type ElementsEnv = 'development' | 'staging' | 'production';
92
+ ```
93
+
94
+ Determines which API environment to use.
95
+
96
+ #### Debug Mode
97
+
98
+ ```typescript
99
+ type DebugMode = 'none' | 'console' | 'panel';
100
+ ```
101
+
102
+ - `'none'`: No debug output (production default)
103
+ - `'console'`: Log debug info to browser console
104
+ - `'panel'`: Show debug panel on page
105
+
106
+ #### Custom Theme
107
+
108
+ ```typescript
109
+ interface IClientCustomThemeConfig {
110
+ global?: UpdateComponentGlobalConfigs;
111
+ product?: UpdateProductComponent;
112
+ address?: UpdateAddressComponent;
113
+ cart?: UpdateCartComponent;
114
+ checkout?: UpdateCheckoutComponent;
115
+ productList?: UpdateProductListComponent;
116
+ }
117
+ ```
118
+
119
+ See [Configuration Reference](./configuration.md) for detailed theme options.
120
+
121
+ #### Promo Ticker
122
+
123
+ ```typescript
124
+ interface IPromoTicker {
125
+ promoCode: string;
126
+ text: string[];
127
+ separator: string;
128
+ activeFrom: string; // ISO 8601 UTC format
129
+ activeUntil: string; // ISO 8601 UTC format
130
+ }
131
+ ```
132
+
133
+ **Example:**
134
+
135
+ ```javascript
136
+ promoTicker: [{
137
+ promoCode: 'SUMMER20',
138
+ text: ['20% Off Summer Sale', 'Free Shipping on $50+'],
139
+ separator: '•',
140
+ activeFrom: '2026-06-01T00:00:00Z',
141
+ activeUntil: '2026-08-31T23:59:59Z'
142
+ }]
143
+ ```
144
+
145
+ #### Proxy Configuration
146
+
147
+ ```typescript
148
+ interface IElementsProxyConfig {
149
+ baseUrl: string;
150
+ headers?: Record<string, string>;
151
+ }
152
+ ```
153
+
154
+ **Example:**
155
+
156
+ ```javascript
157
+ proxy: {
158
+ baseUrl: 'https://yoursite.com/api/elements-proxy',
159
+ headers: {
160
+ 'X-Custom-Header': 'value'
161
+ }
162
+ }
163
+ ```
164
+
165
+ See [Proxy Setup Guide](../integration/proxy-setup.md) for implementation.
166
+
167
+ #### Checkout Configuration
168
+
169
+ ```typescript
170
+ interface ILiquidCommerceElementsCheckoutConfig {
171
+ pageUrl: string; // URL pattern with {token} placeholder
172
+ }
173
+ ```
174
+
175
+ **Example:**
176
+
177
+ ```javascript
178
+ checkout: {
179
+ pageUrl: 'https://yoursite.com/checkout?lce_checkout={token}'
180
+ }
181
+ ```
182
+
183
+ #### Development Configuration
184
+
185
+ ```typescript
186
+ interface ILiquidCommerceElementsDevelopmentConfig {
187
+ customApiUrl?: string;
188
+ paymentMethodId?: string;
189
+ openShadowDom?: boolean;
190
+ }
191
+ ```
192
+
193
+ **Example:**
194
+
195
+ ```javascript
196
+ development: {
197
+ customApiUrl: 'http://localhost:3000/api',
198
+ paymentMethodId: 'pm_test_123', // For testing without Stripe form
199
+ openShadowDom: true // Disable Shadow DOM for debugging
200
+ }
201
+ ```
202
+
203
+ ## Global Access
204
+
205
+ After initialization, the client is available globally under the `window.LiquidCommerce` namespace:
206
+
207
+ ```javascript
208
+ window.LiquidCommerce.elements
209
+ ```
210
+
211
+ This allows access from anywhere in your application:
212
+
213
+ ```javascript
214
+ // From any script
215
+ window.LiquidCommerce.elements.actions.cart.openCart();
216
+ ```
217
+
218
+ ## Client Ready Event
219
+
220
+ Listen for client initialization:
221
+
222
+ ```javascript
223
+ window.addEventListener('lce:actions.client_ready', ( event ) => {
224
+ const { isReady, version, timestamp } = event.detail.data;
225
+
226
+ console.log(`Elements SDK v${version} ready`);
227
+
228
+ // Safe to use client
229
+ window.LiquidCommerce.elements.injectProductElement([...]);
230
+ });
231
+ ```
232
+
233
+ ## Client Interface
234
+
235
+ ### ILiquidCommerceElementsClient
236
+
237
+ The main client interface:
238
+
239
+ ```typescript
240
+ interface ILiquidCommerceElementsClient {
241
+ // Injection methods
242
+ injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
243
+
244
+ injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
245
+
246
+ injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
247
+
248
+ injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
249
+
250
+ injectProductList(params: IInjectProductListParams): Promise<void>;
251
+
252
+ injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
253
+
254
+ injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
255
+
256
+ // UI methods
257
+ ui: ILiquidCommerceElementsUIMethod;
258
+
259
+ // Actions
260
+ actions: ILiquidCommerceElementsActions;
261
+
262
+ // Component management
263
+ getInjectedComponents(): Map<string, IInjectedComponent>;
264
+
265
+ // Cleanup
266
+ destroy(): void;
267
+ }
268
+ ```
269
+
270
+ ## Methods Overview
271
+
272
+ ### Injection Methods
273
+
274
+ - `injectProductElement()` - Inject product displays
275
+ - `injectAddressElement()` - Inject address input
276
+ - `injectCartElement()` - Inject cart (rarely needed)
277
+ - `injectCheckoutElement()` - Inject checkout
278
+ - `injectProductList()` - Inject product catalog
279
+ - `injectProductListSearch()` - Inject search box
280
+ - `injectProductListFilters()` - Inject filter panel
281
+
282
+ See [Injection Methods](./injection-methods.md) for details.
283
+
284
+ ### UI Methods
285
+
286
+ - `ui.cartButton()` - Add cart button
287
+ - `ui.floatingCartButton()` - Add floating cart button
288
+ - `ui.cartSubtotal()` - Display cart subtotal
289
+ - `ui.cartItemsCount()` - Display item count
290
+
291
+ See [UI Helpers](./ui-helpers.md) for details.
292
+
293
+ ### Actions
294
+
295
+ - `actions.product.*` - Product actions
296
+ - `actions.address.*` - Address actions
297
+ - `actions.cart.*` - Cart actions
298
+ - `actions.checkout.*` - Checkout actions
299
+
300
+ See [Actions](./actions/) for details.
301
+
302
+ ### Component Management
303
+
304
+ ```javascript
305
+ // Get all injected components
306
+ const components = client.getInjectedComponents();
307
+
308
+ // Get specific component
309
+ const productComponent = components.get('product-1');
310
+
311
+ // Component methods
312
+ productComponent.getType(); // 'product'
313
+ productComponent.getElement(); // <div id="product-1">...</div>
314
+ productComponent.rerender(); // Force rerender
315
+ productComponent.destroy(); // Remove from DOM and clean up
316
+ ```
317
+
318
+ ### destroy()
319
+
320
+ Remove the client and all injected components, cleaning up event listeners and internal state.
321
+
322
+ ```javascript
323
+ client.destroy();
324
+ ```
325
+
326
+ ## Error Handling
327
+
328
+ ### SDKError
329
+
330
+ All SDK errors use the custom `SDKError` class:
331
+
332
+ ```typescript
333
+ class SDKError extends Error {
334
+ constructor(message: string, reThrow?: boolean);
335
+
336
+ name: 'SDKError';
337
+ isSdk: boolean;
338
+ reThrow: boolean;
339
+ }
340
+ ```
341
+ ### Catching Errors
342
+
343
+ ```javascript
344
+ try {
345
+ await client.injectProductElement([
346
+ { containerId: 'product', identifier: 'invalid_id' }
347
+ ]);
348
+ } catch (error) {
349
+ if (error.name === 'SDKError') {
350
+ console.error('SDK Error:', error);
351
+ }
352
+ }
353
+ ```
354
+
355
+ ### Error Isolation
356
+
357
+ The SDK catches and contains its own errors:
358
+
359
+ ```javascript
360
+ // Even if SDK throws, your app continues
361
+ window.LiquidCommerce.elements.actions.cart.addProduct([/* invalid */]);
362
+
363
+ // Your code still runs
364
+ console.log('App still working');
365
+ ```
366
+
367
+ ## TypeScript Support
368
+
369
+ ### Importing Types
370
+
371
+ ```typescript
372
+ import { Elements } from '@liquidcommerce/elements-sdk';
373
+ import type {
374
+ ILiquidCommerceElementsClient,
375
+ ILiquidCommerceElementsConfig,
376
+ IInjectProductElement,
377
+ IInjectedComponent
378
+ } from '@liquidcommerce/elements-sdk';
379
+
380
+ const config: ILiquidCommerceElementsConfig = {
381
+ env: 'production'
382
+ };
383
+
384
+ const client: ILiquidCommerceElementsClient = await Elements('KEY', config);
385
+ ```
386
+
387
+ ### Type Exports
388
+
389
+ All public interfaces are exported from the main package:
390
+
391
+ ```typescript
392
+ import type {
393
+ // Client types
394
+ ILiquidCommerceElementsClient,
395
+ ILiquidCommerceElementsConfig,
396
+
397
+ // Injection types
398
+ IInjectProductElement,
399
+ IInjectCheckoutParams,
400
+ IInjectedComponent,
401
+
402
+ // Action types
403
+ IProductActions,
404
+ ICartActions,
405
+ ICheckoutActions,
406
+ IAddressActions,
407
+ IAddProductParams,
408
+
409
+ // Configuration types
410
+ IClientCustomThemeConfig,
411
+ IComponentGlobalConfigs,
412
+ IProductComponent,
413
+ ICartComponent,
414
+ ICheckoutComponent,
415
+ IAddressComponent,
416
+
417
+ // Enum types
418
+ ElementsEnv,
419
+ DebugMode,
420
+ FulfillmentType,
421
+ ComponentType
422
+ } from '@liquidcommerce/elements-sdk';
423
+ ```
424
+
425
+ See [TypeScript Types](./typescript-types.md) for complete type reference.
426
+
427
+ ## Best Practices
428
+
429
+ ### Single Client Instance
430
+
431
+ Create one client instance and reuse it:
432
+
433
+ ```javascript
434
+ // Good
435
+ const client = await Elements('KEY', { env: 'production' });
436
+ await client.injectProductElement([...]);
437
+ await client.injectCartElement('cart');
438
+
439
+ // Bad - creates multiple instances
440
+ await Elements('KEY', { env: 'production' });
441
+ await Elements('KEY', { env: 'production' });
442
+ ```
443
+
444
+ ### Use Global Access
445
+
446
+ After initialization, use `window.LiquidCommerce.elements`:
447
+
448
+ ```javascript
449
+ // Initialize once
450
+ await Elements('KEY', { env: 'production' });
451
+
452
+ // Use globally
453
+ window.LiquidCommerce.elements.actions.cart.openCart();
454
+ window.LiquidCommerce.elements.ui.cartButton('cart-btn');
455
+ ```
456
+
457
+ ### Check Client Ready
458
+
459
+ Wait for client ready before using:
460
+
461
+ ```javascript
462
+ if (window.LiquidCommerce?.elements) {
463
+ // Client is ready
464
+ window.LiquidCommerce.elements.actions.cart.openCart();
465
+ } else {
466
+ // Wait for client ready
467
+ window.addEventListener('lce:actions.client_ready', () => {
468
+ window.LiquidCommerce.elements.actions.cart.openCart();
469
+ });
470
+ }
471
+ ```
472
+
473
+ ### Handle Initialization Failures
474
+
475
+ ```javascript
476
+ const client = await Elements('KEY', { env: 'production' });
477
+
478
+ if (!client) {
479
+ console.error('Failed to initialize Elements SDK');
480
+ // Show fallback UI or error message
481
+ showErrorPage();
482
+ return;
483
+ }
484
+
485
+ // Client initialized successfully
486
+ await client.injectProductElement([...]);
487
+ ```
488
+
489
+ ## See Also
490
+
491
+ - [Injection Methods](./injection-methods.md) - Component injection API
492
+ - [UI Helpers](./ui-helpers.md) - UI helper methods
493
+ - [Actions](./actions/) - Action APIs
494
+ - [Configuration](./configuration.md) - Configuration options
495
+ - [TypeScript Types](./typescript-types.md) - Type definitions