@liquidcommerce/elements-sdk 2.6.7 → 2.7.1

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 (170) hide show
  1. package/README.md +83 -2519
  2. package/dist/index.checkout.esm.js +16086 -0
  3. package/dist/index.esm.js +16267 -13788
  4. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  5. package/dist/types/auto-initialize/shared-utils.d.ts +27 -0
  6. package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +11 -1
  7. package/dist/types/clients/checkout.d.ts +13 -0
  8. package/dist/types/constants/core.constant.d.ts +5 -3
  9. package/dist/types/core/api/api-client.service.d.ts +0 -2
  10. package/dist/types/core/client/actions/base-action.service.d.ts +15 -0
  11. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  12. package/dist/types/core/client/actions/client-cart-action.service.d.ts +37 -0
  13. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +50 -0
  14. package/dist/types/core/client/actions/client-product-action.service.d.ts +12 -0
  15. package/dist/types/core/client/client-action.service.d.ts +6 -73
  16. package/dist/types/core/client/client-config.service.d.ts +3 -4
  17. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +1 -0
  18. package/dist/types/core/store/interfaces/core.interface.d.ts +14 -1
  19. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  20. package/dist/types/core/store/interfaces/product-list.interface.d.ts +45 -0
  21. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  22. package/dist/types/core/store/store.constant.d.ts +4 -0
  23. package/dist/types/enums/core.enum.d.ts +14 -1
  24. package/dist/types/enums/index.d.ts +0 -1
  25. package/dist/types/index.checkout.d.ts +7 -0
  26. package/dist/types/index.checkout.umd.d.ts +4 -0
  27. package/dist/types/index.d.ts +2 -2
  28. package/dist/types/interfaces/api/checkout.interface.d.ts +2 -1
  29. package/dist/types/interfaces/api/product-list.interface.d.ts +13 -5
  30. package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -0
  31. package/dist/types/interfaces/configs/global.interface.d.ts +4 -2
  32. package/dist/types/interfaces/configs/index.d.ts +1 -0
  33. package/dist/types/interfaces/configs/product-list.interface.d.ts +28 -0
  34. package/dist/types/interfaces/core.interface.d.ts +28 -6
  35. package/dist/types/modules/address/address-input.component.d.ts +11 -0
  36. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  37. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  38. package/dist/types/modules/checkout/checkout.commands.d.ts +6 -2
  39. package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
  40. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +2 -0
  41. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  42. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  43. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  44. package/dist/types/modules/product-list/components/card-components/index.d.ts +7 -0
  45. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +8 -0
  46. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
  47. package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +12 -0
  48. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
  49. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +10 -0
  50. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -0
  51. package/dist/types/modules/product-list/components/card-components/product-title.d.ts +6 -0
  52. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  53. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  54. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  55. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  56. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +14 -0
  57. 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
  58. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +13 -0
  59. package/dist/types/modules/product-list/components/index.d.ts +7 -3
  60. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +2 -1
  61. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +10 -0
  62. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +58 -37
  63. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +28 -0
  64. package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +26 -0
  65. package/dist/types/modules/product-list/components/product-list-search.component.d.ts +22 -0
  66. package/dist/types/modules/product-list/product-list-card.component.d.ts +30 -0
  67. package/dist/types/modules/product-list/product-list.commands.d.ts +62 -3
  68. package/dist/types/modules/product-list/product-list.component.d.ts +16 -43
  69. package/dist/types/{enums/cloud.enum.d.ts → modules/product-list/product-list.constants.d.ts} +20 -1
  70. package/dist/types/modules/product-list/product-list.interface.d.ts +33 -24
  71. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  72. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  73. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  74. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  75. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  76. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  77. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  78. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  79. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -1
  80. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -1
  81. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  82. package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
  83. package/dist/types/modules/ui-components/modal/modal.component.d.ts +23 -0
  84. package/dist/types/modules/ui-components/styles/modal.style.d.ts +1 -0
  85. package/dist/types/modules/ui-components/ui.commands.d.ts +3 -1
  86. package/dist/types/static/icon/check.icon.d.ts +2 -0
  87. package/dist/types/static/icon/index.d.ts +1 -0
  88. package/docs/gitbook/actions.md +160 -0
  89. package/docs/gitbook/address.md +48 -0
  90. package/docs/gitbook/cart.md +65 -0
  91. package/docs/gitbook/checkout.md +131 -0
  92. package/docs/gitbook/events.md +137 -0
  93. package/docs/gitbook/overview.md +166 -0
  94. package/docs/gitbook/product.md +64 -0
  95. package/docs/gitbook/quick-start-guide.md +393 -0
  96. package/docs/v1/README.md +210 -0
  97. package/docs/v1/api/actions/address-actions.md +281 -0
  98. package/docs/v1/api/actions/cart-actions.md +337 -0
  99. package/docs/v1/api/actions/checkout-actions.md +387 -0
  100. package/docs/v1/api/actions/product-actions.md +115 -0
  101. package/docs/v1/api/client.md +482 -0
  102. package/docs/v1/api/configuration.md +1 -0
  103. package/docs/v1/api/injection-methods.md +247 -0
  104. package/docs/v1/api/typescript-types.md +1 -0
  105. package/docs/v1/api/ui-helpers.md +200 -0
  106. package/docs/v1/examples/advanced-patterns.md +96 -0
  107. package/docs/v1/examples/checkout-flow.md +91 -0
  108. package/docs/v1/examples/custom-theming.md +63 -0
  109. package/docs/v1/examples/multi-product-page.md +90 -0
  110. package/docs/v1/examples/simple-product-page.md +89 -0
  111. package/docs/v1/getting-started/concepts.md +507 -0
  112. package/docs/v1/getting-started/installation.md +328 -0
  113. package/docs/v1/getting-started/quick-start.md +405 -0
  114. package/docs/v1/guides/address-component.md +431 -0
  115. package/docs/v1/guides/best-practices.md +324 -0
  116. package/docs/v1/guides/cart-component.md +737 -0
  117. package/docs/v1/guides/checkout-component.md +672 -0
  118. package/docs/v1/guides/events.md +191 -0
  119. package/docs/v1/guides/product-component.md +686 -0
  120. package/docs/v1/guides/product-list-component.md +598 -0
  121. package/docs/v1/guides/theming.md +216 -0
  122. package/docs/v1/integration/angular.md +39 -0
  123. package/docs/v1/integration/laravel.md +41 -0
  124. package/docs/v1/integration/nextjs.md +60 -0
  125. package/docs/v1/integration/proxy-setup.md +89 -0
  126. package/docs/v1/integration/react.md +64 -0
  127. package/docs/v1/integration/vanilla-js.md +84 -0
  128. package/docs/v1/integration/vue.md +34 -0
  129. package/docs/v1/reference/browser-support.md +35 -0
  130. package/docs/v1/reference/error-handling.md +70 -0
  131. package/docs/v1/reference/performance.md +54 -0
  132. package/docs/v1/reference/troubleshooting.md +64 -0
  133. package/package.json +19 -12
  134. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +0 -37
  135. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  136. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  137. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  138. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
  139. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  140. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  141. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  142. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  143. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  144. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  145. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  146. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  147. package/docs/ACTIONS.md +0 -1300
  148. package/docs/BROWSER_SUPPORT.md +0 -279
  149. package/docs/CONFIGURATION.md +0 -853
  150. package/docs/DOCUMENTATION_INDEX.md +0 -311
  151. package/docs/EVENTS.md +0 -798
  152. package/docs/PROXY.md +0 -228
  153. package/docs/THEMING.md +0 -592
  154. package/docs/TROUBLESHOOTING.md +0 -793
  155. package/umd/elements.js +0 -1
  156. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  157. /package/dist/types/{elements-builder-client.d.ts → clients/builder.d.ts} +0 -0
  158. /package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +0 -0
  159. /package/dist/types/{elements-client.d.ts → clients/main.d.ts} +0 -0
  160. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  161. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  162. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  163. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  164. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  165. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  166. /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
  167. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  168. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  169. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  170. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
