@liquidcommerce/elements-sdk 2.6.0-beta.129 → 2.6.0-beta.130
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 -1
- package/dist/index.checkout.esm.js +10290 -8969
- package/dist/index.esm.js +15124 -13833
- package/dist/ssr-stub.esm.js +2 -0
- package/dist/types/core/a11y/focus-manager.service.d.ts +1 -1
- package/dist/types/core/client/actions/client-checkout-action.service.d.ts +5 -0
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +2 -0
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +3 -0
- package/dist/types/enums/core.enum.d.ts +2 -0
- package/dist/types/index.checkout.d.ts +1 -0
- package/dist/types/interfaces/api/checkout.interface.d.ts +5 -1
- package/dist/types/interfaces/api/delivery.interface.d.ts +24 -0
- package/dist/types/interfaces/api/index.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +23 -0
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-delivery-scheduling.component.d.ts +51 -0
- package/dist/types/modules/checkout/components/checkout-express-checkout.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-item.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/index.d.ts +1 -0
- package/dist/types/ssr/stub.checkout.d.ts +1 -0
- package/dist/types/ssr/stub.d.ts +1 -0
- package/dist/types/utils/delivery-scheduling.d.ts +43 -0
- package/docs/v1/api/actions/checkout-actions.md +40 -0
- package/docs/v1/api/client.md +2 -0
- package/docs/v1/api/typescript-types.md +37 -0
- package/docs/v1/guides/accessibility.md +4 -0
- package/docs/v1/guides/checkout-component.md +46 -0
- package/docs/v1/guides/events.md +14 -1
- package/package.json +1 -1
package/dist/ssr-stub.esm.js
CHANGED
|
@@ -115,6 +115,7 @@ const ELEMENTS_ACTIONS_EVENT = {
|
|
|
115
115
|
CART_PRODUCT_ADD_FAILED: 'cart_product_add_failed',
|
|
116
116
|
INTERNAL_CART_TO_CHECKOUT: 'internal_cart_to_checkout',
|
|
117
117
|
CHECKOUT_LOADED: 'checkout_loaded',
|
|
118
|
+
CHECKOUT_DELIVERY_SELECTION_UPDATED: 'checkout_delivery_selection_updated',
|
|
118
119
|
CHECKOUT_OPENED: 'checkout_opened',
|
|
119
120
|
CHECKOUT_CLOSED: 'checkout_closed',
|
|
120
121
|
CHECKOUT_FAILED: 'checkout_failed',
|
|
@@ -216,6 +217,7 @@ const COMPONENT_TYPE = {
|
|
|
216
217
|
CHECKOUT_BUYER: 'checkout-buyer',
|
|
217
218
|
CHECKOUT_BUYER_SUMMARY: 'checkout-buyer-summary',
|
|
218
219
|
CHECKOUT_TIPS: 'checkout-tips',
|
|
220
|
+
CHECKOUT_DELIVERY_SCHEDULING: 'checkout-delivery-scheduling',
|
|
219
221
|
CHECKOUT_PC_GC: 'checkout-pc-gc',
|
|
220
222
|
CHECKOUT_ITEM: 'checkout-item',
|
|
221
223
|
CHECKOUT_ITEM_QUANTITY: 'checkout-item-quantity',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const A11Y_PERSIST_ATTRIBUTE = "data-lce-a11y-persist";
|
|
2
|
-
export type FocusScope = 'drawer' | 'product-drawer';
|
|
2
|
+
export type FocusScope = 'drawer' | 'product-drawer' | 'delivery-scheduling';
|
|
3
3
|
export declare class FocusManagerService {
|
|
4
4
|
private readonly triggerStacks;
|
|
5
5
|
private hiddenBackground;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
2
2
|
import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse, ICheckoutMarketingPreferences } from '@/interfaces/api/checkout.interface';
|
|
3
|
+
import type { DeliverySlot } from '@/interfaces/api/delivery.interface';
|
|
3
4
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
4
5
|
import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/constant';
|
|
5
6
|
import { BaseActionService } from './base-action.service';
|
|
@@ -35,6 +36,8 @@ export interface ICheckoutActions {
|
|
|
35
36
|
}) => Promise<void>;
|
|
36
37
|
updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
|
|
37
38
|
updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
|
|
39
|
+
loadDeliverySlots: (fulfillmentId: string) => Promise<DeliverySlot[]>;
|
|
40
|
+
chooseDeliverySlot: (fulfillmentId: string, slotId: string | null) => Promise<void>;
|
|
38
41
|
getDetails: () => ICheckoutDetailsEventData;
|
|
39
42
|
getProductAvailabilityByState: (identifiers: string[], state?: string) => Promise<IProductAvailabilityResponse>;
|
|
40
43
|
addAnonymousProduct: (params: IAnonymousCheckoutAddProductParams) => Promise<IAnonymousCheckoutAddProductResponse>;
|
|
@@ -70,6 +73,8 @@ export declare class ClientCheckoutActionService extends BaseActionService {
|
|
|
70
73
|
private updateCustomerInfo;
|
|
71
74
|
private updateBillingInfo;
|
|
72
75
|
private updateGiftInfo;
|
|
76
|
+
private loadDeliverySlots;
|
|
77
|
+
private chooseDeliverySlot;
|
|
73
78
|
private getDetails;
|
|
74
79
|
private addAnonymousProduct;
|
|
75
80
|
private getProductAvailabilityByState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ICheckoutAmounts, ICheckoutItem } from '@/interfaces/api/checkout.interface';
|
|
2
|
+
import type { CheckoutDeliveryScheduling } from '@/interfaces/api/delivery.interface';
|
|
2
3
|
export interface IBaseCheckoutEventData {
|
|
3
4
|
token: string;
|
|
4
5
|
cartId: string;
|
|
@@ -12,6 +13,7 @@ export interface IBaseCheckoutEventData {
|
|
|
12
13
|
hasGiftCards: boolean;
|
|
13
14
|
amounts: ICheckoutAmounts;
|
|
14
15
|
itemCount: number;
|
|
16
|
+
deliveryScheduling: Record<string, CheckoutDeliveryScheduling>;
|
|
15
17
|
items: Record<string, ICheckoutItem>;
|
|
16
18
|
}
|
|
17
19
|
export interface ICheckoutLoadedEventData extends IBaseCheckoutEventData {
|
|
@@ -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, ICheckoutDeliveryMethodUpdatedEventData, ICheckoutExpressCheckoutAvailabilityEventData, ICheckoutExpressCheckoutStartedEventData, ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutGiftInformationUpdatedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutPaymentFormFailedEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
3
|
+
import type { ICheckoutBillingInformationUpdatedEventData, ICheckoutCustomerInformationUpdatedEventData, ICheckoutDeliveryMethodUpdatedEventData, ICheckoutDetailsEventData, ICheckoutExpressCheckoutAvailabilityEventData, ICheckoutExpressCheckoutStartedEventData, ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutGiftInformationUpdatedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutPaymentFormFailedEventData, 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 {
|
|
@@ -58,6 +58,7 @@ export interface IElementsActionsEventsMap {
|
|
|
58
58
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_OPENED]: boolean;
|
|
59
59
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_CLOSED]: boolean;
|
|
60
60
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_LOADED]: ICheckoutLoadedEventData;
|
|
61
|
+
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_DELIVERY_SELECTION_UPDATED]: ICheckoutDetailsEventData;
|
|
61
62
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_FAILED]: ICheckoutFailedEventData;
|
|
62
63
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_IS_GIFT_TOGGLED]: ICheckoutToggleEventData;
|
|
63
64
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED]: ICheckoutToggleEventData;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ICheckoutAmounts, ICheckoutBilling, ICheckoutCustomer, ICheckoutEvent, ICheckoutFulfillment, ICheckoutFulfillmentMethod, ICheckoutGiftCard, ICheckoutGiftRecipient, ICheckoutItem, ICheckoutMarketingPreferences, ICheckoutPaymentConfirm, ICheckoutPaymentSession, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer, ICheckoutShippingAddress } from '@/interfaces/api/checkout.interface';
|
|
2
|
+
export type DeliveryWindowLapse = 'expired' | 'unavailable';
|
|
2
3
|
export interface ICheckoutItemStore extends ICheckoutItem {
|
|
3
4
|
loading: boolean;
|
|
4
5
|
updating: boolean;
|
|
@@ -64,6 +65,8 @@ export interface ICheckoutStore {
|
|
|
64
65
|
itemsQuantity: number;
|
|
65
66
|
items: Record<string, ICheckoutItemStore>;
|
|
66
67
|
fulfillments: Record<string, ICheckoutFulfillment>;
|
|
68
|
+
deliveryWindowLapses: Record<string, DeliveryWindowLapse>;
|
|
69
|
+
deliveryScheduleNotice: string | null;
|
|
67
70
|
retailers: Record<string, ICheckoutRetailer>;
|
|
68
71
|
amounts: ICheckoutAmounts;
|
|
69
72
|
orderNumber: string | null;
|
|
@@ -34,6 +34,7 @@ export declare const ELEMENTS_ACTIONS_EVENT: {
|
|
|
34
34
|
readonly CART_PRODUCT_ADD_FAILED: "cart_product_add_failed";
|
|
35
35
|
readonly INTERNAL_CART_TO_CHECKOUT: "internal_cart_to_checkout";
|
|
36
36
|
readonly CHECKOUT_LOADED: "checkout_loaded";
|
|
37
|
+
readonly CHECKOUT_DELIVERY_SELECTION_UPDATED: "checkout_delivery_selection_updated";
|
|
37
38
|
readonly CHECKOUT_OPENED: "checkout_opened";
|
|
38
39
|
readonly CHECKOUT_CLOSED: "checkout_closed";
|
|
39
40
|
readonly CHECKOUT_FAILED: "checkout_failed";
|
|
@@ -135,6 +136,7 @@ export declare const COMPONENT_TYPE: {
|
|
|
135
136
|
readonly CHECKOUT_BUYER: "checkout-buyer";
|
|
136
137
|
readonly CHECKOUT_BUYER_SUMMARY: "checkout-buyer-summary";
|
|
137
138
|
readonly CHECKOUT_TIPS: "checkout-tips";
|
|
139
|
+
readonly CHECKOUT_DELIVERY_SCHEDULING: "checkout-delivery-scheduling";
|
|
138
140
|
readonly CHECKOUT_PC_GC: "checkout-pc-gc";
|
|
139
141
|
readonly CHECKOUT_ITEM: "checkout-item";
|
|
140
142
|
readonly CHECKOUT_ITEM_QUANTITY: "checkout-item-quantity";
|
|
@@ -6,5 +6,6 @@ import type { IAnalyticsActions, IElementsCheckoutActions, IElementsCheckoutClie
|
|
|
6
6
|
import type { IInjectedComponent } from '@/interfaces/component.interface';
|
|
7
7
|
import type { ILiquidCommerceElementsCheckoutClientConfig } from '@/interfaces/config.interface';
|
|
8
8
|
import type { IInjectCheckoutParams, IInjectExpressCheckoutParams } from '@/interfaces/injection.interface';
|
|
9
|
+
export type { CheckoutDeliveryScheduling, CheckoutDeliverySelection, DeliveryAvailability, DeliverySlot, } from './interfaces/api/delivery.interface';
|
|
9
10
|
export type { DebugMode, ElementsEnv, IAnalyticsActions, IAnalyticsAddress, IAnalyticsAddressFailure, IAnalyticsAvailability, IAnalyticsFulfillmentAvailability, IAnalyticsItem, IAnalyticsItemList, IElementsCheckoutActions, IElementsCheckoutClient, IInjectCheckoutParams, IInjectExpressCheckoutParams, IInjectedComponent, ILiquidCommerceElementsCheckoutClientConfig, };
|
|
10
11
|
export { DEBUG_MODE, ELEMENTS_ENV, ElementsCheckout };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CheckoutEventLevel, CheckoutEventType, FulfillmentType } from '@/enums';
|
|
2
2
|
import type { IAddressAddress, IAddressCoordinates, ILocation } from '@/interfaces/api/address.interface';
|
|
3
3
|
import type { ICart, ICartUpdateItem } from '@/interfaces/api/cart.interface';
|
|
4
|
+
import type { CheckoutDeliveryScheduling, CheckoutDeliverySelection } from '@/interfaces/api/delivery.interface';
|
|
4
5
|
import type { IProductPresale } from '@/interfaces/api/product.interface';
|
|
5
6
|
export interface ICheckoutComplete {
|
|
6
7
|
orderNumber: string;
|
|
@@ -80,6 +81,8 @@ export interface ICheckoutPrepareParams {
|
|
|
80
81
|
giftOptions?: ICheckoutGiftRecipient;
|
|
81
82
|
marketingPreferences?: ICheckoutMarketingPreferences;
|
|
82
83
|
deliveryTips?: ICheckoutDeliveryTip[];
|
|
84
|
+
deliverySelections?: CheckoutDeliverySelection[];
|
|
85
|
+
deliverySlotsFulfillmentId?: string;
|
|
83
86
|
deliveryInstructions?: ICheckoutDeliveryInstructions[];
|
|
84
87
|
payment?: string;
|
|
85
88
|
promoCode?: string;
|
|
@@ -135,7 +138,7 @@ export interface ICheckoutFulfillmentMethod {
|
|
|
135
138
|
retailerId: string;
|
|
136
139
|
reason: CheckoutFulfillmentUnavailableReason | null;
|
|
137
140
|
}
|
|
138
|
-
export type ICheckoutFulfillmentCarryOver = Omit<ICheckoutPrepareParams, 'cartId' | 'token' | 'deliveryTips' | 'deliveryInstructions'>;
|
|
141
|
+
export type ICheckoutFulfillmentCarryOver = Omit<ICheckoutPrepareParams, 'cartId' | 'token' | 'deliveryTips' | 'deliveryInstructions' | 'deliverySelections' | 'deliverySlotsFulfillmentId'>;
|
|
139
142
|
export interface ICheckoutFulfillmentParams {
|
|
140
143
|
cartId: string;
|
|
141
144
|
location: ILocation;
|
|
@@ -223,6 +226,7 @@ export interface ICheckoutItem {
|
|
|
223
226
|
attributes: ICheckoutItemAttributes;
|
|
224
227
|
}
|
|
225
228
|
export interface ICheckoutFulfillment {
|
|
229
|
+
deliveryScheduling?: CheckoutDeliveryScheduling;
|
|
226
230
|
id: string;
|
|
227
231
|
deliveryInstructions: string;
|
|
228
232
|
type: FulfillmentType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface DeliverySlot {
|
|
2
|
+
id: string;
|
|
3
|
+
start: string;
|
|
4
|
+
end: string;
|
|
5
|
+
cutoff: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DeliveryAvailability {
|
|
8
|
+
status: 'available' | 'unavailable';
|
|
9
|
+
canDeliverNow: boolean;
|
|
10
|
+
canSchedule: boolean;
|
|
11
|
+
timezone: string | null;
|
|
12
|
+
nextSlot: DeliverySlot | null;
|
|
13
|
+
checkedAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CheckoutDeliveryScheduling {
|
|
16
|
+
availability: DeliveryAvailability;
|
|
17
|
+
slots: DeliverySlot[];
|
|
18
|
+
selectedSlotId: string | null;
|
|
19
|
+
selectedSlot?: DeliverySlot | null;
|
|
20
|
+
}
|
|
21
|
+
export interface CheckoutDeliverySelection {
|
|
22
|
+
fulfillmentId: string;
|
|
23
|
+
slotId: string | null;
|
|
24
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkou
|
|
|
3
3
|
import type { ICheckoutPaymentMethodStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
4
|
import type { FulfillmentType } from '@/enums';
|
|
5
5
|
import type { CheckoutPaymentSessionType, ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPaymentSession, ICheckoutPrepare } from '@/interfaces/api/checkout.interface';
|
|
6
|
+
import type { DeliverySlot } from '@/interfaces/api/delivery.interface';
|
|
6
7
|
import type { AddItemParams } from '@/modules/cart/cart.commands';
|
|
7
8
|
import type { PresaleExpiredReason } from '@/modules/checkout/components';
|
|
8
9
|
import { type IExpressWalletBillingDetails } from '@/modules/checkout/express-wallet';
|
|
@@ -22,9 +23,31 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
22
23
|
private customerEditRevision;
|
|
23
24
|
private customerEditedGeneration;
|
|
24
25
|
private confirmedPayment;
|
|
26
|
+
private offeredDeliverySlots;
|
|
27
|
+
private offeredDeliveryAddress;
|
|
28
|
+
private savingDeliverySelection;
|
|
25
29
|
private expressHandoff;
|
|
26
30
|
private get requiresBirthDate();
|
|
27
31
|
assertPaymentReady(): void;
|
|
32
|
+
private assertDeliveryScheduleReady;
|
|
33
|
+
private lapsedDeliveryWindowIds;
|
|
34
|
+
private clearLapsedDeliveryWindows;
|
|
35
|
+
private offeredSlots;
|
|
36
|
+
private findOfferedDeliverySlot;
|
|
37
|
+
loadDeliverySlots(fulfillmentId: string): Promise<DeliverySlot[]>;
|
|
38
|
+
chooseDeliverySlot(fulfillmentId: string, slotId: string | null): Promise<void>;
|
|
39
|
+
private completionError;
|
|
40
|
+
private dropDeliveryScheduling;
|
|
41
|
+
private forgetDeliveryWindow;
|
|
42
|
+
private assertDeliverySlotChoosable;
|
|
43
|
+
private responseFulfillments;
|
|
44
|
+
private findResponseFulfillment;
|
|
45
|
+
private withDeliverySlotDetails;
|
|
46
|
+
private responseFulfillmentIds;
|
|
47
|
+
private expiredDeliveryMarksWith;
|
|
48
|
+
private pruneExpiredDeliveryWindows;
|
|
49
|
+
private expireDeliveryWindows;
|
|
50
|
+
private prepareWithWindowRecovery;
|
|
28
51
|
retryLoadCheckout(): Promise<void>;
|
|
29
52
|
private paymentSessionRequest;
|
|
30
53
|
constructor();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseComponent } from '@/core/base-component.service';
|
|
2
2
|
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
3
|
+
import type { PlacedDeliveryWindow } from '@/utils/delivery-scheduling';
|
|
3
4
|
export interface ICheckoutCompletedComponentParams {
|
|
4
5
|
orderNumber: string;
|
|
5
6
|
orderTotal: number;
|
|
@@ -9,6 +10,7 @@ export interface ICheckoutCompletedComponentParams {
|
|
|
9
10
|
checkoutToken?: string;
|
|
10
11
|
cartId?: string;
|
|
11
12
|
isCompleted?: boolean;
|
|
13
|
+
deliveryWindows?: PlacedDeliveryWindow[];
|
|
12
14
|
}
|
|
13
15
|
export declare class CheckoutCompletedComponent extends BaseComponent<ICheckoutCompletedComponentParams, ICheckoutComponent> {
|
|
14
16
|
get hostClasses(): string[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
+
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
3
|
+
export declare class CheckoutDeliverySchedulingComponent extends BaseComponent<null, ICheckoutComponent> {
|
|
4
|
+
private draft;
|
|
5
|
+
private dialog;
|
|
6
|
+
private paintScheduled;
|
|
7
|
+
private error;
|
|
8
|
+
private pendingFocus;
|
|
9
|
+
private restoreTrigger;
|
|
10
|
+
private releaseFocusTrap;
|
|
11
|
+
private readonly focusManager;
|
|
12
|
+
private handledExpired;
|
|
13
|
+
private loadToken;
|
|
14
|
+
private announcedNotice;
|
|
15
|
+
private timesScroll;
|
|
16
|
+
constructor();
|
|
17
|
+
private get busy();
|
|
18
|
+
private get expiredIds();
|
|
19
|
+
protected afterRender(): void;
|
|
20
|
+
protected onStoreChanged(): boolean;
|
|
21
|
+
private update;
|
|
22
|
+
private paint;
|
|
23
|
+
private showDialog;
|
|
24
|
+
private settle;
|
|
25
|
+
private keepTimeInView;
|
|
26
|
+
protected disconnected(): void;
|
|
27
|
+
private endPicker;
|
|
28
|
+
private draftFulfillment;
|
|
29
|
+
private openForNewlyExpired;
|
|
30
|
+
private dayKey;
|
|
31
|
+
private todayKey;
|
|
32
|
+
private draftScheduling;
|
|
33
|
+
private openPicker;
|
|
34
|
+
private loadSlots;
|
|
35
|
+
private whenIdle;
|
|
36
|
+
private closePicker;
|
|
37
|
+
private saveDraft;
|
|
38
|
+
private createGroup;
|
|
39
|
+
private get schedulingAllowed();
|
|
40
|
+
private summaryText;
|
|
41
|
+
private radio;
|
|
42
|
+
private createDates;
|
|
43
|
+
private createTimes;
|
|
44
|
+
private createNotice;
|
|
45
|
+
private createLoading;
|
|
46
|
+
private createDialogShell;
|
|
47
|
+
private fillDialog;
|
|
48
|
+
private captureViewState;
|
|
49
|
+
private createRows;
|
|
50
|
+
protected template(): HTMLElement[];
|
|
51
|
+
}
|
|
@@ -20,6 +20,7 @@ export declare class CheckoutExpressCheckoutComponent extends BaseComponent<IChe
|
|
|
20
20
|
private hasAvailableWallets;
|
|
21
21
|
private availableWallets;
|
|
22
22
|
private hasSettledAvailability;
|
|
23
|
+
private scheduleReadyAtMount;
|
|
23
24
|
private lastPublishedAvailability;
|
|
24
25
|
get hostClasses(): string[];
|
|
25
26
|
constructor();
|
|
@@ -28,6 +29,7 @@ export declare class CheckoutExpressCheckoutComponent extends BaseComponent<IChe
|
|
|
28
29
|
private get isCompletingExpress();
|
|
29
30
|
private get isButtonsOnly();
|
|
30
31
|
private get isReadyForPayment();
|
|
32
|
+
private get isDeliveryScheduleReady();
|
|
31
33
|
private get isGiftOrder();
|
|
32
34
|
protected template(): HTMLElement[];
|
|
33
35
|
protected afterRender(): void;
|
|
@@ -7,6 +7,8 @@ export declare class CheckoutItemComponent extends BaseComponent<ICheckoutItemCo
|
|
|
7
7
|
get hostClasses(): string[];
|
|
8
8
|
constructor();
|
|
9
9
|
onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
|
|
10
|
+
private deliveryExpectation;
|
|
11
|
+
private updateDeliveryExpectation;
|
|
10
12
|
private updateEngravingElement;
|
|
11
13
|
private setupMinimumPurchaseAlert;
|
|
12
14
|
private updateTrashButtonState;
|
|
@@ -18,6 +18,8 @@ export declare class CheckoutPaymentComponent extends BaseComponent<ICheckoutSen
|
|
|
18
18
|
get hostClasses(): string[];
|
|
19
19
|
constructor();
|
|
20
20
|
private getInjectedPaymentMethod;
|
|
21
|
+
private scheduleReady;
|
|
22
|
+
private deliveryPaymentReady;
|
|
21
23
|
onStoreWatch(changes: IOnStoreChanged[]): void;
|
|
22
24
|
private handleBillingSameAsShippingChange;
|
|
23
25
|
afterRender(): Promise<void>;
|
|
@@ -6,6 +6,7 @@ export * from './checkout-completed.component';
|
|
|
6
6
|
export * from './checkout-deliver-to.component';
|
|
7
7
|
export * from './checkout-deliver-to-summary.component';
|
|
8
8
|
export * from './checkout-delivery-method.component';
|
|
9
|
+
export * from './checkout-delivery-scheduling.component';
|
|
9
10
|
export * from './checkout-express-checkout.component';
|
|
10
11
|
export * from './checkout-express-completion.component';
|
|
11
12
|
export * from './checkout-gift-cards.component';
|
|
@@ -5,3 +5,4 @@ export type { IAnalyticsActions, IElementsCheckoutActions, IElementsCheckoutClie
|
|
|
5
5
|
export type { IInjectedComponent } from '../interfaces/component.interface';
|
|
6
6
|
export type { ILiquidCommerceElementsCheckoutClientConfig } from '../interfaces/config.interface';
|
|
7
7
|
export declare function ElementsCheckout(..._args: any[]): Promise<null>;
|
|
8
|
+
export type { CheckoutDeliveryScheduling, CheckoutDeliverySelection, DeliveryAvailability, DeliverySlot, } from '../interfaces/api/delivery.interface';
|
package/dist/types/ssr/stub.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export type * from '../interfaces/configs';
|
|
|
9
9
|
export type { IBuilderInjectElementParams, IInjectCheckoutBuilderParams, IInjectCheckoutParams, IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams, ProductListFilterType, } from '../interfaces/injection.interface';
|
|
10
10
|
export declare function Elements(..._args: any[]): Promise<null>;
|
|
11
11
|
export declare function ElementsBuilder(..._args: any[]): Promise<null>;
|
|
12
|
+
export type { CheckoutDeliveryScheduling, CheckoutDeliverySelection, DeliveryAvailability, DeliverySlot, } from '../interfaces/api/delivery.interface';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ApiError } from '@/core/api/api-result';
|
|
2
|
+
import type { DeliveryWindowLapse } from '@/core/store/interfaces/checkout.interface';
|
|
3
|
+
import type { StoreService } from '@/core/store/store.service';
|
|
4
|
+
import type { ICheckoutFulfillment, ICheckoutRetailer, ICheckoutShippingAddress } from '@/interfaces/api/checkout.interface';
|
|
5
|
+
import type { CheckoutDeliveryScheduling, DeliverySlot } from '@/interfaces/api/delivery.interface';
|
|
6
|
+
export declare const LAPSED_DELIVERY_WINDOW_CODES: readonly string[];
|
|
7
|
+
export declare const DELIVERY_WINDOW_EXPIRED_MESSAGE = "Your delivery window has passed. Choose a new delivery time.";
|
|
8
|
+
export declare const DELIVERY_WINDOW_UNAVAILABLE_MESSAGE = "Your delivery window is no longer available. Choose a new delivery time.";
|
|
9
|
+
export declare const UNSUPPORTED_DELIVERY_SCHEDULING_CODES: readonly string[];
|
|
10
|
+
export declare const DELIVERY_SELECTION_NOT_ACCEPTED_CODE = "delivery_selection_not_accepted";
|
|
11
|
+
export declare const DELIVERY_SELECTION_NOT_ACCEPTED_MESSAGE = "We couldn't save that delivery time. Choose a delivery time again.";
|
|
12
|
+
export declare const SAVED_DELIVERY_WINDOW_LABEL = "Scheduled delivery";
|
|
13
|
+
export declare const DELIVERY_SCHEDULING_UNAVAILABLE_MESSAGE = "Scheduled delivery isn't available for this order right now. We'll deliver as soon as possible.";
|
|
14
|
+
export declare function expiredDeliveryFulfillmentIds(store: Pick<StoreService, 'get'>): string[];
|
|
15
|
+
export declare function deliveryWindowLapseOf(error: Pick<ApiError, 'errors'> | null | undefined): DeliveryWindowLapse;
|
|
16
|
+
export type DeliveryWindowLapseText = 'message' | 'label';
|
|
17
|
+
export declare function deliveryWindowLapseMessage(lapse: DeliveryWindowLapse | null | undefined, text?: DeliveryWindowLapseText): string;
|
|
18
|
+
export declare function lapsedDeliveryWindowMessage(store: Pick<StoreService, 'get'>, fulfillmentId: string, text?: DeliveryWindowLapseText): string;
|
|
19
|
+
export declare function withoutDeliveryWindow(fulfillment: ICheckoutFulfillment): ICheckoutFulfillment;
|
|
20
|
+
export declare function isLapsedDeliveryWindowError(error: Pick<ApiError, 'errors'> | null | undefined): boolean;
|
|
21
|
+
export declare function isNotAcceptedDeliverySelectionError(error: Pick<ApiError, 'errors'> | null | undefined): boolean;
|
|
22
|
+
export declare function isUnsupportedDeliverySchedulingError(error: Pick<ApiError, 'errors'> | null | undefined): boolean;
|
|
23
|
+
export declare function deliveryAddressKey(address: ICheckoutShippingAddress | null | undefined): string;
|
|
24
|
+
export declare function isFutureDeliverySlot(slot: DeliverySlot | null | undefined, now?: number): boolean;
|
|
25
|
+
export declare function selectedDeliverySlot(scheduling: CheckoutDeliveryScheduling | null | undefined): DeliverySlot | null;
|
|
26
|
+
export declare function isLapsedSelectedDeliverySlot(scheduling: CheckoutDeliveryScheduling | null | undefined, now?: number): boolean;
|
|
27
|
+
export declare function deliverySchedulesReady(fulfillments: Record<string, ICheckoutFulfillment>, now?: number, expired?: string[]): boolean;
|
|
28
|
+
export declare function deliveryChoicesMade(fulfillments: Record<string, ICheckoutFulfillment>, expired?: string[]): boolean;
|
|
29
|
+
export declare function hasDeliveryScheduling(fulfillments: Record<string, ICheckoutFulfillment> | null | undefined): boolean;
|
|
30
|
+
export declare function deliverySchedulingAllowed(fulfillments: Record<string, ICheckoutFulfillment> | null | undefined): boolean;
|
|
31
|
+
export declare function deliveryTimeZone(timezone: string | null | undefined): string;
|
|
32
|
+
export declare function deliveryDateLabel(slot: DeliverySlot, timezone: string): string;
|
|
33
|
+
export declare function deliveryTimeZoneName(timezone: string, style?: 'short' | 'long'): string;
|
|
34
|
+
export declare function deliveryTimeLabel(slot: DeliverySlot, timezone: string): string;
|
|
35
|
+
export declare function deliveryWindowLabel(slot: DeliverySlot, timezone: string): string;
|
|
36
|
+
export declare function deliveryScheduledLabel(slot: DeliverySlot, timezone: string): string;
|
|
37
|
+
export declare function deliveryCutoffLabel(slot: DeliverySlot, timezone: string): string;
|
|
38
|
+
export interface PlacedDeliveryWindow {
|
|
39
|
+
retailerName: string | null;
|
|
40
|
+
label: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function placedDeliveryWindows(fulfillments: Record<string, ICheckoutFulfillment> | null | undefined, retailers: Record<string, ICheckoutRetailer> | null | undefined): PlacedDeliveryWindow[];
|
|
43
|
+
export declare function resolveDeliverySlot(scheduling: CheckoutDeliveryScheduling | undefined, advertised: DeliverySlot, now?: number): DeliverySlot | null;
|
|
@@ -405,6 +405,7 @@ console.log(`Is Gift: ${checkout.isGift}`);
|
|
|
405
405
|
|
|
406
406
|
```typescript
|
|
407
407
|
interface ICheckoutDetailsEventData {
|
|
408
|
+
deliveryScheduling: Record<string, CheckoutDeliveryScheduling>; // keyed by fulfillment ID; empty without scheduled delivery
|
|
408
409
|
token: string;
|
|
409
410
|
cartId: string;
|
|
410
411
|
isGift: boolean;
|
|
@@ -442,6 +443,45 @@ const availability = await window.LiquidCommerce.elements.actions.checkout
|
|
|
442
443
|
| `identifiers` | string[] | Yes | Array of product UPCs, SKUs, or IDs |
|
|
443
444
|
| `state` | string | No | Two-letter state code (e.g., `'NY'`) |
|
|
444
445
|
|
|
446
|
+
## Delivery scheduling actions
|
|
447
|
+
|
|
448
|
+
Available on both `Elements()` and `ElementsCheckout()` when a checkout fulfillment carries `deliveryScheduling` (an AccelPay retailer with scheduled delivery turned on). Checkouts without it keep their usual behaviour, and `getDetails().deliveryScheduling` is an empty map.
|
|
449
|
+
|
|
450
|
+
### `actions.checkout.loadDeliverySlots(fulfillmentId)`
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
loadDeliverySlots(fulfillmentId: string): Promise<DeliverySlot[]>
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Loads the full list of delivery windows for one fulfillment. Checkout prepare returns the list only on request, so outside this call `deliveryScheduling.slots` is empty and `availability.nextSlot` names the first window. The call sends the whole current checkout to prepare, plus `deliverySlotsFulfillmentId`, and resolves with the windows that can still be ordered. Each window's `cutoff` is the latest time to place the order for it ("Order by"). Show times in `availability.timezone`.
|
|
457
|
+
|
|
458
|
+
### `actions.checkout.chooseDeliverySlot(fulfillmentId, slotId)`
|
|
459
|
+
|
|
460
|
+
```typescript
|
|
461
|
+
chooseDeliverySlot(fulfillmentId: string, slotId: string | null): Promise<void>
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Saves a window from the last loaded list for one fulfillment, or `null` for as soon as possible (only when `availability.canDeliverNow` is true). The promise resolves after prepare accepts and echoes that exact selection. It rejects malformed arguments, unknown fulfillments, windows that were not offered, concurrent checkout updates, a checkout with more than one fulfillment group (only a checkout with one group can be scheduled) and server errors; a rejected save keeps the previously accepted choice, except after `delivery_selection_not_accepted` (below). Slot IDs come from the server; do not build them.
|
|
465
|
+
|
|
466
|
+
`getDetails().deliveryScheduling[fulfillmentId]` returns the availability, the accepted `selectedSlotId` and `selectedSlot` (the accepted window's `start`, `end` and `cutoff`).
|
|
467
|
+
|
|
468
|
+
```javascript
|
|
469
|
+
const actions = client.actions.checkout;
|
|
470
|
+
const [fulfillmentId] = Object.keys(actions.getDetails().deliveryScheduling);
|
|
471
|
+
if (fulfillmentId) {
|
|
472
|
+
const slots = await actions.loadDeliverySlots(fulfillmentId);
|
|
473
|
+
if (slots.length) await actions.chooseDeliverySlot(fulfillmentId, slots[0].id);
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Expired windows
|
|
478
|
+
|
|
479
|
+
If a saved window's cutoff passes, or the store's hours or zone rules no longer allow it, before the order is placed, the server answers Place Order, or any other checkout update, with error code `delivery_window_expired` or `delivery_window_unavailable`. Both are recovered the same way; only the message differs ("Your delivery window has passed. Choose a new delivery time." or "Your delivery window is no longer available. Choose a new delivery time."). The SDK then clears the window, marks the fulfillment as needing a new choice, shows the message, opens the picker and blocks payment and Place Order until the shopper saves a new choice. An update that hit the error is sent once more without the window, so the shopper's change still applies. Customer, address, payment, tip and notes stay as they were. A custom UI recovers the same way: load the windows again and call `chooseDeliverySlot`.
|
|
480
|
+
|
|
481
|
+
If prepare did not keep the window that was sent (error code `delivery_selection_not_accepted`, HTTP 409), the SDK drops the window it holds for that fulfillment so no later update sends it again. `chooseDeliverySlot` rejects with "We couldn't save that delivery time. Choose a delivery time again."; on any other update the window is recovered as an unavailable one.
|
|
482
|
+
|
|
483
|
+
When scheduled delivery stops applying to the order (`delivery_scheduling_not_enabled`, `delivery_windows_unsupported`, `multiple_fulfillment_groups` or `delivery_scheduling_unsupported`), the SDK drops the saved window with a re-prepare, keeps the rest of checkout and shows "Scheduled delivery isn't available for this order right now. We'll deliver as soon as possible." The picker does not open; the response no longer carries `deliveryScheduling`, so the delivery time row goes away. Switching the delivery method never carries a window over to the new fulfillment.
|
|
484
|
+
|
|
445
485
|
## Use Cases
|
|
446
486
|
|
|
447
487
|
### Pre-fill for Logged-In Users
|
package/docs/v1/api/client.md
CHANGED
|
@@ -596,6 +596,8 @@ import type {
|
|
|
596
596
|
} from '@liquidcommerce/elements-sdk';
|
|
597
597
|
```
|
|
598
598
|
|
|
599
|
+
Both package entries, including their Node/SSR stubs, export `DeliverySlot`, `DeliveryAvailability`, `CheckoutDeliveryScheduling` and `CheckoutDeliverySelection`. Both clients expose `actions.checkout.loadDeliverySlots(fulfillmentId)` and `actions.checkout.chooseDeliverySlot(fulfillmentId, slotId)`.
|
|
600
|
+
|
|
599
601
|
See [TypeScript Types](./typescript-types.md) for complete type reference.
|
|
600
602
|
|
|
601
603
|
## Best Practices
|
|
@@ -425,6 +425,7 @@ type ComponentType =
|
|
|
425
425
|
| 'drawer' | 'input' | 'engraving-form' | 'engraving-view'
|
|
426
426
|
| 'buttons-cart-open' | 'powered-by' | 'lce-element'
|
|
427
427
|
| 'purchase-min-alert' | 'alert' | 'promo-code-ticker'
|
|
428
|
+
| 'checkout-delivery-scheduling' // Internal child of checkout
|
|
428
429
|
// ...and additional internal component types
|
|
429
430
|
```
|
|
430
431
|
|
|
@@ -571,3 +572,39 @@ ownership and for reloading checkout when identity changes.
|
|
|
571
572
|
Order completion waits for queued preference work. It cannot race a late saved
|
|
572
573
|
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
573
574
|
fails, the shopper can retry or explicitly choose the visible channel preference.
|
|
575
|
+
|
|
576
|
+
## Delivery scheduling types
|
|
577
|
+
|
|
578
|
+
The main and checkout-only entries, and their Node/SSR stubs, export these types.
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
export interface DeliverySlot {
|
|
582
|
+
id: string; // server-issued, `<fulfillmentOptionId>:<window start, Unix seconds>`
|
|
583
|
+
start: string; // ISO-8601 UTC
|
|
584
|
+
end: string; // ISO-8601 UTC
|
|
585
|
+
cutoff: string; // ISO-8601 UTC, latest time to order for this window ("Order by")
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface DeliveryAvailability {
|
|
589
|
+
status: 'available' | 'unavailable'; // available when the store can deliver now or offers windows
|
|
590
|
+
canDeliverNow: boolean;
|
|
591
|
+
canSchedule: boolean;
|
|
592
|
+
timezone: string | null; // store IANA time zone; null when the server has none (the SDK then shows UTC)
|
|
593
|
+
nextSlot: DeliverySlot | null;
|
|
594
|
+
checkedAt: string;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export interface CheckoutDeliveryScheduling {
|
|
598
|
+
availability: DeliveryAvailability;
|
|
599
|
+
slots: DeliverySlot[]; // only in answer to deliverySlotsFulfillmentId; empty otherwise
|
|
600
|
+
selectedSlotId: string | null; // null = as soon as possible / no window
|
|
601
|
+
selectedSlot?: DeliverySlot | null; // the accepted window with its real end and cutoff; null when none
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export interface CheckoutDeliverySelection {
|
|
605
|
+
fulfillmentId: string;
|
|
606
|
+
slotId: string | null;
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
`ICheckoutFulfillment.deliveryScheduling` is optional. `ICheckoutPrepareParams` takes `deliverySelections?: CheckoutDeliverySelection[]` and `deliverySlotsFulfillmentId?: string`. `actions.checkout` adds `loadDeliverySlots(fulfillmentId: string): Promise<DeliverySlot[]>` and `chooseDeliverySlot(fulfillmentId: string, slotId: string | null): Promise<void>` on both clients, and `ICheckoutDetailsEventData` adds `deliveryScheduling: Record<string, CheckoutDeliveryScheduling>`.
|
|
@@ -289,3 +289,7 @@ from the accessibility tree; unknown choices retain their named, keyboard-operab
|
|
|
289
289
|
checkboxes. Clearing account preferences reveals the controls and synchronizes
|
|
290
290
|
`aria-checked` with the current guest defaults. A shopper's explicit checkbox edit
|
|
291
291
|
keeps that channel visible when account data arrives later.
|
|
292
|
+
|
|
293
|
+
### Delivery date and arrival windows
|
|
294
|
+
|
|
295
|
+
The delivery picker is a named native modal dialog opened from each delivery's Schedule delivery or Edit control. Dates and arrival windows are radio groups with one tab stop each and arrow-key selection; the date strip scrolls inside the dialog and unavailable dates are disabled. While windows load, the dialog is marked busy and shows a loading line; Cancel and Close stay available. Changes are drafts until Save; Cancel, Close and Escape discard them, and closing returns focus to the opening control. The dialog stays the same modal while it is open: a date or window change updates its contents in place, so it is not announced again. Save errors keep the dialog open and move focus to the error. Success is announced politely; errors and an expired or unavailable window are announced assertively, each with its own message. The time zone is named once above the windows ("Times in Eastern Time"); the first window's accessible name also carries its "Order by" time. The window list scrolls inside the dialog, and the chosen or focused window is kept in view as the picker opens, the date changes and arrow keys move.
|
|
@@ -286,6 +286,31 @@ console.log(checkoutData);
|
|
|
286
286
|
// }
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
+
### Load Delivery Slots
|
|
290
|
+
|
|
291
|
+
Load the delivery windows for one fulfillment that has scheduled delivery. `getDetails().deliveryScheduling` is keyed by fulfillment ID:
|
|
292
|
+
|
|
293
|
+
```javascript
|
|
294
|
+
const actions = window.LiquidCommerce.elements.actions.checkout;
|
|
295
|
+
const [fulfillmentId] = Object.keys(actions.getDetails().deliveryScheduling);
|
|
296
|
+
|
|
297
|
+
const slots = await actions.loadDeliverySlots(fulfillmentId);
|
|
298
|
+
// [{ id: 'option_1:1791475200', start: '2026-10-08T16:00:00.000Z', end: '2026-10-08T17:00:00.000Z', cutoff: '2026-10-08T15:00:00.000Z' }, ...]
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Choose Delivery Slot
|
|
302
|
+
|
|
303
|
+
Save a window from the last loaded list, or `null` for as soon as possible:
|
|
304
|
+
|
|
305
|
+
```javascript
|
|
306
|
+
await window.LiquidCommerce.elements.actions.checkout.chooseDeliverySlot(fulfillmentId, slots[0].id);
|
|
307
|
+
|
|
308
|
+
// As soon as possible (only when availability.canDeliverNow is true)
|
|
309
|
+
await window.LiquidCommerce.elements.actions.checkout.chooseDeliverySlot(fulfillmentId, null);
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The promise rejects when the window was not offered, the fulfillment is unknown or another checkout update is in flight. See the [checkout actions reference](../api/actions/checkout-actions.md#delivery-scheduling-actions).
|
|
313
|
+
|
|
289
314
|
## Events
|
|
290
315
|
|
|
291
316
|
### Checkout Lifecycle
|
|
@@ -384,6 +409,17 @@ window.addEventListener('lce:actions.checkout_delivery_method_updated', (event)
|
|
|
384
409
|
});
|
|
385
410
|
```
|
|
386
411
|
|
|
412
|
+
### Delivery Time
|
|
413
|
+
|
|
414
|
+
Fires once after checkout accepts a delivery window or as soon as possible, from the built-in picker or from `chooseDeliverySlot`.
|
|
415
|
+
|
|
416
|
+
```javascript
|
|
417
|
+
window.addEventListener('lce:actions.checkout_delivery_selection_updated', (event) => {
|
|
418
|
+
const { deliveryScheduling } = event.detail.data;
|
|
419
|
+
console.log('Delivery windows by fulfillment:', deliveryScheduling);
|
|
420
|
+
});
|
|
421
|
+
```
|
|
422
|
+
|
|
387
423
|
### Tips
|
|
388
424
|
|
|
389
425
|
```javascript
|
|
@@ -868,3 +904,13 @@ ownership and for reloading checkout when identity changes.
|
|
|
868
904
|
Order completion waits for queued preference work. It cannot race a late saved
|
|
869
905
|
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
870
906
|
fails, the shopper can retry or explicitly choose the visible channel preference.
|
|
907
|
+
|
|
908
|
+
## Scheduled delivery
|
|
909
|
+
|
|
910
|
+
When an AccelPay retailer has scheduled delivery turned on, checkout shows a **Delivery time** row for that delivery, between the delivery details and payment. It reads "As soon as possible" while the store can deliver now, or asks for a window when it cannot. The row's button reads **Schedule** while the row is on as soon as possible, **Edit** after a window is saved, and **Schedule delivery** when the shopper must choose a window. It opens a dialog that loads the windows for that delivery: date cards for today and the next 7 days, then arrival windows in the retailer's time zone, named once above the list ("Times in Eastern Time"). The window list scrolls inside the dialog and keeps the chosen window in view. The first window shows "Order by" with its cutoff, and **As soon as possible** sits next to it when the store can deliver now. Choices are drafts until **Save**; Cancel, Close and Escape discard them.
|
|
911
|
+
|
|
912
|
+
The accepted window shows in the row and on the items in the order summary ("Scheduled for Thu, Oct 8, 1 PM – 2 PM ET"), and on the thank-you page as "Delivery time" with "Thu, Oct 8, 1 PM – 2 PM ET" (with more than one window, each line names its retailer). An ASAP order adds no line there. If the window's cutoff passes before the order is placed, the SDK clears it, shows "Your delivery window has passed. Choose a new delivery time.", reopens the picker and keeps Place Order disabled until a new choice is saved. If the store no longer offers the window, the same happens with "Your delivery window is no longer available. Choose a new delivery time." Everything else the shopper entered stays.
|
|
913
|
+
|
|
914
|
+
A checkout with more than one fulfillment group cannot be scheduled: the row reads "As soon as possible" with no picker button, and no window is asked for. While a store that cannot deliver now has no accepted window, the express wallet buttons stay off, like the card form.
|
|
915
|
+
|
|
916
|
+
Checkouts without scheduled delivery are unchanged. For a custom UI, see `actions.checkout.loadDeliverySlots` and `actions.checkout.chooseDeliverySlot` in the checkout actions reference, and the `checkout_delivery_selection_updated` event.
|
package/docs/v1/guides/events.md
CHANGED
|
@@ -502,7 +502,7 @@ window.addEventListener('lce:actions.cart_product_add_failed', (event) => {
|
|
|
502
502
|
|
|
503
503
|
Fires when checkout data loads.
|
|
504
504
|
|
|
505
|
-
**Data includes:** `cartId`, `amounts`, `itemCount`, `isGift`, `billingSameAsShipping
|
|
505
|
+
**Data includes:** `cartId`, `amounts`, `itemCount`, `isGift`, `billingSameAsShipping`, `deliveryScheduling` (keyed by fulfillment ID).
|
|
506
506
|
|
|
507
507
|
**Example**
|
|
508
508
|
|
|
@@ -967,6 +967,19 @@ window.addEventListener('lce:actions.checkout_product_add_failed', (event) => {
|
|
|
967
967
|
});
|
|
968
968
|
```
|
|
969
969
|
|
|
970
|
+
### `lce:actions.checkout_delivery_selection_updated`
|
|
971
|
+
|
|
972
|
+
Emitted once after checkout prepare accepts a delivery window or ASAP choice, from the built-in picker or from `actions.checkout.chooseDeliverySlot`. Draft choices in the picker and failed saves do not emit it.
|
|
973
|
+
|
|
974
|
+
**Data:** `ICheckoutDetailsEventData`, including `deliveryScheduling: Record<string, CheckoutDeliveryScheduling>` keyed by fulfillment ID, with each accepted `selectedSlotId` and `selectedSlot`.
|
|
975
|
+
|
|
976
|
+
```javascript
|
|
977
|
+
window.addEventListener('lce:actions.checkout_delivery_selection_updated', (event) => {
|
|
978
|
+
const scheduling = event.detail.data.deliveryScheduling;
|
|
979
|
+
console.log('Delivery windows:', scheduling);
|
|
980
|
+
});
|
|
981
|
+
```
|
|
982
|
+
|
|
970
983
|
## Form Events
|
|
971
984
|
|
|
972
985
|
### `lce:forms.customer`
|
package/package.json
CHANGED