@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
@@ -33,93 +33,99 @@ __export(eftpos_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(eftpos_exports);
35
35
  var import_react = __toESM(require("react"));
36
+ var import_ahooks = require("ahooks");
36
37
  var import_antd = require("antd");
37
38
  var import_utils = require("@pisell/utils");
38
39
  var import_table = __toESM(require("./table"));
39
40
  var import_device = __toESM(require("./device"));
40
41
  var import_pos = __toESM(require("./pos"));
41
42
  var import_drawer = __toESM(require("../booking/components/drawer"));
43
+ var import_log = __toESM(require("./log"));
42
44
  var import_locales = __toESM(require("./locales"));
45
+ var import_hooks = require("./hooks");
46
+ var import_apiKey = __toESM(require("./icon/apiKey"));
47
+ var import_device2 = __toESM(require("./icon/device"));
43
48
  var import_const = require("./const");
44
49
  var import_index = require("./index.less");
45
- var PosTabs = ({
46
- Table: Table2,
47
- PosForm,
48
- style
49
- }) => {
50
- (0, import_react.useEffect)(() => {
51
- document.body.id = "body";
52
- }, []);
53
- const [active, setActive] = (0, import_react.useState)(
54
- import_utils.locales.getText("page.eftpos.text.device")
55
- );
56
- const onClick = (event) => {
57
- const target = event.currentTarget;
58
- if (!target) {
59
- return;
60
- }
61
- const { key } = target.dataset;
62
- key && setActive(key);
63
- };
64
- const items = [
65
- {
66
- key: import_utils.locales.getText("page.eftpos.text.device"),
67
- label: (active2) => /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs-tab-label" }, /* @__PURE__ */ import_react.default.createElement(
50
+ import_utils.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
51
+ var PosTabs = (0, import_react.forwardRef)(
52
+ ({ Table: Table2, PosForm, style, onChange }, ref) => {
53
+ const [active, setActive] = (0, import_react.useState)("device");
54
+ const onClick = (event) => {
55
+ const target = event.currentTarget;
56
+ if (!target) {
57
+ return;
58
+ }
59
+ const { key } = target.dataset;
60
+ if (key) {
61
+ setActive(key);
62
+ onChange(key);
63
+ }
64
+ };
65
+ (0, import_react.useImperativeHandle)(ref, () => ({
66
+ setActive
67
+ }));
68
+ const items = [
69
+ {
70
+ key: "device",
71
+ label: (active2) => /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs-tab-label" }, /* @__PURE__ */ import_react.default.createElement(
72
+ "div",
73
+ {
74
+ className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
75
+ },
76
+ /* @__PURE__ */ import_react.default.createElement(import_device2.default, { color: active2 ? "#fff" : "#98A2B3" })
77
+ ), /* @__PURE__ */ import_react.default.createElement(
78
+ "span",
79
+ {
80
+ className: `pisell-lowcode__pos_tabs-tab-label-tlt ${active2 ? "active" : ""}`
81
+ },
82
+ import_utils.locales.getText("page.eftpos.text.device")
83
+ )),
84
+ children: Table2
85
+ },
86
+ {
87
+ key: "setting",
88
+ label: (active2) => /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs-tab-label" }, /* @__PURE__ */ import_react.default.createElement(
89
+ "div",
90
+ {
91
+ className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
92
+ },
93
+ /* @__PURE__ */ import_react.default.createElement(import_apiKey.default, { color: active2 ? "#fff" : "#98A2B3" })
94
+ ), /* @__PURE__ */ import_react.default.createElement(
95
+ "span",
96
+ {
97
+ className: `pisell-lowcode__pos_tabs-tab-label-tlt ${active2 ? "active" : ""}`
98
+ },
99
+ import_utils.locales.getText("page.eftpos.text.setting")
100
+ )),
101
+ children: PosForm
102
+ }
103
+ ];
104
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs", style }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs-nav" }, items.map((item) => {
105
+ return /* @__PURE__ */ import_react.default.createElement(
68
106
  "div",
69
107
  {
70
- className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
71
- }
72
- ), /* @__PURE__ */ import_react.default.createElement(
73
- "span",
74
- {
75
- className: `pisell-lowcode__pos_tabs-tab-label-tlt ${active2 ? "active" : ""}`
108
+ key: item.key,
109
+ style: {
110
+ display: "contents"
111
+ },
112
+ "data-key": item.key,
113
+ onClick
76
114
  },
77
- "device"
78
- )),
79
- children: Table2
80
- },
81
- {
82
- key: "apiKey",
83
- label: (active2) => /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs-tab-label" }, /* @__PURE__ */ import_react.default.createElement(
115
+ item.label(active === item.key)
116
+ );
117
+ })), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tab-content" }, items.map((item) => {
118
+ return /* @__PURE__ */ import_react.default.createElement(
84
119
  "div",
85
120
  {
86
- className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
87
- }
88
- ), /* @__PURE__ */ import_react.default.createElement(
89
- "span",
90
- {
91
- className: `pisell-lowcode__pos_tabs-tab-label-tlt ${active2 ? "active" : ""}`
92
- },
93
- "apiKey"
94
- )),
95
- children: PosForm
96
- }
97
- ];
98
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs", style }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tabs-nav" }, items.map((item) => {
99
- return /* @__PURE__ */ import_react.default.createElement(
100
- "div",
101
- {
102
- key: item.key,
103
- style: {
104
- display: "contents"
121
+ className: `pisell-lowcode__pos_tabs-tabpane ${active === item.key ? "active" : ""}`,
122
+ key: item.key
105
123
  },
106
- "data-key": item.key,
107
- onClick
108
- },
109
- item.label(active === item.key)
110
- );
111
- })), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__pos_tab-content" }, items.map((item) => {
112
- return /* @__PURE__ */ import_react.default.createElement(
113
- "div",
114
- {
115
- className: `pisell-lowcode__pos_tabs-tabpane ${active === item.key ? "active" : ""}`,
116
- key: item.key
117
- },
118
- item.children
119
- );
120
- })));
121
- };
122
- import_utils.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
124
+ item.children
125
+ );
126
+ })));
127
+ }
128
+ );
123
129
  var eftpos_default = (props) => {
124
130
  const {
125
131
  name,
@@ -132,15 +138,28 @@ var eftpos_default = (props) => {
132
138
  onDel,
133
139
  onEdit,
134
140
  getPosComm,
135
- savePos
141
+ savePos,
142
+ config,
143
+ tyroUrl,
144
+ tyroVersion,
145
+ useTyroLog
136
146
  } = props;
137
147
  const [page, setPage] = (0, import_react.useState)("list");
148
+ const [messageApi, contextHolder] = import_antd.message.useMessage({
149
+ prefixCls: "pisell-lowcode__pos_message"
150
+ });
138
151
  const [loading, setLoading] = (0, import_react.useState)(false);
139
152
  const [status, setStatus] = (0, import_react.useState)(import_const.DeviceEnum.Add);
140
153
  const tableRef = (0, import_react.useRef)();
141
154
  const deviceIdRef = (0, import_react.useRef)("");
142
155
  const [deviceItemList, setDeviceCommList] = (0, import_react.useState)([]);
143
156
  const [posItemList, setPosCommList] = (0, import_react.useState)([]);
157
+ const [deviceItem, setDeviceItem] = (0, import_react.useState)();
158
+ const [pairStatus, setPairStatus] = (0, import_react.useState)("");
159
+ const [pairMessage, setPairMessage] = (0, import_react.useState)("");
160
+ const [systemConfigStatus, setSystemConfigStatus] = (0, import_react.useState)(true);
161
+ const posTabRef = (0, import_react.useRef)(null);
162
+ const [posLoading, setPosLoading] = (0, import_react.useState)(false);
144
163
  const onDelDevice = (id) => {
145
164
  return onDel(id);
146
165
  };
@@ -169,57 +188,155 @@ var eftpos_default = (props) => {
169
188
  setStatus(import_const.DeviceEnum.Repair);
170
189
  setPage("edit");
171
190
  };
191
+ const pair = (0, import_hooks.usePairTerminalo)(type, { url: tyroUrl, version: tyroVersion });
192
+ const onLog = (device) => {
193
+ console.log(device);
194
+ setDeviceItem(device);
195
+ setPage("log");
196
+ };
172
197
  const onSave = async (device) => {
173
- setLoading(true);
174
- await onEdit({ ...device, type }, status || "add").catch(() => {
198
+ console.log("device = ", device);
199
+ const update = async () => {
200
+ await onEdit({ ...device, type }, status || "add").catch(() => {
201
+ setLoading(false);
202
+ });
175
203
  setLoading(false);
176
- });
177
- setLoading(false);
178
- await tableRef.current.loadData();
179
- setPage("list");
204
+ await tableRef.current.loadData();
205
+ setPage("list");
206
+ };
207
+ setLoading(true);
208
+ if (type === "tyro" && status !== "edit") {
209
+ pair({ ...config, ...device.connection }, (response) => {
210
+ console.log("response =", response);
211
+ setPairStatus(response.status);
212
+ setPairMessage(response.message);
213
+ if (response.status === "inProgress") {
214
+ messageApi.open({
215
+ type: "info",
216
+ style: {
217
+ zIndex: (zIndex || 9999) + 1
218
+ },
219
+ content: response.message
220
+ });
221
+ return;
222
+ }
223
+ if (response.status === "success") {
224
+ messageApi.open({
225
+ type: "success",
226
+ style: {
227
+ zIndex: (zIndex || 9999) + 1
228
+ },
229
+ content: response.message
230
+ });
231
+ device.connection.integrationKey = response.integrationKey;
232
+ device.status = "paired";
233
+ update();
234
+ return;
235
+ }
236
+ messageApi.open({
237
+ type: "warning",
238
+ style: {
239
+ zIndex: (zIndex || 9999) + 1
240
+ },
241
+ content: response.message
242
+ });
243
+ device.status = "unpaired";
244
+ update();
245
+ });
246
+ return;
247
+ }
248
+ update();
180
249
  };
250
+ const onClickByTip = () => {
251
+ var _a;
252
+ (_a = posTabRef.current) == null ? void 0 : _a.setActive("setting");
253
+ };
254
+ const getPos = (0, import_react.useCallback)(async () => {
255
+ if (typeof getPosComm === "function") {
256
+ setPosLoading(true);
257
+ const list = (await getPosComm(type).catch(() => {
258
+ setPosLoading(false);
259
+ })).map((item) => {
260
+ return {
261
+ ...item,
262
+ __sourceName: item.name
263
+ };
264
+ });
265
+ setPosLoading(false);
266
+ const obj = (0, import_const.getDefaultValue)(list);
267
+ const status2 = Object.values(obj).every(Boolean);
268
+ setSystemConfigStatus(status2);
269
+ setPosCommList(list);
270
+ }
271
+ }, [getPosComm]);
181
272
  const onSavePos = (pos) => {
182
273
  if (typeof savePos === "function") {
183
- savePos(pos);
274
+ setPosLoading(true);
275
+ savePos(type, pos).then(() => {
276
+ getPos();
277
+ }).catch(() => {
278
+ setPosLoading(false);
279
+ });
184
280
  }
185
281
  };
282
+ (0, import_react.useEffect)(() => {
283
+ setPairStatus("");
284
+ setPairMessage("");
285
+ }, [page]);
186
286
  const onBack = () => {
187
287
  setPage("list");
188
288
  };
189
- (0, import_react.useEffect)(() => {
190
- if (typeof getPosComm === "function") {
191
- setPosCommList(getPosComm(type));
289
+ const onChangeTabs = (key) => {
290
+ setPage("list");
291
+ };
292
+ (0, import_ahooks.useMount)(() => {
293
+ if (typeof getPos === "function") {
294
+ getPos();
192
295
  }
193
- }, [type, getPosComm]);
296
+ });
194
297
  (0, import_react.useEffect)(() => {
195
298
  setPage("list");
196
299
  }, [type]);
197
- if (type === import_const.Eftpos.Stripe) {
300
+ if (type === import_const.Eftpos.Windcave) {
198
301
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
199
302
  PosTabs,
200
303
  {
304
+ ref: posTabRef,
201
305
  Table: /* @__PURE__ */ import_react.default.createElement(
202
306
  import_table.default,
203
307
  {
204
308
  ref: tableRef,
205
309
  eftposName: name,
206
310
  type,
311
+ useTyroLog,
207
312
  tableSize,
208
313
  getList,
209
314
  onDel: onDelDevice,
210
315
  onRepair,
211
316
  onEdit: onEditDevice,
212
- key: `postable${type}`
317
+ onLog,
318
+ key: `postable${type}`,
319
+ systemConfigStatus,
320
+ onClickByTip
213
321
  }
214
322
  ),
215
323
  PosForm: /* @__PURE__ */ import_react.default.createElement(
216
- import_pos.default,
324
+ import_antd.Spin,
217
325
  {
218
- eftposName: name,
219
- onSave: onSavePos,
220
- formItemList: posItemList
221
- }
222
- )
326
+ tip: "Loading...",
327
+ spinning: posLoading,
328
+ wrapperClassName: "pisell-lowcode__pos_setting_box"
329
+ },
330
+ /* @__PURE__ */ import_react.default.createElement(
331
+ import_pos.default,
332
+ {
333
+ eftposName: name,
334
+ onSave: onSavePos,
335
+ formItemList: posItemList
336
+ }
337
+ )
338
+ ),
339
+ onChange: onChangeTabs
223
340
  }
224
341
  ), /* @__PURE__ */ import_react.default.createElement(
225
342
  import_drawer.default,
@@ -245,10 +362,32 @@ var eftpos_default = (props) => {
245
362
  formItemList: deviceItemList,
246
363
  onSave,
247
364
  key: `posdevice${type}`
248
- }
365
+ },
366
+ pairStatus ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: "Status" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Input, { value: pairStatus, disabled: true })) : null,
367
+ pairMessage ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: "Message" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Input, { value: pairMessage, disabled: true })) : null
249
368
  )
