@pisell/private-materials 3.0.96 → 3.0.97

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 (267) 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 +30 -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 +153 -0
  33. package/es/components/eftpos/locales.d.ts +75 -0
  34. package/es/components/eftpos/locales.js +98 -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 +236 -0
  42. package/es/components/eftposPay/amount.d.ts +14 -0
  43. package/es/components/eftposPay/amount.js +253 -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 +95 -0
  51. package/es/components/eftposPay/component/fail/index.d.ts +4 -0
  52. package/es/components/eftposPay/component/fail/index.js +105 -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 +91 -0
  65. package/es/components/eftposPay/component/manual/index.less +96 -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 +131 -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 +188 -0
  89. package/es/components/eftposPay/index.less +273 -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 +10 -0
  95. package/es/components/eftposPay/pay.js +108 -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/windcave/action.d.ts +8 -0
  109. package/es/components/eftposPay/windcave/action.js +104 -0
  110. package/es/components/eftposPay/windcave/const.d.ts +104 -0
  111. package/es/components/eftposPay/windcave/const.js +253 -0
  112. package/es/components/eftposPay/windcave/helper.d.ts +9 -0
  113. package/es/components/eftposPay/windcave/helper.js +314 -0
  114. package/es/components/eftposPay/windcave/hook.d.ts +14 -0
  115. package/es/components/eftposPay/windcave/hook.js +144 -0
  116. package/es/components/eftposPay/windcave/index.d.ts +8 -0
  117. package/es/components/eftposPay/windcave/index.js +49 -0
  118. package/es/components/eftposPay/windcave/pos.d.ts +8 -0
  119. package/es/components/eftposPay/windcave/pos.js +180 -0
  120. package/es/components/eftposPay/windcave/pwd.d.ts +8 -0
  121. package/es/components/eftposPay/windcave/pwd.js +124 -0
  122. package/es/components/eftposPay/windcave/receipet.d.ts +6 -0
  123. package/es/components/eftposPay/windcave/receipet.js +67 -0
  124. package/es/components/eftposPay/windcave/receiptAction.d.ts +11 -0
  125. package/es/components/eftposPay/windcave/receiptAction.js +326 -0
  126. package/es/components/eftposPay/windcave/timer.d.ts +17 -0
  127. package/es/components/eftposPay/windcave/timer.js +181 -0
  128. package/es/components/eftposPay/windcave/wait.d.ts +12 -0
  129. package/es/components/eftposPay/windcave/wait.js +139 -0
  130. package/es/components/eftposPay/windcave/windcave.d.ts +6 -0
  131. package/es/components/eftposPay/windcave/windcave.js +283 -0
  132. package/es/components/schedules/index.d.ts +1 -1
  133. package/es/components/schedules/model.d.ts +1 -2
  134. package/es/hooks/usePrefix.d.ts +1 -0
  135. package/es/hooks/usePrefix.js +10 -0
  136. package/es/index.d.ts +2 -0
  137. package/es/index.js +3 -1
  138. package/lib/components/booking/addons/index.d.ts +1 -1
  139. package/lib/components/booking/addons/model.d.ts +1 -2
  140. package/lib/components/booking/forms/forms.d.ts +1 -1
  141. package/lib/components/booking/forms/index.d.ts +1 -1
  142. package/lib/components/booking/forms/model.d.ts +1 -2
  143. package/lib/components/booking/index.d.ts +1 -1
  144. package/lib/components/booking/info/index.d.ts +1 -1
  145. package/lib/components/booking/info/model.d.ts +1 -2
  146. package/lib/components/booking/model.d.ts +1 -2
  147. package/lib/components/booking/notes/index.d.ts +1 -1
  148. package/lib/components/booking/notes/model.d.ts +1 -2
  149. package/lib/components/booking/payments/index.d.ts +1 -1
  150. package/lib/components/booking/payments/model.d.ts +1 -2
  151. package/lib/components/eftpos/const.d.ts +38 -0
  152. package/lib/components/eftpos/const.js +108 -0
  153. package/lib/components/eftpos/device.d.ts +8 -0
  154. package/lib/components/eftpos/device.js +55 -0
  155. package/lib/components/eftpos/form/index.d.ts +16 -0
  156. package/lib/components/eftpos/form/index.js +124 -0
  157. package/lib/components/eftpos/index.d.ts +37 -0
  158. package/lib/components/eftpos/index.js +279 -0
  159. package/lib/components/eftpos/index.less +153 -0
  160. package/lib/components/eftpos/locales.d.ts +75 -0
  161. package/lib/components/eftpos/locales.js +116 -0
  162. package/lib/components/eftpos/pos.d.ts +9 -0
  163. package/lib/components/eftpos/pos.js +55 -0
  164. package/lib/components/eftpos/surcharge/index.css +17 -0
  165. package/lib/components/eftpos/surcharge/index.d.ts +8 -0
  166. package/lib/components/eftpos/surcharge/index.js +125 -0
  167. package/lib/components/eftpos/table.d.ts +17 -0
  168. package/lib/components/eftpos/table.js +235 -0
  169. package/lib/components/eftposPay/amount.d.ts +14 -0
  170. package/lib/components/eftposPay/amount.js +239 -0
  171. package/lib/components/eftposPay/component/alert/index.d.ts +6 -0
  172. package/lib/components/eftposPay/component/alert/index.js +38 -0
  173. package/lib/components/eftposPay/component/alert/index.less +29 -0
  174. package/lib/components/eftposPay/component/alert/warn.d.ts +3 -0
  175. package/lib/components/eftposPay/component/alert/warn.js +80 -0
  176. package/lib/components/eftposPay/component/fail/failCustom.d.ts +4 -0
  177. package/lib/components/eftposPay/component/fail/failCustom.js +117 -0
  178. package/lib/components/eftposPay/component/fail/index.d.ts +4 -0
  179. package/lib/components/eftposPay/component/fail/index.js +121 -0
  180. package/lib/components/eftposPay/component/fail/network.d.ts +4 -0
  181. package/lib/components/eftposPay/component/fail/network.js +65 -0
  182. package/lib/components/eftposPay/component/fail/unknow.d.ts +4 -0
  183. package/lib/components/eftposPay/component/fail/unknow.js +72 -0
  184. package/lib/components/eftposPay/component/header/index.d.ts +9 -0
  185. package/lib/components/eftposPay/component/header/index.js +92 -0
  186. package/lib/components/eftposPay/component/header/index.less +44 -0
  187. package/lib/components/eftposPay/component/header/titlebar.d.ts +13 -0
  188. package/lib/components/eftposPay/component/header/titlebar.js +55 -0
  189. package/lib/components/eftposPay/component/header/titlebar.less +17 -0
  190. package/lib/components/eftposPay/component/manual/index.d.ts +5 -0
  191. package/lib/components/eftposPay/component/manual/index.js +101 -0
  192. package/lib/components/eftposPay/component/manual/index.less +96 -0
  193. package/lib/components/eftposPay/component/signature/index.d.ts +4 -0
  194. package/lib/components/eftposPay/component/signature/index.js +80 -0
  195. package/lib/components/eftposPay/component/step/index.d.ts +12 -0
  196. package/lib/components/eftposPay/component/step/index.js +71 -0
  197. package/lib/components/eftposPay/component/step/step.d.ts +9 -0
  198. package/lib/components/eftposPay/component/step/step.js +59 -0
  199. package/lib/components/eftposPay/const.d.ts +131 -0
  200. package/lib/components/eftposPay/const.js +86 -0
  201. package/lib/components/eftposPay/device.d.ts +14 -0
  202. package/lib/components/eftposPay/device.js +127 -0
  203. package/lib/components/eftposPay/device.less +61 -0
  204. package/lib/components/eftposPay/eftpos/config.d.ts +11 -0
  205. package/lib/components/eftposPay/eftpos/config.js +199 -0
  206. package/lib/components/eftposPay/eftpos/const.d.ts +10 -0
  207. package/lib/components/eftposPay/eftpos/const.js +165 -0
  208. package/lib/components/eftposPay/eftpos/index.d.ts +7 -0
  209. package/lib/components/eftposPay/eftpos/index.js +66 -0
  210. package/lib/components/eftposPay/helper.d.ts +3 -0
  211. package/lib/components/eftposPay/helper.js +62 -0
  212. package/lib/components/eftposPay/hooks.d.ts +4 -0
  213. package/lib/components/eftposPay/hooks.js +237 -0
  214. package/lib/components/eftposPay/index.d.ts +7 -0
  215. package/lib/components/eftposPay/index.js +189 -0
  216. package/lib/components/eftposPay/index.less +273 -0
  217. package/lib/components/eftposPay/locales.d.ts +264 -0
  218. package/lib/components/eftposPay/locales.js +304 -0
  219. package/lib/components/eftposPay/manufacturer.d.ts +6 -0
  220. package/lib/components/eftposPay/manufacturer.js +77 -0
  221. package/lib/components/eftposPay/pay.d.ts +10 -0
  222. package/lib/components/eftposPay/pay.js +120 -0
  223. package/lib/components/eftposPay/payo/config.d.ts +11 -0
  224. package/lib/components/eftposPay/payo/config.js +377 -0
  225. package/lib/components/eftposPay/payo/const.d.ts +6 -0
  226. package/lib/components/eftposPay/payo/const.js +112 -0
  227. package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
  228. package/lib/components/eftposPay/payo/hooks.js +80 -0
  229. package/lib/components/eftposPay/payo/index.d.ts +7 -0
  230. package/lib/components/eftposPay/payo/index.js +63 -0
  231. package/lib/components/eftposPay/store/index.d.ts +239 -0
  232. package/lib/components/eftposPay/store/index.js +371 -0
  233. package/lib/components/eftposPay/store/useThunkReducer.d.ts +9 -0
  234. package/lib/components/eftposPay/store/useThunkReducer.js +53 -0
  235. package/lib/components/eftposPay/windcave/action.d.ts +8 -0
  236. package/lib/components/eftposPay/windcave/action.js +143 -0
  237. package/lib/components/eftposPay/windcave/const.d.ts +104 -0
  238. package/lib/components/eftposPay/windcave/const.js +300 -0
  239. package/lib/components/eftposPay/windcave/helper.d.ts +9 -0
  240. package/lib/components/eftposPay/windcave/helper.js +378 -0
  241. package/lib/components/eftposPay/windcave/hook.d.ts +14 -0
  242. package/lib/components/eftposPay/windcave/hook.js +139 -0
  243. package/lib/components/eftposPay/windcave/index.d.ts +8 -0
  244. package/lib/components/eftposPay/windcave/index.js +78 -0
  245. package/lib/components/eftposPay/windcave/pos.d.ts +8 -0
  246. package/lib/components/eftposPay/windcave/pos.js +197 -0
  247. package/lib/components/eftposPay/windcave/pwd.d.ts +8 -0
  248. package/lib/components/eftposPay/windcave/pwd.js +143 -0
  249. package/lib/components/eftposPay/windcave/receipet.d.ts +6 -0
  250. package/lib/components/eftposPay/windcave/receipet.js +93 -0
  251. package/lib/components/eftposPay/windcave/receiptAction.d.ts +11 -0
  252. package/lib/components/eftposPay/windcave/receiptAction.js +386 -0
  253. package/lib/components/eftposPay/windcave/timer.d.ts +17 -0
  254. package/lib/components/eftposPay/windcave/timer.js +126 -0
  255. package/lib/components/eftposPay/windcave/wait.d.ts +12 -0
  256. package/lib/components/eftposPay/windcave/wait.js +163 -0
  257. package/lib/components/eftposPay/windcave/windcave.d.ts +6 -0
  258. package/lib/components/eftposPay/windcave/windcave.js +283 -0
  259. package/lib/components/schedules/index.d.ts +1 -1
  260. package/lib/components/schedules/model.d.ts +1 -2
  261. package/lib/hooks/usePrefix.d.ts +1 -0
  262. package/lib/hooks/usePrefix.js +44 -0
  263. package/lib/index.d.ts +2 -0
  264. package/lib/index.js +6 -0
  265. package/lowcode/eftpos/meta.ts +187 -0
  266. package/lowcode/eftpos-pay/meta.ts +122 -0
  267. package/package.json +4 -3
