@storepecker/storefront-core 2.2.0 → 2.2.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 +17 -17
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/{chunk-26A3EBZI.cjs → chunk-A67PCF55.cjs} +1 -2
- package/dist/{chunk-Y6NFUWTH.js → chunk-ERLBPVFK.js} +1 -2
- package/dist/{chunk-PWYWNRVO.cjs → chunk-JVSR6THX.cjs} +6 -6
- package/dist/{chunk-UOFTDL4D.js → chunk-ZKHQPHT5.js} +1 -1
- package/dist/components/index.d.cts +7 -7
- package/dist/components/index.d.ts +7 -7
- package/dist/hooks/index.cjs +16 -16
- package/dist/hooks/index.d.cts +4 -1
- package/dist/hooks/index.d.ts +4 -1
- package/dist/hooks/index.js +7 -7
- package/dist/store/index.cjs +10 -10
- package/dist/store/index.js +5 -5
- package/package.json +1 -1
package/dist/api/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkKKQKHG26_cjs = require('../chunk-KKQKHG26.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkA67PCF55_cjs = require('../chunk-A67PCF55.cjs');
|
|
5
5
|
require('../chunk-SMHJRNCR.cjs');
|
|
6
6
|
var chunkFMHR5ABF_cjs = require('../chunk-FMHR5ABF.cjs');
|
|
7
7
|
var chunkG3R7ZVAG_cjs = require('../chunk-G3R7ZVAG.cjs');
|
|
@@ -151,67 +151,67 @@ Object.defineProperty(exports, "updateUserDetails", {
|
|
|
151
151
|
});
|
|
152
152
|
Object.defineProperty(exports, "addToCart", {
|
|
153
153
|
enumerable: true,
|
|
154
|
-
get: function () { return
|
|
154
|
+
get: function () { return chunkA67PCF55_cjs.addToCart; }
|
|
155
155
|
});
|
|
156
156
|
Object.defineProperty(exports, "addWishlist", {
|
|
157
157
|
enumerable: true,
|
|
158
|
-
get: function () { return
|
|
158
|
+
get: function () { return chunkA67PCF55_cjs.addWishlist; }
|
|
159
159
|
});
|
|
160
160
|
Object.defineProperty(exports, "getCart", {
|
|
161
161
|
enumerable: true,
|
|
162
|
-
get: function () { return
|
|
162
|
+
get: function () { return chunkA67PCF55_cjs.getCart; }
|
|
163
163
|
});
|
|
164
164
|
Object.defineProperty(exports, "getCategories", {
|
|
165
165
|
enumerable: true,
|
|
166
|
-
get: function () { return
|
|
166
|
+
get: function () { return chunkA67PCF55_cjs.getCategories; }
|
|
167
167
|
});
|
|
168
168
|
Object.defineProperty(exports, "getDigitalProductDownloadLink", {
|
|
169
169
|
enumerable: true,
|
|
170
|
-
get: function () { return
|
|
170
|
+
get: function () { return chunkA67PCF55_cjs.getDigitalProductDownloadLink; }
|
|
171
171
|
});
|
|
172
172
|
Object.defineProperty(exports, "getProductCategories", {
|
|
173
173
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
174
|
+
get: function () { return chunkA67PCF55_cjs.getProductCategories; }
|
|
175
175
|
});
|
|
176
176
|
Object.defineProperty(exports, "getProductDetail", {
|
|
177
177
|
enumerable: true,
|
|
178
|
-
get: function () { return
|
|
178
|
+
get: function () { return chunkA67PCF55_cjs.getProductDetail; }
|
|
179
179
|
});
|
|
180
180
|
Object.defineProperty(exports, "getProductDetailBySlug", {
|
|
181
181
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
182
|
+
get: function () { return chunkA67PCF55_cjs.getProductDetailBySlug; }
|
|
183
183
|
});
|
|
184
184
|
Object.defineProperty(exports, "getProductList", {
|
|
185
185
|
enumerable: true,
|
|
186
|
-
get: function () { return
|
|
186
|
+
get: function () { return chunkA67PCF55_cjs.getProductList; }
|
|
187
187
|
});
|
|
188
188
|
Object.defineProperty(exports, "getProducts", {
|
|
189
189
|
enumerable: true,
|
|
190
|
-
get: function () { return
|
|
190
|
+
get: function () { return chunkA67PCF55_cjs.getProducts; }
|
|
191
191
|
});
|
|
192
192
|
Object.defineProperty(exports, "getWishlist", {
|
|
193
193
|
enumerable: true,
|
|
194
|
-
get: function () { return
|
|
194
|
+
get: function () { return chunkA67PCF55_cjs.getWishlist; }
|
|
195
195
|
});
|
|
196
196
|
Object.defineProperty(exports, "notifyProductStock", {
|
|
197
197
|
enumerable: true,
|
|
198
|
-
get: function () { return
|
|
198
|
+
get: function () { return chunkA67PCF55_cjs.notifyProductStock; }
|
|
199
199
|
});
|
|
200
200
|
Object.defineProperty(exports, "removeFromCart", {
|
|
201
201
|
enumerable: true,
|
|
202
|
-
get: function () { return
|
|
202
|
+
get: function () { return chunkA67PCF55_cjs.removeFromCart; }
|
|
203
203
|
});
|
|
204
204
|
Object.defineProperty(exports, "removeFromWishlist", {
|
|
205
205
|
enumerable: true,
|
|
206
|
-
get: function () { return
|
|
206
|
+
get: function () { return chunkA67PCF55_cjs.removeFromWishlist; }
|
|
207
207
|
});
|
|
208
208
|
Object.defineProperty(exports, "updateCart", {
|
|
209
209
|
enumerable: true,
|
|
210
|
-
get: function () { return
|
|
210
|
+
get: function () { return chunkA67PCF55_cjs.updateCart; }
|
|
211
211
|
});
|
|
212
212
|
Object.defineProperty(exports, "updateDigitalProductDownloadLinkCount", {
|
|
213
213
|
enumerable: true,
|
|
214
|
-
get: function () { return
|
|
214
|
+
get: function () { return chunkA67PCF55_cjs.updateDigitalProductDownloadLinkCount; }
|
|
215
215
|
});
|
|
216
216
|
Object.defineProperty(exports, "applyCoupon", {
|
|
217
217
|
enumerable: true,
|
package/dist/api/index.d.cts
CHANGED
|
@@ -114,7 +114,7 @@ declare function getCategories(responseType?: "flat" | "nested"): Promise<AxiosR
|
|
|
114
114
|
declare function getProductDetailBySlug(url: string, slug: string): Promise<ProductDetail.Root | null>;
|
|
115
115
|
declare function notifyProductStock(userDetails: unknown): Promise<AxiosResponse<any, any, {}>>;
|
|
116
116
|
|
|
117
|
-
declare function getWishlist(url: string): Promise<Wishlist.Root
|
|
117
|
+
declare function getWishlist(url: string): Promise<AxiosResponse<Wishlist.Root>>;
|
|
118
118
|
declare function addWishlist(productDetails: {
|
|
119
119
|
action: "add" | "remove";
|
|
120
120
|
product_variants: number[];
|
package/dist/api/index.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ declare function getCategories(responseType?: "flat" | "nested"): Promise<AxiosR
|
|
|
114
114
|
declare function getProductDetailBySlug(url: string, slug: string): Promise<ProductDetail.Root | null>;
|
|
115
115
|
declare function notifyProductStock(userDetails: unknown): Promise<AxiosResponse<any, any, {}>>;
|
|
116
116
|
|
|
117
|
-
declare function getWishlist(url: string): Promise<Wishlist.Root
|
|
117
|
+
declare function getWishlist(url: string): Promise<AxiosResponse<Wishlist.Root>>;
|
|
118
118
|
declare function addWishlist(productDetails: {
|
|
119
119
|
action: "add" | "remove";
|
|
120
120
|
product_variants: number[];
|
package/dist/api/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getUserDetails, updateUserDetails } from '../chunk-C7ZJZEEN.js';
|
|
2
|
-
export { addToCart, addWishlist, getCart, getCategories, getDigitalProductDownloadLink, getProductCategories, getProductDetail, getProductDetailBySlug, getProductList, getProducts, getWishlist, notifyProductStock, removeFromCart, removeFromWishlist, updateCart, updateDigitalProductDownloadLinkCount } from '../chunk-
|
|
2
|
+
export { addToCart, addWishlist, getCart, getCategories, getDigitalProductDownloadLink, getProductCategories, getProductDetail, getProductDetailBySlug, getProductList, getProducts, getWishlist, notifyProductStock, removeFromCart, removeFromWishlist, updateCart, updateDigitalProductDownloadLinkCount } from '../chunk-ERLBPVFK.js';
|
|
3
3
|
import '../chunk-QAC72HKO.js';
|
|
4
4
|
export { applyCoupon, checkPhonepePaymentStatus, getAppliedCoupon, getCoupons, getOrderDetails, getOrderDetailsByNumber, getOrders, getPublicOrderDetailsByNumber, getStripePaymentStatus, getStripePaymentStatusPublic, makeCODOrder, phonepeOrderSuccess, phonepePublicOrderSuccess, placeOrder, publicMakeCODOrder, publicPlaceOrder, razorpayOrderFail, razorpayOrderSuccess, razorpayPublicOrderSuccess, removeCoupon, stripeOrderFail, stripeOrderSuccess, stripePublicOrderSuccess, updateOrder, updateOrderCustomization, uploadCustomizationImage, verifyTabbyPayment } from '../chunk-GHABOHLA.js';
|
|
5
5
|
export { addAddress, deleteAddress, getAddresses, getCountries, getSubdivisions, updateAddress } from '../chunk-YY77CUWX.js';
|
|
@@ -101,8 +101,7 @@ async function notifyProductStock(userDetails) {
|
|
|
101
101
|
|
|
102
102
|
// src/api/wishlist.ts
|
|
103
103
|
async function getWishlist(url) {
|
|
104
|
-
|
|
105
|
-
return response.data;
|
|
104
|
+
return await chunkZO2HREQL_cjs.http_service_default.get(url);
|
|
106
105
|
}
|
|
107
106
|
async function addWishlist(productDetails) {
|
|
108
107
|
return chunkZO2HREQL_cjs.http_service_default.post("/customer/wishlist/", productDetails);
|
|
@@ -99,8 +99,7 @@ async function notifyProductStock(userDetails) {
|
|
|
99
99
|
|
|
100
100
|
// src/api/wishlist.ts
|
|
101
101
|
async function getWishlist(url) {
|
|
102
|
-
|
|
103
|
-
return response.data;
|
|
102
|
+
return await http_service_default.get(url);
|
|
104
103
|
}
|
|
105
104
|
async function addWishlist(productDetails) {
|
|
106
105
|
return http_service_default.post("/customer/wishlist/", productDetails);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkA67PCF55_cjs = require('./chunk-A67PCF55.cjs');
|
|
4
4
|
var chunkSMHJRNCR_cjs = require('./chunk-SMHJRNCR.cjs');
|
|
5
5
|
var chunkBBRXE57K_cjs = require('./chunk-BBRXE57K.cjs');
|
|
6
6
|
var chunkNE3ZHELZ_cjs = require('./chunk-NE3ZHELZ.cjs');
|
|
@@ -22,7 +22,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
22
22
|
syncCart: async (addressId) => {
|
|
23
23
|
set({ status: "loading" /* LOADING */ });
|
|
24
24
|
try {
|
|
25
|
-
const response = await
|
|
25
|
+
const response = await chunkA67PCF55_cjs.getCart("/customer/cart/", addressId);
|
|
26
26
|
if (response) {
|
|
27
27
|
set({ cart: response, status: "idle" /* IDLE */ });
|
|
28
28
|
}
|
|
@@ -33,7 +33,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
33
33
|
fetchCart: async (addressId) => {
|
|
34
34
|
set({ status: "loading" /* LOADING */ });
|
|
35
35
|
try {
|
|
36
|
-
const response = await
|
|
36
|
+
const response = await chunkA67PCF55_cjs.getCart("/customer/cart/", addressId);
|
|
37
37
|
if (response) {
|
|
38
38
|
set({ cart: response, status: "idle" /* IDLE */ });
|
|
39
39
|
}
|
|
@@ -44,7 +44,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
44
44
|
addToCart: async (items, customizationInputs, addressId) => {
|
|
45
45
|
set({ status: "loading" /* LOADING */ });
|
|
46
46
|
try {
|
|
47
|
-
await
|
|
47
|
+
await chunkA67PCF55_cjs.addToCart(items, customizationInputs);
|
|
48
48
|
await useCartStore.getState().syncCart(addressId);
|
|
49
49
|
} catch {
|
|
50
50
|
} finally {
|
|
@@ -54,7 +54,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
54
54
|
removeFromCart: async (items, addressId) => {
|
|
55
55
|
set({ status: "loading" /* LOADING */ });
|
|
56
56
|
try {
|
|
57
|
-
await
|
|
57
|
+
await chunkA67PCF55_cjs.removeFromCart(items);
|
|
58
58
|
await useCartStore.getState().syncCart(addressId);
|
|
59
59
|
} catch {
|
|
60
60
|
} finally {
|
|
@@ -64,7 +64,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
64
64
|
updateCart: async (items, addressId) => {
|
|
65
65
|
set({ status: "loading" /* LOADING */ });
|
|
66
66
|
try {
|
|
67
|
-
await
|
|
67
|
+
await chunkA67PCF55_cjs.updateCart(items);
|
|
68
68
|
await useCartStore.getState().syncCart(addressId);
|
|
69
69
|
} catch {
|
|
70
70
|
} finally {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { updateCart, removeFromCart, addToCart, getCart } from './chunk-
|
|
1
|
+
import { updateCart, removeFromCart, addToCart, getCart } from './chunk-ERLBPVFK.js';
|
|
2
2
|
import { cart_default } from './chunk-QAC72HKO.js';
|
|
3
3
|
import { auth_default } from './chunk-WEMNXIRS.js';
|
|
4
4
|
import { USER_CRED_TOKEN, USER_CREDENTIALS } from './chunk-BQ256JKN.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { U as UseAddressFormOptions, u as useAddressForm } from '../useAddressForm-DGbEn91-.cjs';
|
|
3
3
|
import { f as ProductDetail } from '../product-Daxj09p9.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -24,13 +24,13 @@ interface SearchDropdownProps {
|
|
|
24
24
|
error?: string;
|
|
25
25
|
label?: string;
|
|
26
26
|
name?: string;
|
|
27
|
-
renderOption?: (option: SearchDropdownOption) =>
|
|
28
|
-
renderSelected?: (option: SearchDropdownOption | null) =>
|
|
27
|
+
renderOption?: (option: SearchDropdownOption) => React__default.ReactNode;
|
|
28
|
+
renderSelected?: (option: SearchDropdownOption | null) => React__default.ReactNode;
|
|
29
29
|
filterFunction?: (option: SearchDropdownOption, searchTerm: string) => boolean;
|
|
30
30
|
emptyMessage?: string;
|
|
31
31
|
maxHeight?: string;
|
|
32
32
|
}
|
|
33
|
-
declare const SearchDropdown:
|
|
33
|
+
declare const SearchDropdown: React__default.FC<SearchDropdownProps>;
|
|
34
34
|
|
|
35
35
|
interface AddressFormRef {
|
|
36
36
|
formik: ReturnType<typeof useAddressForm>["formik"];
|
|
@@ -42,8 +42,8 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
42
42
|
type: "submit";
|
|
43
43
|
disabled: boolean;
|
|
44
44
|
loading: boolean;
|
|
45
|
-
children:
|
|
46
|
-
}) =>
|
|
45
|
+
children: React__default.ReactNode;
|
|
46
|
+
}) => React__default.ReactNode;
|
|
47
47
|
/** Called when formik instance is ready (alternative to ref) */
|
|
48
48
|
onFormikReady?: (formik: ReturnType<typeof useAddressForm>["formik"]) => void;
|
|
49
49
|
/** Called when cancel is clicked */
|
|
@@ -57,7 +57,7 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
57
57
|
/** Submit button text. Default: "Save" */
|
|
58
58
|
submitLabel?: string;
|
|
59
59
|
}
|
|
60
|
-
declare const AddressForm:
|
|
60
|
+
declare const AddressForm: React__default.ForwardRefExoticComponent<AddressFormProps & React__default.RefAttributes<AddressFormRef>>;
|
|
61
61
|
|
|
62
62
|
interface ShareButtonProps {
|
|
63
63
|
product: ProductDetail.Root;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { U as UseAddressFormOptions, u as useAddressForm } from '../useAddressForm-cO3Au33k.js';
|
|
3
3
|
import { f as ProductDetail } from '../product-Daxj09p9.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -24,13 +24,13 @@ interface SearchDropdownProps {
|
|
|
24
24
|
error?: string;
|
|
25
25
|
label?: string;
|
|
26
26
|
name?: string;
|
|
27
|
-
renderOption?: (option: SearchDropdownOption) =>
|
|
28
|
-
renderSelected?: (option: SearchDropdownOption | null) =>
|
|
27
|
+
renderOption?: (option: SearchDropdownOption) => React__default.ReactNode;
|
|
28
|
+
renderSelected?: (option: SearchDropdownOption | null) => React__default.ReactNode;
|
|
29
29
|
filterFunction?: (option: SearchDropdownOption, searchTerm: string) => boolean;
|
|
30
30
|
emptyMessage?: string;
|
|
31
31
|
maxHeight?: string;
|
|
32
32
|
}
|
|
33
|
-
declare const SearchDropdown:
|
|
33
|
+
declare const SearchDropdown: React__default.FC<SearchDropdownProps>;
|
|
34
34
|
|
|
35
35
|
interface AddressFormRef {
|
|
36
36
|
formik: ReturnType<typeof useAddressForm>["formik"];
|
|
@@ -42,8 +42,8 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
42
42
|
type: "submit";
|
|
43
43
|
disabled: boolean;
|
|
44
44
|
loading: boolean;
|
|
45
|
-
children:
|
|
46
|
-
}) =>
|
|
45
|
+
children: React__default.ReactNode;
|
|
46
|
+
}) => React__default.ReactNode;
|
|
47
47
|
/** Called when formik instance is ready (alternative to ref) */
|
|
48
48
|
onFormikReady?: (formik: ReturnType<typeof useAddressForm>["formik"]) => void;
|
|
49
49
|
/** Called when cancel is clicked */
|
|
@@ -57,7 +57,7 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
57
57
|
/** Submit button text. Default: "Save" */
|
|
58
58
|
submitLabel?: string;
|
|
59
59
|
}
|
|
60
|
-
declare const AddressForm:
|
|
60
|
+
declare const AddressForm: React__default.ForwardRefExoticComponent<AddressFormProps & React__default.RefAttributes<AddressFormRef>>;
|
|
61
61
|
|
|
62
62
|
interface ShareButtonProps {
|
|
63
63
|
product: ProductDetail.Root;
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkKKQKHG26_cjs = require('../chunk-KKQKHG26.cjs');
|
|
4
4
|
var chunk2AHH3XBW_cjs = require('../chunk-2AHH3XBW.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkJVSR6THX_cjs = require('../chunk-JVSR6THX.cjs');
|
|
6
|
+
var chunkA67PCF55_cjs = require('../chunk-A67PCF55.cjs');
|
|
7
7
|
var chunkSMHJRNCR_cjs = require('../chunk-SMHJRNCR.cjs');
|
|
8
8
|
var chunkXLQAALMU_cjs = require('../chunk-XLQAALMU.cjs');
|
|
9
9
|
var chunkFMHR5ABF_cjs = require('../chunk-FMHR5ABF.cjs');
|
|
@@ -52,7 +52,7 @@ var useCart = (addressId) => {
|
|
|
52
52
|
async (addrId) => {
|
|
53
53
|
try {
|
|
54
54
|
setIsLoading(true);
|
|
55
|
-
const result = await
|
|
55
|
+
const result = await chunkA67PCF55_cjs.getCart("/customer/cart/", addrId ?? addressId);
|
|
56
56
|
setData(result);
|
|
57
57
|
setError(null);
|
|
58
58
|
} catch (err) {
|
|
@@ -72,7 +72,7 @@ var useCart = (addressId) => {
|
|
|
72
72
|
},
|
|
73
73
|
[fetchData]
|
|
74
74
|
);
|
|
75
|
-
return { data, error, isLoading, mutate: fetchData, refetchWithParams };
|
|
75
|
+
return { data, error, isLoading, mutate: fetchData, refetchWithParams, setData };
|
|
76
76
|
};
|
|
77
77
|
var useOrders = (filters) => {
|
|
78
78
|
const [data, setData] = react.useState(void 0);
|
|
@@ -95,7 +95,7 @@ var useOrders = (filters) => {
|
|
|
95
95
|
react.useEffect(() => {
|
|
96
96
|
fetchData();
|
|
97
97
|
}, [fetchData]);
|
|
98
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
98
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
99
99
|
};
|
|
100
100
|
function useGetProducts(initialFilter, options) {
|
|
101
101
|
const paginationMode = options?.paginationMode || "replace";
|
|
@@ -120,7 +120,7 @@ function useGetProducts(initialFilter, options) {
|
|
|
120
120
|
apiParams[key] = value;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
const result = await
|
|
123
|
+
const result = await chunkA67PCF55_cjs.getProductList(endpoint, apiParams);
|
|
124
124
|
setData(result);
|
|
125
125
|
if (modeRef.current === "append" && isLoadMoreRef.current) {
|
|
126
126
|
setProducts((prev) => [...prev, ...result.results || []]);
|
|
@@ -188,7 +188,7 @@ var useGetProductDetails = (slug) => {
|
|
|
188
188
|
const fetchData = react.useCallback(async () => {
|
|
189
189
|
try {
|
|
190
190
|
setIsLoading(true);
|
|
191
|
-
const result = await
|
|
191
|
+
const result = await chunkA67PCF55_cjs.getProductDetail("/inventory/products/", slug);
|
|
192
192
|
setData(result);
|
|
193
193
|
} catch (err) {
|
|
194
194
|
} finally {
|
|
@@ -211,7 +211,7 @@ var useGetProductCategories = () => {
|
|
|
211
211
|
const fetchData = async () => {
|
|
212
212
|
try {
|
|
213
213
|
setIsLoading(true);
|
|
214
|
-
const result = await
|
|
214
|
+
const result = await chunkA67PCF55_cjs.getProductCategories("/store/categories");
|
|
215
215
|
setData(result || []);
|
|
216
216
|
} catch (err) {
|
|
217
217
|
setError(err);
|
|
@@ -256,8 +256,8 @@ var useWishlist = () => {
|
|
|
256
256
|
const fetchData = react.useCallback(async () => {
|
|
257
257
|
try {
|
|
258
258
|
setIsLoading(true);
|
|
259
|
-
const
|
|
260
|
-
setData(
|
|
259
|
+
const response = await chunkA67PCF55_cjs.getWishlist("/customer/wishlist/");
|
|
260
|
+
if (response.data) setData(response.data);
|
|
261
261
|
setError(null);
|
|
262
262
|
} catch (err) {
|
|
263
263
|
setError(err);
|
|
@@ -271,7 +271,7 @@ var useWishlist = () => {
|
|
|
271
271
|
fetchData();
|
|
272
272
|
}
|
|
273
273
|
}, [fetchData]);
|
|
274
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
274
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
275
275
|
};
|
|
276
276
|
var useProductDetailModal = () => {
|
|
277
277
|
const [selectedProductSlug, setSelectedProductSlug] = react.useState();
|
|
@@ -314,7 +314,7 @@ function useCheckoutPayment(options) {
|
|
|
314
314
|
const [isConfirmingPayment, setIsConfirmingPayment] = react.useState(false);
|
|
315
315
|
const [showSuccessModal, setShowSuccessModal] = react.useState(false);
|
|
316
316
|
const [showFailureModal, setShowFailureModal] = react.useState(false);
|
|
317
|
-
const resetCartCount =
|
|
317
|
+
const resetCartCount = chunkJVSR6THX_cjs.useCartStore((s) => s.resetCartCount);
|
|
318
318
|
const callbacks = {
|
|
319
319
|
onSuccess: (order) => {
|
|
320
320
|
setOrderSummary(order);
|
|
@@ -500,8 +500,8 @@ function useVariantSelector(options) {
|
|
|
500
500
|
}
|
|
501
501
|
function useShopCheckout(options) {
|
|
502
502
|
const { product, onNavigateToCart, onToast } = options;
|
|
503
|
-
const { addToCart, setCart } =
|
|
504
|
-
const isUserAuthenticated =
|
|
503
|
+
const { addToCart, setCart } = chunkJVSR6THX_cjs.useCartStore();
|
|
504
|
+
const isUserAuthenticated = chunkJVSR6THX_cjs.useAuthStore((s) => s.isAuthenticated);
|
|
505
505
|
const [isWishlisted, setIsWishlisted] = react.useState(product.is_wishlisted);
|
|
506
506
|
const [isAddedToCart, setIsAddedToCart] = react.useState(false);
|
|
507
507
|
const [loading, setLoading] = react.useState(false);
|
|
@@ -512,7 +512,7 @@ function useShopCheckout(options) {
|
|
|
512
512
|
react.useEffect(() => {
|
|
513
513
|
const fetchCategories = async () => {
|
|
514
514
|
try {
|
|
515
|
-
const response = await
|
|
515
|
+
const response = await chunkA67PCF55_cjs.getCategories();
|
|
516
516
|
setCategories(response.data);
|
|
517
517
|
} catch (error) {
|
|
518
518
|
console.log(error);
|
|
@@ -626,7 +626,7 @@ function useShopCheckout(options) {
|
|
|
626
626
|
const handleNotifyMeFormSubmit = react.useCallback(
|
|
627
627
|
async (values) => {
|
|
628
628
|
try {
|
|
629
|
-
const response = await
|
|
629
|
+
const response = await chunkA67PCF55_cjs.notifyProductStock({
|
|
630
630
|
...values,
|
|
631
631
|
variant_slug: product.slug
|
|
632
632
|
});
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { A as Address } from '../address-DwBZHzbI.cjs';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { C as Cart, b as Category, U as User, c as Coupon } from '../cart-XumsY-y0.cjs';
|
|
3
4
|
import { O as Order } from '../orders-Dm5Dq02y.cjs';
|
|
4
5
|
import { d as Product, f as ProductDetail, e as ProductAttribute, A as Attributes } from '../product-Daxj09p9.cjs';
|
|
5
6
|
import { W as Wishlist } from '../wishlist-Cow1wVqf.cjs';
|
|
6
7
|
export { U as UseAddressFormOptions, a as UseAddressFormReturn, u as useAddressForm } from '../useAddressForm-DGbEn91-.cjs';
|
|
7
8
|
import 'react-toastify';
|
|
8
|
-
import 'react';
|
|
9
9
|
import 'formik';
|
|
10
10
|
|
|
11
11
|
declare const useAddress: () => {
|
|
@@ -21,6 +21,7 @@ declare const useCart: (addressId?: number) => {
|
|
|
21
21
|
isLoading: boolean;
|
|
22
22
|
mutate: (addrId?: number) => Promise<void>;
|
|
23
23
|
refetchWithParams: (newAddressId?: number) => void;
|
|
24
|
+
setData: React.Dispatch<React.SetStateAction<Cart.Root | undefined>>;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
declare const useOrders: (filters: Record<string, string>) => {
|
|
@@ -28,6 +29,7 @@ declare const useOrders: (filters: Record<string, string>) => {
|
|
|
28
29
|
error: unknown;
|
|
29
30
|
isLoading: boolean;
|
|
30
31
|
mutate: () => Promise<void>;
|
|
32
|
+
setData: React.Dispatch<React.SetStateAction<Order.OrderResponse | undefined>>;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
type PaginationMode = "append" | "replace";
|
|
@@ -73,6 +75,7 @@ declare const useWishlist: () => {
|
|
|
73
75
|
error: unknown;
|
|
74
76
|
isLoading: boolean;
|
|
75
77
|
mutate: () => Promise<void>;
|
|
78
|
+
setData: React.Dispatch<React.SetStateAction<Wishlist.Root | undefined>>;
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
declare const useProductDetailModal: () => {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { A as Address } from '../address-DwBZHzbI.js';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { C as Cart, b as Category, U as User, c as Coupon } from '../cart-CfsntcpS.js';
|
|
3
4
|
import { O as Order } from '../orders-CvCa7XWm.js';
|
|
4
5
|
import { d as Product, f as ProductDetail, e as ProductAttribute, A as Attributes } from '../product-Daxj09p9.js';
|
|
5
6
|
import { W as Wishlist } from '../wishlist-gamNg0T1.js';
|
|
6
7
|
export { U as UseAddressFormOptions, a as UseAddressFormReturn, u as useAddressForm } from '../useAddressForm-cO3Au33k.js';
|
|
7
8
|
import 'react-toastify';
|
|
8
|
-
import 'react';
|
|
9
9
|
import 'formik';
|
|
10
10
|
|
|
11
11
|
declare const useAddress: () => {
|
|
@@ -21,6 +21,7 @@ declare const useCart: (addressId?: number) => {
|
|
|
21
21
|
isLoading: boolean;
|
|
22
22
|
mutate: (addrId?: number) => Promise<void>;
|
|
23
23
|
refetchWithParams: (newAddressId?: number) => void;
|
|
24
|
+
setData: React.Dispatch<React.SetStateAction<Cart.Root | undefined>>;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
declare const useOrders: (filters: Record<string, string>) => {
|
|
@@ -28,6 +29,7 @@ declare const useOrders: (filters: Record<string, string>) => {
|
|
|
28
29
|
error: unknown;
|
|
29
30
|
isLoading: boolean;
|
|
30
31
|
mutate: () => Promise<void>;
|
|
32
|
+
setData: React.Dispatch<React.SetStateAction<Order.OrderResponse | undefined>>;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
type PaginationMode = "append" | "replace";
|
|
@@ -73,6 +75,7 @@ declare const useWishlist: () => {
|
|
|
73
75
|
error: unknown;
|
|
74
76
|
isLoading: boolean;
|
|
75
77
|
mutate: () => Promise<void>;
|
|
78
|
+
setData: React.Dispatch<React.SetStateAction<Wishlist.Root | undefined>>;
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
declare const useProductDetailModal: () => {
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getUserDetails } from '../chunk-C7ZJZEEN.js';
|
|
2
2
|
import { findMatchingVariant, findSimilarVariant, isVariantCombinationAvailable, isColorVariantType } from '../chunk-HEFA67WK.js';
|
|
3
|
-
import { useCartStore, useAuthStore } from '../chunk-
|
|
4
|
-
import { getCart, getProductList, getProductDetail, getWishlist, notifyProductStock, getProductCategories, getCategories } from '../chunk-
|
|
3
|
+
import { useCartStore, useAuthStore } from '../chunk-ZKHQPHT5.js';
|
|
4
|
+
import { getCart, getProductList, getProductDetail, getWishlist, notifyProductStock, getProductCategories, getCategories } from '../chunk-ERLBPVFK.js';
|
|
5
5
|
import { cart_default } from '../chunk-QAC72HKO.js';
|
|
6
6
|
import { processPayment, fetchAvailableCoupons, applyCheckoutCoupon, removeCheckoutCoupon } from '../chunk-BHOXJGIE.js';
|
|
7
7
|
import { getOrders, placeOrder, applyCoupon, removeCoupon, getCoupons, getAppliedCoupon } from '../chunk-GHABOHLA.js';
|
|
@@ -70,7 +70,7 @@ var useCart = (addressId) => {
|
|
|
70
70
|
},
|
|
71
71
|
[fetchData]
|
|
72
72
|
);
|
|
73
|
-
return { data, error, isLoading, mutate: fetchData, refetchWithParams };
|
|
73
|
+
return { data, error, isLoading, mutate: fetchData, refetchWithParams, setData };
|
|
74
74
|
};
|
|
75
75
|
var useOrders = (filters) => {
|
|
76
76
|
const [data, setData] = useState(void 0);
|
|
@@ -93,7 +93,7 @@ var useOrders = (filters) => {
|
|
|
93
93
|
useEffect(() => {
|
|
94
94
|
fetchData();
|
|
95
95
|
}, [fetchData]);
|
|
96
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
96
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
97
97
|
};
|
|
98
98
|
function useGetProducts(initialFilter, options) {
|
|
99
99
|
const paginationMode = options?.paginationMode || "replace";
|
|
@@ -254,8 +254,8 @@ var useWishlist = () => {
|
|
|
254
254
|
const fetchData = useCallback(async () => {
|
|
255
255
|
try {
|
|
256
256
|
setIsLoading(true);
|
|
257
|
-
const
|
|
258
|
-
setData(
|
|
257
|
+
const response = await getWishlist("/customer/wishlist/");
|
|
258
|
+
if (response.data) setData(response.data);
|
|
259
259
|
setError(null);
|
|
260
260
|
} catch (err) {
|
|
261
261
|
setError(err);
|
|
@@ -269,7 +269,7 @@ var useWishlist = () => {
|
|
|
269
269
|
fetchData();
|
|
270
270
|
}
|
|
271
271
|
}, [fetchData]);
|
|
272
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
272
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
273
273
|
};
|
|
274
274
|
var useProductDetailModal = () => {
|
|
275
275
|
const [selectedProductSlug, setSelectedProductSlug] = useState();
|
package/dist/store/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkJVSR6THX_cjs = require('../chunk-JVSR6THX.cjs');
|
|
4
|
+
var chunkA67PCF55_cjs = require('../chunk-A67PCF55.cjs');
|
|
5
5
|
require('../chunk-SMHJRNCR.cjs');
|
|
6
6
|
require('../chunk-ZO2HREQL.cjs');
|
|
7
7
|
require('../chunk-BBRXE57K.cjs');
|
|
@@ -19,11 +19,11 @@ var useWishlistStore = zustand.create((set) => ({
|
|
|
19
19
|
resetWishlist: () => set(initialState),
|
|
20
20
|
syncWishlist: async () => {
|
|
21
21
|
try {
|
|
22
|
-
const response = await
|
|
23
|
-
if (response) {
|
|
22
|
+
const response = await chunkA67PCF55_cjs.getWishlist("/customer/wishlist/");
|
|
23
|
+
if (response.data) {
|
|
24
24
|
set({
|
|
25
|
-
wishlist_count: response.wishlist_count,
|
|
26
|
-
product_variants: response.product_variants
|
|
25
|
+
wishlist_count: response.data.wishlist_count,
|
|
26
|
+
product_variants: response.data.product_variants
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
} catch {
|
|
@@ -47,7 +47,7 @@ var useProductStore = zustand.create((set, get) => ({
|
|
|
47
47
|
data: filter.page === 1 ? [] : state.data
|
|
48
48
|
}));
|
|
49
49
|
try {
|
|
50
|
-
const response = await
|
|
50
|
+
const response = await chunkA67PCF55_cjs.getProducts({ ...filter });
|
|
51
51
|
if (response.data) {
|
|
52
52
|
const { results, ...meta } = response.data;
|
|
53
53
|
set((state) => ({
|
|
@@ -67,15 +67,15 @@ var useProductStore = zustand.create((set, get) => ({
|
|
|
67
67
|
|
|
68
68
|
Object.defineProperty(exports, "loginUser", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkJVSR6THX_cjs.loginUser; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "useAuthStore", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkJVSR6THX_cjs.useAuthStore; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "useCartStore", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkJVSR6THX_cjs.useCartStore; }
|
|
79
79
|
});
|
|
80
80
|
exports.useProductStore = useProductStore;
|
|
81
81
|
exports.useWishlistStore = useWishlistStore;
|
package/dist/store/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { loginUser, useAuthStore, useCartStore } from '../chunk-
|
|
2
|
-
import { getWishlist, getProducts } from '../chunk-
|
|
1
|
+
export { loginUser, useAuthStore, useCartStore } from '../chunk-ZKHQPHT5.js';
|
|
2
|
+
import { getWishlist, getProducts } from '../chunk-ERLBPVFK.js';
|
|
3
3
|
import '../chunk-QAC72HKO.js';
|
|
4
4
|
import '../chunk-JWKDXFS4.js';
|
|
5
5
|
import '../chunk-WEMNXIRS.js';
|
|
@@ -18,10 +18,10 @@ var useWishlistStore = create((set) => ({
|
|
|
18
18
|
syncWishlist: async () => {
|
|
19
19
|
try {
|
|
20
20
|
const response = await getWishlist("/customer/wishlist/");
|
|
21
|
-
if (response) {
|
|
21
|
+
if (response.data) {
|
|
22
22
|
set({
|
|
23
|
-
wishlist_count: response.wishlist_count,
|
|
24
|
-
product_variants: response.product_variants
|
|
23
|
+
wishlist_count: response.data.wishlist_count,
|
|
24
|
+
product_variants: response.data.product_variants
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
} catch {
|