250
369
  )
251
- ));
370
+ ), /* @__PURE__ */ import_react.default.createElement(
371
+ import_drawer.default,
372
+ {
373
+ open: page === "log",
374
+ onClose: onBack,
375
+ title: import_utils.locales.getText("page.eftpos.text.log"),
376
+ titleNoWrap: true,
377
+ zIndex: zIndex || 9999,
378
+ destroyOnClose: true,
379
+ className: "pisell-lowcode__pos_drawer pisell-lowcode__pos_drawer_log"
380
+ },
381
+ /* @__PURE__ */ import_react.default.createElement(
382
+ import_log.default,
383
+ {
384
+ type,
385
+ tyroUrl,
386
+ tyroVersion,
387
+ device: deviceItem
388
+ }
389
+ )
390
+ ), contextHolder);
252
391
  }
253
392
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
254
393
  import_table.default,
@@ -256,12 +395,16 @@ var eftpos_default = (props) => {
256
395
  eftposName: name,
257
396
  ref: tableRef,
258
397
  type,
398
+ useTyroLog,
259
399
  tableSize,
260
400
  getList,
261
401
  onDel: onDelDevice,
262
402
  onRepair,
403
+ onLog,
263
404
  onEdit: onEditDevice,
264
- key: `table${type}`
405
+ key: `table${type}`,
406
+ systemConfigStatus,
407
+ onClickByTip
265
408
  }
