@pisell/private-materials 3.0.136 → 3.0.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/forms/single/index.js +3 -0
- package/es/components/eftpos/const.d.ts +26 -0
- package/es/components/eftpos/const.js +40 -8
- package/es/components/eftpos/device.d.ts +3 -2
- package/es/components/eftpos/device.js +6 -5
- package/es/components/eftpos/form/index.d.ts +5 -0
- package/es/components/eftpos/form/index.js +8 -0
- package/es/components/eftpos/hooks.d.ts +34 -0
- package/es/components/{eftposPay/windcave/hook.js → eftpos/hooks.js} +96 -122
- package/es/components/eftpos/icon/apiKey.d.ts +5 -0
- package/es/components/eftpos/icon/apiKey.js +17 -0
- package/es/components/eftpos/icon/device.d.ts +5 -0
- package/es/components/eftpos/icon/device.js +19 -0
- package/es/components/eftpos/index.d.ts +10 -0
- package/es/components/eftpos/index.js +329 -46
- package/es/components/eftpos/index.less +38 -1
- package/es/components/eftpos/locales.d.ts +12 -0
- package/es/components/eftpos/locales.js +15 -3
- package/es/components/eftpos/log.d.ts +8 -0
- package/es/components/eftpos/log.js +85 -0
- package/es/components/eftpos/pos.d.ts +1 -1
- package/es/components/eftpos/pos.js +8 -5
- package/es/components/eftpos/surcharge/index.d.ts +25 -2
- package/es/components/eftpos/surcharge/index.js +100 -16
- package/es/components/eftpos/table.d.ts +4 -0
- package/es/components/eftpos/table.js +102 -10
- package/es/components/eftposPay/amount.d.ts +7 -1
- package/es/components/eftposPay/amount.js +65 -38
- package/es/components/eftposPay/component/fail/failCustom.js +65 -20
- package/es/components/eftposPay/component/fail/index.js +60 -30
- package/es/components/eftposPay/component/fail/network.d.ts +5 -0
- package/es/components/eftposPay/component/fail/network.js +13 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +6 -0
- package/es/components/eftposPay/component/fail/unknow.js +18 -3
- package/es/components/eftposPay/component/header/index.d.ts +2 -1
- package/es/components/eftposPay/component/header/index.js +4 -1
- package/es/components/eftposPay/component/header/index.less +1 -10
- package/es/components/eftposPay/component/manual/index.d.ts +6 -1
- package/es/components/eftposPay/component/manual/index.js +174 -23
- package/es/components/eftposPay/component/manual/index.less +42 -14
- package/es/components/eftposPay/component/signature/index.d.ts +5 -0
- package/es/components/eftposPay/component/signature/index.js +20 -2
- package/es/components/eftposPay/component/step/index.d.ts +7 -7
- package/es/components/eftposPay/component/step/step.d.ts +4 -4
- package/es/components/eftposPay/const.d.ts +19 -4
- package/es/components/eftposPay/const.js +4 -2
- package/es/components/eftposPay/device.d.ts +7 -0
- package/es/components/eftposPay/device.js +22 -0
- package/es/components/eftposPay/helper.d.ts +54 -0
- package/es/components/eftposPay/helper.js +93 -1
- package/es/components/eftposPay/hooks.d.ts +30 -1
- package/es/components/eftposPay/hooks.js +181 -26
- package/es/components/eftposPay/index.d.ts +2 -4
- package/es/components/eftposPay/index.js +119 -31
- package/es/components/eftposPay/index.less +27 -19
- package/es/components/eftposPay/locales.d.ts +45 -0
- package/es/components/eftposPay/locales.js +348 -3
- package/es/components/eftposPay/manufacturer.d.ts +2 -2
- package/es/components/eftposPay/manufacturer.js +9 -10
- package/es/components/eftposPay/pay.d.ts +10 -1
- package/es/components/eftposPay/pay.js +112 -34
- package/es/components/eftposPay/payo/config.js +137 -270
- package/es/components/eftposPay/payo/const.d.ts +22 -2
- package/es/components/eftposPay/payo/const.js +83 -33
- package/es/components/eftposPay/payo/hooks.d.ts +5 -0
- package/es/components/eftposPay/payo/hooks.js +19 -2
- package/es/components/eftposPay/store/index.d.ts +154 -53
- package/es/components/eftposPay/store/index.js +112 -60
- package/es/components/eftposPay/tyro/const.d.ts +17 -0
- package/es/components/eftposPay/{eftpos → tyro}/const.js +71 -90
- package/es/components/eftposPay/tyro/hooks.d.ts +14 -0
- package/es/components/eftposPay/tyro/hooks.js +40 -0
- package/es/components/eftposPay/tyro/index.d.ts +9 -0
- package/es/components/eftposPay/tyro/index.js +575 -0
- package/es/components/eftposPay/windcave/const.d.ts +24 -9
- package/es/components/eftposPay/windcave/const.js +90 -81
- package/es/components/eftposPay/windcave/helper.d.ts +16 -2
- package/es/components/eftposPay/windcave/helper.js +175 -42
- package/es/components/eftposPay/windcave/receiptAction.d.ts +12 -0
- package/es/components/eftposPay/windcave/receiptAction.js +91 -43
- package/es/components/eftposPay/windcave/timer.d.ts +13 -1
- package/es/components/eftposPay/windcave/timer.js +18 -1
- package/es/components/eftposPay/windcave/windcave.d.ts +2 -1
- package/es/components/eftposPay/windcave/windcave.js +155 -139
- package/es/utils/load.d.ts +11 -0
- package/es/utils/load.js +85 -0
- package/lib/components/booking/forms/single/index.js +1 -0
- package/lib/components/eftpos/const.d.ts +26 -0
- package/lib/components/eftpos/const.js +13 -1
- package/lib/components/eftpos/device.d.ts +3 -2
- package/lib/components/eftpos/device.js +2 -2
- package/lib/components/eftpos/form/index.d.ts +5 -0
- package/lib/components/eftpos/hooks.d.ts +34 -0
- package/lib/components/eftpos/hooks.js +106 -0
- package/lib/components/eftpos/icon/apiKey.d.ts +5 -0
- package/lib/components/eftpos/icon/apiKey.js +57 -0
- package/lib/components/eftpos/icon/device.d.ts +5 -0
- package/lib/components/eftpos/icon/device.js +57 -0
- package/lib/components/eftpos/index.d.ts +10 -0
- package/lib/components/eftpos/index.js +262 -97
- package/lib/components/eftpos/index.less +38 -1
- package/lib/components/eftpos/locales.d.ts +12 -0
- package/lib/components/eftpos/locales.js +15 -3
- package/lib/components/eftpos/log.d.ts +8 -0
- package/lib/components/eftpos/log.js +87 -0
- package/lib/components/eftpos/pos.d.ts +1 -1
- package/lib/components/eftpos/pos.js +5 -4
- package/lib/components/eftpos/surcharge/index.d.ts +25 -2
- package/lib/components/eftpos/surcharge/index.js +36 -6
- package/lib/components/eftpos/table.d.ts +4 -0
- package/lib/components/eftpos/table.js +40 -8
- package/lib/components/eftposPay/amount.d.ts +7 -1
- package/lib/components/eftposPay/amount.js +10 -33
- package/lib/components/eftposPay/component/fail/failCustom.js +27 -6
- package/lib/components/eftposPay/component/fail/index.js +39 -18
- package/lib/components/eftposPay/component/fail/network.d.ts +5 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +6 -0
- package/lib/components/eftposPay/component/fail/unknow.js +3 -3
- package/lib/components/eftposPay/component/header/index.d.ts +2 -1
- package/lib/components/eftposPay/component/header/index.js +2 -1
- package/lib/components/eftposPay/component/header/index.less +1 -10
- package/lib/components/eftposPay/component/manual/index.d.ts +6 -1
- package/lib/components/eftposPay/component/manual/index.js +122 -31
- package/lib/components/eftposPay/component/manual/index.less +42 -14
- package/lib/components/eftposPay/component/signature/index.d.ts +5 -0
- package/lib/components/eftposPay/component/signature/index.js +2 -2
- package/lib/components/eftposPay/component/step/index.d.ts +7 -7
- package/lib/components/eftposPay/component/step/step.d.ts +4 -4
- package/lib/components/eftposPay/const.d.ts +19 -4
- package/lib/components/eftposPay/const.js +3 -1
- package/lib/components/eftposPay/device.d.ts +7 -0
- package/lib/components/eftposPay/helper.d.ts +54 -0
- package/lib/components/eftposPay/helper.js +64 -0
- package/lib/components/eftposPay/hooks.d.ts +30 -1
- package/lib/components/eftposPay/hooks.js +182 -44
- package/lib/components/eftposPay/index.d.ts +2 -4
- package/lib/components/eftposPay/index.js +74 -27
- package/lib/components/eftposPay/index.less +27 -19
- package/lib/components/eftposPay/locales.d.ts +45 -0
- package/lib/components/eftposPay/locales.js +352 -3
- package/lib/components/eftposPay/manufacturer.d.ts +2 -2
- package/lib/components/eftposPay/manufacturer.js +13 -13
- package/lib/components/eftposPay/pay.d.ts +10 -1
- package/lib/components/eftposPay/pay.js +86 -25
- package/lib/components/eftposPay/payo/config.js +121 -268
- package/lib/components/eftposPay/payo/const.d.ts +22 -2
- package/lib/components/eftposPay/payo/const.js +55 -36
- package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
- package/lib/components/eftposPay/payo/hooks.js +1 -1
- package/lib/components/eftposPay/store/index.d.ts +154 -53
- package/lib/components/eftposPay/store/index.js +7 -66
- package/lib/components/eftposPay/tyro/const.d.ts +17 -0
- package/lib/components/eftposPay/tyro/const.js +114 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +14 -0
- package/lib/components/eftposPay/{eftpos/index.js → tyro/hooks.js} +31 -36
- package/lib/components/eftposPay/tyro/index.d.ts +9 -0
- package/lib/components/eftposPay/tyro/index.js +558 -0
- package/lib/components/eftposPay/windcave/const.d.ts +24 -9
- package/lib/components/eftposPay/windcave/const.js +53 -104
- package/lib/components/eftposPay/windcave/helper.d.ts +16 -2
- package/lib/components/eftposPay/windcave/helper.js +163 -48
- package/lib/components/eftposPay/windcave/receiptAction.d.ts +12 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +15 -47
- package/lib/components/eftposPay/windcave/timer.d.ts +13 -1
- package/lib/components/eftposPay/windcave/timer.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.d.ts +2 -1
- package/lib/components/eftposPay/windcave/windcave.js +130 -130
- package/lib/utils/load.d.ts +11 -0
- package/lib/utils/load.js +100 -0
- package/lowcode/eftpos/meta.ts +202 -160
- package/lowcode/eftpos-pay/meta.ts +45 -12
- package/package.json +4 -4
- package/es/components/eftposPay/eftpos/config.d.ts +0 -11
- package/es/components/eftposPay/eftpos/config.js +0 -178
- package/es/components/eftposPay/eftpos/const.d.ts +0 -10
- package/es/components/eftposPay/eftpos/index.d.ts +0 -7
- package/es/components/eftposPay/eftpos/index.js +0 -35
- package/es/components/eftposPay/windcave/action.d.ts +0 -8
- package/es/components/eftposPay/windcave/action.js +0 -104
- package/es/components/eftposPay/windcave/hook.d.ts +0 -14
- package/es/components/eftposPay/windcave/index.d.ts +0 -8
- package/es/components/eftposPay/windcave/index.js +0 -49
- package/es/components/eftposPay/windcave/pos.d.ts +0 -8
- package/es/components/eftposPay/windcave/pos.js +0 -180
- package/es/components/eftposPay/windcave/pwd.d.ts +0 -8
- package/es/components/eftposPay/windcave/pwd.js +0 -124
- package/es/components/eftposPay/windcave/receipet.d.ts +0 -6
- package/es/components/eftposPay/windcave/receipet.js +0 -67
- package/es/components/eftposPay/windcave/wait.d.ts +0 -12
- package/es/components/eftposPay/windcave/wait.js +0 -139
- package/lib/components/eftposPay/eftpos/config.d.ts +0 -11
- package/lib/components/eftposPay/eftpos/config.js +0 -199
- package/lib/components/eftposPay/eftpos/const.d.ts +0 -10
- package/lib/components/eftposPay/eftpos/const.js +0 -165
- package/lib/components/eftposPay/eftpos/index.d.ts +0 -7
- package/lib/components/eftposPay/windcave/action.d.ts +0 -8
- package/lib/components/eftposPay/windcave/action.js +0 -143
- package/lib/components/eftposPay/windcave/hook.d.ts +0 -14
- package/lib/components/eftposPay/windcave/hook.js +0 -139
- package/lib/components/eftposPay/windcave/index.d.ts +0 -8
- package/lib/components/eftposPay/windcave/index.js +0 -78
- package/lib/components/eftposPay/windcave/pos.d.ts +0 -8
- package/lib/components/eftposPay/windcave/pos.js +0 -197
- package/lib/components/eftposPay/windcave/pwd.d.ts +0 -8
- package/lib/components/eftposPay/windcave/pwd.js +0 -143
- package/lib/components/eftposPay/windcave/receipet.d.ts +0 -6
- package/lib/components/eftposPay/windcave/receipet.js +0 -93
- package/lib/components/eftposPay/windcave/wait.d.ts +0 -12
- package/lib/components/eftposPay/windcave/wait.js +0 -163
|
@@ -142,6 +142,9 @@ var Single = function Single(_ref) {
|
|
|
142
142
|
*/
|
|
143
143
|
var renderItem = useCallback(function (fieldData) {
|
|
144
144
|
var _fields = form.field || [];
|
|
145
|
+
_fields = _fields.filter(function (item) {
|
|
146
|
+
return item.status !== 'hide';
|
|
147
|
+
});
|
|
145
148
|
return /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
146
149
|
list: _fields,
|
|
147
150
|
renderItem: function renderItem(field) {
|
|
@@ -5,25 +5,51 @@ export declare enum Eftpos {
|
|
|
5
5
|
Stripe = "stripe"
|
|
6
6
|
}
|
|
7
7
|
export declare enum DeviceEnum {
|
|
8
|
+
/** 新增 */
|
|
8
9
|
Add = "add",
|
|
10
|
+
/** 编辑 */
|
|
9
11
|
Edit = "edit",
|
|
12
|
+
/** 重新链接 */
|
|
10
13
|
Repair = "repair"
|
|
11
14
|
}
|
|
12
15
|
export declare type DeviceStatus = `${DeviceEnum}`;
|
|
16
|
+
/** 设备配置信息 */
|
|
13
17
|
export interface DeviceProp {
|
|
18
|
+
/** 设备id */
|
|
14
19
|
id?: string | number;
|
|
20
|
+
/** 设备名称 */
|
|
15
21
|
name: string;
|
|
22
|
+
/** 设备类型(厂商) */
|
|
16
23
|
type: Eftpos.Tyro;
|
|
24
|
+
/** 设备状态 */
|
|
17
25
|
status: "unpaired" | "paired";
|
|
26
|
+
/** 设备设置(商户配置) */
|
|
18
27
|
setting: {
|
|
19
28
|
[key: string]: unknown;
|
|
20
29
|
} | null;
|
|
30
|
+
/** 设备设置(第三方配置) */
|
|
21
31
|
connection: {
|
|
22
32
|
[key: string]: unknown;
|
|
23
33
|
} | null;
|
|
24
34
|
[key: string]: unknown;
|
|
25
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @title: 获取表单结果数据
|
|
38
|
+
* @description: 获取表单结果数据
|
|
39
|
+
* @param {any} list 表单配置信息
|
|
40
|
+
* @return {*} 表单结果信息
|
|
41
|
+
* @Author: hongbing.wang
|
|
42
|
+
* @Date: 2024-08-19 11:10
|
|
43
|
+
*/
|
|
26
44
|
export declare const getDefaultValue: (list: any) => any;
|
|
45
|
+
/**
|
|
46
|
+
* @title: 构建通用表单配置信息,构建动态表单
|
|
47
|
+
* @description:
|
|
48
|
+
* @param {any} field : array 字段信息 value 结果信息,name 上级字段信息用于嵌套, getComm : 获取字段组件配置信息
|
|
49
|
+
* @return form 表单配置信息
|
|
50
|
+
* @Author: hongbing.wang
|
|
51
|
+
* @Date: 2024-08-19 11:11
|
|
52
|
+
*/
|
|
27
53
|
export declare function getCommByFields({ field, value, name, getComm, }: {
|
|
28
54
|
field: (string | {
|
|
29
55
|
name: string;
|
|
@@ -27,6 +27,14 @@ export var DeviceEnum;
|
|
|
27
27
|
DeviceEnum["Edit"] = "edit";
|
|
28
28
|
DeviceEnum["Repair"] = "repair";
|
|
29
29
|
})(DeviceEnum || (DeviceEnum = {}));
|
|
30
|
+
/**
|
|
31
|
+
* @title: 获取表单结果数据
|
|
32
|
+
* @description: 获取表单结果数据
|
|
33
|
+
* @param {any} list 表单配置信息
|
|
34
|
+
* @return {*} 表单结果信息
|
|
35
|
+
* @Author: hongbing.wang
|
|
36
|
+
* @Date: 2024-08-19 11:10
|
|
37
|
+
*/
|
|
30
38
|
export var getDefaultValue = function getDefaultValue(list) {
|
|
31
39
|
return list.reduce(function (target, item) {
|
|
32
40
|
if (Array.isArray(item.children) && item.children.length) {
|
|
@@ -42,6 +50,15 @@ export var getDefaultValue = function getDefaultValue(list) {
|
|
|
42
50
|
return _objectSpread(_objectSpread({}, target), {}, _defineProperty({}, item.__sourceName, item.input.defaultValue));
|
|
43
51
|
}, {});
|
|
44
52
|
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @title: 构建通用表单配置信息,构建动态表单
|
|
56
|
+
* @description:
|
|
57
|
+
* @param {any} field : array 字段信息 value 结果信息,name 上级字段信息用于嵌套, getComm : 获取字段组件配置信息
|
|
58
|
+
* @return form 表单配置信息
|
|
59
|
+
* @Author: hongbing.wang
|
|
60
|
+
* @Date: 2024-08-19 11:11
|
|
61
|
+
*/
|
|
45
62
|
export function getCommByFields(_x) {
|
|
46
63
|
return _getCommByFields.apply(this, arguments);
|
|
47
64
|
}
|
|
@@ -60,7 +77,7 @@ function _getCommByFields() {
|
|
|
60
77
|
while (1) switch (_context.prev = _context.next) {
|
|
61
78
|
case 0:
|
|
62
79
|
if (!(typeof item === 'string')) {
|
|
63
|
-
_context.next =
|
|
80
|
+
_context.next = 15;
|
|
64
81
|
break;
|
|
65
82
|
}
|
|
66
83
|
_context.next = 3;
|
|
@@ -78,33 +95,48 @@ function _getCommByFields() {
|
|
|
78
95
|
}
|
|
79
96
|
return _context.abrupt("return", undefined);
|
|
80
97
|
case 6:
|
|
98
|
+
if (!Array.isArray(commConfig)) {
|
|
99
|
+
_context.next = 8;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return _context.abrupt("return", commConfig.map(function (item) {
|
|
103
|
+
var ComponentName = item.Component;
|
|
104
|
+
var helpFn = helpMapping[ComponentName];
|
|
105
|
+
if (helpFn) {
|
|
106
|
+
return helpFn.getCommName(item, name);
|
|
107
|
+
}
|
|
108
|
+
item.__sourceName = item.name;
|
|
109
|
+
item.name = name.length > 0 ? [].concat(_toConsumableArray(name), [item.name]) : item.name;
|
|
110
|
+
return item;
|
|
111
|
+
}));
|
|
112
|
+
case 8:
|
|
81
113
|
ComponentName = commConfig.Component;
|
|
82
114
|
helpFn = helpMapping[ComponentName];
|
|
83
115
|
if (!helpFn) {
|
|
84
|
-
_context.next =
|
|
116
|
+
_context.next = 12;
|
|
85
117
|
break;
|
|
86
118
|
}
|
|
87
119
|
return _context.abrupt("return", helpFn.getCommName(commConfig, name));
|
|
88
|
-
case
|
|
120
|
+
case 12:
|
|
89
121
|
commConfig.__sourceName = commConfig.name;
|
|
90
122
|
commConfig.name = name.length > 0 ? [].concat(_toConsumableArray(name), [commConfig.name]) : commConfig.name;
|
|
91
123
|
return _context.abrupt("return", commConfig);
|
|
92
|
-
case
|
|
93
|
-
_context.next =
|
|
124
|
+
case 15:
|
|
125
|
+
_context.next = 17;
|
|
94
126
|
return getCommByFields({
|
|
95
127
|
field: item.children,
|
|
96
128
|
value: value,
|
|
97
129
|
name: [].concat(_toConsumableArray(name || []), [item.name]),
|
|
98
130
|
getComm: getComm
|
|
99
131
|
});
|
|
100
|
-
case
|
|
132
|
+
case 17:
|
|
101
133
|
children = _context.sent;
|
|
102
134
|
return _context.abrupt("return", {
|
|
103
135
|
name: name.length > 0 ? [].concat(_toConsumableArray(name), [item.name]) : item.name,
|
|
104
136
|
__sourceName: item.name,
|
|
105
137
|
children: children
|
|
106
138
|
});
|
|
107
|
-
case
|
|
139
|
+
case 19:
|
|
108
140
|
case "end":
|
|
109
141
|
return _context.stop();
|
|
110
142
|
}
|
|
@@ -116,7 +148,7 @@ function _getCommByFields() {
|
|
|
116
148
|
}()));
|
|
117
149
|
case 3:
|
|
118
150
|
result = _context2.sent;
|
|
119
|
-
return _context2.abrupt("return", result.filter(Boolean));
|
|
151
|
+
return _context2.abrupt("return", result.flat().filter(Boolean));
|
|
120
152
|
case 5:
|
|
121
153
|
case "end":
|
|
122
154
|
return _context2.stop();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DeviceProp } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DeviceProp } from './const';
|
|
3
3
|
interface DeviceProps {
|
|
4
4
|
formItemList: any[];
|
|
5
5
|
onSave: (device: DeviceProp) => void;
|
|
6
|
+
children?: React.ReactNode;
|
|
6
7
|
}
|
|
7
8
|
declare const Device: (props: DeviceProps) => React.JSX.Element;
|
|
8
9
|
export default Device;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Form, Button } from
|
|
3
|
-
import { locales } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form, Button } from 'antd';
|
|
3
|
+
import { locales } from '@pisell/utils';
|
|
4
4
|
import { getDefaultValue } from "./const";
|
|
5
5
|
import FormItem from "./form";
|
|
6
6
|
var Device = function Device(props) {
|
|
7
7
|
var onSave = props.onSave,
|
|
8
|
+
children = props.children,
|
|
8
9
|
formItemList = props.formItemList;
|
|
9
10
|
var initialValues = getDefaultValue(formItemList);
|
|
10
11
|
return /*#__PURE__*/React.createElement(Form, {
|
|
@@ -20,7 +21,7 @@ var Device = function Device(props) {
|
|
|
20
21
|
}
|
|
21
22
|
}, /*#__PURE__*/React.createElement(FormItem, {
|
|
22
23
|
formItemList: formItemList
|
|
23
|
-
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
24
|
+
}), children), /*#__PURE__*/React.createElement(Form.Item, {
|
|
24
25
|
className: "pisell-lowcode__pos-device-btn"
|
|
25
26
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
26
27
|
htmlType: "submit",
|
|
@@ -28,6 +29,6 @@ var Device = function Device(props) {
|
|
|
28
29
|
style: {
|
|
29
30
|
height: '48px'
|
|
30
31
|
}
|
|
31
|
-
}, locales.getText(
|
|
32
|
+
}, locales.getText('page.eftpos.text.save'))));
|
|
32
33
|
};
|
|
33
34
|
export default Device;
|
|
@@ -12,6 +12,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Input, InputNumber, Checkbox, Radio, Cascader, DatePicker, Select, Slider, Switch, TimePicker, Transfer, TreeSelect, Upload, Form, Space } from 'antd';
|
|
14
14
|
import Surcharge, { getCommName, getCommDefaultVal } from "../surcharge";
|
|
15
|
+
|
|
16
|
+
// 通用表单配置
|
|
15
17
|
var Mapping = {
|
|
16
18
|
Input: Input,
|
|
17
19
|
InputNumber: InputNumber,
|
|
@@ -85,6 +87,12 @@ var Mapping = {
|
|
|
85
87
|
var CustomMapping = {
|
|
86
88
|
Surcharge: Surcharge
|
|
87
89
|
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @title: 递归循环表单数据
|
|
93
|
+
* @Author: hongbing.wang
|
|
94
|
+
* @Date: 2024-08-20 13:21
|
|
95
|
+
*/
|
|
88
96
|
var CustomFormItem = function CustomFormItem(_ref3) {
|
|
89
97
|
var formItemList = _ref3.formItemList,
|
|
90
98
|
_ref3$level = _ref3.level,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Eftpos } from './const';
|
|
3
|
+
/**
|
|
4
|
+
* @title: tyro 设备连接
|
|
5
|
+
* @Author: hongbing.wang
|
|
6
|
+
* @Date: 2024-08-20 13:23
|
|
7
|
+
*/
|
|
8
|
+
export declare const usePairTerminalo: (type: Eftpos, params: {
|
|
9
|
+
url?: string | undefined;
|
|
10
|
+
version?: string | undefined;
|
|
11
|
+
}) => ({ mid, tid, apiKey, posProductData, }: {
|
|
12
|
+
mid: string;
|
|
13
|
+
tid: string;
|
|
14
|
+
apiKey: string;
|
|
15
|
+
posProductData: {
|
|
16
|
+
posProductVendor: string;
|
|
17
|
+
posProductName: string;
|
|
18
|
+
posProductVersion: string;
|
|
19
|
+
siteReference: string;
|
|
20
|
+
};
|
|
21
|
+
}, cb: (...agrn: unknown[]) => void) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* @title: 获取 Tyro 资源
|
|
24
|
+
* @description:
|
|
25
|
+
* @param {Eftpos} type 类型
|
|
26
|
+
* @param {string} url 链接
|
|
27
|
+
* @return {*}
|
|
28
|
+
* @Author: hongbing.wang
|
|
29
|
+
* @Date: 2024-08-19 18:36
|
|
30
|
+
*/
|
|
31
|
+
export declare const useTyro: (params: {
|
|
32
|
+
url?: string | undefined;
|
|
33
|
+
version?: string | undefined;
|
|
34
|
+
}) => readonly [import("react").MutableRefObject<any>, boolean];
|
|
@@ -1,144 +1,118 @@
|
|
|
1
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import loadjs from "../../utils/load";
|
|
13
|
+
/**
|
|
14
|
+
* @title: tyro 设备连接
|
|
15
|
+
* @Author: hongbing.wang
|
|
16
|
+
* @Date: 2024-08-20 13:23
|
|
17
|
+
*/
|
|
18
|
+
export var usePairTerminalo = function usePairTerminalo(type, params) {
|
|
19
|
+
var ref = useRef();
|
|
20
|
+
var iclientRef = useRef();
|
|
21
|
+
var url = useMemo(function () {
|
|
22
|
+
return params && params.url && params.version ? "".concat(params.url, "/").concat(params.version) : 'https://iclientsimulator.test.tyro.com/iclient-v1.js';
|
|
23
|
+
}, [params]);
|
|
24
|
+
var loadSDK = function loadSDK() {
|
|
25
|
+
var _window;
|
|
26
|
+
if ((_window = window) !== null && _window !== void 0 && _window.TYRO) {
|
|
27
|
+
var _window2;
|
|
28
|
+
return Promise.resolve((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.TYRO);
|
|
29
|
+
}
|
|
30
|
+
return loadjs(url, document.head).then(function () {
|
|
31
|
+
var _window3, _window4;
|
|
32
|
+
console.log((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.TYRO);
|
|
33
|
+
return (_window4 = window) === null || _window4 === void 0 ? void 0 : _window4.TYRO;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var pair = /*#__PURE__*/function () {
|
|
37
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, cb) {
|
|
38
|
+
var mid, tid, apiKey, posProductData, _TYRO;
|
|
19
39
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20
40
|
while (1) switch (_context.prev = _context.next) {
|
|
21
41
|
case 0:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
res = {
|
|
26
|
-
txn_status_id: __start__ || '0'
|
|
27
|
-
};
|
|
28
|
-
case 4:
|
|
29
|
-
if (!(ref.current && checkCondition(res))) {
|
|
30
|
-
_context.next = 17;
|
|
42
|
+
mid = _ref.mid, tid = _ref.tid, apiKey = _ref.apiKey, posProductData = _ref.posProductData;
|
|
43
|
+
if (!(type !== 'tyro')) {
|
|
44
|
+
_context.next = 4;
|
|
31
45
|
break;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
txn_status_id: res.txn_status_id
|
|
39
|
-
}, {
|
|
40
|
-
signal: controllerRef.current.signal
|
|
41
|
-
}).then(function (r) {
|
|
42
|
-
changeStatus === null || changeStatus === void 0 ? void 0 : changeStatus(r);
|
|
43
|
-
console.log('原始数据 res = ', r);
|
|
44
|
-
if (r && r.data) {
|
|
45
|
-
return r.data;
|
|
46
|
-
}
|
|
47
|
-
return r;
|
|
48
|
-
}).catch(function (err) {
|
|
49
|
-
console.log(res);
|
|
50
|
-
res = err;
|
|
51
|
-
});
|
|
52
|
-
case 9:
|
|
53
|
-
res = _context.sent;
|
|
54
|
-
diff = Date.now() - start;
|
|
55
|
-
console.log('diff', "".concat(res && res.txn_status_id) !== '8' && "".concat(res && res.status_id) !== '6', res);
|
|
56
|
-
if (!(diff < time)) {
|
|
57
|
-
_context.next = 15;
|
|
47
|
+
cb({});
|
|
48
|
+
return _context.abrupt("return");
|
|
49
|
+
case 4:
|
|
50
|
+
if (ref.current) {
|
|
51
|
+
_context.next = 8;
|
|
58
52
|
break;
|
|
59
53
|
}
|
|
60
|
-
_context.next =
|
|
61
|
-
return
|
|
62
|
-
case
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!(!res || checkCondition(res))) {
|
|
68
|
-
_context.next = 21;
|
|
54
|
+
_context.next = 7;
|
|
55
|
+
return loadSDK();
|
|
56
|
+
case 7:
|
|
57
|
+
ref.current = _context.sent;
|
|
58
|
+
case 8:
|
|
59
|
+
if (ref.current) {
|
|
60
|
+
_context.next = 11;
|
|
69
61
|
break;
|
|
70
62
|
}
|
|
71
|
-
|
|
72
|
-
return _context.abrupt("return"
|
|
73
|
-
case
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
cb({});
|
|
64
|
+
return _context.abrupt("return");
|
|
65
|
+
case 11:
|
|
66
|
+
// 没有实例,构建实例
|
|
67
|
+
if (!iclientRef.current) {
|
|
68
|
+
_TYRO = ref.current;
|
|
69
|
+
iclientRef.current = new _TYRO.IClient(apiKey, posProductData);
|
|
70
|
+
}
|
|
71
|
+
iclientRef.current.pairTerminal(mid, tid, function (response) {
|
|
72
|
+
console.log(response);
|
|
73
|
+
cb(response);
|
|
74
|
+
});
|
|
75
|
+
case 13:
|
|
76
76
|
case "end":
|
|
77
77
|
return _context.stop();
|
|
78
78
|
}
|
|
79
79
|
}, _callee);
|
|
80
80
|
}));
|
|
81
|
-
return function (_x) {
|
|
81
|
+
return function pair(_x, _x2) {
|
|
82
82
|
return _ref2.apply(this, arguments);
|
|
83
83
|
};
|
|
84
|
-
}()
|
|
85
|
-
|
|
86
|
-
var _controllerRef$curren;
|
|
87
|
-
ref.current = false;
|
|
88
|
-
(_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 ? void 0 : _controllerRef$curren.abort();
|
|
89
|
-
}, []);
|
|
90
|
-
var run = function run(params) {
|
|
91
|
-
TimeoutRef.current && clearTimeout(TimeoutRef.current);
|
|
92
|
-
TimeoutRef.current = setTimeout(function () {
|
|
93
|
-
close();
|
|
94
|
-
}, timeout);
|
|
95
|
-
return checkApi(params);
|
|
96
|
-
};
|
|
97
|
-
useEffect(function () {
|
|
98
|
-
return function () {
|
|
99
|
-
clearTimeout(TimeoutRef.current);
|
|
100
|
-
close();
|
|
101
|
-
};
|
|
102
|
-
}, [close]);
|
|
103
|
-
return [run, close];
|
|
84
|
+
}();
|
|
85
|
+
return pair;
|
|
104
86
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
dispatch(updateStep({
|
|
137
|
-
step: 5
|
|
138
|
-
}));
|
|
139
|
-
} else {
|
|
140
|
-
fail(res);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}, [fail, dispatch]);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @title: 获取 Tyro 资源
|
|
90
|
+
* @description:
|
|
91
|
+
* @param {Eftpos} type 类型
|
|
92
|
+
* @param {string} url 链接
|
|
93
|
+
* @return {*}
|
|
94
|
+
* @Author: hongbing.wang
|
|
95
|
+
* @Date: 2024-08-19 18:36
|
|
96
|
+
*/
|
|
97
|
+
export var useTyro = function useTyro(params) {
|
|
98
|
+
var ref = useRef();
|
|
99
|
+
var _useState = useState(false),
|
|
100
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
101
|
+
load = _useState2[0],
|
|
102
|
+
setLoad = _useState2[1];
|
|
103
|
+
var url = useMemo(function () {
|
|
104
|
+
return params && params.url && params.version ? "".concat(params.url, "/").concat(params.version) : 'https://iclientsimulator.test.tyro.com/iclient-v1.js';
|
|
105
|
+
}, [params]);
|
|
106
|
+
useEffect(function () {
|
|
107
|
+
loadjs(url, document.head).then(function () {
|
|
108
|
+
var _window5;
|
|
109
|
+
return (_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.TYRO;
|
|
110
|
+
}).then(function (res) {
|
|
111
|
+
setLoad(true);
|
|
112
|
+
ref.current = res;
|
|
113
|
+
}, function () {
|
|
114
|
+
setLoad(true);
|
|
115
|
+
});
|
|
116
|
+
}, [url]);
|
|
117
|
+
return [ref, load];
|
|
144
118
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default (function (_ref) {
|
|
3
|
+
var color = _ref.color;
|
|
4
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "24",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
11
|
+
d: "M18 17V19.4C18 19.9601 18 20.2401 17.891 20.454C17.7951 20.6422 17.6422 20.7951 17.454 20.891C17.2401 21 16.9601 21 16.4 21H7.6C7.03995 21 6.75992 21 6.54601 20.891C6.35785 20.7951 6.20487 20.6422 6.10899 20.454C6 20.2401 6 19.9601 6 19.4V17M6.8 17H17.2C18.8802 17 19.7202 17 20.362 16.673C20.9265 16.3854 21.3854 15.9265 21.673 15.362C22 14.7202 22 13.8802 22 12.2V7.8C22 6.11984 22 5.27976 21.673 4.63803C21.3854 4.07354 20.9265 3.6146 20.362 3.32698C19.7202 3 18.8802 3 17.2 3H6.8C5.11984 3 4.27976 3 3.63803 3.32698C3.07354 3.6146 2.6146 4.07354 2.32698 4.63803C2 5.27976 2 6.11984 2 7.8V12.2C2 13.8802 2 14.7202 2.32698 15.362C2.6146 15.9265 3.07354 16.3854 3.63803 16.673C4.27976 17 5.11984 17 6.8 17Z",
|
|
12
|
+
stroke: color || 'white',
|
|
13
|
+
"stroke-width": "1.67",
|
|
14
|
+
"stroke-linecap": "round",
|
|
15
|
+
"stroke-linejoin": "round"
|
|
16
|
+
})));
|
|
17
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default (function (_ref) {
|
|
3
|
+
var color = _ref.color;
|
|
4
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "24",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
11
|
+
d: "M18.5708 20C19.8328 20 20.8568 18.977 20.8568 17.714V13.143L21.9998 12L20.8568 10.857V6.286C20.8568 5.023 19.8338 4 18.5708 4M5.429 4C4.166 4 3.143 5.023 3.143 6.286V10.857L2 12L3.143 13.143V17.714C3.143 18.977 4.166 20 5.429 20M7.5 12H7.51M12 12H12.01M16.5 12H16.51M8 12C8 12.2761 7.77614 12.5 7.5 12.5C7.22386 12.5 7 12.2761 7 12C7 11.7239 7.22386 11.5 7.5 11.5C7.77614 11.5 8 11.7239 8 12ZM12.5 12C12.5 12.2761 12.2761 12.5 12 12.5C11.7239 12.5 11.5 12.2761 11.5 12C11.5 11.7239 11.7239 11.5 12 11.5C12.2761 11.5 12.5 11.7239 12.5 12ZM17 12C17 12.2761 16.7761 12.5 16.5 12.5C16.2239 12.5 16 12.2761 16 12C16 11.7239 16.2239 11.5 16.5 11.5C16.7761 11.5 17 11.7239 17 12Z"
|
|
12
|
+
// stroke="#98A2B3"
|
|
13
|
+
,
|
|
14
|
+
stroke: color || 'white',
|
|
15
|
+
"stroke-width": "1.67",
|
|
16
|
+
"stroke-linecap": "round",
|
|
17
|
+
"stroke-linejoin": "round"
|
|
18
|
+
})));
|
|
19
|
+
});
|
|
@@ -6,10 +6,20 @@ interface PosProps {
|
|
|
6
6
|
type: Eftpos;
|
|
7
7
|
/** 厂商名称 */
|
|
8
8
|
name: string;
|
|
9
|
+
/** 厂商额外信息 */
|
|
10
|
+
config: {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
9
13
|
/** 编辑页面zIndex */
|
|
10
14
|
zIndex?: number;
|
|
11
15
|
/** table 列表宽度 */
|
|
12
16
|
tableSize: number[];
|
|
17
|
+
/** tyro sdk url */
|
|
18
|
+
tyroUrl: string;
|
|
19
|
+
/** tyro sdk version */
|
|
20
|
+
tyroVersion: string;
|
|
21
|
+
/** tyro log 是否展示 */
|
|
22
|
+
useTyroLog?: boolean;
|
|
13
23
|
/** 获取字段匹配数据项 */
|
|
14
24
|
getComm: (params: {
|
|
15
25
|
field: string;
|