@liquidcommerce/elements-sdk 2.2.2 → 2.4.0

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 (62) hide show
  1. package/README.md +1608 -557
  2. package/dist/index.esm.js +10170 -8144
  3. package/dist/types/core/auth.service.d.ts +10 -4
  4. package/dist/types/core/base-component.service.d.ts +3 -0
  5. package/dist/types/core/circuit-breaker.service.d.ts +54 -0
  6. package/dist/types/core/client/client-action.service.d.ts +13 -11
  7. package/dist/types/core/client/client-config.service.d.ts +5 -3
  8. package/dist/types/core/command/common-command.service.d.ts +2 -1
  9. package/dist/types/core/debug-panel/debug-panel.service.d.ts +43 -0
  10. package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -0
  11. package/dist/types/core/fingerprint.service.d.ts +4 -9
  12. package/dist/types/core/google-tag-manager.service.d.ts +127 -2
  13. package/dist/types/core/logger/logger-factory.d.ts +3 -0
  14. package/dist/types/core/logger/logger.service.d.ts +8 -5
  15. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -3
  16. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +0 -5
  17. package/dist/types/core/store/interfaces/cart.interface.d.ts +0 -1
  18. package/dist/types/core/store/interfaces/checkout.interface.d.ts +0 -1
  19. package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
  20. package/dist/types/core/store/interfaces/product.interface.d.ts +0 -1
  21. package/dist/types/core/store/store.service.d.ts +1 -0
  22. package/dist/types/core/telemetry/telemetry.interface.d.ts +80 -0
  23. package/dist/types/core/telemetry/telemetry.service.d.ts +27 -0
  24. package/dist/types/enums/core.enum.d.ts +0 -1
  25. package/dist/types/enums/debug.enum.d.ts +6 -0
  26. package/dist/types/enums/index.d.ts +1 -0
  27. package/dist/types/interfaces/core.interface.d.ts +2 -2
  28. package/dist/types/modules/address/address.command.d.ts +1 -3
  29. package/dist/types/modules/cart/cart.commands.d.ts +1 -1
  30. package/dist/types/modules/cart/cart.component.d.ts +1 -2
  31. package/dist/types/modules/cart/components/cart-footer.component.d.ts +1 -0
  32. package/dist/types/modules/cart/components/cart-item.component.d.ts +2 -6
  33. package/dist/types/modules/checkout/checkout.commands.d.ts +3 -2
  34. package/dist/types/modules/checkout/checkout.component.d.ts +1 -2
  35. package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +2 -0
  36. package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +1 -1
  37. package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +0 -2
  38. package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +2 -1
  39. package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +1 -0
  40. package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +0 -1
  41. package/dist/types/modules/checkout/constant.d.ts +0 -1
  42. package/dist/types/modules/product/components/index.d.ts +1 -0
  43. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  44. package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
  45. package/dist/types/modules/product/components/product-price.component.d.ts +1 -0
  46. package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
  47. package/dist/types/modules/product/product.commands.d.ts +1 -1
  48. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -11
  49. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -9
  50. package/dist/types/static/icon/index.d.ts +0 -1
  51. package/dist/types/utils/format.d.ts +2 -1
  52. package/docs/ACTIONS.md +1235 -0
  53. package/docs/BROWSER_SUPPORT.md +279 -0
  54. package/docs/CONFIGURATION.md +613 -0
  55. package/docs/DOCUMENTATION_INDEX.md +311 -0
  56. package/docs/EVENTS.md +532 -0
  57. package/docs/PROXY.md +228 -0
  58. package/docs/THEMING.md +592 -0
  59. package/docs/TROUBLESHOOTING.md +755 -0
  60. package/package.json +17 -17
  61. package/umd/elements.js +1 -1
  62. package/dist/types/static/icon/completed.icon.d.ts +0 -2
