@storepecker/storefront-core 2.6.2 → 2.7.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/api/index.cjs +55 -46
- package/dist/api/index.d.cts +18 -3
- package/dist/api/index.d.ts +18 -3
- package/dist/api/index.js +12 -4
- package/dist/checkout/index.cjs +22 -22
- package/dist/checkout/index.js +2 -2
- package/dist/{chunk-PARH5TBK.cjs → chunk-5BT3MH4A.cjs} +3 -3
- package/dist/{chunk-VYHAWRJR.js → chunk-5JD6MRVS.js} +5 -2
- package/dist/{chunk-6PF4TQXP.js → chunk-6QHEH5XE.js} +4 -4
- package/dist/{chunk-ME6Z7TZW.js → chunk-CHRTGR3G.js} +6 -2
- package/dist/{chunk-QAC72HKO.js → chunk-H32TICAM.js} +14 -13
- package/dist/{chunk-COO7PUZH.cjs → chunk-IWYO22XV.cjs} +21 -21
- package/dist/{chunk-QSHOJ3NJ.cjs → chunk-KWYFA2LJ.cjs} +9 -6
- package/dist/{chunk-SMHJRNCR.cjs → chunk-LCMJYFHC.cjs} +14 -13
- package/dist/{chunk-LZADKC4Y.cjs → chunk-RNGQUWQW.cjs} +6 -2
- package/dist/{chunk-CUR7CHR5.js → chunk-TY5NK7NW.js} +1 -1
- package/dist/hooks/index.cjs +25 -25
- package/dist/hooks/index.js +7 -7
- package/dist/{blog-kdn4wDjq.d.ts → instagram-CqJBZ-0X.d.ts} +28 -1
- package/dist/{blog-yhzC2V0C.d.cts → instagram-D4JUT4ZU.d.cts} +28 -1
- package/dist/models/index.d.cts +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/store/index.cjs +9 -9
- package/dist/store/index.js +4 -4
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -9,15 +9,16 @@ var LocalCart = {
|
|
|
9
9
|
set(cart) {
|
|
10
10
|
localStorage.setItem(USER_CART, JSON.stringify(cart));
|
|
11
11
|
},
|
|
12
|
-
add(product) {
|
|
12
|
+
add(product, quantity = 1) {
|
|
13
|
+
const qty = Number(quantity) || 1;
|
|
13
14
|
const cart = this.get();
|
|
14
15
|
if (!cart) {
|
|
15
16
|
this.set({
|
|
16
17
|
product_variants: [product],
|
|
17
|
-
products_quantity: { [product.id]:
|
|
18
|
-
total_quantity:
|
|
19
|
-
cart_count:
|
|
20
|
-
total_amount: product.selling_price,
|
|
18
|
+
products_quantity: { [product.id]: qty },
|
|
19
|
+
total_quantity: qty,
|
|
20
|
+
cart_count: qty,
|
|
21
|
+
total_amount: Number(product.selling_price) * qty,
|
|
21
22
|
variant_discounts: {}
|
|
22
23
|
});
|
|
23
24
|
return;
|
|
@@ -27,23 +28,23 @@ var LocalCart = {
|
|
|
27
28
|
if (existingProduct) {
|
|
28
29
|
cart.products_quantity = {
|
|
29
30
|
...cart.products_quantity,
|
|
30
|
-
[product.id]: (Number(cart.products_quantity[product.id]) || 0) +
|
|
31
|
+
[product.id]: (Number(cart.products_quantity[product.id]) || 0) + qty
|
|
31
32
|
};
|
|
32
|
-
cart.total_quantity = Number(cart.total_quantity) +
|
|
33
|
-
cart.cart_count = Number(cart.cart_count) +
|
|
34
|
-
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price);
|
|
33
|
+
cart.total_quantity = Number(cart.total_quantity) + qty;
|
|
34
|
+
cart.cart_count = Number(cart.cart_count) + qty;
|
|
35
|
+
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price) * qty;
|
|
35
36
|
this.set(cart);
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
newCart.push(product);
|
|
39
40
|
cart.products_quantity = {
|
|
40
41
|
...cart.products_quantity,
|
|
41
|
-
[product.id]: (cart.products_quantity[product.id] || 0) +
|
|
42
|
+
[product.id]: (cart.products_quantity[product.id] || 0) + qty
|
|
42
43
|
};
|
|
43
44
|
cart.product_variants = newCart;
|
|
44
|
-
cart.total_quantity = Number(cart.total_quantity) +
|
|
45
|
-
cart.cart_count = Number(cart.cart_count) +
|
|
46
|
-
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price);
|
|
45
|
+
cart.total_quantity = Number(cart.total_quantity) + qty;
|
|
46
|
+
cart.cart_count = Number(cart.cart_count) + qty;
|
|
47
|
+
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price) * qty;
|
|
47
48
|
this.set(cart);
|
|
48
49
|
},
|
|
49
50
|
remove(product) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk5BT3MH4A_cjs = require('./chunk-5BT3MH4A.cjs');
|
|
4
|
+
var chunkLCMJYFHC_cjs = require('./chunk-LCMJYFHC.cjs');
|
|
5
|
+
var chunkRNGQUWQW_cjs = require('./chunk-RNGQUWQW.cjs');
|
|
6
6
|
var chunkBBRXE57K_cjs = require('./chunk-BBRXE57K.cjs');
|
|
7
7
|
var chunkNE3ZHELZ_cjs = require('./chunk-NE3ZHELZ.cjs');
|
|
8
8
|
var zustand = require('zustand');
|
|
@@ -23,7 +23,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
23
23
|
}),
|
|
24
24
|
fetchCartItemQuantity: async () => {
|
|
25
25
|
try {
|
|
26
|
-
const { total_quantity } = await
|
|
26
|
+
const { total_quantity } = await chunk5BT3MH4A_cjs.getCartItemQuantity();
|
|
27
27
|
set({ total_quantity });
|
|
28
28
|
} catch (error) {
|
|
29
29
|
console.error("Failed to fetch cart item quantity", error);
|
|
@@ -32,7 +32,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
32
32
|
syncCart: async (addressId, shippingOptionId) => {
|
|
33
33
|
set({ status: "loading" /* LOADING */ });
|
|
34
34
|
try {
|
|
35
|
-
const response = await
|
|
35
|
+
const response = await chunk5BT3MH4A_cjs.getCart("/customer/cart/", addressId, shippingOptionId);
|
|
36
36
|
if (response) {
|
|
37
37
|
set({ cart: response, total_quantity: response.total_quantity, status: "idle" /* IDLE */ });
|
|
38
38
|
}
|
|
@@ -43,7 +43,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
43
43
|
fetchCart: async (addressId, shippingOptionId) => {
|
|
44
44
|
set({ status: "loading" /* LOADING */ });
|
|
45
45
|
try {
|
|
46
|
-
const response = await
|
|
46
|
+
const response = await chunk5BT3MH4A_cjs.getCart("/customer/cart/", addressId, shippingOptionId);
|
|
47
47
|
if (response) {
|
|
48
48
|
set({ cart: response, total_quantity: response.total_quantity, status: "idle" /* IDLE */ });
|
|
49
49
|
}
|
|
@@ -55,21 +55,21 @@ var useCartStore = zustand.create((set) => ({
|
|
|
55
55
|
set({ status: "loading" /* LOADING */ });
|
|
56
56
|
try {
|
|
57
57
|
if (chunkBBRXE57K_cjs.auth_default.getUserDetails()) {
|
|
58
|
-
await
|
|
58
|
+
await chunk5BT3MH4A_cjs.addToCart(items, customizationInputs);
|
|
59
59
|
await useCartStore.getState().syncCart(addressId);
|
|
60
60
|
} else {
|
|
61
|
-
const cart =
|
|
61
|
+
const cart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
62
62
|
if (cart) {
|
|
63
63
|
items.forEach((item) => {
|
|
64
64
|
const product = cart.product_variants.find(
|
|
65
65
|
(p) => p.id === item.variant_id
|
|
66
66
|
);
|
|
67
67
|
if (product) {
|
|
68
|
-
|
|
68
|
+
chunkLCMJYFHC_cjs.cart_default.add(product, item.quantity);
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
const updatedCart =
|
|
72
|
+
const updatedCart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
73
73
|
if (updatedCart) {
|
|
74
74
|
set({ cart: updatedCart, total_quantity: updatedCart.total_quantity });
|
|
75
75
|
}
|
|
@@ -83,19 +83,19 @@ var useCartStore = zustand.create((set) => ({
|
|
|
83
83
|
set({ status: "loading" /* LOADING */ });
|
|
84
84
|
try {
|
|
85
85
|
if (chunkBBRXE57K_cjs.auth_default.getUserDetails()) {
|
|
86
|
-
await
|
|
86
|
+
await chunk5BT3MH4A_cjs.removeFromCart(items);
|
|
87
87
|
await useCartStore.getState().syncCart(addressId);
|
|
88
88
|
} else {
|
|
89
|
-
const cart =
|
|
89
|
+
const cart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
90
90
|
if (cart) {
|
|
91
91
|
items.forEach((item) => {
|
|
92
92
|
const product = cart.product_variants.find(
|
|
93
93
|
(p) => p.id === item.variant_id
|
|
94
94
|
);
|
|
95
|
-
if (product)
|
|
95
|
+
if (product) chunkLCMJYFHC_cjs.cart_default.remove(product);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
const updatedCart =
|
|
98
|
+
const updatedCart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
99
99
|
if (updatedCart) {
|
|
100
100
|
set({
|
|
101
101
|
cart: updatedCart,
|
|
@@ -114,19 +114,19 @@ var useCartStore = zustand.create((set) => ({
|
|
|
114
114
|
set({ status: "loading" /* LOADING */ });
|
|
115
115
|
try {
|
|
116
116
|
if (chunkBBRXE57K_cjs.auth_default.getUserDetails()) {
|
|
117
|
-
await
|
|
117
|
+
await chunk5BT3MH4A_cjs.updateCart(items);
|
|
118
118
|
await useCartStore.getState().syncCart(addressId);
|
|
119
119
|
} else {
|
|
120
|
-
const cart =
|
|
120
|
+
const cart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
121
121
|
if (cart) {
|
|
122
122
|
items.forEach((item) => {
|
|
123
123
|
const product = cart.product_variants.find(
|
|
124
124
|
(p) => p.id === item.variant_id
|
|
125
125
|
);
|
|
126
|
-
if (product)
|
|
126
|
+
if (product) chunkLCMJYFHC_cjs.cart_default.updateQuantity(product, item.quantity);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
const updatedCart =
|
|
129
|
+
const updatedCart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
130
130
|
if (updatedCart) {
|
|
131
131
|
set({
|
|
132
132
|
cart: updatedCart,
|
|
@@ -142,7 +142,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
142
142
|
updateCustomization: async (customizationInputs) => {
|
|
143
143
|
set({ status: "loading" /* LOADING */ });
|
|
144
144
|
try {
|
|
145
|
-
await
|
|
145
|
+
await chunkRNGQUWQW_cjs.updateOrderCustomization({ customization_inputs: customizationInputs });
|
|
146
146
|
} catch {
|
|
147
147
|
} finally {
|
|
148
148
|
set({ status: "idle" /* IDLE */ });
|
|
@@ -174,7 +174,7 @@ var useAuthStore = zustand.create((set, get) => ({
|
|
|
174
174
|
setTimeout(async () => {
|
|
175
175
|
try {
|
|
176
176
|
set({ user, status: "success" /* SUCCESS */, isAuthenticated: true });
|
|
177
|
-
const localCartItems =
|
|
177
|
+
const localCartItems = chunkLCMJYFHC_cjs.cart_default.get();
|
|
178
178
|
if (localCartItems) {
|
|
179
179
|
await useCartStore.getState().addToCart(
|
|
180
180
|
Object.entries(localCartItems.products_quantity).map(
|
|
@@ -184,7 +184,7 @@ var useAuthStore = zustand.create((set, get) => ({
|
|
|
184
184
|
})
|
|
185
185
|
)
|
|
186
186
|
);
|
|
187
|
-
|
|
187
|
+
chunkLCMJYFHC_cjs.cart_default.clear();
|
|
188
188
|
await useCartStore.getState().fetchCart();
|
|
189
189
|
setTimeout(() => {
|
|
190
190
|
if (!preventRefreshAfterLogin) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkXFOUNOKO_cjs = require('./chunk-XFOUNOKO.cjs');
|
|
4
4
|
var chunkK44JZ5NL_cjs = require('./chunk-K44JZ5NL.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkRNGQUWQW_cjs = require('./chunk-RNGQUWQW.cjs');
|
|
6
6
|
var chunkN3CTXRFT_cjs = require('./chunk-N3CTXRFT.cjs');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
|
|
@@ -69,7 +69,7 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
69
69
|
async function handleRazorpaySuccess(data, order, callbacks) {
|
|
70
70
|
try {
|
|
71
71
|
callbacks.onPaymentStart?.();
|
|
72
|
-
await
|
|
72
|
+
await chunkRNGQUWQW_cjs.razorpayOrderSuccess(data);
|
|
73
73
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
74
74
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
75
75
|
callbacks.onCartReset();
|
|
@@ -82,7 +82,7 @@ async function handleRazorpaySuccess(data, order, callbacks) {
|
|
|
82
82
|
}
|
|
83
83
|
async function handleRazorpayFail(order, callbacks, error) {
|
|
84
84
|
try {
|
|
85
|
-
await
|
|
85
|
+
await chunkRNGQUWQW_cjs.razorpayOrderFail({
|
|
86
86
|
order_id: order.id,
|
|
87
87
|
razorpay_order_id: order.razorpay_order_id,
|
|
88
88
|
error
|
|
@@ -115,9 +115,12 @@ async function handleCODPayment(order, callbacks, options) {
|
|
|
115
115
|
callbacks.onPaymentStart?.();
|
|
116
116
|
chunkK44JZ5NL_cjs.pixelEvents.initiateCheckout(order, "cod");
|
|
117
117
|
if (options?.isPublic) {
|
|
118
|
-
await
|
|
118
|
+
await chunkRNGQUWQW_cjs.publicMakeCODOrder(order.order_number, {
|
|
119
|
+
customer_phone: order.customer_phone,
|
|
120
|
+
customer_email: order.customer_email
|
|
121
|
+
});
|
|
119
122
|
} else {
|
|
120
|
-
await
|
|
123
|
+
await chunkRNGQUWQW_cjs.makeCODOrder(order.id);
|
|
121
124
|
}
|
|
122
125
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
123
126
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
@@ -145,7 +148,7 @@ function handleStripePayment(order, callbacks) {
|
|
|
145
148
|
async function handleStripeSuccess(order, paymentIntentId, callbacks) {
|
|
146
149
|
try {
|
|
147
150
|
callbacks.onPaymentStart?.();
|
|
148
|
-
await
|
|
151
|
+
await chunkRNGQUWQW_cjs.stripeOrderSuccess({
|
|
149
152
|
order_id: order.id,
|
|
150
153
|
payment_intent_id: paymentIntentId
|
|
151
154
|
});
|
|
@@ -11,15 +11,16 @@ var LocalCart = {
|
|
|
11
11
|
set(cart) {
|
|
12
12
|
localStorage.setItem(chunkNE3ZHELZ_cjs.USER_CART, JSON.stringify(cart));
|
|
13
13
|
},
|
|
14
|
-
add(product) {
|
|
14
|
+
add(product, quantity = 1) {
|
|
15
|
+
const qty = Number(quantity) || 1;
|
|
15
16
|
const cart = this.get();
|
|
16
17
|
if (!cart) {
|
|
17
18
|
this.set({
|
|
18
19
|
product_variants: [product],
|
|
19
|
-
products_quantity: { [product.id]:
|
|
20
|
-
total_quantity:
|
|
21
|
-
cart_count:
|
|
22
|
-
total_amount: product.selling_price,
|
|
20
|
+
products_quantity: { [product.id]: qty },
|
|
21
|
+
total_quantity: qty,
|
|
22
|
+
cart_count: qty,
|
|
23
|
+
total_amount: Number(product.selling_price) * qty,
|
|
23
24
|
variant_discounts: {}
|
|
24
25
|
});
|
|
25
26
|
return;
|
|
@@ -29,23 +30,23 @@ var LocalCart = {
|
|
|
29
30
|
if (existingProduct) {
|
|
30
31
|
cart.products_quantity = {
|
|
31
32
|
...cart.products_quantity,
|
|
32
|
-
[product.id]: (Number(cart.products_quantity[product.id]) || 0) +
|
|
33
|
+
[product.id]: (Number(cart.products_quantity[product.id]) || 0) + qty
|
|
33
34
|
};
|
|
34
|
-
cart.total_quantity = Number(cart.total_quantity) +
|
|
35
|
-
cart.cart_count = Number(cart.cart_count) +
|
|
36
|
-
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price);
|
|
35
|
+
cart.total_quantity = Number(cart.total_quantity) + qty;
|
|
36
|
+
cart.cart_count = Number(cart.cart_count) + qty;
|
|
37
|
+
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price) * qty;
|
|
37
38
|
this.set(cart);
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
newCart.push(product);
|
|
41
42
|
cart.products_quantity = {
|
|
42
43
|
...cart.products_quantity,
|
|
43
|
-
[product.id]: (cart.products_quantity[product.id] || 0) +
|
|
44
|
+
[product.id]: (cart.products_quantity[product.id] || 0) + qty
|
|
44
45
|
};
|
|
45
46
|
cart.product_variants = newCart;
|
|
46
|
-
cart.total_quantity = Number(cart.total_quantity) +
|
|
47
|
-
cart.cart_count = Number(cart.cart_count) +
|
|
48
|
-
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price);
|
|
47
|
+
cart.total_quantity = Number(cart.total_quantity) + qty;
|
|
48
|
+
cart.cart_count = Number(cart.cart_count) + qty;
|
|
49
|
+
cart.total_amount = Number(cart.total_amount) + Number(product.selling_price) * qty;
|
|
49
50
|
this.set(cart);
|
|
50
51
|
},
|
|
51
52
|
remove(product) {
|
|
@@ -109,8 +109,12 @@ async function stripeOrderFail(orderDetails) {
|
|
|
109
109
|
async function makeCODOrder(orderId) {
|
|
110
110
|
return chunkECHV2JSY_cjs.http_service_default.post("/customer/order_cod/", { order_id: orderId });
|
|
111
111
|
}
|
|
112
|
-
async function publicMakeCODOrder(orderNumber) {
|
|
113
|
-
return chunkECHV2JSY_cjs.http_service_default.post("/customer/public_order_cod/", {
|
|
112
|
+
async function publicMakeCODOrder(orderNumber, ownership) {
|
|
113
|
+
return chunkECHV2JSY_cjs.http_service_default.post("/customer/public_order_cod/", {
|
|
114
|
+
order_number: orderNumber,
|
|
115
|
+
customer_phone: ownership?.customer_phone,
|
|
116
|
+
customer_email: ownership?.customer_email
|
|
117
|
+
});
|
|
114
118
|
}
|
|
115
119
|
async function updateOrderCustomization(customizationInput) {
|
|
116
120
|
return chunkECHV2JSY_cjs.http_service_default.post("/customer/product_personalize/", customizationInput);
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkY46EHRJQ_cjs = require('../chunk-Y46EHRJQ.cjs');
|
|
4
4
|
var chunk2AHH3XBW_cjs = require('../chunk-2AHH3XBW.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var chunkIWYO22XV_cjs = require('../chunk-IWYO22XV.cjs');
|
|
6
|
+
var chunk5BT3MH4A_cjs = require('../chunk-5BT3MH4A.cjs');
|
|
7
|
+
var chunkLCMJYFHC_cjs = require('../chunk-LCMJYFHC.cjs');
|
|
8
|
+
var chunkKWYFA2LJ_cjs = require('../chunk-KWYFA2LJ.cjs');
|
|
9
9
|
var chunkXFOUNOKO_cjs = require('../chunk-XFOUNOKO.cjs');
|
|
10
10
|
require('../chunk-K44JZ5NL.cjs');
|
|
11
|
-
var
|
|
11
|
+
var chunkRNGQUWQW_cjs = require('../chunk-RNGQUWQW.cjs');
|
|
12
12
|
var chunkIVKJJLG7_cjs = require('../chunk-IVKJJLG7.cjs');
|
|
13
13
|
var chunkRDUT4W3B_cjs = require('../chunk-RDUT4W3B.cjs');
|
|
14
14
|
require('../chunk-LJUGNSQQ.cjs');
|
|
@@ -56,7 +56,7 @@ var useCart = (addressId) => {
|
|
|
56
56
|
async (addrId, shippingId) => {
|
|
57
57
|
try {
|
|
58
58
|
setIsLoading(true);
|
|
59
|
-
const result = await
|
|
59
|
+
const result = await chunk5BT3MH4A_cjs.getCart("/customer/cart/", addrId ?? addressId, shippingId);
|
|
60
60
|
setData(result);
|
|
61
61
|
setError(null);
|
|
62
62
|
} catch (err) {
|
|
@@ -91,7 +91,7 @@ var useOrders = (filters) => {
|
|
|
91
91
|
try {
|
|
92
92
|
setIsLoading(true);
|
|
93
93
|
const url = `/customer/order/?${queryString}`;
|
|
94
|
-
const result = await
|
|
94
|
+
const result = await chunkRNGQUWQW_cjs.getOrders(url);
|
|
95
95
|
setData(result);
|
|
96
96
|
setError(null);
|
|
97
97
|
} catch (err) {
|
|
@@ -128,7 +128,7 @@ function useGetProducts(initialFilter, options) {
|
|
|
128
128
|
apiParams[key] = value;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
const result = await
|
|
131
|
+
const result = await chunk5BT3MH4A_cjs.getProductList(endpoint, apiParams);
|
|
132
132
|
setData(result);
|
|
133
133
|
if (modeRef.current === "append" && isLoadMoreRef.current) {
|
|
134
134
|
setProducts((prev) => [...prev, ...result.results || []]);
|
|
@@ -196,7 +196,7 @@ var useGetProductDetails = (slug) => {
|
|
|
196
196
|
const fetchData = react.useCallback(async () => {
|
|
197
197
|
try {
|
|
198
198
|
setIsLoading(true);
|
|
199
|
-
const result = await
|
|
199
|
+
const result = await chunk5BT3MH4A_cjs.getProductDetail("/inventory/products/", slug);
|
|
200
200
|
setData(result);
|
|
201
201
|
} catch (err) {
|
|
202
202
|
} finally {
|
|
@@ -219,7 +219,7 @@ var useGetProductCategories = () => {
|
|
|
219
219
|
const fetchData = async () => {
|
|
220
220
|
try {
|
|
221
221
|
setIsLoading(true);
|
|
222
|
-
const result = await
|
|
222
|
+
const result = await chunk5BT3MH4A_cjs.getProductCategories("/store/categories");
|
|
223
223
|
setData(result || []);
|
|
224
224
|
} catch (err) {
|
|
225
225
|
setError(err);
|
|
@@ -264,7 +264,7 @@ var useWishlist = () => {
|
|
|
264
264
|
const fetchData = react.useCallback(async () => {
|
|
265
265
|
try {
|
|
266
266
|
setIsLoading(true);
|
|
267
|
-
const response = await
|
|
267
|
+
const response = await chunk5BT3MH4A_cjs.getWishlist("/customer/wishlist/");
|
|
268
268
|
if (response.data) setData(response.data);
|
|
269
269
|
setError(null);
|
|
270
270
|
} catch (err) {
|
|
@@ -322,7 +322,7 @@ function useCheckoutPayment(options) {
|
|
|
322
322
|
const [isConfirmingPayment, setIsConfirmingPayment] = react.useState(false);
|
|
323
323
|
const [showSuccessModal, setShowSuccessModal] = react.useState(false);
|
|
324
324
|
const [showFailureModal, setShowFailureModal] = react.useState(false);
|
|
325
|
-
const resetCartCount =
|
|
325
|
+
const resetCartCount = chunkIWYO22XV_cjs.useCartStore((s) => s.resetCartCount);
|
|
326
326
|
const callbacks = {
|
|
327
327
|
onSuccess: (order) => {
|
|
328
328
|
setOrderSummary(order);
|
|
@@ -345,7 +345,7 @@ function useCheckoutPayment(options) {
|
|
|
345
345
|
try {
|
|
346
346
|
setIsPlacingOrder(true);
|
|
347
347
|
const isCod = paymentMethod === "cod";
|
|
348
|
-
const response = await
|
|
348
|
+
const response = await chunkRNGQUWQW_cjs.placeOrder(
|
|
349
349
|
addressId,
|
|
350
350
|
options.phonepeRedirectUrl,
|
|
351
351
|
isCod,
|
|
@@ -355,7 +355,7 @@ function useCheckoutPayment(options) {
|
|
|
355
355
|
);
|
|
356
356
|
const order = response.data;
|
|
357
357
|
setOrderSummary(order);
|
|
358
|
-
|
|
358
|
+
chunkKWYFA2LJ_cjs.processPayment(order, paymentMethod, callbacks);
|
|
359
359
|
} catch {
|
|
360
360
|
setShowFailureModal(true);
|
|
361
361
|
} finally {
|
|
@@ -385,7 +385,7 @@ function useCheckoutCoupon(options) {
|
|
|
385
385
|
const refreshCoupons = react.useCallback(async () => {
|
|
386
386
|
setIsLoading(true);
|
|
387
387
|
try {
|
|
388
|
-
const coupons = await
|
|
388
|
+
const coupons = await chunkKWYFA2LJ_cjs.fetchAvailableCoupons();
|
|
389
389
|
setAvailableCoupons(coupons);
|
|
390
390
|
} catch {
|
|
391
391
|
} finally {
|
|
@@ -397,7 +397,7 @@ function useCheckoutCoupon(options) {
|
|
|
397
397
|
setError(null);
|
|
398
398
|
setIsApplying(true);
|
|
399
399
|
try {
|
|
400
|
-
const coupon = await
|
|
400
|
+
const coupon = await chunkKWYFA2LJ_cjs.applyCheckoutCoupon(code, callbacks);
|
|
401
401
|
setAppliedCoupon(coupon);
|
|
402
402
|
} catch (err) {
|
|
403
403
|
setError(err instanceof Error ? err.message : "Failed to apply coupon");
|
|
@@ -410,7 +410,7 @@ function useCheckoutCoupon(options) {
|
|
|
410
410
|
const removeCouponHandler = react.useCallback(async () => {
|
|
411
411
|
if (!appliedCoupon) return;
|
|
412
412
|
try {
|
|
413
|
-
await
|
|
413
|
+
await chunkKWYFA2LJ_cjs.removeCheckoutCoupon(appliedCoupon.coupon_code, callbacks);
|
|
414
414
|
setAppliedCoupon(null);
|
|
415
415
|
setError(null);
|
|
416
416
|
} catch {
|
|
@@ -509,8 +509,8 @@ function useVariantSelector(options) {
|
|
|
509
509
|
}
|
|
510
510
|
function useShopCheckout(options) {
|
|
511
511
|
const { product, onNavigateToCart, onToast } = options;
|
|
512
|
-
const { addToCart, setCart } =
|
|
513
|
-
const isUserAuthenticated =
|
|
512
|
+
const { addToCart, setCart } = chunkIWYO22XV_cjs.useCartStore();
|
|
513
|
+
const isUserAuthenticated = chunkIWYO22XV_cjs.useAuthStore((s) => s.isAuthenticated);
|
|
514
514
|
const [isWishlisted, setIsWishlisted] = react.useState(product.is_wishlisted);
|
|
515
515
|
const [isAddedToCart, setIsAddedToCart] = react.useState(false);
|
|
516
516
|
const [loading, setLoading] = react.useState(false);
|
|
@@ -521,7 +521,7 @@ function useShopCheckout(options) {
|
|
|
521
521
|
react.useEffect(() => {
|
|
522
522
|
const fetchCategories = async () => {
|
|
523
523
|
try {
|
|
524
|
-
const response = await
|
|
524
|
+
const response = await chunk5BT3MH4A_cjs.getCategories();
|
|
525
525
|
setCategories(response.data);
|
|
526
526
|
} catch (error) {
|
|
527
527
|
console.log(error);
|
|
@@ -548,8 +548,8 @@ function useShopCheckout(options) {
|
|
|
548
548
|
setLoading(false);
|
|
549
549
|
}
|
|
550
550
|
} else {
|
|
551
|
-
|
|
552
|
-
const localCartItems =
|
|
551
|
+
chunkLCMJYFHC_cjs.cart_default.add(product, quantity);
|
|
552
|
+
const localCartItems = chunkLCMJYFHC_cjs.cart_default.get();
|
|
553
553
|
if (localCartItems) {
|
|
554
554
|
setCart(localCartItems);
|
|
555
555
|
}
|
|
@@ -594,8 +594,8 @@ function useShopCheckout(options) {
|
|
|
594
594
|
setLoading(false);
|
|
595
595
|
}
|
|
596
596
|
} else {
|
|
597
|
-
|
|
598
|
-
const localCartItems =
|
|
597
|
+
chunkLCMJYFHC_cjs.cart_default.add(product, quantity);
|
|
598
|
+
const localCartItems = chunkLCMJYFHC_cjs.cart_default.get();
|
|
599
599
|
if (localCartItems) {
|
|
600
600
|
setCart(localCartItems);
|
|
601
601
|
}
|
|
@@ -635,7 +635,7 @@ function useShopCheckout(options) {
|
|
|
635
635
|
const handleNotifyMeFormSubmit = react.useCallback(
|
|
636
636
|
async (values) => {
|
|
637
637
|
try {
|
|
638
|
-
const response = await
|
|
638
|
+
const response = await chunk5BT3MH4A_cjs.notifyProductStock({
|
|
639
639
|
...values,
|
|
640
640
|
variant_slug: product.slug
|
|
641
641
|
});
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getUserDetails } from '../chunk-WYXT5AAG.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-
|
|
5
|
-
import { cart_default } from '../chunk-
|
|
6
|
-
import { processPayment, fetchAvailableCoupons, applyCheckoutCoupon, removeCheckoutCoupon } from '../chunk-
|
|
3
|
+
import { useCartStore, useAuthStore } from '../chunk-6QHEH5XE.js';
|
|
4
|
+
import { getCart, getProductList, getProductDetail, getWishlist, notifyProductStock, getProductCategories, getCategories } from '../chunk-TY5NK7NW.js';
|
|
5
|
+
import { cart_default } from '../chunk-H32TICAM.js';
|
|
6
|
+
import { processPayment, fetchAvailableCoupons, applyCheckoutCoupon, removeCheckoutCoupon } from '../chunk-5JD6MRVS.js';
|
|
7
7
|
import { applyCoupon, removeCoupon, getCoupons, getAppliedCoupon } from '../chunk-7M5CVYZJ.js';
|
|
8
8
|
import '../chunk-WFDKKOO7.js';
|
|
9
|
-
import { getOrders, placeOrder } from '../chunk-
|
|
9
|
+
import { getOrders, placeOrder } from '../chunk-CHRTGR3G.js';
|
|
10
10
|
export { useAddressForm } from '../chunk-ICKTXS6B.js';
|
|
11
11
|
import { getAddresses } from '../chunk-ZGMLOLTC.js';
|
|
12
12
|
import '../chunk-OSM73ETC.js';
|
|
@@ -546,7 +546,7 @@ function useShopCheckout(options) {
|
|
|
546
546
|
setLoading(false);
|
|
547
547
|
}
|
|
548
548
|
} else {
|
|
549
|
-
cart_default.add(product);
|
|
549
|
+
cart_default.add(product, quantity);
|
|
550
550
|
const localCartItems = cart_default.get();
|
|
551
551
|
if (localCartItems) {
|
|
552
552
|
setCart(localCartItems);
|
|
@@ -592,7 +592,7 @@ function useShopCheckout(options) {
|
|
|
592
592
|
setLoading(false);
|
|
593
593
|
}
|
|
594
594
|
} else {
|
|
595
|
-
cart_default.add(product);
|
|
595
|
+
cart_default.add(product, quantity);
|
|
596
596
|
const localCartItems = cart_default.get();
|
|
597
597
|
if (localCartItems) {
|
|
598
598
|
setCart(localCartItems);
|
|
@@ -116,4 +116,31 @@ declare namespace Blog {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
declare namespace Instagram {
|
|
120
|
+
type MediaType = "IMAGE" | "VIDEO" | "CAROUSEL_ALBUM";
|
|
121
|
+
interface MediaChild {
|
|
122
|
+
id: string;
|
|
123
|
+
media_type?: MediaType;
|
|
124
|
+
media_url?: string;
|
|
125
|
+
thumbnail_url?: string;
|
|
126
|
+
}
|
|
127
|
+
interface Media {
|
|
128
|
+
id: string;
|
|
129
|
+
caption?: string;
|
|
130
|
+
media_type: MediaType;
|
|
131
|
+
media_url?: string;
|
|
132
|
+
permalink?: string;
|
|
133
|
+
thumbnail_url?: string;
|
|
134
|
+
timestamp?: string;
|
|
135
|
+
like_count?: number;
|
|
136
|
+
comments_count?: number;
|
|
137
|
+
children?: {
|
|
138
|
+
data?: MediaChild[];
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
interface MediaRefreshResponse {
|
|
142
|
+
data: Media[];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { Analytics as A, Blog as B, Instagram as I, Review as R, type Booking as a, type BookingDetails as b };
|
|
@@ -116,4 +116,31 @@ declare namespace Blog {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
declare namespace Instagram {
|
|
120
|
+
type MediaType = "IMAGE" | "VIDEO" | "CAROUSEL_ALBUM";
|
|
121
|
+
interface MediaChild {
|
|
122
|
+
id: string;
|
|
123
|
+
media_type?: MediaType;
|
|
124
|
+
media_url?: string;
|
|
125
|
+
thumbnail_url?: string;
|
|
126
|
+
}
|
|
127
|
+
interface Media {
|
|
128
|
+
id: string;
|
|
129
|
+
caption?: string;
|
|
130
|
+
media_type: MediaType;
|
|
131
|
+
media_url?: string;
|
|
132
|
+
permalink?: string;
|
|
133
|
+
thumbnail_url?: string;
|
|
134
|
+
timestamp?: string;
|
|
135
|
+
like_count?: number;
|
|
136
|
+
comments_count?: number;
|
|
137
|
+
children?: {
|
|
138
|
+
data?: MediaChild[];
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
interface MediaRefreshResponse {
|
|
142
|
+
data: Media[];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { Analytics as A, Blog as B, Instagram as I, Review as R, type Booking as a, type BookingDetails as b };
|
package/dist/models/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { A as Address } from '../address-DwBZHzbI.cjs';
|
|
2
|
-
export { A as Analytics, B as Blog, a as Booking, b as BookingDetails, R as Review } from '../
|
|
2
|
+
export { A as Analytics, B as Blog, a as Booking, b as BookingDetails, I as Instagram, R as Review } from '../instagram-D4JUT4ZU.cjs';
|
|
3
3
|
export { A as ApplicableTarget, C as Cart, a as CartState, b as Category, c as Coupon, d as CouponResponse, e as CouponStatus, f as Coupons, D as DiscountType, U as User, V as ValueType } from '../cart-CyN2JQTw.cjs';
|
|
4
4
|
export { A as CollectionAttributes, C as CollectionResponse, s as singleCollection } from '../collections-8YdINtUf.cjs';
|
|
5
5
|
export { O as Order } from '../orders-9_scVq_M.cjs';
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { A as Address } from '../address-DwBZHzbI.js';
|
|
2
|
-
export { A as Analytics, B as Blog, a as Booking, b as BookingDetails, R as Review } from '../
|
|
2
|
+
export { A as Analytics, B as Blog, a as Booking, b as BookingDetails, I as Instagram, R as Review } from '../instagram-CqJBZ-0X.js';
|
|
3
3
|
export { A as ApplicableTarget, C as Cart, a as CartState, b as Category, c as Coupon, d as CouponResponse, e as CouponStatus, f as Coupons, D as DiscountType, U as User, V as ValueType } from '../cart-BGIsIZdM.js';
|
|
4
4
|
export { A as CollectionAttributes, C as CollectionResponse, s as singleCollection } from '../collections-ycrA2cPL.js';
|
|
5
5
|
export { O as Order } from '../orders-C1XZr8tx.js';
|