@pisell/private-materials 6.3.14 → 6.3.15
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 +13 -13
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
- package/es/components/booking/components/browserSelect/index.js +1 -1
- package/es/components/booking/forms/model.js +5 -5
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service/like/index.js +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
- package/es/components/booking/notes/NoteBlock/index.js +11 -11
- package/es/components/booking/notes/model.js +5 -5
- package/es/components/booking/payments/model.js +5 -5
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/listComponent/index.js +5 -5
- package/es/components/pay/toC/PaymentMethods/ApplePay/index.js +52 -6
- package/es/components/pay/toC/PaymentMethods/BankDeposit/index.js +58 -8
- package/es/components/pay/toC/PaymentMethods/CashManual/index.js +74 -12
- package/es/components/pay/toC/PaymentMethods/CustomPayment/index.js +73 -12
- package/es/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +93 -11
- package/es/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +90 -12
- package/es/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +46 -7
- package/es/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +90 -12
- package/es/components/pay/toC/PaymentMethods/GooglePay/index.js +64 -13
- package/es/components/pay/toC/PaymentMethods/OfflinePayment/index.js +73 -8
- package/es/components/pay/toC/PaymentMethods/StripePay/index.js +68 -17
- package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +86 -14
- package/es/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +89 -15
- package/es/components/pay/toC/index.js +278 -118
- package/es/components/productExtension/card/index.js +3 -3
- package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
- package/es/components/productExtension/fields/Forms/index.js +12 -12
- package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
- package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
- package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
- package/es/components/productExtension/server.js +2 -2
- package/es/components/ruleSetting/ruleBorder/index.js +1 -1
- package/es/components/schedules/calendar/index.js +4 -4
- package/es/components/schedules/calendar/serve.js +2 -2
- package/es/components/schedules/components/CurrentDay/index.js +5 -5
- package/es/components/schedules/components/CurrentDay/serve.js +2 -2
- package/es/components/schedules/components/DropdownSort/index.js +1 -1
- package/es/components/schedules/components/ResourceList/index.js +1 -1
- package/es/components/schedules/components/Search/index.js +5 -5
- package/es/components/schedules/model.js +5 -5
- package/es/components/schedules/openHours/index.js +1 -1
- package/es/components/schedules/openHours/serve.js +2 -2
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
- package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
- package/es/components/schedules/products/serve.js +2 -2
- package/es/components/schedules/products/utils.js +5 -5
- package/es/components/schedules/resources/detail/detailContent.js +2 -2
- package/es/components/schedules/resources/detail/index.js +10 -10
- package/es/components/schedules/resources/list/index.js +2 -2
- package/es/components/schedules/resources/relationProduct/index.js +1 -1
- package/es/components/schedules/resources/serve.js +2 -2
- package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
- package/es/components/schedules/utils.d.ts +1 -1
- package/es/components/schedules/utils.js +4 -4
- package/es/components/selectModal/index.js +2 -2
- package/es/hooks/useComponents.js +1 -1
- package/es/hooks/usePaymentLogger.d.ts +22 -0
- package/es/hooks/usePaymentLogger.js +78 -0
- package/es/utils/index.d.ts +1 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/pay/toC/PaymentMethods/ApplePay/index.js +42 -3
- package/lib/components/pay/toC/PaymentMethods/BankDeposit/index.js +52 -15
- package/lib/components/pay/toC/PaymentMethods/CashManual/index.js +60 -2
- package/lib/components/pay/toC/PaymentMethods/CustomPayment/index.js +60 -2
- package/lib/components/pay/toC/PaymentMethods/GlobePayAliPayH5/index.js +66 -2
- package/lib/components/pay/toC/PaymentMethods/GlobePayPaypalH5/index.js +61 -0
- package/lib/components/pay/toC/PaymentMethods/GlobePayQrcode/index.js +29 -0
- package/lib/components/pay/toC/PaymentMethods/GlobePayWxH5/index.js +61 -0
- package/lib/components/pay/toC/PaymentMethods/GooglePay/index.js +50 -6
- package/lib/components/pay/toC/PaymentMethods/OfflinePayment/index.js +72 -10
- package/lib/components/pay/toC/PaymentMethods/StripePay/index.js +47 -5
- package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +61 -3
- package/lib/components/pay/toC/PaymentMethods/SuperPayWxPayH5/index.js +63 -3
- package/lib/components/pay/toC/index.js +183 -48
- package/lib/components/schedules/utils.d.ts +1 -1
- package/lib/components/schedules/utils.js +1 -1
- package/lib/hooks/usePaymentLogger.d.ts +22 -0
- package/lib/hooks/usePaymentLogger.js +69 -0
- package/lib/utils/index.d.ts +1 -1
- package/package.json +4 -4
@@ -45,13 +45,14 @@ var import_PaymentMethods = __toESM(require("./PaymentMethods"));
|
|
45
45
|
var import_serve = require("./serve");
|
46
46
|
var import_model = require("./model");
|
47
47
|
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
48
|
+
var import_usePaymentLogger = __toESM(require("../../../hooks/usePaymentLogger"));
|
48
49
|
var import_utils2 = require("../../../utils");
|
49
50
|
var import_payGroup = require("./payGroup");
|
50
51
|
var import_locales = __toESM(require("./locales"));
|
51
52
|
var import_utils3 = require("./utils");
|
52
53
|
var import_index = require("./index.less");
|
53
54
|
var ToCPay = (props, ref) => {
|
54
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
55
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
55
56
|
const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
|
56
57
|
const paymentListRef = (0, import_react.useRef)();
|
57
58
|
const paymentMethodsRef = (0, import_react.useRef)();
|
@@ -61,13 +62,17 @@ var ToCPay = (props, ref) => {
|
|
61
62
|
const [renderType, setRenderType] = (0, import_react.useState)("modal");
|
62
63
|
const walletPassBlockRef = (0, import_react.useRef)(null);
|
63
64
|
const context = (0, import_useEngineContext.default)();
|
65
|
+
const paymentLogger = (0, import_usePaymentLogger.default)({
|
66
|
+
orderId: ((_a = state.payGroup) == null ? void 0 : _a.order_id) || "unknown",
|
67
|
+
step: "1"
|
68
|
+
});
|
64
69
|
const [showInformation, setShowInformation] = (0, import_react.useState)(false);
|
65
70
|
const [showDetectIncognitoConfirm, setShowDetectIncognitoConfirm] = (0, import_react.useState)(false);
|
66
71
|
const utils = context.appHelper.utils || {};
|
67
|
-
const dvaStore = (
|
68
|
-
const customer_id = (_i = (_h = (_g = (_f = (_e =
|
69
|
-
const shopName = (
|
70
|
-
import_utils.locales.init(import_locales.default, ((
|
72
|
+
const dvaStore = (_d = (_c = (_b = context.appHelper.utils) == null ? void 0 : _b.getStore) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.getState();
|
73
|
+
const customer_id = (_j = (_i = (_h = (_g = (_f = (_e = context.appHelper.utils) == null ? void 0 : _e.getStore()) == null ? void 0 : _f.getState) == null ? void 0 : _g.call(_f)) == null ? void 0 : _h.global) == null ? void 0 : _i.userInfo) == null ? void 0 : _j.id;
|
74
|
+
const shopName = (_m = (_l = (_k = dvaStore.core) == null ? void 0 : _k.core) == null ? void 0 : _l.shop) == null ? void 0 : _m.name;
|
75
|
+
import_utils.locales.init(import_locales.default, ((_n = dvaStore.core) == null ? void 0 : _n.translateLocale) || "en");
|
71
76
|
import_utils2.request.setRequest(utils == null ? void 0 : utils.request);
|
72
77
|
const _initStore = (initProps) => {
|
73
78
|
var _a2;
|
@@ -112,18 +117,47 @@ var ToCPay = (props, ref) => {
|
|
112
117
|
});
|
113
118
|
};
|
114
119
|
const init = async (initProps) => {
|
120
|
+
var _a2;
|
115
121
|
const { renderType: renderType2 } = initProps;
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
122
|
+
paymentLogger.addLog({
|
123
|
+
key: "初始化开始",
|
124
|
+
value: ``
|
125
|
+
});
|
126
|
+
try {
|
127
|
+
setRenderType(renderType2 ?? "modal");
|
128
|
+
setOpen(true);
|
129
|
+
setSubmitLoading(false);
|
130
|
+
setLoading(true);
|
131
|
+
_initStore(initProps);
|
132
|
+
(0, import_payGroup.removePayGroupFromStorage)(initProps.order.order_id);
|
133
|
+
await _getPaymentsAndWalletPass(initProps.order);
|
134
|
+
await getWalletSetting(initProps);
|
135
|
+
paymentLogger.addLog({
|
136
|
+
key: "初始化成功",
|
137
|
+
value: ``
|
138
|
+
});
|
139
|
+
} catch (error) {
|
140
|
+
paymentLogger.addLog({
|
141
|
+
key: "初始化错误",
|
142
|
+
value: {
|
143
|
+
title: `订单${(_a2 = initProps == null ? void 0 : initProps.order) == null ? void 0 : _a2.order_id} 初始化失败: ${(error == null ? void 0 : error.message) || "未知错误"}`,
|
144
|
+
data: {
|
145
|
+
order: initProps == null ? void 0 : initProps.order
|
146
|
+
}
|
147
|
+
}
|
148
|
+
});
|
149
|
+
paymentLogger.sendLogs("支付初始化失败", error);
|
150
|
+
throw error;
|
151
|
+
}
|
124
152
|
};
|
125
153
|
const _getPaymentsAndWalletPass = async (order) => {
|
126
154
|
var _a2, _b2;
|
155
|
+
paymentLogger.addLog({
|
156
|
+
key: "获取支付列表开始",
|
157
|
+
value: {
|
158
|
+
title: `订单${order == null ? void 0 : order.order_id} 开始获取支付列表, 金额: ${order == null ? void 0 : order.amount}`
|
159
|
+
}
|
160
|
+
});
|
127
161
|
try {
|
128
162
|
const data = await (0, import_serve.getPaymentsAndWalletPass)({
|
129
163
|
order_id: order.order_id,
|
@@ -137,6 +171,10 @@ var ToCPay = (props, ref) => {
|
|
137
171
|
payment_list,
|
138
172
|
walletPass
|
139
173
|
} = data || {};
|
174
|
+
paymentLogger.addLog({
|
175
|
+
key: "支付数据获取",
|
176
|
+
value: ""
|
177
|
+
});
|
140
178
|
dispatch({
|
141
179
|
type: "setPayGroup",
|
142
180
|
payload: {
|
@@ -161,8 +199,22 @@ var ToCPay = (props, ref) => {
|
|
161
199
|
setTimeout(() => {
|
162
200
|
setLoading(false);
|
163
201
|
}, 100);
|
202
|
+
paymentLogger.addLog({
|
203
|
+
key: "获取支付列表成功",
|
204
|
+
value: ""
|
205
|
+
});
|
164
206
|
} catch (err) {
|
165
207
|
console.log("err", err);
|
208
|
+
paymentLogger.addLog({
|
209
|
+
key: "获取支付列表错误",
|
210
|
+
value: {
|
211
|
+
title: `订单${order == null ? void 0 : order.order_id} 获取失败: ${(err == null ? void 0 : err.message) || "未知错误"}`,
|
212
|
+
data: {
|
213
|
+
order
|
214
|
+
}
|
215
|
+
}
|
216
|
+
});
|
217
|
+
paymentLogger.sendLogs("获取支付列表失败", err);
|
166
218
|
payCallback({
|
167
219
|
key: "fail",
|
168
220
|
data: {
|
@@ -175,16 +227,47 @@ var ToCPay = (props, ref) => {
|
|
175
227
|
};
|
176
228
|
const handlePaymentByType = async (type, payGroup) => {
|
177
229
|
var _a2, _b2, _c2;
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
230
|
+
const paymentType = type || ((_b2 = (_a2 = state.payGroup) == null ? void 0 : _a2.otherPayment) == null ? void 0 : _b2.service);
|
231
|
+
const currentPayGroup = payGroup || state.payGroup;
|
232
|
+
paymentLogger.addLog({
|
233
|
+
key: "开始支付处理",
|
234
|
+
value: ""
|
235
|
+
});
|
236
|
+
try {
|
237
|
+
setSubmitLoading(true);
|
238
|
+
await ((_c2 = paymentMethodsRef.current) == null ? void 0 : _c2.onPay({
|
239
|
+
type: paymentType,
|
240
|
+
payGroup: currentPayGroup
|
241
|
+
}));
|
242
|
+
paymentLogger.addLog({
|
243
|
+
key: "支付方法调用成功",
|
244
|
+
value: ""
|
245
|
+
});
|
246
|
+
paymentLogger.sendLogs("支付方法调用成功");
|
247
|
+
setSubmitLoading(false);
|
248
|
+
} catch (error) {
|
249
|
+
paymentLogger.addLog({
|
250
|
+
key: "支付处理错误",
|
251
|
+
value: {
|
252
|
+
title: `订单${currentPayGroup == null ? void 0 : currentPayGroup.order_id} ${paymentType}支付失败: ${(error == null ? void 0 : error.message) || "未知错误"}`,
|
253
|
+
data: {
|
254
|
+
type: paymentType,
|
255
|
+
payGroup: currentPayGroup
|
256
|
+
}
|
257
|
+
}
|
258
|
+
});
|
259
|
+
paymentLogger.sendLogs("支付处理失败", error);
|
260
|
+
setSubmitLoading(false);
|
261
|
+
throw error;
|
262
|
+
}
|
184
263
|
};
|
185
264
|
const paymentInit = async (newOrderId) => {
|
186
265
|
var _a2, _b2;
|
187
266
|
const orderId = newOrderId || ((_a2 = state.payGroup) == null ? void 0 : _a2.order_id);
|
267
|
+
paymentLogger.addLog({
|
268
|
+
key: "开始创建交易组",
|
269
|
+
value: ""
|
270
|
+
});
|
188
271
|
setSubmitLoading(true);
|
189
272
|
try {
|
190
273
|
const data = await (0, import_serve.getPaymentInit)({
|
@@ -200,6 +283,10 @@ var ToCPay = (props, ref) => {
|
|
200
283
|
payment_priority: data.payment_priority
|
201
284
|
}
|
202
285
|
});
|
286
|
+
paymentLogger.addLog({
|
287
|
+
key: "创建交易组成功",
|
288
|
+
value: ""
|
289
|
+
});
|
203
290
|
return {
|
204
291
|
...state.payGroup,
|
205
292
|
order_id: orderId,
|
@@ -208,14 +295,16 @@ var ToCPay = (props, ref) => {
|
|
208
295
|
payment_priority: data.payment_priority
|
209
296
|
};
|
210
297
|
} catch (err) {
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
298
|
+
paymentLogger.addLog({
|
299
|
+
key: "创建交易组错误",
|
300
|
+
value: {
|
301
|
+
title: `订单${orderId} 创建交易组失败: ${(err == null ? void 0 : err.message) || "未知错误"}`,
|
302
|
+
data: {
|
303
|
+
order: orderId
|
304
|
+
}
|
305
|
+
}
|
218
306
|
});
|
307
|
+
paymentLogger.sendLogs("创建交易组失败", err);
|
219
308
|
setSubmitLoading(false);
|
220
309
|
payCallback({
|
221
310
|
key: "fail",
|
@@ -230,7 +319,7 @@ var ToCPay = (props, ref) => {
|
|
230
319
|
const waitAmount = (0, import_react.useMemo)(() => {
|
231
320
|
var _a2;
|
232
321
|
return ((_a2 = state.payGroup) == null ? void 0 : _a2.wait_amount) || 0;
|
233
|
-
}, [(
|
322
|
+
}, [(_o = state.payGroup) == null ? void 0 : _o.wait_amount]);
|
234
323
|
const isWalletPassPay = (0, import_react.useMemo)(() => {
|
235
324
|
var _a2, _b2, _c2;
|
236
325
|
const isWalletPass = (_c2 = (_b2 = (_a2 = state.payGroup) == null ? void 0 : _a2.walletPass) == null ? void 0 : _b2.cards) == null ? void 0 : _c2.length;
|
@@ -250,28 +339,50 @@ var ToCPay = (props, ref) => {
|
|
250
339
|
return ((payGroup == null ? void 0 : payGroup.wait_amount) || 0) > 0 && (0, import_utils3.getIsWalletPassAndTripartitePayment)(payGroup) && isPrivate;
|
251
340
|
};
|
252
341
|
const onSubmit = async (newOrderId) => {
|
253
|
-
var _a2;
|
342
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
343
|
+
paymentLogger.addLog({
|
344
|
+
key: "开始提交支付",
|
345
|
+
value: `订单${newOrderId || ((_a2 = state.payGroup) == null ? void 0 : _a2.order_id)} 开始提交, 待支付: ${(_b2 = state.payGroup) == null ? void 0 : _b2.wait_amount}, 总金额: ${(_c2 = state.payGroup) == null ? void 0 : _c2.total_amount}`
|
346
|
+
});
|
347
|
+
let newPayGroup = state.payGroup;
|
254
348
|
try {
|
255
|
-
let newPayGroup = state.payGroup;
|
256
349
|
const result = await getIsShowDetectIncognitoConfirm(newPayGroup);
|
257
350
|
if (result) {
|
351
|
+
paymentLogger.addLog({
|
352
|
+
key: "无痕模式检测",
|
353
|
+
value: ""
|
354
|
+
});
|
258
355
|
setShowDetectIncognitoConfirm(true);
|
259
356
|
return;
|
260
357
|
}
|
261
|
-
if (!((
|
358
|
+
if (!((_d2 = state.payGroup) == null ? void 0 : _d2.payment_group_id)) {
|
359
|
+
paymentLogger.addLog({
|
360
|
+
key: "需要创建交易组",
|
361
|
+
value: ""
|
362
|
+
});
|
262
363
|
newPayGroup = await paymentInit(newOrderId);
|
263
364
|
}
|
365
|
+
paymentLogger.addLog({
|
366
|
+
key: "调用支付方法",
|
367
|
+
value: `订单${newPayGroup == null ? void 0 : newPayGroup.order_id} 交易组${newPayGroup == null ? void 0 : newPayGroup.payment_group_id} 使用${(_f2 = (_e2 = state.payGroup) == null ? void 0 : _e2.otherPayment) == null ? void 0 : _f2.service}支付`
|
368
|
+
});
|
264
369
|
handlePaymentByType(void 0, newPayGroup);
|
370
|
+
paymentLogger.addLog({
|
371
|
+
key: "支付提交调用成功",
|
372
|
+
value: ""
|
373
|
+
});
|
265
374
|
} catch (err) {
|
266
375
|
console.log("err", err);
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
{
|
271
|
-
|
272
|
-
|
273
|
-
|
376
|
+
paymentLogger.addLog({
|
377
|
+
key: "提交支付错误",
|
378
|
+
value: {
|
379
|
+
title: `订单${newOrderId || ((_g2 = state.payGroup) == null ? void 0 : _g2.order_id)} 提交失败: ${(err == null ? void 0 : err.message) || "未知错误"}`,
|
380
|
+
data: {
|
381
|
+
newPayGroup
|
382
|
+
}
|
383
|
+
}
|
274
384
|
});
|
385
|
+
paymentLogger.sendLogs("提交支付失败", err);
|
275
386
|
}
|
276
387
|
};
|
277
388
|
const paymentTypeChange = (payload) => {
|
@@ -295,21 +406,45 @@ var ToCPay = (props, ref) => {
|
|
295
406
|
}
|
296
407
|
}, [state.payGroup]);
|
297
408
|
const payCallback = async (res) => {
|
298
|
-
var _a2;
|
299
|
-
|
409
|
+
var _a2, _b2, _c2, _d2;
|
410
|
+
const orderId = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.order_id) || ((_b2 = state.payGroup) == null ? void 0 : _b2.order_id);
|
411
|
+
if (res.key === "success") {
|
412
|
+
paymentLogger.addLog({
|
413
|
+
key: "支付最终成功",
|
414
|
+
value: `订单${orderId} 支付成功`
|
415
|
+
});
|
416
|
+
paymentLogger.sendLogs("支付成功");
|
417
|
+
} else if (res.key === "fail") {
|
418
|
+
paymentLogger.addLog({
|
419
|
+
key: "支付最终失败",
|
420
|
+
value: {
|
421
|
+
title: `订单${orderId} 支付失败`,
|
422
|
+
data: res == null ? void 0 : res.data
|
423
|
+
}
|
424
|
+
});
|
425
|
+
paymentLogger.sendLogs("支付失败", (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.err);
|
426
|
+
} else if (res.key === "cancel") {
|
427
|
+
paymentLogger.addLog({
|
428
|
+
key: "支付被取消",
|
429
|
+
value: `订单${orderId} 支付被取消`
|
430
|
+
});
|
300
431
|
setOpen(false);
|
301
432
|
}
|
302
|
-
(
|
433
|
+
(_d2 = props.callback) == null ? void 0 : _d2.call(props, res);
|
303
434
|
};
|
304
435
|
const onCancel = () => {
|
305
|
-
var _a2, _b2;
|
306
|
-
|
436
|
+
var _a2, _b2, _c2;
|
437
|
+
paymentLogger.addLog({
|
438
|
+
key: "用户主动取消支付",
|
439
|
+
value: `订单${(_a2 = state.payGroup) == null ? void 0 : _a2.order_id} 用户取消支付`
|
440
|
+
});
|
441
|
+
(0, import_payGroup.removePayGroupFromStorage)((_b2 = state.payGroup) == null ? void 0 : _b2.order_id);
|
307
442
|
setShowInformation(false);
|
308
443
|
setOpen(false);
|
309
444
|
payCallback({
|
310
445
|
key: "cancel",
|
311
446
|
data: {
|
312
|
-
order_id: (
|
447
|
+
order_id: (_c2 = state.payGroup) == null ? void 0 : _c2.order_id
|
313
448
|
}
|
314
449
|
});
|
315
450
|
};
|
@@ -318,7 +453,7 @@ var ToCPay = (props, ref) => {
|
|
318
453
|
(_b2 = paymentListRef.current) == null ? void 0 : _b2.calculateSurcharge(
|
319
454
|
((_a2 = state.payGroup) == null ? void 0 : _a2.wait_amount) || 0
|
320
455
|
);
|
321
|
-
}, [(
|
456
|
+
}, [(_p = state.payGroup) == null ? void 0 : _p.wait_amount]);
|
322
457
|
(0, import_react.useImperativeHandle)(ref, () => {
|
323
458
|
return {
|
324
459
|
init,
|
@@ -432,9 +567,9 @@ var ToCPay = (props, ref) => {
|
|
432
567
|
loading,
|
433
568
|
mask: true
|
434
569
|
},
|
435
|
-
((
|
436
|
-
/* @__PURE__ */ import_react.default.createElement(import_PayAmount.default, { amount: ((
|
437
|
-
((
|
570
|
+
((_q = state.order) == null ? void 0 : _q.countdown) && /* @__PURE__ */ import_react.default.createElement(import_PayCountdown.default, { time: (_r = state.order) == null ? void 0 : _r.countdown }),
|
571
|
+
/* @__PURE__ */ import_react.default.createElement(import_PayAmount.default, { amount: ((_s = state.payGroup) == null ? void 0 : _s.total_amount) || 0 }),
|
572
|
+
((_t = state.payGroup) == null ? void 0 : _t.walletPass) && /* @__PURE__ */ import_react.default.createElement(
|
438
573
|
import_WalletPassBlock.default,
|
439
574
|
{
|
440
575
|
customer_id,
|
@@ -452,7 +587,7 @@ var ToCPay = (props, ref) => {
|
|
452
587
|
handlePaymentByType(detail == null ? void 0 : detail.service);
|
453
588
|
},
|
454
589
|
paymentTypeChange,
|
455
|
-
hide: ((
|
590
|
+
hide: ((_u = state.payGroup) == null ? void 0 : _u.wait_amount) == 0,
|
456
591
|
renderTitle: renderPaymentListTitle
|
457
592
|
}
|
458
593
|
)
|
@@ -17,6 +17,6 @@ declare let modal: Omit<ModalStaticFunctions, "warn">;
|
|
17
17
|
export declare const setModal: (m: Omit<ModalStaticFunctions, "warn">) => void;
|
18
18
|
export declare const saveConfirm: () => Promise<{
|
19
19
|
destroy: () => void;
|
20
|
-
update: (configUpdate: import("antd
|
20
|
+
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
21
21
|
}>;
|
22
22
|
export { modal };
|
@@ -0,0 +1,22 @@
|
|
1
|
+
interface LogData {
|
2
|
+
key: string;
|
3
|
+
value: any;
|
4
|
+
}
|
5
|
+
interface UsePaymentLoggerOptions {
|
6
|
+
orderId: string;
|
7
|
+
step?: string;
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* @title: 支付日志记录器 Hook
|
11
|
+
* @description: 用于记录支付过程中的关键信息
|
12
|
+
* @param {UsePaymentLoggerOptions} options - 配置选项
|
13
|
+
* @return {object} 返回日志记录相关方法
|
14
|
+
* @Author: AI Assistant
|
15
|
+
*/
|
16
|
+
declare const usePaymentLogger: (options: UsePaymentLoggerOptions) => {
|
17
|
+
logs: import("react").MutableRefObject<LogData[]>;
|
18
|
+
addLog: (logData: LogData) => void;
|
19
|
+
sendLogs: (title?: string, err?: any) => void;
|
20
|
+
};
|
21
|
+
export default usePaymentLogger;
|
22
|
+
export type { LogData, UsePaymentLoggerOptions };
|
@@ -0,0 +1,69 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
|
19
|
+
// src/hooks/usePaymentLogger.ts
|
20
|
+
var usePaymentLogger_exports = {};
|
21
|
+
__export(usePaymentLogger_exports, {
|
22
|
+
default: () => usePaymentLogger_default
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(usePaymentLogger_exports);
|
25
|
+
var import_react = require("react");
|
26
|
+
var import_utils = require("@pisell/utils");
|
27
|
+
var import_ahooks = require("ahooks");
|
28
|
+
var usePaymentLogger = (options) => {
|
29
|
+
const { orderId, step = "unknown" } = options;
|
30
|
+
const logs = (0, import_react.useRef)([]);
|
31
|
+
const addLog = (0, import_ahooks.useMemoizedFn)((logData) => {
|
32
|
+
logs.current.push({
|
33
|
+
key: logData.key,
|
34
|
+
value: logData.value
|
35
|
+
});
|
36
|
+
});
|
37
|
+
const sendLogs = (0, import_ahooks.useMemoizedFn)((title = "支付日志", err) => {
|
38
|
+
const content = [
|
39
|
+
{
|
40
|
+
key: "title",
|
41
|
+
value: title
|
42
|
+
},
|
43
|
+
...logs.current
|
44
|
+
];
|
45
|
+
if (err) {
|
46
|
+
content.push(
|
47
|
+
...[
|
48
|
+
{ key: "错误信息", value: (err == null ? void 0 : err.message) || "未知错误" },
|
49
|
+
{ key: "错误堆栈", value: (err == null ? void 0 : err.stack) || "无堆栈信息" },
|
50
|
+
{ key: "错误类型", value: (err == null ? void 0 : err.name) || "未知错误类型" }
|
51
|
+
]
|
52
|
+
);
|
53
|
+
}
|
54
|
+
const formatLogs = content.map((item) => ({
|
55
|
+
key: item.key,
|
56
|
+
value: JSON.stringify(item.value)
|
57
|
+
}));
|
58
|
+
(0, import_utils.sendWarningLog)({
|
59
|
+
title: `h5支付step${step}:${orderId}`,
|
60
|
+
content: formatLogs
|
61
|
+
});
|
62
|
+
});
|
63
|
+
return {
|
64
|
+
logs,
|
65
|
+
addLog,
|
66
|
+
sendLogs
|
67
|
+
};
|
68
|
+
};
|
69
|
+
var usePaymentLogger_default = usePaymentLogger;
|
package/lib/utils/index.d.ts
CHANGED
@@ -18,6 +18,6 @@ declare let modal: Omit<ModalStaticFunctions, 'warn'>;
|
|
18
18
|
export declare const setModal: (m: Omit<ModalStaticFunctions, 'warn'>) => void;
|
19
19
|
export declare const saveConfirm: () => Promise<{
|
20
20
|
destroy: () => void;
|
21
|
-
update: (configUpdate: import("antd
|
21
|
+
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
22
22
|
}>;
|
23
23
|
export { modal };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pisell/private-materials",
|
3
|
-
"version": "6.3.
|
3
|
+
"version": "6.3.15",
|
4
4
|
"main": "./lib/index.js",
|
5
5
|
"module": "./es/index.js",
|
6
6
|
"types": "./lib/index.d.ts",
|
@@ -59,10 +59,10 @@
|
|
59
59
|
"react-infinite-scroll-component": "^6.1.0",
|
60
60
|
"rc-virtual-list": "^3.11.3",
|
61
61
|
"decimal.js": "^10.4.3",
|
62
|
-
"@pisell/utils": "3.0.1",
|
63
62
|
"@pisell/materials": "6.3.4",
|
64
|
-
"@pisell/
|
65
|
-
"@pisell/
|
63
|
+
"@pisell/icon": "0.0.11",
|
64
|
+
"@pisell/utils": "3.0.1",
|
65
|
+
"@pisell/date-picker": "3.0.4"
|
66
66
|
},
|
67
67
|
"peerDependencies": {
|
68
68
|
"react": "^18.0.0",
|