@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,62 @@
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/helper.ts
20
+ var helper_exports = {};
21
+ __export(helper_exports, {
22
+ cloneDeep: () => cloneDeep,
23
+ getUuid: () => getUuid,
24
+ sleep: () => sleep
25
+ });
26
+ module.exports = __toCommonJS(helper_exports);
27
+ function getUuid() {
28
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxx".replace(/[xy]/g, (c) => {
29
+ const r = Math.random() * 16 | 0;
30
+ const v = c === "x" ? r : r & 3 | 8;
31
+ return v.toString(16);
32
+ });
33
+ }
34
+ var sleep = (time) => new Promise((resove) => {
35
+ setTimeout(() => {
36
+ resove(void 0);
37
+ }, time);
38
+ });
39
+ function cloneDeep(source, hash = /* @__PURE__ */ new WeakMap()) {
40
+ if (typeof source !== "object" || source === null) {
41
+ return source;
42
+ }
43
+ if (hash.has(source)) {
44
+ return hash.get(source);
45
+ }
46
+ const target = Array.isArray(source) ? [] : {};
47
+ Reflect.ownKeys(source).forEach((key) => {
48
+ const val = source[key];
49
+ if (typeof val === "object" && val != null) {
50
+ target[key] = cloneDeep(val, hash);
51
+ } else {
52
+ target[key] = val;
53
+ }
54
+ });
55
+ return target;
56
+ }
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ cloneDeep,
60
+ getUuid,
61
+ sleep
62
+ });
@@ -0,0 +1,4 @@
1
+ import { PayStatus } from './const';
2
+ export declare const useFail: (index: number, isMark?: boolean) => (res: {
3
+ code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | undefined;
4
+ }) => void;
@@ -0,0 +1,237 @@
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/hooks.tsx
30
+ var hooks_exports = {};
31
+ __export(hooks_exports, {
32
+ useFail: () => useFail
33
+ });
34
+ module.exports = __toCommonJS(hooks_exports);
35
+ var import_utils = require("@pisell/utils");
36
+ var import_react = __toESM(require("react"));
37
+ var import_const = require("./const");
38
+ var import_store = require("./store");
39
+ var Max4004 = 1;
40
+ var useFail = (index, isMark = false) => {
41
+ const { steps, custom, mode } = (0, import_store.useContextData)();
42
+ const dispatch = (0, import_store.useDispatch)();
43
+ const ref = (0, import_react.useRef)((custom == null ? void 0 : custom.retry) || 0);
44
+ (0, import_react.useEffect)(() => {
45
+ ref.current = (custom == null ? void 0 : custom.retry) || 0;
46
+ }, [custom == null ? void 0 : custom.retry]);
47
+ return (0, import_react.useCallback)(
48
+ (res) => {
49
+ if (!res || !res.code) {
50
+ dispatch(
51
+ (0, import_store.updateCustom)({
52
+ errorStatus: "unknow"
53
+ // unknow know
54
+ })
55
+ );
56
+ dispatch((0, import_store.updateComponent)("UnknowFail"));
57
+ return;
58
+ }
59
+ const [code] = [`${res.code}`];
60
+ dispatch(
61
+ (0, import_store.updateCustomStemItem)({
62
+ step: index
63
+ })
64
+ );
65
+ if (code === import_const.PayStatus.Unknown) {
66
+ steps[index].title = import_utils.locales.getText("page.eftpos-pay.text.failed")(
67
+ mode
68
+ );
69
+ steps[index].fail = import_utils.locales.getText(
70
+ "page.eftpos-pay.text.transaction.fail"
71
+ );
72
+ steps[index].status = "fail";
73
+ dispatch((0, import_store.updateSteps)(steps));
74
+ dispatch((0, import_store.updateComponent)("Fail"));
75
+ dispatch(
76
+ (0, import_store.updateCustom)({
77
+ errorStatus: "know"
78
+ // unknow know
79
+ })
80
+ );
81
+ return;
82
+ }
83
+ if (code === import_const.PayStatus.Timeout || code === import_const.PayStatus.PayTimeout) {
84
+ if (isMark) {
85
+ steps[index].status = "fail";
86
+ dispatch((0, import_store.updateSteps)(steps));
87
+ dispatch(
88
+ (0, import_store.updateState)({
89
+ manual: {
90
+ title: import_utils.locales.getText("page.eftpos-pay.text.timedout.title"),
91
+ text: import_utils.locales.getText("page.eftpos-pay.text.timedout.text")(
92
+ mode
93
+ )
94
+ }
95
+ })
96
+ );
97
+ dispatch(
98
+ (0, import_store.updateCustom)({
99
+ errorStatus: "know"
100
+ // unknow know
101
+ })
102
+ );
103
+ dispatch((0, import_store.updateComponent)("Manual"));
104
+ dispatch(
105
+ (0, import_store.updateCustom)({
106
+ errorStatus: "know"
107
+ // unknow know
108
+ })
109
+ );
110
+ return;
111
+ }
112
+ steps[index].fail = code === import_const.PayStatus.Timeout ? import_utils.locales.getText("page.eftpos-pay.text.transaction.pay.fail.timeout") : import_utils.locales.getText("page.eftpos-pay.text.transaction.fail.timeout");
113
+ steps[index].title = import_utils.locales.getText("page.eftpos-pay.text.failed")(
114
+ mode
115
+ );
116
+ steps[index].status = "fail";
117
+ dispatch((0, import_store.updateSteps)(steps));
118
+ dispatch((0, import_store.updateComponent)("Fail"));
119
+ dispatch(
120
+ (0, import_store.updateCustom)({
121
+ errorStatus: "know"
122
+ // unknow know
123
+ })
124
+ );
125
+ return;
126
+ }
127
+ if (code === import_const.PayStatus.NoPay) {
128
+ if (ref.current > Max4004) {
129
+ dispatch(
130
+ (0, import_store.updateCustom)({
131
+ retry: ref.current,
132
+ number: void 0
133
+ })
134
+ );
135
+ steps[index].title = import_utils.locales.getText("page.eftpos-pay.text.failed")(
136
+ mode
137
+ );
138
+ steps[index].fail = import_utils.locales.getText(
139
+ "page.eftpos-pay.text.transaction.fail"
140
+ );
141
+ steps[index].status = "fail";
142
+ dispatch((0, import_store.updateSteps)(steps));
143
+ dispatch((0, import_store.updateComponent)("Fail"));
144
+ return;
145
+ }
146
+ ref.current += 1;
147
+ dispatch(
148
+ (0, import_store.updateCustom)({
149
+ retry: ref.current,
150
+ number: void 0
151
+ })
152
+ );
153
+ dispatch((0, import_store.updateKey)(Date.now()));
154
+ return;
155
+ }
156
+ if (code === import_const.PayStatus.PayOtherEftposFailed) {
157
+ steps[index].title = import_utils.locales.getText(
158
+ "page.eftpos-pay.text.transaction.fail.terminal.title"
159
+ );
160
+ steps[index].fail = import_utils.locales.getText(
161
+ "page.eftpos-pay.text.transaction.fail.terminal"
162
+ );
163
+ steps[index].status = "fail";
164
+ dispatch((0, import_store.updateSteps)(steps));
165
+ dispatch((0, import_store.updateComponent)("Fail"));
166
+ dispatch(
167
+ (0, import_store.updateCustom)({
168
+ errorStatus: "know"
169
+ // unknow know
170
+ })
171
+ );
172
+ return;
173
+ }
174
+ if (code === import_const.PayStatus.PayCardErrorFailed) {
175
+ steps[index].title = import_utils.locales.getText("page.eftpos-pay.text.transaction.fail.cancel.title");
176
+ steps[index].fail = import_utils.locales.getText(
177
+ "page.eftpos-pay.text.transaction.fail.cancel"
178
+ );
179
+ steps[index].status = "fail";
180
+ dispatch((0, import_store.updateSteps)(steps));
181
+ dispatch((0, import_store.updateComponent)("Fail"));
182
+ dispatch(
183
+ (0, import_store.updateCustom)({
184
+ errorStatus: "know"
185
+ // unknow know
186
+ })
187
+ );
188
+ return;
189
+ }
190
+ if (code === import_const.PayStatus.NoNetWork || code === import_const.PayStatus.SocketError) {
191
+ steps[index].title = import_utils.locales.getText(
192
+ "page.eftpos-pay.text.interrupted"
193
+ );
194
+ steps[index].warn = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, import_utils.locales.getText(
195
+ "page.eftpos-pay.text.transaction.eftpos.fail.title"
196
+ ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
197
+ "page.eftpos-pay.text.transaction.eftpos.fail.power"
198
+ ), ". ", /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
199
+ "page.eftpos-pay.text.transaction.eftpos.fail.device"
200
+ ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText(
201
+ "page.eftpos-pay.text.transaction.eftpos.fail.network"
202
+ ), /* @__PURE__ */ import_react.default.createElement("br", null), import_utils.locales.getText("page.eftpos-pay.text.transaction.eftpos.fail.if")(
203
+ mode
204
+ ));
205
+ steps[index].status = "warn";
206
+ steps[index].custom = steps[index].custom ? { ...steps[index].custom, isPosNetworkError: true } : { isPosNetworkError: true };
207
+ dispatch((0, import_store.updateSteps)(steps));
208
+ dispatch((0, import_store.updateComponent)("Fail"));
209
+ dispatch(
210
+ (0, import_store.updateCustom)({
211
+ errorStatus: "know"
212
+ // unknow know
213
+ })
214
+ );
215
+ return;
216
+ }
217
+ steps[index].title = import_utils.locales.getText("page.eftpos-pay.text.failed")(mode);
218
+ steps[index].status = "fail";
219
+ steps[index].fail = import_utils.locales.getText(
220
+ "page.eftpos-pay.text.transaction.fail"
221
+ );
222
+ dispatch((0, import_store.updateSteps)(steps));
223
+ dispatch(
224
+ (0, import_store.updateCustom)({
225
+ errorStatus: "unknow"
226
+ // unknow know
227
+ })
228
+ );
229
+ dispatch((0, import_store.updateComponent)("UnknowFail"));
230
+ },
231
+ [dispatch, index, steps, isMark]
232
+ );
233
+ };
234
+ // Annotate the CommonJS export names for ESM import in node:
235
+ 0 && (module.exports = {
236
+ useFail
237
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { PosProps, ModeEnum } from './const';
3
+ import './index.less';
4
+ declare const _default: (props: Omit<PosProps, "action"> & {
5
+ mode: ModeEnum;
6
+ }) => React.JSX.Element;
7
+ export default _default;
@@ -0,0 +1,189 @@
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/index.tsx
30
+ var eftposPay_exports = {};
31
+ __export(eftposPay_exports, {
32
+ default: () => eftposPay_default
33
+ });
34
+ module.exports = __toCommonJS(eftposPay_exports);
35
+ var import_utils = require("@pisell/utils");
36
+ var import_react = __toESM(require("react"));
37
+ var import_ahooks = require("ahooks");
38
+ var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
39
+ var import_amount = __toESM(require("./amount"));
40
+ var import_const = require("./const");
41
+ var import_device = __toESM(require("./device"));
42
+ var import_locales = __toESM(require("./locales"));
43
+ var import_manufacturer = require("./manufacturer");
44
+ var import_pay = __toESM(require("./pay"));
45
+ var import_store = require("./store");
46
+ var import_index = require("./index.less");
47
+ import_utils.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
48
+ var App = ({
49
+ action,
50
+ getApi,
51
+ terminal,
52
+ ...props
53
+ }) => {
54
+ var _a;
55
+ const data = (0, import_store.useContextData)();
56
+ const ref = (0, import_react.useRef)(false);
57
+ const [current, setCurrent] = (0, import_react.useState)(action);
58
+ const statusRef = (0, import_react.useRef)(data.status);
59
+ const actRef = (0, import_react.useRef)(action);
60
+ const context = (0, import_useEngineContext.default)();
61
+ const { formatAmount, isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {
62
+ formatAmount: (number, precision, symbol) => `${symbol}${number}`,
63
+ isTerminal: () => false
64
+ };
65
+ const network = (0, import_react.useMemo)(
66
+ () => typeof terminal.network === "boolean" ? terminal.network : true,
67
+ [terminal == null ? void 0 : terminal.network]
68
+ );
69
+ const { online } = (0, import_ahooks.useNetwork)();
70
+ const netRef = (0, import_react.useRef)([network, online]);
71
+ const net = (0, import_react.useMemo)(() => {
72
+ let networkChange = false, onlineChange = false;
73
+ if (netRef.current[0] !== network) {
74
+ netRef.current[0] = network;
75
+ networkChange = true;
76
+ }
77
+ if (netRef.current[1] !== online) {
78
+ netRef.current[1] = online;
79
+ onlineChange = true;
80
+ }
81
+ if (networkChange) {
82
+ return network;
83
+ }
84
+ return online;
85
+ }, [network, online]);
86
+ (0, import_react.useEffect)(() => {
87
+ statusRef.current = data.status;
88
+ }, [data.status]);
89
+ const isIpad = (0, import_react.useMemo)(() => isTerminal && isTerminal(), [isTerminal]);
90
+ const api = (0, import_react.useMemo)(() => {
91
+ if (typeof getApi === "function") {
92
+ return getApi();
93
+ }
94
+ return {};
95
+ }, [getApi]);
96
+ const onChange = (status, params) => {
97
+ if (status === "page" && typeof params === "string") {
98
+ if (["amount", "deviceList", "pay"].includes(params)) {
99
+ setCurrent(params);
100
+ }
101
+ }
102
+ console.log("状态切换 = ", status, params);
103
+ props.onChangeStatus(status, params);
104
+ };
105
+ const onClose = () => {
106
+ onChange("fail");
107
+ };
108
+ if (current === import_const.RouteEnum.DeviceList) {
109
+ return /* @__PURE__ */ import_react.default.createElement(
110
+ import_device.default,
111
+ {
112
+ api,
113
+ onChange,
114
+ onClose,
115
+ isIpad,
116
+ className: isIpad ? "pisell-lowcode__eft-pay-terminal" : "",
117
+ net
118
+ }
119
+ );
120
+ }
121
+ if (current === import_const.RouteEnum.Amount) {
122
+ return /* @__PURE__ */ import_react.default.createElement(
123
+ import_amount.default,
124
+ {
125
+ onChange,
126
+ onClose,
127
+ formatAmount,
128
+ isIpad,
129
+ className: isIpad ? "pisell-lowcode__eft-pay-terminal" : "",
130
+ net
131
+ }
132
+ );
133
+ }
134
+ return /* @__PURE__ */ import_react.default.createElement(
135
+ import_pay.default,
136
+ {
137
+ api,
138
+ onChange,
139
+ className: isIpad ? "pisell-lowcode__eft-pay-terminal" : "",
140
+ terminal,
141
+ net
142
+ }
143
+ );
144
+ };
145
+ var eftposPay_default = (props) => {
146
+ var _a, _b, _c, _d;
147
+ const context = (0, import_useEngineContext.default)();
148
+ const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || { store: {} };
149
+ const mode = (0, import_react.useMemo)(() => {
150
+ if (props.mode) {
151
+ return props.mode;
152
+ }
153
+ return import_const.ModeEnum.Pay;
154
+ }, [props.mode]);
155
+ const action = (0, import_react.useMemo)(() => {
156
+ if (mode === import_const.ModeEnum.Pay) {
157
+ return import_const.RouteEnum.DeviceList;
158
+ }
159
+ if (mode === import_const.ModeEnum.Refund) {
160
+ return import_const.RouteEnum.DeviceList;
161
+ }
162
+ if (mode === import_const.ModeEnum.Query) {
163
+ return import_const.RouteEnum.Pay;
164
+ }
165
+ throw Error("未知模式");
166
+ }, [mode]);
167
+ const symbol = ((_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) || "$";
168
+ const onChangeStatus = (status, params) => {
169
+ props.onChangeStatus(status, params);
170
+ };
171
+ const state = (0, import_react.useMemo)(() => {
172
+ const current = props.params && props.params.symbol ? props.params.symbol : symbol;
173
+ console.log("current 单位 = ", props.params.symbol, symbol);
174
+ return (0, import_manufacturer.getInitState)(
175
+ props.type,
176
+ props.params ? { mode, ...props.params, symbol: current } : { mode, symbol: current }
177
+ );
178
+ }, [mode, props.params, props.type, symbol]);
179
+ return /* @__PURE__ */ import_react.default.createElement(import_store.Provider, { state }, /* @__PURE__ */ import_react.default.createElement(
180
+ App,
181
+ {
182
+ getApi: props.getApi,
183
+ params: props.params,
184
+ onChangeStatus,
185
+ terminal: props.terminal,
186
+ action
187
+ }
188
+ ));
189
+ };