@pisell/private-materials 3.0.136 → 3.0.138

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 (219) 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/forms/single/index.js +3 -0
  12. package/es/components/eftpos/const.d.ts +26 -0
  13. package/es/components/eftpos/const.js +40 -8
  14. package/es/components/eftpos/device.d.ts +3 -2
  15. package/es/components/eftpos/device.js +6 -5
  16. package/es/components/eftpos/form/index.d.ts +5 -0
  17. package/es/components/eftpos/form/index.js +8 -0
  18. package/es/components/eftpos/hooks.d.ts +34 -0
  19. package/es/components/{eftposPay/windcave/hook.js → eftpos/hooks.js} +96 -122
  20. package/es/components/eftpos/icon/apiKey.d.ts +5 -0
  21. package/es/components/eftpos/icon/apiKey.js +17 -0
  22. package/es/components/eftpos/icon/device.d.ts +5 -0
  23. package/es/components/eftpos/icon/device.js +19 -0
  24. package/es/components/eftpos/index.d.ts +10 -0
  25. package/es/components/eftpos/index.js +329 -46
  26. package/es/components/eftpos/index.less +38 -1
  27. package/es/components/eftpos/locales.d.ts +12 -0
  28. package/es/components/eftpos/locales.js +15 -3
  29. package/es/components/eftpos/log.d.ts +8 -0
  30. package/es/components/eftpos/log.js +85 -0
  31. package/es/components/eftpos/pos.d.ts +1 -1
  32. package/es/components/eftpos/pos.js +8 -5
  33. package/es/components/eftpos/surcharge/index.d.ts +25 -2
  34. package/es/components/eftpos/surcharge/index.js +100 -16
  35. package/es/components/eftpos/table.d.ts +4 -0
  36. package/es/components/eftpos/table.js +102 -10
  37. package/es/components/eftposPay/amount.d.ts +7 -1
  38. package/es/components/eftposPay/amount.js +65 -38
  39. package/es/components/eftposPay/component/fail/failCustom.js +65 -20
  40. package/es/components/eftposPay/component/fail/index.js +60 -30
  41. package/es/components/eftposPay/component/fail/network.d.ts +5 -0
  42. package/es/components/eftposPay/component/fail/network.js +13 -0
  43. package/es/components/eftposPay/component/fail/unknow.d.ts +6 -0
  44. package/es/components/eftposPay/component/fail/unknow.js +18 -3
  45. package/es/components/eftposPay/component/header/index.d.ts +2 -1
  46. package/es/components/eftposPay/component/header/index.js +4 -1
  47. package/es/components/eftposPay/component/header/index.less +1 -10
  48. package/es/components/eftposPay/component/manual/index.d.ts +6 -1
  49. package/es/components/eftposPay/component/manual/index.js +174 -23
  50. package/es/components/eftposPay/component/manual/index.less +42 -14
  51. package/es/components/eftposPay/component/signature/index.d.ts +5 -0
  52. package/es/components/eftposPay/component/signature/index.js +20 -2
  53. package/es/components/eftposPay/component/step/index.d.ts +7 -7
  54. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  55. package/es/components/eftposPay/const.d.ts +19 -4
  56. package/es/components/eftposPay/const.js +4 -2
  57. package/es/components/eftposPay/device.d.ts +7 -0
  58. package/es/components/eftposPay/device.js +22 -0
  59. package/es/components/eftposPay/helper.d.ts +54 -0
  60. package/es/components/eftposPay/helper.js +93 -1
  61. package/es/components/eftposPay/hooks.d.ts +30 -1
  62. package/es/components/eftposPay/hooks.js +181 -26
  63. package/es/components/eftposPay/index.d.ts +2 -4
  64. package/es/components/eftposPay/index.js +119 -31
  65. package/es/components/eftposPay/index.less +27 -19
  66. package/es/components/eftposPay/locales.d.ts +45 -0
  67. package/es/components/eftposPay/locales.js +348 -3
  68. package/es/components/eftposPay/manufacturer.d.ts +2 -2
  69. package/es/components/eftposPay/manufacturer.js +9 -10
  70. package/es/components/eftposPay/pay.d.ts +10 -1
  71. package/es/components/eftposPay/pay.js +112 -34
  72. package/es/components/eftposPay/payo/config.js +137 -270
  73. package/es/components/eftposPay/payo/const.d.ts +22 -2
  74. package/es/components/eftposPay/payo/const.js +83 -33
  75. package/es/components/eftposPay/payo/hooks.d.ts +5 -0
  76. package/es/components/eftposPay/payo/hooks.js +19 -2
  77. package/es/components/eftposPay/store/index.d.ts +154 -53
  78. package/es/components/eftposPay/store/index.js +112 -60
  79. package/es/components/eftposPay/tyro/const.d.ts +17 -0
  80. package/es/components/eftposPay/{eftpos → tyro}/const.js +71 -90
  81. package/es/components/eftposPay/tyro/hooks.d.ts +14 -0
  82. package/es/components/eftposPay/tyro/hooks.js +40 -0
  83. package/es/components/eftposPay/tyro/index.d.ts +9 -0
  84. package/es/components/eftposPay/tyro/index.js +575 -0
  85. package/es/components/eftposPay/windcave/const.d.ts +24 -9
  86. package/es/components/eftposPay/windcave/const.js +90 -81
  87. package/es/components/eftposPay/windcave/helper.d.ts +16 -2
  88. package/es/components/eftposPay/windcave/helper.js +175 -42
  89. package/es/components/eftposPay/windcave/receiptAction.d.ts +12 -0
  90. package/es/components/eftposPay/windcave/receiptAction.js +91 -43
  91. package/es/components/eftposPay/windcave/timer.d.ts +13 -1
  92. package/es/components/eftposPay/windcave/timer.js +18 -1
  93. package/es/components/eftposPay/windcave/windcave.d.ts +2 -1
  94. package/es/components/eftposPay/windcave/windcave.js +155 -139
  95. package/es/utils/load.d.ts +11 -0
  96. package/es/utils/load.js +85 -0
  97. package/lib/components/booking/forms/single/index.js +1 -0
  98. package/lib/components/eftpos/const.d.ts +26 -0
  99. package/lib/components/eftpos/const.js +13 -1
  100. package/lib/components/eftpos/device.d.ts +3 -2
  101. package/lib/components/eftpos/device.js +2 -2
  102. package/lib/components/eftpos/form/index.d.ts +5 -0
  103. package/lib/components/eftpos/hooks.d.ts +34 -0
  104. package/lib/components/eftpos/hooks.js +106 -0
  105. package/lib/components/eftpos/icon/apiKey.d.ts +5 -0
  106. package/lib/components/eftpos/icon/apiKey.js +57 -0
  107. package/lib/components/eftpos/icon/device.d.ts +5 -0
  108. package/lib/components/eftpos/icon/device.js +57 -0
  109. package/lib/components/eftpos/index.d.ts +10 -0
  110. package/lib/components/eftpos/index.js +262 -97
  111. package/lib/components/eftpos/index.less +38 -1
  112. package/lib/components/eftpos/locales.d.ts +12 -0
  113. package/lib/components/eftpos/locales.js +15 -3
  114. package/lib/components/eftpos/log.d.ts +8 -0
  115. package/lib/components/eftpos/log.js +87 -0
  116. package/lib/components/eftpos/pos.d.ts +1 -1
  117. package/lib/components/eftpos/pos.js +5 -4
  118. package/lib/components/eftpos/surcharge/index.d.ts +25 -2
  119. package/lib/components/eftpos/surcharge/index.js +36 -6
  120. package/lib/components/eftpos/table.d.ts +4 -0
  121. package/lib/components/eftpos/table.js +40 -8
  122. package/lib/components/eftposPay/amount.d.ts +7 -1
  123. package/lib/components/eftposPay/amount.js +10 -33
  124. package/lib/components/eftposPay/component/fail/failCustom.js +27 -6
  125. package/lib/components/eftposPay/component/fail/index.js +39 -18
  126. package/lib/components/eftposPay/component/fail/network.d.ts +5 -0
  127. package/lib/components/eftposPay/component/fail/unknow.d.ts +6 -0
  128. package/lib/components/eftposPay/component/fail/unknow.js +3 -3
  129. package/lib/components/eftposPay/component/header/index.d.ts +2 -1
  130. package/lib/components/eftposPay/component/header/index.js +2 -1
  131. package/lib/components/eftposPay/component/header/index.less +1 -10
  132. package/lib/components/eftposPay/component/manual/index.d.ts +6 -1
  133. package/lib/components/eftposPay/component/manual/index.js +122 -31
  134. package/lib/components/eftposPay/component/manual/index.less +42 -14
  135. package/lib/components/eftposPay/component/signature/index.d.ts +5 -0
  136. package/lib/components/eftposPay/component/signature/index.js +2 -2
  137. package/lib/components/eftposPay/component/step/index.d.ts +7 -7
  138. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  139. package/lib/components/eftposPay/const.d.ts +19 -4
  140. package/lib/components/eftposPay/const.js +3 -1
  141. package/lib/components/eftposPay/device.d.ts +7 -0
  142. package/lib/components/eftposPay/helper.d.ts +54 -0
  143. package/lib/components/eftposPay/helper.js +64 -0
  144. package/lib/components/eftposPay/hooks.d.ts +30 -1
  145. package/lib/components/eftposPay/hooks.js +182 -44
  146. package/lib/components/eftposPay/index.d.ts +2 -4
  147. package/lib/components/eftposPay/index.js +74 -27
  148. package/lib/components/eftposPay/index.less +27 -19
  149. package/lib/components/eftposPay/locales.d.ts +45 -0
  150. package/lib/components/eftposPay/locales.js +352 -3
  151. package/lib/components/eftposPay/manufacturer.d.ts +2 -2
  152. package/lib/components/eftposPay/manufacturer.js +13 -13
  153. package/lib/components/eftposPay/pay.d.ts +10 -1
  154. package/lib/components/eftposPay/pay.js +86 -25
  155. package/lib/components/eftposPay/payo/config.js +121 -268
  156. package/lib/components/eftposPay/payo/const.d.ts +22 -2
  157. package/lib/components/eftposPay/payo/const.js +55 -36
  158. package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
  159. package/lib/components/eftposPay/payo/hooks.js +1 -1
  160. package/lib/components/eftposPay/store/index.d.ts +154 -53
  161. package/lib/components/eftposPay/store/index.js +7 -66
  162. package/lib/components/eftposPay/tyro/const.d.ts +17 -0
  163. package/lib/components/eftposPay/tyro/const.js +114 -0
  164. package/lib/components/eftposPay/tyro/hooks.d.ts +14 -0
  165. package/lib/components/eftposPay/{eftpos/index.js → tyro/hooks.js} +31 -36
  166. package/lib/components/eftposPay/tyro/index.d.ts +9 -0
  167. package/lib/components/eftposPay/tyro/index.js +558 -0
  168. package/lib/components/eftposPay/windcave/const.d.ts +24 -9
  169. package/lib/components/eftposPay/windcave/const.js +53 -104
  170. package/lib/components/eftposPay/windcave/helper.d.ts +16 -2
  171. package/lib/components/eftposPay/windcave/helper.js +163 -48
  172. package/lib/components/eftposPay/windcave/receiptAction.d.ts +12 -0
  173. package/lib/components/eftposPay/windcave/receiptAction.js +15 -47
  174. package/lib/components/eftposPay/windcave/timer.d.ts +13 -1
  175. package/lib/components/eftposPay/windcave/timer.js +5 -0
  176. package/lib/components/eftposPay/windcave/windcave.d.ts +2 -1
  177. package/lib/components/eftposPay/windcave/windcave.js +130 -130
  178. package/lib/utils/load.d.ts +11 -0
  179. package/lib/utils/load.js +100 -0
  180. package/lowcode/eftpos/meta.ts +202 -160
  181. package/lowcode/eftpos-pay/meta.ts +45 -12
  182. package/package.json +4 -4
  183. package/es/components/eftposPay/eftpos/config.d.ts +0 -11
  184. package/es/components/eftposPay/eftpos/config.js +0 -178
  185. package/es/components/eftposPay/eftpos/const.d.ts +0 -10
  186. package/es/components/eftposPay/eftpos/index.d.ts +0 -7
  187. package/es/components/eftposPay/eftpos/index.js +0 -35
  188. package/es/components/eftposPay/windcave/action.d.ts +0 -8
  189. package/es/components/eftposPay/windcave/action.js +0 -104
  190. package/es/components/eftposPay/windcave/hook.d.ts +0 -14
  191. package/es/components/eftposPay/windcave/index.d.ts +0 -8
  192. package/es/components/eftposPay/windcave/index.js +0 -49
  193. package/es/components/eftposPay/windcave/pos.d.ts +0 -8
  194. package/es/components/eftposPay/windcave/pos.js +0 -180
  195. package/es/components/eftposPay/windcave/pwd.d.ts +0 -8
  196. package/es/components/eftposPay/windcave/pwd.js +0 -124
  197. package/es/components/eftposPay/windcave/receipet.d.ts +0 -6
  198. package/es/components/eftposPay/windcave/receipet.js +0 -67
  199. package/es/components/eftposPay/windcave/wait.d.ts +0 -12
  200. package/es/components/eftposPay/windcave/wait.js +0 -139
  201. package/lib/components/eftposPay/eftpos/config.d.ts +0 -11
  202. package/lib/components/eftposPay/eftpos/config.js +0 -199
  203. package/lib/components/eftposPay/eftpos/const.d.ts +0 -10
  204. package/lib/components/eftposPay/eftpos/const.js +0 -165
  205. package/lib/components/eftposPay/eftpos/index.d.ts +0 -7
  206. package/lib/components/eftposPay/windcave/action.d.ts +0 -8
  207. package/lib/components/eftposPay/windcave/action.js +0 -143
  208. package/lib/components/eftposPay/windcave/hook.d.ts +0 -14
  209. package/lib/components/eftposPay/windcave/hook.js +0 -139
  210. package/lib/components/eftposPay/windcave/index.d.ts +0 -8
  211. package/lib/components/eftposPay/windcave/index.js +0 -78
  212. package/lib/components/eftposPay/windcave/pos.d.ts +0 -8
  213. package/lib/components/eftposPay/windcave/pos.js +0 -197
  214. package/lib/components/eftposPay/windcave/pwd.d.ts +0 -8
  215. package/lib/components/eftposPay/windcave/pwd.js +0 -143
  216. package/lib/components/eftposPay/windcave/receipet.d.ts +0 -6
  217. package/lib/components/eftposPay/windcave/receipet.js +0 -93
  218. package/lib/components/eftposPay/windcave/wait.d.ts +0 -12
  219. package/lib/components/eftposPay/windcave/wait.js +0 -163
