@storepecker/storefront-core 2.10.0 → 2.10.1
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/dist/api/index.cjs +20 -20
- package/dist/api/index.d.cts +8 -15
- package/dist/api/index.d.ts +8 -15
- package/dist/api/index.js +2 -2
- package/dist/{buy-now-kII0KrhP.d.ts → buy-now-CDug6LJ_.d.ts} +1 -1
- package/dist/{buy-now-B_15RUVT.d.cts → buy-now-DrKY5_9R.d.cts} +1 -1
- package/dist/checkout/index.cjs +92 -98
- package/dist/checkout/index.d.cts +17 -30
- package/dist/checkout/index.d.ts +17 -30
- package/dist/checkout/index.js +48 -63
- package/dist/{pincode-Ch3bZSJz.d.cts → checkout-totals-CbmXM9L7.d.cts} +42 -1
- package/dist/{pincode-CHM-ZD3H.d.ts → checkout-totals-DU8l-Wyb.d.ts} +42 -1
- package/dist/{chunk-NQZ5GUOG.cjs → chunk-3YPE6UPC.cjs} +24 -16
- package/dist/{chunk-Y4RNRPBC.js → chunk-DZPK7GPG.js} +58 -2
- package/dist/{chunk-TH7OAMGC.js → chunk-E4D4XOAE.js} +24 -16
- package/dist/{chunk-NRPK5GCJ.cjs → chunk-EFYAFXIS.cjs} +3 -3
- package/dist/{chunk-NOT6VKXA.cjs → chunk-H6UZTS5O.cjs} +67 -23
- package/dist/{chunk-ZAWZ3RB6.js → chunk-NNE42NMP.js} +1 -1
- package/dist/{chunk-QED6QJZC.cjs → chunk-PN6KH5PX.cjs} +59 -1
- package/dist/{chunk-QQHQTBAM.js → chunk-QSRVMOXT.js} +48 -6
- package/dist/{collections-CXgOv5_G.d.cts → collections-CKNFcE2d.d.cts} +1 -1
- package/dist/{collections-CNh2OGbl.d.ts → collections-CtRKsWVx.d.ts} +1 -1
- package/dist/components/digital-product-download-modal.d.cts +2 -2
- package/dist/components/digital-product-download-modal.d.ts +2 -2
- package/dist/components/index.d.cts +4 -5
- package/dist/components/index.d.ts +4 -5
- package/dist/components/share-button.d.cts +1 -1
- package/dist/components/share-button.d.ts +1 -1
- package/dist/components/theme-data-initializer.d.cts +4 -5
- package/dist/components/theme-data-initializer.d.ts +4 -5
- package/dist/hooks/index.cjs +62 -58
- package/dist/hooks/index.d.cts +9 -7
- package/dist/hooks/index.d.ts +9 -7
- package/dist/hooks/index.js +8 -5
- package/dist/{instagram-DalreBu6.d.cts → instagram-CSzrxk10.d.cts} +8 -2
- package/dist/{instagram-BADLnNQ3.d.ts → instagram-CagTLmyq.d.ts} +8 -2
- package/dist/models/index.d.cts +6 -7
- package/dist/models/index.d.ts +6 -7
- package/dist/orders-B6BmHCJN.d.ts +337 -0
- package/dist/orders-ZKP0lqRN.d.cts +337 -0
- package/dist/{pixelEvents-Ds6fwS9t.d.ts → pixelEvents-DqJ_CEEr.d.ts} +3 -4
- package/dist/{pixelEvents-COqZIgTu.d.cts → pixelEvents-bahgVW4_.d.cts} +3 -4
- package/dist/{product-D9liEtl4.d.cts → product-D4kol-Z-.d.cts} +26 -2
- package/dist/{product-D9liEtl4.d.ts → product-D4kol-Z-.d.ts} +26 -2
- package/dist/store/index.cjs +20 -30
- package/dist/store/index.d.cts +21 -7
- package/dist/store/index.d.ts +21 -7
- package/dist/store/index.js +9 -26
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.d.cts +14 -8
- package/dist/utils/index.d.ts +14 -8
- package/dist/utils/index.js +1 -1
- package/dist/{wishlist-Cj0sQxiY.d.ts → wishlist-L3fM5-ie.d.ts} +1 -1
- package/dist/{wishlist-BakHvIFN.d.cts → wishlist-_0x0r1jt.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/cart-DZq1ZEnE.d.ts +0 -153
- package/dist/cart-DwMFBmpC.d.cts +0 -153
- package/dist/orders-B3G4CyhH.d.cts +0 -166
- package/dist/orders-Bl-Slh72.d.ts +0 -166
|
@@ -40,11 +40,18 @@ declare namespace Product {
|
|
|
40
40
|
customizations: Customization[];
|
|
41
41
|
}
|
|
42
42
|
interface Customization {
|
|
43
|
+
id: number;
|
|
43
44
|
name: string;
|
|
44
45
|
customization_type: string;
|
|
45
|
-
customization_options?:
|
|
46
|
+
customization_options?: {
|
|
47
|
+
options: string[];
|
|
48
|
+
};
|
|
46
49
|
is_mandatory?: boolean;
|
|
47
50
|
additional_price?: string;
|
|
51
|
+
product?: number;
|
|
52
|
+
photos?: unknown[];
|
|
53
|
+
input_limit?: number;
|
|
54
|
+
customization_order?: number;
|
|
48
55
|
}
|
|
49
56
|
interface ProductVariant {
|
|
50
57
|
id: number;
|
|
@@ -150,6 +157,7 @@ declare namespace Product {
|
|
|
150
157
|
page: number;
|
|
151
158
|
page_size?: number;
|
|
152
159
|
is_service?: boolean;
|
|
160
|
+
stock_status?: string;
|
|
153
161
|
[key: string]: any;
|
|
154
162
|
};
|
|
155
163
|
interface Meta {
|
|
@@ -165,6 +173,14 @@ declare namespace Product {
|
|
|
165
173
|
name: string;
|
|
166
174
|
slug: string;
|
|
167
175
|
}
|
|
176
|
+
interface StockStatus {
|
|
177
|
+
value: string;
|
|
178
|
+
name: string;
|
|
179
|
+
}
|
|
180
|
+
type FilterResponse = {
|
|
181
|
+
[key: string]: FilterContent[] | StockStatus[] | undefined;
|
|
182
|
+
stock_statuses?: StockStatus[];
|
|
183
|
+
};
|
|
168
184
|
}
|
|
169
185
|
interface Photos {
|
|
170
186
|
image: string;
|
|
@@ -236,6 +252,7 @@ declare namespace ProductDetail {
|
|
|
236
252
|
currency_code: string;
|
|
237
253
|
total_price: string;
|
|
238
254
|
total_tax_price: number;
|
|
255
|
+
is_tax_inclusive_price?: boolean;
|
|
239
256
|
is_custom_product: boolean;
|
|
240
257
|
booking_service?: BookingService;
|
|
241
258
|
fulfillment_time: string;
|
|
@@ -261,11 +278,18 @@ declare namespace ProductDetail {
|
|
|
261
278
|
customizations: Customization[];
|
|
262
279
|
}
|
|
263
280
|
interface Customization {
|
|
281
|
+
id: number;
|
|
264
282
|
name: string;
|
|
265
283
|
customization_type: string;
|
|
266
|
-
customization_options?:
|
|
284
|
+
customization_options?: {
|
|
285
|
+
options: string[];
|
|
286
|
+
};
|
|
267
287
|
is_mandatory?: boolean;
|
|
268
288
|
additional_price?: string;
|
|
289
|
+
product?: number;
|
|
290
|
+
photos?: unknown[];
|
|
291
|
+
input_limit?: number;
|
|
292
|
+
customization_order?: number;
|
|
269
293
|
}
|
|
270
294
|
interface Customization {
|
|
271
295
|
name: string;
|
|
@@ -40,11 +40,18 @@ declare namespace Product {
|
|
|
40
40
|
customizations: Customization[];
|
|
41
41
|
}
|
|
42
42
|
interface Customization {
|
|
43
|
+
id: number;
|
|
43
44
|
name: string;
|
|
44
45
|
customization_type: string;
|
|
45
|
-
customization_options?:
|
|
46
|
+
customization_options?: {
|
|
47
|
+
options: string[];
|
|
48
|
+
};
|
|
46
49
|
is_mandatory?: boolean;
|
|
47
50
|
additional_price?: string;
|
|
51
|
+
product?: number;
|
|
52
|
+
photos?: unknown[];
|
|
53
|
+
input_limit?: number;
|
|
54
|
+
customization_order?: number;
|
|
48
55
|
}
|
|
49
56
|
interface ProductVariant {
|
|
50
57
|
id: number;
|
|
@@ -150,6 +157,7 @@ declare namespace Product {
|
|
|
150
157
|
page: number;
|
|
151
158
|
page_size?: number;
|
|
152
159
|
is_service?: boolean;
|
|
160
|
+
stock_status?: string;
|
|
153
161
|
[key: string]: any;
|
|
154
162
|
};
|
|
155
163
|
interface Meta {
|
|
@@ -165,6 +173,14 @@ declare namespace Product {
|
|
|
165
173
|
name: string;
|
|
166
174
|
slug: string;
|
|
167
175
|
}
|
|
176
|
+
interface StockStatus {
|
|
177
|
+
value: string;
|
|
178
|
+
name: string;
|
|
179
|
+
}
|
|
180
|
+
type FilterResponse = {
|
|
181
|
+
[key: string]: FilterContent[] | StockStatus[] | undefined;
|
|
182
|
+
stock_statuses?: StockStatus[];
|
|
183
|
+
};
|
|
168
184
|
}
|
|
169
185
|
interface Photos {
|
|
170
186
|
image: string;
|
|
@@ -236,6 +252,7 @@ declare namespace ProductDetail {
|
|
|
236
252
|
currency_code: string;
|
|
237
253
|
total_price: string;
|
|
238
254
|
total_tax_price: number;
|
|
255
|
+
is_tax_inclusive_price?: boolean;
|
|
239
256
|
is_custom_product: boolean;
|
|
240
257
|
booking_service?: BookingService;
|
|
241
258
|
fulfillment_time: string;
|
|
@@ -261,11 +278,18 @@ declare namespace ProductDetail {
|
|
|
261
278
|
customizations: Customization[];
|
|
262
279
|
}
|
|
263
280
|
interface Customization {
|
|
281
|
+
id: number;
|
|
264
282
|
name: string;
|
|
265
283
|
customization_type: string;
|
|
266
|
-
customization_options?:
|
|
284
|
+
customization_options?: {
|
|
285
|
+
options: string[];
|
|
286
|
+
};
|
|
267
287
|
is_mandatory?: boolean;
|
|
268
288
|
additional_price?: string;
|
|
289
|
+
product?: number;
|
|
290
|
+
photos?: unknown[];
|
|
291
|
+
input_limit?: number;
|
|
292
|
+
customization_order?: number;
|
|
269
293
|
}
|
|
270
294
|
interface Customization {
|
|
271
295
|
name: string;
|
package/dist/store/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkH6UZTS5O_cjs = require('../chunk-H6UZTS5O.cjs');
|
|
4
|
+
var chunkEFYAFXIS_cjs = require('../chunk-EFYAFXIS.cjs');
|
|
5
|
+
require('../chunk-3YPE6UPC.cjs');
|
|
6
6
|
require('../chunk-H6FJYRO3.cjs');
|
|
7
7
|
var chunkDODFO744_cjs = require('../chunk-DODFO744.cjs');
|
|
8
8
|
require('../chunk-ECHV2JSY.cjs');
|
|
@@ -12,27 +12,6 @@ require('../chunk-N3CTXRFT.cjs');
|
|
|
12
12
|
var zustand = require('zustand');
|
|
13
13
|
|
|
14
14
|
var initialState = {
|
|
15
|
-
wishlist_count: 0,
|
|
16
|
-
product_variants: []
|
|
17
|
-
};
|
|
18
|
-
var useWishlistStore = zustand.create((set) => ({
|
|
19
|
-
...initialState,
|
|
20
|
-
setWishlist: (wishlist) => set(wishlist),
|
|
21
|
-
resetWishlist: () => set(initialState),
|
|
22
|
-
syncWishlist: async () => {
|
|
23
|
-
try {
|
|
24
|
-
const response = await chunkNRPK5GCJ_cjs.getWishlist("/customer/wishlist/");
|
|
25
|
-
if (response.data) {
|
|
26
|
-
set({
|
|
27
|
-
wishlist_count: response.data.wishlist_count,
|
|
28
|
-
product_variants: response.data.product_variants
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
} catch {
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
var initialState2 = {
|
|
36
15
|
data: [],
|
|
37
16
|
status: "loading" /* LOADING */,
|
|
38
17
|
hasMore: false,
|
|
@@ -41,15 +20,18 @@ var initialState2 = {
|
|
|
41
20
|
page_size: 10
|
|
42
21
|
}
|
|
43
22
|
};
|
|
23
|
+
var latestProductRequest = 0;
|
|
44
24
|
var useProductStore = zustand.create((set, get) => ({
|
|
45
|
-
...
|
|
25
|
+
...initialState,
|
|
46
26
|
fetchProducts: async (filter) => {
|
|
27
|
+
const requestId = ++latestProductRequest;
|
|
47
28
|
set((state) => ({
|
|
48
29
|
status: "loading" /* LOADING */,
|
|
49
30
|
data: filter.page === 1 ? [] : state.data
|
|
50
31
|
}));
|
|
51
32
|
try {
|
|
52
|
-
const response = await
|
|
33
|
+
const response = await chunkEFYAFXIS_cjs.getProducts({ ...filter });
|
|
34
|
+
if (requestId !== latestProductRequest) return;
|
|
53
35
|
if (response.data) {
|
|
54
36
|
const { results, ...meta } = response.data;
|
|
55
37
|
set((state) => ({
|
|
@@ -61,6 +43,7 @@ var useProductStore = zustand.create((set, get) => ({
|
|
|
61
43
|
}));
|
|
62
44
|
}
|
|
63
45
|
} catch {
|
|
46
|
+
if (requestId !== latestProductRequest) return;
|
|
64
47
|
set({ status: "idle" /* IDLE */ });
|
|
65
48
|
}
|
|
66
49
|
},
|
|
@@ -69,19 +52,26 @@ var useProductStore = zustand.create((set, get) => ({
|
|
|
69
52
|
|
|
70
53
|
Object.defineProperty(exports, "loginUser", {
|
|
71
54
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkH6UZTS5O_cjs.loginUser; }
|
|
73
56
|
});
|
|
74
57
|
Object.defineProperty(exports, "useAuthStore", {
|
|
75
58
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkH6UZTS5O_cjs.useAuthStore; }
|
|
77
60
|
});
|
|
78
61
|
Object.defineProperty(exports, "useCartStore", {
|
|
79
62
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkH6UZTS5O_cjs.useCartStore; }
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "useIsWishlisted", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () { return chunkH6UZTS5O_cjs.useIsWishlisted; }
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "useWishlistStore", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () { return chunkH6UZTS5O_cjs.useWishlistStore; }
|
|
81
72
|
});
|
|
82
73
|
Object.defineProperty(exports, "useThemeData", {
|
|
83
74
|
enumerable: true,
|
|
84
75
|
get: function () { return chunkDODFO744_cjs.useThemeData; }
|
|
85
76
|
});
|
|
86
77
|
exports.useProductStore = useProductStore;
|
|
87
|
-
exports.useWishlistStore = useWishlistStore;
|
package/dist/store/index.d.cts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
|
-
import { a as CartState, C as Cart, U as User } from '../
|
|
3
|
-
import { f as ProductDetail, d as Product } from '../product-
|
|
4
|
-
import { W as Wishlist } from '../wishlist-
|
|
5
|
-
import { P as PageHeaderProps } from '../pixelEvents-
|
|
2
|
+
import { a as CartState, C as Cart, U as User } from '../orders-ZKP0lqRN.cjs';
|
|
3
|
+
import { f as ProductDetail, d as Product } from '../product-D4kol-Z-.cjs';
|
|
4
|
+
import { W as Wishlist } from '../wishlist-_0x0r1jt.cjs';
|
|
5
|
+
import { P as PageHeaderProps } from '../pixelEvents-bahgVW4_.cjs';
|
|
6
6
|
import 'react-toastify';
|
|
7
|
-
import '../collections-
|
|
8
|
-
import '../orders-B3G4CyhH.cjs';
|
|
7
|
+
import '../collections-CKNFcE2d.cjs';
|
|
9
8
|
|
|
10
9
|
interface CartStore extends CartState {
|
|
11
10
|
setCart: (cart: Cart.Root) => void;
|
|
@@ -68,11 +67,26 @@ declare const useAuthStore: zustand.UseBoundStore<zustand.StoreApi<AuthStore>>;
|
|
|
68
67
|
declare const loginUser: (user: User.LoginUserData) => Promise<void>;
|
|
69
68
|
|
|
70
69
|
interface WishlistStore extends Wishlist.Root {
|
|
70
|
+
/** Whether the server wishlist has been loaded into the store this session. */
|
|
71
|
+
loaded: boolean;
|
|
71
72
|
setWishlist: (wishlist: Wishlist.Root) => void;
|
|
72
73
|
resetWishlist: () => void;
|
|
73
74
|
syncWishlist: () => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Removes the given variants from the wishlist if they're on it — called
|
|
77
|
+
* after they're added to the cart, so a carted item doesn't stay wishlisted.
|
|
78
|
+
* Logged-in only (guests have no server wishlist). Resolves `false` when the
|
|
79
|
+
* wishlist couldn't be updated, so the theme can tell the shopper; never throws.
|
|
80
|
+
*/
|
|
81
|
+
removeAddedFromWishlist: (variantIds: number[]) => Promise<boolean>;
|
|
74
82
|
}
|
|
75
83
|
declare const useWishlistStore: zustand.UseBoundStore<zustand.StoreApi<WishlistStore>>;
|
|
84
|
+
/**
|
|
85
|
+
* Whether a variant is wishlisted. Reads the store once it's loaded, so every
|
|
86
|
+
* heart for the same product stays in sync (e.g. after add-to-cart removes it);
|
|
87
|
+
* until then falls back to the value the product payload came with.
|
|
88
|
+
*/
|
|
89
|
+
declare function useIsWishlisted(variantId: number | undefined, initial?: boolean): boolean;
|
|
76
90
|
|
|
77
91
|
interface ProductStore extends Product.ProductState {
|
|
78
92
|
fetchProducts: (filter: Product.ProductFilter) => Promise<void>;
|
|
@@ -86,4 +100,4 @@ interface ThemeStore {
|
|
|
86
100
|
}
|
|
87
101
|
declare const useThemeData: zustand.UseBoundStore<zustand.StoreApi<ThemeStore>>;
|
|
88
102
|
|
|
89
|
-
export { loginUser, useAuthStore, useCartStore, useProductStore, useThemeData, useWishlistStore };
|
|
103
|
+
export { loginUser, useAuthStore, useCartStore, useIsWishlisted, useProductStore, useThemeData, useWishlistStore };
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
|
-
import { a as CartState, C as Cart, U as User } from '../
|
|
3
|
-
import { f as ProductDetail, d as Product } from '../product-
|
|
4
|
-
import { W as Wishlist } from '../wishlist-
|
|
5
|
-
import { P as PageHeaderProps } from '../pixelEvents-
|
|
2
|
+
import { a as CartState, C as Cart, U as User } from '../orders-B6BmHCJN.js';
|
|
3
|
+
import { f as ProductDetail, d as Product } from '../product-D4kol-Z-.js';
|
|
4
|
+
import { W as Wishlist } from '../wishlist-L3fM5-ie.js';
|
|
5
|
+
import { P as PageHeaderProps } from '../pixelEvents-DqJ_CEEr.js';
|
|
6
6
|
import 'react-toastify';
|
|
7
|
-
import '../collections-
|
|
8
|
-
import '../orders-Bl-Slh72.js';
|
|
7
|
+
import '../collections-CtRKsWVx.js';
|
|
9
8
|
|
|
10
9
|
interface CartStore extends CartState {
|
|
11
10
|
setCart: (cart: Cart.Root) => void;
|
|
@@ -68,11 +67,26 @@ declare const useAuthStore: zustand.UseBoundStore<zustand.StoreApi<AuthStore>>;
|
|
|
68
67
|
declare const loginUser: (user: User.LoginUserData) => Promise<void>;
|
|
69
68
|
|
|
70
69
|
interface WishlistStore extends Wishlist.Root {
|
|
70
|
+
/** Whether the server wishlist has been loaded into the store this session. */
|
|
71
|
+
loaded: boolean;
|
|
71
72
|
setWishlist: (wishlist: Wishlist.Root) => void;
|
|
72
73
|
resetWishlist: () => void;
|
|
73
74
|
syncWishlist: () => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Removes the given variants from the wishlist if they're on it — called
|
|
77
|
+
* after they're added to the cart, so a carted item doesn't stay wishlisted.
|
|
78
|
+
* Logged-in only (guests have no server wishlist). Resolves `false` when the
|
|
79
|
+
* wishlist couldn't be updated, so the theme can tell the shopper; never throws.
|
|
80
|
+
*/
|
|
81
|
+
removeAddedFromWishlist: (variantIds: number[]) => Promise<boolean>;
|
|
74
82
|
}
|
|
75
83
|
declare const useWishlistStore: zustand.UseBoundStore<zustand.StoreApi<WishlistStore>>;
|
|
84
|
+
/**
|
|
85
|
+
* Whether a variant is wishlisted. Reads the store once it's loaded, so every
|
|
86
|
+
* heart for the same product stays in sync (e.g. after add-to-cart removes it);
|
|
87
|
+
* until then falls back to the value the product payload came with.
|
|
88
|
+
*/
|
|
89
|
+
declare function useIsWishlisted(variantId: number | undefined, initial?: boolean): boolean;
|
|
76
90
|
|
|
77
91
|
interface ProductStore extends Product.ProductState {
|
|
78
92
|
fetchProducts: (filter: Product.ProductFilter) => Promise<void>;
|
|
@@ -86,4 +100,4 @@ interface ThemeStore {
|
|
|
86
100
|
}
|
|
87
101
|
declare const useThemeData: zustand.UseBoundStore<zustand.StoreApi<ThemeStore>>;
|
|
88
102
|
|
|
89
|
-
export { loginUser, useAuthStore, useCartStore, useProductStore, useThemeData, useWishlistStore };
|
|
103
|
+
export { loginUser, useAuthStore, useCartStore, useIsWishlisted, useProductStore, useThemeData, useWishlistStore };
|
package/dist/store/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { loginUser, useAuthStore, useCartStore } from '../chunk-
|
|
2
|
-
import {
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { loginUser, useAuthStore, useCartStore, useIsWishlisted, useWishlistStore } from '../chunk-QSRVMOXT.js';
|
|
2
|
+
import { getProducts } from '../chunk-NNE42NMP.js';
|
|
3
|
+
import '../chunk-E4D4XOAE.js';
|
|
4
4
|
import '../chunk-KCLVR6G5.js';
|
|
5
5
|
export { useThemeData } from '../chunk-5NUDTIQ2.js';
|
|
6
6
|
import '../chunk-3SYYP3XV.js';
|
|
@@ -10,27 +10,6 @@ import '../chunk-JQMLHRWL.js';
|
|
|
10
10
|
import { create } from 'zustand';
|
|
11
11
|
|
|
12
12
|
var initialState = {
|
|
13
|
-
wishlist_count: 0,
|
|
14
|
-
product_variants: []
|
|
15
|
-
};
|
|
16
|
-
var useWishlistStore = create((set) => ({
|
|
17
|
-
...initialState,
|
|
18
|
-
setWishlist: (wishlist) => set(wishlist),
|
|
19
|
-
resetWishlist: () => set(initialState),
|
|
20
|
-
syncWishlist: async () => {
|
|
21
|
-
try {
|
|
22
|
-
const response = await getWishlist("/customer/wishlist/");
|
|
23
|
-
if (response.data) {
|
|
24
|
-
set({
|
|
25
|
-
wishlist_count: response.data.wishlist_count,
|
|
26
|
-
product_variants: response.data.product_variants
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}));
|
|
33
|
-
var initialState2 = {
|
|
34
13
|
data: [],
|
|
35
14
|
status: "loading" /* LOADING */,
|
|
36
15
|
hasMore: false,
|
|
@@ -39,15 +18,18 @@ var initialState2 = {
|
|
|
39
18
|
page_size: 10
|
|
40
19
|
}
|
|
41
20
|
};
|
|
21
|
+
var latestProductRequest = 0;
|
|
42
22
|
var useProductStore = create((set, get) => ({
|
|
43
|
-
...
|
|
23
|
+
...initialState,
|
|
44
24
|
fetchProducts: async (filter) => {
|
|
25
|
+
const requestId = ++latestProductRequest;
|
|
45
26
|
set((state) => ({
|
|
46
27
|
status: "loading" /* LOADING */,
|
|
47
28
|
data: filter.page === 1 ? [] : state.data
|
|
48
29
|
}));
|
|
49
30
|
try {
|
|
50
31
|
const response = await getProducts({ ...filter });
|
|
32
|
+
if (requestId !== latestProductRequest) return;
|
|
51
33
|
if (response.data) {
|
|
52
34
|
const { results, ...meta } = response.data;
|
|
53
35
|
set((state) => ({
|
|
@@ -59,10 +41,11 @@ var useProductStore = create((set, get) => ({
|
|
|
59
41
|
}));
|
|
60
42
|
}
|
|
61
43
|
} catch {
|
|
44
|
+
if (requestId !== latestProductRequest) return;
|
|
62
45
|
set({ status: "idle" /* IDLE */ });
|
|
63
46
|
}
|
|
64
47
|
},
|
|
65
48
|
setGatePasses: (products) => set({ data: products })
|
|
66
49
|
}));
|
|
67
50
|
|
|
68
|
-
export { useProductStore
|
|
51
|
+
export { useProductStore };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk57UU7IJ2_cjs = require('../chunk-57UU7IJ2.cjs');
|
|
4
4
|
var chunk2AHH3XBW_cjs = require('../chunk-2AHH3XBW.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk3YPE6UPC_cjs = require('../chunk-3YPE6UPC.cjs');
|
|
6
6
|
var chunkNSAHGMS7_cjs = require('../chunk-NSAHGMS7.cjs');
|
|
7
7
|
var chunkSGJUMI3M_cjs = require('../chunk-SGJUMI3M.cjs');
|
|
8
8
|
var chunkBBRB475I_cjs = require('../chunk-BBRB475I.cjs');
|
|
@@ -355,7 +355,7 @@ Object.defineProperty(exports, "isVariantCombinationAvailable", {
|
|
|
355
355
|
});
|
|
356
356
|
Object.defineProperty(exports, "LocalCart", {
|
|
357
357
|
enumerable: true,
|
|
358
|
-
get: function () { return
|
|
358
|
+
get: function () { return chunk3YPE6UPC_cjs.cart_default; }
|
|
359
359
|
});
|
|
360
360
|
Object.defineProperty(exports, "pixelEvents", {
|
|
361
361
|
enumerable: true,
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { f as ProductDetail, O as OperatingHours, T as TimeSlot, A as Attributes } from '../product-
|
|
2
|
-
export { h as ADDRESS_FORM_SESSION_KEY, i as ALLOWED_COUNTRIES, D as DEFAULT_TOAST_CONFIG, j as PRODUCT_STATUSES, g as SLICE_STATUS, U as USER_CART, k as USER_CREDENTIALS, l as USER_CRED_REFRESH_TOKEN, m as USER_CRED_TOKEN, p as pathNameMap } from '../product-
|
|
3
|
-
import { C as Cart } from '../
|
|
1
|
+
import { f as ProductDetail, O as OperatingHours, T as TimeSlot, A as Attributes } from '../product-D4kol-Z-.cjs';
|
|
2
|
+
export { h as ADDRESS_FORM_SESSION_KEY, i as ALLOWED_COUNTRIES, D as DEFAULT_TOAST_CONFIG, j as PRODUCT_STATUSES, g as SLICE_STATUS, U as USER_CART, k as USER_CREDENTIALS, l as USER_CRED_REFRESH_TOKEN, m as USER_CRED_TOKEN, p as pathNameMap } from '../product-D4kol-Z-.cjs';
|
|
3
|
+
import { C as Cart, O as Order } from '../orders-ZKP0lqRN.cjs';
|
|
4
4
|
export { S as SnapstoreConfig, g as getApiEndpoint, a as getCloudFront, b as getConfig, c as getPhonePeApiEndpoint, d as getPublicApiEndpoint, e as getSecretKey, f as getStoreId, i as initConfig } from '../index-DTyIuLuI.cjs';
|
|
5
|
-
import { S as SectionFilters } from '../pixelEvents-
|
|
6
|
-
export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-
|
|
7
|
-
import { O as Order } from '../orders-B3G4CyhH.cjs';
|
|
5
|
+
import { S as SectionFilters } from '../pixelEvents-bahgVW4_.cjs';
|
|
6
|
+
export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-bahgVW4_.cjs';
|
|
8
7
|
import { AxiosResponse } from 'axios';
|
|
9
8
|
import { a as PhonePe } from '../phonepe-dWMLZel6.cjs';
|
|
10
9
|
import 'react-toastify';
|
|
11
|
-
import '../collections-
|
|
10
|
+
import '../collections-CKNFcE2d.cjs';
|
|
12
11
|
|
|
13
12
|
declare function setAuthTokenChangeCallback(callback: (token: string | undefined) => void): void;
|
|
14
13
|
declare const Auth: {
|
|
@@ -57,7 +56,14 @@ declare function generateCacheKey(endpoint: string, params?: Record<string, any>
|
|
|
57
56
|
declare const LocalCart: {
|
|
58
57
|
get(): Cart.Root | null;
|
|
59
58
|
set(cart: any): void;
|
|
60
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Adds `quantity` of `product`, capped so the line never goes past the
|
|
61
|
+
* product's stock: the guest cart isn't checked against the server until
|
|
62
|
+
* checkout, so repeated adds would otherwise pile up past what's available.
|
|
63
|
+
* Returns how many units were actually added (0 when at the limit or for a
|
|
64
|
+
* pre-order); compare it with the requested quantity to tell the shopper.
|
|
65
|
+
*/
|
|
66
|
+
add(product: ProductDetail.Root, quantity?: number): number;
|
|
61
67
|
remove(product: ProductDetail.Root): void;
|
|
62
68
|
updateQuantity(product: ProductDetail.Root, quantity: number): void;
|
|
63
69
|
clear(): void;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { f as ProductDetail, O as OperatingHours, T as TimeSlot, A as Attributes } from '../product-
|
|
2
|
-
export { h as ADDRESS_FORM_SESSION_KEY, i as ALLOWED_COUNTRIES, D as DEFAULT_TOAST_CONFIG, j as PRODUCT_STATUSES, g as SLICE_STATUS, U as USER_CART, k as USER_CREDENTIALS, l as USER_CRED_REFRESH_TOKEN, m as USER_CRED_TOKEN, p as pathNameMap } from '../product-
|
|
3
|
-
import { C as Cart } from '../
|
|
1
|
+
import { f as ProductDetail, O as OperatingHours, T as TimeSlot, A as Attributes } from '../product-D4kol-Z-.js';
|
|
2
|
+
export { h as ADDRESS_FORM_SESSION_KEY, i as ALLOWED_COUNTRIES, D as DEFAULT_TOAST_CONFIG, j as PRODUCT_STATUSES, g as SLICE_STATUS, U as USER_CART, k as USER_CREDENTIALS, l as USER_CRED_REFRESH_TOKEN, m as USER_CRED_TOKEN, p as pathNameMap } from '../product-D4kol-Z-.js';
|
|
3
|
+
import { C as Cart, O as Order } from '../orders-B6BmHCJN.js';
|
|
4
4
|
export { S as SnapstoreConfig, g as getApiEndpoint, a as getCloudFront, b as getConfig, c as getPhonePeApiEndpoint, d as getPublicApiEndpoint, e as getSecretKey, f as getStoreId, i as initConfig } from '../index-DTyIuLuI.js';
|
|
5
|
-
import { S as SectionFilters } from '../pixelEvents-
|
|
6
|
-
export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-
|
|
7
|
-
import { O as Order } from '../orders-Bl-Slh72.js';
|
|
5
|
+
import { S as SectionFilters } from '../pixelEvents-DqJ_CEEr.js';
|
|
6
|
+
export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-DqJ_CEEr.js';
|
|
8
7
|
import { AxiosResponse } from 'axios';
|
|
9
8
|
import { a as PhonePe } from '../phonepe-dWMLZel6.js';
|
|
10
9
|
import 'react-toastify';
|
|
11
|
-
import '../collections-
|
|
10
|
+
import '../collections-CtRKsWVx.js';
|
|
12
11
|
|
|
13
12
|
declare function setAuthTokenChangeCallback(callback: (token: string | undefined) => void): void;
|
|
14
13
|
declare const Auth: {
|
|
@@ -57,7 +56,14 @@ declare function generateCacheKey(endpoint: string, params?: Record<string, any>
|
|
|
57
56
|
declare const LocalCart: {
|
|
58
57
|
get(): Cart.Root | null;
|
|
59
58
|
set(cart: any): void;
|
|
60
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Adds `quantity` of `product`, capped so the line never goes past the
|
|
61
|
+
* product's stock: the guest cart isn't checked against the server until
|
|
62
|
+
* checkout, so repeated adds would otherwise pile up past what's available.
|
|
63
|
+
* Returns how many units were actually added (0 when at the limit or for a
|
|
64
|
+
* pre-order); compare it with the requested quantity to tell the shopper.
|
|
65
|
+
*/
|
|
66
|
+
add(product: ProductDetail.Root, quantity?: number): number;
|
|
61
67
|
remove(product: ProductDetail.Root): void;
|
|
62
68
|
updateQuantity(product: ProductDetail.Root, quantity: number): void;
|
|
63
69
|
clear(): void;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { authRoutes, protectedRoutes, publicRoutes, routes_default as urls } from '../chunk-OOFYY6GR.js';
|
|
2
2
|
export { findMatchingVariant, findSimilarVariant, isColorVariantType, isVariantCombinationAvailable } from '../chunk-HEFA67WK.js';
|
|
3
|
-
export { cart_default as LocalCart } from '../chunk-
|
|
3
|
+
export { cart_default as LocalCart } from '../chunk-E4D4XOAE.js';
|
|
4
4
|
export { pixelEvents } from '../chunk-VAU5OL72.js';
|
|
5
5
|
import { digestMessage } from '../chunk-EWZ7TGI7.js';
|
|
6
6
|
export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, focusFirstInvalidField, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getOrderStatus, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink } from '../chunk-EWZ7TGI7.js';
|