@pisell/private-materials 3.0.136 → 3.0.138

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 (219) 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 +12 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/forms/single/index.js +3 -0
  12. package/es/components/eftpos/const.d.ts +26 -0
  13. package/es/components/eftpos/const.js +40 -8
  14. package/es/components/eftpos/device.d.ts +3 -2
  15. package/es/components/eftpos/device.js +6 -5
  16. package/es/components/eftpos/form/index.d.ts +5 -0
  17. package/es/components/eftpos/form/index.js +8 -0
  18. package/es/components/eftpos/hooks.d.ts +34 -0
  19. package/es/components/{eftposPay/windcave/hook.js → eftpos/hooks.js} +96 -122
  20. package/es/components/eftpos/icon/apiKey.d.ts +5 -0
  21. package/es/components/eftpos/icon/apiKey.js +17 -0
  22. package/es/components/eftpos/icon/device.d.ts +5 -0
  23. package/es/components/eftpos/icon/device.js +19 -0
  24. package/es/components/eftpos/index.d.ts +10 -0
  25. package/es/components/eftpos/index.js +329 -46
  26. package/es/components/eftpos/index.less +38 -1
  27. package/es/components/eftpos/locales.d.ts +12 -0
  28. package/es/components/eftpos/locales.js +15 -3
  29. package/es/components/eftpos/log.d.ts +8 -0
  30. package/es/components/eftpos/log.js +85 -0
  31. package/es/components/eftpos/pos.d.ts +1 -1
  32. package/es/components/eftpos/pos.js +8 -5
  33. package/es/components/eftpos/surcharge/index.d.ts +25 -2
  34. package/es/components/eftpos/surcharge/index.js +100 -16
  35. package/es/components/eftpos/table.d.ts +4 -0
  36. package/es/components/eftpos/table.js +102 -10
  37. package/es/components/eftposPay/amount.d.ts +7 -1
  38. package/es/components/eftposPay/amount.js +65 -38
  39. package/es/components/eftposPay/component/fail/failCustom.js +65 -20
  40. package/es/components/eftposPay/component/fail/index.js +60 -30
  41. package/es/components/eftposPay/component/fail/network.d.ts +5 -0
  42. package/es/components/eftposPay/component/fail/network.js +13 -0
  43. package/es/components/eftposPay/component/fail/unknow.d.ts +6 -0
  44. package/es/components/eftposPay/component/fail/unknow.js +18 -3
  45. package/es/components/eftposPay/component/header/index.d.ts +2 -1
  46. package/es/components/eftposPay/component/header/index.js +4 -1
  47. package/es/components/eftposPay/component/header/index.less +1 -10
  48. package/es/components/eftposPay/component/manual/index.d.ts +6 -1
  49. package/es/components/eftposPay/component/manual/index.js +174 -23
  50. package/es/components/eftposPay/component/manual/index.less +42 -14
  51. package/es/components/eftposPay/component/signature/index.d.ts +5 -0
  52. package/es/components/eftposPay/component/signature/index.js +20 -2
  53. package/es/components/eftposPay/component/step/index.d.ts +7 -7
  54. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  55. package/es/components/eftposPay/const.d.ts +19 -4
  56. package/es/components/eftposPay/const.js +4 -2
  57. package/es/components/eftposPay/device.d.ts +7 -0
  58. package/es/components/eftposPay/device.js +22 -0
  59. package/es/components/eftposPay/helper.d.ts +54 -0
  60. package/es/components/eftposPay/helper.js +93 -1
  61. package/es/components/eftposPay/hooks.d.ts +30 -1
  62. package/es/components/eftposPay/hooks.js +181 -26
  63. package/es/components/eftposPay/index.d.ts +2 -4
  64. package/es/components/eftposPay/index.js +119 -31
  65. package/es/components/eftposPay/index.less +27 -19
  66. package/es/components/eftposPay/locales.d.ts +45 -0
  67. package/es/components/eftposPay/locales.js +348 -3
  68. package/es/components/eftposPay/manufacturer.d.ts +2 -2
  69. package/es/components/eftposPay/manufacturer.js +9 -10
  70. package/es/components/eftposPay/pay.d.ts +10 -1
  71. package/es/components/eftposPay/pay.js +112 -34
  72. package/es/components/eftposPay/payo/config.js +137 -270
  73. package/es/components/eftposPay/payo/const.d.ts +22 -2
  74. package/es/components/eftposPay/payo/const.js +83 -33
  75. package/es/components/eftposPay/payo/hooks.d.ts +5 -0
  76. package/es/components/eftposPay/payo/hooks.js +19 -2
  77. package/es/components/eftposPay/store/index.d.ts +154 -53
  78. package/es/components/eftposPay/store/index.js +112 -60
  79. package/es/components/eftposPay/tyro/const.d.ts +17 -0
  80. package/es/components/eftposPay/{eftpos → tyro}/const.js +71 -90
  81. package/es/components/eftposPay/tyro/hooks.d.ts +14 -0
  82. package/es/components/eftposPay/tyro/hooks.js +40 -0
  83. package/es/components/eftposPay/tyro/index.d.ts +9 -0
  84. package/es/components/eftposPay/tyro/index.js +575 -0
  85. package/es/components/eftposPay/windcave/const.d.ts +24 -9
  86. package/es/components/eftposPay/windcave/const.js +90 -81
  87. package/es/components/eftposPay/windcave/helper.d.ts +16 -2
  88. package/es/components/eftposPay/windcave/helper.js +175 -42
  89. package/es/components/eftposPay/windcave/receiptAction.d.ts +12 -0
  90. package/es/components/eftposPay/windcave/receiptAction.js +91 -43
  91. package/es/components/eftposPay/windcave/timer.d.ts +13 -1
  92. package/es/components/eftposPay/windcave/timer.js +18 -1
  93. package/es/components/eftposPay/windcave/windcave.d.ts +2 -1
  94. package/es/components/eftposPay/windcave/windcave.js +155 -139
  95. package/es/utils/load.d.ts +11 -0
  96. package/es/utils/load.js +85 -0
  97. package/lib/components/booking/forms/single/index.js +1 -0
  98. package/lib/components/eftpos/const.d.ts +26 -0
  99. package/lib/components/eftpos/const.js +13 -1
  100. package/lib/components/eftpos/device.d.ts +3 -2
  101. package/lib/components/eftpos/device.js +2 -2
  102. package/lib/components/eftpos/form/index.d.ts +5 -0
  103. package/lib/components/eftpos/hooks.d.ts +34 -0
  104. package/lib/components/eftpos/hooks.js +106 -0
  105. package/lib/components/eftpos/icon/apiKey.d.ts +5 -0
  106. package/lib/components/eftpos/icon/apiKey.js +57 -0
  107. package/lib/components/eftpos/icon/device.d.ts +5 -0
  108. package/lib/components/eftpos/icon/device.js +57 -0
  109. package/lib/components/eftpos/index.d.ts +10 -0
  110. package/lib/components/eftpos/index.js +262 -97
  111. package/lib/components/eftpos/index.less +38 -1
  112. package/lib/components/eftpos/locales.d.ts +12 -0
  113. package/lib/components/eftpos/locales.js +15 -3
  114. package/lib/components/eftpos/log.d.ts +8 -0
  115. package/lib/components/eftpos/log.js +87 -0
  116. package/lib/components/eftpos/pos.d.ts +1 -1
  117. package/lib/components/eftpos/pos.js +5 -4
  118. package/lib/components/eftpos/surcharge/index.d.ts +25 -2
  119. package/lib/components/eftpos/surcharge/index.js +36 -6
  120. package/lib/components/eftpos/table.d.ts +4 -0
  121. package/lib/components/eftpos/table.js +40 -8
  122. package/lib/components/eftposPay/amount.d.ts +7 -1
  123. package/lib/components/eftposPay/amount.js +10 -33
  124. package/lib/components/eftposPay/component/fail/failCustom.js +27 -6
  125. package/lib/components/eftposPay/component/fail/index.js +39 -18
  126. package/lib/components/eftposPay/component/fail/network.d.ts +5 -0
  127. package/lib/components/eftposPay/component/fail/unknow.d.ts +6 -0
  128. package/lib/components/eftposPay/component/fail/unknow.js +3 -3
  129. package/lib/components/eftposPay/component/header/index.d.ts +2 -1
  130. package/lib/components/eftposPay/component/header/index.js +2 -1
  131. package/lib/components/eftposPay/component/header/index.less +1 -10
  132. package/lib/components/eftposPay/component/manual/index.d.ts +6 -1
  133. package/lib/components/eftposPay/component/manual/index.js +122 -31
  134. package/lib/components/eftposPay/component/manual/index.less +42 -14
  135. package/lib/components/eftposPay/component/signature/index.d.ts +5 -0
  136. package/lib/components/eftposPay/component/signature/index.js +2 -2
  137. package/lib/components/eftposPay/component/step/index.d.ts +7 -7
  138. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  139. package/lib/components/eftposPay/const.d.ts +19 -4
  140. package/lib/components/eftposPay/const.js +3 -1
  141. package/lib/components/eftposPay/device.d.ts +7 -0
  142. package/lib/components/eftposPay/helper.d.ts +54 -0
  143. package/lib/components/eftposPay/helper.js +64 -0
  144. package/lib/components/eftposPay/hooks.d.ts +30 -1
  145. package/lib/components/eftposPay/hooks.js +182 -44
  146. package/lib/components/eftposPay/index.d.ts +2 -4
  147. package/lib/components/eftposPay/index.js +74 -27
  148. package/lib/components/eftposPay/index.less +27 -19
  149. package/lib/components/eftposPay/locales.d.ts +45 -0
  150. package/lib/components/eftposPay/locales.js +352 -3
  151. package/lib/components/eftposPay/manufacturer.d.ts +2 -2
  152. package/lib/components/eftposPay/manufacturer.js +13 -13
  153. package/lib/components/eftposPay/pay.d.ts +10 -1
  154. package/lib/components/eftposPay/pay.js +86 -25
  155. package/lib/components/eftposPay/payo/config.js +121 -268
  156. package/lib/components/eftposPay/payo/const.d.ts +22 -2
  157. package/lib/components/eftposPay/payo/const.js +55 -36
  158. package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
  159. package/lib/components/eftposPay/payo/hooks.js +1 -1
  160. package/lib/components/eftposPay/store/index.d.ts +154 -53
  161. package/lib/components/eftposPay/store/index.js +7 -66
  162. package/lib/components/eftposPay/tyro/const.d.ts +17 -0
  163. package/lib/components/eftposPay/tyro/const.js +114 -0
  164. package/lib/components/eftposPay/tyro/hooks.d.ts +14 -0
  165. package/lib/components/eftposPay/{eftpos/index.js → tyro/hooks.js} +31 -36
  166. package/lib/components/eftposPay/tyro/index.d.ts +9 -0
  167. package/lib/components/eftposPay/tyro/index.js +558 -0
  168. package/lib/components/eftposPay/windcave/const.d.ts +24 -9
  169. package/lib/components/eftposPay/windcave/const.js +53 -104
  170. package/lib/components/eftposPay/windcave/helper.d.ts +16 -2
  171. package/lib/components/eftposPay/windcave/helper.js +163 -48
  172. package/lib/components/eftposPay/windcave/receiptAction.d.ts +12 -0
  173. package/lib/components/eftposPay/windcave/receiptAction.js +15 -47
  174. package/lib/components/eftposPay/windcave/timer.d.ts +13 -1
  175. package/lib/components/eftposPay/windcave/timer.js +5 -0
  176. package/lib/components/eftposPay/windcave/windcave.d.ts +2 -1
  177. package/lib/components/eftposPay/windcave/windcave.js +130 -130
  178. package/lib/utils/load.d.ts +11 -0
  179. package/lib/utils/load.js +100 -0
  180. package/lowcode/eftpos/meta.ts +202 -160
  181. package/lowcode/eftpos-pay/meta.ts +45 -12
  182. package/package.json +4 -4
  183. package/es/components/eftposPay/eftpos/config.d.ts +0 -11
  184. package/es/components/eftposPay/eftpos/config.js +0 -178
  185. package/es/components/eftposPay/eftpos/const.d.ts +0 -10
  186. package/es/components/eftposPay/eftpos/index.d.ts +0 -7
  187. package/es/components/eftposPay/eftpos/index.js +0 -35
  188. package/es/components/eftposPay/windcave/action.d.ts +0 -8
  189. package/es/components/eftposPay/windcave/action.js +0 -104
  190. package/es/components/eftposPay/windcave/hook.d.ts +0 -14
  191. package/es/components/eftposPay/windcave/index.d.ts +0 -8
  192. package/es/components/eftposPay/windcave/index.js +0 -49
  193. package/es/components/eftposPay/windcave/pos.d.ts +0 -8
  194. package/es/components/eftposPay/windcave/pos.js +0 -180
  195. package/es/components/eftposPay/windcave/pwd.d.ts +0 -8
  196. package/es/components/eftposPay/windcave/pwd.js +0 -124
  197. package/es/components/eftposPay/windcave/receipet.d.ts +0 -6
  198. package/es/components/eftposPay/windcave/receipet.js +0 -67
  199. package/es/components/eftposPay/windcave/wait.d.ts +0 -12
  200. package/es/components/eftposPay/windcave/wait.js +0 -139
  201. package/lib/components/eftposPay/eftpos/config.d.ts +0 -11
  202. package/lib/components/eftposPay/eftpos/config.js +0 -199
  203. package/lib/components/eftposPay/eftpos/const.d.ts +0 -10
  204. package/lib/components/eftposPay/eftpos/const.js +0 -165
  205. package/lib/components/eftposPay/eftpos/index.d.ts +0 -7
  206. package/lib/components/eftposPay/windcave/action.d.ts +0 -8
  207. package/lib/components/eftposPay/windcave/action.js +0 -143
  208. package/lib/components/eftposPay/windcave/hook.d.ts +0 -14
  209. package/lib/components/eftposPay/windcave/hook.js +0 -139
  210. package/lib/components/eftposPay/windcave/index.d.ts +0 -8
  211. package/lib/components/eftposPay/windcave/index.js +0 -78
  212. package/lib/components/eftposPay/windcave/pos.d.ts +0 -8
  213. package/lib/components/eftposPay/windcave/pos.js +0 -197
  214. package/lib/components/eftposPay/windcave/pwd.d.ts +0 -8
  215. package/lib/components/eftposPay/windcave/pwd.js +0 -143
  216. package/lib/components/eftposPay/windcave/receipet.d.ts +0 -6
  217. package/lib/components/eftposPay/windcave/receipet.js +0 -93
  218. package/lib/components/eftposPay/windcave/wait.d.ts +0 -12
  219. package/lib/components/eftposPay/windcave/wait.js +0 -163
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/components/eftposPay/windcave/const.tsx
@@ -33,118 +23,66 @@ __export(const_exports, {
33
23
  StepStatusEnum: () => StepStatusEnum,
34
24
  default: () => const_default,
35
25
  getAmonunt: () => getAmonunt,
36
- getStep: () => getStep,
37
26
  getStepMapping: () => getStepMapping
38
27
  });
