@liquidcommerce/elements-sdk 2.2.0-beta.3 → 2.2.0-beta.31

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 (69) hide show
  1. package/README.md +1681 -568
  2. package/dist/index.esm.js +10716 -8124
  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 +16 -13
  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/cart.interface.d.ts +1 -0
  16. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +46 -6
  17. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -3
  18. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +43 -6
  19. package/dist/types/core/store/interfaces/cart.interface.d.ts +1 -1
  20. package/dist/types/core/store/interfaces/checkout.interface.d.ts +0 -1
  21. package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
  22. package/dist/types/core/store/interfaces/product.interface.d.ts +18 -7
  23. package/dist/types/core/store/store.service.d.ts +1 -0
  24. package/dist/types/core/telemetry/telemetry.interface.d.ts +80 -0
  25. package/dist/types/core/telemetry/telemetry.service.d.ts +27 -0
  26. package/dist/types/elements-client-helper.d.ts +3 -0
  27. package/dist/types/enums/core.enum.d.ts +0 -1
  28. package/dist/types/enums/debug.enum.d.ts +6 -0
  29. package/dist/types/enums/index.d.ts +1 -0
  30. package/dist/types/interfaces/cloud/product.interface.d.ts +2 -0
  31. package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
  32. package/dist/types/interfaces/core.interface.d.ts +17 -11
  33. package/dist/types/modules/address/address.command.d.ts +1 -3
  34. package/dist/types/modules/cart/cart.commands.d.ts +1 -1
  35. package/dist/types/modules/cart/cart.component.d.ts +1 -2
  36. package/dist/types/modules/cart/components/cart-footer.component.d.ts +1 -0
  37. package/dist/types/modules/cart/components/cart-item.component.d.ts +2 -6
  38. package/dist/types/modules/checkout/checkout.commands.d.ts +3 -2
  39. package/dist/types/modules/checkout/checkout.component.d.ts +1 -2
  40. package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +2 -0
  41. package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +1 -1
  42. package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +0 -2
  43. package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +2 -1
  44. package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +1 -0
  45. package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +0 -1
  46. package/dist/types/modules/checkout/constant.d.ts +0 -1
  47. package/dist/types/modules/product/components/index.d.ts +1 -0
  48. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  49. package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
  50. package/dist/types/modules/product/components/product-price.component.d.ts +1 -0
  51. package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
  52. package/dist/types/modules/product/product.commands.d.ts +1 -1
  53. package/dist/types/modules/theme-provider/services/font-manager.service.d.ts +1 -0
  54. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -11
  55. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -9
  56. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -0
  57. package/dist/types/static/icon/index.d.ts +0 -1
  58. package/dist/types/utils/format.d.ts +2 -1
  59. package/docs/ACTIONS.md +1273 -0
  60. package/docs/BROWSER_SUPPORT.md +279 -0
  61. package/docs/CONFIGURATION.md +613 -0
  62. package/docs/DOCUMENTATION_INDEX.md +311 -0
  63. package/docs/EVENTS.md +765 -0
  64. package/docs/PROXY.md +228 -0
  65. package/docs/THEMING.md +592 -0
  66. package/docs/TROUBLESHOOTING.md +772 -0
  67. package/package.json +17 -17
  68. package/umd/elements.js +1 -1
  69. package/dist/types/static/icon/completed.icon.d.ts +0 -2
