@storepecker/storefront-core 2.5.0 → 2.5.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkTLNCCSTQ_cjs = require('../chunk-TLNCCSTQ.cjs');
3
+ var chunkPZJT2Y5B_cjs = require('../chunk-PZJT2Y5B.cjs');
4
4
  require('../chunk-XFOUNOKO.cjs');
5
5
  var chunkK44JZ5NL_cjs = require('../chunk-K44JZ5NL.cjs');
6
6
  var chunkDXQX7ZIL_cjs = require('../chunk-DXQX7ZIL.cjs');
@@ -125,55 +125,55 @@ async function checkTabbyReturnStatus(orderNumber, callbacks) {
125
125
 
126
126
  Object.defineProperty(exports, "applyCheckoutCoupon", {
127
127
  enumerable: true,
128
- get: function () { return chunkTLNCCSTQ_cjs.applyCheckoutCoupon; }
128
+ get: function () { return chunkPZJT2Y5B_cjs.applyCheckoutCoupon; }
129
129
  });
130
130
  Object.defineProperty(exports, "fetchAppliedCoupon", {
131
131
  enumerable: true,
132
- get: function () { return chunkTLNCCSTQ_cjs.fetchAppliedCoupon; }
132
+ get: function () { return chunkPZJT2Y5B_cjs.fetchAppliedCoupon; }
133
133
  });
134
134
  Object.defineProperty(exports, "fetchAvailableCoupons", {
135
135
  enumerable: true,
136
- get: function () { return chunkTLNCCSTQ_cjs.fetchAvailableCoupons; }
136
+ get: function () { return chunkPZJT2Y5B_cjs.fetchAvailableCoupons; }
137
137
  });
138
138
  Object.defineProperty(exports, "handleCODPayment", {
139
139
  enumerable: true,
140
- get: function () { return chunkTLNCCSTQ_cjs.handleCODPayment; }
140
+ get: function () { return chunkPZJT2Y5B_cjs.handleCODPayment; }
141
141
  });
142
142
  Object.defineProperty(exports, "handlePhonepePayment", {
143
143
  enumerable: true,
144
- get: function () { return chunkTLNCCSTQ_cjs.handlePhonepePayment; }
144
+ get: function () { return chunkPZJT2Y5B_cjs.handlePhonepePayment; }
145
145
  });
146
146
  Object.defineProperty(exports, "handleRazorpayFail", {
147
147
  enumerable: true,
148
- get: function () { return chunkTLNCCSTQ_cjs.handleRazorpayFail; }
148
+ get: function () { return chunkPZJT2Y5B_cjs.handleRazorpayFail; }
149
149
  });
150
150
  Object.defineProperty(exports, "handleRazorpaySuccess", {
151
151
  enumerable: true,
152
- get: function () { return chunkTLNCCSTQ_cjs.handleRazorpaySuccess; }
152
+ get: function () { return chunkPZJT2Y5B_cjs.handleRazorpaySuccess; }
153
153
  });
154
154
  Object.defineProperty(exports, "handleStripePayment", {
155
155
  enumerable: true,
156
- get: function () { return chunkTLNCCSTQ_cjs.handleStripePayment; }
156
+ get: function () { return chunkPZJT2Y5B_cjs.handleStripePayment; }
157
157
  });
158
158
  Object.defineProperty(exports, "handleStripeSuccess", {
159
159
  enumerable: true,
160
- get: function () { return chunkTLNCCSTQ_cjs.handleStripeSuccess; }
160
+ get: function () { return chunkPZJT2Y5B_cjs.handleStripeSuccess; }
161
161
  });
162
162
  Object.defineProperty(exports, "handleTabbyPayment", {
163
163
  enumerable: true,
164
- get: function () { return chunkTLNCCSTQ_cjs.handleTabbyPayment; }
164
+ get: function () { return chunkPZJT2Y5B_cjs.handleTabbyPayment; }
165
165
  });
166
166
  Object.defineProperty(exports, "openRazorpayCheckout", {
167
167
  enumerable: true,
168
- get: function () { return chunkTLNCCSTQ_cjs.openRazorpayCheckout; }
168
+ get: function () { return chunkPZJT2Y5B_cjs.openRazorpayCheckout; }
169
169
  });
170
170
  Object.defineProperty(exports, "processPayment", {
171
171
  enumerable: true,
172
- get: function () { return chunkTLNCCSTQ_cjs.processPayment; }
172
+ get: function () { return chunkPZJT2Y5B_cjs.processPayment; }
173
173
  });
174
174
  Object.defineProperty(exports, "removeCheckoutCoupon", {
175
175
  enumerable: true,
176
- get: function () { return chunkTLNCCSTQ_cjs.removeCheckoutCoupon; }
176
+ get: function () { return chunkPZJT2Y5B_cjs.removeCheckoutCoupon; }
177
177
  });
178
178
  Object.defineProperty(exports, "IP_API_CACHE_KEY", {
179
179
  enumerable: true,
@@ -194,7 +194,7 @@ declare function handleRazorpaySuccess(data: {
194
194
  /**
195
195
  * Handle Razorpay payment failure — notify the backend.
196
196
  */
197
- declare function handleRazorpayFail(order: Order.OrderSummary, callbacks: PaymentCallbacks): Promise<void>;
197
+ declare function handleRazorpayFail(order: Order.OrderSummary, callbacks: PaymentCallbacks, error?: any): Promise<void>;
198
198
  /**
199
199
  * Handle PhonePe payment — redirect to the PhonePe URL.
200
200
  */
@@ -194,7 +194,7 @@ declare function handleRazorpaySuccess(data: {
194
194
  /**
195
195
  * Handle Razorpay payment failure — notify the backend.
196
196
  */
197
- declare function handleRazorpayFail(order: Order.OrderSummary, callbacks: PaymentCallbacks): Promise<void>;
197
+ declare function handleRazorpayFail(order: Order.OrderSummary, callbacks: PaymentCallbacks, error?: any): Promise<void>;
198
198
  /**
199
199
  * Handle PhonePe payment — redirect to the PhonePe URL.
200
200
  */
@@ -1,4 +1,4 @@
1
- export { applyCheckoutCoupon, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, openRazorpayCheckout, processPayment, removeCheckoutCoupon } from '../chunk-VETLYY7W.js';
1
+ export { applyCheckoutCoupon, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, openRazorpayCheckout, processPayment, removeCheckoutCoupon } from '../chunk-NXQIWB36.js';
2
2
  import '../chunk-7M5CVYZJ.js';
3
3
  import { pixelEvents } from '../chunk-WFDKKOO7.js';
4
4
  import { checkPhonepePaymentStatus, getOrderDetailsByNumber, getStripePaymentStatusPublic, getStripePaymentStatus, verifyTabbyPayment } from '../chunk-S3ZZ3ZA7.js';
@@ -52,12 +52,15 @@ function openRazorpayCheckout(order, callbacks) {
52
52
  phone: customer_phone
53
53
  },
54
54
  modal: {
55
- ondismiss: () => handleRazorpayFail(order, callbacks)
55
+ ondismiss: () => handleRazorpayFail(order, callbacks, {
56
+ description: "User cancelled the payment manually",
57
+ reason: "user_cancelled_payment_manually"
58
+ })
56
59
  }
57
60
  };
58
61
  const paymentObject = new window.Razorpay(options);
59
- paymentObject.on("payment.failed", () => {
60
- handleRazorpayFail(order, callbacks);
62
+ paymentObject.on("payment.failed", (response) => {
63
+ handleRazorpayFail(order, callbacks, response?.error);
61
64
  });
62
65
  paymentObject.open();
63
66
  }
@@ -75,11 +78,12 @@ async function handleRazorpaySuccess(data, order, callbacks) {
75
78
  callbacks.onPaymentEnd?.();
76
79
  }
77
80
  }
78
- async function handleRazorpayFail(order, callbacks) {
81
+ async function handleRazorpayFail(order, callbacks, error) {
79
82
  try {
80
83
  await razorpayOrderFail({
81
84
  order_id: order.id,
82
- razorpay_order_id: order.razorpay_order_id
85
+ razorpay_order_id: order.razorpay_order_id,
86
+ error
83
87
  });
84
88
  } catch {
85
89
  }
@@ -54,12 +54,15 @@ function openRazorpayCheckout(order, callbacks) {
54
54
  phone: customer_phone
55
55
  },
56
56
  modal: {
57
- ondismiss: () => handleRazorpayFail(order, callbacks)
57
+ ondismiss: () => handleRazorpayFail(order, callbacks, {
58
+ description: "User cancelled the payment manually",
59
+ reason: "user_cancelled_payment_manually"
60
+ })
58
61
  }
59
62
  };
60
63
  const paymentObject = new window.Razorpay(options);
61
- paymentObject.on("payment.failed", () => {
62
- handleRazorpayFail(order, callbacks);
64
+ paymentObject.on("payment.failed", (response) => {
65
+ handleRazorpayFail(order, callbacks, response?.error);
63
66
  });
64
67
  paymentObject.open();
65
68
  }
@@ -77,11 +80,12 @@ async function handleRazorpaySuccess(data, order, callbacks) {
77
80
  callbacks.onPaymentEnd?.();
78
81
  }
79
82
  }
80
- async function handleRazorpayFail(order, callbacks) {
83
+ async function handleRazorpayFail(order, callbacks, error) {
81
84
  try {
82
85
  await chunkDXQX7ZIL_cjs.razorpayOrderFail({
83
86
  order_id: order.id,
84
- razorpay_order_id: order.razorpay_order_id
87
+ razorpay_order_id: order.razorpay_order_id,
88
+ error
85
89
  });
86
90
  } catch {
87
91
  }
@@ -5,7 +5,7 @@ var chunk2AHH3XBW_cjs = require('../chunk-2AHH3XBW.cjs');
5
5
  var chunk23YAZNVF_cjs = require('../chunk-23YAZNVF.cjs');
6
6
  var chunkMTSMQAZR_cjs = require('../chunk-MTSMQAZR.cjs');
7
7
  var chunkSMHJRNCR_cjs = require('../chunk-SMHJRNCR.cjs');
8
- var chunkTLNCCSTQ_cjs = require('../chunk-TLNCCSTQ.cjs');
8
+ var chunkPZJT2Y5B_cjs = require('../chunk-PZJT2Y5B.cjs');
9
9
  var chunkXFOUNOKO_cjs = require('../chunk-XFOUNOKO.cjs');
10
10
  require('../chunk-K44JZ5NL.cjs');
11
11
  var chunkDXQX7ZIL_cjs = require('../chunk-DXQX7ZIL.cjs');
@@ -354,7 +354,7 @@ function useCheckoutPayment(options) {
354
354
  );
355
355
  const order = response.data;
356
356
  setOrderSummary(order);
357
- chunkTLNCCSTQ_cjs.processPayment(order, paymentMethod, callbacks);
357
+ chunkPZJT2Y5B_cjs.processPayment(order, paymentMethod, callbacks);
358
358
  } catch {
359
359
  setShowFailureModal(true);
360
360
  } finally {
@@ -384,7 +384,7 @@ function useCheckoutCoupon(options) {
384
384
  const refreshCoupons = react.useCallback(async () => {
385
385
  setIsLoading(true);
386
386
  try {
387
- const coupons = await chunkTLNCCSTQ_cjs.fetchAvailableCoupons();
387
+ const coupons = await chunkPZJT2Y5B_cjs.fetchAvailableCoupons();
388
388
  setAvailableCoupons(coupons);
389
389
  } catch {
390
390
  } finally {
@@ -396,7 +396,7 @@ function useCheckoutCoupon(options) {
396
396
  setError(null);
397
397
  setIsApplying(true);
398
398
  try {
399
- const coupon = await chunkTLNCCSTQ_cjs.applyCheckoutCoupon(code, callbacks);
399
+ const coupon = await chunkPZJT2Y5B_cjs.applyCheckoutCoupon(code, callbacks);
400
400
  setAppliedCoupon(coupon);
401
401
  } catch (err) {
402
402
  setError(err instanceof Error ? err.message : "Failed to apply coupon");
@@ -409,7 +409,7 @@ function useCheckoutCoupon(options) {
409
409
  const removeCouponHandler = react.useCallback(async () => {
410
410
  if (!appliedCoupon) return;
411
411
  try {
412
- await chunkTLNCCSTQ_cjs.removeCheckoutCoupon(appliedCoupon.coupon_code, callbacks);
412
+ await chunkPZJT2Y5B_cjs.removeCheckoutCoupon(appliedCoupon.coupon_code, callbacks);
413
413
  setAppliedCoupon(null);
414
414
  setError(null);
415
415
  } catch {
@@ -3,7 +3,7 @@ import { findMatchingVariant, findSimilarVariant, isVariantCombinationAvailable,
3
3
  import { useCartStore, useAuthStore } from '../chunk-VZAIAQZJ.js';
4
4
  import { getCart, getProductList, getProductDetail, getWishlist, notifyProductStock, getProductCategories, getCategories } from '../chunk-XURYZRER.js';
5
5
  import { cart_default } from '../chunk-QAC72HKO.js';
6
- import { processPayment, fetchAvailableCoupons, applyCheckoutCoupon, removeCheckoutCoupon } from '../chunk-VETLYY7W.js';
6
+ import { processPayment, fetchAvailableCoupons, applyCheckoutCoupon, removeCheckoutCoupon } from '../chunk-NXQIWB36.js';
7
7
  import { applyCoupon, removeCoupon, getCoupons, getAppliedCoupon } from '../chunk-7M5CVYZJ.js';
8
8
  import '../chunk-WFDKKOO7.js';
9
9
  import { getOrders, placeOrder } from '../chunk-S3ZZ3ZA7.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storepecker/storefront-core",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Shared logic and utilities for Snapstore themes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",