@liquidcommerce/elements-sdk 2.7.36 → 2.7.38
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/dist/index.checkout.esm.js +8211 -7806
- package/dist/index.esm.js +12503 -12095
- package/dist/types/core/client/actions/client-checkout-action.service.d.ts +8 -2
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +26 -1
- package/dist/types/modules/checkout/components/checkout-order-summary.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +4 -0
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +3 -0
- package/dist/types/modules/checkout/customer-prefill.d.ts +2 -0
- package/dist/types/modules/product/components/product-retailers-popup.component.d.ts +1 -0
- package/docs/v1/api/actions/checkout-actions.md +58 -1
- package/docs/v1/api/typescript-types.md +57 -0
- package/docs/v1/guides/accessibility.md +24 -7
- package/docs/v1/guides/checkout-component.md +57 -0
- package/package.json +9 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
2
|
-
import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse } from '@/interfaces/api/checkout.interface';
|
|
2
|
+
import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse, ICheckoutMarketingPreferences } from '@/interfaces/api/checkout.interface';
|
|
3
3
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
4
4
|
import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/constant';
|
|
5
5
|
import { BaseActionService } from './base-action.service';
|
|
@@ -20,6 +20,8 @@ export interface ICheckoutActions {
|
|
|
20
20
|
exitCheckout: () => void;
|
|
21
21
|
setSavedPaymentMethod: (params: ISavedPaymentMethodInput) => void;
|
|
22
22
|
clearSavedPaymentMethod: () => void;
|
|
23
|
+
setSavedMarketingPreferences: (preferences: Partial<ICheckoutMarketingPreferences>) => Promise<void>;
|
|
24
|
+
clearSavedMarketingPreferences: () => void;
|
|
23
25
|
addProduct: (params: IAddProductParams[], openCheckout?: boolean) => Promise<void>;
|
|
24
26
|
applyPromoCode: (promoCode: string) => Promise<void>;
|
|
25
27
|
removePromoCode: () => Promise<void>;
|
|
@@ -28,7 +30,9 @@ export interface ICheckoutActions {
|
|
|
28
30
|
toggleIsGift: (active?: boolean) => Promise<void>;
|
|
29
31
|
toggleBillingSameAsShipping: (active?: boolean) => Promise<void>;
|
|
30
32
|
toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => Promise<void>;
|
|
31
|
-
updateCustomerInfo: (params: Record<CustomerFieldName, string
|
|
33
|
+
updateCustomerInfo: (params: Record<CustomerFieldName, string>, options?: {
|
|
34
|
+
saveIfValid?: boolean;
|
|
35
|
+
}) => Promise<void>;
|
|
32
36
|
updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
|
|
33
37
|
updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
|
|
34
38
|
getDetails: () => ICheckoutDetailsEventData;
|
|
@@ -59,6 +63,8 @@ export declare class ClientCheckoutActionService extends BaseActionService {
|
|
|
59
63
|
private removeGiftCard;
|
|
60
64
|
private toggleIsGift;
|
|
61
65
|
private toggleBillingSameAsShipping;
|
|
66
|
+
private setSavedMarketingPreferences;
|
|
67
|
+
private clearSavedMarketingPreferences;
|
|
62
68
|
private toggleMarketingPreferences;
|
|
63
69
|
private updateCustomerInfo;
|
|
64
70
|
private updateBillingInfo;
|
|
@@ -36,6 +36,7 @@ export interface ICheckoutStore {
|
|
|
36
36
|
presale: ICheckoutPresale | null;
|
|
37
37
|
isGift: boolean;
|
|
38
38
|
marketingPreferences: ICheckoutMarketingPreferences;
|
|
39
|
+
appliedSavedMarketingPreferences: Partial<ICheckoutMarketingPreferences>;
|
|
39
40
|
customerForm: ICheckoutCustomerFormStore;
|
|
40
41
|
giftRecipientForm: ICheckoutGiftRecipientFormStore;
|
|
41
42
|
paymentForm: ICheckoutPaymentFormStore;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
2
|
import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
3
3
|
import type { ICheckoutPaymentMethodStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
|
-
import type { ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient, ICheckoutPrepare } from '@/interfaces/api/checkout.interface';
|
|
4
|
+
import type { ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPrepare } from '@/interfaces/api/checkout.interface';
|
|
5
5
|
import type { AddItemParams } from '@/modules/cart/cart.commands';
|
|
6
6
|
import type { PresaleExpiredReason } from '@/modules/checkout/components';
|
|
7
7
|
export declare class CheckoutCommands extends BaseCommand {
|
|
8
8
|
private readonly uiCommands;
|
|
9
9
|
private lastLoadParams;
|
|
10
10
|
private paymentGeneration;
|
|
11
|
+
private savedMarketingPreferences;
|
|
12
|
+
private savedMarketingRevision;
|
|
13
|
+
private marketingNeedsPrepare;
|
|
14
|
+
private completingCheckout;
|
|
15
|
+
private savedMarketingError;
|
|
16
|
+
private marketingEdits;
|
|
17
|
+
private marketingQueue;
|
|
18
|
+
private readonly marketingFields;
|
|
19
|
+
private customerEditRevision;
|
|
20
|
+
private customerEditedGeneration;
|
|
11
21
|
private confirmedPayment;
|
|
12
22
|
assertPaymentReady(): void;
|
|
13
23
|
retryLoadCheckout(): Promise<void>;
|
|
@@ -23,6 +33,17 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
23
33
|
loadCheckoutFromResponse(response: ICheckoutPrepare): void;
|
|
24
34
|
toggleIsGift(active?: boolean): Promise<void>;
|
|
25
35
|
toggleBillingSameAsShipping(active?: boolean): Promise<void>;
|
|
36
|
+
private loadedMarketingState;
|
|
37
|
+
private defaultMarketingPreferences;
|
|
38
|
+
private marketingForPrepare;
|
|
39
|
+
private confirmedSavedMarketing;
|
|
40
|
+
private queueMarketing;
|
|
41
|
+
setSavedMarketingPreferences(preferences: Partial<ICheckoutMarketingPreferences>): Promise<void>;
|
|
42
|
+
clearSavedMarketingPreferences(): void;
|
|
43
|
+
private recordSavedMarketing;
|
|
44
|
+
private assertMarketingRestored;
|
|
45
|
+
private canApplySavedMarketing;
|
|
46
|
+
private applySavedMarketingPreferences;
|
|
26
47
|
toggleMarketingPreferences(fieldName: 'canEmail' | 'canSms', active?: boolean): Promise<boolean>;
|
|
27
48
|
getPaymentSession(): Promise<void>;
|
|
28
49
|
confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ICheckoutPaymentMethodStore>;
|
|
@@ -44,6 +65,9 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
44
65
|
updateFulfillmentTip(fulfillmentId: string, tipAmount: number): Promise<void>;
|
|
45
66
|
removeFulfillmentTip(fulfillmentId: string): Promise<void>;
|
|
46
67
|
clearCheckoutError(): Promise<void>;
|
|
68
|
+
markCustomerFormEdited(): void;
|
|
69
|
+
canPrefillCustomerForm(): boolean;
|
|
70
|
+
savePrefilledCustomerInfo(): Promise<void>;
|
|
47
71
|
editCustomerForm(): Promise<void>;
|
|
48
72
|
saveCustomerForm({ shippingAddressTwo, deliveryInstructions, customerData, }: {
|
|
49
73
|
customerData: ICheckoutCustomer;
|
|
@@ -65,6 +89,7 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
65
89
|
setupIntentId: string;
|
|
66
90
|
};
|
|
67
91
|
}): Promise<void>;
|
|
92
|
+
private prepareMarketingForCompletion;
|
|
68
93
|
checkoutComplete(): Promise<void>;
|
|
69
94
|
private updateStoreFromCheckoutResponse;
|
|
70
95
|
private syncFromItemUpdate;
|
|
@@ -10,6 +10,7 @@ export declare class CheckoutOrderSummaryComponent extends BaseComponent<null, I
|
|
|
10
10
|
private toggleMarketingPreference;
|
|
11
11
|
private handleEmailToggle;
|
|
12
12
|
private handleSmsToggle;
|
|
13
|
+
private updateSavedMarketingPrompts;
|
|
13
14
|
private marketingOptInsContainer;
|
|
14
15
|
private hasOnDemandOrder;
|
|
15
16
|
protected template(): HTMLElement[];
|
|
@@ -7,6 +7,7 @@ export declare class CheckoutPaymentComponent extends BaseComponent<ICheckoutSen
|
|
|
7
7
|
private stripeHandlerElement;
|
|
8
8
|
private saveButton;
|
|
9
9
|
private errorMessageElement;
|
|
10
|
+
private walletInstructionsElement?;
|
|
10
11
|
private billingFormData;
|
|
11
12
|
private isValidBillingForm;
|
|
12
13
|
private isBillingSameAsShipping;
|
|
@@ -21,6 +22,9 @@ export declare class CheckoutPaymentComponent extends BaseComponent<ICheckoutSen
|
|
|
21
22
|
private handleBillingSameAsShippingChange;
|
|
22
23
|
afterRender(): Promise<void>;
|
|
23
24
|
private updateSaveButtonState;
|
|
25
|
+
private getSelectedWallet;
|
|
26
|
+
private getPaymentButtonText;
|
|
27
|
+
private updateWalletInstructions;
|
|
24
28
|
private lastAnnouncedPaymentError;
|
|
25
29
|
private updateErrorMessage;
|
|
26
30
|
private showError;
|
|
@@ -18,6 +18,8 @@ export interface IStripeConfig {
|
|
|
18
18
|
elementOptions?: Record<string, any>;
|
|
19
19
|
}
|
|
20
20
|
export interface IStripeFormStatus {
|
|
21
|
+
selectedPaymentType?: string;
|
|
22
|
+
hasPendingConfirmation?: boolean;
|
|
21
23
|
isFormComplete: boolean;
|
|
22
24
|
isProcessing: boolean;
|
|
23
25
|
hasCompletedPayment: boolean;
|
|
@@ -31,6 +33,7 @@ export declare class CheckoutStripeFormComponent extends SafeHTMLElement {
|
|
|
31
33
|
private _stripeElements;
|
|
32
34
|
private _paymentElement;
|
|
33
35
|
private _isProcessing;
|
|
36
|
+
private _selectedPaymentType;
|
|
34
37
|
private _isFormComplete;
|
|
35
38
|
private _hasUsedCurrentSession;
|
|
36
39
|
private _pendingConfirmation;
|
|
@@ -264,7 +264,7 @@ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences
|
|
|
264
264
|
### actions.checkout.updateCustomerInfo()
|
|
265
265
|
|
|
266
266
|
```typescript
|
|
267
|
-
updateCustomerInfo(params: Record<CustomerFieldName, string
|
|
267
|
+
updateCustomerInfo(params: Record<CustomerFieldName, string>, options?: { saveIfValid?: boolean }): Promise<void>
|
|
268
268
|
```
|
|
269
269
|
|
|
270
270
|
Pre-fill customer information.
|
|
@@ -525,3 +525,60 @@ Key events:
|
|
|
525
525
|
- [Checkout Component Guide](../../guides/checkout-component.md)
|
|
526
526
|
- [Checkout Events](../../guides/events.md#checkout-events)
|
|
527
527
|
- [Cart Actions](./cart-actions.md)
|
|
528
|
+
|
|
529
|
+
### Preparing complete account delivery details
|
|
530
|
+
|
|
531
|
+
After `lce:actions.checkout_loaded`, call
|
|
532
|
+
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
533
|
+
to validate and prepare complete account details, then show their editable summary.
|
|
534
|
+
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
535
|
+
(age 21+, year 1930 or later). A shipping street must already be selected.
|
|
536
|
+
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
537
|
+
Partial or invalid details stay in the form; backend validation failures reject the
|
|
538
|
+
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
|
539
|
+
|
|
540
|
+
The option skips gifts, saved forms, in-flight saves, and customer forms the shopper
|
|
541
|
+
has edited during the current checkout. It does not overwrite those forms. Edits or
|
|
542
|
+
address/checkout changes during preparation prevent a stale response from closing
|
|
543
|
+
the form. Without the option, this action only prefills fields, as before.
|
|
544
|
+
|
|
545
|
+
Apple Pay and Google Pay selection displays **Continue with Apple Pay** or
|
|
546
|
+
**Continue with Google Pay**. This opens the wallet to save a payment method; the
|
|
547
|
+
shopper still reviews and places the order afterward. It is not express checkout.
|
|
548
|
+
|
|
549
|
+
After wallet cancellation, the same Continue action remains available. If authorization
|
|
550
|
+
succeeded but saving the method failed, **Retry saving Apple Pay/Google Pay** reuses
|
|
551
|
+
the existing authorization rather than opening the wallet again.
|
|
552
|
+
|
|
553
|
+
### Saved account marketing preferences
|
|
554
|
+
|
|
555
|
+
```ts
|
|
556
|
+
setSavedMarketingPreferences(preferences: { canEmail?: boolean; canSms?: boolean }): Promise<void>
|
|
557
|
+
clearSavedMarketingPreferences(): void
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Call `actions.checkout.setSavedMarketingPreferences()` with known recorded account
|
|
561
|
+
choices, including `false`, before checkout loads. Only boolean values are used;
|
|
562
|
+
missing/null/unrecognized values remain unknown. The first checkout prepare uses
|
|
563
|
+
saved values instead of tenant defaults. Each channel's prompt is hidden only
|
|
564
|
+
after the server confirms that saved choice. Unknown channels retain their normal
|
|
565
|
+
checkout prompts. The actions are available in both full and checkout-only clients.
|
|
566
|
+
|
|
567
|
+
Calling the setter during an active checkout prepares untouched channels and
|
|
568
|
+
preserves shopper checkbox edits. Backend failure rejects the promise, displays
|
|
569
|
+
an error, and leaves prompts available; the host should catch the rejection.
|
|
570
|
+
The same call can retry. Applying values does not call a subscription service.
|
|
571
|
+
It supplies the account's recorded choices to this checkout.
|
|
572
|
+
|
|
573
|
+
Saved choices persist across cart resets in the same SDK session. Call
|
|
574
|
+
`clearSavedMarketingPreferences()` on sign-out, account change, and host cleanup.
|
|
575
|
+
Clearing reveals the prompts and restores configured guest defaults. It invalidates
|
|
576
|
+
stale responses while draining outstanding preference requests; checkout completion
|
|
577
|
+
prepares the current choices before submitting the checkout token. A load already
|
|
578
|
+
in progress still finishes and reconciles the current account's values. Bind a new
|
|
579
|
+
account only to its own checkout; the host remains responsible for account/cart
|
|
580
|
+
ownership and for reloading checkout when identity changes.
|
|
581
|
+
|
|
582
|
+
Order completion waits for queued preference work. It cannot race a late saved
|
|
583
|
+
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
584
|
+
fails, the shopper can retry or explicitly choose the visible channel preference.
|
|
@@ -422,3 +422,60 @@ type DeepPartial<T> = {
|
|
|
422
422
|
- [Client API](./client.md) - Client initialization and usage
|
|
423
423
|
- [Configuration Reference](./configuration.md) - Detailed config options
|
|
424
424
|
- [Injection Methods](./injection-methods.md) - Component injection API
|
|
425
|
+
|
|
426
|
+
### Preparing complete account delivery details
|
|
427
|
+
|
|
428
|
+
After `lce:actions.checkout_loaded`, call
|
|
429
|
+
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
430
|
+
to validate and prepare complete account details, then show their editable summary.
|
|
431
|
+
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
432
|
+
(age 21+, year 1930 or later). A shipping street must already be selected.
|
|
433
|
+
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
434
|
+
Partial or invalid details stay in the form; backend validation failures reject the
|
|
435
|
+
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
|
436
|
+
|
|
437
|
+
The option skips gifts, saved forms, in-flight saves, and customer forms the shopper
|
|
438
|
+
has edited during the current checkout. It does not overwrite those forms. Edits or
|
|
439
|
+
address/checkout changes during preparation prevent a stale response from closing
|
|
440
|
+
the form. Without the option, this action only prefills fields, as before.
|
|
441
|
+
|
|
442
|
+
Apple Pay and Google Pay selection displays **Continue with Apple Pay** or
|
|
443
|
+
**Continue with Google Pay**. This opens the wallet to save a payment method; the
|
|
444
|
+
shopper still reviews and places the order afterward. It is not express checkout.
|
|
445
|
+
|
|
446
|
+
After wallet cancellation, the same Continue action remains available. If authorization
|
|
447
|
+
succeeded but saving the method failed, **Retry saving Apple Pay/Google Pay** reuses
|
|
448
|
+
the existing authorization rather than opening the wallet again.
|
|
449
|
+
|
|
450
|
+
### Saved account marketing preferences
|
|
451
|
+
|
|
452
|
+
```ts
|
|
453
|
+
setSavedMarketingPreferences(preferences: { canEmail?: boolean; canSms?: boolean }): Promise<void>
|
|
454
|
+
clearSavedMarketingPreferences(): void
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Call `actions.checkout.setSavedMarketingPreferences()` with known recorded account
|
|
458
|
+
choices, including `false`, before checkout loads. Only boolean values are used;
|
|
459
|
+
missing/null/unrecognized values remain unknown. The first checkout prepare uses
|
|
460
|
+
saved values instead of tenant defaults. Each channel's prompt is hidden only
|
|
461
|
+
after the server confirms that saved choice. Unknown channels retain their normal
|
|
462
|
+
checkout prompts. The actions are available in both full and checkout-only clients.
|
|
463
|
+
|
|
464
|
+
Calling the setter during an active checkout prepares untouched channels and
|
|
465
|
+
preserves shopper checkbox edits. Backend failure rejects the promise, displays
|
|
466
|
+
an error, and leaves prompts available; the host should catch the rejection.
|
|
467
|
+
The same call can retry. Applying values does not call a subscription service.
|
|
468
|
+
It supplies the account's recorded choices to this checkout.
|
|
469
|
+
|
|
470
|
+
Saved choices persist across cart resets in the same SDK session. Call
|
|
471
|
+
`clearSavedMarketingPreferences()` on sign-out, account change, and host cleanup.
|
|
472
|
+
Clearing reveals the prompts and restores configured guest defaults. It invalidates
|
|
473
|
+
stale responses while draining outstanding preference requests; checkout completion
|
|
474
|
+
prepares the current choices before submitting the checkout token. A load already
|
|
475
|
+
in progress still finishes and reconciles the current account's values. Bind a new
|
|
476
|
+
account only to its own checkout; the host remains responsible for account/cart
|
|
477
|
+
ownership and for reloading checkout when identity changes.
|
|
478
|
+
|
|
479
|
+
Order completion waits for queued preference work. It cannot race a late saved
|
|
480
|
+
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
481
|
+
fails, the shopper can retry or explicitly choose the visible channel preference.
|
|
@@ -146,14 +146,14 @@ on render, and a live region recreated with its text already in place is not ann
|
|
|
146
146
|
|
|
147
147
|
### Headings
|
|
148
148
|
|
|
149
|
-
The product element emits a level-1 title
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
The product element emits a level-1 title, and every section caption below it sits at level 2 —
|
|
150
|
+
`Size`, `Delivers to:`, `Shipping From:` and `About this product:` — so the whole element is
|
|
151
|
+
reachable by heading navigation with no level skipped. An overlay supplies its own heading at the
|
|
152
|
+
top of its content, because the page behind it is out of the accessibility tree while it is open.
|
|
152
153
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
technology because the control beside it already announces the address.
|
|
154
|
+
A caption can do both jobs at once: `Shipping From:` is a heading *and* names the retailer card
|
|
155
|
+
beneath it through `aria-labelledby`. Heading ids are scoped to the product, so each product
|
|
156
|
+
element on a page labels its own sections.
|
|
157
157
|
|
|
158
158
|
The checkout element has its own outline and is not covered by the above. Where any element's
|
|
159
159
|
top-level heading sits in **your** page's outline is yours to place.
|
|
@@ -229,3 +229,20 @@ for (const region of document.querySelectorAll('[data-lce-live-region]')) {
|
|
|
229
229
|
Checkout announces loading or initialization failure in a status region. If initialization fails, payment fields are withheld and a keyboard-operable **Retry checkout** button retries the same checkout. The button is disabled while loading.
|
|
230
230
|
|
|
231
231
|
Save Payment Information remains disabled until checkout initializes. During payment save it stays busy until the server responds. Recoverable billing/prepare errors are announced while the mounted card fields and billing input remain available for correction and retry.
|
|
232
|
+
|
|
233
|
+
### Wallet payment actions
|
|
234
|
+
|
|
235
|
+
The payment action's accessible name matches its visible label, including the
|
|
236
|
+
selected Apple Pay or Google Pay wallet and retry/processing states. Adjacent
|
|
237
|
+
instructions explain whether the action opens the wallet or retries saving already
|
|
238
|
+
authorized details. These actions save the payment method; order placement is a
|
|
239
|
+
separate step.
|
|
240
|
+
|
|
241
|
+
### Recorded marketing choices
|
|
242
|
+
|
|
243
|
+
Checkout suppresses each email/SMS consent checkbox only after the corresponding
|
|
244
|
+
recorded account choice is confirmed. Suppressed controls are hidden visually and
|
|
245
|
+
from the accessibility tree; unknown choices retain their named, keyboard-operable
|
|
246
|
+
checkboxes. Clearing account preferences reveals the controls and synchronizes
|
|
247
|
+
`aria-checked` with the current guest defaults. A shopper's explicit checkbox edit
|
|
248
|
+
keeps that channel visible when account data arrives later.
|
|
@@ -668,3 +668,60 @@ checkout: {
|
|
|
668
668
|
- [Actions API](../api/actions/checkout-actions.md) - Checkout actions reference
|
|
669
669
|
- [Events](./events.md) - All available events
|
|
670
670
|
- [Theming](./theming.md) - Customize appearance
|
|
671
|
+
|
|
672
|
+
### Preparing complete account delivery details
|
|
673
|
+
|
|
674
|
+
After `lce:actions.checkout_loaded`, call
|
|
675
|
+
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
676
|
+
to validate and prepare complete account details, then show their editable summary.
|
|
677
|
+
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
678
|
+
(age 21+, year 1930 or later). A shipping street must already be selected.
|
|
679
|
+
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
680
|
+
Partial or invalid details stay in the form; backend validation failures reject the
|
|
681
|
+
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
|
682
|
+
|
|
683
|
+
The option skips gifts, saved forms, in-flight saves, and customer forms the shopper
|
|
684
|
+
has edited during the current checkout. It does not overwrite those forms. Edits or
|
|
685
|
+
address/checkout changes during preparation prevent a stale response from closing
|
|
686
|
+
the form. Without the option, this action only prefills fields, as before.
|
|
687
|
+
|
|
688
|
+
Apple Pay and Google Pay selection displays **Continue with Apple Pay** or
|
|
689
|
+
**Continue with Google Pay**. This opens the wallet to save a payment method; the
|
|
690
|
+
shopper still reviews and places the order afterward. It is not express checkout.
|
|
691
|
+
|
|
692
|
+
After wallet cancellation, the same Continue action remains available. If authorization
|
|
693
|
+
succeeded but saving the method failed, **Retry saving Apple Pay/Google Pay** reuses
|
|
694
|
+
the existing authorization rather than opening the wallet again.
|
|
695
|
+
|
|
696
|
+
### Saved account marketing preferences
|
|
697
|
+
|
|
698
|
+
```ts
|
|
699
|
+
setSavedMarketingPreferences(preferences: { canEmail?: boolean; canSms?: boolean }): Promise<void>
|
|
700
|
+
clearSavedMarketingPreferences(): void
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
Call `actions.checkout.setSavedMarketingPreferences()` with known recorded account
|
|
704
|
+
choices, including `false`, before checkout loads. Only boolean values are used;
|
|
705
|
+
missing/null/unrecognized values remain unknown. The first checkout prepare uses
|
|
706
|
+
saved values instead of tenant defaults. Each channel's prompt is hidden only
|
|
707
|
+
after the server confirms that saved choice. Unknown channels retain their normal
|
|
708
|
+
checkout prompts. The actions are available in both full and checkout-only clients.
|
|
709
|
+
|
|
710
|
+
Calling the setter during an active checkout prepares untouched channels and
|
|
711
|
+
preserves shopper checkbox edits. Backend failure rejects the promise, displays
|
|
712
|
+
an error, and leaves prompts available; the host should catch the rejection.
|
|
713
|
+
The same call can retry. Applying values does not call a subscription service.
|
|
714
|
+
It supplies the account's recorded choices to this checkout.
|
|
715
|
+
|
|
716
|
+
Saved choices persist across cart resets in the same SDK session. Call
|
|
717
|
+
`clearSavedMarketingPreferences()` on sign-out, account change, and host cleanup.
|
|
718
|
+
Clearing reveals the prompts and restores configured guest defaults. It invalidates
|
|
719
|
+
stale responses while draining outstanding preference requests; checkout completion
|
|
720
|
+
prepares the current choices before submitting the checkout token. A load already
|
|
721
|
+
in progress still finishes and reconciles the current account's values. Bind a new
|
|
722
|
+
account only to its own checkout; the host remains responsible for account/cart
|
|
723
|
+
ownership and for reloading checkout when identity changes.
|
|
724
|
+
|
|
725
|
+
Order completion waits for queued preference work. It cannot race a late saved
|
|
726
|
+
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
727
|
+
fails, the shopper can retry or explicitly choose the visible channel preference.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "LiquidCommerce Elements SDK",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "LiquidCommerce Team",
|
|
6
|
-
"version": "2.7.
|
|
6
|
+
"version": "2.7.38",
|
|
7
7
|
"homepage": "https://docs.liquidcommerce.co/elements-sdk",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -109,10 +109,10 @@
|
|
|
109
109
|
"theming"
|
|
110
110
|
],
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@biomejs/biome": "^2.5.
|
|
113
|
-
"@commitlint/cli": "^21.2.
|
|
114
|
-
"@commitlint/config-conventional": "^21.2.
|
|
115
|
-
"@playwright/test": "1.
|
|
112
|
+
"@biomejs/biome": "^2.5.14",
|
|
113
|
+
"@commitlint/cli": "^21.2.3",
|
|
114
|
+
"@commitlint/config-conventional": "^21.2.3",
|
|
115
|
+
"@playwright/test": "1.63.0",
|
|
116
116
|
"@rollup/plugin-alias": "^6.0.0",
|
|
117
117
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
118
118
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -126,18 +126,18 @@
|
|
|
126
126
|
"@semantic-release/npm": "^13.1.5",
|
|
127
127
|
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
128
128
|
"@types/core-js": "^2.5.8",
|
|
129
|
-
"@types/node": "^26.
|
|
129
|
+
"@types/node": "^26.6.2",
|
|
130
130
|
"conventional-changelog": "8.1.3",
|
|
131
131
|
"husky": "^9.1.7",
|
|
132
|
-
"jsdom": "
|
|
132
|
+
"jsdom": "30.1.0",
|
|
133
133
|
"process": "^0.11.10",
|
|
134
|
-
"rollup": "^4.63.
|
|
134
|
+
"rollup": "^4.63.4",
|
|
135
135
|
"rollup-obfuscator": "^4.1.1",
|
|
136
136
|
"rollup-plugin-typescript2": "^0.37.0",
|
|
137
137
|
"semantic-release": "^25.0.9",
|
|
138
138
|
"ts-node": "^10.9.2",
|
|
139
139
|
"typescript": "6.0.3",
|
|
140
|
-
"vitest": "
|
|
140
|
+
"vitest": "5.0.1"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=22"
|