@storepecker/storefront-core 2.9.1 → 2.10.1

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.
Files changed (91) hide show
  1. package/dist/address-BdIB6IuI.d.cts +42 -0
  2. package/dist/address-BdIB6IuI.d.ts +42 -0
  3. package/dist/api/index.cjs +36 -32
  4. package/dist/api/index.d.cts +20 -17
  5. package/dist/api/index.d.ts +20 -17
  6. package/dist/api/index.js +4 -4
  7. package/dist/{buy-now-BqVWXyy8.d.cts → buy-now-CDug6LJ_.d.ts} +2 -2
  8. package/dist/{buy-now-DFdnuLjO.d.ts → buy-now-DrKY5_9R.d.cts} +2 -2
  9. package/dist/checkout/index.cjs +163 -76
  10. package/dist/checkout/index.d.cts +37 -26
  11. package/dist/checkout/index.d.ts +37 -26
  12. package/dist/checkout/index.js +50 -64
  13. package/dist/checkout-totals-CbmXM9L7.d.cts +220 -0
  14. package/dist/checkout-totals-DU8l-Wyb.d.ts +220 -0
  15. package/dist/{chunk-IG4BW3ZB.cjs → chunk-32X4SWN4.cjs} +3 -3
  16. package/dist/{chunk-NQZ5GUOG.cjs → chunk-3YPE6UPC.cjs} +24 -16
  17. package/dist/{chunk-RDUT4W3B.cjs → chunk-6APRQ2ED.cjs} +4 -1
  18. package/dist/{chunk-ICKTXS6B.js → chunk-6IXTFZFS.js} +3 -3
  19. package/dist/{chunk-7M5CVYZJ.js → chunk-A7EI7XLU.js} +8 -1
  20. package/dist/chunk-DZPK7GPG.js +601 -0
  21. package/dist/{chunk-TH7OAMGC.js → chunk-E4D4XOAE.js} +24 -16
  22. package/dist/{chunk-NRPK5GCJ.cjs → chunk-EFYAFXIS.cjs} +3 -3
  23. package/dist/{chunk-CBKJ3Y2I.js → chunk-EWZ7TGI7.js} +11 -1
  24. package/dist/{chunk-5XVHYPOC.js → chunk-FF5N7PTB.js} +1 -1
  25. package/dist/{chunk-NOT6VKXA.cjs → chunk-H6UZTS5O.cjs} +67 -23
  26. package/dist/{chunk-XFOUNOKO.cjs → chunk-KNG4OMS5.cjs} +8 -0
  27. package/dist/{chunk-ZAWZ3RB6.js → chunk-NNE42NMP.js} +1 -1
  28. package/dist/chunk-PN6KH5PX.cjs +661 -0
  29. package/dist/{chunk-QQHQTBAM.js → chunk-QSRVMOXT.js} +48 -6
  30. package/dist/{chunk-W6BDMNSU.js → chunk-QVO56X4E.js} +1 -1
  31. package/dist/{chunk-6LS5F4R3.cjs → chunk-SGJUMI3M.cjs} +11 -0
  32. package/dist/{chunk-YLLAP3H2.cjs → chunk-SGKLMS7W.cjs} +2 -2
  33. package/dist/{chunk-ZGMLOLTC.js → chunk-VRZRV2BR.js} +4 -1
  34. package/dist/{chunk-IVKJJLG7.cjs → chunk-WWJAPKRQ.cjs} +8 -8
  35. package/dist/{collections-CXgOv5_G.d.cts → collections-CKNFcE2d.d.cts} +1 -1
  36. package/dist/{collections-CNh2OGbl.d.ts → collections-CtRKsWVx.d.ts} +1 -1
  37. package/dist/components/address-form.cjs +6 -6
  38. package/dist/components/address-form.d.cts +10 -6
  39. package/dist/components/address-form.d.ts +10 -6
  40. package/dist/components/address-form.js +5 -5
  41. package/dist/components/digital-product-download-modal.d.cts +2 -2
  42. package/dist/components/digital-product-download-modal.d.ts +2 -2
  43. package/dist/components/index.cjs +8 -8
  44. package/dist/components/index.d.cts +6 -7
  45. package/dist/components/index.d.ts +6 -7
  46. package/dist/components/index.js +6 -6
  47. package/dist/components/search-dropdown.d.cts +4 -4
  48. package/dist/components/search-dropdown.d.ts +4 -4
  49. package/dist/components/share-button.cjs +3 -3
  50. package/dist/components/share-button.d.cts +1 -1
  51. package/dist/components/share-button.d.ts +1 -1
  52. package/dist/components/share-button.js +2 -2
  53. package/dist/components/theme-data-initializer.d.cts +4 -5
  54. package/dist/components/theme-data-initializer.d.ts +4 -5
  55. package/dist/hooks/index.cjs +672 -44
  56. package/dist/hooks/index.d.cts +239 -13
  57. package/dist/hooks/index.d.ts +239 -13
  58. package/dist/hooks/index.js +630 -11
  59. package/dist/{instagram-DalreBu6.d.cts → instagram-CSzrxk10.d.cts} +8 -2
  60. package/dist/{instagram-BADLnNQ3.d.ts → instagram-CagTLmyq.d.ts} +8 -2
  61. package/dist/models/index.d.cts +8 -8
  62. package/dist/models/index.d.ts +8 -8
  63. package/dist/orders-B6BmHCJN.d.ts +337 -0
  64. package/dist/orders-ZKP0lqRN.d.cts +337 -0
  65. package/dist/pincode-8u7yWLpQ.d.cts +29 -0
  66. package/dist/pincode-8u7yWLpQ.d.ts +29 -0
  67. package/dist/{pixelEvents-LsealscG.d.ts → pixelEvents-DqJ_CEEr.d.ts} +4 -4
  68. package/dist/{pixelEvents-BtEO5QAR.d.cts → pixelEvents-bahgVW4_.d.cts} +4 -4
  69. package/dist/{product-D9liEtl4.d.cts → product-D4kol-Z-.d.cts} +26 -2
  70. package/dist/{product-D9liEtl4.d.ts → product-D4kol-Z-.d.ts} +26 -2
  71. package/dist/store/index.cjs +20 -30
  72. package/dist/store/index.d.cts +21 -7
  73. package/dist/store/index.d.ts +21 -7
  74. package/dist/store/index.js +9 -26
  75. package/dist/{useAddressForm-DGbEn91-.d.cts → useAddressForm-fMOb5Z-a.d.ts} +6 -1
  76. package/dist/{useAddressForm-cO3Au33k.d.ts → useAddressForm-wleIo78M.d.cts} +6 -1
  77. package/dist/utils/index.cjs +60 -56
  78. package/dist/utils/index.d.cts +24 -9
  79. package/dist/utils/index.d.ts +24 -9
  80. package/dist/utils/index.js +4 -4
  81. package/dist/{wishlist-Cj0sQxiY.d.ts → wishlist-L3fM5-ie.d.ts} +1 -1
  82. package/dist/{wishlist-BakHvIFN.d.cts → wishlist-_0x0r1jt.d.cts} +1 -1
  83. package/package.json +1 -1
  84. package/dist/address-DwBZHzbI.d.cts +0 -19
  85. package/dist/address-DwBZHzbI.d.ts +0 -19
  86. package/dist/cart-DZq1ZEnE.d.ts +0 -153
  87. package/dist/cart-DwMFBmpC.d.cts +0 -153
  88. package/dist/chunk-34Y7Y5FU.cjs +0 -246
  89. package/dist/chunk-VPTN4YXD.js +0 -232
  90. package/dist/orders-B3G4CyhH.d.cts +0 -166
  91. package/dist/orders-Bl-Slh72.d.ts +0 -166
