@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
@@ -13,57 +13,83 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
13
  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; }
14
14
  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; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useState, useRef, useEffect } from 'react';
17
- import { Spin } from 'antd';
16
+ import React, { useState, useRef, useEffect, useCallback, useImperativeHandle, forwardRef } from 'react';
17
+ import { useMount } from 'ahooks';
18
+ import { Spin, message, Form, Input } from 'antd';
18
19
  import { locales } from '@pisell/utils';
19
20
  import Table from "./table";
20
21
  import Device from "./device";
21
22
  import Pos from "./pos";
22
23
  import Drawer from "../booking/components/drawer";
24
+ import Log from "./log";
23
25
  import localeTexts from "./locales";
24
- import { Eftpos, getCommByFields, DeviceEnum } from "./const";
26
+ import { usePairTerminalo } from "./hooks";
27
+ import ApiKeyIcon from "./icon/apiKey";
28
+ import DeviceIcon from "./icon/device";
29
+ import { Eftpos, getCommByFields, DeviceEnum, getDefaultValue } from "./const";
25
30
  import "./index.less";
26
- var PosTabs = function PosTabs(_ref) {
31
+ locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
32
+
33
+ // export type ChildRef = ComponentRef<typeof Child>;
34
+
35
+ var PosTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
27
36
  var Table = _ref.Table,
28
37
  PosForm = _ref.PosForm,
29
- style = _ref.style;
30
- useEffect(function () {
31
- document.body.id = 'body';
32
- }, []);
33
- var _useState = useState(locales.getText('page.eftpos.text.device')),
38
+ style = _ref.style,
39
+ onChange = _ref.onChange;
40
+ var _useState = useState('device'),
34
41
  _useState2 = _slicedToArray(_useState, 2),
35
42
  active = _useState2[0],
36
43
  setActive = _useState2[1];
44
+
45
+ /**
46
+ * @title: 切换tab
47
+ * @Author: hongbing.wang
48
+ * @Date: 2024-08-20 11:18
49
+ */
37
50
  var onClick = function onClick(event) {
38
51
  var target = event.currentTarget;
39
52
  if (!target) {
40
53
  return;
41
54
  }
42
55
  var key = target.dataset.key;
43
- key && setActive(key);
56
+ if (key) {
57
+ setActive(key);
58
+ onChange(key);
59
+ }
44
60
  };
61
+ useImperativeHandle(ref, function () {
62
+ return {
63
+ setActive: setActive
64
+ };
65
+ });
66
+ // tabs 数据
45
67
  var items = [{
46
- key: locales.getText('page.eftpos.text.device'),
68
+ key: 'device',
47
69
  label: function label(active) {
48
70
  return /*#__PURE__*/React.createElement("div", {
49
71
  className: "pisell-lowcode__pos_tabs-tab-label"
50
72
  }, /*#__PURE__*/React.createElement("div", {
51
73
  className: "pisell-lowcode__pos_circle ".concat(active ? 'active' : '')
52
- }), /*#__PURE__*/React.createElement("span", {
74
+ }, /*#__PURE__*/React.createElement(DeviceIcon, {
75
+ color: active ? '#fff' : '#98A2B3'
76
+ })), /*#__PURE__*/React.createElement("span", {
53
77
  className: "pisell-lowcode__pos_tabs-tab-label-tlt ".concat(active ? 'active' : '')
54
- }, "device"));
78
+ }, locales.getText('page.eftpos.text.device')));
55
79
  },
56
80
  children: Table
57
81
  }, {
58
- key: 'apiKey',
82
+ key: 'setting',
59
83
  label: function label(active) {
60
84
  return /*#__PURE__*/React.createElement("div", {
61
85
  className: "pisell-lowcode__pos_tabs-tab-label"
62
86
  }, /*#__PURE__*/React.createElement("div", {
63
87
  className: "pisell-lowcode__pos_circle ".concat(active ? 'active' : '')
64
- }), /*#__PURE__*/React.createElement("span", {
88
+ }, /*#__PURE__*/React.createElement(ApiKeyIcon, {
89
+ color: active ? '#fff' : '#98A2B3'
90
+ })), /*#__PURE__*/React.createElement("span", {
65
91
  className: "pisell-lowcode__pos_tabs-tab-label-tlt ".concat(active ? 'active' : '')
66
- }, "apiKey"));
92
+ }, locales.getText('page.eftpos.text.setting')));
67
93
  },