39
28
  module.exports = __toCommonJS(const_exports);
40
29
  var import_utils = require("@pisell/utils");
41
- var import_react = __toESM(require("react"));
42
30
  var import_const = require("../const");
43
- var getStep = ({
44
- amount,
45
- symbol,
46
- mode
47
- } = {
48
- amount: "0",
49
- symbol: "",
50
- mode: import_const.ModeEnum.Pay
51
- }) => [
52
- {
53
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(
54
- mode || import_const.ModeEnum.Pay
55
- ),
56
- key: Date.now(),
57
- text: import_utils.locales.getText("page.eftpos-pay.text.wait")(symbol + amount, mode),
58
- // 'Asked EFTPOS to accept payment for Purchase $100...',
59
- warn: "",
60
- tip: import_utils.locales.getText("page.eftpos-pay.text.processing"),
61
- status: import_const.StatusEnum.Loading
62
- },
63
- {
64
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(
65
- mode || import_const.ModeEnum.Pay
66
- ),
67
- key: Date.now(),
68
- text: import_utils.locales.getText("page.eftpos-pay.text.pin"),
69
- warn: "",
70
- tip: import_utils.locales.getText("page.eftpos-pay.text.processing"),
71
- status: import_const.StatusEnum.Loading
72
- },
73
- {
74
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(
75
- mode || import_const.ModeEnum.Pay
76
- ),
77
- key: Date.now(),
78
- text: import_utils.locales.getText("page.eftpos-pay.text.receipt"),
79
- warn: "",
80
- tip: import_utils.locales.getText("page.eftpos-pay.text.processing"),
81
- status: import_const.StatusEnum.Loading
82
- },
83
- {
84
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(
85
- mode || import_const.ModeEnum.Pay
86
- ),
87
- key: Date.now(),
88
- text: import_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"),
89
- warn: import_utils.locales.getText("page.eftpos-pay.text.receipt.again.text"),
90
- tip: "",
91
- status: import_const.StatusEnum.Warn
92
- },
93
- {
94
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(
95
- mode || import_const.ModeEnum.Pay
96
- ),
97
- key: Date.now(),
98
- text: import_utils.locales.getText("page.eftpos-pay.text.waiting.processing"),
99
- success: "Approade",
100
- warn: "",
101
- tip: import_utils.locales.getText("page.eftpos-pay.text.processing"),
102
- status: import_const.StatusEnum.Loading
103
- }
104
- ];
105
- var getInitState = (params) => {
106
- if (typeof params.number !== "undefined") {
107
- params.isPay = true;
108
- }
31
+ var const_default = (params) => {
32
+ const {
33
+ order_id,
34
+ name,
35
+ symbol,
36
+ amount,
37
+ mode,
38
+ number,
39
+ pay,
40
+ device,
41
+ net,
42
+ ...other
43
+ } = params || {
44
+ mode: import_const.ModeEnum.Pay
45
+ };
109
46
  return {
110
- mode: (params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay,
47
+ order_id,
48
+ name,
49
+ symbol,
50
+ amount,
51
+ mode,
111
52
  eftpos: import_const.EftposEnum.Windcave,
112
53
  key: Date.now(),
113
54
  warn: "",
114
55
  step: 0,
115
56
  type: import_const.PayRouteEnum.Step,
116
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(
117
- (params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay
118
- ),
57
+ title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
119
58
  component: "",
120
59
  status: import_const.StatusEnum.Loading,
121
- steps: getStep(params),
122
- custom: params ? { ...params, list: [], step: 2 } : { list: [], step: 2 },
60
+ steps: [],
123
61
  render: true,
124
- ...params.device ? { device: params.device } : {}
62
+ custom: other ? { ...other, list: [], step: 1 /* Free */ } : { list: [], step: 1 /* Free */ },
63
+ ...typeof net !== "undefined" ? { net } : {},
64
+ ...typeof number !== "undefined" ? { number } : {},
65
+ ...typeof pay !== "undefined" ? { pay } : {},
66
+ ...typeof device !== "undefined" ? { device } : {}
125
67
  };
126
68
  };
127
- var const_default = getInitState;
128
69
  function getAmonunt(store) {
129
- const { device, custom } = store;
70
+ const { device, pay, custom, name, symbol, amount } = store;
130
71
  if (!device || !custom) {
131
72
  throw Error("device or custom is not defined");
132
73
  }
133
- const name = custom.name;
134
- const symbol = custom.symbol;
135
- const money = custom.amount;
136
- const pay = custom.pay;
137
74
  const setting = device.setting;
138
75
  if (pay) {
139
76
  return {
140
77
  name,
141
78
  symbol,
142
79
  // format,
143
- money,
80
+ money: Number(amount),
144
81
  amount: Number(pay.amount),
145
82
  surRate: Number(pay.surRate),
146
83
  surMoney: Number(pay.surMoney),
147
- surcharge: (setting == null ? void 0 : setting.surcharge) || false
84
+ surcharge: (setting == null ? void 0 : setting.surcharge) || false,
85
+ useOriginSurcharge: (pay == null ? void 0 : pay.useOriginSurcharge) || false
148
86
  };
149
87
  }
150
88
  if (!setting) {
@@ -152,25 +90,27 @@ function getAmonunt(store) {
152
90
  name,
153
91
  symbol,
154
92
  // format,
155
- money,
156
- amount: money,
93
+ money: Number(amount),
94
+ amount: Number(amount),
157
95
  surRate: 0,
158
96
  surMoney: 0,
159
- surcharge: false
97
+ surcharge: false,
98
+ useOriginSurcharge: false
160
99
  };
161
100
  }
162
101
  const surRate = setting.constant_rate || 0;
163
102
  const surMoney = setting.constant_money || 0;
164
103
  const surcharge = setting.surcharge;
104
+ const useOriginSurcharge = setting.useOriginSurcharge || false;
165
105
  return {
166
106
  name,
167
107
  symbol,
168
- // format,
169
- money,
170
- amount: money,
171
- surRate: surcharge ? surRate : 0,
172
- surMoney: surcharge ? surMoney : 0,
173
- surcharge
108
+ money: Number(amount),
109
+ amount: Number(amount),
110
+ surRate: useOriginSurcharge ? 0 : surcharge ? surRate : 0,
111
+ surMoney: useOriginSurcharge ? 0 : surcharge ? surMoney : 0,
112
+ surcharge,
113
+ useOriginSurcharge
174
114
  };
175
115
  }
176
116
  var StepStatusEnum = /* @__PURE__ */ ((StepStatusEnum2) => {
@@ -268,7 +208,17 @@ var getStepMapping = (type, { money, mode = import_const.ModeEnum.Pay }) => {
268
208
  // passive active
269
209
  status: "pedding",
270
210
  //
271
- pedding: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, import_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText("page.eftpos-pay.text.receipt.again.text")),
211
+ pedding: `${import_utils.locales.getText(
212
+ "page.eftpos-pay.text.receipt.again.title"
213
+ )}
214
+ ${import_utils.locales.getText("page.eftpos-pay.text.receipt.again.text")}`,
215
+ // pedding: (
216
+ // <>
217
+ // {locales.getText('page.eftpos-pay.text.receipt.again.title')}
218
+ // <br />
219
+ // {locales.getText('page.eftpos-pay.text.receipt.again.text')}
220
+ // </>
221
+ // ),
272
222
  resolve: import_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"),
273
223
  reject: import_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"),
274
224
  // locales.getText('page.eftpos-pay.text.waiting.decline'), // 'Wait for the Decline',
@@ -295,6 +245,5 @@ var getStepMapping = (type, { money, mode = import_const.ModeEnum.Pay }) => {
295
245
  StemTypeEnum,
296
246
  StepStatusEnum,
297
247
  getAmonunt,
298
- getStep,
299
248
  getStepMapping
300
249
  });
@@ -1,9 +1,23 @@
1
1
  import React from 'react';
2
2
  import { PayStatus } from '../const';
3
3
  import XhrTimer from './timer';
4
+ /**
5
+ * @title: windcave 支付,退款,查询 错误逻辑处理
6
+ * @description: 动态步骤页 异常前往 FailCustom 页面
7
+ * @return null
8
+ * @Author: hongbing.wang
9
+ * @Date: 2024-08-12 10:29
10
+ */
4
11
  export declare const useFail: () => (res: {
5
- code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | undefined;
12
+ code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | "701008" | "701009" | "701010" | undefined;
6
13
  }, isMark?: boolean) => void;
14
+ /**
15
+ * @title: 轮询 check 接口
16
+ * @description: 轮询 终止条件 1.超时 , 2. 返回非200状态码 , 3. 外部关闭
17
+ * @return [run, XhrTimer] run: 启动函数 , XhrTimer 轮询类
18
+ * @Author: hongbing.wang
19
+ * @Date: 2024-08-12 10:30
20
+ */
7
21
  export declare const useValidate: (check: (...agrn: unknown[]) => Promise<unknown>, num: number, onChange: (params: {
8
22
  [key: string]: unknown;
9
- }) => unknown) => readonly [(timeout?: number) => void, React.MutableRefObject<XhrTimer | undefined>];
23
+ }) => unknown) => readonly [(timeout?: number) => void, React.MutableRefObject<((res: any, isRun?: boolean) => unknown) | undefined>, React.MutableRefObject<XhrTimer | undefined>];
@@ -34,15 +34,17 @@ __export(helper_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(helper_exports);
36
36
  var import_utils = require("@pisell/utils");
37
- var import_react = __toESM(require("react"));
37
+ var import_react = require("react");
38
38
  var import_const = require("../const");
39
39
  var import_store = require("../store");
40
40
  var import_const2 = require("./const");
41
+ var import_hooks = require("../hooks");
41
42
  var import_timer = __toESM(require("./timer"));
42
43
  var Max4004 = 1;
43
44
  var useFail = () => {
44
45
  const dispatch = (0, import_store.useDispatch)();
45
- const { custom, mode } = (0, import_store.useContextData)();
46
+ const { custom } = (0, import_store.useContextData)();
47
+ const { modeRef } = (0, import_hooks.useStoreRef)();
46
48
  const ref = (0, import_react.useRef)((custom == null ? void 0 : custom.retry) || 0);
47
49
  (0, import_react.useEffect)(() => {
48
50
  ref.current = (custom == null ? void 0 : custom.retry) || 0;
@@ -68,7 +70,9 @@ var useFail = () => {
68
70
  status: "fail",
69
71
  fail: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail"),
70
72
  warn: null,
71
- title: import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)
73
+ title: import_utils.locales.getText("page.eftpos-pay.text.failed")(
74
+ modeRef.current
75
+ )
72
76
  }
73
77
  })
74
78
  );
@@ -86,7 +90,9 @@ var useFail = () => {
86
90
  status: "fail",
87
91
  fail: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail"),
88
92
  warn: null,
89
- titl: import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)
93
+ titl: import_utils.locales.getText("page.eftpos-pay.text.failed")(
94
+ modeRef.current
95
+ )
90
96
  }
