@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.
Files changed (81) hide show
  1. package/README.md +83 -2750
  2. package/dist/index.checkout.esm.js +6898 -6837
  3. package/dist/index.esm.js +11463 -10993
  4. package/dist/types/auto-initialize/shared-utils.d.ts +5 -0
  5. package/dist/types/constants/core.constant.d.ts +0 -4
  6. package/dist/types/core/base-component.service.d.ts +2 -1
  7. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +1 -0
  8. package/dist/types/enums/core.enum.d.ts +11 -0
  9. package/dist/types/interfaces/configs/product-list.interface.d.ts +2 -2
  10. package/dist/types/interfaces/core.interface.d.ts +5 -4
  11. package/dist/types/modules/address/address-input.component.d.ts +11 -0
  12. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  13. package/dist/types/modules/product-list/components/card-components/index.d.ts +3 -0
  14. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +8 -0
  15. package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +2 -0
  16. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
  17. package/dist/types/modules/product-list/components/card-components/product-title.d.ts +6 -0
  18. package/dist/types/modules/product-list/components/index.d.ts +1 -0
  19. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +5 -1
  20. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +28 -0
  21. package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +10 -2
  22. package/dist/types/modules/product-list/product-list-card.component.d.ts +0 -5
  23. package/dist/types/modules/product-list/product-list.commands.d.ts +11 -2
  24. package/dist/types/modules/product-list/product-list.interface.d.ts +1 -0
  25. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +11 -2
  26. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  27. package/dist/types/utils/dom-compat.d.ts +2 -0
  28. package/docs/gitbook/actions.md +964 -0
  29. package/docs/gitbook/address.md +48 -0
  30. package/docs/gitbook/cart.md +65 -0
  31. package/docs/gitbook/checkout.md +131 -0
  32. package/docs/gitbook/events.md +1765 -0
  33. package/docs/gitbook/overview.md +166 -0
  34. package/docs/gitbook/product.md +64 -0
  35. package/docs/gitbook/quick-start-guide.md +393 -0
  36. package/docs/v1/README.md +210 -0
  37. package/docs/v1/api/actions/address-actions.md +281 -0
  38. package/docs/v1/api/actions/cart-actions.md +337 -0
  39. package/docs/v1/api/actions/checkout-actions.md +387 -0
  40. package/docs/v1/api/actions/product-actions.md +115 -0
  41. package/docs/v1/api/client.md +482 -0
  42. package/docs/v1/api/configuration.md +1 -0
  43. package/docs/v1/api/injection-methods.md +247 -0
  44. package/docs/v1/api/typescript-types.md +1 -0
  45. package/docs/v1/api/ui-helpers.md +200 -0
  46. package/docs/v1/examples/advanced-patterns.md +96 -0
  47. package/docs/v1/examples/checkout-flow.md +91 -0
  48. package/docs/v1/examples/custom-theming.md +63 -0
  49. package/docs/v1/examples/multi-product-page.md +90 -0
  50. package/docs/v1/examples/simple-product-page.md +89 -0
  51. package/docs/v1/getting-started/concepts.md +507 -0
  52. package/docs/v1/getting-started/installation.md +328 -0
  53. package/docs/v1/getting-started/quick-start.md +405 -0
  54. package/docs/v1/guides/address-component.md +431 -0
  55. package/docs/v1/guides/best-practices.md +324 -0
  56. package/docs/v1/guides/cart-component.md +737 -0
  57. package/docs/v1/guides/checkout-component.md +672 -0
  58. package/docs/v1/guides/events.md +926 -0
  59. package/docs/v1/guides/product-component.md +686 -0
  60. package/docs/v1/guides/product-list-component.md +598 -0
  61. package/docs/v1/guides/theming.md +216 -0
  62. package/docs/v1/integration/angular.md +39 -0
  63. package/docs/v1/integration/laravel.md +41 -0
  64. package/docs/v1/integration/nextjs.md +60 -0
  65. package/docs/v1/integration/proxy-setup.md +89 -0
  66. package/docs/v1/integration/react.md +64 -0
  67. package/docs/v1/integration/vanilla-js.md +84 -0
  68. package/docs/v1/integration/vue.md +34 -0
  69. package/docs/v1/reference/browser-support.md +44 -0
  70. package/docs/v1/reference/error-handling.md +70 -0
  71. package/docs/v1/reference/performance.md +54 -0
  72. package/docs/v1/reference/troubleshooting.md +64 -0
  73. package/package.json +1 -1
  74. package/docs/ACTIONS.md +0 -1301
  75. package/docs/BROWSER_SUPPORT.md +0 -279
  76. package/docs/CONFIGURATION.md +0 -997
  77. package/docs/DOCUMENTATION_INDEX.md +0 -319
  78. package/docs/EVENTS.md +0 -798
  79. package/docs/PROXY.md +0 -228
  80. package/docs/THEMING.md +0 -681
  81. package/docs/TROUBLESHOOTING.md +0 -793