68
94
  children: PosForm
69
95
  }];
@@ -89,8 +115,7 @@ var PosTabs = function PosTabs(_ref) {
89
115
  key: item.key
90
116
  }, item.children);
91
117
  })));
92
- };
93
- locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
118
+ });
94
119
  export default (function (props) {
95
120
  var name = props.name,
96
121
  zIndex = props.zIndex,
@@ -103,11 +128,21 @@ export default (function (props) {
103
128
  onDel = props.onDel,
104
129
  onEdit = props.onEdit,
105
130
  getPosComm = props.getPosComm,
106
- savePos = props.savePos;
131
+ savePos = props.savePos,
132
+ config = props.config,
133
+ tyroUrl = props.tyroUrl,
134
+ tyroVersion = props.tyroVersion,
135
+ useTyroLog = props.useTyroLog;
107
136
  var _useState3 = useState('list'),
108
137
  _useState4 = _slicedToArray(_useState3, 2),
109
138
  page = _useState4[0],
110
139
  setPage = _useState4[1];
140
+ var _message$useMessage = message.useMessage({
141
+ prefixCls: 'pisell-lowcode__pos_message'
142
+ }),
143
+ _message$useMessage2 = _slicedToArray(_message$useMessage, 2),
144
+ messageApi = _message$useMessage2[0],
145
+ contextHolder = _message$useMessage2[1];
111
146
  var _useState5 = useState(false),
112
147
  _useState6 = _slicedToArray(_useState5, 2),
113
148
  loading = _useState6[0],
@@ -126,6 +161,34 @@ export default (function (props) {
126
161
  _useState12 = _slicedToArray(_useState11, 2),
127
162
  posItemList = _useState12[0],
128
163
  setPosCommList = _useState12[1];
164
+ var _useState13 = useState(),
165
+ _useState14 = _slicedToArray(_useState13, 2),
166
+ deviceItem = _useState14[0],
167
+ setDeviceItem = _useState14[1];
168
+ var _useState15 = useState(''),
169
+ _useState16 = _slicedToArray(_useState15, 2),
170
+ pairStatus = _useState16[0],
171
+ setPairStatus = _useState16[1];
172
+ var _useState17 = useState(''),
173
+ _useState18 = _slicedToArray(_useState17, 2),
174
+ pairMessage = _useState18[0],
175
+ setPairMessage = _useState18[1];
176
+ var _useState19 = useState(true),
177
+ _useState20 = _slicedToArray(_useState19, 2),
178
+ systemConfigStatus = _useState20[0],
179
+ setSystemConfigStatus = _useState20[1];
180
+ var posTabRef = useRef(null);
181
+ var _useState21 = useState(false),
182
+ _useState22 = _slicedToArray(_useState21, 2),
183
+ posLoading = _useState22[0],
184
+ setPosLoading = _useState22[1];
185
+
186
+ /**
187
+ * @title: 删除设备
188
+ * @param {string} id 设备id
189
+ * @Author: hongbing.wang
190
+ * @Date: 2024-08-20 11:20
191
+ */
129
192
  var onDelDevice = function onDelDevice(id) {
130
193
  return onDel(id);
131
194
  };
@@ -184,6 +247,14 @@ export default (function (props) {
184
247
  return _ref2.apply(this, arguments);
185
248
  };
186
249
  }();
250
+
251
+ /**
252
+ * @title: 重连设备
253
+ * @description: 编辑第三方设备信息
254
+ * @param {any} device
255
+ * @Author: hongbing.wang
256
+ * @Date: 2024-08-20 11:21
257
+ */
187
258
  var onRepair = /*#__PURE__*/function () {
188
259
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(device) {
189
260
  var field, list;
@@ -213,68 +284,229 @@ export default (function (props) {
213
284
  return _ref3.apply(this, arguments);
214
285
  };
215
286
  }();
287
+ var pair = usePairTerminalo(type, {
288
+ url: tyroUrl,
289
+ version: tyroVersion
290
+ });
291
+ var onLog = function onLog(device) {
292
+ console.log(device);
293
+ setDeviceItem(device);
294
+ setPage('log');
295
+ };
296
+
297
+ /**
298
+ * @title: 保存设备信息
299
+ * @description: tyro 在新增与重连时候需在前端进行重连
300
+ * @param {any} device 设备信息
301
+ * @Author: hongbing.wang
302
+ * @Date: 2024-08-20 11:21
303
+ */
216
304
  var onSave = /*#__PURE__*/function () {
217
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(device) {
218
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
219
- while (1) switch (_context3.prev = _context3.next) {
305
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(device) {
306
+ var update;
307
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
308
+ while (1) switch (_context4.prev = _context4.next) {
220
309
  case 0:
310
+ console.log('device = ', device);
311
+ update = /*#__PURE__*/function () {
312
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
313
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
314
+ while (1) switch (_context3.prev = _context3.next) {
315
+ case 0:
316
+ _context3.next = 2;
317
+ return onEdit(_objectSpread(_objectSpread({}, device), {}, {
318
+ type: type
319
+ }), status || 'add').catch(function () {
320
+ setLoading(false);
321
+ });
322
+ case 2:
323
+ setLoading(false);
324
+ _context3.next = 5;
325
+ return tableRef.current.loadData();
326
+ case 5:
327
+ setPage('list');
328
+ case 6:
329
+ case "end":
330
+ return _context3.stop();
331
+ }
332
+ }, _callee3);
333
+ }));
334
+ return function update() {
335
+ return _ref5.apply(this, arguments);
336
+ };
337
+ }();
221
338
  setLoading(true);
222
- _context3.next = 3;
223
- return onEdit(_objectSpread(_objectSpread({}, device), {}, {
224
- type: type
225
- }), status || 'add').catch(function () {
226
- setLoading(false);
339
+ if (!(type === 'tyro' && status !== 'edit')) {
340
+ _context4.next = 6;
341
+ break;
342
+ }
343
+ pair(_objectSpread(_objectSpread({}, config), device.connection), function (response) {
344
+ console.log('response =', response);
345
+ setPairStatus(response.status);
346
+ setPairMessage(response.message);
347
+ if (response.status === 'inProgress') {
348
+ messageApi.open({
349
+ type: 'info',
350
+ style: {
351
+ zIndex: (zIndex || 9999) + 1
352
+ },
353
+ content: response.message
354
+ });
355
+ return;
356
+ }
357
+ if (response.status === 'success') {
358
+ messageApi.open({
359
+ type: 'success',
360
+ style: {
361
+ zIndex: (zIndex || 9999) + 1
362
+ },
363
+ content: response.message
364
+ });
365
+ device.connection.integrationKey = response.integrationKey;
366
+ device.status = 'paired';
367
+ update();
368
+ return;
369
+ }
370
+ messageApi.open({
371
+ type: 'warning',
372
+ style: {
373
+ zIndex: (zIndex || 9999) + 1
374
+ },
375
+ content: response.message
376
+ });
377
+ device.status = 'unpaired';
378
+ update();
227
379
  });
228
- case 3:
229
- setLoading(false);
230
- _context3.next = 6;
231
- return tableRef.current.loadData();
380
+ return _context4.abrupt("return");
232
381
  case 6:
233
- setPage('list');
382
+ update();
234
383
  case 7:
235
384
  case "end":
236
- return _context3.stop();
385
+ return _context4.stop();
237
386
  }
238
- }, _callee3);
387
+ }, _callee4);
239
388
  }));
240
389
  return function onSave(_x4) {
241
390
  return _ref4.apply(this, arguments);
242
391
  };
243
392
  }();
393
+ var onClickByTip = function onClickByTip() {
394
+ var _posTabRef$current;
395
+ (_posTabRef$current = posTabRef.current) === null || _posTabRef$current === void 0 ? void 0 : _posTabRef$current.setActive('setting');
396
+ };
397
+ var getPos = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
398
+ var list, obj, _status;
399
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
400
+ while (1) switch (_context5.prev = _context5.next) {
401
+ case 0:
402
+ if (!(typeof getPosComm === 'function')) {
403
+ _context5.next = 10;
404
+ break;
405
+ }
406
+ setPosLoading(true);
407
+ _context5.next = 4;
408
+ return getPosComm(type).catch(function () {
409
+ setPosLoading(false);
410
+ });
411
+ case 4:
412
+ list = _context5.sent.map(function (item) {
413
+ return _objectSpread(_objectSpread({}, item), {}, {
414
+ __sourceName: item.name
415
+ });
416
+ });
417
+ setPosLoading(false);
418
+ obj = getDefaultValue(list);
419
+ _status = Object.values(obj).every(Boolean);
420
+ setSystemConfigStatus(_status);
421
+ setPosCommList(list);
422
+ case 10:
423
+ case "end":
424
+ return _context5.stop();
425
+ }
426
+ }, _callee5);
427
+ })), [getPosComm]);
428
+
429
+ /**
430
+ * @title: 保存厂商设置
431
+ * @param {any} pos 厂商信息
432
+ * @return {*}
433
+ * @Author: hongbing.wang
434
+ * @Date: 2024-08-20 11:22
435
+ */
244
436
  var onSavePos = function onSavePos(pos) {
245
437
  if (typeof savePos === 'function') {
246
- savePos(pos);
438
+ setPosLoading(true);
439
+ savePos(type, pos).then(function () {
440
+ getPos();
441
+ }).catch(function () {
442
+ setPosLoading(false);
443
+ });
247
444
  }
248
445
  };
