@pisell/private-materials 6.8.76 → 6.8.78

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 (126) 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 +8 -8
  11. package/es/components/checkout/PaymentModal.js +32 -8
  12. package/es/components/checkout/components/PaymentOptionsModule/index.js +1 -1
  13. package/es/components/eftposPay/amount.d.ts +1 -1
  14. package/es/components/eftposPay/app.d.ts +1 -1
  15. package/es/components/eftposPay/app.js +0 -5
  16. package/es/components/eftposPay/component/fail/failCustom.js +12 -16
  17. package/es/components/eftposPay/component/fail/index.js +5 -12
  18. package/es/components/eftposPay/const.d.ts +1 -6
  19. package/es/components/eftposPay/const.js +0 -3
  20. package/es/components/eftposPay/device.d.ts +1 -1
  21. package/es/components/eftposPay/hooks.d.ts +2 -3
  22. package/es/components/eftposPay/hooks.js +0 -12
  23. package/es/components/eftposPay/index.js +1 -5
  24. package/es/components/eftposPay/locales.d.ts +0 -36
  25. package/es/components/eftposPay/locales.js +3 -42
  26. package/es/components/eftposPay/manufacturer.d.ts +0 -1
  27. package/es/components/eftposPay/manufacturer.js +0 -5
  28. package/es/components/eftposPay/pay.js +2 -6
  29. package/es/components/eftposPay/store/index.d.ts +5 -12
  30. package/es/components/kioskSkuDetail/index.d.ts +0 -3
  31. package/es/components/kioskSkuDetail/index.js +173 -266
  32. package/es/components/kioskSkuDetail/index.less +7 -49
  33. package/es/components/kioskSkuDetail/locales.d.ts +0 -6
  34. package/es/components/kioskSkuDetail/locales.js +3 -9
  35. package/es/components/pay/toB/components/EFTPOS/index.js +1 -8
  36. package/es/components/pay/toB/types/index.d.ts +0 -1
  37. package/es/components/pay/toC/PaymentList/serve.js +0 -14
  38. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -7
  39. package/es/plus/skuOptionsSelection/components/VariantCard/index.js +1 -1
  40. package/es/plus/skuOptionsSelection/locales.d.ts +0 -3
  41. package/es/plus/skuOptionsSelection/locales.js +0 -3
  42. package/es/pro/Login2.0/components/LoginCodeInput.js +3 -36
  43. package/es/pro/Login2.0/steps/CodeInput.js +7 -37
  44. package/lib/components/checkout/PaymentModal.js +41 -24
  45. package/lib/components/checkout/components/PaymentOptionsModule/index.js +1 -2
  46. package/lib/components/eftposPay/amount.d.ts +1 -1
  47. package/lib/components/eftposPay/app.d.ts +1 -1
  48. package/lib/components/eftposPay/app.js +0 -5
  49. package/lib/components/eftposPay/component/fail/failCustom.js +9 -15
  50. package/lib/components/eftposPay/component/fail/index.js +1 -4
  51. package/lib/components/eftposPay/const.d.ts +1 -6
  52. package/lib/components/eftposPay/const.js +0 -3
  53. package/lib/components/eftposPay/device.d.ts +1 -1
  54. package/lib/components/eftposPay/hooks.d.ts +2 -3
  55. package/lib/components/eftposPay/hooks.js +0 -16
  56. package/lib/components/eftposPay/index.js +1 -5
  57. package/lib/components/eftposPay/locales.d.ts +0 -36
  58. package/lib/components/eftposPay/locales.js +3 -42
  59. package/lib/components/eftposPay/manufacturer.d.ts +0 -1
  60. package/lib/components/eftposPay/manufacturer.js +0 -7
  61. package/lib/components/eftposPay/pay.js +2 -3
  62. package/lib/components/eftposPay/store/index.d.ts +5 -12
  63. package/lib/components/kioskSkuDetail/index.d.ts +0 -3
  64. package/lib/components/kioskSkuDetail/index.js +113 -180
  65. package/lib/components/kioskSkuDetail/index.less +7 -49
  66. package/lib/components/kioskSkuDetail/locales.d.ts +0 -6
  67. package/lib/components/kioskSkuDetail/locales.js +3 -9
  68. package/lib/components/pay/toB/components/EFTPOS/index.js +1 -8
  69. package/lib/components/pay/toB/types/index.d.ts +0 -1
  70. package/lib/components/pay/toC/PaymentList/serve.js +0 -15
  71. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -7
  72. package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +0 -2
  73. package/lib/plus/skuOptionsSelection/locales.d.ts +0 -3
  74. package/lib/plus/skuOptionsSelection/locales.js +0 -3
  75. package/lib/pro/Login2.0/components/LoginCodeInput.js +4 -26
  76. package/lib/pro/Login2.0/steps/CodeInput.js +5 -27
  77. package/lowcode/kiosk-sku-detail/meta.ts +94 -229
  78. package/package.json +8 -2
  79. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +0 -7
  80. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.js +0 -120
  81. package/es/components/eftposPay/aggregatePayment/index.d.ts +0 -3
  82. package/es/components/eftposPay/aggregatePayment/index.js +0 -3
  83. package/es/components/eftposPay/aggregatePayment/service.d.ts +0 -24
  84. package/es/components/eftposPay/aggregatePayment/service.js +0 -69
  85. package/es/components/eftposPay/aggregatePayment/types.d.ts +0 -106
  86. package/es/components/eftposPay/aggregatePayment/types.js +0 -65
  87. package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +0 -110
  88. package/es/components/eftposPay/aggregatePayment/utils/logs.js +0 -371
  89. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +0 -139
  90. package/es/components/eftposPay/aggregatePayment/utils/payment.js +0 -1138
  91. package/es/components/eftposPay/huifu/Action.d.ts +0 -8
  92. package/es/components/eftposPay/huifu/Action.js +0 -146
  93. package/es/components/eftposPay/huifu/const.d.ts +0 -5
  94. package/es/components/eftposPay/huifu/const.js +0 -70
  95. package/es/components/eftposPay/huifu/hooks.d.ts +0 -25
  96. package/es/components/eftposPay/huifu/hooks.js +0 -184
  97. package/es/components/eftposPay/huifu/index.d.ts +0 -5
  98. package/es/components/eftposPay/huifu/index.js +0 -196
  99. package/es/components/eftposPay/huifu/index.less +0 -180
  100. package/es/components/eftposPay/huifu/types.d.ts +0 -14
  101. package/es/components/eftposPay/huifu/types.js +0 -1
  102. package/es/pro/skuDetailModal/index.d.ts +0 -5
  103. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +0 -7
  104. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.js +0 -133
  105. package/lib/components/eftposPay/aggregatePayment/index.d.ts +0 -3
  106. package/lib/components/eftposPay/aggregatePayment/index.js +0 -42
  107. package/lib/components/eftposPay/aggregatePayment/service.d.ts +0 -24
  108. package/lib/components/eftposPay/aggregatePayment/service.js +0 -81
  109. package/lib/components/eftposPay/aggregatePayment/types.d.ts +0 -106
  110. package/lib/components/eftposPay/aggregatePayment/types.js +0 -74
  111. package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +0 -110
  112. package/lib/components/eftposPay/aggregatePayment/utils/logs.js +0 -294
  113. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +0 -139
  114. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +0 -752
  115. package/lib/components/eftposPay/huifu/Action.d.ts +0 -8
  116. package/lib/components/eftposPay/huifu/Action.js +0 -174
  117. package/lib/components/eftposPay/huifu/const.d.ts +0 -5
  118. package/lib/components/eftposPay/huifu/const.js +0 -86
  119. package/lib/components/eftposPay/huifu/hooks.d.ts +0 -25
  120. package/lib/components/eftposPay/huifu/hooks.js +0 -186
  121. package/lib/components/eftposPay/huifu/index.d.ts +0 -5
  122. package/lib/components/eftposPay/huifu/index.js +0 -200
  123. package/lib/components/eftposPay/huifu/index.less +0 -180
  124. package/lib/components/eftposPay/huifu/types.d.ts +0 -14
  125. package/lib/components/eftposPay/huifu/types.js +0 -17
  126. package/lib/pro/skuDetailModal/index.d.ts +0 -5
