@storepecker/storefront-core 2.10.0 → 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 (59) hide show
  1. package/dist/api/index.cjs +20 -20
  2. package/dist/api/index.d.cts +8 -15
  3. package/dist/api/index.d.ts +8 -15
  4. package/dist/api/index.js +2 -2
  5. package/dist/{buy-now-kII0KrhP.d.ts → buy-now-CDug6LJ_.d.ts} +1 -1
  6. package/dist/{buy-now-B_15RUVT.d.cts → buy-now-DrKY5_9R.d.cts} +1 -1
  7. package/dist/checkout/index.cjs +92 -98
  8. package/dist/checkout/index.d.cts +17 -30
  9. package/dist/checkout/index.d.ts +17 -30
  10. package/dist/checkout/index.js +48 -63
  11. package/dist/{pincode-Ch3bZSJz.d.cts → checkout-totals-CbmXM9L7.d.cts} +42 -1
  12. package/dist/{pincode-CHM-ZD3H.d.ts → checkout-totals-DU8l-Wyb.d.ts} +42 -1
  13. package/dist/{chunk-NQZ5GUOG.cjs → chunk-3YPE6UPC.cjs} +24 -16
  14. package/dist/{chunk-Y4RNRPBC.js → chunk-DZPK7GPG.js} +58 -2
  15. package/dist/{chunk-TH7OAMGC.js → chunk-E4D4XOAE.js} +24 -16
  16. package/dist/{chunk-NRPK5GCJ.cjs → chunk-EFYAFXIS.cjs} +3 -3
  17. package/dist/{chunk-NOT6VKXA.cjs → chunk-H6UZTS5O.cjs} +67 -23
  18. package/dist/{chunk-ZAWZ3RB6.js → chunk-NNE42NMP.js} +1 -1
  19. package/dist/{chunk-QED6QJZC.cjs → chunk-PN6KH5PX.cjs} +59 -1
  20. package/dist/{chunk-QQHQTBAM.js → chunk-QSRVMOXT.js} +48 -6
  21. package/dist/{collections-CXgOv5_G.d.cts → collections-CKNFcE2d.d.cts} +1 -1
  22. package/dist/{collections-CNh2OGbl.d.ts → collections-CtRKsWVx.d.ts} +1 -1
  23. package/dist/components/digital-product-download-modal.d.cts +2 -2
  24. package/dist/components/digital-product-download-modal.d.ts +2 -2
  25. package/dist/components/index.d.cts +4 -5
  26. package/dist/components/index.d.ts +4 -5
  27. package/dist/components/share-button.d.cts +1 -1
  28. package/dist/components/share-button.d.ts +1 -1
  29. package/dist/components/theme-data-initializer.d.cts +4 -5
  30. package/dist/components/theme-data-initializer.d.ts +4 -5
  31. package/dist/hooks/index.cjs +62 -58
  32. package/dist/hooks/index.d.cts +9 -7
  33. package/dist/hooks/index.d.ts +9 -7
  34. package/dist/hooks/index.js +8 -5
  35. package/dist/{instagram-DalreBu6.d.cts → instagram-CSzrxk10.d.cts} +8 -2
  36. package/dist/{instagram-BADLnNQ3.d.ts → instagram-CagTLmyq.d.ts} +8 -2
  37. package/dist/models/index.d.cts +6 -7
  38. package/dist/models/index.d.ts +6 -7
  39. package/dist/orders-B6BmHCJN.d.ts +337 -0
  40. package/dist/orders-ZKP0lqRN.d.cts +337 -0
  41. package/dist/{pixelEvents-Ds6fwS9t.d.ts → pixelEvents-DqJ_CEEr.d.ts} +3 -4
  42. package/dist/{pixelEvents-COqZIgTu.d.cts → pixelEvents-bahgVW4_.d.cts} +3 -4
  43. package/dist/{product-D9liEtl4.d.cts → product-D4kol-Z-.d.cts} +26 -2
  44. package/dist/{product-D9liEtl4.d.ts → product-D4kol-Z-.d.ts} +26 -2
  45. package/dist/store/index.cjs +20 -30
  46. package/dist/store/index.d.cts +21 -7
  47. package/dist/store/index.d.ts +21 -7
  48. package/dist/store/index.js +9 -26
  49. package/dist/utils/index.cjs +2 -2
  50. package/dist/utils/index.d.cts +14 -8
  51. package/dist/utils/index.d.ts +14 -8
  52. package/dist/utils/index.js +1 -1
  53. package/dist/{wishlist-Cj0sQxiY.d.ts → wishlist-L3fM5-ie.d.ts} +1 -1
  54. package/dist/{wishlist-BakHvIFN.d.cts → wishlist-_0x0r1jt.d.cts} +1 -1
  55. package/package.json +1 -1
  56. package/dist/cart-DZq1ZEnE.d.ts +0 -153
  57. package/dist/cart-DwMFBmpC.d.cts +0 -153
  58. package/dist/orders-B3G4CyhH.d.cts +0 -166
  59. package/dist/orders-Bl-Slh72.d.ts +0 -166
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkY46EHRJQ_cjs = require('../chunk-Y46EHRJQ.cjs');
4
- var chunkNRPK5GCJ_cjs = require('../chunk-NRPK5GCJ.cjs');
5
- require('../chunk-NQZ5GUOG.cjs');
4
+ var chunkEFYAFXIS_cjs = require('../chunk-EFYAFXIS.cjs');
5
+ require('../chunk-3YPE6UPC.cjs');
6
6
  var chunkKNG4OMS5_cjs = require('../chunk-KNG4OMS5.cjs');