446
+ useEffect(function () {
447
+ setPairStatus('');
448
+ setPairMessage('');
449
+ }, [page]);
450
+ /**
451
+ * @title: 回退列表页
452
+ * @Author: hongbing.wang
453
+ * @Date: 2024-08-20 11:23
454
+ */
249
455
  var onBack = function onBack() {
250
456
  setPage('list');
251
457
  };
252
- useEffect(function () {
253
- if (typeof getPosComm === 'function') {
254
- setPosCommList(getPosComm(type));
458
+ var onChangeTabs = function onChangeTabs(key) {
459
+ setPage('list');
460
+ };
461
+
462
+ /**
463
+ * @title: 设置厂商配置字段
464
+ * @Author: hongbing.wang
465
+ * @Date: 2024-08-20 11:23
466
+ */
467
+ useMount(function () {
468
+ if (typeof getPos === 'function') {
469
+ getPos();
255
470
  }
256
- }, [type, getPosComm]);
471
+ });
472
+
473
+ /**
474
+ * @title: 响应外界type变化将page重置为列表页
475
+ * @Author: hongbing.wang
476
+ * @Date: 2024-08-20 11:23
477
+ */
257
478
  useEffect(function () {
258
479
  setPage('list');
259
480
  }, [type]);
260
- if (type === Eftpos.Stripe) {
481
+ if (type === Eftpos.Windcave) {
482
+ // 使用 stripe 支付 需要设置 商家参数
261
483
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PosTabs, {
484
+ ref: posTabRef,
262
485
  Table: /*#__PURE__*/React.createElement(Table, {
263
486
  ref: tableRef,
264
487
  eftposName: name,
265
488
  type: type,
489
+ useTyroLog: useTyroLog,
266
490
  tableSize: tableSize,
267
491
  getList: getList,
268
492
  onDel: onDelDevice,
269
493
  onRepair: onRepair,
270
494
  onEdit: onEditDevice,
271
- key: "postable".concat(type)
495
+ onLog: onLog,
496
+ key: "postable".concat(type),
497
+ systemConfigStatus: systemConfigStatus,
498
+ onClickByTip: onClickByTip
272
499
  }),
273
- PosForm: /*#__PURE__*/React.createElement(Pos, {
500
+ PosForm: /*#__PURE__*/React.createElement(Spin, {
501
+ tip: "Loading...",
502
+ spinning: posLoading,
503
+ wrapperClassName: "pisell-lowcode__pos_setting_box"
504
+ }, /*#__PURE__*/React.createElement(Pos, {
274
505
  eftposName: name,
275
506
  onSave: onSavePos,
276
507
  formItemList: posItemList
277
- })
508
+ })),
509
+ onChange: onChangeTabs
278
510
  }), /*#__PURE__*/React.createElement(Drawer, {
279
511
  open: page === 'edit',
280
512
  onClose: onBack,
@@ -291,18 +523,46 @@ export default (function (props) {
291
523
  formItemList: deviceItemList,
292
524
  onSave: onSave,
293
525
  key: "posdevice".concat(type)
294
- }))));
526
+ }, pairStatus ? /*#__PURE__*/React.createElement(Form.Item, {
527
+ label: "Status"
528
+ }, /*#__PURE__*/React.createElement(Input, {
529
+ value: pairStatus,
530
+ disabled: true
531
+ })) : null, pairMessage ? /*#__PURE__*/React.createElement(Form.Item, {
532
+ label: "Message"
533
+ }, /*#__PURE__*/React.createElement(Input, {
534
+ value: pairMessage,
535
+ disabled: true
536
+ })) : null))), /*#__PURE__*/React.createElement(Drawer, {
537
+ open: page === 'log',
538
+ onClose: onBack,
539
+ title: locales.getText('page.eftpos.text.log'),
540
+ titleNoWrap: true,
541
+ zIndex: zIndex || 9999,
542
+ destroyOnClose: true,
543
+ className: "pisell-lowcode__pos_drawer pisell-lowcode__pos_drawer_log"
544
+ }, /*#__PURE__*/React.createElement(Log, {
545
+ type: type,
546
+ tyroUrl: tyroUrl,
547
+ tyroVersion: tyroVersion,
548
+ device: deviceItem
549
+ })), contextHolder);
295
550
  }
