@pisell/private-materials 6.8.83 → 6.8.84

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 (134) 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 +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/index.d.ts +1 -0
  12. package/es/components/booking/info/index.d.ts +1 -0
  13. package/es/components/checkout/PaymentModal.js +4 -2
  14. package/es/components/checkout/components/PaymentOptionsModule/index.js +1 -1
  15. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
  16. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.js +120 -0
  17. package/es/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  18. package/es/components/eftposPay/aggregatePayment/index.js +3 -0
  19. package/es/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  20. package/es/components/eftposPay/aggregatePayment/service.js +69 -0
  21. package/es/components/eftposPay/aggregatePayment/types.d.ts +106 -0
  22. package/es/components/eftposPay/aggregatePayment/types.js +65 -0
  23. package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  24. package/es/components/eftposPay/aggregatePayment/utils/logs.js +371 -0
  25. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
  26. package/es/components/eftposPay/aggregatePayment/utils/payment.js +1138 -0
  27. package/es/components/eftposPay/amount.d.ts +1 -1
  28. package/es/components/eftposPay/app.d.ts +1 -1
  29. package/es/components/eftposPay/app.js +5 -0
  30. package/es/components/eftposPay/component/fail/failCustom.js +16 -12
  31. package/es/components/eftposPay/component/fail/index.js +12 -5
  32. package/es/components/eftposPay/const.d.ts +6 -1
  33. package/es/components/eftposPay/const.js +3 -0
  34. package/es/components/eftposPay/device.d.ts +1 -1
  35. package/es/components/eftposPay/hooks.d.ts +3 -2
  36. package/es/components/eftposPay/hooks.js +12 -0
  37. package/es/components/eftposPay/huifu/Action.d.ts +8 -0
  38. package/es/components/eftposPay/huifu/Action.js +146 -0
  39. package/es/components/eftposPay/huifu/const.d.ts +5 -0
  40. package/es/components/eftposPay/huifu/const.js +70 -0
  41. package/es/components/eftposPay/huifu/hooks.d.ts +25 -0
  42. package/es/components/eftposPay/huifu/hooks.js +184 -0
  43. package/es/components/eftposPay/huifu/index.d.ts +5 -0
  44. package/es/components/eftposPay/huifu/index.js +196 -0
  45. package/es/components/eftposPay/huifu/index.less +180 -0
  46. package/es/components/eftposPay/huifu/types.d.ts +14 -0
  47. package/es/components/eftposPay/huifu/types.js +1 -0
  48. package/es/components/eftposPay/index.js +5 -1
  49. package/es/components/eftposPay/locales.d.ts +36 -0
  50. package/es/components/eftposPay/locales.js +42 -3
  51. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  52. package/es/components/eftposPay/manufacturer.js +5 -0
  53. package/es/components/eftposPay/pay.js +6 -2
  54. package/es/components/eftposPay/store/index.d.ts +11 -4
  55. package/es/components/kioskSkuDetail/index.d.ts +3 -0
  56. package/es/components/kioskSkuDetail/index.js +266 -173
  57. package/es/components/kioskSkuDetail/index.less +49 -7
  58. package/es/components/kioskSkuDetail/locales.d.ts +6 -0
  59. package/es/components/kioskSkuDetail/locales.js +9 -3
  60. package/es/components/pay/toB/components/Cache/index.d.ts +1 -0
  61. package/es/components/pay/toB/components/EFTPOS/index.js +8 -1
  62. package/es/components/pay/toB/types/index.d.ts +1 -0
  63. package/es/components/pay/toC/PaymentList/serve.js +14 -0
  64. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
  65. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  66. package/es/components/ticketBooking/index.d.ts +16 -0
  67. package/es/plus/skuOptionsSelection/components/VariantCard/index.js +1 -1
  68. package/es/plus/skuOptionsSelection/locales.d.ts +3 -0
  69. package/es/plus/skuOptionsSelection/locales.js +3 -0
  70. package/es/pro/Login2.0/components/LoginCodeInput.js +36 -3
  71. package/es/pro/Login2.0/steps/CodeInput.js +37 -7
  72. package/lib/components/booking/components/footer/index.d.ts +1 -0
  73. package/lib/components/booking/info/index.d.ts +1 -0
  74. package/lib/components/checkout/PaymentModal.js +5 -2
  75. package/lib/components/checkout/components/PaymentOptionsModule/index.js +2 -1
  76. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
  77. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.js +133 -0
  78. package/lib/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  79. package/lib/components/eftposPay/aggregatePayment/index.js +42 -0
  80. package/lib/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  81. package/lib/components/eftposPay/aggregatePayment/service.js +81 -0
  82. package/lib/components/eftposPay/aggregatePayment/types.d.ts +106 -0
  83. package/lib/components/eftposPay/aggregatePayment/types.js +74 -0
  84. package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  85. package/lib/components/eftposPay/aggregatePayment/utils/logs.js +294 -0
  86. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
  87. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +752 -0
  88. package/lib/components/eftposPay/amount.d.ts +1 -1
  89. package/lib/components/eftposPay/app.d.ts +1 -1
  90. package/lib/components/eftposPay/app.js +5 -0
  91. package/lib/components/eftposPay/component/fail/failCustom.js +15 -9
  92. package/lib/components/eftposPay/component/fail/index.js +4 -1
  93. package/lib/components/eftposPay/const.d.ts +6 -1
  94. package/lib/components/eftposPay/const.js +3 -0
  95. package/lib/components/eftposPay/device.d.ts +1 -1
  96. package/lib/components/eftposPay/hooks.d.ts +3 -2
  97. package/lib/components/eftposPay/hooks.js +16 -0
  98. package/lib/components/eftposPay/huifu/Action.d.ts +8 -0
  99. package/lib/components/eftposPay/huifu/Action.js +174 -0
  100. package/lib/components/eftposPay/huifu/const.d.ts +5 -0
  101. package/lib/components/eftposPay/huifu/const.js +86 -0
  102. package/lib/components/eftposPay/huifu/hooks.d.ts +25 -0
  103. package/lib/components/eftposPay/huifu/hooks.js +186 -0
  104. package/lib/components/eftposPay/huifu/index.d.ts +5 -0
  105. package/lib/components/eftposPay/huifu/index.js +200 -0
  106. package/lib/components/eftposPay/huifu/index.less +180 -0
  107. package/lib/components/eftposPay/huifu/types.d.ts +14 -0
  108. package/lib/components/eftposPay/huifu/types.js +17 -0
  109. package/lib/components/eftposPay/index.js +5 -1
  110. package/lib/components/eftposPay/locales.d.ts +36 -0
  111. package/lib/components/eftposPay/locales.js +42 -3
  112. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  113. package/lib/components/eftposPay/manufacturer.js +7 -0
  114. package/lib/components/eftposPay/pay.js +3 -2
  115. package/lib/components/eftposPay/store/index.d.ts +11 -4
  116. package/lib/components/kioskSkuDetail/index.d.ts +3 -0
  117. package/lib/components/kioskSkuDetail/index.js +180 -113
  118. package/lib/components/kioskSkuDetail/index.less +49 -7
  119. package/lib/components/kioskSkuDetail/locales.d.ts +6 -0
  120. package/lib/components/kioskSkuDetail/locales.js +9 -3
  121. package/lib/components/pay/toB/components/Cache/index.d.ts +1 -0
  122. package/lib/components/pay/toB/components/EFTPOS/index.js +8 -1
  123. package/lib/components/pay/toB/types/index.d.ts +1 -0
  124. package/lib/components/pay/toC/PaymentList/serve.js +15 -0
  125. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
  126. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  127. package/lib/components/ticketBooking/index.d.ts +16 -0
  128. package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +2 -0
  129. package/lib/plus/skuOptionsSelection/locales.d.ts +3 -0
  130. package/lib/plus/skuOptionsSelection/locales.js +3 -0
  131. package/lib/pro/Login2.0/components/LoginCodeInput.js +26 -4
  132. package/lib/pro/Login2.0/steps/CodeInput.js +27 -5
  133. package/lowcode/kiosk-sku-detail/meta.ts +229 -94
  134. package/package.json +1 -1
