@xfe-repo/web-utils 1.0.8 → 1.0.10
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/dist/env.d.mts +3 -1
- package/dist/env.d.ts +3 -1
- package/dist/env.js +10 -3
- package/dist/env.mjs +8 -3
- package/dist/loadScript.d.mts +2 -1
- package/dist/loadScript.d.ts +2 -1
- package/dist/loadScript.js +7 -4
- package/dist/loadScript.mjs +5 -3
- package/package.json +2 -2
package/dist/env.d.mts
CHANGED
|
@@ -14,6 +14,8 @@ declare const business: Business;
|
|
|
14
14
|
declare const assetsHost = "https://imgs.xianghuanji.com/";
|
|
15
15
|
declare const getErpSaasOrigin: (_apiEnv: ApiEnv) => string;
|
|
16
16
|
declare const getMSaasOrigin: (_apiEnv: ApiEnv) => string;
|
|
17
|
+
declare const isTestEnv: (_apiEnv: ApiEnv) => _apiEnv is `test${number}` | "test";
|
|
18
|
+
declare const getEnvApi: (envApis: Record<ApiEnv, string>, _apiEnv?: ApiEnv) => string;
|
|
17
19
|
declare const getBffApi: (_apiEnv?: ApiEnv) => string;
|
|
18
20
|
declare function getEnvDomain(hostname: string): string;
|
|
19
21
|
declare const sentryConfig: {
|
|
@@ -24,4 +26,4 @@ declare const sentryConfig: {
|
|
|
24
26
|
debug: boolean;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
export { type ApiEnv, type Business, type TestEnv, apiEnv, assetsHost, business, getBffApi, getEnvDomain, getErpSaasOrigin, getMSaasOrigin, isAndroid, isClient, isIos, isProduction, isSSR, isServer, isWeiXin, release, sentryConfig };
|
|
29
|
+
export { type ApiEnv, type Business, type TestEnv, apiEnv, assetsHost, business, getBffApi, getEnvApi, getEnvDomain, getErpSaasOrigin, getMSaasOrigin, isAndroid, isClient, isIos, isProduction, isSSR, isServer, isTestEnv, isWeiXin, release, sentryConfig };
|
package/dist/env.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ declare const business: Business;
|
|
|
14
14
|
declare const assetsHost = "https://imgs.xianghuanji.com/";
|
|
15
15
|
declare const getErpSaasOrigin: (_apiEnv: ApiEnv) => string;
|
|
16
16
|
declare const getMSaasOrigin: (_apiEnv: ApiEnv) => string;
|
|
17
|
+
declare const isTestEnv: (_apiEnv: ApiEnv) => _apiEnv is `test${number}` | "test";
|
|
18
|
+
declare const getEnvApi: (envApis: Record<ApiEnv, string>, _apiEnv?: ApiEnv) => string;
|
|
17
19
|
declare const getBffApi: (_apiEnv?: ApiEnv) => string;
|
|
18
20
|
declare function getEnvDomain(hostname: string): string;
|
|
19
21
|
declare const sentryConfig: {
|
|
@@ -24,4 +26,4 @@ declare const sentryConfig: {
|
|
|
24
26
|
debug: boolean;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
export { type ApiEnv, type Business, type TestEnv, apiEnv, assetsHost, business, getBffApi, getEnvDomain, getErpSaasOrigin, getMSaasOrigin, isAndroid, isClient, isIos, isProduction, isSSR, isServer, isWeiXin, release, sentryConfig };
|
|
29
|
+
export { type ApiEnv, type Business, type TestEnv, apiEnv, assetsHost, business, getBffApi, getEnvApi, getEnvDomain, getErpSaasOrigin, getMSaasOrigin, isAndroid, isClient, isIos, isProduction, isSSR, isServer, isTestEnv, isWeiXin, release, sentryConfig };
|
package/dist/env.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(env_exports, {
|
|
|
24
24
|
assetsHost: () => assetsHost,
|
|
25
25
|
business: () => business,
|
|
26
26
|
getBffApi: () => getBffApi,
|
|
27
|
+
getEnvApi: () => getEnvApi,
|
|
27
28
|
getEnvDomain: () => getEnvDomain,
|
|
28
29
|
getErpSaasOrigin: () => getErpSaasOrigin,
|
|
29
30
|
getMSaasOrigin: () => getMSaasOrigin,
|
|
@@ -33,6 +34,7 @@ __export(env_exports, {
|
|
|
33
34
|
isProduction: () => isProduction,
|
|
34
35
|
isSSR: () => isSSR,
|
|
35
36
|
isServer: () => isServer,
|
|
37
|
+
isTestEnv: () => isTestEnv,
|
|
36
38
|
isWeiXin: () => isWeiXin,
|
|
37
39
|
release: () => release,
|
|
38
40
|
sentryConfig: () => sentryConfig
|
|
@@ -90,16 +92,19 @@ var bffApiList = {
|
|
|
90
92
|
beta: "https://bff.beta.eshetang.com/",
|
|
91
93
|
prod: "https://bff.eshetang.com/"
|
|
92
94
|
};
|
|
93
|
-
|
|
95
|
+
var isTestEnv = (_apiEnv) => {
|
|
94
96
|
return _apiEnv.startsWith("test");
|
|
95
|
-
}
|
|
96
|
-
var
|
|
97
|
+
};
|
|
98
|
+
var getEnvApi = (envApis, _apiEnv = apiEnv) => {
|
|
97
99
|
if (isTestEnv(_apiEnv)) {
|
|
98
100
|
return bffApiList["test"].replace("test", _apiEnv);
|
|
99
101
|
} else {
|
|
100
102
|
return bffApiList[_apiEnv];
|
|
101
103
|
}
|
|
102
104
|
};
|
|
105
|
+
var getBffApi = (_apiEnv = apiEnv) => {
|
|
106
|
+
return getEnvApi(bffApiList, _apiEnv);
|
|
107
|
+
};
|
|
103
108
|
function getEnvDomain(hostname) {
|
|
104
109
|
var _a;
|
|
105
110
|
const isTest = hostname.startsWith("test");
|
|
@@ -119,6 +124,7 @@ var sentryConfig = {
|
|
|
119
124
|
assetsHost,
|
|
120
125
|
business,
|
|
121
126
|
getBffApi,
|
|
127
|
+
getEnvApi,
|
|
122
128
|
getEnvDomain,
|
|
123
129
|
getErpSaasOrigin,
|
|
124
130
|
getMSaasOrigin,
|
|
@@ -128,6 +134,7 @@ var sentryConfig = {
|
|
|
128
134
|
isProduction,
|
|
129
135
|
isSSR,
|
|
130
136
|
isServer,
|
|
137
|
+
isTestEnv,
|
|
131
138
|
isWeiXin,
|
|
132
139
|
release,
|
|
133
140
|
sentryConfig
|
package/dist/env.mjs
CHANGED
|
@@ -53,16 +53,19 @@ var bffApiList = {
|
|
|
53
53
|
beta: "https://bff.beta.eshetang.com/",
|
|
54
54
|
prod: "https://bff.eshetang.com/"
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
var isTestEnv = (_apiEnv) => {
|
|
57
57
|
return _apiEnv.startsWith("test");
|
|
58
|
-
}
|
|
59
|
-
var
|
|
58
|
+
};
|
|
59
|
+
var getEnvApi = (envApis, _apiEnv = apiEnv) => {
|
|
60
60
|
if (isTestEnv(_apiEnv)) {
|
|
61
61
|
return bffApiList["test"].replace("test", _apiEnv);
|
|
62
62
|
} else {
|
|
63
63
|
return bffApiList[_apiEnv];
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
var getBffApi = (_apiEnv = apiEnv) => {
|
|
67
|
+
return getEnvApi(bffApiList, _apiEnv);
|
|
68
|
+
};
|
|
66
69
|
function getEnvDomain(hostname) {
|
|
67
70
|
var _a;
|
|
68
71
|
const isTest = hostname.startsWith("test");
|
|
@@ -81,6 +84,7 @@ export {
|
|
|
81
84
|
assetsHost,
|
|
82
85
|
business,
|
|
83
86
|
getBffApi,
|
|
87
|
+
getEnvApi,
|
|
84
88
|
getEnvDomain,
|
|
85
89
|
getErpSaasOrigin,
|
|
86
90
|
getMSaasOrigin,
|
|
@@ -90,6 +94,7 @@ export {
|
|
|
90
94
|
isProduction,
|
|
91
95
|
isSSR,
|
|
92
96
|
isServer,
|
|
97
|
+
isTestEnv,
|
|
93
98
|
isWeiXin,
|
|
94
99
|
release,
|
|
95
100
|
sentryConfig
|
package/dist/loadScript.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ declare class LoadScript {
|
|
|
6
6
|
constructor(url: string, name: string);
|
|
7
7
|
load(): Promise<unknown>;
|
|
8
8
|
}
|
|
9
|
+
declare const sensorsInstanceID = "sensorsDataAnalytic201505";
|
|
9
10
|
declare function loadSensors(): Promise<any>;
|
|
10
11
|
|
|
11
|
-
export { LoadScript as default, loadSensors };
|
|
12
|
+
export { LoadScript as default, loadSensors, sensorsInstanceID };
|
package/dist/loadScript.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare class LoadScript {
|
|
|
6
6
|
constructor(url: string, name: string);
|
|
7
7
|
load(): Promise<unknown>;
|
|
8
8
|
}
|
|
9
|
+
declare const sensorsInstanceID = "sensorsDataAnalytic201505";
|
|
9
10
|
declare function loadSensors(): Promise<any>;
|
|
10
11
|
|
|
11
|
-
export { LoadScript as default, loadSensors };
|
|
12
|
+
export { LoadScript as default, loadSensors, sensorsInstanceID };
|
package/dist/loadScript.js
CHANGED
|
@@ -41,7 +41,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
41
41
|
var loadScript_exports = {};
|
|
42
42
|
__export(loadScript_exports, {
|
|
43
43
|
default: () => LoadScript,
|
|
44
|
-
loadSensors: () => loadSensors
|
|
44
|
+
loadSensors: () => loadSensors,
|
|
45
|
+
sensorsInstanceID: () => sensorsInstanceID
|
|
45
46
|
});
|
|
46
47
|
module.exports = __toCommonJS(loadScript_exports);
|
|
47
48
|
var LoadScript = class _LoadScript {
|
|
@@ -80,13 +81,14 @@ var LoadScript = class _LoadScript {
|
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
};
|
|
84
|
+
var sensorsInstanceID = "sensorsDataAnalytic201505";
|
|
83
85
|
function loadSensors() {
|
|
84
86
|
return __async(this, null, function* () {
|
|
85
87
|
const sensorsSDK = new LoadScript("https://img.eshetang.com/sensorsdata/sensorsdata.min.js", "sensorsDataAnalytic201505");
|
|
86
88
|
yield sensorsSDK.load();
|
|
87
|
-
const sensors = window[
|
|
89
|
+
const sensors = window[sensorsInstanceID];
|
|
88
90
|
sensors.init({
|
|
89
|
-
server_url: "https://bibp.
|
|
91
|
+
server_url: "https://bibp.eshetang.com/xhj_bi/bi.gif",
|
|
90
92
|
heatmap: { clickmap: "default", scroll_notice_map: "default" },
|
|
91
93
|
show_log: false,
|
|
92
94
|
is_track_single_page: true
|
|
@@ -97,5 +99,6 @@ function loadSensors() {
|
|
|
97
99
|
}
|
|
98
100
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
101
|
0 && (module.exports = {
|
|
100
|
-
loadSensors
|
|
102
|
+
loadSensors,
|
|
103
|
+
sensorsInstanceID
|
|
101
104
|
});
|
package/dist/loadScript.mjs
CHANGED
|
@@ -39,13 +39,14 @@ var LoadScript = class _LoadScript {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
var sensorsInstanceID = "sensorsDataAnalytic201505";
|
|
42
43
|
function loadSensors() {
|
|
43
44
|
return __async(this, null, function* () {
|
|
44
45
|
const sensorsSDK = new LoadScript("https://img.eshetang.com/sensorsdata/sensorsdata.min.js", "sensorsDataAnalytic201505");
|
|
45
46
|
yield sensorsSDK.load();
|
|
46
|
-
const sensors = window[
|
|
47
|
+
const sensors = window[sensorsInstanceID];
|
|
47
48
|
sensors.init({
|
|
48
|
-
server_url: "https://bibp.
|
|
49
|
+
server_url: "https://bibp.eshetang.com/xhj_bi/bi.gif",
|
|
49
50
|
heatmap: { clickmap: "default", scroll_notice_map: "default" },
|
|
50
51
|
show_log: false,
|
|
51
52
|
is_track_single_page: true
|
|
@@ -56,5 +57,6 @@ function loadSensors() {
|
|
|
56
57
|
}
|
|
57
58
|
export {
|
|
58
59
|
LoadScript as default,
|
|
59
|
-
loadSensors
|
|
60
|
+
loadSensors,
|
|
61
|
+
sensorsInstanceID
|
|
60
62
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/js-cookie": "^3.0.5",
|
|
30
30
|
"@types/node": "^20.10.3",
|
|
31
|
-
"@xfe-repo/eslint-config": "0.0.
|
|
31
|
+
"@xfe-repo/eslint-config": "0.0.2",
|
|
32
32
|
"@xfe-repo/typescript-config": "0.0.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|