@pisell/private-materials 3.0.96 → 3.0.98

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 (269) 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 +16 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +15 -8
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/addons/model.d.ts +1 -2
  13. package/es/components/booking/forms/forms.d.ts +1 -1
  14. package/es/components/booking/forms/index.d.ts +1 -1
  15. package/es/components/booking/forms/model.d.ts +1 -2
  16. package/es/components/booking/index.d.ts +1 -1
  17. package/es/components/booking/info/index.d.ts +1 -1
  18. package/es/components/booking/info/model.d.ts +1 -2
  19. package/es/components/booking/model.d.ts +1 -2
  20. package/es/components/booking/notes/index.d.ts +1 -1
  21. package/es/components/booking/notes/model.d.ts +1 -2
  22. package/es/components/booking/payments/index.d.ts +1 -1
  23. package/es/components/booking/payments/model.d.ts +1 -2
  24. package/es/components/eftpos/const.d.ts +38 -0
  25. package/es/components/eftpos/const.js +79 -0
  26. package/es/components/eftpos/device.d.ts +8 -0
  27. package/es/components/eftpos/device.js +33 -0
  28. package/es/components/eftpos/form/index.d.ts +16 -0
  29. package/es/components/eftpos/form/index.js +113 -0
  30. package/es/components/eftpos/index.d.ts +37 -0
  31. package/es/components/eftpos/index.js +274 -0
  32. package/es/components/eftpos/index.less +169 -0
  33. package/es/components/eftpos/locales.d.ts +87 -0
  34. package/es/components/eftpos/locales.js +110 -0
  35. package/es/components/eftpos/pos.d.ts +9 -0
  36. package/es/components/eftpos/pos.js +33 -0
  37. package/es/components/eftpos/surcharge/index.css +17 -0
  38. package/es/components/eftpos/surcharge/index.d.ts +8 -0
  39. package/es/components/eftpos/surcharge/index.js +111 -0
  40. package/es/components/eftpos/table.d.ts +17 -0
  41. package/es/components/eftpos/table.js +285 -0
  42. package/es/components/eftposPay/amount.d.ts +14 -0
  43. package/es/components/eftposPay/amount.js +252 -0
  44. package/es/components/eftposPay/component/alert/index.d.ts +6 -0
  45. package/es/components/eftposPay/component/alert/index.js +11 -0
  46. package/es/components/eftposPay/component/alert/index.less +29 -0
  47. package/es/components/eftposPay/component/alert/warn.d.ts +3 -0
  48. package/es/components/eftposPay/component/alert/warn.js +45 -0
  49. package/es/components/eftposPay/component/fail/failCustom.d.ts +4 -0
  50. package/es/components/eftposPay/component/fail/failCustom.js +99 -0
  51. package/es/components/eftposPay/component/fail/index.d.ts +4 -0
  52. package/es/components/eftposPay/component/fail/index.js +109 -0
  53. package/es/components/eftposPay/component/fail/network.d.ts +4 -0
  54. package/es/components/eftposPay/component/fail/network.js +48 -0
  55. package/es/components/eftposPay/component/fail/unknow.d.ts +4 -0
  56. package/es/components/eftposPay/component/fail/unknow.js +43 -0
  57. package/es/components/eftposPay/component/header/index.d.ts +9 -0
  58. package/es/components/eftposPay/component/header/index.js +66 -0
  59. package/es/components/eftposPay/component/header/index.less +44 -0
  60. package/es/components/eftposPay/component/header/titlebar.d.ts +13 -0
  61. package/es/components/eftposPay/component/header/titlebar.js +39 -0
  62. package/es/components/eftposPay/component/header/titlebar.less +17 -0
  63. package/es/components/eftposPay/component/manual/index.d.ts +5 -0
  64. package/es/components/eftposPay/component/manual/index.js +97 -0
  65. package/es/components/eftposPay/component/manual/index.less +109 -0
  66. package/es/components/eftposPay/component/signature/index.d.ts +4 -0
  67. package/es/components/eftposPay/component/signature/index.js +63 -0
  68. package/es/components/eftposPay/component/step/index.d.ts +12 -0
  69. package/es/components/eftposPay/component/step/index.js +31 -0
  70. package/es/components/eftposPay/component/step/step.d.ts +9 -0
  71. package/es/components/eftposPay/component/step/step.js +23 -0
  72. package/es/components/eftposPay/const.d.ts +132 -0
  73. package/es/components/eftposPay/const.js +48 -0
  74. package/es/components/eftposPay/device.d.ts +14 -0
  75. package/es/components/eftposPay/device.js +124 -0
  76. package/es/components/eftposPay/device.less +61 -0
  77. package/es/components/eftposPay/eftpos/config.d.ts +11 -0
  78. package/es/components/eftposPay/eftpos/config.js +178 -0
  79. package/es/components/eftposPay/eftpos/const.d.ts +10 -0
  80. package/es/components/eftposPay/eftpos/const.js +139 -0
  81. package/es/components/eftposPay/eftpos/index.d.ts +7 -0
  82. package/es/components/eftposPay/eftpos/index.js +35 -0
  83. package/es/components/eftposPay/helper.d.ts +3 -0
  84. package/es/components/eftposPay/helper.js +35 -0
  85. package/es/components/eftposPay/hooks.d.ts +4 -0
  86. package/es/components/eftposPay/hooks.js +153 -0
  87. package/es/components/eftposPay/index.d.ts +7 -0
  88. package/es/components/eftposPay/index.js +187 -0
  89. package/es/components/eftposPay/index.less +263 -0
  90. package/es/components/eftposPay/locales.d.ts +264 -0
  91. package/es/components/eftposPay/locales.js +384 -0
  92. package/es/components/eftposPay/manufacturer.d.ts +6 -0
  93. package/es/components/eftposPay/manufacturer.js +32 -0
  94. package/es/components/eftposPay/pay.d.ts +11 -0
  95. package/es/components/eftposPay/pay.js +110 -0
  96. package/es/components/eftposPay/payo/config.d.ts +11 -0
  97. package/es/components/eftposPay/payo/config.js +357 -0
  98. package/es/components/eftposPay/payo/const.d.ts +6 -0
  99. package/es/components/eftposPay/payo/const.js +93 -0
  100. package/es/components/eftposPay/payo/hooks.d.ts +5 -0
  101. package/es/components/eftposPay/payo/hooks.js +84 -0
  102. package/es/components/eftposPay/payo/index.d.ts +7 -0
  103. package/es/components/eftposPay/payo/index.js +35 -0
  104. package/es/components/eftposPay/store/index.d.ts +239 -0
  105. package/es/components/eftposPay/store/index.js +304 -0
  106. package/es/components/eftposPay/store/useThunkReducer.d.ts +9 -0
  107. package/es/components/eftposPay/store/useThunkReducer.js +31 -0
  108. package/es/components/eftposPay/var.less +9 -0
  109. package/es/components/eftposPay/windcave/action.d.ts +8 -0
  110. package/es/components/eftposPay/windcave/action.js +104 -0
  111. package/es/components/eftposPay/windcave/const.d.ts +104 -0
  112. package/es/components/eftposPay/windcave/const.js +253 -0
  113. package/es/components/eftposPay/windcave/helper.d.ts +9 -0
  114. package/es/components/eftposPay/windcave/helper.js +314 -0
  115. package/es/components/eftposPay/windcave/hook.d.ts +14 -0
  116. package/es/components/eftposPay/windcave/hook.js +144 -0
  117. package/es/components/eftposPay/windcave/index.d.ts +8 -0
  118. package/es/components/eftposPay/windcave/index.js +49 -0
  119. package/es/components/eftposPay/windcave/pos.d.ts +8 -0
  120. package/es/components/eftposPay/windcave/pos.js +180 -0
  121. package/es/components/eftposPay/windcave/pwd.d.ts +8 -0
  122. package/es/components/eftposPay/windcave/pwd.js +124 -0
  123. package/es/components/eftposPay/windcave/receipet.d.ts +6 -0
  124. package/es/components/eftposPay/windcave/receipet.js +67 -0
  125. package/es/components/eftposPay/windcave/receiptAction.d.ts +11 -0
  126. package/es/components/eftposPay/windcave/receiptAction.js +326 -0
  127. package/es/components/eftposPay/windcave/timer.d.ts +17 -0
  128. package/es/components/eftposPay/windcave/timer.js +181 -0
  129. package/es/components/eftposPay/windcave/wait.d.ts +12 -0
  130. package/es/components/eftposPay/windcave/wait.js +139 -0
  131. package/es/components/eftposPay/windcave/windcave.d.ts +6 -0
  132. package/es/components/eftposPay/windcave/windcave.js +283 -0
  133. package/es/components/schedules/index.d.ts +1 -1
  134. package/es/components/schedules/model.d.ts +1 -2
  135. package/es/hooks/usePrefix.d.ts +1 -0
  136. package/es/hooks/usePrefix.js +10 -0
  137. package/es/index.d.ts +2 -0
  138. package/es/index.js +3 -1
  139. package/lib/components/booking/addons/index.d.ts +1 -1
  140. package/lib/components/booking/addons/model.d.ts +1 -2
  141. package/lib/components/booking/forms/forms.d.ts +1 -1
  142. package/lib/components/booking/forms/index.d.ts +1 -1
  143. package/lib/components/booking/forms/model.d.ts +1 -2
  144. package/lib/components/booking/index.d.ts +1 -1
  145. package/lib/components/booking/info/index.d.ts +1 -1
  146. package/lib/components/booking/info/model.d.ts +1 -2
  147. package/lib/components/booking/model.d.ts +1 -2
  148. package/lib/components/booking/notes/index.d.ts +1 -1
  149. package/lib/components/booking/notes/model.d.ts +1 -2
  150. package/lib/components/booking/payments/index.d.ts +1 -1
  151. package/lib/components/booking/payments/model.d.ts +1 -2
  152. package/lib/components/eftpos/const.d.ts +38 -0
  153. package/lib/components/eftpos/const.js +108 -0
  154. package/lib/components/eftpos/device.d.ts +8 -0
  155. package/lib/components/eftpos/device.js +55 -0
  156. package/lib/components/eftpos/form/index.d.ts +16 -0
  157. package/lib/components/eftpos/form/index.js +124 -0
  158. package/lib/components/eftpos/index.d.ts +37 -0
  159. package/lib/components/eftpos/index.js +279 -0
  160. package/lib/components/eftpos/index.less +169 -0
  161. package/lib/components/eftpos/locales.d.ts +87 -0
  162. package/lib/components/eftpos/locales.js +128 -0
  163. package/lib/components/eftpos/pos.d.ts +9 -0
  164. package/lib/components/eftpos/pos.js +55 -0
  165. package/lib/components/eftpos/surcharge/index.css +17 -0
  166. package/lib/components/eftpos/surcharge/index.d.ts +8 -0
  167. package/lib/components/eftpos/surcharge/index.js +125 -0
  168. package/lib/components/eftpos/table.d.ts +17 -0
  169. package/lib/components/eftpos/table.js +260 -0
  170. package/lib/components/eftposPay/amount.d.ts +14 -0
  171. package/lib/components/eftposPay/amount.js +238 -0
  172. package/lib/components/eftposPay/component/alert/index.d.ts +6 -0
  173. package/lib/components/eftposPay/component/alert/index.js +38 -0
  174. package/lib/components/eftposPay/component/alert/index.less +29 -0
  175. package/lib/components/eftposPay/component/alert/warn.d.ts +3 -0
  176. package/lib/components/eftposPay/component/alert/warn.js +80 -0
  177. package/lib/components/eftposPay/component/fail/failCustom.d.ts +4 -0
  178. package/lib/components/eftposPay/component/fail/failCustom.js +120 -0
  179. package/lib/components/eftposPay/component/fail/index.d.ts +4 -0
  180. package/lib/components/eftposPay/component/fail/index.js +124 -0
  181. package/lib/components/eftposPay/component/fail/network.d.ts +4 -0
  182. package/lib/components/eftposPay/component/fail/network.js +65 -0
  183. package/lib/components/eftposPay/component/fail/unknow.d.ts +4 -0
  184. package/lib/components/eftposPay/component/fail/unknow.js +72 -0
  185. package/lib/components/eftposPay/component/header/index.d.ts +9 -0
  186. package/lib/components/eftposPay/component/header/index.js +92 -0
  187. package/lib/components/eftposPay/component/header/index.less +44 -0
  188. package/lib/components/eftposPay/component/header/titlebar.d.ts +13 -0
  189. package/lib/components/eftposPay/component/header/titlebar.js +55 -0
  190. package/lib/components/eftposPay/component/header/titlebar.less +17 -0
  191. package/lib/components/eftposPay/component/manual/index.d.ts +5 -0
  192. package/lib/components/eftposPay/component/manual/index.js +113 -0
  193. package/lib/components/eftposPay/component/manual/index.less +109 -0
  194. package/lib/components/eftposPay/component/signature/index.d.ts +4 -0
  195. package/lib/components/eftposPay/component/signature/index.js +80 -0
  196. package/lib/components/eftposPay/component/step/index.d.ts +12 -0
  197. package/lib/components/eftposPay/component/step/index.js +71 -0
  198. package/lib/components/eftposPay/component/step/step.d.ts +9 -0
  199. package/lib/components/eftposPay/component/step/step.js +59 -0
  200. package/lib/components/eftposPay/const.d.ts +132 -0
  201. package/lib/components/eftposPay/const.js +86 -0
  202. package/lib/components/eftposPay/device.d.ts +14 -0
  203. package/lib/components/eftposPay/device.js +127 -0
  204. package/lib/components/eftposPay/device.less +61 -0
  205. package/lib/components/eftposPay/eftpos/config.d.ts +11 -0
  206. package/lib/components/eftposPay/eftpos/config.js +199 -0
  207. package/lib/components/eftposPay/eftpos/const.d.ts +10 -0
  208. package/lib/components/eftposPay/eftpos/const.js +165 -0
  209. package/lib/components/eftposPay/eftpos/index.d.ts +7 -0
  210. package/lib/components/eftposPay/eftpos/index.js +66 -0
  211. package/lib/components/eftposPay/helper.d.ts +3 -0
  212. package/lib/components/eftposPay/helper.js +62 -0
  213. package/lib/components/eftposPay/hooks.d.ts +4 -0
  214. package/lib/components/eftposPay/hooks.js +237 -0
  215. package/lib/components/eftposPay/index.d.ts +7 -0
  216. package/lib/components/eftposPay/index.js +193 -0
  217. package/lib/components/eftposPay/index.less +263 -0
  218. package/lib/components/eftposPay/locales.d.ts +264 -0
  219. package/lib/components/eftposPay/locales.js +304 -0
  220. package/lib/components/eftposPay/manufacturer.d.ts +6 -0
  221. package/lib/components/eftposPay/manufacturer.js +77 -0
  222. package/lib/components/eftposPay/pay.d.ts +11 -0
  223. package/lib/components/eftposPay/pay.js +122 -0
  224. package/lib/components/eftposPay/payo/config.d.ts +11 -0
  225. package/lib/components/eftposPay/payo/config.js +377 -0
  226. package/lib/components/eftposPay/payo/const.d.ts +6 -0
  227. package/lib/components/eftposPay/payo/const.js +112 -0
  228. package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
  229. package/lib/components/eftposPay/payo/hooks.js +80 -0
  230. package/lib/components/eftposPay/payo/index.d.ts +7 -0
  231. package/lib/components/eftposPay/payo/index.js +63 -0
  232. package/lib/components/eftposPay/store/index.d.ts +239 -0
  233. package/lib/components/eftposPay/store/index.js +371 -0
  234. package/lib/components/eftposPay/store/useThunkReducer.d.ts +9 -0
  235. package/lib/components/eftposPay/store/useThunkReducer.js +53 -0
  236. package/lib/components/eftposPay/var.less +9 -0
  237. package/lib/components/eftposPay/windcave/action.d.ts +8 -0
  238. package/lib/components/eftposPay/windcave/action.js +143 -0
  239. package/lib/components/eftposPay/windcave/const.d.ts +104 -0
  240. package/lib/components/eftposPay/windcave/const.js +300 -0
  241. package/lib/components/eftposPay/windcave/helper.d.ts +9 -0
  242. package/lib/components/eftposPay/windcave/helper.js +378 -0
  243. package/lib/components/eftposPay/windcave/hook.d.ts +14 -0
  244. package/lib/components/eftposPay/windcave/hook.js +139 -0
  245. package/lib/components/eftposPay/windcave/index.d.ts +8 -0
  246. package/lib/components/eftposPay/windcave/index.js +78 -0
  247. package/lib/components/eftposPay/windcave/pos.d.ts +8 -0
  248. package/lib/components/eftposPay/windcave/pos.js +197 -0
  249. package/lib/components/eftposPay/windcave/pwd.d.ts +8 -0
  250. package/lib/components/eftposPay/windcave/pwd.js +143 -0
  251. package/lib/components/eftposPay/windcave/receipet.d.ts +6 -0
  252. package/lib/components/eftposPay/windcave/receipet.js +93 -0
  253. package/lib/components/eftposPay/windcave/receiptAction.d.ts +11 -0
  254. package/lib/components/eftposPay/windcave/receiptAction.js +386 -0
  255. package/lib/components/eftposPay/windcave/timer.d.ts +17 -0
  256. package/lib/components/eftposPay/windcave/timer.js +126 -0
  257. package/lib/components/eftposPay/windcave/wait.d.ts +12 -0
  258. package/lib/components/eftposPay/windcave/wait.js +163 -0
  259. package/lib/components/eftposPay/windcave/windcave.d.ts +6 -0
  260. package/lib/components/eftposPay/windcave/windcave.js +283 -0
  261. package/lib/components/schedules/index.d.ts +1 -1
  262. package/lib/components/schedules/model.d.ts +1 -2
  263. package/lib/hooks/usePrefix.d.ts +1 -0
  264. package/lib/hooks/usePrefix.js +44 -0
  265. package/lib/index.d.ts +2 -0
  266. package/lib/index.js +6 -0
  267. package/lowcode/eftpos/meta.ts +187 -0
  268. package/lowcode/eftpos-pay/meta.ts +122 -0
  269. package/package.json +4 -3
