@liquidcommerce/elements-sdk 2.7.0 → 2.7.2
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.
- package/README.md +83 -2750
- package/dist/index.checkout.esm.js +6898 -6837
- package/dist/index.esm.js +11463 -10993
- package/dist/types/auto-initialize/shared-utils.d.ts +5 -0
- package/dist/types/constants/core.constant.d.ts +0 -4
- package/dist/types/core/base-component.service.d.ts +2 -1
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +11 -0
- package/dist/types/interfaces/configs/product-list.interface.d.ts +2 -2
- package/dist/types/interfaces/core.interface.d.ts +5 -4
- package/dist/types/modules/address/address-input.component.d.ts +11 -0
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
- package/dist/types/modules/product-list/components/card-components/index.d.ts +3 -0
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +8 -0
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +2 -0
- package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
- package/dist/types/modules/product-list/components/card-components/product-title.d.ts +6 -0
- package/dist/types/modules/product-list/components/index.d.ts +1 -0
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +5 -1
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +28 -0
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +10 -2
- package/dist/types/modules/product-list/product-list-card.component.d.ts +0 -5
- package/dist/types/modules/product-list/product-list.commands.d.ts +11 -2
- package/dist/types/modules/product-list/product-list.interface.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +11 -2
- package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
- package/dist/types/utils/dom-compat.d.ts +2 -0
- package/docs/gitbook/actions.md +964 -0
- package/docs/gitbook/address.md +48 -0
- package/docs/gitbook/cart.md +65 -0
- package/docs/gitbook/checkout.md +131 -0
- package/docs/gitbook/events.md +1765 -0
- package/docs/gitbook/overview.md +166 -0
- package/docs/gitbook/product.md +64 -0
- package/docs/gitbook/quick-start-guide.md +393 -0
- package/docs/v1/README.md +210 -0
- package/docs/v1/api/actions/address-actions.md +281 -0
- package/docs/v1/api/actions/cart-actions.md +337 -0
- package/docs/v1/api/actions/checkout-actions.md +387 -0
- package/docs/v1/api/actions/product-actions.md +115 -0
- package/docs/v1/api/client.md +482 -0
- package/docs/v1/api/configuration.md +1 -0
- package/docs/v1/api/injection-methods.md +247 -0
- package/docs/v1/api/typescript-types.md +1 -0
- package/docs/v1/api/ui-helpers.md +200 -0
- package/docs/v1/examples/advanced-patterns.md +96 -0
- package/docs/v1/examples/checkout-flow.md +91 -0
- package/docs/v1/examples/custom-theming.md +63 -0
- package/docs/v1/examples/multi-product-page.md +90 -0
- package/docs/v1/examples/simple-product-page.md +89 -0
- package/docs/v1/getting-started/concepts.md +507 -0
- package/docs/v1/getting-started/installation.md +328 -0
- package/docs/v1/getting-started/quick-start.md +405 -0
- package/docs/v1/guides/address-component.md +431 -0
- package/docs/v1/guides/best-practices.md +324 -0
- package/docs/v1/guides/cart-component.md +737 -0
- package/docs/v1/guides/checkout-component.md +672 -0
- package/docs/v1/guides/events.md +926 -0
- package/docs/v1/guides/product-component.md +686 -0
- package/docs/v1/guides/product-list-component.md +598 -0
- package/docs/v1/guides/theming.md +216 -0
- package/docs/v1/integration/angular.md +39 -0
- package/docs/v1/integration/laravel.md +41 -0
- package/docs/v1/integration/nextjs.md +60 -0
- package/docs/v1/integration/proxy-setup.md +89 -0
- package/docs/v1/integration/react.md +64 -0
- package/docs/v1/integration/vanilla-js.md +84 -0
- package/docs/v1/integration/vue.md +34 -0
- package/docs/v1/reference/browser-support.md +44 -0
- package/docs/v1/reference/error-handling.md +70 -0
- package/docs/v1/reference/performance.md +54 -0
- package/docs/v1/reference/troubleshooting.md +64 -0
- package/package.json +1 -1
- package/docs/ACTIONS.md +0 -1301
- package/docs/BROWSER_SUPPORT.md +0 -279
- package/docs/CONFIGURATION.md +0 -997
- package/docs/DOCUMENTATION_INDEX.md +0 -319
- package/docs/EVENTS.md +0 -798
- package/docs/PROXY.md +0 -228
- package/docs/THEMING.md +0 -681
- package/docs/TROUBLESHOOTING.md +0 -793
package/docs/CONFIGURATION.md
DELETED
|
@@ -1,997 +0,0 @@
|
|
|
1
|
-
# Configuration Reference
|
|
2
|
-
|
|
3
|
-
Complete reference for all LiquidCommerce Elements SDK configuration options.
|
|
4
|
-
|
|
5
|
-
## Basic Configuration
|
|
6
|
-
|
|
7
|
-
```javascript
|
|
8
|
-
const client = await Elements('YOUR_API_KEY', {
|
|
9
|
-
env: 'production',
|
|
10
|
-
debugMode: 'none',
|
|
11
|
-
isBuilder: false,
|
|
12
|
-
customTheme: {},
|
|
13
|
-
proxy: {},
|
|
14
|
-
promoTicker: [],
|
|
15
|
-
checkout: {
|
|
16
|
-
pageUrl: 'https://yoursite.com/checkout?id={id}' // Optional: hosted checkout
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Configuration Options
|
|
22
|
-
|
|
23
|
-
### `env` (required)
|
|
24
|
-
|
|
25
|
-
**Type:** `'local' | 'development' | 'staging' | 'production'`
|
|
26
|
-
**Default:** `'production'`
|
|
27
|
-
|
|
28
|
-
Specifies the API environment to use.
|
|
29
|
-
|
|
30
|
-
```javascript
|
|
31
|
-
env: 'production' // Live environment
|
|
32
|
-
env: 'staging' // Pre-production testing
|
|
33
|
-
env: 'development' // Development with extra logging
|
|
34
|
-
env: 'local' // Local development
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
**Environment URLs:**
|
|
38
|
-
- `production`: `https://elements.liquidcommerce.us`
|
|
39
|
-
- `staging`: `https://staging-elements.liquidcommerce.us`
|
|
40
|
-
- `development`: `https://dev-elements.liquidcommerce.us`
|
|
41
|
-
- `local`: `http://localhost:3000`
|
|
42
|
-
|
|
43
|
-
### `debugMode`
|
|
44
|
-
|
|
45
|
-
**Type:** `'none' | 'console' | 'panel'`
|
|
46
|
-
**Default:** `'none'`
|
|
47
|
-
|
|
48
|
-
Controls logging and debugging output.
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
debugMode: 'none' // No logging (production)
|
|
52
|
-
debugMode: 'console' // Console logs only
|
|
53
|
-
debugMode: 'panel' // Visual debug panel + console
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Debug panel features:**
|
|
57
|
-
- Real-time event stream
|
|
58
|
-
- API call inspector
|
|
59
|
-
- State viewer
|
|
60
|
-
- Performance metrics
|
|
61
|
-
|
|
62
|
-
**Note:** Automatically disabled in production environment regardless of setting.
|
|
63
|
-
|
|
64
|
-
### `isBuilder`
|
|
65
|
-
|
|
66
|
-
**Type:** `boolean`
|
|
67
|
-
**Default:** `false`
|
|
68
|
-
|
|
69
|
-
Enables builder mode for theme development and testing.
|
|
70
|
-
|
|
71
|
-
```javascript
|
|
72
|
-
isBuilder: true // Enables builder.* methods
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Builder mode provides:**
|
|
76
|
-
- `client.builder.updateComponentGlobalConfigs()`
|
|
77
|
-
- `client.builder.updateProductComponent()`
|
|
78
|
-
- `client.builder.updateCartComponent()`
|
|
79
|
-
- `client.builder.updateCheckoutComponent()`
|
|
80
|
-
- `client.builder.updateAddressComponent()`
|
|
81
|
-
|
|
82
|
-
**Use case:** Theme customization and testing.
|
|
83
|
-
|
|
84
|
-
### `customTheme`
|
|
85
|
-
|
|
86
|
-
**Type:** `object`
|
|
87
|
-
**Default:** `{}`
|
|
88
|
-
|
|
89
|
-
Custom theme configuration. See [`THEMING.md`](./THEMING.md) for complete reference.
|
|
90
|
-
|
|
91
|
-
```javascript
|
|
92
|
-
customTheme: {
|
|
93
|
-
global: {
|
|
94
|
-
colors: {
|
|
95
|
-
primary: '#007bff',
|
|
96
|
-
secondary: '#6c757d'
|
|
97
|
-
},
|
|
98
|
-
typography: {
|
|
99
|
-
fontFamily: 'Inter, sans-serif',
|
|
100
|
-
fontSize: '16px'
|
|
101
|
-
},
|
|
102
|
-
layout: {
|
|
103
|
-
enablePersonalization: true,
|
|
104
|
-
personalizationText: 'Personalize your product',
|
|
105
|
-
personalizationCardStyle: 'outlined',
|
|
106
|
-
allowPromoCodes: true,
|
|
107
|
-
inputFieldStyle: 'outlined',
|
|
108
|
-
poweredByMode: 'light' // Can be customized
|
|
109
|
-
// Note: showPoweredBy cannot be customized (controlled by LiquidCommerce)
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
product: { /* product theme */ },
|
|
113
|
-
cart: { /* cart theme */ },
|
|
114
|
-
checkout: { /* checkout theme */ },
|
|
115
|
-
address: { /* address theme */ }
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Key Theme Categories:**
|
|
120
|
-
|
|
121
|
-
- **`global`**: Affects all components (colors, fonts, personalization settings)
|
|
122
|
-
- **`product`**: Product display customization
|
|
123
|
-
- **`cart`**: Cart drawer and item display
|
|
124
|
-
- **`checkout`**: Checkout flow and completion screen
|
|
125
|
-
- **`address`**: Address input and selection
|
|
126
|
-
|
|
127
|
-
**Personalization (Engraving) Settings:**
|
|
128
|
-
|
|
129
|
-
The personalization feature is configured in `global.layout`:
|
|
130
|
-
|
|
131
|
-
```javascript
|
|
132
|
-
customTheme: {
|
|
133
|
-
global: {
|
|
134
|
-
layout: {
|
|
135
|
-
enablePersonalization: true, // Enable/disable engraving globally
|
|
136
|
-
personalizationText: 'Make it yours', // Button text for adding personalization
|
|
137
|
-
personalizationCardStyle: 'outlined' // Style: 'outlined' | 'filled'
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
- **`enablePersonalization`**: Master switch for engraving feature
|
|
144
|
-
- **`personalizationText`**: Call-to-action text on product pages
|
|
145
|
-
- **`personalizationCardStyle`**: Visual style in cart/checkout ('outlined' or 'filled')
|
|
146
|
-
- **`poweredByMode`**: Visual mode for "Powered by" branding ('light' or 'dark')
|
|
147
|
-
|
|
148
|
-
**Protected Setting:**
|
|
149
|
-
⚠️ **`showPoweredBy`** is a read-only setting controlled by LiquidCommerce. This paid feature cannot be customized through the `customTheme` configuration and is managed via your LiquidCommerce dashboard. However, you can customize `poweredByMode` to match your site's theme.
|
|
150
|
-
|
|
151
|
-
### `proxy`
|
|
152
|
-
|
|
153
|
-
**Type:** `object`
|
|
154
|
-
**Default:** `null`
|
|
155
|
-
|
|
156
|
-
Proxy configuration for routing API requests through your server.
|
|
157
|
-
|
|
158
|
-
```javascript
|
|
159
|
-
proxy: {
|
|
160
|
-
baseUrl: 'https://yourdomain.com/api/liquidcommerce',
|
|
161
|
-
headers: {
|
|
162
|
-
'X-Custom-Header': 'value'
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Properties:**
|
|
168
|
-
|
|
169
|
-
#### `proxy.baseUrl`
|
|
170
|
-
|
|
171
|
-
**Type:** `string` (required)
|
|
172
|
-
|
|
173
|
-
Base URL for your proxy endpoint.
|
|
174
|
-
|
|
175
|
-
```javascript
|
|
176
|
-
baseUrl: 'https://yourdomain.com/api/liquidcommerce'
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
The SDK automatically appends API paths: `/api/products`, `/api/cart`, etc.
|
|
180
|
-
|
|
181
|
-
#### `proxy.headers`
|
|
182
|
-
|
|
183
|
-
**Type:** `object` (optional)
|
|
184
|
-
|
|
185
|
-
Custom headers to include in proxied requests.
|
|
186
|
-
|
|
187
|
-
```javascript
|
|
188
|
-
headers: {
|
|
189
|
-
'X-Custom-Auth': 'your-token',
|
|
190
|
-
'X-Request-Id': 'unique-id'
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
See [`PROXY.md`](./PROXY.md) for implementation guide.
|
|
195
|
-
|
|
196
|
-
### `promoTicker`
|
|
197
|
-
|
|
198
|
-
**Type:** `array`
|
|
199
|
-
**Default:** `[]`
|
|
200
|
-
|
|
201
|
-
Promotional ticker configuration for rotating messages.
|
|
202
|
-
|
|
203
|
-
```javascript
|
|
204
|
-
promoTicker: [
|
|
205
|
-
{
|
|
206
|
-
promoCode: 'FREESHIP',
|
|
207
|
-
text: ['Free Shipping Today!', 'Use code FREESHIP'],
|
|
208
|
-
separator: '•',
|
|
209
|
-
activeFrom: '2025-01-01T00:00:00Z',
|
|
210
|
-
activeUntil: '2025-12-31T23:59:59Z'
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
**Properties:**
|
|
216
|
-
|
|
217
|
-
#### `promoCode` (required)
|
|
218
|
-
|
|
219
|
-
**Type:** `string`
|
|
220
|
-
|
|
221
|
-
The promo code to apply when clicked.
|
|
222
|
-
|
|
223
|
-
#### `text` (required)
|
|
224
|
-
|
|
225
|
-
**Type:** `string[]`
|
|
226
|
-
|
|
227
|
-
Array of messages to rotate through.
|
|
228
|
-
|
|
229
|
-
```javascript
|
|
230
|
-
text: ['Message 1', 'Message 2', 'Message 3']
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
#### `separator` (optional)
|
|
234
|
-
|
|
235
|
-
**Type:** `string`
|
|
236
|
-
**Default:** `'•'`
|
|
237
|
-
|
|
238
|
-
Separator between rotating messages.
|
|
239
|
-
|
|
240
|
-
```javascript
|
|
241
|
-
separator: '•' // Bullet
|
|
242
|
-
separator: '|' // Pipe
|
|
243
|
-
separator: '→' // Arrow
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
#### `activeFrom` (optional)
|
|
247
|
-
|
|
248
|
-
**Type:** `string` (ISO 8601)
|
|
249
|
-
|
|
250
|
-
Start date/time for the promotion.
|
|
251
|
-
|
|
252
|
-
```javascript
|
|
253
|
-
activeFrom: '2025-01-01T00:00:00Z'
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
#### `activeUntil` (optional)
|
|
257
|
-
|
|
258
|
-
**Type:** `string` (ISO 8601)
|
|
259
|
-
|
|
260
|
-
End date/time for the promotion.
|
|
261
|
-
|
|
262
|
-
```javascript
|
|
263
|
-
activeUntil: '2025-12-31T23:59:59Z'
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**Note:** Only active promotions are displayed.
|
|
267
|
-
|
|
268
|
-
### `checkout`
|
|
269
|
-
|
|
270
|
-
**Type:** `object`
|
|
271
|
-
**Default:** `undefined`
|
|
272
|
-
|
|
273
|
-
Configuration for hosted checkout (external checkout page).
|
|
274
|
-
|
|
275
|
-
```javascript
|
|
276
|
-
checkout: {
|
|
277
|
-
pageUrl: 'https://yoursite.com/checkout?id={id}'
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
**Properties:**
|
|
282
|
-
|
|
283
|
-
#### `checkout.pageUrl`
|
|
284
|
-
|
|
285
|
-
**Type:** `string` (required)
|
|
286
|
-
|
|
287
|
-
URL of your dedicated checkout page. The `{id}` placeholder is replaced with the checkout token.
|
|
288
|
-
|
|
289
|
-
```javascript
|
|
290
|
-
pageUrl: 'https://yoursite.com/checkout?id={id}'
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
When set, the "Go to Checkout" button in the cart redirects to this URL instead of opening the checkout drawer.
|
|
294
|
-
|
|
295
|
-
## Auto-Initialization Configuration
|
|
296
|
-
|
|
297
|
-
When using auto-initialization, configure via `data-` attributes on the script tag.
|
|
298
|
-
|
|
299
|
-
### Required Attributes
|
|
300
|
-
|
|
301
|
-
```html
|
|
302
|
-
<script
|
|
303
|
-
data-liquid-commerce-elements
|
|
304
|
-
data-token="YOUR_API_KEY"
|
|
305
|
-
src="https://assets-elements.liquidcommerce.us/all/elements.js"
|
|
306
|
-
></script>
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
#### `data-liquid-commerce-elements`
|
|
310
|
-
|
|
311
|
-
**Type:** flag (no value)
|
|
312
|
-
|
|
313
|
-
Enables auto-initialization.
|
|
314
|
-
|
|
315
|
-
#### `data-token`
|
|
316
|
-
|
|
317
|
-
**Type:** `string` (required)
|
|
318
|
-
|
|
319
|
-
Your LiquidCommerce API key.
|
|
320
|
-
|
|
321
|
-
### Optional Attributes
|
|
322
|
-
|
|
323
|
-
#### `data-env`
|
|
324
|
-
|
|
325
|
-
**Type:** `'production' | 'staging' | 'development' | 'local'`
|
|
326
|
-
**Default:** `'production'`
|
|
327
|
-
|
|
328
|
-
```html
|
|
329
|
-
data-env="production"
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
#### `data-debug-mode`
|
|
333
|
-
|
|
334
|
-
**Type:** `'console' | 'panel'`
|
|
335
|
-
**Default:** Not set
|
|
336
|
-
|
|
337
|
-
```html
|
|
338
|
-
data-debug-mode="console"
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
#### `data-cart-button`
|
|
342
|
-
|
|
343
|
-
**Type:** `string`
|
|
344
|
-
|
|
345
|
-
Container ID, CSS selector, or position-prefixed selector for simple cart button (no badge).
|
|
346
|
-
|
|
347
|
-
```html
|
|
348
|
-
<!-- Simple ID (with or without # prefix) -->
|
|
349
|
-
data-cart-button="header-cart" <!-- Works with or without # -->
|
|
350
|
-
data-cart-button="#header-cart" <!-- Also works with # prefix -->
|
|
351
|
-
|
|
352
|
-
<!-- CSS Selector (from browser inspect tool) -->
|
|
353
|
-
data-cart-button=".header .nav-links"
|
|
354
|
-
data-cart-button="#main-navigation"
|
|
355
|
-
|
|
356
|
-
<!-- Position-prefixed selectors -->
|
|
357
|
-
data-cart-button="above:.header .logo" <!-- Place above the target -->
|
|
358
|
-
data-cart-button="below:#main-navigation" <!-- Place below the target -->
|
|
359
|
-
data-cart-button="below:main-navigation" <!-- Also works without # prefix -->
|
|
360
|
-
data-cart-button="replace:.old-cart" <!-- Replace the target -->
|
|
361
|
-
data-cart-button="inside:.header .nav" <!-- Place inside the target (default) -->
|
|
362
|
-
|
|
363
|
-
<!-- Floating cart button (no badge) -->
|
|
364
|
-
data-cart-button="" <!-- Empty value = floating button -->
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
**Smart Fallback Behavior:**
|
|
368
|
-
- If the target element is not found, automatically falls back to floating cart button
|
|
369
|
-
- If attribute is present but empty (`data-cart-button=""`), creates floating cart button without badge
|
|
370
|
-
- Element IDs are automatically prefixed with `#` if needed (e.g., `header-cart` becomes `#header-cart`)
|
|
371
|
-
|
|
372
|
-
#### `data-cart-badge-button`
|
|
373
|
-
|
|
374
|
-
**Type:** `string`
|
|
375
|
-
|
|
376
|
-
Container ID, CSS selector, or position-prefixed selector for cart button with item count badge.
|
|
377
|
-
|
|
378
|
-
```html
|
|
379
|
-
<!-- Simple ID (with or without # prefix) -->
|
|
380
|
-
data-cart-badge-button="header-cart" <!-- Works with or without # -->
|
|
381
|
-
data-cart-badge-button="#header-cart" <!-- Also works with # prefix -->
|
|
382
|
-
|
|
383
|
-
<!-- CSS Selector (from browser inspect tool) -->
|
|
384
|
-
data-cart-badge-button=".header .nav-links"
|
|
385
|
-
data-cart-badge-button="#main-navigation"
|
|
386
|
-
|
|
387
|
-
<!-- Position-prefixed selectors -->
|
|
388
|
-
data-cart-badge-button="above:.header .logo" <!-- Place above the target -->
|
|
389
|
-
data-cart-badge-button="below:#main-navigation" <!-- Place below the target -->
|
|
390
|
-
data-cart-badge-button="replace:.old-cart" <!-- Replace the target -->
|
|
391
|
-
data-cart-badge-button="inside:.header .nav" <!-- Place inside the target (default) -->
|
|
392
|
-
|
|
393
|
-
<!-- Floating cart button with badge (default) -->
|
|
394
|
-
data-cart-badge-button="" <!-- Empty value = floating button with badge -->
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
**Smart Fallback Behavior:**
|
|
398
|
-
- If the target element is not found, automatically falls back to floating cart button with badge
|
|
399
|
-
- If attribute is present but empty (`data-cart-badge-button=""`), creates floating cart button with badge
|
|
400
|
-
- Element IDs are automatically prefixed with `#` if needed
|
|
401
|
-
- If neither `data-cart-button` nor `data-cart-badge-button` is provided, defaults to floating cart button with badge
|
|
402
|
-
|
|
403
|
-
**Position Prefixes:**
|
|
404
|
-
- `above:` - Place above the target element
|
|
405
|
-
- `below:` - Place below the target element
|
|
406
|
-
- `replace:` - Replace the target element
|
|
407
|
-
- `inside:` - Place inside the target element (default)
|
|
408
|
-
|
|
409
|
-
#### `data-cart-mobile-button`
|
|
410
|
-
|
|
411
|
-
**Type:** `string`
|
|
412
|
-
|
|
413
|
-
Mobile-specific cart button (no badge). Same syntax as `data-cart-button` but only shown on mobile devices.
|
|
414
|
-
|
|
415
|
-
```html
|
|
416
|
-
data-cart-mobile-button="below:.mobile-header"
|
|
417
|
-
data-cart-mobile-button="inside:.mobile-nav"
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
#### `data-cart-mobile-badge-button`
|
|
421
|
-
|
|
422
|
-
**Type:** `string`
|
|
423
|
-
|
|
424
|
-
Mobile-specific cart button with item count badge. Same syntax as `data-cart-badge-button` but only shown on mobile devices.
|
|
425
|
-
|
|
426
|
-
```html
|
|
427
|
-
data-cart-mobile-badge-button="below:.mobile-header"
|
|
428
|
-
data-cart-mobile-badge-button="inside:.mobile-nav"
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
#### `data-cart-button-hidden`
|
|
432
|
-
|
|
433
|
-
**Type:** flag (no value)
|
|
434
|
-
|
|
435
|
-
Hide cart button completely. Use this when you want to manage cart display manually via `client.actions.cart.openCart()`.
|
|
436
|
-
|
|
437
|
-
```html
|
|
438
|
-
data-cart-button-hidden
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
**Important:** When this attribute is present, the SDK will skip all cart button setup, including floating buttons. This takes precedence over `data-cart-button` and `data-cart-badge-button` attributes.
|
|
442
|
-
|
|
443
|
-
### Cart Button Examples
|
|
444
|
-
|
|
445
|
-
**Simple cart button (no badge):**
|
|
446
|
-
```html
|
|
447
|
-
<script
|
|
448
|
-
data-liquid-commerce-elements
|
|
449
|
-
data-token="your-api-key"
|
|
450
|
-
data-cart-button="header-cart"
|
|
451
|
-
src="elements.js">
|
|
452
|
-
</script>
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
**Cart button with item count badge:**
|
|
456
|
-
```html
|
|
457
|
-
<script
|
|
458
|
-
data-liquid-commerce-elements
|
|
459
|
-
data-token="your-api-key"
|
|
460
|
-
data-cart-badge-button="header-cart"
|
|
461
|
-
src="elements.js">
|
|
462
|
-
</script>
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
**Using position-prefixed selectors:**
|
|
466
|
-
```html
|
|
467
|
-
<!-- Place inside the target element (default) -->
|
|
468
|
-
<script
|
|
469
|
-
data-liquid-commerce-elements
|
|
470
|
-
data-token="your-api-key"
|
|
471
|
-
data-cart-badge-button="inside:.header .nav-links"
|
|
472
|
-
src="elements.js">
|
|
473
|
-
</script>
|
|
474
|
-
|
|
475
|
-
<!-- Place above the target element -->
|
|
476
|
-
<script
|
|
477
|
-
data-liquid-commerce-elements
|
|
478
|
-
data-token="your-api-key"
|
|
479
|
-
data-cart-button="above:.header .logo"
|
|
480
|
-
src="elements.js">
|
|
481
|
-
</script>
|
|
482
|
-
|
|
483
|
-
<!-- Place below the target element -->
|
|
484
|
-
<script
|
|
485
|
-
data-liquid-commerce-elements
|
|
486
|
-
data-token="your-api-key"
|
|
487
|
-
data-cart-badge-button="below:#main-navigation"
|
|
488
|
-
src="elements.js">
|
|
489
|
-
</script>
|
|
490
|
-
|
|
491
|
-
<!-- Replace the target element -->
|
|
492
|
-
<script
|
|
493
|
-
data-liquid-commerce-elements
|
|
494
|
-
data-token="your-api-key"
|
|
495
|
-
data-cart-button="replace:.old-cart-button"
|
|
496
|
-
src="elements.js">
|
|
497
|
-
</script>
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
**No cart button:**
|
|
501
|
-
```html
|
|
502
|
-
<script
|
|
503
|
-
data-liquid-commerce-elements
|
|
504
|
-
data-token="your-api-key"
|
|
505
|
-
data-cart-button-hidden
|
|
506
|
-
src="elements.js">
|
|
507
|
-
</script>
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
**Default behavior (floating cart button with badge):**
|
|
511
|
-
```html
|
|
512
|
-
<script
|
|
513
|
-
data-liquid-commerce-elements
|
|
514
|
-
data-token="your-api-key"
|
|
515
|
-
src="elements.js">
|
|
516
|
-
</script>
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
### Getting CSS Selectors from Browser
|
|
520
|
-
|
|
521
|
-
**Super Easy Method:**
|
|
522
|
-
1. **Right-click** on any element where you want the cart button
|
|
523
|
-
2. Select **"Inspect"** or **"Inspect Element"**
|
|
524
|
-
3. In developer tools, **right-click** on the highlighted element
|
|
525
|
-
4. Select **"Copy" → "Copy selector"**
|
|
526
|
-
5. Paste the selector into your `data-cart-button` or `data-cart-badge-button` attribute
|
|
527
|
-
|
|
528
|
-
**Example:**
|
|
529
|
-
```html
|
|
530
|
-
<!-- After copying selector from browser inspect tool -->
|
|
531
|
-
<script
|
|
532
|
-
data-liquid-commerce-elements
|
|
533
|
-
data-token="your-api-key"
|
|
534
|
-
data-cart-badge-button="body > div.container > header > nav > div.nav-links"
|
|
535
|
-
src="elements.js">
|
|
536
|
-
</script>
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
### Product Configuration
|
|
540
|
-
|
|
541
|
-
#### Method 1: Direct Attributes
|
|
542
|
-
|
|
543
|
-
```html
|
|
544
|
-
data-container-1="product-1"
|
|
545
|
-
data-product-1="00619947000020"
|
|
546
|
-
data-container-2="product-2"
|
|
547
|
-
data-product-2="00832889005513"
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
#### Method 2: JSON Configuration
|
|
551
|
-
|
|
552
|
-
```html
|
|
553
|
-
<script data-liquid-commerce-elements-products type="application/json">
|
|
554
|
-
[
|
|
555
|
-
{ "containerId": "product-1", "identifier": "00619947000020" },
|
|
556
|
-
{ "containerId": "product-2", "identifier": "00832889005513" }
|
|
557
|
-
]
|
|
558
|
-
</script>
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
#### Method 3: Annotated Elements
|
|
562
|
-
|
|
563
|
-
```html
|
|
564
|
-
<div data-lce-product="00619947000020"></div>
|
|
565
|
-
<div data-lce-product="00832889005513"></div>
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
### Product List Configuration
|
|
569
|
-
|
|
570
|
-
```html
|
|
571
|
-
<div data-liquid-commerce-elements-products-list
|
|
572
|
-
data-rows="3"
|
|
573
|
-
data-columns="4"
|
|
574
|
-
data-filters="engraving,presale,fulfillment,price,brands"
|
|
575
|
-
data-product-url="/product/{upc}">
|
|
576
|
-
</div>
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
**Attributes:**
|
|
580
|
-
|
|
581
|
-
##### `data-liquid-commerce-elements-products-list`
|
|
582
|
-
|
|
583
|
-
**Type:** flag (no value)
|
|
584
|
-
|
|
585
|
-
Enables product list on this div element.
|
|
586
|
-
|
|
587
|
-
##### `data-rows`
|
|
588
|
-
|
|
589
|
-
**Type:** `number`
|
|
590
|
-
**Default:** `3`
|
|
591
|
-
|
|
592
|
-
Number of rows to display per page (1-10).
|
|
593
|
-
|
|
594
|
-
```html
|
|
595
|
-
data-rows="4"
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
##### `data-columns`
|
|
599
|
-
|
|
600
|
-
**Type:** `number`
|
|
601
|
-
**Default:** `4`
|
|
602
|
-
|
|
603
|
-
Number of columns in the grid (1-4).
|
|
604
|
-
|
|
605
|
-
```html
|
|
606
|
-
data-columns="4"
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
##### `data-filters`
|
|
610
|
-
|
|
611
|
-
**Type:** `string` (comma-separated)
|
|
612
|
-
|
|
613
|
-
Filter types to enable.
|
|
614
|
-
|
|
615
|
-
```html
|
|
616
|
-
data-filters="engraving,presale,fulfillment,price,brands"
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
**Available filters:**
|
|
620
|
-
- `engraving` - Show filter for personalized/engravable products
|
|
621
|
-
- `presale` - Show filter for pre-order products
|
|
622
|
-
- `fulfillment` - Show filter for delivery type (shipping, onDemand)
|
|
623
|
-
- `price` - Show price range filter
|
|
624
|
-
- `brands` - Show brand filter
|
|
625
|
-
- `categories` - Show category filter
|
|
626
|
-
- `flavor` - Show flavor filter
|
|
627
|
-
- `region` - Show region filter
|
|
628
|
-
- `variety` - Show variety filter
|
|
629
|
-
- `vintage` - Show vintage year filter
|
|
630
|
-
- `country` - Show country filter
|
|
631
|
-
- `appellation` - Show appellation filter
|
|
632
|
-
- `materials` - Show materials filter
|
|
633
|
-
- `sizes` - Show size filter
|
|
634
|
-
|
|
635
|
-
##### `data-product-url`
|
|
636
|
-
|
|
637
|
-
**Type:** `string`
|
|
638
|
-
|
|
639
|
-
Product detail page URL template. Use `{upc}` or `{grouping}` placeholder.
|
|
640
|
-
|
|
641
|
-
```html
|
|
642
|
-
data-product-url="/product/{upc}"
|
|
643
|
-
data-product-url="/products/{grouping}"
|
|
644
|
-
```
|
|
645
|
-
|
|
646
|
-
**Placeholders:**
|
|
647
|
-
- `{upc}` - Replaced with product UPC
|
|
648
|
-
- `{grouping}` - Replaced with Salsify grouping ID
|
|
649
|
-
|
|
650
|
-
### Product List Search and Filters Containers
|
|
651
|
-
|
|
652
|
-
You can place search and filter components in separate containers:
|
|
653
|
-
|
|
654
|
-
```html
|
|
655
|
-
<!-- Search bar (any div) -->
|
|
656
|
-
<div data-search-container></div>
|
|
657
|
-
|
|
658
|
-
<!-- Filter panel (any div) -->
|
|
659
|
-
<div data-filters-container></div>
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
These work alongside the main `data-liquid-commerce-elements-products-list` container. The search and filter components communicate with the product list automatically.
|
|
663
|
-
|
|
664
|
-
### Checkout URL Configuration
|
|
665
|
-
|
|
666
|
-
#### `data-checkout-url`
|
|
667
|
-
|
|
668
|
-
**Type:** `string`
|
|
669
|
-
|
|
670
|
-
URL for hosted checkout page. The `{id}` placeholder is replaced with the checkout token.
|
|
671
|
-
|
|
672
|
-
```html
|
|
673
|
-
data-checkout-url="https://yoursite.com/checkout?id={id}"
|
|
674
|
-
```
|
|
675
|
-
|
|
676
|
-
When set, the "Go to Checkout" button in the cart redirects to this URL instead of opening the checkout drawer.
|
|
677
|
-
|
|
678
|
-
### Custom Cart Elements
|
|
679
|
-
|
|
680
|
-
#### `data-lce-cart-toggle-button`
|
|
681
|
-
|
|
682
|
-
**Type:** flag (no value)
|
|
683
|
-
|
|
684
|
-
Add to any element to make it toggle the cart open/closed on click.
|
|
685
|
-
|
|
686
|
-
```html
|
|
687
|
-
<button data-lce-cart-toggle-button>Open Cart</button>
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
#### `data-lce-cart-items-count`
|
|
691
|
-
|
|
692
|
-
**Type:** `string` (optional value: `"keep-zero"`)
|
|
693
|
-
|
|
694
|
-
Displays the current cart item count inside the element. Updated automatically.
|
|
695
|
-
|
|
696
|
-
```html
|
|
697
|
-
<!-- Hides when count is 0 -->
|
|
698
|
-
<span data-lce-cart-items-count></span>
|
|
699
|
-
|
|
700
|
-
<!-- Always shows count, even when 0 -->
|
|
701
|
-
<span data-lce-cart-items-count="keep-zero">0</span>
|
|
702
|
-
```
|
|
703
|
-
|
|
704
|
-
### URL Parameter Configuration
|
|
705
|
-
|
|
706
|
-
#### `data-product-param`
|
|
707
|
-
|
|
708
|
-
**Type:** `string`
|
|
709
|
-
|
|
710
|
-
URL parameter name for auto-adding products to cart.
|
|
711
|
-
|
|
712
|
-
```html
|
|
713
|
-
data-product-param="lce_product"
|
|
714
|
-
```
|
|
715
|
-
|
|
716
|
-
**Usage:** `?lce_product=00619947000020&lce_fulfillment=shipping`
|
|
717
|
-
|
|
718
|
-
#### `data-product-fulfillment-type-param`
|
|
719
|
-
|
|
720
|
-
**Type:** `string`
|
|
721
|
-
|
|
722
|
-
URL parameter name for fulfillment type.
|
|
723
|
-
|
|
724
|
-
```html
|
|
725
|
-
data-product-fulfillment-type-param="lce_fulfillment"
|
|
726
|
-
```
|
|
727
|
-
|
|
728
|
-
**Values:** `shipping` or `onDemand`
|
|
729
|
-
|
|
730
|
-
#### `data-promo-code-param`
|
|
731
|
-
|
|
732
|
-
**Type:** `string`
|
|
733
|
-
|
|
734
|
-
URL parameter name for auto-applying promo codes.
|
|
735
|
-
|
|
736
|
-
```html
|
|
737
|
-
data-promo-code-param="lce_promo"
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
**Usage:** `?lce_promo=SUMMER20`
|
|
741
|
-
|
|
742
|
-
### Promo Ticker Configuration
|
|
743
|
-
|
|
744
|
-
#### `data-promo-code`
|
|
745
|
-
|
|
746
|
-
**Type:** `string`
|
|
747
|
-
|
|
748
|
-
Promo code to apply.
|
|
749
|
-
|
|
750
|
-
```html
|
|
751
|
-
data-promo-code="FREESHIP"
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
#### `data-promo-text`
|
|
755
|
-
|
|
756
|
-
**Type:** `string` (pipe-separated)
|
|
757
|
-
|
|
758
|
-
Messages to display.
|
|
759
|
-
|
|
760
|
-
```html
|
|
761
|
-
data-promo-text="Free Shipping Today!|Use code FREESHIP"
|
|
762
|
-
```
|
|
763
|
-
|
|
764
|
-
#### `data-promo-separator`
|
|
765
|
-
|
|
766
|
-
**Type:** `string`
|
|
767
|
-
**Default:** `'•'`
|
|
768
|
-
|
|
769
|
-
```html
|
|
770
|
-
data-promo-separator="•"
|
|
771
|
-
```
|
|
772
|
-
|
|
773
|
-
#### `data-promo-active-from`
|
|
774
|
-
|
|
775
|
-
**Type:** `string` (ISO 8601)
|
|
776
|
-
|
|
777
|
-
```html
|
|
778
|
-
data-promo-active-from="2025-01-01T00:00:00Z"
|
|
779
|
-
```
|
|
780
|
-
|
|
781
|
-
#### `data-promo-active-until`
|
|
782
|
-
|
|
783
|
-
**Type:** `string` (ISO 8601)
|
|
784
|
-
|
|
785
|
-
```html
|
|
786
|
-
data-promo-active-until="2025-12-31T23:59:59Z"
|
|
787
|
-
```
|
|
788
|
-
|
|
789
|
-
## Checkout-Only Build (Hosted Checkout)
|
|
790
|
-
|
|
791
|
-
For hosted checkout pages, use the checkout-only build for a smaller bundle.
|
|
792
|
-
|
|
793
|
-
### Auto-Initialization
|
|
794
|
-
|
|
795
|
-
```html
|
|
796
|
-
<script
|
|
797
|
-
data-liquid-commerce-checkout
|
|
798
|
-
data-token="YOUR_API_KEY"
|
|
799
|
-
data-env="production"
|
|
800
|
-
data-debug-mode="none"
|
|
801
|
-
src="https://assets-elements.liquidcommerce.us/checkout/elements.js"
|
|
802
|
-
></script>
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
**Attributes:**
|
|
806
|
-
- `data-liquid-commerce-checkout` - Enables checkout-only auto-initialization (required)
|
|
807
|
-
- `data-token` - Your API key (required)
|
|
808
|
-
- `data-env` - Environment: `production`, `staging`, `development`
|
|
809
|
-
- `data-debug-mode` - Debug mode: `console`, `panel`
|
|
810
|
-
- `data-checkout-url` - Checkout page URL (for redirect behavior)
|
|
811
|
-
|
|
812
|
-
### Programmatic Initialization
|
|
813
|
-
|
|
814
|
-
```javascript
|
|
815
|
-
import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
|
|
816
|
-
|
|
817
|
-
const client = await ElementsCheckout('YOUR_API_KEY', {
|
|
818
|
-
env: 'production'
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
const component = await client.injectCheckout({
|
|
822
|
-
containerId: 'checkout-container',
|
|
823
|
-
checkoutId: 'checkout-token-from-url', // Optional: checkout token
|
|
824
|
-
hideHeader: true // Optional
|
|
825
|
-
});
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
**Differences from full SDK:**
|
|
829
|
-
- Smaller bundle (tree-shaken, no product/cart/PLP components)
|
|
830
|
-
- Only `injectCheckout()` method available (no `injectProductElement`, `injectCartElement`, etc.)
|
|
831
|
-
- Checkout actions only (no `openCheckout`/`closeCheckout`/`toggleCheckout` drawer controls)
|
|
832
|
-
- Same theming, events, and configuration system
|
|
833
|
-
|
|
834
|
-
## TypeScript Types
|
|
835
|
-
|
|
836
|
-
### `ILiquidCommerceElementsConfig`
|
|
837
|
-
|
|
838
|
-
```typescript
|
|
839
|
-
interface ILiquidCommerceElementsConfig {
|
|
840
|
-
env?: 'local' | 'development' | 'staging' | 'production';
|
|
841
|
-
debugMode?: 'none' | 'console' | 'panel';
|
|
842
|
-
isBuilder?: boolean;
|
|
843
|
-
customTheme?: IClientCustomThemeConfig;
|
|
844
|
-
proxy?: IElementsProxyConfig;
|
|
845
|
-
promoTicker?: IPromoTicker[];
|
|
846
|
-
checkout?: ILiquidCommerceElementsCheckoutConfig;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
interface ILiquidCommerceElementsCheckoutConfig {
|
|
850
|
-
pageUrl: string; // URL with {id} placeholder for checkout token
|
|
851
|
-
}
|
|
852
|
-
```
|
|
853
|
-
|
|
854
|
-
### `IElementsProxyConfig`
|
|
855
|
-
|
|
856
|
-
```typescript
|
|
857
|
-
interface IElementsProxyConfig {
|
|
858
|
-
baseUrl: string;
|
|
859
|
-
headers?: Record<string, string>;
|
|
860
|
-
}
|
|
861
|
-
```
|
|
862
|
-
|
|
863
|
-
### `IPromoTicker`
|
|
864
|
-
|
|
865
|
-
```typescript
|
|
866
|
-
interface IPromoTicker {
|
|
867
|
-
promoCode: string;
|
|
868
|
-
text: string[];
|
|
869
|
-
separator: string;
|
|
870
|
-
activeFrom: string; // ISO 8601 UTC format
|
|
871
|
-
activeUntil: string; // ISO 8601 UTC format
|
|
872
|
-
}
|
|
873
|
-
```
|
|
874
|
-
|
|
875
|
-
## Configuration Examples
|
|
876
|
-
|
|
877
|
-
### Production Setup
|
|
878
|
-
|
|
879
|
-
```javascript
|
|
880
|
-
const client = await Elements('YOUR_PRODUCTION_API_KEY', {
|
|
881
|
-
env: 'production',
|
|
882
|
-
debugMode: 'none',
|
|
883
|
-
proxy: {
|
|
884
|
-
baseUrl: 'https://yourdomain.com/api/liquidcommerce'
|
|
885
|
-
},
|
|
886
|
-
customTheme: {
|
|
887
|
-
global: {
|
|
888
|
-
colors: {
|
|
889
|
-
primary: '#007bff'
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
```
|
|
895
|
-
|
|
896
|
-
### Development Setup
|
|
897
|
-
|
|
898
|
-
```javascript
|
|
899
|
-
const client = await Elements('YOUR_DEV_API_KEY', {
|
|
900
|
-
env: 'development',
|
|
901
|
-
debugMode: 'panel',
|
|
902
|
-
isBuilder: true,
|
|
903
|
-
customTheme: {
|
|
904
|
-
global: {
|
|
905
|
-
colors: {
|
|
906
|
-
primary: '#ff6b6b'
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
```
|
|
912
|
-
|
|
913
|
-
### With Promo Ticker
|
|
914
|
-
|
|
915
|
-
```javascript
|
|
916
|
-
const client = await Elements('YOUR_API_KEY', {
|
|
917
|
-
env: 'production',
|
|
918
|
-
promoTicker: [
|
|
919
|
-
{
|
|
920
|
-
promoCode: 'SUMMER20',
|
|
921
|
-
text: ['20% Off Summer Sale!', 'Use code SUMMER20'],
|
|
922
|
-
separator: '•',
|
|
923
|
-
activeFrom: '2025-06-01T00:00:00Z',
|
|
924
|
-
activeUntil: '2025-08-31T23:59:59Z'
|
|
925
|
-
}
|
|
926
|
-
]
|
|
927
|
-
});
|
|
928
|
-
```
|
|
929
|
-
|
|
930
|
-
## Configuration Validation
|
|
931
|
-
|
|
932
|
-
The SDK validates configuration on initialization:
|
|
933
|
-
|
|
934
|
-
```javascript
|
|
935
|
-
try {
|
|
936
|
-
const client = await Elements('YOUR_API_KEY', {
|
|
937
|
-
env: 'invalid' // ❌ Will throw error
|
|
938
|
-
});
|
|
939
|
-
} catch (error) {
|
|
940
|
-
console.error('Invalid configuration:', error);
|
|
941
|
-
}
|
|
942
|
-
```
|
|
943
|
-
|
|
944
|
-
**Common validation errors:**
|
|
945
|
-
- Invalid environment value
|
|
946
|
-
- Missing API key
|
|
947
|
-
- Invalid proxy baseUrl
|
|
948
|
-
- Malformed promo ticker dates
|
|
949
|
-
|
|
950
|
-
## Environment Variables
|
|
951
|
-
|
|
952
|
-
For framework integrations, use environment variables:
|
|
953
|
-
|
|
954
|
-
### React / Next.js
|
|
955
|
-
|
|
956
|
-
```javascript
|
|
957
|
-
const client = await Elements(process.env.REACT_APP_LCE_API_KEY, {
|
|
958
|
-
env: process.env.REACT_APP_LCE_ENV || 'production'
|
|
959
|
-
});
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
### Vue
|
|
963
|
-
|
|
964
|
-
```javascript
|
|
965
|
-
const client = await Elements(process.env.VUE_APP_LCE_API_KEY, {
|
|
966
|
-
env: process.env.VUE_APP_LCE_ENV || 'production'
|
|
967
|
-
});
|
|
968
|
-
```
|
|
969
|
-
|
|
970
|
-
### Node.js / Server-Side
|
|
971
|
-
|
|
972
|
-
```javascript
|
|
973
|
-
const client = await Elements(process.env.LCE_API_KEY, {
|
|
974
|
-
env: process.env.NODE_ENV === 'production' ? 'production' : 'development'
|
|
975
|
-
});
|
|
976
|
-
```
|
|
977
|
-
|
|
978
|
-
## Configuration Best Practices
|
|
979
|
-
|
|
980
|
-
1. **Use environment variables** for API keys (never hardcode)
|
|
981
|
-
2. **Enable debug mode only in development** (security risk in production)
|
|
982
|
-
3. **Pin to specific version** in production for stability
|
|
983
|
-
4. **Configure proxy** if targeting ad blocker-heavy audiences
|
|
984
|
-
5. **Use minimal theme overrides** for optimal performance
|
|
985
|
-
6. **Set GTM container ID** for analytics tracking
|
|
986
|
-
7. **Test configuration** in staging before production
|
|
987
|
-
8. **Validate promo dates** to avoid expired promotions
|
|
988
|
-
9. **Use builder mode** only in development (performance overhead)
|
|
989
|
-
10. **Monitor proxy** health if using custom proxy
|
|
990
|
-
|
|
991
|
-
## Related Documentation
|
|
992
|
-
|
|
993
|
-
- [Theming Guide](./THEMING.md) - Complete theme configuration reference
|
|
994
|
-
- [Proxy Setup](./PROXY.md) - Proxy implementation guide
|
|
995
|
-
- [Actions Reference](./ACTIONS.md) - Programmatic control API
|
|
996
|
-
- [Events Reference](./EVENTS.md) - Event system and tracking
|
|
997
|
-
|