@pisell/utils 1.0.50 → 1.0.52
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/es/jsBridge/index.js +29 -14
- package/es/jsBridge/types.d.ts +149 -0
- package/es/jsBridge/types.js +1 -0
- package/es/locales.js +0 -1
- package/lib/jsBridge/index.js +21 -3
- package/lib/jsBridge/types.d.ts +149 -0
- package/lib/jsBridge/types.js +17 -0
- package/lib/locales.js +0 -1
- package/package.json +1 -1
- package/es/constants/index.d.ts +0 -7
- package/es/locales.d.ts +0 -12
- package/lib/constants/index.d.ts +0 -7
- package/lib/locales.d.ts +0 -12
package/es/jsBridge/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import regDeviceApi from "./regDeviceApi";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 打印小票
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 打印ITS备货单/划菜单
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
2
|
/**
|
|
12
3
|
* webView页面中调用打印机打印
|
|
13
4
|
* 此api暂时只支持native app平台下ios手机
|
|
@@ -15,17 +6,20 @@ import regDeviceApi from "./regDeviceApi";
|
|
|
15
6
|
* @param callback
|
|
16
7
|
*/
|
|
17
8
|
export function webPrint(params, _callback, onError) {
|
|
18
|
-
regDeviceApi(
|
|
9
|
+
regDeviceApi().then(function (jsBridge) {
|
|
19
10
|
jsBridge.callDeviceApi({
|
|
20
|
-
apiName:
|
|
11
|
+
apiName: 'webPrint',
|
|
21
12
|
params: params,
|
|
22
13
|
callback: function callback() {
|
|
23
14
|
_callback && _callback.apply(void 0, arguments);
|
|
24
|
-
}
|
|
25
|
-
onError: onError
|
|
15
|
+
}
|
|
26
16
|
});
|
|
17
|
+
}).catch(function (err) {
|
|
18
|
+
onError === null || onError === void 0 || onError(err);
|
|
19
|
+
console.error('webPrint', err);
|
|
27
20
|
});
|
|
28
21
|
}
|
|
22
|
+
|
|
29
23
|
/**
|
|
30
24
|
* webView页面中调用APP内的数据
|
|
31
25
|
* 此api暂时只支持native app平台下ios手机
|
|
@@ -35,7 +29,7 @@ export function webPrint(params, _callback, onError) {
|
|
|
35
29
|
export function dataManager(params, _callback2, onError) {
|
|
36
30
|
regDeviceApi().then(function (jsBridge) {
|
|
37
31
|
jsBridge.callDeviceApi({
|
|
38
|
-
apiName:
|
|
32
|
+
apiName: 'dataManager',
|
|
39
33
|
params: params,
|
|
40
34
|
callback: function callback() {
|
|
41
35
|
_callback2 && _callback2.apply(void 0, arguments);
|
|
@@ -43,4 +37,25 @@ export function dataManager(params, _callback2, onError) {
|
|
|
43
37
|
onError: onError
|
|
44
38
|
});
|
|
45
39
|
}).catch(onError);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* webView页面中调用APP内的支付
|
|
44
|
+
* 此api暂时只支持native app平台下ios
|
|
45
|
+
* @param params
|
|
46
|
+
* @param callback
|
|
47
|
+
*/
|
|
48
|
+
export function webPayment(params, _callback3, onError) {
|
|
49
|
+
regDeviceApi().then(function (jsBridge) {
|
|
50
|
+
jsBridge.callDeviceApi({
|
|
51
|
+
apiName: 'webPayment',
|
|
52
|
+
params: params,
|
|
53
|
+
callback: function callback() {
|
|
54
|
+
_callback3 && _callback3.apply(void 0, arguments);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}).catch(function (err) {
|
|
58
|
+
onError === null || onError === void 0 || onError(err);
|
|
59
|
+
console.error('webPayment', err);
|
|
60
|
+
});
|
|
46
61
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
declare type LanguageNumber = {
|
|
2
|
+
en: number;
|
|
3
|
+
zh_CN: number;
|
|
4
|
+
zh_HK: number;
|
|
5
|
+
};
|
|
6
|
+
declare type LanguageString = {
|
|
7
|
+
en: string;
|
|
8
|
+
zh_CN: string;
|
|
9
|
+
zh_HK: string;
|
|
10
|
+
} | string;
|
|
11
|
+
/**
|
|
12
|
+
* 打印小票
|
|
13
|
+
*/
|
|
14
|
+
export declare type WebPrint0 = {
|
|
15
|
+
/**
|
|
16
|
+
* 打印类型
|
|
17
|
+
* 0: 小票
|
|
18
|
+
* 1:ITS备货单/划菜单
|
|
19
|
+
* 2:手环
|
|
20
|
+
*/
|
|
21
|
+
type: '0';
|
|
22
|
+
data: {
|
|
23
|
+
/** 订单ID */
|
|
24
|
+
order_id: string;
|
|
25
|
+
};
|
|
26
|
+
/** 打印语言对应的数量 */
|
|
27
|
+
language: LanguageNumber;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 打印ITS备货单/划菜单
|
|
31
|
+
*/
|
|
32
|
+
export declare type WebPrint1 = {
|
|
33
|
+
/**
|
|
34
|
+
* 打印类型
|
|
35
|
+
* 0: 小票
|
|
36
|
+
* 1:ITS备货单/划菜单
|
|
37
|
+
* 2:手环
|
|
38
|
+
*/
|
|
39
|
+
type: '1';
|
|
40
|
+
data: {
|
|
41
|
+
/** 0:备货 1:划单 */
|
|
42
|
+
mode: '0' | '1';
|
|
43
|
+
resource: LanguageString;
|
|
44
|
+
/** 订单备注 */
|
|
45
|
+
order_note: string;
|
|
46
|
+
/** 订单时间或商品下单时间 */
|
|
47
|
+
time: string;
|
|
48
|
+
/** 订单编号 */
|
|
49
|
+
order_number?: string;
|
|
50
|
+
/** 商品 */
|
|
51
|
+
products: {
|
|
52
|
+
/** 商品名称 */
|
|
53
|
+
product_title: LanguageString;
|
|
54
|
+
/** 商品规格 */
|
|
55
|
+
product_option_string: LanguageString;
|
|
56
|
+
/** 商品备注 */
|
|
57
|
+
product_note: string;
|
|
58
|
+
/** 商品数量 */
|
|
59
|
+
product_quantity: number;
|
|
60
|
+
/** 加菜标识 待定 */
|
|
61
|
+
is_append?: boolean;
|
|
62
|
+
/** 退菜标识 待定 */
|
|
63
|
+
is_removed?: boolean;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
/** 打印语言对应的数量 */
|
|
67
|
+
language: LanguageNumber;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* 打印手环
|
|
71
|
+
*/
|
|
72
|
+
export declare type WebPrint2 = {
|
|
73
|
+
/**
|
|
74
|
+
* 打印类型
|
|
75
|
+
* 0: 小票
|
|
76
|
+
* 1:ITS备货单/划菜单
|
|
77
|
+
* 2:手环
|
|
78
|
+
*/
|
|
79
|
+
type: '2';
|
|
80
|
+
data: {
|
|
81
|
+
/** 0: 普通票 1:成人票 2:免费成人票 */
|
|
82
|
+
type: '0' | '1' | '2';
|
|
83
|
+
/** 发行编码 */
|
|
84
|
+
encoded: string;
|
|
85
|
+
/** 编码 */
|
|
86
|
+
code: string;
|
|
87
|
+
/** 到期时间 */
|
|
88
|
+
expire_date: string;
|
|
89
|
+
areas: {
|
|
90
|
+
/** 区域名字 */
|
|
91
|
+
area_name: string;
|
|
92
|
+
/** 区域代码 */
|
|
93
|
+
area_code: string;
|
|
94
|
+
/** 可用次数 */
|
|
95
|
+
limit_num: number;
|
|
96
|
+
/** 已用次数 */
|
|
97
|
+
used_num: number;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 打印充值卡
|
|
103
|
+
*/
|
|
104
|
+
export declare type WebPrint4 = {
|
|
105
|
+
type: '4';
|
|
106
|
+
data: {
|
|
107
|
+
order_id: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* 打印订单中所有
|
|
112
|
+
*/
|
|
113
|
+
export declare type WebPrint99 = {
|
|
114
|
+
type: '99';
|
|
115
|
+
data: {
|
|
116
|
+
order_id: string;
|
|
117
|
+
machine_code_print_info: {
|
|
118
|
+
[key: string]: any;
|
|
119
|
+
}[];
|
|
120
|
+
small_ticket_data: {
|
|
121
|
+
[key: string]: any;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* 打印
|
|
127
|
+
*/
|
|
128
|
+
export declare type WebPrintParams = WebPrint0 | WebPrint1 | WebPrint2 | WebPrint4 | WebPrint99;
|
|
129
|
+
/**
|
|
130
|
+
* 数据管理
|
|
131
|
+
*/
|
|
132
|
+
export declare type DataManagerParams = {
|
|
133
|
+
module: 'set' | 'get';
|
|
134
|
+
key: string;
|
|
135
|
+
data?: any;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* 支付
|
|
139
|
+
*/
|
|
140
|
+
export declare type WebPaymentParams = {
|
|
141
|
+
module: 'payment' | 'refund' | string;
|
|
142
|
+
key: 'mx51' | string;
|
|
143
|
+
data?: {
|
|
144
|
+
order_id: string | number;
|
|
145
|
+
amount: string | number;
|
|
146
|
+
surcharge?: string | number;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/locales.js
CHANGED
package/lib/jsBridge/index.js
CHANGED
|
@@ -30,20 +30,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var jsBridge_exports = {};
|
|
31
31
|
__export(jsBridge_exports, {
|
|
32
32
|
dataManager: () => dataManager,
|
|
33
|
+
webPayment: () => webPayment,
|
|
33
34
|
webPrint: () => webPrint
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(jsBridge_exports);
|
|
36
37
|
var import_regDeviceApi = __toESM(require("./regDeviceApi"));
|
|
37
38
|
function webPrint(params, callback, onError) {
|
|
38
|
-
(0, import_regDeviceApi.default)(
|
|
39
|
+
(0, import_regDeviceApi.default)().then((jsBridge) => {
|
|
39
40
|
jsBridge.callDeviceApi({
|
|
40
41
|
apiName: "webPrint",
|
|
41
42
|
params,
|
|
42
43
|
callback: (...arg) => {
|
|
43
44
|
callback && callback(...arg);
|
|
44
|
-
}
|
|
45
|
-
onError
|
|
45
|
+
}
|
|
46
46
|
});
|
|
47
|
+
}).catch((err) => {
|
|
48
|
+
onError == null ? void 0 : onError(err);
|
|
49
|
+
console.error("webPrint", err);
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
52
|
function dataManager(params, callback, onError) {
|
|
@@ -58,8 +61,23 @@ function dataManager(params, callback, onError) {
|
|
|
58
61
|
});
|
|
59
62
|
}).catch(onError);
|
|
60
63
|
}
|
|
64
|
+
function webPayment(params, callback, onError) {
|
|
65
|
+
(0, import_regDeviceApi.default)().then((jsBridge) => {
|
|
66
|
+
jsBridge.callDeviceApi({
|
|
67
|
+
apiName: "webPayment",
|
|
68
|
+
params,
|
|
69
|
+
callback: (...arg) => {
|
|
70
|
+
callback && callback(...arg);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}).catch((err) => {
|
|
74
|
+
onError == null ? void 0 : onError(err);
|
|
75
|
+
console.error("webPayment", err);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
61
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
79
|
0 && (module.exports = {
|
|
63
80
|
dataManager,
|
|
81
|
+
webPayment,
|
|
64
82
|
webPrint
|
|
65
83
|
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
declare type LanguageNumber = {
|
|
2
|
+
en: number;
|
|
3
|
+
zh_CN: number;
|
|
4
|
+
zh_HK: number;
|
|
5
|
+
};
|
|
6
|
+
declare type LanguageString = {
|
|
7
|
+
en: string;
|
|
8
|
+
zh_CN: string;
|
|
9
|
+
zh_HK: string;
|
|
10
|
+
} | string;
|
|
11
|
+
/**
|
|
12
|
+
* 打印小票
|
|
13
|
+
*/
|
|
14
|
+
export declare type WebPrint0 = {
|
|
15
|
+
/**
|
|
16
|
+
* 打印类型
|
|
17
|
+
* 0: 小票
|
|
18
|
+
* 1:ITS备货单/划菜单
|
|
19
|
+
* 2:手环
|
|
20
|
+
*/
|
|
21
|
+
type: '0';
|
|
22
|
+
data: {
|
|
23
|
+
/** 订单ID */
|
|
24
|
+
order_id: string;
|
|
25
|
+
};
|
|
26
|
+
/** 打印语言对应的数量 */
|
|
27
|
+
language: LanguageNumber;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 打印ITS备货单/划菜单
|
|
31
|
+
*/
|
|
32
|
+
export declare type WebPrint1 = {
|
|
33
|
+
/**
|
|
34
|
+
* 打印类型
|
|
35
|
+
* 0: 小票
|
|
36
|
+
* 1:ITS备货单/划菜单
|
|
37
|
+
* 2:手环
|
|
38
|
+
*/
|
|
39
|
+
type: '1';
|
|
40
|
+
data: {
|
|
41
|
+
/** 0:备货 1:划单 */
|
|
42
|
+
mode: '0' | '1';
|
|
43
|
+
resource: LanguageString;
|
|
44
|
+
/** 订单备注 */
|
|
45
|
+
order_note: string;
|
|
46
|
+
/** 订单时间或商品下单时间 */
|
|
47
|
+
time: string;
|
|
48
|
+
/** 订单编号 */
|
|
49
|
+
order_number?: string;
|
|
50
|
+
/** 商品 */
|
|
51
|
+
products: {
|
|
52
|
+
/** 商品名称 */
|
|
53
|
+
product_title: LanguageString;
|
|
54
|
+
/** 商品规格 */
|
|
55
|
+
product_option_string: LanguageString;
|
|
56
|
+
/** 商品备注 */
|
|
57
|
+
product_note: string;
|
|
58
|
+
/** 商品数量 */
|
|
59
|
+
product_quantity: number;
|
|
60
|
+
/** 加菜标识 待定 */
|
|
61
|
+
is_append?: boolean;
|
|
62
|
+
/** 退菜标识 待定 */
|
|
63
|
+
is_removed?: boolean;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
/** 打印语言对应的数量 */
|
|
67
|
+
language: LanguageNumber;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* 打印手环
|
|
71
|
+
*/
|
|
72
|
+
export declare type WebPrint2 = {
|
|
73
|
+
/**
|
|
74
|
+
* 打印类型
|
|
75
|
+
* 0: 小票
|
|
76
|
+
* 1:ITS备货单/划菜单
|
|
77
|
+
* 2:手环
|
|
78
|
+
*/
|
|
79
|
+
type: '2';
|
|
80
|
+
data: {
|
|
81
|
+
/** 0: 普通票 1:成人票 2:免费成人票 */
|
|
82
|
+
type: '0' | '1' | '2';
|
|
83
|
+
/** 发行编码 */
|
|
84
|
+
encoded: string;
|
|
85
|
+
/** 编码 */
|
|
86
|
+
code: string;
|
|
87
|
+
/** 到期时间 */
|
|
88
|
+
expire_date: string;
|
|
89
|
+
areas: {
|
|
90
|
+
/** 区域名字 */
|
|
91
|
+
area_name: string;
|
|
92
|
+
/** 区域代码 */
|
|
93
|
+
area_code: string;
|
|
94
|
+
/** 可用次数 */
|
|
95
|
+
limit_num: number;
|
|
96
|
+
/** 已用次数 */
|
|
97
|
+
used_num: number;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 打印充值卡
|
|
103
|
+
*/
|
|
104
|
+
export declare type WebPrint4 = {
|
|
105
|
+
type: '4';
|
|
106
|
+
data: {
|
|
107
|
+
order_id: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* 打印订单中所有
|
|
112
|
+
*/
|
|
113
|
+
export declare type WebPrint99 = {
|
|
114
|
+
type: '99';
|
|
115
|
+
data: {
|
|
116
|
+
order_id: string;
|
|
117
|
+
machine_code_print_info: {
|
|
118
|
+
[key: string]: any;
|
|
119
|
+
}[];
|
|
120
|
+
small_ticket_data: {
|
|
121
|
+
[key: string]: any;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* 打印
|
|
127
|
+
*/
|
|
128
|
+
export declare type WebPrintParams = WebPrint0 | WebPrint1 | WebPrint2 | WebPrint4 | WebPrint99;
|
|
129
|
+
/**
|
|
130
|
+
* 数据管理
|
|
131
|
+
*/
|
|
132
|
+
export declare type DataManagerParams = {
|
|
133
|
+
module: 'set' | 'get';
|
|
134
|
+
key: string;
|
|
135
|
+
data?: any;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* 支付
|
|
139
|
+
*/
|
|
140
|
+
export declare type WebPaymentParams = {
|
|
141
|
+
module: 'payment' | 'refund' | string;
|
|
142
|
+
key: 'mx51' | string;
|
|
143
|
+
data?: {
|
|
144
|
+
order_id: string | number;
|
|
145
|
+
amount: string | number;
|
|
146
|
+
surcharge?: string | number;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/jsBridge/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
package/lib/locales.js
CHANGED
package/package.json
CHANGED
package/es/constants/index.d.ts
DELETED
package/es/locales.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const locales: {
|
|
2
|
-
init: (_localeMaps: any, _locale: string) => void;
|
|
3
|
-
getText: (id: string) => any;
|
|
4
|
-
locale: string;
|
|
5
|
-
localeMap: any;
|
|
6
|
-
localeMaps: {
|
|
7
|
-
en: {};
|
|
8
|
-
'zh-CN': {};
|
|
9
|
-
'zh-HK': {};
|
|
10
|
-
};
|
|
11
|
-
formatLocale: (_locale: string) => string;
|
|
12
|
-
};
|
package/lib/constants/index.d.ts
DELETED
package/lib/locales.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const locales: {
|
|
2
|
-
init: (_localeMaps: any, _locale: string) => void;
|
|
3
|
-
getText: (id: string) => any;
|
|
4
|
-
locale: string;
|
|
5
|
-
localeMap: any;
|
|
6
|
-
localeMaps: {
|
|
7
|
-
en: {};
|
|
8
|
-
'zh-CN': {};
|
|
9
|
-
'zh-HK': {};
|
|
10
|
-
};
|
|
11
|
-
formatLocale: (_locale: string) => string;
|
|
12
|
-
};
|