@@ -1,51 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunk34Y7Y5FU_cjs = require('../chunk-34Y7Y5FU.cjs');
4
- require('../chunk-XFOUNOKO.cjs');
3
+ var chunkPN6KH5PX_cjs = require('../chunk-PN6KH5PX.cjs');
4
+ require('../chunk-KNG4OMS5.cjs');
5
5
  var chunkNSAHGMS7_cjs = require('../chunk-NSAHGMS7.cjs');
6
6
  var chunkH6FJYRO3_cjs = require('../chunk-H6FJYRO3.cjs');
7
7
  var chunkTB72NPRM_cjs = require('../chunk-TB72NPRM.cjs');
8
+ require('../chunk-LJUGNSQQ.cjs');
8
9
  require('../chunk-ECHV2JSY.cjs');
9
10
  require('../chunk-BBRXE57K.cjs');
10
11
  require('../chunk-NE3ZHELZ.cjs');
11
12
  require('../chunk-N3CTXRFT.cjs');
12
13
 
13
- // src/checkout/cart-calculations.ts
14
- function calculateCartTotals(cart) {
15
- if (!cart) {
16
- return {
17
- totalSellingAmount: 0,
18
- discountAmount: 0,
19
- isCartEmpty: true,
20
- allInclusiveTax: true,
21
- exclusiveTaxAmount: 0
22
- };
23
- }
24
- let totalSellingAmount = 0;
25
- let discountAmount = 0;
26
- let exclusiveTaxAmount = 0;
27
- let allInclusiveTax = true;
28
- cart.product_variants?.forEach((item) => {
29
- const quantity = cart.products_quantity[item.id] || 0;
30
- const actualPrice = Number(item.actual_price);
31
- const sellingPrice = Number(item.selling_price);
32
- const variant = item;
33
- totalSellingAmount += actualPrice ? actualPrice * quantity : sellingPrice * quantity;
34
- discountAmount += actualPrice ? (actualPrice - sellingPrice) * quantity : 0;
35
- if (!variant.is_tax_inclusive_price) {
36
- allInclusiveTax = false;
37
- exclusiveTaxAmount += Number(variant.total_tax_price || 0) * quantity;
38
- }
39
- });
40
- return {
41
- totalSellingAmount,
42
- discountAmount,
43
- isCartEmpty: !cart.product_variants?.length,
44
- allInclusiveTax,
45
- exclusiveTaxAmount
46
- };
47
- }
48
-
49
14
  // src/checkout/placement-error.ts
