@pisell/utils 1.0.49 → 1.0.51

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.
@@ -0,0 +1,22 @@
1
+ import { WebPrintParams, DataManagerParams, WebPaymentParams } from './types';
2
+ /**
3
+ * webView页面中调用打印机打印
4
+ * 此api暂时只支持native app平台下ios手机
5
+ * @param params
6
+ * @param callback
7
+ */
8
+ export declare function webPrint(params: WebPrintParams, callback: (...arg: any) => void, onError?: (error: any) => void): void;
9
+ /**
10
+ * webView页面中调用APP内的数据
11
+ * 此api暂时只支持native app平台下ios手机
12
+ * @param params
13
+ * @param callback
14
+ */
15
+ export declare function dataManager(params: DataManagerParams, callback: (...arg: any) => void, onError: () => void): void;
16
+ /**
17
+ * webView页面中调用APP内的支付
18
+ * 此api暂时只支持native app平台下ios
19
+ * @param params
20
+ * @param callback
21
+ */
22
+ export declare function webPayment(params: WebPaymentParams, callback: (...arg: any) => void, onError?: (error: any) => void): void;
@@ -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(true).then(function (jsBridge) {
9
+ regDeviceApi().then(function (jsBridge) {
19
10
  jsBridge.callDeviceApi({
20
- apiName: "webPrint",
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: "dataManager",
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 @@
1
+ export {};
package/es/locales.js CHANGED
@@ -51,7 +51,6 @@ var init = function init(_localeMaps, _locale) {
51
51
 
52
52
  // 更新当前语言对应的多语言
53
53
  localeMap = localeMaps[locale];
54
- console.log('多语言注入成功, 当前语言为:' + locale);
55
54
  };
56
55
 
57
56
  /**
@@ -0,0 +1,22 @@
1
+ import { WebPrintParams, DataManagerParams, WebPaymentParams } from './types';
2
+ /**
3
+ * webView页面中调用打印机打印
4
+ * 此api暂时只支持native app平台下ios手机
5
+ * @param params
6
+ * @param callback
7
+ */
8
+ export declare function webPrint(params: WebPrintParams, callback: (...arg: any) => void, onError?: (error: any) => void): void;
9
+ /**
10
+ * webView页面中调用APP内的数据
11
+ * 此api暂时只支持native app平台下ios手机
12
+ * @param params
13
+ * @param callback
14
+ */
15
+ export declare function dataManager(params: DataManagerParams, callback: (...arg: any) => void, onError: () => void): void;
16
+ /**
17
+ * webView页面中调用APP内的支付
18
+ * 此api暂时只支持native app平台下ios
19
+ * @param params
20
+ * @param callback
21
+ */
22
+ export declare function webPayment(params: WebPaymentParams, callback: (...arg: any) => void, onError?: (error: any) => void): void;
@@ -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)(true).then((jsBridge) => {
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,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
@@ -50,7 +50,6 @@ var init = (_localeMaps, _locale) => {
50
50
  }
51
51
  localeMaps = allLocales;
52
52
  localeMap = localeMaps[locale];
53
- console.log("多语言注入成功, 当前语言为:" + locale);
54
53
  };
55
54
  var getText = (id) => {
56
55
  return localeMap[id] || id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/utils",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "sideEffects": false,
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",
@@ -1,7 +0,0 @@
1
- declare const webHookApi: {
2
- warning_log: {
3
- test: string;
4
- prod: string;
5
- };
6
- };
7
- export { webHookApi };
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
- };
@@ -1,7 +0,0 @@
1
- declare const webHookApi: {
2
- warning_log: {
3
- test: string;
4
- prod: string;
5
- };
6
- };
7
- export { webHookApi };
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
- };