@liquidcommerce/elements-sdk 2.6.0-beta.40 → 2.6.0-beta.42

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 (68) hide show
  1. package/README.md +79 -171
  2. package/dist/index.checkout.esm.js +6814 -6806
  3. package/dist/index.esm.js +10596 -10567
  4. package/dist/types/auto-initialize/shared-utils.d.ts +5 -0
  5. package/dist/types/core/base-component.service.d.ts +2 -1
  6. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +1 -0
  7. package/dist/types/interfaces/core.interface.d.ts +5 -4
  8. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  9. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  10. package/dist/types/utils/dom-compat.d.ts +2 -0
  11. package/docs/gitbook/actions.md +964 -0
  12. package/docs/gitbook/address.md +48 -0
  13. package/docs/gitbook/cart.md +65 -0
  14. package/docs/gitbook/checkout.md +131 -0
  15. package/docs/gitbook/events.md +1765 -0
  16. package/docs/gitbook/overview.md +166 -0
  17. package/docs/gitbook/product.md +64 -0
  18. package/docs/gitbook/quick-start-guide.md +393 -0
  19. package/docs/v1/README.md +210 -0
  20. package/docs/v1/api/actions/address-actions.md +281 -0
  21. package/docs/v1/api/actions/cart-actions.md +337 -0
  22. package/docs/v1/api/actions/checkout-actions.md +387 -0
  23. package/docs/v1/api/actions/product-actions.md +115 -0
  24. package/docs/v1/api/client.md +482 -0
  25. package/docs/v1/api/configuration.md +1 -0
  26. package/docs/v1/api/injection-methods.md +247 -0
  27. package/docs/v1/api/typescript-types.md +1 -0
  28. package/docs/v1/api/ui-helpers.md +200 -0
  29. package/docs/v1/examples/advanced-patterns.md +96 -0
  30. package/docs/v1/examples/checkout-flow.md +91 -0
  31. package/docs/v1/examples/custom-theming.md +63 -0
  32. package/docs/v1/examples/multi-product-page.md +90 -0
  33. package/docs/v1/examples/simple-product-page.md +89 -0
  34. package/docs/v1/getting-started/concepts.md +507 -0
  35. package/docs/v1/getting-started/installation.md +328 -0
  36. package/docs/v1/getting-started/quick-start.md +405 -0
  37. package/docs/v1/guides/address-component.md +431 -0
  38. package/docs/v1/guides/best-practices.md +324 -0
  39. package/docs/v1/guides/cart-component.md +737 -0
  40. package/docs/v1/guides/checkout-component.md +672 -0
  41. package/docs/v1/guides/events.md +926 -0
  42. package/docs/v1/guides/product-component.md +686 -0
  43. package/docs/v1/guides/product-list-component.md +598 -0
  44. package/docs/v1/guides/theming.md +216 -0
  45. package/docs/v1/integration/angular.md +39 -0
  46. package/docs/v1/integration/laravel.md +41 -0
  47. package/docs/v1/integration/nextjs.md +60 -0
  48. package/docs/v1/integration/proxy-setup.md +89 -0
  49. package/docs/v1/integration/react.md +64 -0
  50. package/docs/v1/integration/vanilla-js.md +84 -0
  51. package/docs/v1/integration/vue.md +34 -0
  52. package/docs/v1/reference/browser-support.md +44 -0
  53. package/docs/v1/reference/error-handling.md +70 -0
  54. package/docs/v1/reference/performance.md +54 -0
  55. package/docs/v1/reference/troubleshooting.md +64 -0
  56. package/package.json +1 -1
  57. package/docs/actions.md +0 -320
  58. package/docs/address.md +0 -242
  59. package/docs/browser-support.md +0 -279
  60. package/docs/cart.md +0 -387
  61. package/docs/checkout.md +0 -420
  62. package/docs/configuration.md +0 -1017
  63. package/docs/events.md +0 -181
  64. package/docs/product-list.md +0 -311
  65. package/docs/product.md +0 -250
  66. package/docs/proxy.md +0 -228
  67. package/docs/theming.md +0 -682
  68. package/docs/troubleshooting.md +0 -793