551
+ // 其他支付 不需要设置商家参数
296
552
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, {
297
553
  eftposName: name,
298
554
  ref: tableRef,
299
555
  type: type,
556
+ useTyroLog: useTyroLog,
300
557
  tableSize: tableSize,
301
558
  getList: getList,
302
559
  onDel: onDelDevice,
303
560
  onRepair: onRepair,
561
+ onLog: onLog,
304
562
  onEdit: onEditDevice,
305
- key: "table".concat(type)
563
+ key: "table".concat(type),
564
+ systemConfigStatus: systemConfigStatus,
565
+ onClickByTip: onClickByTip
306
566
  }), /*#__PURE__*/React.createElement(Drawer, {
307
567
  open: page === 'edit',
308
568
  onClose: onBack,
@@ -319,5 +579,28 @@ export default (function (props) {
319
579
  formItemList: deviceItemList,
320
580
  onSave: onSave,
321
581
  key: "device".concat(type)
322
- }))));
582
+ }, pairStatus ? /*#__PURE__*/React.createElement(Form.Item, {
583
+ label: "Status"
584
+ }, /*#__PURE__*/React.createElement(Input, {
585
+ value: pairStatus,
586
+ disabled: true
587
+ })) : null, pairMessage ? /*#__PURE__*/React.createElement(Form.Item, {
588
+ label: "Message"
589
+ }, /*#__PURE__*/React.createElement(Input, {
590
+ value: pairMessage,
591
+ disabled: true
592
+ })) : null))), /*#__PURE__*/React.createElement(Drawer, {
593
+ open: page === 'log',
594
+ onClose: onBack,
595
+ title: locales.getText('page.eftpos.text.log'),
596
+ titleNoWrap: true,
597
+ zIndex: zIndex || 9999,
598
+ destroyOnClose: true,
599
+ className: "pisell-lowcode__pos_drawer pisell-lowcode__pos_drawer_log"
600
+ }, /*#__PURE__*/React.createElement(Log, {
601
+ type: type,
602
+ tyroUrl: tyroUrl,
603
+ tyroVersion: tyroVersion,
604
+ device: deviceItem
605
+ })), contextHolder);
323
606
  });
