@pisell/private-materials 3.0.95 → 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,239 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { DeviceStatusType, StatusType, ModeType } from '../const';
3
+ import { ThunkDispatch } from './useThunkReducer';
4
+ export declare enum EActionTypes {
5
+ UPDATE_INIT = "UPDATE_INIT",
6
+ UPDATE_CUSTOM = "UPDATE_CUSTOM",
7
+ UPDATE_KEY = "UPDATE_KEY",
8
+ UPDATE_STEP = "UPDATE_STEP",
9
+ UPDATE_STEP_KEY = "UPDATE_STEP_KEY",
10
+ UPDATE_DEVICE = "UPDATE_DEVICE",
11
+ UPDATE_NEXT_STEP = "UPDATE_NEXT_STEP",
12
+ UPDATE_STATUS = "UPDATE_STATUS",
13
+ UPDATE_TITLE = "UPDATE_TITLE",
14
+ UPDATE_LOADING = "UPDATE_LOADING",
15
+ UPDATE_COMPONENT = "UPDATE_COMPONENT",
16
+ UPDATE_STEPS = "UPDATE_STEPS",
17
+ UPDATE_WARN = "UPDATE_WARN",
18
+ UPDATE_STEP_CURRENT_ITEM_CUSTOM = "UPDATE_STEP_CURRENT_ITEM_CUSTOM",
19
+ UPDATE_STEP_ITEM_CUSTOM = "UPDATE_STEP_ITEM_CUSTOM",
20
+ UPDATE_STEP_ITEM = "UPDATE_STEP_ITEM",
21
+ BACKUP_PRODUCTION = "BACKUP_PRODUCTION",
22
+ BACKUP_FREE = "BACKUP_FREE"
23
+ }
24
+ export declare type State = {
25
+ mode: ModeType;
26
+ /** 厂商 */
27
+ eftpos: DeviceStatusType;
28
+ /** 用于重置页面特指 =》全部步骤 */
29
+ key: number;
30
+ /** 当前执行到哪一步了 */
31
+ step: number;
32
+ /** 标题 */
33
+ title: string;
34
+ /** step : 常规步骤页面 ,unset 自定义页面 */
35
+ type: 'step' | 'unset';
36
+ render: boolean;
37
+ /** 上面 unset 自定义页面,这里需要指定到具体页面 */
38
+ component: string;
39
+ lastComponent?: string;
40
+ /** 页面状态 */
41
+ status: StatusType;
42
+ /** 警告文案 */
43
+ warn: ReactNode;
44
+ steps: {
45
+ /** 用于重置当前步骤 */
46
+ key: number;
47
+ title?: ReactNode;
48
+ text?: ReactNode;
49
+ warn?: ReactNode;
50
+ tip?: ReactNode;
51
+ success?: ReactNode;
52
+ fail?: ReactNode;
53
+ loading?: ReactNode;
54
+ /** 步骤状态 */
55
+ status: StatusType;
56
+ custom?: {
57
+ /** 厂商自定义 */
58
+ [key: string]: unknown;
59
+ };
60
+ }[];
61
+ device?: {
62
+ [key: string]: unknown;
63
+ };
64
+ custom?: {
65
+ [key: string]: unknown;
66
+ };
67
+ manual?: {
68
+ title: string;
69
+ text: string;
70
+ };
71
+ backup?: Omit<State, 'backup'>;
72
+ };
73
+ export declare type Action = {
74
+ type: EActionTypes;
75
+ payload: Partial<State>;
76
+ };
77
+ export declare const updateKey: (key: number) => {
78
+ type: EActionTypes;
79
+ payload: {
80
+ key: number;
81
+ };
82
+ };
83
+ export declare const updateDevice: (payload: {
84
+ device: State['device'];
85
+ }) => {
86
+ type: EActionTypes;
87
+ payload: {
88
+ device: State['device'];
89
+ };
90
+ };
91
+ export declare const updateStepKey: () => {
92
+ type: EActionTypes;
93
+ payload: {};
94
+ };
95
+ export declare const updateNextStep: (warn?: string) => {
96
+ type: EActionTypes;
97
+ payload: {
98
+ warn: string;
99
+ } | {
100
+ warn?: undefined;
101
+ };
102
+ };
103
+ export declare const updateStep: (payload: {
104
+ step: number;
105
+ warn?: ReactNode;
106
+ }) => {
107
+ type: EActionTypes;
108
+ payload: {
109
+ step: number;
110
+ warn?: ReactNode;
111
+ };
112
+ };
113
+ export declare const updateCustom: (payload: {
114
+ [key: string]: unknown;
115
+ }) => {
116
+ type: EActionTypes;
117
+ payload: {
118
+ [key: string]: unknown;
119
+ };
120
+ };
121
+ export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
122
+ type: EActionTypes;
123
+ payload: {
124
+ status: "loading" | "success" | "warn" | "fail" | "question";
125
+ };
126
+ };
127
+ export declare const updateWarn: (warn: ReactNode) => {
128
+ type: EActionTypes;
129
+ payload: {
130
+ warn: React.ReactNode;
131
+ };
132
+ };
133
+ export declare const updateComponent: (component: string, render?: boolean) => {
134
+ type: EActionTypes;
135
+ payload: {
136
+ readonly component: string;
137
+ readonly type: "unset";
138
+ readonly render: boolean;
139
+ } | {
140
+ readonly type: "step";
141
+ readonly render: boolean;
142
+ readonly component?: undefined;
143
+ };
144
+ };
145
+ export declare const updateSteps: (steps: State['steps']) => {
146
+ type: EActionTypes;
147
+ payload: {
148
+ steps: {
149
+ /** 用于重置当前步骤 */
150
+ key: number;
151
+ title?: ReactNode;
152
+ text?: ReactNode;
153
+ warn?: ReactNode;
154
+ tip?: ReactNode;
155
+ success?: ReactNode;
156
+ fail?: ReactNode;
157
+ loading?: ReactNode;
158
+ /** 步骤状态 */
159
+ status: StatusType;
160
+ custom?: {
161
+ [key: string]: unknown;
162
+ } | undefined;
163
+ }[];
164
+ };
165
+ };
166
+ export declare const updateState: (payload: Partial<State>) => {
167
+ type: EActionTypes;
168
+ payload: Partial<State>;
169
+ };
170
+ export declare const updateCurrentCustomStemItem: (payload: NonNullable<Partial<State['steps'][number]['custom']>>) => {
171
+ type: EActionTypes;
172
+ payload: Partial<{
173
+ [key: string]: unknown;
174
+ }>;
175
+ };
176
+ export declare const updateCustomStemItem: (payload: NonNullable<Partial<State['steps'][number]['custom']>>) => {
177
+ type: EActionTypes;
178
+ payload: Partial<{
179
+ [key: string]: unknown;
180
+ }>;
181
+ };
182
+ export declare const updateCurrentStemItem: (payload: any) => {
183
+ type: EActionTypes;
184
+ payload: any;
185
+ };
186
+ export declare const backUpProduction: (payload: Partial<State>) => {
187
+ type: EActionTypes;
188
+ payload: Partial<State>;
189
+ };
190
+ export declare const backUpFree: (payload: Partial<State>) => {
191
+ type: EActionTypes;
192
+ payload: {
193
+ mode?: "refund" | "pay" | "query" | undefined;
194
+ eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "eftpos" | undefined;
195
+ key?: number | undefined;
196
+ step?: number | undefined;
197
+ title?: string | undefined;
198
+ type?: "unset" | "step" | undefined;
199
+ render?: boolean | undefined;
200
+ component?: string | undefined;
201
+ lastComponent?: string | undefined;
202
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
203
+ warn?: ReactNode;
204
+ steps?: {
205
+ /** 用于重置当前步骤 */
206
+ key: number;
207
+ title?: ReactNode;
208
+ text?: ReactNode;
209
+ warn?: ReactNode;
210
+ tip?: ReactNode;
211
+ success?: ReactNode;
212
+ fail?: ReactNode;
213
+ loading?: ReactNode;
214
+ /** 步骤状态 */
215
+ status: StatusType;
216
+ custom?: {
217
+ [key: string]: unknown;
218
+ } | undefined;
219
+ }[] | undefined;
220
+ device?: {
221
+ [key: string]: unknown;
222
+ } | undefined;
223
+ custom?: {
224
+ [key: string]: unknown;
225
+ } | undefined;
226
+ manual?: {
227
+ title: string;
228
+ text: string;
229
+ } | undefined;
230
+ backup?: Omit<State, "backup"> | undefined;
231
+ };
232
+ };
233
+ export declare function reducers(state: State, action: Action): State;
234
+ export declare const Provider: ({ children, state: providerState, }: {
235
+ children: ReactNode;
236
+ state?: State | undefined;
237
+ }) => React.JSX.Element;
238
+ export declare function useContextData(): State;
239
+ export declare function useDispatch(): ThunkDispatch<State, Action>;
@@ -0,0 +1,371 @@
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/store/index.tsx
30
+ var store_exports = {};
31
+ __export(store_exports, {
32
+ EActionTypes: () => EActionTypes,
33
+ Provider: () => Provider,
34
+ backUpFree: () => backUpFree,
35
+ backUpProduction: () => backUpProduction,
36
+ reducers: () => reducers,
37
+ updateComponent: () => updateComponent,
38
+ updateCurrentCustomStemItem: () => updateCurrentCustomStemItem,
39
+ updateCurrentStemItem: () => updateCurrentStemItem,
40
+ updateCustom: () => updateCustom,
41
+ updateCustomStemItem: () => updateCustomStemItem,
42
+ updateDevice: () => updateDevice,
43
+ updateKey: () => updateKey,
44
+ updateNextStep: () => updateNextStep,
45
+ updateState: () => updateState,
46
+ updateStatus: () => updateStatus,
47
+ updateStep: () => updateStep,
48
+ updateStepKey: () => updateStepKey,
49
+ updateSteps: () => updateSteps,
50
+ updateWarn: () => updateWarn,
51
+ useContextData: () => useContextData,
52
+ useDispatch: () => useDispatch
53
+ });
54
+ module.exports = __toCommonJS(store_exports);
55
+ var import_react = __toESM(require("react"));
56
+ var import_const = require("../const");
57
+ var import_helper = require("../helper");
58
+ var import_useThunkReducer = __toESM(require("./useThunkReducer"));
59
+ var EActionTypes = /* @__PURE__ */ ((EActionTypes2) => {
60
+ EActionTypes2["UPDATE_INIT"] = "UPDATE_INIT";
61
+ EActionTypes2["UPDATE_CUSTOM"] = "UPDATE_CUSTOM";
62
+ EActionTypes2["UPDATE_KEY"] = "UPDATE_KEY";
63
+ EActionTypes2["UPDATE_STEP"] = "UPDATE_STEP";
64
+ EActionTypes2["UPDATE_STEP_KEY"] = "UPDATE_STEP_KEY";
65
+ EActionTypes2["UPDATE_DEVICE"] = "UPDATE_DEVICE";
66
+ EActionTypes2["UPDATE_NEXT_STEP"] = "UPDATE_NEXT_STEP";
67
+ EActionTypes2["UPDATE_STATUS"] = "UPDATE_STATUS";
68
+ EActionTypes2["UPDATE_TITLE"] = "UPDATE_TITLE";
69
+ EActionTypes2["UPDATE_LOADING"] = "UPDATE_LOADING";
70
+ EActionTypes2["UPDATE_COMPONENT"] = "UPDATE_COMPONENT";
71
+ EActionTypes2["UPDATE_STEPS"] = "UPDATE_STEPS";
72
+ EActionTypes2["UPDATE_WARN"] = "UPDATE_WARN";
73
+ EActionTypes2["UPDATE_STEP_CURRENT_ITEM_CUSTOM"] = "UPDATE_STEP_CURRENT_ITEM_CUSTOM";
74
+ EActionTypes2["UPDATE_STEP_ITEM_CUSTOM"] = "UPDATE_STEP_ITEM_CUSTOM";
75
+ EActionTypes2["UPDATE_STEP_ITEM"] = "UPDATE_STEP_ITEM";
76
+ EActionTypes2["BACKUP_PRODUCTION"] = "BACKUP_PRODUCTION";
77
+ EActionTypes2["BACKUP_FREE"] = "BACKUP_FREE";
78
+ return EActionTypes2;
79
+ })(EActionTypes || {});
80
+ var updateKey = (key) => ({
81
+ type: "UPDATE_KEY" /* UPDATE_KEY */,
82
+ payload: {
83
+ key
84
+ }
85
+ });
86
+ var updateDevice = (payload) => ({
87
+ type: "UPDATE_DEVICE" /* UPDATE_DEVICE */,
88
+ payload
89
+ });
90
+ var updateStepKey = () => ({
91
+ type: "UPDATE_STEP_KEY" /* UPDATE_STEP_KEY */,
92
+ payload: {}
93
+ });
94
+ var updateNextStep = (warn) => ({
95
+ type: "UPDATE_NEXT_STEP" /* UPDATE_NEXT_STEP */,
96
+ payload: warn ? { warn } : {}
97
+ });
98
+ var updateStep = (payload) => ({
99
+ type: "UPDATE_STEP" /* UPDATE_STEP */,
100
+ payload
101
+ });
102
+ var updateCustom = (payload) => ({
103
+ type: "UPDATE_CUSTOM" /* UPDATE_CUSTOM */,
104
+ payload
105
+ });
106
+ var updateStatus = (status) => ({
107
+ type: "UPDATE_LOADING" /* UPDATE_LOADING */,
108
+ payload: { status }
109
+ });
110
+ var updateWarn = (warn) => ({
111
+ type: "UPDATE_WARN" /* UPDATE_WARN */,
112
+ payload: { warn }
113
+ });
114
+ var updateComponent = (component, render) => ({
115
+ type: "UPDATE_COMPONENT" /* UPDATE_COMPONENT */,
116
+ payload: component ? {
117
+ component,
118
+ type: "unset",
119
+ render: typeof render === "boolean" ? render : false
120
+ } : {
121
+ type: "step",
122
+ render: typeof render === "boolean" ? render : true
123
+ }
124
+ });
125
+ var updateSteps = (steps) => ({
126
+ type: "UPDATE_STEPS" /* UPDATE_STEPS */,
127
+ payload: { steps }
128
+ });
129
+ var updateState = (payload) => ({
130
+ type: "UPDATE_INIT" /* UPDATE_INIT */,
131
+ payload
132
+ });
133
+ var updateCurrentCustomStemItem = (payload) => ({
134
+ type: "UPDATE_STEP_CURRENT_ITEM_CUSTOM" /* UPDATE_STEP_CURRENT_ITEM_CUSTOM */,
135
+ payload
136
+ });
137
+ var updateCustomStemItem = (payload) => ({
138
+ type: "UPDATE_STEP_ITEM_CUSTOM" /* UPDATE_STEP_ITEM_CUSTOM */,
139
+ payload
140
+ });
141
+ var updateCurrentStemItem = (payload) => ({
142
+ type: "UPDATE_STEP_ITEM" /* UPDATE_STEP_ITEM */,
143
+ payload
144
+ });
145
+ var backUpProduction = (payload) => ({
146
+ type: "BACKUP_PRODUCTION" /* BACKUP_PRODUCTION */,
147
+ payload
148
+ });
149
+ var backUpFree = (payload) => ({
150
+ type: "BACKUP_FREE" /* BACKUP_FREE */,
151
+ payload: {
152
+ ...payload
153
+ }
154
+ });
155
+ var initialState = {
156
+ mode: import_const.ModeEnum.Pay,
157
+ eftpos: "",
158
+ key: 0,
159
+ step: 0,
160
+ type: import_const.PayRouteEnum.Step,
161
+ title: "Processing ...",
162
+ component: "",
163
+ status: import_const.StatusEnum.Loading,
164
+ steps: [],
165
+ warn: "",
166
+ render: true
167
+ };
168
+ var StateContext = (0, import_react.createContext)(void 0);
169
+ var DispatchContext = (0, import_react.createContext)(
170
+ void 0
171
+ );
172
+ function reducers(state, action) {
173
+ switch (action.type) {
174
+ case "UPDATE_INIT" /* UPDATE_INIT */:
175
+ return {
176
+ ...state,
177
+ ...action.payload
178
+ };
179
+ case "UPDATE_NEXT_STEP" /* UPDATE_NEXT_STEP */:
180
+ const currentStep = state.step + 1;
181
+ if (state.step === state.steps.length - 1) {
182
+ state.steps[state.steps.length - 1].status = "success";
183
+ return {
184
+ ...state,
185
+ status: "success",
186
+ steps: [...state.steps]
187
+ };
188
+ }
189
+ state.steps[state.step].status = "success";
190
+ return {
191
+ ...state,
192
+ warn: action.payload.warn || "",
193
+ steps: [...state.steps],
194
+ status: state.steps[currentStep].status,
195
+ step: currentStep
196
+ };
197
+ case "UPDATE_KEY" /* UPDATE_KEY */:
198
+ return {
199
+ ...state,
200
+ ...action.payload
201
+ };
202
+ case "UPDATE_STEP" /* UPDATE_STEP */:
203
+ if (state.type === "unset") {
204
+ return state;
205
+ }
206
+ const { step } = action.payload;
207
+ state.steps.forEach((s2, index2) => {
208
+ if (index2 < step) {
209
+ s2.status = "success";
210
+ }
211
+ });
212
+ const current = step < state.steps.length - 1 ? step : state.steps.length - 1;
213
+ console.log("current ", current);
214
+ return {
215
+ ...state,
216
+ ...{
217
+ step: current,
218
+ warn: action.payload.warn || "",
219
+ status: state.steps[current].status,
220
+ steps: [...state.steps]
221
+ }
222
+ };
223
+ case "UPDATE_LOADING" /* UPDATE_LOADING */:
224
+ return {
225
+ ...state,
226
+ ...action.payload
227
+ };
228
+ case "UPDATE_COMPONENT" /* UPDATE_COMPONENT */:
229
+ return {
230
+ ...state,
231
+ ...action.payload,
232
+ lastComponent: state.component
233
+ };
234
+ case "UPDATE_STEPS" /* UPDATE_STEPS */:
235
+ return {
236
+ ...state,
237
+ ...action.payload
238
+ };
239
+ case "UPDATE_STEP_ITEM" /* UPDATE_STEP_ITEM */:
240
+ state.steps[state.step] = {
241
+ ...state.steps[state.step],
242
+ ...action.payload
243
+ };
244
+ return {
245
+ ...state,
246
+ steps: [...state.steps]
247
+ };
248
+ case "UPDATE_WARN" /* UPDATE_WARN */:
249
+ return {
250
+ ...state,
251
+ ...action.payload
252
+ };
253
+ case "UPDATE_STEP_CURRENT_ITEM_CUSTOM" /* UPDATE_STEP_CURRENT_ITEM_CUSTOM */:
254
+ if (state.steps[state.step].custom) {
255
+ state.steps[state.step].custom = {
256
+ ...state.steps[state.step].custom,
257
+ ...action.payload
258
+ };
259
+ } else {
260
+ state.steps[state.step].custom = {
261
+ ...action.payload
262
+ };
263
+ }
264
+ return {
265
+ ...state,
266
+ steps: [...state.steps]
267
+ };
268
+ case "UPDATE_STEP_ITEM_CUSTOM" /* UPDATE_STEP_ITEM_CUSTOM */:
269
+ const index = action.payload.step;
270
+ const { custom } = action.payload;
271
+ if (state.steps[index].custom) {
272
+ state.steps[index].custom = {
273
+ ...state.steps[index].custom,
274
+ ...custom
275
+ };
276
+ } else {
277
+ state.steps[index].custom = {
278
+ ...custom
279
+ };
280
+ }
281
+ return {
282
+ ...state,
283
+ steps: [...state.steps]
284
+ };
285
+ case "UPDATE_STEP_KEY" /* UPDATE_STEP_KEY */:
286
+ state.steps[state.step].key = Date.now();
287
+ return {
288
+ ...state,
289
+ steps: [...state.steps]
290
+ };
291
+ case "UPDATE_DEVICE" /* UPDATE_DEVICE */:
292
+ return {
293
+ ...state,
294
+ ...action.payload
295
+ };
296
+ case "UPDATE_CUSTOM" /* UPDATE_CUSTOM */:
297
+ return {
298
+ ...state,
299
+ custom: state.custom ? {
300
+ ...state.custom,
301
+ ...action.payload
302
+ } : { ...action.payload }
303
+ // ,
304
+ };
305
+ case "BACKUP_PRODUCTION" /* BACKUP_PRODUCTION */:
306
+ return {
307
+ ...state,
308
+ backup: (0, import_helper.cloneDeep)(state)
309
+ };
310
+ case "BACKUP_FREE" /* BACKUP_FREE */:
311
+ if (!state.backup) {
312
+ return state;
313
+ }
314
+ const { ...s } = state.backup;
315
+ return {
316
+ ...s,
317
+ ...action.payload
318
+ };
319
+ default: {
320
+ throw new Error(`Unhandled action type: ${action.type}`);
321
+ }
322
+ }
323
+ }
324
+ var Provider = ({
325
+ children,
326
+ state: providerState
327
+ }) => {
328
+ const [state, dispatch] = (0, import_useThunkReducer.default)(
329
+ reducers,
330
+ providerState || initialState
331
+ );
332
+ return /* @__PURE__ */ import_react.default.createElement(StateContext.Provider, { value: state }, /* @__PURE__ */ import_react.default.createElement(DispatchContext.Provider, { value: dispatch }, children));
333
+ };
334
+ function useContextData() {
335
+ const context = (0, import_react.useContext)(StateContext);
336
+ if (context === void 0) {
337
+ throw new Error("useState must be used within a Provider");
338
+ }
339
+ return context;
340
+ }
341
+ function useDispatch() {
342
+ const context = (0, import_react.useContext)(DispatchContext);
343
+ if (context === void 0) {
344
+ throw new Error("useDispatch must be used within a Provider");
345
+ }
346
+ return context;
347
+ }
348
+ // Annotate the CommonJS export names for ESM import in node:
349
+ 0 && (module.exports = {
350
+ EActionTypes,
351
+ Provider,
352
+ backUpFree,
353
+ backUpProduction,
354
+ reducers,
355
+ updateComponent,
356
+ updateCurrentCustomStemItem,
357
+ updateCurrentStemItem,
358
+ updateCustom,
359
+ updateCustomStemItem,
360
+ updateDevice,
361
+ updateKey,
362
+ updateNextStep,
363
+ updateState,
364
+ updateStatus,
365
+ updateStep,
366
+ updateStepKey,
367
+ updateSteps,
368
+ updateWarn,
369
+ useContextData,
370
+ useDispatch
371
+ });
@@ -0,0 +1,9 @@
1
+ import { Reducer } from 'react';
2
+ export default function useThunkReducer<State, Action extends {
3
+ [P in keyof Action]: Action[P];
4
+ }>(reducer: Reducer<State, Action>, initialArg: State, init?: (s: State) => State): [State, ThunkDispatch<State, Action>];
5
+ export interface ThunkDispatch<State, Action> {
6
+ <TReturnType>(ThunkAction: ThunkAction<TReturnType, State, Action>): TReturnType;
7
+ (action: Action): void;
8
+ }
9
+ export declare type ThunkAction<TReturnType, State, Action> = (dispatch: ThunkDispatch<State, Action>, getState: () => State) => TReturnType;
@@ -0,0 +1,53 @@
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/store/useThunkReducer.ts
20
+ var useThunkReducer_exports = {};
21
+ __export(useThunkReducer_exports, {
22
+ default: () => useThunkReducer
23
+ });
24
+ module.exports = __toCommonJS(useThunkReducer_exports);
25
+ var import_react = require("react");
26
+ function useThunkReducer(reducer, initialArg, init) {
27
+ const [hookState, setHookState] = (0, import_react.useState)(
28
+ init ? init(initialArg) : initialArg
29
+ );
30
+ const state = (0, import_react.useRef)(hookState);
31
+ const getState = (0, import_react.useCallback)(() => state.current, [state]);
32
+ const setState = (0, import_react.useCallback)(
33
+ (newState) => {
34
+ state.current = newState;
35
+ setHookState(newState);
36
+ },
37
+ [state, setHookState]
38
+ );
39
+ const reduce = (0, import_react.useCallback)(
40
+ (action) => reducer(getState(), action),
41
+ [reducer, getState]
42
+ );
43
+ const dispatch = (0, import_react.useCallback)(
44
+ (action) => {
45
+ if (typeof action === "function") {
46
+ return action(dispatch, getState);
47
+ }
48
+ setState(reduce(action));
49
+ },
50
+ [getState, setState, reduce]
51
+ );
52
+ return [hookState, dispatch];
53
+ }
@@ -0,0 +1,8 @@
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;