266
409
  ), /* @__PURE__ */ import_react.default.createElement(
267
410
  import_drawer.default,
@@ -287,8 +430,30 @@ var eftpos_default = (props) => {
287
430
  formItemList: deviceItemList,
288
431
  onSave,
289
432
  key: `device${type}`
290
- }
433
+ },
434
+ pairStatus ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: "Status" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Input, { value: pairStatus, disabled: true })) : null,
435
+ pairMessage ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: "Message" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Input, { value: pairMessage, disabled: true })) : null
291
436
  )
292
437
  )
293
- ));
438
+ ), /* @__PURE__ */ import_react.default.createElement(
439
+ import_drawer.default,
440
+ {
441
+ open: page === "log",
442
+ onClose: onBack,
443
+ title: import_utils.locales.getText("page.eftpos.text.log"),
444
+ titleNoWrap: true,
445
+ zIndex: zIndex || 9999,
446
+ destroyOnClose: true,
447
+ className: "pisell-lowcode__pos_drawer pisell-lowcode__pos_drawer_log"
448
+ },
449
+ /* @__PURE__ */ import_react.default.createElement(
450
+ import_log.default,
451
+ {
452
+ type,
453
+ tyroUrl,
454
+ tyroVersion,
455
+ device: deviceItem
456
+ }
457
+ )
458
+ ), contextHolder);
294
459
  };
