@pisell/private-materials 6.12.227 → 6.12.228
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/plus/saleDetail/actions/index.js +29 -19
- package/lib/plus/saleDetail/actions/index.js +29 -19
- package/package.json +3 -3
|
@@ -83,7 +83,7 @@ function isPaymentActionRuntimeKey(key) {
|
|
|
83
83
|
return key === "cash-payment" || key === "wallet-confirm" || key === "checkout-cart" || String(key).startsWith("payment:");
|
|
84
84
|
}
|
|
85
85
|
function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, context, enableFulfillmentReferencePrompt = false, onExternalPaymentSettled, variant }) {
|
|
86
|
-
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel3, _engineContext$appHel4, _engineContext$appHel5, _engineContext$
|
|
86
|
+
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel3, _engineContext$appHel4, _engineContext$appHel5, _engineContext$appHel9, _engineContext$appHel10, _cart$items, _cart$bookings, _sales$bookingTicket2, _sales$bookingTicket3, _tempOrder$note, _summary$summary2, _selectFloorConfig$bu;
|
|
87
87
|
const Toast = useToast();
|
|
88
88
|
const engineContext = useEngineContext();
|
|
89
89
|
const paymentResultLocale = ((_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 || (_engineContext$appHel2 = _engineContext$appHel.getApp) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.call(_engineContext$appHel)) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.locales) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel3 = _engineContext$appHel2.getLocale) === null || _engineContext$appHel3 === void 0 ? void 0 : _engineContext$appHel3.call(_engineContext$appHel2)) || ((_engineContext$appHel4 = engineContext.appHelper) === null || _engineContext$appHel4 === void 0 || (_engineContext$appHel4 = _engineContext$appHel4.utils) === null || _engineContext$appHel4 === void 0 || (_engineContext$appHel4 = _engineContext$appHel4.storage) === null || _engineContext$appHel4 === void 0 || (_engineContext$appHel5 = _engineContext$appHel4.get) === null || _engineContext$appHel5 === void 0 ? void 0 : _engineContext$appHel5.call(_engineContext$appHel4, "umi_locale")) || "en";
|
|
@@ -108,6 +108,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
108
108
|
const [paymentMethodsLoading, setPaymentMethodsLoading] = useState(false);
|
|
109
109
|
const [cardReaderDeviceNumber, setCardReaderDeviceNumber] = useState("");
|
|
110
110
|
const paymentRuntimeRef = useRef(null);
|
|
111
|
+
const paymentMethodsLoadSequenceRef = useRef(0);
|
|
111
112
|
const { cart, sales, summary } = context;
|
|
112
113
|
const refreshSalesRootSnapshot = useContext(SalesSdkRootRefreshContext);
|
|
113
114
|
const globalScanActivity = useSalesSdkGlobalScanActivity();
|
|
@@ -127,47 +128,56 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
127
128
|
});
|
|
128
129
|
const paymentActionsEnabled = useMemo(() => hasConfiguredPaymentAction(actionConfigs), [actionConfigs]);
|
|
129
130
|
useEffect(() => {
|
|
131
|
+
var _engineContext$appHel7, _engineContext$appHel8;
|
|
130
132
|
if (!paymentActionsEnabled) {
|
|
131
133
|
setPaymentMethods([]);
|
|
132
134
|
setCashPaymentMethod(null);
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
135
137
|
let cancelled = false;
|
|
136
|
-
|
|
138
|
+
const loadPaymentMethods = function() {
|
|
137
139
|
var _ref = _asyncToGenerator(function* () {
|
|
138
140
|
var _sales$bookingTicket;
|
|
139
141
|
if (!((_sales$bookingTicket = sales.bookingTicket) === null || _sales$bookingTicket === void 0 ? void 0 : _sales$bookingTicket.getPaymentMethodsAsync)) return;
|
|
142
|
+
const loadSequence = ++paymentMethodsLoadSequenceRef.current;
|
|
140
143
|
setPaymentMethodsLoading(true);
|
|
141
144
|
try {
|
|
142
145
|
var _engineContext$appHel6;
|
|
143
146
|
const interaction = (_engineContext$appHel6 = engineContext.appHelper) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel6 = _engineContext$appHel6.utils) === null || _engineContext$appHel6 === void 0 ? void 0 : _engineContext$appHel6.interaction;
|
|
144
147
|
const [methods, deviceNumber] = yield Promise.all([sales.bookingTicket.getPaymentMethodsAsync(), getCurrentDeviceNumber(interaction)]);
|
|
145
148
|
const reordered = yield reorderPaymentMethodList(methods || [], interaction);
|
|
146
|
-
if (!cancelled) {
|
|
149
|
+
if (!cancelled && loadSequence === paymentMethodsLoadSequenceRef.current) {
|
|
147
150
|
const firstCashPaymentMethod = reordered.find(isCashPaymentMethod) || null;
|
|
148
151
|
setCashPaymentMethod(firstCashPaymentMethod);
|
|
149
152
|
setPaymentMethods(reordered.filter((method) => method !== firstCashPaymentMethod && isFooterPaymentMethod(method)));
|
|
150
153
|
setCardReaderDeviceNumber(deviceNumber);
|
|
151
154
|
}
|
|
152
155
|
} catch (error) {
|
|
153
|
-
if (!cancelled) {
|
|
156
|
+
if (!cancelled && loadSequence === paymentMethodsLoadSequenceRef.current) {
|
|
154
157
|
setPaymentMethods([]);
|
|
155
158
|
setCashPaymentMethod(null);
|
|
156
159
|
console.error("[SaleDetail] load payment methods failed", error);
|
|
157
160
|
}
|
|
158
161
|
} finally {
|
|
159
|
-
if (!cancelled) setPaymentMethodsLoading(false);
|
|
162
|
+
if (!cancelled && loadSequence === paymentMethodsLoadSequenceRef.current) setPaymentMethodsLoading(false);
|
|
160
163
|
}
|
|
161
164
|
});
|
|
162
165
|
return function loadPaymentMethods() {
|
|
163
166
|
return _ref.apply(this, arguments);
|
|
164
167
|
};
|
|
165
|
-
}
|
|
168
|
+
}();
|
|
169
|
+
loadPaymentMethods();
|
|
170
|
+
const unsubscribe = (_engineContext$appHel7 = engineContext.appHelper) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.utils) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.pisellos) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.effects) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel8 = _engineContext$appHel7.on) === null || _engineContext$appHel8 === void 0 ? void 0 : _engineContext$appHel8.call(_engineContext$appHel7, "payment:onPaymentMethodsChanged", () => {
|
|
171
|
+
if (cancelled) return;
|
|
172
|
+
loadPaymentMethods();
|
|
173
|
+
});
|
|
166
174
|
return () => {
|
|
167
175
|
cancelled = true;
|
|
176
|
+
unsubscribe === null || unsubscribe === void 0 || unsubscribe();
|
|
168
177
|
};
|
|
169
178
|
}, [
|
|
170
|
-
(_engineContext$
|
|
179
|
+
(_engineContext$appHel9 = engineContext.appHelper) === null || _engineContext$appHel9 === void 0 || (_engineContext$appHel9 = _engineContext$appHel9.utils) === null || _engineContext$appHel9 === void 0 ? void 0 : _engineContext$appHel9.interaction,
|
|
180
|
+
(_engineContext$appHel10 = engineContext.appHelper) === null || _engineContext$appHel10 === void 0 || (_engineContext$appHel10 = _engineContext$appHel10.utils) === null || _engineContext$appHel10 === void 0 || (_engineContext$appHel10 = _engineContext$appHel10.pisellos) === null || _engineContext$appHel10 === void 0 ? void 0 : _engineContext$appHel10.effects,
|
|
171
181
|
paymentActionsEnabled,
|
|
172
182
|
sales.bookingTicket
|
|
173
183
|
]);
|
|
@@ -545,7 +555,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
545
555
|
return;
|
|
546
556
|
}
|
|
547
557
|
try {
|
|
548
|
-
var _sales$bookingTicket12, _sales$bookingTicket13, _engineContext$
|
|
558
|
+
var _sales$bookingTicket12, _sales$bookingTicket13, _engineContext$appHel11, _sales$bookingTicket$, _sales$bookingTicket14;
|
|
549
559
|
yield cart.waitForCartConsistency();
|
|
550
560
|
if ((cashPaymentConfig === null || cashPaymentConfig === void 0 ? void 0 : cashPaymentConfig.validateHolder) === true) yield sales.validateHoldersBeforePayment();
|
|
551
561
|
if (!((_sales$bookingTicket12 = sales.bookingTicket) === null || _sales$bookingTicket12 === void 0 ? void 0 : _sales$bookingTicket12.getCashPaymentConfig) || !((_sales$bookingTicket13 = sales.bookingTicket) === null || _sales$bookingTicket13 === void 0 ? void 0 : _sales$bookingTicket13.payCash)) {
|
|
@@ -556,7 +566,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
556
566
|
});
|
|
557
567
|
return;
|
|
558
568
|
}
|
|
559
|
-
const shopWalletPassId = yield getShopWalletPassId((_engineContext$
|
|
569
|
+
const shopWalletPassId = yield getShopWalletPassId((_engineContext$appHel11 = engineContext.appHelper) === null || _engineContext$appHel11 === void 0 || (_engineContext$appHel11 = _engineContext$appHel11.utils) === null || _engineContext$appHel11 === void 0 ? void 0 : _engineContext$appHel11.interaction);
|
|
560
570
|
yield (_sales$bookingTicket$ = (_sales$bookingTicket14 = sales.bookingTicket).setOtherParams) === null || _sales$bookingTicket$ === void 0 ? void 0 : _sales$bookingTicket$.call(_sales$bookingTicket14, { shop_wallet_pass_id: shopWalletPassId });
|
|
561
571
|
cashExternalRequestIdRef.current = externalRequestId;
|
|
562
572
|
setShowCashPayment(true);
|
|
@@ -595,9 +605,9 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
595
605
|
};
|
|
596
606
|
}();
|
|
597
607
|
const handleDetails = () => {
|
|
598
|
-
var _engineContext$
|
|
608
|
+
var _engineContext$appHel12, _engineContext$appHel13;
|
|
599
609
|
closePaymentResultToastV2();
|
|
600
|
-
(_engineContext$
|
|
610
|
+
(_engineContext$appHel12 = engineContext.appHelper) === null || _engineContext$appHel12 === void 0 || (_engineContext$appHel12 = _engineContext$appHel12.utils) === null || _engineContext$appHel12 === void 0 || (_engineContext$appHel13 = _engineContext$appHel12.action) === null || _engineContext$appHel13 === void 0 || _engineContext$appHel13.call(_engineContext$appHel12, {
|
|
601
611
|
type: "pisell1.handleOpenSaleDetail",
|
|
602
612
|
data: {
|
|
603
613
|
osKey: "big-sale-detail",
|
|
@@ -626,7 +636,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
626
636
|
}]];
|
|
627
637
|
});
|
|
628
638
|
const presentPaymentResult = useMemoizedFn((params) => {
|
|
629
|
-
var _params$result, _engineContext$
|
|
639
|
+
var _params$result, _engineContext$appHel14, _engineContext$appHel15, _engineContext$appHel16;
|
|
630
640
|
return presentBaseSalesPaymentResult({
|
|
631
641
|
baseSales: sales.bookingTicket,
|
|
632
642
|
status: params.status,
|
|
@@ -636,8 +646,8 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
636
646
|
failureReason: params.failureReason,
|
|
637
647
|
actionButtons: params.status === "failed" ? void 0 : buildPaymentResultActions(params.orderId),
|
|
638
648
|
locale: paymentResultLocale,
|
|
639
|
-
translationOriginal: (_engineContext$
|
|
640
|
-
taxTitle: (_engineContext$
|
|
649
|
+
translationOriginal: (_engineContext$appHel14 = engineContext.appHelper) === null || _engineContext$appHel14 === void 0 || (_engineContext$appHel14 = _engineContext$appHel14.utils) === null || _engineContext$appHel14 === void 0 ? void 0 : _engineContext$appHel14.translationOriginal,
|
|
650
|
+
taxTitle: (_engineContext$appHel15 = engineContext.appHelper) === null || _engineContext$appHel15 === void 0 || (_engineContext$appHel15 = _engineContext$appHel15.utils) === null || _engineContext$appHel15 === void 0 || (_engineContext$appHel16 = _engineContext$appHel15.getData) === null || _engineContext$appHel16 === void 0 ? void 0 : _engineContext$appHel16.call(_engineContext$appHel15, "tax_title")
|
|
641
651
|
});
|
|
642
652
|
});
|
|
643
653
|
const handleCashPaymentSuccess = useMemoizedFn(function() {
|
|
@@ -750,12 +760,12 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
750
760
|
};
|
|
751
761
|
}();
|
|
752
762
|
try {
|
|
753
|
-
var _engineContext$
|
|
763
|
+
var _engineContext$appHel17, _engineContext$appHel18, _paymentRuntimeRef$cu, _result$syncResult$su2, _result$syncResult2;
|
|
754
764
|
const method = methodOverride || paymentMethods.find((item) => String(item.code || "").toUpperCase() === code);
|
|
755
765
|
if (!method) throw new Error(`Payment method ${code} is unavailable.`);
|
|
756
766
|
baseSales = sales.bookingTicket;
|
|
757
767
|
const paymentAmount = requestedAmount !== null && requestedAmount !== void 0 ? requestedAmount : resolveCurrentPaymentAmountDue();
|
|
758
|
-
const piPaymentProvider = resolvePiPaymentProvider(code, Boolean((_engineContext$
|
|
768
|
+
const piPaymentProvider = resolvePiPaymentProvider(code, Boolean((_engineContext$appHel17 = engineContext.appHelper) === null || _engineContext$appHel17 === void 0 || (_engineContext$appHel17 = _engineContext$appHel17.utils) === null || _engineContext$appHel17 === void 0 || (_engineContext$appHel17 = _engineContext$appHel17.businessUtils) === null || _engineContext$appHel17 === void 0 || (_engineContext$appHel18 = _engineContext$appHel17.isPiPaymentEnabled) === null || _engineContext$appHel18 === void 0 ? void 0 : _engineContext$appHel18.call(_engineContext$appHel17)));
|
|
759
769
|
if (Boolean(piPaymentProvider) || isSpiMx51Payment) {
|
|
760
770
|
preparedPayment = yield preparePendingEftposPayment({
|
|
761
771
|
amount: paymentAmount,
|
|
@@ -881,7 +891,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
881
891
|
if (!beginAction("wallet-confirm")) return;
|
|
882
892
|
const finishPaymentActivity = globalScanActivity.beginPayment();
|
|
883
893
|
try {
|
|
884
|
-
var _engineContext$
|
|
894
|
+
var _engineContext$appHel19, _engineContext$appHel20, _engineContext$appHel21, _context$onOrderCompl6;
|
|
885
895
|
yield cart.waitForCartConsistency();
|
|
886
896
|
if ((walletConfirmConfig === null || walletConfirmConfig === void 0 ? void 0 : walletConfirmConfig.validateHolder) === true) yield sales.validateHoldersBeforePayment();
|
|
887
897
|
const baseSales = sales.bookingTicket;
|
|
@@ -915,8 +925,8 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
915
925
|
currencySymbol,
|
|
916
926
|
actionButtons: buildPaymentResultActions(orderId),
|
|
917
927
|
locale: paymentResultLocale,
|
|
918
|
-
translationOriginal: (_engineContext$
|
|
919
|
-
taxTitle: (_engineContext$
|
|
928
|
+
translationOriginal: (_engineContext$appHel19 = engineContext.appHelper) === null || _engineContext$appHel19 === void 0 || (_engineContext$appHel19 = _engineContext$appHel19.utils) === null || _engineContext$appHel19 === void 0 ? void 0 : _engineContext$appHel19.translationOriginal,
|
|
929
|
+
taxTitle: (_engineContext$appHel20 = engineContext.appHelper) === null || _engineContext$appHel20 === void 0 || (_engineContext$appHel20 = _engineContext$appHel20.utils) === null || _engineContext$appHel20 === void 0 || (_engineContext$appHel21 = _engineContext$appHel20.getData) === null || _engineContext$appHel21 === void 0 ? void 0 : _engineContext$appHel21.call(_engineContext$appHel20, "tax_title")
|
|
920
930
|
});
|
|
921
931
|
yield sales.restore();
|
|
922
932
|
(_context$onOrderCompl6 = context.onOrderComplete) === null || _context$onOrderCompl6 === void 0 || _context$onOrderCompl6.call(context, {
|
|
@@ -86,7 +86,7 @@ function isPaymentActionRuntimeKey(key) {
|
|
|
86
86
|
return key === "cash-payment" || key === "wallet-confirm" || key === "checkout-cart" || String(key).startsWith("payment:");
|
|
87
87
|
}
|
|
88
88
|
function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, context, enableFulfillmentReferencePrompt = false, onExternalPaymentSettled, variant }) {
|
|
89
|
-
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel3, _engineContext$appHel4, _engineContext$appHel5, _engineContext$
|
|
89
|
+
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel3, _engineContext$appHel4, _engineContext$appHel5, _engineContext$appHel9, _engineContext$appHel10, _cart$items, _cart$bookings, _sales$bookingTicket2, _sales$bookingTicket3, _tempOrder$note, _summary$summary2, _selectFloorConfig$bu;
|
|
90
90
|
const Toast = (0, _pisell_materials.useToast)();
|
|
91
91
|
const engineContext = require_useEngineContext.default();
|
|
92
92
|
const paymentResultLocale = ((_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 || (_engineContext$appHel2 = _engineContext$appHel.getApp) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.call(_engineContext$appHel)) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.locales) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel3 = _engineContext$appHel2.getLocale) === null || _engineContext$appHel3 === void 0 ? void 0 : _engineContext$appHel3.call(_engineContext$appHel2)) || ((_engineContext$appHel4 = engineContext.appHelper) === null || _engineContext$appHel4 === void 0 || (_engineContext$appHel4 = _engineContext$appHel4.utils) === null || _engineContext$appHel4 === void 0 || (_engineContext$appHel4 = _engineContext$appHel4.storage) === null || _engineContext$appHel4 === void 0 || (_engineContext$appHel5 = _engineContext$appHel4.get) === null || _engineContext$appHel5 === void 0 ? void 0 : _engineContext$appHel5.call(_engineContext$appHel4, "umi_locale")) || "en";
|
|
@@ -111,6 +111,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
111
111
|
const [paymentMethodsLoading, setPaymentMethodsLoading] = (0, react.useState)(false);
|
|
112
112
|
const [cardReaderDeviceNumber, setCardReaderDeviceNumber] = (0, react.useState)("");
|
|
113
113
|
const paymentRuntimeRef = (0, react.useRef)(null);
|
|
114
|
+
const paymentMethodsLoadSequenceRef = (0, react.useRef)(0);
|
|
114
115
|
const { cart, sales, summary } = context;
|
|
115
116
|
const refreshSalesRootSnapshot = (0, react.useContext)(require_SalesSdkProvider.SalesSdkRootRefreshContext);
|
|
116
117
|
const globalScanActivity = require_SalesSdkGlobalScanActivityContext.useSalesSdkGlobalScanActivity();
|
|
@@ -130,47 +131,56 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
130
131
|
});
|
|
131
132
|
const paymentActionsEnabled = (0, react.useMemo)(() => hasConfiguredPaymentAction(actionConfigs), [actionConfigs]);
|
|
132
133
|
(0, react.useEffect)(() => {
|
|
134
|
+
var _engineContext$appHel7, _engineContext$appHel8;
|
|
133
135
|
if (!paymentActionsEnabled) {
|
|
134
136
|
setPaymentMethods([]);
|
|
135
137
|
setCashPaymentMethod(null);
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
140
|
let cancelled = false;
|
|
139
|
-
|
|
141
|
+
const loadPaymentMethods = function() {
|
|
140
142
|
var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
141
143
|
var _sales$bookingTicket;
|
|
142
144
|
if (!((_sales$bookingTicket = sales.bookingTicket) === null || _sales$bookingTicket === void 0 ? void 0 : _sales$bookingTicket.getPaymentMethodsAsync)) return;
|
|
145
|
+
const loadSequence = ++paymentMethodsLoadSequenceRef.current;
|
|
143
146
|
setPaymentMethodsLoading(true);
|
|
144
147
|
try {
|
|
145
148
|
var _engineContext$appHel6;
|
|
146
149
|
const interaction = (_engineContext$appHel6 = engineContext.appHelper) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel6 = _engineContext$appHel6.utils) === null || _engineContext$appHel6 === void 0 ? void 0 : _engineContext$appHel6.interaction;
|
|
147
150
|
const [methods, deviceNumber] = yield Promise.all([sales.bookingTicket.getPaymentMethodsAsync(), require_utils$1.getCurrentDeviceNumber(interaction)]);
|
|
148
151
|
const reordered = yield require_utils$1.reorderPaymentMethodList(methods || [], interaction);
|
|
149
|
-
if (!cancelled) {
|
|
152
|
+
if (!cancelled && loadSequence === paymentMethodsLoadSequenceRef.current) {
|
|
150
153
|
const firstCashPaymentMethod = reordered.find(require_utils$1.isCashPaymentMethod) || null;
|
|
151
154
|
setCashPaymentMethod(firstCashPaymentMethod);
|
|
152
155
|
setPaymentMethods(reordered.filter((method) => method !== firstCashPaymentMethod && isFooterPaymentMethod(method)));
|
|
153
156
|
setCardReaderDeviceNumber(deviceNumber);
|
|
154
157
|
}
|
|
155
158
|
} catch (error) {
|
|
156
|
-
if (!cancelled) {
|
|
159
|
+
if (!cancelled && loadSequence === paymentMethodsLoadSequenceRef.current) {
|
|
157
160
|
setPaymentMethods([]);
|
|
158
161
|
setCashPaymentMethod(null);
|
|
159
162
|
console.error("[SaleDetail] load payment methods failed", error);
|
|
160
163
|
}
|
|
161
164
|
} finally {
|
|
162
|
-
if (!cancelled) setPaymentMethodsLoading(false);
|
|
165
|
+
if (!cancelled && loadSequence === paymentMethodsLoadSequenceRef.current) setPaymentMethodsLoading(false);
|
|
163
166
|
}
|
|
164
167
|
});
|
|
165
168
|
return function loadPaymentMethods() {
|
|
166
169
|
return _ref.apply(this, arguments);
|
|
167
170
|
};
|
|
168
|
-
}
|
|
171
|
+
}();
|
|
172
|
+
loadPaymentMethods();
|
|
173
|
+
const unsubscribe = (_engineContext$appHel7 = engineContext.appHelper) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.utils) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.pisellos) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.effects) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel8 = _engineContext$appHel7.on) === null || _engineContext$appHel8 === void 0 ? void 0 : _engineContext$appHel8.call(_engineContext$appHel7, "payment:onPaymentMethodsChanged", () => {
|
|
174
|
+
if (cancelled) return;
|
|
175
|
+
loadPaymentMethods();
|
|
176
|
+
});
|
|
169
177
|
return () => {
|
|
170
178
|
cancelled = true;
|
|
179
|
+
unsubscribe === null || unsubscribe === void 0 || unsubscribe();
|
|
171
180
|
};
|
|
172
181
|
}, [
|
|
173
|
-
(_engineContext$
|
|
182
|
+
(_engineContext$appHel9 = engineContext.appHelper) === null || _engineContext$appHel9 === void 0 || (_engineContext$appHel9 = _engineContext$appHel9.utils) === null || _engineContext$appHel9 === void 0 ? void 0 : _engineContext$appHel9.interaction,
|
|
183
|
+
(_engineContext$appHel10 = engineContext.appHelper) === null || _engineContext$appHel10 === void 0 || (_engineContext$appHel10 = _engineContext$appHel10.utils) === null || _engineContext$appHel10 === void 0 || (_engineContext$appHel10 = _engineContext$appHel10.pisellos) === null || _engineContext$appHel10 === void 0 ? void 0 : _engineContext$appHel10.effects,
|
|
174
184
|
paymentActionsEnabled,
|
|
175
185
|
sales.bookingTicket
|
|
176
186
|
]);
|
|
@@ -548,7 +558,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
548
558
|
return;
|
|
549
559
|
}
|
|
550
560
|
try {
|
|
551
|
-
var _sales$bookingTicket12, _sales$bookingTicket13, _engineContext$
|
|
561
|
+
var _sales$bookingTicket12, _sales$bookingTicket13, _engineContext$appHel11, _sales$bookingTicket$, _sales$bookingTicket14;
|
|
552
562
|
yield cart.waitForCartConsistency();
|
|
553
563
|
if ((cashPaymentConfig === null || cashPaymentConfig === void 0 ? void 0 : cashPaymentConfig.validateHolder) === true) yield sales.validateHoldersBeforePayment();
|
|
554
564
|
if (!((_sales$bookingTicket12 = sales.bookingTicket) === null || _sales$bookingTicket12 === void 0 ? void 0 : _sales$bookingTicket12.getCashPaymentConfig) || !((_sales$bookingTicket13 = sales.bookingTicket) === null || _sales$bookingTicket13 === void 0 ? void 0 : _sales$bookingTicket13.payCash)) {
|
|
@@ -559,7 +569,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
559
569
|
});
|
|
560
570
|
return;
|
|
561
571
|
}
|
|
562
|
-
const shopWalletPassId = yield require_utils$1.getShopWalletPassId((_engineContext$
|
|
572
|
+
const shopWalletPassId = yield require_utils$1.getShopWalletPassId((_engineContext$appHel11 = engineContext.appHelper) === null || _engineContext$appHel11 === void 0 || (_engineContext$appHel11 = _engineContext$appHel11.utils) === null || _engineContext$appHel11 === void 0 ? void 0 : _engineContext$appHel11.interaction);
|
|
563
573
|
yield (_sales$bookingTicket$ = (_sales$bookingTicket14 = sales.bookingTicket).setOtherParams) === null || _sales$bookingTicket$ === void 0 ? void 0 : _sales$bookingTicket$.call(_sales$bookingTicket14, { shop_wallet_pass_id: shopWalletPassId });
|
|
564
574
|
cashExternalRequestIdRef.current = externalRequestId;
|
|
565
575
|
setShowCashPayment(true);
|
|
@@ -598,9 +608,9 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
598
608
|
};
|
|
599
609
|
}();
|
|
600
610
|
const handleDetails = () => {
|
|
601
|
-
var _engineContext$
|
|
611
|
+
var _engineContext$appHel12, _engineContext$appHel13;
|
|
602
612
|
require_PaymentResultToastV2Provider.closePaymentResultToastV2();
|
|
603
|
-
(_engineContext$
|
|
613
|
+
(_engineContext$appHel12 = engineContext.appHelper) === null || _engineContext$appHel12 === void 0 || (_engineContext$appHel12 = _engineContext$appHel12.utils) === null || _engineContext$appHel12 === void 0 || (_engineContext$appHel13 = _engineContext$appHel12.action) === null || _engineContext$appHel13 === void 0 || _engineContext$appHel13.call(_engineContext$appHel12, {
|
|
604
614
|
type: "pisell1.handleOpenSaleDetail",
|
|
605
615
|
data: {
|
|
606
616
|
osKey: "big-sale-detail",
|
|
@@ -629,7 +639,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
629
639
|
}]];
|
|
630
640
|
});
|
|
631
641
|
const presentPaymentResult = (0, ahooks.useMemoizedFn)((params) => {
|
|
632
|
-
var _params$result, _engineContext$
|
|
642
|
+
var _params$result, _engineContext$appHel14, _engineContext$appHel15, _engineContext$appHel16;
|
|
633
643
|
return require_presentBaseSalesPaymentResult.presentBaseSalesPaymentResult({
|
|
634
644
|
baseSales: sales.bookingTicket,
|
|
635
645
|
status: params.status,
|
|
@@ -639,8 +649,8 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
639
649
|
failureReason: params.failureReason,
|
|
640
650
|
actionButtons: params.status === "failed" ? void 0 : buildPaymentResultActions(params.orderId),
|
|
641
651
|
locale: paymentResultLocale,
|
|
642
|
-
translationOriginal: (_engineContext$
|
|
643
|
-
taxTitle: (_engineContext$
|
|
652
|
+
translationOriginal: (_engineContext$appHel14 = engineContext.appHelper) === null || _engineContext$appHel14 === void 0 || (_engineContext$appHel14 = _engineContext$appHel14.utils) === null || _engineContext$appHel14 === void 0 ? void 0 : _engineContext$appHel14.translationOriginal,
|
|
653
|
+
taxTitle: (_engineContext$appHel15 = engineContext.appHelper) === null || _engineContext$appHel15 === void 0 || (_engineContext$appHel15 = _engineContext$appHel15.utils) === null || _engineContext$appHel15 === void 0 || (_engineContext$appHel16 = _engineContext$appHel15.getData) === null || _engineContext$appHel16 === void 0 ? void 0 : _engineContext$appHel16.call(_engineContext$appHel15, "tax_title")
|
|
644
654
|
});
|
|
645
655
|
});
|
|
646
656
|
const handleCashPaymentSuccess = (0, ahooks.useMemoizedFn)(function() {
|
|
@@ -753,12 +763,12 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
753
763
|
};
|
|
754
764
|
}();
|
|
755
765
|
try {
|
|
756
|
-
var _engineContext$
|
|
766
|
+
var _engineContext$appHel17, _engineContext$appHel18, _paymentRuntimeRef$cu, _result$syncResult$su2, _result$syncResult2;
|
|
757
767
|
const method = methodOverride || paymentMethods.find((item) => String(item.code || "").toUpperCase() === code);
|
|
758
768
|
if (!method) throw new Error(`Payment method ${code} is unavailable.`);
|
|
759
769
|
baseSales = sales.bookingTicket;
|
|
760
770
|
const paymentAmount = requestedAmount !== null && requestedAmount !== void 0 ? requestedAmount : resolveCurrentPaymentAmountDue();
|
|
761
|
-
const piPaymentProvider = require_constants.resolvePiPaymentProvider(code, Boolean((_engineContext$
|
|
771
|
+
const piPaymentProvider = require_constants.resolvePiPaymentProvider(code, Boolean((_engineContext$appHel17 = engineContext.appHelper) === null || _engineContext$appHel17 === void 0 || (_engineContext$appHel17 = _engineContext$appHel17.utils) === null || _engineContext$appHel17 === void 0 || (_engineContext$appHel17 = _engineContext$appHel17.businessUtils) === null || _engineContext$appHel17 === void 0 || (_engineContext$appHel18 = _engineContext$appHel17.isPiPaymentEnabled) === null || _engineContext$appHel18 === void 0 ? void 0 : _engineContext$appHel18.call(_engineContext$appHel17)));
|
|
762
772
|
if (Boolean(piPaymentProvider) || isSpiMx51Payment) {
|
|
763
773
|
preparedPayment = yield require_pendingEftposLifecycle.preparePendingEftposPayment({
|
|
764
774
|
amount: paymentAmount,
|
|
@@ -884,7 +894,7 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
884
894
|
if (!beginAction("wallet-confirm")) return;
|
|
885
895
|
const finishPaymentActivity = globalScanActivity.beginPayment();
|
|
886
896
|
try {
|
|
887
|
-
var _engineContext$
|
|
897
|
+
var _engineContext$appHel19, _engineContext$appHel20, _engineContext$appHel21, _context$onOrderCompl6;
|
|
888
898
|
yield cart.waitForCartConsistency();
|
|
889
899
|
if ((walletConfirmConfig === null || walletConfirmConfig === void 0 ? void 0 : walletConfirmConfig.validateHolder) === true) yield sales.validateHoldersBeforePayment();
|
|
890
900
|
const baseSales = sales.bookingTicket;
|
|
@@ -918,8 +928,8 @@ function SaleOrderActionProvider({ actionConfigs, actionOverrides, children, con
|
|
|
918
928
|
currencySymbol,
|
|
919
929
|
actionButtons: buildPaymentResultActions(orderId),
|
|
920
930
|
locale: paymentResultLocale,
|
|
921
|
-
translationOriginal: (_engineContext$
|
|
922
|
-
taxTitle: (_engineContext$
|
|
931
|
+
translationOriginal: (_engineContext$appHel19 = engineContext.appHelper) === null || _engineContext$appHel19 === void 0 || (_engineContext$appHel19 = _engineContext$appHel19.utils) === null || _engineContext$appHel19 === void 0 ? void 0 : _engineContext$appHel19.translationOriginal,
|
|
932
|
+
taxTitle: (_engineContext$appHel20 = engineContext.appHelper) === null || _engineContext$appHel20 === void 0 || (_engineContext$appHel20 = _engineContext$appHel20.utils) === null || _engineContext$appHel20 === void 0 || (_engineContext$appHel21 = _engineContext$appHel20.getData) === null || _engineContext$appHel21 === void 0 ? void 0 : _engineContext$appHel21.call(_engineContext$appHel20, "tax_title")
|
|
923
933
|
});
|
|
924
934
|
yield sales.restore();
|
|
925
935
|
(_context$onOrderCompl6 = context.onOrderComplete) === null || _context$onOrderCompl6 === void 0 || _context$onOrderCompl6.call(context, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.228",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"react-zoom-pan-pinch": "^3.7.0",
|
|
70
70
|
"styled-components": "^6.0.0-rc.3",
|
|
71
71
|
"use-sync-external-store": "^1.6.0",
|
|
72
|
-
"@pisell/utils": "3.0.4",
|
|
73
|
-
"@pisell/materials": "6.12.61",
|
|
74
72
|
"@pisell/pi-payment-sdk": "0.0.3",
|
|
75
73
|
"@pisell/icon": "0.0.11",
|
|
74
|
+
"@pisell/utils": "3.0.4",
|
|
75
|
+
"@pisell/materials": "6.12.61",
|
|
76
76
|
"@pisell/date-picker": "3.0.10"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|