@storepecker/storefront-core 2.2.0 → 2.2.2
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 +21 -17
- package/dist/hooks/index.d.cts +5 -2
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/index.js +12 -8
- 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,13 +72,17 @@ 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);
|
|
79
79
|
const [error, setError] = react.useState(null);
|
|
80
80
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
81
|
-
const queryString = new URLSearchParams(
|
|
81
|
+
const queryString = new URLSearchParams(
|
|
82
|
+
Object.fromEntries(
|
|
83
|
+
Object.entries(filters).map(([k, v]) => [k, String(v)])
|
|
84
|
+
)
|
|
85
|
+
).toString();
|
|
82
86
|
const fetchData = react.useCallback(async () => {
|
|
83
87
|
try {
|
|
84
88
|
setIsLoading(true);
|
|
@@ -95,7 +99,7 @@ var useOrders = (filters) => {
|
|
|
95
99
|
react.useEffect(() => {
|
|
96
100
|
fetchData();
|
|
97
101
|
}, [fetchData]);
|
|
98
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
102
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
99
103
|
};
|
|
100
104
|
function useGetProducts(initialFilter, options) {
|
|
101
105
|
const paginationMode = options?.paginationMode || "replace";
|
|
@@ -120,7 +124,7 @@ function useGetProducts(initialFilter, options) {
|
|
|
120
124
|
apiParams[key] = value;
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
|
-
const result = await
|
|
127
|
+
const result = await chunkA67PCF55_cjs.getProductList(endpoint, apiParams);
|
|
124
128
|
setData(result);
|
|
125
129
|
if (modeRef.current === "append" && isLoadMoreRef.current) {
|
|
126
130
|
setProducts((prev) => [...prev, ...result.results || []]);
|
|
@@ -188,7 +192,7 @@ var useGetProductDetails = (slug) => {
|
|
|
188
192
|
const fetchData = react.useCallback(async () => {
|
|
189
193
|
try {
|
|
190
194
|
setIsLoading(true);
|
|
191
|
-
const result = await
|
|
195
|
+
const result = await chunkA67PCF55_cjs.getProductDetail("/inventory/products/", slug);
|
|
192
196
|
setData(result);
|
|
193
197
|
} catch (err) {
|
|
194
198
|
} finally {
|
|
@@ -211,7 +215,7 @@ var useGetProductCategories = () => {
|
|
|
211
215
|
const fetchData = async () => {
|
|
212
216
|
try {
|
|
213
217
|
setIsLoading(true);
|
|
214
|
-
const result = await
|
|
218
|
+
const result = await chunkA67PCF55_cjs.getProductCategories("/store/categories");
|
|
215
219
|
setData(result || []);
|
|
216
220
|
} catch (err) {
|
|
217
221
|
setError(err);
|
|
@@ -256,8 +260,8 @@ var useWishlist = () => {
|
|
|
256
260
|
const fetchData = react.useCallback(async () => {
|
|
257
261
|
try {
|
|
258
262
|
setIsLoading(true);
|
|
259
|
-
const
|
|
260
|
-
setData(
|
|
263
|
+
const response = await chunkA67PCF55_cjs.getWishlist("/customer/wishlist/");
|
|
264
|
+
if (response.data) setData(response.data);
|
|
261
265
|
setError(null);
|
|
262
266
|
} catch (err) {
|
|
263
267
|
setError(err);
|
|
@@ -271,7 +275,7 @@ var useWishlist = () => {
|
|
|
271
275
|
fetchData();
|
|
272
276
|
}
|
|
273
277
|
}, [fetchData]);
|
|
274
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
278
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
275
279
|
};
|
|
276
280
|
var useProductDetailModal = () => {
|
|
277
281
|
const [selectedProductSlug, setSelectedProductSlug] = react.useState();
|
|
@@ -314,7 +318,7 @@ function useCheckoutPayment(options) {
|
|
|
314
318
|
const [isConfirmingPayment, setIsConfirmingPayment] = react.useState(false);
|
|
315
319
|
const [showSuccessModal, setShowSuccessModal] = react.useState(false);
|
|
316
320
|
const [showFailureModal, setShowFailureModal] = react.useState(false);
|
|
317
|
-
const resetCartCount =
|
|
321
|
+
const resetCartCount = chunkJVSR6THX_cjs.useCartStore((s) => s.resetCartCount);
|
|
318
322
|
const callbacks = {
|
|
319
323
|
onSuccess: (order) => {
|
|
320
324
|
setOrderSummary(order);
|
|
@@ -500,8 +504,8 @@ function useVariantSelector(options) {
|
|
|
500
504
|
}
|
|
501
505
|
function useShopCheckout(options) {
|
|
502
506
|
const { product, onNavigateToCart, onToast } = options;
|
|
503
|
-
const { addToCart, setCart } =
|
|
504
|
-
const isUserAuthenticated =
|
|
507
|
+
const { addToCart, setCart } = chunkJVSR6THX_cjs.useCartStore();
|
|
508
|
+
const isUserAuthenticated = chunkJVSR6THX_cjs.useAuthStore((s) => s.isAuthenticated);
|
|
505
509
|
const [isWishlisted, setIsWishlisted] = react.useState(product.is_wishlisted);
|
|
506
510
|
const [isAddedToCart, setIsAddedToCart] = react.useState(false);
|
|
507
511
|
const [loading, setLoading] = react.useState(false);
|
|
@@ -512,7 +516,7 @@ function useShopCheckout(options) {
|
|
|
512
516
|
react.useEffect(() => {
|
|
513
517
|
const fetchCategories = async () => {
|
|
514
518
|
try {
|
|
515
|
-
const response = await
|
|
519
|
+
const response = await chunkA67PCF55_cjs.getCategories();
|
|
516
520
|
setCategories(response.data);
|
|
517
521
|
} catch (error) {
|
|
518
522
|
console.log(error);
|
|
@@ -626,7 +630,7 @@ function useShopCheckout(options) {
|
|
|
626
630
|
const handleNotifyMeFormSubmit = react.useCallback(
|
|
627
631
|
async (values) => {
|
|
628
632
|
try {
|
|
629
|
-
const response = await
|
|
633
|
+
const response = await chunkA67PCF55_cjs.notifyProductStock({
|
|
630
634
|
...values,
|
|
631
635
|
variant_slug: product.slug
|
|
632
636
|
});
|
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,13 +21,15 @@ 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
|
-
declare const useOrders: (filters: Record<string,
|
|
27
|
+
declare const useOrders: (filters: Record<string, any>) => {
|
|
27
28
|
data: Order.OrderResponse | undefined;
|
|
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,13 +21,15 @@ 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
|
-
declare const useOrders: (filters: Record<string,
|
|
27
|
+
declare const useOrders: (filters: Record<string, any>) => {
|
|
27
28
|
data: Order.OrderResponse | undefined;
|
|
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,13 +70,17 @@ 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);
|
|
77
77
|
const [error, setError] = useState(null);
|
|
78
78
|
const [isLoading, setIsLoading] = useState(true);
|
|
79
|
-
const queryString = new URLSearchParams(
|
|
79
|
+
const queryString = new URLSearchParams(
|
|
80
|
+
Object.fromEntries(
|
|
81
|
+
Object.entries(filters).map(([k, v]) => [k, String(v)])
|
|
82
|
+
)
|
|
83
|
+
).toString();
|
|
80
84
|
const fetchData = useCallback(async () => {
|
|
81
85
|
try {
|
|
82
86
|
setIsLoading(true);
|
|
@@ -93,7 +97,7 @@ var useOrders = (filters) => {
|
|
|
93
97
|
useEffect(() => {
|
|
94
98
|
fetchData();
|
|
95
99
|
}, [fetchData]);
|
|
96
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
100
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
97
101
|
};
|
|
98
102
|
function useGetProducts(initialFilter, options) {
|
|
99
103
|
const paginationMode = options?.paginationMode || "replace";
|
|
@@ -254,8 +258,8 @@ var useWishlist = () => {
|
|
|
254
258
|
const fetchData = useCallback(async () => {
|
|
255
259
|
try {
|
|
256
260
|
setIsLoading(true);
|
|
257
|
-
const
|
|
258
|
-
setData(
|
|
261
|
+
const response = await getWishlist("/customer/wishlist/");
|
|
262
|
+
if (response.data) setData(response.data);
|
|
259
263
|
setError(null);
|
|
260
264
|
} catch (err) {
|
|
261
265
|
setError(err);
|
|
@@ -269,7 +273,7 @@ var useWishlist = () => {
|
|
|
269
273
|
fetchData();
|
|
270
274
|
}
|
|
271
275
|
}, [fetchData]);
|
|
272
|
-
return { data, error, isLoading, mutate: fetchData };
|
|
276
|
+
return { data, error, isLoading, mutate: fetchData, setData };
|
|
273
277
|
};
|
|
274
278
|
var useProductDetailModal = () => {
|
|
275
279
|
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 {
|