@elliemae/pui-app-sdk 4.2.2 → 4.2.4
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/cjs/api/auth/index.js +7 -3
- package/dist/cjs/view/micro-app/resources/script.js +4 -9
- package/dist/cjs/view/micro-app/resources/style.js +4 -9
- package/dist/esm/api/auth/index.js +7 -3
- package/dist/esm/view/micro-app/resources/script.js +4 -9
- package/dist/esm/view/micro-app/resources/style.js +4 -9
- package/dist/types/lib/view/micro-app/resources/script.d.ts +1 -1
- package/dist/types/lib/view/micro-app/resources/style.d.ts +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,10 @@ __export(auth_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(auth_exports);
|
|
26
26
|
var import_http_client = require("../../communication/http-client/index.js");
|
|
27
|
+
var import_config = require("../../utils/app-config/config.js");
|
|
28
|
+
const getIDPClient = () => (0, import_http_client.getHTTPClient)({
|
|
29
|
+
baseURL: (0, import_config.getAppConfigValue)("serviceEndpoints.idp", "")
|
|
30
|
+
});
|
|
27
31
|
const getToken = async ({
|
|
28
32
|
clientId,
|
|
29
33
|
redirectUri,
|
|
@@ -34,7 +38,7 @@ const getToken = async ({
|
|
|
34
38
|
params.append("client_id", clientId);
|
|
35
39
|
params.append("redirect_uri", redirectUri);
|
|
36
40
|
params.append("code", idpCode);
|
|
37
|
-
const { data } = await (
|
|
41
|
+
const { data } = await getIDPClient().post(
|
|
38
42
|
"/oauth2/v1/token",
|
|
39
43
|
params
|
|
40
44
|
);
|
|
@@ -44,7 +48,7 @@ const revokeToken = async ({ clientId, token }) => {
|
|
|
44
48
|
const params = new URLSearchParams();
|
|
45
49
|
params.append("token", token);
|
|
46
50
|
params.append("client_id", clientId);
|
|
47
|
-
await (
|
|
51
|
+
await getIDPClient().post("/oauth2/v1/token/revocation", params);
|
|
48
52
|
};
|
|
49
53
|
const introspectToken = async ({
|
|
50
54
|
clientId,
|
|
@@ -53,7 +57,7 @@ const introspectToken = async ({
|
|
|
53
57
|
const params = new URLSearchParams();
|
|
54
58
|
params.append("token", accessToken);
|
|
55
59
|
params.append("client_id", clientId);
|
|
56
|
-
const { data } = await (
|
|
60
|
+
const { data } = await getIDPClient().post(
|
|
57
61
|
"/oauth2/v1/token/introspection",
|
|
58
62
|
params
|
|
59
63
|
);
|
|
@@ -29,20 +29,15 @@ var import_url = require("../../../utils/url.js");
|
|
|
29
29
|
const APP_SCRIPT_ID_PREFIX = "emui-script-";
|
|
30
30
|
const HEAD_SCRIPTS = /(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js/;
|
|
31
31
|
const isHeadScript = (scriptSrc) => HEAD_SCRIPTS.test(scriptSrc);
|
|
32
|
-
const addScriptToDOM = ({ name, hostUrl, documentEle
|
|
33
|
-
if (!hostUrl
|
|
34
|
-
throw new Error(
|
|
35
|
-
"Unable to add scripts to DOM. hostUrl and manifestPath are required."
|
|
36
|
-
);
|
|
32
|
+
const addScriptToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
33
|
+
if (!hostUrl)
|
|
34
|
+
throw new Error("Unable to add scripts to DOM. hostUrl is required.");
|
|
37
35
|
return new Promise((resolve, reject) => {
|
|
38
36
|
const ele = documentEle.createElement("script");
|
|
39
37
|
if (!ele)
|
|
40
38
|
reject(new Error("Unable to insert Application scripts."));
|
|
41
39
|
ele.id = `${APP_SCRIPT_ID_PREFIX}${name}-${index}`;
|
|
42
|
-
const url = new URL(
|
|
43
|
-
`${manifestPath.replace(/\/?$/, "/")}${fileName}`,
|
|
44
|
-
hostUrl
|
|
45
|
-
);
|
|
40
|
+
const url = new URL(fileName, hostUrl);
|
|
46
41
|
ele.src = (0, import_url.removeDoubleSlash)(url.href);
|
|
47
42
|
ele.onload = resolve.bind(null, ele.id);
|
|
48
43
|
ele.onerror = reject.bind(null, ele.id);
|
|
@@ -26,21 +26,16 @@ __export(style_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(style_exports);
|
|
27
27
|
var import_url = require("../../../utils/url.js");
|
|
28
28
|
const APP_STYLE_ID_PREFIX = "emui-style-";
|
|
29
|
-
const addStylesToDOM = ({ name, hostUrl, documentEle
|
|
30
|
-
if (!hostUrl
|
|
31
|
-
throw new Error(
|
|
32
|
-
"Unable to add styles to DOM. hostUrl and manifestPath are required."
|
|
33
|
-
);
|
|
29
|
+
const addStylesToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
30
|
+
if (!hostUrl)
|
|
31
|
+
throw new Error("Unable to add styles to DOM. hostUrl is required.");
|
|
34
32
|
return new Promise((resolve, reject) => {
|
|
35
33
|
const ele = documentEle.createElement("link");
|
|
36
34
|
if (!ele)
|
|
37
35
|
reject(new Error("Unable to insert Application styles."));
|
|
38
36
|
ele.id = `${APP_STYLE_ID_PREFIX}${name}-${index}`;
|
|
39
37
|
ele.rel = "stylesheet";
|
|
40
|
-
const url = new URL(
|
|
41
|
-
`${manifestPath.replace(/\/?$/, "/")}${fileName}`,
|
|
42
|
-
hostUrl
|
|
43
|
-
);
|
|
38
|
+
const url = new URL(fileName, hostUrl);
|
|
44
39
|
ele.href = (0, import_url.removeDoubleSlash)(url.href);
|
|
45
40
|
ele.onload = resolve.bind(null, ele.id);
|
|
46
41
|
documentEle.head.appendChild(ele);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { getHTTPClient } from "../../communication/http-client/index.js";
|
|
2
|
+
import { getAppConfigValue } from "../../utils/app-config/config.js";
|
|
3
|
+
const getIDPClient = () => getHTTPClient({
|
|
4
|
+
baseURL: getAppConfigValue("serviceEndpoints.idp", "")
|
|
5
|
+
});
|
|
2
6
|
const getToken = async ({
|
|
3
7
|
clientId,
|
|
4
8
|
redirectUri,
|
|
@@ -9,7 +13,7 @@ const getToken = async ({
|
|
|
9
13
|
params.append("client_id", clientId);
|
|
10
14
|
params.append("redirect_uri", redirectUri);
|
|
11
15
|
params.append("code", idpCode);
|
|
12
|
-
const { data } = await
|
|
16
|
+
const { data } = await getIDPClient().post(
|
|
13
17
|
"/oauth2/v1/token",
|
|
14
18
|
params
|
|
15
19
|
);
|
|
@@ -19,7 +23,7 @@ const revokeToken = async ({ clientId, token }) => {
|
|
|
19
23
|
const params = new URLSearchParams();
|
|
20
24
|
params.append("token", token);
|
|
21
25
|
params.append("client_id", clientId);
|
|
22
|
-
await
|
|
26
|
+
await getIDPClient().post("/oauth2/v1/token/revocation", params);
|
|
23
27
|
};
|
|
24
28
|
const introspectToken = async ({
|
|
25
29
|
clientId,
|
|
@@ -28,7 +32,7 @@ const introspectToken = async ({
|
|
|
28
32
|
const params = new URLSearchParams();
|
|
29
33
|
params.append("token", accessToken);
|
|
30
34
|
params.append("client_id", clientId);
|
|
31
|
-
const { data } = await
|
|
35
|
+
const { data } = await getIDPClient().post(
|
|
32
36
|
"/oauth2/v1/token/introspection",
|
|
33
37
|
params
|
|
34
38
|
);
|
|
@@ -2,20 +2,15 @@ import { removeDoubleSlash } from "../../../utils/url.js";
|
|
|
2
2
|
const APP_SCRIPT_ID_PREFIX = "emui-script-";
|
|
3
3
|
const HEAD_SCRIPTS = /(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js/;
|
|
4
4
|
const isHeadScript = (scriptSrc) => HEAD_SCRIPTS.test(scriptSrc);
|
|
5
|
-
const addScriptToDOM = ({ name, hostUrl, documentEle
|
|
6
|
-
if (!hostUrl
|
|
7
|
-
throw new Error(
|
|
8
|
-
"Unable to add scripts to DOM. hostUrl and manifestPath are required."
|
|
9
|
-
);
|
|
5
|
+
const addScriptToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
6
|
+
if (!hostUrl)
|
|
7
|
+
throw new Error("Unable to add scripts to DOM. hostUrl is required.");
|
|
10
8
|
return new Promise((resolve, reject) => {
|
|
11
9
|
const ele = documentEle.createElement("script");
|
|
12
10
|
if (!ele)
|
|
13
11
|
reject(new Error("Unable to insert Application scripts."));
|
|
14
12
|
ele.id = `${APP_SCRIPT_ID_PREFIX}${name}-${index}`;
|
|
15
|
-
const url = new URL(
|
|
16
|
-
`${manifestPath.replace(/\/?$/, "/")}${fileName}`,
|
|
17
|
-
hostUrl
|
|
18
|
-
);
|
|
13
|
+
const url = new URL(fileName, hostUrl);
|
|
19
14
|
ele.src = removeDoubleSlash(url.href);
|
|
20
15
|
ele.onload = resolve.bind(null, ele.id);
|
|
21
16
|
ele.onerror = reject.bind(null, ele.id);
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { removeDoubleSlash } from "../../../utils/url.js";
|
|
2
2
|
const APP_STYLE_ID_PREFIX = "emui-style-";
|
|
3
|
-
const addStylesToDOM = ({ name, hostUrl, documentEle
|
|
4
|
-
if (!hostUrl
|
|
5
|
-
throw new Error(
|
|
6
|
-
"Unable to add styles to DOM. hostUrl and manifestPath are required."
|
|
7
|
-
);
|
|
3
|
+
const addStylesToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
4
|
+
if (!hostUrl)
|
|
5
|
+
throw new Error("Unable to add styles to DOM. hostUrl is required.");
|
|
8
6
|
return new Promise((resolve, reject) => {
|
|
9
7
|
const ele = documentEle.createElement("link");
|
|
10
8
|
if (!ele)
|
|
11
9
|
reject(new Error("Unable to insert Application styles."));
|
|
12
10
|
ele.id = `${APP_STYLE_ID_PREFIX}${name}-${index}`;
|
|
13
11
|
ele.rel = "stylesheet";
|
|
14
|
-
const url = new URL(
|
|
15
|
-
`${manifestPath.replace(/\/?$/, "/")}${fileName}`,
|
|
16
|
-
hostUrl
|
|
17
|
-
);
|
|
12
|
+
const url = new URL(fileName, hostUrl);
|
|
18
13
|
ele.href = removeDoubleSlash(url.href);
|
|
19
14
|
ele.onload = resolve.bind(null, ele.id);
|
|
20
15
|
documentEle.head.appendChild(ele);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MicroAppConfig } from '../../../utils/micro-frontend/types.js';
|
|
2
2
|
export declare const APP_SCRIPT_ID_PREFIX = "emui-script-";
|
|
3
|
-
export declare const addScriptToDOM: ({ name, hostUrl, documentEle
|
|
3
|
+
export declare const addScriptToDOM: ({ name, hostUrl, documentEle }: MicroAppConfig, fileName: string, index: number) => Promise<string>;
|
|
4
4
|
export declare const removeScriptFromDOM: (elementId?: string, documentEle?: Document) => Promise<void>;
|
|
5
5
|
export declare const removeDynamicImportedScripts: (hostUrl: string, documentEle: HTMLDocument) => void;
|
|
6
6
|
export declare const removePrefetchLinks: (hostUrl: string, documentEle: HTMLDocument) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MicroAppConfig } from '../../../utils/micro-frontend/types.js';
|
|
2
2
|
export declare const APP_STYLE_ID_PREFIX = "emui-style-";
|
|
3
|
-
export declare const addStylesToDOM: ({ name, hostUrl, documentEle
|
|
3
|
+
export declare const addStylesToDOM: ({ name, hostUrl, documentEle }: MicroAppConfig, fileName: string, index: number) => Promise<string>;
|
|
4
4
|
export declare const removeStyleFromDOM: (elementId?: string, documentEle?: Document) => Promise<void>;
|
|
5
5
|
export declare const removeDynamicImportedStyles: (hostUrl: string, documentEle: Document) => void;
|