@pisell/private-materials 3.0.136 → 3.0.137

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 (231) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/addons/model.d.ts +1 -2
  12. package/es/components/booking/forms/model.d.ts +1 -2
  13. package/es/components/booking/notes/index.d.ts +1 -1
  14. package/es/components/booking/notes/model.d.ts +1 -2
  15. package/es/components/booking/payments/model.d.ts +1 -2
  16. package/es/components/eftpos/const.d.ts +26 -0
  17. package/es/components/eftpos/const.js +40 -8
  18. package/es/components/eftpos/device.d.ts +3 -2
  19. package/es/components/eftpos/device.js +6 -5
  20. package/es/components/eftpos/form/index.d.ts +5 -0
  21. package/es/components/eftpos/form/index.js +8 -0
  22. package/es/components/eftpos/hooks.d.ts +34 -0
  23. package/es/components/{eftposPay/windcave/hook.js → eftpos/hooks.js} +96 -122
  24. package/es/components/eftpos/icon/apiKey.d.ts +5 -0
  25. package/es/components/eftpos/icon/apiKey.js +17 -0
  26. package/es/components/eftpos/icon/device.d.ts +5 -0
  27. package/es/components/eftpos/icon/device.js +19 -0
  28. package/es/components/eftpos/index.d.ts +10 -0
  29. package/es/components/eftpos/index.js +329 -46
  30. package/es/components/eftpos/index.less +38 -1
  31. package/es/components/eftpos/locales.d.ts +12 -0
  32. package/es/components/eftpos/locales.js +15 -3
  33. package/es/components/eftpos/log.d.ts +8 -0
  34. package/es/components/eftpos/log.js +85 -0
  35. package/es/components/eftpos/pos.d.ts +1 -1
  36. package/es/components/eftpos/pos.js +8 -5
  37. package/es/components/eftpos/surcharge/index.d.ts +25 -2
  38. package/es/components/eftpos/surcharge/index.js +100 -16
  39. package/es/components/eftpos/table.d.ts +4 -0
  40. package/es/components/eftpos/table.js +102 -10
  41. package/es/components/eftposPay/amount.d.ts +7 -1
  42. package/es/components/eftposPay/amount.js +65 -38
  43. package/es/components/eftposPay/component/fail/failCustom.js +65 -20
  44. package/es/components/eftposPay/component/fail/index.js +60 -30
  45. package/es/components/eftposPay/component/fail/network.d.ts +5 -0
  46. package/es/components/eftposPay/component/fail/network.js +13 -0
  47. package/es/components/eftposPay/component/fail/unknow.d.ts +6 -0
  48. package/es/components/eftposPay/component/fail/unknow.js +18 -3
  49. package/es/components/eftposPay/component/header/index.d.ts +2 -1
  50. package/es/components/eftposPay/component/header/index.js +4 -1
  51. package/es/components/eftposPay/component/header/index.less +1 -10
  52. package/es/components/eftposPay/component/manual/index.d.ts +6 -1
  53. package/es/components/eftposPay/component/manual/index.js +174 -23
  54. package/es/components/eftposPay/component/manual/index.less +42 -14
  55. package/es/components/eftposPay/component/signature/index.d.ts +5 -0
  56. package/es/components/eftposPay/component/signature/index.js +20 -2
  57. package/es/components/eftposPay/component/step/index.d.ts +7 -7
  58. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  59. package/es/components/eftposPay/const.d.ts +19 -4
  60. package/es/components/eftposPay/const.js +4 -2
  61. package/es/components/eftposPay/device.d.ts +7 -0
  62. package/es/components/eftposPay/device.js +22 -0
  63. package/es/components/eftposPay/helper.d.ts +54 -0
  64. package/es/components/eftposPay/helper.js +93 -1
  65. package/es/components/eftposPay/hooks.d.ts +30 -1
  66. package/es/components/eftposPay/hooks.js +181 -26
  67. package/es/components/eftposPay/index.d.ts +2 -4
  68. package/es/components/eftposPay/index.js +119 -31
  69. package/es/components/eftposPay/index.less +27 -19
  70. package/es/components/eftposPay/locales.d.ts +45 -0
  71. package/es/components/eftposPay/locales.js +348 -3
  72. package/es/components/eftposPay/manufacturer.d.ts +2 -2
  73. package/es/components/eftposPay/manufacturer.js +9 -10
  74. package/es/components/eftposPay/pay.d.ts +10 -1
  75. package/es/components/eftposPay/pay.js +112 -34
  76. package/es/components/eftposPay/payo/config.js +137 -270
  77. package/es/components/eftposPay/payo/const.d.ts +22 -2
  78. package/es/components/eftposPay/payo/const.js +83 -33
  79. package/es/components/eftposPay/payo/hooks.d.ts +5 -0
  80. package/es/components/eftposPay/payo/hooks.js +19 -2
  81. package/es/components/eftposPay/store/index.d.ts +154 -53
  82. package/es/components/eftposPay/store/index.js +112 -60
  83. package/es/components/eftposPay/tyro/const.d.ts +17 -0
  84. package/es/components/eftposPay/{eftpos → tyro}/const.js +71 -90
  85. package/es/components/eftposPay/tyro/hooks.d.ts +14 -0
  86. package/es/components/eftposPay/tyro/hooks.js +40 -0
  87. package/es/components/eftposPay/tyro/index.d.ts +9 -0
  88. package/es/components/eftposPay/tyro/index.js +575 -0
  89. package/es/components/eftposPay/windcave/const.d.ts +24 -9
  90. package/es/components/eftposPay/windcave/const.js +90 -81
  91. package/es/components/eftposPay/windcave/helper.d.ts +16 -2
  92. package/es/components/eftposPay/windcave/helper.js +175 -42
  93. package/es/components/eftposPay/windcave/receiptAction.d.ts +12 -0
  94. package/es/components/eftposPay/windcave/receiptAction.js +91 -43
  95. package/es/components/eftposPay/windcave/timer.d.ts +13 -1
  96. package/es/components/eftposPay/windcave/timer.js +18 -1
  97. package/es/components/eftposPay/windcave/windcave.d.ts +2 -1
  98. package/es/components/eftposPay/windcave/windcave.js +155 -139
  99. package/es/components/schedules/index.d.ts +1 -1
  100. package/es/components/schedules/model.d.ts +1 -2
  101. package/es/utils/load.d.ts +11 -0
  102. package/es/utils/load.js +85 -0
  103. package/lib/components/booking/addons/model.d.ts +1 -2
  104. package/lib/components/booking/forms/model.d.ts +1 -2
  105. package/lib/components/booking/notes/index.d.ts +1 -1
  106. package/lib/components/booking/notes/model.d.ts +1 -2
  107. package/lib/components/booking/payments/model.d.ts +1 -2
  108. package/lib/components/eftpos/const.d.ts +26 -0
  109. package/lib/components/eftpos/const.js +13 -1
  110. package/lib/components/eftpos/device.d.ts +3 -2
  111. package/lib/components/eftpos/device.js +2 -2
  112. package/lib/components/eftpos/form/index.d.ts +5 -0
  113. package/lib/components/eftpos/hooks.d.ts +34 -0
  114. package/lib/components/eftpos/hooks.js +106 -0
  115. package/lib/components/eftpos/icon/apiKey.d.ts +5 -0
  116. package/lib/components/eftpos/icon/apiKey.js +57 -0
  117. package/lib/components/eftpos/icon/device.d.ts +5 -0
  118. package/lib/components/eftpos/icon/device.js +57 -0
  119. package/lib/components/eftpos/index.d.ts +10 -0
  120. package/lib/components/eftpos/index.js +262 -97
  121. package/lib/components/eftpos/index.less +38 -1
  122. package/lib/components/eftpos/locales.d.ts +12 -0
  123. package/lib/components/eftpos/locales.js +15 -3
  124. package/lib/components/eftpos/log.d.ts +8 -0
  125. package/lib/components/eftpos/log.js +87 -0
  126. package/lib/components/eftpos/pos.d.ts +1 -1
  127. package/lib/components/eftpos/pos.js +5 -4
  128. package/lib/components/eftpos/surcharge/index.d.ts +25 -2
  129. package/lib/components/eftpos/surcharge/index.js +36 -6
  130. package/lib/components/eftpos/table.d.ts +4 -0
  131. package/lib/components/eftpos/table.js +40 -8
  132. package/lib/components/eftposPay/amount.d.ts +7 -1
  133. package/lib/components/eftposPay/amount.js +10 -33
  134. package/lib/components/eftposPay/component/fail/failCustom.js +27 -6
  135. package/lib/components/eftposPay/component/fail/index.js +39 -18
  136. package/lib/components/eftposPay/component/fail/network.d.ts +5 -0
  137. package/lib/components/eftposPay/component/fail/unknow.d.ts +6 -0
  138. package/lib/components/eftposPay/component/fail/unknow.js +3 -3
  139. package/lib/components/eftposPay/component/header/index.d.ts +2 -1
  140. package/lib/components/eftposPay/component/header/index.js +2 -1
  141. package/lib/components/eftposPay/component/header/index.less +1 -10
  142. package/lib/components/eftposPay/component/manual/index.d.ts +6 -1
  143. package/lib/components/eftposPay/component/manual/index.js +122 -31
  144. package/lib/components/eftposPay/component/manual/index.less +42 -14
  145. package/lib/components/eftposPay/component/signature/index.d.ts +5 -0
  146. package/lib/components/eftposPay/component/signature/index.js +2 -2
  147. package/lib/components/eftposPay/component/step/index.d.ts +7 -7
  148. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  149. package/lib/components/eftposPay/const.d.ts +19 -4
  150. package/lib/components/eftposPay/const.js +3 -1
  151. package/lib/components/eftposPay/device.d.ts +7 -0
  152. package/lib/components/eftposPay/helper.d.ts +54 -0
  153. package/lib/components/eftposPay/helper.js +64 -0
  154. package/lib/components/eftposPay/hooks.d.ts +30 -1
  155. package/lib/components/eftposPay/hooks.js +182 -44
  156. package/lib/components/eftposPay/index.d.ts +2 -4
  157. package/lib/components/eftposPay/index.js +74 -27
  158. package/lib/components/eftposPay/index.less +27 -19
  159. package/lib/components/eftposPay/locales.d.ts +45 -0
  160. package/lib/components/eftposPay/locales.js +352 -3
  161. package/lib/components/eftposPay/manufacturer.d.ts +2 -2
  162. package/lib/components/eftposPay/manufacturer.js +13 -13
  163. package/lib/components/eftposPay/pay.d.ts +10 -1
  164. package/lib/components/eftposPay/pay.js +86 -25
  165. package/lib/components/eftposPay/payo/config.js +121 -268
  166. package/lib/components/eftposPay/payo/const.d.ts +22 -2
  167. package/lib/components/eftposPay/payo/const.js +55 -36
  168. package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
  169. package/lib/components/eftposPay/payo/hooks.js +1 -1
  170. package/lib/components/eftposPay/store/index.d.ts +154 -53
  171. package/lib/components/eftposPay/store/index.js +7 -66
  172. package/lib/components/eftposPay/tyro/const.d.ts +17 -0
  173. package/lib/components/eftposPay/tyro/const.js +114 -0
  174. package/lib/components/eftposPay/tyro/hooks.d.ts +14 -0
  175. package/lib/components/eftposPay/{eftpos/index.js → tyro/hooks.js} +31 -36
  176. package/lib/components/eftposPay/tyro/index.d.ts +9 -0
  177. package/lib/components/eftposPay/tyro/index.js +558 -0
  178. package/lib/components/eftposPay/windcave/const.d.ts +24 -9
  179. package/lib/components/eftposPay/windcave/const.js +53 -104
  180. package/lib/components/eftposPay/windcave/helper.d.ts +16 -2
  181. package/lib/components/eftposPay/windcave/helper.js +163 -48
  182. package/lib/components/eftposPay/windcave/receiptAction.d.ts +12 -0
  183. package/lib/components/eftposPay/windcave/receiptAction.js +15 -47
  184. package/lib/components/eftposPay/windcave/timer.d.ts +13 -1
  185. package/lib/components/eftposPay/windcave/timer.js +5 -0
  186. package/lib/components/eftposPay/windcave/windcave.d.ts +2 -1
  187. package/lib/components/eftposPay/windcave/windcave.js +130 -130
  188. package/lib/components/schedules/index.d.ts +1 -1
  189. package/lib/components/schedules/model.d.ts +1 -2
  190. package/lib/utils/load.d.ts +11 -0
  191. package/lib/utils/load.js +100 -0
  192. package/lowcode/eftpos/meta.ts +202 -160
  193. package/lowcode/eftpos-pay/meta.ts +45 -12
  194. package/package.json +4 -4
  195. package/es/components/eftposPay/eftpos/config.d.ts +0 -11
  196. package/es/components/eftposPay/eftpos/config.js +0 -178
  197. package/es/components/eftposPay/eftpos/const.d.ts +0 -10
  198. package/es/components/eftposPay/eftpos/index.d.ts +0 -7
  199. package/es/components/eftposPay/eftpos/index.js +0 -35
  200. package/es/components/eftposPay/windcave/action.d.ts +0 -8
  201. package/es/components/eftposPay/windcave/action.js +0 -104
  202. package/es/components/eftposPay/windcave/hook.d.ts +0 -14
  203. package/es/components/eftposPay/windcave/index.d.ts +0 -8
  204. package/es/components/eftposPay/windcave/index.js +0 -49
  205. package/es/components/eftposPay/windcave/pos.d.ts +0 -8
  206. package/es/components/eftposPay/windcave/pos.js +0 -180
  207. package/es/components/eftposPay/windcave/pwd.d.ts +0 -8
  208. package/es/components/eftposPay/windcave/pwd.js +0 -124
  209. package/es/components/eftposPay/windcave/receipet.d.ts +0 -6
  210. package/es/components/eftposPay/windcave/receipet.js +0 -67
  211. package/es/components/eftposPay/windcave/wait.d.ts +0 -12
  212. package/es/components/eftposPay/windcave/wait.js +0 -139
  213. package/lib/components/eftposPay/eftpos/config.d.ts +0 -11
  214. package/lib/components/eftposPay/eftpos/config.js +0 -199
  215. package/lib/components/eftposPay/eftpos/const.d.ts +0 -10
  216. package/lib/components/eftposPay/eftpos/const.js +0 -165
  217. package/lib/components/eftposPay/eftpos/index.d.ts +0 -7
  218. package/lib/components/eftposPay/windcave/action.d.ts +0 -8
  219. package/lib/components/eftposPay/windcave/action.js +0 -143
  220. package/lib/components/eftposPay/windcave/hook.d.ts +0 -14
  221. package/lib/components/eftposPay/windcave/hook.js +0 -139
  222. package/lib/components/eftposPay/windcave/index.d.ts +0 -8
  223. package/lib/components/eftposPay/windcave/index.js +0 -78
  224. package/lib/components/eftposPay/windcave/pos.d.ts +0 -8
  225. package/lib/components/eftposPay/windcave/pos.js +0 -197
  226. package/lib/components/eftposPay/windcave/pwd.d.ts +0 -8
  227. package/lib/components/eftposPay/windcave/pwd.js +0 -143
  228. package/lib/components/eftposPay/windcave/receipet.d.ts +0 -6
  229. package/lib/components/eftposPay/windcave/receipet.js +0 -93
  230. package/lib/components/eftposPay/windcave/wait.d.ts +0 -12
  231. package/lib/components/eftposPay/windcave/wait.js +0 -163
