@pisell/utils 1.0.50 → 3.0.0

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,118 @@
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
+ 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
+ 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
+ declare type WebPrint2 = {
70
+ /**
71
+ * 打印类型
72
+ * 0: 小票
73
+ * 1:ITS备货单/划菜单
74
+ * 2:手环
75
+ */
76
+ type: "2";
77
+ data: {
78
+ /** 0: 普通票 1:成人票 2:免费成人票 */
79
+ type: "0" | "1" | "2";
80
+ /** 发行编码 */
81
+ encoded: string;
82
+ /** 编码 */
83
+ code: string;
84
+ /** 到期时间 */
85
+ expire_date: string;
86
+ areas: {
87
+ /** 区域名字 */
88
+ area_name: string;
89
+ /** 区域代码 */
90
+ area_code: string;
91
+ /** 可用次数 */
92
+ limit_num: number;
93
+ /** 已用次数 */
94
+ used_num: number;
95
+ }[];
96
+ };
97
+ };
98
+ declare type WebPrintParams = WebPrint0 | WebPrint1 | WebPrint2;
99
+ /**
100
+ * webView页面中调用打印机打印
101
+ * 此api暂时只支持native app平台下ios手机
102
+ * @param params
103
+ * @param callback
104
+ */
105
+ export declare function webPrint(params: WebPrintParams, callback: (...arg: any) => void): void;
106
+ declare type DataManagerParams = {
107
+ module: "set" | "get";
108
+ key: string;
109
+ data?: any;
110
+ };
111
+ /**
112
+ * webView页面中调用APP内的数据
113
+ * 此api暂时只支持native app平台下ios手机
114
+ * @param params
115
+ * @param callback
116
+ */
117
+ export declare function dataManager(params: DataManagerParams, callback: (...arg: any) => void, onError: () => void): void;
118
+ export {};
@@ -14,15 +14,14 @@ import regDeviceApi from "./regDeviceApi";
14
14
  * @param params
15
15
  * @param callback
16
16
  */
17
- export function webPrint(params, _callback, onError) {
18
- regDeviceApi(true).then(function (jsBridge) {
17
+ export function webPrint(params, _callback) {
18
+ regDeviceApi().then(function (jsBridge) {
19
19
  jsBridge.callDeviceApi({
20
20
  apiName: "webPrint",
21
21
  params: params,
22
22
  callback: function callback() {
23
23
  _callback && _callback.apply(void 0, arguments);
24
- },
25
- onError: onError
24
+ }
26
25
  });
27
26
  });
28
27
  }
@@ -39,8 +38,7 @@ export function dataManager(params, _callback2, onError) {
39
38
  params: params,
40
39
  callback: function callback() {
41
40
  _callback2 && _callback2.apply(void 0, arguments);
42
- },
43
- onError: onError
41
+ }
44
42
  });
45
43
  }).catch(onError);
46
44
  }
@@ -10,6 +10,6 @@ type ComposedJSBridge = {
10
10
  calledByDevice: (a: { apiName: string; callback: Functon }) => void;
11
11
  };
12
12
 
13
- const regDeviceApi: (isWebPrint?: boolean) => Promise<ComposedJSBridge>;
13
+ const regDeviceApi: () => Promise<ComposedJSBridge>;
14
14
 
15
15
  export default regDeviceApi;
@@ -4,12 +4,10 @@ var iosRegStatus = false;
4
4
  var androidBridge;
5
5
  var iosBridge;
6
6
  var composedBridge;