@@ -25,7 +25,6 @@ export var EActionTypes;
25
25
  EActionTypes["UPDATE_INIT"] = "UPDATE_INIT";
26
26
  EActionTypes["UPDATE_CUSTOM"] = "UPDATE_CUSTOM";
27
27
  EActionTypes["UPDATE_KEY"] = "UPDATE_KEY";
28
- EActionTypes["UPDATE_STEP"] = "UPDATE_STEP";
29
28
  EActionTypes["UPDATE_STEP_KEY"] = "UPDATE_STEP_KEY";
30
29
  EActionTypes["UPDATE_DEVICE"] = "UPDATE_DEVICE";
31
30
  EActionTypes["UPDATE_NEXT_STEP"] = "UPDATE_NEXT_STEP";
@@ -34,13 +33,18 @@ export var EActionTypes;
34
33
  EActionTypes["UPDATE_LOADING"] = "UPDATE_LOADING";
35
34
  EActionTypes["UPDATE_COMPONENT"] = "UPDATE_COMPONENT";
36
35
  EActionTypes["UPDATE_STEPS"] = "UPDATE_STEPS";
37
- EActionTypes["UPDATE_WARN"] = "UPDATE_WARN";
38
36
  EActionTypes["UPDATE_STEP_CURRENT_ITEM_CUSTOM"] = "UPDATE_STEP_CURRENT_ITEM_CUSTOM";
