@liquidcommerce/elements-sdk 2.6.5 → 2.6.6
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 +7 -7
- package/dist/index.esm.js +10646 -10762
- package/dist/types/core/api/api-client.service.d.ts +6 -6
- package/dist/types/core/client/client-action.service.d.ts +1 -2
- package/dist/types/core/client/client-config.service.d.ts +2 -0
- package/dist/types/core/google-tag-manager.service.d.ts +1 -1
- package/dist/types/core/logger/logger.service.d.ts +1 -1
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -1
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +35 -51
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +5 -4
- package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
- package/dist/types/core/store/interfaces/core.interface.d.ts +3 -2
- package/dist/types/enums/cloud.enum.d.ts +0 -77
- package/dist/types/enums/core.enum.d.ts +24 -0
- package/dist/types/interfaces/api/cart.interface.d.ts +11 -7
- package/dist/types/interfaces/api/checkout.interface.d.ts +216 -0
- package/dist/types/interfaces/api/product.interface.d.ts +2 -3
- package/dist/types/interfaces/core.interface.d.ts +7 -1
- package/dist/types/modules/cart/cart.commands.d.ts +4 -4
- package/dist/types/modules/checkout/checkout.commands.d.ts +18 -9
- package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
- package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
- package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
- package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
- package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
- package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
- package/dist/types/modules/checkout/constant.d.ts +3 -0
- package/dist/types/modules/product/product.commands.d.ts +1 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -0
- package/dist/types/utils/format.d.ts +0 -1
- package/docs/ACTIONS.md +13 -13
- package/docs/EVENTS.md +7 -7
- package/package.json +5 -5
- package/umd/elements.js +1 -1
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
- package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
- package/dist/types/interfaces/cloud/index.d.ts +0 -3
- package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
- package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
- package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
- package/dist/types/utils/helper.d.ts +0 -28
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { CheckoutEventLevel, CheckoutEventType, FulfillmentType } from '@/enums';
|
|
2
|
+
import type { IAddressAddress, IAddressCoordinates, ILocation } from '@/interfaces/api/address.interface';
|
|
3
|
+
import type { ICart } from '@/interfaces/api/cart.interface';
|
|
4
|
+
import type { IProductPresale } from '@/interfaces/api/product.interface';
|
|
5
|
+
export interface ICheckoutComplete {
|
|
6
|
+
orderNumber: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ICheckoutPaymentSession {
|
|
9
|
+
key: string;
|
|
10
|
+
secret: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ICheckoutPaymentConfirmParams {
|
|
13
|
+
confirmationTokenId: string;
|
|
14
|
+
setupIntentId: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ICheckoutPaymentConfirmCard {
|
|
17
|
+
brand: string;
|
|
18
|
+
expMonth: string;
|
|
19
|
+
expYear: string;
|
|
20
|
+
last4: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ICheckoutPaymentConfirm {
|
|
23
|
+
id: string;
|
|
24
|
+
card: ICheckoutPaymentConfirmCard;
|
|
25
|
+
}
|
|
26
|
+
export interface ICheckoutCustomer {
|
|
27
|
+
email: string;
|
|
28
|
+
firstName: string;
|
|
29
|
+
lastName: string;
|
|
30
|
+
company: string;
|
|
31
|
+
phone: string;
|
|
32
|
+
birthDate: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ICheckoutBilling {
|
|
35
|
+
firstName: string;
|
|
36
|
+
lastName: string;
|
|
37
|
+
email: string;
|
|
38
|
+
phone: string;
|
|
39
|
+
company: string;
|
|
40
|
+
one: string;
|
|
41
|
+
two: string;
|
|
42
|
+
city: string;
|
|
43
|
+
state: string;
|
|
44
|
+
zip: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ICheckoutGiftRecipient {
|
|
47
|
+
firstName: string;
|
|
48
|
+
lastName: string;
|
|
49
|
+
email: string;
|
|
50
|
+
phone: string;
|
|
51
|
+
message: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ICheckoutMarketingPreferences {
|
|
54
|
+
canEmail: boolean;
|
|
55
|
+
canSms: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface ICheckoutDeliveryTip {
|
|
58
|
+
fulfillmentId: string;
|
|
59
|
+
tip: number;
|
|
60
|
+
}
|
|
61
|
+
export interface ICheckoutDeliveryInstructions {
|
|
62
|
+
fulfillmentId: string;
|
|
63
|
+
instructions: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ICheckoutPrepareParams {
|
|
66
|
+
cartId: string;
|
|
67
|
+
customer?: ICheckoutCustomer;
|
|
68
|
+
shippingAddressTwo?: string;
|
|
69
|
+
billingAddress?: ICheckoutBilling;
|
|
70
|
+
isGift?: boolean;
|
|
71
|
+
billingSameAsShipping?: boolean;
|
|
72
|
+
giftOptions?: ICheckoutGiftRecipient;
|
|
73
|
+
marketingPreferences?: ICheckoutMarketingPreferences;
|
|
74
|
+
deliveryTips?: ICheckoutDeliveryTip[];
|
|
75
|
+
deliveryInstructions?: ICheckoutDeliveryInstructions[];
|
|
76
|
+
payment?: string;
|
|
77
|
+
promoCode?: string;
|
|
78
|
+
giftCards?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface ICheckoutUpdateItem {
|
|
81
|
+
id?: string;
|
|
82
|
+
partNumber: string;
|
|
83
|
+
quantity: number;
|
|
84
|
+
fulfillmentId: string;
|
|
85
|
+
engravingLines?: string[];
|
|
86
|
+
}
|
|
87
|
+
export interface ICheckoutItemsUpdateParams {
|
|
88
|
+
cartId: string;
|
|
89
|
+
items: ICheckoutUpdateItem[];
|
|
90
|
+
location?: ILocation;
|
|
91
|
+
}
|
|
92
|
+
export interface ICheckoutItemsUpdateResponse {
|
|
93
|
+
cart: ICart;
|
|
94
|
+
checkout: ICheckoutPrepare;
|
|
95
|
+
}
|
|
96
|
+
export interface ICheckoutAmounts {
|
|
97
|
+
subtotal: number;
|
|
98
|
+
engraving: number;
|
|
99
|
+
service: number;
|
|
100
|
+
shipping: number;
|
|
101
|
+
delivery: number;
|
|
102
|
+
platform: number;
|
|
103
|
+
discounts: number;
|
|
104
|
+
giftCards: number;
|
|
105
|
+
tax: number;
|
|
106
|
+
tip: number;
|
|
107
|
+
total: number;
|
|
108
|
+
}
|
|
109
|
+
export interface ICheckoutPromoCode {
|
|
110
|
+
code: string;
|
|
111
|
+
discount: number;
|
|
112
|
+
freeDelivery: boolean;
|
|
113
|
+
freeServiceFee: boolean;
|
|
114
|
+
freeShipping: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface ICheckoutGiftCard {
|
|
117
|
+
code: string;
|
|
118
|
+
applied: number;
|
|
119
|
+
}
|
|
120
|
+
export interface ICheckoutShippingAddress {
|
|
121
|
+
formattedAddress: string;
|
|
122
|
+
address: IAddressAddress;
|
|
123
|
+
coordinates: IAddressCoordinates;
|
|
124
|
+
}
|
|
125
|
+
export interface ICheckoutItemEngraving {
|
|
126
|
+
isEngravable: boolean;
|
|
127
|
+
hasEngraving: boolean;
|
|
128
|
+
fee: number;
|
|
129
|
+
maxCharsPerLine: number;
|
|
130
|
+
maxLines: number;
|
|
131
|
+
location: string;
|
|
132
|
+
lines: string[];
|
|
133
|
+
}
|
|
134
|
+
export interface ICheckoutItemAttributes {
|
|
135
|
+
engraving: ICheckoutItemEngraving;
|
|
136
|
+
presale: IProductPresale;
|
|
137
|
+
}
|
|
138
|
+
export interface ICheckoutItem {
|
|
139
|
+
variantId: string;
|
|
140
|
+
cartItemId: string;
|
|
141
|
+
liquidId: string;
|
|
142
|
+
retailerId: string;
|
|
143
|
+
fulfillmentId: string;
|
|
144
|
+
salsifyPid?: string;
|
|
145
|
+
salsifyGrouping?: string;
|
|
146
|
+
name: string;
|
|
147
|
+
catPath: string;
|
|
148
|
+
volume: string;
|
|
149
|
+
uom: string;
|
|
150
|
+
proof: string;
|
|
151
|
+
abv: string;
|
|
152
|
+
containerType: string;
|
|
153
|
+
container: string;
|
|
154
|
+
size: string;
|
|
155
|
+
pack: boolean;
|
|
156
|
+
packDesc: string;
|
|
157
|
+
mainImage: string;
|
|
158
|
+
brand: string;
|
|
159
|
+
partNumber: string;
|
|
160
|
+
upc: string;
|
|
161
|
+
sku: string;
|
|
162
|
+
price: number;
|
|
163
|
+
unitPrice: number;
|
|
164
|
+
quantity: number;
|
|
165
|
+
tax: number;
|
|
166
|
+
unitTax: number;
|
|
167
|
+
bottleDeposits: number;
|
|
168
|
+
attributes: ICheckoutItemAttributes;
|
|
169
|
+
}
|
|
170
|
+
export interface ICheckoutFulfillment {
|
|
171
|
+
id: string;
|
|
172
|
+
deliveryInstructions: string;
|
|
173
|
+
type: FulfillmentType;
|
|
174
|
+
expectation: string;
|
|
175
|
+
engravingExpectation: string;
|
|
176
|
+
itemIds: string[];
|
|
177
|
+
doesAllowPromos: boolean;
|
|
178
|
+
doesAllowGiftCards: boolean;
|
|
179
|
+
amounts: ICheckoutAmounts;
|
|
180
|
+
itemsQuantity: number;
|
|
181
|
+
}
|
|
182
|
+
export interface ICheckoutRetailer {
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
fulfillments: Record<string, ICheckoutFulfillment>;
|
|
186
|
+
amounts: ICheckoutAmounts;
|
|
187
|
+
}
|
|
188
|
+
export interface ICheckoutPresale {
|
|
189
|
+
isLocked: boolean;
|
|
190
|
+
expiresAt: string;
|
|
191
|
+
}
|
|
192
|
+
export interface ICheckoutEvent {
|
|
193
|
+
type: CheckoutEventType;
|
|
194
|
+
message: string;
|
|
195
|
+
level: CheckoutEventLevel;
|
|
196
|
+
}
|
|
197
|
+
export interface ICheckoutPrepare {
|
|
198
|
+
token: string;
|
|
199
|
+
cartId: string;
|
|
200
|
+
customer: ICheckoutCustomer;
|
|
201
|
+
isGift: boolean;
|
|
202
|
+
billingSameAsShipping: boolean;
|
|
203
|
+
payment?: string;
|
|
204
|
+
giftOptions: ICheckoutGiftRecipient;
|
|
205
|
+
marketingPreferences: ICheckoutMarketingPreferences;
|
|
206
|
+
shippingAddress: ICheckoutShippingAddress;
|
|
207
|
+
billingAddress: ICheckoutBilling;
|
|
208
|
+
promoCode: ICheckoutPromoCode | null;
|
|
209
|
+
amounts: ICheckoutAmounts;
|
|
210
|
+
giftCards: ICheckoutGiftCard[];
|
|
211
|
+
presale: ICheckoutPresale | null;
|
|
212
|
+
itemsQuantity: number;
|
|
213
|
+
items: Record<string, ICheckoutItem>;
|
|
214
|
+
retailers: Record<string, ICheckoutRetailer>;
|
|
215
|
+
events: ICheckoutEvent[];
|
|
216
|
+
}
|
|
@@ -34,7 +34,6 @@ export interface IProductSize {
|
|
|
34
34
|
onDemandVariants: Record<string, IProductVariant>;
|
|
35
35
|
}
|
|
36
36
|
export interface IProductFulfillmentHourStatus {
|
|
37
|
-
text: string;
|
|
38
37
|
isOpen: boolean;
|
|
39
38
|
openTime: string;
|
|
40
39
|
isClosed: boolean;
|
|
@@ -73,8 +72,8 @@ export interface IFulfillment {
|
|
|
73
72
|
type: FulfillmentType;
|
|
74
73
|
doesAllowGiftCards: boolean;
|
|
75
74
|
doesAllowPromos: boolean;
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
expectation: string;
|
|
76
|
+
engravingExpectation: string;
|
|
78
77
|
fee: number;
|
|
79
78
|
timezone: string;
|
|
80
79
|
hourStatus: IProductFulfillmentHourStatus;
|
|
@@ -28,6 +28,7 @@ export interface ILiquidCommerceElementsBaseConfig {
|
|
|
28
28
|
promoTicker?: IPromoTicker[];
|
|
29
29
|
customTheme?: IClientCustomThemeConfig;
|
|
30
30
|
debugMode?: DebugMode;
|
|
31
|
+
checkoutUrl?: string;
|
|
31
32
|
}
|
|
32
33
|
export interface ILiquidCommerceElementsBuilderConfig extends ILiquidCommerceElementsBaseConfig {
|
|
33
34
|
}
|
|
@@ -65,6 +66,11 @@ export interface IProcessInjectElementParams {
|
|
|
65
66
|
containerId: string;
|
|
66
67
|
identifier?: string;
|
|
67
68
|
options?: IAddressOptions;
|
|
69
|
+
checkoutId?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface IInjectCheckoutParams {
|
|
72
|
+
containerId: string;
|
|
73
|
+
checkoutId?: string;
|
|
68
74
|
}
|
|
69
75
|
export interface ILiquidCommerceElementsUIMethod {
|
|
70
76
|
cartButton(containerId: string, showItemsCount?: boolean): void;
|
|
@@ -101,7 +107,7 @@ export interface ILiquidCommerceElementsClient {
|
|
|
101
107
|
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
102
108
|
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
103
109
|
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
104
|
-
injectCheckoutElement(
|
|
110
|
+
injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
105
111
|
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
106
112
|
ui: ILiquidCommerceElementsUIMethod;
|
|
107
113
|
actions: ILiquidCommerceElementsActions;
|
|
@@ -8,17 +8,15 @@ export interface AddItemParams {
|
|
|
8
8
|
identifier: string;
|
|
9
9
|
}
|
|
10
10
|
export declare class CartCommands extends BaseCommand {
|
|
11
|
-
private readonly uiCommands;
|
|
12
|
-
private readonly checkoutCommands;
|
|
13
|
-
private readonly commonCommands;
|
|
14
11
|
constructor();
|
|
15
12
|
static getInstance(): CartCommands;
|
|
16
13
|
updateItemQuantity(itemId: string, delta: number): Promise<void>;
|
|
17
14
|
removeItem(itemId: string, isNotStandAlone?: boolean): Promise<void>;
|
|
18
15
|
updateItemEngraving(productItemId: string, engravingLines: string[]): Promise<void>;
|
|
19
16
|
addItem(params: AddItemParams): Promise<void>;
|
|
20
|
-
addPresaleItem(params: AddItemParams): Promise<void>;
|
|
21
17
|
handleGoToCheckout(): Promise<void>;
|
|
18
|
+
private trackBeginCheckout;
|
|
19
|
+
private resolveCheckoutRedirectUrl;
|
|
22
20
|
applyPromoCode(promoCode: string): Promise<void>;
|
|
23
21
|
removePromoCode(): Promise<void>;
|
|
24
22
|
rerenderCart(): void;
|
|
@@ -31,4 +29,6 @@ export declare class CartCommands extends BaseCommand {
|
|
|
31
29
|
private updateFulfillment;
|
|
32
30
|
private addNewFulfillmentAndRetailer;
|
|
33
31
|
private cleanupAfterItemRemoval;
|
|
32
|
+
private syncCartState;
|
|
33
|
+
private buildCartLoadedEventData;
|
|
34
34
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
3
|
+
import type { ICheckoutPaymentMethodStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
|
+
import type { ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient } from '@/interfaces/api/checkout.interface';
|
|
5
|
+
import type { AddItemParams } from '@/modules/cart/cart.commands';
|
|
6
|
+
import type { PresaleExpiredReason } from '@/modules/checkout/components';
|
|
3
7
|
export declare class CheckoutCommands extends BaseCommand {
|
|
4
8
|
private readonly uiCommands;
|
|
5
|
-
private readonly commonCommands;
|
|
6
9
|
constructor();
|
|
7
10
|
static getInstance(): CheckoutCommands;
|
|
8
|
-
|
|
11
|
+
addPresaleItem(params: AddItemParams): Promise<void>;
|
|
12
|
+
loadCheckout(params: {
|
|
13
|
+
customCartId?: string;
|
|
14
|
+
isForPresale?: boolean;
|
|
15
|
+
}): Promise<void>;
|
|
9
16
|
toggleIsGift(active?: boolean): Promise<void>;
|
|
10
17
|
toggleBillingSameAsShipping(active?: boolean): Promise<void>;
|
|
11
18
|
toggleMarketingPreferences(fieldName: 'canEmail' | 'canSms', active?: boolean): Promise<void>;
|
|
@@ -17,7 +24,7 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
17
24
|
applyGiftCard(code: string): Promise<void>;
|
|
18
25
|
removeGiftCard(code: string): Promise<void>;
|
|
19
26
|
clearGiftCardError(): Promise<void>;
|
|
20
|
-
openPresaleExpiredDrawer(): void;
|
|
27
|
+
openPresaleExpiredDrawer(reason?: PresaleExpiredReason): void;
|
|
21
28
|
rerenderCheckout(): void;
|
|
22
29
|
updateCheckoutItemQuantity(itemId: string, delta: number): Promise<void>;
|
|
23
30
|
removeItemEngraving(productItemId: string): Promise<void>;
|
|
@@ -28,18 +35,18 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
28
35
|
clearCheckoutError(): Promise<void>;
|
|
29
36
|
editCustomerForm(): Promise<void>;
|
|
30
37
|
saveCustomerForm({ shippingAddressTwo, deliveryInstructions, customerData, }: {
|
|
31
|
-
customerData:
|
|
38
|
+
customerData: ICheckoutCustomer;
|
|
32
39
|
shippingAddressTwo: string;
|
|
33
40
|
deliveryInstructions: string;
|
|
34
41
|
}): Promise<void>;
|
|
35
42
|
editGiftRecipientForm(): Promise<void>;
|
|
36
|
-
saveGiftRecipientForm({ shippingAddressTwo, deliveryInstructions, ...giftRecipientData }:
|
|
43
|
+
saveGiftRecipientForm({ shippingAddressTwo, deliveryInstructions, ...giftRecipientData }: ICheckoutGiftRecipient & {
|
|
37
44
|
shippingAddressTwo: string;
|
|
38
45
|
deliveryInstructions: string;
|
|
39
46
|
}): Promise<void>;
|
|
40
47
|
editPaymentForm(): Promise<void>;
|
|
41
48
|
savePaymentForm({ billingFormData, paymentSession, }: {
|
|
42
|
-
billingFormData?:
|
|
49
|
+
billingFormData?: ICheckoutBilling;
|
|
43
50
|
paymentSession?: {
|
|
44
51
|
confirmationTokenId: string;
|
|
45
52
|
setupIntentId: string;
|
|
@@ -47,7 +54,9 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
47
54
|
}): Promise<void>;
|
|
48
55
|
checkoutComplete(): Promise<void>;
|
|
49
56
|
private updateStoreFromCheckoutResponse;
|
|
50
|
-
private
|
|
57
|
+
private syncFromItemUpdate;
|
|
58
|
+
private syncCheckoutState;
|
|
59
|
+
private refreshCheckout;
|
|
51
60
|
private dataForCheckoutPrepare;
|
|
52
|
-
|
|
61
|
+
getDetails(): ICheckoutDetailsEventData;
|
|
53
62
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ICheckoutBilling } from '@/interfaces/api/checkout.interface';
|
|
3
3
|
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
4
4
|
export interface ICheckoutBillingComponentParams {
|
|
5
|
-
isFormValid: (isValid: boolean, data:
|
|
5
|
+
isFormValid: (isValid: boolean, data: ICheckoutBilling) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare class CheckoutBillingComponent extends BaseComponent<ICheckoutBillingComponentParams, ICheckoutComponent> {
|
|
8
8
|
private billingData;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
2
|
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
3
3
|
export declare class CheckoutItemsComponent extends BaseComponent<null, ICheckoutComponent> {
|
|
4
|
+
private togglerElement;
|
|
5
|
+
private togglerButton;
|
|
6
|
+
private togglerLabel;
|
|
7
|
+
private itemsList;
|
|
4
8
|
get hostClasses(): string[];
|
|
5
9
|
constructor();
|
|
6
10
|
private createItemElement;
|
|
7
|
-
private getItemsListContainer;
|
|
8
|
-
private getTogglerLabel;
|
|
9
11
|
private getCurrentItemsMap;
|
|
10
12
|
private syncItemsWithStore;
|
|
11
|
-
private updateItemCount;
|
|
12
13
|
onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
|
|
13
14
|
private handleToggle;
|
|
14
15
|
private setupToggler;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
2
|
export declare class CheckoutPresaleCountdownComponent extends BaseComponent<null> {
|
|
3
|
+
private static readonly DEFAULT_PRESALE_DURATION_SECONDS;
|
|
4
|
+
private static readonly ONE_MINUTE_THRESHOLD_SECONDS;
|
|
5
|
+
private static readonly COUNTDOWN_UPDATE_INTERVAL_MS;
|
|
3
6
|
private countdownInterval;
|
|
4
7
|
private expiresAt;
|
|
5
|
-
private
|
|
8
|
+
private initialDurationSeconds;
|
|
6
9
|
private rootElement;
|
|
7
10
|
private scrollHandler;
|
|
8
11
|
private scrollContainer;
|
|
@@ -11,16 +14,26 @@ export declare class CheckoutPresaleCountdownComponent extends BaseComponent<nul
|
|
|
11
14
|
get hostClasses(): string[];
|
|
12
15
|
constructor();
|
|
13
16
|
onStoreChanged(changes: IOnStoreChanged[]): boolean;
|
|
17
|
+
private resetCountdownState;
|
|
14
18
|
protected afterRender(): void;
|
|
15
19
|
protected disconnected(): void;
|
|
16
20
|
private setupDrawerScrollDetection;
|
|
21
|
+
private findScrollContainer;
|
|
22
|
+
private setScrolledState;
|
|
17
23
|
private isScrollable;
|
|
18
24
|
private cleanupScrollListener;
|
|
19
25
|
private updateExpiresAt;
|
|
20
26
|
private startCountdown;
|
|
21
27
|
private stopCountdown;
|
|
22
28
|
private updateCountdown;
|
|
29
|
+
private updateWarningState;
|
|
30
|
+
private updateTimerDisplay;
|
|
31
|
+
private updateProgressBar;
|
|
23
32
|
private formatTime;
|
|
24
33
|
private handleExpire;
|
|
25
34
|
protected template(): HTMLElement;
|
|
35
|
+
private createTextContainer;
|
|
36
|
+
private createHeader;
|
|
37
|
+
private createSubtitle;
|
|
38
|
+
private createProgressBar;
|
|
26
39
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { BaseComponent } from '@/core/base-component.service';
|
|
2
2
|
import type { ICheckoutComponent } from '@/interfaces/configs';
|
|
3
|
-
export
|
|
3
|
+
export type PresaleExpiredReason = 'time_expired' | 'items_unavailable';
|
|
4
|
+
export interface ICheckoutPresaleExpiredComponentParams {
|
|
5
|
+
reason: PresaleExpiredReason;
|
|
6
|
+
}
|
|
7
|
+
export declare class CheckoutPresaleExpiredComponent extends BaseComponent<ICheckoutPresaleExpiredComponentParams, ICheckoutComponent> {
|
|
4
8
|
private autoCloseInterval;
|
|
5
9
|
private autoCloseSeconds;
|
|
6
10
|
private autoCloseElement;
|
|
7
11
|
get hostClasses(): string[];
|
|
8
12
|
get hostAttributes(): Record<string, string>;
|
|
13
|
+
private isItemsUnavailable;
|
|
14
|
+
private isTimeExpired;
|
|
9
15
|
protected afterRender(): void;
|
|
10
16
|
protected disconnected(): void;
|
|
11
17
|
private handleExit;
|
|
@@ -6,8 +6,8 @@ export declare class CheckoutTipsComponent extends BaseComponent<null, ICheckout
|
|
|
6
6
|
constructor();
|
|
7
7
|
protected afterRender(): void;
|
|
8
8
|
private getTipSelection;
|
|
9
|
-
private
|
|
10
|
-
private
|
|
9
|
+
private getOnDemandFulfillments;
|
|
10
|
+
private getRetailerNameForFulfillment;
|
|
11
11
|
private handlePercentageSelect;
|
|
12
12
|
private handleFulfillmentTipInput;
|
|
13
13
|
private removeTipFromFulfillment;
|
|
@@ -7,8 +7,6 @@ export declare class CheckoutPcGcComponent extends BaseComponent<null, ICheckout
|
|
|
7
7
|
onStoreWatch(changes: IOnStoreChanged[]): void;
|
|
8
8
|
private updateAppliedGiftCards;
|
|
9
9
|
private createAppliedGiftCardElement;
|
|
10
|
-
private pcInputContainer;
|
|
11
|
-
private gcInputContainer;
|
|
12
10
|
private inputContainer;
|
|
13
11
|
private createErrorElement;
|
|
14
12
|
protected template(): HTMLElement[];
|
|
@@ -8,6 +8,7 @@ export declare const customerFormFields: {
|
|
|
8
8
|
readonly addressTwo: "addressTwo";
|
|
9
9
|
readonly company: "company";
|
|
10
10
|
};
|
|
11
|
+
export type CustomerFieldName = (typeof customerFormFields)[keyof typeof customerFormFields];
|
|
11
12
|
export declare const giftFormFields: {
|
|
12
13
|
readonly firstName: "firstName";
|
|
13
14
|
readonly lastName: "lastName";
|
|
@@ -16,6 +17,7 @@ export declare const giftFormFields: {
|
|
|
16
17
|
readonly addressTwo: "addressTwo";
|
|
17
18
|
readonly message: "message";
|
|
18
19
|
};
|
|
20
|
+
export type GiftFieldName = (typeof giftFormFields)[keyof typeof giftFormFields];
|
|
19
21
|
export declare const billingFormFields: {
|
|
20
22
|
readonly firstName: "firstName";
|
|
21
23
|
readonly lastName: "lastName";
|
|
@@ -28,3 +30,4 @@ export declare const billingFormFields: {
|
|
|
28
30
|
readonly state: "state";
|
|
29
31
|
readonly zipCode: "zipCode";
|
|
30
32
|
};
|
|
33
|
+
export type BillingFieldName = (typeof billingFormFields)[keyof typeof billingFormFields];
|
|
@@ -7,6 +7,7 @@ import { type AddItemParams } from '@/modules/cart/cart.commands';
|
|
|
7
7
|
export declare class ProductCommands extends BaseCommand {
|
|
8
8
|
private readonly uiCommands;
|
|
9
9
|
private readonly cartCommands;
|
|
10
|
+
private readonly checkoutCommands;
|
|
10
11
|
constructor();
|
|
11
12
|
static getInstance(): ProductCommands;
|
|
12
13
|
createProductInstance(productId: string, firstTime?: boolean): Promise<void>;
|
|
@@ -5,6 +5,7 @@ import { type AddItemParams } from '@/modules/cart/cart.commands';
|
|
|
5
5
|
export declare class ProductListCommands extends BaseCommand {
|
|
6
6
|
private readonly uiCommands;
|
|
7
7
|
private readonly cartCommands;
|
|
8
|
+
private readonly checkoutCommands;
|
|
8
9
|
constructor();
|
|
9
10
|
static getInstance(): ProductListCommands;
|
|
10
11
|
getProductList(params: IProductSearchParams): Promise<IProductSearchResponse>;
|
|
@@ -15,6 +15,7 @@ export declare class EngravingFormComponent extends BaseComponent<IEngravingForm
|
|
|
15
15
|
private addToCartButton;
|
|
16
16
|
private fulfillmentId;
|
|
17
17
|
private partNumber;
|
|
18
|
+
private isPresale;
|
|
18
19
|
beforeConnected(): void;
|
|
19
20
|
private calculateTotalPrice;
|
|
20
21
|
private productInformationSection;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare function centToDollar(cent: number): number;
|
|
2
2
|
export declare function formatCentToDollarText(cent: number, showZeroDecimals?: boolean): string;
|
|
3
3
|
export declare function htmlStringToElement(htmlString: string): HTMLElement;
|
|
4
|
-
export declare function format24TimeTo12(time24h: string): string;
|
|
5
4
|
export declare function formatISODateToMMDDYYYY(isoDateString: string | null | undefined): string;
|
|
6
5
|
export declare function capitalizeFirstLetter(text: string): string;
|
|
7
6
|
export declare function splitCategoryPath(catPath?: string): {
|
package/docs/ACTIONS.md
CHANGED
|
@@ -26,8 +26,8 @@ await actions.cart.applyPromoCode('SAVE20');
|
|
|
26
26
|
|
|
27
27
|
// 2. Listen for success/failure feedback via events
|
|
28
28
|
window.addEventListener('lce:actions.cart_promo_code_applied', function(event) {
|
|
29
|
-
const {
|
|
30
|
-
showSuccessMessage(`🎉 Promo applied! You saved $${
|
|
29
|
+
const { discount, newTotal } = event.detail.data;
|
|
30
|
+
showSuccessMessage(`🎉 Promo applied! You saved $${discount}!`);
|
|
31
31
|
updateCartDisplay(newTotal);
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -262,7 +262,7 @@ All actions provide feedback through events. Here are all available success/fail
|
|
|
262
262
|
'lce:actions.cart_product_add_failed' // { identifiers: string[], error: string }
|
|
263
263
|
|
|
264
264
|
// Promo code management
|
|
265
|
-
'lce:actions.cart_promo_code_applied' // {
|
|
265
|
+
'lce:actions.cart_promo_code_applied' // { discount?: number, newTotal?: number }
|
|
266
266
|
'lce:actions.cart_promo_code_removed' // { newTotal?: number }
|
|
267
267
|
'lce:actions.cart_promo_code_failed' // { error: string }
|
|
268
268
|
```
|
|
@@ -274,7 +274,7 @@ All actions provide feedback through events. Here are all available success/fail
|
|
|
274
274
|
'lce:actions.checkout_product_add_failed' // { identifiers: string[], error: string, isPresale?: boolean }
|
|
275
275
|
|
|
276
276
|
// Promo code management
|
|
277
|
-
'lce:actions.checkout_promo_code_applied' // {
|
|
277
|
+
'lce:actions.checkout_promo_code_applied' // { discount?: number, newTotal?: number }
|
|
278
278
|
'lce:actions.checkout_promo_code_removed' // { newTotal?: number }
|
|
279
279
|
'lce:actions.checkout_promo_code_failed' // { error: string }
|
|
280
280
|
|
|
@@ -335,10 +335,10 @@ window.addEventListener('lce:actions.cart_product_add_success', function(event)
|
|
|
335
335
|
```javascript
|
|
336
336
|
// ✅ Create reusable handlers
|
|
337
337
|
const handlePromoSuccess = (event) => {
|
|
338
|
-
const {
|
|
339
|
-
showSuccessMessage(`Discount applied! Saved: $${
|
|
338
|
+
const { discount, newTotal } = event.detail.data;
|
|
339
|
+
showSuccessMessage(`Discount applied! Saved: $${discount}`);
|
|
340
340
|
updatePriceDisplay(newTotal);
|
|
341
|
-
trackPromoSuccess(
|
|
341
|
+
trackPromoSuccess(discount);
|
|
342
342
|
};
|
|
343
343
|
|
|
344
344
|
const handlePromoFailure = (event) => {
|
|
@@ -472,12 +472,12 @@ await actions.cart.applyPromoCode('WELCOME10');
|
|
|
472
472
|
|
|
473
473
|
// Listen for success
|
|
474
474
|
window.addEventListener('lce:actions.cart_promo_code_applied', function(event) {
|
|
475
|
-
const {
|
|
476
|
-
showMessage(`Welcome discount applied! You saved $${
|
|
475
|
+
const { discount, newTotal } = event.detail.data;
|
|
476
|
+
showMessage(`Welcome discount applied! You saved $${discount}!`);
|
|
477
477
|
updateCartDisplay(newTotal);
|
|
478
478
|
|
|
479
479
|
// Track successful promo usage
|
|
480
|
-
analytics.track('Promo Applied', { discount:
|
|
480
|
+
analytics.track('Promo Applied', { discount: discount });
|
|
481
481
|
});
|
|
482
482
|
|
|
483
483
|
// Listen for failure and try fallback
|
|
@@ -624,12 +624,12 @@ const customer = getCurrentCustomer();
|
|
|
624
624
|
|
|
625
625
|
// Set up event listeners first
|
|
626
626
|
window.addEventListener('lce:actions.checkout_promo_code_applied', function(event) {
|
|
627
|
-
const {
|
|
628
|
-
showCheckoutSuccess(`Discount applied! You saved $${
|
|
627
|
+
const { discount, newTotal } = event.detail.data;
|
|
628
|
+
showCheckoutSuccess(`Discount applied! You saved $${discount}`);
|
|
629
629
|
updateCheckoutTotal(newTotal);
|
|
630
630
|
|
|
631
631
|
// Track successful conversion optimization
|
|
632
|
-
analytics.track('Checkout Discount Applied', { discount:
|
|
632
|
+
analytics.track('Checkout Discount Applied', { discount: discount });
|
|
633
633
|
});
|
|
634
634
|
|
|
635
635
|
window.addEventListener('lce:actions.checkout_promo_code_failed', function(event) {
|
package/docs/EVENTS.md
CHANGED
|
@@ -470,7 +470,7 @@ These events fire when programmatic actions succeed or fail, giving you complete
|
|
|
470
470
|
|
|
471
471
|
// Promo code feedback
|
|
472
472
|
'lce:actions.cart_promo_code_applied' // → "Promo code worked - show success!"
|
|
473
|
-
// Data: {
|
|
473
|
+
// Data: { discount?: number, newTotal?: number }
|
|
474
474
|
|
|
475
475
|
'lce:actions.cart_promo_code_removed' // → "Promo code removed successfully"
|
|
476
476
|
// Data: { newTotal?: number }
|
|
@@ -490,7 +490,7 @@ These events fire when programmatic actions succeed or fail, giving you complete
|
|
|
490
490
|
|
|
491
491
|
// Promo code feedback
|
|
492
492
|
'lce:actions.checkout_promo_code_applied' // → "Checkout discount applied!"
|
|
493
|
-
// Data: {
|
|
493
|
+
// Data: { discount?: number, newTotal?: number }
|
|
494
494
|
|
|
495
495
|
'lce:actions.checkout_promo_code_removed' // → "Checkout discount removed"
|
|
496
496
|
// Data: { newTotal?: number }
|
|
@@ -519,11 +519,11 @@ await actions.cart.applyPromoCode('SECRET20');
|
|
|
519
519
|
|
|
520
520
|
// Get feedback (secure)
|
|
521
521
|
window.addEventListener('lce:actions.cart_promo_code_applied', function(event) {
|
|
522
|
-
const {
|
|
522
|
+
const { discount, newTotal } = event.detail.data;
|
|
523
523
|
// ✅ You get: discount amount, new total
|
|
524
524
|
// 🚫 You DON'T get: 'SECRET20' (secure!)
|
|
525
525
|
|
|
526
|
-
showSuccessMessage(`🎉 Discount applied! You saved $${
|
|
526
|
+
showSuccessMessage(`🎉 Discount applied! You saved $${discount}!`);
|
|
527
527
|
updateCartTotal(newTotal);
|
|
528
528
|
});
|
|
529
529
|
```
|
|
@@ -539,14 +539,14 @@ async function applyPromoCodeWithFeedback(code) {
|
|
|
539
539
|
|
|
540
540
|
// Set up event listeners BEFORE firing action
|
|
541
541
|
const successHandler = (event) => {
|
|
542
|
-
const {
|
|
542
|
+
const { discount, newTotal } = event.detail.data;
|
|
543
543
|
hideLoadingMessage();
|
|
544
|
-
showSuccessMessage(`🎉 Success! You saved $${
|
|
544
|
+
showSuccessMessage(`🎉 Success! You saved $${discount}!`);
|
|
545
545
|
updatePriceDisplay(newTotal);
|
|
546
546
|
|
|
547
547
|
// Track successful promo usage
|
|
548
548
|
analytics.track('Promo Applied', {
|
|
549
|
-
discount:
|
|
549
|
+
discount: discount,
|
|
550
550
|
newTotal: newTotal
|
|
551
551
|
});
|
|
552
552
|
|