7
- function regIosJsBridge(callback, reject) {
7
+ function regIosJsBridge(callback) {
8
8
  if (window.WebViewJavascriptBridge) {
9
9
  callback(window.WebViewJavascriptBridge);
10
10
  return;
11
- } else {
12
- reject();
13
11
  }
14
12
  if (window.WVJBCallbacks) {
15
13
  window.WVJBCallbacks.push(callback);
@@ -46,10 +44,6 @@ function regAndroidJsBridge(extraInit) {
46
44
  extraInit(bridge);
47
45
  }, false);
48
46
  }
49
- function checkApiName(apiNames, apiName) {
50
- var _apiNames = apiNames || ['webPrint'];
51
- return _apiNames.includes(apiName);
52
- }
53
47
 
54
48
  /**
55
49
  * 通用jsBridge
@@ -84,27 +78,16 @@ function getComposedBridge(deviceType) {
84
78
  inCb.apply(void 0, [result].concat(args));
85
79
  };
86
80
  if (deviceType === 'iphone') {
87
- var _iosBridge;
88
- if (!checkApiName((_iosBridge = iosBridge) === null || _iosBridge === void 0 ? void 0 : _iosBridge.apiNames, apiName)) {
89
- onError === null || onError === void 0 || onError();
90
- return;
91
- }
92
81
  iosBridge.callHandler(apiName, params, callback, function (e) {
93
82
  console.log(e, '--- 调用ios api报错:', apiName);
94
83
  if (onError) {
95
- onError === null || onError === void 0 || onError(e);
84
+ onError(e);
96
85
  }
97
86
  });
98
87
  } else if (deviceType === 'android') {
99
- var _androidBridge;
100
- if (!checkApiName((_androidBridge = androidBridge) === null || _androidBridge === void 0 ? void 0 : _androidBridge.apiNames, apiName)) {
101
- onError === null || onError === void 0 || onError();
102
- return;
103
- }
104
88
  var res = androidBridge.callHandler(apiName, JSON.stringify(params));
105
89
  callback(res);
106
90
  } else {
107
- onError === null || onError === void 0 || onError();
108
91
  console.log('--- 没获取到js bridge ---');
109
92
  }
110
93
  },
@@ -121,23 +104,15 @@ function getComposedBridge(deviceType) {
121
104
  };
122
105
  return composedBridge;
123
106
  }
124
- export default function regDeviceApi(isWebPrint) {
107
+ export default function regDeviceApi() {
125
108
  return new Promise(function (resolve, reject) {
126
- // 旧版本只能用WebPrint
127
- var isOld = !navigator.userAgent.includes('jsBridge');
128
- if (isOld) {
129
- if (!isWebPrint) {
130
- reject();
131
- return;
132
- }
133
- }
134
109
  if (isIos() && !iosRegStatus) {
135
110
  regIosJsBridge(function (bridge) {
136
111
  iosRegStatus = true;
137
112
  iosBridge = bridge;
138
113
  var realBridge = getComposedBridge('iphone');
139
114
  resolve(realBridge);
140
- }, reject);
115
+ });
141
116
  } else if (isIos() && iosRegStatus) {
142
117
  var realBridge = getComposedBridge('iphone');
143
118
  resolve(realBridge);
@@ -0,0 +1,118 @@
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
+ 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
+ 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
+ declare type WebPrint2 = {
70
+ /**
71
+ * 打印类型
72
+ * 0: 小票
73
+ * 1:ITS备货单/划菜单
74
+ * 2:手环
75
+ */
76
+ type: "2";
77
+ data: {
78
+ /** 0: 普通票 1:成人票 2:免费成人票 */
79
+ type: "0" | "1" | "2";
80
+ /** 发行编码 */
81
+ encoded: string;
82
+ /** 编码 */
83
+ code: string;
84
+ /** 到期时间 */
85
+ expire_date: string;
86
+ areas: {
87
+ /** 区域名字 */
88
+ area_name: string;
89
+ /** 区域代码 */
90
+ area_code: string;
91
+ /** 可用次数 */
92
+ limit_num: number;
93
+ /** 已用次数 */
94
+ used_num: number;
95
+ }[];
96
+ };
97
+ };
98
+ declare type WebPrintParams = WebPrint0 | WebPrint1 | WebPrint2;
99
+ /**
100
+ * webView页面中调用打印机打印
101
+ * 此api暂时只支持native app平台下ios手机
102
+ * @param params
103
+ * @param callback
104
+ */
105
+ export declare function webPrint(params: WebPrintParams, callback: (...arg: any) => void): void;
106
+ declare type DataManagerParams = {
107
+ module: "set" | "get";
108
+ key: string;
109
+ data?: any;
110
+ };
111
+ /**
112
+ * webView页面中调用APP内的数据
113
+ * 此api暂时只支持native app平台下ios手机
114
+ * @param params
115
+ * @param callback
116
+ */
117
+ export declare function dataManager(params: DataManagerParams, callback: (...arg: any) => void, onError: () => void): void;
118
+ export {};
@@ -34,15 +34,14 @@ __export(jsBridge_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(jsBridge_exports);
36
36
  var import_regDeviceApi = __toESM(require("./regDeviceApi"));
37
- function webPrint(params, callback, onError) {
38
- (0, import_regDeviceApi.default)(true).then((jsBridge) => {
37
+ function webPrint(params, callback) {
38
+ (0, import_regDeviceApi.default)().then((jsBridge) => {
39
39
  jsBridge.callDeviceApi({
40
40
  apiName: "webPrint",
41
41
  params,
42
42
  callback: (...arg) => {
43
43
  callback && callback(...arg);
44
- },
45
- onError
44
+ }
46
45
  });
47
46
  });
48
47
  }
@@ -53,8 +52,7 @@ function dataManager(params, callback, onError) {
53
52
  params,
54
53
  callback: (...arg) => {
55
54
  callback && callback(...arg);
56
- },
57
- onError
55
+ }
58
56
  });
59
57
  }).catch(onError);