@@ -0,0 +1,772 @@
1
+ # Troubleshooting Guide
2
+
3
+ Common issues and solutions for the LiquidCommerce Elements SDK.
4
+
5
+ ## SDK Initialization Issues
6
+
7
+ ### SDK Not Loading
8
+
9
+ **Symptom:** `Elements is not defined` or SDK not initializing
10
+
11
+ **Causes & Solutions:**
12
+
13
+ #### 1. Script Not Loaded
14
+
15
+ ```html
16
+ <!-- ❌ Wrong -->
17
+ <script src="https://assets-elements.liquidcommerce.us/all/elements.js" async></script>
18
+
19
+ <!-- ✅ Correct - Remove async or use onload -->
20
+ <script src="https://assets-elements.liquidcommerce.us/all/elements.js"></script>
21
+
22
+ <!-- Or with async -->
23
+ <script src="https://assets-elements.liquidcommerce.us/all/elements.js" async onload="initSDK()"></script>
24
+ ```
25
+
26
+ #### 2. Content Security Policy (CSP)
27
+
28
+ ```html
29
+ <!-- Add to your CSP -->
30
+ <meta http-equiv="Content-Security-Policy"
31
+ content="script-src 'self' https://assets-elements.liquidcommerce.us;">
32
+ ```
33
+
34
+ #### 3. Ad Blockers
35
+
36
+ **Solution:** Configure a [proxy](./PROXY.md) to route requests through your domain.
37
+
38
+ ### Authentication Failures
39
+
40
+ **Symptom:** `401 Unauthorized` or `Invalid API key`
41
+
42
+ **Solutions:**
43
+
44
+ ```javascript
45
+ // ✅ Check API key is correct
46
+ const client = await Elements('YOUR_ACTUAL_API_KEY', {
47
+ env: 'production' // Make sure env matches your key
48
+ });
49
+
50
+ // ✅ Verify environment
51
+ // Production keys won't work in development env
52
+ const client = await Elements('PROD_KEY', {
53
+ env: 'production' // Not 'development'
54
+ });
55
+ ```
56
+
57
+ **Check:**
58
+ - API key is correct
59
+ - Environment matches key (prod key → prod env)
60
+ - Key hasn't been revoked
61
+ - Domain is whitelisted in LiquidCommerce dashboard
62
+
63
+ ### Configuration Errors
64
+
65
+ **Symptom:** `Invalid configuration` errors
66
+
67
+ **Common mistakes:**
68
+
69
+ ```javascript
70
+ // ❌ Wrong - Invalid env value
71
+ { env: 'prod' } // Should be 'production'
72
+
73
+ // ❌ Wrong - Invalid debugMode
74
+ { debugMode: 'debug' } // Should be 'console' or 'panel'
75
+
76
+ // ❌ Wrong - Invalid proxy config
77
+ { proxy: 'https://...' } // Should be object with baseUrl
78
+
79
+ // ✅ Correct
80
+ {
81
+ env: 'production',
82
+ debugMode: 'none',
83
+ proxy: {
84
+ baseUrl: 'https://...'
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## Component Rendering Issues
90
+
91
+ ### Components Not Appearing
92
+
93
+ **Symptom:** Container div is empty
94
+
95
+ **Debugging steps:**
96
+
97
+ ```javascript
98
+ // 1. Check container exists
99
+ const container = document.getElementById('product-container');
100
+ console.log('Container:', container); // Should not be null
101
+
102
+ // 2. Wait for DOM
103
+ window.addEventListener('DOMContentLoaded', async () => {
104
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
105
+ const components = await client.injectProductElement([
106
+ { containerId: 'product-container', identifier: 'product-123' }
107
+ ]);
108
+
109
+ // Check if injection was successful
110
+ if (components.length > 0) {
111
+ console.log('Product component injected successfully');
112
+ // components[0].rerender() - Rerender if needed
113
+ // components[0].getElement() - Get container element
114
+ // components[0].getType() - Get component type
115
+ } else {
116
+ console.log('Product injection failed');
117
+ }
118
+
119
+ // Debug: Check all injected components
120
+ const allComponents = client.getInjectedComponents();
121
+ console.log('All injected components:', allComponents);
122
+ allComponents.forEach((component, containerId) => {
123
+ console.log(`Container: ${containerId}, Type: ${component.getType()}`);
124
+ });
125
+ });
126
+
127
+ // 3. Monitor product loading
128
+ window.addEventListener('lce:actions.product_loaded', (event) => {
129
+ console.log('Product loaded:', event.detail.data);
130
+ });
131
+ ```
132
+
133
+ **Common issues:**
134
+ - Container doesn't exist when SDK tries to inject
135
+ - Product identifier is invalid
136
+ - Product not available in current environment
137
+
138
+ ### Styling Issues
139
+
140
+ **Symptom:** Components look broken or unstyled
141
+
142
+ **Solutions:**
143
+
144
+ ```javascript
145
+ // 1. Check for CSS conflicts
146
+ // Look for these in your CSS:
147
+ // - * { all: unset }
148
+ // - Overly broad selectors affecting [data-lce-*]
149
+
150
+ // 2. Verify theme config
151
+ const client = await Elements('YOUR_API_KEY', {
152
+ customTheme: {
153
+ global: {
154
+ colors: {
155
+ primary: '#007bff' // Valid hex color
156
+ }
157
+ }
158
+ }
159
+ });
160
+
161
+ // 3. Check z-index conflicts
162
+ // SDK uses z-index 1000-1070 for modals/drawers
163
+ ```
164
+
165
+ ### Layout Issues
166
+
167
+ **Symptom:** Components overlapping or misaligned
168
+
169
+ **Solutions:**
170
+
171
+ ```css
172
+ /* Ensure container has proper display */
173
+ #product-container {
174
+ display: block;
175
+ width: 100%;
176
+ min-height: 400px; /* Prevent collapsing */
177
+ }
178
+
179
+ /* Fix flexbox/grid conflicts */
180
+ #product-container > * {
181
+ flex: initial;
182
+ grid-column: initial;
183
+ }
184
+ ```
185
+
186
+ ## Event Handling Issues
187
+
188
+ ### Events Not Firing
189
+
190
+ **Symptom:** Event listeners not being called
191
+
192
+ **Solutions:**
193
+
194
+ ```javascript
195
+ // ✅ Correct - Set up listener BEFORE action
196
+ window.addEventListener('lce:actions.cart_updated', handleUpdate);
197
+ await client.actions.cart.addProduct([...]);
198
+
199
+ // ❌ Wrong - Listener after action (might miss event)
200
+ await client.actions.cart.addProduct([...]);
201
+ window.addEventListener('lce:actions.cart_updated', handleUpdate);
202
+
203
+ // ✅ Use capture phase for guaranteed delivery
204
+ window.addEventListener('lce:actions.cart_updated', handleUpdate, true);
205
+ ```
206
+
207
+ ### Event Data Missing
208
+
209
+ **Symptom:** `event.detail.data` is undefined
210
+
211
+ **Check:**
212
+
213
+ ```javascript
214
+ window.addEventListener('lce:actions.cart_updated', (event) => {
215
+ // ❌ Wrong
216
+ const data = event.data;
217
+
218
+ // ✅ Correct
219
+ const data = event.detail.data;
220
+
221
+ console.log('Cart data:', data);
222
+ });
223
+ ```
224
+
225
+ ### Multiple Event Firings
226
+
227
+ **Symptom:** Event listener called multiple times unexpectedly
228
+
229
+ **Solution:**
230
+
231
+ ```javascript
232
+ // ❌ Problem - Adding listener multiple times
233
+ function setupListeners() {
234
+ window.addEventListener('lce:actions.cart_updated', handleUpdate);
235
+ }
236
+
237
+ // ✅ Solution - Remove before adding
238
+ function setupListeners() {
239
+ window.removeEventListener('lce:actions.cart_updated', handleUpdate);
240
+ window.addEventListener('lce:actions.cart_updated', handleUpdate);
241
+ }
242
+
243
+ // Or use once option
244
+ window.addEventListener('lce:actions.cart_updated', handleUpdate, { once: true });
245
+ ```
246
+
247
+ ## Cart & Checkout Issues
248
+
249
+ ### Cart Not Persisting
250
+
251
+ **Symptom:** Cart clears on page reload
252
+
253
+ **Causes:**
254
+
255
+ ```javascript
256
+ // 1. LocalStorage disabled
257
+ if (!('localStorage' in window)) {
258
+ console.error('LocalStorage not available');
259
+ }
260
+
261
+ // 2. Private/Incognito mode
262
+ // LocalStorage is disabled in private browsing
263
+
264
+ // 3. Storage quota exceeded
265
+ try {
266
+ localStorage.setItem('test', 'test');
267
+ } catch (e) {
268
+ console.error('Storage error:', e);
269
+ }
270
+ ```
271
+
272
+ **Solutions:**
273
+ - Ask users to enable cookies/storage
274
+ - Warn users about private mode limitations
275
+ - Clear old localStorage data
276
+
277
+ ### Checkout Failing
278
+
279
+ **Symptom:** Checkout submit errors
280
+
281
+ **Common causes:**
282
+
283
+ ```javascript
284
+ // Listen for specific errors
285
+ window.addEventListener('lce:actions.checkout_submit_failed', (event) => {
286
+ const { error, reason } = event.detail.data;
287
+
288
+ if (reason.includes('payment')) {
289
+ // Payment declined
290
+ showPaymentError();
291
+ } else if (reason.includes('inventory')) {
292
+ // Out of stock
293
+ showInventoryError();
294
+ } else if (reason.includes('address')) {
295
+ // Invalid address
296
+ showAddressError();
297
+ }
298
+ });
299
+ ```
300
+
301
+ **Debug steps:**
302
+ 1. Check address is set: `client.actions.address.getDetails()`
303
+ 2. Check cart has items: `client.actions.cart.getDetails()`
304
+ 3. Verify payment info is complete
305
+ 4. Check for form validation errors
306
+ 5. Look for network errors in console
307
+
308
+ ### Promo Code Issues
309
+
310
+ **Symptom:** Promo codes not applying
311
+
312
+ **Debug:**
313
+
314
+ ```javascript
315
+ // Listen for promo failures
316
+ window.addEventListener('lce:actions.cart_promo_code_failed', (event) => {
317
+ const { error } = event.detail.data;
318
+ console.error('Promo failed:', error);
319
+
320
+ // Common errors:
321
+ // - "Promo code expired"
322
+ // - "Cart minimum not met"
323
+ // - "Promo code invalid"
324
+ // - "Promo already applied"
325
+ });
326
+
327
+ // Verify promo is active
328
+ // Check LiquidCommerce dashboard for promo settings
329
+ ```
330
+
331
+ ## Address Validation Issues
332
+
333
+ ### Google Places Not Working
334
+
335
+ **Symptom:** Address autocomplete not appearing
336
+
337
+ **Causes:**
338
+
339
+ ```javascript
340
+ // 1. Google Places API key missing/invalid
341
+ // Check browser console for Google API errors
342
+
343
+ // 2. Domain not authorized
344
+ // Add your domain to Google Cloud Console
345
+
346
+ // 3. API not enabled
347
+ // Enable Places API in Google Cloud Console
348
+ ```
349
+
350
+ ### Manual Address Issues
351
+
352
+ **Symptom:** Manual address not working
353
+
354
+ **Solutions:**
355
+
356
+ ```javascript
357
+ // Ensure coordinates are valid
358
+ const isValidLat = lat >= -90 && lat <= 90;
359
+ const isValidLng = lng >= -180 && lng <= 180;
360
+
361
+ if (!isValidLat || !isValidLng) {
362
+ console.error('Invalid coordinates');
363
+ }
364
+
365
+ // Use proper format
366
+ await client.actions.address.setAddressManually(
367
+ {
368
+ one: '123 Main St',
369
+ two: 'Apt 4B', // Optional but must be string
370
+ city: 'New York',
371
+ state: 'NY',
372
+ zip: '10001',
373
+ country: 'United States'
374
+ },
375
+ {
376
+ lat: 40.7505045,
377
+ long: -73.9934387 // Note: "long" not "lng"
378
+ }
379
+ );
380
+ ```
381
+
382
+ ## Network & API Issues
383
+
384
+ ### CORS Errors
385
+
386
+ **Symptom:** `Access-Control-Allow-Origin` errors
387
+
388
+ **Solutions:**
389
+
390
+ ```javascript
391
+ // 1. Use proxy to avoid CORS
392
+ const client = await Elements('YOUR_API_KEY', {
393
+ proxy: {
394
+ baseUrl: 'https://yourdomain.com/api/liquidcommerce'
395
+ }
396
+ });
397
+
398
+ // 2. Check domain whitelist
399
+ // Verify your domain is whitelisted in LiquidCommerce dashboard
400
+
401
+ // 3. Development workaround
402
+ // Use browser extension to disable CORS (dev only!)
403
+ ```
404
+
405
+ ### Slow API Responses
406
+
407
+ **Symptom:** Components take long to load
408
+
409
+ **Debug:**
410
+
411
+ ```javascript
412
+ // 1. Enable debug mode
413
+ const client = await Elements('YOUR_API_KEY', {
414
+ debugMode: 'console'
415
+ });
416
+
417
+ // 2. Check network tab
418
+ // Look for slow API calls
419
+
420
+ // 3. Monitor for failures
421
+ window.addEventListener('lce:actions.cart_failed', (event) => {
422
+ console.warn('Cart operation failed:', event.detail);
423
+ });
424
+ ```
425
+
426
+ **Solutions:**
427
+ - Configure proxy for better routing
428
+ - Check internet connection
429
+ - Verify API status (LiquidCommerce status page)
430
+ - Use CDN for SDK script (automatic caching)
431
+
432
+ ### API Rate Limiting
433
+
434
+ **Symptom:** `429 Too Many Requests`
435
+
436
+ **Solutions:**
437
+
438
+ ```javascript
439
+ // Implement retry logic
440
+ async function addToCartWithRetry(params, maxRetries = 3) {
441
+ for (let i = 0; i < maxRetries; i++) {
442
+ try {
443
+ await client.actions.cart.addProduct(params);
444
+ return;
445
+ } catch (error) {
446
+ if (error.status === 429) {
447
+ // Wait before retry
448
+ await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
449
+ } else {
450
+ throw error;
451
+ }
452
+ }
453
+ }
454
+ }
455
+ ```
456
+
457
+ ## Performance Issues
458
+
459
+ ### Slow Page Load
460
+
461
+ **Symptom:** SDK slows down page load
462
+
463
+ **Solutions:**
464
+
465
+ ```html
466
+ <!-- 1. Use defer attribute -->
467
+ <script defer src="https://assets-elements.liquidcommerce.us/all/elements.js"></script>
468
+
469
+ <!-- 2. Load at end of body -->
470
+ <body>
471
+ <!-- Page content -->
472
+ <script src="https://assets-elements.liquidcommerce.us/all/elements.js"></script>
473
+ </body>
474
+
475
+ <!-- 3. Lazy load components -->
476
+ <script>
477
+ window.addEventListener('load', async () => {
478
+ const client = await Elements('YOUR_API_KEY', { env: 'production' });
479
+ // Initialize after page load
480
+ });
481
+ </script>
482
+ ```
483
+
484
+ ### Memory Leaks
485
+
486
+ **Symptom:** Page becomes slow over time
487
+
488
+ **Solutions:**
489
+
490
+ ```javascript
491
+ // Remove event listeners when done
492
+ function cleanup() {
493
+ window.removeEventListener('lce:actions.cart_updated', handleUpdate);
494
+ window.removeEventListener('lce:actions.product_loaded', handleProduct);
495
+ }
496
+
497
+ // In React/Vue
498
+ useEffect(() => {
499
+ window.addEventListener('lce:actions.cart_updated', handleUpdate);
500
+
501
+ return () => {
502
+ window.removeEventListener('lce:actions.cart_updated', handleUpdate);
503
+ };
504
+ }, []);
505
+ ```
506
+
507
+ ### High CPU Usage
508
+
509
+ **Symptom:** Browser tab using excessive CPU
510
+
511
+ **Check:**
512
+
513
+ ```javascript
514
+ // 1. Disable debug mode in production
515
+ {
516
+ debugMode: 'none' // Not 'panel'
517
+ }
518
+
519
+ // 2. Minimize theme complexity
520
+ {
521
+ customTheme: {
522
+ global: {
523
+ colors: {
524
+ primary: '#007bff' // Only override what's needed
525
+ }
526
+ }
527
+ }
528
+ }
529
+
530
+ // 3. Reduce event listeners
531
+ // Use event delegation instead of many listeners
532
+ ```
533
+
534
+ ## Mobile-Specific Issues
535
+
536
+ ### Touch Events Not Working
537
+
538
+ **Symptom:** Buttons/interactions not responding on mobile
539
+
540
+ **Check:**
541
+
542
+ ```css
543
+ /* Ensure touch targets are large enough */
544
+ button {
545
+ min-height: 44px; /* iOS minimum */
546
+ min-width: 44px;
547
+ }
548
+
549
+ /* Fix iOS double-tap zoom */
550
+ button {
551
+ touch-action: manipulation;
552
+ }
553
+ ```
554
+
555
+ ### Viewport Issues
556
+
557
+ **Symptom:** Components too small or zoomed on mobile
558
+
559
+ **Solution:**
560
+
561
+ ```html
562
+ <!-- Ensure viewport meta tag is present -->
563
+ <meta name="viewport" content="width=device-width, initial-scale=1">
564
+ ```
565
+
566
+ ### Keyboard Covering Input
567
+
568
+ **Symptom:** Keyboard covers form fields on mobile
569
+
570
+ **Solution:**
571
+
572
+ ```javascript
573
+ // SDK handles this automatically, but if issues persist:
574
+ document.addEventListener('focusin', (e) => {
575
+ if (e.target.tagName === 'INPUT') {
576
+ setTimeout(() => {
577
+ e.target.scrollIntoView({ behavior: 'smooth', block: 'center' });
578
+ }, 300);
579
+ }
580
+ });
581
+ ```
582
+
583
+ ## Framework-Specific Issues
584
+
585
+ ### React Issues
586
+
587
+ **Problem:** SDK initializes multiple times
588
+
589
+ **Solution:**
590
+
591
+ ```jsx
592
+ import { useEffect, useRef } from 'react';
593
+
594
+ function App() {
595
+ const clientRef = useRef(null);
596
+
597
+ useEffect(() => {
598
+ async function init() {
599
+ if (!clientRef.current) {
600
+ clientRef.current = await Elements('YOUR_API_KEY', { env: 'production' });
601
+ }
602
+ }
603
+ init();
604
+ }, []); // Empty deps - initialize once
605
+
606
+ return <div id="product-container"></div>;
607
+ }
608
+ ```
609
+
610
+ ### Next.js Issues
611
+
612
+ **Problem:** `window is not defined` (SSR)
613
+
614
+ **Solution:**
615
+
616
+ ```javascript
617
+ // pages/product.js
618
+ import { useEffect } from 'react';
619
+
620
+ export default function Product() {
621
+ useEffect(() => {
622
+ // Only run on client
623
+ async function init() {
624
+ if (typeof window !== 'undefined') {
625
+ const { Elements } = await import('@liquidcommerce/elements-sdk');
626
+ const client = await Elements(process.env.NEXT_PUBLIC_LCE_API_KEY, {
627
+ env: 'production'
628
+ });
629
+ }
630
+ }
631
+ init();
632
+ }, []);
633
+
634
+ return <div id="product-container"></div>;
635
+ }
636
+ ```
637
+
638
+ ### Vue Issues
639
+
640
+ **Problem:** Components not reactive
641
+
642
+ **Solution:**
643
+
644
+ ```vue
645
+ <script setup>
646
+ import { onMounted, ref } from 'vue';
647
+
648
+ const cartData = ref(null);
649
+
650
+ onMounted(async () => {
651
+ const client = await Elements(import.meta.env.VITE_LCE_API_KEY, {
652
+ env: 'production'
653
+ });
654
+
655
+ window.addEventListener('lce:actions.cart_updated', (event) => {
656
+ cartData.value = event.detail.data.current; // Vue reactivity
657
+ });
658
+ });
659
+ </script>
660
+ ```
661
+
662
+ ## Browser-Specific Issues
663
+
664
+ ### Safari Issues
665
+
666
+ **Problem:** LocalStorage quota exceeded
667
+
668
+ **Solution:**
669
+
670
+ ```javascript
671
+ try {
672
+ localStorage.setItem('lce_cart', JSON.stringify(cart));
673
+ } catch (e) {
674
+ if (e.name === 'QuotaExceededError') {
675
+ // Clear old data
676
+ localStorage.removeItem('lce_old_cart');
677
+ // Retry
678
+ localStorage.setItem('lce_cart', JSON.stringify(cart));
679
+ }
680
+ }
681
+ ```
682
+
683
+ ### Firefox Issues
684
+
685
+ **Problem:** Different rendering/layout
686
+
687
+ **Solution:**
688
+
689
+ ```css
690
+ /* Add Firefox-specific fixes if needed */
691
+ @-moz-document url-prefix() {
692
+ .lce-component {
693
+ /* Firefox-specific styles */
694
+ }
695
+ }
696
+ ```
697
+
698
+ ## Debugging Tools
699
+
700
+ ### Enable Debug Mode
701
+
702
+ ```javascript
703
+ const client = await Elements('YOUR_API_KEY', {
704
+ debugMode: 'panel' // Shows visual debug panel
705
+ });
706
+ ```
707
+
708
+ ### Check SDK State
709
+
710
+ ```javascript
711
+ // Get current state
712
+ const cart = await client.actions.cart.getDetails();
713
+ const address = await client.actions.address.getDetails();
714
+ const checkout = await client.actions.checkout.getDetails();
715
+
716
+ console.log('Cart:', cart);
717
+ console.log('Address:', address);
718
+ console.log('Checkout:', checkout);
719
+ ```
720
+
721
+ ### Monitor All Events
722
+
723
+ ```javascript
724
+ // Log all SDK events
725
+ window.elements.onAllActions((data, metadata) => {
726
+ console.log('Action:', metadata.eventName, data);
727
+ });
728
+
729
+ window.elements.onAllForms((data, metadata) => {
730
+ console.log('Form:', metadata.eventName, data);
731
+ });
732
+ ```
733
+
734
+ ### Network Inspection
735
+
736
+ ```javascript
737
+ // Monitor cart operations
738
+ window.addEventListener('lce:actions.cart_loaded', (event) => {
739
+ console.log('Cart loaded:', event.detail.data);
740
+ });
741
+
742
+ window.addEventListener('lce:actions.cart_failed', (event) => {
743
+ console.error('Cart operation failed:', event.detail.data);
744
+ });
745
+ ```
746
+
747
+ ## Getting Help
748
+
749
+ If you're still experiencing issues:
750
+
751
+ 1. **Check the console** for error messages
752
+ 2. **Enable debug mode** to see detailed logs
753
+ 3. **Check network tab** for failed requests
754
+ 4. **Verify configuration** matches documentation
755
+ 5. **Test in incognito mode** to rule out extensions
756
+ 6. **Try a different browser** to isolate browser-specific issues
757
+ 7. **Check LiquidCommerce status page** for API issues
758
+ 8. **Contact support** with:
759
+ - SDK version
760
+ - Browser and OS
761
+ - Console errors
762
+ - Steps to reproduce
763
+ - Minimal code example
764
+
765
+ ## Related Documentation
766
+
767
+ - [Configuration Reference](./CONFIGURATION.md) - Configuration options
768
+ - [Actions Reference](./ACTIONS.md) - Programmatic control
769
+ - [Events Reference](./EVENTS.md) - Event system
770
+ - [Browser Support](./BROWSER_SUPPORT.md) - Browser compatibility
771
+ - [Proxy Setup](./PROXY.md) - Proxy configuration
772
+