@storepecker/storefront-core 1.0.0
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/address-DQEZzyUG.d.cts +19 -0
- package/dist/address-DQEZzyUG.d.ts +19 -0
- package/dist/api/index.cjs +367 -0
- package/dist/api/index.d.cts +127 -0
- package/dist/api/index.d.ts +127 -0
- package/dist/api/index.js +131 -0
- package/dist/booking-ClX-dhX7.d.ts +131 -0
- package/dist/booking-Drl7-IL7.d.cts +131 -0
- package/dist/cart-DVrn8hD0.d.cts +367 -0
- package/dist/cart-DVrn8hD0.d.ts +367 -0
- package/dist/checkout/index.cjs +228 -0
- package/dist/checkout/index.d.cts +251 -0
- package/dist/checkout/index.d.ts +251 -0
- package/dist/checkout/index.js +122 -0
- package/dist/chunk-4CVKE6CC.cjs +312 -0
- package/dist/chunk-4MJMNIAB.js +123 -0
- package/dist/chunk-57ZBPAXU.js +114 -0
- package/dist/chunk-7MQOVWLW.js +40 -0
- package/dist/chunk-7UH6REGV.js +12 -0
- package/dist/chunk-A6IO3HIN.cjs +151 -0
- package/dist/chunk-CFF632IQ.cjs +100 -0
- package/dist/chunk-CSISWBZZ.js +121 -0
- package/dist/chunk-E7WPE3PV.js +98 -0
- package/dist/chunk-FLBJKM6G.js +83 -0
- package/dist/chunk-GB3HW6DM.js +61 -0
- package/dist/chunk-GH75WUO2.cjs +42 -0
- package/dist/chunk-GQTO5ZE2.cjs +96 -0
- package/dist/chunk-JHGXIIBZ.cjs +37 -0
- package/dist/chunk-JQMLHRWL.js +21 -0
- package/dist/chunk-K44JZ5NL.cjs +212 -0
- package/dist/chunk-K5B62JZO.cjs +154 -0
- package/dist/chunk-KWKHHRRJ.cjs +15 -0
- package/dist/chunk-LBGIUNM6.js +30 -0
- package/dist/chunk-LC5ZAUKL.cjs +220 -0
- package/dist/chunk-N3CTXRFT.cjs +30 -0
- package/dist/chunk-QCQCFYYR.js +206 -0
- package/dist/chunk-QM73PI5L.cjs +218 -0
- package/dist/chunk-RCXQJ6XC.cjs +131 -0
- package/dist/chunk-UM24VDYB.js +216 -0
- package/dist/chunk-UXLUE3HW.cjs +69 -0
- package/dist/chunk-WFDKKOO7.js +210 -0
- package/dist/chunk-YUPBTD4M.js +289 -0
- package/dist/components/index.cjs +576 -0
- package/dist/components/index.css +329 -0
- package/dist/components/index.d.cts +58 -0
- package/dist/components/index.d.ts +58 -0
- package/dist/components/index.js +569 -0
- package/dist/coupons-C7iJ-1cy.d.cts +37 -0
- package/dist/coupons-CnfTKL1i.d.ts +37 -0
- package/dist/hooks/index.cjs +381 -0
- package/dist/hooks/index.d.cts +123 -0
- package/dist/hooks/index.d.ts +123 -0
- package/dist/hooks/index.js +364 -0
- package/dist/index-DTyIuLuI.d.cts +18 -0
- package/dist/index-DTyIuLuI.d.ts +18 -0
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/index.cjs +2 -0
- package/dist/models/index.d.cts +53 -0
- package/dist/models/index.d.ts +53 -0
- package/dist/models/index.js +1 -0
- package/dist/orders-CkUzv5Xh.d.ts +159 -0
- package/dist/orders-D0oC9ugD.d.cts +159 -0
- package/dist/phonepe-D7vn-9SR.d.cts +27 -0
- package/dist/phonepe-D7vn-9SR.d.ts +27 -0
- package/dist/store/index.cjs +149 -0
- package/dist/store/index.d.cts +46 -0
- package/dist/store/index.d.ts +46 -0
- package/dist/store/index.js +141 -0
- package/dist/useAddressForm-C-Uzug4d.d.ts +42 -0
- package/dist/useAddressForm-DgkCP1nG.d.cts +42 -0
- package/dist/utils/index.cjs +535 -0
- package/dist/utils/index.d.cts +507 -0
- package/dist/utils/index.d.ts +507 -0
- package/dist/utils/index.js +342 -0
- package/dist/wishlist-BzhnCAQD.d.ts +41 -0
- package/dist/wishlist-CBCZD66Y.d.cts +41 -0
- package/package.json +134 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkKWKHHRRJ_cjs = require('../chunk-KWKHHRRJ.cjs');
|
|
4
|
+
var chunkGH75WUO2_cjs = require('../chunk-GH75WUO2.cjs');
|
|
5
|
+
var chunkRCXQJ6XC_cjs = require('../chunk-RCXQJ6XC.cjs');
|
|
6
|
+
require('../chunk-CFF632IQ.cjs');
|
|
7
|
+
var chunkLC5ZAUKL_cjs = require('../chunk-LC5ZAUKL.cjs');
|
|
8
|
+
var chunkA6IO3HIN_cjs = require('../chunk-A6IO3HIN.cjs');
|
|
9
|
+
require('../chunk-K44JZ5NL.cjs');
|
|
10
|
+
var chunkQM73PI5L_cjs = require('../chunk-QM73PI5L.cjs');
|
|
11
|
+
var chunkJHGXIIBZ_cjs = require('../chunk-JHGXIIBZ.cjs');
|
|
12
|
+
require('../chunk-4CVKE6CC.cjs');
|
|
13
|
+
require('../chunk-K5B62JZO.cjs');
|
|
14
|
+
require('../chunk-UXLUE3HW.cjs');
|
|
15
|
+
require('../chunk-GQTO5ZE2.cjs');
|
|
16
|
+
require('../chunk-N3CTXRFT.cjs');
|
|
17
|
+
var react = require('react');
|
|
18
|
+
|
|
19
|
+
var useAddress = () => {
|
|
20
|
+
const [data, setData] = react.useState([]);
|
|
21
|
+
const [error, setError] = react.useState(null);
|
|
22
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
23
|
+
const hasFetched = react.useRef(false);
|
|
24
|
+
const fetchData = react.useCallback(async () => {
|
|
25
|
+
try {
|
|
26
|
+
setIsLoading(true);
|
|
27
|
+
const result = await chunkJHGXIIBZ_cjs.getAddresses("/store/customer_address/");
|
|
28
|
+
setData(result || []);
|
|
29
|
+
setError(null);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
setError(err);
|
|
32
|
+
} finally {
|
|
33
|
+
setIsLoading(false);
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
react.useEffect(() => {
|
|
37
|
+
if (!hasFetched.current) {
|
|
38
|
+
hasFetched.current = true;
|
|
39
|
+
fetchData();
|
|
40
|
+
}
|
|
41
|
+
}, [fetchData]);
|
|
42
|
+
return { data, error, isLoading, mutate: fetchData };
|
|
43
|
+
};
|
|
44
|
+
var useCart = (addressId) => {
|
|
45
|
+
const [data, setData] = react.useState(void 0);
|
|
46
|
+
const [error, setError] = react.useState(null);
|
|
47
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
48
|
+
const fetchData = react.useCallback(
|
|
49
|
+
async (addrId) => {
|
|
50
|
+
try {
|
|
51
|
+
setIsLoading(true);
|
|
52
|
+
const result = await chunkRCXQJ6XC_cjs.getCart("/customer/cart/", addrId ?? addressId);
|
|
53
|
+
setData(result);
|
|
54
|
+
setError(null);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
setError(err);
|
|
57
|
+
} finally {
|
|
58
|
+
setIsLoading(false);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
[addressId]
|
|
62
|
+
);
|
|
63
|
+
react.useEffect(() => {
|
|
64
|
+
fetchData();
|
|
65
|
+
}, [fetchData]);
|
|
66
|
+
const refetchWithParams = react.useCallback(
|
|
67
|
+
(newAddressId) => {
|
|
68
|
+
fetchData(newAddressId);
|
|
69
|
+
},
|
|
70
|
+
[fetchData]
|
|
71
|
+
);
|
|
72
|
+
return { data, error, isLoading, mutate: fetchData, refetchWithParams };
|
|
73
|
+
};
|
|
74
|
+
var useOrders = (filters) => {
|
|
75
|
+
const [data, setData] = react.useState(void 0);
|
|
76
|
+
const [error, setError] = react.useState(null);
|
|
77
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
78
|
+
const queryString = new URLSearchParams(filters).toString();
|
|
79
|
+
const fetchData = react.useCallback(async () => {
|
|
80
|
+
try {
|
|
81
|
+
setIsLoading(true);
|
|
82
|
+
const url = `/customer/order/?${queryString}`;
|
|
83
|
+
const result = await chunkA6IO3HIN_cjs.getOrders(url);
|
|
84
|
+
setData(result);
|
|
85
|
+
setError(null);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
setError(err);
|
|
88
|
+
} finally {
|
|
89
|
+
setIsLoading(false);
|
|
90
|
+
}
|
|
91
|
+
}, [queryString]);
|
|
92
|
+
react.useEffect(() => {
|
|
93
|
+
fetchData();
|
|
94
|
+
}, [fetchData]);
|
|
95
|
+
return { data, error, isLoading, mutate: fetchData };
|
|
96
|
+
};
|
|
97
|
+
var useGetProducts = (filter) => {
|
|
98
|
+
const [data, setData] = react.useState(
|
|
99
|
+
void 0
|
|
100
|
+
);
|
|
101
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
102
|
+
const hasFetched = react.useRef(false);
|
|
103
|
+
react.useEffect(() => {
|
|
104
|
+
if (hasFetched.current) return;
|
|
105
|
+
hasFetched.current = true;
|
|
106
|
+
const fetchData = async () => {
|
|
107
|
+
try {
|
|
108
|
+
setIsLoading(true);
|
|
109
|
+
const result = await chunkRCXQJ6XC_cjs.getProductList("/inventory/products/", filter);
|
|
110
|
+
setData(result);
|
|
111
|
+
} catch (err) {
|
|
112
|
+
} finally {
|
|
113
|
+
setIsLoading(false);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
fetchData();
|
|
117
|
+
}, []);
|
|
118
|
+
return { data, loading: isLoading && !data, isLoading };
|
|
119
|
+
};
|
|
120
|
+
var useGetProductDetails = (slug) => {
|
|
121
|
+
const [data, setData] = react.useState(void 0);
|
|
122
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
123
|
+
const fetchData = react.useCallback(async () => {
|
|
124
|
+
try {
|
|
125
|
+
setIsLoading(true);
|
|
126
|
+
const result = await chunkRCXQJ6XC_cjs.getProductDetail("/inventory/products/", slug);
|
|
127
|
+
setData(result);
|
|
128
|
+
} catch (err) {
|
|
129
|
+
} finally {
|
|
130
|
+
setIsLoading(false);
|
|
131
|
+
}
|
|
132
|
+
}, [slug]);
|
|
133
|
+
react.useEffect(() => {
|
|
134
|
+
fetchData();
|
|
135
|
+
}, [fetchData]);
|
|
136
|
+
return { data, loading: isLoading && !data, isLoading };
|
|
137
|
+
};
|
|
138
|
+
var useGetProductCategories = () => {
|
|
139
|
+
const [data, setData] = react.useState([]);
|
|
140
|
+
const [error, setError] = react.useState(null);
|
|
141
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
142
|
+
const hasFetched = react.useRef(false);
|
|
143
|
+
react.useEffect(() => {
|
|
144
|
+
if (hasFetched.current) return;
|
|
145
|
+
hasFetched.current = true;
|
|
146
|
+
const fetchData = async () => {
|
|
147
|
+
try {
|
|
148
|
+
setIsLoading(true);
|
|
149
|
+
const result = await chunkRCXQJ6XC_cjs.getProductCategories("/store/categories");
|
|
150
|
+
setData(result || []);
|
|
151
|
+
} catch (err) {
|
|
152
|
+
setError(err);
|
|
153
|
+
} finally {
|
|
154
|
+
setIsLoading(false);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
fetchData();
|
|
158
|
+
}, []);
|
|
159
|
+
return { data, loading: isLoading, error };
|
|
160
|
+
};
|
|
161
|
+
var useUserDetails = () => {
|
|
162
|
+
const [data, setData] = react.useState(void 0);
|
|
163
|
+
const [error, setError] = react.useState(null);
|
|
164
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
165
|
+
const hasFetched = react.useRef(false);
|
|
166
|
+
const fetchData = react.useCallback(async () => {
|
|
167
|
+
try {
|
|
168
|
+
setIsLoading(true);
|
|
169
|
+
const result = await chunkKWKHHRRJ_cjs.getUserDetails("/users/store/profile/");
|
|
170
|
+
setData(result);
|
|
171
|
+
setError(null);
|
|
172
|
+
} catch (err) {
|
|
173
|
+
setError(err);
|
|
174
|
+
} finally {
|
|
175
|
+
setIsLoading(false);
|
|
176
|
+
}
|
|
177
|
+
}, []);
|
|
178
|
+
react.useEffect(() => {
|
|
179
|
+
if (!hasFetched.current) {
|
|
180
|
+
hasFetched.current = true;
|
|
181
|
+
fetchData();
|
|
182
|
+
}
|
|
183
|
+
}, [fetchData]);
|
|
184
|
+
return { data, error, isLoading, mutate: fetchData };
|
|
185
|
+
};
|
|
186
|
+
var useWishlist = () => {
|
|
187
|
+
const [data, setData] = react.useState(void 0);
|
|
188
|
+
const [error, setError] = react.useState(null);
|
|
189
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
190
|
+
const hasFetched = react.useRef(false);
|
|
191
|
+
const fetchData = react.useCallback(async () => {
|
|
192
|
+
try {
|
|
193
|
+
setIsLoading(true);
|
|
194
|
+
const result = await chunkRCXQJ6XC_cjs.getWishlist("/customer/wishlist/");
|
|
195
|
+
setData(result);
|
|
196
|
+
setError(null);
|
|
197
|
+
} catch (err) {
|
|
198
|
+
setError(err);
|
|
199
|
+
} finally {
|
|
200
|
+
setIsLoading(false);
|
|
201
|
+
}
|
|
202
|
+
}, []);
|
|
203
|
+
react.useEffect(() => {
|
|
204
|
+
if (!hasFetched.current) {
|
|
205
|
+
hasFetched.current = true;
|
|
206
|
+
fetchData();
|
|
207
|
+
}
|
|
208
|
+
}, [fetchData]);
|
|
209
|
+
return { data, error, isLoading, mutate: fetchData };
|
|
210
|
+
};
|
|
211
|
+
var useProductDetailModal = () => {
|
|
212
|
+
const [selectedProductSlug, setSelectedProductSlug] = react.useState();
|
|
213
|
+
const [isModalOpen, setIsModalOpen] = react.useState(false);
|
|
214
|
+
const _handleOnOpenModal = (productSlug) => {
|
|
215
|
+
setSelectedProductSlug(productSlug);
|
|
216
|
+
document.body.style.overflow = "hidden";
|
|
217
|
+
setIsModalOpen(true);
|
|
218
|
+
};
|
|
219
|
+
const _handleOnCloseModal = () => {
|
|
220
|
+
document.body.style.overflow = "auto";
|
|
221
|
+
setIsModalOpen(false);
|
|
222
|
+
};
|
|
223
|
+
return {
|
|
224
|
+
isModalOpen,
|
|
225
|
+
onOpenModal: _handleOnOpenModal,
|
|
226
|
+
onCloseModal: _handleOnCloseModal,
|
|
227
|
+
selectedProductSlug
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
var useServiceFormModal = () => {
|
|
231
|
+
const [isModalOpen, setIsModalOpen] = react.useState(false);
|
|
232
|
+
const _handleOnOpenModal = () => {
|
|
233
|
+
document.body.style.overflow = "hidden";
|
|
234
|
+
setIsModalOpen(true);
|
|
235
|
+
};
|
|
236
|
+
const _handleOnCloseModal = () => {
|
|
237
|
+
document.body.style.overflow = "auto";
|
|
238
|
+
setIsModalOpen(false);
|
|
239
|
+
};
|
|
240
|
+
return {
|
|
241
|
+
isServiceModalOpen: isModalOpen,
|
|
242
|
+
onOpenServiceModal: _handleOnOpenModal,
|
|
243
|
+
onCloseServiceModal: _handleOnCloseModal
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
function useCheckoutPayment(options) {
|
|
247
|
+
const [orderSummary, setOrderSummary] = react.useState(null);
|
|
248
|
+
const [isPlacingOrder, setIsPlacingOrder] = react.useState(false);
|
|
249
|
+
const [isConfirmingPayment, setIsConfirmingPayment] = react.useState(false);
|
|
250
|
+
const [showSuccessModal, setShowSuccessModal] = react.useState(false);
|
|
251
|
+
const [showFailureModal, setShowFailureModal] = react.useState(false);
|
|
252
|
+
const resetCartCount = chunkGH75WUO2_cjs.useCartStore((s) => s.resetCartCount);
|
|
253
|
+
const callbacks = {
|
|
254
|
+
onSuccess: (order) => {
|
|
255
|
+
setOrderSummary(order);
|
|
256
|
+
setShowSuccessModal(true);
|
|
257
|
+
options.onSuccess?.(order);
|
|
258
|
+
},
|
|
259
|
+
onFailure: (order) => {
|
|
260
|
+
setOrderSummary(order);
|
|
261
|
+
setShowFailureModal(true);
|
|
262
|
+
options.onFailure?.(order);
|
|
263
|
+
},
|
|
264
|
+
onRedirect: options.onRedirect,
|
|
265
|
+
onStripeModalOpen: options.onStripeModalOpen,
|
|
266
|
+
onCartReset: resetCartCount,
|
|
267
|
+
onPaymentStart: () => setIsConfirmingPayment(true),
|
|
268
|
+
onPaymentEnd: () => setIsConfirmingPayment(false)
|
|
269
|
+
};
|
|
270
|
+
const placeAndPay = react.useCallback(
|
|
271
|
+
async (addressId, paymentMethod) => {
|
|
272
|
+
try {
|
|
273
|
+
setIsPlacingOrder(true);
|
|
274
|
+
const isCod = paymentMethod === "cod";
|
|
275
|
+
const response = await chunkA6IO3HIN_cjs.placeOrder(
|
|
276
|
+
addressId,
|
|
277
|
+
options.phonepeRedirectUrl,
|
|
278
|
+
isCod,
|
|
279
|
+
options.stripeRedirectUrl,
|
|
280
|
+
options.tabbyRedirectUrl
|
|
281
|
+
);
|
|
282
|
+
const order = response.data;
|
|
283
|
+
setOrderSummary(order);
|
|
284
|
+
chunkLC5ZAUKL_cjs.processPayment(order, paymentMethod, callbacks);
|
|
285
|
+
} catch {
|
|
286
|
+
setShowFailureModal(true);
|
|
287
|
+
} finally {
|
|
288
|
+
setIsPlacingOrder(false);
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
[options.phonepeRedirectUrl, options.stripeRedirectUrl, options.tabbyRedirectUrl]
|
|
292
|
+
);
|
|
293
|
+
return {
|
|
294
|
+
orderSummary,
|
|
295
|
+
isPlacingOrder,
|
|
296
|
+
isConfirmingPayment,
|
|
297
|
+
showSuccessModal,
|
|
298
|
+
showFailureModal,
|
|
299
|
+
setShowSuccessModal,
|
|
300
|
+
setShowFailureModal,
|
|
301
|
+
placeAndPay
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function useCheckoutCoupon(options) {
|
|
305
|
+
const [availableCoupons, setAvailableCoupons] = react.useState([]);
|
|
306
|
+
const [appliedCoupon, setAppliedCoupon] = react.useState(null);
|
|
307
|
+
const [isApplying, setIsApplying] = react.useState(false);
|
|
308
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
309
|
+
const [error, setError] = react.useState(null);
|
|
310
|
+
const callbacks = { onCartRefresh: options.onCartRefresh };
|
|
311
|
+
const refreshCoupons = react.useCallback(async () => {
|
|
312
|
+
setIsLoading(true);
|
|
313
|
+
try {
|
|
314
|
+
const [coupons, applied] = await Promise.all([
|
|
315
|
+
chunkLC5ZAUKL_cjs.fetchAvailableCoupons(),
|
|
316
|
+
chunkLC5ZAUKL_cjs.fetchAppliedCoupon()
|
|
317
|
+
]);
|
|
318
|
+
setAvailableCoupons(coupons);
|
|
319
|
+
setAppliedCoupon(applied);
|
|
320
|
+
} catch {
|
|
321
|
+
} finally {
|
|
322
|
+
setIsLoading(false);
|
|
323
|
+
}
|
|
324
|
+
}, []);
|
|
325
|
+
const applyCouponHandler = react.useCallback(
|
|
326
|
+
async (code) => {
|
|
327
|
+
setError(null);
|
|
328
|
+
setIsApplying(true);
|
|
329
|
+
try {
|
|
330
|
+
const coupon = await chunkLC5ZAUKL_cjs.applyCheckoutCoupon(code, callbacks);
|
|
331
|
+
setAppliedCoupon(coupon);
|
|
332
|
+
} catch (err) {
|
|
333
|
+
setError(err instanceof Error ? err.message : "Failed to apply coupon");
|
|
334
|
+
} finally {
|
|
335
|
+
setIsApplying(false);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
[options.onCartRefresh]
|
|
339
|
+
);
|
|
340
|
+
const removeCouponHandler = react.useCallback(async () => {
|
|
341
|
+
if (!appliedCoupon) return;
|
|
342
|
+
try {
|
|
343
|
+
await chunkLC5ZAUKL_cjs.removeCheckoutCoupon(appliedCoupon.coupon_code, callbacks);
|
|
344
|
+
setAppliedCoupon(null);
|
|
345
|
+
setError(null);
|
|
346
|
+
} catch {
|
|
347
|
+
}
|
|
348
|
+
}, [appliedCoupon, options.onCartRefresh]);
|
|
349
|
+
react.useEffect(() => {
|
|
350
|
+
if (options.autoFetch !== false) {
|
|
351
|
+
refreshCoupons();
|
|
352
|
+
}
|
|
353
|
+
}, []);
|
|
354
|
+
return {
|
|
355
|
+
availableCoupons,
|
|
356
|
+
appliedCoupon,
|
|
357
|
+
isApplying,
|
|
358
|
+
isLoading,
|
|
359
|
+
error,
|
|
360
|
+
applyCoupon: applyCouponHandler,
|
|
361
|
+
removeCoupon: removeCouponHandler,
|
|
362
|
+
refreshCoupons
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
Object.defineProperty(exports, "useAddressForm", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function () { return chunkQM73PI5L_cjs.useAddressForm; }
|
|
369
|
+
});
|
|
370
|
+
exports.useAddress = useAddress;
|
|
371
|
+
exports.useCart = useCart;
|
|
372
|
+
exports.useCheckoutCoupon = useCheckoutCoupon;
|
|
373
|
+
exports.useCheckoutPayment = useCheckoutPayment;
|
|
374
|
+
exports.useGetProductCategories = useGetProductCategories;
|
|
375
|
+
exports.useGetProductDetails = useGetProductDetails;
|
|
376
|
+
exports.useGetProducts = useGetProducts;
|
|
377
|
+
exports.useOrders = useOrders;
|
|
378
|
+
exports.useProductDetailModal = useProductDetailModal;
|
|
379
|
+
exports.useServiceFormModal = useServiceFormModal;
|
|
380
|
+
exports.useUserDetails = useUserDetails;
|
|
381
|
+
exports.useWishlist = useWishlist;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { A as Address } from '../address-DQEZzyUG.cjs';
|
|
2
|
+
import { C as Cart, d as Product } from '../cart-DVrn8hD0.cjs';
|
|
3
|
+
import { O as Order, C as Category } from '../orders-D0oC9ugD.cjs';
|
|
4
|
+
import { U as User, W as Wishlist } from '../wishlist-CBCZD66Y.cjs';
|
|
5
|
+
import { C as Coupon } from '../coupons-C7iJ-1cy.cjs';
|
|
6
|
+
export { U as UseAddressFormOptions, a as UseAddressFormReturn, u as useAddressForm } from '../useAddressForm-DgkCP1nG.cjs';
|
|
7
|
+
import 'react-toastify';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'formik';
|
|
10
|
+
|
|
11
|
+
declare const useAddress: () => {
|
|
12
|
+
data: Address[];
|
|
13
|
+
error: any;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
mutate: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
declare const useCart: (addressId?: number) => {
|
|
19
|
+
data: Cart.Root | undefined;
|
|
20
|
+
error: any;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
mutate: (addrId?: number) => Promise<void>;
|
|
23
|
+
refetchWithParams: (newAddressId?: number) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare const useOrders: (filters: any) => {
|
|
27
|
+
data: Order.OrderResponse | undefined;
|
|
28
|
+
error: any;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
mutate: () => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare const useGetProducts: (filter: CustomObject) => {
|
|
34
|
+
data: Product.ProductResponse | undefined;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare const useGetProductDetails: (slug: string) => {
|
|
39
|
+
data: any;
|
|
40
|
+
loading: boolean;
|
|
41
|
+
isLoading: boolean;
|
|
42
|
+
};
|
|
43
|
+
declare const useGetProductCategories: () => {
|
|
44
|
+
data: Category.Root[];
|
|
45
|
+
loading: boolean;
|
|
46
|
+
error: any;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare const useUserDetails: () => {
|
|
50
|
+
data: User.Root | undefined;
|
|
51
|
+
error: any;
|
|
52
|
+
isLoading: boolean;
|
|
53
|
+
mutate: () => Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
declare const useWishlist: () => {
|
|
57
|
+
data: Wishlist.Root | undefined;
|
|
58
|
+
error: any;
|
|
59
|
+
isLoading: boolean;
|
|
60
|
+
mutate: () => Promise<void>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare const useProductDetailModal: () => {
|
|
64
|
+
isModalOpen: boolean;
|
|
65
|
+
onOpenModal: (productSlug: string) => void;
|
|
66
|
+
onCloseModal: () => void;
|
|
67
|
+
selectedProductSlug: string | null | undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare const useServiceFormModal: () => {
|
|
71
|
+
isServiceModalOpen: boolean;
|
|
72
|
+
onOpenServiceModal: () => void;
|
|
73
|
+
onCloseServiceModal: () => void;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
interface UseCheckoutPaymentOptions {
|
|
77
|
+
phonepeRedirectUrl: string;
|
|
78
|
+
stripeRedirectUrl?: string;
|
|
79
|
+
tabbyRedirectUrl?: string;
|
|
80
|
+
onRedirect: (url: string) => void;
|
|
81
|
+
onStripeModalOpen?: (order: Order.OrderSummary) => void;
|
|
82
|
+
onSuccess?: (order: Order.OrderSummary) => void;
|
|
83
|
+
onFailure?: (order: Order.OrderSummary) => void;
|
|
84
|
+
}
|
|
85
|
+
interface UseCheckoutPaymentReturn {
|
|
86
|
+
orderSummary: Order.OrderSummary | null;
|
|
87
|
+
isPlacingOrder: boolean;
|
|
88
|
+
isConfirmingPayment: boolean;
|
|
89
|
+
showSuccessModal: boolean;
|
|
90
|
+
showFailureModal: boolean;
|
|
91
|
+
setShowSuccessModal: (show: boolean) => void;
|
|
92
|
+
setShowFailureModal: (show: boolean) => void;
|
|
93
|
+
placeAndPay: (addressId: number, paymentMethod: string) => Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Hook that manages the full checkout payment flow:
|
|
97
|
+
* 1. Place order via API
|
|
98
|
+
* 2. Route to appropriate payment gateway
|
|
99
|
+
* 3. Handle success/failure states
|
|
100
|
+
*/
|
|
101
|
+
declare function useCheckoutPayment(options: UseCheckoutPaymentOptions): UseCheckoutPaymentReturn;
|
|
102
|
+
|
|
103
|
+
interface UseCheckoutCouponOptions {
|
|
104
|
+
onCartRefresh: () => void | Promise<void>;
|
|
105
|
+
autoFetch?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface UseCheckoutCouponReturn {
|
|
108
|
+
availableCoupons: Coupon[];
|
|
109
|
+
appliedCoupon: Coupon | null;
|
|
110
|
+
isApplying: boolean;
|
|
111
|
+
isLoading: boolean;
|
|
112
|
+
error: string | null;
|
|
113
|
+
applyCoupon: (code: string) => Promise<void>;
|
|
114
|
+
removeCoupon: () => Promise<void>;
|
|
115
|
+
refreshCoupons: () => Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Hook that manages coupon state for the checkout flow.
|
|
119
|
+
* Handles fetching available coupons, applying/removing coupons, and error states.
|
|
120
|
+
*/
|
|
121
|
+
declare function useCheckoutCoupon(options: UseCheckoutCouponOptions): UseCheckoutCouponReturn;
|
|
122
|
+
|
|
123
|
+
export { type UseCheckoutCouponOptions, type UseCheckoutCouponReturn, type UseCheckoutPaymentOptions, type UseCheckoutPaymentReturn, useAddress, useCart, useCheckoutCoupon, useCheckoutPayment, useGetProductCategories, useGetProductDetails, useGetProducts, useOrders, useProductDetailModal, useServiceFormModal, useUserDetails, useWishlist };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { A as Address } from '../address-DQEZzyUG.js';
|
|
2
|
+
import { C as Cart, d as Product } from '../cart-DVrn8hD0.js';
|
|
3
|
+
import { O as Order, C as Category } from '../orders-CkUzv5Xh.js';
|
|
4
|
+
import { U as User, W as Wishlist } from '../wishlist-BzhnCAQD.js';
|
|
5
|
+
import { C as Coupon } from '../coupons-CnfTKL1i.js';
|
|
6
|
+
export { U as UseAddressFormOptions, a as UseAddressFormReturn, u as useAddressForm } from '../useAddressForm-C-Uzug4d.js';
|
|
7
|
+
import 'react-toastify';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'formik';
|
|
10
|
+
|
|
11
|
+
declare const useAddress: () => {
|
|
12
|
+
data: Address[];
|
|
13
|
+
error: any;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
mutate: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
declare const useCart: (addressId?: number) => {
|
|
19
|
+
data: Cart.Root | undefined;
|
|
20
|
+
error: any;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
mutate: (addrId?: number) => Promise<void>;
|
|
23
|
+
refetchWithParams: (newAddressId?: number) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare const useOrders: (filters: any) => {
|
|
27
|
+
data: Order.OrderResponse | undefined;
|
|
28
|
+
error: any;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
mutate: () => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare const useGetProducts: (filter: CustomObject) => {
|
|
34
|
+
data: Product.ProductResponse | undefined;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare const useGetProductDetails: (slug: string) => {
|
|
39
|
+
data: any;
|
|
40
|
+
loading: boolean;
|
|
41
|
+
isLoading: boolean;
|
|
42
|
+
};
|
|
43
|
+
declare const useGetProductCategories: () => {
|
|
44
|
+
data: Category.Root[];
|
|
45
|
+
loading: boolean;
|
|
46
|
+
error: any;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare const useUserDetails: () => {
|
|
50
|
+
data: User.Root | undefined;
|
|
51
|
+
error: any;
|
|
52
|
+
isLoading: boolean;
|
|
53
|
+
mutate: () => Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
declare const useWishlist: () => {
|
|
57
|
+
data: Wishlist.Root | undefined;
|
|
58
|
+
error: any;
|
|
59
|
+
isLoading: boolean;
|
|
60
|
+
mutate: () => Promise<void>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare const useProductDetailModal: () => {
|
|
64
|
+
isModalOpen: boolean;
|
|
65
|
+
onOpenModal: (productSlug: string) => void;
|
|
66
|
+
onCloseModal: () => void;
|
|
67
|
+
selectedProductSlug: string | null | undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare const useServiceFormModal: () => {
|
|
71
|
+
isServiceModalOpen: boolean;
|
|
72
|
+
onOpenServiceModal: () => void;
|
|
73
|
+
onCloseServiceModal: () => void;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
interface UseCheckoutPaymentOptions {
|
|
77
|
+
phonepeRedirectUrl: string;
|
|
78
|
+
stripeRedirectUrl?: string;
|
|
79
|
+
tabbyRedirectUrl?: string;
|
|
80
|
+
onRedirect: (url: string) => void;
|
|
81
|
+
onStripeModalOpen?: (order: Order.OrderSummary) => void;
|
|
82
|
+
onSuccess?: (order: Order.OrderSummary) => void;
|
|
83
|
+
onFailure?: (order: Order.OrderSummary) => void;
|
|
84
|
+
}
|
|
85
|
+
interface UseCheckoutPaymentReturn {
|
|
86
|
+
orderSummary: Order.OrderSummary | null;
|
|
87
|
+
isPlacingOrder: boolean;
|
|
88
|
+
isConfirmingPayment: boolean;
|
|
89
|
+
showSuccessModal: boolean;
|
|
90
|
+
showFailureModal: boolean;
|
|
91
|
+
setShowSuccessModal: (show: boolean) => void;
|
|
92
|
+
setShowFailureModal: (show: boolean) => void;
|
|
93
|
+
placeAndPay: (addressId: number, paymentMethod: string) => Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Hook that manages the full checkout payment flow:
|
|
97
|
+
* 1. Place order via API
|
|
98
|
+
* 2. Route to appropriate payment gateway
|
|
99
|
+
* 3. Handle success/failure states
|
|
100
|
+
*/
|
|
101
|
+
declare function useCheckoutPayment(options: UseCheckoutPaymentOptions): UseCheckoutPaymentReturn;
|
|
102
|
+
|
|
103
|
+
interface UseCheckoutCouponOptions {
|
|
104
|
+
onCartRefresh: () => void | Promise<void>;
|
|
105
|
+
autoFetch?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface UseCheckoutCouponReturn {
|
|
108
|
+
availableCoupons: Coupon[];
|
|
109
|
+
appliedCoupon: Coupon | null;
|
|
110
|
+
isApplying: boolean;
|
|
111
|
+
isLoading: boolean;
|
|
112
|
+
error: string | null;
|
|
113
|
+
applyCoupon: (code: string) => Promise<void>;
|
|
114
|
+
removeCoupon: () => Promise<void>;
|
|
115
|
+
refreshCoupons: () => Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Hook that manages coupon state for the checkout flow.
|
|
119
|
+
* Handles fetching available coupons, applying/removing coupons, and error states.
|
|
120
|
+
*/
|
|
121
|
+
declare function useCheckoutCoupon(options: UseCheckoutCouponOptions): UseCheckoutCouponReturn;
|
|
122
|
+
|
|
123
|
+
export { type UseCheckoutCouponOptions, type UseCheckoutCouponReturn, type UseCheckoutPaymentOptions, type UseCheckoutPaymentReturn, useAddress, useCart, useCheckoutCoupon, useCheckoutPayment, useGetProductCategories, useGetProductDetails, useGetProducts, useOrders, useProductDetailModal, useServiceFormModal, useUserDetails, useWishlist };
|