@pisell/utils 2.0.1 → 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.
- package/es/constants/index.js +6 -1
- package/es/document.js +2 -2
- package/es/escPosPrinter/index.js +2 -2
- package/es/firebase/index.js +34 -13
- package/es/index.d.ts +18 -12
- package/es/index.js +16 -1
- package/es/jsBridge/index.d.ts +12 -0
- package/es/jsBridge/index.js +26 -0
- package/es/jsBridge/regDeviceApi.js +2 -6
- package/es/locales.js +5 -5
- package/es/log.js +23 -14
- package/es/miniRedux.js +8 -9
- package/es/otherUtils.js +2 -2
- package/lib/constants/index.js +6 -1
- package/lib/escPosPrinter/EscPosPrinter.js +43 -86
- package/lib/escPosPrinter/index.js +2 -2
- package/lib/firebase/index.js +22 -0
- package/lib/image.js +1 -2
- package/lib/index.d.ts +18 -12
- package/lib/index.js +21 -0
- package/lib/jsBridge/index.d.ts +12 -0
- package/lib/jsBridge/index.js +13 -0
- package/lib/jsBridge/regDeviceApi.js +5 -10
- package/lib/locales.js +1 -1
- package/lib/log.js +10 -1
- package/package.json +1 -1
- package/es/arrayUtils.d.ts +0 -1
- package/es/constants/index.d.ts +0 -4
- package/es/document.d.ts +0 -13
- package/es/firebase/config/index.d.ts +0 -13
- package/es/firebase/index.d.ts +0 -28
- package/es/format.d.ts +0 -28
- package/es/miniRedux.d.ts +0 -16
- package/es/otherUtils.d.ts +0 -48
- package/es/platform.d.ts +0 -9
- package/lib/arrayUtils.d.ts +0 -1
- package/lib/constants/index.d.ts +0 -4
- package/lib/document.d.ts +0 -13
- package/lib/firebase/config/index.d.ts +0 -13
- package/lib/firebase/index.d.ts +0 -28
- package/lib/format.d.ts +0 -28
- package/lib/miniRedux.d.ts +0 -16
- package/lib/otherUtils.d.ts +0 -48
- package/lib/platform.d.ts +0 -9
package/lib/log.js
CHANGED
|
@@ -22,6 +22,7 @@ __export(log_exports, {
|
|
|
22
22
|
sendWarningLog: () => sendWarningLog
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(log_exports);
|
|
25
|
+
var import_index = require("./index");
|
|
25
26
|
var import_constants = require("./constants");
|
|
26
27
|
var createFeishuMessageContent = (contentArr) => {
|
|
27
28
|
return JSON.stringify(
|
|
@@ -35,7 +36,15 @@ var createFeishuMessageContent = (contentArr) => {
|
|
|
35
36
|
};
|
|
36
37
|
var sendWarningLog = async ({ title, content }) => {
|
|
37
38
|
const contentStr = createFeishuMessageContent(content);
|
|
38
|
-
|
|
39
|
+
let apiUrl = "";
|
|
40
|
+
const config = (0, import_index.getPisellUtilsConfig)();
|
|
41
|
+
console.log("PISELL_UTILS_CONFIG>>>>", config);
|
|
42
|
+
if ((config == null ? void 0 : config.env) === "dev" || (config == null ? void 0 : config.env) === "pre" || (config == null ? void 0 : config.env) === "release") {
|
|
43
|
+
apiUrl = import_constants.webHookApi.warning_log.test;
|
|
44
|
+
} else {
|
|
45
|
+
apiUrl = import_constants.webHookApi.warning_log.prod;
|
|
46
|
+
}
|
|
47
|
+
const response = await fetch(apiUrl, {
|
|
39
48
|
headers: {
|
|
40
49
|
"Content-Type": "application/json"
|
|
41
50
|
},
|
package/package.json
CHANGED
package/es/arrayUtils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const uniqueByKey: <T>(arr: T[], key: keyof T) => T[];
|
package/es/constants/index.d.ts
DELETED
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;
|
package/es/firebase/index.d.ts
DELETED
|
@@ -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 {};
|
package/es/otherUtils.d.ts
DELETED
|
@@ -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;
|
package/lib/arrayUtils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const uniqueByKey: <T>(arr: T[], key: keyof T) => T[];
|
package/lib/constants/index.d.ts
DELETED
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;
|
package/lib/firebase/index.d.ts
DELETED
|
@@ -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;
|
package/lib/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 {};
|
package/lib/otherUtils.d.ts
DELETED
|
@@ -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;
|