@liquidcommerce/elements-sdk 2.7.1 → 2.7.3
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 +6788 -6890
- package/dist/index.esm.js +10440 -10643
- package/dist/ssr-stub.checkout.esm.js +18 -0
- package/dist/ssr-stub.esm.js +270 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +3 -1
- package/dist/types/clients/base.d.ts +6 -4
- package/dist/types/clients/builder.d.ts +2 -1
- package/dist/types/clients/checkout.d.ts +2 -10
- package/dist/types/clients/main.d.ts +2 -1
- package/dist/types/constants/core.constant.d.ts +0 -5
- package/dist/types/core/api/api-client.service.d.ts +16 -15
- package/dist/types/core/api/api-result.d.ts +19 -0
- package/dist/types/core/api/auth-client.service.d.ts +13 -5
- package/dist/types/core/base-component.service.d.ts +2 -1
- package/dist/types/core/client/client-action.service.d.ts +1 -1
- package/dist/types/core/client/client-config.service.d.ts +1 -1
- package/dist/types/core/pubsub/pubsub.service.d.ts +0 -2
- package/dist/types/core/singleton-manager.service.d.ts +12 -8
- package/dist/types/core/store/interfaces/core.interface.d.ts +7 -11
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +12 -28
- package/dist/types/core/store/store.service.d.ts +1 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +5 -4
- package/dist/types/index.checkout.d.ts +3 -2
- package/dist/types/index.checkout.umd.d.ts +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/interfaces/client.interface.d.ts +72 -0
- package/dist/types/interfaces/component.interface.d.ts +7 -0
- package/dist/types/interfaces/config.interface.d.ts +46 -0
- package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/global.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product.interface.d.ts +1 -1
- package/dist/types/interfaces/injection.interface.d.ts +44 -0
- package/dist/types/modules/address/address-input.component.d.ts +0 -11
- package/dist/types/modules/address/address.command.d.ts +1 -1
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
- package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +3 -2
- package/dist/types/modules/product/product.commands.d.ts +1 -3
- package/dist/types/modules/product-list/components/card-components/index.d.ts +0 -2
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -3
- package/dist/types/modules/product-list/components/index.d.ts +1 -1
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +2 -5
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +3 -3
- package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +21 -0
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +30 -14
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +0 -2
- package/dist/types/modules/product-list/product-list-card.component.d.ts +18 -16
- package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +7 -54
- package/dist/types/modules/product-list/product-list.component.d.ts +2 -11
- package/dist/types/modules/product-list/product-list.interface.d.ts +0 -30
- package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -10
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -1
- package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
- package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +6 -4
- package/dist/types/ssr/stub.checkout.d.ts +6 -0
- package/dist/types/ssr/stub.d.ts +10 -0
- package/dist/types/utils/dom-compat.d.ts +2 -0
- package/dist/types/utils/product-selection.d.ts +16 -0
- package/dist/types/utils/product.d.ts +10 -0
- package/docs/v1/README.md +2 -2
- package/docs/v1/api/actions/address-actions.md +11 -11
- package/docs/v1/api/actions/cart-actions.md +13 -13
- package/docs/v1/api/actions/checkout-actions.md +23 -23
- package/docs/v1/api/actions/product-actions.md +6 -6
- package/docs/v1/api/client.md +11 -11
- package/docs/v1/api/ui-helpers.md +11 -11
- package/docs/v1/examples/advanced-patterns.md +1 -1
- package/docs/v1/examples/checkout-flow.md +1 -1
- package/docs/v1/getting-started/concepts.md +7 -7
- package/docs/v1/getting-started/installation.md +2 -2
- package/docs/v1/getting-started/quick-start.md +3 -3
- package/docs/v1/guides/address-component.md +11 -11
- package/docs/v1/guides/best-practices.md +14 -14
- package/docs/v1/guides/cart-component.md +23 -23
- package/docs/v1/guides/checkout-component.md +24 -24
- package/docs/v1/guides/events.md +812 -77
- package/docs/v1/guides/product-component.md +5 -5
- package/docs/v1/integration/nextjs.md +11 -2
- package/docs/v1/integration/react.md +3 -3
- package/docs/v1/integration/vanilla-js.md +1 -1
- package/docs/v1/integration/vue.md +24 -0
- package/docs/v1/reference/browser-support.md +9 -0
- package/docs/v1/reference/error-handling.md +2 -2
- package/docs/v1/reference/troubleshooting.md +10 -2
- package/package.json +17 -13
- package/dist/types/interfaces/core.interface.d.ts +0 -139
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +0 -12
- package/dist/types/modules/product-list/components/card-components/product-title.d.ts +0 -6
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +0 -26
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +0 -23
- package/dist/types/modules/ui-components/styles/modal.style.d.ts +0 -1
- package/docs/gitbook/actions.md +0 -160
- package/docs/gitbook/address.md +0 -48
- package/docs/gitbook/cart.md +0 -65
- package/docs/gitbook/checkout.md +0 -131
- package/docs/gitbook/events.md +0 -137
- package/docs/gitbook/overview.md +0 -166
- package/docs/gitbook/product.md +0 -64
- package/docs/gitbook/quick-start-guide.md +0 -393
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const ELEMENTS_ENV = {
|
|
2
|
+
DEVELOPMENT: 'development',
|
|
3
|
+
STAGING: 'staging',
|
|
4
|
+
PRODUCTION: 'production',
|
|
5
|
+
};
|
|
6
|
+
const DEBUG_MODE = {
|
|
7
|
+
NONE: 'none',
|
|
8
|
+
CONSOLE: 'console',
|
|
9
|
+
PANEL: 'panel',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const SSR_WARN = '[LiquidCommerce Checkout] This SDK is designed for the browser. ' + 'Calls made during SSR return null. The SDK will initialize on the client.';
|
|
13
|
+
async function ElementsCheckout(..._args) {
|
|
14
|
+
console.warn(SSR_WARN);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { DEBUG_MODE, ELEMENTS_ENV, ElementsCheckout };
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
class SDKError extends Error {
|
|
2
|
+
constructor(message, reThrow = false) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'SDKError';
|
|
5
|
+
this.isSdk = true;
|
|
6
|
+
this.reThrow = reThrow;
|
|
7
|
+
if (Error.captureStackTrace) {
|
|
8
|
+
Error.captureStackTrace(this, SDKError);
|
|
9
|
+
}
|
|
10
|
+
Object.setPrototypeOf(this, SDKError.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function isSDKError(error, source) {
|
|
14
|
+
if ((error === null || error === void 0 ? void 0 : error.isSdk) === true) {
|
|
15
|
+
if (error instanceof SDKError && error.reThrow) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (!error || typeof error !== 'object') {
|
|
21
|
+
return source ? isSDKSource(source) : false;
|
|
22
|
+
}
|
|
23
|
+
const message = String((error === null || error === void 0 ? void 0 : error.message) || '');
|
|
24
|
+
const hasSDKMessage = /liquidcommerce\s+elements/i.test(message);
|
|
25
|
+
const stack = String((error === null || error === void 0 ? void 0 : error.stack) || '');
|
|
26
|
+
const errorSource = (error === null || error === void 0 ? void 0 : error.source) || source || '';
|
|
27
|
+
const sdkPathPatterns = [
|
|
28
|
+
/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,
|
|
29
|
+
/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,
|
|
30
|
+
/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,
|
|
31
|
+
/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,
|
|
32
|
+
/chunk-[a-z0-9]+.*elements/i,
|
|
33
|
+
];
|
|
34
|
+
const sdkClassPatterns = [
|
|
35
|
+
/\bElements\b(?!\w)/,
|
|
36
|
+
/\bElementsBuilder\b/,
|
|
37
|
+
/\bLiquidCommerceElements\b/,
|
|
38
|
+
/BaseComponent/,
|
|
39
|
+
/Elements(?:Base)?Client/,
|
|
40
|
+
/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,
|
|
41
|
+
/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,
|
|
42
|
+
/(?:Product|Cart|Checkout|Address|ProductList).*Component/,
|
|
43
|
+
];
|
|
44
|
+
const sdkFilePatterns = [
|
|
45
|
+
/(?:service|commands|component)\.(?:ts|js)/,
|
|
46
|
+
/auto-initialize\/(?:main|checkout)\.(?:ts|js)/,
|
|
47
|
+
/elements-(?:base-|builder-)?client\.(?:ts|js)/,
|
|
48
|
+
];
|
|
49
|
+
const sdkDirPatterns = [
|
|
50
|
+
/elements-sdk[/\\]/i,
|
|
51
|
+
/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,
|
|
52
|
+
/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,
|
|
53
|
+
/@liquidcommerce[/\\]elements-sdk/i,
|
|
54
|
+
];
|
|
55
|
+
const hasSDKSource = isSDKSource(errorSource);
|
|
56
|
+
const hasSDKPathPattern = sdkPathPatterns.some((p) => p.test(stack));
|
|
57
|
+
const hasSDKClassPattern = sdkClassPatterns.some((p) => p.test(stack));
|
|
58
|
+
const hasSDKFilePattern = sdkFilePatterns.some((p) => p.test(stack));
|
|
59
|
+
const hasSDKDirPattern = sdkDirPatterns.some((p) => p.test(stack));
|
|
60
|
+
return hasSDKMessage || hasSDKSource || hasSDKPathPattern || hasSDKClassPattern || hasSDKFilePattern || hasSDKDirPattern;
|
|
61
|
+
}
|
|
62
|
+
function isSDKSource(source) {
|
|
63
|
+
if (!source || typeof source !== 'string') {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const sdkSourcePatterns = [
|
|
67
|
+
/\/elements\.js$/i,
|
|
68
|
+
/\/index\.esm\.js$/i,
|
|
69
|
+
/@liquidcommerce\/elements-sdk/i,
|
|
70
|
+
/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,
|
|
71
|
+
/@liquidcommerce[/\\]elements-sdk[/\\]/i,
|
|
72
|
+
/\/elements-sdk[/\\]/i,
|
|
73
|
+
/elements-sdk[/\\]src/i,
|
|
74
|
+
/elements[-.]?[a-z0-9]*\.js$/i,
|
|
75
|
+
/chunk.*elements/i,
|
|
76
|
+
/elements.*chunk/i,
|
|
77
|
+
/\?.*elements\.js/i,
|
|
78
|
+
/#.*elements\.js/i,
|
|
79
|
+
];
|
|
80
|
+
return sdkSourcePatterns.some((pattern) => pattern.test(source));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const ELEMENTS_ENV = {
|
|
84
|
+
DEVELOPMENT: 'development',
|
|
85
|
+
STAGING: 'staging',
|
|
86
|
+
PRODUCTION: 'production',
|
|
87
|
+
};
|
|
88
|
+
const ELEMENTS_ACTIONS_EVENT = {
|
|
89
|
+
CLIENT_READY: 'client_ready',
|
|
90
|
+
ADDRESS_UPDATED: 'address_updated',
|
|
91
|
+
ADDRESS_CLEARED: 'address_cleared',
|
|
92
|
+
ADDRESS_FAILED: 'address_failed',
|
|
93
|
+
PRODUCT_LOADED: 'product_loaded',
|
|
94
|
+
PRODUCT_QUANTITY_INCREASE: 'product_quantity_increase',
|
|
95
|
+
PRODUCT_QUANTITY_DECREASE: 'product_quantity_decrease',
|
|
96
|
+
PRODUCT_ADD_TO_CART: 'product_add_to_cart',
|
|
97
|
+
PRODUCT_SIZE_CHANGED: 'product_size_changed',
|
|
98
|
+
PRODUCT_FULFILLMENT_TYPE_CHANGED: 'product_fulfillment_type_changed',
|
|
99
|
+
PRODUCT_FULFILLMENT_CHANGED: 'product_fulfillment_changed',
|
|
100
|
+
CART_LOADED: 'cart_loaded',
|
|
101
|
+
CART_CLOSED: 'cart_closed',
|
|
102
|
+
CART_OPENED: 'cart_opened',
|
|
103
|
+
CART_UPDATED: 'cart_updated',
|
|
104
|
+
CART_FAILED: 'cart_failed',
|
|
105
|
+
CART_RESET: 'cart_reset',
|
|
106
|
+
CART_ITEM_ADDED: 'cart_item_added',
|
|
107
|
+
CART_ITEM_REMOVED: 'cart_item_removed',
|
|
108
|
+
CART_ITEM_QUANTITY_INCREASE: 'cart_item_quantity_increase',
|
|
109
|
+
CART_ITEM_QUANTITY_DECREASE: 'cart_item_quantity_decrease',
|
|
110
|
+
CART_ITEM_ENGRAVING_UPDATED: 'cart_item_engraving_updated',
|
|
111
|
+
CART_PROMO_CODE_APPLIED: 'cart_promo_code_applied',
|
|
112
|
+
CART_PROMO_CODE_REMOVED: 'cart_promo_code_removed',
|
|
113
|
+
CART_PROMO_CODE_FAILED: 'cart_promo_code_failed',
|
|
114
|
+
CART_PRODUCT_ADD_SUCCESS: 'cart_product_add_success',
|
|
115
|
+
CART_PRODUCT_ADD_FAILED: 'cart_product_add_failed',
|
|
116
|
+
INTERNAL_CART_TO_CHECKOUT: 'internal_cart_to_checkout',
|
|
117
|
+
CHECKOUT_LOADED: 'checkout_loaded',
|
|
118
|
+
CHECKOUT_OPENED: 'checkout_opened',
|
|
119
|
+
CHECKOUT_CLOSED: 'checkout_closed',
|
|
120
|
+
CHECKOUT_FAILED: 'checkout_failed',
|
|
121
|
+
CHECKOUT_IS_GIFT_TOGGLED: 'checkout_is_gift_toggled',
|
|
122
|
+
CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED: 'checkout_billing_same_as_shipping_toggled',
|
|
123
|
+
CHECKOUT_MARKETING_PREFERENCES_TOGGLED: 'checkout_marketing_preferences_toggled',
|
|
124
|
+
CHECKOUT_CUSTOMER_INFORMATION_UPDATED: 'checkout_customer_information_updated',
|
|
125
|
+
CHECKOUT_GIFT_INFORMATION_UPDATED: 'checkout_gift_information_updated',
|
|
126
|
+
CHECKOUT_BILLING_INFORMATION_UPDATED: 'checkout_billing_information_updated',
|
|
127
|
+
CHECKOUT_ITEM_REMOVED: 'checkout_item_removed',
|
|
128
|
+
CHECKOUT_ITEM_QUANTITY_INCREASE: 'checkout_item_quantity_increase',
|
|
129
|
+
CHECKOUT_ITEM_QUANTITY_DECREASE: 'checkout_item_quantity_decrease',
|
|
130
|
+
CHECKOUT_ITEM_ENGRAVING_UPDATED: 'checkout_item_engraving_updated',
|
|
131
|
+
CHECKOUT_TIP_UPDATED: 'checkout_tip_updated',
|
|
132
|
+
CHECKOUT_SUBMIT_STARTED: 'checkout_submit_started',
|
|
133
|
+
CHECKOUT_SUBMIT_COMPLETED: 'checkout_submit_completed',
|
|
134
|
+
CHECKOUT_SUBMIT_FAILED: 'checkout_submit_failed',
|
|
135
|
+
CHECKOUT_PROMO_CODE_APPLIED: 'checkout_promo_code_applied',
|
|
136
|
+
CHECKOUT_PROMO_CODE_REMOVED: 'checkout_promo_code_removed',
|
|
137
|
+
CHECKOUT_PROMO_CODE_FAILED: 'checkout_promo_code_failed',
|
|
138
|
+
CHECKOUT_GIFT_CARD_APPLIED: 'checkout_gift_card_applied',
|
|
139
|
+
CHECKOUT_GIFT_CARD_REMOVED: 'checkout_gift_card_removed',
|
|
140
|
+
CHECKOUT_GIFT_CARD_FAILED: 'checkout_gift_card_failed',
|
|
141
|
+
CHECKOUT_PRODUCT_ADD_SUCCESS: 'checkout_product_add_success',
|
|
142
|
+
CHECKOUT_PRODUCT_ADD_FAILED: 'checkout_product_add_failed',
|
|
143
|
+
};
|
|
144
|
+
const ELEMENTS_FORM = {
|
|
145
|
+
CUSTOMER: 'customer',
|
|
146
|
+
GIFT: 'gift',
|
|
147
|
+
BILLING: 'billing',
|
|
148
|
+
};
|
|
149
|
+
const COMPONENT_TYPE = {
|
|
150
|
+
DRAWER: 'drawer',
|
|
151
|
+
INPUT: 'input',
|
|
152
|
+
ENGRAVING_FORM: 'engraving-form',
|
|
153
|
+
ENGRAVING_VIEW: 'engraving-view',
|
|
154
|
+
BUTTONS_CART_OPEN: 'buttons-cart-open',
|
|
155
|
+
POWERED_BY: 'powered-by',
|
|
156
|
+
LCE_ELEMENT: 'lce-element',
|
|
157
|
+
PURCHASE_MIN_ALERT: 'purchase-min-alert',
|
|
158
|
+
ALERT: 'alert',
|
|
159
|
+
PROMO_CODE_TICKER: 'promo-code-ticker',
|
|
160
|
+
ADDRESS: 'address',
|
|
161
|
+
ADDRESS_INPUT: 'address-input',
|
|
162
|
+
ADDRESS_DISPLAY: 'address-display',
|
|
163
|
+
PRODUCT: 'product',
|
|
164
|
+
PRODUCT_IMAGE_CAROUSEL: 'product-image-carousel',
|
|
165
|
+
PRODUCT_OPTIONS: 'product-options',
|
|
166
|
+
PRODUCT_INTERACTIONS: 'product-interactions',
|
|
167
|
+
PRODUCT_DESCRIPTION: 'product-description',
|
|
168
|
+
PRODUCT_RETAILERS: 'product-retailers',
|
|
169
|
+
PRODUCT_RETAILERS_CAROUSEL: 'product-retailers-carousel',
|
|
170
|
+
PRODUCT_RETAILERS_POPUP: 'product-retailers-popup',
|
|
171
|
+
PRODUCT_RETAILERS_POPUP_LIST: 'product-retailers-popup-list',
|
|
172
|
+
PRODUCT_PRICE: 'product-price',
|
|
173
|
+
PRODUCT_ADD_TO_CART_SECTION: 'product-add-to-cart-section',
|
|
174
|
+
PRODUCT_DRAWER: 'product-drawer',
|
|
175
|
+
PRODUCT_LOADING: 'product-loading',
|
|
176
|
+
PRODUCT_LIST: 'product-list',
|
|
177
|
+
PRODUCT_LIST_CARD: 'product-list-card',
|
|
178
|
+
PRODUCT_LIST_FILTERS: 'product-list-filters',
|
|
179
|
+
PRODUCT_LIST_SEARCH: 'product-list-search',
|
|
180
|
+
PRODUCT_LIST_CARD_LOADING: 'product-list-card-loading',
|
|
181
|
+
PRODUCT_LIST_ENGRAVING_FORM: 'product-list-engraving-form',
|
|
182
|
+
PRODUCT_LIST_PRODUCT_PRE_CART: 'product-list-product-pre-cart',
|
|
183
|
+
PRODUCT_LIST_PRODUCT_ENGRAVING_LINES: 'product-list-product-engraving-lines',
|
|
184
|
+
PRODUCT_LIST_SIZE_SELECTOR: 'product-list-size-selector',
|
|
185
|
+
CART: 'cart',
|
|
186
|
+
CART_RETAILER: 'cart-retailer',
|
|
187
|
+
CART_ITEM: 'cart-item',
|
|
188
|
+
CART_FOOTER: 'cart-footer',
|
|
189
|
+
CART_ITEM_QUANTITY_PRICE: 'cart-item-quantity-price',
|
|
190
|
+
CART_RETAILER_SUBTOTAL: 'cart-retailer-subtotal',
|
|
191
|
+
CART_PROMO_CODE: 'cart-promo-code',
|
|
192
|
+
CART_HEADER: 'cart-header',
|
|
193
|
+
CART_BODY: 'cart-body',
|
|
194
|
+
CART_FULFILLMENT: 'cart-fulfillment',
|
|
195
|
+
CHECKOUT: 'checkout',
|
|
196
|
+
CHECKOUT_INFORMATION: 'checkout-information',
|
|
197
|
+
CHECKOUT_STRIPE_HANDLER: 'checkout-stripe-handler',
|
|
198
|
+
CHECKOUT_STRIPE_FORM: 'checkout-stripe-form',
|
|
199
|
+
CHECKOUT_PAYMENT: 'checkout-payment',
|
|
200
|
+
CHECKOUT_PAYMENT_SUMMARY: 'checkout-payment-summary',
|
|
201
|
+
CHECKOUT_BILLING: 'checkout-billing',
|
|
202
|
+
CHECKOUT_ORDER_SUMMARY: 'checkout-order-summary',
|
|
203
|
+
CHECKOUT_PROMO_CODE: 'checkout-promo-code',
|
|
204
|
+
CHECKOUT_GIFT_CARDS: 'checkout-gift-cards',
|
|
205
|
+
CHECKOUT_AMOUNTS: 'checkout-amounts',
|
|
206
|
+
CHECKOUT_ITEMS: 'checkout-items',
|
|
207
|
+
CHECKOUT_COMPLETED: 'checkout-completed',
|
|
208
|
+
CHECKOUT_DELIVER_TO: 'checkout-deliver-to',
|
|
209
|
+
CHECKOUT_DELIVER_TO_SUMMARY: 'checkout-deliver-to-summary',
|
|
210
|
+
CHECKOUT_BUYER: 'checkout-buyer',
|
|
211
|
+
CHECKOUT_BUYER_SUMMARY: 'checkout-buyer-summary',
|
|
212
|
+
CHECKOUT_TIPS: 'checkout-tips',
|
|
213
|
+
CHECKOUT_PC_GC: 'checkout-pc-gc',
|
|
214
|
+
CHECKOUT_ITEM: 'checkout-item',
|
|
215
|
+
CHECKOUT_ITEM_QUANTITY: 'checkout-item-quantity',
|
|
216
|
+
CHECKOUT_PLACE_ORDER_BUTTON: 'checkout-place-order-button',
|
|
217
|
+
CHECKOUT_HEADER: 'checkout-header',
|
|
218
|
+
CHECKOUT_PRESALE_COUNTDOWN: 'checkout-presale-countdown',
|
|
219
|
+
CHECKOUT_PRESALE_EXPIRED: 'checkout-presale-expired',
|
|
220
|
+
CHECKOUT_SEND_AS_GIFT: 'checkout-send-as-gift',
|
|
221
|
+
};
|
|
222
|
+
const FULFILLMENT_TYPE = {
|
|
223
|
+
ON_DEMAND: 'onDemand',
|
|
224
|
+
SHIPPING: 'shipping',
|
|
225
|
+
};
|
|
226
|
+
const DEBUG_MODE = {
|
|
227
|
+
NONE: 'none',
|
|
228
|
+
CONSOLE: 'console',
|
|
229
|
+
PANEL: 'panel',
|
|
230
|
+
};
|
|
231
|
+
const CART_EVENT_TYPE = {
|
|
232
|
+
GENERIC: 'generic',
|
|
233
|
+
PROMO_CODE: 'promo-code',
|
|
234
|
+
};
|
|
235
|
+
const CART_EVENT_LEVEL = {
|
|
236
|
+
SUCCESS: 'success',
|
|
237
|
+
WARNING: 'warning',
|
|
238
|
+
ERROR: 'error',
|
|
239
|
+
};
|
|
240
|
+
const CHECKOUT_EVENT_TYPE = {
|
|
241
|
+
GENERIC: 'generic',
|
|
242
|
+
PROMO_CODE: 'promo-code',
|
|
243
|
+
GIFT_CARD: 'gift-card',
|
|
244
|
+
};
|
|
245
|
+
const CHECKOUT_EVENT_LEVEL = {
|
|
246
|
+
SUCCESS: 'success',
|
|
247
|
+
WARNING: 'warning',
|
|
248
|
+
ERROR: 'error',
|
|
249
|
+
};
|
|
250
|
+
const DISPLAY_MODE = {
|
|
251
|
+
MODAL: 'modal',
|
|
252
|
+
DRAWER: 'drawer',
|
|
253
|
+
};
|
|
254
|
+
const NAVIGATION_SOURCE = {
|
|
255
|
+
PRODUCT: 'product',
|
|
256
|
+
PRODUCT_LIST_CARD: 'product-list-card',
|
|
257
|
+
PRE_CART: 'pre-cart',
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const SSR_WARN = '[LiquidCommerce Elements] This SDK is designed for the browser. ' + 'Calls made during SSR return null. The SDK will initialize on the client.';
|
|
261
|
+
async function Elements(..._args) {
|
|
262
|
+
console.warn(SSR_WARN);
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
async function ElementsBuilder(..._args) {
|
|
266
|
+
console.warn(SSR_WARN);
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export { CART_EVENT_LEVEL, CART_EVENT_TYPE, CHECKOUT_EVENT_LEVEL, CHECKOUT_EVENT_TYPE, COMPONENT_TYPE, DEBUG_MODE, DISPLAY_MODE, ELEMENTS_ACTIONS_EVENT, ELEMENTS_ENV, ELEMENTS_FORM, Elements, ElementsBuilder, FULFILLMENT_TYPE, NAVIGATION_SOURCE, SDKError, isSDKError };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IInjectedComponent } from '@/interfaces/component.interface';
|
|
2
|
+
import type { ILiquidCommerceElementsDevelopmentConfig } from '@/interfaces/config.interface';
|
|
3
|
+
import type { IInjectCheckoutParams } from '@/interfaces/injection.interface';
|
|
2
4
|
export declare const SHARED_ATTR: {
|
|
3
5
|
readonly SCRIPT: {
|
|
4
6
|
readonly MAIN: "data-liquid-commerce-elements";
|
|
@@ -16,7 +16,9 @@ import { LoggerFactory } from '@/core/logger/logger-factory';
|
|
|
16
16
|
import { StoreService } from '@/core/store/store.service';
|
|
17
17
|
import { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
18
18
|
import { type ComponentType } from '@/enums';
|
|
19
|
-
import type {
|
|
19
|
+
import type { ILiquidCommerceElementsActions } from '@/interfaces/client.interface';
|
|
20
|
+
import type { IInjectedComponent } from '@/interfaces/component.interface';
|
|
21
|
+
import type { IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams, IProcessInjectElementParams } from '@/interfaces/injection.interface';
|
|
20
22
|
import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
|
|
21
23
|
export declare abstract class ElementsBaseClient {
|
|
22
24
|
protected readonly authClient: AuthClientService;
|
|
@@ -33,8 +35,8 @@ export declare abstract class ElementsBaseClient {
|
|
|
33
35
|
protected readonly logger: ReturnType<typeof LoggerFactory.get>;
|
|
34
36
|
protected clientPrepared: boolean;
|
|
35
37
|
protected componentFactoryInitialized: boolean;
|
|
36
|
-
protected
|
|
37
|
-
|
|
38
|
+
protected cartDrawerElement: HTMLElement | null;
|
|
39
|
+
private heavyInitTimeoutId;
|
|
38
40
|
protected injectedComponents: Map<string, IInjectedComponent>;
|
|
39
41
|
constructor(clientConfigs: IClientConfigs);
|
|
40
42
|
prepare(): Promise<void>;
|
|
@@ -48,9 +50,9 @@ export declare abstract class ElementsBaseClient {
|
|
|
48
50
|
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
49
51
|
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
50
52
|
protected ensureCartDrawerExists(): void;
|
|
51
|
-
protected ensureModalExists(): void;
|
|
52
53
|
protected ensureAllComponentsRegistered(): void;
|
|
53
54
|
protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
|
|
55
|
+
destroy(): void;
|
|
54
56
|
protected rerenderInjectedComponentsByType(type: ComponentType): void;
|
|
55
57
|
protected isElementsEnabled(): boolean;
|
|
56
58
|
protected injectDisabledElementsError(containerId: string, componentName: ComponentType): void;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { ILiquidCommerceElementsBuilderClient
|
|
1
|
+
import type { ILiquidCommerceElementsBuilderClient } from '@/interfaces/client.interface';
|
|
2
|
+
import type { ILiquidCommerceElementsBuilderConfig } from '@/interfaces/config.interface';
|
|
2
3
|
export declare function ElementsBuilder(apiKey: string, config: ILiquidCommerceElementsBuilderConfig): Promise<ILiquidCommerceElementsBuilderClient | null>;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { IElementsCheckoutClient } from '@/interfaces/client.interface';
|
|
2
|
+
import type { ILiquidCommerceElementsCheckoutClientConfig } from '@/interfaces/config.interface';
|
|
3
3
|
import '@/modules/theme-provider/styles/register-styles';
|
|
4
4
|
import '@/modules/checkout/styles/register-styles';
|
|
5
|
-
export interface IElementsCheckoutActions extends Omit<ICheckoutActions, 'openCheckout' | 'closeCheckout' | 'toggleCheckout'> {
|
|
6
|
-
}
|
|
7
|
-
export interface IElementsCheckoutClient {
|
|
8
|
-
injectCheckout: (params: IInjectCheckoutParams) => Promise<IInjectedComponent | null>;
|
|
9
|
-
actions: {
|
|
10
|
-
checkout: IElementsCheckoutActions;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
5
|
export declare function ElementsCheckout(apiKey: string, config: ILiquidCommerceElementsCheckoutClientConfig): Promise<IElementsCheckoutClient | null>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { ILiquidCommerceElementsClient
|
|
1
|
+
import type { ILiquidCommerceElementsClient } from '@/interfaces/client.interface';
|
|
2
|
+
import type { ILiquidCommerceElementsConfig } from '@/interfaces/config.interface';
|
|
2
3
|
export declare function Elements(apiKey: string, config: ILiquidCommerceElementsConfig): Promise<ILiquidCommerceElementsClient | null>;
|
|
@@ -3,9 +3,6 @@ export declare const API_CLIENT_URL: {
|
|
|
3
3
|
staging: string;
|
|
4
4
|
production: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const PRODUCT_LIST_CARD_VARIANT: {
|
|
7
|
-
STANDARD: string;
|
|
8
|
-
};
|
|
9
6
|
export declare const PRODUCT_LIST_FILTER_TYPES: {
|
|
10
7
|
ENGRAVING: string;
|
|
11
8
|
PRESALE: string;
|
|
@@ -45,6 +42,4 @@ export declare const Z_INDEX: {
|
|
|
45
42
|
readonly ADDRESS_ACTIONS: 5050;
|
|
46
43
|
readonly SKELETON_WAVE: 5040;
|
|
47
44
|
readonly CONTENT_OVERLAY: 5030;
|
|
48
|
-
readonly MODAL: 2147483640;
|
|
49
45
|
};
|
|
50
|
-
export declare const DESKTOP_BREAKPOINT = 1024;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ApiResult } from '@/core/api/api-result';
|
|
1
2
|
import type { AuthClientService } from '@/core/api/auth-client.service';
|
|
2
|
-
import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
|
|
3
|
+
import type { IPersistedStore, IPersistedStoreAction } from '@/core/store/interfaces/core.interface';
|
|
3
4
|
import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
|
|
4
5
|
import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
|
|
5
6
|
import type { ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
|
|
@@ -11,18 +12,18 @@ export declare class ApiClientService {
|
|
|
11
12
|
constructor();
|
|
12
13
|
static getInstance(): ApiClientService;
|
|
13
14
|
setClient(client: AuthClientService): Promise<void>;
|
|
14
|
-
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<
|
|
15
|
-
getPersistedStore(userDeviceId: string): Promise<IPersistedStore
|
|
16
|
-
deletePersistedStore(userDeviceId: string): Promise<
|
|
17
|
-
getAddressSuggestions(input: string): Promise<IAddressAutocompleteResult[]
|
|
18
|
-
getAddressDetails(id: string): Promise<IAddressDetailsResult
|
|
19
|
-
getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse
|
|
20
|
-
catalogSearch(params: IProductSearchParams): Promise<IProductSearchResponse
|
|
21
|
-
getCartData(id: string | null): Promise<ICart
|
|
22
|
-
updateCart(params: ICartUpdateParams): Promise<ICart
|
|
23
|
-
prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepare
|
|
24
|
-
updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ICheckoutItemsUpdateResponse
|
|
25
|
-
getPaymentSession(cartId: string): Promise<ICheckoutPaymentSession
|
|
26
|
-
confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ICheckoutPaymentConfirm
|
|
27
|
-
checkoutComplete(token: string): Promise<ICheckoutComplete
|
|
15
|
+
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<ApiResult<IPersistedStoreAction>>;
|
|
16
|
+
getPersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStore>>;
|
|
17
|
+
deletePersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStoreAction>>;
|
|
18
|
+
getAddressSuggestions(input: string): Promise<ApiResult<IAddressAutocompleteResult[]>>;
|
|
19
|
+
getAddressDetails(id: string): Promise<ApiResult<IAddressDetailsResult>>;
|
|
20
|
+
getProductsData(identifier: string[], location?: ILocation): Promise<ApiResult<IProductAvailabilityResponse>>;
|
|
21
|
+
catalogSearch(params: IProductSearchParams): Promise<ApiResult<IProductSearchResponse>>;
|
|
22
|
+
getCartData(id: string | null): Promise<ApiResult<ICart>>;
|
|
23
|
+
updateCart(params: ICartUpdateParams): Promise<ApiResult<ICart>>;
|
|
24
|
+
prepareCheckout(params: ICheckoutPrepareParams): Promise<ApiResult<ICheckoutPrepare>>;
|
|
25
|
+
updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ApiResult<ICheckoutItemsUpdateResponse>>;
|
|
26
|
+
getPaymentSession(cartId: string): Promise<ApiResult<ICheckoutPaymentSession>>;
|
|
27
|
+
confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ApiResult<ICheckoutPaymentConfirm>>;
|
|
28
|
+
checkoutComplete(token: string): Promise<ApiResult<ICheckoutComplete>>;
|
|
28
29
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IApiErrorDetail {
|
|
2
|
+
field?: string;
|
|
3
|
+
message: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApiError {
|
|
7
|
+
status: number;
|
|
8
|
+
message: string;
|
|
9
|
+
errors: IApiErrorDetail[];
|
|
10
|
+
}
|
|
11
|
+
export type ApiResult<T> = {
|
|
12
|
+
success: true;
|
|
13
|
+
data: T;
|
|
14
|
+
} | {
|
|
15
|
+
success: false;
|
|
16
|
+
error: ApiError;
|
|
17
|
+
};
|
|
18
|
+
export declare function apiSuccess<T>(data: T): ApiResult<T>;
|
|
19
|
+
export declare function apiError<T = never>(status: number, message: string, errors?: IApiErrorDetail[]): ApiResult<T>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ApiResult } from '@/core/api/api-result';
|
|
1
2
|
import type { ElementsEnv } from '@/enums';
|
|
2
3
|
import type { IAllConfigs } from '@/interfaces/configs/global.interface';
|
|
3
4
|
export interface IAuthConfig {
|
|
@@ -13,13 +14,20 @@ export interface IAuth {
|
|
|
13
14
|
accessToken: string;
|
|
14
15
|
expiration: number;
|
|
15
16
|
}
|
|
16
|
-
export interface IApiResponseBase {
|
|
17
|
-
message: string;
|
|
18
|
-
}
|
|
19
17
|
export interface IApiResponse<T> {
|
|
20
18
|
message: string;
|
|
21
19
|
data: T;
|
|
22
20
|
}
|
|
21
|
+
export interface IApiErrorDetail {
|
|
22
|
+
field?: string;
|
|
23
|
+
message: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IApiError {
|
|
27
|
+
statusCode: number;
|
|
28
|
+
message: string;
|
|
29
|
+
errors: IApiErrorDetail[];
|
|
30
|
+
}
|
|
23
31
|
export interface IAuthWithConfigs {
|
|
24
32
|
auth: IAuth;
|
|
25
33
|
configs: IAllConfigs;
|
|
@@ -46,8 +54,8 @@ export declare class AuthClientService {
|
|
|
46
54
|
}>;
|
|
47
55
|
authenticate(): Promise<boolean>;
|
|
48
56
|
refreshToken(): Promise<boolean>;
|
|
49
|
-
get<
|
|
50
|
-
post<
|
|
57
|
+
get<TData = unknown>(path: string, options?: IHttpRequestOptions): Promise<ApiResult<TData>>;
|
|
58
|
+
post<TData = unknown>(path: string, options?: IHttpRequestOptions): Promise<ApiResult<TData>>;
|
|
51
59
|
private performAuthentication;
|
|
52
60
|
private performTokenRefresh;
|
|
53
61
|
private request;
|
|
@@ -7,6 +7,7 @@ import { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
|
7
7
|
import type { ComponentType } from '@/enums';
|
|
8
8
|
import type { ConfigsKeyType, ConfigsType } from '@/interfaces/configs';
|
|
9
9
|
import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
|
|
10
|
+
import { SafeHTMLElement } from '@/utils/dom-compat';
|
|
10
11
|
import { CommandService } from './command/command.service';
|
|
11
12
|
export interface IBaseComponentConfig {
|
|
12
13
|
type: ComponentType;
|
|
@@ -25,7 +26,7 @@ export interface IOnStoreChanged {
|
|
|
25
26
|
value: any;
|
|
26
27
|
oldValue: any;
|
|
27
28
|
}
|
|
28
|
-
export declare abstract class BaseComponent<TParams = Record<string, any>, TConfig = ConfigsType> extends
|
|
29
|
+
export declare abstract class BaseComponent<TParams = Record<string, any>, TConfig = ConfigsType> extends SafeHTMLElement {
|
|
29
30
|
protected readonly store: StoreService;
|
|
30
31
|
protected readonly commands: CommandService;
|
|
31
32
|
protected readonly themeProvider: ThemeProviderService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ILiquidCommerceElementsActions } from '@/interfaces/
|
|
1
|
+
import type { ILiquidCommerceElementsActions } from '@/interfaces/client.interface';
|
|
2
2
|
export declare class ClientActionService {
|
|
3
3
|
private readonly productActionService;
|
|
4
4
|
private readonly addressActionService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DebugMode, type ElementsEnv } from '@/enums';
|
|
2
|
+
import type { IClientCustomThemeConfig, IElementsProxyConfig, ILiquidCommerceElementsCheckoutConfig } from '@/interfaces/config.interface';
|
|
2
3
|
import type { IPromoTicker } from '@/interfaces/configs';
|
|
3
|
-
import type { IClientCustomThemeConfig, IElementsProxyConfig, ILiquidCommerceElementsCheckoutConfig } from '@/interfaces/core.interface';
|
|
4
4
|
export type DeviceType = 'desktop' | 'tablet' | 'mobile';
|
|
5
5
|
export interface IClientConfigs {
|
|
6
6
|
apiKey: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IElementsActionsEventsMap, IElementsFormsEventsMap, SpecificActionEvent, SpecificFormEvent } from '@/core/pubsub/interfaces/core.interface';
|
|
2
2
|
export declare class PubSubService {
|
|
3
3
|
private readonly logger;
|
|
4
|
-
private clientReadyEvent;
|
|
5
4
|
constructor();
|
|
6
5
|
private readonly eventPrefix;
|
|
7
6
|
static getInstance(): PubSubService;
|
|
@@ -9,5 +8,4 @@ export declare class PubSubService {
|
|
|
9
8
|
publishForm<K extends SpecificFormEvent>(eventType: K, data: IElementsFormsEventsMap[K]): void;
|
|
10
9
|
private publishSpecific;
|
|
11
10
|
private dispatchNativeEvents;
|
|
12
|
-
private setupClientReadyBuffering;
|
|
13
11
|
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
2
|
-
import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/
|
|
2
|
+
import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsCheckoutClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/client.interface';
|
|
3
|
+
type ClientConstructor = LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor | LiquidCommerceElementsCheckoutClientConstructor;
|
|
4
|
+
export type SDKContext = 'regular' | 'builder' | 'checkout';
|
|
3
5
|
export declare class SingletonManager {
|
|
4
6
|
private static clientConstructor;
|
|
5
|
-
private static
|
|
6
|
-
private static builderClientInstances;
|
|
7
|
+
private static contexts;
|
|
7
8
|
private static currentContext;
|
|
9
|
+
private static initializationInProgress;
|
|
8
10
|
private static getInstances;
|
|
9
11
|
private constructor();
|
|
10
|
-
static setContext(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static
|
|
14
|
-
static
|
|
12
|
+
static setContext(context: SDKContext): void;
|
|
13
|
+
static finalizeInitialization(): void;
|
|
14
|
+
static hasContext(context: SDKContext): boolean;
|
|
15
|
+
static destroyContext(context: SDKContext): void;
|
|
16
|
+
static setClientConstructor(lceConstructor: ClientConstructor): void;
|
|
17
|
+
static getClientConstructor(): ClientConstructor | null;
|
|
15
18
|
static getClassInstance<T>(className: string, instanceCreator: () => T): T;
|
|
16
19
|
static getClient<T>(clientConfigs: IClientConfigs): Promise<T>;
|
|
17
20
|
}
|
|
21
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { ICartFulfillmentStore, ICartItemStore, ICartRetailerStore, ICartSt
|
|
|
3
3
|
import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutItemStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
4
|
import type { ICheckoutInjection, ICheckoutMetadata, IElementsMetadataStore } from '@/core/store/interfaces/metadata.interface';
|
|
5
5
|
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
6
|
-
import type { IProductListStore } from '@/core/store/interfaces/product-list.interface';
|
|
6
|
+
import type { IPLProductStore, IProductListStore } from '@/core/store/interfaces/product-list.interface';
|
|
7
7
|
import type { ComponentType } from '@/enums';
|
|
8
8
|
import type { ICartPromoCode } from '@/interfaces/api/cart.interface';
|
|
9
9
|
import type { ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer } from '@/interfaces/api/checkout.interface';
|
|
@@ -11,21 +11,14 @@ export interface IDrawerContentConfig {
|
|
|
11
11
|
type: ComponentType;
|
|
12
12
|
data?: Record<string, any>;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
type: ComponentType;
|
|
16
|
-
data?: Record<string, any>;
|
|
17
|
-
}
|
|
14
|
+
export type UIDrawerMode = 'drawer' | 'modal';
|
|
18
15
|
export interface IDrawerStore {
|
|
19
16
|
isOpen: boolean;
|
|
20
17
|
contentConfig: IDrawerContentConfig | null;
|
|
18
|
+
mode: UIDrawerMode;
|
|
21
19
|
}
|
|
22
20
|
export interface IUIStore {
|
|
23
21
|
drawer: IDrawerStore;
|
|
24
|
-
modal: IModalStore;
|
|
25
|
-
}
|
|
26
|
-
export interface IModalStore {
|
|
27
|
-
isOpen: boolean;
|
|
28
|
-
contentConfig: IModalContentConfig | null;
|
|
29
22
|
}
|
|
30
23
|
export interface IGlobalStore {
|
|
31
24
|
address: IAddressStore;
|
|
@@ -40,7 +33,10 @@ export interface IPersistedStore {
|
|
|
40
33
|
p?: string;
|
|
41
34
|
c?: string;
|
|
42
35
|
}
|
|
43
|
-
export
|
|
36
|
+
export interface IPersistedStoreAction {
|
|
37
|
+
success: boolean;
|
|
38
|
+
}
|
|
39
|
+
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof ICartRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof ICartFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCode}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresale}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferences}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipient}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCode}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.retailers.${string}` | `checkout.retailers.${string}.${keyof ICheckoutRetailer}` | `checkout.fulfillments.${string}` | `productsList.${keyof IProductListStore}` | `productsList.products.${string}` | `productsList.products.${string}.${keyof IPLProductStore}` | `metadata.${keyof IElementsMetadataStore}` | `metadata.checkout.${keyof ICheckoutMetadata}` | `metadata.checkout.injection.${keyof ICheckoutInjection}`;
|
|
44
40
|
interface MiddlewareContext {
|
|
45
41
|
action: string;
|
|
46
42
|
payload: any;
|