@@ -0,0 +1,378 @@
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/windcave/helper.tsx
30
+ var helper_exports = {};
31
+ __export(helper_exports, {
32
+ useFail: () => useFail,
33
+ useValidate: () => useValidate
34
+ });
35
+ module.exports = __toCommonJS(helper_exports);
36
+ var import_utils = require("@pisell/utils");
37
+ var import_react = __toESM(require("react"));
38
+ var import_const = require("../const");
39
+ var import_store = require("../store");
40
+ var import_const2 = require("./const");
41
+ var import_timer = __toESM(require("./timer"));
42
+ var Max4004 = 1;
43
+ var useFail = () => {
44
+ const dispatch = (0, import_store.useDispatch)();
45
+ const { custom, mode } = (0, import_store.useContextData)();
46
+ const ref = (0, import_react.useRef)((custom == null ? void 0 : custom.retry) || 0);
47
+ (0, import_react.useEffect)(() => {
48
+ ref.current = (custom == null ? void 0 : custom.retry) || 0;
49
+ }, [custom == null ? void 0 : custom.retry]);
50
+ return (0, import_react.useCallback)(
51
+ (res, isMark = false) => {
52
+ if (!res || !res.code) {
53
+ dispatch(
54
+ (0, import_store.updateCustom)({
55
+ errorStatus: "unknow"
56
+ // unknow know
57
+ })
58
+ );
59
+ dispatch((0, import_store.updateComponent)("UnknowFail"));
60
+ return;
61
+ }
62
+ const [code] = [`${res.code}`];
63
+ if (`${res.code}` === import_const.PayStatus.Unknown) {
64
+ dispatch(
65
+ (0, import_store.updateCustom)({
66
+ failCustom: {
67
+ isPosNetworkError: false,
68
+ status: "fail",
69
+ fail: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail"),
70
+ warn: null,
71
+ title: import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)
72
+ }
73
+ })
74
+ );
75
+ dispatch((0, import_store.updateComponent)("FailCustom"));
76
+ return;
77
+ }
78
+ console.log(code, ref.current, Max4004);
79
+ if (code === import_const.PayStatus.NoPay) {
80
+ if (ref.current > Max4004) {
81
+ dispatch(
82
+ (0, import_store.updateCustom)({
83
+ retry: 0,
84
+ failCustom: {
85
+ isPosNetworkError: false,
86
+ status: "fail",
87
+ fail: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail"),
88
+ warn: null,
89
+ titl: import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)
90
+ }
91
+ })
92
+ );
93
+ dispatch((0, import_store.updateComponent)("FailCustom"));
94
+ return;
95
+ }
96
+ ref.current += 1;
97
+ dispatch(
98
+ (0, import_store.updateCustom)({
99
+ retry: ref.current,
100
+ number: void 0,
101
+ isPay: false,
102
+ list: []
103
+ })
104
+ );
105
+ dispatch((0, import_store.updateKey)(Date.now()));
106
+ return;
107
+ }
108
+ if (code === import_const.PayStatus.Timeout || code === import_const.PayStatus.PayTimeout) {
109
+ if (isMark) {
110
+ dispatch(
111
+ (0, import_store.updateState)({
112
+ manual: {
113
+ title: import_utils.locales.getText("page.eftpos-pay.text.timedout.title"),
114
+ text: import_utils.locales.getText("page.eftpos-pay.text.timedout.text")(
115
+ mode
116
+ )
117
+ }
118
+ })
119
+ );
120
+ dispatch((0, import_store.updateComponent)("Manual"));
121
+ return;
122
+ }
123
+ dispatch(
124
+ (0, import_store.updateCustom)({
125
+ failCustom: {
126
+ isPosNetworkError: false,
127
+ 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(
131
+ "page.eftpos-pay.text.transaction.fail.timeout"
132
+ ),
133
+ title: import_utils.locales.getText("page.eftpos-pay.text.failed")(mode),
134
+ warn: null
135
+ }
136
+ })
137
+ );
138
+ dispatch((0, import_store.updateComponent)("FailCustom"));
139
+ return;
140
+ }
141
+ if (code === import_const.PayStatus.PayOtherEftposFailed) {
142
+ dispatch(
143
+ (0, import_store.updateCustom)({
144
+ failCustom: {
145
+ isPosNetworkError: false,
146
+ status: "fail",
147
+ fail: import_utils.locales.getText(
148
+ "page.eftpos-pay.text.transaction.fail.terminal"
149
+ ),
150
+ title: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail.terminal.title"),
151
+ warn: null
152
+ }
153
+ })
154
+ );
155
+ dispatch((0, import_store.updateComponent)("FailCustom"));
156
+ return;
157
+ }
158
+ if (code === import_const.PayStatus.PayCardErrorFailed) {
159
+ dispatch(
160
+ (0, import_store.updateCustom)({
161
+ failCustom: {
162
+ isPosNetworkError: true,
163
+ status: "fail",
164
+ fail: import_utils.locales.getText(
165
+ "page.eftpos-pay.text.transaction.fail.cancel"
166
+ ),
167
+ title: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail.cancel.title"),
168
+ warn: null
169
+ }
170
+ })
171
+ );
172
+ dispatch((0, import_store.updateComponent)("FailCustom"));
173
+ return;
174
+ }
175
+ if (code === import_const.PayStatus.NoNetWork || code === import_const.PayStatus.SocketError) {
176
+ dispatch(
177
+ (0, import_store.updateCustom)({
178
+ failCustom: {
179
+ isPosNetworkError: true,
180
+ status: "warn",
181
+ fail: null,
182
+ 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(
184
+ "page.eftpos-pay.text.transaction.eftpos.fail.title"
185
+ ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
186
+ "page.eftpos-pay.text.transaction.eftpos.fail.power"
187
+ ), ". ", /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
188
+ "page.eftpos-pay.text.transaction.eftpos.fail.device"
189
+ ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
190
+ "page.eftpos-pay.text.transaction.eftpos.fail.network"
191
+ ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
192
+ "page.eftpos-pay.text.transaction.eftpos.fail.if"
193
+ )(mode))
194
+ }
195
+ })
196
+ );
197
+ dispatch((0, import_store.updateComponent)("FailCustom"));
198
+ return;
199
+ }
200
+ dispatch(
201
+ (0, import_store.updateCustom)({
202
+ errorStatus: "unknow"
203
+ // unknow know
204
+ })
205
+ );
206
+ dispatch((0, import_store.updateComponent)("UnknowFail"));
207
+ },
208
+ [dispatch]
209
+ );
210
+ };
211
+ var useValidate = (check, num, onChange) => {
212
+ const unloadRef = (0, import_react.useRef)(false);
213
+ const dispatch = (0, import_store.useDispatch)();
214
+ const fail = useFail();
215
+ const failRef = (0, import_react.useRef)(fail);
216
+ const ref = (0, import_react.useRef)();
217
+ const { custom, mode } = (0, import_store.useContextData)();
218
+ const stepRef = (0, import_react.useRef)(custom == null ? void 0 : custom.step);
219
+ 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
+ (0, import_react.useEffect)(() => {
225
+ listRef.current = custom == null ? void 0 : custom.list;
226
+ }, [custom == null ? void 0 : custom.list]);
227
+ (0, import_react.useEffect)(() => {
228
+ stepRef.current = custom == null ? void 0 : custom.step;
229
+ }, [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]);
240
+ const run = (0, import_react.useCallback)(
241
+ (timeout) => {
242
+ var _a, _b, _c;
243
+ if (unloadRef.current) {
244
+ (_a = ref.current) == null ? void 0 : _a.close();
245
+ return;
246
+ }
247
+ if (!watchRef.current) {
248
+ return;
249
+ }
250
+ if (!netRef.current) {
251
+ return;
252
+ }
253
+ (_b = ref.current) == null ? void 0 : _b.close();
254
+ ref.current = new import_timer.default({
255
+ xhr: check,
256
+ timeout: typeof timeout === "number" ? timeout : num,
257
+ callback: watchRef.current
258
+ });
259
+ (_c = ref.current) == null ? void 0 : _c.run({ number: numberRef.current }).then((res) => {
260
+ if (unloadRef.current) {
261
+ return;
262
+ }
263
+ if (!netRef.current) {
264
+ return;
265
+ }
266
+ if (!res || Number(res.code) !== 200) {
267
+ return Promise.reject(res);
268
+ }
269
+ }).catch((res) => {
270
+ var _a2;
271
+ if (unloadRef.current) {
272
+ return;
273
+ }
274
+ if (!netRef.current) {
275
+ return;
276
+ }
277
+ if (res && res.code === -1) {
278
+ return;
279
+ }
280
+ (_a2 = failRef.current) == null ? void 0 : _a2.call(failRef, res, stepRef.current >= 3);
281
+ });
282
+ },
283
+ [check, num]
284
+ );
285
+ (0, import_react.useEffect)(() => {
286
+ watchRef.current = (res) => {
287
+ var _a, _b, _c, _d, _e, _f;
288
+ if (unloadRef.current) {
289
+ (_a = ref.current) == null ? void 0 : _a.close();
290
+ return;
291
+ }
292
+ if (!res || !res.data || !res.data.txn_status_id) {
293
+ (_b = ref.current) == null ? void 0 : _b.close();
294
+ }
295
+ const [txn_status_id, status_id, complete] = [
296
+ Number(res.data.txn_status_id),
297
+ Number(res.data.status_id),
298
+ Number(res.data.complete)
299
+ ];
300
+ if (txn_status_id === import_const2.StepStatusEnum.Wait && status_id === 6 && complete === 1) {
301
+ (_c = ref.current) == null ? void 0 : _c.close();
302
+ if (stepRef.current !== txn_status_id && listRef.current.every(({ index }) => txn_status_id !== index)) {
303
+ const current = listRef.current.map((item) => {
304
+ if (Number(item == null ? void 0 : item.index) < Number(stepRef.current)) {
305
+ return {
306
+ ...item,
307
+ status: "resolve"
308
+ };
309
+ }
310
+ return item;
311
+ });
312
+ const nextStep = (0, import_const2.getStepMapping)(txn_status_id, {
313
+ money: (_d = payRef.current) == null ? void 0 : _d.totalUnit,
314
+ mode
315
+ });
316
+ current.push(nextStep);
317
+ dispatch((0, import_store.updateCustom)({ list: current, step: txn_status_id }));
318
+ }
319
+ onChange(res.data);
320
+ return;
321
+ }
322
+ if (stepRef.current !== txn_status_id && listRef.current.every(({ index }) => txn_status_id !== index)) {
323
+ console.log(
324
+ "self.flag stepRef.current, txn_status_id ",
325
+ stepRef.current,
326
+ txn_status_id
327
+ );
328
+ stepRef.current = txn_status_id;
329
+ (_e = ref.current) == null ? void 0 : _e.close();
330
+ const current = listRef.current.map((item) => {
331
+ if (Number(item == null ? void 0 : item.index) < Number(stepRef.current)) {
332
+ return {
333
+ ...item,
334
+ status: "resolve"
335
+ };
336
+ }
337
+ return item;
338
+ });
339
+ const nextStep = (0, import_const2.getStepMapping)(txn_status_id, {
340
+ money: (_f = payRef.current) == null ? void 0 : _f.totalUnit,
341
+ mode
342
+ });
343
+ if (nextStep) {
344
+ current.push(nextStep);
345
+ if (nextStep.type === import_const2.StemTypeEnum.Passive) {
346
+ dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Question));
347
+ }
348
+ if (nextStep.index === import_const2.StepStatusEnum.Receipt) {
349
+ dispatch(
350
+ (0, import_store.updateState)({
351
+ title: import_utils.locales.getText(
352
+ "page.eftpos-pay.text.waiting.signature"
353
+ )
354
+ // 等待签名
355
+ })
356
+ );
357
+ }
358
+ }
359
+ dispatch((0, import_store.updateCustom)({ list: current, step: txn_status_id }));
360
+ txn_status_id === import_const2.StepStatusEnum.Receipt ? run(-1) : run();
361
+ }
362
+ };
363
+ }, [dispatch, onChange, run]);
364
+ (0, import_react.useEffect)(
365
+ () => () => {
366
+ var _a;
367
+ (_a = ref.current) == null ? void 0 : _a.close();
368
+ unloadRef.current = true;
369
+ },
370
+ []
371
+ );
372
+ return [run, ref];
373
+ };
374
+ // Annotate the CommonJS export names for ESM import in node:
375
+ 0 && (module.exports = {
376
+ useFail,
377
+ useValidate
378
+ });
@@ -0,0 +1,14 @@
1
+ import { PayStatus } from '../const';
2
+ export declare const useValidate: (timeout: number, changeStatus?: ((status: PayStatus) => void) | undefined) => readonly [(params: {
3
+ check: (...agrn: unknown[]) => Promise<any>;
4
+ number: number;
5
+ txn_status_id: string;
6
+ time?: number | undefined;
7
+ __start__?: string | undefined;
8
+ checkCondition(...agrn: unknown[]): boolean;
9
+ }) => Promise<{
10
+ [key: string]: unknown;
11
+ }>, () => void];
12
+ export declare const useSuccess: (index: number) => (res: {
13
+ [key: string]: unknown;
14
+ }, hasBackup?: boolean) => void;
@@ -0,0 +1,139 @@
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/windcave/hook.tsx
20
+ var hook_exports = {};
21
+ __export(hook_exports, {
22
+ useSuccess: () => useSuccess,
23
+ useValidate: () => useValidate
24
+ });
25
+ module.exports = __toCommonJS(hook_exports);
26
+ var import_react = require("react");
27
+ var import_helper = require("../helper");
28
+ var import_hooks = require("../hooks");
29
+ var import_store = require("../store");
30
+ var useValidate = (timeout, changeStatus) => {
31
+ const controllerRef = (0, import_react.useRef)();
32
+ const ref = (0, import_react.useRef)(true);
33
+ const TimeoutRef = (0, import_react.useRef)();
34
+ const checkApi = (0, import_react.useCallback)(
35
+ async ({
36
+ check,
37
+ number,
38
+ txn_status_id,
39
+ time,
40
+ __start__,
41
+ checkCondition
42
+ }) => {
43
+ time = time || 5e3;
44
+ controllerRef.current = new AbortController();
45
+ let res = { txn_status_id: __start__ || "0" };
46
+ while (ref.current && checkCondition(res)) {
47
+ console.log(res.txn_status_id, txn_status_id);
48
+ const start = Date.now();
49
+ res = await check(
50
+ { number, txn_status_id: res.txn_status_id },
51
+ { signal: controllerRef.current.signal }
52
+ ).then((r) => {
53
+ changeStatus == null ? void 0 : changeStatus(r);
54
+ console.log("原始数据 res = ", r);
55
+ if (r && r.data) {
56
+ return r.data;
57
+ }
58
+ return r;
59
+ }).catch((err) => {
60
+ console.log(res);
61
+ res = err;
62
+ });
63
+ const diff = Date.now() - start;
64
+ console.log(
65
+ "diff",
66
+ `${res && res.txn_status_id}` !== "8" && `${res && res.status_id}` !== "6",
67
+ res
68
+ );
69
+ if (diff < time) {
70
+ await (0, import_helper.sleep)(time - diff);
71
+ }
72
+ }
73
+ console.log(" res 结束当前 流程 == ", res);
74
+ if (!res || checkCondition(res)) {
75
+ console.log("失败");
76
+ return Promise.reject(res);
77
+ }
78
+ return res;
79
+ },
80
+ [changeStatus]
81
+ );
82
+ const close = (0, import_react.useCallback)(() => {
83
+ var _a;
84
+ ref.current = false;
85
+ (_a = controllerRef.current) == null ? void 0 : _a.abort();
86
+ }, []);
87
+ const run = (params) => {
88
+ TimeoutRef.current && clearTimeout(TimeoutRef.current);
89
+ TimeoutRef.current = setTimeout(() => {
90
+ close();
91
+ }, timeout);
92
+ return checkApi(params);
93
+ };
94
+ (0, import_react.useEffect)(
95
+ () => () => {
96
+ clearTimeout(TimeoutRef.current);
97
+ close();
98
+ },
99
+ [close]
100
+ );
101
+ return [run, close];
102
+ };
103
+ var useSuccess = (index) => {
104
+ const fail = (0, import_hooks.useFail)(index);
105
+ const dispatch = (0, import_store.useDispatch)();
106
+ return (0, import_react.useCallback)(
107
+ (res, hasBackup) => {
108
+ if (hasBackup) {
109
+ return;
110
+ }
111
+ if (!res) {
112
+ console.log("success fail 报错 1 ", res);
113
+ fail(res);
114
+ return;
115
+ }
116
+ const [txn_status_id] = [Number(res.txn_status_id)];
117
+ console.log("success txn_status_id = ", txn_status_id);
118
+ if (txn_status_id < 5) {
119
+ dispatch((0, import_store.updateStep)({ step: 0 }));
120
+ } else if (txn_status_id >= 5 && txn_status_id < 7) {
121
+ dispatch((0, import_store.updateStep)({ step: 1 }));
122
+ } else if (txn_status_id === 7) {
123
+ dispatch((0, import_store.updateStep)({ step: 2 }));
124
+ } else if (txn_status_id === 8) {
125
+ if (res.status_id === "6" || res.status_id === 6) {
126
+ dispatch((0, import_store.updateStep)({ step: 5 }));
127
+ } else {
128
+ fail(res);
129
+ }
130
+ }
131
+ },
132
+ [fail, dispatch]
133
+ );
134
+ };
135
+ // Annotate the CommonJS export names for ESM import in node:
136
+ 0 && (module.exports = {
137
+ useSuccess,
138
+ useValidate
139
+ });
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare const _default: ({ api, onChange, children, hasBackup, }: {
3
+ api: any;
4
+ onChange: any;
5
+ children: React.ReactNode;
6
+ hasBackup: boolean;
7
+ }) => React.JSX.Element;
8
+ export default _default;
@@ -0,0 +1,78 @@
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/windcave/index.tsx
30
+ var windcave_exports = {};
31
+ __export(windcave_exports, {
32
+ default: () => windcave_default
33
+ });
34
+ module.exports = __toCommonJS(windcave_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_const = require("../const");
37
+ var import_store = require("../store");
38
+ var import_action = __toESM(require("./action"));
39
+ var import_pos = __toESM(require("./pos"));
40
+ var import_pwd = __toESM(require("./pwd"));
41
+ var import_receipet = __toESM(require("./receipet"));
42
+ var import_wait = __toESM(require("./wait"));
43
+ var windcave_default = ({
44
+ api,
45
+ onChange,
46
+ children,
47
+ hasBackup
48
+ }) => {
49
+ const { step, steps, ...data } = (0, import_store.useContextData)();
50
+ console.log("hasBackup = ", hasBackup);
51
+ 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) => {
52
+ let Comm;
53
+ if (idx === 0)
54
+ Comm = import_pos.default;
55
+ if (idx === 1)
56
+ Comm = import_pwd.default;
57
+ if (idx === 2)
58
+ Comm = import_receipet.default;
59
+ if (idx === 3)
60
+ Comm = import_receipet.ReceipetAgain;
61
+ if (idx === 4)
62
+ Comm = import_wait.default;
63
+ if (!Comm) {
64
+ throw new Error("no comm");
65
+ }
66
+ if (step >= idx) {
67
+ return /* @__PURE__ */ import_react.default.createElement(
68
+ Comm,
69
+ {
70
+ key: `${data.key}-${item.key}-${idx}`,
71
+ api,
72
+ hasBackup,
73
+ onChange
74
+ }
75
+ );
76
+ }
77
+ }), children), data.status !== import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement(import_action.default, { index: step, api }) : null);
78
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare const POS: ({ api, hasBackup, }: {
3
+ api: {
4
+ [key: string]: (...agrn: unknown[]) => Promise<unknown>;
5
+ };
6
+ hasBackup: boolean;
7
+ }) => React.JSX.Element;
8
+ export default POS;