50
15
  function describePlacementError(error) {
51
16
  const code = error?.response?.data?.error_code || error?.response?.data?.code;
@@ -88,57 +53,73 @@ function describePlacementError(error) {
88
53
  }
89
54
 
90
55
  // src/checkout/payment-status.ts
56
+ async function reportPhonepeFailure(transactionId, order, isPublic) {
57
+ try {
58
+ if (isPublic) {
59
+ await chunkH6FJYRO3_cjs.publicPhonepeOrderFailure({ id: transactionId, status: "REJECTED" });
60
+ } else if (order) {
61
+ await chunkH6FJYRO3_cjs.phonepePaymentFailure({ order_id: order.id, phonepe_transaction_id: transactionId });
62
+ }
63
+ } catch {
64
+ }
65
+ }
66
+ function isStripePaid(data) {
67
+ return data?.payment_status === "paid" || data?.status === "complete" || data?.order_status === "paid" || data?.success === true;
68
+ }
69
+ function isTabbyPaid(data) {
70
+ return data?.order_status === "paid" || data?.order_status === "confirmed" || data?.order_status === "success" || data?.status === "paid";
71
+ }
91
72
  async function checkPhonepeReturnStatus(transactionId, callbacks, options) {
92
73
  try {
93
74
  const checkStatus = options?.isPublic ? chunkH6FJYRO3_cjs.checkPhonepePaymentStatusPublic : chunkH6FJYRO3_cjs.checkPhonepePaymentStatus;
94
75
  const response = await checkStatus(transactionId);
95
76
  if (response.data.success) {
96
77
  callbacks.onSuccess(void 0);
97
- } else {
98
- callbacks.onFailure();
78
+ return;
99
79
  }
100
80
  } catch {
101
- callbacks.onFailure();
102
81
  }
82
+ if (options?.reportFailure) await reportPhonepeFailure(transactionId, null, options.isPublic);
83
+ callbacks.onFailure();
103
84
  }
104
85
  async function checkPhonepeReturnStatusWithOrder(transactionId, orderNumber, callbacks, options) {
86
+ const checkStatus = options?.isPublic ? chunkH6FJYRO3_cjs.checkPhonepePaymentStatusPublic : chunkH6FJYRO3_cjs.checkPhonepePaymentStatus;
87
+ const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
88
+ let order = null;
105
89
  try {
106
- const checkStatus = options?.isPublic ? chunkH6FJYRO3_cjs.checkPhonepePaymentStatusPublic : chunkH6FJYRO3_cjs.checkPhonepePaymentStatus;
107
- const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
108
90
  const [paymentResponse, orderResponse] = await Promise.all([
109
91
  checkStatus(transactionId),
110
92
  getOrder(orderNumber)
111
93
  ]);
112
- const order = orderResponse.data;
94
+ order = orderResponse.data;
113
95
  callbacks.onOrderLoaded?.(order);
114
96
  if (paymentResponse.data.success) {
115
97
  chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
116
98
  chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
117
99
  callbacks.onSuccess(order);
118
- } else {
119
- callbacks.onFailure();
100
+ return;
120
101
  }
121
102
  } catch {
122
- callbacks.onFailure();
123
103
  }
104
+ if (options?.reportFailure) await reportPhonepeFailure(transactionId, order, options.isPublic);
105
+ callbacks.onFailure();
124
106
  }
125
107
  async function checkStripeReturnStatus(sessionId, orderNumber, paymentLinkUrl, callbacks, options) {
126
108
  try {
127
109
  const getStatus = options?.isPublic ? chunkH6FJYRO3_cjs.getStripePaymentStatusPublic : chunkH6FJYRO3_cjs.getStripePaymentStatus;
128
- const response = await getStatus(sessionId, orderNumber, paymentLinkUrl);
129
- const data = response.data;
130
- if (data.payment_status === "paid" || data.status === "complete") {
131
- try {
132
- const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
133
- const orderResponse = await getOrder(orderNumber);
134
- const order = orderResponse.data;
135
- callbacks.onOrderLoaded?.(order);
110
+ const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
111
+ const [response, orderResponse] = await Promise.all([
112
+ getStatus(sessionId, orderNumber, paymentLinkUrl),
113
+ getOrder(orderNumber).catch(() => null)
114
+ ]);
115
+ const order = orderResponse?.data;
116
+ if (order) callbacks.onOrderLoaded?.(order);
117
+ if (isStripePaid(response.data)) {
118
+ if (order) {
136
119
  chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
137
120
  chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
138
- callbacks.onSuccess(order);
139
- } catch {
140
- callbacks.onSuccess(void 0);
141
121
  }
122
+ callbacks.onSuccess(order ?? void 0);
142
123
  } else {
143
124
  callbacks.onFailure();
144
125
  }
@@ -147,6 +128,7 @@ async function checkStripeReturnStatus(sessionId, orderNumber, paymentLinkUrl, c
147
128
  }
148
129
  }
149
130
  async function checkTabbyReturnStatus(orderNumber, callbacks, options) {
131
+ let tabbyPaymentId = options?.paymentId || void 0;
150
132
  try {
151
133
  const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
152
134
  const [response, orderResponse] = await Promise.all([
@@ -155,71 +137,175 @@ async function checkTabbyReturnStatus(orderNumber, callbacks, options) {
155
137
  ]);
156
138
  const order = orderResponse?.data;
157
139
  if (order) callbacks.onOrderLoaded?.(order);
158
- if (response.data.order_status === "paid" || response.data.order_status === "confirmed" || response.data.status === "paid") {
140
+ if (isTabbyPaid(response.data)) {
159
141
  if (order) {
160
142
  chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
161
143
  chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
162
144
  }
163
145
  callbacks.onSuccess(order ?? void 0);
164
- } else {
165
- callbacks.onFailure();
146
+ return;
166
147
  }
148
+ tabbyPaymentId = tabbyPaymentId || response.data.payment_id;
167
149
  } catch {
168
- callbacks.onFailure();
169
150
  }
151
+ if (options?.reportFailure && tabbyPaymentId) {
152
+ await chunkH6FJYRO3_cjs.tabbyPaymentFailure(tabbyPaymentId).catch(() => {
153
+ });
154
+ }
155
+ callbacks.onFailure();
170
156
  }
171
157
 
158
+ Object.defineProperty(exports, "DEFAULT_ADDRESS_SCHEMA_MESSAGES", {
159
+ enumerable: true,
160
+ get: function () { return chunkPN6KH5PX_cjs.DEFAULT_ADDRESS_SCHEMA_MESSAGES; }
161
+ });
162
+ Object.defineProperty(exports, "INVALID_PINCODE", {
163
+ enumerable: true,
164
+ get: function () { return chunkPN6KH5PX_cjs.INVALID_PINCODE; }
165
+ });
166
+ Object.defineProperty(exports, "NO_POSTAL_CODE", {
167
+ enumerable: true,
168
+ get: function () { return chunkPN6KH5PX_cjs.NO_POSTAL_CODE; }
169
+ });
170
+ Object.defineProperty(exports, "PINCODE_DEBOUNCE_MS", {
171
+ enumerable: true,
172
+ get: function () { return chunkPN6KH5PX_cjs.PINCODE_DEBOUNCE_MS; }
173
+ });
174
+ Object.defineProperty(exports, "PINCODE_MIN_LENGTH", {
175
+ enumerable: true,
176
+ get: function () { return chunkPN6KH5PX_cjs.PINCODE_MIN_LENGTH; }
177
+ });
178
+ Object.defineProperty(exports, "PINCODE_VALIDATION_UNAVAILABLE", {
179
+ enumerable: true,
180
+ get: function () { return chunkPN6KH5PX_cjs.PINCODE_VALIDATION_UNAVAILABLE; }
181
+ });
172
182
  Object.defineProperty(exports, "applyCheckoutCoupon", {
173
183
  enumerable: true,
174
- get: function () { return chunk34Y7Y5FU_cjs.applyCheckoutCoupon; }
184
+ get: function () { return chunkPN6KH5PX_cjs.applyCheckoutCoupon; }
185
+ });
186
+ Object.defineProperty(exports, "buildAddressFormat", {
187
+ enumerable: true,
188
+ get: function () { return chunkPN6KH5PX_cjs.buildAddressFormat; }
189
+ });
190
+ Object.defineProperty(exports, "buildAddressSchema", {
191
+ enumerable: true,
192
+ get: function () { return chunkPN6KH5PX_cjs.buildAddressSchema; }
193
+ });
194
+ Object.defineProperty(exports, "calculateCartTotals", {
195
+ enumerable: true,
196
+ get: function () { return chunkPN6KH5PX_cjs.calculateCartTotals; }
197
+ });
198
+ Object.defineProperty(exports, "clearPincodeCache", {
199
+ enumerable: true,
200
+ get: function () { return chunkPN6KH5PX_cjs.clearPincodeCache; }
175
201
  });
176
202
  Object.defineProperty(exports, "fetchAppliedCoupon", {
177
203
  enumerable: true,
178
- get: function () { return chunk34Y7Y5FU_cjs.fetchAppliedCoupon; }
204
+ get: function () { return chunkPN6KH5PX_cjs.fetchAppliedCoupon; }
179
205
  });
180
206
  Object.defineProperty(exports, "fetchAvailableCoupons", {
181
207
  enumerable: true,
182
- get: function () { return chunk34Y7Y5FU_cjs.fetchAvailableCoupons; }
208
+ get: function () { return chunkPN6KH5PX_cjs.fetchAvailableCoupons; }
209
+ });
210
+ Object.defineProperty(exports, "findStateByName", {
211
+ enumerable: true,
212
+ get: function () { return chunkPN6KH5PX_cjs.findStateByName; }
213
+ });
214
+ Object.defineProperty(exports, "findSubdivision", {
215
+ enumerable: true,
216
+ get: function () { return chunkPN6KH5PX_cjs.findSubdivision; }
217
+ });
218
+ Object.defineProperty(exports, "getAreaOptions", {
219
+ enumerable: true,
220
+ get: function () { return chunkPN6KH5PX_cjs.getAreaOptions; }
221
+ });
222
+ Object.defineProperty(exports, "getCustomizationPrice", {
223
+ enumerable: true,
224
+ get: function () { return chunkPN6KH5PX_cjs.getCustomizationPrice; }
225
+ });
226
+ Object.defineProperty(exports, "getPincodeError", {
227
+ enumerable: true,
228
+ get: function () { return chunkPN6KH5PX_cjs.getPincodeError; }
229
+ });
230
+ Object.defineProperty(exports, "getPostcodeHint", {
231
+ enumerable: true,
232
+ get: function () { return chunkPN6KH5PX_cjs.getPostcodeHint; }
183
233
  });
184
234
  Object.defineProperty(exports, "handleCODPayment", {
185
235
  enumerable: true,
186
- get: function () { return chunk34Y7Y5FU_cjs.handleCODPayment; }
236
+ get: function () { return chunkPN6KH5PX_cjs.handleCODPayment; }
187
237
  });
188
238
  Object.defineProperty(exports, "handlePhonepePayment", {
189
239
  enumerable: true,
190
- get: function () { return chunk34Y7Y5FU_cjs.handlePhonepePayment; }
240
+ get: function () { return chunkPN6KH5PX_cjs.handlePhonepePayment; }
191
241
  });
192
242
  Object.defineProperty(exports, "handleRazorpayFail", {
193
243
  enumerable: true,
194
- get: function () { return chunk34Y7Y5FU_cjs.handleRazorpayFail; }
244
+ get: function () { return chunkPN6KH5PX_cjs.handleRazorpayFail; }
195
245
  });
196
246
  Object.defineProperty(exports, "handleRazorpaySuccess", {
197
247
  enumerable: true,
198
- get: function () { return chunk34Y7Y5FU_cjs.handleRazorpaySuccess; }
248
+ get: function () { return chunkPN6KH5PX_cjs.handleRazorpaySuccess; }
199
249
  });
200
250
  Object.defineProperty(exports, "handleStripePayment", {
201
251
  enumerable: true,
202
- get: function () { return chunk34Y7Y5FU_cjs.handleStripePayment; }
252
+ get: function () { return chunkPN6KH5PX_cjs.handleStripePayment; }
203
253
  });
204
254
  Object.defineProperty(exports, "handleStripeSuccess", {
205
255
  enumerable: true,
206
- get: function () { return chunk34Y7Y5FU_cjs.handleStripeSuccess; }
256
+ get: function () { return chunkPN6KH5PX_cjs.handleStripeSuccess; }
207
257
  });
208
258
  Object.defineProperty(exports, "handleTabbyPayment", {
209
259
  enumerable: true,
210
- get: function () { return chunk34Y7Y5FU_cjs.handleTabbyPayment; }
260
+ get: function () { return chunkPN6KH5PX_cjs.handleTabbyPayment; }
261
+ });
262
+ Object.defineProperty(exports, "isValidNumber", {
263
+ enumerable: true,
264
+ get: function () { return chunkPN6KH5PX_cjs.isValidNumber; }
265
+ });
266
+ Object.defineProperty(exports, "joinAddressLines", {
267
+ enumerable: true,
268
+ get: function () { return chunkPN6KH5PX_cjs.joinAddressLines; }
269
+ });
270
+ Object.defineProperty(exports, "loadAddressFormat", {
271
+ enumerable: true,
272
+ get: function () { return chunkPN6KH5PX_cjs.loadAddressFormat; }
273
+ });
274
+ Object.defineProperty(exports, "lowerLabel", {
275
+ enumerable: true,
276
+ get: function () { return chunkPN6KH5PX_cjs.lowerLabel; }
277
+ });
278
+ Object.defineProperty(exports, "normalizePostcode", {
279
+ enumerable: true,
280
+ get: function () { return chunkPN6KH5PX_cjs.normalizePostcode; }
211
281
  });
212
282
  Object.defineProperty(exports, "openRazorpayCheckout", {
213
283
  enumerable: true,
214
- get: function () { return chunk34Y7Y5FU_cjs.openRazorpayCheckout; }
284
+ get: function () { return chunkPN6KH5PX_cjs.openRazorpayCheckout; }
215
285
  });
216
286
  Object.defineProperty(exports, "processPayment", {
217
287
  enumerable: true,
218
- get: function () { return chunk34Y7Y5FU_cjs.processPayment; }
288
+ get: function () { return chunkPN6KH5PX_cjs.processPayment; }
219
289
  });
220
290
  Object.defineProperty(exports, "removeCheckoutCoupon", {
221
291
  enumerable: true,
222
- get: function () { return chunk34Y7Y5FU_cjs.removeCheckoutCoupon; }
292
+ get: function () { return chunkPN6KH5PX_cjs.removeCheckoutCoupon; }
293
+ });
294
+ Object.defineProperty(exports, "sanitizePhoneInput", {
295
+ enumerable: true,
296
+ get: function () { return chunkPN6KH5PX_cjs.sanitizePhoneInput; }
297
+ });
298
+ Object.defineProperty(exports, "sanitizePincode", {
299
+ enumerable: true,
300
+ get: function () { return chunkPN6KH5PX_cjs.sanitizePincode; }
301
+ });
302
+ Object.defineProperty(exports, "usableEmail", {
303
+ enumerable: true,
304
+ get: function () { return chunkPN6KH5PX_cjs.usableEmail; }
305
+ });
306
+ Object.defineProperty(exports, "validatePincode", {
307
+ enumerable: true,
308
+ get: function () { return chunkPN6KH5PX_cjs.validatePincode; }
223
309
  });
224
310
  Object.defineProperty(exports, "IP_API_CACHE_KEY", {
225
311
  enumerable: true,
@@ -273,9 +359,10 @@ Object.defineProperty(exports, "saveAddressFormToSession", {
273
359
  enumerable: true,
274
360
  get: function () { return chunkTB72NPRM_cjs.saveAddressFormToSession; }
275
361
  });
276
- exports.calculateCartTotals = calculateCartTotals;
277
362
  exports.checkPhonepeReturnStatus = checkPhonepeReturnStatus;
278
363
  exports.checkPhonepeReturnStatusWithOrder = checkPhonepeReturnStatusWithOrder;
279
364
  exports.checkStripeReturnStatus = checkStripeReturnStatus;
280
365
  exports.checkTabbyReturnStatus = checkTabbyReturnStatus;
281
366
  exports.describePlacementError = describePlacementError;
367
+ exports.isStripePaid = isStripePaid;
368
+ exports.isTabbyPaid = isTabbyPaid;
@@ -1,7 +1,8 @@
1
1
  import * as Yup from 'yup';
2
- import { C as Cart, c as Coupon } from '../cart-DwMFBmpC.cjs';
3
- import { O as Order } from '../orders-B3G4CyhH.cjs';
4
- import '../product-D9liEtl4.cjs';
2
+ export { A as AddressFormat, a as AddressSchemaMessages, C as CartLike, b as CheckoutTotals, D as DEFAULT_ADDRESS_SCHEMA_MESSAGES, I as INVALID_PINCODE, N as NO_POSTAL_CODE, P as PINCODE_DEBOUNCE_MS, c as PINCODE_MIN_LENGTH, d as PINCODE_VALIDATION_UNAVAILABLE, e as PincodeCheck, f as PincodeMatch, R as RawAddressData, g as buildAddressFormat, h as buildAddressSchema, i as calculateCartTotals, j as clearPincodeCache, k as findStateByName, l as findSubdivision, m as getAreaOptions, n as getCustomizationPrice, o as getPincodeError, p as getPostcodeHint, q as joinAddressLines, r as loadAddressFormat, s as lowerLabel, t as normalizePostcode, u as sanitizePincode, v as usableEmail, w as validatePincode } from '../checkout-totals-CbmXM9L7.cjs';
3
+ import { c as Coupon, O as Order } from '../orders-ZKP0lqRN.cjs';
4
+ import '../pincode-8u7yWLpQ.cjs';
5
+ import '../product-D4kol-Z-.cjs';
5
6
  import 'react-toastify';
6
7
 
7
8
  /**
@@ -24,6 +25,10 @@ declare const addressFormInitialValues: AddressFormValues;
24
25
  /**
25
26
  * Strip country calling code prefix and trim whitespace from a phone number.
26
27
  * E.g. "+919876543210" with countryCode "IN" → "9876543210"
28
+ *
29
+ * @deprecated Strips a leading calling code without checking the rest is a
30
+ * valid number, so an Indian number starting with 91 loses digits. Use
31
+ * `sanitizePhoneInput` from `/checkout`.
27
32
  */
28
33
  declare function sanitizePhoneNumber(input: string, countryCode: string): string;
29
34
  /**
@@ -127,19 +132,23 @@ declare function buildSubmitPayload(values: AddressFormValues & {
127
132
  name: string;
128
133
  }>): any;
129
134
 
130
- interface CartTotals {
131
- totalSellingAmount: number;
132
- discountAmount: number;
133
- isCartEmpty: boolean;
134
- allInclusiveTax: boolean;
135
- exclusiveTaxAmount: number;
136
- }
137
135
  /**
138
- * Calculate cart totals from the cart data.
139
- * Computes subtotal (based on actual_price or selling_price), discount amount,
140
- * and tax breakdown (inclusive vs exclusive).
136
+ * Validate a national phone number for a given country (e.g. "IN").
137
+ *
138
+ * Uses libphonenumber-js's default (min) metadata, which checks the number's
139
+ * length for the country rather than its full digit pattern
140
+ */
141
+ declare function isValidNumber(input: string, code: string): boolean;
142
+ /**
143
+ * Address forms have a separate country/calling-code dropdown, but users often
144
+ * still type the code into the phone field itself (e.g. "+91 98765...",
145
+ * "0091...", "91 98765..."). This strips the code so only the national number
146
+ * is kept.
147
+ *
148
+ * @param raw The raw value typed into the phone input.
149
+ * @param countryCode The ISO code currently selected (e.g. "IN").
141
150
  */
142
- declare function calculateCartTotals(cart: Cart.Root | null): CartTotals;
151
+ declare function sanitizePhoneInput(raw: string, countryCode: string): string;
143
152
 
144
153
  interface CouponCallbacks {
145
154
  onCartRefresh: () => void | Promise<void>;
@@ -266,29 +275,31 @@ interface PaymentStatusCallbacks {
266
275
  onFailure: () => void;
267
276
  onOrderLoaded?: (order: Order.OrderSummary) => void;
268
277
  }
278
+ interface PaymentStatusOptions {
279
+ isPublic?: boolean;
280
+ reportFailure?: boolean;
281
+ }
282
+ /** Whether a Stripe status payload means the order is paid. */
283
+ declare function isStripePaid(data?: Partial<Order.StripePaymentStatus> | null): boolean;
284
+ /** Whether a Tabby status payload means the order is paid. */
285
+ declare function isTabbyPaid(data?: Partial<Order.TabbyPaymentStatus> | null): boolean;
269
286
  /**
270
287
  * Check PhonePe payment status after redirect back from PhonePe.
271
288
  */
272
- declare function checkPhonepeReturnStatus(transactionId: string, callbacks: PaymentStatusCallbacks, options?: {
273
- isPublic?: boolean;
274
- }): Promise<void>;
289
+ declare function checkPhonepeReturnStatus(transactionId: string, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions): Promise<void>;
275
290
  /**
276
291
  * Check PhonePe payment status with order details for pixel events.
277
292
  */
278
- declare function checkPhonepeReturnStatusWithOrder(transactionId: string, orderNumber: number, callbacks: PaymentStatusCallbacks, options?: {
279
- isPublic?: boolean;
280
- }): Promise<void>;
293
+ declare function checkPhonepeReturnStatusWithOrder(transactionId: string, orderNumber: number, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions): Promise<void>;
281
294
  /**
282
295
  * Check Stripe payment status after redirect back from Stripe checkout.
283
296
  */
284
- declare function checkStripeReturnStatus(sessionId: string, orderNumber: number, paymentLinkUrl: string, callbacks: PaymentStatusCallbacks, options?: {
285
- isPublic?: boolean;
286
- }): Promise<void>;
297
+ declare function checkStripeReturnStatus(sessionId: string, orderNumber: number, paymentLinkUrl: string, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions): Promise<void>;
287
298
  /**
288
299
  * Check Tabby payment status after redirect back from Tabby.
289
300
  */
290
- declare function checkTabbyReturnStatus(orderNumber: number, callbacks: PaymentStatusCallbacks, options?: {
291
- isPublic?: boolean;
301
+ declare function checkTabbyReturnStatus(orderNumber: number, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions & {
302
+ paymentId?: string | null;
292
303
  }): Promise<void>;
293
304
 
294
- export { type AddressFormValues, type CartTotals, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, calculateCartTotals, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneNumber, saveAddressFormToSession };
305
+ export { type AddressFormValues, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PaymentStatusOptions, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isStripePaid, isTabbyPaid, isValidNumber, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneInput, sanitizePhoneNumber, saveAddressFormToSession };
@@ -1,7 +1,8 @@
1
1
  import * as Yup from 'yup';
2
- import { C as Cart, c as Coupon } from '../cart-DZq1ZEnE.js';
3
- import { O as Order } from '../orders-Bl-Slh72.js';
4
- import '../product-D9liEtl4.js';
2
+ export { A as AddressFormat, a as AddressSchemaMessages, C as CartLike, b as CheckoutTotals, D as DEFAULT_ADDRESS_SCHEMA_MESSAGES, I as INVALID_PINCODE, N as NO_POSTAL_CODE, P as PINCODE_DEBOUNCE_MS, c as PINCODE_MIN_LENGTH, d as PINCODE_VALIDATION_UNAVAILABLE, e as PincodeCheck, f as PincodeMatch, R as RawAddressData, g as buildAddressFormat, h as buildAddressSchema, i as calculateCartTotals, j as clearPincodeCache, k as findStateByName, l as findSubdivision, m as getAreaOptions, n as getCustomizationPrice, o as getPincodeError, p as getPostcodeHint, q as joinAddressLines, r as loadAddressFormat, s as lowerLabel, t as normalizePostcode, u as sanitizePincode, v as usableEmail, w as validatePincode } from '../checkout-totals-DU8l-Wyb.js';
3
+ import { c as Coupon, O as Order } from '../orders-B6BmHCJN.js';
4
+ import '../pincode-8u7yWLpQ.js';
5
+ import '../product-D4kol-Z-.js';
5
6
  import 'react-toastify';
6
7
 
7
8
  /**
@@ -24,6 +25,10 @@ declare const addressFormInitialValues: AddressFormValues;
24
25
  /**
25
26
  * Strip country calling code prefix and trim whitespace from a phone number.
26
27
  * E.g. "+919876543210" with countryCode "IN" → "9876543210"
28
+ *
29
+ * @deprecated Strips a leading calling code without checking the rest is a
30
+ * valid number, so an Indian number starting with 91 loses digits. Use
31
+ * `sanitizePhoneInput` from `/checkout`.
27
32
  */
28
33
  declare function sanitizePhoneNumber(input: string, countryCode: string): string;
29
34
  /**
@@ -127,19 +132,23 @@ declare function buildSubmitPayload(values: AddressFormValues & {
127
132
  name: string;
128
133
  }>): any;
129
134
 
130
- interface CartTotals {
131
- totalSellingAmount: number;
132
- discountAmount: number;
133
- isCartEmpty: boolean;
134
- allInclusiveTax: boolean;
135
- exclusiveTaxAmount: number;
136
- }
137
135
  /**
138
- * Calculate cart totals from the cart data.
139
- * Computes subtotal (based on actual_price or selling_price), discount amount,
140
- * and tax breakdown (inclusive vs exclusive).
136
+ * Validate a national phone number for a given country (e.g. "IN").
137
+ *
138
+ * Uses libphonenumber-js's default (min) metadata, which checks the number's
139
+ * length for the country rather than its full digit pattern
140
+ */
141
+ declare function isValidNumber(input: string, code: string): boolean;
142
+ /**
143
+ * Address forms have a separate country/calling-code dropdown, but users often
144
+ * still type the code into the phone field itself (e.g. "+91 98765...",
145
+ * "0091...", "91 98765..."). This strips the code so only the national number
146
+ * is kept.
147
+ *
148
+ * @param raw The raw value typed into the phone input.
149
+ * @param countryCode The ISO code currently selected (e.g. "IN").
141
150
  */
142
- declare function calculateCartTotals(cart: Cart.Root | null): CartTotals;
151
+ declare function sanitizePhoneInput(raw: string, countryCode: string): string;
143
152
 
144
153
  interface CouponCallbacks {
145
154
  onCartRefresh: () => void | Promise<void>;
@@ -266,29 +275,31 @@ interface PaymentStatusCallbacks {
266
275
  onFailure: () => void;
267
276
  onOrderLoaded?: (order: Order.OrderSummary) => void;
268
277
  }
278
+ interface PaymentStatusOptions {
279
+ isPublic?: boolean;
280
+ reportFailure?: boolean;
281
+ }
282
+ /** Whether a Stripe status payload means the order is paid. */
283
+ declare function isStripePaid(data?: Partial<Order.StripePaymentStatus> | null): boolean;
284
+ /** Whether a Tabby status payload means the order is paid. */
285
+ declare function isTabbyPaid(data?: Partial<Order.TabbyPaymentStatus> | null): boolean;
269
286
  /**
270
287
  * Check PhonePe payment status after redirect back from PhonePe.
271
288
  */
272
- declare function checkPhonepeReturnStatus(transactionId: string, callbacks: PaymentStatusCallbacks, options?: {
273
- isPublic?: boolean;
274
- }): Promise<void>;
289
+ declare function checkPhonepeReturnStatus(transactionId: string, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions): Promise<void>;
275
290
  /**
276
291
  * Check PhonePe payment status with order details for pixel events.
277
292
  */
278
- declare function checkPhonepeReturnStatusWithOrder(transactionId: string, orderNumber: number, callbacks: PaymentStatusCallbacks, options?: {
279
- isPublic?: boolean;
280
- }): Promise<void>;
293
+ declare function checkPhonepeReturnStatusWithOrder(transactionId: string, orderNumber: number, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions): Promise<void>;
281
294
  /**
282
295
  * Check Stripe payment status after redirect back from Stripe checkout.
283
296
  */
284
- declare function checkStripeReturnStatus(sessionId: string, orderNumber: number, paymentLinkUrl: string, callbacks: PaymentStatusCallbacks, options?: {
285
- isPublic?: boolean;
286
- }): Promise<void>;
297
+ declare function checkStripeReturnStatus(sessionId: string, orderNumber: number, paymentLinkUrl: string, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions): Promise<void>;
287
298
  /**
288
299
  * Check Tabby payment status after redirect back from Tabby.
289
300
  */
290
- declare function checkTabbyReturnStatus(orderNumber: number, callbacks: PaymentStatusCallbacks, options?: {
291
- isPublic?: boolean;
301
+ declare function checkTabbyReturnStatus(orderNumber: number, callbacks: PaymentStatusCallbacks, options?: PaymentStatusOptions & {
302
+ paymentId?: string | null;
292
303
  }): Promise<void>;
293
304
 
294
- export { type AddressFormValues, type CartTotals, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, calculateCartTotals, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneNumber, saveAddressFormToSession };
305
+ export { type AddressFormValues, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PaymentStatusOptions, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isStripePaid, isTabbyPaid, isValidNumber, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneInput, sanitizePhoneNumber, saveAddressFormToSession };