39
- EActionTypes["UPDATE_STEP_ITEM_CUSTOM"] = "UPDATE_STEP_ITEM_CUSTOM";
40
37
  EActionTypes["UPDATE_STEP_ITEM"] = "UPDATE_STEP_ITEM";
41
38
  EActionTypes["BACKUP_PRODUCTION"] = "BACKUP_PRODUCTION";
42
39
  EActionTypes["BACKUP_FREE"] = "BACKUP_FREE";
43
40
  })(EActionTypes || (EActionTypes = {}));
41
+ /**
42
+ * @title: 刷新 key
43
+ * @description: 用户重置组件生命周期,
44
+ * @param {number} key
45
+ * @Author: hongbing.wang
46
+ * @Date: 2024-08-19 09:56
47
+ */
44
48
  export var updateKey = function updateKey(key) {
45
49
  return {
46
50
  type: EActionTypes.UPDATE_KEY,
@@ -49,18 +53,41 @@ export var updateKey = function updateKey(key) {
49
53
  }
50
54
  };
51
55
  };
56
+
57
+ /**
58
+ * @title: 更新设备信息
59
+ * @description: 用户选择设备将回填到此处
60
+ * @param {object} payload
61
+ * @Author: hongbing.wang
62
+ * @Date: 2024-08-19 09:57
63
+ */
52
64
  export var updateDevice = function updateDevice(payload) {
53
65
  return {
54
66
  type: EActionTypes.UPDATE_DEVICE,
55
67
  payload: payload
56
68
  };
57
69
  };
