@pisell/private-materials 6.8.22 → 6.8.24

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.
@@ -680,9 +680,10 @@ var Footer = function Footer(props) {
680
680
  setCheckoutLoading(false);
681
681
  setPaymentCallback(function () {
682
682
  return function (paymentResult) {
683
+ var _paymentResult$respon;
683
684
  console.log('Payment result:', paymentResult);
684
685
  setIsPaymentModalOpen(false);
685
- if ((paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.status) === 'success') {
686
+ if ((paymentResult === null || paymentResult === void 0 ? void 0 : paymentResult.status) === 'success' || (paymentResult === null || paymentResult === void 0 || (_paymentResult$respon = paymentResult.response) === null || _paymentResult$respon === void 0 || (_paymentResult$respon = _paymentResult$respon.data) === null || _paymentResult$respon === void 0 ? void 0 : _paymentResult$respon.payment_status) === 'paid') {
686
687
  var _window5;
687
688
  console.log('Payment completed successfully');
688
689
  (_window5 = window) === null || _window5 === void 0 || (_window5 = _window5.shopApi) === null || _window5 === void 0 || (_window5 = _window5.bookingTicket) === null || _window5 === void 0 || _window5.clearAllCart();
@@ -1785,7 +1786,7 @@ var Footer = function Footer(props) {
1785
1786
  clearAllScanListenersTaskQueue = _useScanManager2.clearAllScanListenersTaskQueue;
1786
1787
  // 清空所有内容并重置购物车
1787
1788
  var handleClearAllAndReset = function handleClearAllAndReset() {
1788
- var _shopDiscount$clear;
1789
+ var _shopDiscount$clear, _window9;
1789
1790
  clearAllScanListenersTaskQueue();
1790
1791
 
1791
1792
  // 清空附加服务
@@ -1837,17 +1838,14 @@ var Footer = function Footer(props) {
1837
1838
  // 清空商品券
1838
1839
  shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$clear = shopDiscount.clear) === null || _shopDiscount$clear === void 0 || _shopDiscount$clear.call(shopDiscount);
1839
1840
  setEditOrderId(0);
1840
- setTimeout(function () {
1841
- var _window9;
1842
- (_window9 = window) === null || _window9 === void 0 || (_window9 = _window9.shopApi) === null || _window9 === void 0 || (_window9 = _window9.bookingTicket) === null || _window9 === void 0 || _window9.clearAllCart();
1843
- // 清空服务项目
1844
- dispatch({
1845
- type: 'setService',
1846
- payload: {
1847
- value: []
1848
- }
1849
- });
1850
- }, 0);
1841
+ (_window9 = window) === null || _window9 === void 0 || (_window9 = _window9.shopApi) === null || _window9 === void 0 || (_window9 = _window9.bookingTicket) === null || _window9 === void 0 || _window9.clearAllCart();
1842
+ // 清空服务项目
1843
+ dispatch({
1844
+ type: 'setService',
1845
+ payload: {
1846
+ value: []
1847
+ }
1848
+ });
1851
1849
  };
1852
1850
 
1853
1851
  // 购物车进入编辑状态
@@ -2007,9 +2005,7 @@ var Footer = function Footer(props) {
2007
2005
  // handleClearAllAndReset();
2008
2006
  // }
2009
2007
  if (reset) {
2010
- setTimeout(function () {
2011
- handleClearAllAndReset();
2012
- }, 0);
2008
+ handleClearAllAndReset();
2013
2009
  }
2014
2010
  // setPaymentModalData(null);
2015
2011
  // setPaymentCallback(null);
@@ -500,18 +500,18 @@ var Footer = (props) => {
500
500
  setIsPaymentModalOpen(true);
501
501
  setCheckoutLoading(false);
502
502
  setPaymentCallback(() => (paymentResult) => {
503
- var _a3, _b3, _c3, _d2, _e2, _f2;
503
+ var _a3, _b3, _c3, _d2, _e2, _f2, _g2, _h2;
504
504
  console.log("Payment result:", paymentResult);
505
505
  setIsPaymentModalOpen(false);
506
- if ((paymentResult == null ? void 0 : paymentResult.status) === "success") {
506
+ if ((paymentResult == null ? void 0 : paymentResult.status) === "success" || ((_b3 = (_a3 = paymentResult == null ? void 0 : paymentResult.response) == null ? void 0 : _a3.data) == null ? void 0 : _b3.payment_status) === "paid") {
507
507
  console.log("Payment completed successfully");
508
- (_b3 = (_a3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _a3.bookingTicket) == null ? void 0 : _b3.clearAllCart();
508
+ (_d2 = (_c3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _c3.bookingTicket) == null ? void 0 : _d2.clearAllCart();
509
509
  setPaymentModalData(null);
510
510
  setPaymentCallback(null);
511
511
  } else if ((paymentResult == null ? void 0 : paymentResult.status) === "cancelled") {
512
512
  console.log("Payment cancelled");
513
513
  if (res == null ? void 0 : res.order_id) {
514
- (_d2 = (_c3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _c3.booking) == null ? void 0 : _d2.voidBooking(res.order_id);
514
+ (_f2 = (_e2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _e2.booking) == null ? void 0 : _f2.voidBooking(res.order_id);
515
515
  }
516
516
  setPaymentModalData(null);
517
517
  setPaymentCallback(null);
@@ -519,7 +519,7 @@ var Footer = (props) => {
519
519
  console.log("Payment status:", paymentResult == null ? void 0 : paymentResult.status);
520
520
  setPaymentModalData(null);
521
521
  setPaymentCallback(null);
522
- (_f2 = (_e2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _e2.bookingTicket) == null ? void 0 : _f2.clearAllCart();
522
+ (_h2 = (_g2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _g2.bookingTicket) == null ? void 0 : _h2.clearAllCart();
523
523
  }
524
524
  });
525
525
  } else {
@@ -1287,7 +1287,7 @@ var Footer = (props) => {
1287
1287
  const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
1288
1288
  const { clearAllScanListenersTaskQueue } = (0, import_useScanManager.default)();
1289
1289
  const handleClearAllAndReset = () => {
1290
- var _a2;
1290
+ var _a2, _b2, _c2;
1291
1291
  clearAllScanListenersTaskQueue();
1292
1292
  dispatch({
1293
1293
  type: "setAddons",
@@ -1321,16 +1321,13 @@ var Footer = (props) => {
1321
1321
  });
1322
1322
  (_a2 = shopDiscount == null ? void 0 : shopDiscount.clear) == null ? void 0 : _a2.call(shopDiscount);
1323
1323
  setEditOrderId(0);
1324
- setTimeout(() => {
1325
- var _a3, _b2;
1326
- (_b2 = (_a3 = window == null ? void 0 : window.shopApi) == null ? void 0 : _a3.bookingTicket) == null ? void 0 : _b2.clearAllCart();
1327
- dispatch({
1328
- type: "setService",
1329
- payload: {
1330
- value: []
1331
- }
1332
- });
1333
- }, 0);
1324
+ (_c2 = (_b2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _b2.bookingTicket) == null ? void 0 : _c2.clearAllCart();
1325
+ dispatch({
1326
+ type: "setService",
1327
+ payload: {
1328
+ value: []
1329
+ }
1330
+ });
1334
1331
  };
1335
1332
  const setEditCartMode = (order_id2, payData, closeModal = false) => {
1336
1333
  setEditOrderId(order_id2);
@@ -1473,9 +1470,7 @@ var Footer = (props) => {
1473
1470
  }
1474
1471
  });
1475
1472
  if (reset) {
1476
- setTimeout(() => {
1477
- handleClearAllAndReset();
1478
- }, 0);
1473
+ handleClearAllAndReset();
1479
1474
  }
1480
1475
  }
1481
1476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.8.22",
3
+ "version": "6.8.24",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -77,9 +77,9 @@
77
77
  "react-resizable": "^3.0.5",
78
78
  "styled-components": "^6.0.0-rc.3",
79
79
  "@pisell/date-picker": "3.0.7",
80
- "@pisell/utils": "3.0.2",
81
80
  "@pisell/icon": "0.0.11",
82
- "@pisell/materials": "6.8.6"
81
+ "@pisell/materials": "6.8.6",
82
+ "@pisell/utils": "3.0.2"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "react": "^18.0.0",