@pisell/private-materials 3.0.205 → 3.0.206

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 (57) 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 +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/eftposPay/component/fail/failCustom.js +0 -1
  12. package/es/components/eftposPay/component/fail/index.js +0 -1
  13. package/es/components/eftposPay/component/manual/index.js +1 -4
  14. package/es/components/eftposPay/const.d.ts +1 -27
  15. package/es/components/eftposPay/const.js +0 -22
  16. package/es/components/eftposPay/device.d.ts +1 -1
  17. package/es/components/eftposPay/device.js +2 -2
  18. package/es/components/eftposPay/helper.d.ts +0 -5
  19. package/es/components/eftposPay/helper.js +4 -10
  20. package/es/components/eftposPay/hooks.d.ts +0 -1
  21. package/es/components/eftposPay/hooks.js +16 -22
  22. package/es/components/eftposPay/index.d.ts +1 -1
  23. package/es/components/eftposPay/index.js +179 -130
  24. package/es/components/eftposPay/locales.d.ts +0 -15
  25. package/es/components/eftposPay/locales.js +0 -15
  26. package/es/components/eftposPay/payo/config.js +8 -20
  27. package/es/components/eftposPay/tyro/index.js +2 -4
  28. package/es/components/eftposPay/windcave/windcave.js +6 -17
  29. package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
  30. package/lib/components/eftposPay/component/fail/index.js +1 -1
  31. package/lib/components/eftposPay/component/manual/index.js +5 -19
  32. package/lib/components/eftposPay/const.d.ts +1 -27
  33. package/lib/components/eftposPay/const.js +0 -18
  34. package/lib/components/eftposPay/device.d.ts +1 -1
  35. package/lib/components/eftposPay/device.js +2 -2
  36. package/lib/components/eftposPay/helper.d.ts +0 -5
  37. package/lib/components/eftposPay/helper.js +4 -8
  38. package/lib/components/eftposPay/hooks.d.ts +0 -1
  39. package/lib/components/eftposPay/hooks.js +2 -8
  40. package/lib/components/eftposPay/index.d.ts +1 -1
  41. package/lib/components/eftposPay/index.js +144 -106
  42. package/lib/components/eftposPay/locales.d.ts +0 -15
  43. package/lib/components/eftposPay/locales.js +0 -15
  44. package/lib/components/eftposPay/payo/config.js +9 -33
  45. package/lib/components/eftposPay/tyro/index.js +2 -4
  46. package/lib/components/eftposPay/windcave/windcave.js +6 -29
  47. package/package.json +4 -4
  48. package/es/components/eftposPay/app.d.ts +0 -11
  49. package/es/components/eftposPay/app.js +0 -173
  50. package/es/components/eftposPay/tip.d.ts +0 -10
  51. package/es/components/eftposPay/tip.js +0 -177
  52. package/es/components/eftposPay/tip.less +0 -9
  53. package/lib/components/eftposPay/app.d.ts +0 -11
  54. package/lib/components/eftposPay/app.js +0 -166
  55. package/lib/components/eftposPay/tip.d.ts +0 -10
  56. package/lib/components/eftposPay/tip.js +0 -159
  57. package/lib/components/eftposPay/tip.less +0 -9
