@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.
Files changed (43) hide show
  1. package/README.md +7 -7
  2. package/dist/index.esm.js +10646 -10762
  3. package/dist/types/core/api/api-client.service.d.ts +6 -6
  4. package/dist/types/core/client/client-action.service.d.ts +1 -2
  5. package/dist/types/core/client/client-config.service.d.ts +2 -0
  6. package/dist/types/core/google-tag-manager.service.d.ts +1 -1
  7. package/dist/types/core/logger/logger.service.d.ts +1 -1
  8. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -1
  9. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +35 -51
  10. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +5 -4
  11. package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
  12. package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
  13. package/dist/types/core/store/interfaces/core.interface.d.ts +3 -2
  14. package/dist/types/enums/cloud.enum.d.ts +0 -77
  15. package/dist/types/enums/core.enum.d.ts +24 -0
  16. package/dist/types/interfaces/api/cart.interface.d.ts +11 -7
  17. package/dist/types/interfaces/api/checkout.interface.d.ts +216 -0
  18. package/dist/types/interfaces/api/product.interface.d.ts +2 -3
  19. package/dist/types/interfaces/core.interface.d.ts +7 -1
  20. package/dist/types/modules/cart/cart.commands.d.ts +4 -4
  21. package/dist/types/modules/checkout/checkout.commands.d.ts +18 -9
  22. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  23. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  24. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
  25. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  26. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
  27. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  28. package/dist/types/modules/checkout/constant.d.ts +3 -0
  29. package/dist/types/modules/product/product.commands.d.ts +1 -0
  30. package/dist/types/modules/product-list/product-list.commands.d.ts +1 -0
  31. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -0
  32. package/dist/types/utils/format.d.ts +0 -1
  33. package/docs/ACTIONS.md +13 -13
  34. package/docs/EVENTS.md +7 -7
  35. package/package.json +5 -5
  36. package/umd/elements.js +1 -1
  37. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
  38. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  39. package/dist/types/interfaces/cloud/index.d.ts +0 -3
  40. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  41. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  42. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  43. package/dist/types/utils/helper.d.ts +0 -28
@@ -2,10 +2,9 @@ import type { AuthClientService } from '@/core/api/auth-client.service';
2
2
  import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
3
3
  import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
4
4
  import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
