@pisell/private-materials 3.0.187 → 3.0.189

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 (75) 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 +3 -3
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +5 -5
  11. package/es/components/booking/info/utils.js +1 -1
  12. package/es/components/eftposPay/amount.d.ts +4 -3
  13. package/es/components/eftposPay/amount.js +5 -4
  14. package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  15. package/es/components/eftposPay/component/fail/failCustom.js +14 -6
  16. package/es/components/eftposPay/component/fail/index.d.ts +1 -1
  17. package/es/components/eftposPay/component/fail/index.js +14 -5
  18. package/es/components/eftposPay/component/fail/unknow.d.ts +1 -1
  19. package/es/components/eftposPay/component/fail/unknow.js +17 -7
  20. package/es/components/eftposPay/const.d.ts +8 -2
  21. package/es/components/eftposPay/const.js +5 -0
  22. package/es/components/eftposPay/device.d.ts +4 -3
  23. package/es/components/eftposPay/device.js +5 -4
  24. package/es/components/eftposPay/hooks.d.ts +4 -3
  25. package/es/components/eftposPay/hooks.js +31 -6
  26. package/es/components/eftposPay/index.js +57 -23
  27. package/es/components/eftposPay/index.less +1 -0
  28. package/es/components/eftposPay/locales.d.ts +6 -0
  29. package/es/components/eftposPay/locales.js +6 -0
  30. package/es/components/eftposPay/pay.d.ts +3 -2
  31. package/es/components/eftposPay/pay.js +8 -7
  32. package/es/components/eftposPay/payo/config.d.ts +3 -1
  33. package/es/components/eftposPay/payo/config.js +11 -9
  34. package/es/components/eftposPay/payo/const.js +4 -2
  35. package/es/components/eftposPay/payo/index.js +3 -1
  36. package/es/components/eftposPay/store/index.d.ts +17 -2
  37. package/es/components/eftposPay/store/index.js +20 -0
  38. package/es/components/eftposPay/tyro/const.js +4 -2
  39. package/es/components/eftposPay/tyro/index.js +70 -20
  40. package/es/components/eftposPay/windcave/const.js +4 -2
  41. package/es/components/eftposPay/windcave/helper.js +19 -28
  42. package/es/components/eftposPay/windcave/windcave.js +2 -1
  43. package/lib/components/booking/info/utils.js +1 -1
  44. package/lib/components/eftposPay/amount.d.ts +4 -3
  45. package/lib/components/eftposPay/amount.js +4 -3
  46. package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  47. package/lib/components/eftposPay/component/fail/failCustom.js +16 -4
  48. package/lib/components/eftposPay/component/fail/index.d.ts +1 -1
  49. package/lib/components/eftposPay/component/fail/index.js +17 -4
  50. package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -1
  51. package/lib/components/eftposPay/component/fail/unknow.js +15 -3
  52. package/lib/components/eftposPay/const.d.ts +8 -2
  53. package/lib/components/eftposPay/const.js +7 -0
  54. package/lib/components/eftposPay/device.d.ts +4 -3
  55. package/lib/components/eftposPay/device.js +5 -4
  56. package/lib/components/eftposPay/hooks.d.ts +4 -3
  57. package/lib/components/eftposPay/hooks.js +30 -8
  58. package/lib/components/eftposPay/index.js +46 -18
  59. package/lib/components/eftposPay/index.less +1 -0
  60. package/lib/components/eftposPay/locales.d.ts +6 -0
  61. package/lib/components/eftposPay/locales.js +6 -0
  62. package/lib/components/eftposPay/pay.d.ts +3 -2
  63. package/lib/components/eftposPay/pay.js +7 -6
  64. package/lib/components/eftposPay/payo/config.d.ts +3 -1
  65. package/lib/components/eftposPay/payo/config.js +8 -8
  66. package/lib/components/eftposPay/payo/const.js +2 -0
  67. package/lib/components/eftposPay/payo/index.js +1 -1
  68. package/lib/components/eftposPay/store/index.d.ts +17 -2
  69. package/lib/components/eftposPay/store/index.js +14 -0
  70. package/lib/components/eftposPay/tyro/const.js +2 -0
  71. package/lib/components/eftposPay/tyro/index.js +63 -6
  72. package/lib/components/eftposPay/windcave/const.js +2 -0
  73. package/lib/components/eftposPay/windcave/helper.js +23 -28
  74. package/lib/components/eftposPay/windcave/windcave.js +2 -1
  75. package/package.json +3 -3
