@liquidcommerce/elements-sdk 2.7.9 → 2.7.11

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.
@@ -1 +1,528 @@
1
- to be created...
1
+ # Configuration Reference
2
+
3
+ Complete reference for all configuration options available in the Elements SDK.
4
+
5
+ ## Client Configuration
6
+
7
+ ### ILiquidCommerceElementsConfig
8
+
9
+ Top-level configuration passed to `Elements()` or `ElementsBuilder()`.
10
+
11
+ ```typescript
12
+ interface ILiquidCommerceElementsConfig {
13
+ env?: ElementsEnv;
14
+ promoTicker?: IPromoTicker[];
15
+ customTheme?: IClientCustomThemeConfig;
16
+ debugMode?: DebugMode;
17
+ checkout?: ILiquidCommerceElementsCheckoutConfig;
18
+ proxy?: IElementsProxyConfig;
19
+ development?: ILiquidCommerceElementsDevelopmentConfig;
20
+ }
21
+ ```
22
+
23
+ | Property | Type | Required | Description |
24
+ |----------|------|----------|-------------|
25
+ | `env` | `'development' \| 'staging' \| 'production'` | No | API environment |
26
+ | `promoTicker` | `IPromoTicker[]` | No | Promotional ticker configurations |
27
+ | `customTheme` | `IClientCustomThemeConfig` | No | Theme overrides for all components |
28
+ | `debugMode` | `'none' \| 'console' \| 'panel'` | No | Debug output mode |
29
+ | `checkout` | `ILiquidCommerceElementsCheckoutConfig` | No | Checkout behavior settings |
30
+ | `proxy` | `IElementsProxyConfig` | No | Proxy configuration for API requests |
31
+ | `development` | `ILiquidCommerceElementsDevelopmentConfig` | No | Development/testing options |
32
+
33
+ ---
34
+
35
+ ## Theme Configuration
36
+
37
+ ### IClientCustomThemeConfig
38
+
39
+ Override default theme settings for any component.
40
+
41
+ ```typescript
42
+ interface IClientCustomThemeConfig {
43
+ global?: UpdateComponentGlobalConfigs;
44
+ product?: UpdateProductComponent;
45
+ address?: UpdateAddressComponent;
46
+ cart?: UpdateCartComponent;
47
+ checkout?: UpdateCheckoutComponent;
48
+ productList?: UpdateProductListComponent;
49
+ }
50
+ ```
51
+
52
+ All theme properties are deeply partial -- you only need to specify the values you want to override.
53
+
54
+ ---
55
+
56
+ ### Global Theme
57
+
58
+ #### IGlobalTheme
59
+
60
+ ```typescript
61
+ interface IGlobalTheme {
62
+ buttonCornerRadius: string;
63
+ cardCornerRadius: string;
64
+ headingFont: IFontFamily;
65
+ paragraphFont: IFontFamily;
66
+ primaryColor: string;
67
+ accentColor: string;
68
+ defaultTextColor: string;
69
+ selectedTextColor: string;
70
+ linkTextColor: string;
71
+ errorColor: string;
72
+ warningColor: string;
73
+ successColor: string;
74
+ drawerBackgroundColor: string;
75
+ }
76
+ ```
77
+
78
+ | Property | Type | Description |
79
+ |----------|------|-------------|
80
+ | `buttonCornerRadius` | `string` | CSS border-radius for buttons (e.g., `'8px'`) |
81
+ | `cardCornerRadius` | `string` | CSS border-radius for cards |
82
+ | `headingFont` | `IFontFamily` | Font family and weights for headings |
83
+ | `paragraphFont` | `IFontFamily` | Font family and weights for body text |
84
+ | `primaryColor` | `string` | Primary brand color (buttons, links, highlights) |
85
+ | `accentColor` | `string` | Secondary accent color |
86
+ | `defaultTextColor` | `string` | Default text color |
87
+ | `selectedTextColor` | `string` | Text color for selected/active elements |
88
+ | `linkTextColor` | `string` | Color for links |
89
+ | `errorColor` | `string` | Color for error states |
90
+ | `warningColor` | `string` | Color for warning states |
91
+ | `successColor` | `string` | Color for success states |
92
+ | `drawerBackgroundColor` | `string` | Background color for drawer components |
93
+
94
+ #### IFontFamily
95
+
96
+ ```typescript
97
+ interface IFontFamily {
98
+ name: string; // Google Font name (e.g., 'Inter')
99
+ weights: number[]; // Font weights to load (e.g., [400, 500, 700])
100
+ }
101
+ ```
102
+
103
+ #### IGlobalLayout
104
+
105
+ ```typescript
106
+ interface IGlobalLayout {
107
+ enablePersonalization: boolean;
108
+ personalizationText: string;
109
+ personalizationCardStyle: 'outlined' | 'filled';
110
+ allowPromoCodes: boolean;
111
+ inputFieldStyle: 'outlined' | 'filled';
112
+ showPoweredBy: boolean;
113
+ poweredByMode: 'light' | 'dark';
114
+ }
115
+ ```
116
+
117
+ | Property | Type | Description |
118
+ |----------|------|-------------|
119
+ | `enablePersonalization` | `boolean` | Enable engraving/personalization features |
120
+ | `personalizationText` | `string` | Label text for personalization option |
121
+ | `personalizationCardStyle` | `'outlined' \| 'filled'` | Visual style for personalization cards |
122
+ | `allowPromoCodes` | `boolean` | Show promo code inputs in cart/checkout |
123
+ | `inputFieldStyle` | `'outlined' \| 'filled'` | Visual style for input fields |
124
+ | `showPoweredBy` | `boolean` | Show "Powered by LiquidCommerce" badge |
125
+ | `poweredByMode` | `'light' \| 'dark'` | Color mode for the powered-by badge |
126
+
127
+ **Example:**
128
+
129
+ ```javascript
130
+ customTheme: {
131
+ global: {
132
+ theme: {
133
+ primaryColor: '#007bff',
134
+ buttonCornerRadius: '8px',
135
+ headingFont: { name: 'Inter', weights: [400, 600, 700] }
136
+ },
137
+ layout: {
138
+ allowPromoCodes: true,
139
+ inputFieldStyle: 'outlined'
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ ---
146
+
147
+ ### Product Theme
148
+
149
+ #### IProductComponent
150
+
151
+ ```typescript
152
+ interface IProductComponent {
153
+ theme: IProductTheme;
154
+ layout: IProductLayout;
155
+ }
156
+ ```
157
+
158
+ #### IProductTheme
159
+
160
+ ```typescript
161
+ interface IProductTheme {
162
+ backgroundColor: string;
163
+ }
164
+ ```
165
+
166
+ #### IProductLayout
167
+
168
+ ```typescript
169
+ interface IProductLayout {
170
+ showImages: boolean;
171
+ showOnlyMainImage: boolean;
172
+ showTitle: boolean;
173
+ showDescription: boolean;
174
+ showQuantityCounter: boolean;
175
+ showOffHours: boolean;
176
+ quantityCounterStyle: 'outlined' | 'ghost';
177
+ fulfillmentDisplay: 'carousel' | 'popup';
178
+ enableShippingFulfillment: boolean;
179
+ enableOnDemandFulfillment: boolean;
180
+ addToCartButtonText: string;
181
+ addToCartButtonShowTotalPrice: boolean;
182
+ buyNowButtonText: string;
183
+ preSaleButtonText: string;
184
+ prioritizeEngraving: boolean;
185
+ noAvailabilityText: string;
186
+ }
187
+ ```
188
+
189
+ | Property | Type | Description |
190
+ |----------|------|-------------|
191
+ | `showImages` | `boolean` | Show product image carousel |
192
+ | `showOnlyMainImage` | `boolean` | Show only the main product image (no carousel) |
193
+ | `showTitle` | `boolean` | Show product title |
194
+ | `showDescription` | `boolean` | Show product description |
195
+ | `showQuantityCounter` | `boolean` | Show quantity selector |
196
+ | `showOffHours` | `boolean` | Show off-hours messaging |
197
+ | `quantityCounterStyle` | `'outlined' \| 'ghost'` | Visual style for quantity counter |
198
+ | `fulfillmentDisplay` | `'carousel' \| 'popup'` | How to display fulfillment/retailer options |
199
+ | `enableShippingFulfillment` | `boolean` | Enable shipping fulfillment option |
200
+ | `enableOnDemandFulfillment` | `boolean` | Enable on-demand delivery option |
201
+ | `addToCartButtonText` | `string` | Custom text for add-to-cart button |
202
+ | `addToCartButtonShowTotalPrice` | `boolean` | Show total price on add-to-cart button |
203
+ | `buyNowButtonText` | `string` | Custom text for buy-now button |
204
+ | `preSaleButtonText` | `string` | Custom text for pre-sale button |
205
+ | `prioritizeEngraving` | `boolean` | Show engraving option before add-to-cart |
206
+ | `noAvailabilityText` | `string` | Text shown when product is unavailable |
207
+
208
+ **Example:**
209
+
210
+ ```javascript
211
+ customTheme: {
212
+ product: {
213
+ layout: {
214
+ fulfillmentDisplay: 'popup',
215
+ addToCartButtonText: 'Add to Bag',
216
+ showQuantityCounter: true
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ### Cart Theme
225
+
226
+ #### ICartComponent
227
+
228
+ ```typescript
229
+ interface ICartComponent {
230
+ theme: ICartTheme;
231
+ layout: ICartLayout;
232
+ }
233
+ ```
234
+
235
+ #### ICartTheme
236
+
237
+ ```typescript
238
+ interface ICartTheme {
239
+ backgroundColor: string;
240
+ }
241
+ ```
242
+
243
+ #### ICartLayout
244
+
245
+ ```typescript
246
+ interface ICartLayout {
247
+ showQuantityCounter: boolean;
248
+ quantityCounterStyle: 'outlined' | 'ghost';
249
+ drawerHeaderText: string;
250
+ goToCheckoutButtonText: string;
251
+ }
252
+ ```
253
+
254
+ | Property | Type | Description |
255
+ |----------|------|-------------|
256
+ | `showQuantityCounter` | `boolean` | Show quantity counter in cart items |
257
+ | `quantityCounterStyle` | `'outlined' \| 'ghost'` | Visual style for quantity counter |
258
+ | `drawerHeaderText` | `string` | Header text for the cart drawer |
259
+ | `goToCheckoutButtonText` | `string` | Custom text for checkout button |
260
+
261
+ **Example:**
262
+
263
+ ```javascript
264
+ customTheme: {
265
+ cart: {
266
+ theme: { backgroundColor: '#f8f9fa' },
267
+ layout: {
268
+ drawerHeaderText: 'Your Bag',
269
+ goToCheckoutButtonText: 'Proceed to Checkout'
270
+ }
271
+ }
272
+ }
273
+ ```
274
+
275
+ ---
276
+
277
+ ### Checkout Theme
278
+
279
+ #### ICheckoutComponent
280
+
281
+ ```typescript
282
+ interface ICheckoutComponent {
283
+ theme: ICheckoutTheme;
284
+ layout: ICheckoutLayout;
285
+ }
286
+ ```
287
+
288
+ #### ICheckoutTheme
289
+
290
+ ```typescript
291
+ interface ICheckoutTheme {
292
+ backgroundColor: string;
293
+ }
294
+ ```
295
+
296
+ #### ICheckoutLayout
297
+
298
+ ```typescript
299
+ interface ICheckoutLayout {
300
+ emailOptIn: ICheckoutMarketingOptIn;
301
+ smsOptIn: ICheckoutMarketingOptIn;
302
+ allowGiftCards: boolean;
303
+ legalMessage: ICheckoutLegalMessage;
304
+ continueShoppingUrl: string;
305
+ exitUrl: string;
306
+ thankYouButtonText: string;
307
+ drawerHeaderText: string;
308
+ placeOrderButtonText: string;
309
+ checkoutCompleted: ICheckoutCompleted;
310
+ }
311
+ ```
312
+
313
+ | Property | Type | Description |
314
+ |----------|------|-------------|
315
+ | `emailOptIn` | `ICheckoutMarketingOptIn` | Email marketing opt-in configuration |
316
+ | `smsOptIn` | `ICheckoutMarketingOptIn` | SMS marketing opt-in configuration |
317
+ | `allowGiftCards` | `boolean` | Enable gift card payment option |
318
+ | `legalMessage` | `ICheckoutLegalMessage` | Legal/terms message configuration |
319
+ | `continueShoppingUrl` | `string` | URL for "Continue Shopping" link |
320
+ | `exitUrl` | `string` | URL for exit/back navigation |
321
+ | `thankYouButtonText` | `string` | Button text on order confirmation page |
322
+ | `drawerHeaderText` | `string` | Header text for checkout drawer |
323
+ | `placeOrderButtonText` | `string` | Custom text for place order button |
324
+ | `checkoutCompleted` | `ICheckoutCompleted` | Order confirmation page customization |
325
+
326
+ #### ICheckoutMarketingOptIn
327
+
328
+ ```typescript
329
+ interface ICheckoutMarketingOptIn {
330
+ show: boolean; // Show the opt-in checkbox
331
+ checked: boolean; // Default checked state
332
+ text: string; // Label text (supports rich HTML)
333
+ }
334
+ ```
335
+
336
+ #### ICheckoutLegalMessage
337
+
338
+ ```typescript
339
+ interface ICheckoutLegalMessage {
340
+ show: boolean; // Show the legal message
341
+ text: string; // Message content (supports rich HTML)
342
+ }
343
+ ```
344
+
345
+ #### ICheckoutCompleted
346
+
347
+ ```typescript
348
+ interface ICheckoutCompleted {
349
+ customLogo: string; // URL to custom logo image
350
+ customText: string | null; // Custom confirmation text
351
+ }
352
+ ```
353
+
354
+ **Example:**
355
+
356
+ ```javascript
357
+ customTheme: {
358
+ checkout: {
359
+ layout: {
360
+ placeOrderButtonText: 'Complete Purchase',
361
+ emailOptIn: { show: true, checked: false, text: 'Subscribe to our newsletter' },
362
+ legalMessage: { show: true, text: 'By placing this order, you agree to our <a href="/terms">Terms</a>.' }
363
+ }
364
+ }
365
+ }
366
+ ```
367
+
368
+ ---
369
+
370
+ ### Address Theme
371
+
372
+ #### IAddressComponent
373
+
374
+ ```typescript
375
+ interface IAddressComponent {
376
+ theme: IAddressTheme;
377
+ }
378
+ ```
379
+
380
+ #### IAddressTheme
381
+
382
+ ```typescript
383
+ interface IAddressTheme {
384
+ backgroundColor: string;
385
+ }
386
+ ```
387
+
388
+ ---
389
+
390
+ ### Product List Theme
391
+
392
+ #### IProductListComponent
393
+
394
+ ```typescript
395
+ interface IProductListComponent {
396
+ theme: IProductListTheme;
397
+ layout: IProductListLayout;
398
+ }
399
+ ```
400
+
401
+ Product list theme updates use a special structure where lists are keyed by slug:
402
+
403
+ ```typescript
404
+ interface UpdateProductListComponent {
405
+ theme?: { backgroundColor?: string };
406
+ layout?: {
407
+ lists?: Record<string, DeepPartial<IPLCList>>;
408
+ };
409
+ }
410
+ ```
411
+
412
+ **Example:**
413
+
414
+ ```javascript
415
+ customTheme: {
416
+ productList: {
417
+ theme: { backgroundColor: '#ffffff' },
418
+ layout: {
419
+ lists: {
420
+ 'best-sellers': {
421
+ productCard: {
422
+ style: 'card',
423
+ showPrice: true,
424
+ enablePreCart: true
425
+ }
426
+ }
427
+ }
428
+ }
429
+ }
430
+ }
431
+ ```
432
+
433
+ ---
434
+
435
+ ## Promo Ticker Configuration
436
+
437
+ ### IPromoTicker
438
+
439
+ ```typescript
440
+ interface IPromoTicker {
441
+ promoCode: string; // Promo code to auto-apply
442
+ text: string[]; // Array of messages to rotate
443
+ separator: string; // Separator between messages (e.g., '|')
444
+ activeFrom: string; // Start date in ISO 8601 UTC format
445
+ activeUntil: string; // End date in ISO 8601 UTC format
446
+ }
447
+ ```
448
+
449
+ **Example:**
450
+
451
+ ```javascript
452
+ promoTicker: [
453
+ {
454
+ promoCode: 'SUMMER20',
455
+ text: ['20% Off Summer Sale', 'Free Shipping on $50+'],
456
+ separator: '|',
457
+ activeFrom: '2026-06-01T00:00:00Z',
458
+ activeUntil: '2026-08-31T23:59:59Z'
459
+ }
460
+ ]
461
+ ```
462
+
463
+ ---
464
+
465
+ ## Checkout Configuration
466
+
467
+ ### ILiquidCommerceElementsCheckoutConfig
468
+
469
+ ```typescript
470
+ interface ILiquidCommerceElementsCheckoutConfig {
471
+ pageUrl?: string; // URL with {token} placeholder
472
+ }
473
+ ```
474
+
475
+ When `pageUrl` is set, the cart's checkout button redirects to this URL instead of opening the checkout drawer. Use `{token}` as a placeholder for the checkout session token.
476
+
477
+ **Example:**
478
+
479
+ ```javascript
480
+ checkout: {
481
+ pageUrl: 'https://yoursite.com/checkout?lce_checkout={token}'
482
+ }
483
+ ```
484
+
485
+ ---
486
+
487
+ ## Proxy Configuration
488
+
489
+ ### IElementsProxyConfig
490
+
491
+ ```typescript
492
+ interface IElementsProxyConfig {
493
+ baseUrl: string;
494
+ headers?: Record<string, string>;
495
+ }
496
+ ```
497
+
498
+ Route SDK API requests through your own server to avoid ad blockers.
499
+
500
+ See [Proxy Setup Guide](../integration/proxy-setup.md) for implementation details.
501
+
502
+ ---
503
+
504
+ ## Development Configuration
505
+
506
+ ### ILiquidCommerceElementsDevelopmentConfig
507
+
508
+ ```typescript
509
+ interface ILiquidCommerceElementsDevelopmentConfig {
510
+ customApiUrl?: string;
511
+ paymentMethodId?: string;
512
+ openShadowDom?: boolean;
513
+ }
514
+ ```
515
+
516
+ | Property | Type | Description |
517
+ |----------|------|-------------|
518
+ | `customApiUrl` | `string` | Custom API URL for local or custom backend testing |
519
+ | `paymentMethodId` | `string` | Hardcoded Stripe payment method ID for automated testing |
520
+ | `openShadowDom` | `boolean` | Disable Shadow DOM isolation for debugging (default: `false`) |
521
+
522
+ ---
523
+
524
+ ## See Also
525
+
526
+ - [Client API](./client.md) - Client initialization and usage
527
+ - [TypeScript Types](./typescript-types.md) - Complete type reference
528
+ - [Theming Guide](../guides/theming.md) - Theming best practices
@@ -126,6 +126,7 @@ injectProductList(params: IInjectProductListParams): Promise<void>
126
126
  ```typescript
127
127
  interface IInjectProductListParams {
128
128
  containerId: string;
129
+ slug: string; // Product list slug identifier
129
130
  rows?: number; // Default: 3
130
131
  columns?: number; // Default: 4
131
132
  filters?: ProductListFilterType[];
@@ -138,9 +139,10 @@ interface IInjectProductListParams {
138
139
  ```javascript
139
140
  await client.injectProductList({
140
141
  containerId: 'products',
142
+ slug: 'best-sellers',
141
143
  rows: 4,
142
144
  columns: 3,
143
- filters: ['price', 'brand', 'category'],
145
+ filters: ['price', 'brands', 'categories'],
144
146
  productUrl: '/product/{identifier}'
145
147
  });
146
148
  ```
@@ -162,6 +164,7 @@ injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>
162
164
  ```typescript
163
165
  interface IInjectProductListSearchParams {
164
166
  containerId: string;
167
+ slug: string; // Product list slug identifier
165
168
  }
166
169
  ```
167
170
 
@@ -169,7 +172,8 @@ interface IInjectProductListSearchParams {
169
172
 
170
173
  ```javascript
171
174
  await client.injectProductListSearch({
172
- containerId: 'search-box'
175
+ containerId: 'search-box',
176
+ slug: 'best-sellers'
173
177
  });
174
178
  ```
175
179
 
@@ -190,7 +194,8 @@ injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>
190
194
  ```typescript
191
195
  interface IInjectProductListFiltersParams {
192
196
  containerId: string;
193
- filters: ProductListFilterType[];
197
+ slug: string; // Product list slug identifier
198
+ filters?: ProductListFilterType[];
194
199
  }
195
200
  ```
196
201
 
@@ -199,7 +204,8 @@ interface IInjectProductListFiltersParams {
199
204
  ```javascript
200
205
  await client.injectProductListFilters({
201
206
  containerId: 'filters',
202
- filters: ['price', 'brand', 'fulfillment']
207
+ slug: 'best-sellers',
208
+ filters: ['price', 'brands', 'fulfillment']
203
209
  });
204
210
  ```
205
211
 
@@ -238,9 +244,17 @@ interface IInjectedComponent {
238
244
  getType(): ComponentType;
239
245
  getElement(): HTMLElement;
240
246
  rerender(): void;
247
+ destroy(): void;
241
248
  }
242
249
  ```
243
250
 
251
+ | Method | Returns | Description |
252
+ |--------|---------|-------------|
253
+ | `getType()` | `ComponentType` | Returns the type of the injected component |
254
+ | `getElement()` | `HTMLElement` | Returns the container element where the component is injected |
255
+ | `rerender()` | `void` | Re-renders the component with the latest data and configurations |
256
+ | `destroy()` | `void` | Removes the component from the DOM and cleans up internal tracking |
257
+
244
258
  ## See Also
245
259
 
246
260
  - [Client API](./client.md)