@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,121 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { EButtonKeyType } from "./types";
8
+
9
+ /**
10
+ * 解析MX51参数
11
+ * @param params 接口返回的原始参数
12
+ * @param status 支付状态
13
+ * @param data 接口返回的数据
14
+ * @returns 解析后的结果对象
15
+ */
16
+ export var parseMX51Params = function parseMX51Params(params, paymentStatus, data) {
17
+ if (!params) {
18
+ return null;
19
+ }
20
+ // 默认值
21
+ var result = {
22
+ transactionId: (params === null || params === void 0 ? void 0 : params.id) || '',
23
+ status: (params === null || params === void 0 ? void 0 : params.status) || '',
24
+ version: (params === null || params === void 0 ? void 0 : params.version) || 0,
25
+ message: (params === null || params === void 0 ? void 0 : params.message) || '',
26
+ merchantReceipt: params === null || params === void 0 ? void 0 : params.merchant_receipt,
27
+ customerReceipt: params === null || params === void 0 ? void 0 : params.customer_receipt,
28
+ resultAmounts: params === null || params === void 0 ? void 0 : params.result_amounts,
29
+ resultFinancialStatus: params === null || params === void 0 ? void 0 : params.result_financial_status,
30
+ layouts: [],
31
+ details: {},
32
+ detailsText: '',
33
+ autoAction: []
34
+ };
35
+
36
+ // 检查是否存在 pos_instructions
37
+ if (!(params !== null && params !== void 0 && params.pos_instructions)) {
38
+ return result;
39
+ }
40
+ var posInstructions = (params === null || params === void 0 ? void 0 : params.pos_instructions) || {};
41
+
42
+ // 检查是否有自动操作
43
+ result.autoAction = (posInstructions === null || posInstructions === void 0 ? void 0 : posInstructions.auto_actions) || [];
44
+
45
+ // 检查是否存在 action_form
46
+ if (!(posInstructions !== null && posInstructions !== void 0 && posInstructions.action_form)) {
47
+ return result;
48
+ }
49
+ var actionForm = (posInstructions === null || posInstructions === void 0 ? void 0 : posInstructions.action_form) || {};
50
+
51
+ // 解析详情信息
52
+ if (actionForm !== null && actionForm !== void 0 && actionForm.details) {
53
+ result.details = _objectSpread({}, (actionForm === null || actionForm === void 0 ? void 0 : actionForm.details) || {});
54
+ var detailsTextArr = [];
55
+ Object.keys((actionForm === null || actionForm === void 0 ? void 0 : actionForm.details) || {}).forEach(function (key) {
56
+ var _actionForm$details;
57
+ detailsTextArr.push("".concat(key, ": ").concat((actionForm === null || actionForm === void 0 || (_actionForm$details = actionForm.details) === null || _actionForm$details === void 0 ? void 0 : _actionForm$details[key]) || ''));
58
+ });
59
+ result.detailsText = (detailsTextArr === null || detailsTextArr === void 0 ? void 0 : detailsTextArr.join(', ')) || '';
60
+ }
61
+
62
+ // 解析布局和按钮
63
+ if (actionForm !== null && actionForm !== void 0 && actionForm.layout && Array.isArray(actionForm === null || actionForm === void 0 ? void 0 : actionForm.layout)) {
64
+ var layouts = [];
65
+
66
+ // 遍历所有布局
67
+ actionForm.layout.forEach(function (layout) {
68
+ var elements = [];
69
+ if (layout !== null && layout !== void 0 && layout.elements && Array.isArray(layout === null || layout === void 0 ? void 0 : layout.elements)) {
70
+ // 遍历布局中的所有元素
71
+ layout.elements.forEach(function (element) {
72
+ var _actionForm$propertie;
73
+ var elementKey = (element === null || element === void 0 ? void 0 : element.key) || '';
74
+ var elementLabel = (element === null || element === void 0 ? void 0 : element.label) || '';
75
+
76
+ // 从 properties 中获取对应的属性
77
+ var property = (actionForm === null || actionForm === void 0 || (_actionForm$propertie = actionForm.properties) === null || _actionForm$propertie === void 0 ? void 0 : _actionForm$propertie[elementKey]) || {};
78
+ if (property) {
79
+ var _element = {
80
+ _extra: {
81
+ merchantReceipt: params === null || params === void 0 ? void 0 : params.merchant_receipt,
82
+ customerReceipt: params === null || params === void 0 ? void 0 : params.customer_receipt,
83
+ paymentStatus: paymentStatus,
84
+ response: data
85
+ },
86
+ key: elementKey,
87
+ name: (property === null || property === void 0 ? void 0 : property.name) || '',
88
+ label: elementLabel,
89
+ submitUrl: (property === null || property === void 0 ? void 0 : property.submit_url) || '',
90
+ action: property === null || property === void 0 ? void 0 : property.action,
91
+ type: (property === null || property === void 0 ? void 0 : property.type) || 'button',
92
+ text: property === null || property === void 0 ? void 0 : property.text,
93
+ // 如果是打印收据按钮,需要关联对应的小票信息
94
+ receipt: elementKey === EButtonKeyType.PrintMerchantReceipt ? result === null || result === void 0 ? void 0 : result.merchantReceipt : elementKey === EButtonKeyType.PrintCustomerReceipt ? result === null || result === void 0 ? void 0 : result.customerReceipt : null
95
+ };
96
+
97
+ // 只在 type 为 'image' 时添加 image 字段
98
+ if ((property === null || property === void 0 ? void 0 : property.type) === 'image') {
99
+ _element.image = {
100
+ name: (property === null || property === void 0 ? void 0 : property.name) || '',
101
+ data: (property === null || property === void 0 ? void 0 : property.data) || '',
102
+ encoding: (property === null || property === void 0 ? void 0 : property.encoding) || ''
103
+ };
104
+ }
105
+ elements.push(_element);
106
+ }
107
+ });
108
+ }
109
+
110
+ // 只添加有元素的布局
111
+ if (elements.length > 0) {
112
+ layouts.push({
113
+ layoutType: layout.type || 'unknown',
114
+ elements: elements
115
+ });
116
+ }
117
+ });
118
+ result.layouts = layouts;
119
+ }
120
+ return result;
121
+ };
@@ -10,9 +10,10 @@ import { getPayParams } from "./helper";
10
10
  import Manual from "./component/manual";
