@pisell/private-materials 6.12.349 → 6.12.350
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 +4 -4
- package/build/lowcode/view.js +4 -4
- package/es/components/checkout/PaymentModal.js +61 -3
- package/es/components/checkout/checkout-channel-diagnostics.js +31 -0
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +32 -0
- package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
- package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
- package/lib/components/checkout/PaymentModal.js +61 -3
- package/lib/components/checkout/checkout-channel-diagnostics.js +32 -0
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +32 -0
- package/package.json +4 -4
|
@@ -27,6 +27,7 @@ import AmountSummary_default from "./components/AmountSummary/index.js";
|
|
|
27
27
|
import SavePayLaterHandler from "./components/SavePayLaterHandler/index.js";
|
|
28
28
|
import usePaymentLogger from "./hooks/usePaymentLogger.js";
|
|
29
29
|
import WalletPassModule_default from "./components/WalletPassModule/index.js";
|
|
30
|
+
import { getCheckoutOrderDiagnostic, logCheckoutChannel } from "./checkout-channel-diagnostics.js";
|
|
30
31
|
import PaymentOptionsModule from "./components/PaymentOptionsModule/index.js";
|
|
31
32
|
import AdditionalModule from "./components/AdditionalModule/index.js";
|
|
32
33
|
import { buildPaymentResultToastParams } from "./payment-result-flow.js";
|
|
@@ -472,7 +473,7 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
472
473
|
const [paymentMethodsReady, setPaymentMethodsReady] = useState(false);
|
|
473
474
|
const [showCashPayment, setShowCashPayment] = useState(false);
|
|
474
475
|
const [paymentOptionsTitle, setPaymentOptionsTitle] = useState(locales.getText("cards.and.digitals") || "Cards & Digitals");
|
|
475
|
-
useOsKey();
|
|
476
|
+
const osKey = useOsKey();
|
|
476
477
|
const paymentChannel = useMemo(() => String((getData === null || getData === void 0 ? void 0 : getData("channel")) || "pos").trim().toLowerCase(), [getData]);
|
|
477
478
|
const paymentScanActivity = useCheckoutPaymentScanActivity(paymentChannel === "kiosk");
|
|
478
479
|
const activeKioskPaymentActivityRef = useRef();
|
|
@@ -1476,6 +1477,21 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1476
1477
|
var _method$name, _method$channel_appli;
|
|
1477
1478
|
return (((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes("cash")) || /现金|現金/i.test(method.name)) && ((_method$channel_appli = method.channel_application) === null || _method$channel_appli === void 0 ? void 0 : _method$channel_appli.includes(currentChannel));
|
|
1478
1479
|
});
|
|
1480
|
+
logCheckoutChannel(logger, getData, "cash-local-add", () => {
|
|
1481
|
+
var _contactParams$busine2;
|
|
1482
|
+
return _objectSpread2(_objectSpread2({
|
|
1483
|
+
paymentChannel,
|
|
1484
|
+
currentChannel,
|
|
1485
|
+
osKey
|
|
1486
|
+
}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
1487
|
+
businessCode: (_contactParams$busine2 = contactParams === null || contactParams === void 0 ? void 0 : contactParams.businessCode) !== null && _contactParams$busine2 !== void 0 ? _contactParams$busine2 : contactParams === null || contactParams === void 0 ? void 0 : contactParams.business_code,
|
|
1488
|
+
osChannel: contactParams === null || contactParams === void 0 ? void 0 : contactParams.channel,
|
|
1489
|
+
osPlatform: contactParams === null || contactParams === void 0 ? void 0 : contactParams.platform,
|
|
1490
|
+
paymentMethodId: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.id,
|
|
1491
|
+
paymentMethodCode: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.code,
|
|
1492
|
+
uniquePaymentNumber
|
|
1493
|
+
});
|
|
1494
|
+
});
|
|
1479
1495
|
logger === null || logger === void 0 || logger.addLog({
|
|
1480
1496
|
type: "info",
|
|
1481
1497
|
title: "open_till",
|
|
@@ -1931,6 +1947,20 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
1931
1947
|
});
|
|
1932
1948
|
}
|
|
1933
1949
|
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1950
|
+
logCheckoutChannel(logger, getData, "method-local-add", () => {
|
|
1951
|
+
var _contactParams$busine3;
|
|
1952
|
+
return _objectSpread2(_objectSpread2({
|
|
1953
|
+
paymentChannel,
|
|
1954
|
+
osKey
|
|
1955
|
+
}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
1956
|
+
businessCode: (_contactParams$busine3 = contactParams === null || contactParams === void 0 ? void 0 : contactParams.businessCode) !== null && _contactParams$busine3 !== void 0 ? _contactParams$busine3 : contactParams === null || contactParams === void 0 ? void 0 : contactParams.business_code,
|
|
1957
|
+
osChannel: contactParams === null || contactParams === void 0 ? void 0 : contactParams.channel,
|
|
1958
|
+
osPlatform: contactParams === null || contactParams === void 0 ? void 0 : contactParams.platform,
|
|
1959
|
+
paymentMethodId: method.id,
|
|
1960
|
+
paymentMethodCode: method.code,
|
|
1961
|
+
paymentMethodType: method.type
|
|
1962
|
+
});
|
|
1963
|
+
});
|
|
1934
1964
|
yield addBaseSalesOrderPayment(currentBaseSales, _objectSpread2({
|
|
1935
1965
|
amount: finalAmount,
|
|
1936
1966
|
code: method.code,
|
|
@@ -2158,6 +2188,34 @@ const PaymentContent = forwardRef(({ cartData, orderInfo, isModalOpen, onPayment
|
|
|
2158
2188
|
showPaymentOptions: (_config$showPaymentOp = config === null || config === void 0 ? void 0 : config.showPaymentOptions) !== null && _config$showPaymentOp !== void 0 ? _config$showPaymentOp : true
|
|
2159
2189
|
};
|
|
2160
2190
|
const shouldShowCashPayment = moduleConfig.showCashPayment && showCashPayment;
|
|
2191
|
+
const channelDiagnosticSnapshotRef = useRef();
|
|
2192
|
+
useEffect(() => {
|
|
2193
|
+
if (!isModalOpen) {
|
|
2194
|
+
channelDiagnosticSnapshotRef.current = void 0;
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
if (!paymentMethodsReady) return;
|
|
2198
|
+
try {
|
|
2199
|
+
var _getData, _contactParams$busine4;
|
|
2200
|
+
const snapshot = _objectSpread2(_objectSpread2({
|
|
2201
|
+
paymentChannel,
|
|
2202
|
+
dataChannel: (_getData = getData === null || getData === void 0 ? void 0 : getData("channel")) !== null && _getData !== void 0 ? _getData : null,
|
|
2203
|
+
osKey
|
|
2204
|
+
}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
2205
|
+
businessCode: (_contactParams$busine4 = contactParams === null || contactParams === void 0 ? void 0 : contactParams.businessCode) !== null && _contactParams$busine4 !== void 0 ? _contactParams$busine4 : contactParams === null || contactParams === void 0 ? void 0 : contactParams.business_code,
|
|
2206
|
+
osChannel: contactParams === null || contactParams === void 0 ? void 0 : contactParams.channel,
|
|
2207
|
+
osPlatform: contactParams === null || contactParams === void 0 ? void 0 : contactParams.platform,
|
|
2208
|
+
showCashPayment: shouldShowCashPayment,
|
|
2209
|
+
showCustomerSelect: moduleConfig.showCustomerSelect,
|
|
2210
|
+
showPaymentType: (config === null || config === void 0 ? void 0 : config.showPaymentType) !== false,
|
|
2211
|
+
directCustomPayment: (config === null || config === void 0 ? void 0 : config.directCustomPayment) === true
|
|
2212
|
+
});
|
|
2213
|
+
const key = JSON.stringify(snapshot);
|
|
2214
|
+
if (channelDiagnosticSnapshotRef.current === key) return;
|
|
2215
|
+
channelDiagnosticSnapshotRef.current = key;
|
|
2216
|
+
logCheckoutChannel(logger, getData, "ui-ready", () => snapshot);
|
|
2217
|
+
} catch (_unused7) {}
|
|
2218
|
+
});
|
|
2161
2219
|
const paymentOptionsColumnCount = (_config$paymentOption = config === null || config === void 0 ? void 0 : config.paymentOptionsColumnCount) !== null && _config$paymentOption !== void 0 ? _config$paymentOption : shouldShowCashPayment ? 1 : 2;
|
|
2162
2220
|
const isKioskCheckoutActivityLocked = paymentChannel === "kiosk" && (syncingLock || paymentScanActivity.isScanProcessing || paymentScanActivity.isPaymentProcessing);
|
|
2163
2221
|
const handleSearch = useMemoizedFn(function() {
|
|
@@ -3215,11 +3273,11 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
3215
3273
|
try {
|
|
3216
3274
|
const baseSalesModule = currentBaseSales;
|
|
3217
3275
|
if (baseSalesModule) {
|
|
3218
|
-
var
|
|
3276
|
+
var _getData2;
|
|
3219
3277
|
isLocalOrderCreated.current = true;
|
|
3220
3278
|
const shop_wallet_pass_id = yield getShopWalletPassId(interaction);
|
|
3221
3279
|
baseSalesModule.setOtherParams({
|
|
3222
|
-
is_price_include_tax: (
|
|
3280
|
+
is_price_include_tax: (_getData2 = getData("is_price_include_tax")) !== null && _getData2 !== void 0 ? _getData2 : 1,
|
|
3223
3281
|
tax_rate: getData("tax_rate"),
|
|
3224
3282
|
surcharge_list: getData("surcharge_list"),
|
|
3225
3283
|
currency_format: getData("currency_format"),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
+
//#region src/components/checkout/checkout-channel-diagnostics.ts
|
|
3
|
+
/** 取白名单标识,便于把支付分流日志与订单/同步日志关联。 */
|
|
4
|
+
function getCheckoutOrderDiagnostic(baseSales) {
|
|
5
|
+
var _baseSales$getOrderId;
|
|
6
|
+
const identity = baseSales === null || baseSales === void 0 || (_baseSales$getOrderId = baseSales.getOrderIdentity) === null || _baseSales$getOrderId === void 0 ? void 0 : _baseSales$getOrderId.call(baseSales);
|
|
7
|
+
return {
|
|
8
|
+
localOrderId: identity === null || identity === void 0 ? void 0 : identity.localId,
|
|
9
|
+
orderId: identity === null || identity === void 0 ? void 0 : identity.orderId,
|
|
10
|
+
orderNumber: identity === null || identity === void 0 ? void 0 : identity.orderNumber,
|
|
11
|
+
shopOrderNumber: identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** 只采集渠道和流程标识,不记录客户、购物车或完整支付载荷。 */
|
|
15
|
+
function logCheckoutChannel(logger, getData, event, getDetails) {
|
|
16
|
+
try {
|
|
17
|
+
var _logger$addLog, _getData;
|
|
18
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
19
|
+
type: "info",
|
|
20
|
+
title: `checkout-channel:${event}`,
|
|
21
|
+
metadata: _objectSpread2({
|
|
22
|
+
path: window.location.pathname,
|
|
23
|
+
secondaryDisplay: new URLSearchParams(window.location.search).get("secondaryDisplay"),
|
|
24
|
+
storedChannel: window.localStorage.getItem("pisell_app_channel"),
|
|
25
|
+
dataChannel: (_getData = getData === null || getData === void 0 ? void 0 : getData("channel")) !== null && _getData !== void 0 ? _getData : null
|
|
26
|
+
}, getDetails())
|
|
27
|
+
});
|
|
28
|
+
} catch (_unused) {}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getCheckoutOrderDiagnostic, logCheckoutChannel };
|
|
@@ -2,7 +2,9 @@ import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
|
2
2
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
3
3
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
4
4
|
import PaymentKeyboard from "../../../../pro/priceKeyboard/components/paymentKeyboard/index.js";
|
|
5
|
+
import usePaymentLogger from "../../hooks/usePaymentLogger.js";
|
|
5
6
|
import { buildDirectPaymentMethodPayload, calculateDirectPaymentSurcharge, shouldSkipCustomPaymentKeyboard } from "./paymentMethodPolicy.js";
|
|
7
|
+
import { getCheckoutOrderDiagnostic, logCheckoutChannel } from "../../checkout-channel-diagnostics.js";
|
|
6
8
|
import React, { useMemo, useState } from "react";
|
|
7
9
|
import { Button } from "antd";
|
|
8
10
|
import { formatAmount } from "@pisell/utils";
|
|
@@ -15,6 +17,7 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
15
17
|
const context = useEngineContext();
|
|
16
18
|
const { getData, getApp } = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
17
19
|
!(getApp === null || getApp === void 0) && getApp();
|
|
20
|
+
const logger = usePaymentLogger();
|
|
18
21
|
const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
|
|
19
22
|
const calculateSurcharge = (surchargeConfig) => calculateDirectPaymentSurcharge(surchargeConfig, customAmount);
|
|
20
23
|
const handleRightButtonClick = (e) => {
|
|
@@ -68,6 +71,15 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
68
71
|
const showKeyboard = function() {
|
|
69
72
|
var _ref = _asyncToGenerator(function* () {
|
|
70
73
|
if (isEftpos) return;
|
|
74
|
+
logCheckoutChannel(logger, getData, "method-route", () => _objectSpread2(_objectSpread2({}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
75
|
+
paymentChannel,
|
|
76
|
+
paymentMethodId: method.id,
|
|
77
|
+
paymentMethodCode: method.code,
|
|
78
|
+
paymentMethodType: method.type,
|
|
79
|
+
allowedChannels: method.channel_application,
|
|
80
|
+
directCustomPayment,
|
|
81
|
+
route: paymentChannel === "kiosk" ? "main-screen-authorization" : shouldSkipCustomPaymentKeyboard(method.type, directCustomPayment) ? "local-direct" : "local-keyboard"
|
|
82
|
+
}));
|
|
71
83
|
if (paymentChannel === "kiosk") {
|
|
72
84
|
const finishPaymentActivity = beginKioskPaymentActivity === null || beginKioskPaymentActivity === void 0 ? void 0 : beginKioskPaymentActivity(`authorization:${method.code || "unknown"}`);
|
|
73
85
|
if (beginKioskPaymentActivity && !finishPaymentActivity) return;
|
|
@@ -75,6 +87,13 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
75
87
|
var _currentBaseSales$get, _window;
|
|
76
88
|
const otherParams = (yield Promise.resolve(currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get = currentBaseSales.getOtherParams) === null || _currentBaseSales$get === void 0 ? void 0 : _currentBaseSales$get.call(currentBaseSales))) || (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.otherParams) || {};
|
|
77
89
|
if (finishPaymentActivity && !finishPaymentActivity.isActive()) return;
|
|
90
|
+
logCheckoutChannel(logger, getData, "authorization-request", () => _objectSpread2(_objectSpread2({}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
91
|
+
paymentChannel,
|
|
92
|
+
paymentMethodCode: method.code,
|
|
93
|
+
businessCode: otherParams.businessCode || otherParams.business_code,
|
|
94
|
+
osChannel: otherParams.channel,
|
|
95
|
+
osPlatform: otherParams.platform
|
|
96
|
+
}));
|
|
78
97
|
const authorizationResult = yield Promise.resolve((_window = window) === null || _window === void 0 || (_window = _window.app) === null || _window === void 0 ? void 0 : _window.applicationManager.get("global").runFunction("authorizeAction", {
|
|
79
98
|
onClose: finishPaymentActivity,
|
|
80
99
|
params: {
|
|
@@ -85,9 +104,22 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
85
104
|
amount: customAmount
|
|
86
105
|
}
|
|
87
106
|
}));
|
|
107
|
+
logCheckoutChannel(logger, getData, "authorization-result", () => {
|
|
108
|
+
var _authorizationResult$;
|
|
109
|
+
return _objectSpread2(_objectSpread2({}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
110
|
+
paymentChannel,
|
|
111
|
+
paymentMethodCode: method.code,
|
|
112
|
+
status: (_authorizationResult$ = authorizationResult === null || authorizationResult === void 0 ? void 0 : authorizationResult.status) !== null && _authorizationResult$ !== void 0 ? _authorizationResult$ : "unavailable"
|
|
113
|
+
});
|
|
114
|
+
});
|
|
88
115
|
if (String((authorizationResult === null || authorizationResult === void 0 ? void 0 : authorizationResult.status) || "").toLowerCase() !== "success") finishPaymentActivity === null || finishPaymentActivity === void 0 || finishPaymentActivity();
|
|
89
116
|
} catch (error) {
|
|
90
117
|
finishPaymentActivity === null || finishPaymentActivity === void 0 || finishPaymentActivity();
|
|
118
|
+
logCheckoutChannel(logger, getData, "authorization-error", () => _objectSpread2(_objectSpread2({}, getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
119
|
+
paymentChannel,
|
|
120
|
+
paymentMethodCode: method.code,
|
|
121
|
+
errorName: error instanceof Error ? error.name : "unknown"
|
|
122
|
+
}));
|
|
91
123
|
console.error("[PaymentMethodItem] request payment authorization failed", error);
|
|
92
124
|
}
|
|
93
125
|
return;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import timezonePlugin from "dayjs/plugin/timezone";
|
|
4
|
+
import utcPlugin from "dayjs/plugin/utc";
|
|
5
5
|
//#region src/plus/saasDevice/devicePasscodes/model.ts
|
|
6
|
-
dayjs.extend(
|
|
7
|
-
dayjs.extend(
|
|
6
|
+
dayjs.extend(utcPlugin);
|
|
7
|
+
dayjs.extend(timezonePlugin);
|
|
8
8
|
const INITIAL_DEVICE_PASSCODE_STATE = {
|
|
9
9
|
deviceIds: [],
|
|
10
10
|
devicesById: {}
|
|
@@ -6,12 +6,12 @@ import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
|
6
6
|
import { locales } from "@pisell/utils";
|
|
7
7
|
import { Button, PisellEmpty, PisellModal, PisellStatisticList, Skeleton, Timeline, usePisellConfig } from "@pisell/materials";
|
|
8
8
|
import { useRequest } from "ahooks";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import timezonePlugin from "dayjs/plugin/timezone";
|
|
10
|
+
import utcPlugin from "dayjs/plugin/utc";
|
|
11
11
|
import "./index.less";
|
|
12
12
|
//#region src/plus/walletPassGallery/components/timelineSection/index.tsx
|
|
13
|
-
dayjs.extend(
|
|
14
|
-
dayjs.extend(
|
|
13
|
+
dayjs.extend(timezonePlugin);
|
|
14
|
+
dayjs.extend(utcPlugin);
|
|
15
15
|
const stateTimeUnix = 1723255863;
|
|
16
16
|
const POLL_INTERVAL = 2e3;
|
|
17
17
|
const POLL_MAX_TIMES = 5;
|
|
@@ -28,6 +28,7 @@ const require_index$7 = require("./components/AmountSummary/index.js");
|
|
|
28
28
|
const require_index$8 = require("./components/SavePayLaterHandler/index.js");
|
|
29
29
|
const require_usePaymentLogger = require("./hooks/usePaymentLogger.js");
|
|
30
30
|
const require_index$9 = require("./components/WalletPassModule/index.js");
|
|
31
|
+
const require_checkout_channel_diagnostics = require("./checkout-channel-diagnostics.js");
|
|
31
32
|
const require_index$10 = require("./components/PaymentOptionsModule/index.js");
|
|
32
33
|
const require_index$11 = require("./components/AdditionalModule/index.js");
|
|
33
34
|
const require_payment_result_flow = require("./payment-result-flow.js");
|
|
@@ -475,7 +476,7 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
475
476
|
const [paymentMethodsReady, setPaymentMethodsReady] = (0, react.useState)(false);
|
|
476
477
|
const [showCashPayment, setShowCashPayment] = (0, react.useState)(false);
|
|
477
478
|
const [paymentOptionsTitle, setPaymentOptionsTitle] = (0, react.useState)(_pisell_utils.locales.getText("cards.and.digitals") || "Cards & Digitals");
|
|
478
|
-
require_OsKeyContext.useOsKey();
|
|
479
|
+
const osKey = require_OsKeyContext.useOsKey();
|
|
479
480
|
const paymentChannel = (0, react.useMemo)(() => String((getData === null || getData === void 0 ? void 0 : getData("channel")) || "pos").trim().toLowerCase(), [getData]);
|
|
480
481
|
const paymentScanActivity = require_useCheckoutPaymentScanActivity.default(paymentChannel === "kiosk");
|
|
481
482
|
const activeKioskPaymentActivityRef = (0, react.useRef)();
|
|
@@ -1479,6 +1480,21 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1479
1480
|
var _method$name, _method$channel_appli;
|
|
1480
1481
|
return (((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes("cash")) || /现金|現金/i.test(method.name)) && ((_method$channel_appli = method.channel_application) === null || _method$channel_appli === void 0 ? void 0 : _method$channel_appli.includes(currentChannel));
|
|
1481
1482
|
});
|
|
1483
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "cash-local-add", () => {
|
|
1484
|
+
var _contactParams$busine2;
|
|
1485
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
1486
|
+
paymentChannel,
|
|
1487
|
+
currentChannel,
|
|
1488
|
+
osKey
|
|
1489
|
+
}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
1490
|
+
businessCode: (_contactParams$busine2 = contactParams === null || contactParams === void 0 ? void 0 : contactParams.businessCode) !== null && _contactParams$busine2 !== void 0 ? _contactParams$busine2 : contactParams === null || contactParams === void 0 ? void 0 : contactParams.business_code,
|
|
1491
|
+
osChannel: contactParams === null || contactParams === void 0 ? void 0 : contactParams.channel,
|
|
1492
|
+
osPlatform: contactParams === null || contactParams === void 0 ? void 0 : contactParams.platform,
|
|
1493
|
+
paymentMethodId: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.id,
|
|
1494
|
+
paymentMethodCode: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.code,
|
|
1495
|
+
uniquePaymentNumber
|
|
1496
|
+
});
|
|
1497
|
+
});
|
|
1482
1498
|
logger === null || logger === void 0 || logger.addLog({
|
|
1483
1499
|
type: "info",
|
|
1484
1500
|
title: "open_till",
|
|
@@ -1934,6 +1950,20 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
1934
1950
|
});
|
|
1935
1951
|
}
|
|
1936
1952
|
setIsChangePaymentNotIncludeVoucher === null || setIsChangePaymentNotIncludeVoucher === void 0 || setIsChangePaymentNotIncludeVoucher(true);
|
|
1953
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "method-local-add", () => {
|
|
1954
|
+
var _contactParams$busine3;
|
|
1955
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
1956
|
+
paymentChannel,
|
|
1957
|
+
osKey
|
|
1958
|
+
}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
1959
|
+
businessCode: (_contactParams$busine3 = contactParams === null || contactParams === void 0 ? void 0 : contactParams.businessCode) !== null && _contactParams$busine3 !== void 0 ? _contactParams$busine3 : contactParams === null || contactParams === void 0 ? void 0 : contactParams.business_code,
|
|
1960
|
+
osChannel: contactParams === null || contactParams === void 0 ? void 0 : contactParams.channel,
|
|
1961
|
+
osPlatform: contactParams === null || contactParams === void 0 ? void 0 : contactParams.platform,
|
|
1962
|
+
paymentMethodId: method.id,
|
|
1963
|
+
paymentMethodCode: method.code,
|
|
1964
|
+
paymentMethodType: method.type
|
|
1965
|
+
});
|
|
1966
|
+
});
|
|
1937
1967
|
yield addBaseSalesOrderPayment(currentBaseSales, require_objectSpread2._objectSpread2({
|
|
1938
1968
|
amount: finalAmount,
|
|
1939
1969
|
code: method.code,
|
|
@@ -2161,6 +2191,34 @@ const PaymentContent = (0, react.forwardRef)(({ cartData, orderInfo, isModalOpen
|
|
|
2161
2191
|
showPaymentOptions: (_config$showPaymentOp = config === null || config === void 0 ? void 0 : config.showPaymentOptions) !== null && _config$showPaymentOp !== void 0 ? _config$showPaymentOp : true
|
|
2162
2192
|
};
|
|
2163
2193
|
const shouldShowCashPayment = moduleConfig.showCashPayment && showCashPayment;
|
|
2194
|
+
const channelDiagnosticSnapshotRef = (0, react.useRef)();
|
|
2195
|
+
(0, react.useEffect)(() => {
|
|
2196
|
+
if (!isModalOpen) {
|
|
2197
|
+
channelDiagnosticSnapshotRef.current = void 0;
|
|
2198
|
+
return;
|
|
2199
|
+
}
|
|
2200
|
+
if (!paymentMethodsReady) return;
|
|
2201
|
+
try {
|
|
2202
|
+
var _getData, _contactParams$busine4;
|
|
2203
|
+
const snapshot = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
2204
|
+
paymentChannel,
|
|
2205
|
+
dataChannel: (_getData = getData === null || getData === void 0 ? void 0 : getData("channel")) !== null && _getData !== void 0 ? _getData : null,
|
|
2206
|
+
osKey
|
|
2207
|
+
}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
2208
|
+
businessCode: (_contactParams$busine4 = contactParams === null || contactParams === void 0 ? void 0 : contactParams.businessCode) !== null && _contactParams$busine4 !== void 0 ? _contactParams$busine4 : contactParams === null || contactParams === void 0 ? void 0 : contactParams.business_code,
|
|
2209
|
+
osChannel: contactParams === null || contactParams === void 0 ? void 0 : contactParams.channel,
|
|
2210
|
+
osPlatform: contactParams === null || contactParams === void 0 ? void 0 : contactParams.platform,
|
|
2211
|
+
showCashPayment: shouldShowCashPayment,
|
|
2212
|
+
showCustomerSelect: moduleConfig.showCustomerSelect,
|
|
2213
|
+
showPaymentType: (config === null || config === void 0 ? void 0 : config.showPaymentType) !== false,
|
|
2214
|
+
directCustomPayment: (config === null || config === void 0 ? void 0 : config.directCustomPayment) === true
|
|
2215
|
+
});
|
|
2216
|
+
const key = JSON.stringify(snapshot);
|
|
2217
|
+
if (channelDiagnosticSnapshotRef.current === key) return;
|
|
2218
|
+
channelDiagnosticSnapshotRef.current = key;
|
|
2219
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "ui-ready", () => snapshot);
|
|
2220
|
+
} catch (_unused7) {}
|
|
2221
|
+
});
|
|
2164
2222
|
const paymentOptionsColumnCount = (_config$paymentOption = config === null || config === void 0 ? void 0 : config.paymentOptionsColumnCount) !== null && _config$paymentOption !== void 0 ? _config$paymentOption : shouldShowCashPayment ? 1 : 2;
|
|
2165
2223
|
const isKioskCheckoutActivityLocked = paymentChannel === "kiosk" && (syncingLock || paymentScanActivity.isScanProcessing || paymentScanActivity.isPaymentProcessing);
|
|
2166
2224
|
const handleSearch = (0, ahooks.useMemoizedFn)(function() {
|
|
@@ -3218,11 +3276,11 @@ const PaymentModal = ({ open, baseSales, baseSalesModuleName, walletPassMode = "
|
|
|
3218
3276
|
try {
|
|
3219
3277
|
const baseSalesModule = currentBaseSales;
|
|
3220
3278
|
if (baseSalesModule) {
|
|
3221
|
-
var
|
|
3279
|
+
var _getData2;
|
|
3222
3280
|
isLocalOrderCreated.current = true;
|
|
3223
3281
|
const shop_wallet_pass_id = yield require_utils.getShopWalletPassId(interaction);
|
|
3224
3282
|
baseSalesModule.setOtherParams({
|
|
3225
|
-
is_price_include_tax: (
|
|
3283
|
+
is_price_include_tax: (_getData2 = getData("is_price_include_tax")) !== null && _getData2 !== void 0 ? _getData2 : 1,
|
|
3226
3284
|
tax_rate: getData("tax_rate"),
|
|
3227
3285
|
surcharge_list: getData("surcharge_list"),
|
|
3228
3286
|
currency_format: getData("currency_format"),
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
2
|
+
//#region src/components/checkout/checkout-channel-diagnostics.ts
|
|
3
|
+
/** 取白名单标识,便于把支付分流日志与订单/同步日志关联。 */
|
|
4
|
+
function getCheckoutOrderDiagnostic(baseSales) {
|
|
5
|
+
var _baseSales$getOrderId;
|
|
6
|
+
const identity = baseSales === null || baseSales === void 0 || (_baseSales$getOrderId = baseSales.getOrderIdentity) === null || _baseSales$getOrderId === void 0 ? void 0 : _baseSales$getOrderId.call(baseSales);
|
|
7
|
+
return {
|
|
8
|
+
localOrderId: identity === null || identity === void 0 ? void 0 : identity.localId,
|
|
9
|
+
orderId: identity === null || identity === void 0 ? void 0 : identity.orderId,
|
|
10
|
+
orderNumber: identity === null || identity === void 0 ? void 0 : identity.orderNumber,
|
|
11
|
+
shopOrderNumber: identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** 只采集渠道和流程标识,不记录客户、购物车或完整支付载荷。 */
|
|
15
|
+
function logCheckoutChannel(logger, getData, event, getDetails) {
|
|
16
|
+
try {
|
|
17
|
+
var _logger$addLog, _getData;
|
|
18
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
19
|
+
type: "info",
|
|
20
|
+
title: `checkout-channel:${event}`,
|
|
21
|
+
metadata: require_objectSpread2._objectSpread2({
|
|
22
|
+
path: window.location.pathname,
|
|
23
|
+
secondaryDisplay: new URLSearchParams(window.location.search).get("secondaryDisplay"),
|
|
24
|
+
storedChannel: window.localStorage.getItem("pisell_app_channel"),
|
|
25
|
+
dataChannel: (_getData = getData === null || getData === void 0 ? void 0 : getData("channel")) !== null && _getData !== void 0 ? _getData : null
|
|
26
|
+
}, getDetails())
|
|
27
|
+
});
|
|
28
|
+
} catch (_unused) {}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.getCheckoutOrderDiagnostic = getCheckoutOrderDiagnostic;
|
|
32
|
+
exports.logCheckoutChannel = logCheckoutChannel;
|
|
@@ -3,7 +3,9 @@ const require_useEngineContext = require("../../../../hooks/useEngineContext.js"
|
|
|
3
3
|
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
4
4
|
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
5
5
|
const require_index = require("../../../../pro/priceKeyboard/components/paymentKeyboard/index.js");
|
|
6
|
+
const require_usePaymentLogger = require("../../hooks/usePaymentLogger.js");
|
|
6
7
|
const require_paymentMethodPolicy = require("./paymentMethodPolicy.js");
|
|
8
|
+
const require_checkout_channel_diagnostics = require("../../checkout-channel-diagnostics.js");
|
|
7
9
|
let react = require("react");
|
|
8
10
|
react = require_runtime.__toESM(react);
|
|
9
11
|
let antd = require("antd");
|
|
@@ -18,6 +20,7 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
18
20
|
const context = require_useEngineContext.default();
|
|
19
21
|
const { getData, getApp } = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
20
22
|
!(getApp === null || getApp === void 0) && getApp();
|
|
23
|
+
const logger = require_usePaymentLogger.default();
|
|
21
24
|
const [isKeyboardVisible, setIsKeyboardVisible] = (0, react.useState)(false);
|
|
22
25
|
const calculateSurcharge = (surchargeConfig) => require_paymentMethodPolicy.calculateDirectPaymentSurcharge(surchargeConfig, customAmount);
|
|
23
26
|
const handleRightButtonClick = (e) => {
|
|
@@ -71,6 +74,15 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
71
74
|
const showKeyboard = function() {
|
|
72
75
|
var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
73
76
|
if (isEftpos) return;
|
|
77
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "method-route", () => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
78
|
+
paymentChannel,
|
|
79
|
+
paymentMethodId: method.id,
|
|
80
|
+
paymentMethodCode: method.code,
|
|
81
|
+
paymentMethodType: method.type,
|
|
82
|
+
allowedChannels: method.channel_application,
|
|
83
|
+
directCustomPayment,
|
|
84
|
+
route: paymentChannel === "kiosk" ? "main-screen-authorization" : require_paymentMethodPolicy.shouldSkipCustomPaymentKeyboard(method.type, directCustomPayment) ? "local-direct" : "local-keyboard"
|
|
85
|
+
}));
|
|
74
86
|
if (paymentChannel === "kiosk") {
|
|
75
87
|
const finishPaymentActivity = beginKioskPaymentActivity === null || beginKioskPaymentActivity === void 0 ? void 0 : beginKioskPaymentActivity(`authorization:${method.code || "unknown"}`);
|
|
76
88
|
if (beginKioskPaymentActivity && !finishPaymentActivity) return;
|
|
@@ -78,6 +90,13 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
78
90
|
var _currentBaseSales$get, _window;
|
|
79
91
|
const otherParams = (yield Promise.resolve(currentBaseSales === null || currentBaseSales === void 0 || (_currentBaseSales$get = currentBaseSales.getOtherParams) === null || _currentBaseSales$get === void 0 ? void 0 : _currentBaseSales$get.call(currentBaseSales))) || (currentBaseSales === null || currentBaseSales === void 0 ? void 0 : currentBaseSales.otherParams) || {};
|
|
80
92
|
if (finishPaymentActivity && !finishPaymentActivity.isActive()) return;
|
|
93
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "authorization-request", () => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
94
|
+
paymentChannel,
|
|
95
|
+
paymentMethodCode: method.code,
|
|
96
|
+
businessCode: otherParams.businessCode || otherParams.business_code,
|
|
97
|
+
osChannel: otherParams.channel,
|
|
98
|
+
osPlatform: otherParams.platform
|
|
99
|
+
}));
|
|
81
100
|
const authorizationResult = yield Promise.resolve((_window = window) === null || _window === void 0 || (_window = _window.app) === null || _window === void 0 ? void 0 : _window.applicationManager.get("global").runFunction("authorizeAction", {
|
|
82
101
|
onClose: finishPaymentActivity,
|
|
83
102
|
params: {
|
|
@@ -88,9 +107,22 @@ const PaymentMethodItem = ({ method, amountSymbol, customAmount, disabled = fals
|
|
|
88
107
|
amount: customAmount
|
|
89
108
|
}
|
|
90
109
|
}));
|
|
110
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "authorization-result", () => {
|
|
111
|
+
var _authorizationResult$;
|
|
112
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
113
|
+
paymentChannel,
|
|
114
|
+
paymentMethodCode: method.code,
|
|
115
|
+
status: (_authorizationResult$ = authorizationResult === null || authorizationResult === void 0 ? void 0 : authorizationResult.status) !== null && _authorizationResult$ !== void 0 ? _authorizationResult$ : "unavailable"
|
|
116
|
+
});
|
|
117
|
+
});
|
|
91
118
|
if (String((authorizationResult === null || authorizationResult === void 0 ? void 0 : authorizationResult.status) || "").toLowerCase() !== "success") finishPaymentActivity === null || finishPaymentActivity === void 0 || finishPaymentActivity();
|
|
92
119
|
} catch (error) {
|
|
93
120
|
finishPaymentActivity === null || finishPaymentActivity === void 0 || finishPaymentActivity();
|
|
121
|
+
require_checkout_channel_diagnostics.logCheckoutChannel(logger, getData, "authorization-error", () => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, require_checkout_channel_diagnostics.getCheckoutOrderDiagnostic(currentBaseSales)), {}, {
|
|
122
|
+
paymentChannel,
|
|
123
|
+
paymentMethodCode: method.code,
|
|
124
|
+
errorName: error instanceof Error ? error.name : "unknown"
|
|
125
|
+
}));
|
|
94
126
|
console.error("[PaymentMethodItem] request payment authorization failed", error);
|
|
95
127
|
}
|
|
96
128
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.350",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
"react-zoom-pan-pinch": "^3.7.0",
|
|
74
74
|
"styled-components": "^6.0.0-rc.3",
|
|
75
75
|
"use-sync-external-store": "^1.6.0",
|
|
76
|
-
"@pisell/pi-payment-sdk": "0.0.4",
|
|
77
76
|
"@pisell/utils": "3.0.7",
|
|
77
|
+
"@pisell/pi-payment-sdk": "0.0.4",
|
|
78
|
+
"@pisell/materials": "6.12.82",
|
|
78
79
|
"@pisell/date-picker": "3.0.12",
|
|
79
|
-
"@pisell/icon": "0.0.11"
|
|
80
|
-
"@pisell/materials": "6.12.82"
|
|
80
|
+
"@pisell/icon": "0.0.11"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": "^18.0.0",
|