@@ -8,7 +8,7 @@ import { PosProps } from './const';
8
8
  */
9
9
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
10
10
  className?: string | undefined;
11
- onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
11
+ onChange?: ((status: "fail" | "success" | "page" | "print" | "mark_tx_processed", params?: string | {
12
12
  [keys: string]: unknown;
13
13
  } | undefined, other?: any) => void) | undefined;
14
14
  onClose: () => void;
@@ -1,5 +1,5 @@
1
1
  import { PosProps, RouteType } from './const';
2
- declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "type" | "mode" | "getApi"> & {
2
+ declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "getApi" | "type" | "mode"> & {
3
3
  action: RouteType;
4
4
  device_number: string | number;
5
5
  api: ReturnType<PosProps['getApi']>;
@@ -21,6 +21,8 @@ import { RouteEnum, ClientEnum, RestoreEumn } from "./const";
21
21
  import Device from "./device";
22
22
  import Pay from "./pay";
23
23
  import { useContextData, useDispatch, updateState, updateClient } from "./store";
24
+ import useEngineContext from "../../hooks/useEngineContext";
25
+ import { request } from "../../utils";
24
26
  var App = function App(_ref) {
25
27
  var action = _ref.action,
26
28
  api = _ref.api,
@@ -42,6 +44,9 @@ var App = function App(_ref) {
42
44
  _useState2 = _slicedToArray(_useState, 2),
43
45
  current = _useState2[0],
44
46
  setCurrent = _useState2[1];
47
+ var engineContext = useEngineContext();
48
+ var utils = engineContext.appHelper.utils || {};
49
+ request.setRequest(utils === null || utils === void 0 ? void 0 : utils.request);
45
50
  var statusRef = useRef(data.status);
46
51
 
47
52
  // 外部网络数据
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  /* eslint-disable no-nested-ternary */
2
8
  import { locales } from '@pisell/utils';
3
9
  import { useMount } from 'ahooks';
@@ -23,7 +29,8 @@ export default (function (_ref) {
23
29
  order_id = _useContextData.order_id,
24
30
  number = _useContextData.number,
25
31
  device = _useContextData.device,
26
- client = _useContextData.client;
32
+ client = _useContextData.client,
33
+ originalParams = _useContextData.originalParams;
27
34
  var failCustom = custom === null || custom === void 0 ? void 0 : custom.failCustom;
28
35
  var dispatch = useDispatch();
29
36
 
@@ -34,20 +41,17 @@ export default (function (_ref) {
34
41
  */
35
42
  var onRetry = function onRetry() {
36
43
  onChange('page', 'pay');
37
- dispatch(updateState(getInitState(eftpos, mode === ModeEnum.Query ? {
44
+ var params = _objectSpread(_objectSpread({}, originalParams || {}), {}, {
38
45
  mode: mode,
39
46
  name: name,
40
47
  symbol: symbol,
41
48
  amount: amount,
42
49
  order_id: order_id
43
- } : {
44
- mode: mode,
45
- name: name,
46
- symbol: symbol,
47
- amount: amount,
48
- order_id: order_id,
49
- number: ''
50
- })));
50
+ });
51
+ if (mode === ModeEnum.Query) {
52
+ params.number = '';
53
+ }
54
+ dispatch(updateState(getInitState(eftpos, params)));
51
55
  };
52
56
 
53
57
  /**
@@ -56,14 +60,14 @@ export default (function (_ref) {
56
60
  * @Date: 2024-08-20 11:30
57
61
  */
58
62
  var onModify = function onModify() {
59
- dispatch(updateState(getInitState(eftpos, {
63
+ dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, originalParams || {}), {}, {
60
64
  mode: mode,
61
65
  name: name,
62
66
  symbol: symbol,
63
67
  amount: amount,
64
68
  order_id: order_id,
65
69
  number: ''
66
- })));
70
+ }))));
67
71
  onChange('page', 'amount');
68
72
  };
69
73
 
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  /* eslint-disable no-nested-ternary */
2
8
  import { locales } from '@pisell/utils';
3
9
  import { Button } from 'antd';
@@ -25,7 +31,8 @@ export default (function (_ref) {
25
31
  order_id = _useContextData.order_id,
26
32
  number = _useContextData.number,
27
33
  device = _useContextData.device,
28
- client = _useContextData.client;
34
+ client = _useContextData.client,
35
+ originalParams = _useContextData.originalParams;
29
36
  var isPosNetworkError = ((_steps$step = steps[step]) === null || _steps$step === void 0 || (_steps$step = _steps$step.custom) === null || _steps$step === void 0 ? void 0 : _steps$step.isPosNetworkError) || false;
30
37
  var dispatch = useDispatch();
31
38
 
@@ -36,14 +43,14 @@ export default (function (_ref) {
36
43
  */
37
44
  var onRetry = function onRetry() {
38
45
  onChange('page', 'pay');
39
- dispatch(updateState(getInitState(eftpos, {
46
+ dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, originalParams || {}), {}, {
40
47
  mode: mode,
41
48
  name: name,
42
49
  symbol: symbol,
43
50
  amount: amount,
44
51
  order_id: order_id,
45
52
  number: ''
46
- })));
53
+ }))));
47
54
  };
48
55
 
49
56
  /**
@@ -52,14 +59,14 @@ export default (function (_ref) {
52
59
  * @Date: 2024-08-20 11:30
53
60
  */
54
61
  var onModify = function onModify() {
55
- dispatch(updateState(getInitState(eftpos, {
62
+ dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, originalParams || {}), {}, {
56
63
  mode: mode,
57
64
  name: name,
58
65
  symbol: symbol,
59
66
  amount: amount,
60
67
  order_id: order_id,
61
68
  number: ''
62
- })));
69
+ }))));
63
70
  onChange('page', 'amount');