7
7
  var chunkH6FJYRO3_cjs = require('../chunk-H6FJYRO3.cjs');
8
8
  var chunk6APRQ2ED_cjs = require('../chunk-6APRQ2ED.cjs');
@@ -173,75 +173,75 @@ Object.defineProperty(exports, "updateUserDetails", {
173
173
  });
174
174
  Object.defineProperty(exports, "addToCart", {
175
175
  enumerable: true,
176
- get: function () { return chunkNRPK5GCJ_cjs.addToCart; }
176
+ get: function () { return chunkEFYAFXIS_cjs.addToCart; }
177
177
  });
178
178
  Object.defineProperty(exports, "addWishlist", {
179
179
  enumerable: true,
180
- get: function () { return chunkNRPK5GCJ_cjs.addWishlist; }
180
+ get: function () { return chunkEFYAFXIS_cjs.addWishlist; }
181
181
  });
182
182
  Object.defineProperty(exports, "getCart", {
183
183
  enumerable: true,
184
- get: function () { return chunkNRPK5GCJ_cjs.getCart; }
184
+ get: function () { return chunkEFYAFXIS_cjs.getCart; }
185
185
  });
186
186
  Object.defineProperty(exports, "getCartItemQuantity", {
187
187
  enumerable: true,
188
- get: function () { return chunkNRPK5GCJ_cjs.getCartItemQuantity; }
188
+ get: function () { return chunkEFYAFXIS_cjs.getCartItemQuantity; }
189
189
  });
190
190
  Object.defineProperty(exports, "getCategories", {
191
191
  enumerable: true,
192
- get: function () { return chunkNRPK5GCJ_cjs.getCategories; }
192
+ get: function () { return chunkEFYAFXIS_cjs.getCategories; }
193
193
  });
194
194
  Object.defineProperty(exports, "getDigitalProductDownloadLink", {
195
195
  enumerable: true,
196
- get: function () { return chunkNRPK5GCJ_cjs.getDigitalProductDownloadLink; }
196
+ get: function () { return chunkEFYAFXIS_cjs.getDigitalProductDownloadLink; }
197
197
  });
198
198
  Object.defineProperty(exports, "getProductCategories", {
199
199
  enumerable: true,
200
- get: function () { return chunkNRPK5GCJ_cjs.getProductCategories; }
200
+ get: function () { return chunkEFYAFXIS_cjs.getProductCategories; }
201
201
  });
202
202
  Object.defineProperty(exports, "getProductDetail", {
203
203
  enumerable: true,
204
- get: function () { return chunkNRPK5GCJ_cjs.getProductDetail; }
204
+ get: function () { return chunkEFYAFXIS_cjs.getProductDetail; }
205
205
  });
206
206
  Object.defineProperty(exports, "getProductDetailBySlug", {
207
207
  enumerable: true,
208
- get: function () { return chunkNRPK5GCJ_cjs.getProductDetailBySlug; }
208
+ get: function () { return chunkEFYAFXIS_cjs.getProductDetailBySlug; }
209
209
  });
210
210
  Object.defineProperty(exports, "getProductList", {
211
211
  enumerable: true,
212
- get: function () { return chunkNRPK5GCJ_cjs.getProductList; }
212
+ get: function () { return chunkEFYAFXIS_cjs.getProductList; }
213
213
  });
214
214
  Object.defineProperty(exports, "getProducts", {
215
215
  enumerable: true,
216
- get: function () { return chunkNRPK5GCJ_cjs.getProducts; }
216
+ get: function () { return chunkEFYAFXIS_cjs.getProducts; }
217
217
  });
218
218
  Object.defineProperty(exports, "getWishlist", {
219
219
  enumerable: true,
220
- get: function () { return chunkNRPK5GCJ_cjs.getWishlist; }
220
+ get: function () { return chunkEFYAFXIS_cjs.getWishlist; }
221
221
  });
222
222
  Object.defineProperty(exports, "mergeCart", {
223
223
  enumerable: true,
224
- get: function () { return chunkNRPK5GCJ_cjs.mergeCart; }
224
+ get: function () { return chunkEFYAFXIS_cjs.mergeCart; }
225
225
  });
226
226
  Object.defineProperty(exports, "notifyProductStock", {
227
227
  enumerable: true,
228
- get: function () { return chunkNRPK5GCJ_cjs.notifyProductStock; }
228
+ get: function () { return chunkEFYAFXIS_cjs.notifyProductStock; }
229
229
  });