package/docs/THEMING.md DELETED
@@ -1,592 +0,0 @@
1
- # Theming Guide
2
-
3
- Complete reference for customizing the appearance of LiquidCommerce Elements SDK components based on actual SDK interfaces.
4
-
5
- ## Overview
6
-
7
- The SDK provides theme customization through the `customTheme` configuration option. Theme configuration uses a hierarchical structure with global and component-specific settings.
8
-
9
- ## Basic Usage
10
-
11
- ```javascript
12
- const client = await Elements('YOUR_API_KEY', {
13
- customTheme: {
14
- global: {
15
- theme: { /* global theme */ },
16
- layout: { /* global layout */ }
17
- },
18
- product: { /* product theme */ },
19
- cart: { /* cart theme */ },
20
- checkout: { /* checkout theme */ },
21
- address: { /* address theme */ }
22
- }
23
- });
24
- ```
25
-
26
- ## Global Configuration
27
-
28
- ### Global Theme
29
-
30
- ```typescript
31
- interface IGlobalTheme {
32
- buttonCornerRadius: string;
33
- cardCornerRadius: string;
34
- headingFont: IFontFamily;
35
- paragraphFont: IFontFamily;
36
- primaryColor: string;
37
- accentColor: string;
38
- defaultTextColor: string;
39
- selectedTextColor: string;
40
- linkTextColor: string;
41
- errorColor: string;
42
- warningColor: string;
43
- successColor: string;
44
- drawerBackgroundColor: string;
45
- }
46
-
47
- interface IFontFamily {
48
- name: string;
49
- weights: number[];
50
- }
51
- ```
52
-
53
- **Example:**
54
- ```javascript
55
- customTheme: {
56
- global: {
57
- theme: {
58
- buttonCornerRadius: '8px',
59
- cardCornerRadius: '12px',
60
- headingFont: {
61
- name: 'Inter',
62
- weights: [600, 700]
63
- },
64
- paragraphFont: {
65
- name: 'Inter',
66
- weights: [400, 500]
67
- },
68
- primaryColor: '#007bff',
69
- accentColor: '#6c757d',
70
- defaultTextColor: '#212529',
71
- selectedTextColor: '#ffffff',
72
- linkTextColor: '#1d4ed8',
73
- errorColor: '#dc3545',
74
- warningColor: '#ffc107',
75
- successColor: '#28a745',
76
- drawerBackgroundColor: '#ffffff'
77
- }
78
- }
79
- }
80
- ```
81
-
82
- ### Global Layout
83
-
84
- ```typescript
85
- interface IGlobalLayout {
86
- enablePersonalization: boolean;
87
- personalizationText: string;
88
- personalizationCardStyle: 'outlined' | 'filled';
89
- allowPromoCodes: boolean;
90
- inputFieldStyle: 'outlined' | 'filled';
91
- showPoweredBy: boolean; // ⚠️ READ-ONLY: Cannot be customized (paid feature)
92
- poweredByMode: 'light' | 'dark'; // Can be customized
93
- }
94
- ```
95
-
96
- **⚠️ Protected Field**: `showPoweredBy` is controlled by LiquidCommerce and cannot be overridden through custom theme configuration. This is a paid feature managed through your LiquidCommerce dashboard. However, `poweredByMode` can be customized to match your site's theme (light or dark).
97
-
98
- **Example:**
99
- ```javascript
100
- customTheme: {
101
- global: {
102
- layout: {
103
- enablePersonalization: true,
104
- personalizationText: 'Personalize your product',
105
- personalizationCardStyle: 'outlined',
106
- allowPromoCodes: true,
107
- inputFieldStyle: 'filled',
108
- poweredByMode: 'dark' // Can be customized (light or dark)
109
- // Note: showPoweredBy is read-only and cannot be customized here
110
- }
111
- }
112
- }
113
- ```
114
-
115
- ### Personalization (Engraving) Configuration
116
-
117
- The personalization feature is controlled globally and affects how engraving appears across all contexts (product, cart, and checkout).
118
-
119
- **Configuration Options:**
120
-
121
- - **`enablePersonalization`** (boolean): Master switch to enable/disable personalization feature globally. When `false`, engraving options won't appear even for engravable products.
122
-
123
- - **`personalizationText`** (string): The text shown on the "Add Personalization" button in product views. This is the call-to-action that customers see before adding engraving.
124
-
125
- - **`personalizationCardStyle`** ('outlined' | 'filled'): Controls the visual style of personalization cards displayed in cart and checkout:
126
- - `'outlined'`: Border-based style with transparent background
127
- - `'filled'`: Filled background style
128
-
129
- **Context-Specific Behavior:**
130
-
131
- The SDK intelligently displays personalization differently based on context:
132
-
133
- 1. **Product View:** Shows button with `personalizationText` and engraving fee (e.g., "Personalize your product +$5.00")
134
-
135
- 2. **Cart View:** Displays engraving details in a card with edit/remove buttons using the `personalizationCardStyle`
136
-
137
- 3. **Checkout View:** Shows engraving details in a card (read-only) with only remove button using the `personalizationCardStyle`
138
-
139
- **Example Configurations:**
140
-
141
- ```javascript
142
- // Minimal personalization (use defaults)
143
- customTheme: {
144
- global: {
145
- layout: {
146
- enablePersonalization: true
147
- }
148
- }
149
- }
150
-
151
- // Custom personalization styling
152
- customTheme: {
153
- global: {
154
- layout: {
155
- enablePersonalization: true,
156
- personalizationText: 'Make it yours',
157
- personalizationCardStyle: 'filled'
158
- }
159
- }
160
- }
161
-
162
- // Disable personalization globally
163
- customTheme: {
164
- global: {
165
- layout: {
166
- enablePersonalization: false
167
- }
168
- }
169
- }
170
- ```
171
-
172
- **Note:** Individual products determine if they support engraving based on product metadata. The global setting only controls whether the feature is available when products support it.
173
-
174
- ## Product Component
175
-
176
- ```typescript
177
- interface IProductComponent {
178
- theme: {
179
- backgroundColor: string;
180
- };
181
- layout: {
182
- showImages: boolean;
183
- showTitle: boolean;
184
- showDescription: boolean;
185
- showQuantityCounter: boolean;
186
- showOffHours: boolean;
187
- quantityCounterStyle: 'outlined' | 'ghost';
188
- fulfillmentDisplay: 'carousel' | 'popup';
189
- enableShippingFulfillment: boolean;
190
- enableOnDemandFulfillment: boolean;
191
- addToCartButtonText: string;
192
- addToCartButtonShowTotalPrice: boolean;
193
- buyNowButtonText: string;
194
- preSaleButtonText: string;
195
- };
196
- }
197
- ```
198
-
199
- **Example:**
200
- ```javascript
201
- customTheme: {
202
- product: {
203
- theme: {
204
- backgroundColor: '#ffffff'
205
- },
206
- layout: {
207
- showImages: true,
208
- showTitle: true,
209
- showDescription: true,
210
- showQuantityCounter: true,
211
- showOffHours: false,
212
- quantityCounterStyle: 'outlined',
213
- fulfillmentDisplay: 'carousel',
214
- enableShippingFulfillment: true,
215
- enableOnDemandFulfillment: true,
216
- addToCartButtonText: 'Add to Cart',
217
- addToCartButtonShowTotalPrice: true,
218
- buyNowButtonText: 'Buy Now',
219
- preSaleButtonText: 'Pre-Order'
220
- }
221
- }
222
- }
223
- ```
224
-
225
- ## Cart Component
226
-
227
- ```typescript
228
- interface ICartComponent {
229
- theme: {
230
- backgroundColor: string;
231
- };
232
- layout: {
233
- showQuantityCounter: boolean;
234
- quantityCounterStyle: 'outlined' | 'ghost';
235
- drawerHeaderText: string;
236
- goToCheckoutButtonText: string;
237
- };
238
- }
239
- ```
240
-
241
- **Example:**
242
- ```javascript
243
- customTheme: {
244
- cart: {
245
- theme: {
246
- backgroundColor: '#ffffff'
247
- },
248
- layout: {
249
- showQuantityCounter: true,
250
- quantityCounterStyle: 'outlined',
251
- drawerHeaderText: 'Your Cart',
252
- goToCheckoutButtonText: 'Proceed to Checkout'
253
- }
254
- }
255
- }
256
- ```
257
-
258
- ## Checkout Component
259
-
260
- ```typescript
261
- interface ICheckoutComponent {
262
- theme: {
263
- backgroundColor: string;
264
- checkoutCompleted: {
265
- customLogo: string;
266
- customText: string | null;
267
- };
268
- };
269
- layout: {
270
- emailOptIn: {
271
- show: boolean;
272
- checked: boolean;
273
- text: string;
274
- };
275
- smsOptIn: {
276
- show: boolean;
277
- checked: boolean;
278
- text: string;
279
- };
280
- allowGiftCards: boolean;
281
- legalMessage: {
282
- show: boolean;
283
- text: string;
284
- };
285
- exitUrl: string;
286
- thankYouButtonText: string;
287
- drawerHeaderText: string;
288
- placeOrderButtonText: string;
289
- };
290
- }
291
- ```
292
-
293
- **Example:**
294
- ```javascript
295
- customTheme: {
296
- checkout: {
297
- theme: {
298
- backgroundColor: '#ffffff',
299
- checkoutCompleted: {
300
- customLogo: 'https://yourdomain.com/logo.png',
301
- customText: 'Thank you for your order!'
302
- }
303
- },
304
- layout: {
305
- emailOptIn: {
306
- show: true,
307
- checked: false,
308
- text: 'Send me marketing emails'
309
- },
310
- smsOptIn: {
311
- show: true,
312
- checked: false,
313
- text: 'Send me SMS updates'
314
- },
315
- allowGiftCards: true,
316
- legalMessage: {
317
- show: true,
318
- text: 'By placing this order, you agree to our terms and conditions.'
319
- },
320
- exitUrl: '/',
321
- thankYouButtonText: 'Continue Shopping',
322
- drawerHeaderText: 'Checkout',
323
- placeOrderButtonText: 'Place Order'
324
- }
325
- }
326
- }
327
- ```
328
-
329
- ## Address Component
330
-
331
- ```typescript
332
- interface IAddressComponent {
333
- theme: {
334
- backgroundColor: string;
335
- };
336
- }
337
- ```
338
-
339
- **Example:**
340
- ```javascript
341
- customTheme: {
342
- address: {
343
- theme: {
344
- backgroundColor: '#ffffff'
345
- }
346
- }
347
- }
348
- ```
349
-
350
- ## Complete Configuration Example
351
-
352
- ```javascript
353
- const client = await Elements('YOUR_API_KEY', {
354
- env: 'production',
355
- customTheme: {
356
- global: {
357
- theme: {
358
- buttonCornerRadius: '8px',
359
- cardCornerRadius: '12px',
360
- headingFont: {
361
- name: 'Inter',
362
- weights: [600, 700]
363
- },
364
- paragraphFont: {
365
- name: 'Inter',
366
- weights: [400, 500]
367
- },
368
- primaryColor: '#007bff',
369
- accentColor: '#6c757d',
370
- defaultTextColor: '#212529',
371
- selectedTextColor: '#ffffff',
372
- linkTextColor: '#1d4ed8',
373
- errorColor: '#dc3545',
374
- warningColor: '#ffc107',
375
- successColor: '#28a745',
376
- drawerBackgroundColor: '#ffffff'
377
- },
378
- layout: {
379
- enablePersonalization: true,
380
- personalizationText: 'Make it yours',
381
- personalizationCardStyle: 'outlined',
382
- allowPromoCodes: true,
383
- inputFieldStyle: 'filled',
384
- poweredByMode: 'light'
385
- }
386
- },
387
- product: {
388
- theme: {
389
- backgroundColor: '#ffffff'
390
- },
391
- layout: {
392
- showImages: true,
393
- showTitle: true,
394
- showDescription: true,
395
- showQuantityCounter: true,
396
- showOffHours: false,
397
- quantityCounterStyle: 'outlined',
398
- fulfillmentDisplay: 'carousel',
399
- enableShippingFulfillment: true,
400
- enableOnDemandFulfillment: true,
401
- addToCartButtonText: 'Add to Cart',
402
- addToCartButtonShowTotalPrice: true,
403
- buyNowButtonText: 'Buy Now',
404
- preSaleButtonText: 'Pre-Order'
405
- }
406
- },
407
- cart: {
408
- theme: {
409
- backgroundColor: '#ffffff'
410
- },
411
- layout: {
412
- showQuantityCounter: true,
413
- quantityCounterStyle: 'outlined',
414
- drawerHeaderText: 'Your Cart',
415
- goToCheckoutButtonText: 'Checkout'
416
- }
417
- },
418
- checkout: {
419
- theme: {
420
- backgroundColor: '#ffffff',
421
- checkoutCompleted: {
422
- customLogo: 'https://yourdomain.com/logo.png',
423
- customText: null
424
- }
425
- },
426
- layout: {
427
- emailOptIn: {
428
- show: true,
429
- checked: false,
430
- text: 'Email me with news and offers'
431
- },
432
- smsOptIn: {
433
- show: true,
434
- checked: false,
435
- text: 'Text me with updates'
436
- },
437
- allowGiftCards: true,
438
- legalMessage: {
439
- show: false,
440
- text: ''
441
- },
442
- exitUrl: '/',
443
- thankYouButtonText: 'Continue Shopping',
444
- drawerHeaderText: 'Checkout',
445
- placeOrderButtonText: 'Place Order'
446
- }
447
- },
448
- address: {
449
- theme: {
450
- backgroundColor: '#ffffff'
451
- }
452
- }
453
- }
454
- });
455
- ```
456
-
457
- ## Dynamic Theme Updates (Builder Mode)
458
-
459
- When `isBuilder: true`, update themes dynamically:
460
-
461
- ```javascript
462
- const client = await Elements('YOUR_API_KEY', {
463
- env: 'development',
464
- isBuilder: true
465
- });
466
-
467
- // Update global theme
468
- await client.builder.updateComponentGlobalConfigs({
469
- theme: {
470
- primaryColor: '#ff6b6b'
471
- }
472
- });
473
-
474
- // Update product component
475
- await client.builder.updateProductComponent({
476
- layout: {
477
- addToCartButtonText: 'Add to Bag'
478
- }
479
- });
480
-
481
- // Update cart component
482
- client.builder.updateCartComponent({
483
- layout: {
484
- drawerHeaderText: 'Shopping Bag'
485
- }
486
- });
487
-
488
- // Update checkout component
489
- client.builder.updateCheckoutComponent({
490
- layout: {
491
- placeOrderButtonText: 'Complete Purchase'
492
- }
493
- });
494
-
495
- // Update address component
496
- client.builder.updateAddressComponent({
497
- theme: {
498
- backgroundColor: '#f8f9fa'
499
- }
500
- });
501
- ```
502
-
503
- ## TypeScript Support
504
-
505
- The SDK includes full TypeScript definitions:
506
-
507
- ```typescript
508
- import type {
509
- IClientCustomThemeConfig,
510
- UpdateComponentGlobalConfigs,
511
- UpdateProductComponent,
512
- UpdateCartComponent,
513
- UpdateCheckoutComponent,
514
- UpdateAddressComponent
515
- } from '@liquidcommerce/elements-sdk';
516
-
517
- const customTheme: IClientCustomThemeConfig = {
518
- global: {
519
- theme: {
520
- primaryColor: '#007bff'
521
- }
522
- }
523
- };
524
- ```
525
-
526
- ## Theme Presets
527
-
528
- ### Minimal
529
-
530
- ```javascript
531
- customTheme: {
532
- global: {
533
- theme: {
534
- buttonCornerRadius: '4px',
535
- cardCornerRadius: '4px',
536
- primaryColor: '#000000',
537
- accentColor: '#666666'
538
- }
539
- }
540
- }
541
- ```
542
-
543
- ### Rounded
544
-
545
- ```javascript
546
- customTheme: {
547
- global: {
548
- theme: {
549
- buttonCornerRadius: '24px',
550
- cardCornerRadius: '16px'
551
- }
552
- }
553
- }
554
- ```
555
-
556
- ### Bold Colors
557
-
558
- ```javascript
559
- customTheme: {
560
- global: {
561
- theme: {
562
- primaryColor: '#ff4757',
563
- accentColor: '#5f27cd',
564
- successColor: '#1dd1a1',
565
- errorColor: '#ee5a6f'
566
- }
567
- }
568
- }
569
- ```
570
-
571
- ## Best Practices
572
-
573
- 1. **Start minimal** - Only override what you need
574
- 2. **Maintain consistency** - Use consistent corner radius and colors across components
575
- 3. **Test accessibility** - Ensure sufficient color contrast
576
- 4. **Use web fonts** - Load fonts before initializing SDK for smooth rendering
577
- 5. **Match your brand** - Use your existing brand colors and typography
578
- 6. **Test on mobile** - Verify appearance on different screen sizes
579
- 7. **Use TypeScript** - Leverage type checking to avoid errors
580
- 8. **Document your theme** - Keep a reference of your theme customizations
581
-
582
- ## Limitations
583
-
584
- - Theme configuration is deep-merged with default theme
585
- - Some UI elements may not be customizable (core functionality)
586
- - Font loading is your responsibility (load fonts before SDK init)
587
- - Background colors apply to drawer containers, not individual elements
588
-
589
- ## Related Documentation
590
-
591
- - [Configuration Reference](./CONFIGURATION.md) - All SDK configuration options
592
- - [Troubleshooting Guide](./TROUBLESHOOTING.md) - Common theming issues