11
11
  import Signature from "./component/signature";
12
12
  import { StatusEnum, PayRouteEnum, ClientEnum } from "./const";
13
- import { Payo, Windcave, Tyro, Linkly, Huifu } from "./manufacturer";
13
+ import { Payo, Windcave, Tyro, Linkly, Huifu, Mx51 } from "./manufacturer";
14
14
  import { useContextData, useDispatch, updateStatus, backUpProduction, updateComponent, backUpFree, updateState } from "./store";
15
15
  import "./index.less";
16
+ import payLog from "./utils/payLog";
16
17
 
17
18
  // 定制组件 用于当前页面无法扩展场景
18
19
  var Mapping = {
@@ -45,13 +46,15 @@ var Pay = function Pay(_ref) {
45
46
  client = _ref.client;
46
47
  var data = useContextData();
47
48
  var dataRef = useRef(data);
48
- // console.log("pay = ",'pay')
49
49
  var dispatch = useDispatch();
50
50
  var ref = useRef(false);
51
51
  var statusRef = useRef(data.status);
52
52
  var comonentRef = useRef(data.component);
53
53
  var backupRef = useRef(data.backup);
54
- var clearRef = useRef(0);
54
+ var clearRef = useRef(null);
55
+ useEffect(function () {
56
+ payLog.log('支付组件初始化');
57
+ }, []);
55
58
  useEffect(function () {
56
59
  comonentRef.current = data.component;
57
60
  }, [data.component]);
@@ -92,10 +95,11 @@ var Pay = function Pay(_ref) {
92
95
  net: net
93
96
  }));