70
+
71
+ /**
72
+ * @title: 刷新 步骤key
73
+ * @description: 重置某一步生命周期
74
+ * @Author: hongbing.wang
75
+ * @Date: 2024-08-19 09:58
76
+ */
58
77
  export var updateStepKey = function updateStepKey() {
59
78
  return {
60
79
  type: EActionTypes.UPDATE_STEP_KEY,
61
80
  payload: {}
62
81
  };
63
82
  };
83
+
84
+ /**
85
+ * @title: 更新至下一步
86
+ * @description: 更新至下一步
87
+ * @param {string} warn?: 错误信息
88
+ * @Author: hongbing.wang
89
+ * @Date: 2024-08-19 09:58
90
+ */
64
91
  export var updateNextStep = function updateNextStep(warn) {
65
92
  return {
66
93
  type: EActionTypes.UPDATE_NEXT_STEP,
@@ -69,18 +96,28 @@ export var updateNextStep = function updateNextStep(warn) {
69
96
  } : {}
70
97
  };
71
98
  };
72
- export var updateStep = function updateStep(payload) {
73
- return {
74
- type: EActionTypes.UPDATE_STEP,
75
- payload: payload
76
- };
77
- };
99
+
100
+ /**
101
+ * @title: 更新自定义信息
102
+ * @description: 更新自定义信息
103
+ * @param {object} payload
104
+ * @Author: hongbing.wang
105
+ * @Date: 2024-08-19 10:03
106
+ */
78
107
  export var updateCustom = function updateCustom(payload) {
79
108
  return {
80
109
  type: EActionTypes.UPDATE_CUSTOM,
81
110
  payload: payload
82
111
  };
83
112
  };