@@ -6,6 +6,9 @@
6
6
  background: #f2f2f7;
7
7
  color: #acacac;
8
8
  border: 1px solid #f2f2f7;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
9
12
  }
10
13
  .pisell-lowcode__pos_circle.active {
11
14
  background: var(--primary-600, #7f56d9);
@@ -44,6 +47,7 @@
44
47
  justify-content: center;
45
48
  cursor: pointer;
46
49
  padding: 16px 0;
50
+ gap: 6px;
47
51
  }
48
52
  .pisell-lowcode__pos_tabs-tab-label-tlt {
49
53
  color: #0d1619;
@@ -63,6 +67,7 @@
63
67
  .pisell-lowcode__pos_tabs-tabpane {
64
68
  display: none;
65
69
  flex: 1;
70
+ overflow: hidden;
66
71
  }
67
72
  .pisell-lowcode__pos_tabs-tabpane.active {
68
73
  display: flex;
@@ -70,12 +75,20 @@
70
75
  .pisell-lowcode__pos_tab-content {
71
76
  display: flex;
72
77
  flex: 1;
78
+ overflow: hidden;
73
79
  }
74
80
 
75
81
  .pisell-lowcode__pos_box {
76
82
  height: 100%;
77
83
  }
78
84
 
85
+ .pisell-lowcode__pos_setting_box {
86
+ height: 100%;
87
+ width: 100%;
88
+ display: flex;
89
+ }
90
+
91
+
79
92
  .pisell-lowcode__pos_drawer {
80
93
  transform: translateZ(0);
81
94
  }
@@ -116,6 +129,7 @@
116
129
  display: flex;
117
130
  flex-direction: column;
118
131
  gap: 8px;
132
+ overflow: hidden;
119
133
  }
120
134
 
121
135
  .pisell-lowcode__pos-table-act {
@@ -155,7 +169,8 @@
155
169
  .pisell-lowcode__pos-device {
156
170
  display: flex;
157
171
  flex-direction: column;
158
- padding: 24px 32px 0 !important;
172
+ padding: 24px 22px 0 !important;
173
+ margin: 0 0 0 10px;
159
174
  overflow: hidden;
160
175
  }
161
176
  .pisell-lowcode__pos-device-btn {
@@ -167,3 +182,25 @@
167
182
  background-color: #fff;
168
183
  padding: 0 0 24px 0 !important;
169
184
  }
185
+
186
+ .pisell-lowcode__pos_message {
187
+ z-index: var(--pisell-lc-pos-message-z-index, 9999);
188
+ }
189
+
190
+ .pisell-lowcode__pos_message .pisell-lowcode__pos_message-notice-content {
191
+ background-color: #fff !important;
192
+ }
193
+
194
+ .pisell-lowcode__pos_drawer_log .pisell-lowcode-drawer-body {
195
+ display: flex;
196
+ flex-direction: column;
197
+ }
198
+ .pisell-lowcode__pos_drawer_log
199
+ .pisell-lowcode-drawer-body
200
+ .pisell-lowcode__booking-drawer-title-wrap
201
+ + div {
202
+ width: 100%;
203
+ flex: 1;
204
+ display: flex;
205
+ flex-direction: column;
206
+ }
@@ -26,6 +26,10 @@ declare const _default: {
26
26
  'page.eftpos.text.table.del.text': string;
27
27
  'page.eftpos.text.table.del.delete': string;
28
28
  'page.eftpos.text.table.del.cancel': string;
29
+ 'page.eftpos.text.log': string;
30
+ 'page.eftpos.text.setting': string;
31
+ 'page.eftpos.text.setting.tip': string;
32
+ 'page.eftpos.text.setting.btn': string;
29
33
  };
30
34
  'zh-CN': {
31
35
  'page.eftpos.text.manufacturer': string;
@@ -54,6 +58,10 @@ declare const _default: {
54
58
  'page.eftpos.text.table.del.text': string;
55
59
  'page.eftpos.text.table.del.delete': string;
56
60
  'page.eftpos.text.table.del.cancel': string;
61
+ 'page.eftpos.text.log': string;
62
+ 'page.eftpos.text.setting': string;
63
+ 'page.eftpos.text.setting.tip': string;
64
+ 'page.eftpos.text.setting.btn': string;
57
65
  };
58
66
  'zh-HK': {
59
67
  'page.eftpos.text.manufacturer': string;
@@ -82,6 +90,10 @@ declare const _default: {
82
90
  'page.eftpos.text.table.del.text': string;
83
91
  'page.eftpos.text.table.del.delete': string;
84
92
  'page.eftpos.text.table.del.cancel': string;
93
+ 'page.eftpos.text.log': string;
94
+ 'page.eftpos.text.setting': string;
95
+ 'page.eftpos.text.setting.tip': string;
96
+ 'page.eftpos.text.setting.btn': string;
85
97
  };
86
98
  };
87
99
  export default _default;
@@ -33,7 +33,11 @@ export default {
33
33
  'page.eftpos.text.table.del.title': 'Delete device',
34
34
  'page.eftpos.text.table.del.text': 'Are you sure you want to delete the device?',
35
35
  'page.eftpos.text.table.del.delete': 'Delete',
36
- 'page.eftpos.text.table.del.cancel': 'Cancel'
36
+ 'page.eftpos.text.table.del.cancel': 'Cancel',
37
+ 'page.eftpos.text.log': 'Log',
38
+ 'page.eftpos.text.setting': 'Setting',
39
+ 'page.eftpos.text.setting.tip': 'You have not configured the necessary parameters, which may affect the normal use of your POS! ',
40
+ 'page.eftpos.text.setting.btn': 'Go to configure'
37
41
  },
38
42
  'zh-CN': {
39
43
  'page.eftpos.text.manufacturer': '厂商',
@@ -69,7 +73,11 @@ export default {
69
73
  'page.eftpos.text.table.del.title': '删除设备',
70
74
  'page.eftpos.text.table.del.text': '您确定要删除设备?',
71
75
  'page.eftpos.text.table.del.delete': '删除',
72
- 'page.eftpos.text.table.del.cancel': '取消'
76
+ 'page.eftpos.text.table.del.cancel': '取消',
77
+ 'page.eftpos.text.log': '日志',
78
+ 'page.eftpos.text.setting': '设置',
79
+ 'page.eftpos.text.setting.tip': '您尚未配置必要参数,这可能会影响您Pos的正常使用!',
80
+ 'page.eftpos.text.setting.btn': '前往配置'
73
81
  },
74
82
  'zh-HK': {
75
83
  'page.eftpos.text.manufacturer': '廠商',
@@ -105,6 +113,10 @@ export default {
105
113
  'page.eftpos.text.table.del.title': '刪除設備',
106
114
  'page.eftpos.text.table.del.text': '您確定要刪除設備?',
107
115
  'page.eftpos.text.table.del.delete': '刪除',
108
- 'page.eftpos.text.table.del.cancel': '取消'
116
+ 'page.eftpos.text.table.del.cancel': '取消',
117
+ 'page.eftpos.text.log': '日誌',
118
+ 'page.eftpos.text.setting': '设置',
119
+ 'page.eftpos.text.setting.tip': '您尚未配置必要參數,這可能會影響您Pos的正常使用!',
120
+ 'page.eftpos.text.setting.btn': '前往配置'
109
121
  }
110
122
  };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { Eftpos } from './const';
3
+ export default function Log({ device, type, tyroUrl, tyroVersion, }: {
4
+ device: any;
5
+ type: Eftpos;
6
+ tyroUrl: string;
7
+ tyroVersion: string;
8
+ }): React.JSX.Element;