@pisell/private-materials 6.6.62 → 6.6.63

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.
Files changed (203) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/amount.js +4 -3
  12. package/es/components/booking/components/footer/utils.js +10 -3
  13. package/es/components/booking/components/voucher/index.js +1 -1
  14. package/es/components/booking/info2/service/editService/index.js +76 -8
  15. package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
  16. package/es/components/booking/info2/service/editService/utils.js +16 -0
  17. package/es/components/booking/payments/index.js +1 -1
  18. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  19. package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
  20. package/es/components/eftpos/PairModal/hooks.js +67 -0
  21. package/es/components/eftpos/PairModal/index.d.ts +11 -0
  22. package/es/components/eftpos/PairModal/index.js +246 -0
  23. package/es/components/eftpos/PairModal/index.less +70 -0
  24. package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
  25. package/es/components/eftpos/SettlementModal/Action.js +141 -0
  26. package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
  27. package/es/components/eftpos/SettlementModal/index.js +135 -0
  28. package/es/components/eftpos/SettlementModal/index.less +33 -0
  29. package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
  30. package/es/components/eftpos/SettlementModal/serve.js +171 -0
  31. package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
  32. package/es/components/eftpos/SettlementModal/types.js +35 -0
  33. package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
  34. package/es/components/eftpos/SettlementModal/utils.js +351 -0
  35. package/es/components/eftpos/assets/mx51SCI.svg +15 -0
  36. package/es/components/eftpos/const.d.ts +3 -1
  37. package/es/components/eftpos/const.js +2 -0
  38. package/es/components/eftpos/device.d.ts +3 -1
  39. package/es/components/eftpos/device.js +14 -3
  40. package/es/components/eftpos/hooks.d.ts +13 -0
  41. package/es/components/eftpos/hooks.js +35 -0
  42. package/es/components/eftpos/index.js +198 -24
  43. package/es/components/eftpos/index.less +32 -1
  44. package/es/components/eftpos/locales.d.ts +80 -0
  45. package/es/components/eftpos/locales.js +205 -25
  46. package/es/components/eftpos/table.js +47 -3
  47. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  48. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  49. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
  50. package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  51. package/es/components/eftposPay/aggregatePayment/index.js +2 -1
  52. package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  53. package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
  54. package/es/components/eftposPay/aggregatePayment/service.js +1 -0
  55. package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  56. package/es/components/eftposPay/aggregatePayment/types.js +4 -8
  57. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  58. package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
  59. package/es/components/eftposPay/amount.js +15 -1
  60. package/es/components/eftposPay/app.js +2 -3
  61. package/es/components/eftposPay/component/fail/failCustom.js +13 -4
  62. package/es/components/eftposPay/component/fail/index.js +12 -5
  63. package/es/components/eftposPay/component/fail/network.js +3 -0
  64. package/es/components/eftposPay/component/fail/unknow.js +8 -0
  65. package/es/components/eftposPay/component/manual/index.js +17 -3
  66. package/es/components/eftposPay/component/signature/index.js +3 -0
  67. package/es/components/eftposPay/const.d.ts +8 -3
  68. package/es/components/eftposPay/const.js +2 -0
  69. package/es/components/eftposPay/device.js +225 -38
  70. package/es/components/eftposPay/helper.d.ts +3 -0
  71. package/es/components/eftposPay/helper.js +2 -1
  72. package/es/components/eftposPay/hooks.d.ts +1 -1
  73. package/es/components/eftposPay/index.js +50 -13
  74. package/es/components/eftposPay/linkly/const.js +1 -1
  75. package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
  76. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
  77. package/es/components/eftposPay/linkly/index.js +11 -23
  78. package/es/components/eftposPay/locales.d.ts +15 -0
  79. package/es/components/eftposPay/locales.js +30 -15
  80. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  81. package/es/components/eftposPay/manufacturer.js +4 -0
  82. package/es/components/eftposPay/mx51/Action.d.ts +6 -0
  83. package/es/components/eftposPay/mx51/Action.js +144 -0
  84. package/es/components/eftposPay/mx51/const.d.ts +5 -0
  85. package/es/components/eftposPay/mx51/const.js +69 -0
  86. package/es/components/eftposPay/mx51/index.d.ts +6 -0
  87. package/es/components/eftposPay/mx51/index.js +498 -0
  88. package/es/components/eftposPay/mx51/types.d.ts +142 -0
  89. package/es/components/eftposPay/mx51/types.js +35 -0
  90. package/es/components/eftposPay/mx51/utils.d.ts +10 -0
  91. package/es/components/eftposPay/mx51/utils.js +121 -0
  92. package/es/components/eftposPay/pay.js +21 -9
  93. package/es/components/eftposPay/payo/config.js +39 -5
  94. package/es/components/eftposPay/payo/const.js +1 -1
  95. package/es/components/eftposPay/payo/hooks.js +3 -12
  96. package/es/components/eftposPay/payo/payment.js +69 -136
  97. package/es/components/eftposPay/store/index.d.ts +4 -8
  98. package/es/components/eftposPay/tip.js +5 -0
  99. package/es/components/eftposPay/tyro/const.js +1 -1
  100. package/es/components/eftposPay/tyro/index.js +44 -11
  101. package/es/components/eftposPay/utils/payLog.d.ts +81 -0
  102. package/es/components/eftposPay/utils/payLog.js +458 -0
  103. package/es/components/eftposPay/windcave/const.js +1 -1
  104. package/es/components/eftposPay/windcave/receiptAction.js +5 -0
  105. package/es/components/eftposPay/windcave/windcave.js +37 -38
  106. package/lib/components/booking/components/footer/amount.js +3 -3
  107. package/lib/components/booking/components/footer/utils.js +12 -5
  108. package/lib/components/booking/components/voucher/index.js +1 -1
  109. package/lib/components/booking/info2/service/editService/index.js +56 -5
  110. package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
  111. package/lib/components/booking/info2/service/editService/utils.js +16 -0
  112. package/lib/components/booking/payments/index.js +1 -1
  113. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  114. package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
  115. package/lib/components/eftpos/PairModal/hooks.js +70 -0
  116. package/lib/components/eftpos/PairModal/index.d.ts +11 -0
  117. package/lib/components/eftpos/PairModal/index.js +197 -0
  118. package/lib/components/eftpos/PairModal/index.less +70 -0
  119. package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
  120. package/lib/components/eftpos/SettlementModal/Action.js +153 -0
  121. package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
  122. package/lib/components/eftpos/SettlementModal/index.js +170 -0
  123. package/lib/components/eftpos/SettlementModal/index.less +33 -0
  124. package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
  125. package/lib/components/eftpos/SettlementModal/serve.js +45 -0
  126. package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
  127. package/lib/components/eftpos/SettlementModal/types.js +43 -0
  128. package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
  129. package/lib/components/eftpos/SettlementModal/utils.js +248 -0
  130. package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
  131. package/lib/components/eftpos/const.d.ts +3 -1
  132. package/lib/components/eftpos/const.js +2 -0
  133. package/lib/components/eftpos/device.d.ts +3 -1
  134. package/lib/components/eftpos/device.js +13 -3
  135. package/lib/components/eftpos/hooks.d.ts +13 -0
  136. package/lib/components/eftpos/hooks.js +30 -0
  137. package/lib/components/eftpos/index.js +121 -8
  138. package/lib/components/eftpos/index.less +32 -1
  139. package/lib/components/eftpos/locales.d.ts +80 -0
  140. package/lib/components/eftpos/locales.js +231 -21
  141. package/lib/components/eftpos/table.js +30 -2
  142. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  143. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  144. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
  145. package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  146. package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
  147. package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  148. package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
  149. package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  150. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  151. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
  152. package/lib/components/eftposPay/amount.js +13 -1
  153. package/lib/components/eftposPay/app.js +4 -5
  154. package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
  155. package/lib/components/eftposPay/component/fail/index.js +10 -2
  156. package/lib/components/eftposPay/component/fail/network.js +3 -0
  157. package/lib/components/eftposPay/component/fail/unknow.js +8 -0
  158. package/lib/components/eftposPay/component/manual/index.js +16 -2
  159. package/lib/components/eftposPay/component/signature/index.js +3 -0
  160. package/lib/components/eftposPay/const.d.ts +8 -3
  161. package/lib/components/eftposPay/const.js +2 -0
  162. package/lib/components/eftposPay/device.js +114 -25
  163. package/lib/components/eftposPay/helper.d.ts +3 -0
  164. package/lib/components/eftposPay/helper.js +2 -1
  165. package/lib/components/eftposPay/hooks.d.ts +1 -1
  166. package/lib/components/eftposPay/index.js +38 -13
  167. package/lib/components/eftposPay/linkly/const.js +1 -1
  168. package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
  169. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
  170. package/lib/components/eftposPay/linkly/index.js +8 -10
  171. package/lib/components/eftposPay/locales.d.ts +15 -0
  172. package/lib/components/eftposPay/locales.js +30 -15
  173. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  174. package/lib/components/eftposPay/manufacturer.js +6 -0
  175. package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
  176. package/lib/components/eftposPay/mx51/Action.js +154 -0
  177. package/lib/components/eftposPay/mx51/const.d.ts +5 -0
  178. package/lib/components/eftposPay/mx51/const.js +85 -0
  179. package/lib/components/eftposPay/mx51/index.d.ts +6 -0
  180. package/lib/components/eftposPay/mx51/index.js +433 -0
  181. package/lib/components/eftposPay/mx51/types.d.ts +142 -0
  182. package/lib/components/eftposPay/mx51/types.js +43 -0
  183. package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
  184. package/lib/components/eftposPay/mx51/utils.js +115 -0
  185. package/lib/components/eftposPay/pay.js +13 -3
  186. package/lib/components/eftposPay/payo/config.js +16 -8
  187. package/lib/components/eftposPay/payo/const.js +1 -1
  188. package/lib/components/eftposPay/payo/hooks.js +12 -10
  189. package/lib/components/eftposPay/payo/payment.js +31 -65
  190. package/lib/components/eftposPay/store/index.d.ts +4 -8
  191. package/lib/components/eftposPay/tip.js +5 -0
  192. package/lib/components/eftposPay/tyro/const.js +1 -1
  193. package/lib/components/eftposPay/tyro/index.js +21 -17
  194. package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
  195. package/lib/components/eftposPay/utils/payLog.js +321 -0
  196. package/lib/components/eftposPay/windcave/const.js +1 -1
  197. package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
  198. package/lib/components/eftposPay/windcave/windcave.js +27 -29
  199. package/package.json +2 -2
  200. package/es/components/eftposPay/utils/log/index.d.ts +0 -110
  201. package/es/components/eftposPay/utils/log/index.js +0 -371
  202. package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
  203. package/lib/components/eftposPay/utils/log/index.js +0 -294