@@ -1,165 +0,0 @@
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/eftpos/const.ts
20
- var const_exports = {};
21
- __export(const_exports, {
22
- default: () => const_default,
23
- getAmonunt: () => getAmonunt,
24
- getStep: () => getStep
25
- });
26
- module.exports = __toCommonJS(const_exports);
27
- var import_utils = require("@pisell/utils");
28
- var import_const = require("../const");
29
- var getStep = ({
30
- amount,
31
- symbol,
32
- mode
33
- } = {
34
- amount: "0",
35
- symbol: "",
36
- mode: import_const.ModeEnum.Pay
37
- }) => [
38
- {
39
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
40
- key: Date.now(),
41
- text: import_utils.locales.getText("page.eftpos-pay.text.wait")(symbol + amount, mode),
42
- // 'Asked EFTPOS to accept payment for Purchase $100...',
43
- warn: "",
44
- tip: "processing...",
45
- status: "loading"
46
- },
47
- {
48
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
49
- key: Date.now(),
50
- text: import_utils.locales.getText("page.eftpos-pay.text.surcharge"),
51
- warn: "",
52
- tip: "processing...",
53
- status: "loading"
54
- },
55
- {
56
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
57
- key: Date.now(),
58
- text: import_utils.locales.getText("page.eftpos-pay.text.account"),
59
- warn: "",
60
- tip: "processing...",
61
- status: "loading"
62
- },
63
- {
64
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
65
- key: Date.now(),
66
- text: import_utils.locales.getText("page.eftpos-pay.text.pin"),
67
- warn: "",
68
- tip: "processing...",
69
- status: "loading"
70
- },
71
- {
72
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
73
- key: Date.now(),
74
- text: import_utils.locales.getText("page.eftpos-pay.text.receipt"),
75
- warn: "",
76
- tip: "processing...",
77
- status: "loading"
78
- },
79
- {
80
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
81
- key: Date.now(),
82
- text: import_utils.locales.getText("page.eftpos-pay.text.receipt.again.title"),
83
- warn: import_utils.locales.getText("page.eftpos-pay.text.receipt.again.text"),
84
- tip: "",
85
- status: "warn"
86
- },
87
- {
88
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
89
- key: Date.now(),
90
- text: "Waiting for the appvoval...",
91
- success: "Approade",
92
- warn: "",
93
- tip: "processing...",
94
- status: "loading"
95
- }
96
- ];
97
- var getInitState = (params) => ({
98
- mode: (params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay,
99
- eftpos: import_const.EftposEnum.Eftpos,
100
- key: Date.now(),
101
- warn: "",
102
- step: 0,
103
- type: import_const.PayRouteEnum.Step,
104
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")((params == null ? void 0 : params.mode) || import_const.ModeEnum.Pay),
105
- component: "",
106
- status: import_const.StatusEnum.Loading,
107
- steps: getStep(params),
108
- custom: params,
109
- render: true,
110
- ...params.device ? { device: params.device } : {}
111
- });
112
- var const_default = getInitState;
113
- function getAmonunt(store) {
114
- const { device, custom } = store;
115
- if (!device || !custom) {
116
- throw Error("device or custom is not defined");
117
- }
118
- const name = custom.name;
119
- const symbol = custom.symbol;
120
- const money = custom.amount;
121
- const pay = custom.pay;
122
- const setting = device.setting;
123
- if (pay) {
124
- return {
125
- name,
126
- symbol,
127
- // format,
128
- money,
129
- amount: Number(pay.amount),
130
- surRate: Number(pay.surRate),
131
- surMoney: Number(pay.surMoney),
132
- surcharge: (setting == null ? void 0 : setting.surcharge) || false
133
- };
134
- }
135
- if (!setting) {
136
- return {
137
- name,
138
- symbol,
139
- // format,
140
- money,
141
- amount: money,
142
- surRate: 0,
143
- surMoney: 0,
144
- surcharge: false
145
- };
146
- }
147
- const surRate = setting.constant_rate || 0;
148
- const surMoney = setting.constant_money || 0;
149
- const surcharge = setting.surcharge;
150
- return {
151
- name,
152
- symbol,
153
- // format,
154
- money,
155
- amount: money,
156
- surRate: surcharge ? surRate : 0,
157
- surMoney: surcharge ? surMoney : 0,
158
- surcharge
159
- };
160
- }
161
- // Annotate the CommonJS export names for ESM import in node:
162
- 0 && (module.exports = {
163
- getAmonunt,
164
- getStep
165
- });
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- declare const _default: ({ api, onChange, children, }: {
3
- api: any;
4
- onChange: any;
5
- children: React.ReactNode;
6
- }) => React.JSX.Element;
7
- export default _default;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- declare const _default: ({ index, api, }: {
3
- index: number;
4
- api: {
5
- [key: string]: (...agrn: unknown[]) => Promise<unknown>;
6
- };
7
- }) => React.JSX.Element;
8
- export default _default;
@@ -1,143 +0,0 @@
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/action.tsx
30
- var action_exports = {};
31
- __export(action_exports, {
32
- default: () => action_default
33
- });
34
- module.exports = __toCommonJS(action_exports);
35
- var import_utils = require("@pisell/utils");
36
- var import_antd = require("antd");
37
- var import_react = __toESM(require("react"));
38
- var import_store = require("../store");
39
- var action_default = ({
40
- index,
41
- api
42
- }) => {
43
- const [disabled, setDisabled] = (0, import_react.useState)(false);
44
- const dispatch = (0, import_store.useDispatch)();
45
- const data = (0, import_store.useContextData)();
46
- const { custom } = (0, import_store.useContextData)();
47
- const onCancel = () => {
48
- setDisabled(true);
49
- api.update({
50
- type: "CANCEL",
51
- number: custom == null ? void 0 : custom.number
52
- }).then(() => {
53
- dispatch((0, import_store.updateComponent)("Fail"));
54
- data.steps[index].status = "fail";
55
- data.steps[index].fail = import_utils.locales.getText("page.eftpos-pay.text.cancel");
56
- dispatch((0, import_store.updateSteps)(data.steps));
57
- setDisabled(false);
58
- }).catch((res) => {
59
- console.log(res);
60
- setDisabled(false);
61
- });
62
- };
63
- const onAccept = () => {
64
- setDisabled(true);
65
- api.update({
66
- type: "YES",
67
- number: custom == null ? void 0 : custom.number
68
- }).then(() => {
69
- setDisabled(false);
70
- dispatch((0, import_store.updateNextStep)());
71
- }).catch((res) => {
72
- setDisabled(false);
73
- console.log(res);
74
- });
75
- };
76
- const onDecline = () => {
77
- dispatch((0, import_store.updateComponent)("Signature", true));
78
- };
79
- const onManually = () => {
80
- dispatch(
81
- (0, import_store.updateState)({
82
- manual: {
83
- title: import_utils.locales.getText("page.eftpos-pay.text.request.title")(data.mode),
84
- text: import_utils.locales.getText("page.eftpos-pay.text.request.text")(data.mode)
85
- }
86
- })
87
- );
88
- dispatch((0, import_store.updateComponent)("Manual", true));
89
- };
90
- if (index === 0) {
91
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
92
- import_antd.Button,
93
- {
94
- block: true,
95
- className: "pisell-lowcode__eft-pay-step-item-btn",
96
- onClick: onCancel,
97
- disabled
98
- },
99
- import_utils.locales.getText("page.eftpos-pay.text.cancel")
100
- ));
101
- }
102
- if (index > 0 && index < 3) {
103
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
104
- import_antd.Button,
105
- {
106
- block: true,
107
- className: "pisell-lowcode__eft-pay-step-item-btn",
108
- disabled: true
109
- },
110
- import_utils.locales.getText("page.eftpos-pay.text.leave")
111
- ));
112
- }
113
- if (index === 3) {
114
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
115
- import_antd.Button,
116
- {
117
- block: true,
118
- className: "pisell-lowcode__eft-pay-step-item-btn",
119
- onClick: onDecline
120
- },
121
- import_utils.locales.getText("page.eftpos-pay.text.decline")
122
- ), /* @__PURE__ */ import_react.default.createElement(
123
- import_antd.Button,
124
- {
125
- block: true,
126
- type: "primary",
127
- className: "pisell-lowcode__eft-pay-step-item-btn",
128
- onClick: onAccept,
129
- disabled
130
- },
131
- import_utils.locales.getText("page.eftpos-pay.text.accept")
132
- ));
133
- }
134
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
135
- import_antd.Button,
136
- {
137
- block: true,
138
- className: "pisell-lowcode__eft-pay-step-item-btn",
139
- onClick: onManually
140
- },
141
- import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
142
- ));
143
- };
@@ -1,14 +0,0 @@
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;
@@ -1,139 +0,0 @@
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
- });
@@ -1,8 +0,0 @@
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;
@@ -1,78 +0,0 @@
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
- };
@@ -1,8 +0,0 @@
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;