@pisell/private-materials 6.4.12 → 6.4.14
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/checkout/PaymentModal.js +30 -23
- package/es/components/ticketBooking/components/menuBar/index.js +3 -0
- package/lib/components/checkout/PaymentModal.js +16 -6
- package/lib/components/ticketBooking/components/menuBar/index.js +4 -0
- package/package.json +3 -3
@@ -1588,10 +1588,7 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1588
1588
|
}
|
1589
1589
|
}, [data]);
|
1590
1590
|
var logger = usePaymentLogger();
|
1591
|
-
var
|
1592
|
-
_useState38 = _slicedToArray(_useState37, 2),
|
1593
|
-
isLocalOrderCreated = _useState38[0],
|
1594
|
-
setIsLocalOrderCreated = _useState38[1];
|
1591
|
+
var isLocalOrderCreated = useRef(undefined);
|
1595
1592
|
var unsubscribeRef = useRef(undefined);
|
1596
1593
|
|
1597
1594
|
// 初始化checkout数据
|
@@ -1605,11 +1602,11 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1605
1602
|
_context17.prev = 0;
|
1606
1603
|
// 获取 checkout 模块并处理订单数据
|
1607
1604
|
checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1608
|
-
if (!(checkout && data && !isLocalOrderCreated)) {
|
1609
|
-
_context17.next =
|
1605
|
+
if (!(checkout && data && !isLocalOrderCreated.current)) {
|
1606
|
+
_context17.next = 20;
|
1610
1607
|
break;
|
1611
1608
|
}
|
1612
|
-
|
1609
|
+
isLocalOrderCreated.current = true;
|
1613
1610
|
_context17.next = 6;
|
1614
1611
|
return getShopWalletPassId(interaction);
|
1615
1612
|
case 6:
|
@@ -1645,6 +1642,15 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1645
1642
|
setTotalAmount(_orderInfo2.totalAmount);
|
1646
1643
|
}
|
1647
1644
|
setOrderInfo(_orderInfo2);
|
1645
|
+
if (unsubscribeRef.current) {
|
1646
|
+
logger === null || logger === void 0 || logger.addLog({
|
1647
|
+
type: 'info',
|
1648
|
+
title: '有重复的checkout:onOrderSynced,清空',
|
1649
|
+
metadata: {}
|
1650
|
+
});
|
1651
|
+
unsubscribeRef.current();
|
1652
|
+
unsubscribeRef.current = undefined;
|
1653
|
+
}
|
1648
1654
|
// 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
|
1649
1655
|
unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
|
1650
1656
|
var _data$response, _responseData$payment2;
|
@@ -1748,46 +1754,46 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1748
1754
|
// 可以在这里执行同步完成后的业务逻辑
|
1749
1755
|
// 比如:通知其他系统、更新UI状态等
|
1750
1756
|
});
|
1751
|
-
_context17.next =
|
1757
|
+
_context17.next = 31;
|
1752
1758
|
break;
|
1753
|
-
case
|
1754
|
-
if (!isLocalOrderCreated) {
|
1755
|
-
_context17.next =
|
1759
|
+
case 20:
|
1760
|
+
if (!isLocalOrderCreated.current) {
|
1761
|
+
_context17.next = 31;
|
1756
1762
|
break;
|
1757
1763
|
}
|
1758
1764
|
// // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
|
1759
1765
|
console.log('🔄 PaymentModal: data changed, updating checkout data...');
|
1760
|
-
|
1761
|
-
_context17.next =
|
1766
|
+
isLocalOrderCreated.current = false;
|
1767
|
+
_context17.next = 25;
|
1762
1768
|
return checkout.cancelCurrentOrderAsync();
|
1763
|
-
case
|
1764
|
-
_context17.next =
|
1769
|
+
case 25:
|
1770
|
+
_context17.next = 27;
|
1765
1771
|
return checkout.createLocalOrderAsync({
|
1766
1772
|
orderData: data === null || data === void 0 ? void 0 : data.order_info,
|
1767
1773
|
cartSummary: data === null || data === void 0 || (_data$subtotal_info = data.subtotal_info) === null || _data$subtotal_info === void 0 ? void 0 : _data$subtotal_info.subTotalList,
|
1768
1774
|
autoPayment: true,
|
1769
1775
|
totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
|
1770
1776
|
});
|
1771
|
-
case
|
1777
|
+
case 27:
|
1772
1778
|
// 获取订单总金额
|
1773
1779
|
_orderInfo3 = checkout.getCurrentOrderInfo();
|
1774
1780
|
if (_orderInfo3 && _orderInfo3.totalAmount) {
|
1775
1781
|
setTotalAmount(_orderInfo3.totalAmount);
|
1776
1782
|
}
|
1777
1783
|
setOrderInfo(_orderInfo3);
|
1778
|
-
|
1779
|
-
case
|
1780
|
-
_context17.next =
|
1784
|
+
isLocalOrderCreated.current = true;
|
1785
|
+
case 31:
|
1786
|
+
_context17.next = 36;
|
1781
1787
|
break;
|
1782
|
-
case
|
1783
|
-
_context17.prev =
|
1788
|
+
case 33:
|
1789
|
+
_context17.prev = 33;
|
1784
1790
|
_context17.t0 = _context17["catch"](0);
|
1785
1791
|
console.error('Failed to initialize checkout data:', _context17.t0);
|
1786
|
-
case
|
1792
|
+
case 36:
|
1787
1793
|
case "end":
|
1788
1794
|
return _context17.stop();
|
1789
1795
|
}
|
1790
|
-
}, _callee17, null, [[0,
|
1796
|
+
}, _callee17, null, [[0, 33]]);
|
1791
1797
|
}));
|
1792
1798
|
return function initCheckoutData() {
|
1793
1799
|
return _ref22.apply(this, arguments);
|
@@ -1802,6 +1808,7 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1802
1808
|
if (typeof unsubscribeRef.current === 'function') {
|
1803
1809
|
var _unsubscribeRef$curre;
|
1804
1810
|
(_unsubscribeRef$curre = unsubscribeRef.current) === null || _unsubscribeRef$curre === void 0 || _unsubscribeRef$curre.call(unsubscribeRef);
|
1811
|
+
unsubscribeRef.current = undefined;
|
1805
1812
|
}
|
1806
1813
|
};
|
1807
1814
|
}, []);
|
@@ -1189,15 +1189,15 @@ var PaymentModal = ({
|
|
1189
1189
|
}
|
1190
1190
|
}, [data]);
|
1191
1191
|
const logger = (0, import_usePaymentLogger.default)();
|
1192
|
-
const
|
1192
|
+
const isLocalOrderCreated = (0, import_react.useRef)(void 0);
|
1193
1193
|
const unsubscribeRef = (0, import_react.useRef)(void 0);
|
1194
1194
|
(0, import_react.useEffect)(() => {
|
1195
1195
|
const initCheckoutData = async () => {
|
1196
1196
|
var _a2, _b2;
|
1197
1197
|
try {
|
1198
1198
|
const checkout = pisellos == null ? void 0 : pisellos.getModule("checkout");
|
1199
|
-
if (checkout && data && !isLocalOrderCreated) {
|
1200
|
-
|
1199
|
+
if (checkout && data && !isLocalOrderCreated.current) {
|
1200
|
+
isLocalOrderCreated.current = true;
|
1201
1201
|
const shop_wallet_pass_id = await (0, import_utils2.getShopWalletPassId)(interaction);
|
1202
1202
|
checkout.setOtherParams({
|
1203
1203
|
is_price_include_tax: getData("is_price_include_tax"),
|
@@ -1225,6 +1225,15 @@ var PaymentModal = ({
|
|
1225
1225
|
setTotalAmount(orderInfo2.totalAmount);
|
1226
1226
|
}
|
1227
1227
|
setOrderInfo(orderInfo2);
|
1228
|
+
if (unsubscribeRef.current) {
|
1229
|
+
logger == null ? void 0 : logger.addLog({
|
1230
|
+
type: "info",
|
1231
|
+
title: "有重复的checkout:onOrderSynced,清空",
|
1232
|
+
metadata: {}
|
1233
|
+
});
|
1234
|
+
unsubscribeRef.current();
|
1235
|
+
unsubscribeRef.current = void 0;
|
1236
|
+
}
|
1228
1237
|
unsubscribeRef.current = checkout.core.effects.on("checkout:onOrderSynced", (data2) => {
|
1229
1238
|
var _a3, _b3, _c2;
|
1230
1239
|
const responseData = (_a3 = data2.response) == null ? void 0 : _a3.data;
|
@@ -1317,11 +1326,11 @@ var PaymentModal = ({
|
|
1317
1326
|
handlePaymentComplete(data2);
|
1318
1327
|
}
|
1319
1328
|
});
|
1320
|
-
} else if (isLocalOrderCreated) {
|
1329
|
+
} else if (isLocalOrderCreated.current) {
|
1321
1330
|
console.log(
|
1322
1331
|
"🔄 PaymentModal: data changed, updating checkout data..."
|
1323
1332
|
);
|
1324
|
-
|
1333
|
+
isLocalOrderCreated.current = false;
|
1325
1334
|
await checkout.cancelCurrentOrderAsync();
|
1326
1335
|
await checkout.createLocalOrderAsync({
|
1327
1336
|
orderData: data == null ? void 0 : data.order_info,
|
@@ -1334,7 +1343,7 @@ var PaymentModal = ({
|
|
1334
1343
|
setTotalAmount(orderInfo2.totalAmount);
|
1335
1344
|
}
|
1336
1345
|
setOrderInfo(orderInfo2);
|
1337
|
-
|
1346
|
+
isLocalOrderCreated.current = true;
|
1338
1347
|
}
|
1339
1348
|
} catch (error) {
|
1340
1349
|
console.error("Failed to initialize checkout data:", error);
|
@@ -1349,6 +1358,7 @@ var PaymentModal = ({
|
|
1349
1358
|
var _a2;
|
1350
1359
|
if (typeof unsubscribeRef.current === "function") {
|
1351
1360
|
(_a2 = unsubscribeRef.current) == null ? void 0 : _a2.call(unsubscribeRef);
|
1361
|
+
unsubscribeRef.current = void 0;
|
1352
1362
|
}
|
1353
1363
|
};
|
1354
1364
|
}, []);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pisell/private-materials",
|
3
|
-
"version": "6.4.
|
3
|
+
"version": "6.4.14",
|
4
4
|
"main": "./lib/index.js",
|
5
5
|
"module": "./es/index.js",
|
6
6
|
"types": "./lib/index.d.ts",
|
@@ -59,10 +59,10 @@
|
|
59
59
|
"react-infinite-scroll-component": "^6.1.0",
|
60
60
|
"react-resizable": "^3.0.5",
|
61
61
|
"styled-components": "^6.0.0-rc.3",
|
62
|
-
"@pisell/date-picker": "3.0.6",
|
63
62
|
"@pisell/icon": "0.0.11",
|
63
|
+
"@pisell/utils": "3.0.2",
|
64
64
|
"@pisell/materials": "6.4.1",
|
65
|
-
"@pisell/
|
65
|
+
"@pisell/date-picker": "3.0.6"
|
66
66
|
},
|
67
67
|
"peerDependencies": {
|
68
68
|
"react": "^18.0.0",
|