@@ -0,0 +1,115 @@
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/components/eftposPay/mx51/utils.ts
20
+ var utils_exports = {};
21
+ __export(utils_exports, {
22
+ parseMX51Params: () => parseMX51Params
23
+ });
24
+ module.exports = __toCommonJS(utils_exports);
25
+ var import_types = require("./types");
26
+ var parseMX51Params = (params, paymentStatus, data) => {
27
+ if (!params) {
28
+ return null;
29
+ }
30
+ const result = {
31
+ transactionId: (params == null ? void 0 : params.id) || "",
32
+ status: (params == null ? void 0 : params.status) || "",
33
+ version: (params == null ? void 0 : params.version) || 0,
34
+ message: (params == null ? void 0 : params.message) || "",
35
+ merchantReceipt: params == null ? void 0 : params.merchant_receipt,
36
+ customerReceipt: params == null ? void 0 : params.customer_receipt,
37
+ resultAmounts: params == null ? void 0 : params.result_amounts,
38
+ resultFinancialStatus: params == null ? void 0 : params.result_financial_status,
39
+ layouts: [],
40
+ details: {},
41
+ detailsText: "",
42
+ autoAction: []
43
+ };
44
+ if (!(params == null ? void 0 : params.pos_instructions)) {
45
+ return result;
46
+ }
47
+ const posInstructions = (params == null ? void 0 : params.pos_instructions) || {};
48
+ result.autoAction = (posInstructions == null ? void 0 : posInstructions.auto_actions) || [];
49
+ if (!(posInstructions == null ? void 0 : posInstructions.action_form)) {
50
+ return result;
51
+ }
52
+ const actionForm = (posInstructions == null ? void 0 : posInstructions.action_form) || {};
53
+ if (actionForm == null ? void 0 : actionForm.details) {
54
+ result.details = { ...(actionForm == null ? void 0 : actionForm.details) || {} };
55
+ const detailsTextArr = [];
56
+ Object.keys((actionForm == null ? void 0 : actionForm.details) || {}).forEach((key) => {
57
+ var _a;
58
+ detailsTextArr.push(`${key}: ${((_a = actionForm == null ? void 0 : actionForm.details) == null ? void 0 : _a[key]) || ""}`);
59
+ });
60
+ result.detailsText = (detailsTextArr == null ? void 0 : detailsTextArr.join(", ")) || "";
61
+ }
62
+ if ((actionForm == null ? void 0 : actionForm.layout) && Array.isArray(actionForm == null ? void 0 : actionForm.layout)) {
63
+ const layouts = [];
64
+ actionForm.layout.forEach((layout) => {
65
+ const elements = [];
66
+ if ((layout == null ? void 0 : layout.elements) && Array.isArray(layout == null ? void 0 : layout.elements)) {
67
+ layout.elements.forEach((element) => {
68
+ var _a;
69
+ const elementKey = (element == null ? void 0 : element.key) || "";
70
+ const elementLabel = (element == null ? void 0 : element.label) || "";
71
+ const property = ((_a = actionForm == null ? void 0 : actionForm.properties) == null ? void 0 : _a[elementKey]) || {};
72
+ if (property) {
73
+ const element2 = {
74
+ _extra: {
75
+ merchantReceipt: params == null ? void 0 : params.merchant_receipt,
76
+ customerReceipt: params == null ? void 0 : params.customer_receipt,
77
+ paymentStatus,
78
+ response: data
79
+ },
80
+ key: elementKey,
81
+ name: (property == null ? void 0 : property.name) || "",
82
+ label: elementLabel,
83
+ submitUrl: (property == null ? void 0 : property.submit_url) || "",
84
+ action: property == null ? void 0 : property.action,
85
+ type: (property == null ? void 0 : property.type) || "button",
86
+ text: property == null ? void 0 : property.text,
87
+ // 如果是打印收据按钮,需要关联对应的小票信息
88
+ receipt: elementKey === import_types.EButtonKeyType.PrintMerchantReceipt ? result == null ? void 0 : result.merchantReceipt : elementKey === import_types.EButtonKeyType.PrintCustomerReceipt ? result == null ? void 0 : result.customerReceipt : null
89
+ };
90
+ if ((property == null ? void 0 : property.type) === "image") {
91
+ element2.image = {
92
+ name: (property == null ? void 0 : property.name) || "",
93
+ data: (property == null ? void 0 : property.data) || "",
94
+ encoding: (property == null ? void 0 : property.encoding) || ""
95
+ };
96
+ }
97
+ elements.push(element2);
98
+ }
99
+ });
100
+ }
101
+ if (elements.length > 0) {
102
+ layouts.push({
103
+ layoutType: layout.type || "unknown",
104
+ elements
105
+ });
106
+ }
107
+ });
108
+ result.layouts = layouts;
109
+ }
110
+ return result;
111
+ };
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ parseMX51Params
115
+ });
@@ -46,6 +46,7 @@ var import_const = require("./const");
46
46
  var import_manufacturer = require("./manufacturer");