60
58
  }
@@ -10,6 +10,6 @@ type ComposedJSBridge = {
10
10
  calledByDevice: (a: { apiName: string; callback: Functon }) => void;
11
11
  };
12
12
 
13
- const regDeviceApi: (isWebPrint?: boolean) => Promise<ComposedJSBridge>;
13
+ const regDeviceApi: () => Promise<ComposedJSBridge>;
14
14
 
15
15
  export default regDeviceApi;
@@ -28,12 +28,10 @@ var iosRegStatus = false;
28
28
  var androidBridge;
29
29
  var iosBridge;
30
30
  var composedBridge;
31
- function regIosJsBridge(callback, reject) {
31
+ function regIosJsBridge(callback) {
32
32
  if (window.WebViewJavascriptBridge) {
33
33
  callback(window.WebViewJavascriptBridge);
34
34
  return;
35
- } else {
36
- reject();
37
35
  }
38
36
  if (window.WVJBCallbacks) {
39
37
  window.WVJBCallbacks.push(callback);
@@ -73,10 +71,6 @@ function regAndroidJsBridge(extraInit) {
73
71
  false
74
72
  );
75
73
  }
76
- function checkApiName(apiNames, apiName) {
77
- let _apiNames = apiNames || ["webPrint"];
78
- return _apiNames.includes(apiName);
79
- }
80
74
  function getComposedBridge(deviceType) {
81
75
  if (composedBridge) {
82
76
  return composedBridge;
@@ -97,25 +91,16 @@ function getComposedBridge(deviceType) {
97
91
  inCb(result, ...args);
98
92
  };
99
93
  if (deviceType === "iphone") {
100
- if (!checkApiName(iosBridge == null ? void 0 : iosBridge.apiNames, apiName)) {
101
- onError == null ? void 0 : onError();
102
- return;
103
- }
104
94
  iosBridge.callHandler(apiName, params, callback, (e) => {
105
95
  console.log(e, "--- 调用ios api报错:", apiName);
106
96
  if (onError) {
107
- onError == null ? void 0 : onError(e);
97
+ onError(e);
108
98
  }
109
99
  });
110
100
  } else if (deviceType === "android") {
111
- if (!checkApiName(androidBridge == null ? void 0 : androidBridge.apiNames, apiName)) {
112
- onError == null ? void 0 : onError();
113
- return;
114
- }
115
101
  const res = androidBridge.callHandler(apiName, JSON.stringify(params));
116
102
  callback(res);
117
103
  } else {
118
- onError == null ? void 0 : onError();
119
104
  console.log("--- 没获取到js bridge ---");
120
105
  }
121
106
  },
@@ -130,22 +115,15 @@ function getComposedBridge(deviceType) {
130
115
  };
131
116
  return composedBridge;
132
117
  }
133
- function regDeviceApi(isWebPrint) {
118
+ function regDeviceApi() {
134
119
  return new Promise((resolve, reject) => {
135
- const isOld = !navigator.userAgent.includes("jsBridge");
136
- if (isOld) {
137
- if (!isWebPrint) {
138
- reject();
139
- return;
140
- }
141
- }
142
120
  if ((0, import_platform.isIos)() && !iosRegStatus) {
143
121
  regIosJsBridge((bridge) => {
144
122
  iosRegStatus = true;
145
123
  iosBridge = bridge;
146
124
  const realBridge = getComposedBridge("iphone");
147
125
  resolve(realBridge);
148
- }, reject);
126
+ });
149
127
  } else if ((0, import_platform.isIos)() && iosRegStatus) {
150
128
  const realBridge = getComposedBridge("iphone");
151
129
  resolve(realBridge);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/utils",
3
- "version": "1.0.50",
3
+ "version": "3.0.0",
4
4
  "sideEffects": false,
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",
@@ -1 +0,0 @@
1
- export declare const uniqueByKey: <T>(arr: T[], key: keyof T) => T[];
@@ -1,7 +0,0 @@
1
- declare const webHookApi: {
2
- warning_log: {
3
- test: string;
4
- prod: string;
5
- };
6
- };
7
- export { webHookApi };
package/es/document.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * @Title: 设置主题
3
- * @Describe: 传入字符串键值对
4
- * @Author: Wzw
5
- */
6
- export declare const setTheme: (themes: {
7
- [key: string]: string;
8
- }) => void;
9
- /**
10
- * 复制到剪切板
11
- * @param text
12
- */
13
- export declare const copyToClipboard: (text: string) => Promise<void>;
@@ -1,13 +0,0 @@
1
- declare type InjectedConfigType = {
2
- apiKey: string;
3
- authDomain: string;
4
- projectId: string;
5
- storageBucket: string;
6
- messagingSenderId: string;
7
- appId: string;
8
- databaseURL: string;
9
- };
10
- export declare const injectConfig: (context: InjectedConfigType) => void;
11
- export declare const firebaseConfig: any;
12
- declare const _default: any;
13
- export default _default;
@@ -1,28 +0,0 @@
1
- import { FirebaseApp } from 'firebase/app';
2
- import { Auth } from 'firebase/auth';
3
- import { ref, Database, goOnline, goOffline } from 'firebase/database';
4
- declare let firebaseApp: FirebaseApp;
5
- declare let auth: Auth;
6
- declare let database: Database;
7
- export declare const initFirebase: (config?: any) => void;
8
- export { database, firebaseApp, auth, ref, goOnline, goOffline };
9
- export declare const getPath: (path: string) => string;
10
- export declare const setAuthStateChangeCallback: (callback: (user: any) => void) => void;
11
- export declare const signUp: (email: string, password: string) => Promise<import("firebase/auth").User>;
12
- export declare const signInUser: (email: string, password: string) => Promise<import("firebase/auth").User>;
13
- export declare const signOutUser: () => Promise<void>;
14
- export declare const readData: (path: string) => Promise<any>;
15
- export declare const writeData: (path: string, data: any) => Promise<void>;
16
- export declare const onDataChange: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
17
- export declare const onDataChanged: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
18
- export declare const removeDataListener: (listener: any) => void;
19
- declare const _default: {
20
- signInUser: (email: string, password: string) => Promise<import("firebase/auth").User>;
21
- signOutUser: () => Promise<void>;
22
- readData: (path: string) => Promise<any>;
23
- writeData: (path: string, data: any) => Promise<void>;
24
- onDataChange: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
25
- removeDataListener: (listener: any) => void;
26
- onDataChanged: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
27
- };
28
- export default _default;
package/es/format.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * @title: 格式化金额
3
- * @description:
4
- * @param {number} amount 原金额
5
- * @param {number} precision 小数位数
6
- * @param {string} symbol 货币符号
7
- * @return {*}
8
- * @Author: zhiwei.Wang
9
- * @Date: 2023-11-06 16:51
10
- */
11
- export declare const formatAmount: (amount?: number | string, precision?: number, symbol?: string) => string | number;
12
- export declare type FormatOptions = {
13
- /** 小数点后位数 默认是小数点后2位 */
14
- precision?: number;
15
- /** 显示货币符号 指的是 ¥$ 等货币符号等显隐,默认是展示 */
16
- showCurrencySymbol?: boolean;
17
- /** 千分位 指的是长金额的千分位逗号隔开,比如“123, 245, 315” 这种展现形式,默认是关闭 */
18
- useThousandsSeparator?: boolean;
19
- /** 整数位隐藏小数 指的是如果价格为整数,后面的".00" 将被省略以节省页面空间 */
20
- hideDecimalForWholeNumbers?: boolean;
21
- };
22
- /**
23
- * 根据配置格式化金额
24
- * @param amount
25
- * @param symbol
26
- * @param options
27
- */
28
- export declare const formatAmountWithOptions: (amount: string | number | undefined, symbol: string | undefined, options: FormatOptions) => string | number;
package/es/miniRedux.d.ts DELETED
@@ -1,16 +0,0 @@
1
- interface MiniReduxProps<State, Namespace> {
2
- namespace?: Namespace;
3
- state?: State;
4
- reducers?: any;
5
- effects?: any;
6
- }
7
- export declare const miniRedux: <State extends Record<string, any>, Namespace extends string>({ namespace, state, reducers, effects, }: MiniReduxProps<State, Namespace>) => {
8
- Context: React.Context<{ [K in Namespace]: State; } & {
9
- dispatch: (params: {
10
- type: string;
11
- payload: any;
12
- }) => void;
13
- }>;
14
- Provider: (ComponentUi: any) => any;
15
- };
16
- export {};
@@ -1,48 +0,0 @@
1
- /**
2
- * @title: 判断是否无痕模式
3
- * @description:
4
- * @return: *
5
- * @Author: shengjie.zuo
6
- * @Date: 2024-09-4 09:58:22
7
- */
8
- export declare const detectIncognito: () => Promise<{
9
- isPrivate: boolean;
10
- browserName: string;
11
- } | {
12
- isPrivate: boolean;
13
- }>;
14
- /**
15
- * @Description: 生成唯一id
16
- * @Author: wzw
17
- * @Date: 2020-12-01 14:20:29
18
- * @param {*}
19
- * @return {*}
20
- */
21
- export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
22
- /**
23
- * @title: 对数组进行增|删
24
- * @description: 用于多选选中和取消选中的处理
25
- * @param {any} list
26
- * @param {any} item
27
- * @param {string} key
28
- * @return {*}
29
- * @Author: zhiwei.Wang
30
- * @Date: 2023-12-19 16:44
31
- */
32
- export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
33
- /**
34
- * @title: 判断某个字段是否在列表内
35
- * @description:
36
- * @param {*} T
37
- * @param {boolean} param2
38
- * @return {*}
39
- * @Author: zhiwei.Wang
40
- * @Date: 2023-12-19 16:54
41
- */
42
- export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
43
- export declare const createArray: (length: number, returnItem: any) => unknown[];
44
- /**
45
- * 根据对象内容生成唯一id
46
- * @param obj
47
- */
48
- export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
package/es/platform.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare const isIpad: () => boolean;
2
- export declare const isMobile: () => boolean;
3
- export declare const isAndroid: () => boolean;
4
- export declare const isIos: () => boolean;
5
- export declare const checkEnv: () => number;
6
- export declare const isWx: () => boolean;
7
- export declare const isIOS: () => boolean;
8
- export declare const isWxApp: () => boolean;
9
- export declare const isSafari: () => boolean;
@@ -1 +0,0 @@
1
- export declare const uniqueByKey: <T>(arr: T[], key: keyof T) => T[];
@@ -1,7 +0,0 @@
1
- declare const webHookApi: {
2
- warning_log: {
3
- test: string;
4
- prod: string;
5
- };
6
- };
7
- export { webHookApi };
package/lib/document.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * @Title: 设置主题
3
- * @Describe: 传入字符串键值对
4
- * @Author: Wzw
5
- */
6
- export declare const setTheme: (themes: {
7
- [key: string]: string;
8
- }) => void;
9
- /**
10
- * 复制到剪切板
11
- * @param text
12
- */
13
- export declare const copyToClipboard: (text: string) => Promise<void>;
@@ -1,13 +0,0 @@
1
- declare type InjectedConfigType = {
2
- apiKey: string;
3
- authDomain: string;
4
- projectId: string;
5
- storageBucket: string;
6
- messagingSenderId: string;
7
- appId: string;
8
- databaseURL: string;
9
- };
10
- export declare const injectConfig: (context: InjectedConfigType) => void;
11
- export declare const firebaseConfig: any;
12
- declare const _default: any;
13
- export default _default;
@@ -1,28 +0,0 @@
1
- import { FirebaseApp } from 'firebase/app';
2
- import { Auth } from 'firebase/auth';
3
- import { ref, Database, goOnline, goOffline } from 'firebase/database';
4
- declare let firebaseApp: FirebaseApp;
5
- declare let auth: Auth;
6
- declare let database: Database;
7
- export declare const initFirebase: (config?: any) => void;
8
- export { database, firebaseApp, auth, ref, goOnline, goOffline };
9
- export declare const getPath: (path: string) => string;
10
- export declare const setAuthStateChangeCallback: (callback: (user: any) => void) => void;
11
- export declare const signUp: (email: string, password: string) => Promise<import("firebase/auth").User>;
12
- export declare const signInUser: (email: string, password: string) => Promise<import("firebase/auth").User>;
13
- export declare const signOutUser: () => Promise<void>;
14
- export declare const readData: (path: string) => Promise<any>;
15
- export declare const writeData: (path: string, data: any) => Promise<void>;
16
- export declare const onDataChange: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
17
- export declare const onDataChanged: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
18
- export declare const removeDataListener: (listener: any) => void;
19
- declare const _default: {
20
- signInUser: (email: string, password: string) => Promise<import("firebase/auth").User>;
21
- signOutUser: () => Promise<void>;
22
- readData: (path: string) => Promise<any>;
23
- writeData: (path: string, data: any) => Promise<void>;
24
- onDataChange: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
25
- removeDataListener: (listener: any) => void;
26
- onDataChanged: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
27
- };
28
- export default _default;
package/lib/format.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * @title: 格式化金额
3
- * @description:
4
- * @param {number} amount 原金额
5
- * @param {number} precision 小数位数
6
- * @param {string} symbol 货币符号
7
- * @return {*}
8
- * @Author: zhiwei.Wang
9
- * @Date: 2023-11-06 16:51
10
- */
11
- export declare const formatAmount: (amount?: number | string, precision?: number, symbol?: string) => string | number;
12
- export declare type FormatOptions = {
13
- /** 小数点后位数 默认是小数点后2位 */
14
- precision?: number;
15
- /** 显示货币符号 指的是 ¥$ 等货币符号等显隐,默认是展示 */
16
- showCurrencySymbol?: boolean;
17
- /** 千分位 指的是长金额的千分位逗号隔开,比如“123, 245, 315” 这种展现形式,默认是关闭 */
18
- useThousandsSeparator?: boolean;
19
- /** 整数位隐藏小数 指的是如果价格为整数,后面的".00" 将被省略以节省页面空间 */
20
- hideDecimalForWholeNumbers?: boolean;
21
- };
22
- /**
23
- * 根据配置格式化金额
24
- * @param amount
25
- * @param symbol
26
- * @param options
27
- */
28
- export declare const formatAmountWithOptions: (amount: string | number | undefined, symbol: string | undefined, options: FormatOptions) => string | number;
@@ -1,16 +0,0 @@
1
- interface MiniReduxProps<State, Namespace> {
2
- namespace?: Namespace;
3
- state?: State;
4
- reducers?: any;
5
- effects?: any;
6
- }
7
- export declare const miniRedux: <State extends Record<string, any>, Namespace extends string>({ namespace, state, reducers, effects, }: MiniReduxProps<State, Namespace>) => {
8
- Context: React.Context<{ [K in Namespace]: State; } & {
9
- dispatch: (params: {
10
- type: string;
11
- payload: any;
12
- }) => void;
13
- }>;
14
- Provider: (ComponentUi: any) => any;
15
- };
16
- export {};
@@ -1,48 +0,0 @@
1
- /**
2
- * @title: 判断是否无痕模式
3
- * @description:
4
- * @return: *
5
- * @Author: shengjie.zuo
6
- * @Date: 2024-09-4 09:58:22
7
- */
8
- export declare const detectIncognito: () => Promise<{
9
- isPrivate: boolean;
10
- browserName: string;
11
- } | {
12
- isPrivate: boolean;
13
- }>;
14
- /**
15
- * @Description: 生成唯一id
16
- * @Author: wzw
17
- * @Date: 2020-12-01 14:20:29
18
- * @param {*}
19
- * @return {*}
20
- */
21
- export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
22
- /**
23
- * @title: 对数组进行增|删
24
- * @description: 用于多选选中和取消选中的处理
25
- * @param {any} list
26
- * @param {any} item
27
- * @param {string} key
28
- * @return {*}
29
- * @Author: zhiwei.Wang
30
- * @Date: 2023-12-19 16:44
31
- */
32
- export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
33
- /**
34
- * @title: 判断某个字段是否在列表内
35
- * @description:
36
- * @param {*} T
37
- * @param {boolean} param2
38
- * @return {*}
39
- * @Author: zhiwei.Wang
40
- * @Date: 2023-12-19 16:54
41
- */
42
- export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
43
- export declare const createArray: (length: number, returnItem: any) => unknown[];
44
- /**
45
- * 根据对象内容生成唯一id
46
- * @param obj
47
- */
48
- export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
package/lib/platform.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare const isIpad: () => boolean;
2
- export declare const isMobile: () => boolean;
3
- export declare const isAndroid: () => boolean;
4
- export declare const isIos: () => boolean;
5
- export declare const checkEnv: () => number;
6
- export declare const isWx: () => boolean;
7
- export declare const isIOS: () => boolean;
8
- export declare const isWxApp: () => boolean;
9
- export declare const isSafari: () => boolean;