5
+ import type { ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
5
6
  import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
6
7
  import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
7
- import type { ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
8
- import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
9
8
  import type { IAllConfigs } from '@/interfaces/configs';
10
9
  export declare class ApiClientService {
11
10
  private client;
@@ -23,8 +22,9 @@ export declare class ApiClientService {
23
22
  catalogSearch(params: IProductSearchParams): Promise<IProductSearchResponse>;
24
23
  getCartData(id: string | null): Promise<ICart>;
25
24
  updateCart(params: ICartUpdateParams): Promise<ICart>;
26
- prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
27
- getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
28
- confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ILiquidPaymentToken>;
29
- checkoutComplete(params: Partial<ICheckoutCompleteParams>): Promise<ICheckoutCompleteResponse>;
25
+ prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepare>;
26
+ updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ICheckoutItemsUpdateResponse>;
27
+ getPaymentSession(cartId: string): Promise<ICheckoutPaymentSession>;
28
+ confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ICheckoutPaymentConfirm>;
29
+ checkoutComplete(token: string): Promise<ICheckoutComplete>;
30
30
  }
@@ -3,7 +3,7 @@ import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkou
3
3
  import type { IBaseProductEventData } from '@/core/pubsub/interfaces/product.interface';
4
4
  import { type FulfillmentType } from '@/enums';
5
5
  import type { IAddressAddress, IAddressCoordinates, IAddressData } from '@/interfaces/api/address.interface';
6
- import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
6
+ import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/constant';
7
7
  export interface IAddProductParams {
8
8
  identifier: string;
9
9
  fulfillmentType: FulfillmentType;
@@ -30,7 +30,6 @@ export interface ICheckoutActions {
30
30
  closeCheckout: () => void;
31
31
  toggleCheckout: () => void;
32
32
  addProduct: (params: IAddProductParams[], openCheckout?: boolean) => Promise<void>;
33
- addPresaleProduct: (params: IAddProductParams) => Promise<void>;
34
33
  applyPromoCode: (promoCode: string) => Promise<void>;
35
34
  removePromoCode: () => Promise<void>;
36
35
  applyGiftCard: (code: string) => Promise<void>;
@@ -22,6 +22,7 @@ export interface IClientConfigs {
22
22
  paymentMethodId?: string;
23
23
  openShadowDom?: boolean;
24
24
  hasCustomApiUrl?: boolean;
25
+ checkoutUrl: string | null;
25
26
  }
26
27
  export interface IClientConfigInput {
27
28
  env?: ElementsEnv;
@@ -35,6 +36,7 @@ export interface IClientConfigInput {
35
36
  paymentMethodId?: string;
36
37
  openShadowDom?: boolean;
37
38
  };
39
+ checkoutUrl?: string;
38
40
  }
39
41
  export declare class ClientConfigService {
40
42
  private config;
@@ -94,7 +94,7 @@ export declare class GoogleTagManagerService {
94
94
  net_total?: number;
95
95
  }): void;
96
96
  promoCodeAttempt(code: string): void;
97
- promoCodeApplied(code: string, discountAmount?: number): void;
97
+ promoCodeApplied(code: string, discount?: number): void;
98
98
  promoCodeFailed(code: string, reason?: string): void;
99
99
  giftCardAttempt(code: string): void;
100
100
  giftCardApplied(code: string, appliedAmount?: number): void;
@@ -13,6 +13,6 @@ export declare class LoggerService {
13
13
  debug(message: string, data?: Record<string, any>): void;
14
14
  info(message: string, data?: Record<string, any>): void;
15
15
  warn(message: string, data?: Record<string, any>): void;
16
- error(message: string, error?: Error | Record<string, any>): void;
16
+ error(message: string, errorOrData?: Error | Record<string, any>): void;
17
17
  private sendToTelemetry;
18
18
  }
@@ -50,7 +50,7 @@ export interface ICartItemEngravingUpdatedEventData {
50
50
  }
51
51
  export interface ICartPromoCodeEventData {
52
52
  cartId: string;
53
- discountAmount?: number;
53
+ discount?: number;
54
54
  newSubtotal?: number;
55
55
  }
56
56
  export interface ICartPromoCodeFailedEventData {
@@ -1,25 +1,55 @@
1
- import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
2
- import type { ICheckoutTotalAmounts } from '@/interfaces/cloud';
1
+ import type { ICheckoutAmounts, ICheckoutItem } from '@/interfaces/api/checkout.interface';
3
2
  export interface IBaseCheckoutEventData {
4
3
  cartId: string;
4
+ isGift: boolean;
5
+ billingSameAsShipping: boolean;
6
+ marketingPreferences: {
7
+ canEmail: boolean;
8
+ canSms: boolean;
9
+ };
10
+ hasPromoCode: boolean;
11
+ hasGiftCards: boolean;
12
+ amounts: ICheckoutAmounts;
13
+ itemCount: number;
14
+ items: Record<string, ICheckoutItem>;
5
15
  }
6
16
  export interface ICheckoutLoadedEventData extends IBaseCheckoutEventData {
7
17
  }
18
+ export interface ICheckoutDetailsEventData extends IBaseCheckoutEventData {
19
+ }
20
+ export interface ICheckoutCustomerInformationUpdatedEventData {
21
+ cartId: string;
22
+ }
23
+ export interface ICheckoutGiftInformationUpdatedEventData {
24
+ cartId: string;
25
+ }
26
+ export interface ICheckoutBillingInformationUpdatedEventData {
27
+ cartId: string;
28
+ }
8
29
  export interface ICheckoutTipUpdatedEventData {
30
+ cartId: string;
9
31
  deliveryTips: Array<{
10
- fulfillmentId?: string;
11
- tipAmount?: number;
32
+ fulfillmentId: string;
33
+ tip: number;
34
+ }>;
35
+ previousDeliveryTips: Array<{
36
+ fulfillmentId: string;
37
+ tip: number;
12
38
  }>;
13
39
  }
14
40
  export interface ICheckoutFailedEventData {
15
41
  message: string;
16
42
  }
17
43
  export interface ICheckoutToggleEventData {
44
+ cartId: string;
18
45
  isActive: boolean;
46
+ previousIsActive: boolean;
19
47
  }
20
48
  export interface ICheckoutMarketingPreferencesToggleEventData {
49
+ cartId: string;
21
50
  fieldName: 'canEmail' | 'canSms';
22
51
  isActive: boolean;
52
+ previousIsActive: boolean;
23
53
  }
24
54
  export interface ICheckoutSubmitStartedEventData {
25
55
  started: boolean;
@@ -49,7 +79,7 @@ export interface ICheckoutItemEngravingUpdatedEventData {
49
79
  }
50
80
  export interface ICheckoutPromoCodeEventData {
51
81
  cartId: string;
52
- discountAmount?: number;
82
+ discount?: number;
53
83
  newTotal?: number;
54
84
  }
55
85
  export interface ICheckoutPromoCodeFailedEventData {
@@ -76,49 +106,3 @@ export interface ICheckoutProductAddFailedEventData {
76
106
  error: string;
77
107
  isPresale?: boolean;
78
108
  }
79
- export interface ICheckoutItemEventData {
80
- liquidId: string;
81
- variantId: string;
82
- cartItemId: string;
83
- retailerId: string;
84
- fulfillmentId: string;
85
- salsifyGrouping: string;
86
- name: string;
87
- catPath: string;
88
- volume: string;
89
- uom: string;
90
- proof: string;
91
- abv: string;
92
- containerType: string;
93
- container: string;
94
- size: string;
95
- pack: boolean;
96
- packDesc: string;
97
- mainImage: string;
98
- brand: string;
99
- partNumber: string;
100
- upc: string;
101
- sku: string;
102
- price: number;
103
- unitPrice: number;
104
- quantity: number;
105
- unitTax: number;
106
- bottleDeposits: number;
107
- attributes: ICartItemAttributes;
108
- retailerName: string;
109
- expectationDetail: string;
110
- }
111
- export interface ICheckoutDetailsEventData {
112
- cartId: string;
113
- isGift: boolean;
114
- billingSameAsShipping: boolean;
115
- marketingPreferences: {
116
- canEmail: boolean;
117
- canSms: boolean;
118
- };
119
- hasPromoCode: boolean;
120
- hasGiftCards: boolean;
121
- amounts: ICheckoutTotalAmounts;
122
- itemCount: number;
123
- items: Record<string, ICheckoutItemEventData>;
124
- }
@@ -1,6 +1,6 @@
1
1
  import type { IAddressActionEventData } from '@/core/pubsub/interfaces/address.interface';
2
2
  import type { ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartUpdatedEventData } from '@/core/pubsub/interfaces/cart.interface';
3
- import type { ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, 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, 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 {
@@ -49,6 +49,7 @@ export interface IElementsActionsEventsMap {
49
49
  [ELEMENTS_ACTIONS_EVENT.CART_PROMO_CODE_FAILED]: ICartPromoCodeFailedEventData;
50
50
  [ELEMENTS_ACTIONS_EVENT.CART_PRODUCT_ADD_SUCCESS]: ICartProductAddEventData;
51
51
  [ELEMENTS_ACTIONS_EVENT.CART_PRODUCT_ADD_FAILED]: ICartProductAddFailedEventData;
52
+ [ELEMENTS_ACTIONS_EVENT.INTERNAL_CART_TO_CHECKOUT]: object;
52
53
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_OPENED]: boolean;
53
54
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_CLOSED]: boolean;
54
55
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_LOADED]: ICheckoutLoadedEventData;
@@ -56,9 +57,9 @@ export interface IElementsActionsEventsMap {
56
57
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_IS_GIFT_TOGGLED]: ICheckoutToggleEventData;
57
58
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED]: ICheckoutToggleEventData;
58
59
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_MARKETING_PREFERENCES_TOGGLED]: ICheckoutMarketingPreferencesToggleEventData;
59
- [ELEMENTS_ACTIONS_EVENT.CHECKOUT_CUSTOMER_INFORMATION_UPDATED]: boolean;
60
- [ELEMENTS_ACTIONS_EVENT.CHECKOUT_GIFT_INFORMATION_UPDATED]: boolean;
61
- [ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_INFORMATION_UPDATED]: boolean;
60
+ [ELEMENTS_ACTIONS_EVENT.CHECKOUT_CUSTOMER_INFORMATION_UPDATED]: ICheckoutCustomerInformationUpdatedEventData;
61
+ [ELEMENTS_ACTIONS_EVENT.CHECKOUT_GIFT_INFORMATION_UPDATED]: ICheckoutGiftInformationUpdatedEventData;
62
+ [ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_INFORMATION_UPDATED]: ICheckoutBillingInformationUpdatedEventData;
62
63
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_REMOVED]: ICheckoutItemRemovedEventData;
63
64
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_QUANTITY_INCREASE]: ICheckoutItemQuantityChangedEventData;
64
65
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_QUANTITY_DECREASE]: ICheckoutItemQuantityChangedEventData;
@@ -1,5 +1,4 @@
1
- import type { IElementsCartEvent } from 'utils/helper';
2
- import type { ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
1
+ import type { ICartEvent, ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
3
2
  export interface ICartItemStore {
4
3
  id: string;
5
4
  variantId: string;
@@ -48,7 +47,7 @@ export interface ICartStore {
48
47
  fulfillments: Record<string, ICartFulfillmentStore>;
49
48
  retailers: Record<string, ICartRetailerStore>;
50
49
  promoCode: ICartPromoCode | null;
51
- events: IElementsCartEvent[];
50
+ events: ICartEvent[];
52
51
  loading: boolean;
53
52
  error: string | null;
54
53
  rerender: boolean;
@@ -1,121 +1,29 @@
1
- import type { IElementsCheckoutEvents } from 'utils/helper';
2
- import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
3
- export interface ICheckoutMarketingPreferencesStore {
4
- canEmail: boolean;
5
- canSms: boolean;
6
- }
7
- export interface ICheckoutPromoCodeStore {
8
- code: string;
9
- discountAmount: number;
10
- }
11
- export interface ICheckoutGiftCardStore {
12
- code: string;
13
- discountAmount: number;
14
- }
15
- export interface ICheckoutItemStore {
16
- liquidId: string;
17
- variantId: string;
18
- cartItemId: string;
19
- retailerId: string;
20
- fulfillmentId: string;
21
- salsifyGrouping: string;
22
- name: string;
23
- catPath: string;
24
- volume: string;
25
- uom: string;
26
- proof: string;
27
- abv: string;
28
- containerType: string;
29
- container: string;
30
- size: string;
31
- pack: boolean;
32
- packDesc: string;
33
- mainImage: string;
34
- brand: string;
35
- partNumber: string;
36
- upc: string;
37
- sku: string;
38
- price: number;
39
- unitPrice: number;
40
- quantity: number;
41
- unitTax: number;
42
- bottleDeposits: number;
43
- attributes: ICartItemAttributes;
44
- retailerName: string;
45
- expectationDetail: string;
1
+ import type { ICheckoutAmounts, ICheckoutBilling, ICheckoutCustomer, ICheckoutEvent, ICheckoutFulfillment, ICheckoutGiftCard, ICheckoutGiftRecipient, ICheckoutItem, ICheckoutMarketingPreferences, ICheckoutPaymentConfirm, ICheckoutPaymentSession, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer, ICheckoutShippingAddress } from '@/interfaces/api/checkout.interface';
2
+ export interface ICheckoutItemStore extends ICheckoutItem {
46
3
  loading: boolean;
47
4
  updating: boolean;
48
5
  error: string | null;
49
6
  }
50
- export interface IOnDemandFulfillmentTipInfo {
51
- fulfillmentId: string;
52
- retailerId: string;
53
- retailerName: string;
54
- subtotal: number;
55
- tip: number;
56
- }
57
- export interface ICheckoutPresaleStore {
58
- isLocked: boolean;
59
- expiresAt: string | null;
60
- }
61
- export interface ICheckoutCustomerStore {
62
- id?: string;
63
- firstName: string;
64
- lastName: string;
65
- email: string;
66
- phone: string;
67
- birthDate: string;
68
- company: string;
69
- }
70
7
  export interface ICheckoutCustomerFormStore {
71
- data: ICheckoutCustomerStore;
8
+ data: ICheckoutCustomer;
72
9
  isEditing: boolean;
73
10
  isValid: boolean;
74
11
  isSaving: boolean;
75
12
  }
76
- export interface ICheckoutGiftRecipientStore {
77
- firstName: string;
78
- lastName: string;
79
- email: string;
80
- phone: string;
81
- message: string;
82
- }
83
13
  export interface ICheckoutGiftRecipientFormStore {
84
- data: ICheckoutGiftRecipientStore;
14
+ data: ICheckoutGiftRecipient;
85
15
  isEditing: boolean;
86
16
  isValid: boolean;
87
17
  isSaving: boolean;
88
18
  }
89
- export interface ICheckoutBillingStore {
90
- firstName: string;
91
- lastName: string;
92
- email: string;
93
- phone: string;
94
- company: string;
95
- addressOne: string;
96
- addressTwo: string;
97
- city: string;
98
- state: string;
99
- zipCode: string;
100
- }
101
- export interface ICheckoutPaymentCardStore {
102
- brand: string;
103
- last4: string;
104
- expMonth: string;
105
- expYear: string;
106
- }
107
- export interface ICheckoutPaymentMethodStore {
108
- id: string;
109
- card: ICheckoutPaymentCardStore;
19
+ export interface ICheckoutPaymentMethodStore extends ICheckoutPaymentConfirm {
110
20
  }
111
- export interface ICheckoutPaymentSessionStore {
112
- key: string;
113
- secret: string;
21
+ export interface ICheckoutPaymentSessionStore extends ICheckoutPaymentSession {
114
22
  }
115
23
  export interface ICheckoutPaymentFormStore {
116
24
  paymentSession: ICheckoutPaymentSessionStore | null;
117
25
  paymentMethod: ICheckoutPaymentMethodStore | null;
118
- data: ICheckoutBillingStore | null;
26
+ data: ICheckoutBilling | null;
119
27
  billingSameAsShipping: boolean;
120
28
  isEditing: boolean;
121
29
  isValid: boolean;
@@ -124,19 +32,21 @@ export interface ICheckoutPaymentFormStore {
124
32
  export interface ICheckoutStore {
125
33
  token: string;
126
34
  cartId: string;
127
- presale: ICheckoutPresaleStore | null;
35
+ presale: ICheckoutPresale | null;
128
36
  isGift: boolean;
129
- marketingPreferences: ICheckoutMarketingPreferencesStore;
37
+ marketingPreferences: ICheckoutMarketingPreferences;
130
38
  customerForm: ICheckoutCustomerFormStore;
131
39
  giftRecipientForm: ICheckoutGiftRecipientFormStore;
132
40
  paymentForm: ICheckoutPaymentFormStore;
133
- shippingAddressTwo: string;
134
- promoCode: ICheckoutPromoCodeStore | null;
135
- giftCards: ICheckoutGiftCardStore[];
41
+ shippingAddress: ICheckoutShippingAddress;
42
+ promoCode: ICheckoutPromoCode | null;
43
+ giftCards: ICheckoutGiftCard[];
44
+ itemsQuantity: number;
136
45
  items: Record<string, ICheckoutItemStore>;
137
- amounts: any;
46
+ fulfillments: Record<string, ICheckoutFulfillment>;
47
+ retailers: Record<string, ICheckoutRetailer>;
48
+ amounts: ICheckoutAmounts;
138
49
  orderNumber: string | null;
139
- onDemandFulfillmentTipInfo: Record<string, IOnDemandFulfillmentTipInfo>;
140
50
  tipSelection: number;
141
51
  deliveryInstructions: string;
142
52
  giftCardError: string | null;
@@ -145,6 +55,5 @@ export interface ICheckoutStore {
145
55
  loading: boolean;
146
56
  updating: boolean;
147
57
  error: string | null;
148
- warning: string[];
149
- events: IElementsCheckoutEvents[];
58
+ events: ICheckoutEvent[];
150
59
  }
@@ -1,9 +1,10 @@
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, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutPresaleStore, ICheckoutPromoCodeStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
3
+ import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutItemStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
4
4
  import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
5
5
  import type { ComponentType } from '@/enums';
6
6
  import type { ICartPromoCode } from '@/interfaces/api/cart.interface';
7
+ import type { ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer } from '@/interfaces/api/checkout.interface';
7
8
  export interface IDrawerContentConfig {
8
9
  type: ComponentType;
9
10
  data?: Record<string, any>;
@@ -26,7 +27,7 @@ export interface IPersistedStore {
26
27
  p?: string;
27
28
  c?: string;
28
29
  }
29
- 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 ICheckoutPresaleStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.onDemandFulfillmentTipInfo.${string}`;
30
+ 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}`;
30
31
  interface MiddlewareContext {
31
32
  action: string;
32
33
  payload: any;
@@ -1,80 +1,3 @@
1
- export declare enum DAYS_OF_WEEK {
2
- MONDAY = "monday",
3
- TUESDAY = "tuesday",
4
- WEDNESDAY = "wednesday",
5
- THURSDAY = "thursday",
6
- FRIDAY = "friday",
7
- SATURDAY = "saturday",
8
- SUNDAY = "sunday"
9
- }
10
- export declare const CART_EVENT_ENUM: {
11
- readonly OOS: "OutOfStock";
12
- readonly ITEMS_NOT_ADDED: "ItemsNotAdded";
13
- readonly ITEMS_REQUESTED_NOT_ADDED: "ItemsRequestedNotAdded";
14
- readonly ITEM_NOT_ENGRAVED: "ItemEngravingError";
15
- readonly ADDRESS_CHANGE: "AddressChange";
16
- readonly LOCATION_AVAILABILITY: "LocationAvailability";
17
- readonly PARTNER_PRODUCT_CONFIGS: "PartnerProductConfigs";
18
- readonly REMOVED_EXISTING_ITEMS: "RemovedExistingCartItems";
19
- readonly RETAILER_MIN: "RetailerMinNotMet";
20
- readonly NO_ITEMS_IN_CART: "NoItemsInCart";
21
- readonly INVALID_ID: "InvalidId";
22
- readonly NO_ID: "NoId";
23
- readonly CART_CHECKOUT_PROCESSED: "CartCheckoutProcessed";
24
- readonly NEW_CART: "NewCart";
25
- readonly DEFAULT: "CartError";
26
- readonly ITEM_QTY_CHANGE: "ItemQuantityChange";
27
- readonly ITEM_ID_NOT_FOUND: "ItemIdNotFound";
28
- readonly ITEMS_REMOVED: "ItemsRemoved";
29
- readonly COUPON_PROCESSING_ERROR: "CouponProcessingError";
30
- readonly COUPON_NOT_FOUND: "CouponNotFound";
31
- readonly COUPON_EXPIRED: "CouponExpired";
32
- readonly NO_APPLICABLE_DISCOUNT: "NoApplicableDiscount";
33
- readonly COUPON_NOT_STARTED: "CouponNotStarted";
34
- readonly MINIMUM_ORDER_VALUE_NOT_MET: "MinimumOrderValueNotMet";
35
- readonly MINIMUM_ORDER_UNITS_NOT_MET: "MinimumOrderUnitsNotMet";
36
- readonly MINIMUM_DISTINCT_ITEMS_NOT_MET: "MinimumDistinctItemsNotMet";
37
- readonly QUOTA_EXCEEDED: "QuotaExceeded";
38
- readonly USER_LIMIT_EXCEEDED: "UserLimitExceeded";
39
- readonly NOT_FIRST_PURCHASE: "NotFirstPurchase";
40
- readonly INVALID_COUPON: "InvalidCoupon";
41
- readonly INVALID_MEMBERSHIP: "InvalidMembership";
42
- readonly INVALID_DOMAIN: "InvalidDomain";
43
- readonly INVALID_REQUIREMENTS: "InvalidRequirements";
44
- readonly INVALID_ORGANIZATION: "InvalidOrganization";
45
- readonly PRODUCT_NOT_ELIGIBLE: "ProductNotEligible";
46
- readonly NOT_ENOUGH_PREVIOUS_ORDERS: "NotEnoughPreviousOrders";
47
- readonly PRESALE_ITEMS_NOT_ALLOWED: "PresaleItemsNotAllowed";
48
- readonly PRESALE_LIMIT_EXCEEDED: "PresaleLimitExceeded";
49
- readonly PRESALE_NOT_STARTED: "PresaleNotStarted";
50
- readonly PRESALE_EXPIRED: "PresaleExpired";
51
- readonly PRESALE_MIXED_CART: "PresaleMixedCart";
52
- readonly RETAILER_DOES_NOT_ALLOW_PROMOS: "RetailerDoesNotAllowPromos";
53
- readonly RETAILERS_DO_NOT_ALLOW_PROMOS: "RetailersDoNotAllowPromos";
54
- };
55
- export type CartEventEnum = (typeof CART_EVENT_ENUM)[keyof typeof CART_EVENT_ENUM];
56
- export declare const CHECKOUT_EVENT_ENUM: {
57
- readonly ERROR_PROCESSING_GIFT_CARDS: "ErrorProcessingGiftCards";
58
- readonly INVALID_GIFT_CARD_CODE: "InvalidGiftCardCodes";
59
- readonly INVALID_GIFT_CARD_PARTNER: "InvalidGiftCardPartner";
60
- readonly INACTIVE_GIFT_CARD: "InactiveGiftCard";
61
- readonly GIFT_CARD_ALREADY_IN_USE: "GiftCardAlreadyInUse";
62
- readonly GIFT_CARD_EXPIRED: "GiftCardExpired";
63
- readonly GIFT_CARD_BALANCE_DEPLETED: "GiftCardBalanceDepleted";
64
- readonly RETAILER_ONDEMAND_HOURS_NOT_AVAILABLE: "RetailerOnDemandHoursNotAvailable";
65
- readonly ITEM_QTY_CHANGE: "ItemQuantityChange";
66
- readonly MAX_QUANTITY_PER_ORDER_EXCEEDED: "MaxQuantityPerOrderExceeded";
67
- readonly RETAILER_DOES_NOT_ALLOW_PROMOS: "RetailerDoesNotAllowPromos";
68
- readonly RETAILERS_DO_NOT_ALLOW_PROMOS: "RetailersDoNotAllowPromos";
69
- readonly RETAILER_DOES_NOT_ALLOW_GIFT_CARDS: "RetailerDoesNotAllowGiftCards";
70
- readonly RETAILERS_DO_NOT_ALLOW_GIFT_CARDS: "RetailersDoNotAllowGiftCards";
71
- };
72
- export type CheckoutEventEnum = (typeof CHECKOUT_EVENT_ENUM)[keyof typeof CHECKOUT_EVENT_ENUM];
73
- export declare const ENUM_ADDRESS_TYPE: {
74
- readonly SHIPPING: "shipping";
75
- readonly BILLING: "billing";
76
- };
77
- export type AddressType = (typeof ENUM_ADDRESS_TYPE)[keyof typeof ENUM_ADDRESS_TYPE];
78
1
  export declare const ENUM_FILTER_KEYS: {
79
2
  readonly BRANDS: "brands";
80
3
  readonly FLAVOR: "flavor";
@@ -32,6 +32,7 @@ export declare const ELEMENTS_ACTIONS_EVENT: {
32
32
  readonly CART_PROMO_CODE_FAILED: "cart_promo_code_failed";
33
33
  readonly CART_PRODUCT_ADD_SUCCESS: "cart_product_add_success";
34
34
  readonly CART_PRODUCT_ADD_FAILED: "cart_product_add_failed";
35
+ readonly INTERNAL_CART_TO_CHECKOUT: "internal_cart_to_checkout";
35
36
  readonly CHECKOUT_LOADED: "checkout_loaded";
36
37
  readonly CHECKOUT_OPENED: "checkout_opened";
37
38
  readonly CHECKOUT_CLOSED: "checkout_closed";
@@ -146,3 +147,26 @@ export declare const DEBUG_MODE: {
146
147
  readonly PANEL: "panel";
147
148
  };
148
149
  export type DebugMode = (typeof DEBUG_MODE)[keyof typeof DEBUG_MODE];
150
+ export declare const CART_EVENT_TYPE: {
151
+ readonly GENERIC: "generic";
152
+ readonly PROMO_CODE: "promo-code";
153
+ };
154
+ export type CartEventType = (typeof CART_EVENT_TYPE)[keyof typeof CART_EVENT_TYPE];
155
+ export declare const CART_EVENT_LEVEL: {
156
+ readonly SUCCESS: "success";
157
+ readonly WARNING: "warning";
158
+ readonly ERROR: "error";
159
+ };
160
+ export type CartEventLevel = (typeof CART_EVENT_LEVEL)[keyof typeof CART_EVENT_LEVEL];
161
+ export declare const CHECKOUT_EVENT_TYPE: {
162
+ readonly GENERIC: "generic";
163
+ readonly PROMO_CODE: "promo-code";
164
+ readonly GIFT_CARD: "gift-card";
165
+ };
166
+ export type CheckoutEventType = (typeof CHECKOUT_EVENT_TYPE)[keyof typeof CHECKOUT_EVENT_TYPE];
167
+ export declare const CHECKOUT_EVENT_LEVEL: {
168
+ readonly SUCCESS: "success";
169
+ readonly WARNING: "warning";
170
+ readonly ERROR: "error";
171
+ };
172
+ export type CheckoutEventLevel = (typeof CHECKOUT_EVENT_LEVEL)[keyof typeof CHECKOUT_EVENT_LEVEL];
@@ -1,4 +1,4 @@
1
- import type { CartEventEnum, FulfillmentType } from '@/enums';
1
+ import type { CartEventLevel, CartEventType, FulfillmentType } from '@/enums';
2
2
  import type { ILocation } from '@/interfaces/api/address.interface';
3
3
  import type { IProductPresale } from '@/interfaces/api/product.interface';
4
4
  export interface ICartUpdateItem {
@@ -19,6 +19,7 @@ export interface ICartFulfillment {
19
19
  canEngrave: boolean;
20
20
  type: FulfillmentType;
21
21
  expectation: string;
22
+ engravingExpectation: string;
22
23
  itemIds: string[];
23
24
  subtotal: number;
24
25
  hasUnmetMinimumPurchaseAmount: boolean;
@@ -64,7 +65,15 @@ export interface ICartItem {
64
65
  }
65
66
  export interface ICartPromoCode {
66
67
  code: string;
67
- discountAmount: number;
68
+ discount: number;
69
+ freeDelivery: boolean;
70
+ freeServiceFee: boolean;
71
+ freeShipping: boolean;
72
+ }
73
+ export interface ICartEvent {
74
+ type: CartEventType;
75
+ message: string;
76
+ level: CartEventLevel;
68
77
  }
69
78
  export interface ICart {
70
79
  id: string;
@@ -84,8 +93,3 @@ export interface ICartItemEngraving {
84
93
  location: string;
85
94
  lines: string[];
86
95
  }
87
- export interface ICartEvent {
88
- type: CartEventEnum;
89
- message: string;
90
- items?: Array<Partial<ICartItem>>;
91
- }