@elliemae/pui-app-sdk 3.12.0 → 3.12.1
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/utils/auth/index.js +3 -3
- package/dist/cjs/view/login/index.js +15 -3
- package/dist/cjs/view/require-auth.js +1 -1
- package/dist/esm/utils/auth/index.js +3 -3
- package/dist/esm/view/login/index.js +13 -4
- package/dist/esm/view/require-auth.js +1 -1
- package/dist/types/utils/auth/index.d.ts +3 -1
- package/dist/types/view/login/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -138,7 +138,6 @@ const authorize = async ({
|
|
|
138
138
|
const data = await (0, import_users.getUser)({ userName });
|
|
139
139
|
sessionStorage.setItem("userSettings", JSON.stringify(data));
|
|
140
140
|
const pathName = new URL(redirectUri).pathname;
|
|
141
|
-
import_history.browserHistory.push(`${pathName.replace(/\/$/, "")}/_rerender`);
|
|
142
141
|
import_history.browserHistory.replace(pathName);
|
|
143
142
|
} catch (err) {
|
|
144
143
|
const code = err?.response?.data?.code;
|
|
@@ -165,7 +164,8 @@ const login = async ({
|
|
|
165
164
|
};
|
|
166
165
|
if (idpCode) {
|
|
167
166
|
await authorize(loginInfo);
|
|
168
|
-
|
|
169
|
-
navigateToLoginPage(loginInfo);
|
|
167
|
+
return { authorized: true };
|
|
170
168
|
}
|
|
169
|
+
navigateToLoginPage(loginInfo);
|
|
170
|
+
return { authorized: false };
|
|
171
171
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,23 +17,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
18
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
22
|
var login_exports = {};
|
|
20
23
|
__export(login_exports, {
|
|
21
24
|
Login: () => Login
|
|
22
25
|
});
|
|
23
26
|
module.exports = __toCommonJS(login_exports);
|
|
27
|
+
var React = __toESM(require("react"));
|
|
24
28
|
var import_react = require("react");
|
|
25
29
|
var import_react_redux = require("../../data/react-redux.js");
|
|
26
30
|
var import_auth = require("../../utils/auth/index.js");
|
|
27
31
|
var import_actions = require("../../data/auth/actions.js");
|
|
28
|
-
const Login = ({
|
|
32
|
+
const Login = ({
|
|
33
|
+
clientId,
|
|
34
|
+
scope,
|
|
35
|
+
responseType,
|
|
36
|
+
children
|
|
37
|
+
}) => {
|
|
38
|
+
const [userAuthorized, setUserAuthorized] = (0, import_react.useState)(false);
|
|
29
39
|
const dispatch = (0, import_react_redux.useAppDispatch)();
|
|
30
40
|
(0, import_react.useEffect)(() => {
|
|
31
|
-
(0, import_auth.login)({ clientId, scope, responseType }).then(() => {
|
|
41
|
+
(0, import_auth.login)({ clientId, scope, responseType }).then(({ authorized }) => {
|
|
42
|
+
if (authorized)
|
|
43
|
+
setUserAuthorized(true);
|
|
32
44
|
dispatch({ type: import_actions.LOGIN_SUCCESS });
|
|
33
45
|
}).catch(() => {
|
|
34
46
|
});
|
|
35
47
|
}, [dispatch, clientId, scope, responseType]);
|
|
36
|
-
return null;
|
|
48
|
+
return userAuthorized ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : null;
|
|
37
49
|
};
|
|
@@ -115,7 +115,6 @@ const authorize = async ({
|
|
|
115
115
|
const data = await getUser({ userName });
|
|
116
116
|
sessionStorage.setItem("userSettings", JSON.stringify(data));
|
|
117
117
|
const pathName = new URL(redirectUri).pathname;
|
|
118
|
-
history.push(`${pathName.replace(/\/$/, "")}/_rerender`);
|
|
119
118
|
history.replace(pathName);
|
|
120
119
|
} catch (err) {
|
|
121
120
|
const code = err?.response?.data?.code;
|
|
@@ -142,9 +141,10 @@ const login = async ({
|
|
|
142
141
|
};
|
|
143
142
|
if (idpCode) {
|
|
144
143
|
await authorize(loginInfo);
|
|
145
|
-
|
|
146
|
-
navigateToLoginPage(loginInfo);
|
|
144
|
+
return { authorized: true };
|
|
147
145
|
}
|
|
146
|
+
navigateToLoginPage(loginInfo);
|
|
147
|
+
return { authorized: false };
|
|
148
148
|
};
|
|
149
149
|
export {
|
|
150
150
|
authorize,
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
3
4
|
import { useAppDispatch } from "../../data/react-redux.js";
|
|
4
5
|
import { login } from "../../utils/auth/index.js";
|
|
5
6
|
import { LOGIN_SUCCESS } from "../../data/auth/actions.js";
|
|
6
|
-
const Login = ({
|
|
7
|
+
const Login = ({
|
|
8
|
+
clientId,
|
|
9
|
+
scope,
|
|
10
|
+
responseType,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const [userAuthorized, setUserAuthorized] = useState(false);
|
|
7
14
|
const dispatch = useAppDispatch();
|
|
8
15
|
useEffect(() => {
|
|
9
|
-
login({ clientId, scope, responseType }).then(() => {
|
|
16
|
+
login({ clientId, scope, responseType }).then(({ authorized }) => {
|
|
17
|
+
if (authorized)
|
|
18
|
+
setUserAuthorized(true);
|
|
10
19
|
dispatch({ type: LOGIN_SUCCESS });
|
|
11
20
|
}).catch(() => {
|
|
12
21
|
});
|
|
13
22
|
}, [dispatch, clientId, scope, responseType]);
|
|
14
|
-
return null;
|
|
23
|
+
return userAuthorized ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : null;
|
|
15
24
|
};
|
|
16
25
|
export {
|
|
17
26
|
Login
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
interface LoginParams {
|
|
2
3
|
clientId: string;
|
|
3
4
|
scope: string;
|
|
4
5
|
responseType: string;
|
|
6
|
+
children: React.ReactNode;
|
|
5
7
|
}
|
|
6
|
-
export declare const Login: ({ clientId, scope, responseType }: LoginParams) => null;
|
|
8
|
+
export declare const Login: ({ clientId, scope, responseType, children, }: LoginParams) => JSX.Element | null;
|
|
7
9
|
export {};
|