94
97
  if (!ref.current) {
95
- // 初始化
96
98
  ref.current = true;
97
- // 断网&崩溃 恢复处理
98
99
  if (backupRef.current && net) {
100
+ payLog.log('网络恢复:从备份恢复', {
101
+ hasBackup: true
102
+ });
99
103
  var _data = Object.assign({}, (_objectDestructuringEmpty(backupRef.current), backupRef.current));
100
104
  dispatch(backUpFree({
101
105
  key: Date.now()
@@ -115,8 +119,10 @@ var Pay = function Pay(_ref) {
115
119
  return;
116
120
  }
117
121
  if (net) {
122
+ payLog.log('网络恢复', {
123
+ hasBackup: !!backupRef.current
124
+ });
118
125
  var _data2 = Object.assign({}, (_objectDestructuringEmpty(backupRef.current), backupRef.current));
119
- // 网络恢复 释放备份
120
126
  dispatch(backUpFree({
121
127
  key: Date.now()
122
128
  }));
@@ -132,10 +138,10 @@ var Pay = function Pay(_ref) {
132
138
  }
133
139
  return;
134
140
  }
135
- // 网络终端 - 备份数据
141
+ payLog.log('网络断开,备份数据');
136
142
  dispatch(updateState({
137
143
  form: 'Network'
138
- })); // 最新的展示的组件为 Network
144
+ }));
139
145
  dispatch(backUpProduction({}));
140
146
  dispatch(updateState({
141
147
  net: net,
@@ -147,16 +153,19 @@ var Pay = function Pay(_ref) {
147
153
  return function () {
148
154
  if (clearRef.current) {
149
155
  clearTimeout(clearRef.current);
156
+ clearRef.current = null;
150
157
  }
151
158
  };
152
159
  }, []);
153
160
  console.log('data =>>>>>> ', data);
161
+ // 定制逻辑:MX51 状态为 Question 时,不展示 Header 组件
162
+ var isHideHeader = data.eftpos === 'mx51' && data.status === StatusEnum.Question || data.status === StatusEnum.Init;
154
163
  return /*#__PURE__*/React.createElement(React.Fragment, null, data.render ? /*#__PURE__*/React.createElement("div", {
155
164
  className: "pisell-lowcode__eft-pay-box ".concat(className),
156
165
  style: data.type === 'step' ? {} : {
157
166
  display: 'none'
158
167
  }
159
- }, data.status !== StatusEnum.Init && /*#__PURE__*/React.createElement(Header, {
168
+ }, isHideHeader ? null : /*#__PURE__*/React.createElement(Header, {
160
169
  status: data.status,
161
170
  title: data.title,
162
171
  subTitle: data.subTitle
@@ -186,6 +195,9 @@ var Pay = function Pay(_ref) {
186
195
  key: data.key,
187
196
  onChange: onChange,
188
197
  isNativeApp: isMobile
198
+ }) : null, data.eftpos === 'mx51' ? /*#__PURE__*/React.createElement(Mx51, {
199
+ key: data.key,
200
+ onChange: onChange
189
201
  }) : null) : null, data.type === PayRouteEnum.Unset && Comm ? /*#__PURE__*/React.createElement(Comm, {
190
202
  onChange: onChange,
191
203
  api: api,
@@ -28,6 +28,7 @@ import { useFail, useStoreRef } from "../hooks";
28
28
  import { useContextData, useDispatch, updateNextStep, updateComponent, updateState, updateCustom } from "../store";
29
29
  import { useValidate } from "./hooks";
30
30
  import { usePayment, ActionType } from "./payment";
31
+ import payLog from "../utils/payLog";
31
32
 
32
33
  // 注意断网与卸载未完成的回调将终止处理
33
34
  export var POS = function POS(_ref) {
@@ -54,7 +55,7 @@ export var POS = function POS(_ref) {
54
55
  var fail = useFail(0);
55
56
  var failRef = useRef(fail);
56
57
  var controllerRef = useRef();
57
- var clearRef = useRef();
58
+ var clearRef = useRef(null);
58
59
  var initRef = useRef(false);
59
60
  var unloadRef = useRef(false);
60
61
  var _useValidate = useValidate(1000 * 60),
@@ -188,6 +189,7 @@ export var POS = function POS(_ref) {
188
189
  card_reader_type: eftposRef.current,
189
190
  card_reader_id: (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.id,
190
191
  number: numRef.current,
192
+ original_payment_number: custom === null || custom === void 0 ? void 0 : custom.original_payment_number,
191
193
  pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
192
194
  number: numRef.current
193
195
  })))))
@@ -196,9 +198,15 @@ export var POS = function POS(_ref) {
196
198
  // ? api.pay(apiParams, { signal: controllerRef.current.signal })
197
199
  // : api.refund(apiParams, { signal: controllerRef.current.signal });
198
200
 
199
- // 支付场景单独接入新的流程
201
+ payLog.setContext({
202
+ transactionNumber: numRef.current
203
+ });
200
204
  if (isPay) {
201
205
  var _deviceRef$current4;
206
+ payLog.log('Payo:发起支付', {
207
+ isPay: isPay,
208
+ number: numRef.current
209
+ });
202
210
  paymentRun({
203
211
  paymentType: ActionType.Pay,
204
212
  paymentNum: numRef.current,
@@ -207,39 +215,62 @@ export var POS = function POS(_ref) {
207
215
  params: apiParams,
208
216
  callbacks: {
209
217
  onSuccess: function onSuccess(res) {
218
+ payLog.log('Payo:支付成功', {
219
+ code: res === null || res === void 0 ? void 0 : res.code
220
+ });
210
221
  success(res);
211
222
  },
212
223
  onError: function onError(err) {
213
- console.log('err = >>>>>', err);
224
+ payLog.log('Payo:支付失败', {
225
+ code: err === null || err === void 0 ? void 0 : err.code
226
+ });
214
227
  failRef.current(err, true);
215
228
  }
216
229
  }
217
230
  });
218
231
  return;
219
232
  } else {
233
+ payLog.log('Payo:发起退款', {
234
+ isPay: isPay,
235
+ number: numRef.current
236
+ });
220
237
  var resultPromise = api.refund(apiParams, {
221
238
  signal: controllerRef.current.signal
222
239
  });
223
240
  resultPromise.then(function (res) {
224
241
  console.log('netRef.current111 = ', netRef.current);
225
242
  if (unloadRef.current || !netRef.current) {
243
+ payLog.log('Payo:退款拦截', {
244
+ isUnload: unloadRef.current,
245
+ isNet: netRef.current
246
+ });
226
247
  return;
227
248
  }
228
249
  if (res && "".concat(res.code) === '200') {
250
+ payLog.log('Payo:退款成功', {
251
+ res: JSON.stringify(res)
252
+ });
229
253
  success(res);
230
254
  return;
231
255
  }
232
256
  return Promise.reject(res);
233
257
  }).catch(function (err) {
234
- console.log('netRef.current222 = ', netRef.current, unloadRef.current, err);
235
258
  if (unloadRef.current || !netRef.current) {
259
+ payLog.log('Payo:退款失败拦截', {
260
+ isUnload: unloadRef.current,
261
+ isNet: netRef.current
262
+ });
236
263
  return;
237
264
  }
238
- // 支付接口超时 进行支付状态查询(超时或者其它错误)
239
265
  if (!(err !== null && err !== void 0 && err.code) || "".concat(err.code) === PayStatus.Timeout) {
266
+ payLog.log('Payo:退款超时,转查询');
240
267
  checkApi();
241
268
  return;
242
269
  }
270
+ payLog.log('Payo:退款失败', {
271
+ code: err === null || err === void 0 ? void 0 : err.code,
272
+ message: err === null || err === void 0 ? void 0 : err.message
273
+ });
243
274
  failRef.current(err, true);
244
275
  });
245
276
  }
@@ -273,6 +304,7 @@ export var Action = function Action(_ref2) {
273
304
  useEffect(function () {
274
305
  var timer = setTimeout(function () {
275
306
  setIsShowCancel(true);
307
+ payLog.log('Payo:30秒后显示取消按钮');
276
308
  }, 30 * 1000);
277
309
  return function () {
278
310
  clearTimeout(timer);
@@ -285,6 +317,7 @@ export var Action = function Action(_ref2) {
285
317
  * @Date: 2024-08-20 12:18
286
318
  */
287
319
  var onManually = function onManually() {
320
+ payLog.log('Payo:点击手动标记');
288
321
  dispatch(updateState({
289
322
  manual: {
290
323
  title: locales.getText('page.eftpos-pay.text.request.title')(mode),
@@ -294,6 +327,7 @@ export var Action = function Action(_ref2) {
294
327
  dispatch(updateComponent('Manual', true));
295
328
  };
296
329
  var onCancel = function onCancel() {
330
+ payLog.log('Payo:点击取消');
297
331
  onChange('fail', {
298
332
  number: number,
299
333
  uniquePaymentNumber: number,
@@ -68,7 +68,7 @@ export default (function (params) {
68
68
  status: StatusEnum.Loading,
69
69
  steps: getStep(mode),
70
70
  render: true,
71
- client: client !== 'undefined' ? client : ClientEnum.Merchant,
71
+ client: client !== 'undefined' && client !== undefined ? client : ClientEnum.Merchant,
72
72
  custom: other || {}
73
73
  }, typeof net !== 'undefined' ? {
74
74
  net: net
@@ -12,7 +12,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
12
12
  import { useCallback, useEffect, useRef } from 'react';
13
13
  import { PayStatus } from "../const";
14
14
  import { sleep } from "../helper";
15
- import { sendWarningLog } from '@pisell/utils';
15
+ import payLog from "../utils/payLog";
16
16
 
17
17
  /**
18
18
  * @title: 循环查询 接口状态
@@ -112,24 +112,15 @@ export var useValidate = function useValidate(timeout) {
112
112
  (_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 || _controllerRef$curren.abort();
113
113
  }, []);
114
114
  var run = function run() {
115
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
116
- params[_key] = arguments[_key];
117
- }
118
115
  isTimeoutCloseRef.current = false;
119
116
  TimeoutRef.current && clearTimeout(TimeoutRef.current);
120
117
  // 开启计时
121
118
  TimeoutRef.current = setTimeout(function () {
122
119
  isTimeoutCloseRef.current = true;
123
- sendWarningLog({
124
- title: '支付状态查询超时',
125
- content: [{
126
- key: 'params',
127
- value: JSON.stringify(params)
128
- }]
129
- });
120
+ payLog.log('Payo:支付状态查询超时');
130
121
  close();
131
122
  }, timeout);
132
- return checkApi.apply(void 0, params);
123
+ return checkApi.apply(void 0, arguments);
133
124
  };
134
125
  useEffect(function () {
135
126
  return function () {