@@ -0,0 +1,377 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/eftposPay/payo/config.tsx
30
+ var config_exports = {};
31
+ __export(config_exports, {
32
+ Action: () => Action,
33
+ POS: () => POS
34
+ });
35
+ module.exports = __toCommonJS(config_exports);
36
+ var import_utils = require("@pisell/utils");
37
+ var import_antd = require("antd");
38
+ var import_react = __toESM(require("react"));
39
+ var import_decimal = require("decimal.js");
40
+ var import_step = __toESM(require("../component/step"));
41
+ var import_const = require("../const");
42
+ var import_helper = require("../helper");
43
+ var import_hooks = require("../hooks");
44
+ var import_store = require("../store");
45
+ var import_hooks2 = require("./hooks");
46
+ var POS = ({
47
+ api,
48
+ onChange
49
+ }) => {
50
+ var _a, _b;
51
+ const { steps, eftpos, device, custom, status, mode } = (0, import_store.useContextData)();
52
+ const refundRef = (0, import_react.useRef)(
53
+ custom == null ? void 0 : custom.refund
54
+ );
55
+ const statusRef = (0, import_react.useRef)(status);
56
+ const dispatch = (0, import_store.useDispatch)();
57
+ const { key, ...props } = steps[0];
58
+ const modeRef = (0, import_react.useRef)(mode);
59
+ const ref = (0, import_react.useRef)(custom == null ? void 0 : custom.number);
60
+ const customRef = (0, import_react.useRef)(custom);
61
+ const deviceRef = (0, import_react.useRef)(device);
62
+ const stepStatusRef = (0, import_react.useRef)((_a = props == null ? void 0 : props.custom) == null ? void 0 : _a.status);
63
+ const fail = (0, import_hooks.useFail)(0, true);
64
+ const failRef = (0, import_react.useRef)(fail);
65
+ const controllerRef = (0, import_react.useRef)();
66
+ const clearRef = (0, import_react.useRef)();
67
+ const initRef = (0, import_react.useRef)(false);
68
+ const unloadRef = (0, import_react.useRef)(false);
69
+ const netRef = (0, import_react.useRef)(custom == null ? void 0 : custom.net);
70
+ const [check] = (0, import_hooks2.useValidate)(1e3 * 60);
71
+ (0, import_react.useEffect)(() => {
72
+ customRef.current = custom;
73
+ }, [custom]);
74
+ (0, import_react.useEffect)(() => {
75
+ deviceRef.current = device;
76
+ }, [device]);
77
+ (0, import_react.useEffect)(() => {
78
+ modeRef.current = mode;
79
+ }, [mode]);
80
+ (0, import_react.useEffect)(() => {
81
+ refundRef.current = custom == null ? void 0 : custom.refund;
82
+ }, [custom == null ? void 0 : custom.refund]);
83
+ (0, import_react.useEffect)(() => {
84
+ statusRef.current = status;
85
+ }, [status]);
86
+ (0, import_react.useEffect)(() => {
87
+ netRef.current = custom == null ? void 0 : custom.net;
88
+ }, [custom == null ? void 0 : custom.net]);
89
+ (0, import_react.useEffect)(() => {
90
+ var _a2;
91
+ stepStatusRef.current = (_a2 = props == null ? void 0 : props.custom) == null ? void 0 : _a2.status;
92
+ }, [(_b = props == null ? void 0 : props.custom) == null ? void 0 : _b.status]);
93
+ (0, import_react.useEffect)(() => {
94
+ failRef.current = fail;
95
+ }, [fail]);
96
+ (0, import_react.useEffect)(() => {
97
+ var _a2, _b2, _c;
98
+ if (initRef.current) {
99
+ return;
100
+ }
101
+ initRef.current = true;
102
+ if (statusRef.current !== import_const.StatusEnum.Loading) {
103
+ return;
104
+ }
105
+ if (!ref.current) {
106
+ const { pay, order_id } = customRef.current;
107
+ ref.current = (0, import_helper.getUuid)();
108
+ dispatch(
109
+ (0, import_store.updateState)({
110
+ custom: { ...customRef.current, number: ref.current }
111
+ })
112
+ );
113
+ if (api && api.pay) {
114
+ controllerRef.current = new AbortController();
115
+ let clear;
116
+ const resultPromise = modeRef.current === import_const.ModeEnum.Pay ? api.pay(
117
+ {
118
+ order_id,
119
+ amount: pay.total,
120
+ card_reader_type: eftpos,
121
+ card_reader_id: (_a2 = deviceRef.current) == null ? void 0 : _a2.id,
122
+ number: ref.current
123
+ },
124
+ { signal: controllerRef.current.signal }
125
+ ) : api.refund(
126
+ {
127
+ order_id,
128
+ amount: (_b2 = refundRef.current) == null ? void 0 : _b2.total,
129
+ card_reader_type: eftpos,
130
+ card_reader_id: (_c = deviceRef.current) == null ? void 0 : _c.id,
131
+ number: ref.current
132
+ },
133
+ { signal: controllerRef.current.signal }
134
+ );
135
+ resultPromise.then((res) => {
136
+ var _a3;
137
+ console.log("netRef.current = ", netRef.current);
138
+ if (unloadRef.current) {
139
+ return;
140
+ }
141
+ if (!((_a3 = customRef.current) == null ? void 0 : _a3.net)) {
142
+ return;
143
+ }
144
+ if (res && (res.code === 200 || res.code === "200")) {
145
+ dispatch(
146
+ (0, import_store.updateCurrentCustomStemItem)({
147
+ status: "pay"
148
+ })
149
+ );
150
+ return res;
151
+ }
152
+ if (res && `${res.code}` === import_const.PayStatus.Timeout) {
153
+ dispatch(
154
+ (0, import_store.updateCurrentCustomStemItem)({
155
+ status: "pay"
156
+ })
157
+ );
158
+ }
159
+ return Promise.reject(res);
160
+ }).then(
161
+ (res) => {
162
+ var _a3;
163
+ console.log("netRef.current = ", netRef.current);
164
+ if (unloadRef.current) {
165
+ return;
166
+ }
167
+ if (!((_a3 = customRef.current) == null ? void 0 : _a3.net)) {
168
+ return;
169
+ }
170
+ dispatch((0, import_store.updateNextStep)());
171
+ clear = setTimeout(() => {
172
+ var _a4, _b3;
173
+ if (modeRef.current === import_const.ModeEnum.Pay) {
174
+ const obj = ((_a4 = customRef.current) == null ? void 0 : _a4.pay) || {};
175
+ const cardReaderSurcharge = ((_b3 = res == null ? void 0 : res.data) == null ? void 0 : _b3.card_reader_surcharge) || 0;
176
+ const surCardDeci = new import_decimal.Decimal(Number(cardReaderSurcharge));
177
+ const surMoneyDeci = new import_decimal.Decimal(Number((obj == null ? void 0 : obj.surMoney) || 0));
178
+ const surRateMoneyDeci = new import_decimal.Decimal(
179
+ Number(obj == null ? void 0 : obj.surRateMoney)
180
+ );
181
+ const surMoneyTotal = surMoneyDeci.add(surCardDeci);
182
+ const surchargeDeci = surMoneyTotal.add(surRateMoneyDeci);
183
+ onChange("success", {
184
+ ...obj,
185
+ number: ref.current,
186
+ device: deviceRef.current,
187
+ cardReaderSurcharge,
188
+ surMoney: surMoneyTotal.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
189
+ surcharge: surchargeDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP)
190
+ });
191
+ return;
192
+ }
193
+ if (modeRef.current === import_const.ModeEnum.Refund) {
194
+ const obj = refundRef.current || {};
195
+ onChange("success", {
196
+ ...obj,
197
+ number: ref.current,
198
+ device: deviceRef.current
199
+ });
200
+ return;
201
+ }
202
+ onChange("success", { number: ref.current });
203
+ }, 1e3);
204
+ },
205
+ (res) => Promise.reject(res)
206
+ ).catch((res) => {
207
+ var _a3;
208
+ console.log("netRef.current = ", netRef.current);
209
+ if (unloadRef.current) {
210
+ return;
211
+ }
212
+ if (!((_a3 = customRef.current) == null ? void 0 : _a3.net)) {
213
+ return;
214
+ }
215
+ if (res && `${res.code}` === import_const.PayStatus.Timeout) {
216
+ check(api.check, ref.current).then(
217
+ (r) => {
218
+ var _a4;
219
+ console.log(" check :检车2 ,r ", r);
220
+ if (unloadRef.current) {
221
+ return;
222
+ }
223
+ if (!((_a4 = customRef.current) == null ? void 0 : _a4.net)) {
224
+ return;
225
+ }
226
+ if (r && (r.code === 200 || r.code === "200")) {
227
+ dispatch(
228
+ (0, import_store.updateCurrentCustomStemItem)({
229
+ status: "pay"
230
+ })
231
+ );
232
+ dispatch((0, import_store.updateNextStep)());
233
+ clearRef.current = setTimeout(() => {
234
+ var _a5, _b3;
235
+ const cardReaderSurcharge = ((_a5 = res == null ? void 0 : res.data) == null ? void 0 : _a5.card_reader_surcharge) || 0;
236
+ const obj = ((_b3 = customRef.current) == null ? void 0 : _b3.pay) || {};
237
+ const surCardDeci = new import_decimal.Decimal(
238
+ Number(cardReaderSurcharge)
239
+ );
240
+ const surMoneyDeci = new import_decimal.Decimal(
241
+ Number((obj == null ? void 0 : obj.surMoney) || 0)
242
+ );
243
+ const surRateMoneyDeci = new import_decimal.Decimal(
244
+ Number(obj == null ? void 0 : obj.surRateMoney)
245
+ );
246
+ const surMoneyTotal = surMoneyDeci.add(surCardDeci);
247
+ const surchargeDeci = surMoneyTotal.add(surRateMoneyDeci);
248
+ onChange("success", {
249
+ ...obj,
250
+ number: ref.current,
251
+ device: deviceRef.current,
252
+ cardReaderSurcharge,
253
+ surMoney: surMoneyTotal.toFixed(
254
+ 2,
255
+ import_decimal.Decimal.ROUND_HALF_UP
256
+ ),
257
+ surcharge: surchargeDeci.toFixed(
258
+ 2,
259
+ import_decimal.Decimal.ROUND_HALF_UP
260
+ )
261
+ });
262
+ }, 1e3);
263
+ return;
264
+ }
265
+ failRef.current(r);
266
+ },
267
+ (r) => {
268
+ var _a4;
269
+ if (unloadRef.current) {
270
+ return;
271
+ }
272
+ if (!((_a4 = customRef.current) == null ? void 0 : _a4.net)) {
273
+ return;
274
+ }
275
+ failRef.current(r);
276
+ }
277
+ );
278
+ } else {
279
+ failRef.current(res);
280
+ }
281
+ });
282
+ }
283
+ } else {
284
+ check(api.check, ref.current).then(
285
+ (res) => {
286
+ var _a3;
287
+ console.log(" check 检车 ,r ", res);
288
+ if (unloadRef.current) {
289
+ return;
290
+ }
291
+ if (!((_a3 = customRef.current) == null ? void 0 : _a3.net)) {
292
+ return;
293
+ }
294
+ if (res && (res.code === 200 || res.code === "200")) {
295
+ dispatch(
296
+ (0, import_store.updateCurrentCustomStemItem)({
297
+ status: "pay"
298
+ })
299
+ );
300
+ dispatch((0, import_store.updateNextStep)());
301
+ clearRef.current = setTimeout(() => {
302
+ var _a4, _b3;
303
+ const cardReaderSurcharge = ((_a4 = res == null ? void 0 : res.data) == null ? void 0 : _a4.card_reader_surcharge) || 0;
304
+ const obj = ((_b3 = customRef.current) == null ? void 0 : _b3.pay) || {};
305
+ const surCardDeci = new import_decimal.Decimal(Number(cardReaderSurcharge));
306
+ const surMoneyDeci = new import_decimal.Decimal(Number((obj == null ? void 0 : obj.surMoney) || 0));
307
+ const surRateMoneyDeci = new import_decimal.Decimal(Number(obj == null ? void 0 : obj.surRateMoney));
308
+ const surMoneyTotal = surMoneyDeci.add(surCardDeci);
309
+ const surchargeDeci = surMoneyTotal.add(surRateMoneyDeci);
310
+ onChange("success", {
311
+ ...obj,
312
+ number: ref.current,
313
+ device: deviceRef.current,
314
+ cardReaderSurcharge,
315
+ surMoney: surMoneyTotal.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP),
316
+ surcharge: surchargeDeci.toFixed(2, import_decimal.Decimal.ROUND_HALF_UP)
317
+ });
318
+ }, 1e3);
319
+ return;
320
+ }
321
+ failRef.current(res);
322
+ },
323
+ (res) => {
324
+ var _a3;
325
+ if (unloadRef.current) {
326
+ return;
327
+ }
328
+ if (!((_a3 = customRef.current) == null ? void 0 : _a3.net)) {
329
+ return;
330
+ }
331
+ failRef.current(res);
332
+ }
333
+ );
334
+ }
335
+ }, [api, check, dispatch, eftpos, onChange]);
336
+ (0, import_react.useEffect)(
337
+ () => () => {
338
+ var _a2;
339
+ (_a2 = controllerRef.current) == null ? void 0 : _a2.abort();
340
+ unloadRef.current = true;
341
+ if (clearRef.current) {
342
+ clearTimeout(clearRef.current);
343
+ }
344
+ },
345
+ []
346
+ );
347
+ return /* @__PURE__ */ import_react.default.createElement(import_step.default, { ...props });
348
+ };
349
+ var Action = () => {
350
+ const dispatch = (0, import_store.useDispatch)();
351
+ const { mode } = (0, import_store.useContextData)();
352
+ const onManually = () => {
353
+ dispatch(
354
+ (0, import_store.updateState)({
355
+ manual: {
356
+ title: import_utils.locales.getText("page.eftpos-pay.text.request.title")(mode),
357
+ text: import_utils.locales.getText("page.eftpos-pay.text.request.text")(mode)
358
+ }
359
+ })
360
+ );
361
+ dispatch((0, import_store.updateComponent)("Manual", true));
362
+ };
363
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
364
+ import_antd.Button,
365
+ {
366
+ block: true,
367
+ className: "pisell-lowcode__eft-pay-step-item-btn",
368
+ onClick: onManually
369
+ },
370
+ import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
371
+ ));
372
+ };
373
+ // Annotate the CommonJS export names for ESM import in node:
374
+ 0 && (module.exports = {
375
+ Action,
376
+ POS
377
+ });
@@ -0,0 +1,6 @@
1
+ import { Amount, ModeEnum } from '../const';
2
+ import { State } from '../store';
3
+ export declare const getStep: (mode?: ModeEnum) => State['steps'];
4
+ declare const getInitState: (params: any) => State;
5
+ export default getInitState;
6
+ export declare function getAmonunt(store: State): Amount;
@@ -0,0 +1,112 @@
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/payo/const.ts
20
+ var const_exports = {};
21
+ __export(const_exports, {
22
+ default: () => const_default,
23
+ getAmonunt: () => getAmonunt,
24
+ getStep: () => getStep
25
+ });
26
+ module.exports = __toCommonJS(const_exports);
27
+ var import_utils = require("@pisell/utils");
28
+ var import_const = require("../const");
29
+ var getStep = (mode = import_const.ModeEnum.Pay) => [
30
+ {
31
+ key: Date.now(),
32
+ title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
33
+ // 'Payment in process...',
34
+ text: import_utils.locales.getText("page.eftpos-pay.text.waiting.processing"),
35
+ // 'Waiting for the processing...',
36
+ warn: "",
37
+ tip: import_utils.locales.getText("page.eftpos-pay.text.processing"),
38
+ // 'processing...',
39
+ status: import_const.StatusEnum.Loading
40
+ }
41
+ ];
42
+ var getInitState = (params) => ({
43
+ mode: (params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay,
44
+ eftpos: import_const.EftposEnum.Payo,
45
+ key: Date.now(),
46
+ warn: import_utils.locales.getText("page.eftpos-pay.text.waiting.pay")((params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay),
47
+ // 'If you have confirmed the payment status from the PoS, you can press Manual marking buttonto skip.',
48
+ step: 0,
49
+ type: import_const.PayRouteEnum.Step,
50
+ title: import_utils.locales.getText("page.eftpos-pay.text.loading")((params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay),
51
+ // 'Payment in process...',
52
+ component: "",
53
+ status: import_const.StatusEnum.Loading,
54
+ steps: getStep((params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay),
55
+ custom: params,
56
+ render: true,
57
+ ...params.device ? { device: params.device } : {}
58
+ });
59
+ var const_default = getInitState;
60
+ function getAmonunt(store) {
61
+ const { device, custom } = store;
62
+ if (!device || !custom) {
63
+ throw Error("device or custom is not defined");
64
+ }
65
+ const name = custom.name;
66
+ const symbol = custom.symbol;
67
+ const money = custom.amount;
68
+ const pay = custom.pay;
69
+ const setting = device.setting;
70
+ if (pay) {
71
+ return {
72
+ name,
73
+ symbol,
74
+ // format,
75
+ money,
76
+ amount: Number(pay.amount),
77
+ surRate: Number(pay.surRate),
78
+ surMoney: Number(pay.surMoney),
79
+ surcharge: (setting == null ? void 0 : setting.surcharge) || false
80
+ };
81
+ }
82
+ if (!setting) {
83
+ return {
84
+ name,
85
+ symbol,
86
+ // format,
87
+ money,
88
+ amount: money,
89
+ surRate: 0,
90
+ surMoney: 0,
91
+ surcharge: false
92
+ };
93
+ }
94
+ const surRate = setting.constant_rate || 0;
95
+ const surMoney = setting.constant_money || 0;
96
+ const surcharge = setting.surcharge;
97
+ return {
98
+ name,
99
+ symbol,
100
+ // format,
101
+ money,
102
+ amount: money,
103
+ surRate: surcharge ? surRate : 0,
104
+ surMoney: surcharge ? surMoney : 0,
105
+ surcharge
106
+ };
107
+ }
108
+ // Annotate the CommonJS export names for ESM import in node:
109
+ 0 && (module.exports = {
110
+ getAmonunt,
111
+ getStep
112
+ });
@@ -0,0 +1,5 @@
1
+ import { PayStatus } from '../const';
2
+ export declare const useValidate: (timeout: number) => readonly [(params_0: (...agrn: unknown[]) => Promise<any>, params_1: number, params_2?: number | undefined) => Promise<{
3
+ [key: string]: unknown;
4
+ code: `${PayStatus}`;
5
+ }>, () => void];
@@ -0,0 +1,80 @@
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/payo/hooks.tsx
20
+ var hooks_exports = {};
21
+ __export(hooks_exports, {
22
+ useValidate: () => useValidate
23
+ });
24
+ module.exports = __toCommonJS(hooks_exports);
25
+ var import_react = require("react");
26
+ var import_const = require("../const");
27
+ var import_helper = require("../helper");
28
+ var useValidate = (timeout) => {
29
+ const controllerRef = (0, import_react.useRef)();
30
+ const ref = (0, import_react.useRef)(true);
31
+ const TimeoutRef = (0, import_react.useRef)();
32
+ const checkApi = (0, import_react.useCallback)(
33
+ async (check, number, time) => {
34
+ time = time || 5e3;
35
+ controllerRef.current = new AbortController();
36
+ let res = {
37
+ code: import_const.PayStatus.Timeout
38
+ };
39
+ console.log("循环开始前...");
40
+ while (ref.current && res && (`${res.code}` === import_const.PayStatus.Timeout || `${res.code}` === import_const.PayStatus.PayTimeout)) {
41
+ const start = Date.now();
42
+ res = await check(
43
+ { number },
44
+ { signal: controllerRef.current.signal }
45
+ ).catch((err) => Promise.resolve(err));
46
+ const diff = Date.now() - start;
47
+ console.log(diff, time, time - diff, "diff", res);
48
+ if (diff < time) {
49
+ await (0, import_helper.sleep)(time - diff);
50
+ }
51
+ }
52
+ return res;
53
+ },
54
+ []
55
+ );
56
+ const close = (0, import_react.useCallback)(() => {
57
+ var _a;
58
+ ref.current = false;
59
+ (_a = controllerRef.current) == null ? void 0 : _a.abort();
60
+ }, []);
61
+ const run = (...params) => {
62
+ TimeoutRef.current && clearTimeout(TimeoutRef.current);
63
+ TimeoutRef.current = setTimeout(() => {
64
+ close();
65
+ }, timeout);
66
+ return checkApi(...params);
67
+ };
68
+ (0, import_react.useEffect)(
69
+ () => () => {
70
+ clearTimeout(TimeoutRef.current);
71
+ close();
72
+ },
73
+ [close]
74
+ );
75
+ return [run, close];
76
+ };
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ useValidate
80
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare const _default: ({ api, onChange, children, }: {
3
+ api: any;
4
+ onChange: any;
5
+ children: React.ReactNode;
6
+ }) => React.JSX.Element;
7
+ export default _default;
@@ -0,0 +1,63 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/eftposPay/payo/index.tsx
30
+ var payo_exports = {};
31
+ __export(payo_exports, {
32
+ default: () => payo_default
33
+ });
34
+ module.exports = __toCommonJS(payo_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_const = require("../const");
37
+ var import_store = require("../store");
38
+ var import_config = require("./config");
39
+ var payo_default = ({
40
+ api,
41
+ onChange,
42
+ children
43
+ }) => {
44
+ const { step, steps, ...data } = (0, import_store.useContextData)();
45
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-body " }, steps.map((item, idx) => {
46
+ let Comm;
47
+ if (idx === 0)
48
+ Comm = import_config.POS;
49
+ if (!Comm) {
50
+ throw new Error("no comm");
51
+ }
52
+ if (step >= idx) {
53
+ return /* @__PURE__ */ import_react.default.createElement(
54
+ Comm,
55
+ {
56
+ key: `${data.key}-${item.key}-${idx}`,
57
+ api,
58
+ onChange
59
+ }
60
+ );
61
+ }
62
+ }), children), data.status !== import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement(import_config.Action, null) : null);
63
+ };