113
+
114
+ /**
115
+ * @title: 更新 全局状态
116
+ * @description: 更新 全局状态
117
+ * @param {string} status : 状态
118
+ * * @Author: hongbing.wang
119
+ * @Date: 2024-08-19 10:03
120
+ */
84
121
  export var updateStatus = function updateStatus(status) {
85
122
  return {
86
123
  type: EActionTypes.UPDATE_LOADING,
@@ -89,14 +126,16 @@ export var updateStatus = function updateStatus(status) {
89
126
  }
90
127
  };
91
128
  };
92
- export var updateWarn = function updateWarn(warn) {
93
- return {
94
- type: EActionTypes.UPDATE_WARN,
95
- payload: {
96
- warn: warn
97
- }
98
- };
99
- };
129
+
130
+ /**
131
+ * @title: 更新自定义组件
132
+ * @description: 更新自定义组件
133
+ * @param {string} component 组件名称
134
+ * @param {boolean} render : true : 隐藏 原组件(维持原组件内状态) ;false : 卸载
135
+ * @return {*}
136
+ * @Author: hongbing.wang
137
+ * @Date: 2024-08-19 10:04
138
+ */
100
139
  export var updateComponent = function updateComponent(component, render) {
101
140
  return {
102
141
  type: EActionTypes.UPDATE_COMPONENT,
@@ -110,6 +149,14 @@ export var updateComponent = function updateComponent(component, render) {
110
149
  }
111
150
  };
112
151
  };
152
+
153
+ /**
154
+ * @title: 更新步骤信息
155
+ * @description: 更新某一步骤信息
156
+ * @param {State} steps 某一步骤信息
157
+ * @Author: hongbing.wang
158
+ * @Date: 2024-08-19 10:07
159
+ */
113
160
  export var updateSteps = function updateSteps(steps) {
114
161
  return {
115
162
  type: EActionTypes.UPDATE_STEPS,
@@ -118,36 +165,68 @@ export var updateSteps = function updateSteps(steps) {
118
165
  }
119
166
  };
120
167
  };
168
+
169
+ /**
170
+ * @title: 更新状态管理信息
171
+ * @description: 更新状态管理信息
172
+ * @param {Partial} payload
173
+ * @return {*}
174
+ * @Author: hongbing.wang
175
+ * @Date: 2024-08-19 10:08
176
+ */
121
177
  export var updateState = function updateState(payload) {
122
178
  return {
123
179
  type: EActionTypes.UPDATE_INIT,
124
180
  payload: payload
125
181
  };
126
182
  };
183
+
184
+ /**
185
+ * @title: 更新当前步骤自定义信息
186
+ * @description: 更新当前步骤自定义信息
187
+ * @Author: hongbing.wang
188
+ * @Date: 2024-08-19 10:09
189
+ */
127
190
  export var updateCurrentCustomStemItem = function updateCurrentCustomStemItem(payload) {
128
191
  return {
129
192
  type: EActionTypes.UPDATE_STEP_CURRENT_ITEM_CUSTOM,
130
193
  payload: payload
131
194
  };
132
195
  };
133
- export var updateCustomStemItem = function updateCustomStemItem(payload) {
134
- return {
135
- type: EActionTypes.UPDATE_STEP_ITEM_CUSTOM,
136
- payload: payload
137
- };
138
- };
196
+
197
+ /**
198
+ * @title: 更新当前步骤信息
199
+ * @description: 更新当前步骤信息
200
+ * @Author: hongbing.wang
201
+ * @Date: 2024-08-19 10:09
202
+ */
139
203
  export var updateCurrentStemItem = function updateCurrentStemItem(payload) {
140
204
  return {
141
205
  type: EActionTypes.UPDATE_STEP_ITEM,
142
206
  payload: payload
143
207
  };
144
208
  };
209
+
210
+ /**
211
+ * @title: 更新备份信息
212
+ * @description: 更新备份信息
213
+ * @Author: hongbing.wang
214
+ * @Date: 2024-08-19 10:25
215
+ */
145
216
  export var backUpProduction = function backUpProduction(payload) {
146
217
  return {
147
218
  type: EActionTypes.BACKUP_PRODUCTION,
148
219
  payload: payload
149
220
  };
150
221
  };