@@ -0,0 +1,964 @@
1
+ # Actions
2
+
3
+ Actions let you control Elements programmatically after the SDK initializes. All actions live under `window.elements.actions.*`.
4
+
5
+ ## Quick start
6
+
7
+ ```js
8
+ window.addEventListener('lce:actions.client_ready', () => {
9
+ window.elements.actions.cart.openCart();
10
+ });
11
+ ```
12
+
13
+ ## Product actions
14
+
15
+ ### `actions.product.getDetails(identifier)`
16
+
17
+ Returns the current loaded product data (price, size, fulfillment, retailer, quantity, images, and more). The product must already be injected and loaded.
18
+
19
+ **Signature**
20
+
21
+ ```ts
22
+ getDetails(identifier: string): IBaseProductEventData
23
+ ```
24
+
25
+ **Return shape (TypeScript)**
26
+
27
+ ```ts
28
+ export type FulfillmentType = 'onDemand' | 'shipping';
29
+
30
+ export interface IBaseProductEventData {
31
+ identifier: string;
32
+ selectedSizeId: string | null;
33
+ selectedFulfillmentType: FulfillmentType;
34
+ selectedFulfillmentId: string | null;
35
+ productHasAvailability: boolean;
36
+ fulfillmentHasAvailability: boolean;
37
+ sizes: Record<string, IProductSizeEventData>;
38
+
39
+ id: string;
40
+ name: string;
41
+ description: string;
42
+ htmlDescription: string;
43
+ images: string[];
44
+ brand: string;
45
+ region: string;
46
+ country: string;
47
+ material: string;
48
+ abv: string;
49
+ proof: string;
50
+ age: string;
51
+ color: string;
52
+ flavor: string;
53
+ variety: string;
54
+ appellation: string;
55
+ vintage: string;
56
+ tastingNotes: string;
57
+ catPath: string;
58
+ category: string;
59
+ classification: string;
60
+ type: string;
61
+ subType: string;
62
+ salsifyGrouping: string;
63
+ noAvailabilityPrice: number;
64
+ }
65
+
66
+ export interface IProductSizeEventData {
67
+ id: string;
68
+ upc: string;
69
+ size: string;
70
+ pack: boolean;
71
+ packDesc: string;
72
+ container: string;
73
+ containerType: string;
74
+ image: string;
75
+ uom: string;
76
+ volume: string;
77
+ maxQuantityPerOrder: number;
78
+ attributes: IProductSizeAttributes;
79
+ onDemandFulfillments: Record<string, IProductFulfillmentEventData>;
80
+ shippingFulfillments: Record<string, IProductFulfillmentEventData>;
81
+ }
82
+
83
+ export interface IProductSizeAttributes {
84
+ presale: IProductPresale;
85
+ engraving: IProductSizeEngraving;
86
+ }
87
+
88
+ export interface IProductSizeEngraving {
89
+ maxLines: number;
90
+ maxCharsPerLine: number;
91
+ fee: number;
92
+ location: string;
93
+ }
94
+
95
+ export interface IProductPresale {
96
+ canPurchaseOn: string | null;
97
+ estimatedShipBy: string | null;
98
+ isActive: boolean;
99
+ language: string;
100
+ }
101
+
102
+ export interface IProductFulfillmentEventData {
103
+ id: string;
104
+ type: FulfillmentType;
105
+ doesAllowGiftCards: boolean;
106
+ doesAllowPromos: boolean;
107
+ expectation: string;
108
+ engravingExpectation: string;
109
+ fee: number;
110
+ timezone: string;
111
+ hourStatus: IProductFulfillmentHourStatus;
112
+ retailerName: string;
113
+ retailerAddress: IRetailerAddress;
114
+ retailerAddressFormatted: string;
115
+ variant: IProductVariant;
116
+ }
117
+
118
+ export interface IProductFulfillmentHourStatus {
119
+ isOpen: boolean;
120
+ openTime: string;
121
+ isClosed: boolean;
122
+ closeTime: string;
123
+ }
124
+
125
+ export interface IProductVariant {
126
+ retailerId: string;
127
+ shippingFulfillmentId: string;
128
+ onDemandFulfillmentId: string;
129
+ isEngravable: boolean;
130
+ partNumber: string;
131
+ price: number;
132
+ stock: number;
133
+ }
134
+
135
+ export type IRetailerAddress = IAddressAddress & IAddressCoordinates;
136
+
137
+ export interface IAddressAddress {
138
+ one: string;
139
+ two: string;
140
+ city: string;
141
+ state: string;
142
+ zip: string;
143
+ country: string;
144
+ }
145
+
146
+ export interface IAddressCoordinates {
147
+ latitude: number;
148
+ longitude: number;
149
+ }
150
+ ```
151
+
152
+ **Example**
153
+
154
+ ```js
155
+ const product = window.elements.actions.product.getDetails('00619947000020');
156
+ console.log(product.name, product.price / 100);
157
+ ```
158
+
159
+ ## Cart actions
160
+
161
+ ### `actions.cart.openCart()`
162
+
163
+ Opens the cart drawer.
164
+
165
+ **Signature**
166
+
167
+ ```ts
168
+ openCart(): void
169
+ ```
170
+
171
+ **Example**
172
+
173
+ ```js
174
+ window.elements.actions.cart.openCart();
175
+ ```
176
+
177
+ ### `actions.cart.closeCart()`
178
+
179
+ Closes the cart drawer.
180
+
181
+ **Signature**
182
+
183
+ ```ts
184
+ closeCart(): void
185
+ ```
186
+
187
+ **Example**
188
+
189
+ ```js
190
+ window.elements.actions.cart.closeCart();
191
+ ```
192
+
193
+ ### `actions.cart.toggleCart()`
194
+
195
+ Toggles the cart drawer open/closed.
196
+
197
+ **Signature**
198
+
199
+ ```ts
200
+ toggleCart(): void
201
+ ```
202
+
203
+ **Example**
204
+
205
+ ```js
206
+ document.getElementById('cart-btn').addEventListener('click', () => {
207
+ window.elements.actions.cart.toggleCart();
208
+ });
209
+ ```
210
+
211
+ ### `actions.cart.addProduct(params[], openCart?)`
212
+
213
+ Adds one or more products to the cart. If no address is set, the SDK prompts for one and retries automatically.
214
+
215
+ **Signature**
216
+
217
+ ```ts
218
+ addProduct(params: IAddProductParams[], openCart?: boolean): Promise<void>
219
+ ```
220
+
221
+ **Parameters (TypeScript)**
222
+
223
+ ```ts
224
+ export type FulfillmentType = 'onDemand' | 'shipping';
225
+
226
+ export interface IAddProductParams {
227
+ identifier: string;
228
+ fulfillmentType: FulfillmentType;
229
+ quantity: number;
230
+ }
231
+ ```
232
+
233
+ **Example**
234
+
235
+ ```js
236
+ await window.elements.actions.cart.addProduct([
237
+ { identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 },
238
+ { identifier: '08504405135', fulfillmentType: 'onDemand', quantity: 2 }
239
+ ], true);
240
+ ```
241
+
242
+ ### `actions.cart.applyPromoCode(promoCode)`
243
+
244
+ Applies a promo code to the cart (replaces any existing code).
245
+
246
+ **Signature**
247
+
248
+ ```ts
249
+ applyPromoCode(promoCode: string): Promise<void>
250
+ ```
251
+
252
+ **Example**
253
+
254
+ ```js
255
+ try {
256
+ await window.elements.actions.cart.applyPromoCode('SUMMER20');
257
+ } catch (error) {
258
+ console.error('Promo code invalid:', error);
259
+ }
260
+ ```
261
+
262
+ ### `actions.cart.removePromoCode()`
263
+
264
+ Removes the active promo code.
265
+
266
+ **Signature**
267
+
268
+ ```ts
269
+ removePromoCode(): Promise<void>
270
+ ```
271
+
272
+ **Example**
273
+
274
+ ```js
275
+ await window.elements.actions.cart.removePromoCode();
276
+ ```
277
+
278
+ ### `actions.cart.resetCart()`
279
+
280
+ Clears all cart items (no undo).
281
+
282
+ **Signature**
283
+
284
+ ```ts
285
+ resetCart(): Promise<void>
286
+ ```
287
+
288
+ **Example**
289
+
290
+ ```js
291
+ await window.elements.actions.cart.resetCart();
292
+ ```
293
+
294
+ ### `actions.cart.getDetails()`
295
+
296
+ Returns current cart data (items, totals, promo, retailers, location, etc.).
297
+
298
+ **Signature**
299
+
300
+ ```ts
301
+ getDetails(): IBaseCartEventData
302
+ ```
303
+
304
+ **Return shape (TypeScript)**
305
+
306
+ ```ts
307
+ export type FulfillmentType = 'onDemand' | 'shipping';
308
+
309
+ export interface IBaseCartEventData {
310
+ cartId: string;
311
+ promoCodeDiscount: number | null;
312
+ subtotal: number;
313
+ itemCount: number;
314
+ items: Record<string, ICartItem>;
315
+ retailers: Record<string, ICartRetailer>;
316
+ location: {
317
+ placesId: string;
318
+ formattedAddress: string;
319
+ address: IAddressAddress;
320
+ coordinates: IAddressCoordinates;
321
+ } | null;
322
+ }
323
+
324
+ export interface ICartItem {
325
+ id: string;
326
+ variantId: string;
327
+ liquidId: string;
328
+ retailerId: string;
329
+ partNumber: string;
330
+ fulfillmentId: string;
331
+ upc: string;
332
+ sku: string;
333
+ salsifyGrouping: string;
334
+ catPath: string;
335
+ volume: string;
336
+ uom: string;
337
+ pack: boolean;
338
+ packDesc: string;
339
+ container: string;
340
+ containerType: string;
341
+ name: string;
342
+ brand: string;
343
+ size: string;
344
+ price: number;
345
+ quantity: number;
346
+ maxQuantity: number;
347
+ unitPrice: number;
348
+ mainImage: string;
349
+ attributes: ICartItemAttributes;
350
+ }
351
+
352
+ export interface ICartItemAttributes {
353
+ engraving: ICartItemEngraving;
354
+ presale: IProductPresale;
355
+ }
356
+
357
+ export interface ICartItemEngraving {
358
+ isEngravable: boolean;
359
+ hasEngraving: boolean;
360
+ fee: number;
361
+ maxCharsPerLine: number;
362
+ maxLines: number;
363
+ location: string;
364
+ lines: string[];
365
+ }
366
+
367
+ export interface IProductPresale {
368
+ canPurchaseOn: string | null;
369
+ estimatedShipBy: string | null;
370
+ isActive: boolean;
371
+ language: string;
372
+ }
373
+
374
+ export interface ICartRetailer {
375
+ id: string;
376
+ name: string;
377
+ subtotal: number;
378
+ itemsQuantity: number;
379
+ fulfillments: Record<string, ICartFulfillment>;
380
+ }
381
+
382
+ export interface ICartFulfillment {
383
+ id: string;
384
+ canEngrave: boolean;
385
+ type: FulfillmentType;
386
+ expectation: string;
387
+ engravingExpectation: string;
388
+ itemIds: string[];
389
+ subtotal: number;
390
+ hasUnmetMinimumPurchaseAmount: boolean;
391
+ minimumPurchaseAmount: number;
392
+ }
393
+
394
+ export interface IAddressAddress {
395
+ one: string;
396
+ two: string;
397
+ city: string;
398
+ state: string;
399
+ zip: string;
400
+ country: string;
401
+ }
402
+
403
+ export interface IAddressCoordinates {
404
+ latitude: number;
405
+ longitude: number;
406
+ }
407
+ ```
408
+
409
+ **Example**
410
+
411
+ ```js
412
+ const cart = window.elements.actions.cart.getDetails();
413
+ console.log(cart.cartId, cart.itemCount, cart.subtotal / 100);
414
+ ```
415
+
416
+ ## Checkout actions
417
+
418
+ ### `actions.checkout.openCheckout()`
419
+
420
+ Opens the checkout drawer or navigates to checkout.
421
+
422
+ **Signature**
423
+
424
+ ```ts
425
+ openCheckout(): void
426
+ ```
427
+
428
+ **Example**
429
+
430
+ ```js
431
+ window.elements.actions.checkout.openCheckout();
432
+ ```
433
+
434
+ ### `actions.checkout.closeCheckout()`
435
+
436
+ Closes the checkout drawer.
437
+
438
+ **Signature**
439
+
440
+ ```ts
441
+ closeCheckout(): void
442
+ ```
443
+
444
+ **Example**
445
+
446
+ ```js
447
+ window.elements.actions.checkout.closeCheckout();
448
+ ```
449
+
450
+ ### `actions.checkout.toggleCheckout()`
451
+
452
+ Toggles the checkout drawer open/closed.
453
+
454
+ **Signature**
455
+
456
+ ```ts
457
+ toggleCheckout(): void
458
+ ```
459
+
460
+ **Example**
461
+
462
+ ```js
463
+ window.elements.actions.checkout.toggleCheckout();
464
+ ```
465
+
466
+ ### `actions.checkout.exitCheckout()`
467
+
468
+ Navigates away from checkout (requires `exitUrl` configuration).
469
+
470
+ **Signature**
471
+
472
+ ```ts
473
+ exitCheckout(): void
474
+ ```
475
+
476
+ **Example**
477
+
478
+ ```js
479
+ window.elements.actions.checkout.exitCheckout();
480
+ ```
481
+
482
+ ### `actions.checkout.addProduct(params[], openCheckout?)`
483
+
484
+ Adds products directly to checkout (bypasses cart).
485
+
486
+ **Signature**
487
+
488
+ ```ts
489
+ addProduct(params: IAddProductParams[], openCheckout?: boolean): Promise<void>
490
+ ```
491
+
492
+ **Parameters (TypeScript)**
493
+
494
+ ```ts
495
+ export type FulfillmentType = 'onDemand' | 'shipping';
496
+
497
+ export interface IAddProductParams {
498
+ identifier: string;
499
+ fulfillmentType: FulfillmentType;
500
+ quantity: number;
501
+ }
502
+ ```
503
+
504
+ **Example**
505
+
506
+ ```js
507
+ await window.elements.actions.checkout.addProduct([
508
+ { identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 }
509
+ ], true);
510
+ ```
511
+
512
+ ### `actions.checkout.applyPromoCode(promoCode)`
513
+
514
+ Applies a promo code in checkout.
515
+
516
+ **Signature**
517
+
518
+ ```ts
519
+ applyPromoCode(promoCode: string): Promise<void>
520
+ ```
521
+
522
+ **Example**
523
+
524
+ ```js
525
+ await window.elements.actions.checkout.applyPromoCode('WELCOME10');
526
+ ```
527
+
528
+ ### `actions.checkout.removePromoCode()`
529
+
530
+ Removes the active promo code in checkout.
531
+
532
+ **Signature**
533
+
534
+ ```ts
535
+ removePromoCode(): Promise<void>
536
+ ```
537
+
538
+ **Example**
539
+
540
+ ```js
541
+ await window.elements.actions.checkout.removePromoCode();
542
+ ```
543
+
544
+ ### `actions.checkout.applyGiftCard(code)`
545
+
546
+ Applies a gift card.
547
+
548
+ **Signature**
549
+
550
+ ```ts
551
+ applyGiftCard(code: string): Promise<void>
552
+ ```
553
+
554
+ **Example**
555
+
556
+ ```js
557
+ await window.elements.actions.checkout.applyGiftCard('GIFT-1234-5678-9012');
558
+ ```
559
+
560
+ ### `actions.checkout.removeGiftCard(code)`
561
+
562
+ Removes a gift card.
563
+
564
+ **Signature**
565
+
566
+ ```ts
567
+ removeGiftCard(code: string): Promise<void>
568
+ ```
569
+
570
+ **Example**
571
+
572
+ ```js
573
+ await window.elements.actions.checkout.removeGiftCard('GIFT-1234-5678-9012');
574
+ ```
575
+
576
+ ### `actions.checkout.toggleIsGift(active?)`
577
+
578
+ Enables/disables gift mode (toggles when omitted).
579
+
580
+ **Signature**
581
+
582
+ ```ts
583
+ toggleIsGift(active?: boolean): Promise<void>
584
+ ```
585
+
586
+ **Example**
587
+
588
+ ```js
589
+ await window.elements.actions.checkout.toggleIsGift(true);
590
+ ```
591
+
592
+ ### `actions.checkout.toggleBillingSameAsShipping(active?)`
593
+
594
+ Sets whether billing address matches shipping.
595
+
596
+ **Signature**
597
+
598
+ ```ts
599
+ toggleBillingSameAsShipping(active?: boolean): Promise<void>
600
+ ```
601
+
602
+ **Example**
603
+
604
+ ```js
605
+ await window.elements.actions.checkout.toggleBillingSameAsShipping(false);
606
+ ```
607
+
608
+ ### `actions.checkout.toggleMarketingPreferences(field, active)`
609
+
610
+ Sets marketing opt-in (`canEmail` or `canSms`).
611
+
612
+ **Signature**
613
+
614
+ ```ts
615
+ toggleMarketingPreferences(field: 'canEmail' | 'canSms', active: boolean): Promise<void>
616
+ ```
617
+
618
+ **Example**
619
+
620
+ ```js
621
+ await window.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
622
+ ```
623
+
624
+ ### `actions.checkout.updateCustomerInfo(fields)`
625
+
626
+ Prefills customer info (name, email, phone, birthdate, etc.).
627
+
628
+ **Signature**
629
+
630
+ ```ts
631
+ updateCustomerInfo(params: Record<CustomerFieldName, string>): void
632
+ ```
633
+
634
+ **Parameters (TypeScript)**
635
+
636
+ ```ts
637
+ export type CustomerFieldName =
638
+ | 'firstName'
639
+ | 'lastName'
640
+ | 'email'
641
+ | 'phone'
642
+ | 'birthDate'
643
+ | 'addressTwo'
644
+ | 'company';
645
+ ```
646
+
647
+ **Example**
648
+
649
+ ```js
650
+ window.elements.actions.checkout.updateCustomerInfo({
651
+ firstName: 'John',
652
+ lastName: 'Doe',
653
+ email: 'john@example.com',
654
+ phone: '+15551234567'
655
+ });
656
+ ```
657
+
658
+ ### `actions.checkout.updateBillingInfo(fields)`
659
+
660
+ Prefills billing address fields.
661
+
662
+ **Signature**
663
+
664
+ ```ts
665
+ updateBillingInfo(params: Record<BillingFieldName, string>): void
666
+ ```
667
+
668
+ **Parameters (TypeScript)**
669
+
670
+ ```ts
671
+ export type BillingFieldName =
672
+ | 'firstName'
673
+ | 'lastName'
674
+ | 'email'
675
+ | 'phone'
676
+ | 'company'
677
+ | 'addressOne'
678
+ | 'addressTwo'
679
+ | 'city'
680
+ | 'state'
681
+ | 'zipCode';
682
+ ```
683
+
684
+ **Example**
685
+
686
+ ```js
687
+ window.elements.actions.checkout.updateBillingInfo({
688
+ firstName: 'John',
689
+ lastName: 'Doe',
690
+ addressOne: '789 Elm St',
691
+ city: 'Chicago',
692
+ state: 'IL',
693
+ zipCode: '60601'
694
+ });
695
+ ```
696
+
697
+ ### `actions.checkout.updateGiftInfo(fields)`
698
+
699
+ Prefills gift recipient information.
700
+
701
+ **Signature**
702
+
703
+ ```ts
704
+ updateGiftInfo(params: Record<GiftFieldName, string>): void
705
+ ```
706
+
707
+ **Parameters (TypeScript)**
708
+
709
+ ```ts
710
+ export type GiftFieldName =
711
+ | 'firstName'
712
+ | 'lastName'
713
+ | 'email'
714
+ | 'phone'
715
+ | 'addressTwo'
716
+ | 'message';
717
+ ```
718
+
719
+ **Example**
720
+
721
+ ```js
722
+ window.elements.actions.checkout.updateGiftInfo({
723
+ firstName: 'Jane',
724
+ lastName: 'Smith',
725
+ message: 'Happy Birthday!'
726
+ });
727
+ ```
728
+
729
+ ### `actions.checkout.getDetails()`
730
+
731
+ Returns current checkout data (amounts, items, preferences, addresses, gift info, etc.).
732
+
733
+ **Signature**
734
+
735
+ ```ts
736
+ getDetails(): ICheckoutDetailsEventData
737
+ ```
738
+
739
+ **Return shape (TypeScript)**
740
+
741
+ ```ts
742
+ export interface ICheckoutDetailsEventData {
743
+ token: string;
744
+ cartId: string;
745
+ isGift: boolean;
746
+ billingSameAsShipping: boolean;
747
+ marketingPreferences: ICheckoutMarketingPreferences;
748
+ hasPromoCode: boolean;
749
+ hasGiftCards: boolean;
750
+ amounts: ICheckoutAmounts;
751
+ itemCount: number;
752
+ items: Record<string, ICheckoutItem>;
753
+ }
754
+
755
+ export interface ICheckoutMarketingPreferences {
756
+ canEmail: boolean;
757
+ canSms: boolean;
758
+ }
759
+
760
+ export interface ICheckoutAmounts {
761
+ subtotal: number;
762
+ engraving: number;
763
+ service: number;
764
+ shipping: number;
765
+ delivery: number;
766
+ platform: number;
767
+ discounts: number;
768
+ giftCards: number;
769
+ tax: number;
770
+ tip: number;
771
+ total: number;
772
+ }
773
+
774
+ export interface ICheckoutItem {
775
+ variantId: string;
776
+ cartItemId: string;
777
+ liquidId: string;
778
+ retailerId: string;
779
+ fulfillmentId: string;
780
+ salsifyPid?: string;
781
+ salsifyGrouping?: string;
782
+ name: string;
783
+ catPath: string;
784
+ volume: string;
785
+ uom: string;
786
+ proof: string;
787
+ abv: string;
788
+ containerType: string;
789
+ container: string;
790
+ size: string;
791
+ pack: boolean;
792
+ packDesc: string;
793
+ mainImage: string;
794
+ brand: string;
795
+ partNumber: string;
796
+ upc: string;
797
+ sku: string;
798
+ price: number;
799
+ unitPrice: number;
800
+ quantity: number;
801
+ tax: number;
802
+ unitTax: number;
803
+ bottleDeposits: number;
804
+ attributes: ICheckoutItemAttributes;
805
+ }
806
+
807
+ export interface ICheckoutItemAttributes {
808
+ engraving: ICheckoutItemEngraving;
809
+ presale: IProductPresale;
810
+ }
811
+
812
+ export interface ICheckoutItemEngraving {
813
+ isEngravable: boolean;
814
+ hasEngraving: boolean;
815
+ fee: number;
816
+ maxCharsPerLine: number;
817
+ maxLines: number;
818
+ location: string;
819
+ lines: string[];
820
+ }
821
+
822
+ export interface IProductPresale {
823
+ canPurchaseOn: string | null;
824
+ estimatedShipBy: string | null;
825
+ isActive: boolean;
826
+ language: string;
827
+ }
828
+ ```
829
+
830
+ **Example**
831
+
832
+ ```js
833
+ const checkout = window.elements.actions.checkout.getDetails();
834
+ console.log(checkout.cartId, checkout.amounts.total / 100);
835
+ ```
836
+
837
+ ## Address actions
838
+
839
+ ### `actions.address.setAddressByPlacesId(placesId)`
840
+
841
+ Sets address using a Google Places ID (recommended).
842
+
843
+ **Signature**
844
+
845
+ ```ts
846
+ setAddressByPlacesId(placesId: string): Promise<void>
847
+ ```
848
+
849
+ **Example**
850
+
851
+ ```js
852
+ await window.elements.actions.address.setAddressByPlacesId('ChIJOwg_06VPwokRYv534QaPC8g');
853
+ ```
854
+
855
+ ### `actions.address.setAddressManually(address, coordinates)`
856
+
857
+ Sets address with your own address + lat/long data.
858
+
859
+ **Signature**
860
+
861
+ ```ts
862
+ setAddressManually(address: IAddressAddress, coordinates: IAddressCoordinates): Promise<void>
863
+ ```
864
+
865
+ **Parameters (TypeScript)**
866
+
867
+ ```ts
868
+ export interface IAddressAddress {
869
+ one: string;
870
+ two: string;
871
+ city: string;
872
+ state: string;
873
+ zip: string;
874
+ country: string;
875
+ }
876
+
877
+ export interface IAddressCoordinates {
878
+ latitude: number;
879
+ longitude: number;
880
+ }
881
+ ```
882
+
883
+ **Example**
884
+
885
+ ```js
886
+ await window.elements.actions.address.setAddressManually(
887
+ { one: '123 Main Street', city: 'New York', state: 'NY', zip: '10001' },
888
+ { latitude: 40.7128, longitude: -74.0060 }
889
+ );
890
+ ```
891
+
892
+ ### `actions.address.getDetails()`
893
+
894
+ Returns the current address (or `null` if not set).
895
+
896
+ **Signature**
897
+
898
+ ```ts
899
+ getDetails(): IAddressData | null
900
+ ```
901
+
902
+ **Return shape (TypeScript)**
903
+
904
+ ```ts
905
+ export interface IAddressData {
906
+ id: string;
907
+ formattedAddress: string;
908
+ address: IAddressAddress;
909
+ coordinates: IAddressCoordinates;
910
+ }
911
+
912
+ export interface IAddressAddress {
913
+ one: string;
914
+ two: string;
915
+ city: string;
916
+ state: string;
917
+ zip: string;
918
+ country: string;
919
+ }
920
+
921
+ export interface IAddressCoordinates {
922
+ latitude: number;
923
+ longitude: number;
924
+ }
925
+ ```
926
+
927
+ **Example**
928
+
929
+ ```js
930
+ const address = window.elements.actions.address.getDetails();
931
+ console.log(address?.formattedAddress);
932
+ ```
933
+
934
+ ### `actions.address.clear()`
935
+
936
+ Removes the stored address and resets availability.
937
+
938
+ **Signature**
939
+
940
+ ```ts
941
+ clear(): Promise<void>
942
+ ```
943
+
944
+ **Example**
945
+
946
+ ```js
947
+ await window.elements.actions.address.clear();
948
+ ```
949
+
950
+ ## UI helpers (non-actions)
951
+
952
+ These helpers live under `window.elements.ui.*` and are commonly used with actions.
953
+
954
+ - `ui.cartButton(containerId, showItemsCount?)` - Renders a cart button inside the given container.
955
+ - `ui.floatingCartButton(showItemsCount?)` - Renders a floating cart button (bottom-right).
956
+ - `ui.cartSubtotal(elementId)` - Keeps an element updated with cart subtotal.
957
+ - `ui.cartItemsCount(elementId, { hideZero })` - Keeps an element updated with cart item count.
958
+
959
+ ```js
960
+ window.elements.ui.cartButton('header-cart', true);
961
+ window.elements.ui.floatingCartButton(true);
962
+ window.elements.ui.cartSubtotal('cart-total');
963
+ window.elements.ui.cartItemsCount('items-count', { hideZero: true });
964
+ ```