@@ -62,9 +62,14 @@ var App = ({
62
62
  const statusRef = (0, import_react.useRef)(data.status);
63
63
  const context = (0, import_useEngineContext.default)();
64
64
  console.log("context = ", context);
65
- const { formatAmount, isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {
65
+ const {
66
+ formatAmount,
67
+ storage
68
+ } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {
66
69
  formatAmount: (number, precision, symbol) => `${symbol}${number}`,
67
- isTerminal: () => false
70
+ storage: () => ({
71
+ get: () => ""
72
+ })
68
73
  };
69
74
  const network = (0, import_react.useMemo)(
70
75
  () => typeof terminal.network === "boolean" ? terminal.network : true,
@@ -90,7 +95,27 @@ var App = ({
90
95
  (0, import_react.useEffect)(() => {
91
96
  statusRef.current = data.status;
92
97
  }, [data.status]);
93
- const isIpad = (0, import_react.useMemo)(() => isTerminal && isTerminal(), [isTerminal]);
98
+ const channel = (0, import_react.useMemo)(() => {
99
+ var _a2;
100
+ const channel2 = ((_a2 = storage == null ? void 0 : storage.get) == null ? void 0 : _a2.call(storage, "channel")) || "";
101
+ if (channel2 === "terminal") {
102
+ return "terminal";
103
+ }
104
+ if (channel2 === "android_kiosk") {
105
+ return "kiosk";
106
+ }
107
+ return "";
108
+ }, []);
109
+ const client = (0, import_react.useMemo)(() => {
110
+ if (channel === "kiosk") {
111
+ return import_const.ClientEnum.User;
112
+ }
113
+ return import_const.ClientEnum.Merchant;
114
+ }, [channel]);
115
+ (0, import_react.useEffect)(() => {
116
+ dispatch((0, import_store.updateClient)(client));
117
+ }, [client]);
118
+ const isMobile = (0, import_react.useMemo)(() => Boolean(channel), [channel]);
94
119
  const api = (0, import_react.useMemo)(() => {
95
120
  if (typeof getApi === "function") {
96
121
  return getApi();
@@ -104,15 +129,15 @@ var App = ({
104
129
  form: "restore"
105
130
  });
106
131
  }, [data, onChangeParams]);
107
- const onChange = (0, import_react.useCallback)((status, params) => {
132
+ const onChange = (0, import_react.useCallback)((status, params, other) => {
108
133
  if (status === "page" && typeof params === "string") {
109
134
  if (["amount", "deviceList", "pay"].includes(params)) {
110
135
  setCurrent(params);
111
136
  dispatch((0, import_store.updateState)({ action: params }));
112
137
  }
113
138
  }
114
- console.log("状态切换 = ", status, params);
115
- props.onChangeStatus(status, params);
139
+ console.log("状态切换 = ", status, params, other);
140
+ props.onChangeStatus(status, params, other);
116
141
  }, []);
117
142
  const onClose = () => {
118
143
  onChange("fail", {
@@ -128,11 +153,12 @@ var App = ({
128
153
  api,
129
154
  onChange,
130
155
  onClose,
131
- isIpad,
132
- className: isIpad ? "pisell-lowcode__eft-pay-terminal" : "",
156
+ isMobile,
157
+ className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
133
158
  net,
134
159
  device_number,
135
- formatAmount
160
+ formatAmount,
161
+ client
136
162
  }
137
163
  );
138
164
  }
@@ -143,9 +169,10 @@ var App = ({
143
169
  onChange,
144
170
  onClose,
145
171
  formatAmount,
146
- isIpad,
147
- className: isIpad ? "pisell-lowcode__eft-pay-terminal" : "",
148
- net
172
+ isMobile,
173
+ className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
174
+ net,
175
+ client
149
176
  }
150
177
  );
151
178
  }
@@ -156,11 +183,12 @@ var App = ({
156
183
  tyroUrl,
157
184
  tyroVersion,
158
185
  onChange,
159
- className: isIpad ? "pisell-lowcode__eft-pay-terminal" : "",
186
+ className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
160
187
  terminal,
161
- isIpad,
188
+ isMobile,
162
189
  net,
163
- formatAmount
190
+ formatAmount,
191
+ client
164
192
  }
165
193
  );
166
194
  };
@@ -194,8 +222,8 @@ var eftposPay_default = (props) => {
194
222
  );
195
223
  }, [mode, props.params, props.type, symbol]);
196
224
  const onChangeStatus = (0, import_react.useCallback)(
197
- (status, params) => {
198
- props.onChangeStatus(status, params);
225
+ (status, params, other) => {
226
+ props.onChangeStatus(status, params, other);
199
227
  },
200
228
  []
201
229
  );
@@ -228,7 +256,7 @@ var eftposPay_default = (props) => {
228
256
  return act;
229
257
  }, [mode, state]);
230
258
  (0, import_react.useEffect)(() => {
231
- console.log("初始化 ........");
259
+ console.log("初始化 ........11221801");
232
260
  }, []);
233
261
  console.log("props?.params?.device_number = ", (_e = props == null ? void 0 : props.params) == null ? void 0 : _e.device_number);
234
262
  return /* @__PURE__ */ import_react.default.createElement(import_store.Provider, { state }, /* @__PURE__ */ import_react.default.createElement(
@@ -256,6 +256,7 @@
256
256
  .pisell-lowcode__eft-pay-terminal {
257
257
  width: var(--pisel-lc-pos-terminal-width, 100%) !important;
258
258
  height: var(--pisel-lc-pos-terminal-height, 100%) !important;
259
+ max-height: var(--pisel-lc-pos-terminal-max-height, unset) !important;
259
260
  display: flex;
260
261
  flex-direction: column;
261
262
  }
@@ -37,6 +37,7 @@ declare const _default: {
37
37
  'page.eftpos-pay.text.manual.diff': string;
38
38
  'page.eftpos-pay.text.manual.tip': string;
39
39
  'page.eftpos-pay.text.manual.cancel': string;
40
+ 'page.eftpos-pay.text.manual.print_receipt': string;
40
41
  'page.eftpos-pay.text.modify.payment.info': (mode: string) => "Modify payment info" | "Modify refund information";
41
42
  'page.eftpos-pay.text.successful': (mode: string) => string;
42
43
  'page.eftpos-pay.text.failed': (mode: string) => string;
@@ -85,6 +86,7 @@ declare const _default: {
85
86
  'page.eftpos-pay.text.transaction.eftpos.fail.device': string;
86
87
  'page.eftpos-pay.text.transaction.eftpos.fail.network': string;
87
88
  'page.eftpos-pay.text.transaction.eftpos.fail.if': (mode: string) => "If you have confirmed the payment status of this order, please click on Manual marking." | "If you have confirmed the refund status of this order, please click on Manual Marking.";
89
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': string;
88
90
  'page.eftpos-pay.text.application': string;
89
91
  'page.eftpos-pay.text.approved': string;
90
92
  'page.eftpos-pay.text.device.no.title': string;
@@ -139,6 +141,7 @@ declare const _default: {
139
141
  'page.eftpos-pay.text.manual.diff': string;
140
142
  'page.eftpos-pay.text.manual.tip': string;
141
143
  'page.eftpos-pay.text.manual.cancel': string;
144
+ 'page.eftpos-pay.text.manual.print_receipt': string;
142
145
  'page.eftpos-pay.text.modify.payment.info': (mode: string) => "修改支付信息" | "修改退款信息";
143
146
  'page.eftpos-pay.text.successful': (mode: string) => string;
144
147
  'page.eftpos-pay.text.failed': (mode: string) => string;
@@ -187,6 +190,7 @@ declare const _default: {
187
190
  'page.eftpos-pay.text.transaction.eftpos.fail.device': string;
188
191
  'page.eftpos-pay.text.transaction.eftpos.fail.network': string;
189
192
  'page.eftpos-pay.text.transaction.eftpos.fail.if': (mode: string) => "如果您已确认此交易的付款状态,请点击手动标记" | "如果您已确认此订单的退款状态,请点击手动标记。";
193
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': string;
190
194
  'page.eftpos-pay.text.application': string;
191
195
  'page.eftpos-pay.text.approved': string;
192
196
  'page.eftpos-pay.text.device.no.title': string;
@@ -241,6 +245,7 @@ declare const _default: {
241
245
  'page.eftpos-pay.text.manual.diff': string;
242
246
  'page.eftpos-pay.text.manual.tip': string;
243
247
  'page.eftpos-pay.text.manual.cancel': string;
248
+ 'page.eftpos-pay.text.manual.print_receipt': string;
244
249
  'page.eftpos-pay.text.modify.payment.info': (mode: string) => "修改支付信息" | "修改退款信息";
245
250
  'page.eftpos-pay.text.successful': (mode: string) => string;
246
251
  'page.eftpos-pay.text.failed': (mode: string) => string;
@@ -289,6 +294,7 @@ declare const _default: {
289
294
  'page.eftpos-pay.text.transaction.eftpos.fail.device': string;
290
295
  'page.eftpos-pay.text.transaction.eftpos.fail.network': string;
291
296
  'page.eftpos-pay.text.transaction.eftpos.fail.if': (mode: string) => "如果您已確認此交易的付款狀態,請點擊手動標記" | "如果您已確認此訂單的退款狀態,請點擊手動標記。";
297
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': string;
292
298
  'page.eftpos-pay.text.application': string;
293
299
  'page.eftpos-pay.text.approved': string;
294
300
  'page.eftpos-pay.text.device.no.title': string;
@@ -61,6 +61,7 @@ var locales_default = {
61
61
  "page.eftpos-pay.text.manual.diff": "If it doesn't match, please enter the actual transaction amount in the input box below.",
62
62
  "page.eftpos-pay.text.manual.tip": "Amount tendered (incl. surcharge)",
63
63
  "page.eftpos-pay.text.manual.cancel": "Cancel current transaction",
64
+ "page.eftpos-pay.text.manual.print_receipt": "Print Receipt",
64
65
  "page.eftpos-pay.text.modify.payment.info": (mode) => mode === "pay" || mode === "fullPay" ? "Modify payment info" : "Modify refund information",
65
66
  "page.eftpos-pay.text.successful": (mode) => `${mode === "pay" || mode === "fullPay" ? "Payment" : "Refund"} successful`,
66
67
  "page.eftpos-pay.text.failed": (mode) => `${mode === "pay" || mode === "fullPay" ? "Payment" : "Refund"} failed`,
@@ -110,6 +111,7 @@ var locales_default = {
110
111
  "page.eftpos-pay.text.transaction.eftpos.fail.device": "2. Check if the device is turned on.",
111
112
  "page.eftpos-pay.text.transaction.eftpos.fail.network": "3. Check the device network.",
112
113
  "page.eftpos-pay.text.transaction.eftpos.fail.if": (mode) => mode === "pay" || mode === "fullPay" ? "If you have confirmed the payment status of this order, please click on Manual marking." : "If you have confirmed the refund status of this order, please click on Manual Marking.",
114
+ "page.eftpos-pay.text.transaction.eftpos.fail.other": "Payment issue detected. Please print the receipt and contact staff for assistance.",
113
115
  "page.eftpos-pay.text.application": "Waiting for customer to select application",
114
116
  "page.eftpos-pay.text.approved": "Approved",
115
117
  "page.eftpos-pay.text.device.no.title": "No devices added yet. Please add devices to proceed.",
@@ -168,6 +170,7 @@ var locales_default = {
168
170
  "page.eftpos-pay.text.manual.diff": "如不一致请在下方输入框内输入真实的交易金额。",
169
171
  "page.eftpos-pay.text.manual.tip": "实付金额(含附加费)",
170
172
  "page.eftpos-pay.text.manual.cancel": "取消当前交易",
173
+ "page.eftpos-pay.text.manual.print_receipt": "打印收据",
171
174
  "page.eftpos-pay.text.modify.payment.info": (mode) => mode === "pay" || mode === "fullPay" ? "修改支付信息" : "修改退款信息",
172
175
  "page.eftpos-pay.text.successful": (mode) => `${mode === "pay" || mode === "fullPay" ? "支付" : "退款"}成功`,
173
176
  "page.eftpos-pay.text.failed": (mode) => `${mode === "pay" || mode === "fullPay" ? "支付" : "退款"}失败`,
@@ -224,6 +227,7 @@ var locales_default = {
224
227
  "page.eftpos-pay.text.transaction.eftpos.fail.device": "2. 检查设备是否开机",
225
228
  "page.eftpos-pay.text.transaction.eftpos.fail.network": "3. 检查设备网络",
226
229
  "page.eftpos-pay.text.transaction.eftpos.fail.if": (mode) => mode === "pay" || mode === "fullPay" ? "如果您已确认此交易的付款状态,请点击手动标记" : "如果您已确认此订单的退款状态,请点击手动标记。",
230
+ "page.eftpos-pay.text.transaction.eftpos.fail.other": "刷卡机支付出现问题,请打印收据后联系店员处理。",
227
231
  "page.eftpos-pay.text.application": "等待客户选择应用",
228
232
  "page.eftpos-pay.text.approved": "已接受",
229
233
  "page.eftpos-pay.text.device.no.title": "您还没有添加任何设备。请添加设备后使用",
@@ -428,6 +432,7 @@ var locales_default = {
428
432
  "page.eftpos-pay.text.manual.diff": "如不一致請在下方輸入框內輸入真實的交易金額。",
429
433
  "page.eftpos-pay.text.manual.tip": "實付金額(含附加費)",
430
434
  "page.eftpos-pay.text.manual.cancel": "取消當前交易",
435
+ "page.eftpos-pay.text.manual.print_receipt": "打印收據",
431
436
  "page.eftpos-pay.text.modify.payment.info": (mode) => mode === "pay" || mode === "fullPay" ? "修改支付信息" : "修改退款信息",
432
437
  "page.eftpos-pay.text.successful": (mode) => `${mode === "pay" || mode === "fullPay" ? "支付" : "退款"}成功`,
433
438
  "page.eftpos-pay.text.failed": (mode) => `${mode === "pay" || mode === "fullPay" ? "支付" : "退款"}失敗`,
@@ -484,6 +489,7 @@ var locales_default = {
484
489
  "page.eftpos-pay.text.transaction.eftpos.fail.device": "2. 檢查設備是否開機",
485
490
  "page.eftpos-pay.text.transaction.eftpos.fail.network": "3. 檢查設備網絡",
486
491
  "page.eftpos-pay.text.transaction.eftpos.fail.if": (mode) => mode === "pay" || mode === "fullPay" ? "如果您已確認此交易的付款狀態,請點擊手動標記" : "如果您已確認此訂單的退款狀態,請點擊手動標記。",
492
+ "page.eftpos-pay.text.transaction.eftpos.fail.other": "刷卡機支付出現問題,請打印收據後聯繫店員處理。",
487
493
  "page.eftpos-pay.text.application": "等待客户選擇應用",
488
494
  "page.eftpos-pay.text.approved": "已接受",
489
495
  "page.eftpos-pay.text.device.no.title": "您還沒有添加任何設備。請添加設備後使用",
@@ -7,14 +7,15 @@ import './index.less';
7
7
  * @Author: hongbing.wang
8
8
  * @Date: 2024-08-20 14:59
9
9
  */
10
- declare const Pay: ({ api, onChange: onChangeStatus, className, terminal, net, isIpad, tyroUrl, tyroVersion, formatAmount, }: PayProps & {
10
+ declare const Pay: ({ api, onChange: onChangeStatus, className, terminal, net, isMobile, tyroUrl, tyroVersion, formatAmount, client }: PayProps & {
11
11
  terminal: {
12
12
  network: boolean;
13
13
  };
14
14
  net: boolean;
15
- isIpad: boolean;
15
+ isMobile: boolean;
16
16
  tyroUrl?: string | undefined;
17
17
  tyroVersion?: string | undefined;
18
18
  formatAmount(amount: number | string, precision: number, symbol: string): string;
19
+ client: string;
19
20
  }) => React.JSX.Element;
20
21
  export default Pay;
@@ -60,10 +60,11 @@ var Pay = ({
60
60
  className,
61
61
  terminal,
62
62
  net,
63
- isIpad,
63
+ isMobile,
64
64
  tyroUrl,
65
65
  tyroVersion,
66
- formatAmount = (number, precision, symbol) => `${symbol}${number}`
66
+ formatAmount = (number, precision, symbol) => `${symbol}${number}`,
67
+ client
67
68
  }) => {
68
69
  const data = (0, import_store.useContextData)();
69
70
  const dataRef = (0, import_react.useRef)(data);
@@ -84,11 +85,11 @@ var Pay = ({
84
85
  }, [data]);
85
86
  const Comm = Mapping[data.component];
86
87
  const onChange = (0, import_react.useCallback)(
87
- (status, params) => {
88
+ (status, params, other) => {
88
89
  if (status === import_const.StatusEnum.Success || status === import_const.StatusEnum.Fail) {
89
90
  dispatch((0, import_store.updateStatus)(status));
90
91
  }
91
- onChangeStatus(status, params);
92
+ onChangeStatus(status, params, other);
92
93
  },
93
94
  [dispatch, onChangeStatus]
94
95
  );
@@ -158,7 +159,7 @@ var Pay = ({
158
159
  subTitle: data.subTitle
159
160
  }
160
161
  ),
161
- data.eftpos === "payo" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Payo, { api, onChange }, data.warn && data.status !== import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-warn" }, data.warn) : null, data.status === import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-tip" }, import_utils.locales.getText("page.eftpos-pay.text.transaction.end")) : null) : null,
162
+ data.eftpos === "payo" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Payo, { api, onChange }, data.warn && data.status !== import_const.StatusEnum.Success && client === import_const.ClientEnum.Merchant ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-warn" }, data.warn) : null, data.status === import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-tip" }, import_utils.locales.getText("page.eftpos-pay.text.transaction.end")) : null) : null,
162
163
  data.eftpos === "tyro" ? /* @__PURE__ */ import_react.default.createElement(import_manufacturer.Tyro, { api, onChange, key: data.key, url: tyroUrl, version: tyroVersion }) : null,
163
164
  data.eftpos === "windcave" ? /* @__PURE__ */ import_react.default.createElement(
164
165
  import_manufacturer.Windcave,
@@ -175,7 +176,7 @@ var Pay = ({
175
176
  onChange,
176
177
  api,
177
178
  className,
178
- isIpad,
179
+ isMobile,
179
180
  formatAmount
180
181
  }
181
182
  ) : null);
@@ -8,4 +8,6 @@ export declare const POS: ({ api, onChange, }: {
8
8
  [keys: string]: unknown;
9
9
  } | undefined) => void;
10
10
  }) => React.JSX.Element;
11
- export declare const Action: () => React.JSX.Element;
11
+ export declare const Action: ({ onChange }: {
12
+ onChange: any;
13
+ }) => React.JSX.Element;
@@ -60,7 +60,7 @@ var POS = ({
60
60
  } = (0, import_hooks.useStoreRef)();
61
61
  const dispatch = (0, import_store.useDispatch)();
62
62
  const { key, ...props } = steps[0];
63
- const fail = (0, import_hooks.useFail)(0, true);
63
+ const fail = (0, import_hooks.useFail)(0);
64
64
  const failRef = (0, import_react.useRef)(fail);
65
65
  const controllerRef = (0, import_react.useRef)();
66
66
  const clearRef = (0, import_react.useRef)();
@@ -110,13 +110,13 @@ var POS = ({
110
110
  success(res);
111
111
  return;
112
112
  }
113
- failRef.current(res);
113
+ failRef.current(res, true);
114
114
  },
115
115
  (res) => {
116
116
  if (unloadRef.current || !netRef.current) {
117
117
  return;
118
118
  }
119
- failRef.current(res);
119
+ failRef.current(res, true);
120
120
  }
121
121
  );
122
122
  };
@@ -183,7 +183,7 @@ var POS = ({
183
183
  checkApi();
184
184
  return;
185
185
  }
186
- failRef.current(err);
186
+ failRef.current(err, true);
187
187
  });
188
188
  }, [api, check, dispatch, onChange]);
189
189
  (0, import_react.useEffect)(
@@ -199,9 +199,9 @@ var POS = ({
199
199
  );
200
200
  return /* @__PURE__ */ import_react.default.createElement(import_step.default, { ...props });
201
201
  };
202
- var Action = () => {
202
+ var Action = ({ onChange }) => {
203
203
  const dispatch = (0, import_store.useDispatch)();
204
- const { mode } = (0, import_store.useContextData)();
204
+ const { mode, client } = (0, import_store.useContextData)();
205
205
  const onManually = () => {
206
206
  dispatch(
207
207
  (0, import_store.updateState)({
@@ -213,7 +213,7 @@ var Action = () => {
213
213
  );
214
214
  dispatch((0, import_store.updateComponent)("Manual", true));
215
215
  };
216
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
216
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client === import_const.ClientEnum.Merchant ? /* @__PURE__ */ import_react.default.createElement(
217
217
  import_antd.Button,
218
218
  {
219
219
  block: true,
@@ -221,7 +221,7 @@ var Action = () => {
221
221
  onClick: onManually
222
222
  },
223
223
  import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
224
- ));
224
+ ) : null);
225
225
  };
226
226
  // Annotate the CommonJS export names for ESM import in node:
227
227
  0 && (module.exports = {
@@ -50,6 +50,7 @@ var const_default = (params) => {
50
50
  pay,
51
51
  device,
52
52
  net,
53
+ client,
53
54
  ...other
54
55
  } = params || {
55
56
  mode: import_const.ModeEnum.Pay
@@ -70,6 +71,7 @@ var const_default = (params) => {
70
71
  status: import_const.StatusEnum.Loading,
71
72
  steps: getStep(mode),
72
73
  render: true,
74
+ client: client !== "undefined" ? client : import_const.ClientEnum.Merchant,
73
75
  custom: other || {},
74
76
  ...typeof net !== "undefined" ? { net } : {},
75
77
  ...typeof number !== "undefined" ? { number } : {},
@@ -59,5 +59,5 @@ var payo_default = ({
59
59
  }
60
60
  );
61
61
  }
62
- }), children), data.status !== import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement(import_config.Action, null) : null);
62
+ }), children), data.status !== import_const.StatusEnum.Success ? /* @__PURE__ */ import_react.default.createElement(import_config.Action, { onChange }) : null);
63
63
  };
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { DeviceStatusType, StatusType, ModeType, RouteType } from '../const';
2
+ import { DeviceStatusType, StatusType, ModeType, RouteType, ClientEnum } from '../const';
3
3
  import { ThunkDispatch } from './useThunkReducer';
4
4
  export declare enum EActionTypes {
5
5
  UPDATE_INIT = "UPDATE_INIT",
@@ -16,7 +16,8 @@ export declare enum EActionTypes {
16
16
  UPDATE_STEP_CURRENT_ITEM_CUSTOM = "UPDATE_STEP_CURRENT_ITEM_CUSTOM",
17
17
  UPDATE_STEP_ITEM = "UPDATE_STEP_ITEM",
18
18
  BACKUP_PRODUCTION = "BACKUP_PRODUCTION",
19
- BACKUP_FREE = "BACKUP_FREE"
19
+ BACKUP_FREE = "BACKUP_FREE",
20
+ UPDATE_CLIENT = "UPDATE_CLIENT"
20
21
  }
21
22
  export declare type State = {
22
23
  /** 支付名称 */
@@ -89,6 +90,7 @@ export declare type State = {
89
90
  money?: number;
90
91
  };
91
92
  backup?: Omit<State, 'backup'>;
93
+ client: ClientEnum;
92
94
  };
93
95
  export declare type Action = {
94
96
  type: EActionTypes;
@@ -258,6 +260,18 @@ export declare const updateCurrentStemItem: (payload: any) => {
258
260
  type: EActionTypes;
259
261
  payload: any;
260
262
  };
263
+ /**
264
+ * @title: 更新当前步骤信息
265
+ * @description: 更新当前步骤信息
266
+ * @Author: hongbing.wang
267
+ * @Date: 2024-08-19 10:09
268
+ */
269
+ export declare const updateClient: (payload: ClientEnum) => {
270
+ type: EActionTypes;
271
+ payload: {
272
+ client: ClientEnum;
273
+ };
274
+ };
261
275
  /**
262
276
  * @title: 更新备份信息
263
277
  * @description: 更新备份信息
@@ -329,6 +343,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
329
343
  money?: number | undefined;
330
344
  } | undefined;
331
345
  backup?: Omit<State, "backup"> | undefined;
346
+ client?: ClientEnum | undefined;
332
347
  };
333
348
  };
334
349
  export declare function reducers(state: State, action: Action): State;
@@ -34,6 +34,7 @@ __export(store_exports, {
34
34
  backUpFree: () => backUpFree,
35
35
  backUpProduction: () => backUpProduction,
36
36
  reducers: () => reducers,
37
+ updateClient: () => updateClient,
37
38
  updateComponent: () => updateComponent,
38
39
  updateCurrentCustomStemItem: () => updateCurrentCustomStemItem,
39
40
  updateCurrentStemItem: () => updateCurrentStemItem,
@@ -69,6 +70,7 @@ var EActionTypes = /* @__PURE__ */ ((EActionTypes2) => {
69
70
  EActionTypes2["UPDATE_STEP_ITEM"] = "UPDATE_STEP_ITEM";
70
71
  EActionTypes2["BACKUP_PRODUCTION"] = "BACKUP_PRODUCTION";
71
72
  EActionTypes2["BACKUP_FREE"] = "BACKUP_FREE";
73
+ EActionTypes2["UPDATE_CLIENT"] = "UPDATE_CLIENT";
72
74
  return EActionTypes2;
73
75
  })(EActionTypes || {});
74
76
  var updateKey = (key) => ({
@@ -124,6 +126,12 @@ var updateCurrentStemItem = (payload) => ({
124
126
  type: "UPDATE_STEP_ITEM" /* UPDATE_STEP_ITEM */,
125
127
  payload
126
128
  });
129
+ var updateClient = (payload) => ({
130
+ type: "UPDATE_CLIENT" /* UPDATE_CLIENT */,
131
+ payload: {
132
+ client: payload
133
+ }
134
+ });
127
135
  var backUpProduction = (payload) => ({
128
136
  type: "BACKUP_PRODUCTION" /* BACKUP_PRODUCTION */,
129
137
  payload
@@ -260,6 +268,11 @@ function reducers(state, action) {
260
268
  ...s,
261
269
  ...action.payload
262
270
  };
271
+ case "UPDATE_CLIENT" /* UPDATE_CLIENT */:
272
+ return {
273
+ ...state,
274
+ client: action.payload["client"]
275
+ };
263
276
  default: {
264
277
  throw new Error(`Unhandled action type: ${action.type}`);
265
278
  }
@@ -296,6 +309,7 @@ function useDispatch() {
296
309
  backUpFree,
297
310
  backUpProduction,
298
311
  reducers,
312
+ updateClient,
299
313
  updateComponent,
300
314
  updateCurrentCustomStemItem,
301
315
  updateCurrentStemItem,
@@ -36,6 +36,7 @@ var const_default = (params) => {
36
36
  pay,
37
37
  device,
38
38
  net,
39
+ client,
39
40
  ...other
40
41
  } = params || {
41
42
  mode: import_const.ModeEnum.Pay
@@ -56,6 +57,7 @@ var const_default = (params) => {
56
57
  status: import_const.StatusEnum.Loading,
57
58
  steps: [],
58
59
  render: true,
60
+ client: client !== "undefined" ? client : import_const.ClientEnum.Merchant,
59
61
  custom: other || {},
60
62
  ...typeof net !== "undefined" ? { net } : {},
61
63
  ...typeof number !== "undefined" ? { number } : {},
@@ -50,7 +50,7 @@ var tyro_default = ({
50
50
  url,
51
51
  version
52
52
  }) => {
53
- const { eftpos, custom, mode, status: payStatus } = (0, import_store.useContextData)();
53
+ const { eftpos, custom, mode, status: payStatus, client } = (0, import_store.useContextData)();
54
54
  const dispatch = (0, import_store.useDispatch)();
55
55
  const [status, setStatus] = (0, import_react.useState)(-1);
56
56
  const [isManually, setManually] = (0, import_react.useState)(false);
@@ -61,11 +61,15 @@ var tyro_default = ({
61
61
  const requestParams = (0, import_react.useRef)(custom == null ? void 0 : custom.requestParams);
62
62
  const listRef = (0, import_react.useRef)((custom == null ? void 0 : custom.list) || []);
63
63
  const iClientRef = (0, import_react.useRef)();
64
+ const requestIdRef = (0, import_react.useRef)((custom == null ? void 0 : custom.requestId) || "");
64
65
  const unloadRef = (0, import_react.useRef)(false);
65
66
  const clearRef = (0, import_react.useRef)();
66
67
  (0, import_react.useEffect)(() => {
67
68
  listRef.current = (custom == null ? void 0 : custom.list) || [];
68
69
  }, [custom == null ? void 0 : custom.list]);
70
+ (0, import_react.useEffect)(() => {
71
+ requestIdRef.current = (custom == null ? void 0 : custom.requestId) || "";
72
+ }, [custom == null ? void 0 : custom.requestId]);
69
73
  (0, import_react.useEffect)(() => {
70
74
  requestParams.current = custom == null ? void 0 : custom.requestParams;
71
75
  }, [custom == null ? void 0 : custom.requestParams]);
@@ -92,7 +96,7 @@ var tyro_default = ({
92
96
  );
93
97
  };
94
98
  const refundOrder = () => {
95
- var _a, _b;
99
+ var _a, _b, _c;
96
100
  const iClient = iClientRef.current;
97
101
  if (!iClient) {
98
102
  return;
@@ -124,6 +128,27 @@ var tyro_default = ({
124
128
  );
125
129
  setStatus(Date.now());
126
130
  merchantReceiptRef.current = {};
131
+ api.addTransaction({
132
+ order_id: orderIdRef.current,
133
+ number: numRef.current,
134
+ card_reader_id: (_c = deviceRef.current) == null ? void 0 : _c.id,
135
+ card_reader_type: eftpos,
136
+ amount: requestParams.current.amount,
137
+ action: modeRef.current === import_const.ModeEnum.FullPay ? import_const.ModeEnum.Pay : modeRef.current,
138
+ status: "pending",
139
+ request: requestParams.current,
140
+ response: {},
141
+ metadata: {
142
+ receipt: []
143
+ }
144
+ }).then((res) => {
145
+ requestIdRef.current = res.data.id;
146
+ dispatch(
147
+ (0, import_store.updateCustom)({
148
+ requestId: res.data.id
149
+ })
150
+ );
151
+ });
127
152
  iClient.initiateRefund(requestParams.current, {
128
153
  receiptCallback: receiptCallbackImpl,
129
154
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -132,7 +157,7 @@ var tyro_default = ({
132
157
  });
133
158
  };
134
159
  const payOrder = () => {
135
- var _a, _b, _c, _d, _e, _f, _g;
160
+ var _a, _b, _c, _d, _e, _f, _g, _h;
136
161
  const iClient = iClientRef.current;
137
162
  if (!iClient) {
138
163
  return;
@@ -170,6 +195,27 @@ var tyro_default = ({
170
195
  );
171
196
  setStatus(Date.now());
172
197
  merchantReceiptRef.current = {};
198
+ api.addTransaction({
199
+ order_id: orderIdRef.current,
200
+ number: numRef.current,
201
+ card_reader_id: (_h = deviceRef.current) == null ? void 0 : _h.id,
202
+ card_reader_type: eftpos,
203
+ amount: requestParams.current.amount,
204
+ action: modeRef.current === import_const.ModeEnum.FullPay ? import_const.ModeEnum.Pay : modeRef.current,
205
+ status: "pending",
206
+ request: requestParams.current,
207
+ response: {},
208
+ metadata: {
209
+ receipt: []
210
+ }
211
+ }).then((res) => {
212
+ requestIdRef.current = res.data.id;
213
+ dispatch(
214
+ (0, import_store.updateCustom)({
215
+ requestId: res.data.id
216
+ })
217
+ );
218
+ });
173
219
  iClient.initiatePurchase(requestParams.current, {
174
220
  receiptCallback: receiptCallbackImpl,
175
221
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -302,15 +348,15 @@ var tyro_default = ({
302
348
  // merchantReceiptRef.current?.merchantReceipt,
303
349
  response == null ? void 0 : response.customerReceipt
304
350
  ].filter((item) => typeof item === "string").filter(Boolean);
305
- api.addTransaction({
351
+ api.editTransaction(requestIdRef.current, {
306
352
  order_id: orderIdRef.current,
307
353
  number: numRef.current,
308
354
  card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
309
355
  card_reader_type: eftpos,
310
356
  amount: requestParams.current.amount,
311
357
  action: modeRef.current === import_const.ModeEnum.FullPay ? import_const.ModeEnum.Pay : modeRef.current,
312
- status: response.result === "APPROVED" ? "succeed" : "failed",
313
358
  request: requestParams.current,
359
+ status: response.result === "APPROVED" ? "succeed" : "failed",
314
360
  response: { ...response, merchantReceipt: merchantReceiptRef.current },
315
361
  metadata: {
316
362
  receipt
@@ -418,6 +464,9 @@ var tyro_default = ({
418
464
  }
419
465
  }
420
466
  }, [load]);
467
+ const onNotin = () => {
468
+ onChange("print", [], "print_on_timeout");
469
+ };
421
470
  (0, import_react.useEffect)(() => {
422
471
  let clear;
423
472
  if (status === -1) {
@@ -532,7 +581,7 @@ var tyro_default = ({
532
581
  reject: item.reject,
533
582
  status: item.status
534
583
  }
535
- ))), isManually ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
584
+ ))), isManually ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client === import_const.ClientEnum.Merchant ? /* @__PURE__ */ import_react.default.createElement(
536
585
  import_antd.Button,
537
586
  {
538
587
  block: true,
@@ -540,6 +589,14 @@ var tyro_default = ({
540
589
  onClick: onManually
541
590
  },
542
591
  import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
592
+ ) : /* @__PURE__ */ import_react.default.createElement(
593
+ import_antd.Button,
594
+ {
595
+ block: true,
596
+ className: "pisell-lowcode__eft-pay-step-item-btn",
597
+ onClick: onNotin
598
+ },
599
+ import_utils.locales.getText("page.eftpos-pay.text.manual.print_receipt")
543
600
  )) : null, /* @__PURE__ */ import_react.default.createElement(
544
601
  "div",
545
602
  {