@xfe-repo/web-utils 1.0.9 → 1.0.11

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 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
- function isTestEnv(_apiEnv) {
95
+ var isTestEnv = (_apiEnv) => {
94
96
  return _apiEnv.startsWith("test");
95
- }
96
- var getBffApi = (_apiEnv = apiEnv) => {
97
+ };
98
+ var getEnvApi = (envApis, _apiEnv = apiEnv) => {
97
99
  if (isTestEnv(_apiEnv)) {
98
- return bffApiList["test"].replace("test", _apiEnv);
100
+ return envApis["test"].replace("test", _apiEnv);
99
101
  } else {
100
- return bffApiList[_apiEnv];
102
+ return envApis[_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
- function isTestEnv(_apiEnv) {
56
+ var isTestEnv = (_apiEnv) => {
57
57
  return _apiEnv.startsWith("test");
58
- }
59
- var getBffApi = (_apiEnv = apiEnv) => {
58
+ };
59
+ var getEnvApi = (envApis, _apiEnv = apiEnv) => {
60
60
  if (isTestEnv(_apiEnv)) {
61
- return bffApiList["test"].replace("test", _apiEnv);
61
+ return envApis["test"].replace("test", _apiEnv);
62
62
  } else {
63
- return bffApiList[_apiEnv];
63
+ return envApis[_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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-utils",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
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.1",
31
+ "@xfe-repo/eslint-config": "0.0.2",
32
32
  "@xfe-repo/typescript-config": "0.0.3"
33
33
  },
34
34
  "scripts": {