asma-helpers 0.6.16 → 0.6.18
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.
|
@@ -5,16 +5,20 @@
|
|
|
5
5
|
* mst_stores_toPersisit - array of mst stores that should be persisted in indexedDB
|
|
6
6
|
* data_for_registered_subdomain_check - data needed to check if subdomain is registered to an exiting tenant in the db
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function initASMAAppVitals({
|
|
9
9
|
/**
|
|
10
10
|
* //TODO invesigate how to internalyze this variable
|
|
11
11
|
* add qiankunWindow.__POWERED_BY_QIANKUN__ there where qiankunWindow is awailable
|
|
12
12
|
*/
|
|
13
|
-
is_child_app,
|
|
13
|
+
authenticated, is_child_app, subdomain_check, mst_stores_to_persisit, setLoadMicroApp, }: {
|
|
14
14
|
setLoadMicroApp(dev_mode: boolean): Promise<void>;
|
|
15
15
|
is_child_app?: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
mst_stores_to_persisit: Object[];
|
|
17
|
+
/**
|
|
18
|
+
* whenether user is authenticated or not
|
|
19
|
+
*/
|
|
20
|
+
authenticated: () => boolean;
|
|
21
|
+
subdomain_check: {
|
|
18
22
|
/**
|
|
19
23
|
* redirects to domain if subdomain is not registered
|
|
20
24
|
* ex: https://non-existent.adopus.no -> https://www.adopus.no
|
|
@@ -28,10 +32,6 @@ is_child_app, data_for_registered_subdomain_check, mst_stores_toPersisit, setLoa
|
|
|
28
32
|
fretexLogo: string;
|
|
29
33
|
carasentLogo: string;
|
|
30
34
|
};
|
|
31
|
-
/**
|
|
32
|
-
* whenether user is authenticated or not
|
|
33
|
-
*/
|
|
34
|
-
authenticated: () => boolean;
|
|
35
35
|
/**
|
|
36
36
|
* temporary solution need to be removed after theming will be implemented in all app-shells (app-shell, app-advoca, advoca-portal)
|
|
37
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initAppVitals.d.ts","sourceRoot":"","sources":["../../src/helpers/initAppVitals.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAsB,
|
|
1
|
+
{"version":3,"file":"initAppVitals.d.ts","sourceRoot":"","sources":["../../src/helpers/initAppVitals.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC;AACpC;;;GAGG;AACH,aAAa,EACb,YAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,eAAe,GAClB,EAAE;IACC,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,sBAAsB,EAAE,MAAM,EAAE,CAAA;IAChC;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAA;IAC5B,eAAe,EAAE;QACb;;;WAGG;QACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;QAChC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;QACnD;;WAEG;QACH,KAAK,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,CAAA;SAAE,CAAA;QACnD;;WAEG;QACH,OAAO,EAAE,WAAW,GAAG,YAAY,GAAG,eAAe,CAAA;KACxD,CAAA;CACJ,2CAsBA"}
|
|
@@ -10,23 +10,23 @@ import { initiatieIDBListenersOnMstSnaphsots } from './InitializeIDBListenersOnM
|
|
|
10
10
|
* mst_stores_toPersisit - array of mst stores that should be persisted in indexedDB
|
|
11
11
|
* data_for_registered_subdomain_check - data needed to check if subdomain is registered to an exiting tenant in the db
|
|
12
12
|
*/
|
|
13
|
-
export async function
|
|
13
|
+
export async function initASMAAppVitals({
|
|
14
14
|
/**
|
|
15
15
|
* //TODO invesigate how to internalyze this variable
|
|
16
16
|
* add qiankunWindow.__POWERED_BY_QIANKUN__ there where qiankunWindow is awailable
|
|
17
17
|
*/
|
|
18
|
-
is_child_app = false,
|
|
18
|
+
authenticated, is_child_app = false, subdomain_check, mst_stores_to_persisit, setLoadMicroApp, }) {
|
|
19
19
|
await fetchConfigsInternal();
|
|
20
20
|
await clearCacheData(EnvConfigsFnInternal().CACHE_VERSION);
|
|
21
21
|
await setLoadMicroApp(EnvConfigsFnInternal().DEVELOPMENT);
|
|
22
|
-
const promises =
|
|
22
|
+
const promises = mst_stores_to_persisit.map((store) => initiatieIDBListenersOnMstSnaphsots(store));
|
|
23
23
|
await Promise.allSettled(promises);
|
|
24
|
-
let registeredSubdomain =
|
|
24
|
+
let registeredSubdomain = true;
|
|
25
25
|
if (!is_child_app) {
|
|
26
|
-
const [registeredSubdomain1] = await checkForRegisteredSubdomain(
|
|
26
|
+
const [registeredSubdomain1] = await checkForRegisteredSubdomain({ ...subdomain_check, authenticated });
|
|
27
27
|
registeredSubdomain = registeredSubdomain1;
|
|
28
|
+
authenticated() && (await getCachedJwtInternal());
|
|
28
29
|
}
|
|
29
|
-
data_for_registered_subdomain_check.authenticated() && (await getCachedJwtInternal());
|
|
30
30
|
return [registeredSubdomain];
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=initAppVitals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initAppVitals.js","sourceRoot":"","sources":["../../src/helpers/initAppVitals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAA;AAE5F;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"initAppVitals.js","sourceRoot":"","sources":["../../src/helpers/initAppVitals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAA;AAE5F;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC;AACpC;;;GAGG;AACH,aAAa,EACb,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,sBAAsB,EACtB,eAAe,GAyBlB;IACG,MAAM,oBAAoB,EAAE,CAAA;IAE5B,MAAM,cAAc,CAAC,oBAAoB,EAAE,CAAC,aAAa,CAAC,CAAA;IAE1D,MAAM,eAAe,CAAC,oBAAoB,EAAE,CAAC,WAAW,CAAC,CAAA;IAEzD,MAAM,QAAQ,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAC,CAAA;IAElG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAElC,IAAI,mBAAmB,GAAG,IAAI,CAAA;IAE9B,IAAI,CAAC,YAAY,EAAE;QACf,MAAM,CAAC,oBAAoB,CAAC,GAAG,MAAM,2BAA2B,CAAC,EAAE,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;QAEvG,mBAAmB,GAAG,oBAAoB,CAAA;QAE1C,aAAa,EAAE,IAAI,CAAC,MAAM,oBAAoB,EAAE,CAAC,CAAA;KACpD;IAED,OAAO,CAAC,mBAAmB,CAAmC,CAAA;AAClE,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,20 +11,25 @@ import { initiatieIDBListenersOnMstSnaphsots } from './InitializeIDBListenersOnM
|
|
|
11
11
|
* mst_stores_toPersisit - array of mst stores that should be persisted in indexedDB
|
|
12
12
|
* data_for_registered_subdomain_check - data needed to check if subdomain is registered to an exiting tenant in the db
|
|
13
13
|
*/
|
|
14
|
-
export async function
|
|
14
|
+
export async function initASMAAppVitals({
|
|
15
15
|
/**
|
|
16
16
|
* //TODO invesigate how to internalyze this variable
|
|
17
17
|
* add qiankunWindow.__POWERED_BY_QIANKUN__ there where qiankunWindow is awailable
|
|
18
18
|
*/
|
|
19
|
+
authenticated,
|
|
19
20
|
is_child_app = false,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
subdomain_check,
|
|
22
|
+
mst_stores_to_persisit,
|
|
22
23
|
setLoadMicroApp,
|
|
23
24
|
}: {
|
|
24
25
|
setLoadMicroApp(dev_mode: boolean): Promise<void>
|
|
25
26
|
is_child_app?: boolean
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
mst_stores_to_persisit: Object[]
|
|
28
|
+
/**
|
|
29
|
+
* whenether user is authenticated or not
|
|
30
|
+
*/
|
|
31
|
+
authenticated: () => boolean
|
|
32
|
+
subdomain_check: {
|
|
28
33
|
/**
|
|
29
34
|
* redirects to domain if subdomain is not registered
|
|
30
35
|
* ex: https://non-existent.adopus.no -> https://www.adopus.no
|
|
@@ -35,10 +40,6 @@ export async function initAppVitals({
|
|
|
35
40
|
* //TODO temporary solution need to be fetched logos dynamically from srv-auth (origin service is srv-storage or srv-directory)
|
|
36
41
|
*/
|
|
37
42
|
logos: { fretexLogo: string; carasentLogo: string }
|
|
38
|
-
/**
|
|
39
|
-
* whenether user is authenticated or not
|
|
40
|
-
*/
|
|
41
|
-
authenticated: () => boolean
|
|
42
43
|
/**
|
|
43
44
|
* temporary solution need to be removed after theming will be implemented in all app-shells (app-shell, app-advoca, advoca-portal)
|
|
44
45
|
*/
|
|
@@ -51,19 +52,19 @@ export async function initAppVitals({
|
|
|
51
52
|
|
|
52
53
|
await setLoadMicroApp(EnvConfigsFnInternal().DEVELOPMENT)
|
|
53
54
|
|
|
54
|
-
const promises =
|
|
55
|
+
const promises = mst_stores_to_persisit.map((store) => initiatieIDBListenersOnMstSnaphsots(store))
|
|
55
56
|
|
|
56
57
|
await Promise.allSettled(promises)
|
|
57
58
|
|
|
58
|
-
let registeredSubdomain =
|
|
59
|
+
let registeredSubdomain = true
|
|
59
60
|
|
|
60
61
|
if (!is_child_app) {
|
|
61
|
-
const [registeredSubdomain1] = await checkForRegisteredSubdomain(
|
|
62
|
+
const [registeredSubdomain1] = await checkForRegisteredSubdomain({ ...subdomain_check, authenticated })
|
|
62
63
|
|
|
63
64
|
registeredSubdomain = registeredSubdomain1
|
|
64
|
-
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
authenticated() && (await getCachedJwtInternal())
|
|
67
|
+
}
|
|
67
68
|
|
|
68
69
|
return [registeredSubdomain] as [registeredSubdomain: boolean]
|
|
69
70
|
}
|