230
230
  Object.defineProperty(exports, "removeFromCart", {
231
231
  enumerable: true,
232
- get: function () { return chunkNRPK5GCJ_cjs.removeFromCart; }
232
+ get: function () { return chunkEFYAFXIS_cjs.removeFromCart; }
233
233
  });
234
234
  Object.defineProperty(exports, "removeFromWishlist", {
235
235
  enumerable: true,
236
- get: function () { return chunkNRPK5GCJ_cjs.removeFromWishlist; }
236
+ get: function () { return chunkEFYAFXIS_cjs.removeFromWishlist; }
237
237
  });
238
238
  Object.defineProperty(exports, "updateCart", {
239
239
  enumerable: true,
240
- get: function () { return chunkNRPK5GCJ_cjs.updateCart; }
240
+ get: function () { return chunkEFYAFXIS_cjs.updateCart; }
241
241
  });
242
242
  Object.defineProperty(exports, "updateDigitalProductDownloadLinkCount", {
243
243
  enumerable: true,
244
- get: function () { return chunkNRPK5GCJ_cjs.updateDigitalProductDownloadLinkCount; }
244
+ get: function () { return chunkEFYAFXIS_cjs.updateDigitalProductDownloadLinkCount; }
245
245
  });
246
246
  Object.defineProperty(exports, "applyCoupon", {
247
247
  enumerable: true,
@@ -1,13 +1,12 @@
1
1
  import * as axios from 'axios';
2
2
  import { AxiosInstance, AxiosResponse } from 'axios';
3
3
  import { A as Address } from '../address-BdIB6IuI.cjs';
4
- import { U as User, C as Cart, d as CouponResponse, c as Coupon, b as Category } from '../cart-DwMFBmpC.cjs';
5
- import { d as Product, f as ProductDetail } from '../product-D9liEtl4.cjs';
6
- import { O as Order } from '../orders-B3G4CyhH.cjs';
7
- import { B as BuyNow, P as PublicCheckout } from '../buy-now-B_15RUVT.cjs';
8
- import { W as Wishlist } from '../wishlist-BakHvIFN.cjs';
9
- import { C as CollectionResponse } from '../collections-CXgOv5_G.cjs';
10
- import { R as Review, A as Analytics, a as Booking, B as Blog, I as Instagram } from '../instagram-DalreBu6.cjs';
4
+ import { U as User, C as Cart, d as CouponResponse, c as Coupon, O as Order, b as Category } from '../orders-ZKP0lqRN.cjs';
5
+ import { d as Product, f as ProductDetail } from '../product-D4kol-Z-.cjs';
6
+ import { B as BuyNow, P as PublicCheckout } from '../buy-now-DrKY5_9R.cjs';
7
+ import { W as Wishlist } from '../wishlist-_0x0r1jt.cjs';
8
+ import { C as CollectionResponse } from '../collections-CKNFcE2d.cjs';
9
+ import { R as Review, A as Analytics, c as BookingResponse, B as Blog, I as Instagram } from '../instagram-CSzrxk10.cjs';
11
10
  import { P as Pincode } from '../pincode-8u7yWLpQ.cjs';
12
11
  import 'react-toastify';
13
12
 
@@ -217,11 +216,7 @@ declare function updateOrderCustomization(customizationInput: unknown): Promise<
217
216
  declare function uploadCustomizationImage(uploadForm: FormData): Promise<AxiosResponse<{
218
217
  image_paths: string[];
219
218
  }>>;
220
- declare function verifyTabbyPayment(orderNumber: number): Promise<AxiosResponse<{
221
- order_status: string;
222
- message: string;
223
- status: string;
224
- }>>;
219
+ declare function verifyTabbyPayment(orderNumber: number): Promise<AxiosResponse<Order.TabbyPaymentStatus>>;
225
220
 
226
221
  declare function getProductList(url: string, filter: unknown): Promise<Product.ProductResponse>;
227
222
  declare function getProducts(filter: Product.ProductFilter): Promise<AxiosResponse<Product.ProductResponse>>;
@@ -273,9 +268,7 @@ interface BookingFilter {
273
268
  page?: number;
274
269
  page_size?: number;
275
270
  }
276
- declare function getUserBookings(filter: BookingFilter): Promise<AxiosResponse<{
277
- results: Booking[];
278
- }>>;
271
+ declare function getUserBookings(filter: BookingFilter): Promise<AxiosResponse<BookingResponse>>;
279
272
 
280
273
  declare function getBlogPostsList(filter: any): Promise<AxiosResponse<{
281
274
  results: Blog.Post[];
@@ -1,13 +1,12 @@
1
1
  import * as axios from 'axios';
2
2
  import { AxiosInstance, AxiosResponse } from 'axios';
3
3
  import { A as Address } from '../address-BdIB6IuI.js';
4
- import { U as User, C as Cart, d as CouponResponse, c as Coupon, b as Category } from '../cart-DZq1ZEnE.js';
5
- import { d as Product, f as ProductDetail } from '../product-D9liEtl4.js';
6
- import { O as Order } from '../orders-Bl-Slh72.js';
7
- import { B as BuyNow, P as PublicCheckout } from '../buy-now-kII0KrhP.js';
8
- import { W as Wishlist } from '../wishlist-Cj0sQxiY.js';
9
- import { C as CollectionResponse } from '../collections-CNh2OGbl.js';
10
- import { R as Review, A as Analytics, a as Booking, B as Blog, I as Instagram } from '../instagram-BADLnNQ3.js';
4
+ import { U as User, C as Cart, d as CouponResponse, c as Coupon, O as Order, b as Category } from '../orders-B6BmHCJN.js';
5
+ import { d as Product, f as ProductDetail } from '../product-D4kol-Z-.js';
6
+ import { B as BuyNow, P as PublicCheckout } from '../buy-now-CDug6LJ_.js';
7
+ import { W as Wishlist } from '../wishlist-L3fM5-ie.js';
8
+ import { C as CollectionResponse } from '../collections-CtRKsWVx.js';
9
+ import { R as Review, A as Analytics, c as BookingResponse, B as Blog, I as Instagram } from '../instagram-CagTLmyq.js';
11
10
  import { P as Pincode } from '../pincode-8u7yWLpQ.js';
12
11
  import 'react-toastify';
13
12
 
@@ -217,11 +216,7 @@ declare function updateOrderCustomization(customizationInput: unknown): Promise<
217
216
  declare function uploadCustomizationImage(uploadForm: FormData): Promise<AxiosResponse<{
218
217
  image_paths: string[];
219
218
  }>>;
220
- declare function verifyTabbyPayment(orderNumber: number): Promise<AxiosResponse<{
221
- order_status: string;
222
- message: string;
223
- status: string;
224
- }>>;
219
+ declare function verifyTabbyPayment(orderNumber: number): Promise<AxiosResponse<Order.TabbyPaymentStatus>>;
225
220
 
226
221
  declare function getProductList(url: string, filter: unknown): Promise<Product.ProductResponse>;
227
222
  declare function getProducts(filter: Product.ProductFilter): Promise<AxiosResponse<Product.ProductResponse>>;
@@ -273,9 +268,7 @@ interface BookingFilter {
273
268
  page?: number;
274
269
  page_size?: number;
275
270
  }
276
- declare function getUserBookings(filter: BookingFilter): Promise<AxiosResponse<{
277
- results: Booking[];
278
- }>>;
271
+ declare function getUserBookings(filter: BookingFilter): Promise<AxiosResponse<BookingResponse>>;
279
272
 
280
273
  declare function getBlogPostsList(filter: any): Promise<AxiosResponse<{
281
274
  results: Blog.Post[];
package/dist/api/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { getUserDetails, updateUserDetails } from '../chunk-WYXT5AAG.js';
2
- export { addToCart, addWishlist, getCart, getCartItemQuantity, getCategories, getDigitalProductDownloadLink, getProductCategories, getProductDetail, getProductDetailBySlug, getProductList, getProducts, getWishlist, mergeCart, notifyProductStock, removeFromCart, removeFromWishlist, updateCart, updateDigitalProductDownloadLinkCount } from '../chunk-ZAWZ3RB6.js';
3
- import '../chunk-TH7OAMGC.js';
2
+ export { addToCart, addWishlist, getCart, getCartItemQuantity, getCategories, getDigitalProductDownloadLink, getProductCategories, getProductDetail, getProductDetailBySlug, getProductList, getProducts, getWishlist, mergeCart, notifyProductStock, removeFromCart, removeFromWishlist, updateCart, updateDigitalProductDownloadLinkCount } from '../chunk-NNE42NMP.js';
3
+ import '../chunk-E4D4XOAE.js';
4
4
  export { applyCoupon, getAppliedCoupon, getCoupons, getPincodeDetails, removeCoupon } from '../chunk-A7EI7XLU.js';
5
5
  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 } from '../chunk-KCLVR6G5.js';
6
6
  export { addAddress, deleteAddress, getAddresses, getCountries, getSubdivisions, updateAddress } from '../chunk-VRZRV2BR.js';
@@ -1,5 +1,5 @@
1
1
  import { A as Address } from './address-BdIB6IuI.js';
2
- import { C as Cart, c as Coupon } from './cart-DZq1ZEnE.js';
2
+ import { C as Cart, c as Coupon } from './orders-B6BmHCJN.js';
3
3
 
4
4
  /**
5
5
  * Types shared by the two checkout surfaces that price an *inline* selection
@@ -1,5 +1,5 @@
1
1
  import { A as Address } from './address-BdIB6IuI.cjs';
2
- import { C as Cart, c as Coupon } from './cart-DwMFBmpC.cjs';
2
+ import { C as Cart, c as Coupon } from './orders-ZKP0lqRN.cjs';
3
3
 
4
4
  /**
5
5
  * Types shared by the two checkout surfaces that price an *inline* selection
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQED6QJZC_cjs = require('../chunk-QED6QJZC.cjs');
3
+ var chunkPN6KH5PX_cjs = require('../chunk-PN6KH5PX.cjs');
4
4
  require('../chunk-KNG4OMS5.cjs');
5
5
  var chunkNSAHGMS7_cjs = require('../chunk-NSAHGMS7.cjs');
6
6
  var chunkH6FJYRO3_cjs = require('../chunk-H6FJYRO3.cjs');
@@ -11,42 +11,6 @@ require('../chunk-BBRXE57K.cjs');
11
11
  require('../chunk-NE3ZHELZ.cjs');
12
12
  require('../chunk-N3CTXRFT.cjs');
13
13
 
14
- // src/checkout/cart-calculations.ts
15
- function calculateCartTotals(cart) {
16
- if (!cart) {
17
- return {
18
- totalSellingAmount: 0,
19
- discountAmount: 0,
20
- isCartEmpty: true,
21
- allInclusiveTax: true,
22
- exclusiveTaxAmount: 0
23
- };
24
- }
25
- let totalSellingAmount = 0;
26
- let discountAmount = 0;
27
- let exclusiveTaxAmount = 0;
28
- let allInclusiveTax = true;
29
- cart.product_variants?.forEach((item) => {
30
- const quantity = cart.products_quantity[item.id] || 0;
31
- const actualPrice = Number(item.actual_price);
32
- const sellingPrice = Number(item.selling_price);
33
- const variant = item;
34
- totalSellingAmount += actualPrice ? actualPrice * quantity : sellingPrice * quantity;
35
- discountAmount += actualPrice ? (actualPrice - sellingPrice) * quantity : 0;
36
- if (!variant.is_tax_inclusive_price) {
37
- allInclusiveTax = false;
38
- exclusiveTaxAmount += Number(variant.total_tax_price || 0) * quantity;
39
- }
40
- });
41
- return {
42
- totalSellingAmount,
43
- discountAmount,
44
- isCartEmpty: !cart.product_variants?.length,
45
- allInclusiveTax,
46
- exclusiveTaxAmount
47
- };
48
- }
49
-
50
14
  // src/checkout/placement-error.ts
51
15
  function describePlacementError(error) {
52
16
  const code = error?.response?.data?.error_code || error?.response?.data?.code;
@@ -89,57 +53,73 @@ function describePlacementError(error) {
89
53
  }
90
54
 
91
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
+ }
92
72
  async function checkPhonepeReturnStatus(transactionId, callbacks, options) {
93
73
  try {
94
74
  const checkStatus = options?.isPublic ? chunkH6FJYRO3_cjs.checkPhonepePaymentStatusPublic : chunkH6FJYRO3_cjs.checkPhonepePaymentStatus;
95
75
  const response = await checkStatus(transactionId);
96
76
  if (response.data.success) {
97
77
  callbacks.onSuccess(void 0);
98
- } else {
99
- callbacks.onFailure();
78
+ return;
100
79
  }
101
80
  } catch {
102
- callbacks.onFailure();
103
81
  }
82
+ if (options?.reportFailure) await reportPhonepeFailure(transactionId, null, options.isPublic);
83
+ callbacks.onFailure();
104
84
  }
105
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;
106
89
  try {
107
- const checkStatus = options?.isPublic ? chunkH6FJYRO3_cjs.checkPhonepePaymentStatusPublic : chunkH6FJYRO3_cjs.checkPhonepePaymentStatus;
108
- const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
109
90
  const [paymentResponse, orderResponse] = await Promise.all([
110
91
  checkStatus(transactionId),
111
92
  getOrder(orderNumber)
112
93
  ]);
113
- const order = orderResponse.data;
94
+ order = orderResponse.data;
114
95
  callbacks.onOrderLoaded?.(order);
115
96
  if (paymentResponse.data.success) {
116
97
  chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
117
98
  chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
118
99
  callbacks.onSuccess(order);
119
- } else {
120
- callbacks.onFailure();
100
+ return;
121
101
  }
122
102
  } catch {
123
- callbacks.onFailure();
124
103
  }
104
+ if (options?.reportFailure) await reportPhonepeFailure(transactionId, order, options.isPublic);
105
+ callbacks.onFailure();
125
106
  }
126
107
  async function checkStripeReturnStatus(sessionId, orderNumber, paymentLinkUrl, callbacks, options) {
127
108
  try {
128
109
  const getStatus = options?.isPublic ? chunkH6FJYRO3_cjs.getStripePaymentStatusPublic : chunkH6FJYRO3_cjs.getStripePaymentStatus;
129
- const response = await getStatus(sessionId, orderNumber, paymentLinkUrl);
130
- const data = response.data;
131
- if (data.payment_status === "paid" || data.status === "complete") {
132
- try {
133
- const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
134
- const orderResponse = await getOrder(orderNumber);
135
- const order = orderResponse.data;
136
- 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) {
137
119
  chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
138
120
  chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
139
- callbacks.onSuccess(order);
140
- } catch {
141
- callbacks.onSuccess(void 0);
142
121
  }
122
+ callbacks.onSuccess(order ?? void 0);
143
123
  } else {
144
124
  callbacks.onFailure();
145
125
  }
@@ -148,6 +128,7 @@ async function checkStripeReturnStatus(sessionId, orderNumber, paymentLinkUrl, c
148
128
  }
149
129
  }
150
130
  async function checkTabbyReturnStatus(orderNumber, callbacks, options) {
131
+ let tabbyPaymentId = options?.paymentId || void 0;
151
132
  try {
152
133
  const getOrder = options?.isPublic ? chunkH6FJYRO3_cjs.getPublicOrderDetailsByNumber : chunkH6FJYRO3_cjs.getOrderDetailsByNumber;
153
134
  const [response, orderResponse] = await Promise.all([
@@ -156,163 +137,175 @@ async function checkTabbyReturnStatus(orderNumber, callbacks, options) {
156
137
  ]);
157
138
  const order = orderResponse?.data;
158
139
  if (order) callbacks.onOrderLoaded?.(order);
159
- if (response.data.order_status === "paid" || response.data.order_status === "confirmed" || response.data.status === "paid") {
140
+ if (isTabbyPaid(response.data)) {
160
141
  if (order) {
161
142
  chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
162
143
  chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
163
144
  }
164
145
  callbacks.onSuccess(order ?? void 0);
165
- } else {
166
- callbacks.onFailure();
146
+ return;
167
147
  }
148
+ tabbyPaymentId = tabbyPaymentId || response.data.payment_id;
168
149
  } catch {
169
- callbacks.onFailure();
170
150
  }
151
+ if (options?.reportFailure && tabbyPaymentId) {
152
+ await chunkH6FJYRO3_cjs.tabbyPaymentFailure(tabbyPaymentId).catch(() => {
153
+ });
154
+ }
155
+ callbacks.onFailure();
171
156
  }
172
157
 
173
158
  Object.defineProperty(exports, "DEFAULT_ADDRESS_SCHEMA_MESSAGES", {
174
159
  enumerable: true,
175
- get: function () { return chunkQED6QJZC_cjs.DEFAULT_ADDRESS_SCHEMA_MESSAGES; }
160
+ get: function () { return chunkPN6KH5PX_cjs.DEFAULT_ADDRESS_SCHEMA_MESSAGES; }
176
161
  });
177
162
  Object.defineProperty(exports, "INVALID_PINCODE", {
178
163
  enumerable: true,
179
- get: function () { return chunkQED6QJZC_cjs.INVALID_PINCODE; }
164
+ get: function () { return chunkPN6KH5PX_cjs.INVALID_PINCODE; }
180
165
  });
181
166
  Object.defineProperty(exports, "NO_POSTAL_CODE", {
182
167
  enumerable: true,
183
- get: function () { return chunkQED6QJZC_cjs.NO_POSTAL_CODE; }
168
+ get: function () { return chunkPN6KH5PX_cjs.NO_POSTAL_CODE; }
184
169
  });
185
170
  Object.defineProperty(exports, "PINCODE_DEBOUNCE_MS", {
186
171
  enumerable: true,
187
- get: function () { return chunkQED6QJZC_cjs.PINCODE_DEBOUNCE_MS; }
172
+ get: function () { return chunkPN6KH5PX_cjs.PINCODE_DEBOUNCE_MS; }
188
173
  });
189
174
  Object.defineProperty(exports, "PINCODE_MIN_LENGTH", {
190
175
  enumerable: true,
191
- get: function () { return chunkQED6QJZC_cjs.PINCODE_MIN_LENGTH; }
176
+ get: function () { return chunkPN6KH5PX_cjs.PINCODE_MIN_LENGTH; }
192
177
  });
193
178
  Object.defineProperty(exports, "PINCODE_VALIDATION_UNAVAILABLE", {
194
179
  enumerable: true,
195
- get: function () { return chunkQED6QJZC_cjs.PINCODE_VALIDATION_UNAVAILABLE; }
180
+ get: function () { return chunkPN6KH5PX_cjs.PINCODE_VALIDATION_UNAVAILABLE; }
196
181
  });
197
182
  Object.defineProperty(exports, "applyCheckoutCoupon", {
198
183
  enumerable: true,
199
- get: function () { return chunkQED6QJZC_cjs.applyCheckoutCoupon; }
184
+ get: function () { return chunkPN6KH5PX_cjs.applyCheckoutCoupon; }
200
185
  });
201
186
  Object.defineProperty(exports, "buildAddressFormat", {
202
187
  enumerable: true,
203
- get: function () { return chunkQED6QJZC_cjs.buildAddressFormat; }
188
+ get: function () { return chunkPN6KH5PX_cjs.buildAddressFormat; }
204
189
  });
205
190
  Object.defineProperty(exports, "buildAddressSchema", {
206
191
  enumerable: true,
207
- get: function () { return chunkQED6QJZC_cjs.buildAddressSchema; }
192
+ get: function () { return chunkPN6KH5PX_cjs.buildAddressSchema; }
193
+ });
194
+ Object.defineProperty(exports, "calculateCartTotals", {
195
+ enumerable: true,
196
+ get: function () { return chunkPN6KH5PX_cjs.calculateCartTotals; }
208
197
  });
209
198
  Object.defineProperty(exports, "clearPincodeCache", {
210
199
  enumerable: true,
211
- get: function () { return chunkQED6QJZC_cjs.clearPincodeCache; }
200
+ get: function () { return chunkPN6KH5PX_cjs.clearPincodeCache; }
212
201
  });
213
202
  Object.defineProperty(exports, "fetchAppliedCoupon", {
214
203
  enumerable: true,
215
- get: function () { return chunkQED6QJZC_cjs.fetchAppliedCoupon; }
204
+ get: function () { return chunkPN6KH5PX_cjs.fetchAppliedCoupon; }
216
205
  });
217
206
  Object.defineProperty(exports, "fetchAvailableCoupons", {
218
207
  enumerable: true,
219
- get: function () { return chunkQED6QJZC_cjs.fetchAvailableCoupons; }
208
+ get: function () { return chunkPN6KH5PX_cjs.fetchAvailableCoupons; }
220
209
  });
221
210
  Object.defineProperty(exports, "findStateByName", {
222
211
  enumerable: true,
223
- get: function () { return chunkQED6QJZC_cjs.findStateByName; }
212
+ get: function () { return chunkPN6KH5PX_cjs.findStateByName; }
224
213
  });
225
214
  Object.defineProperty(exports, "findSubdivision", {
226
215
  enumerable: true,
227
- get: function () { return chunkQED6QJZC_cjs.findSubdivision; }
216
+ get: function () { return chunkPN6KH5PX_cjs.findSubdivision; }
228
217
  });
229
218
  Object.defineProperty(exports, "getAreaOptions", {
230
219
  enumerable: true,
231
- get: function () { return chunkQED6QJZC_cjs.getAreaOptions; }
220
+ get: function () { return chunkPN6KH5PX_cjs.getAreaOptions; }
221
+ });
222
+ Object.defineProperty(exports, "getCustomizationPrice", {
223
+ enumerable: true,
224
+ get: function () { return chunkPN6KH5PX_cjs.getCustomizationPrice; }
232
225
  });
233
226
  Object.defineProperty(exports, "getPincodeError", {
234
227
  enumerable: true,
235
- get: function () { return chunkQED6QJZC_cjs.getPincodeError; }
228
+ get: function () { return chunkPN6KH5PX_cjs.getPincodeError; }
236
229
  });
237
230
  Object.defineProperty(exports, "getPostcodeHint", {
238
231
  enumerable: true,
239
- get: function () { return chunkQED6QJZC_cjs.getPostcodeHint; }
232
+ get: function () { return chunkPN6KH5PX_cjs.getPostcodeHint; }
240
233
  });
241
234
  Object.defineProperty(exports, "handleCODPayment", {
242
235
  enumerable: true,
243
- get: function () { return chunkQED6QJZC_cjs.handleCODPayment; }
236
+ get: function () { return chunkPN6KH5PX_cjs.handleCODPayment; }
244
237
  });
245
238
  Object.defineProperty(exports, "handlePhonepePayment", {
246
239
  enumerable: true,
247
- get: function () { return chunkQED6QJZC_cjs.handlePhonepePayment; }
240
+ get: function () { return chunkPN6KH5PX_cjs.handlePhonepePayment; }
248
241
  });
249
242
  Object.defineProperty(exports, "handleRazorpayFail", {
250
243
  enumerable: true,
251
- get: function () { return chunkQED6QJZC_cjs.handleRazorpayFail; }
244
+ get: function () { return chunkPN6KH5PX_cjs.handleRazorpayFail; }
252
245
  });
253
246
  Object.defineProperty(exports, "handleRazorpaySuccess", {
254
247
  enumerable: true,
255
- get: function () { return chunkQED6QJZC_cjs.handleRazorpaySuccess; }
248
+ get: function () { return chunkPN6KH5PX_cjs.handleRazorpaySuccess; }
256
249
  });
257
250
  Object.defineProperty(exports, "handleStripePayment", {
258
251
  enumerable: true,
259
- get: function () { return chunkQED6QJZC_cjs.handleStripePayment; }
252
+ get: function () { return chunkPN6KH5PX_cjs.handleStripePayment; }
260
253
  });
261
254
  Object.defineProperty(exports, "handleStripeSuccess", {
262
255
  enumerable: true,
263
- get: function () { return chunkQED6QJZC_cjs.handleStripeSuccess; }
256
+ get: function () { return chunkPN6KH5PX_cjs.handleStripeSuccess; }
264
257
  });
265
258
  Object.defineProperty(exports, "handleTabbyPayment", {
266
259
  enumerable: true,
267
- get: function () { return chunkQED6QJZC_cjs.handleTabbyPayment; }
260
+ get: function () { return chunkPN6KH5PX_cjs.handleTabbyPayment; }
268
261
  });
269
262
  Object.defineProperty(exports, "isValidNumber", {
270
263
  enumerable: true,
271
- get: function () { return chunkQED6QJZC_cjs.isValidNumber; }
264
+ get: function () { return chunkPN6KH5PX_cjs.isValidNumber; }
272
265
  });
273
266
  Object.defineProperty(exports, "joinAddressLines", {
274
267
  enumerable: true,
275
- get: function () { return chunkQED6QJZC_cjs.joinAddressLines; }
268
+ get: function () { return chunkPN6KH5PX_cjs.joinAddressLines; }
276
269
  });
277
270
  Object.defineProperty(exports, "loadAddressFormat", {
278
271
  enumerable: true,
279
- get: function () { return chunkQED6QJZC_cjs.loadAddressFormat; }
272
+ get: function () { return chunkPN6KH5PX_cjs.loadAddressFormat; }
280
273
  });
281
274
  Object.defineProperty(exports, "lowerLabel", {
282
275
  enumerable: true,
283
- get: function () { return chunkQED6QJZC_cjs.lowerLabel; }
276
+ get: function () { return chunkPN6KH5PX_cjs.lowerLabel; }
284
277
  });
285
278
  Object.defineProperty(exports, "normalizePostcode", {
286
279
  enumerable: true,
287
- get: function () { return chunkQED6QJZC_cjs.normalizePostcode; }
280
+ get: function () { return chunkPN6KH5PX_cjs.normalizePostcode; }
288
281
  });
289
282
  Object.defineProperty(exports, "openRazorpayCheckout", {
290
283
  enumerable: true,
291
- get: function () { return chunkQED6QJZC_cjs.openRazorpayCheckout; }
284
+ get: function () { return chunkPN6KH5PX_cjs.openRazorpayCheckout; }
292
285
  });
293
286
  Object.defineProperty(exports, "processPayment", {
294
287
  enumerable: true,
295
- get: function () { return chunkQED6QJZC_cjs.processPayment; }
288
+ get: function () { return chunkPN6KH5PX_cjs.processPayment; }
296
289
  });
297
290
  Object.defineProperty(exports, "removeCheckoutCoupon", {
298
291
  enumerable: true,
299
- get: function () { return chunkQED6QJZC_cjs.removeCheckoutCoupon; }
292
+ get: function () { return chunkPN6KH5PX_cjs.removeCheckoutCoupon; }
300
293
  });
301
294
  Object.defineProperty(exports, "sanitizePhoneInput", {
302
295
  enumerable: true,
303
- get: function () { return chunkQED6QJZC_cjs.sanitizePhoneInput; }
296
+ get: function () { return chunkPN6KH5PX_cjs.sanitizePhoneInput; }
304
297
  });
305
298
  Object.defineProperty(exports, "sanitizePincode", {
306
299
  enumerable: true,
307
- get: function () { return chunkQED6QJZC_cjs.sanitizePincode; }
300
+ get: function () { return chunkPN6KH5PX_cjs.sanitizePincode; }
308
301
  });
309
302
  Object.defineProperty(exports, "usableEmail", {
310
303
  enumerable: true,
311
- get: function () { return chunkQED6QJZC_cjs.usableEmail; }
304
+ get: function () { return chunkPN6KH5PX_cjs.usableEmail; }
312
305
  });
313
306
  Object.defineProperty(exports, "validatePincode", {
314
307
  enumerable: true,
315
- get: function () { return chunkQED6QJZC_cjs.validatePincode; }
308
+ get: function () { return chunkPN6KH5PX_cjs.validatePincode; }
316
309
  });
317
310
  Object.defineProperty(exports, "IP_API_CACHE_KEY", {
318
311
  enumerable: true,
@@ -366,9 +359,10 @@ Object.defineProperty(exports, "saveAddressFormToSession", {
366
359
  enumerable: true,
367
360
  get: function () { return chunkTB72NPRM_cjs.saveAddressFormToSession; }
368
361
  });
369
- exports.calculateCartTotals = calculateCartTotals;
370
362
  exports.checkPhonepeReturnStatus = checkPhonepeReturnStatus;
371
363
  exports.checkPhonepeReturnStatusWithOrder = checkPhonepeReturnStatusWithOrder;
372
364
  exports.checkStripeReturnStatus = checkStripeReturnStatus;
373
365
  exports.checkTabbyReturnStatus = checkTabbyReturnStatus;
374
366
  exports.describePlacementError = describePlacementError;
367
+ exports.isStripePaid = isStripePaid;
368
+ exports.isTabbyPaid = isTabbyPaid;