47
47
  var import_store = require("./store");
48
48
  var import_index = require("./index.less");
49
+ var import_payLog = __toESM(require("./utils/payLog"));
49
50
  var Mapping = {
50
51
  Fail: import_fail.default,
51
52
  Network: import_network.default,
@@ -73,7 +74,10 @@ var Pay = ({
73
74
  const statusRef = (0, import_react.useRef)(data.status);
74
75
  const comonentRef = (0, import_react.useRef)(data.component);
75
76
  const backupRef = (0, import_react.useRef)(data.backup);
76
- const clearRef = (0, import_react.useRef)(0);
77
+ const clearRef = (0, import_react.useRef)(null);
78
+ (0, import_react.useEffect)(() => {
79
+ import_payLog.default.log("支付组件初始化");
80
+ }, []);
77
81
  (0, import_react.useEffect)(() => {
78
82
  comonentRef.current = data.component;
79
83
  }, [data.component]);
@@ -107,6 +111,7 @@ var Pay = ({
107
111
  if (!ref.current) {
108
112
  ref.current = true;
109
113
  if (backupRef.current && net) {
114
+ import_payLog.default.log("网络恢复:从备份恢复", { hasBackup: true });
110
115
  const { ...data2 } = backupRef.current;
111
116
  dispatch((0, import_store.backUpFree)({ key: Date.now() }));
112
117
  dispatch((0, import_store.updateState)({ net }));
@@ -121,6 +126,7 @@ var Pay = ({
121
126
  return;
122
127
  }
123
128
  if (net) {
129
+ import_payLog.default.log("网络恢复", { hasBackup: !!backupRef.current });
124
130
  const { ...data2 } = backupRef.current;
125
131
  dispatch((0, import_store.backUpFree)({ key: Date.now() }));
126
132
  dispatch((0, import_store.updateState)({ net }));
@@ -133,6 +139,7 @@ var Pay = ({
133
139
  }
134
140
  return;
135
141
  }
142
+ import_payLog.default.log("网络断开,备份数据");
136
143
  dispatch((0, import_store.updateState)({ form: "Network" }));
137
144
  dispatch((0, import_store.backUpProduction)({}));
138
145
  dispatch((0, import_store.updateState)({ net, status: "warn" }));
@@ -142,17 +149,19 @@ var Pay = ({
142
149
  return () => {
143
150
  if (clearRef.current) {
144
151
  clearTimeout(clearRef.current);
152
+ clearRef.current = null;
145
153
  }
146
154
  };
147
155
  }, []);
148
156
  console.log("data =>>>>>> ", data);
157
+ const isHideHeader = data.eftpos === "mx51" && data.status === import_const.StatusEnum.Question || data.status === import_const.StatusEnum.Init;
149
158
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data.render ? /* @__PURE__ */ import_react.default.createElement(
150
159
  "div",
151
160
  {
152
161
  className: `pisell-lowcode__eft-pay-box ${className}`,
153
162
  style: data.type === "step" ? {} : { display: "none" }
154
163
  },
155
- data.status !== import_const.StatusEnum.Init && /* @__PURE__ */ import_react.default.createElement(
164
+ isHideHeader ? null : /* @__PURE__ */ import_react.default.createElement(
156
165
  import_header.default,
157
166
  {
158
167
  status: data.status,
@@ -181,7 +190,8 @@ var Pay = ({
181
190
  }
182
191
  ) : null,
183
192
  data.eftpos === "linkly" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Linkly, { key: data.key, api, onChange }) : null,
184
- data.eftpos === "huifu" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Huifu, { key: data.key, onChange, isNativeApp: isMobile }) : null
193
+ data.eftpos === "huifu" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Huifu, { key: data.key, onChange, isNativeApp: isMobile }) : null,
194
+ data.eftpos === "mx51" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Mx51, { key: data.key, onChange }) : null
185
195
  ) : null, data.type === import_const.PayRouteEnum.Unset && Comm ? /* @__PURE__ */ import_react.default.createElement(
186
196
  Comm,
187
197
  {
@@ -43,6 +43,7 @@ var import_hooks = require("../hooks");
43
43
  var import_store = require("../store");
44
44
  var import_hooks2 = require("./hooks");
45
45
  var import_payment = require("./payment");
46
+ var import_payLog = __toESM(require("../utils/payLog"));
46
47
  var POS = ({
47
48
  api,
48
49
  onChange
@@ -65,7 +66,7 @@ var POS = ({
65
66
  const fail = (0, import_hooks.useFail)(0);
66
67
  const failRef = (0, import_react.useRef)(fail);
67
68
  const controllerRef = (0, import_react.useRef)();
68
- const clearRef = (0, import_react.useRef)();
69
+ const clearRef = (0, import_react.useRef)(null);
69
70
  const initRef = (0, import_react.useRef)(false);
70
71
  const unloadRef = (0, import_react.useRef)(false);
71
72
  const [check] = (0, import_hooks2.useValidate)(1e3 * 60);
@@ -187,6 +188,7 @@ var POS = ({
187
188
  card_reader_type: eftposRef.current,
188
189
  card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
189
190
  number: numRef.current,
191
+ original_payment_number: custom == null ? void 0 : custom.original_payment_number,
190
192
  pay_param_base64: encodeURIComponent(
191
193
  btoa(
192
194
  encodeURIComponent(
@@ -198,7 +200,9 @@ var POS = ({
198
200
  )
199
201
  )
200
202
  };
203
+ import_payLog.default.setContext({ transactionNumber: numRef.current });
201
204
  if (isPay) {
205
+ import_payLog.default.log("Payo:发起支付", { isPay, number: numRef.current });
202
206
  paymentRun({
203
207
  paymentType: import_payment.ActionType.Pay,
204
208
  paymentNum: numRef.current,
@@ -207,41 +211,42 @@ var POS = ({
207
211
  params: apiParams,
208
212
  callbacks: {
209
213
  onSuccess: (res) => {
214
+ import_payLog.default.log("Payo:支付成功", { code: res == null ? void 0 : res.code });
210
215
  success(res);
211
216
  },
212
217
  onError: (err) => {
213
- console.log("err = >>>>>", err);
218
+ import_payLog.default.log("Payo:支付失败", { code: err == null ? void 0 : err.code });
214
219
  failRef.current(err, true);
215
220
  }
216
221
  }
217
222
  });
218
223
  return;
219
224
  } else {
225
+ import_payLog.default.log("Payo:发起退款", { isPay, number: numRef.current });
220
226
  const resultPromise = api.refund(apiParams, { signal: controllerRef.current.signal });
221
227
  resultPromise.then((res) => {
222
228
  console.log("netRef.current111 = ", netRef.current);
223
229
  if (unloadRef.current || !netRef.current) {
230
+ import_payLog.default.log("Payo:退款拦截", { isUnload: unloadRef.current, isNet: netRef.current });
224
231
  return;
225
232
  }
226
233
  if (res && `${res.code}` === "200") {
234
+ import_payLog.default.log("Payo:退款成功", { res: JSON.stringify(res) });
227
235
  success(res);
228
236
  return;
229
237
  }
230
238
  return Promise.reject(res);
231
239
  }).catch((err) => {
232
- console.log(
233
- "netRef.current222 = ",
234
- netRef.current,
235
- unloadRef.current,
236
- err
237
- );
238
240
  if (unloadRef.current || !netRef.current) {
241
+ import_payLog.default.log("Payo:退款失败拦截", { isUnload: unloadRef.current, isNet: netRef.current });
239
242
  return;
240
243
  }
241
244
  if (!(err == null ? void 0 : err.code) || `${err.code}` === import_const.PayStatus.Timeout) {
245
+ import_payLog.default.log("Payo:退款超时,转查询");
242
246
  checkApi();
243
247
  return;
244
248
  }
249
+ import_payLog.default.log("Payo:退款失败", { code: err == null ? void 0 : err.code, message: err == null ? void 0 : err.message });
245
250
  failRef.current(err, true);
246
251
  });
247
252
  }
@@ -267,12 +272,14 @@ var Action = ({ onChange }) => {
267
272
  (0, import_react.useEffect)(() => {
268
273
  const timer = setTimeout(() => {
269
274
  setIsShowCancel(true);
275
+ import_payLog.default.log("Payo:30秒后显示取消按钮");
270
276
  }, 30 * 1e3);
271
277
  return () => {
272
278
  clearTimeout(timer);
273
279
  };
274
280
  }, []);
275
281
  const onManually = () => {
282
+ import_payLog.default.log("Payo:点击手动标记");
276
283
  dispatch(
277
284
  (0, import_store.updateState)({
278
285
  manual: {
@@ -284,6 +291,7 @@ var Action = ({ onChange }) => {
284
291
  dispatch((0, import_store.updateComponent)("Manual", true));
285
292
  };
286
293
  const onCancel = () => {
294
+ import_payLog.default.log("Payo:点击取消");
287
295
  onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
288
296
  };
289
297
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client !== import_const.ClientEnum.Merchant && isShowCancel && /* @__PURE__ */ import_react.default.createElement(
@@ -71,7 +71,7 @@ var const_default = (params) => {
71
71
  status: import_const.StatusEnum.Loading,
72
72
  steps: getStep(mode),
73
73
  render: true,
74
- client: client !== "undefined" ? client : import_const.ClientEnum.Merchant,
74
+ client: client !== "undefined" && client !== void 0 ? client : import_const.ClientEnum.Merchant,
75
75
  custom: other || {},
76
76
  ...typeof net !== "undefined" ? { net } : {},
77
77
  ...typeof number !== "undefined" ? { number } : {},
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
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
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/eftposPay/payo/hooks.tsx
@@ -25,7 +35,7 @@ module.exports = __toCommonJS(hooks_exports);
25
35
  var import_react = require("react");
26
36
  var import_const = require("../const");
27
37
  var import_helper = require("../helper");
28
- var import_utils = require("@pisell/utils");
38
+ var import_payLog = __toESM(require("../utils/payLog"));
29
39
  var useValidate = (timeout) => {
30
40
  const controllerRef = (0, import_react.useRef)();
31
41
  const ref = (0, import_react.useRef)(true);
@@ -79,15 +89,7 @@ var useValidate = (timeout) => {
79
89
  TimeoutRef.current && clearTimeout(TimeoutRef.current);
80
90
  TimeoutRef.current = setTimeout(() => {
81
91
  isTimeoutCloseRef.current = true;
82
- (0, import_utils.sendWarningLog)({
83
- title: "支付状态查询超时",
84
- content: [
85
- {
86
- key: "params",
87
- value: JSON.stringify(params)
88
- }
89
- ]
90
- });
92
+ import_payLog.default.log("Payo:支付状态查询超时");
91
93
  close();
92
94
  }, timeout);
93
95
  return checkApi(...params);
@@ -35,7 +35,7 @@ __export(payment_exports, {
35
35
  module.exports = __toCommonJS(payment_exports);
36
36
  var import_react = require("react");
37
37
  var import_const = require("../const");
38
- var import_log = __toESM(require("../utils/log"));
38
+ var import_payLog = __toESM(require("../utils/payLog"));
39
39
  var QUERY_START_DELAY = 1e3 * 10;
40
40
  var GLOBAL_TIMEOUT = 1e3 * 60 * 2;
41
41
  var REQUEST_TIMEOUT = 1e3 * 10;
@@ -107,36 +107,32 @@ var usePayment = (options) => {
107
107
  if (!isFinishedRef.current) {
108
108
  clean();
109
109
  isFinishedRef.current = true;
110
- import_log.default.clearLogs();
111
110
  }
112
111
  };
113
112
  const handleFinalSuccess = (res, type) => {
114
113
  var _a, _b;
115
114
  if (isFinishedRef.current || !shouldContinue()) {
116
- console.log(`⚠️ 已完成或不应继续处理,忽略${type}操作成功结果`);
115
+ import_payLog.default.log(`handleFinalSuccess: 已完成或不应继续处理,忽略${type}操作成功结果`);
117
116
  return;
118
117
  }
118
+ import_payLog.default.log("接口最终结果:支付成功", { type, res });
119
119
  (_b = (_a = callbacksRef.current) == null ? void 0 : _a.onSuccess) == null ? void 0 : _b.call(_a, res);
120
- import_log.default.addLog({ title: "最终结果:支付成功", content: { type, res } });
121
120
  finish();
122
121
  };
123
122
  const handleFinalError = (error, type) => {
124
123
  var _a, _b;
125
124
  if (isFinishedRef.current || !shouldContinue()) {
126
- console.log(`⚠️ 已完成或不应继续处理,忽略${type}操作错误`);
125
+ import_payLog.default.log(`handleFinalError: 已完成或不应继续处理,忽略${type}操作错误`);
127
126
  return;
128
127
  }
128
+ import_payLog.default.log("接口最终结果:支付失败", { type, error });
129
129
  (_b = (_a = callbacksRef.current) == null ? void 0 : _a.onError) == null ? void 0 : _b.call(_a, error);
130
- import_log.default.addLog({
131
- title: "最终结果:支付失败",
132
- content: { type, error }
133
- });
134
130
  finish();
135
131
  };
136
132
  const createTimeoutPromise = (timeoutMs) => {
137
133
  return new Promise((_, reject) => {
138
134
  requestTimeoutTimerRef.current = setTimeout(() => {
139
- console.log(`⏱️ 单次查询超时(${timeoutMs / 1e3}秒),强制终止`);
135
+ import_payLog.default.log(`⏱️ 单次查询超时(${timeoutMs / 1e3}秒),强制终止`);
140
136
  isRequestTimeoutRef.current = true;
141
137
  if (queryControllerRef.current) {
142
138
  queryControllerRef.current.abort();
@@ -147,9 +143,7 @@ var usePayment = (options) => {
147
143
  };
148
144
  const performQuery = async (paymentNum) => {
149
145
  if (isFinishedRef.current || !shouldContinue()) {
150
- import_log.default.addLog({
151
- title: "支付轮询前置校验:支付已完成或不应继续处理,取消查询"
152
- });
146
+ import_payLog.default.log("支付轮询前置校验:已完成或不应继续,取消查询");
153
147
  return;
154
148
  }
155
149
  if (queryControllerRef.current) {
@@ -166,7 +160,7 @@ var usePayment = (options) => {
166
160
  queryControllerRef.current = new AbortController();
167
161
  const { signal } = queryControllerRef.current;
168
162
  try {
169
- import_log.default.addLog({ title: "支付轮询:开始单次查询" });
163
+ import_payLog.default.log("支付轮询:开始单次查询");
170
164
  const res = await Promise.race([
171
165
  checkApi({ number: paymentNum }, { signal }),
172
166
  createTimeoutPromise(REQUEST_TIMEOUT)
@@ -176,29 +170,23 @@ var usePayment = (options) => {
176
170
  requestTimeoutTimerRef.current = null;
177
171
  }
178
172
  if (queryId < currentQueryIdRef.current) {
179
- import_log.default.addLog({ title: "支付轮询结果:过期的查询响应,忽略" });
173
+ import_payLog.default.log("支付轮询结果:过期的查询响应,忽略");
180
174
  return;
181
175
  }
182
176
  if (isFinishedRef.current || !shouldContinue()) {
183
- import_log.default.addLog({ title: "支付轮询结果:支付已完成或不应继续处理" });
177
+ import_payLog.default.log("支付轮询结果:已完成或不应继续处理");
184
178
  return;
185
179
  }
186
180
  if (res && `${res.code}` === "200") {
187
- import_log.default.addLog({ title: "支付轮询结果:支付成功" });
181
+ import_payLog.default.log("支付轮询结果:支付成功");
188
182
  handleFinalSuccess(res, "query" /* Query */);
189
183
  return;
190
184
  }
191
185
  if (isRequestFailed(res == null ? void 0 : res.code)) {
192
- import_log.default.addLog({
193
- title: "支付轮询结果:有明确错误code,停止轮询",
194
- content: res
195
- });
186
+ import_payLog.default.log("支付轮询结果:有明确错误code,停止轮询", { code: res == null ? void 0 : res.code });
196
187
  handleFinalError(res, "query" /* Query */);
197
188
  } else {
198
- import_log.default.addLog({
199
- title: "支付轮询结果:查询返回失败但没有明确code或超时code,继续轮询",
200
- content: res
201
- });
189
+ import_payLog.default.log("支付轮询结果:无明确code,继续轮询", { code: res == null ? void 0 : res.code });
202
190
  scheduleNextQuery(paymentNum);
203
191
  }
204
192
  } catch (error) {
@@ -207,32 +195,22 @@ var usePayment = (options) => {
207
195
  requestTimeoutTimerRef.current = null;
208
196
  }
209
197
  if (queryId < currentQueryIdRef.current) {
210
- import_log.default.addLog({
211
- title: "支付轮询结果:error-过期的查询异常,忽略"
212
- });
198
+ import_payLog.default.log("支付轮询结果:error-过期的查询异常,忽略");
213
199
  return;
214
200
  }
215
201
  if (isFinishedRef.current || !shouldContinue()) {
216
202
  return;
217
203
  }
218
204
  if (isRequestTimeoutRef.current || (error == null ? void 0 : error.name) === "AbortError" || (error == null ? void 0 : error.message) === "REQUEST_TIMEOUT") {
219
- import_log.default.addLog({
220
- title: "支付轮询结果:error-请求被取消或超时,继续轮询"
221
- });
205
+ import_payLog.default.log("支付轮询结果:error-请求被取消或超时,继续轮询");
222
206
  scheduleNextQuery(paymentNum);
223
207
  return;
224
208
  }
225
209
  if (isRequestFailed(error == null ? void 0 : error.code)) {
226
- import_log.default.addLog({
227
- title: "支付轮询结果:error-有明确错误code,停止轮询",
228
- content: error
229
- });
210
+ import_payLog.default.log("支付轮询结果:error-有明确错误code,停止轮询", { code: error == null ? void 0 : error.code });
230
211
  handleFinalError(error, "query" /* Query */);
231
212
  } else {
232
- import_log.default.addLog({
233
- title: "支付轮询结果:error-无明确code或者code不是超时,继续轮询",
234
- content: error
235
- });
213
+ import_payLog.default.log("支付轮询结果:error-无明确code,继续轮询", { code: error == null ? void 0 : error.code });
236
214
  scheduleNextQuery(paymentNum);
237
215
  }
238
216
  }
@@ -245,7 +223,7 @@ var usePayment = (options) => {
245
223
  clearTimeout(queryIntervalTimerRef.current);
246
224
  }
247
225
  queryIntervalTimerRef.current = setTimeout(() => {
248
- import_log.default.addLog({ title: "支付轮询:安排下一次查询" });
226
+ import_payLog.default.log("支付轮询:安排下一次查询");
249
227
  performQuery(paymentNum);
250
228
  }, QUERY_INTERVAL);
251
229
  };
@@ -259,7 +237,7 @@ var usePayment = (options) => {
259
237
  return;
260
238
  }
261
239
  console.log("⏱️ 轮询全局超时(2分钟),终止所有请求");
262
- import_log.default.addLog({ title: "轮询全局超时(2分钟),终止所有请求" });
240
+ import_payLog.default.log("轮询全局超时(2分钟),终止所有请求");
263
241
  handleFinalError(
264
242
  { code: import_const.PayStatus.Timeout, message: "交易超时" },
265
243
  "query" /* Query */
@@ -277,23 +255,17 @@ var usePayment = (options) => {
277
255
  const runId = Date.now();
278
256
  currentRunIdRef.current = runId;
279
257
  const { pay_param_base64, ...otherParams } = params || {};
280
- import_log.default.init(paymentNum, {
281
- orderId: options2 == null ? void 0 : options2.orderId,
282
- deviceId: options2 == null ? void 0 : options2.deviceId,
283
- paymentType: `PAYO_${paymentType}`,
284
- params: otherParams
285
- });
286
258
  isFinishedRef.current = true;
287
259
  clean({ clearCallbacks: false });
288
260
  callbacksRef.current = callbacks;
289
261
  queryStartTimerRef.current = setTimeout(() => {
290
- import_log.default.addLog({ title: "支付后10秒开始轮询" });
262
+ import_payLog.default.log("支付后10秒开始轮询");
291
263
  startQuery(paymentNum);
292
264
  }, QUERY_START_DELAY);
293
265
  payControllerRef.current = new AbortController();
294
266
  const { signal } = payControllerRef.current;
295
267
  try {
296
- import_log.default.addLog({ title: "发起支付请求" });
268
+ import_payLog.default.log("发起支付请求");
297
269
  const resultPromise = paymentType === "pay" /* Pay */ ? payApi : refundApi;
298
270
  if (!resultPromise) {
299
271
  throw new Error(
@@ -302,49 +274,43 @@ var usePayment = (options) => {
302
274
  }
303
275
  const res = await (resultPromise == null ? void 0 : resultPromise(params, { signal }));
304
276
  if (runId < currentRunIdRef.current) {
305
- import_log.default.addLog({ title: "支付响应过期,忽略" });
277
+ import_payLog.default.log("支付响应过期,忽略");
306
278
  return;
307
279
  }
308
280
  if (isFinishedRef.current || !shouldContinue()) {
309
- import_log.default.addLog({ title: "支付返回时已完成或不应继续处理" });
281
+ import_payLog.default.log("支付返回时已完成或不应继续处理");
310
282
  return;
311
283
  }
312
284
  if (res && `${res.code}` === "200") {
313
- import_log.default.addLog({ title: "支付接口成功" });
285
+ import_payLog.default.log("支付接口成功");
314
286
  handleFinalSuccess(res, paymentType);
315
287
  return;
316
288
  }
317
289
  if (isRequestFailed(res == null ? void 0 : res.code)) {
318
- import_log.default.addLog({ title: "支付接口返回失败", content: { res } });
290
+ import_payLog.default.log("支付接口返回失败", { code: res == null ? void 0 : res.code });
319
291
  handleFinalError(res, "pay" /* Pay */);
320
292
  } else {
321
- import_log.default.addLog({
322
- title: "支付超时或无明确错误,等待轮询结果",
323
- content: { res }
324
- });
293
+ import_payLog.default.log("支付超时或无明确错误,等待轮询结果", { code: res == null ? void 0 : res.code });
325
294
  }
326
295
  } catch (error) {
327
296
  if (runId < currentRunIdRef.current) {
328
- import_log.default.addLog({ title: "支付响应过期,忽略" });
297
+ import_payLog.default.log("支付异常响应过期,忽略");
329
298
  return;
330
299
  }
331
300
  if (isFinishedRef.current || !shouldContinue()) {
332
- import_log.default.addLog({ title: "支付异常时已完成或不应继续处理" });
301
+ import_payLog.default.log("支付异常时已完成或不应继续处理");
333
302
  return;
334
303
  }
335
304
  if (isRequestFailed(error == null ? void 0 : error.code)) {
336
- import_log.default.addLog({ title: "支付接口异常", content: { error } });
305
+ import_payLog.default.log("支付接口异常", { code: error == null ? void 0 : error.code });
337
306
  handleFinalError(error, paymentType);
338
307
  } else {
339
- import_log.default.addLog({
340
- title: "支付超时或无明确错误,等待轮询结果",
341
- content: { error }
342
- });
308
+ import_payLog.default.log("支付异常超时或无明确错误,等待轮询结果", { code: error == null ? void 0 : error.code });
343
309
  }
344
310
  }
345
311
  };
346
312
  const stop = () => {
347
- import_log.default.addLog({ title: "手动停止支付流程" });
313
+ import_payLog.default.log("手动停止支付流程");
348
314
  clean();
349
315
  isFinishedRef.current = true;
350
316
  };
@@ -91,10 +91,8 @@ export declare type State = {
91
91
  };
92
92
  backup?: Omit<State, 'backup'>;
93
93
  client: ClientEnum;
94
- /** 原始参数 - 用于 retry 时完整恢复 */
95
- originalParams?: {
96
- [key: string]: unknown;
97
- };
94
+ /** 支付原始参数 */
95
+ originalParams?: Record<string, any>;
98
96
  };
99
97
  export declare type Action = {
100
98
  type: EActionTypes;
@@ -301,7 +299,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
301
299
  amount?: string | number | undefined;
302
300
  mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
303
301
  order_id?: string | number | undefined;
304
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "huifu" | undefined;
302
+ eftpos?: "stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu" | undefined;
305
303
  action?: "pay" | "amount" | "deviceList" | undefined;
306
304
  key?: number | undefined;
307
305
  step?: number | undefined;
@@ -348,9 +346,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
348
346
  } | undefined;
349
347
  backup?: Omit<State, "backup"> | undefined;
350
348
  client?: ClientEnum | undefined;
351
- originalParams?: {
352
- [key: string]: unknown;
353
- } | undefined;
349
+ originalParams?: Record<string, any> | undefined;
354
350
  };
355
351
  };
356
352
  export declare function reducers(state: State, action: Action): State;
@@ -40,6 +40,7 @@ var import_const = require("./const");
40
40
  var import_dayjs = __toESM(require("dayjs"));
41
41
  var import_store = require("./store");
42
42
  var import_hooks = require("./hooks");
43
+ var import_payLog = __toESM(require("./utils/payLog"));
43
44
  var import_tip = require("./tip.less");
44
45
  function formatDateUtils(date, format) {
45
46
  if (!date) {
@@ -83,7 +84,11 @@ var tip_default = ({
83
84
  amountRef,
84
85
  eftposRef
85
86
  } = (0, import_hooks.useStoreRef)();
87
+ (0, import_react.useEffect)(() => {
88
+ import_payLog.default.log("成功确认页展示");
89
+ }, []);
86
90
  const onConfirm = () => {
91
+ import_payLog.default.log("确认支付成功");
87
92
  onChangeStatus("success", { ...ref.current || {} });
88
93
  };
89
94
  (0, import_react.useEffect)(() => {
@@ -57,7 +57,7 @@ var const_default = (params) => {
57
57
  status: import_const.StatusEnum.Loading,
58
58
  steps: [],
59
59
  render: true,
60
- client: client !== "undefined" ? client : import_const.ClientEnum.Merchant,
60
+ client: client !== "undefined" && client !== void 0 ? client : import_const.ClientEnum.Merchant,
61
61
  custom: other || {},
62
62
  ...typeof net !== "undefined" ? { net } : {},
63
63
  ...typeof number !== "undefined" ? { number } : {},