package/docs/address.md DELETED
@@ -1,242 +0,0 @@
1
- # Address
2
-
3
- The address component manages the customer's delivery location. This determines which products are available, their pricing, and fulfillment options. Most implementations don't need to interact with this directly - it's built into the product component.
4
-
5
- ## Overview
6
-
7
- The address element powers location-aware shopping:
8
- - Customers enter their delivery address
9
- - The SDK fetches location-specific inventory and pricing
10
- - Fulfillment options update based on what's available in that area
11
- - The address persists across sessions for returning customers
12
-
13
- **Important:** You typically don't need to inject this component separately. The address input is embedded within the product component by default. Use standalone injection only for dedicated "enter your address" landing pages.
14
-
15
- ---
16
-
17
- ## Declarative Setup (HTML Attributes)
18
-
19
- In most cases, the address component is automatically managed within the product element. No separate configuration is required.
20
-
21
- When you inject a product element, customers can:
22
- 1. Click to enter their delivery address
23
- 2. See real-time availability and pricing for their location
24
- 3. Have their address remembered for future visits
25
-
26
- The address UI appears as part of the product component's fulfillment section.
27
-
28
- ---
29
-
30
- ## Programmatic Setup (JavaScript API)
31
-
32
- For standalone address collection (e.g., a "Check Availability" page), inject the address element directly.
33
-
34
- ### Basic Injection
35
-
36
- ```javascript
37
- const client = await Elements('YOUR_API_KEY', { env: 'production' });
38
-
39
- const component = await client.injectAddressElement('address-container');
40
- ```
41
-
42
- ### Return Value
43
-
44
- Returns `IInjectedComponent | null`:
45
-
46
- ```javascript
47
- if (component) {
48
- // Get the container element
49
- const element = component.getElement();
50
-
51
- // Get the component type
52
- const type = component.getType(); // 'address'
53
-
54
- // Force a re-render
55
- component.rerender();
56
- }
57
- ```
58
-
59
- ---
60
-
61
- ## Actions
62
-
63
- Control address state programmatically. Useful for:
64
- - Pre-filling addresses for logged-in customers
65
- - Custom address form integrations
66
- - Single-click address selection
67
-
68
- ### Set Address by Google Places ID
69
-
70
- Set the delivery location using a Google Places ID:
71
-
72
- ```javascript
73
- await window.elements.actions.address.setAddressByPlacesId('ChIJN1t_tDeuEmsRUsoyG83frY4');
74
- ```
75
-
76
- ### Set Address Manually
77
-
78
- Set the delivery location with explicit address data and coordinates:
79
-
80
- ```javascript
81
- await window.elements.actions.address.setAddressManually(
82
- {
83
- one: '123 Main St', // Street address line 1
84
- two: 'Apt 4B', // Street address line 2 (optional)
85
- city: 'New York',
86
- state: 'NY',
87
- zip: '10001',
88
- country: 'US' // Optional, defaults to US
89
- },
90
- {
91
- lat: 40.7128, // Latitude
92
- long: -74.0060 // Longitude
93
- }
94
- );
95
- ```
96
-
97
- ### Get Address Details
98
-
99
- Retrieve the currently saved address:
100
-
101
- ```javascript
102
- const address = window.elements.actions.address.getDetails();
103
-
104
- if (address) {
105
- console.log(address.formattedAddress);
106
- console.log(address.coordinates);
107
- }
108
- ```
109
-
110
- Returns `IAddressData | null`.
111
-
112
- ### Clear Address
113
-
114
- Remove the saved address. **Note:** This also clears the cart since pricing and availability are location-dependent.
115
-
116
- ```javascript
117
- await window.elements.actions.address.clear();
118
- ```
119
-
120
- ---
121
-
122
- ## Events
123
-
124
- Listen to address changes for analytics or custom UI updates.
125
-
126
- ### Subscribing to Events
127
-
128
- ```javascript
129
- window.addEventListener('lce:actions.address_updated', (event) => {
130
- const { formattedAddress, coordinates } = event.detail.data;
131
- console.log('Address set to:', formattedAddress);
132
- });
133
- ```
134
-
135
- ### Available Events
136
-
137
- | Event | Description | Key Data |
138
- |-------|-------------|----------|
139
- | `address_updated` | Location set or changed | googlePlacesId, formattedAddress, address, coordinates |
140
- | `address_cleared` | Location removed | boolean (true) |
141
- | `address_failed` | Location operation failed | error message, googlePlacesId (if applicable) |
142
-
143
- ### Example: Update Custom UI
144
-
145
- ```javascript
146
- // Update your own UI when address changes
147
- window.addEventListener('lce:actions.address_updated', (event) => {
148
- const { formattedAddress } = event.detail.data;
149
- document.querySelector('.delivery-location').textContent = formattedAddress;
150
- });
151
-
152
- // Handle address being cleared
153
- window.addEventListener('lce:actions.address_cleared', () => {
154
- document.querySelector('.delivery-location').textContent = 'Enter your address';
155
- });
156
- ```
157
-
158
- ---
159
-
160
- ## Clear Address Behavior
161
-
162
- When an address is cleared (either by the customer or programmatically), several things happen:
163
-
164
- 1. **Cart is reset** - Items are removed because pricing and availability are location-specific
165
- 2. **Local storage is cleared** - The saved address is removed
166
- 3. **Product displays update** - Products show "Enter address" prompts again
167
-
168
- This ensures customers never see stale pricing or unavailable items.
169
-
170
- ---
171
-
172
- ## Use Cases
173
-
174
- ### Pre-fill for Logged-in Customers
175
-
176
- ```javascript
177
- // When user logs in, set their saved address
178
- if (user.savedAddress) {
179
- await window.elements.actions.address.setAddressManually(
180
- {
181
- one: user.savedAddress.street,
182
- city: user.savedAddress.city,
183
- state: user.savedAddress.state,
184
- zip: user.savedAddress.zip
185
- },
186
- {
187
- lat: user.savedAddress.latitude,
188
- long: user.savedAddress.longitude
189
- }
190
- );
191
- }
192
- ```
193
-
194
- ### Custom Address Form
195
-
196
- ```javascript
197
- // Connect your own address form to the SDK
198
- document.querySelector('#address-form').addEventListener('submit', async (e) => {
199
- e.preventDefault();
200
- const formData = new FormData(e.target);
201
-
202
- // Use your geocoding service to get coordinates
203
- const coords = await geocode(formData.get('address'));
204
-
205
- await window.elements.actions.address.setAddressManually(
206
- {
207
- one: formData.get('street'),
208
- city: formData.get('city'),
209
- state: formData.get('state'),
210
- zip: formData.get('zip')
211
- },
212
- coords
213
- );
214
- });
215
- ```
216
-
217
- ---
218
-
219
- ## Customization
220
-
221
- Style the address component through theme configuration.
222
-
223
- ```javascript
224
- const client = await Elements('YOUR_API_KEY', {
225
- customTheme: {
226
- address: {
227
- // Address-specific theme options
228
- }
229
- }
230
- });
231
- ```
232
-
233
- See [theming.md](./theming.md) for available address theme options.
234
-
235
- ---
236
-
237
- ## See Also
238
-
239
- - [Product](./product.md) - The product element (includes embedded address)
240
- - [Actions Reference](./actions.md) - All available actions
241
- - [Events Reference](./events.md) - All available events
242
- - [Theming Guide](./theming.md) - Customization options
@@ -1,279 +0,0 @@
1
- # Browser Support
2
-
3
- The LiquidCommerce Elements SDK supports all modern browsers from 2018 onward.
4
-
5
- ## Minimum Supported Versions
6
-
7
- | Browser | Minimum Version | Released |
8
- |---------|----------------|----------|
9
- | Chrome | 66+ | April 2018 |
10
- | Firefox | 60+ | May 2018 |
11
- | Safari | 12+ | September 2018 |
12
- | Edge | 79+ (Chromium) | January 2020 |
13
- | Samsung Internet | 7.2+ | June 2018 |
14
-
15
- ## How We Achieve Compatibility
16
-
17
- ### Polyfills
18
-
19
- The SDK includes polyfills for the following DOM methods to ensure compatibility with older browsers:
20
-
21
- - `Element.prototype.replaceChildren` - Replace all children of an element
22
- - `Element.prototype.prepend` - Insert nodes before first child
23
- - `Element.prototype.remove` - Remove element from DOM
24
- - `Element.prototype.replaceWith` - Replace element with other nodes
25
- - `Element.prototype.before` - Insert nodes before element
26
- - `Element.prototype.after` - Insert nodes after element
27
- - `Object.fromEntries` - Create object from key-value pairs
28
-
29
- **Implementation:** `src/utils/dom-polyfills.ts`
30
-
31
- ### Transpilation
32
-
33
- The SDK is transpiled to ES2018 via Rollup and Babel, ensuring:
34
- - Modern syntax compatibility
35
- - Promise/async-await support
36
- - Arrow functions and spread operators
37
- - Template literals and destructuring
38
-
39
- **Build target:** `es2018` (configured in `rollup.config.mjs`)
40
-
41
- ## Testing Recommendations
42
-
43
- ### Required Testing
44
-
45
- Test your integration on:
46
- - ✅ Chrome (latest stable)
47
- - ✅ Firefox (latest stable)
48
- - ✅ Safari (latest stable)
49
- - ✅ Mobile Safari (iOS 12+)
50
- - ✅ Chrome for Android
51
-
52
- ### Optional Testing
53
-
54
- For broader coverage:
55
- - Samsung Internet (Android)
56
- - Edge (Chromium)
57
-
58
- ## Mobile Support
59
-
60
- The SDK is fully responsive and optimized for mobile devices:
61
- - Touch-optimized UI components
62
- - Viewport-aware layouts
63
- - Mobile payment methods (Apple Pay, Google Pay)
64
- - Native mobile browser support
65
-
66
- ## Progressive Web Apps (PWA)
67
-
68
- The SDK works seamlessly in PWAs:
69
- - Service Worker compatible
70
- - Offline state handling
71
- - LocalStorage for cart persistence
72
- - Mobile-first design
73
-
74
- ## Known Limitations
75
-
76
- ### Internet Explorer
77
-
78
- **Not supported.** Internet Explorer 11 and below are not compatible due to:
79
- - Lack of ES6+ support
80
- - Missing modern DOM APIs
81
- - Security vulnerabilities
82
-
83
- **Recommendation:** Show upgrade prompt for IE users.
84
-
85
- ### Safari < 12
86
-
87
- Safari versions before 12 have limited support:
88
- - Some polyfills may not work
89
- - Payment features may be restricted
90
- - Consider showing upgrade prompt
91
-
92
- ## Feature Detection
93
-
94
- The SDK automatically detects browser capabilities:
95
-
96
- ```javascript
97
- // Automatic feature detection
98
- if ('IntersectionObserver' in window) {
99
- // Use lazy loading
100
- } else {
101
- // Fallback: load immediately
102
- }
103
-
104
- if ('localStorage' in window) {
105
- // Persist cart data
106
- } else {
107
- // Use session-only cart
108
- }
109
- ```
110
-
111
- ## Browser-Specific Notes
112
-
113
- ### Chrome
114
-
115
- - ✅ Full feature support
116
- - ✅ Optimal performance
117
- - ✅ Payment Request API
118
-
119
- ### Firefox
120
-
121
- - ✅ Full feature support
122
- - ⚠️ Slightly different rendering
123
- - ✅ All payment methods
124
-
125
- ### Safari
126
-
127
- - ✅ Full feature support
128
- - ⚠️ Stricter CORS policies
129
- - ✅ Apple Pay integration
130
- - ⚠️ LocalStorage limits (5MB)
131
-
132
- ### Edge (Chromium)
133
-
134
- - ✅ Full feature support
135
- - ✅ Same as Chrome (Chromium-based)
136
-
137
- ### Samsung Internet
138
-
139
- - ✅ Full feature support
140
- - ✅ Android optimization
141
- - ⚠️ Custom payment flows
142
-
143
- ## Detailed Version Support by Year
144
-
145
- ## 2018
146
-
147
- ### Chrome
148
- - Chrome 64, 65, 66, 67, 68, 69, 70, 71
149
-
150
- ### Safari
151
- - Safari 11.1, 12
152
-
153
- ### Firefox
154
- - Firefox 58, 59, 60, 61, 62, 63, 64
155
-
156
- ### Samsung Internet
157
- - Samsung Internet 7.2, 7.4, 8.2
158
-
159
- ### Edge
160
- - Not supported (Edge Legacy only)
161
-
162
- ## 2019
163
-
164
- ### Chrome
165
- - Chrome 72, 73, 74, 75, 76, 77, 78, 79
166
-
167
- ### Safari
168
- - Safari 12.1, 13
169
-
170
- ### Firefox
171
- - Firefox 65, 66, 67, 68, 69, 70, 71
172
-
173
- ### Samsung Internet
174
- - Samsung Internet 9.0, 9.2, 10.1
175
-
176
- ### Edge
177
- - Not supported (Edge Legacy only)
178
-
179
- ## 2020
180
-
181
- ### Chrome
182
- - Chrome 80, 81, 83, 84, 85, 86, 87
183
-
184
- ### Safari
185
- - Safari 13.1, 14
186
-
187
- ### Firefox
188
- - Firefox 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84
189
-
190
- ### Samsung Internet
191
- - Samsung Internet 11.1, 11.2, 12.0
192
-
193
- ### Edge
194
- - Edge 79, 80, 81, 83, 84, 85, 86, 87 (Chromium-based starts)
195
-
196
- ## 2021
197
-
198
- ### Chrome
199
- - Chrome 88, 89, 90, 91, 92, 93, 94, 95, 96
200
-
201
- ### Safari
202
- - Safari 14.1, 15
203
-
204
- ### Firefox
205
- - Firefox 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
206
-
207
- ### Samsung Internet
208
- - Samsung Internet 13.0, 13.2, 14.0, 14.2
209
-
210
- ### Edge
211
- - Edge 88, 89, 90, 91, 92, 93, 94, 95, 96
212
-
213
- ## 2022
214
-
215
- ### Chrome
216
- - Chrome 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108
217
-
218
- ### Safari
219
- - Safari 15.4, 16
220
-
221
- ### Firefox
222
- - Firefox 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108
223
-
224
- ### Samsung Internet
225
- - Samsung Internet 15.0, 16.0, 17.0, 18.0
226
-
227
- ### Edge
228
- - Edge 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108
229
-
230
- ## 2023
231
-
232
- ### Chrome
233
- - Chrome 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120
234
-
235
- ### Safari
236
- - Safari 16.4, 17
237
-
238
- ### Firefox
239
- - Firefox 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121
240
-
241
- ### Samsung Internet
242
- - Samsung Internet 19.0, 20.0, 21.0, 22.0
243
-
244
- ### Edge
245
- - Edge 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120
246
-
247
- ## 2024
248
-
249
- ### Chrome
250
- - Chrome 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132
251
-
252
- ### Safari
253
- - Safari 17.4, 18, 18.2
254
-
255
- ### Firefox
256
- - Firefox 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133
257
-
258
- ### Samsung Internet
259
- - Samsung Internet 23.0, 24.0, 25.0, 26.0
260
-
261
- ### Edge
262
- - Edge 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131
263
-
264
- ## 2025
265
-
266
- ### Chrome
267
- - Chrome 133, 134
268
-
269
- ### Safari
270
- - Safari 19 (expected)
271
-
272
- ### Firefox
273
- - Firefox 134, 135
274
-
275
- ### Samsung Internet
276
- - Samsung Internet 27.0 (expected)
277
-
278
- ### Edge
279
- - Edge 132, 133