91
97
  })
92
98
  );
@@ -94,25 +100,47 @@ var useFail = () => {
94
100
  return;
95
101
  }
96
102
  ref.current += 1;
103
+ dispatch(
104
+ (0, import_store.updateState)({
105
+ number: ""
106
+ })
107
+ );
97
108
  dispatch(
98
109
  (0, import_store.updateCustom)({
99
110
  retry: ref.current,
100
- number: void 0,
101
- isPay: false,
102
111
  list: []
103
112
  })
104
113
  );
105
114
  dispatch((0, import_store.updateKey)(Date.now()));
106
115
  return;
107
116
  }
108
- if (code === import_const.PayStatus.Timeout || code === import_const.PayStatus.PayTimeout) {
117
+ if (code === import_const.PayStatus.PayTimeout) {
118
+ dispatch(
119
+ (0, import_store.updateCustom)({
120
+ failCustom: {
121
+ isPosNetworkError: false,
122
+ status: "fail",
123
+ fail: import_utils.locales.getText(
124
+ "page.eftpos-pay.text.transaction.fail.timeout"
125
+ ),
126
+ title: import_utils.locales.getText("page.eftpos-pay.text.failed")(
127
+ modeRef.current
128
+ ),
129
+ warn: null
130
+ }
131
+ })
132
+ );
133
+ dispatch((0, import_store.updateComponent)("FailCustom"));
134
+ return;
135
+ }
136
+ if (code === import_const.PayStatus.Timeout) {
109
137
  if (isMark) {
110
138
  dispatch(
111
139
  (0, import_store.updateState)({
112
140
  manual: {
113
141
  title: import_utils.locales.getText("page.eftpos-pay.text.timedout.title"),
114
142
  text: import_utils.locales.getText("page.eftpos-pay.text.timedout.text")(
115
- mode
143
+ modeRef.current
116
144
  )
117
145
  }
118
146
  })
@@ -125,12 +153,12 @@ var useFail = () => {
125
153
  failCustom: {
126
154
  isPosNetworkError: false,
127
155
  status: "fail",
128
- fail: code === import_const.PayStatus.Timeout ? import_utils.locales.getText(
129
- "page.eftpos-pay.text.transaction.pay.fail.timeout"
130
- ) : import_utils.locales.getText(
156
+ fail: import_utils.locales.getText(
131
157
  "page.eftpos-pay.text.transaction.fail.timeout"
132
158
  ),
133
- title: import_utils.locales.getText("page.eftpos-pay.text.failed")(mode),
159
+ title: import_utils.locales.getText("page.eftpos-pay.text.failed")(
160
+ modeRef.current
161
+ ),
134
162
  warn: null
135
163
  }
136
164
  })
@@ -147,7 +175,9 @@ var useFail = () => {
147
175
  fail: import_utils.locales.getText(
148
176
  "page.eftpos-pay.text.transaction.fail.terminal"
149
177
  ),
150
- title: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail.terminal.title"),
178
+ title: import_utils.locales.getText(
179
+ "page.eftpos-pay.text.transaction.fail.terminal.title"
180
+ ),
151
181
  warn: null
152
182
  }
153
183
  })
@@ -159,12 +189,13 @@ var useFail = () => {
159
189
  dispatch(
160
190
  (0, import_store.updateCustom)({
161
191
  failCustom: {
162
- isPosNetworkError: true,
163
192
  status: "fail",
164
193
  fail: import_utils.locales.getText(
165
194
  "page.eftpos-pay.text.transaction.fail.cancel"
166
195
  ),
167
- title: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail.cancel.title"),
196
+ title: import_utils.locales.getText(
197
+ "page.eftpos-pay.text.transaction.fail.cancel.title"
198
+ ),
168
199
  warn: null
169
200
  }
170
201
  })
@@ -180,17 +211,102 @@ var useFail = () => {
180
211
  status: "warn",
181
212
  fail: null,
182
213
  title: import_utils.locales.getText("page.eftpos-pay.text.interrupted"),
183
- warn: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, import_utils.locales.getText(
214
+ warn: `${import_utils.locales.getText(
184
215
  "page.eftpos-pay.text.transaction.eftpos.fail.title"
185
- ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
216
+ )}
217
+ ${import_utils.locales.getText(
186
218
  "page.eftpos-pay.text.transaction.eftpos.fail.power"
187
- ), ". ", /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
219
+ )}
220
+ ${import_utils.locales.getText(
188
221
  "page.eftpos-pay.text.transaction.eftpos.fail.device"
189
- ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
222
+ )}
223
+ ${import_utils.locales.getText(
190
224
  "page.eftpos-pay.text.transaction.eftpos.fail.network"
191
- ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
225
+ )}
226
+ ${import_utils.locales.getText(
192
227
  "page.eftpos-pay.text.transaction.eftpos.fail.if"
193
- )(mode))
228
+ )(modeRef.current)}
229
+ `
230
+ // warn: (
231
+ // <>
232
+ // {locales.getText(
233
+ // 'page.eftpos-pay.text.transaction.eftpos.fail.title'
234
+ // )}
235
+ // <br />
236
+ // {locales.getText(
237
+ // 'page.eftpos-pay.text.transaction.eftpos.fail.power'
238
+ // )}
239
+ // . <br />
240
+ // {locales.getText(
241
+ // 'page.eftpos-pay.text.transaction.eftpos.fail.device'
242
+ // )}
243
+ // <br />
244
+ // {locales.getText(
245
+ // 'page.eftpos-pay.text.transaction.eftpos.fail.network'
246
+ // )}
247
+ // <br />
248
+ // {locales.getText(
249
+ // 'page.eftpos-pay.text.transaction.eftpos.fail.if'
250
+ // )(modeRef.current)}
251
+ // </>
252
+ // ),
253
+ }
254
+ })
255
+ );
256
+ dispatch((0, import_store.updateComponent)("FailCustom"));
257
+ return;
258
+ }
259
+ if (code === import_const.PayStatus.PayBankRefuses) {
260
+ dispatch(
261
+ (0, import_store.updateCustom)({
262
+ failCustom: {
263
+ isPosNetworkError: false,
264
+ status: "fail",
265
+ fail: import_utils.locales.getText(
266
+ "page.eftpos-pay.text.transaction.back.declined.text"
267
+ ),
268
+ title: import_utils.locales.getText(
269
+ "page.eftpos-pay.text.transaction.back.declined.title"
270
+ ),
271
+ warn: null
272
+ }
273
+ })
274
+ );
275
+ dispatch((0, import_store.updateComponent)("FailCustom"));
276
+ return;
277
+ }
278
+ if (code === import_const.PayStatus.SignatureDeclined) {
279
+ dispatch(
280
+ (0, import_store.updateCustom)({
281
+ failCustom: {
282
+ isPosNetworkError: false,
283
+ status: "fail",
284
+ fail: import_utils.locales.getText(
285
+ "page.eftpos-pay.text.transaction.user.declined.text"
286
+ ),
287
+ title: import_utils.locales.getText(
288
+ "page.eftpos-pay.text.transaction.user.declined.title"
289
+ ),
290
+ warn: null
291
+ }
292
+ })
293
+ );
294
+ dispatch((0, import_store.updateComponent)("FailCustom"));
295
+ return;
296
+ }
297
+ if (code === import_const.PayStatus.UserConfigError) {
298
+ dispatch(
299
+ (0, import_store.updateCustom)({
300
+ failCustom: {
301
+ isPosNetworkError: false,
302
+ status: "fail",
303
+ fail: import_utils.locales.getText(
304
+ "page.eftpos-pay.text.transaction.user.config.text"
305
+ ),
306
+ title: import_utils.locales.getText(
307
+ "page.eftpos-pay.text.transaction.user.config.title"
308
+ ),
309
+ warn: null
194
310
  }
195
311
  })
196
312
  );
@@ -214,40 +330,30 @@ var useValidate = (check, num, onChange) => {
214
330
  const fail = useFail();
215
331
  const failRef = (0, import_react.useRef)(fail);
216
332
  const ref = (0, import_react.useRef)();
217
- const { custom, mode } = (0, import_store.useContextData)();
333
+ const { custom } = (0, import_store.useContextData)();
334
+ const { netRef, payRef, numRef, modeRef } = (0, import_hooks.useStoreRef)();
218
335
  const stepRef = (0, import_react.useRef)(custom == null ? void 0 : custom.step);
219
336
  const listRef = (0, import_react.useRef)(custom == null ? void 0 : custom.list);
220
- const numberRef = (0, import_react.useRef)(custom == null ? void 0 : custom.number);
221
- const payRef = (0, import_react.useRef)(custom == null ? void 0 : custom.pay);
222
- const netRef = (0, import_react.useRef)(custom == null ? void 0 : custom.net);
223
- const watchRef = (0, import_react.useRef)();
224
337
  (0, import_react.useEffect)(() => {
225
338
  listRef.current = custom == null ? void 0 : custom.list;
226
339
  }, [custom == null ? void 0 : custom.list]);
227
340
  (0, import_react.useEffect)(() => {
228
341
  stepRef.current = custom == null ? void 0 : custom.step;
229
342
  }, [custom == null ? void 0 : custom.step]);
230
- (0, import_react.useEffect)(() => {
231
- numberRef.current = custom == null ? void 0 : custom.number;
232
- }, [custom == null ? void 0 : custom.number]);
233
- (0, import_react.useEffect)(() => {
234
- console.log("custom?.net = ", custom);
235
- netRef.current = custom == null ? void 0 : custom.net;
236
- }, [custom == null ? void 0 : custom.net]);
237
- (0, import_react.useEffect)(() => {
238
- payRef.current = custom == null ? void 0 : custom.pay;
239
- }, [custom == null ? void 0 : custom.pay]);
343
+ const watchRef = (0, import_react.useRef)();
240
344
  const run = (0, import_react.useCallback)(
241
345
  (timeout) => {
242
346
  var _a, _b, _c;
347
+ if (timeout === -1) {
348
+ console.log("无限加载");
349
+ } else {
350
+ console.log("计时加载 ", typeof timeout === "number" ? timeout : num);
351
+ }
243
352
  if (unloadRef.current) {
244
353
  (_a = ref.current) == null ? void 0 : _a.close();
245
354
  return;
246
355
  }
247
- if (!watchRef.current) {
248
- return;
249
- }
250
- if (!netRef.current) {
356
+ if (!watchRef.current || !netRef.current) {
251
357
  return;
252
358
  }
253
359
  (_b = ref.current) == null ? void 0 : _b.close();
@@ -256,7 +362,7 @@ var useValidate = (check, num, onChange) => {
256
362
  timeout: typeof timeout === "number" ? timeout : num,
257
363
  callback: watchRef.current
258
364
  });
259
- (_c = ref.current) == null ? void 0 : _c.run({ number: numberRef.current }).then((res) => {
365
+ (_c = ref.current) == null ? void 0 : _c.run({ number: numRef.current }).then((res) => {
260
366
  if (unloadRef.current) {
261
367
  return;
262
368
  }
@@ -277,13 +383,17 @@ var useValidate = (check, num, onChange) => {
277
383
  if (res && res.code === -1) {
278
384
  return;
279
385
  }
280
- (_a2 = failRef.current) == null ? void 0 : _a2.call(failRef, res, stepRef.current >= 3);
386
+ (_a2 = failRef.current) == null ? void 0 : _a2.call(
387
+ failRef,
388
+ res,
389
+ stepRef.current >= import_const2.StepStatusEnum.Account
390
+ );
281
391
  });
282
392
  },
283
393
  [check, num]
284
394
  );
285
395
  (0, import_react.useEffect)(() => {
286
- watchRef.current = (res) => {
396
+ watchRef.current = (res, isRun) => {
287
397
  var _a, _b, _c, _d, _e, _f;
288
398
  if (unloadRef.current) {
289
399
  (_a = ref.current) == null ? void 0 : _a.close();
@@ -311,9 +421,11 @@ var useValidate = (check, num, onChange) => {
311
421
  });
312
422
  const nextStep = (0, import_const2.getStepMapping)(txn_status_id, {
313
423
  money: (_d = payRef.current) == null ? void 0 : _d.totalUnit,
314
- mode
424
+ mode: modeRef.current
315
425
  });
316
- current.push(nextStep);
426
+ if (nextStep) {
427
+ current.push(nextStep);
428
+ }
317
429
  dispatch((0, import_store.updateCustom)({ list: current, step: txn_status_id }));
318
430
  }
319
431
  onChange(res.data);
@@ -338,7 +450,7 @@ var useValidate = (check, num, onChange) => {
338
450
  });
339
451
  const nextStep = (0, import_const2.getStepMapping)(txn_status_id, {
340
452
  money: (_f = payRef.current) == null ? void 0 : _f.totalUnit,
341
- mode
453
+ mode: modeRef.current
342
454
  });
343
455
  if (nextStep) {
344
456
  current.push(nextStep);
@@ -351,13 +463,16 @@ var useValidate = (check, num, onChange) => {
351
463
  title: import_utils.locales.getText(
352
464
  "page.eftpos-pay.text.waiting.signature"
353
465
  )
354
- // 等待签名
355
466
  })
356
467
  );
357
468
  }
358
469
  }
359
470
  dispatch((0, import_store.updateCustom)({ list: current, step: txn_status_id }));
360
471
  txn_status_id === import_const2.StepStatusEnum.Receipt ? run(-1) : run();
472
+ return;
473
+ }
474
+ if (isRun) {
475
+ run();
361
476
  }
362
477
  };
363
478
  }, [dispatch, onChange, run]);
@@ -369,7 +484,7 @@ var useValidate = (check, num, onChange) => {
369
484
  },
370
485
  []
371
486
  );
372
- return [run, ref];
487
+ return [run, watchRef, ref];
373
488
  };
374
489
  // Annotate the CommonJS export names for ESM import in node:
375
490
  0 && (module.exports = {
@@ -1,8 +1,20 @@
1
1
  import React from 'react';
2
+ /**
3
+ * @title: 按钮操作区
4
+ * @description: 仅包含签名
5
+ * @Author: hongbing.wang
6
+ * @Date: 2024-08-20 12:33
7
+ */
2
8
  export declare const ReceiptAction: ({ api, onChange, }: {
3
9
  api: any;
4
10
  onChange: (status: boolean) => void;
5
11
  }) => React.JSX.Element;
12
+ /**
13
+ * @title: 按钮操作区
14
+ * @description: 不包含签名
15
+ * @Author: hongbing.wang
16
+ * @Date: 2024-08-20 12:32
17
+ */
6
18
  declare const Action: ({ index, onCancel, disabled, }: {
7
19
  index: number;
8
20
  onCancel: () => void;