@pisell/private-materials 6.3.123 → 6.3.125
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +4 -4
- package/build/lowcode/render/default/view.js +4 -4
- package/build/lowcode/view.js +4 -4
- package/es/components/booking/addons/model.d.ts +10 -1
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/info/model.d.ts +10 -1
- package/es/components/booking/model.d.ts +9 -1
- package/es/components/booking/notes/model.d.ts +10 -1
- package/es/components/booking/payments/model.d.ts +10 -1
- package/es/components/eftposPay/amount.js +15 -1
- package/es/components/eftposPay/app.js +2 -1
- package/es/components/eftposPay/component/fail/failCustom.js +12 -4
- package/es/components/eftposPay/component/fail/index.js +14 -6
- package/es/components/eftposPay/component/fail/network.js +3 -0
- package/es/components/eftposPay/component/fail/unknow.js +8 -0
- package/es/components/eftposPay/component/manual/index.js +13 -1
- package/es/components/eftposPay/component/signature/index.js +3 -0
- package/es/components/eftposPay/device.js +33 -22
- package/es/components/eftposPay/index.js +48 -11
- package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
- package/es/components/eftposPay/linkly/index.js +10 -23
- package/es/components/eftposPay/pay.js +14 -7
- package/es/components/eftposPay/payo/config.js +38 -5
- package/es/components/eftposPay/payo/hooks.js +3 -12
- package/es/components/eftposPay/payo/payment.js +69 -136
- package/es/components/eftposPay/tip.js +5 -0
- package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/es/components/eftposPay/tyro/index.js +44 -11
- package/es/components/eftposPay/utils/payLog.d.ts +81 -0
- package/es/components/eftposPay/utils/payLog.js +430 -0
- package/es/components/eftposPay/windcave/receiptAction.js +5 -0
- package/es/components/eftposPay/windcave/windcave.js +28 -29
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +142 -165
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +3 -3
- package/es/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/es/components/pay/toC/index.js +31 -65
- package/es/components/pay/toC/model.d.ts +9 -2
- package/es/components/pay/toC/serve.d.ts +0 -18
- package/es/components/pay/toC/serve.js +15 -42
- package/es/components/pay/toC/utils.d.ts +2 -2
- package/es/components/pay/toC/utils.js +0 -4
- package/es/components/schedules/model.d.ts +9 -1
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/hooks/usePaymentLogger.d.ts +0 -1
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/info/model.d.ts +10 -1
- package/lib/components/booking/model.d.ts +9 -1
- package/lib/components/booking/notes/model.d.ts +10 -1
- package/lib/components/booking/payments/model.d.ts +10 -1
- package/lib/components/eftposPay/amount.js +13 -1
- package/lib/components/eftposPay/app.js +2 -1
- package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
- package/lib/components/eftposPay/component/fail/index.js +10 -2
- package/lib/components/eftposPay/component/fail/network.js +3 -0
- package/lib/components/eftposPay/component/fail/unknow.js +8 -0
- package/lib/components/eftposPay/component/manual/index.js +10 -0
- package/lib/components/eftposPay/component/signature/index.js +3 -0
- package/lib/components/eftposPay/device.js +11 -10
- package/lib/components/eftposPay/index.js +36 -11
- package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
- package/lib/components/eftposPay/linkly/index.js +7 -10
- package/lib/components/eftposPay/pay.js +9 -1
- package/lib/components/eftposPay/payo/config.js +15 -8
- package/lib/components/eftposPay/payo/hooks.js +12 -10
- package/lib/components/eftposPay/payo/payment.js +31 -65
- package/lib/components/eftposPay/tip.js +5 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
- package/lib/components/eftposPay/tyro/index.js +21 -17
- package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
- package/lib/components/eftposPay/utils/payLog.js +320 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.js +18 -20
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +100 -90
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -2
- package/lib/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/lib/components/pay/toC/index.js +19 -52
- package/lib/components/pay/toC/model.d.ts +9 -2
- package/lib/components/pay/toC/serve.d.ts +0 -18
- package/lib/components/pay/toC/serve.js +0 -6
- package/lib/components/pay/toC/utils.d.ts +2 -2
- package/lib/components/pay/toC/utils.js +2 -6
- package/lib/components/schedules/model.d.ts +9 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/hooks/usePaymentLogger.d.ts +0 -1
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/package.json +2 -2
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/eftposPay/utils/payLog.ts
|
|
30
|
+
var payLog_exports = {};
|
|
31
|
+
__export(payLog_exports, {
|
|
32
|
+
default: () => payLog_default,
|
|
33
|
+
usePayLog: () => usePayLog
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(payLog_exports);
|
|
36
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_utils = require("@pisell/utils");
|
|
39
|
+
var STORAGE_KEY = "pisell2_eftpos_paylog";
|
|
40
|
+
var ERROR_KEYWORDS = ["失败", "错误", "异常", "error", "fail", "timeout", "超时"];
|
|
41
|
+
function generateSessionKey() {
|
|
42
|
+
const ts = Date.now();
|
|
43
|
+
const rand = Math.random().toString(36).substring(2, 8);
|
|
44
|
+
return `eft_${ts}_${rand}`;
|
|
45
|
+
}
|
|
46
|
+
function isErrorLog(title) {
|
|
47
|
+
const lower = title.toLowerCase();
|
|
48
|
+
return ERROR_KEYWORDS.some((kw) => lower.includes(kw));
|
|
49
|
+
}
|
|
50
|
+
function shallowEqual(a, b) {
|
|
51
|
+
if (a === b) return true;
|
|
52
|
+
if (a == null && b == null) return true;
|
|
53
|
+
if (a == null || b == null) return false;
|
|
54
|
+
try {
|
|
55
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function compressLogs(logs) {
|
|
61
|
+
if (logs.length === 0) return [];
|
|
62
|
+
const result = [];
|
|
63
|
+
let i = 0;
|
|
64
|
+
while (i < logs.length) {
|
|
65
|
+
const current = logs[i];
|
|
66
|
+
if (isErrorLog(current.t)) {
|
|
67
|
+
result.push({ t: current.t, ts: current.ts, d: current.d });
|
|
68
|
+
i++;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
let j = i + 1;
|
|
72
|
+
while (j < logs.length && logs[j].t === current.t && !isErrorLog(logs[j].t)) {
|
|
73
|
+
j++;
|
|
74
|
+
}
|
|
75
|
+
const count = j - i;
|
|
76
|
+
if (count === 1) {
|
|
77
|
+
result.push({ t: current.t, ts: current.ts, d: current.d });
|
|
78
|
+
} else {
|
|
79
|
+
const last = logs[j - 1];
|
|
80
|
+
const entry = {
|
|
81
|
+
t: current.t,
|
|
82
|
+
ts: current.ts,
|
|
83
|
+
count,
|
|
84
|
+
lastTs: last.ts
|
|
85
|
+
};
|
|
86
|
+
if (current.d !== void 0) entry.d = current.d;
|
|
87
|
+
if (!shallowEqual(current.d, last.d) && last.d !== void 0) {
|
|
88
|
+
entry.lastD = last.d;
|
|
89
|
+
}
|
|
90
|
+
result.push(entry);
|
|
91
|
+
}
|
|
92
|
+
i = j;
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
var PayLog = class _PayLog {
|
|
97
|
+
static instance;
|
|
98
|
+
sessionKey = null;
|
|
99
|
+
context = {};
|
|
100
|
+
logs = [];
|
|
101
|
+
startTime = 0;
|
|
102
|
+
flushed = false;
|
|
103
|
+
constructor() {
|
|
104
|
+
}
|
|
105
|
+
static getInstance() {
|
|
106
|
+
if (!_PayLog.instance) {
|
|
107
|
+
_PayLog.instance = new _PayLog();
|
|
108
|
+
}
|
|
109
|
+
return _PayLog.instance;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 初始化一次交易会话
|
|
113
|
+
* - 生成唯一 sessionKey
|
|
114
|
+
* - 恢复上报 localStorage 中残留的旧日志
|
|
115
|
+
* - 接受部分 context(后续可通过 setContext 补充)
|
|
116
|
+
*/
|
|
117
|
+
init(context) {
|
|
118
|
+
try {
|
|
119
|
+
this.recoverOrphanedLogs();
|
|
120
|
+
this.sessionKey = generateSessionKey();
|
|
121
|
+
this.context = context || {};
|
|
122
|
+
this.logs = [];
|
|
123
|
+
this.startTime = Date.now();
|
|
124
|
+
this.flushed = false;
|
|
125
|
+
this.log("PayLog 初始化", context);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error("PayLog init error:", error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 补充/更新上下文信息
|
|
132
|
+
* 新值覆盖旧值,extra 做浅合并
|
|
133
|
+
*/
|
|
134
|
+
setContext(partial) {
|
|
135
|
+
var _a;
|
|
136
|
+
if (!this.sessionKey) return;
|
|
137
|
+
const { extra, ...rest } = partial;
|
|
138
|
+
Object.assign(this.context, rest);
|
|
139
|
+
if (extra) {
|
|
140
|
+
this.context.extra = { ...((_a = this.context) == null ? void 0 : _a.extra) || {}, ...extra || {} };
|
|
141
|
+
}
|
|
142
|
+
this.persistToStorage();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 记录一条日志
|
|
146
|
+
*/
|
|
147
|
+
log(title, data) {
|
|
148
|
+
if (!this.sessionKey) {
|
|
149
|
+
console.warn("PayLog: 未初始化,日志将被忽略 -", title);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const entry = {
|
|
153
|
+
t: title,
|
|
154
|
+
ts: (0, import_dayjs.default)().format("HH:mm:ss.SSS")
|
|
155
|
+
};
|
|
156
|
+
if (data !== void 0) {
|
|
157
|
+
entry.d = data;
|
|
158
|
+
}
|
|
159
|
+
this.logs.push(entry);
|
|
160
|
+
this.persistToStorage();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 上报日志到飞书并清理 localStorage
|
|
164
|
+
*/
|
|
165
|
+
flush(customTitle) {
|
|
166
|
+
if (this.flushed || !this.sessionKey) return;
|
|
167
|
+
this.flushed = true;
|
|
168
|
+
try {
|
|
169
|
+
const elapsed = ((Date.now() - this.startTime) / 1e3).toFixed(1);
|
|
170
|
+
const compressed = compressLogs(this.logs);
|
|
171
|
+
const { paymentType, mode, orderId } = this.context;
|
|
172
|
+
const title = customTitle || `[EFTPOS] ${paymentType || "Unknown"}-${mode || "unknown"}-${orderId || "Unknown"}`;
|
|
173
|
+
const content = this.buildContent(compressed, elapsed);
|
|
174
|
+
(0, import_utils.sendWarningLog)({ title, content });
|
|
175
|
+
this.removeFromStorage(this.sessionKey);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.error("PayLog flush error:", error);
|
|
178
|
+
} finally {
|
|
179
|
+
this.sessionKey = null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* flush + 重置内部状态
|
|
184
|
+
*/
|
|
185
|
+
destroy() {
|
|
186
|
+
this.flush();
|
|
187
|
+
this.sessionKey = null;
|
|
188
|
+
this.context = {};
|
|
189
|
+
this.logs = [];
|
|
190
|
+
this.startTime = 0;
|
|
191
|
+
this.flushed = false;
|
|
192
|
+
}
|
|
193
|
+
// ─── 私有方法 ───
|
|
194
|
+
/**
|
|
195
|
+
* 构建 sendWarningLog 所需的 content 数组
|
|
196
|
+
*/
|
|
197
|
+
buildContent(compressed, elapsed) {
|
|
198
|
+
const ctx = this.context;
|
|
199
|
+
return [
|
|
200
|
+
{ key: "sessionKey", value: this.sessionKey || "" },
|
|
201
|
+
{ key: "发起时间", value: (0, import_dayjs.default)(this.startTime).format("YYYY-MM-DD HH:mm:ss") },
|
|
202
|
+
{ key: "交易号", value: String(ctx.transactionNumber || "未知") },
|
|
203
|
+
{ key: "订单ID", value: String(ctx.orderId || "未知") },
|
|
204
|
+
{ key: "设备ID", value: String(ctx.deviceId || "未知") },
|
|
205
|
+
{ key: "支付类型", value: String(ctx.paymentType || "未知") },
|
|
206
|
+
{ key: "模式", value: String(ctx.mode || "未知") },
|
|
207
|
+
{ key: "渠道", value: String(ctx.channel || "未知") },
|
|
208
|
+
{ key: "总耗时", value: `${elapsed}s` },
|
|
209
|
+
// { key: '日志条数(原始/压缩)', value: `${this.logs.length}/${compressed.length}` },
|
|
210
|
+
{ key: "时间线", value: JSON.stringify(compressed) }
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 持久化当前会话到 localStorage
|
|
215
|
+
*/
|
|
216
|
+
persistToStorage() {
|
|
217
|
+
if (!this.sessionKey) return;
|
|
218
|
+
try {
|
|
219
|
+
const all = this.getAllSessions();
|
|
220
|
+
all[this.sessionKey] = {
|
|
221
|
+
sessionKey: this.sessionKey,
|
|
222
|
+
context: this.context,
|
|
223
|
+
logs: this.logs,
|
|
224
|
+
startTime: this.startTime
|
|
225
|
+
};
|
|
226
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(all));
|
|
227
|
+
} catch (error) {
|
|
228
|
+
console.error("PayLog persist error:", error);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 从 localStorage 移除指定 session
|
|
233
|
+
*/
|
|
234
|
+
removeFromStorage(key) {
|
|
235
|
+
try {
|
|
236
|
+
const all = this.getAllSessions();
|
|
237
|
+
delete all[key];
|
|
238
|
+
if (Object.keys(all).length === 0) {
|
|
239
|
+
localStorage.removeItem(STORAGE_KEY);
|
|
240
|
+
} else {
|
|
241
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(all));
|
|
242
|
+
}
|
|
243
|
+
} catch (error) {
|
|
244
|
+
console.error("PayLog removeFromStorage error:", error);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 获取 localStorage 中所有 session
|
|
249
|
+
*/
|
|
250
|
+
getAllSessions() {
|
|
251
|
+
try {
|
|
252
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
253
|
+
if (!raw) return {};
|
|
254
|
+
return JSON.parse(raw);
|
|
255
|
+
} catch {
|
|
256
|
+
return {};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* 恢复上报 localStorage 中残留的旧日志(崩溃/异常退出场景)
|
|
261
|
+
*/
|
|
262
|
+
recoverOrphanedLogs() {
|
|
263
|
+
try {
|
|
264
|
+
const all = this.getAllSessions();
|
|
265
|
+
const keys = Object.keys(all);
|
|
266
|
+
if (keys.length === 0) return;
|
|
267
|
+
for (const key of keys) {
|
|
268
|
+
const session = all[key];
|
|
269
|
+
try {
|
|
270
|
+
const elapsed = ((Date.now() - session.startTime) / 1e3).toFixed(1);
|
|
271
|
+
const compressed = compressLogs(session.logs);
|
|
272
|
+
const ctx = session.context;
|
|
273
|
+
const title = `[PRE][EFTPOS] ${ctx.paymentType || "未知支付"}-${ctx.mode || "未知模式"}-${ctx.orderId || "未知订单ID"}`;
|
|
274
|
+
const content = [
|
|
275
|
+
{ key: "sessionKey", value: session.sessionKey },
|
|
276
|
+
{ key: "发起时间", value: (0, import_dayjs.default)(session.startTime).format("YYYY-MM-DD HH:mm:ss") },
|
|
277
|
+
{ key: "交易号", value: String(ctx.transactionNumber || "未知") },
|
|
278
|
+
{ key: "订单ID", value: String(ctx.orderId || "未知") },
|
|
279
|
+
{ key: "设备ID", value: String(ctx.deviceId || "未知") },
|
|
280
|
+
{ key: "支付类型", value: String(ctx.paymentType || "未知") },
|
|
281
|
+
{ key: "模式", value: String(ctx.mode || "未知") },
|
|
282
|
+
{ key: "总耗时", value: `${elapsed}s` },
|
|
283
|
+
{ key: "日志条数(原始/压缩)", value: `${session.logs.length}/${compressed.length}` },
|
|
284
|
+
{ key: "时间线", value: JSON.stringify(compressed) }
|
|
285
|
+
];
|
|
286
|
+
(0, import_utils.sendWarningLog)({ title, content });
|
|
287
|
+
this.removeFromStorage(key);
|
|
288
|
+
} catch (err) {
|
|
289
|
+
console.error(`PayLog: 恢复上报失败 (${key}):`, err);
|
|
290
|
+
this.removeFromStorage(key);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
} catch (error) {
|
|
294
|
+
console.error("PayLog recoverOrphanedLogs error:", error);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
var payLog = PayLog.getInstance();
|
|
299
|
+
var payLog_default = payLog;
|
|
300
|
+
function usePayLog(context) {
|
|
301
|
+
const initialized = (0, import_react.useRef)(false);
|
|
302
|
+
(0, import_react.useEffect)(() => {
|
|
303
|
+
if (!initialized.current) {
|
|
304
|
+
initialized.current = true;
|
|
305
|
+
payLog.init(context);
|
|
306
|
+
}
|
|
307
|
+
return () => {
|
|
308
|
+
payLog.log("流程结束,上报日志");
|
|
309
|
+
payLog.flush();
|
|
310
|
+
};
|
|
311
|
+
}, []);
|
|
312
|
+
return {
|
|
313
|
+
log: (title, data) => payLog.log(title, data),
|
|
314
|
+
setContext: (partial) => payLog.setContext(partial)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
318
|
+
0 && (module.exports = {
|
|
319
|
+
usePayLog
|
|
320
|
+
});
|
|
@@ -40,6 +40,7 @@ var import_const = require("../const");
|
|
|
40
40
|
var import_store = require("../store");
|
|
41
41
|
var import_hooks = require("../hooks");
|
|
42
42
|
var import_const2 = require("./const");
|
|
43
|
+
var import_payLog = __toESM(require("../utils/payLog"));
|
|
43
44
|
var ReceiptAction = ({
|
|
44
45
|
api,
|
|
45
46
|
onChange
|
|
@@ -67,6 +68,7 @@ var ReceiptAction = ({
|
|
|
67
68
|
listRef.current = custom == null ? void 0 : custom.list;
|
|
68
69
|
}, [custom == null ? void 0 : custom.list]);
|
|
69
70
|
const onAccept = () => {
|
|
71
|
+
import_payLog.default.log("Windcave:签名-点击确认");
|
|
70
72
|
dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Loading));
|
|
71
73
|
dispatch(
|
|
72
74
|
(0, import_store.updateCustom)({
|
|
@@ -144,6 +146,7 @@ var ReceiptAction = ({
|
|
|
144
146
|
});
|
|
145
147
|
};
|
|
146
148
|
const onBack = () => {
|
|
149
|
+
import_payLog.default.log("Windcave:签名-点击后退");
|
|
147
150
|
dispatch(
|
|
148
151
|
(0, import_store.updateState)({
|
|
149
152
|
title: import_utils.locales.getText("page.eftpos-pay.text.waiting.signature"),
|
|
@@ -154,6 +157,7 @@ var ReceiptAction = ({
|
|
|
154
157
|
dispatch((0, import_store.updateCustom)({ receiptPage: "receipt" }));
|
|
155
158
|
};
|
|
156
159
|
const onConfirm = () => {
|
|
160
|
+
import_payLog.default.log("Windcave:签名-点击取消");
|
|
157
161
|
dispatch(
|
|
158
162
|
(0, import_store.updateState)({
|
|
159
163
|
title: import_utils.locales.getText("page.eftpos-pay.text.processing"),
|
|
@@ -243,6 +247,7 @@ var ReceiptAction = ({
|
|
|
243
247
|
});
|
|
244
248
|
};
|
|
245
249
|
const onDecline = () => {
|
|
250
|
+
import_payLog.default.log("Windcave:签名-点击取消");
|
|
246
251
|
dispatch(
|
|
247
252
|
(0, import_store.updateState)({
|
|
248
253
|
title: import_utils.locales.getText("page.eftpos-pay.text.signature.title"),
|
|
@@ -41,6 +41,7 @@ var import_hooks = require("../hooks");
|
|
|
41
41
|
var import_store = require("../store");
|
|
42
42
|
var import_const2 = require("./const");
|
|
43
43
|
var import_helper2 = require("./helper");
|
|
44
|
+
var import_payLog = __toESM(require("../utils/payLog"));
|
|
44
45
|
var import_receiptAction = __toESM(require("./receiptAction"));
|
|
45
46
|
var Minute = 1e3 * 60;
|
|
46
47
|
var windcave_default = ({
|
|
@@ -69,7 +70,7 @@ var windcave_default = ({
|
|
|
69
70
|
const stepRef = (0, import_react.useRef)(custom == null ? void 0 : custom.step);
|
|
70
71
|
const listRef = (0, import_react.useRef)(custom == null ? void 0 : custom.list);
|
|
71
72
|
const initRef = (0, import_react.useRef)(false);
|
|
72
|
-
const clearRef = (0, import_react.useRef)();
|
|
73
|
+
const clearRef = (0, import_react.useRef)(null);
|
|
73
74
|
const isReceiptPage = (0, import_react.useMemo)(
|
|
74
75
|
() => (custom == null ? void 0 : custom.step) === import_const2.StepStatusEnum.Receipt,
|
|
75
76
|
[custom == null ? void 0 : custom.step]
|
|
@@ -144,8 +145,10 @@ var windcave_default = ({
|
|
|
144
145
|
initRef.current = true;
|
|
145
146
|
if (stepRef.current === import_const2.StepStatusEnum.Receipt) {
|
|
146
147
|
if (import_const.StatusEnum.Loading === statusRef.current) {
|
|
148
|
+
import_payLog.default.log("Windcave:签名页面处于运行中(已发送签名,或取消签名接口),进行计时查询");
|
|
147
149
|
run();
|
|
148
150
|
} else {
|
|
151
|
+
import_payLog.default.log("Windcave:签名页面处于未加载中,进行无限查询");
|
|
149
152
|
run(-1);
|
|
150
153
|
}
|
|
151
154
|
return;
|
|
@@ -155,7 +158,6 @@ var windcave_default = ({
|
|
|
155
158
|
run();
|
|
156
159
|
return;
|
|
157
160
|
}
|
|
158
|
-
console.log("modeRef.current = ", modeRef.current);
|
|
159
161
|
numRef.current = (0, import_helper.getUuid)();
|
|
160
162
|
dispatch(
|
|
161
163
|
(0, import_store.updateState)({
|
|
@@ -212,24 +214,25 @@ var windcave_default = ({
|
|
|
212
214
|
)
|
|
213
215
|
};
|
|
214
216
|
}
|
|
217
|
+
import_payLog.default.setContext({ transactionNumber: numRef.current });
|
|
218
|
+
if (isPay) {
|
|
219
|
+
import_payLog.default.log("Windcave:发起支付", { number: numRef.current });
|
|
220
|
+
} else {
|
|
221
|
+
import_payLog.default.log("Windcave:发起退款", { number: numRef.current });
|
|
222
|
+
}
|
|
215
223
|
const resultPromise = isPay ? api.pay(_params, { signal: controllerRef.current.signal }) : api.refund(_params, { signal: controllerRef.current.signal });
|
|
216
224
|
resultPromise.then((res) => {
|
|
217
|
-
var _a2, _b2;
|
|
225
|
+
var _a2, _b2, _c;
|
|
218
226
|
if (unloadRef.current || !netRef.current) {
|
|
219
227
|
return;
|
|
220
228
|
}
|
|
221
229
|
if (res && `${res.code}` === "200" && res.data && res.data.txn_status_id) {
|
|
222
|
-
(_a2 =
|
|
230
|
+
import_payLog.default.log("Windcave:接口成功,进入轮询", { txn_status_id: (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.txn_status_id });
|
|
231
|
+
(_b2 = validateRef.current) == null ? void 0 : _b2.call(validateRef, res, true);
|
|
223
232
|
return;
|
|
224
233
|
}
|
|
225
|
-
(
|
|
226
|
-
|
|
227
|
-
content: [
|
|
228
|
-
{ key: "res", value: JSON.stringify(res) },
|
|
229
|
-
{ key: "params", value: JSON.stringify(_params) }
|
|
230
|
-
]
|
|
231
|
-
});
|
|
232
|
-
(_b2 = failRef.current) == null ? void 0 : _b2.call(
|
|
234
|
+
import_payLog.default.log("Windcave:支付接口返回失败", { code: res == null ? void 0 : res.code });
|
|
235
|
+
(_c = failRef.current) == null ? void 0 : _c.call(
|
|
233
236
|
failRef,
|
|
234
237
|
res,
|
|
235
238
|
stepRef.current >= import_const2.StepStatusEnum.Account
|
|
@@ -237,14 +240,7 @@ var windcave_default = ({
|
|
|
237
240
|
}).catch((res) => {
|
|
238
241
|
var _a2;
|
|
239
242
|
let isNoNet = unloadRef.current || !netRef.current;
|
|
240
|
-
(0,
|
|
241
|
-
title: "windcave支付失败",
|
|
242
|
-
content: [
|
|
243
|
-
{ key: "error", value: JSON.stringify(res) },
|
|
244
|
-
{ key: "params", value: JSON.stringify(_params) },
|
|
245
|
-
{ key: "isNoNet", value: isNoNet ? "1" : "0" }
|
|
246
|
-
]
|
|
247
|
-
});
|
|
243
|
+
import_payLog.default.log("Windcave:支付接口异常", { error: res == null ? void 0 : res.message, isNoNet });
|
|
248
244
|
if (isNoNet) {
|
|
249
245
|
return;
|
|
250
246
|
}
|
|
@@ -257,6 +253,7 @@ var windcave_default = ({
|
|
|
257
253
|
return;
|
|
258
254
|
}, [api, run, dispatch]);
|
|
259
255
|
const onCancel = () => {
|
|
256
|
+
import_payLog.default.log("Windcave:点击取消支付");
|
|
260
257
|
setDisabled(true);
|
|
261
258
|
api.update({
|
|
262
259
|
type: "CANCEL",
|
|
@@ -276,6 +273,7 @@ var windcave_default = ({
|
|
|
276
273
|
);
|
|
277
274
|
const onChangeReceipt = (status2) => {
|
|
278
275
|
if (status2) {
|
|
276
|
+
import_payLog.default.log("Windcave:签名状态");
|
|
279
277
|
run();
|
|
280
278
|
}
|
|
281
279
|
};
|
|
@@ -15,16 +15,11 @@ export interface WalletPassProps {
|
|
|
15
15
|
walletPass: {
|
|
16
16
|
cards: WalletPassDataType[];
|
|
17
17
|
amount: number;
|
|
18
|
-
recommended?: WalletPassDataType[];
|
|
19
|
-
transformList?: WalletPassDataType[];
|
|
20
|
-
noApplicableVoucher?: WalletPassDataType[];
|
|
21
18
|
};
|
|
22
19
|
walletSetting: {
|
|
23
20
|
name: string;
|
|
24
21
|
popup_status: 0 | 1;
|
|
25
22
|
};
|
|
26
|
-
orderDetail: any;
|
|
27
|
-
total_amount: number;
|
|
28
23
|
}
|
|
29
24
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<WalletPassProps & React.RefAttributes<WalletPassRef>>>;
|
|
30
25
|
export default _default;
|