@liquidcommerce/elements-sdk 2.6.0-beta.119 → 2.6.0-beta.120
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 +1 -0
- package/dist/index.checkout.esm.js +9187 -8014
- package/dist/index.esm.js +14030 -12873
- package/dist/ssr-stub.esm.js +3 -0
- package/dist/types/clients/base.d.ts +1 -0
- package/dist/types/clients/helpers.d.ts +2 -1
- package/dist/types/core/api/api-client.service.d.ts +6 -3
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +5 -0
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +9 -0
- package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
- package/dist/types/enums/core.enum.d.ts +3 -0
- package/dist/types/index.checkout.d.ts +2 -1
- package/dist/types/interfaces/api/checkout.interface.d.ts +7 -0
- package/dist/types/interfaces/client.interface.d.ts +3 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -0
- package/dist/types/interfaces/injection.interface.d.ts +6 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +27 -3
- package/dist/types/modules/checkout/components/checkout-buyer.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-deliver-to.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-express-checkout.component.d.ts +61 -0
- package/dist/types/modules/checkout/components/checkout-express-completion.component.d.ts +21 -0
- package/dist/types/modules/checkout/components/index.d.ts +2 -0
- package/dist/types/modules/checkout/constant.d.ts +2 -0
- package/dist/types/modules/checkout/customer-prefill.d.ts +4 -1
- package/dist/types/modules/checkout/express-wallet.d.ts +12 -0
- package/dist/types/modules/checkout/styles/express-checkout.style.d.ts +1 -0
- package/dist/types/modules/checkout/styles/express-completion.style.d.ts +1 -0
- package/dist/types/modules/ui-components/input/input.component.d.ts +1 -1
- package/dist/types/utils/format.d.ts +4 -0
- package/docs/v1/api/actions/checkout-actions.md +3 -1
- package/docs/v1/api/client.md +49 -0
- package/docs/v1/api/configuration.md +3 -1
- package/docs/v1/api/typescript-types.md +10 -1
- package/docs/v1/guides/accessibility.md +21 -0
- package/docs/v1/guides/checkout-component.md +66 -3
- package/docs/v1/guides/events.md +19 -0
- package/docs/v1/guides/theming.md +1 -0
- package/docs/v1/reference/analytics.md +14 -2
- package/package.json +1 -1
package/dist/ssr-stub.esm.js
CHANGED
|
@@ -140,6 +140,7 @@ const ELEMENTS_ACTIONS_EVENT = {
|
|
|
140
140
|
CHECKOUT_GIFT_CARD_FAILED: 'checkout_gift_card_failed',
|
|
141
141
|
CHECKOUT_PRODUCT_ADD_SUCCESS: 'checkout_product_add_success',
|
|
142
142
|
CHECKOUT_PRODUCT_ADD_FAILED: 'checkout_product_add_failed',
|
|
143
|
+
CHECKOUT_EXPRESS_CHECKOUT_AVAILABILITY: 'checkout_express_checkout_availability',
|
|
143
144
|
};
|
|
144
145
|
const ELEMENTS_FORM = {
|
|
145
146
|
CUSTOMER: 'customer',
|
|
@@ -220,6 +221,8 @@ const COMPONENT_TYPE = {
|
|
|
220
221
|
CHECKOUT_PRESALE_COUNTDOWN: 'checkout-presale-countdown',
|
|
221
222
|
CHECKOUT_PRESALE_EXPIRED: 'checkout-presale-expired',
|
|
222
223
|
CHECKOUT_SEND_AS_GIFT: 'checkout-send-as-gift',
|
|
224
|
+
CHECKOUT_EXPRESS_CHECKOUT: 'checkout-express-checkout',
|
|
225
|
+
CHECKOUT_EXPRESS_COMPLETION: 'checkout-express-completion',
|
|
223
226
|
};
|
|
224
227
|
const FULFILLMENT_TYPE = {
|
|
225
228
|
ON_DEMAND: 'onDemand',
|
|
@@ -45,6 +45,7 @@ export declare abstract class ElementsBaseClient {
|
|
|
45
45
|
private initializeHeavyServices;
|
|
46
46
|
get actions(): ILiquidCommerceElementsActions;
|
|
47
47
|
protected processInjectElement(params: IProcessInjectElementParams): Promise<IInjectedComponent | null>;
|
|
48
|
+
private loadCheckoutForExpressCheckout;
|
|
48
49
|
protected processInjectProduct(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
49
50
|
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
50
51
|
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ComponentType } from '@/enums';
|
|
2
|
-
import type { ICartComponent } from '@/interfaces/configs';
|
|
2
|
+
import type { ICartComponent, ICheckoutComponent } from '@/interfaces/configs';
|
|
3
3
|
export declare function normalizeProductListLists<T extends Record<string, any>>(data: T): T;
|
|
4
4
|
export declare function withCartLayoutDefaults(cart: ICartComponent): ICartComponent;
|
|
5
|
+
export declare function withCheckoutLayoutDefaults(checkout: ICheckoutComponent): ICheckoutComponent;
|
|
5
6
|
export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>, currentPath?: string): T;
|
|
6
7
|
export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
|
|
7
8
|
export declare function getComponentTypesForLayoutFields(parentPath: string, layoutFields: Record<string, any>): ComponentType[];
|
|
@@ -3,7 +3,7 @@ import type { AuthClientService } from '@/core/api/auth-client.service';
|
|
|
3
3
|
import type { IPersistedStore, IPersistedStoreAction } from '@/core/store/interfaces/core.interface';
|
|
4
4
|
import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
|
|
5
5
|
import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
|
|
6
|
-
import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse, ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
|
|
6
|
+
import type { CheckoutPaymentSessionType, IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse, ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
|
|
7
7
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
8
8
|
import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
9
9
|
export declare class ApiClientService {
|
|
@@ -24,8 +24,11 @@ export declare class ApiClientService {
|
|
|
24
24
|
updateCart(params: ICartUpdateParams): Promise<ApiResult<ICart>>;
|
|
25
25
|
prepareCheckout(params: ICheckoutPrepareParams): Promise<ApiResult<ICheckoutPrepare>>;
|
|
26
26
|
updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ApiResult<ICheckoutItemsUpdateResponse>>;
|
|
27
|
-
getPaymentSession(cartId: string
|
|
27
|
+
getPaymentSession(cartId: string, params?: {
|
|
28
|
+
checkoutToken?: string;
|
|
29
|
+
sessionType?: CheckoutPaymentSessionType;
|
|
30
|
+
}): Promise<ApiResult<ICheckoutPaymentSession>>;
|
|
28
31
|
confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ApiResult<ICheckoutPaymentConfirm>>;
|
|
29
32
|
addAnonymousProduct(params: IAnonymousCheckoutAddProductParams): Promise<ApiResult<IAnonymousCheckoutAddProductResponse>>;
|
|
30
|
-
checkoutComplete(token: string, payment?: string): Promise<ApiResult<ICheckoutComplete>>;
|
|
33
|
+
checkoutComplete(token: string, payment?: string, expressPaymentIntentId?: string): Promise<ApiResult<ICheckoutComplete>>;
|
|
31
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IAddressActionEventData, IAddressFailedEventData } from '@/core/pubsub/interfaces/address.interface';
|
|
2
2
|
import type { ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartShopRetailerEventData, ICartUpdatedEventData } from '@/core/pubsub/interfaces/cart.interface';
|
|
3
|
-
import type { ICheckoutBillingInformationUpdatedEventData, ICheckoutCustomerInformationUpdatedEventData, ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutGiftInformationUpdatedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
3
|
+
import type { ICheckoutBillingInformationUpdatedEventData, ICheckoutCustomerInformationUpdatedEventData, ICheckoutExpressCheckoutAvailabilityEventData, ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutGiftInformationUpdatedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
4
4
|
import type { IProductAddToCartEventData, IProductFulfillmentChangedEventData, IProductFulfillmentTypeChangedEventData, IProductLoadedEventData, IProductQuantityChangedEventData, IProductSizeChangedEventData } from '@/core/pubsub/interfaces/product.interface';
|
|
5
5
|
import { ELEMENTS_ACTIONS_EVENT } from '@/enums';
|
|
6
6
|
export interface IElementsClientIsReadyEventData {
|
|
@@ -81,6 +81,7 @@ export interface IElementsActionsEventsMap {
|
|
|
81
81
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_GIFT_CARD_FAILED]: ICheckoutGiftCardFailedEventData;
|
|
82
82
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_PRODUCT_ADD_SUCCESS]: ICheckoutProductAddEventData;
|
|
83
83
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_PRODUCT_ADD_FAILED]: ICheckoutProductAddFailedEventData;
|
|
84
|
+
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_EXPRESS_CHECKOUT_AVAILABILITY]: ICheckoutExpressCheckoutAvailabilityEventData;
|
|
84
85
|
}
|
|
85
86
|
export type SpecificActionEvent = keyof IElementsActionsEventsMap;
|
|
86
87
|
export interface IFormEventData {
|
|
@@ -20,6 +20,14 @@ export interface ICheckoutPaymentMethodStore extends ICheckoutPaymentConfirm {
|
|
|
20
20
|
}
|
|
21
21
|
export interface ICheckoutPaymentSessionStore extends ICheckoutPaymentSession {
|
|
22
22
|
}
|
|
23
|
+
export type CheckoutExpressStatus = 'idle' | 'preparing' | 'birthDate' | 'completing' | 'failed';
|
|
24
|
+
export interface ICheckoutExpressStore {
|
|
25
|
+
status: CheckoutExpressStatus;
|
|
26
|
+
wallet: string | null;
|
|
27
|
+
intentId: string | null;
|
|
28
|
+
approvedTotal: number | null;
|
|
29
|
+
error: string | null;
|
|
30
|
+
}
|
|
23
31
|
export interface ICheckoutPaymentFormStore {
|
|
24
32
|
paymentSession: ICheckoutPaymentSessionStore | null;
|
|
25
33
|
paymentMethod: ICheckoutPaymentMethodStore | null;
|
|
@@ -41,6 +49,7 @@ export interface ICheckoutStore {
|
|
|
41
49
|
giftRecipientForm: ICheckoutGiftRecipientFormStore;
|
|
42
50
|
paymentForm: ICheckoutPaymentFormStore;
|
|
43
51
|
injectedPaymentMethod: ICheckoutPaymentMethodStore | null;
|
|
52
|
+
express: ICheckoutExpressStore;
|
|
44
53
|
shippingAddress: ICheckoutShippingAddress;
|
|
45
54
|
promoCode: ICheckoutPromoCode | null;
|
|
46
55
|
giftCards: ICheckoutGiftCard[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IAddressStore } from '@/core/store/interfaces/address.interface';
|
|
2
2
|
import type { ICartFulfillmentStore, ICartItemStore, ICartRetailerStore, ICartStore } from '@/core/store/interfaces/cart.interface';
|
|
3
|
-
import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutItemStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
3
|
+
import type { ICheckoutCustomerFormStore, ICheckoutExpressStore, ICheckoutGiftRecipientFormStore, ICheckoutItemStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
4
|
import type { ICheckoutInjection, ICheckoutMetadata, IElementsMetadataStore } from '@/core/store/interfaces/metadata.interface';
|
|
5
5
|
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
6
6
|
import type { IPLProductStore, IProductListStore } from '@/core/store/interfaces/product-list.interface';
|
|
@@ -36,7 +36,7 @@ export interface IPersistedStore {
|
|
|
36
36
|
export interface IPersistedStoreAction {
|
|
37
37
|
success: boolean;
|
|
38
38
|
}
|
|
39
|
-
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof ICartRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof ICartFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCode}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresale}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferences}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipient}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCode}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.retailers.${string}` | `checkout.retailers.${string}.${keyof ICheckoutRetailer}` | `checkout.fulfillments.${string}` | `productsList.${string}` | `productsList.${string}.${keyof IProductListStore}` | `productsList.${string}.products.${string}` | `productsList.${string}.products.${string}.${keyof IPLProductStore}` | `metadata.${keyof IElementsMetadataStore}` | `metadata.checkout.${keyof ICheckoutMetadata}` | `metadata.checkout.injection.${keyof ICheckoutInjection}`;
|
|
39
|
+
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof ICartRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof ICartFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCode}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.express.${keyof ICheckoutExpressStore}` | `checkout.presale.${keyof ICheckoutPresale}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferences}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipient}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCode}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.retailers.${string}` | `checkout.retailers.${string}.${keyof ICheckoutRetailer}` | `checkout.fulfillments.${string}` | `productsList.${string}` | `productsList.${string}.${keyof IProductListStore}` | `productsList.${string}.products.${string}` | `productsList.${string}.products.${string}.${keyof IPLProductStore}` | `metadata.${keyof IElementsMetadataStore}` | `metadata.checkout.${keyof ICheckoutMetadata}` | `metadata.checkout.injection.${keyof ICheckoutInjection}`;
|
|
40
40
|
interface MiddlewareContext {
|
|
41
41
|
action: string;
|
|
42
42
|
payload: any;
|
|
@@ -59,6 +59,7 @@ export declare const ELEMENTS_ACTIONS_EVENT: {
|
|
|
59
59
|
readonly CHECKOUT_GIFT_CARD_FAILED: "checkout_gift_card_failed";
|
|
60
60
|
readonly CHECKOUT_PRODUCT_ADD_SUCCESS: "checkout_product_add_success";
|
|
61
61
|
readonly CHECKOUT_PRODUCT_ADD_FAILED: "checkout_product_add_failed";
|
|
62
|
+
readonly CHECKOUT_EXPRESS_CHECKOUT_AVAILABILITY: "checkout_express_checkout_availability";
|
|
62
63
|
};
|
|
63
64
|
export declare const ELEMENTS_FORM: {
|
|
64
65
|
readonly CUSTOMER: "customer";
|
|
@@ -139,6 +140,8 @@ export declare const COMPONENT_TYPE: {
|
|
|
139
140
|
readonly CHECKOUT_PRESALE_COUNTDOWN: "checkout-presale-countdown";
|
|
140
141
|
readonly CHECKOUT_PRESALE_EXPIRED: "checkout-presale-expired";
|
|
141
142
|
readonly CHECKOUT_SEND_AS_GIFT: "checkout-send-as-gift";
|
|
143
|
+
readonly CHECKOUT_EXPRESS_CHECKOUT: "checkout-express-checkout";
|
|
144
|
+
readonly CHECKOUT_EXPRESS_COMPLETION: "checkout-express-completion";
|
|
142
145
|
};
|
|
143
146
|
export type ComponentType = (typeof COMPONENT_TYPE)[keyof typeof COMPONENT_TYPE];
|
|
144
147
|
export declare const FULFILLMENT_TYPE: {
|
|
@@ -4,5 +4,6 @@ import { DEBUG_MODE, ELEMENTS_ENV } from '@/enums';
|
|
|
4
4
|
import type { IElementsCheckoutActions, IElementsCheckoutClient } from '@/interfaces/client.interface';
|
|
5
5
|
import type { IInjectedComponent } from '@/interfaces/component.interface';
|
|
6
6
|
import type { ILiquidCommerceElementsCheckoutClientConfig } from '@/interfaces/config.interface';
|
|
7
|
-
|
|
7
|
+
import type { IInjectCheckoutParams, IInjectExpressCheckoutParams } from '@/interfaces/injection.interface';
|
|
8
|
+
export type { DebugMode, ElementsEnv, IElementsCheckoutActions, IElementsCheckoutClient, IInjectCheckoutParams, IInjectExpressCheckoutParams, IInjectedComponent, ILiquidCommerceElementsCheckoutClientConfig, };
|
|
8
9
|
export { DEBUG_MODE, ELEMENTS_ENV, ElementsCheckout };
|
|
@@ -5,6 +5,11 @@ import type { IProductPresale } from '@/interfaces/api/product.interface';
|
|
|
5
5
|
export interface ICheckoutComplete {
|
|
6
6
|
orderNumber: string;
|
|
7
7
|
}
|
|
8
|
+
export declare const CHECKOUT_PAYMENT_SESSION_TYPE: {
|
|
9
|
+
readonly STANDARD: "standard";
|
|
10
|
+
readonly EXPRESS: "express";
|
|
11
|
+
};
|
|
12
|
+
export type CheckoutPaymentSessionType = (typeof CHECKOUT_PAYMENT_SESSION_TYPE)[keyof typeof CHECKOUT_PAYMENT_SESSION_TYPE];
|
|
8
13
|
export interface ICheckoutPaymentSession {
|
|
9
14
|
key: string;
|
|
10
15
|
secret: string;
|
|
@@ -12,6 +17,8 @@ export interface ICheckoutPaymentSession {
|
|
|
12
17
|
export interface ICheckoutPaymentConfirmParams {
|
|
13
18
|
confirmationTokenId: string;
|
|
14
19
|
setupIntentId: string;
|
|
20
|
+
sessionType?: CheckoutPaymentSessionType;
|
|
21
|
+
checkoutToken?: string;
|
|
15
22
|
}
|
|
16
23
|
export interface ICheckoutPaymentConfirmCard {
|
|
17
24
|
brand: string;
|
|
@@ -6,7 +6,7 @@ import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
|
6
6
|
import type { IAddressOptions } from '@/modules/address/address.interface';
|
|
7
7
|
import type { IInjectedComponent } from './component.interface';
|
|
8
8
|
import type { UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent, UpdateProductListComponent } from './configs';
|
|
9
|
-
import type { IBuilderInjectElementParams, IInjectCheckoutBuilderParams, IInjectCheckoutParams, IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams } from './injection.interface';
|
|
9
|
+
import type { IBuilderInjectElementParams, IInjectCheckoutBuilderParams, IInjectCheckoutParams, IInjectExpressCheckoutParams, IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams } from './injection.interface';
|
|
10
10
|
export interface ILiquidCommerceElementsUIMethod {
|
|
11
11
|
cartButton(containerId: string, showItemsCount?: boolean): void;
|
|
12
12
|
floatingCartButton(showItemsCount?: boolean): void;
|
|
@@ -25,6 +25,7 @@ export interface IElementsCheckoutActions extends Omit<ICheckoutActions, 'openCh
|
|
|
25
25
|
}
|
|
26
26
|
export interface IElementsCheckoutClient {
|
|
27
27
|
injectCheckout: (params: IInjectCheckoutParams) => Promise<IInjectedComponent | null>;
|
|
28
|
+
injectExpressCheckout: (params: IInjectExpressCheckoutParams) => Promise<IInjectedComponent | null>;
|
|
28
29
|
actions: {
|
|
29
30
|
checkout: IElementsCheckoutActions;
|
|
30
31
|
};
|
|
@@ -51,6 +52,7 @@ export interface ILiquidCommerceElementsClient {
|
|
|
51
52
|
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
52
53
|
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
53
54
|
injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
55
|
+
injectExpressCheckoutElement(params: IInjectExpressCheckoutParams): Promise<IInjectedComponent | null>;
|
|
54
56
|
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
55
57
|
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
56
58
|
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
@@ -12,6 +12,7 @@ export interface ICheckoutLayout {
|
|
|
12
12
|
emailOptIn: ICheckoutMarketingOptIn;
|
|
13
13
|
smsOptIn: ICheckoutMarketingOptIn;
|
|
14
14
|
allowGiftCards: boolean;
|
|
15
|
+
requireBirthDate?: boolean;
|
|
15
16
|
legalMessage: ICheckoutLegalMessage;
|
|
16
17
|
continueShoppingUrl: string;
|
|
17
18
|
exitUrl: string;
|
|
@@ -38,12 +38,18 @@ export interface IProcessInjectElementParams {
|
|
|
38
38
|
options?: IAddressOptions;
|
|
39
39
|
checkoutId?: string;
|
|
40
40
|
hideHeader?: boolean;
|
|
41
|
+
variant?: 'section' | 'buttons';
|
|
41
42
|
}
|
|
42
43
|
export interface IInjectCheckoutParams {
|
|
43
44
|
containerId: string;
|
|
44
45
|
checkoutId?: string;
|
|
45
46
|
hideHeader?: boolean;
|
|
46
47
|
}
|
|
48
|
+
export interface IInjectExpressCheckoutParams {
|
|
49
|
+
containerId: string;
|
|
50
|
+
checkoutId?: string;
|
|
51
|
+
variant?: 'section' | 'buttons';
|
|
52
|
+
}
|
|
47
53
|
export interface IInjectCheckoutBuilderParams extends IInjectCheckoutParams {
|
|
48
54
|
simulatePresale?: boolean;
|
|
49
55
|
presaleExpiresInMinutes?: number;
|
|
@@ -1,9 +1,10 @@
|
|
|
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, ICheckoutMarketingPreferences, ICheckoutPrepare } from '@/interfaces/api/checkout.interface';
|
|
4
|
+
import type { CheckoutPaymentSessionType, ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPaymentSession, 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
|
+
import { type IExpressWalletBillingDetails } from '@/modules/checkout/express-wallet';
|
|
7
8
|
export declare class CheckoutCommands extends BaseCommand {
|
|
8
9
|
private readonly uiCommands;
|
|
9
10
|
private lastLoadParams;
|
|
@@ -19,8 +20,11 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
19
20
|
private customerEditRevision;
|
|
20
21
|
private customerEditedGeneration;
|
|
21
22
|
private confirmedPayment;
|
|
23
|
+
private expressHandoff;
|
|
24
|
+
private get requiresBirthDate();
|
|
22
25
|
assertPaymentReady(): void;
|
|
23
26
|
retryLoadCheckout(): Promise<void>;
|
|
27
|
+
private paymentSessionRequest;
|
|
24
28
|
constructor();
|
|
25
29
|
static getInstance(): CheckoutCommands;
|
|
26
30
|
addPresaleItem(params: AddItemParams): Promise<void>;
|
|
@@ -46,7 +50,9 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
46
50
|
private applySavedMarketingPreferences;
|
|
47
51
|
toggleMarketingPreferences(fieldName: 'canEmail' | 'canSms', active?: boolean): Promise<boolean>;
|
|
48
52
|
getPaymentSession(): Promise<void>;
|
|
49
|
-
|
|
53
|
+
getExpressPaymentSession(): Promise<ICheckoutPaymentSession | null>;
|
|
54
|
+
private requestPaymentSession;
|
|
55
|
+
confirmPaymentSession(confirmationTokenId: string, setupIntentId: string, sessionType?: CheckoutPaymentSessionType): Promise<ICheckoutPaymentMethodStore>;
|
|
50
56
|
applyPromoCode(code: string): Promise<void>;
|
|
51
57
|
removePromoCode(): Promise<void>;
|
|
52
58
|
clearPromoCodeError(): Promise<void>;
|
|
@@ -87,10 +93,28 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
87
93
|
paymentSession?: {
|
|
88
94
|
confirmationTokenId: string;
|
|
89
95
|
setupIntentId: string;
|
|
96
|
+
sessionType?: CheckoutPaymentSessionType;
|
|
90
97
|
};
|
|
91
98
|
}): Promise<void>;
|
|
92
99
|
private prepareMarketingForCompletion;
|
|
93
|
-
|
|
100
|
+
beginExpressCompletion({ wallet, confirmationTokenId, intentId, approvedTotal, billingDetails, }: {
|
|
101
|
+
wallet: string;
|
|
102
|
+
confirmationTokenId: string;
|
|
103
|
+
intentId: string;
|
|
104
|
+
approvedTotal: number;
|
|
105
|
+
billingDetails: IExpressWalletBillingDetails | undefined;
|
|
106
|
+
}): Promise<void>;
|
|
107
|
+
private prepareExpressPayment;
|
|
108
|
+
completeExpressOrder(birthDate?: string): Promise<void>;
|
|
109
|
+
cancelExpressCompletion(): void;
|
|
110
|
+
private saveExpressCustomer;
|
|
111
|
+
private assertApprovedTotal;
|
|
112
|
+
private setExpressStatus;
|
|
113
|
+
private failExpressCompletion;
|
|
114
|
+
private writeExpress;
|
|
115
|
+
checkoutComplete(options?: {
|
|
116
|
+
expressPaymentIntentId?: string;
|
|
117
|
+
}): Promise<void>;
|
|
94
118
|
private updateStoreFromCheckoutResponse;
|
|
95
119
|
private syncFromItemUpdate;
|
|
96
120
|
private syncCheckoutState;
|
|
@@ -7,6 +7,7 @@ export declare class CheckoutBuyer extends BaseComponent<null, ICheckoutComponen
|
|
|
7
7
|
get hostClasses(): string[];
|
|
8
8
|
constructor();
|
|
9
9
|
onStoreWatch(changes: IOnStoreChanged[]): void;
|
|
10
|
+
private get requiresBirthDate();
|
|
10
11
|
private updateSaveButtonState;
|
|
11
12
|
protected template(): HTMLElement[];
|
|
12
13
|
}
|
|
@@ -8,6 +8,7 @@ export declare class CheckoutDeliverToComponent extends BaseComponent<null, IChe
|
|
|
8
8
|
get hostClasses(): string[];
|
|
9
9
|
constructor();
|
|
10
10
|
onStoreWatch(changes: IOnStoreChanged[]): void;
|
|
11
|
+
private get requiresBirthDate();
|
|
11
12
|
private updateSaveButtonState;
|
|
12
13
|
protected template(): HTMLElement[];
|
|
13
14
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
+
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
3
|
+
export interface ICheckoutExpressCheckoutComponentParams {
|
|
4
|
+
variant?: 'section' | 'buttons';
|
|
5
|
+
isIndependentComponent?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class CheckoutExpressCheckoutComponent extends BaseComponent<ICheckoutExpressCheckoutComponentParams, ICheckoutComponent> {
|
|
8
|
+
private section;
|
|
9
|
+
private walletHost;
|
|
10
|
+
private completionElement;
|
|
11
|
+
private stripe;
|
|
12
|
+
private stripeElements;
|
|
13
|
+
private expressElement;
|
|
14
|
+
private sessionSecret;
|
|
15
|
+
private expressSession;
|
|
16
|
+
private sessionAmount;
|
|
17
|
+
private isMounting;
|
|
18
|
+
private isProcessing;
|
|
19
|
+
private hasAvailableWallets;
|
|
20
|
+
private availableWallets;
|
|
21
|
+
private hasSettledAvailability;
|
|
22
|
+
private lastPublishedAvailability;
|
|
23
|
+
get hostClasses(): string[];
|
|
24
|
+
constructor();
|
|
25
|
+
protected onStoreWatch(): void;
|
|
26
|
+
private syncCompletionView;
|
|
27
|
+
private get isCompletingExpress();
|
|
28
|
+
private get isButtonsOnly();
|
|
29
|
+
private get isReadyForPayment();
|
|
30
|
+
private get isGiftOrder();
|
|
31
|
+
protected template(): HTMLElement[];
|
|
32
|
+
protected afterRender(): void;
|
|
33
|
+
private createDividerLine;
|
|
34
|
+
private updateVisibility;
|
|
35
|
+
private publishAvailability;
|
|
36
|
+
private reportUnavailable;
|
|
37
|
+
private mountExpressElement;
|
|
38
|
+
private ensurePaymentSession;
|
|
39
|
+
private createWalletHost;
|
|
40
|
+
private findRootComponent;
|
|
41
|
+
private get orderTotal();
|
|
42
|
+
private buildElementsOptions;
|
|
43
|
+
private readIntentTerms;
|
|
44
|
+
private normaliseFutureUsage;
|
|
45
|
+
private buildAppearance;
|
|
46
|
+
private buildElementOptions;
|
|
47
|
+
private buildLineItems;
|
|
48
|
+
private readAvailability;
|
|
49
|
+
private handleAvailability;
|
|
50
|
+
private handleClick;
|
|
51
|
+
private hasUnmetMinimums;
|
|
52
|
+
private handleConfirm;
|
|
53
|
+
private isTotalUnchanged;
|
|
54
|
+
private toBillingDetails;
|
|
55
|
+
private failPayment;
|
|
56
|
+
private handleCancel;
|
|
57
|
+
private loadStripeJS;
|
|
58
|
+
private teardownExpressElement;
|
|
59
|
+
private remountIfTotalMoved;
|
|
60
|
+
protected disconnected(): void;
|
|
61
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
+
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
3
|
+
export declare class CheckoutExpressCompletionComponent extends BaseComponent<null, ICheckoutComponent> {
|
|
4
|
+
private birthDate;
|
|
5
|
+
private isBirthDateValid;
|
|
6
|
+
private completeButton;
|
|
7
|
+
private announcedState;
|
|
8
|
+
private hasFocusedHeading;
|
|
9
|
+
constructor();
|
|
10
|
+
get hostClasses(): string[];
|
|
11
|
+
private get express();
|
|
12
|
+
private get needsBirthDate();
|
|
13
|
+
protected afterRender(): void;
|
|
14
|
+
protected template(): HTMLElement[];
|
|
15
|
+
private headingFor;
|
|
16
|
+
private copyFor;
|
|
17
|
+
private createDots;
|
|
18
|
+
private createBirthDateInput;
|
|
19
|
+
private createCompleteButton;
|
|
20
|
+
private createBackLink;
|
|
21
|
+
}
|
|
@@ -5,6 +5,8 @@ export * from './checkout-buyer-summary.component';
|
|
|
5
5
|
export * from './checkout-completed.component';
|
|
6
6
|
export * from './checkout-deliver-to.component';
|
|
7
7
|
export * from './checkout-deliver-to-summary.component';
|
|
8
|
+
export * from './checkout-express-checkout.component';
|
|
9
|
+
export * from './checkout-express-completion.component';
|
|
8
10
|
export * from './checkout-gift-cards.component';
|
|
9
11
|
export * from './checkout-header.component';
|
|
10
12
|
export * from './checkout-information.component';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const STRIPE_SLOT_NAME = "lce-checkout-stripe-slot";
|
|
2
|
+
export declare const STRIPE_MINIMUM_CHARGE = 50;
|
|
3
|
+
export declare const EXPRESS_CHECKOUT_SLOT_NAME = "lce-checkout-express-checkout-slot";
|
|
2
4
|
export declare const customerFormFields: {
|
|
3
5
|
readonly firstName: "firstName";
|
|
4
6
|
readonly lastName: "lastName";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { ICheckoutCustomer } from '@/interfaces/api/checkout.interface';
|
|
2
|
-
|
|
2
|
+
import type { ICheckoutLayout } from '@/interfaces/configs/checkout.interface';
|
|
3
|
+
export declare function isBirthDateRequired(layout: Pick<ICheckoutLayout, 'requireBirthDate'> | null | undefined): boolean;
|
|
4
|
+
export declare function isValidCustomerPrefill(customer: ICheckoutCustomer, requireBirthDate?: boolean, today?: Date): boolean;
|
|
5
|
+
export declare function isValidBirthDate(birthDate: string | null | undefined, today?: Date): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ICheckoutCustomer } from '@/interfaces/api/checkout.interface';
|
|
2
|
+
export interface IExpressWalletBillingDetails {
|
|
3
|
+
name?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
address?: Record<string, string | null>;
|
|
7
|
+
}
|
|
8
|
+
export declare function walletDisplayName(expressPaymentType: unknown): string;
|
|
9
|
+
export declare function splitWalletName(walletName: string | undefined, existing: Pick<ICheckoutCustomer, 'firstName' | 'lastName'> | null | undefined): {
|
|
10
|
+
firstName: string;
|
|
11
|
+
lastName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getExpressCheckoutStyles: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getExpressCompletionStyles: () => string;
|
|
@@ -22,7 +22,7 @@ export interface IInputComponentParams {
|
|
|
22
22
|
label?: string;
|
|
23
23
|
ariaLabel?: string;
|
|
24
24
|
name: string;
|
|
25
|
-
autocomplete?: boolean;
|
|
25
|
+
autocomplete?: boolean | string;
|
|
26
26
|
disabled?: boolean;
|
|
27
27
|
}
|
|
28
28
|
export declare class InputComponent extends BaseComponent<IInputComponentParams, null> {
|
|
@@ -13,3 +13,7 @@ export declare function normalizeEngravingLines(lines: readonly (string | null |
|
|
|
13
13
|
export declare function normalizeText<T extends string | null | undefined>(value: T): T;
|
|
14
14
|
export declare function normalizeEmail<T extends string | null | undefined>(value: T): T;
|
|
15
15
|
export declare function normalizeCode<T extends string | null | undefined>(value: T): T;
|
|
16
|
+
export declare function formatPaymentMethodLabel(card: {
|
|
17
|
+
brand?: string | null;
|
|
18
|
+
last4?: string | null;
|
|
19
|
+
} | null | undefined): string;
|
|
@@ -532,7 +532,9 @@ After `lce:actions.checkout_loaded`, call
|
|
|
532
532
|
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
533
533
|
to validate and prepare complete account details, then show their editable summary.
|
|
534
534
|
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
535
|
-
(age 21+, year 1930 or later).
|
|
535
|
+
(age 21+, year 1930 or later). The `birthDate` may be blank when the partner does not require a
|
|
536
|
+
date of birth (`checkout.layout.requireBirthDate: false`); a supplied one is still validated.
|
|
537
|
+
A shipping street must already be selected.
|
|
536
538
|
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
537
539
|
Partial or invalid details stay in the form; backend validation failures reject the
|
|
538
540
|
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
package/docs/v1/api/client.md
CHANGED
|
@@ -64,6 +64,55 @@ const client = await ElementsCheckout('YOUR_API_KEY', {
|
|
|
64
64
|
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
The checkout-only client exposes `injectCheckout()`, `injectExpressCheckout()`, `actions.checkout`
|
|
68
|
+
and `destroy()`.
|
|
69
|
+
|
|
70
|
+
#### injectExpressCheckout()
|
|
71
|
+
|
|
72
|
+
Injects only the Apple Pay and Google Pay wallet buttons, anywhere on the page, without the rest of
|
|
73
|
+
the checkout UI. Confirming the wallet sheet places the order outright — the wallet's contact and
|
|
74
|
+
billing details are sent to the checkout, so the shopper never fills a checkout form.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
injectExpressCheckout(params: IInjectExpressCheckoutParams): Promise<IInjectedComponent | null>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Parameter | Type | Required | Description |
|
|
81
|
+
|-----------|------|----------|-------------|
|
|
82
|
+
| `containerId` | string | Yes | ID of an element that already exists in the DOM |
|
|
83
|
+
| `checkoutId` | string | No | Checkout token to bind the buttons to. Omit to use the checkout already loaded |
|
|
84
|
+
| `variant` | `'buttons' \| 'section'` | No | `'buttons'` (default) is the wallet row alone; `'section'` adds the "Express Checkout" heading and OR divider |
|
|
85
|
+
|
|
86
|
+
A checkout is prepared at injection time rather than when a button is tapped: Stripe gives the
|
|
87
|
+
wallet's click handler one second to open its sheet, which is not enough time to create a checkout
|
|
88
|
+
and a payment session. Without a `checkoutId` the checkout already in the store is reused, so the
|
|
89
|
+
buttons can be injected beside a checkout the page has already loaded; the checkout-only client has
|
|
90
|
+
no cart to fall back on, so it throws when there is no loaded checkout to attach to. Inject again
|
|
91
|
+
with a new token whenever the address or fulfillment changes — the amounts the sheet shows come from
|
|
92
|
+
the checkout the buttons were prepared against.
|
|
93
|
+
|
|
94
|
+
The buttons only render where the shopper's platform offers a wallet, and the block hides itself
|
|
95
|
+
entirely otherwise. Subscribe to `lce:actions.checkout_express_checkout_availability` to know which
|
|
96
|
+
state you are in. Both wallets require an HTTPS origin on a domain registered with Stripe, each
|
|
97
|
+
subdomain separately — see the
|
|
98
|
+
[checkout component guide](../guides/checkout-component.md#express-checkout-apple-pay-and-google-pay).
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
await client.injectExpressCheckout({
|
|
102
|
+
containerId: 'express-checkout-container'
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The full client exposes the same component as `injectExpressCheckoutElement()`, with the same
|
|
107
|
+
parameters. It differs in one way: with no `checkoutId` and no checkout loaded, it prepares one from
|
|
108
|
+
the current cart rather than throwing.
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
await client.injectExpressCheckoutElement({
|
|
112
|
+
containerId: 'pdp-express-checkout'
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
67
116
|
### ElementsBuilder()
|
|
68
117
|
|
|
69
118
|
Initialize the builder client, which exposes manual `inject*` / `update*` methods for fully programmatic composition.
|
|
@@ -335,6 +335,7 @@ interface ICheckoutLayout {
|
|
|
335
335
|
emailOptIn: ICheckoutMarketingOptIn;
|
|
336
336
|
smsOptIn: ICheckoutMarketingOptIn;
|
|
337
337
|
allowGiftCards: boolean;
|
|
338
|
+
requireBirthDate?: boolean;
|
|
338
339
|
legalMessage: ICheckoutLegalMessage;
|
|
339
340
|
continueShoppingUrl: string;
|
|
340
341
|
exitUrl: string;
|
|
@@ -350,6 +351,7 @@ interface ICheckoutLayout {
|
|
|
350
351
|
| `emailOptIn` | `ICheckoutMarketingOptIn` | Email marketing opt-in configuration |
|
|
351
352
|
| `smsOptIn` | `ICheckoutMarketingOptIn` | SMS marketing opt-in configuration |
|
|
352
353
|
| `allowGiftCards` | `boolean` | Enable gift card payment option |
|
|
354
|
+
| `requireBirthDate` | `boolean` | Whether the shopper must enter a date of birth to place an order. Defaults to `true`. When `false` the form's field is optional and express checkout does not ask for it |
|
|
353
355
|
| `legalMessage` | `ICheckoutLegalMessage` | Legal/terms message configuration |
|
|
354
356
|
| `continueShoppingUrl` | `string` | URL for "Continue Shopping" link |
|
|
355
357
|
| `exitUrl` | `string` | URL for exit/back navigation |
|
|
@@ -546,7 +548,7 @@ interface IElementsGTMConfig {
|
|
|
546
548
|
}
|
|
547
549
|
```
|
|
548
550
|
|
|
549
|
-
If your site loads its own GTM container through Google tag gateway for advertisers, set `gatewayUrl` to that first-party path (e.g. `'https://www.yoursite.com/metrics/'` or `'/metrics/'`) so the SDK recognizes the container
|
|
551
|
+
If your site loads its own GTM container through Google tag gateway for advertisers, set `gatewayUrl` to that first-party path (e.g. `'https://www.yoursite.com/metrics/'` or `'/metrics/'`) so the SDK recognizes the container before GTM has booted it. It affects detection only: your container receives SDK events through `dataLayer` with or without it. Declarative equivalent: `data-gtm-gateway-url`. An empty or non-string value drops the whole `gtm` config with a console warning.
|
|
550
552
|
|
|
551
553
|
See [Analytics → Google tag gateway](../reference/analytics.md#google-tag-gateway).
|
|
552
554
|
|
|
@@ -80,9 +80,16 @@ Checkout-only client interface returned by `ElementsCheckout()`.
|
|
|
80
80
|
```typescript
|
|
81
81
|
interface IElementsCheckoutClient {
|
|
82
82
|
injectCheckout(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
83
|
+
injectExpressCheckout(params: IInjectExpressCheckoutParams): Promise<IInjectedComponent | null>;
|
|
83
84
|
actions: { checkout: IElementsCheckoutActions };
|
|
84
85
|
destroy(): void;
|
|
85
86
|
}
|
|
87
|
+
|
|
88
|
+
interface IInjectExpressCheckoutParams {
|
|
89
|
+
containerId: string;
|
|
90
|
+
checkoutId?: string; // omit to use the checkout already loaded
|
|
91
|
+
variant?: 'section' | 'buttons'; // 'buttons' is the default outside the checkout element
|
|
92
|
+
}
|
|
86
93
|
```
|
|
87
94
|
|
|
88
95
|
---
|
|
@@ -440,7 +447,9 @@ After `lce:actions.checkout_loaded`, call
|
|
|
440
447
|
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
441
448
|
to validate and prepare complete account details, then show their editable summary.
|
|
442
449
|
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
443
|
-
(age 21+, year 1930 or later).
|
|
450
|
+
(age 21+, year 1930 or later). The `birthDate` may be blank when the partner does not require a
|
|
451
|
+
date of birth (`checkout.layout.requireBirthDate: false`); a supplied one is still validated.
|
|
452
|
+
A shipping street must already be selected.
|
|
444
453
|
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
445
454
|
Partial or invalid details stay in the form; backend validation failures reject the
|
|
446
455
|
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|