@@ -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;
@@ -55,7 +55,11 @@ var locales_default = {
55
55
  "page.eftpos.text.table.del.title": "Delete device",
56
56
  "page.eftpos.text.table.del.text": "Are you sure you want to delete the device?",
57
57
  "page.eftpos.text.table.del.delete": "Delete",
58
- "page.eftpos.text.table.del.cancel": "Cancel"
58
+ "page.eftpos.text.table.del.cancel": "Cancel",
59
+ "page.eftpos.text.log": "Log",
60
+ "page.eftpos.text.setting": "Setting",
61
+ "page.eftpos.text.setting.tip": "You have not configured the necessary parameters, which may affect the normal use of your POS! ",
62
+ "page.eftpos.text.setting.btn": "Go to configure"
59
63
  },
60
64
  "zh-CN": {
61
65
  "page.eftpos.text.manufacturer": "厂商",
@@ -89,7 +93,11 @@ var locales_default = {
89
93
  "page.eftpos.text.table.del.title": "删除设备",
90
94
  "page.eftpos.text.table.del.text": "您确定要删除设备?",
91
95
  "page.eftpos.text.table.del.delete": "删除",
92
- "page.eftpos.text.table.del.cancel": "取消"
96
+ "page.eftpos.text.table.del.cancel": "取消",
97
+ "page.eftpos.text.log": "日志",
98
+ "page.eftpos.text.setting": "设置",
99
+ "page.eftpos.text.setting.tip": "您尚未配置必要参数,这可能会影响您Pos的正常使用!",
100
+ "page.eftpos.text.setting.btn": "前往配置"
93
101
  },
94
102
  "zh-HK": {
95
103
  "page.eftpos.text.manufacturer": "廠商",
@@ -123,6 +131,10 @@ var locales_default = {
123
131
  "page.eftpos.text.table.del.title": "刪除設備",
124
132
  "page.eftpos.text.table.del.text": "您確定要刪除設備?",
125
133
  "page.eftpos.text.table.del.delete": "刪除",
126
- "page.eftpos.text.table.del.cancel": "取消"
134
+ "page.eftpos.text.table.del.cancel": "取消",
135
+ "page.eftpos.text.log": "日誌",
136
+ "page.eftpos.text.setting": "设置",
137
+ "page.eftpos.text.setting.tip": "您尚未配置必要參數,這可能會影響您Pos的正常使用!",
138
+ "page.eftpos.text.setting.btn": "前往配置"
127
139
  }
128
140
  };
@@ -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;