@storepecker/storefront-core 2.5.2 → 2.5.4
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 +74 -45
- package/dist/api/index.d.cts +33 -7
- package/dist/api/index.d.ts +33 -7
- package/dist/api/index.js +25 -4
- package/dist/{cart-DV1HcSC6.d.ts → cart-BGIsIZdM.d.ts} +1 -1
- package/dist/{cart-lJvJzaoH.d.cts → cart-CyN2JQTw.d.cts} +1 -1
- package/dist/checkout/index.cjs +23 -23
- package/dist/checkout/index.d.cts +3 -3
- package/dist/checkout/index.d.ts +3 -3
- package/dist/checkout/index.js +3 -3
- package/dist/{chunk-PARH5TBK.cjs → chunk-5BT3MH4A.cjs} +3 -3
- package/dist/{chunk-EGFOTJPC.js → chunk-5XVHYPOC.js} +1 -1
- package/dist/{chunk-OTMTHA5C.cjs → chunk-6LS5F4R3.cjs} +80 -0
- package/dist/{chunk-F45S7UWC.js → chunk-CBKJ3Y2I.js} +80 -1
- package/dist/{chunk-QAC72HKO.js → chunk-H32TICAM.js} +14 -13
- package/dist/{chunk-6Q7QMPOQ.js → chunk-ICKTXS6B.js} +1 -1
- package/dist/{chunk-HAQWCNDY.cjs → chunk-IG4BW3ZB.cjs} +3 -3
- package/dist/{chunk-KLNKIQQM.cjs → chunk-IVKJJLG7.cjs} +2 -2
- package/dist/{chunk-SMHJRNCR.cjs → chunk-LCMJYFHC.cjs} +14 -13
- package/dist/{chunk-DXQX7ZIL.cjs → chunk-LZADKC4Y.cjs} +6 -0
- package/dist/{chunk-S3ZZ3ZA7.js → chunk-ME6Z7TZW.js} +6 -1
- package/dist/{chunk-P252YNRA.js → chunk-PGBYYKFQ.js} +6 -6
- package/dist/{chunk-PZJT2Y5B.cjs → chunk-QSHOJ3NJ.cjs} +7 -7
- package/dist/{chunk-CUR7CHR5.js → chunk-TY5NK7NW.js} +1 -1
- package/dist/{chunk-NXQIWB36.js → chunk-VYHAWRJR.js} +2 -2
- package/dist/{chunk-L43KF3AC.js → chunk-W6BDMNSU.js} +1 -1
- package/dist/{chunk-B3BXKMQA.cjs → chunk-YLLAP3H2.cjs} +2 -2
- package/dist/{chunk-FU46MZTI.cjs → chunk-ZQOESVVE.cjs} +23 -23
- package/dist/{collections-fGX_D_Mi.d.cts → collections-8YdINtUf.d.cts} +1 -1
- package/dist/{collections-kERS_kZw.d.ts → collections-ycrA2cPL.d.ts} +1 -1
- package/dist/components/address-form.cjs +5 -4
- package/dist/components/address-form.js +4 -3
- package/dist/components/digital-product-download-modal.d.cts +2 -2
- package/dist/components/digital-product-download-modal.d.ts +2 -2
- package/dist/components/index.cjs +7 -7
- package/dist/components/index.d.cts +5 -5
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.js +5 -5
- package/dist/components/share-button.cjs +4 -3
- package/dist/components/share-button.d.cts +1 -1
- package/dist/components/share-button.d.ts +1 -1
- package/dist/components/share-button.js +3 -2
- package/dist/components/theme-data-initializer.d.cts +5 -5
- package/dist/components/theme-data-initializer.d.ts +5 -5
- package/dist/hooks/index.cjs +34 -33
- package/dist/hooks/index.d.cts +6 -6
- package/dist/hooks/index.d.ts +6 -6
- package/dist/hooks/index.js +14 -13
- package/dist/{booking-Bpj3o6Av.d.cts → instagram-CqJBZ-0X.d.ts} +56 -2
- package/dist/{booking-cbb8kh2L.d.ts → instagram-D4JUT4ZU.d.cts} +56 -2
- package/dist/models/index.d.cts +6 -6
- package/dist/models/index.d.ts +6 -6
- package/dist/{orders--jclZ94W.d.cts → orders-9_scVq_M.d.cts} +7 -2
- package/dist/{orders-D1fVTlCj.d.ts → orders-C1XZr8tx.d.ts} +7 -2
- package/dist/{pixelEvents-BhKaV1r5.d.ts → pixelEvents-D0sH22Er.d.ts} +14 -7
- package/dist/{pixelEvents-CdYQsgEH.d.cts → pixelEvents-uiPHbiAQ.d.cts} +14 -7
- package/dist/{product-B8elBN21.d.ts → product-CZtFWhxO.d.cts} +3 -0
- package/dist/{product-B8elBN21.d.cts → product-CZtFWhxO.d.ts} +3 -0
- package/dist/store/index.cjs +9 -9
- package/dist/store/index.d.cts +7 -7
- package/dist/store/index.d.ts +7 -7
- package/dist/store/index.js +4 -4
- package/dist/utils/index.cjs +31 -27
- package/dist/utils/index.d.cts +13 -9
- package/dist/utils/index.d.ts +13 -9
- package/dist/utils/index.js +4 -4
- package/dist/{wishlist-B-bvvOxv.d.ts → wishlist-CRNbfFIx.d.ts} +1 -1
- package/dist/{wishlist-BdpIFX5_.d.cts → wishlist-Cx9Vrszq.d.cts} +1 -1
- package/package.json +1 -1
package/dist/checkout/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { applyCheckoutCoupon, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, openRazorpayCheckout, processPayment, removeCheckoutCoupon } from '../chunk-
|
|
1
|
+
export { applyCheckoutCoupon, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, openRazorpayCheckout, processPayment, removeCheckoutCoupon } from '../chunk-VYHAWRJR.js';
|
|
2
2
|
import '../chunk-7M5CVYZJ.js';
|
|
3
3
|
import { pixelEvents } from '../chunk-WFDKKOO7.js';
|
|
4
|
-
import { checkPhonepePaymentStatus, getOrderDetailsByNumber, getStripePaymentStatusPublic, getStripePaymentStatus, verifyTabbyPayment } from '../chunk-
|
|
4
|
+
import { checkPhonepePaymentStatus, getOrderDetailsByNumber, getStripePaymentStatusPublic, getStripePaymentStatus, verifyTabbyPayment } from '../chunk-ME6Z7TZW.js';
|
|
5
5
|
export { IP_API_CACHE_KEY, addressFormInitialValues, addressValidationSchema, buildAddressPayload, buildSubmitPayload, clearAddressFormSession, decodeAddress, encodeAddress, isValidPhoneNumber, loadAddressFormFromSession, parseEditAddress, sanitizePhoneNumber, saveAddressFormToSession } from '../chunk-ELP23UGF.js';
|
|
6
6
|
import '../chunk-3SYYP3XV.js';
|
|
7
7
|
import '../chunk-WEMNXIRS.js';
|
|
@@ -102,7 +102,7 @@ async function checkStripeReturnStatus(sessionId, orderNumber, paymentLinkUrl, c
|
|
|
102
102
|
async function checkTabbyReturnStatus(orderNumber, callbacks) {
|
|
103
103
|
try {
|
|
104
104
|
const response = await verifyTabbyPayment(orderNumber);
|
|
105
|
-
if (response.data.order_status === "paid" || response.data.order_status === "confirmed") {
|
|
105
|
+
if (response.data.order_status === "paid" || response.data.order_status === "confirmed" || response.data.status === "paid") {
|
|
106
106
|
try {
|
|
107
107
|
const orderResponse = await getOrderDetailsByNumber(orderNumber);
|
|
108
108
|
const order = orderResponse.data;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLCMJYFHC_cjs = require('./chunk-LCMJYFHC.cjs');
|
|
4
4
|
var chunkECHV2JSY_cjs = require('./chunk-ECHV2JSY.cjs');
|
|
5
5
|
var chunkBBRXE57K_cjs = require('./chunk-BBRXE57K.cjs');
|
|
6
6
|
|
|
7
7
|
// src/api/cart.ts
|
|
8
8
|
async function getCart(url, addressId, shippingOptionId) {
|
|
9
|
-
const localCart =
|
|
9
|
+
const localCart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
10
10
|
return chunkBBRXE57K_cjs.auth_default.getUserDetails() ? (await chunkECHV2JSY_cjs.http_service_default.get(url, { params: { address_id: addressId, shipping_option_id: shippingOptionId } })).data : localCart || {
|
|
11
11
|
product_variants: [],
|
|
12
12
|
total_amount: 0,
|
|
@@ -28,7 +28,7 @@ async function getCart(url, addressId, shippingOptionId) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
async function getCartItemQuantity() {
|
|
31
|
-
const localCart =
|
|
31
|
+
const localCart = chunkLCMJYFHC_cjs.cart_default.get();
|
|
32
32
|
return chunkBBRXE57K_cjs.auth_default.getUserDetails() ? (await chunkECHV2JSY_cjs.http_service_default.get("/customer/cart/quantity/")).data : { total_quantity: localCart?.total_quantity || 0 };
|
|
33
33
|
}
|
|
34
34
|
async function addToCart(product, customizationInputs) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkBBRB475I_cjs = require('./chunk-BBRB475I.cjs');
|
|
4
|
+
|
|
3
5
|
// src/utils/misc.ts
|
|
4
6
|
function convertObjectToParams(params) {
|
|
5
7
|
const cleanedParams = Object.fromEntries(
|
|
@@ -149,6 +151,83 @@ async function getAddressMeta(countryCode) {
|
|
|
149
151
|
hasPostal: !!data.zip_name_type
|
|
150
152
|
};
|
|
151
153
|
}
|
|
154
|
+
function getOrderStatus(order) {
|
|
155
|
+
switch (order.order_status) {
|
|
156
|
+
case "pending":
|
|
157
|
+
return {
|
|
158
|
+
title: "Order yet to confirm by the seller",
|
|
159
|
+
info: "We are waiting for the seller to confirm your order. This usually takes less than 24 hours."
|
|
160
|
+
};
|
|
161
|
+
case "confirmed":
|
|
162
|
+
return {
|
|
163
|
+
title: "Order confirmed",
|
|
164
|
+
info: "Your order has been confirmed and is being processed. You will receive a notification once it is dispatched."
|
|
165
|
+
};
|
|
166
|
+
case "packed":
|
|
167
|
+
return {
|
|
168
|
+
title: "Order packed",
|
|
169
|
+
info: "Your order has been packed and is ready for dispatch. You will receive a notification once it is shipped."
|
|
170
|
+
};
|
|
171
|
+
case "shipped":
|
|
172
|
+
return {
|
|
173
|
+
title: order.delivered_at ? `Arriving by ${formatDateTime(order.delivered_at)}` : "Order shipped",
|
|
174
|
+
info: `Your order has been shipped and is on its way to you. ${order.tracking_id ? `Track your order using ${order.tracking_id}` : ""}`
|
|
175
|
+
};
|
|
176
|
+
case "delivered":
|
|
177
|
+
if (!order.delivered_at) {
|
|
178
|
+
return {
|
|
179
|
+
title: "Delivered"
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
const deliveredDate = new Date(order.delivered_at);
|
|
183
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
184
|
+
const diffTime = currentDate.getTime() - deliveredDate.getTime();
|
|
185
|
+
const difference = Math.floor(diffTime / (1e3 * 60 * 60 * 24));
|
|
186
|
+
if (difference < 3) {
|
|
187
|
+
return {
|
|
188
|
+
title: `Delivered ${chunkBBRB475I_cjs.timeFromNow(order.delivered_at)}`
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
title: `Delivered on ${formatDateTime(order.delivered_at)}`
|
|
193
|
+
};
|
|
194
|
+
case "failed":
|
|
195
|
+
return {
|
|
196
|
+
title: "Order failed",
|
|
197
|
+
info: "Your order has failed. If you have any queries, please contact customer support"
|
|
198
|
+
};
|
|
199
|
+
case "cancelled":
|
|
200
|
+
return {
|
|
201
|
+
title: "Cancelled",
|
|
202
|
+
info: "Your order has been cancelled. If you have any queries, please contact customer support"
|
|
203
|
+
};
|
|
204
|
+
case "paid":
|
|
205
|
+
return {
|
|
206
|
+
title: "Order placed, Thank you",
|
|
207
|
+
info: "Your order has been placed successfully. Order status will be updated soon."
|
|
208
|
+
};
|
|
209
|
+
case "payment_pending":
|
|
210
|
+
return {
|
|
211
|
+
title: "Payment pending",
|
|
212
|
+
info: "Your order has not been placed. Please retry your payment to proceed."
|
|
213
|
+
};
|
|
214
|
+
case "refunded":
|
|
215
|
+
return {
|
|
216
|
+
title: "Refunded",
|
|
217
|
+
info: "Your order has been refunded. If you have any queries, please contact customer support."
|
|
218
|
+
};
|
|
219
|
+
case "returned":
|
|
220
|
+
return {
|
|
221
|
+
title: "Returned",
|
|
222
|
+
info: "Your order has been returned. If you have any queries, please contact customer support."
|
|
223
|
+
};
|
|
224
|
+
default:
|
|
225
|
+
return {
|
|
226
|
+
title: "Purchase successful",
|
|
227
|
+
info: "Your order has been placed successfully. Order status will be updated soon."
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
}
|
|
152
231
|
|
|
153
232
|
exports.constructFilter = constructFilter;
|
|
154
233
|
exports.convertObjectToParams = convertObjectToParams;
|
|
@@ -158,6 +237,7 @@ exports.formatDateTime = formatDateTime;
|
|
|
158
237
|
exports.formatPostalLabel = formatPostalLabel;
|
|
159
238
|
exports.getAddressMeta = getAddressMeta;
|
|
160
239
|
exports.getDelayInMilliseconds = getDelayInMilliseconds;
|
|
240
|
+
exports.getOrderStatus = getOrderStatus;
|
|
161
241
|
exports.getParamsFromURL = getParamsFromURL;
|
|
162
242
|
exports.getQueryParams = getQueryParams;
|
|
163
243
|
exports.pluralize = pluralize;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { timeFromNow } from './chunk-HSF2D56O.js';
|
|
2
|
+
|
|
1
3
|
// src/utils/misc.ts
|
|
2
4
|
function convertObjectToParams(params) {
|
|
3
5
|
const cleanedParams = Object.fromEntries(
|
|
@@ -147,5 +149,82 @@ async function getAddressMeta(countryCode) {
|
|
|
147
149
|
hasPostal: !!data.zip_name_type
|
|
148
150
|
};
|
|
149
151
|
}
|
|
152
|
+
function getOrderStatus(order) {
|
|
153
|
+
switch (order.order_status) {
|
|
154
|
+
case "pending":
|
|
155
|
+
return {
|
|
156
|
+
title: "Order yet to confirm by the seller",
|
|
157
|
+
info: "We are waiting for the seller to confirm your order. This usually takes less than 24 hours."
|
|
158
|
+
};
|
|
159
|
+
case "confirmed":
|
|
160
|
+
return {
|
|
161
|
+
title: "Order confirmed",
|
|
162
|
+
info: "Your order has been confirmed and is being processed. You will receive a notification once it is dispatched."
|
|
163
|
+
};
|
|
164
|
+
case "packed":
|
|
165
|
+
return {
|
|
166
|
+
title: "Order packed",
|
|
167
|
+
info: "Your order has been packed and is ready for dispatch. You will receive a notification once it is shipped."
|
|
168
|
+
};
|
|
169
|
+
case "shipped":
|
|
170
|
+
return {
|
|
171
|
+
title: order.delivered_at ? `Arriving by ${formatDateTime(order.delivered_at)}` : "Order shipped",
|
|
172
|
+
info: `Your order has been shipped and is on its way to you. ${order.tracking_id ? `Track your order using ${order.tracking_id}` : ""}`
|
|
173
|
+
};
|
|
174
|
+
case "delivered":
|
|
175
|
+
if (!order.delivered_at) {
|
|
176
|
+
return {
|
|
177
|
+
title: "Delivered"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
const deliveredDate = new Date(order.delivered_at);
|
|
181
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
182
|
+
const diffTime = currentDate.getTime() - deliveredDate.getTime();
|
|
183
|
+
const difference = Math.floor(diffTime / (1e3 * 60 * 60 * 24));
|
|
184
|
+
if (difference < 3) {
|
|
185
|
+
return {
|
|
186
|
+
title: `Delivered ${timeFromNow(order.delivered_at)}`
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
title: `Delivered on ${formatDateTime(order.delivered_at)}`
|
|
191
|
+
};
|
|
192
|
+
case "failed":
|
|
193
|
+
return {
|
|
194
|
+
title: "Order failed",
|
|
195
|
+
info: "Your order has failed. If you have any queries, please contact customer support"
|
|
196
|
+
};
|
|
197
|
+
case "cancelled":
|
|
198
|
+
return {
|
|
199
|
+
title: "Cancelled",
|
|
200
|
+
info: "Your order has been cancelled. If you have any queries, please contact customer support"
|
|
201
|
+
};
|
|
202
|
+
case "paid":
|
|
203
|
+
return {
|
|
204
|
+
title: "Order placed, Thank you",
|
|
205
|
+
info: "Your order has been placed successfully. Order status will be updated soon."
|
|
206
|
+
};
|
|
207
|
+
case "payment_pending":
|
|
208
|
+
return {
|
|
209
|
+
title: "Payment pending",
|
|
210
|
+
info: "Your order has not been placed. Please retry your payment to proceed."
|
|
211
|
+
};
|
|
212
|
+
case "refunded":
|
|
213
|
+
return {
|
|
214
|
+
title: "Refunded",
|
|
215
|
+
info: "Your order has been refunded. If you have any queries, please contact customer support."
|
|
216
|
+
};
|
|
217
|
+
case "returned":
|
|
218
|
+
return {
|
|
219
|
+
title: "Returned",
|
|
220
|
+
info: "Your order has been returned. If you have any queries, please contact customer support."
|
|
221
|
+
};
|
|
222
|
+
default:
|
|
223
|
+
return {
|
|
224
|
+
title: "Purchase successful",
|
|
225
|
+
info: "Your order has been placed successfully. Order status will be updated soon."
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
150
229
|
|
|
151
|
-
export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink };
|
|
230
|
+
export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getOrderStatus, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink };
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { updateAddress, addAddress, getCountries, getSubdivisions } from './chunk-ZGMLOLTC.js';
|
|
2
2
|
import { getCache } from './chunk-OSM73ETC.js';
|
|
3
|
-
import { getAddressMeta } from './chunk-
|
|
3
|
+
import { getAddressMeta } from './chunk-CBKJ3Y2I.js';
|
|
4
4
|
import { addressFormInitialValues, IP_API_CACHE_KEY, addressValidationSchema, buildSubmitPayload } from './chunk-ELP23UGF.js';
|
|
5
5
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
6
6
|
import { useFormik } from 'formik';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk3YRSHPM6_cjs = require('./chunk-3YRSHPM6.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk6LS5F4R3_cjs = require('./chunk-6LS5F4R3.cjs');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
7
|
var ShareButton = ({
|
|
@@ -10,8 +10,8 @@ var ShareButton = ({
|
|
|
10
10
|
iconSize = 22
|
|
11
11
|
}) => {
|
|
12
12
|
const _handleShare = () => {
|
|
13
|
-
|
|
14
|
-
`Buy ${product.name} at ${
|
|
13
|
+
chunk6LS5F4R3_cjs.shareLink(
|
|
14
|
+
`Buy ${product.name} at ${chunk6LS5F4R3_cjs.convertToCurrency(
|
|
15
15
|
Number(product.selling_price)
|
|
16
16
|
)}`,
|
|
17
17
|
product.name
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkRDUT4W3B_cjs = require('./chunk-RDUT4W3B.cjs');
|
|
4
4
|
var chunkLJUGNSQQ_cjs = require('./chunk-LJUGNSQQ.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk6LS5F4R3_cjs = require('./chunk-6LS5F4R3.cjs');
|
|
6
6
|
var chunkTB72NPRM_cjs = require('./chunk-TB72NPRM.cjs');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var formik = require('formik');
|
|
@@ -97,7 +97,7 @@ function useAddressForm(options = {}) {
|
|
|
97
97
|
};
|
|
98
98
|
const fetchAddressMeta = async () => {
|
|
99
99
|
try {
|
|
100
|
-
const response = await
|
|
100
|
+
const response = await chunk6LS5F4R3_cjs.getAddressMeta(
|
|
101
101
|
selectedCountry.tld_code
|
|
102
102
|
);
|
|
103
103
|
setAddressMeta(response);
|
|
@@ -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) {
|
|
@@ -32,6 +32,11 @@ async function getPublicOrderDetailsByNumber(orderNumber) {
|
|
|
32
32
|
params: { order_number: orderNumber }
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
async function getPublicOrderDetailsByRef(orderRef) {
|
|
36
|
+
return chunkECHV2JSY_cjs.http_service_default.get("/customer/public_order/", {
|
|
37
|
+
params: { order_ref: orderRef }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
35
40
|
async function placeOrder(address_id, redirect, isCod, shipping_option_id, stripeRedirect, tabbyRedirect) {
|
|
36
41
|
return chunkECHV2JSY_cjs.http_service_default.post("/customer/order/", {
|
|
37
42
|
address_id,
|
|
@@ -126,6 +131,7 @@ exports.getOrderDetailsByRef = getOrderDetailsByRef;
|
|
|
126
131
|
exports.getOrderDetailsByRefV2 = getOrderDetailsByRefV2;
|
|
127
132
|
exports.getOrders = getOrders;
|
|
128
133
|
exports.getPublicOrderDetailsByNumber = getPublicOrderDetailsByNumber;
|
|
134
|
+
exports.getPublicOrderDetailsByRef = getPublicOrderDetailsByRef;
|
|
129
135
|
exports.getStripePaymentStatus = getStripePaymentStatus;
|
|
130
136
|
exports.getStripePaymentStatusPublic = getStripePaymentStatusPublic;
|
|
131
137
|
exports.makeCODOrder = makeCODOrder;
|
|
@@ -30,6 +30,11 @@ async function getPublicOrderDetailsByNumber(orderNumber) {
|
|
|
30
30
|
params: { order_number: orderNumber }
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
async function getPublicOrderDetailsByRef(orderRef) {
|
|
34
|
+
return http_service_default.get("/customer/public_order/", {
|
|
35
|
+
params: { order_ref: orderRef }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
33
38
|
async function placeOrder(address_id, redirect, isCod, shipping_option_id, stripeRedirect, tabbyRedirect) {
|
|
34
39
|
return http_service_default.post("/customer/order/", {
|
|
35
40
|
address_id,
|
|
@@ -117,4 +122,4 @@ async function verifyTabbyPayment(orderNumber) {
|
|
|
117
122
|
});
|
|
118
123
|
}
|
|
119
124
|
|
|
120
|
-
export { checkPhonepePaymentStatus, getOrderDetails, getOrderDetailsByNumber, getOrderDetailsByRef, getOrderDetailsByRefV2, getOrders, getPublicOrderDetailsByNumber, getStripePaymentStatus, getStripePaymentStatusPublic, makeCODOrder, phonepeOrderSuccess, phonepePublicOrderSuccess, placeOrder, publicMakeCODOrder, publicPlaceOrder, razorpayOrderFail, razorpayOrderSuccess, razorpayPublicOrderSuccess, stripeOrderFail, stripeOrderSuccess, stripePublicOrderSuccess, updateOrder, updateOrderCustomization, uploadCustomizationImage, verifyTabbyPayment };
|
|
125
|
+
export { checkPhonepePaymentStatus, getOrderDetails, getOrderDetailsByNumber, getOrderDetailsByRef, getOrderDetailsByRefV2, getOrders, getPublicOrderDetailsByNumber, getPublicOrderDetailsByRef, getStripePaymentStatus, getStripePaymentStatusPublic, makeCODOrder, phonepeOrderSuccess, phonepePublicOrderSuccess, placeOrder, publicMakeCODOrder, publicPlaceOrder, razorpayOrderFail, razorpayOrderSuccess, razorpayPublicOrderSuccess, stripeOrderFail, stripeOrderSuccess, stripePublicOrderSuccess, updateOrder, updateOrderCustomization, uploadCustomizationImage, verifyTabbyPayment };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { updateCart, removeFromCart, addToCart, getCart, getCartItemQuantity } from './chunk-
|
|
2
|
-
import { cart_default } from './chunk-
|
|
3
|
-
import { updateOrderCustomization } from './chunk-
|
|
1
|
+
import { updateCart, removeFromCart, addToCart, getCart, getCartItemQuantity } from './chunk-TY5NK7NW.js';
|
|
2
|
+
import { cart_default } from './chunk-H32TICAM.js';
|
|
3
|
+
import { updateOrderCustomization } from './chunk-ME6Z7TZW.js';
|
|
4
4
|
import { auth_default } from './chunk-WEMNXIRS.js';
|
|
5
5
|
import { USER_CRED_TOKEN, USER_CREDENTIALS } from './chunk-BQ256JKN.js';
|
|
6
6
|
import { create } from 'zustand';
|
|
@@ -19,12 +19,12 @@ var useCartStore = create((set) => ({
|
|
|
19
19
|
if (!state.cart) return { ...state, total_quantity: 0 };
|
|
20
20
|
return { cart: { ...state.cart, total_quantity: 0 }, total_quantity: 0 };
|
|
21
21
|
}),
|
|
22
|
-
|
|
22
|
+
fetchCartItemQuantity: async () => {
|
|
23
23
|
try {
|
|
24
24
|
const { total_quantity } = await getCartItemQuantity();
|
|
25
25
|
set({ total_quantity });
|
|
26
26
|
} catch (error) {
|
|
27
|
-
console.error("Failed to fetch cart quantity", error);
|
|
27
|
+
console.error("Failed to fetch cart item quantity", error);
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
syncCart: async (addressId, shippingOptionId) => {
|
|
@@ -63,7 +63,7 @@ var useCartStore = create((set) => ({
|
|
|
63
63
|
(p) => p.id === item.variant_id
|
|
64
64
|
);
|
|
65
65
|
if (product) {
|
|
66
|
-
cart_default.add(product);
|
|
66
|
+
cart_default.add(product, item.quantity);
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -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 chunkLZADKC4Y_cjs = require('./chunk-LZADKC4Y.cjs');
|
|
6
6
|
var chunkN3CTXRFT_cjs = require('./chunk-N3CTXRFT.cjs');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
|
|
@@ -50,7 +50,7 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
50
50
|
},
|
|
51
51
|
prefill: {
|
|
52
52
|
name: customer_name,
|
|
53
|
-
email: customer_email,
|
|
53
|
+
email: customer_email?.endsWith("@test.com") ? void 0 : customer_email,
|
|
54
54
|
phone: customer_phone
|
|
55
55
|
},
|
|
56
56
|
modal: {
|
|
@@ -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 chunkLZADKC4Y_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 chunkLZADKC4Y_cjs.razorpayOrderFail({
|
|
86
86
|
order_id: order.id,
|
|
87
87
|
razorpay_order_id: order.razorpay_order_id,
|
|
88
88
|
error
|
|
@@ -115,9 +115,9 @@ 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 chunkLZADKC4Y_cjs.publicMakeCODOrder(order.order_number);
|
|
119
119
|
} else {
|
|
120
|
-
await
|
|
120
|
+
await chunkLZADKC4Y_cjs.makeCODOrder(order.id);
|
|
121
121
|
}
|
|
122
122
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
123
123
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
@@ -145,7 +145,7 @@ function handleStripePayment(order, callbacks) {
|
|
|
145
145
|
async function handleStripeSuccess(order, paymentIntentId, callbacks) {
|
|
146
146
|
try {
|
|
147
147
|
callbacks.onPaymentStart?.();
|
|
148
|
-
await
|
|
148
|
+
await chunkLZADKC4Y_cjs.stripeOrderSuccess({
|
|
149
149
|
order_id: order.id,
|
|
150
150
|
payment_intent_id: paymentIntentId
|
|
151
151
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCoupons, getAppliedCoupon, applyCoupon, removeCoupon } from './chunk-7M5CVYZJ.js';
|
|
2
2
|
import { pixelEvents } from './chunk-WFDKKOO7.js';
|
|
3
|
-
import { razorpayOrderSuccess, razorpayOrderFail, publicMakeCODOrder, makeCODOrder, stripeOrderSuccess } from './chunk-
|
|
3
|
+
import { razorpayOrderSuccess, razorpayOrderFail, publicMakeCODOrder, makeCODOrder, stripeOrderSuccess } from './chunk-ME6Z7TZW.js';
|
|
4
4
|
import { getCloudFront } from './chunk-JQMLHRWL.js';
|
|
5
5
|
import { AxiosError } from 'axios';
|
|
6
6
|
|
|
@@ -48,7 +48,7 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
48
48
|
},
|
|
49
49
|
prefill: {
|
|
50
50
|
name: customer_name,
|
|
51
|
-
email: customer_email,
|
|
51
|
+
email: customer_email?.endsWith("@test.com") ? void 0 : customer_email,
|
|
52
52
|
phone: customer_phone
|
|
53
53
|
},
|
|
54
54
|
modal: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { search_dropdown_default, DownChevron } from './chunk-YK4M3SFP.js';
|
|
2
|
-
import { useAddressForm } from './chunk-
|
|
2
|
+
import { useAddressForm } from './chunk-ICKTXS6B.js';
|
|
3
3
|
import { forwardRef, useImperativeHandle, useEffect } from 'react';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkV447PVRV_cjs = require('./chunk-V447PVRV.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkIVKJJLG7_cjs = require('./chunk-IVKJJLG7.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ var AddressForm = react.forwardRef(
|
|
|
34
34
|
handlePhoneChange,
|
|
35
35
|
isSubmitting,
|
|
36
36
|
isEditing
|
|
37
|
-
} =
|
|
37
|
+
} = chunkIVKJJLG7_cjs.useAddressForm({
|
|
38
38
|
address,
|
|
39
39
|
onSuccess,
|
|
40
40
|
onError,
|