@@ -0,0 +1,592 @@
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
+ errorColor: string;
41
+ warningColor: string;
42
+ successColor: string;
43
+ drawerBackgroundColor: string;
44
+ }
45
+
46
+ interface IFontFamily {
47
+ name: string;
48
+ weights: number[];
49
+ }
50
+ ```
51
+
52
+ **Example:**
53
+ ```javascript
54
+ customTheme: {
55
+ global: {
56
+ theme: {
57
+ buttonCornerRadius: '8px',
58
+ cardCornerRadius: '12px',
59
+ headingFont: {
60
+ name: 'Inter',
61
+ weights: [600, 700]
62
+ },
63
+ paragraphFont: {
64
+ name: 'Inter',
65
+ weights: [400, 500]
66
+ },
67
+ primaryColor: '#007bff',
68
+ accentColor: '#6c757d',
69
+ defaultTextColor: '#212529',
70
+ selectedTextColor: '#ffffff',
71
+ errorColor: '#dc3545',
72
+ warningColor: '#ffc107',
73
+ successColor: '#28a745',
74
+ drawerBackgroundColor: '#ffffff'
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### Global Layout
81
+
82
+ ```typescript
83
+ interface IGlobalLayout {
84
+ enablePersonalization: boolean;
85
+ personalizationText: string;
86
+ personalizationCardStyle: 'outlined' | 'filled';
87
+ allowPromoCodes: boolean;
88
+ inputFieldStyle: 'outlined' | 'filled';
89
+ showPoweredBy: boolean; // ⚠️ READ-ONLY: Cannot be customized (paid feature)
90
+ poweredByMode: 'light' | 'dark'; // Can be customized
91
+ }
92
+ ```
93
+
94
+ **⚠️ 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).
95
+
96
+ **Example:**
97
+ ```javascript
98
+ customTheme: {
99
+ global: {
100
+ layout: {
101
+ enablePersonalization: true,
102
+ personalizationText: 'Personalize your product',
103
+ personalizationCardStyle: 'outlined',
104
+ allowPromoCodes: true,
105
+ inputFieldStyle: 'filled',
106
+ poweredByMode: 'dark' // Can be customized (light or dark)
107
+ // Note: showPoweredBy is read-only and cannot be customized here
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ ### Personalization (Engraving) Configuration
114
+
115
+ The personalization feature is controlled globally and affects how engraving appears across all contexts (product, cart, and checkout).
116
+
117
+ **Configuration Options:**
118
+
119
+ - **`enablePersonalization`** (boolean): Master switch to enable/disable personalization feature globally. When `false`, engraving options won't appear even for engravable products.
120
+
121
+ - **`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.
122
+
123
+ - **`personalizationCardStyle`** ('outlined' | 'filled'): Controls the visual style of personalization cards displayed in cart and checkout:
124
+ - `'outlined'`: Border-based style with transparent background
125
+ - `'filled'`: Filled background style
126
+
127
+ **Context-Specific Behavior:**
128
+
129
+ The SDK intelligently displays personalization differently based on context:
130
+
131
+ 1. **Product View:** Shows button with `personalizationText` and engraving fee (e.g., "Personalize your product +$5.00")
132
+
133
+ 2. **Cart View:** Displays engraving details in a card with edit/remove buttons using the `personalizationCardStyle`
134
+
135
+ 3. **Checkout View:** Shows engraving details in a card (read-only) with only remove button using the `personalizationCardStyle`
136
+
137
+ **Example Configurations:**
138
+
139
+ ```javascript
140
+ // Minimal personalization (use defaults)
141
+ customTheme: {
142
+ global: {
143
+ layout: {
144
+ enablePersonalization: true
145
+ }
146
+ }
147
+ }
148
+
149
+ // Custom personalization styling
150
+ customTheme: {
151
+ global: {
152
+ layout: {
153
+ enablePersonalization: true,
154
+ personalizationText: 'Make it yours',
155
+ personalizationCardStyle: 'filled'
156
+ }
157
+ }
158
+ }
159
+
160
+ // Disable personalization globally
161
+ customTheme: {
162
+ global: {
163
+ layout: {
164
+ enablePersonalization: false
165
+ }
166
+ }
167
+ }
168
+ ```
169
+
170
+ **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.
171
+
172
+ ## Product Component
173
+
174
+ ```typescript
175
+ interface IProductComponent {
176
+ theme: {
177
+ backgroundColor: string;
178
+ };
179
+ layout: {
180
+ showImages: boolean;
181
+ showTitle: boolean;
182
+ showDescription: boolean;
183
+ showQuantityCounter: boolean;
184
+ showOffHours: boolean;
185
+ quantityCounterStyle: 'outlined' | 'ghost';
186
+ fulfillmentDisplay: 'carousel' | 'popup';
187
+ enableShippingFulfillment: boolean;
188
+ enableOnDemandFulfillment: boolean;
189
+ addToCartButtonText: string;
190
+ addToCartButtonShowTotalPrice: boolean;
191
+ buyNowButtonText: string;
192
+ preSaleButtonText: string;
193
+ };
194
+ }
195
+ ```
196
+
197
+ **Example:**
198
+ ```javascript
199
+ customTheme: {
200
+ product: {
201
+ theme: {
202
+ backgroundColor: '#ffffff'
203
+ },
204
+ layout: {
205
+ showImages: true,
206
+ showTitle: true,
207
+ showDescription: true,
208
+ showQuantityCounter: true,
209
+ showOffHours: false,
210
+ quantityCounterStyle: 'outlined',
211
+ fulfillmentDisplay: 'carousel',
212
+ enableShippingFulfillment: true,
213
+ enableOnDemandFulfillment: true,
214
+ addToCartButtonText: 'Add to Cart',
215
+ addToCartButtonShowTotalPrice: true,
216
+ buyNowButtonText: 'Buy Now',
217
+ preSaleButtonText: 'Pre-Order'
218
+ }
219
+ }
220
+ }
221
+ ```
222
+
223
+ ## Cart Component
224
+
225
+ ```typescript
226
+ interface ICartComponent {
227
+ theme: {
228
+ backgroundColor: string;
229
+ };
230
+ layout: {
231
+ showQuantityCounter: boolean;
232
+ quantityCounterStyle: 'outlined' | 'ghost';
233
+ drawerHeaderText: string;
234
+ goToCheckoutButtonText: string;
235
+ };
236
+ }
237
+ ```
238
+
239
+ **Example:**
240
+ ```javascript
241
+ customTheme: {
242
+ cart: {
243
+ theme: {
244
+ backgroundColor: '#ffffff'
245
+ },
246
+ layout: {
247
+ showQuantityCounter: true,
248
+ quantityCounterStyle: 'outlined',
249
+ drawerHeaderText: 'Your Cart',
250
+ goToCheckoutButtonText: 'Proceed to Checkout'
251
+ }
252
+ }
253
+ }
254
+ ```
255
+
256
+ ## Checkout Component
257
+
258
+ ```typescript
259
+ interface ICheckoutComponent {
260
+ theme: {
261
+ backgroundColor: string;
262
+ checkoutCompleted: {
263
+ customLogo: string;
264
+ customText: string | null;
265
+ };
266
+ };
267
+ layout: {
268
+ emailOptIn: {
269
+ show: boolean;
270
+ checked: boolean;
271
+ text: string;
272
+ };
273
+ smsOptIn: {
274
+ show: boolean;
275
+ checked: boolean;
276
+ text: string;
277
+ };
278
+ allowGiftCards: boolean;
279
+ legalMessage: {
280
+ show: boolean;
281
+ text: string;
282
+ };
283
+ exitUrl: string;
284
+ thankYouButtonText: string;
285
+ drawerHeaderText: string;
286
+ placeOrderButtonText: string;
287
+ placeOrderButtonShowRequiredFields: boolean;
288
+ };
289
+ }
290
+ ```
291
+
292
+ **Example:**
293
+ ```javascript
294
+ customTheme: {
295
+ checkout: {
296
+ theme: {
297
+ backgroundColor: '#ffffff',
298
+ checkoutCompleted: {
299
+ customLogo: 'https://yourdomain.com/logo.png',
300
+ customText: 'Thank you for your order!'
301
+ }
302
+ },
303
+ layout: {
304
+ emailOptIn: {
305
+ show: true,
306
+ checked: false,
307
+ text: 'Send me marketing emails'
308
+ },
309
+ smsOptIn: {
310
+ show: true,
311
+ checked: false,
312
+ text: 'Send me SMS updates'
313
+ },
314
+ allowGiftCards: true,
315
+ legalMessage: {
316
+ show: true,
317
+ text: 'By placing this order, you agree to our terms and conditions.'
318
+ },
319
+ exitUrl: '/',
320
+ thankYouButtonText: 'Continue Shopping',
321
+ drawerHeaderText: 'Checkout',
322
+ placeOrderButtonText: 'Place Order',
323
+ placeOrderButtonShowRequiredFields: true
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
+ errorColor: '#dc3545',
373
+ warningColor: '#ffc107',
374
+ successColor: '#28a745',
375
+ drawerBackgroundColor: '#ffffff'
376
+ },
377
+ layout: {
378
+ enablePersonalization: true,
379
+ personalizationText: 'Make it yours',
380
+ personalizationCardStyle: 'outlined',
381
+ allowPromoCodes: true,
382
+ inputFieldStyle: 'filled',
383
+ poweredByMode: 'light'
384
+ }
385
+ },
386
+ product: {
387
+ theme: {
388
+ backgroundColor: '#ffffff'
389
+ },
390
+ layout: {
391
+ showImages: true,
392
+ showTitle: true,
393
+ showDescription: true,
394
+ showQuantityCounter: true,
395
+ showOffHours: false,
396
+ quantityCounterStyle: 'outlined',
397
+ fulfillmentDisplay: 'carousel',
398
+ enableShippingFulfillment: true,
399
+ enableOnDemandFulfillment: true,
400
+ addToCartButtonText: 'Add to Cart',
401
+ addToCartButtonShowTotalPrice: true,
402
+ buyNowButtonText: 'Buy Now',
403
+ preSaleButtonText: 'Pre-Order'
404
+ }
405
+ },
406
+ cart: {
407
+ theme: {
408
+ backgroundColor: '#ffffff'
409
+ },
410
+ layout: {
411
+ showQuantityCounter: true,
412
+ quantityCounterStyle: 'outlined',
413
+ drawerHeaderText: 'Your Cart',
414
+ goToCheckoutButtonText: 'Checkout'
415
+ }
416
+ },
417
+ checkout: {
418
+ theme: {
419
+ backgroundColor: '#ffffff',
420
+ checkoutCompleted: {
421
+ customLogo: 'https://yourdomain.com/logo.png',
422
+ customText: null
423
+ }
424
+ },
425
+ layout: {
426
+ emailOptIn: {
427
+ show: true,
428
+ checked: false,
429
+ text: 'Email me with news and offers'
430
+ },
431
+ smsOptIn: {
432
+ show: true,
433
+ checked: false,
434
+ text: 'Text me with updates'
435
+ },
436
+ allowGiftCards: true,
437
+ legalMessage: {
438
+ show: false,
439
+ text: ''
440
+ },
441
+ exitUrl: '/',
442
+ thankYouButtonText: 'Continue Shopping',
443
+ drawerHeaderText: 'Checkout',
444
+ placeOrderButtonText: 'Place Order',
445
+ placeOrderButtonShowRequiredFields: true
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