@pisell/utils 3.0.6 → 3.0.7
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/arrayUtils.d.ts +23 -26
- package/es/arrayUtils.js +157 -97
- package/es/common/index.d.ts +5 -0
- package/es/common/index.js +5 -0
- package/es/common/stateHelper.d.ts +2 -6
- package/es/common/stateHelper.js +24 -22
- package/es/common/types.d.ts +10 -13
- package/es/common/types.js +1 -0
- package/es/componentStorage.d.ts +25 -27
- package/es/componentStorage.js +130 -94
- package/es/constants/index.js +9 -7
- package/es/date.js +53 -36
- package/es/document.js +67 -43
- package/es/escPosPrinter/EscPosPrinter.js +490 -353
- package/es/escPosPrinter/index.d.ts +9 -9
- package/es/escPosPrinter/index.js +52 -37
- package/es/firebase/config/index.js +54 -0
- package/es/firebase/index.js +232 -0
- package/es/format.d.ts +15 -12
- package/es/format.js +156 -89
- package/es/image.js +60 -48
- package/es/index.d.ts +24 -39
- package/es/index.js +35 -40
- package/es/jsBridge/index.d.ts +4 -8
- package/es/jsBridge/index.js +55 -56
- package/es/jsBridge/regDeviceApi.js +126 -87
- package/es/jsBridge/types.d.ts +115 -95
- package/es/jsBridge/types.js +1 -0
- package/es/locales.d.ts +8 -11
- package/es/locales.js +96 -77
- package/es/log.d.ts +6 -11
- package/es/log.js +59 -37
- package/es/miniRedux.d.ts +13 -20
- package/es/miniRedux.js +76 -42
- package/es/number-input/hooks/index.d.ts +4 -0
- package/es/number-input/hooks/index.js +5 -0
- package/es/number-input/hooks/useNumberInputState.d.ts +2 -6
- package/es/number-input/hooks/useNumberInputState.js +128 -71
- package/es/number-input/index.d.ts +14 -0
- package/es/number-input/index.js +21 -0
- package/es/number-input/types.d.ts +88 -88
- package/es/number-input/types.js +1 -0
- package/es/number-input/utils/formatter.d.ts +10 -13
- package/es/number-input/utils/formatter.js +77 -51
- package/es/number-input/utils/index.d.ts +7 -0
- package/es/number-input/utils/index.js +8 -0
- package/es/number-input/utils/validation.d.ts +2 -7
- package/es/number-input/utils/validation.js +66 -51
- package/es/otherUtils.d.ts +9 -12
- package/es/otherUtils.js +129 -71
- package/es/platform.d.ts +9 -12
- package/es/platform.js +85 -61
- package/es/select/hooks/index.d.ts +5 -0
- package/es/select/hooks/index.js +6 -0
- package/es/select/hooks/useDebouncedSearch.d.ts +1 -4
- package/es/select/hooks/useDebouncedSearch.js +53 -39
- package/es/select/hooks/useSelectState.d.ts +7 -7
- package/es/select/hooks/useSelectState.js +113 -56
- package/es/select/index.d.ts +8 -7
- package/es/select/index.js +13 -0
- package/es/select/types.d.ts +211 -211
- package/es/select/types.js +1 -0
- package/es/select/utils/filterOptions.d.ts +6 -7
- package/es/select/utils/filterOptions.js +31 -26
- package/es/select/utils/helpers.d.ts +9 -10
- package/es/select/utils/helpers.js +52 -42
- package/es/select/utils/index.d.ts +7 -4
- package/es/select/utils/index.js +8 -0
- package/es/select/utils/sortOptions.d.ts +5 -6
- package/es/select/utils/sortOptions.js +31 -19
- package/es/select/utils/tagAggregation.d.ts +6 -6
- package/es/select/utils/tagAggregation.js +47 -34
- package/es/text-input/hooks/index.d.ts +4 -0
- package/es/text-input/hooks/index.js +5 -0
- package/es/text-input/hooks/useTextInputState.d.ts +2 -6
- package/es/text-input/hooks/useTextInputState.js +126 -69
- package/es/text-input/index.d.ts +14 -0
- package/es/text-input/index.js +20 -0
- package/es/text-input/types.d.ts +48 -48
- package/es/text-input/types.js +1 -0
- package/es/text-input/utils/index.d.ts +5 -0
- package/es/text-input/utils/index.js +7 -0
- package/es/text-input/utils/validation.d.ts +2 -7
- package/es/text-input/utils/validation.js +70 -50
- package/es/typeUtils.js +84 -61
- package/es/walletValidity.d.ts +42 -44
- package/es/walletValidity.js +557 -396
- package/es/weighing.d.ts +45 -48
- package/es/weighing.js +106 -83
- package/lib/arrayUtils.d.ts +23 -26
- package/lib/arrayUtils.js +111 -101
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +29 -0
- package/lib/common/stateHelper.d.ts +2 -6
- package/lib/common/stateHelper.js +32 -21
- package/lib/common/types.d.ts +10 -13
- package/lib/common/types.js +17 -0
- package/lib/componentStorage.d.ts +25 -27
- package/lib/componentStorage.js +126 -96
- package/lib/constants/index.js +36 -7
- package/lib/date.js +65 -43
- package/lib/document.js +62 -46
- package/lib/escPosPrinter/EscPosPrinter.js +403 -327
- package/lib/escPosPrinter/index.d.ts +9 -9
- package/lib/escPosPrinter/index.js +84 -38
- package/lib/firebase/config/index.js +79 -0
- package/lib/firebase/index.js +180 -0
- package/lib/format.d.ts +15 -12
- package/lib/format.js +133 -91
- package/lib/image.js +74 -48
- package/lib/index.d.ts +24 -39
- package/lib/index.js +80 -137
- package/lib/jsBridge/index.d.ts +4 -8
- package/lib/jsBridge/index.js +76 -57
- package/lib/jsBridge/regDeviceApi.js +133 -86
- package/lib/jsBridge/types.d.ts +115 -95
- package/lib/jsBridge/types.js +17 -0
- package/lib/locales.d.ts +8 -11
- package/lib/locales.js +90 -79
- package/lib/log.d.ts +6 -11
- package/lib/log.js +61 -37
- package/lib/miniRedux.d.ts +13 -20
- package/lib/miniRedux.js +89 -43
- package/lib/number-input/hooks/index.d.ts +4 -0
- package/lib/number-input/hooks/index.js +29 -0
- package/lib/number-input/hooks/useNumberInputState.d.ts +2 -6
- package/lib/number-input/hooks/useNumberInputState.js +81 -71
- package/lib/number-input/index.d.ts +14 -0
- package/lib/number-input/index.js +41 -0
- package/lib/number-input/types.d.ts +88 -88
- package/lib/number-input/types.js +17 -0
- package/lib/number-input/utils/formatter.d.ts +10 -13
- package/lib/number-input/utils/formatter.js +49 -52
- package/lib/number-input/utils/index.d.ts +7 -0
- package/lib/number-input/utils/index.js +39 -0
- package/lib/number-input/utils/validation.d.ts +2 -7
- package/lib/number-input/utils/validation.js +52 -50
- package/lib/otherUtils.d.ts +9 -12
- package/lib/otherUtils.js +98 -86
- package/lib/platform.d.ts +9 -12
- package/lib/platform.js +123 -68
- package/lib/select/hooks/index.d.ts +5 -0
- package/lib/select/hooks/index.js +34 -0
- package/lib/select/hooks/useDebouncedSearch.d.ts +1 -4
- package/lib/select/hooks/useDebouncedSearch.js +41 -40
- package/lib/select/hooks/useSelectState.d.ts +7 -7
- package/lib/select/hooks/useSelectState.js +93 -58
- package/lib/select/index.d.ts +8 -7
- package/lib/select/index.js +53 -0
- package/lib/select/types.d.ts +211 -211
- package/lib/select/types.js +17 -0
- package/lib/select/utils/filterOptions.d.ts +6 -7
- package/lib/select/utils/filterOptions.js +37 -26
- package/lib/select/utils/helpers.d.ts +9 -10
- package/lib/select/utils/helpers.js +41 -45
- package/lib/select/utils/index.d.ts +7 -4
- package/lib/select/utils/index.js +48 -0
- package/lib/select/utils/sortOptions.d.ts +5 -6
- package/lib/select/utils/sortOptions.js +39 -18
- package/lib/select/utils/tagAggregation.d.ts +6 -6
- package/lib/select/utils/tagAggregation.js +41 -33
- package/lib/text-input/hooks/index.d.ts +4 -0
- package/lib/text-input/hooks/index.js +29 -0
- package/lib/text-input/hooks/useTextInputState.d.ts +2 -6
- package/lib/text-input/hooks/useTextInputState.js +79 -69
- package/lib/text-input/index.d.ts +14 -0
- package/lib/text-input/index.js +35 -0
- package/lib/text-input/types.d.ts +48 -48
- package/lib/text-input/types.js +17 -0
- package/lib/text-input/utils/index.d.ts +5 -0
- package/lib/text-input/utils/index.js +32 -0
- package/lib/text-input/utils/validation.d.ts +2 -7
- package/lib/text-input/utils/validation.js +58 -49
- package/lib/typeUtils.js +73 -68
- package/lib/walletValidity.d.ts +42 -44
- package/lib/walletValidity.js +393 -410
- package/lib/weighing.d.ts +45 -48
- package/lib/weighing.js +149 -104
- package/package.json +1 -1
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -11
- package/es/date.d.ts +0 -31
- package/es/document.d.ts +0 -16
- package/es/image.d.ts +0 -14
- package/es/typeUtils.d.ts +0 -45
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -16
- package/lib/_virtual/_rolldown/runtime.js +0 -23
- package/lib/date.d.ts +0 -31
- package/lib/document.d.ts +0 -16
- package/lib/image.d.ts +0 -14
- package/lib/typeUtils.d.ts +0 -45
package/es/jsBridge/index.js
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
|
-
import regDeviceApi from "./regDeviceApi
|
|
2
|
-
//#region src/jsBridge/index.ts
|
|
1
|
+
import regDeviceApi from "./regDeviceApi";
|
|
3
2
|
/**
|
|
4
|
-
* webView页面中调用打印机打印
|
|
5
|
-
* 此api暂时只支持native app平台下ios手机
|
|
6
|
-
* @param params
|
|
7
|
-
* @param callback
|
|
8
|
-
*/
|
|
9
|
-
function webPrint(params,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
* webView页面中调用打印机打印
|
|
4
|
+
* 此api暂时只支持native app平台下ios手机
|
|
5
|
+
* @param params
|
|
6
|
+
* @param callback
|
|
7
|
+
*/
|
|
8
|
+
export function webPrint(params, _callback, onError) {
|
|
9
|
+
regDeviceApi().then(function (jsBridge) {
|
|
10
|
+
jsBridge.callDeviceApi({
|
|
11
|
+
apiName: 'webPrint',
|
|
12
|
+
params: params,
|
|
13
|
+
callback: function callback() {
|
|
14
|
+
_callback && _callback.apply(void 0, arguments);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}).catch(function (err) {
|
|
18
|
+
onError === null || onError === void 0 || onError(err);
|
|
19
|
+
console.error('webPrint', err);
|
|
20
|
+
});
|
|
22
21
|
}
|
|
22
|
+
|
|
23
23
|
/**
|
|
24
|
-
* webView页面中调用APP内的数据
|
|
25
|
-
* 此api暂时只支持native app平台下ios手机
|
|
26
|
-
* @param params
|
|
27
|
-
* @param callback
|
|
28
|
-
*/
|
|
29
|
-
function dataManager(params,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
* webView页面中调用APP内的数据
|
|
25
|
+
* 此api暂时只支持native app平台下ios手机
|
|
26
|
+
* @param params
|
|
27
|
+
* @param callback
|
|
28
|
+
*/
|
|
29
|
+
export function dataManager(params, _callback2, onError) {
|
|
30
|
+
regDeviceApi().then(function (jsBridge) {
|
|
31
|
+
jsBridge.callDeviceApi({
|
|
32
|
+
apiName: 'dataManager',
|
|
33
|
+
params: params,
|
|
34
|
+
callback: function callback() {
|
|
35
|
+
_callback2 && _callback2.apply(void 0, arguments);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}).catch(onError);
|
|
39
39
|
}
|
|
40
|
+
|
|
40
41
|
/**
|
|
41
|
-
* webView页面中调用APP内的支付
|
|
42
|
-
* 此api暂时只支持native app平台下ios
|
|
43
|
-
* @param params
|
|
44
|
-
* @param callback
|
|
45
|
-
*/
|
|
46
|
-
function webPayment(params,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { dataManager, webPayment, webPrint };
|
|
42
|
+
* webView页面中调用APP内的支付
|
|
43
|
+
* 此api暂时只支持native app平台下ios
|
|
44
|
+
* @param params
|
|
45
|
+
* @param callback
|
|
46
|
+
*/
|
|
47
|
+
export function webPayment(params, _callback3, onError) {
|
|
48
|
+
regDeviceApi().then(function (jsBridge) {
|
|
49
|
+
jsBridge.callDeviceApi({
|
|
50
|
+
apiName: 'webPayment',
|
|
51
|
+
params: params,
|
|
52
|
+
callback: function callback() {
|
|
53
|
+
_callback3 && _callback3.apply(void 0, arguments);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}).catch(function (err) {
|
|
57
|
+
onError === null || onError === void 0 || onError(err);
|
|
58
|
+
console.error('webPayment', err);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -1,94 +1,133 @@
|
|
|
1
|
-
import { isAndroid, isIos } from "../platform
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let composedBridge;
|
|
1
|
+
import { isAndroid, isIos } from "../platform";
|
|
2
|
+
var androidRegStatus = false;
|
|
3
|
+
var iosRegStatus = false;
|
|
4
|
+
var androidBridge;
|
|
5
|
+
var iosBridge;
|
|
6
|
+
var composedBridge;
|
|
8
7
|
function regIosJsBridge(callback) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
if (window.WebViewJavascriptBridge) {
|
|
9
|
+
callback(window.WebViewJavascriptBridge);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (window.WVJBCallbacks) {
|
|
13
|
+
window.WVJBCallbacks.push(callback);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
window.WVJBCallbacks = [callback];
|
|
17
|
+
var WVJBIframe = document.createElement('iframe');
|
|
18
|
+
WVJBIframe.style.display = 'none';
|
|
19
|
+
WVJBIframe.src = 'https://__bridge_loaded__';
|
|
20
|
+
document.documentElement && document.documentElement.appendChild(WVJBIframe);
|
|
21
|
+
setTimeout(function () {
|
|
22
|
+
try {
|
|
23
|
+
document.documentElement && document.documentElement.removeChild(WVJBIframe);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
console.log(e);
|
|
26
|
+
}
|
|
27
|
+
}, 0);
|
|
29
28
|
}
|
|
30
29
|
function regAndroidJsBridge(extraInit) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
if (window._jsBridge) {
|
|
31
|
+
extraInit(window._jsBridge);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
document.addEventListener('WebViewJavascriptBridgeReady', function (event) {
|
|
35
|
+
var bridge = event.bridge;
|
|
36
|
+
window._jsBridge = bridge;
|
|
37
|
+
if (!bridge) return;
|
|
38
|
+
// 这段代码不能删除
|
|
39
|
+
bridge.init(function (message, responseCallback) {
|
|
40
|
+
if (responseCallback) {
|
|
41
|
+
responseCallback('init responseCallback');
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
extraInit(bridge);
|
|
45
|
+
}, false);
|
|
44
46
|
}
|
|
47
|
+
|
|
45
48
|
/**
|
|
46
|
-
* 通用jsBridge
|
|
47
|
-
* @param deviceType
|
|
48
|
-
*/
|
|
49
|
+
* 通用jsBridge
|
|
50
|
+
* @param deviceType
|
|
51
|
+
*/
|
|
49
52
|
function getComposedBridge(deviceType) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
53
|
+
if (composedBridge) {
|
|
54
|
+
return composedBridge;
|
|
55
|
+
}
|
|
56
|
+
composedBridge = {
|
|
57
|
+
// 主动调用设备的方法
|
|
58
|
+
callDeviceApi: function callDeviceApi(_ref) {
|
|
59
|
+
var apiName = _ref.apiName,
|
|
60
|
+
inCb = _ref.callback,
|
|
61
|
+
_ref$params = _ref.params,
|
|
62
|
+
params = _ref$params === void 0 ? {} : _ref$params,
|
|
63
|
+
onError = _ref.onError;
|
|
64
|
+
var callback = function callback(res) {
|
|
65
|
+
var result = res;
|
|
66
|
+
try {
|
|
67
|
+
result = JSON.parse(res);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.log("error ".concat(apiName), error);
|
|
70
|
+
}
|
|
71
|
+
// if (result.code || result.code === 0) {
|
|
72
|
+
// // 强转字符串,兼容安卓的number
|
|
73
|
+
// result.code = `${result.code}`;
|
|
74
|
+
// }
|
|
75
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
76
|
+
args[_key - 1] = arguments[_key];
|
|
77
|
+
}
|
|
78
|
+
inCb.apply(void 0, [result].concat(args));
|
|
79
|
+
};
|
|
80
|
+
if (deviceType === 'iphone') {
|
|
81
|
+
iosBridge.callHandler(apiName, params, callback, function (e) {
|
|
82
|
+
console.log(e, '--- 调用ios api报错:', apiName);
|
|
83
|
+
if (onError) {
|
|
84
|
+
onError(e);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} else if (deviceType === 'android') {
|
|
88
|
+
var res = androidBridge.callHandler(apiName, JSON.stringify(params));
|
|
89
|
+
callback(res);
|
|
90
|
+
} else {
|
|
91
|
+
console.log('--- 没获取到js bridge ---');
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// 被设备调用的方法
|
|
95
|
+
calledByDevice: function calledByDevice(_ref2) {
|
|
96
|
+
var apiName = _ref2.apiName,
|
|
97
|
+
callback = _ref2.callback;
|
|
98
|
+
if (deviceType === 'iphone') {
|
|
99
|
+
iosBridge.registerHandler(apiName, callback);
|
|
100
|
+
} else if (deviceType === 'android') {
|
|
101
|
+
androidBridge.registerHandler(apiName, callback);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return composedBridge;
|
|
75
106
|
}
|
|
76
|
-
function regDeviceApi() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
107
|
+
export default function regDeviceApi() {
|
|
108
|
+
return new Promise(function (resolve, reject) {
|
|
109
|
+
if (isIos() && !iosRegStatus) {
|
|
110
|
+
regIosJsBridge(function (bridge) {
|
|
111
|
+
iosRegStatus = true;
|
|
112
|
+
iosBridge = bridge;
|
|
113
|
+
var realBridge = getComposedBridge('iphone');
|
|
114
|
+
resolve(realBridge);
|
|
115
|
+
});
|
|
116
|
+
} else if (isIos() && iosRegStatus) {
|
|
117
|
+
var realBridge = getComposedBridge('iphone');
|
|
118
|
+
resolve(realBridge);
|
|
119
|
+
} else if (isAndroid() && !androidRegStatus) {
|
|
120
|
+
regAndroidJsBridge(function (bridge) {
|
|
121
|
+
androidBridge = bridge;
|
|
122
|
+
androidRegStatus = true;
|
|
123
|
+
var realBridge = getComposedBridge('android');
|
|
124
|
+
resolve(realBridge);
|
|
125
|
+
});
|
|
126
|
+
} else if (isAndroid() && androidRegStatus) {
|
|
127
|
+
var _realBridge = getComposedBridge('android');
|
|
128
|
+
resolve(_realBridge);
|
|
129
|
+
} else {
|
|
130
|
+
reject();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
package/es/jsBridge/types.d.ts
CHANGED
|
@@ -1,129 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
zh_HK: number;
|
|
1
|
+
declare type LanguageNumber = {
|
|
2
|
+
en: number;
|
|
3
|
+
zh_CN: number;
|
|
4
|
+
zh_HK: number;
|
|
6
5
|
};
|
|
7
|
-
type LanguageString = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
declare type LanguageString = {
|
|
7
|
+
en: string;
|
|
8
|
+
zh_CN: string;
|
|
9
|
+
zh_HK: string;
|
|
11
10
|
} | string;
|
|
12
11
|
/**
|
|
13
12
|
* 打印小票
|
|
14
13
|
*/
|
|
15
|
-
type WebPrint0 = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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;
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
29
30
|
* 打印ITS备货单/划菜单
|
|
30
31
|
*/
|
|
31
|
-
type WebPrint1 = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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;
|
|
55
68
|
};
|
|
56
69
|
/**
|
|
57
70
|
* 打印手环
|
|
58
71
|
*/
|
|
59
|
-
type WebPrint2 = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
+
};
|
|
79
100
|
};
|
|
80
101
|
/**
|
|
81
102
|
* 打印充值卡
|
|
82
103
|
*/
|
|
83
|
-
type WebPrint4 = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
104
|
+
export declare type WebPrint4 = {
|
|
105
|
+
type: '4';
|
|
106
|
+
data: {
|
|
107
|
+
order_id: string;
|
|
108
|
+
};
|
|
88
109
|
};
|
|
89
110
|
/**
|
|
90
111
|
* 打印订单中所有
|
|
91
112
|
*/
|
|
92
|
-
type WebPrint99 = {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
};
|
|
101
123
|
};
|
|
102
|
-
};
|
|
103
124
|
};
|
|
104
125
|
/**
|
|
105
126
|
* 打印
|
|
106
127
|
*/
|
|
107
|
-
type WebPrintParams = WebPrint0 | WebPrint1 | WebPrint2 | WebPrint4 | WebPrint99;
|
|
128
|
+
export declare type WebPrintParams = WebPrint0 | WebPrint1 | WebPrint2 | WebPrint4 | WebPrint99;
|
|
108
129
|
/**
|
|
109
130
|
* 数据管理
|
|
110
131
|
*/
|
|
111
|
-
type DataManagerParams = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
export declare type DataManagerParams = {
|
|
133
|
+
module: 'set' | 'get';
|
|
134
|
+
key: string;
|
|
135
|
+
data?: any;
|
|
115
136
|
};
|
|
116
137
|
/**
|
|
117
138
|
* 支付
|
|
118
139
|
*/
|
|
119
|
-
type WebPaymentParams = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
+
};
|
|
127
148
|
};
|
|
128
|
-
|
|
129
|
-
export { DataManagerParams, WebPaymentParams, WebPrintParams };
|
|
149
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/locales.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
formatLocale: (_locale: string) => string;
|
|
1
|
+
export declare const locales: {
|
|
2
|
+
init: (_localeMaps: any, _locale: string) => void;
|
|
3
|
+
getText: (id: string) => any;
|
|
4
|
+
getLocale: () => string;
|
|
5
|
+
locale: string;
|
|
6
|
+
localeMap: any;
|
|
7
|
+
localeMaps: any;
|
|
8
|
+
formatLocale: (_locale: string) => string;
|
|
10
9
|
};
|
|
11
|
-
//#endregion
|
|
12
|
-
export { locales };
|