@servicetitan/web-components 35.3.0 → 36.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.
|
@@ -22,7 +22,8 @@ function detectEnvironment(keys, defaultEnvironment, hostname) {
|
|
|
22
22
|
function isLocalHost(hostname) {
|
|
23
23
|
return [
|
|
24
24
|
'localhost',
|
|
25
|
-
'127.0.0.1'
|
|
25
|
+
'127.0.0.1',
|
|
26
|
+
'app-web'
|
|
26
27
|
].some((host)=>hostname.indexOf(host) >= 0);
|
|
27
28
|
}
|
|
28
29
|
function isTestEnvironment() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/get-value-for-environment.ts"],"sourcesContent":["// See https://github.com/microsoft/TypeScript/issues/29729 for why LiteralUnion\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype LiteralUnion<T extends U, U = string> = T | (U & { _?: never });\n\nexport type Environment = LiteralUnion<'dev' | 'go' | 'next' | 'qa' | 'stage' | 'test'>;\nexport type EnvironmentValues = Partial<Record<Environment, string>>;\n\nexport function getValueForEnvironment(\n values: EnvironmentValues,\n defaultEnvironment: Environment = 'qa',\n hostname: string = window.location.hostname\n) {\n const keys = Object.keys(values) as (keyof typeof values)[];\n const key = detectEnvironment(keys, defaultEnvironment, hostname);\n return values[key];\n}\n\nfunction detectEnvironment(\n keys: Environment[],\n defaultEnvironment: Environment,\n hostname: string\n): Environment {\n if (isTestEnvironment()) {\n return 'test';\n }\n\n if (isLocalHost(hostname)) {\n return 'dev';\n }\n\n for (const key of keys) {\n if (\n hostname.indexOf(`${key}.servicetitan.com`) >= 0 ||\n (key.endsWith('.st.dev') && hostname.indexOf(key) >= 0)\n ) {\n return key;\n }\n }\n\n return defaultEnvironment;\n}\n\nfunction isLocalHost(hostname: string) {\n return ['localhost', '127.0.0.1'].some(host => hostname.indexOf(host) >= 0);\n}\n\nfunction isTestEnvironment() {\n return process.env.NODE_ENV === 'test';\n}\n"],"names":["getValueForEnvironment","values","defaultEnvironment","hostname","window","location","keys","Object","key","detectEnvironment","isTestEnvironment","isLocalHost","indexOf","endsWith","some","host","process","env","NODE_ENV"],"mappings":"AAAA,gFAAgF;AAChF,gEAAgE;AAMhE,OAAO,SAASA,uBACZC,MAAyB,EACzBC,qBAAkC,IAAI,EACtCC,WAAmBC,OAAOC,QAAQ,CAACF,QAAQ;IAE3C,MAAMG,OAAOC,OAAOD,IAAI,CAACL;IACzB,MAAMO,MAAMC,kBAAkBH,MAAMJ,oBAAoBC;IACxD,OAAOF,MAAM,CAACO,IAAI;AACtB;AAEA,SAASC,kBACLH,IAAmB,EACnBJ,kBAA+B,EAC/BC,QAAgB;IAEhB,IAAIO,qBAAqB;QACrB,OAAO;IACX;IAEA,IAAIC,YAAYR,WAAW;QACvB,OAAO;IACX;IAEA,KAAK,MAAMK,OAAOF,KAAM;QACpB,IACIH,SAASS,OAAO,CAAC,GAAGJ,IAAI,iBAAiB,CAAC,KAAK,KAC9CA,IAAIK,QAAQ,CAAC,cAAcV,SAASS,OAAO,CAACJ,QAAQ,GACvD;YACE,OAAOA;QACX;IACJ;IAEA,OAAON;AACX;AAEA,SAASS,YAAYR,QAAgB;IACjC,OAAO;QAAC;QAAa;
|
|
1
|
+
{"version":3,"sources":["../src/get-value-for-environment.ts"],"sourcesContent":["// See https://github.com/microsoft/TypeScript/issues/29729 for why LiteralUnion\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype LiteralUnion<T extends U, U = string> = T | (U & { _?: never });\n\nexport type Environment = LiteralUnion<'dev' | 'go' | 'next' | 'qa' | 'stage' | 'test'>;\nexport type EnvironmentValues = Partial<Record<Environment, string>>;\n\nexport function getValueForEnvironment(\n values: EnvironmentValues,\n defaultEnvironment: Environment = 'qa',\n hostname: string = window.location.hostname\n) {\n const keys = Object.keys(values) as (keyof typeof values)[];\n const key = detectEnvironment(keys, defaultEnvironment, hostname);\n return values[key];\n}\n\nfunction detectEnvironment(\n keys: Environment[],\n defaultEnvironment: Environment,\n hostname: string\n): Environment {\n if (isTestEnvironment()) {\n return 'test';\n }\n\n if (isLocalHost(hostname)) {\n return 'dev';\n }\n\n for (const key of keys) {\n if (\n hostname.indexOf(`${key}.servicetitan.com`) >= 0 ||\n (key.endsWith('.st.dev') && hostname.indexOf(key) >= 0)\n ) {\n return key;\n }\n }\n\n return defaultEnvironment;\n}\n\nfunction isLocalHost(hostname: string) {\n return ['localhost', '127.0.0.1', 'app-web'].some(host => hostname.indexOf(host) >= 0);\n}\n\nfunction isTestEnvironment() {\n return process.env.NODE_ENV === 'test';\n}\n"],"names":["getValueForEnvironment","values","defaultEnvironment","hostname","window","location","keys","Object","key","detectEnvironment","isTestEnvironment","isLocalHost","indexOf","endsWith","some","host","process","env","NODE_ENV"],"mappings":"AAAA,gFAAgF;AAChF,gEAAgE;AAMhE,OAAO,SAASA,uBACZC,MAAyB,EACzBC,qBAAkC,IAAI,EACtCC,WAAmBC,OAAOC,QAAQ,CAACF,QAAQ;IAE3C,MAAMG,OAAOC,OAAOD,IAAI,CAACL;IACzB,MAAMO,MAAMC,kBAAkBH,MAAMJ,oBAAoBC;IACxD,OAAOF,MAAM,CAACO,IAAI;AACtB;AAEA,SAASC,kBACLH,IAAmB,EACnBJ,kBAA+B,EAC/BC,QAAgB;IAEhB,IAAIO,qBAAqB;QACrB,OAAO;IACX;IAEA,IAAIC,YAAYR,WAAW;QACvB,OAAO;IACX;IAEA,KAAK,MAAMK,OAAOF,KAAM;QACpB,IACIH,SAASS,OAAO,CAAC,GAAGJ,IAAI,iBAAiB,CAAC,KAAK,KAC9CA,IAAIK,QAAQ,CAAC,cAAcV,SAASS,OAAO,CAACJ,QAAQ,GACvD;YACE,OAAOA;QACX;IACJ;IAEA,OAAON;AACX;AAEA,SAASS,YAAYR,QAAgB;IACjC,OAAO;QAAC;QAAa;QAAa;KAAU,CAACW,IAAI,CAACC,CAAAA,OAAQZ,SAASS,OAAO,CAACG,SAAS;AACxF;AAEA,SAASL;IACL,OAAOM,QAAQC,GAAG,CAACC,QAAQ,KAAK;AACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/web-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.0",
|
|
4
4
|
"description": "Framework to build, register, and load Microfrontends into host applications",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/uikit/web-components",
|
|
6
6
|
"repository": {
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
"src"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@servicetitan/error-boundary": "
|
|
20
|
-
"@servicetitan/startup-utils": "
|
|
19
|
+
"@servicetitan/error-boundary": "36.0.0",
|
|
20
|
+
"@servicetitan/startup-utils": "36.0.0",
|
|
21
21
|
"lodash.get": "~4.4.2",
|
|
22
22
|
"mitt": "~3.0.1",
|
|
23
23
|
"semver": "~7.7.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@servicetitan/anvil2": "^2.
|
|
26
|
+
"@servicetitan/anvil2": "^2.7.0",
|
|
27
27
|
"@servicetitan/design-system": "~14.5.3",
|
|
28
|
-
"@servicetitan/launchdarkly-service": "
|
|
29
|
-
"@servicetitan/log-service": "
|
|
30
|
-
"@servicetitan/react-ioc": "
|
|
28
|
+
"@servicetitan/launchdarkly-service": "36.0.0",
|
|
29
|
+
"@servicetitan/log-service": "36.0.0",
|
|
30
|
+
"@servicetitan/react-ioc": "36.0.0",
|
|
31
31
|
"@testing-library/dom": "^10.4.1",
|
|
32
32
|
"@testing-library/jest-dom": "^6.9.1",
|
|
33
33
|
"@testing-library/react": "^16.3.2",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@servicetitan/anvil2": ">=1.5.0",
|
|
47
47
|
"@servicetitan/design-system": ">=14.5.3",
|
|
48
|
-
"@servicetitan/launchdarkly-service": "
|
|
49
|
-
"@servicetitan/log-service": "
|
|
50
|
-
"@servicetitan/react-ioc": "
|
|
48
|
+
"@servicetitan/launchdarkly-service": "36.0.0",
|
|
49
|
+
"@servicetitan/log-service": "36.0.0",
|
|
50
|
+
"@servicetitan/react-ioc": "36.0.0",
|
|
51
51
|
"history": "~4.10.1",
|
|
52
52
|
"react": ">=17.0.2",
|
|
53
53
|
"react-dom": ">=17.0.2"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"cli": {
|
|
70
70
|
"webpack": false
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "73584720991027dd55eaeb24fb8e09bad656dbad"
|
|
73
73
|
}
|
|
@@ -56,7 +56,7 @@ describe(`[web-components] ${getValueForEnvironment.name}`, () => {
|
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
describe.each(['127.0.0.1', 'localhost'])('when hostname contains "%s"', host => {
|
|
59
|
+
describe.each(['127.0.0.1', 'localhost', 'app-web'])('when hostname contains "%s"', host => {
|
|
60
60
|
beforeEach(() => (hostname = host));
|
|
61
61
|
|
|
62
62
|
test('returns id for "dev" environment', () => {
|
|
@@ -41,7 +41,7 @@ function detectEnvironment(
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function isLocalHost(hostname: string) {
|
|
44
|
-
return ['localhost', '127.0.0.1'].some(host => hostname.indexOf(host) >= 0);
|
|
44
|
+
return ['localhost', '127.0.0.1', 'app-web'].some(host => hostname.indexOf(host) >= 0);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function isTestEnvironment() {
|