@@ -1,8 +0,0 @@
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
- }) => React.JSX.Element;
8
- export declare const ScanAction: React.FC<HuifuActionProps>;
@@ -1,174 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/components/eftposPay/huifu/Action.tsx
30
- var Action_exports = {};
31
- __export(Action_exports, {
32
- NativeDeviceStatus: () => NativeDeviceStatus,
33
- ScanAction: () => ScanAction
34
- });
35
- module.exports = __toCommonJS(Action_exports);
36
- var import_react = __toESM(require("react"));
37
- var import_utils = require("@pisell/utils");
38
- var import_materials = require("@pisell/materials");
39
- var import_index = require("./index.less");
40
- var import_hooks = require("./hooks");
41
- var NativeDeviceStatus = ({
42
- type,
43
- status
44
- }) => {
45
- const iconType = type === "scanner" ? "pisell2-Scanner" : "pisell2-camera";
46
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-status" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: iconType, style: { fontSize: "40px" } }), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-status-wrapper" }, /* @__PURE__ */ import_react.default.createElement(
47
- import_materials.Iconfont,
48
- {
49
- style: {
50
- borderRadius: "50%",
51
- background: status ? "#17B26A" : "#F04438",
52
- color: "#fff"
53
- },
54
- type: status ? "pisell2-check" : "pisell2-x-close"
55
- }
56
- )));
57
- };
58
- var DEFAULT_SCANNER_CLASS = "pisell-eftpos-pay-huifu-scan-content-scanner";
59
- var ScanAction = ({
60
- isNativeApp,
61
- onClose,
62
- onPayClick,
63
- onScanCallback
64
- }) => {
65
- const { scannerStatus } = (0, import_hooks.useScannerDevice)();
66
- const { cameraStatus, activeCamera } = (0, import_hooks.useCameraDevice)();
67
- const { scanResult } = (0, import_hooks.useScanListener)();
68
- const [inputValue, setInputValue] = (0, import_react.useState)("");
69
- (0, import_react.useEffect)(() => {
70
- if (!!(scanResult == null ? void 0 : scanResult.value)) {
71
- onScanCallback(scanResult.value);
72
- }
73
- }, [scanResult]);
74
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan" }, !isNativeApp ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-header" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-eftpos-pay-huifu-scan-header-title" }, import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.title")), /* @__PURE__ */ import_react.default.createElement(
75
- "div",
76
- {
77
- className: "pisell-eftpos-pay-huifu-scan-header-close",
78
- onClick: onClose
79
- },
80
- /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-x-close", style: { fontSize: "24px" } })
81
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-header-divider" })) : null, /* @__PURE__ */ import_react.default.createElement(
82
- "div",
83
- {
84
- className: "pisell-eftpos-pay-huifu-scan-content",
85
- style: { paddingTop: isNativeApp ? "0" : "24px" }
86
- },
87
- !!isNativeApp && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-content-title" }, import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.title")),
88
- /* @__PURE__ */ import_react.default.createElement(
89
- "div",
90
- {
91
- className: `${DEFAULT_SCANNER_CLASS} ${DEFAULT_SCANNER_CLASS}-${scannerStatus ? "active" : "unactive"}`
92
- },
93
- /* @__PURE__ */ import_react.default.createElement(NativeDeviceStatus, { type: "scanner", status: scannerStatus }),
94
- /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-content-scanner-right" }, /* @__PURE__ */ import_react.default.createElement(
95
- "span",
96
- {
97
- className: `${DEFAULT_SCANNER_CLASS}-${scannerStatus ? "active" : "unactive"}-title`
98
- },
99
- scannerStatus ? import_utils.locales.getText(
100
- "page.eftpos-pay.text.huifu.scan.gun.connected"
101
- ) : import_utils.locales.getText(
102
- "page.eftpos-pay.text.huifu.scan.gun.not-connected"
103
- )
104
- ), /* @__PURE__ */ import_react.default.createElement(
105
- "span",
106
- {
107
- className: `${DEFAULT_SCANNER_CLASS}-${scannerStatus ? "active" : "unactive"}-desc`
108
- },
109
- scannerStatus ? import_utils.locales.getText(
110
- "page.eftpos-pay.text.huifu.scan.gun.connected-desc"
111
- ) : import_utils.locales.getText(
112
- "page.eftpos-pay.text.huifu.scan.gun.not-connected-desc"
113
- )
114
- ))
115
- ),
116
- cameraStatus && /* @__PURE__ */ import_react.default.createElement(
117
- "div",
118
- {
119
- className: "pisell-eftpos-pay-huifu-scan-content-camera",
120
- onClick: activeCamera
121
- },
122
- /* @__PURE__ */ import_react.default.createElement(NativeDeviceStatus, { type: "camera", status: cameraStatus }),
123
- /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-content-camera-right" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-eftpos-pay-huifu-scan-content-camera-title" }, import_utils.locales.getText(
124
- "page.eftpos-pay.text.huifu.scan.camera-title"
125
- )), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-eftpos-pay-huifu-scan-content-camera-desc" }, import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.camera-desc")))
126
- ),
127
- /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-content-input-wrapper" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-content-input-wrapper-title" }, import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.input-title")), /* @__PURE__ */ import_react.default.createElement(
128
- import_materials.Input,
129
- {
130
- placeholder: import_utils.locales.getText(
131
- "page.eftpos-pay.text.huifu.scan.input-placeholder"
132
- ),
133
- maxLength: 18,
134
- style: { width: "100%", fontSize: "16px" },
135
- size: "large",
136
- value: inputValue,
137
- onChange: (e) => {
138
- var _a;
139
- const value = ((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value) || "";
140
- const regex = /^[0-9]*$/;
141
- if (regex.test(value) && (value == null ? void 0 : value.length) <= 18) {
142
- setInputValue(value);
143
- }
144
- }
145
- }
146
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-content-input-wrapper-tip" }, "💡", import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.input-tip")))
147
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-footer" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-eftpos-pay-huifu-scan-footer-divider" }), /* @__PURE__ */ import_react.default.createElement(
148
- import_materials.Button,
149
- {
150
- type: "default",
151
- block: true,
152
- size: "large",
153
- className: "pisell-eftpos-pay-huifu-scan-footer-button",
154
- onClick: onClose
155
- },
156
- import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.cancel")
157
- ), /* @__PURE__ */ import_react.default.createElement(
158
- import_materials.Button,
159
- {
160
- type: "primary",
161
- block: true,
162
- size: "large",
163
- disabled: !inputValue || (inputValue == null ? void 0 : inputValue.length) < 18,
164
- onClick: () => onPayClick(inputValue),
165
- className: "pisell-eftpos-pay-huifu-scan-footer-button"
166
- },
167
- import_utils.locales.getText("page.eftpos-pay.text.huifu.scan.confirm")
168
- )));
169
- };
170
- // Annotate the CommonJS export names for ESM import in node:
171
- 0 && (module.exports = {
172
- NativeDeviceStatus,
173
- ScanAction
174
- });
@@ -1,5 +0,0 @@
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;
@@ -1,86 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/components/eftposPay/huifu/const.ts
20
- var const_exports = {};
21
- __export(const_exports, {
22
- default: () => const_default,
23
- getStep: () => getStep
24
- });
25
- module.exports = __toCommonJS(const_exports);
26
- var import_utils = require("@pisell/utils");
27
- var import_const = require("../const");
28
- var getStep = (mode = import_const.ModeEnum.Pay) => [
29
- {
30
- key: Date.now(),
31
- title: import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
32
- // 'Payment in process...',
33
- text: import_utils.locales.getText("page.eftpos-pay.text.waiting.processing"),
34
- // 'Waiting for the processing...',
35
- warn: "",
36
- tip: import_utils.locales.getText("page.eftpos-pay.text.processing"),
37
- // 'processing...',
38
- status: import_const.StatusEnum.Loading
39
- }
40
- ];
41
- var const_default = (params) => {
42
- const {
43
- order_id,
44
- name,
45
- symbol,
46
- amount,
47
- mode,
48
- number,
49
- pay,
50
- device,
51
- net,
52
- client,
53
- ...other
54
- } = params || {
55
- mode: import_const.ModeEnum.Pay
56
- };
57
- console.log("params =>>>>>> ", params);
58
- const isPay = mode === import_const.ModeEnum.Pay || mode === import_const.ModeEnum.FullPay;
59
- return {
60
- order_id,
61
- name,
62
- symbol,
63
- amount,
64
- mode,
65
- eftpos: import_const.EftposEnum.Huifu,
66
- key: Date.now(),
67
- step: 0,
68
- type: import_const.PayRouteEnum.Step,
69
- title: isPay ? "" : import_utils.locales.getText("page.eftpos-pay.text.loading")(mode),
70
- component: "",
71
- status: isPay ? import_const.StatusEnum.Init : import_const.StatusEnum.Loading,
72
- steps: getStep(mode),
73
- render: true,
74
- client: client !== "undefined" ? client : import_const.ClientEnum.Merchant,
75
- warn: "",
76
- custom: other || {},
77
- ...typeof net !== "undefined" ? { net } : {},
78
- ...typeof number !== "undefined" ? { number } : {},
79
- ...typeof pay !== "undefined" ? { pay } : {},
80
- ...typeof device !== "undefined" ? { device } : {}
81
- };
82
- };
83
- // Annotate the CommonJS export names for ESM import in node:
84
- 0 && (module.exports = {
85
- getStep
86
- });
@@ -1,25 +0,0 @@
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
- };
@@ -1,186 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/components/eftposPay/huifu/hooks.ts
30
- var hooks_exports = {};
31
- __export(hooks_exports, {
32
- useCameraDevice: () => useCameraDevice,
33
- useScanListener: () => useScanListener,
34
- useScannerDevice: () => useScannerDevice,
35
- useTerminal: () => useTerminal
36
- });
37
- module.exports = __toCommonJS(hooks_exports);
38
- var import_react = require("react");
39
- var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
40
- var useTerminal = () => {
41
- var _a, _b, _c;
42
- const context = (0, import_useEngineContext.default)();
43
- const { interaction, isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
44
- return {
45
- isTerminal: isTerminal && isTerminal() || ((_c = (_b = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _b.isAppEnv) == null ? void 0 : _c.call(_b))
46
- };
47
- };
48
- var useScannerDevice = () => {
49
- var _a;
50
- const [scannerStatus, setScannerStatus] = (0, import_react.useState)(false);
51
- const context = (0, import_useEngineContext.default)();
52
- const { interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
53
- (0, import_react.useEffect)(() => {
54
- var _a2, _b, _c, _d;
55
- (_b = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b.call(_a2, {
56
- module: "global",
57
- key: "get_peripherals_status",
58
- data: {}
59
- });
60
- (_d = (_c = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c.mountFunction) == null ? void 0 : _d.call(
61
- _c,
62
- "global",
63
- "peripheralsStatus",
64
- (strPeripherals) => {
65
- try {
66
- const peripherals = JSON.parse(strPeripherals);
67
- setScannerStatus((peripherals == null ? void 0 : peripherals.scanner) == "connected");
68
- } catch (err) {
69
- console.error(err);
70
- }
71
- }
72
- );
73
- }, []);
74
- return {
75
- scannerStatus
76
- };
77
- };
78
- var useCameraDevice = () => {
79
- var _a, _b, _c;
80
- const context = (0, import_useEngineContext.default)();
81
- const { interaction, isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
82
- const activeCamera = (0, import_react.useCallback)(() => {
83
- var _a2, _b2;
84
- (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
85
- module: "global",
86
- key: "active_native_scanner",
87
- data: {
88
- source: "eftposPay_huifu"
89
- }
90
- });
91
- }, []);
92
- return {
93
- activeCamera,
94
- cameraStatus: isTerminal && isTerminal() || ((_c = (_b = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _b.isAppEnv) == null ? void 0 : _c.call(_b))
95
- };
96
- };
97
- var useScanListener = () => {
98
- var _a, _b, _c;
99
- const context = (0, import_useEngineContext.default)();
100
- const { interaction, isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
101
- const [scanResult, setScanResult] = (0, import_react.useState)({ type: "scanner", value: "" });
102
- const isNativeEnv = isTerminal && isTerminal() || ((_c = (_b = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _b.isAppEnv) == null ? void 0 : _c.call(_b));
103
- (0, import_react.useEffect)(() => {
104
- var _a2, _b2;
105
- (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.mountFunction) == null ? void 0 : _b2.call(
106
- _a2,
107
- "global",
108
- "peripheralsResult",
109
- (strVal) => {
110
- try {
111
- const val = JSON.parse(strVal);
112
- setScanResult(val);
113
- } catch (err) {
114
- console.error(err);
115
- setScanResult({ type: "scanner", value: "" });
116
- }
117
- }
118
- );
119
- let inputBuffer = "";
120
- let lastInputTime = 0;
121
- let inputTimer = null;
122
- const handleKeyDown = (e) => {
123
- if (e.key === "Shift" || e.key === "Control" || e.key === "Alt" || e.key === "Meta" || e.key === "Tab" || e.key === "CapsLock" || e.key === "Escape" || e.key.startsWith("Arrow") || e.ctrlKey || e.metaKey) {
124
- return;
125
- }
126
- const currentTime = Date.now();
127
- const timeDiff = currentTime - lastInputTime;
128
- if (e.key === "Enter") {
129
- const trimmedCode = inputBuffer.trim();
130
- if (trimmedCode.length >= 10) {
131
- setScanResult({
132
- type: "scanner",
133
- value: trimmedCode
134
- });
135
- }
136
- inputBuffer = "";
137
- lastInputTime = 0;
138
- if (inputTimer) {
139
- clearTimeout(inputTimer);
140
- inputTimer = null;
141
- }
142
- return;
143
- }
144
- if (timeDiff < 30 && inputBuffer.length > 0) {
145
- inputBuffer += e.key;
146
- } else {
147
- inputBuffer = e.key;
148
- }
149
- lastInputTime = currentTime;
150
- if (inputTimer) {
151
- clearTimeout(inputTimer);
152
- }
153
- inputTimer = setTimeout(() => {
154
- const trimmedCode = inputBuffer.trim();
155
- if (trimmedCode.length >= 10) {
156
- setScanResult({
157
- type: "scanner",
158
- value: trimmedCode
159
- });
160
- }
161
- inputBuffer = "";
162
- }, 100);
163
- };
164
- if (!isNativeEnv) {
165
- document.addEventListener("keydown", handleKeyDown);
166
- }
167
- return () => {
168
- if (!isNativeEnv) {
169
- document.removeEventListener("keydown", handleKeyDown);
170
- }
171
- if (inputTimer) {
172
- clearTimeout(inputTimer);
173
- }
174
- };
175
- }, []);
176
- return {
177
- scanResult
178
- };
179
- };
180
- // Annotate the CommonJS export names for ESM import in node:
181
- 0 && (module.exports = {
182
- useCameraDevice,
183
- useScanListener,
184
- useScannerDevice,
185
- useTerminal
186
- });
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- import { HuifuProps } from './types';
4
- declare const Huifu: React.FC<HuifuProps>;
5
- export default Huifu;