@@ -78,11 +78,6 @@ var locales_default = {
78
78
  "page.eftpos-pay.text.sure": "Sure",
79
79
  "page.eftpos-pay.text.device": "Please select device",
80
80
  "page.eftpos-pay.text.leave": "Please do not leave this page",
81
- "page.eftpos-pay.text.latest.success": "A Successful Payment Detected for This Order!",
82
- "page.eftpos-pay.text.latest.amount": "Amount",
83
- "page.eftpos-pay.text.latest.surcharge": "Surcharge",
84
- "page.eftpos-pay.text.latest.time": "Time",
85
- "page.eftpos-pay.text.latest.confirm": "Confirm",
86
81
  "page.eftpos-pay.text.amount.to.pay": "Amount to pay",
87
82
  "page.eftpos-pay.text.surcharge.percentage": "Percentage",
88
83
  "page.eftpos-pay.text.surcharge.fixed": "Fixed",
@@ -192,11 +187,6 @@ var locales_default = {
192
187
  "page.eftpos-pay.text.sure": "确定",
193
188
  "page.eftpos-pay.text.device": "请选择设备",
194
189
  "page.eftpos-pay.text.leave": "请不要离开此页面",
195
- "page.eftpos-pay.text.latest.success": "检测到此订单有一笔交易已支付成功!",
196
- "page.eftpos-pay.text.latest.amount": "交易金额",
197
- "page.eftpos-pay.text.latest.surcharge": "手续费",
198
- "page.eftpos-pay.text.latest.time": "交易时间",
199
- "page.eftpos-pay.text.latest.confirm": "确认",
200
190
  "page.eftpos-pay.text.amount.to.pay": "剩余待支付金额",
201
191
  "page.eftpos-pay.text.surcharge.percentage": "百分比",
202
192
  // Percentage
@@ -459,11 +449,6 @@ var locales_default = {
459
449
  "page.eftpos-pay.text.sure": "確定",
460
450
  "page.eftpos-pay.text.device": "請選擇設備",
461
451
  "page.eftpos-pay.text.leave": "請不要離開此頁面",
462
- "page.eftpos-pay.text.latest.success": "檢測到此訂單有一筆交易已支付成功!",
463
- "page.eftpos-pay.text.latest.amount": "交易金額",
464
- "page.eftpos-pay.text.latest.surcharge": "手續費",
465
- "page.eftpos-pay.text.latest.time": "交易時間",
466
- "page.eftpos-pay.text.latest.confirm": "確認",
467
452
  "page.eftpos-pay.text.amount.to.pay": "剩餘待支付金額",
468
453
  "page.eftpos-pay.text.surcharge.percentage": "百分比",
469
454
  // Percentage
@@ -56,8 +56,7 @@ var POS = ({
56
56
  netRef,
57
57
  orderIdRef,
58
58
  amountRef,
59
- eftposRef,
60
- dataRef
59
+ eftposRef
61
60
  } = (0, import_hooks.useStoreRef)();
62
61
  const dispatch = (0, import_store.useDispatch)();
63
62
  const { key, ...props } = steps[0];
@@ -72,18 +71,15 @@ var POS = ({
72
71
  failRef.current = fail;
73
72
  }, [fail]);
74
73
  const success = (res) => {
75
- var _a, _b, _c, _d;
76
- let receipt = Array.isArray((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.receipt) ? (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.receipt : [(_c = res == null ? void 0 : res.data) == null ? void 0 : _c.receipt];
77
- receipt = receipt.filter((item) => typeof item === "string").filter(Boolean);
74
+ var _a;
78
75
  dispatch((0, import_store.updateNextStep)());
79
76
  dispatch(
80
77
  (0, import_store.updateCustom)({
81
- card_reader_surcharge: ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.card_reader_surcharge) || 0,
82
- receipt
78
+ card_reader_surcharge: ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.card_reader_surcharge) || 0
83
79
  })
84
80
  );
85
81
  clearRef.current = setTimeout(() => {
86
- var _a2, _b2, _c2;
82
+ var _a2, _b, _c;
87
83
  const params = (0, import_helper.getPayParams)(
88
84
  {
89
85
  mode: modeRef.current,
@@ -93,15 +89,15 @@ var POS = ({
93
89
  device: deviceRef.current,
94
90
  pay: payRef.current,
95
91
  custom: {
96
- card_reader_surcharge: ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.card_reader_surcharge) || 0,
97
- receipt
92
+ card_reader_surcharge: ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.card_reader_surcharge) || 0
98
93
  }
99
94
  },
100
95
  "success"
101
96
  );
97
+ const receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
102
98
  onChange("success", {
103
99
  ...params,
104
- receipt: ((_c2 = (_b2 = deviceRef.current) == null ? void 0 : _b2.setting) == null ? void 0 : _c2.receipts) ? [] : receipt
100
+ receipt: ((_c = (_b = deviceRef.current) == null ? void 0 : _b.setting) == null ? void 0 : _c.receipts) ? [] : receipt
105
101
  });
106
102
  }, 1e3);
107
103
  };
@@ -151,17 +147,7 @@ var POS = ({
151
147
  amount: payRef.current.total,
152
148
  card_reader_type: eftposRef.current,
153
149
  card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
154
- number: numRef.current,
155
- pay_param_base64: encodeURIComponent(
156
- btoa(
157
- encodeURIComponent(
158
- JSON.stringify({
159
- ...dataRef.current,
160
- number: numRef.current
161
- })
162
- )
163
- )
164
- )
150
+ number: numRef.current
165
151
  },
166
152
  { signal: controllerRef.current.signal }
167
153
  ) : api.refund(
@@ -170,17 +156,7 @@ var POS = ({
170
156
  amount: amountRef.current,
171
157
  card_reader_type: eftposRef.current,
172
158
  card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
173
- number: numRef.current,
174
- pay_param_base64: encodeURIComponent(
175
- btoa(
176
- encodeURIComponent(
177
- JSON.stringify({
178
- ...dataRef.current,
179
- number: numRef.current
180
- })
181
- )
182
- )
183
- )
159
+ number: numRef.current
184
160
  },
185
161
  { signal: controllerRef.current.signal }
186
162
  );
@@ -405,8 +405,7 @@ var tyro_default = ({
405
405
  );
406
406
  dispatch(
407
407
  (0, import_store.updateCustom)({
408
- card_reader_surcharge: response.surchargeAmount || 0,
409
- receipt
408
+ card_reader_surcharge: response.surchargeAmount || 0
410
409
  })
411
410
  );
412
411
  clearRef.current = setTimeout(() => {
@@ -419,8 +418,7 @@ var tyro_default = ({
419
418
  device: deviceRef.current,
420
419
  pay: payRef.current,
421
420
  custom: {
422
- card_reader_surcharge: response.surchargeAmount || 0,
423
- receipt
421
+ card_reader_surcharge: response.surchargeAmount || 0
424
422
  }
425
423
  },
426
424
  "success"
@@ -60,7 +60,7 @@ var windcave_default = ({
60
60
  symbolRef,
61
61
  amountRef,
62
62
  eftposRef,
63
- dataRef
63
+ clientRef
64
64
  } = (0, import_hooks.useStoreRef)();
65
65
  const dispatch = (0, import_store.useDispatch)();
66
66
  const fail = (0, import_helper2.useFail)();
@@ -89,16 +89,13 @@ var windcave_default = ({
89
89
  failRef.current = fail;
90
90
  }, [fail]);
91
91
  const [run, validateRef] = (0, import_helper2.useValidate)(api.check, Minute, (res) => {
92
- let receipt = Array.isArray(res == null ? void 0 : res.receipt) ? res.receipt : [res.receipt];
93
- receipt = receipt.filter((item) => typeof item === "string").filter(Boolean);
94
92
  dispatch(
95
93
  (0, import_store.updateCustom)({
96
94
  list: listRef.current.map((item) => ({
97
95
  ...item,
98
96
  status: "resolve"
99
97
  })),
100
- card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0,
101
- receipt
98
+ card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0
102
99
  })
103
100
  );
104
101
  dispatch(
@@ -120,12 +117,12 @@ var windcave_default = ({
120
117
  device: deviceRef.current,
121
118
  pay: payRef.current,
122
119
  custom: {
123
- card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0,
124
- receipt
120
+ card_reader_surcharge: (res == null ? void 0 : res.card_reader_surcharge) || 0
125
121
  }
126
122
  },
127
123
  "success"
128
124
  );
125
+ const receipt = Array.isArray(res.receipt) ? res.receipt : [res.receipt];
129
126
  onChange("success", {
130
127
  ...params,
131
128
  receipt: ((_b = (_a = deviceRef.current) == null ? void 0 : _a.setting) == null ? void 0 : _b.receipts) ? [] : receipt
@@ -168,17 +165,7 @@ var windcave_default = ({
168
165
  amount: payRef.current.total,
169
166
  card_reader_type: eftposRef.current,
170
167
  card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
171
- number: numRef.current,
172
- pay_param_base64: encodeURIComponent(
173
- btoa(
174
- encodeURIComponent(
175
- JSON.stringify({
176
- ...dataRef.current,
177
- number: numRef.current
178
- })
179
- )
180
- )
181
- )
168
+ number: numRef.current
182
169
  },
183
170
  { signal: controllerRef.current.signal }
184
171
  ) : api.refund(
@@ -187,17 +174,7 @@ var windcave_default = ({
187
174
  amount: amountRef.current,
188
175
  card_reader_type: eftposRef.current,
189
176
  card_reader_id: (_b = deviceRef.current) == null ? void 0 : _b.id,
190
- number: numRef.current,
191
- pay_param_base64: encodeURIComponent(
192
- btoa(
193
- encodeURIComponent(
194
- JSON.stringify({
195
- ...dataRef.current,
196
- number: numRef.current
197
- })
198
- )
199
- )
200
- )
177
+ number: numRef.current
201
178
  },
202
179
  { signal: controllerRef.current.signal }
203
180
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.205",
3
+ "version": "3.0.206",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -59,10 +59,10 @@
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
- "@pisell/icon": "0.0.11",
62
+ "@pisell/utils": "1.0.42",
63
63
  "@pisell/materials": "3.0.59",
64
- "@pisell/date-picker": "1.0.100",
65
- "@pisell/utils": "1.0.42"
64
+ "@pisell/icon": "0.0.11",
65
+ "@pisell/date-picker": "1.0.100"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { PosProps, RouteType } from './const';
3
- declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "type" | "mode" | "getApi"> & {
4
- action: RouteType;
5
- device_number: string | number;
6
- api: ReturnType<PosProps['getApi']>;
7
- isMobile: boolean;
8
- channel?: string | undefined;
9
- formatAmount(amount: number | string, precision: number, symbol: string): string;
10
- }) => React.JSX.Element;
11
- export default App;
@@ -1,173 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["action", "api", "device_number", "terminal", "tyroUrl", "tyroVersion", "onChangeParams", "isMobile", "channel", "formatAmount"];
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- 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; }
12
- 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; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
- /* eslint-disable react/destructuring-assignment */
17
- import React, { useEffect, useState, useMemo, useRef, useCallback } from 'react';
18
- import { useNetwork } from 'ahooks';
19
- import Amount from "./amount";
20
- import { RouteEnum, ClientEnum, RestoreEumn } from "./const";
21
- import Device from "./device";
22
- import Pay from "./pay";
23
- import { useContextData, useDispatch, updateState, updateClient } from "./store";
24
- var App = function App(_ref) {
25
- var action = _ref.action,
26
- api = _ref.api,
27
- device_number = _ref.device_number,
28
- terminal = _ref.terminal,
29
- tyroUrl = _ref.tyroUrl,
30
- tyroVersion = _ref.tyroVersion,
31
- onChangeParams = _ref.onChangeParams,
32
- isMobile = _ref.isMobile,
33
- channel = _ref.channel,
34
- _ref$formatAmount = _ref.formatAmount,
35
- formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
36
- return "".concat(symbol).concat(number);
37
- } : _ref$formatAmount,
38
- props = _objectWithoutProperties(_ref, _excluded);
39
- var data = useContextData();
40
- var dispatch = useDispatch();
41
- var _useState = useState(action),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- current = _useState2[0],
44
- setCurrent = _useState2[1];
45
- var statusRef = useRef(data.status);
46
-
47
- // 外部网络数据
48
- var network = useMemo(function () {
49
- return typeof terminal.network === 'boolean' ? terminal.network : true;
50
- }, [terminal === null || terminal === void 0 ? void 0 : terminal.network]);
51
- // 内部网络数据
52
- var _useNetwork = useNetwork(),
53
- online = _useNetwork.online;
54
- var netRef = useRef([network, online]);
55
-
56
- // 网络数据
57
- var net = useMemo(function () {
58
- var networkChange = false,
59
- onlineChange = false;
60
- if (netRef.current[0] !== network) {
61
- netRef.current[0] = network;
62
- networkChange = true;
63
- }
64
- if (netRef.current[1] !== online) {
65
- netRef.current[1] = online;
66
- onlineChange = true;
67
- }
68
- if (networkChange) {
69
- return network;
70
- }
71
- return online;
72
- }, [network, online]);
73
- useEffect(function () {
74
- statusRef.current = data.status;
75
- }, [data.status]);
76
- var client = useMemo(function () {
77
- if (channel === 'kiosk') {
78
- return ClientEnum.User;
79
- }
80
- return ClientEnum.Merchant;
81
- }, [channel]);
82
- useEffect(function () {
83
- dispatch(updateClient(client));
84
- }, [client]);
85
-
86
- // 内嵌在 terminal 或者 kiosk 的移动端 做特定移动端(大屏)适配
87
- // const isMobile = useMemo(() => Boolean(channel), [channel]);
88
-
89
- /**
90
- * @title: 缓存状态数据 可以用于闪退,成功or失败时清除缓存
91
- * @Author: hongbing.wang
92
- * @Date: 2024-08-20 10:27
93
- */
94
- useEffect(function () {
95
- onChangeParams && onChangeParams(_objectSpread(_objectSpread(_objectSpread({}, data), data.eftpos === 'tyro' ? {
96
- custom: _objectSpread(_objectSpread({}, data.custom), {}, {
97
- btnList: [],
98
- list: []
99
- })
100
- } : {}), {}, {
101
- form: RestoreEumn.Restore
102
- }));
103
- }, [data, onChangeParams]);
104
-
105
- /**
106
- * @title: 支付状态切换页
107
- * @Author: hongbing.wang
108
- * @Date: 2024-08-20 13:10
109
- */
110
- var onChange = useCallback(function (status, params, other) {
111
- if (status === 'page' && typeof params === 'string') {
112
- if (['amount', 'deviceList', 'pay'].includes(params)) {
113
- setCurrent(params);
114
- dispatch(updateState({
115
- action: params
116
- }));
117
- }
118
- }
119
- console.log('状态切换 = ', status, params, other);
120
- props.onChangeStatus(status, params, other);
121
- }, []);
122
-
123
- /**
124
- * @title: 支付失败
125
- * @Author: hongbing.wang
126
- * @Date: 2024-08-20 13:09
127
- */
128
- var onClose = function onClose() {
129
- onChange('fail', {
130
- number: data.number,
131
- uniquePaymentNumber: data.number,
132
- device: data.device,
133
- order_id: data.order_id
134
- });
135
- };
136
- if (current === RouteEnum.DeviceList) {
137
- return /*#__PURE__*/React.createElement(Device, {
138
- api: api,
139
- onChange: onChange,
140
- onClose: onClose,
141
- isMobile: isMobile,
142
- className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
143
- net: net,
144
- device_number: device_number,
145
- formatAmount: formatAmount,
146
- client: client
147
- });
148
- }
149
- if (current === RouteEnum.Amount) {
150
- return /*#__PURE__*/React.createElement(Amount, {
151
- onChange: onChange,
152
- onClose: onClose,
153
- formatAmount: formatAmount,
154
- isMobile: isMobile,
155
- className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
156
- net: net,
157
- client: client
158
- });
159
- }
160
- return /*#__PURE__*/React.createElement(Pay, {
161
- api: api,
162
- tyroUrl: tyroUrl,
163
- tyroVersion: tyroVersion,
164
- onChange: onChange,
165
- className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
166
- terminal: terminal,
167
- isMobile: isMobile,
168
- net: net,
169
- formatAmount: formatAmount,
170
- client: client
171
- });
172
- };
173
- export default App;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import './tip.less';
3
- /**
4
- * @title: 支付状态未知页面
5
- * @description:
6
- * @Author: hongbing.wang
7
- * @Date: 2024-08-20 11:42
8
- */
9
- declare const _default: ({ onChangeStatus, className, formatAmount, cardSurcharge, receipts, successTime, onChangeParams, }: any) => React.JSX.Element;
10
- export default _default;
@@ -1,177 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- 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; }
11
- 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; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- /* eslint-disable no-nested-ternary */
14
- import { locales } from '@pisell/utils';
15
- import { Button } from 'antd';
16
- import React, { useEffect, useRef, useState } from 'react';
17
- import { getPayParams } from "./helper";
18
- import { RestoreEumn, EftposEnum } from "./const";
19
- import dayjs from 'dayjs';
20
- import { useDispatch, useContextData, updateState, updateCustom, updateNextStep } from "./store";
21
- import { useStoreRef } from "./hooks";
22
- import "./tip.less";
23
- function formatDateUtils(date, format) {
24
- if (!date) {
25
- return date;
26
- }
27
- if (date.includes('undefined')) {
28
- return '';
29
- }
30
- var lang = localStorage.getItem('umi_locale') || 'en-US';
31
- var _format = format || ['HH:mm:ss DD/MM/YYYY', 'YYYY年MM月DD日 HH:mm:ss'];
32
- var type = lang === 'en-US' || lang === 'en' ? _format[0] : _format[1];
33
- return dayjs(date).locale(lang).format(type);
34
- }
35
-
36
- /**
37
- * @title: 支付状态未知页面
38
- * @description:
39
- * @Author: hongbing.wang
40
- * @Date: 2024-08-20 11:42
41
- */
42
- export default (function (_ref) {
43
- var onChangeStatus = _ref.onChangeStatus,
44
- _ref$className = _ref.className,
45
- className = _ref$className === void 0 ? '' : _ref$className,
46
- formatAmount = _ref.formatAmount,
47
- cardSurcharge = _ref.cardSurcharge,
48
- receipts = _ref.receipts,
49
- successTime = _ref.successTime,
50
- onChangeParams = _ref.onChangeParams;
51
- var _useState = useState(true),
52
- _useState2 = _slicedToArray(_useState, 2),
53
- disabled = _useState2[0],
54
- setDisabled = _useState2[1];
55
- var _useState3 = useState(''),
56
- _useState4 = _slicedToArray(_useState3, 2),
57
- amount = _useState4[0],
58
- setAmount = _useState4[1];
59
- var _useState5 = useState(''),
60
- _useState6 = _slicedToArray(_useState5, 2),
61
- surcharge = _useState6[0],
62
- setSurcharge = _useState6[1];
63
- var _useState7 = useState(''),
64
- _useState8 = _slicedToArray(_useState7, 2),
65
- surMoney = _useState8[0],
66
- setSurMoney = _useState8[1];
67
- var _useState9 = useState(''),
68
- _useState10 = _slicedToArray(_useState9, 2),
69
- rate = _useState10[0],
70
- setRate = _useState10[1];
71
- var _useState11 = useState(''),
72
- _useState12 = _slicedToArray(_useState11, 2),
73
- total = _useState12[0],
74
- setTotal = _useState12[1];
75
- var _useState13 = useState(''),
76
- _useState14 = _slicedToArray(_useState13, 2),
77
- time = _useState14[0],
78
- setTime = _useState14[1];
79
- var data = useContextData();
80
- var symbol = data.symbol,
81
- custom = data.custom;
82
- var ref = useRef();
83
- var dispatch = useDispatch();
84
- var listRef = useRef(custom === null || custom === void 0 ? void 0 : custom.list);
85
- var _useStoreRef = useStoreRef(),
86
- deviceRef = _useStoreRef.deviceRef,
87
- payRef = _useStoreRef.payRef,
88
- numRef = _useStoreRef.numRef,
89
- orderIdRef = _useStoreRef.orderIdRef,
90
- modeRef = _useStoreRef.modeRef,
91
- amountRef = _useStoreRef.amountRef,
92
- eftposRef = _useStoreRef.eftposRef;
93
- var onConfirm = function onConfirm() {
94
- onChangeStatus('success', _objectSpread({}, ref.current || {}));
95
- };
96
-
97
- /**
98
- * @title: 手动标记
99
- * @description: 前往手动标记
100
- * @Author: hongbing.wang
101
- * @Date: 2024-08-20 11:31
102
- */
103
- useEffect(function () {
104
- // 将所有步骤状态设为完成 resolve
105
- if (eftposRef.current === EftposEnum.Payo) {
106
- dispatch(updateNextStep());
107
- dispatch(updateCustom({
108
- card_reader_surcharge: cardSurcharge || 0,
109
- receipt: receipts
110
- }));
111
- } else if (eftposRef.current === EftposEnum.Windcave) {
112
- dispatch(updateCustom({
113
- list: listRef.current.map(function (item) {
114
- return _objectSpread(_objectSpread({}, item), {}, {
115
- status: 'resolve'
116
- });
117
- }),
118
- card_reader_surcharge: cardSurcharge || 0,
119
- receipt: receipts
120
- }));
121
- }
122
- var params = getPayParams({
123
- mode: modeRef.current,
124
- amount: amountRef.current,
125
- order_id: orderIdRef.current,
126
- number: numRef.current,
127
- device: deviceRef.current,
128
- pay: payRef.current,
129
- custom: {
130
- card_reader_surcharge: cardSurcharge,
131
- receipt: receipts
132
- }
133
- }, 'success');
134
- ref.current = params;
135
- setAmount("".concat((params === null || params === void 0 ? void 0 : params.amount) || ''));
136
- setSurcharge("".concat((params === null || params === void 0 ? void 0 : params.surcharge) || ''));
137
- setSurMoney("".concat((params === null || params === void 0 ? void 0 : params.surMoney) || ''));
138
- setRate("".concat((params === null || params === void 0 ? void 0 : params.surRate) || ''));
139
- setTotal("".concat((params === null || params === void 0 ? void 0 : params.total) || ''));
140
- setTime(formatDateUtils(successTime));
141
- setDisabled(false);
142
-
143
- // 更新支付状态与文案
144
- dispatch(updateState({
145
- status: 'success',
146
- title: locales.getText('page.eftpos-pay.text.successful')(modeRef.current)
147
- }));
148
- }, []);
149
- useEffect(function () {
150
- onChangeParams && onChangeParams(_objectSpread(_objectSpread({}, data), {}, {
151
- form: RestoreEumn.Restore
152
- }));
153
- }, [data, onChangeParams]);
154
- return /*#__PURE__*/React.createElement("div", {
155
- className: "pisell-lowcode__eft-pay-box ".concat(className)
156
- }, /*#__PURE__*/React.createElement("div", {
157
- className: "pisell-lowcode__eft-pay-fail-title"
158
- }, locales.getText('page.eftpos-pay.text.latest.success')), /*#__PURE__*/React.createElement("div", {
159
- className: "pisell-lowcode__eft-pay-body pisell-lowcode__eft-pay-tip-body"
160
- }, /*#__PURE__*/React.createElement("div", {
161
- className: "pisell-lowcode__eft-pay-tip-text"
162
- }, locales.getText('page.eftpos-pay.text.latest.amount'), ":", ' ', formatAmount("".concat(amount), 2, symbol)), /*#__PURE__*/React.createElement("div", {
163
- className: "pisell-lowcode__eft-pay-tip-text"
164
- }, locales.getText('page.eftpos-pay.text.latest.surcharge'), ":", ' ', formatAmount("".concat(surcharge), 2, symbol), " (", rate, "% +", ' ', formatAmount("".concat(surMoney), 2, symbol), ")"), /*#__PURE__*/React.createElement("div", {
165
- className: "pisell-lowcode__eft-pay-tip-text"
166
- }, locales.getText('page.eftpos-pay.text.surcharge.edit.actual.pay'), ":", ' ', formatAmount("".concat(total), 2, symbol)), /*#__PURE__*/React.createElement("div", {
167
- className: "pisell-lowcode__eft-pay-tip-text"
168
- }, locales.getText('page.eftpos-pay.text.latest.time'), ": ", time)), /*#__PURE__*/React.createElement("div", {
169
- className: "pisell-lowcode__eft-pay-step-item-btns"
170
- }, /*#__PURE__*/React.createElement(Button, {
171
- disabled: disabled,
172
- block: true,
173
- className: "pisell-lowcode__eft-pay-step-item-btn",
174
- type: "primary",
175
- onClick: onConfirm
176
- }, locales.getText('page.eftpos-pay.text.latest.confirm'))));
177
- });
@@ -1,9 +0,0 @@
1
- .pisell-lowcode__eft-pay-tip-body{
2
- display: flex;
3
- flex-direction: column;
4
- gap: 16px;
5
- margin: 20px 0 0 0;
6
- }
7
- .pisell-lowcode__eft-pay-tip-text{
8
- color: var(--Gray-700, #344054);
9
- }
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { PosProps, RouteType } from './const';
3
- declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "type" | "mode" | "getApi"> & {
4
- action: RouteType;
5
- device_number: string | number;
6
- api: ReturnType<PosProps['getApi']>;
7
- isMobile: boolean;
8
- channel?: string | undefined;
9
- formatAmount(amount: number | string, precision: number, symbol: string): string;
10
- }) => React.JSX.Element;
11
- export default App;