@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,386 @@
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/receiptAction.tsx
30
+ var receiptAction_exports = {};
31
+ __export(receiptAction_exports, {
32
+ ReceiptAction: () => ReceiptAction,
33
+ default: () => receiptAction_default
34
+ });
35
+ module.exports = __toCommonJS(receiptAction_exports);
36
+ var import_utils = require("@pisell/utils");
37
+ var import_antd = require("antd");
38
+ var import_react = __toESM(require("react"));
39
+ var import_const = require("../const");
40
+ var import_store = require("../store");
41
+ var import_const2 = require("./const");
42
+ var ReceiptAction = ({
43
+ api,
44
+ onChange
45
+ }) => {
46
+ const dispatch = (0, import_store.useDispatch)();
47
+ const { custom, mode } = (0, import_store.useContextData)();
48
+ const ref = (0, import_react.useRef)(custom == null ? void 0 : custom.number);
49
+ const listRef = (0, import_react.useRef)(custom == null ? void 0 : custom.list);
50
+ const [receiptLoading, setReceiptLoading] = (0, import_react.useState)(
51
+ (custom == null ? void 0 : custom.receiptLoading) || false
52
+ );
53
+ const unloadRef = (0, import_react.useRef)(false);
54
+ (0, import_react.useEffect)(() => {
55
+ dispatch(
56
+ (0, import_store.updateCustom)({
57
+ receiptLoading
58
+ })
59
+ );
60
+ }, [receiptLoading]);
61
+ const receiptPage = (0, import_react.useMemo)(
62
+ () => (custom == null ? void 0 : custom.step) !== import_const2.StepStatusEnum.Receipt ? "" : (custom == null ? void 0 : custom.receiptPage) || "receipt",
63
+ [custom == null ? void 0 : custom.step, custom == null ? void 0 : custom.receiptPage]
64
+ );
65
+ (0, import_react.useEffect)(() => {
66
+ listRef.current = custom == null ? void 0 : custom.list;
67
+ }, [custom == null ? void 0 : custom.list]);
68
+ (0, import_react.useEffect)(() => {
69
+ ref.current = custom == null ? void 0 : custom.number;
70
+ }, [custom == null ? void 0 : custom.number]);
71
+ const onAccept = () => {
72
+ dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Loading));
73
+ dispatch(
74
+ (0, import_store.updateCustom)({
75
+ list: listRef.current.map(
76
+ (item) => item.index === 7 ? { ...item, status: "resolve" } : item
77
+ )
78
+ })
79
+ );
80
+ dispatch(
81
+ (0, import_store.updateState)({
82
+ title: import_utils.locales.getText("page.eftpos-pay.text.processing")
83
+ })
84
+ );
85
+ setReceiptLoading(true);
86
+ api.update({
87
+ type: "YES",
88
+ number: custom == null ? void 0 : custom.number
89
+ }).then((res) => {
90
+ if (unloadRef.current) {
91
+ return res;
92
+ }
93
+ if (res && (res.code === 200 || res.code === "200")) {
94
+ setReceiptLoading(false);
95
+ const current = listRef.current.map((item) => {
96
+ if (Number(item == null ? void 0 : item.index) < import_const2.StepStatusEnum.Wait) {
97
+ return {
98
+ ...item,
99
+ status: "resolve"
100
+ };
101
+ }
102
+ return item;
103
+ });
104
+ const nextStep = (0, import_const2.getStepMapping)(import_const2.StepStatusEnum.Wait, { mode });
105
+ if (nextStep) {
106
+ current.push(nextStep);
107
+ if (nextStep.type === import_const2.StemTypeEnum.Passive) {
108
+ dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Question));
109
+ }
110
+ dispatch(
111
+ (0, import_store.updateState)({
112
+ title: nextStep.index < import_const2.StepStatusEnum.Receipt ? import_utils.locales.getText("page.eftpos-pay.text.loading")(mode) : nextStep.index === import_const2.StepStatusEnum.Receipt ? import_utils.locales.getText("page.eftpos-pay.text.waiting.signature") : import_utils.locales.getText("page.eftpos-pay.text.loading")(mode)
113
+ })
114
+ );
115
+ }
116
+ dispatch(
117
+ (0, import_store.updateCustom)({
118
+ step: import_const2.StepStatusEnum.Wait,
119
+ list: current,
120
+ isDeclineReceipt: false
121
+ })
122
+ );
123
+ onChange(true);
124
+ return res;
125
+ }
126
+ return Promise.reject(res);
127
+ }).catch(() => {
128
+ if (unloadRef.current) {
129
+ return;
130
+ }
131
+ dispatch(
132
+ (0, import_store.updateCustom)({
133
+ list: listRef.current.map(
134
+ (item) => item.index === import_const2.StepStatusEnum.Receipt ? { ...item, status: "pedding" } : item
135
+ ),
136
+ isDeclineReceipt: false
137
+ })
138
+ );
139
+ dispatch(
140
+ (0, import_store.updateState)({
141
+ title: import_utils.locales.getText("page.eftpos-pay.text.waiting.signature")
142
+ // 等待签名
143
+ })
144
+ );
145
+ dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Question));
146
+ setReceiptLoading(false);
147
+ onChange(false);
148
+ });
149
+ };
150
+ const onBack = () => {
151
+ dispatch(
152
+ (0, import_store.updateState)({
153
+ title: import_utils.locales.getText("page.eftpos-pay.text.waiting.signature"),
154
+ // ''), // 等待签名
155
+ status: import_const.StatusEnum.Question
156
+ })
157
+ );
158
+ dispatch((0, import_store.updateCustom)({ receiptPage: "receipt" }));
159
+ };
160
+ const onConfirm = () => {
161
+ dispatch(
162
+ (0, import_store.updateState)({
163
+ title: import_utils.locales.getText("page.eftpos-pay.text.processing"),
164
+ status: import_const.StatusEnum.Loading
165
+ })
166
+ );
167
+ dispatch(
168
+ (0, import_store.updateCustom)({
169
+ list: listRef.current.map(
170
+ (item) => item.index === import_const2.StepStatusEnum.Receipt ? { ...item, status: "reject" } : item
171
+ ),
172
+ receiptPage: "receipt"
173
+ })
174
+ );
175
+ setReceiptLoading(true);
176
+ api.update({
177
+ type: "NO",
178
+ number: custom == null ? void 0 : custom.number
179
+ }).then((res) => {
180
+ if (unloadRef.current) {
181
+ return res;
182
+ }
183
+ setReceiptLoading(false);
184
+ if (res && (res.code === 200 || res.code === "200")) {
185
+ const current = listRef.current.map((item) => {
186
+ if (Number(item == null ? void 0 : item.index) === import_const2.StepStatusEnum.Receipt) {
187
+ return {
188
+ ...item,
189
+ resolve: item.reject,
190
+ status: "resolve"
191
+ };
192
+ }
193
+ if (Number(item == null ? void 0 : item.index) < import_const2.StepStatusEnum.Wait) {
194
+ return {
195
+ ...item,
196
+ status: "resolve"
197
+ };
198
+ }
199
+ return item;
200
+ });
201
+ const nextStep = (0, import_const2.getStepMapping)(import_const2.StepStatusEnum.Wait, { mode });
202
+ if (nextStep) {
203
+ nextStep.pedding = import_utils.locales.getText(
204
+ "page.eftpos-pay.text.waiting.decline.signature"
205
+ );
206
+ if (nextStep.type === import_const2.StemTypeEnum.Passive) {
207
+ dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Question));
208
+ }
209
+ dispatch(
210
+ (0, import_store.updateState)({
211
+ title: nextStep.index < import_const2.StepStatusEnum.Receipt ? import_utils.locales.getText("page.eftpos-pay.text.loading")(mode) : nextStep.index === import_const2.StepStatusEnum.Receipt ? import_utils.locales.getText("page.eftpos-pay.text.waiting.signature") : import_utils.locales.getText("page.eftpos-pay.text.loading")(mode)
212
+ })
213
+ );
214
+ current.push(nextStep);
215
+ }
216
+ dispatch(
217
+ (0, import_store.updateCustom)({
218
+ step: import_const2.StepStatusEnum.Wait,
219
+ list: current,
220
+ isDeclineReceipt: true
221
+ })
222
+ );
223
+ onChange(true);
224
+ return res;
225
+ }
226
+ return Promise.reject(res);
227
+ }).catch(() => {
228
+ if (unloadRef.current) {
229
+ return;
230
+ }
231
+ onChange(false);
232
+ setReceiptLoading(false);
233
+ dispatch(
234
+ (0, import_store.updateCustom)({
235
+ list: listRef.current.map(
236
+ (item) => item.index === import_const2.StepStatusEnum.Receipt ? { ...item, status: "pedding" } : item
237
+ ),
238
+ isDeclineReceipt: false
239
+ })
240
+ );
241
+ dispatch(
242
+ (0, import_store.updateState)({
243
+ title: import_utils.locales.getText("page.eftpos-pay.text.waiting.signature")
244
+ // 等待签名
245
+ })
246
+ );
247
+ dispatch((0, import_store.updateStatus)(import_const.StatusEnum.Question));
248
+ setReceiptLoading(false);
249
+ });
250
+ };
251
+ const onDecline = () => {
252
+ dispatch(
253
+ (0, import_store.updateState)({
254
+ title: import_utils.locales.getText("page.eftpos-pay.text.signature.title"),
255
+ // 'page.eftpos-pay.text.waiting.signature'), // 等待签名
256
+ status: import_const.StatusEnum.Warn
257
+ })
258
+ );
259
+ dispatch(
260
+ (0, import_store.updateState)({
261
+ custom: {
262
+ ...custom,
263
+ receiptPage: "again"
264
+ }
265
+ })
266
+ );
267
+ };
268
+ (0, import_react.useEffect)(
269
+ () => () => {
270
+ unloadRef.current = true;
271
+ },
272
+ []
273
+ );
274
+ if (receiptLoading) {
275
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
276
+ import_antd.Button,
277
+ {
278
+ block: true,
279
+ className: "pisell-lowcode__eft-pay-step-item-btn",
280
+ disabled: true
281
+ },
282
+ import_utils.locales.getText("page.eftpos-pay.text.leave")
283
+ ));
284
+ }
285
+ if (receiptPage === "receipt") {
286
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
287
+ import_antd.Button,
288
+ {
289
+ block: true,
290
+ className: "pisell-lowcode__eft-pay-step-item-btn",
291
+ onClick: onDecline
292
+ },
293
+ import_utils.locales.getText("page.eftpos-pay.text.decline")
294
+ ), /* @__PURE__ */ import_react.default.createElement(
295
+ import_antd.Button,
296
+ {
297
+ block: true,
298
+ type: "primary",
299
+ className: "pisell-lowcode__eft-pay-step-item-btn",
300
+ onClick: onAccept
301
+ },
302
+ import_utils.locales.getText("page.eftpos-pay.text.accept")
303
+ ));
304
+ }
305
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
306
+ import_antd.Button,
307
+ {
308
+ block: true,
309
+ className: "pisell-lowcode__eft-pay-step-item-btn",
310
+ onClick: onBack
311
+ },
312
+ import_utils.locales.getText("page.eftpos-pay.text.back")
313
+ ), /* @__PURE__ */ import_react.default.createElement(
314
+ import_antd.Button,
315
+ {
316
+ block: true,
317
+ className: "pisell-lowcode__eft-pay-step-item-btn",
318
+ type: "primary",
319
+ onClick: onConfirm,
320
+ disabled: receiptLoading
321
+ },
322
+ import_utils.locales.getText("page.eftpos-pay.text.confirm.decline")
323
+ ));
324
+ };
325
+ var Action = ({
326
+ index,
327
+ onCancel,
328
+ disabled
329
+ }) => {
330
+ const dispatch = (0, import_store.useDispatch)();
331
+ const { custom, mode } = (0, import_store.useContextData)();
332
+ const onManually = () => {
333
+ dispatch(
334
+ (0, import_store.updateState)({
335
+ manual: {
336
+ title: import_utils.locales.getText("page.eftpos-pay.text.request.title")(mode),
337
+ text: import_utils.locales.getText("page.eftpos-pay.text.request.text")(mode)
338
+ }
339
+ })
340
+ );
341
+ dispatch((0, import_store.updateComponent)("Manual", true));
342
+ };
343
+ if (index < import_const2.StepStatusEnum.Account) {
344
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
345
+ import_antd.Button,
346
+ {
347
+ block: true,
348
+ className: "pisell-lowcode__eft-pay-step-item-btn",
349
+ onClick: onCancel,
350
+ disabled
351
+ },
352
+ import_utils.locales.getText("page.eftpos-pay.text.cancel")
353
+ ));
354
+ }
355
+ if (index >= import_const2.StepStatusEnum.Account && index < import_const2.StepStatusEnum.Receipt) {
356
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
357
+ import_antd.Button,
358
+ {
359
+ block: true,
360
+ className: "pisell-lowcode__eft-pay-step-item-btn",
361
+ disabled: true
362
+ },
363
+ import_utils.locales.getText("page.eftpos-pay.text.leave")
364
+ ));
365
+ }
366
+ if (index === import_const2.StepStatusEnum.Receipt) {
367
+ return null;
368
+ }
369
+ if (custom == null ? void 0 : custom.isDeclineReceipt) {
370
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { block: true, className: "pisell-lowcode__eft-pay-step-item-btn", disabled: true }, import_utils.locales.getText("page.eftpos-pay.text.leave")));
371
+ }
372
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
373
+ import_antd.Button,
374
+ {
375
+ block: true,
376
+ className: "pisell-lowcode__eft-pay-step-item-btn",
377
+ onClick: onManually
378
+ },
379
+ import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
380
+ ));
381
+ };
382
+ var receiptAction_default = Action;
383
+ // Annotate the CommonJS export names for ESM import in node:
384
+ 0 && (module.exports = {
385
+ ReceiptAction
386
+ });
@@ -0,0 +1,17 @@
1
+ export default class XhrTimer {
2
+ clearTimeout: number;
3
+ isTimeoutClose: boolean;
4
+ timeout: number;
5
+ callback: (...agrn: unknown[]) => unknown;
6
+ flag: boolean;
7
+ run: any;
8
+ abortController: AbortController;
9
+ num: string;
10
+ constructor({ xhr, timeout, callback, max, }: {
11
+ xhr: (...agrn: unknown[]) => Promise<unknown>;
12
+ timeout: number;
13
+ callback: (...agrn: unknown[]) => unknown;
14
+ max?: number;
15
+ });
16
+ close(): void;
17
+ }
@@ -0,0 +1,126 @@
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/timer.ts
20
+ var timer_exports = {};
21
+ __export(timer_exports, {
22
+ default: () => XhrTimer
23
+ });
24
+ module.exports = __toCommonJS(timer_exports);
25
+ var import_const = require("../const");
26
+ var import_helper = require("../helper");
27
+ var MaxTime = 5e3;
28
+ var XhrTimer = class {
29
+ constructor({
30
+ xhr,
31
+ timeout,
32
+ callback,
33
+ max = MaxTime
34
+ }) {
35
+ this.clearTimeout = 0;
36
+ this.isTimeoutClose = false;
37
+ this.flag = true;
38
+ this.timeout = timeout;
39
+ this.callback = callback;
40
+ this.num = (0, import_helper.getUuid)();
41
+ const self = this;
42
+ const xhrApi = new Proxy(xhr, {
43
+ async apply(target, ctx, agrns) {
44
+ let laster = Date.now();
45
+ let result = await Promise.resolve(void 0);
46
+ while (self.flag) {
47
+ laster = Date.now();
48
+ if (self.flag) {
49
+ self.abortController = new AbortController();
50
+ if (!agrns[1]) {
51
+ agrns[1] = {
52
+ signal: self.abortController.signal
53
+ };
54
+ } else {
55
+ agrns[1].signal = self.abortController.signal;
56
+ }
57
+ result = await Reflect.apply(target, ctx, agrns).then((res) => {
58
+ if (res && `${res.code}` === import_const.PayStatus.Success) {
59
+ self.callback(res);
60
+ }
61
+ return res;
62
+ }).catch((err) => {
63
+ console.log("外部取消", self.flag, !self.isTimeoutClose, self.num);
64
+ if (!self.flag && !self.isTimeoutClose) {
65
+ return Promise.resolve({ code: -1 });
66
+ }
67
+ console.log(err);
68
+ self.flag = false;
69
+ return Promise.resolve(err);
70
+ });
71
+ }
72
+ const currentTime = Date.now();
73
+ const diff = currentTime - laster;
74
+ if (self.flag && diff < max) {
75
+ await (0, import_helper.sleep)(max - diff);
76
+ }
77
+ }
78
+ return result;
79
+ }
80
+ });
81
+ this.run = new Proxy(xhrApi, {
82
+ async apply(target, ctx, agrns) {
83
+ self.flag = true;
84
+ self.isTimeoutClose = false;
85
+ if (self.clearTimeout) {
86
+ clearTimeout(self.clearTimeout);
87
+ }
88
+ if (self.timeout > 4) {
89
+ self.clearTimeout = setTimeout(() => {
90
+ if (self.flag) {
91
+ self.flag = false;
92
+ self.isTimeoutClose = true;
93
+ }
94
+ }, self.timeout);
95
+ }
96
+ const result = await Reflect.apply(target, ctx, agrns);
97
+ clearTimeout(self.clearTimeout);
98
+ if (self.isTimeoutClose) {
99
+ if (!result) {
100
+ return {
101
+ code: import_const.PayStatus.Timeout
102
+ };
103
+ }
104
+ const { code } = result;
105
+ if (`${code}` === `200`) {
106
+ return {
107
+ ...result,
108
+ code: import_const.PayStatus.Timeout
109
+ };
110
+ }
111
+ return result;
112
+ }
113
+ return result;
114
+ }
115
+ });
116
+ }
117
+ close() {
118
+ var _a;
119
+ console.log("外部关闭", this.flag, this.num);
120
+ this.flag = false;
121
+ (_a = this.abortController) == null ? void 0 : _a.abort();
122
+ if (this.clearTimeout) {
123
+ clearTimeout(this.clearTimeout);
124
+ }
125
+ }
126
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { StatusEnum } from '../const';
3
+ declare const Wait: ({ api, onChange, hasBackup, }: {
4
+ api: {
5
+ [key: string]: (...agrn: unknown[]) => Promise<unknown>;
6
+ };
7
+ onChange: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}`, params?: {
8
+ [keys: string]: unknown;
9
+ } | undefined) => void;
10
+ hasBackup: boolean;
11
+ }) => React.JSX.Element;
12
+ export default Wait;