222
+
223
+ /**
224
+ * @title: 释放备份信息
225
+ * @description: 释放备份信息
226
+ * @param {Partial} payload
227
+ * @Author: hongbing.wang
228
+ * @Date: 2024-08-19 10:27
229
+ */
151
230
  export var backUpFree = function backUpFree(payload) {
152
231
  return {
153
232
  type: EActionTypes.BACKUP_FREE,
@@ -155,12 +234,17 @@ export var backUpFree = function backUpFree(payload) {
155
234
  };
156
235
  };
157
236
  var initialState = {
237
+ name: '',
238
+ symbol: '',
239
+ amount: '',
240
+ order_id: '',
158
241
  mode: ModeEnum.Pay,
159
242
  eftpos: '',
160
243
  key: 0,
161
244
  step: 0,
162
245
  type: PayRouteEnum.Step,
163
- title: 'Processing ...',
246
+ title: '',
247
+ net: true,
164
248
  component: '',
165
249
  status: StatusEnum.Loading,
166
250
  steps: [],
@@ -192,30 +276,11 @@ export function reducers(state, action) {
192
276
  });
193
277
  case EActionTypes.UPDATE_KEY:
194
278
  return _objectSpread(_objectSpread({}, state), action.payload);
195
- case EActionTypes.UPDATE_STEP:
196
- if (state.type === 'unset') {
197
- return state;
198
- }
199
- var _ref = action.payload,
200
- step = _ref.step;
201
- state.steps.forEach(function (s, index) {
202
- if (index < step) {
203
- s.status = 'success';
204
- }
205
- });
206
- var current = step < state.steps.length - 1 ? step : state.steps.length - 1;
207
- console.log('current ', current);
208
- return _objectSpread(_objectSpread({}, state), {
209
- step: current,
210
- warn: action.payload.warn || '',
211
- status: state.steps[current].status,
212
- steps: _toConsumableArray(state.steps)
213
- });
214
279
  case EActionTypes.UPDATE_LOADING:
215
280
  return _objectSpread(_objectSpread({}, state), action.payload);
216
281
  case EActionTypes.UPDATE_COMPONENT:
217
282
  return _objectSpread(_objectSpread(_objectSpread({}, state), action.payload), {}, {
218
- lastComponent: state.component
283
+ form: state.component
219
284
  });
220
285
  case EActionTypes.UPDATE_STEPS:
221
286
  return _objectSpread(_objectSpread({}, state), action.payload);
@@ -224,8 +289,6 @@ export function reducers(state, action) {
224
289
  return _objectSpread(_objectSpread({}, state), {}, {
225
290
  steps: _toConsumableArray(state.steps)
226
291
  });
227
- case EActionTypes.UPDATE_WARN:
228
- return _objectSpread(_objectSpread({}, state), action.payload);
229
292
  case EActionTypes.UPDATE_STEP_CURRENT_ITEM_CUSTOM:
230
293
  if (state.steps[state.step].custom) {
231
294
  state.steps[state.step].custom = _objectSpread(_objectSpread({}, state.steps[state.step].custom), action.payload);
@@ -235,17 +298,6 @@ export function reducers(state, action) {
235
298
  return _objectSpread(_objectSpread({}, state), {}, {
236
299
  steps: _toConsumableArray(state.steps)
237
300
  });
238
- case EActionTypes.UPDATE_STEP_ITEM_CUSTOM:
239
- var index = action.payload.step;
240
- var custom = action.payload.custom;
241
- if (state.steps[index].custom) {
242
- state.steps[index].custom = _objectSpread(_objectSpread({}, state.steps[index].custom), custom);
243
- } else {
244
- state.steps[index].custom = _objectSpread({}, custom);
245
- }
246
- return _objectSpread(_objectSpread({}, state), {}, {
247
- steps: _toConsumableArray(state.steps)
248
- });
249
301
  case EActionTypes.UPDATE_STEP_KEY:
250
302
  state.steps[state.step].key = Date.now();
251
303
  return _objectSpread(_objectSpread({}, state), {}, {
@@ -275,9 +327,9 @@ export function reducers(state, action) {
275
327
  }
276
328
  }
277
329
  }
278
- export var Provider = function Provider(_ref2) {
279
- var children = _ref2.children,
280
- providerState = _ref2.state;
330
+ export var Provider = function Provider(_ref) {
331
+ var children = _ref.children,
332
+ providerState = _ref.state;
281
333
  var _useThunkReducer = useThunkReducer(reducers, providerState || initialState),
282
334
  _useThunkReducer2 = _slicedToArray(_useThunkReducer, 2),
283
335
  state = _useThunkReducer2[0],
@@ -0,0 +1,17 @@
1
+ import { Amount } from '../const';
2
+ import { State } from '../store';
3
+ /**
4
+ * @title: 初始化 tyro 数据
5
+ * @Author: hongbing.wang
6
+ * @Date: 2024-08-20 13:50
7
+ */
8
+ declare const _default: (params: any) => State;
9
+ export default _default;
10
+ /**
11
+ * @title: tyro 金额信息
12
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
13
+ * @param {State} store : 全局store数据管理
14
+ * @Author: hongbing.wang
15
+ * @Date: 2024-08-12 10:24
16
+ */
17
+ export declare function getAmonunt(store: State): Amount;
@@ -1,139 +1,120 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net"];
2
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
7
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
10
  import { locales } from '@pisell/utils';
8
11
  import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum } from "../const";
9
- export var getStep = function getStep() {
10
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
11
- amount: '0',
12
- symbol: '',
12
+ /**
13
+ * @title: 初始化 tyro 数据
14
+ * @Author: hongbing.wang
15
+ * @Date: 2024-08-20 13:50
16
+ */
17
+ export default (function (params) {
18
+ var _ref = params || {
13
19
  mode: ModeEnum.Pay
14
20
  },
15
- amount = _ref.amount,
21
+ order_id = _ref.order_id,
22
+ name = _ref.name,
16
23
  symbol = _ref.symbol,
17
- mode = _ref.mode;
18
- return [{
19
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
20
- key: Date.now(),
21
- text: locales.getText('page.eftpos-pay.text.wait')(symbol + amount, mode),
22
- // 'Asked EFTPOS to accept payment for Purchase $100...',
23
- warn: '',
24
- tip: 'processing...',
25
- status: 'loading'
26
- }, {
27
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
28
- key: Date.now(),
29
- text: locales.getText('page.eftpos-pay.text.surcharge'),
30
- warn: '',
31
- tip: 'processing...',
32
- status: 'loading'
33
- }, {
34
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
35
- key: Date.now(),
36
- text: locales.getText('page.eftpos-pay.text.account'),
37
- warn: '',
38
- tip: 'processing...',
39
- status: 'loading'
40
- }, {
41
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
42
- key: Date.now(),
43
- text: locales.getText('page.eftpos-pay.text.pin'),
44
- warn: '',
45
- tip: 'processing...',
46
- status: 'loading'
47
- }, {
48
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
49
- key: Date.now(),
50
- text: locales.getText('page.eftpos-pay.text.receipt'),
51
- warn: '',
52
- tip: 'processing...',
53
- status: 'loading'
54
- }, {
55
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
56
- key: Date.now(),
57
- text: locales.getText('page.eftpos-pay.text.receipt.again.title'),
58
- warn: locales.getText('page.eftpos-pay.text.receipt.again.text'),
59
- tip: '',
60
- status: 'warn'
61
- }, {
62
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
63
- key: Date.now(),
64
- text: 'Waiting for the appvoval...',
65
- success: 'Approade',
66
- warn: '',
67
- tip: 'processing...',
68
- status: 'loading'
69
- }];
70
- };
71
- var getInitState = function getInitState(params) {
72
- return _objectSpread({
73
- mode: (params === null || params === void 0 ? void 0 : params.mode) || ModeEnum.Pay,
74
- eftpos: EftposEnum.Eftpos,
24
+ amount = _ref.amount,
25
+ mode = _ref.mode,
26
+ number = _ref.number,
27
+ pay = _ref.pay,
28
+ device = _ref.device,
29
+ net = _ref.net,
30
+ other = _objectWithoutProperties(_ref, _excluded);
31
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
32
+ name: name,
33
+ symbol: symbol,
34
+ amount: amount,
35
+ order_id: order_id,
36
+ mode: mode,
37
+ eftpos: EftposEnum.Tyro,
75
38
  key: Date.now(),
76
39
  warn: '',
77
40
  step: 0,
78
41
  type: PayRouteEnum.Step,
79
- title: locales.getText('page.eftpos-pay.text.loading')((params === null || params === void 0 ? void 0 : params.mode) || ModeEnum.Pay),
42
+ title: locales.getText('page.eftpos-pay.text.loading')(mode),
80
43
  component: '',
81
44
  status: StatusEnum.Loading,
82
- steps: getStep(params),
83
- custom: params,
84
- render: true
85
- }, params.device ? {
86
- device: params.device
45
+ steps: [],
46
+ render: true,
47
+ custom: other || {}
48
+ }, typeof net !== 'undefined' ? {
49
+ net: net
50
+ } : {}), typeof number !== 'undefined' ? {
51
+ number: number
52
+ } : {}), typeof pay !== 'undefined' ? {
53
+ pay: pay
54
+ } : {}), typeof device !== 'undefined' ? {
55
+ device: device
87
56
  } : {});
88
- };
89
- export default getInitState;
57
+ });
58
+
59
+ /**
60
+ * @title: tyro 金额信息
61
+ * @description: 在 amount 页面设置则使用 pay ,如果有 setting 则使用 setting 信息 ,都没有则设置0
62
+ * @param {State} store : 全局store数据管理
63
+ * @Author: hongbing.wang
64
+ * @Date: 2024-08-12 10:24
65
+ */
90
66
  export function getAmonunt(store) {
91
67
  var device = store.device,
92
- custom = store.custom;
68
+ pay = store.pay,
69
+ custom = store.custom,
70
+ name = store.name,
71
+ symbol = store.symbol,
72
+ amount = store.amount;
93
73
  if (!device || !custom) {
94
74
  throw Error('device or custom is not defined');
95
75
  }
96
- var name = custom.name;
97
- var symbol = custom.symbol;
98
- // const format = custom.format as string;
99
- var money = custom.amount;
100
- var pay = custom.pay;
101
76
  var setting = device.setting;
77
+
78
+ // 从 金额编辑页 获取到 支付数据
102
79
  if (pay) {
103
80
  return {
104
81
  name: name,
105
82
  symbol: symbol,
106
- // format,
107
- money: money,
83
+ money: Number(amount),
108
84
  amount: Number(pay.amount),
109
85
  surRate: Number(pay.surRate),
110
86
  surMoney: Number(pay.surMoney),
111
- surcharge: (setting === null || setting === void 0 ? void 0 : setting.surcharge) || false
87
+ surcharge: (setting === null || setting === void 0 ? void 0 : setting.surcharge) || false,
88
+ useOriginSurcharge: (pay === null || pay === void 0 ? void 0 : pay.useOriginSurcharge) || false
112
89
  };
113
90
  }
91
+
92
+ // 直接获取支付金额
114
93
  if (!setting) {
115
94
  return {
116
95
  name: name,
117
96
  symbol: symbol,
118
- // format,
119
- money: money,
120
- amount: money,
97
+ money: Number(amount),
98
+ amount: Number(amount),
121
99
  surRate: 0,
122
100
  surMoney: 0,
123
- surcharge: false
101
+ surcharge: false,
102
+ useOriginSurcharge: false
124
103
  };
125
104
  }
105
+ // 直接设备中手续费金额
126
106
  var surRate = setting.constant_rate || 0;
127
107
  var surMoney = setting.constant_money || 0;
128
108
  var surcharge = setting.surcharge;
109
+ var useOriginSurcharge = setting.useOriginSurcharge || false;
129
110
  return {
130
111
  name: name,
131
112
  symbol: symbol,
132
- // format,
133
- money: money,
134
- amount: money,
135
- surRate: surcharge ? surRate : 0,
136
- surMoney: surcharge ? surMoney : 0,
137
- surcharge: surcharge
113
+ money: Number(amount),
114
+ amount: Number(amount),
115
+ surRate: useOriginSurcharge ? 0 : surcharge ? surRate : 0,
116
+ surMoney: useOriginSurcharge ? 0 : surcharge ? surMoney : 0,
117
+ surcharge: surcharge,
118
+ useOriginSurcharge: useOriginSurcharge
138
119
  };
139
120
  }
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * @title: 获取 Tyro 资源
4
+ * @description:
5
+ * @param {Eftpos} type 类型
6
+ * @param {string} url 链接
7
+ * @return {*}
8
+ * @Author: hongbing.wang
9
+ * @Date: 2024-08-19 18:36
10
+ */
11
+ export declare const useTyro: (params: {
12
+ url?: string | undefined;
13
+ version?: string | undefined;
14
+ }) => readonly [import("react").MutableRefObject<any>, boolean];
@@ -0,0 +1,40 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useEffect, useMemo, useRef, useState } from 'react';
8
+ import loadjs from "../../../utils/load";
9
+
10
+ /**
11
+ * @title: 获取 Tyro 资源
12
+ * @description:
13
+ * @param {Eftpos} type 类型
14
+ * @param {string} url 链接
15
+ * @return {*}
16
+ * @Author: hongbing.wang
17
+ * @Date: 2024-08-19 18:36
18
+ */
19
+ export var useTyro = function useTyro(params) {
20
+ var ref = useRef();
21
+ var _useState = useState(false),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ load = _useState2[0],
24
+ setLoad = _useState2[1];
25
+ var url = useMemo(function () {
26
+ return params && params.url && params.version ? "".concat(params.url, "/").concat(params.version) : 'https://iclientsimulator.test.tyro.com/iclient-v1.js';
27
+ }, [params]);
28
+ useEffect(function () {
29
+ loadjs(url, document.head).then(function () {
30
+ var _window;
31
+ return (_window = window) === null || _window === void 0 ? void 0 : _window.TYRO;
32
+ }).then(function (res) {
33
+ setLoad(true);
34
+ ref.current = res;
35
+ }, function () {
36
+ setLoad(true);
37
+ });
38
+ }, [url]);
39
+ return [ref, load];
40
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const _default: ({ api, onChange, children, url, version, }: {
3
+ api: any;
4
+ onChange: any;
5
+ children?: React.ReactNode;
6
+ url?: string | undefined;
7
+ version?: string | undefined;
8
+ }) => React.JSX.Element;
9
+ export default _default;