@storepecker/storefront-core 2.6.3 → 2.9.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 +90 -46
- package/dist/api/index.d.cts +99 -7
- package/dist/api/index.d.ts +99 -7
- package/dist/api/index.js +3 -3
- package/dist/buy-now-B1dkx82V.d.cts +197 -0
- package/dist/buy-now-BgKd5p4J.d.ts +197 -0
- package/dist/checkout/index.cjs +78 -31
- package/dist/checkout/index.d.cts +47 -9
- package/dist/checkout/index.d.ts +47 -9
- package/dist/checkout/index.js +64 -18
- package/dist/{chunk-GTV42PDK.cjs → chunk-57UU7IJ2.cjs} +1 -0
- package/dist/{chunk-ZQOESVVE.cjs → chunk-CIBMO44U.cjs} +26 -31
- package/dist/{chunk-5BT3MH4A.cjs → chunk-ETXIP5XE.cjs} +3 -3
- package/dist/{chunk-LZADKC4Y.cjs → chunk-H6FJYRO3.cjs} +55 -3
- package/dist/{chunk-ME6Z7TZW.js → chunk-KCLVR6G5.js} +45 -4
- package/dist/{chunk-LCMJYFHC.cjs → chunk-NQZ5GUOG.cjs} +0 -1
- package/dist/{chunk-4C4NTH6O.js → chunk-OOFYY6GR.js} +1 -0
- package/dist/{chunk-PGBYYKFQ.js → chunk-SU5LVRZD.js} +9 -14
- package/dist/{chunk-QSHOJ3NJ.cjs → chunk-TFWTQTWE.cjs} +40 -19
- package/dist/{chunk-H32TICAM.js → chunk-TH7OAMGC.js} +0 -1
- package/dist/{chunk-VYHAWRJR.js → chunk-UWW5YIHL.js} +39 -18
- package/dist/{chunk-TY5NK7NW.js → chunk-YMZZCVZ2.js} +1 -1
- package/dist/components/digital-product-download-modal.d.cts +1 -1
- package/dist/components/digital-product-download-modal.d.ts +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/theme-data-initializer.d.cts +2 -2
- package/dist/components/theme-data-initializer.d.ts +2 -2
- package/dist/hooks/index.cjs +564 -29
- package/dist/hooks/index.d.cts +179 -2
- package/dist/hooks/index.d.ts +179 -2
- package/dist/hooks/index.js +541 -10
- package/dist/middleware/index.cjs +3 -3
- package/dist/middleware/index.js +1 -1
- package/dist/models/index.d.cts +2 -1
- package/dist/models/index.d.ts +2 -1
- package/dist/{orders-9_scVq_M.d.cts → orders-COKWr7K7.d.cts} +1 -0
- package/dist/{orders-C1XZr8tx.d.ts → orders-Cp8qNCrl.d.ts} +1 -0
- package/dist/{pixelEvents-D0sH22Er.d.ts → pixelEvents-2Tb-_fRP.d.ts} +2 -1
- package/dist/{pixelEvents-uiPHbiAQ.d.cts → pixelEvents-BJNH06rS.d.cts} +2 -1
- package/dist/store/index.cjs +9 -9
- package/dist/store/index.d.cts +9 -4
- package/dist/store/index.d.ts +9 -4
- package/dist/store/index.js +4 -4
- package/dist/utils/index.cjs +7 -7
- package/dist/utils/index.d.cts +4 -3
- package/dist/utils/index.d.ts +4 -3
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
|
@@ -54,12 +54,44 @@ async function publicPlaceOrder(address, redirect, orderDetails, stripeRedirect,
|
|
|
54
54
|
...orderDetails
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
async function buyNowPreview(payload) {
|
|
58
|
+
return http_service_default.post("/customer/buy_now/preview/", payload);
|
|
59
|
+
}
|
|
60
|
+
async function placeBuyNowOrder(payload) {
|
|
61
|
+
return http_service_default.post("/customer/buy_now/", payload);
|
|
62
|
+
}
|
|
63
|
+
async function placeGuestBuyNowOrder(payload) {
|
|
64
|
+
return http_service_default.post("/customer/public_order/", payload);
|
|
65
|
+
}
|
|
66
|
+
async function publicCheckoutPreview(payload) {
|
|
67
|
+
return http_service_default.post("/customer/public_order/preview/", payload);
|
|
68
|
+
}
|
|
69
|
+
async function placePublicOrder(payload) {
|
|
70
|
+
return http_service_default.post("/customer/public_order/", payload);
|
|
71
|
+
}
|
|
57
72
|
async function updateOrder(orderDetails) {
|
|
58
73
|
return http_service_default.patch("/customer/order/", orderDetails);
|
|
59
74
|
}
|
|
60
75
|
async function razorpayPublicOrderSuccess(orderDetails) {
|
|
61
76
|
return http_service_default.post("/payment/public-razorpay-order-success/", orderDetails);
|
|
62
77
|
}
|
|
78
|
+
async function publicRazorpayOrderFailure(orderDetails) {
|
|
79
|
+
return http_service_default.post("/payment/public-razorpay-order-failure/", orderDetails);
|
|
80
|
+
}
|
|
81
|
+
async function publicPhonepeOrderFailure(payload) {
|
|
82
|
+
return http_service_default.post("/payment/public-phonepe-order-failure/", payload);
|
|
83
|
+
}
|
|
84
|
+
async function phonepePaymentFailure(payload) {
|
|
85
|
+
return http_service_default.post("/payment/phonepe-order-failure/", payload);
|
|
86
|
+
}
|
|
87
|
+
async function publicStripeOrderFailure(orderDetails) {
|
|
88
|
+
return http_service_default.post("/payment/public-stripe-order-failure/", orderDetails);
|
|
89
|
+
}
|
|
90
|
+
async function tabbyPaymentFailure(paymentId) {
|
|
91
|
+
return http_service_default.post("/payment/tabby-payment-failure/", {
|
|
92
|
+
payment_id: paymentId
|
|
93
|
+
});
|
|
94
|
+
}
|
|
63
95
|
async function razorpayOrderSuccess(orderDetails) {
|
|
64
96
|
return http_service_default.post("/payment/razorpay-order-success/", orderDetails);
|
|
65
97
|
}
|
|
@@ -77,6 +109,11 @@ async function checkPhonepePaymentStatus(transactionId) {
|
|
|
77
109
|
params: { phonepe_transaction_id: transactionId }
|
|
78
110
|
});
|
|
79
111
|
}
|
|
112
|
+
async function checkPhonepePaymentStatusPublic(transactionId) {
|
|
113
|
+
return http_service_default.get("/payment/public-phonepe-order-success/", {
|
|
114
|
+
params: { phonepe_transaction_id: transactionId }
|
|
115
|
+
});
|
|
116
|
+
}
|
|
80
117
|
async function getStripePaymentStatus(stripeCheckoutSessionId, order_number, payment_link_id) {
|
|
81
118
|
return http_service_default.get("/payment/stripe-payment-status/", {
|
|
82
119
|
params: {
|
|
@@ -102,13 +139,17 @@ async function stripeOrderSuccess(orderDetails) {
|
|
|
102
139
|
return http_service_default.post("/payment/stripe-order-success/", orderDetails);
|
|
103
140
|
}
|
|
104
141
|
async function stripeOrderFail(orderDetails) {
|
|
105
|
-
return http_service_default.post("/payment/stripe-order-
|
|
142
|
+
return http_service_default.post("/payment/stripe-order-failure/", orderDetails);
|
|
106
143
|
}
|
|
107
144
|
async function makeCODOrder(orderId) {
|
|
108
145
|
return http_service_default.post("/customer/order_cod/", { order_id: orderId });
|
|
109
146
|
}
|
|
110
|
-
async function publicMakeCODOrder(orderNumber) {
|
|
111
|
-
return http_service_default.post("/customer/public_order_cod/", {
|
|
147
|
+
async function publicMakeCODOrder(orderNumber, ownership) {
|
|
148
|
+
return http_service_default.post("/customer/public_order_cod/", {
|
|
149
|
+
order_number: orderNumber,
|
|
150
|
+
customer_phone: ownership?.customer_phone,
|
|
151
|
+
customer_email: ownership?.customer_email
|
|
152
|
+
});
|
|
112
153
|
}
|
|
113
154
|
async function updateOrderCustomization(customizationInput) {
|
|
114
155
|
return http_service_default.post("/customer/product_personalize/", customizationInput);
|
|
@@ -122,4 +163,4 @@ async function verifyTabbyPayment(orderNumber) {
|
|
|
122
163
|
});
|
|
123
164
|
}
|
|
124
165
|
|
|
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 };
|
|
166
|
+
export { buyNowPreview, checkPhonepePaymentStatus, checkPhonepePaymentStatusPublic, getOrderDetails, getOrderDetailsByNumber, getOrderDetailsByRef, getOrderDetailsByRefV2, getOrders, getPublicOrderDetailsByNumber, getPublicOrderDetailsByRef, getStripePaymentStatus, getStripePaymentStatusPublic, makeCODOrder, phonepeOrderSuccess, phonepePaymentFailure, phonepePublicOrderSuccess, placeBuyNowOrder, placeGuestBuyNowOrder, placeOrder, placePublicOrder, publicCheckoutPreview, publicMakeCODOrder, publicPhonepeOrderFailure, publicPlaceOrder, publicRazorpayOrderFailure, publicStripeOrderFailure, razorpayOrderFail, razorpayOrderSuccess, razorpayPublicOrderSuccess, stripeOrderFail, stripeOrderSuccess, stripePublicOrderSuccess, tabbyPaymentFailure, 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-YMZZCVZ2.js';
|
|
2
|
+
import { cart_default } from './chunk-TH7OAMGC.js';
|
|
3
|
+
import { updateOrderCustomization } from './chunk-KCLVR6G5.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';
|
|
@@ -49,7 +49,7 @@ var useCartStore = create((set) => ({
|
|
|
49
49
|
set({ status: "idle" /* IDLE */ });
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
addToCart: async (items, customizationInputs, addressId) => {
|
|
52
|
+
addToCart: async (items, customizationInputs, addressId, products) => {
|
|
53
53
|
set({ status: "loading" /* LOADING */ });
|
|
54
54
|
try {
|
|
55
55
|
if (auth_default.getUserDetails()) {
|
|
@@ -57,16 +57,11 @@ var useCartStore = create((set) => ({
|
|
|
57
57
|
await useCartStore.getState().syncCart(addressId);
|
|
58
58
|
} else {
|
|
59
59
|
const cart = cart_default.get();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (product) {
|
|
66
|
-
cart_default.add(product, item.quantity);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
60
|
+
items.forEach((item) => {
|
|
61
|
+
const product = products?.find((p) => p.id === item.variant_id) || cart?.product_variants?.find((p) => p.id === item.variant_id);
|
|
62
|
+
if (!product) return;
|
|
63
|
+
cart_default.add(product, item.quantity);
|
|
64
|
+
});
|
|
70
65
|
const updatedCart = cart_default.get();
|
|
71
66
|
if (updatedCart) {
|
|
72
67
|
set({ cart: updatedCart, total_quantity: updatedCart.total_quantity });
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkXFOUNOKO_cjs = require('./chunk-XFOUNOKO.cjs');
|
|
4
4
|
var chunkK44JZ5NL_cjs = require('./chunk-K44JZ5NL.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkH6FJYRO3_cjs = require('./chunk-H6FJYRO3.cjs');
|
|
6
6
|
var chunkN3CTXRFT_cjs = require('./chunk-N3CTXRFT.cjs');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
|
|
9
9
|
// src/checkout/payment.ts
|
|
10
|
-
function openRazorpayCheckout(order, callbacks) {
|
|
10
|
+
function openRazorpayCheckout(order, callbacks, paymentOptions) {
|
|
11
11
|
if (!order) return;
|
|
12
12
|
chunkK44JZ5NL_cjs.pixelEvents.initiateCheckout(order, "razorpay");
|
|
13
13
|
const {
|
|
@@ -41,7 +41,8 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
41
41
|
payment_id: response.razorpay_payment_id
|
|
42
42
|
},
|
|
43
43
|
order,
|
|
44
|
-
callbacks
|
|
44
|
+
callbacks,
|
|
45
|
+
paymentOptions
|
|
45
46
|
);
|
|
46
47
|
},
|
|
47
48
|
theme: {
|
|
@@ -54,22 +55,33 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
54
55
|
phone: customer_phone
|
|
55
56
|
},
|
|
56
57
|
modal: {
|
|
57
|
-
ondismiss: () => handleRazorpayFail(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
ondismiss: () => handleRazorpayFail(
|
|
59
|
+
order,
|
|
60
|
+
callbacks,
|
|
61
|
+
{
|
|
62
|
+
description: "User cancelled the payment manually",
|
|
63
|
+
reason: "user_cancelled_payment_manually"
|
|
64
|
+
},
|
|
65
|
+
{ isPublic: paymentOptions?.isPublic }
|
|
66
|
+
)
|
|
61
67
|
}
|
|
62
68
|
};
|
|
63
69
|
const paymentObject = new window.Razorpay(options);
|
|
64
70
|
paymentObject.on("payment.failed", (response) => {
|
|
65
|
-
handleRazorpayFail(order, callbacks, response?.error
|
|
71
|
+
handleRazorpayFail(order, callbacks, response?.error, {
|
|
72
|
+
isPublic: paymentOptions?.isPublic
|
|
73
|
+
});
|
|
66
74
|
});
|
|
67
75
|
paymentObject.open();
|
|
68
76
|
}
|
|
69
|
-
async function handleRazorpaySuccess(data, order, callbacks) {
|
|
77
|
+
async function handleRazorpaySuccess(data, order, callbacks, options) {
|
|
70
78
|
try {
|
|
71
79
|
callbacks.onPaymentStart?.();
|
|
72
|
-
|
|
80
|
+
if (options?.isPublic) {
|
|
81
|
+
await chunkH6FJYRO3_cjs.razorpayPublicOrderSuccess(data);
|
|
82
|
+
} else {
|
|
83
|
+
await chunkH6FJYRO3_cjs.razorpayOrderSuccess(data);
|
|
84
|
+
}
|
|
73
85
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
74
86
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
75
87
|
callbacks.onCartReset();
|
|
@@ -80,13 +92,14 @@ async function handleRazorpaySuccess(data, order, callbacks) {
|
|
|
80
92
|
callbacks.onPaymentEnd?.();
|
|
81
93
|
}
|
|
82
94
|
}
|
|
83
|
-
async function handleRazorpayFail(order, callbacks, error) {
|
|
95
|
+
async function handleRazorpayFail(order, callbacks, error, options) {
|
|
84
96
|
try {
|
|
85
|
-
|
|
97
|
+
const payload = {
|
|
86
98
|
order_id: order.id,
|
|
87
99
|
razorpay_order_id: order.razorpay_order_id,
|
|
88
100
|
error
|
|
89
|
-
}
|
|
101
|
+
};
|
|
102
|
+
options?.isPublic ? await chunkH6FJYRO3_cjs.publicRazorpayOrderFailure(payload) : await chunkH6FJYRO3_cjs.razorpayOrderFail(payload);
|
|
90
103
|
} catch {
|
|
91
104
|
}
|
|
92
105
|
callbacks.onFailure(order);
|
|
@@ -115,9 +128,12 @@ async function handleCODPayment(order, callbacks, options) {
|
|
|
115
128
|
callbacks.onPaymentStart?.();
|
|
116
129
|
chunkK44JZ5NL_cjs.pixelEvents.initiateCheckout(order, "cod");
|
|
117
130
|
if (options?.isPublic) {
|
|
118
|
-
await
|
|
131
|
+
await chunkH6FJYRO3_cjs.publicMakeCODOrder(order.order_number, {
|
|
132
|
+
customer_phone: order.customer_phone,
|
|
133
|
+
customer_email: order.customer_email
|
|
134
|
+
});
|
|
119
135
|
} else {
|
|
120
|
-
await
|
|
136
|
+
await chunkH6FJYRO3_cjs.makeCODOrder(order.id);
|
|
121
137
|
}
|
|
122
138
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
123
139
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
@@ -142,13 +158,18 @@ function handleStripePayment(order, callbacks) {
|
|
|
142
158
|
}
|
|
143
159
|
callbacks.onFailure(order);
|
|
144
160
|
}
|
|
145
|
-
async function handleStripeSuccess(order, paymentIntentId, callbacks) {
|
|
161
|
+
async function handleStripeSuccess(order, paymentIntentId, callbacks, options) {
|
|
146
162
|
try {
|
|
147
163
|
callbacks.onPaymentStart?.();
|
|
148
|
-
|
|
164
|
+
const stripeSuccessPayload = {
|
|
149
165
|
order_id: order.id,
|
|
150
166
|
payment_intent_id: paymentIntentId
|
|
151
|
-
}
|
|
167
|
+
};
|
|
168
|
+
if (options?.isPublic) {
|
|
169
|
+
await chunkH6FJYRO3_cjs.stripePublicOrderSuccess(stripeSuccessPayload);
|
|
170
|
+
} else {
|
|
171
|
+
await chunkH6FJYRO3_cjs.stripeOrderSuccess(stripeSuccessPayload);
|
|
172
|
+
}
|
|
152
173
|
chunkK44JZ5NL_cjs.pixelEvents.purchase(order);
|
|
153
174
|
chunkK44JZ5NL_cjs.pixelEvents.checkoutCompleted(order);
|
|
154
175
|
callbacks.onCartReset();
|
|
@@ -173,7 +194,7 @@ function processPayment(order, paymentMethod, callbacks, options) {
|
|
|
173
194
|
return;
|
|
174
195
|
}
|
|
175
196
|
if (order.razorpay_public_token) {
|
|
176
|
-
openRazorpayCheckout(order, callbacks);
|
|
197
|
+
openRazorpayCheckout(order, callbacks, options);
|
|
177
198
|
return;
|
|
178
199
|
}
|
|
179
200
|
handlePhonepePayment(order, callbacks);
|
|
@@ -1,11 +1,11 @@
|
|
|
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 { razorpayPublicOrderSuccess, razorpayOrderSuccess, publicRazorpayOrderFailure, razorpayOrderFail, publicMakeCODOrder, makeCODOrder, stripePublicOrderSuccess, stripeOrderSuccess } from './chunk-KCLVR6G5.js';
|
|
4
4
|
import { getCloudFront } from './chunk-JQMLHRWL.js';
|
|
5
5
|
import { AxiosError } from 'axios';
|
|
6
6
|
|
|
7
7
|
// src/checkout/payment.ts
|
|
8
|
-
function openRazorpayCheckout(order, callbacks) {
|
|
8
|
+
function openRazorpayCheckout(order, callbacks, paymentOptions) {
|
|
9
9
|
if (!order) return;
|
|
10
10
|
pixelEvents.initiateCheckout(order, "razorpay");
|
|
11
11
|
const {
|
|
@@ -39,7 +39,8 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
39
39
|
payment_id: response.razorpay_payment_id
|
|
40
40
|
},
|
|
41
41
|
order,
|
|
42
|
-
callbacks
|
|
42
|
+
callbacks,
|
|
43
|
+
paymentOptions
|
|
43
44
|
);
|
|
44
45
|
},
|
|
45
46
|
theme: {
|
|
@@ -52,22 +53,33 @@ function openRazorpayCheckout(order, callbacks) {
|
|
|
52
53
|
phone: customer_phone
|
|
53
54
|
},
|
|
54
55
|
modal: {
|
|
55
|
-
ondismiss: () => handleRazorpayFail(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
ondismiss: () => handleRazorpayFail(
|
|
57
|
+
order,
|
|
58
|
+
callbacks,
|
|
59
|
+
{
|
|
60
|
+
description: "User cancelled the payment manually",
|
|
61
|
+
reason: "user_cancelled_payment_manually"
|
|
62
|
+
},
|
|
63
|
+
{ isPublic: paymentOptions?.isPublic }
|
|
64
|
+
)
|
|
59
65
|
}
|
|
60
66
|
};
|
|
61
67
|
const paymentObject = new window.Razorpay(options);
|
|
62
68
|
paymentObject.on("payment.failed", (response) => {
|
|
63
|
-
handleRazorpayFail(order, callbacks, response?.error
|
|
69
|
+
handleRazorpayFail(order, callbacks, response?.error, {
|
|
70
|
+
isPublic: paymentOptions?.isPublic
|
|
71
|
+
});
|
|
64
72
|
});
|
|
65
73
|
paymentObject.open();
|
|
66
74
|
}
|
|
67
|
-
async function handleRazorpaySuccess(data, order, callbacks) {
|
|
75
|
+
async function handleRazorpaySuccess(data, order, callbacks, options) {
|
|
68
76
|
try {
|
|
69
77
|
callbacks.onPaymentStart?.();
|
|
70
|
-
|
|
78
|
+
if (options?.isPublic) {
|
|
79
|
+
await razorpayPublicOrderSuccess(data);
|
|
80
|
+
} else {
|
|
81
|
+
await razorpayOrderSuccess(data);
|
|
82
|
+
}
|
|
71
83
|
pixelEvents.purchase(order);
|
|
72
84
|
pixelEvents.checkoutCompleted(order);
|
|
73
85
|
callbacks.onCartReset();
|
|
@@ -78,13 +90,14 @@ async function handleRazorpaySuccess(data, order, callbacks) {
|
|
|
78
90
|
callbacks.onPaymentEnd?.();
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
|
-
async function handleRazorpayFail(order, callbacks, error) {
|
|
93
|
+
async function handleRazorpayFail(order, callbacks, error, options) {
|
|
82
94
|
try {
|
|
83
|
-
|
|
95
|
+
const payload = {
|
|
84
96
|
order_id: order.id,
|
|
85
97
|
razorpay_order_id: order.razorpay_order_id,
|
|
86
98
|
error
|
|
87
|
-
}
|
|
99
|
+
};
|
|
100
|
+
options?.isPublic ? await publicRazorpayOrderFailure(payload) : await razorpayOrderFail(payload);
|
|
88
101
|
} catch {
|
|
89
102
|
}
|
|
90
103
|
callbacks.onFailure(order);
|
|
@@ -113,7 +126,10 @@ async function handleCODPayment(order, callbacks, options) {
|
|
|
113
126
|
callbacks.onPaymentStart?.();
|
|
114
127
|
pixelEvents.initiateCheckout(order, "cod");
|
|
115
128
|
if (options?.isPublic) {
|
|
116
|
-
await publicMakeCODOrder(order.order_number
|
|
129
|
+
await publicMakeCODOrder(order.order_number, {
|
|
130
|
+
customer_phone: order.customer_phone,
|
|
131
|
+
customer_email: order.customer_email
|
|
132
|
+
});
|
|
117
133
|
} else {
|
|
118
134
|
await makeCODOrder(order.id);
|
|
119
135
|
}
|
|
@@ -140,13 +156,18 @@ function handleStripePayment(order, callbacks) {
|
|
|
140
156
|
}
|
|
141
157
|
callbacks.onFailure(order);
|
|
142
158
|
}
|
|
143
|
-
async function handleStripeSuccess(order, paymentIntentId, callbacks) {
|
|
159
|
+
async function handleStripeSuccess(order, paymentIntentId, callbacks, options) {
|
|
144
160
|
try {
|
|
145
161
|
callbacks.onPaymentStart?.();
|
|
146
|
-
|
|
162
|
+
const stripeSuccessPayload = {
|
|
147
163
|
order_id: order.id,
|
|
148
164
|
payment_intent_id: paymentIntentId
|
|
149
|
-
}
|
|
165
|
+
};
|
|
166
|
+
if (options?.isPublic) {
|
|
167
|
+
await stripePublicOrderSuccess(stripeSuccessPayload);
|
|
168
|
+
} else {
|
|
169
|
+
await stripeOrderSuccess(stripeSuccessPayload);
|
|
170
|
+
}
|
|
150
171
|
pixelEvents.purchase(order);
|
|
151
172
|
pixelEvents.checkoutCompleted(order);
|
|
152
173
|
callbacks.onCartReset();
|
|
@@ -171,7 +192,7 @@ function processPayment(order, paymentMethod, callbacks, options) {
|
|
|
171
192
|
return;
|
|
172
193
|
}
|
|
173
194
|
if (order.razorpay_public_token) {
|
|
174
|
-
openRazorpayCheckout(order, callbacks);
|
|
195
|
+
openRazorpayCheckout(order, callbacks, options);
|
|
175
196
|
return;
|
|
176
197
|
}
|
|
177
198
|
handlePhonepePayment(order, callbacks);
|
|
@@ -11,7 +11,7 @@ import '../address-DwBZHzbI.cjs';
|
|
|
11
11
|
import '../product-CZtFWhxO.cjs';
|
|
12
12
|
import 'react-toastify';
|
|
13
13
|
import 'react/jsx-runtime';
|
|
14
|
-
import '../orders-
|
|
15
|
-
import '../pixelEvents-
|
|
14
|
+
import '../orders-COKWr7K7.cjs';
|
|
15
|
+
import '../pixelEvents-BJNH06rS.cjs';
|
|
16
16
|
import '../cart-CyN2JQTw.cjs';
|
|
17
17
|
import '../collections-8YdINtUf.cjs';
|
|
@@ -11,7 +11,7 @@ import '../address-DwBZHzbI.js';
|
|
|
11
11
|
import '../product-CZtFWhxO.js';
|
|
12
12
|
import 'react-toastify';
|
|
13
13
|
import 'react/jsx-runtime';
|
|
14
|
-
import '../orders-
|
|
15
|
-
import '../pixelEvents-
|
|
14
|
+
import '../orders-Cp8qNCrl.js';
|
|
15
|
+
import '../pixelEvents-2Tb-_fRP.js';
|
|
16
16
|
import '../cart-BGIsIZdM.js';
|
|
17
17
|
import '../collections-ycrA2cPL.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as PageHeaderProps } from '../pixelEvents-
|
|
1
|
+
import { P as PageHeaderProps } from '../pixelEvents-BJNH06rS.cjs';
|
|
2
2
|
import '../cart-CyN2JQTw.cjs';
|
|
3
3
|
import '../product-CZtFWhxO.cjs';
|
|
4
4
|
import 'react-toastify';
|
|
5
5
|
import '../collections-8YdINtUf.cjs';
|
|
6
|
-
import '../orders-
|
|
6
|
+
import '../orders-COKWr7K7.cjs';
|
|
7
7
|
|
|
8
8
|
declare function ThemeDataInitializer({ themeData, }: {
|
|
9
9
|
themeData: PageHeaderProps;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as PageHeaderProps } from '../pixelEvents-
|
|
1
|
+
import { P as PageHeaderProps } from '../pixelEvents-2Tb-_fRP.js';
|
|
2
2
|
import '../cart-BGIsIZdM.js';
|
|
3
3
|
import '../product-CZtFWhxO.js';
|
|
4
4
|
import 'react-toastify';
|
|
5
5
|
import '../collections-ycrA2cPL.js';
|
|
6
|
-
import '../orders-
|
|
6
|
+
import '../orders-Cp8qNCrl.js';
|
|
7
7
|
|
|
8
8
|
declare function ThemeDataInitializer({ themeData, }: {
|
|
9
9
|
themeData: PageHeaderProps;
|