64
71
  };
65
72
 
@@ -7,9 +7,12 @@ export declare enum EftposEnum {
7
7
  /** 后端支付 - 支付 + 退款 */
8
8
  Windcave = "windcave",
9
9
  Stripe = "stripe",
10
- Linkly = "linkly"
10
+ Linkly = "linkly",
11
+ /** 汇付天下 */
12
+ Huifu = "huifu"
11
13
  }
12
14
  export declare enum StatusEnum {
15
+ Init = "init",
13
16
  Loading = "loading",
14
17
  Warn = "warn",
15
18
  Fail = "fail",
@@ -160,6 +163,8 @@ export declare enum PayStatus {
160
163
  'Unknown' = "701000",
161
164
  /** 交易请求超时 */
162
165
  'Timeout' = "701001",
166
+ /** 支付失败(汇付天下) */
167
+ 'PaymentFailed' = "701002",
163
168
  /** 繁忙 EFTPOS终端暂时不可用,因为EFTPOS正在处理另一个请求。 */
164
169
  'PayOtherEftposFailed' = "701003",
165
170
  /** 购物者没有出示卡片/卡片金额不足/在线拒绝/卡已过期/卡被锁定 */
@@ -4,9 +4,11 @@ export var EftposEnum = /*#__PURE__*/function (EftposEnum) {
4
4
  EftposEnum["Windcave"] = "windcave";
5
5
  EftposEnum["Stripe"] = "stripe";
6
6
  EftposEnum["Linkly"] = "linkly";
7
+ EftposEnum["Huifu"] = "huifu";
7
8
  return EftposEnum;
8
9
  }({});
9
10
  export var StatusEnum = /*#__PURE__*/function (StatusEnum) {
11
+ StatusEnum["Init"] = "init";
10
12
  StatusEnum["Loading"] = "loading";
11
13
  StatusEnum["Warn"] = "warn";
12
14
  StatusEnum["Fail"] = "fail";
@@ -68,6 +70,7 @@ export var PayStatus = /*#__PURE__*/function (PayStatus) {
68
70
  PayStatus["PairingFailure"] = "606020";
69
71
  PayStatus["Unknown"] = "701000";
70
72
  PayStatus["Timeout"] = "701001";
73
+ PayStatus["PaymentFailed"] = "701002";
71
74
  PayStatus["PayOtherEftposFailed"] = "701003";
72
75
  PayStatus["PayCardErrorFailed"] = "701004";
73
76
  PayStatus["NoNetWork"] = "701005";
@@ -11,7 +11,7 @@ import './device.less';
11
11
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, containerStyle, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
- onChange?: ((status: "success" | "page" | "fail" | "print" | "mark_tx_processed", params?: string | {
14
+ onChange?: ((status: "fail" | "success" | "page" | "print" | "mark_tx_processed", params?: string | {
15
15
  [keys: string]: unknown;
16
16
  } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"init" | "loading" | "warn" | "fail" | "success" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe" | "linkly" | "huifu">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -32,4 +32,5 @@ export declare const useStoreRef: <T extends {
32
32
  */
33
33
  export declare const useFail: (index: number) => (res: {
34
34
  code?: `${PayStatus}`;
35
+ message?: string;
35
36
  }, isMark?: boolean) => void;
@@ -314,6 +314,18 @@ export var useFail = function useFail(index) {
314
314
  }));
315
315
  return;
316
316
  }
317
+ if (code === PayStatus.PaymentFailed) {
318
+ // 前往错误页 不可标记状态
319
+ steps[index].title = locales.getText('page.eftpos-pay.text.transaction.fail');
320
+ steps[index].fail = (res === null || res === void 0 ? void 0 : res.message) || locales.getText('page.eftpos-pay.text.failed')(modeRef.current);
321
+ steps[index].status = 'fail';
322
+ dispatch(updateSteps(steps));
323
+ dispatch(updateComponent('Fail'));
324
+ dispatch(updateCustom({
325
+ errorStatus: 'know' // unknow know
326
+ }));
327
+ return;
328
+ }
317
329
 
318
330
  // 其他场景前往未知错误页
319
331
  steps[index].title = locales.getText('page.eftpos-pay.text.failed')(modeRef.current);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ import { HuifuActionProps } from './types';
4
+ export declare const NativeDeviceStatus: ({ type, status, }: {
5
+ type: 'scanner' | 'camera';
6
+ status: boolean;
7
+ }) => JSX.Element;
8
+ export declare const ScanAction: React.FC<HuifuActionProps>;
@@ -0,0 +1,146 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useState, useEffect } from 'react';
8
+ import { locales } from '@pisell/utils';
9
+ import { Iconfont, Button, Input } from '@pisell/materials';
10
+ import "./index.less";
11
+ import { useScannerDevice, useCameraDevice, useScanListener } from "./hooks";
12
+ export var NativeDeviceStatus = function NativeDeviceStatus(_ref) {
13
+ var type = _ref.type,
14
+ status = _ref.status;
15
+ var iconType = type === 'scanner' ? 'pisell2-Scanner' : 'pisell2-camera';
16
+ return /*#__PURE__*/React.createElement("div", {
17
+ className: "pisell-eftpos-pay-huifu-scan-status"
18
+ }, /*#__PURE__*/React.createElement(Iconfont, {
19
+ type: iconType,
20
+ style: {
21
+ fontSize: '40px'
22
+ }
23
+ }), /*#__PURE__*/React.createElement("div", {
24
+ className: "pisell-eftpos-pay-huifu-scan-status-wrapper"
25
+ }, /*#__PURE__*/React.createElement(Iconfont, {
26
+ style: {
27
+ borderRadius: '50%',
28
+ background: status ? '#17B26A' : '#F04438',
29
+ color: '#fff'
30
+ },
31
+ type: status ? 'pisell2-check' : 'pisell2-x-close'
32
+ })));
33
+ };
34
+ var DEFAULT_SCANNER_CLASS = 'pisell-eftpos-pay-huifu-scan-content-scanner';
35
+ export var ScanAction = function ScanAction(_ref2) {
36
+ var isNativeApp = _ref2.isNativeApp,
37
+ onClose = _ref2.onClose,
38
+ onPayClick = _ref2.onPayClick,
39
+ onScanCallback = _ref2.onScanCallback;
40
+ var _useScannerDevice = useScannerDevice(),
41
+ scannerStatus = _useScannerDevice.scannerStatus;
42
+ var _useCameraDevice = useCameraDevice(),
43
+ cameraStatus = _useCameraDevice.cameraStatus,
44
+ activeCamera = _useCameraDevice.activeCamera;
45
+ var _useScanListener = useScanListener(),
46
+ scanResult = _useScanListener.scanResult;
47
+ var _useState = useState(''),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ inputValue = _useState2[0],
50
+ setInputValue = _useState2[1];
51
+ useEffect(function () {
52
+ if (!!(scanResult !== null && scanResult !== void 0 && scanResult.value)) {
53
+ onScanCallback(scanResult.value);
54
+ }
55
+ }, [scanResult]);
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ className: "pisell-eftpos-pay-huifu-scan"
58
+ }, !isNativeApp ? /*#__PURE__*/React.createElement("div", {
59
+ className: "pisell-eftpos-pay-huifu-scan-header"
60
+ }, /*#__PURE__*/React.createElement("span", {
61
+ className: "pisell-eftpos-pay-huifu-scan-header-title"
62
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.title')), /*#__PURE__*/React.createElement("div", {
63
+ className: "pisell-eftpos-pay-huifu-scan-header-close",
64
+ onClick: onClose
65
+ }, /*#__PURE__*/React.createElement(Iconfont, {
66
+ type: "pisell2-x-close",
67
+ style: {
68
+ fontSize: '24px'
69
+ }
70
+ })), /*#__PURE__*/React.createElement("div", {
71
+ className: "pisell-eftpos-pay-huifu-scan-header-divider"
72
+ })) : null, /*#__PURE__*/React.createElement("div", {
73
+ className: "pisell-eftpos-pay-huifu-scan-content",
74
+ style: {
75
+ paddingTop: isNativeApp ? '0' : '24px'
76
+ }
77
+ }, !!isNativeApp && /*#__PURE__*/React.createElement("div", {
78
+ className: "pisell-eftpos-pay-huifu-scan-content-title"
79
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.title')), /*#__PURE__*/React.createElement("div", {
80
+ className: "".concat(DEFAULT_SCANNER_CLASS, " ").concat(DEFAULT_SCANNER_CLASS, "-").concat(scannerStatus ? 'active' : 'unactive')
81
+ }, /*#__PURE__*/React.createElement(NativeDeviceStatus, {
82
+ type: "scanner",
83
+ status: scannerStatus
84
+ }), /*#__PURE__*/React.createElement("div", {
85
+ className: "pisell-eftpos-pay-huifu-scan-content-scanner-right"
86
+ }, /*#__PURE__*/React.createElement("span", {
87
+ className: "".concat(DEFAULT_SCANNER_CLASS, "-").concat(scannerStatus ? 'active' : 'unactive', "-title")
88
+ }, scannerStatus ? locales.getText('page.eftpos-pay.text.huifu.scan.gun.connected') : locales.getText('page.eftpos-pay.text.huifu.scan.gun.not-connected')), /*#__PURE__*/React.createElement("span", {
89
+ className: "".concat(DEFAULT_SCANNER_CLASS, "-").concat(scannerStatus ? 'active' : 'unactive', "-desc")
90
+ }, scannerStatus ? locales.getText('page.eftpos-pay.text.huifu.scan.gun.connected-desc') : locales.getText('page.eftpos-pay.text.huifu.scan.gun.not-connected-desc')))), cameraStatus && /*#__PURE__*/React.createElement("div", {
91
+ className: "pisell-eftpos-pay-huifu-scan-content-camera",
92
+ onClick: activeCamera
93
+ }, /*#__PURE__*/React.createElement(NativeDeviceStatus, {
94
+ type: "camera",
95
+ status: cameraStatus
96
+ }), /*#__PURE__*/React.createElement("div", {
97
+ className: "pisell-eftpos-pay-huifu-scan-content-camera-right"
98
+ }, /*#__PURE__*/React.createElement("span", {
99
+ className: "pisell-eftpos-pay-huifu-scan-content-camera-title"
100
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.camera-title')), /*#__PURE__*/React.createElement("span", {
101
+ className: "pisell-eftpos-pay-huifu-scan-content-camera-desc"
102
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.camera-desc')))), /*#__PURE__*/React.createElement("div", {
103
+ className: "pisell-eftpos-pay-huifu-scan-content-input-wrapper"
104
+ }, /*#__PURE__*/React.createElement("div", {
105
+ className: "pisell-eftpos-pay-huifu-scan-content-input-wrapper-title"
106
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.input-title')), /*#__PURE__*/React.createElement(Input, {
107
+ placeholder: locales.getText('page.eftpos-pay.text.huifu.scan.input-placeholder'),
108
+ maxLength: 18,
109
+ style: {
110
+ width: '100%',
111
+ fontSize: '16px'
112
+ },
113
+ size: "large",
114
+ value: inputValue,
115
+ onChange: function onChange(e) {
116
+ var _e$target;
117
+ // 使用正则控制只能输入0-9字符,且长度不超过18
118
+ var value = (e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value) || '';
119
+ var regex = /^[0-9]*$/;
120
+ if (regex.test(value) && (value === null || value === void 0 ? void 0 : value.length) <= 18) {
121
+ setInputValue(value);
122
+ }
123
+ }
124
+ }), /*#__PURE__*/React.createElement("div", {
125
+ className: "pisell-eftpos-pay-huifu-scan-content-input-wrapper-tip"
126
+ }, "\uD83D\uDCA1", locales.getText('page.eftpos-pay.text.huifu.scan.input-tip')))), /*#__PURE__*/React.createElement("div", {
127
+ className: "pisell-eftpos-pay-huifu-scan-footer"
128
+ }, /*#__PURE__*/React.createElement("div", {
129
+ className: "pisell-eftpos-pay-huifu-scan-footer-divider"
130
+ }), /*#__PURE__*/React.createElement(Button, {
131
+ type: "default",
132
+ block: true,
133
+ size: "large",
134
+ className: "pisell-eftpos-pay-huifu-scan-footer-button",
135
+ onClick: onClose
136
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.cancel')), /*#__PURE__*/React.createElement(Button, {
137
+ type: "primary",
138
+ block: true,
139
+ size: "large",
140
+ disabled: !inputValue || (inputValue === null || inputValue === void 0 ? void 0 : inputValue.length) < 18,
141
+ onClick: function onClick() {
142
+ return onPayClick(inputValue);
143
+ },
144
+ className: "pisell-eftpos-pay-huifu-scan-footer-button"
145
+ }, locales.getText('page.eftpos-pay.text.huifu.scan.confirm'))));
146
+ };
@@ -0,0 +1,5 @@
1
+ import { State } from '../store';
2
+ import { ModeEnum } from '../const';
3
+ export declare const getStep: (mode?: ModeEnum) => State['steps'];
4
+ declare const _default: (params: any) => State;
5
+ export default _default;
@@ -0,0 +1,70 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net", "client"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import { locales } from '@pisell/utils';
11
+ import { ClientEnum, EftposEnum, ModeEnum, PayRouteEnum, StatusEnum } from "../const";
12
+ export var getStep = function getStep() {
13
+ var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ModeEnum.Pay;
14
+ return [{
15
+ key: Date.now(),
16
+ title: locales.getText('page.eftpos-pay.text.loading')(mode),
17
+ // 'Payment in process...',
18
+ text: locales.getText('page.eftpos-pay.text.waiting.processing'),
19
+ // 'Waiting for the processing...',
20
+ warn: '',
21
+ tip: locales.getText('page.eftpos-pay.text.processing'),
22
+ // 'processing...',
23
+ status: StatusEnum.Loading
24
+ }];
25
+ };
26
+ export default (function (params) {
27
+ var _ref = params || {
28
+ mode: ModeEnum.Pay
29
+ },
30
+ order_id = _ref.order_id,
31
+ name = _ref.name,
32
+ symbol = _ref.symbol,
33
+ amount = _ref.amount,
34
+ mode = _ref.mode,
35
+ number = _ref.number,
36
+ pay = _ref.pay,
37
+ device = _ref.device,
38
+ net = _ref.net,
39
+ client = _ref.client,
40
+ other = _objectWithoutProperties(_ref, _excluded);
41
+ console.log('params =>>>>>> ', params);
42
+ var isPay = mode === ModeEnum.Pay || mode === ModeEnum.FullPay;
43
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
44
+ order_id: order_id,
45
+ name: name,
46
+ symbol: symbol,
47
+ amount: amount,
48
+ mode: mode,
49
+ eftpos: EftposEnum.Huifu,
50
+ key: Date.now(),
51
+ step: 0,
52
+ type: PayRouteEnum.Step,
53
+ title: isPay ? '' : locales.getText('page.eftpos-pay.text.loading')(mode),
54
+ component: '',
55
+ status: isPay ? StatusEnum.Init : StatusEnum.Loading,
56
+ steps: getStep(mode),
57
+ render: true,
58
+ client: client !== 'undefined' ? client : ClientEnum.Merchant,
59
+ warn: '',
60
+ custom: other || {}
61
+ }, typeof net !== 'undefined' ? {
62
+ net: net
63
+ } : {}), typeof number !== 'undefined' ? {
64
+ number: number
65
+ } : {}), typeof pay !== 'undefined' ? {
66
+ pay: pay
67
+ } : {}), typeof device !== 'undefined' ? {
68
+ device: device
69
+ } : {});
70
+ });
@@ -0,0 +1,25 @@
1
+ export declare const useTerminal: () => {
2
+ isTerminal: any;
3
+ };
4
+ /**
5
+ * 获取扫码设备连接状态
6
+ */
7
+ export declare const useScannerDevice: () => {
8
+ scannerStatus: boolean;
9
+ };
10
+ /**
11
+ * 摄像头激活和状态获取
12
+ */
13
+ export declare const useCameraDevice: () => {
14
+ activeCamera: () => void;
15
+ cameraStatus: any;
16
+ };
17
+ /**
18
+ * 获取外部设备扫描结果
19
+ */
20
+ export declare const useScanListener: () => {
21
+ scanResult: {
22
+ type: 'scanner' | 'nfc' | 'camera';
23
+ value: string;
24
+ };
25
+ };