@elliemae/pui-app-sdk 5.3.8 → 5.3.10

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.
@@ -25,14 +25,16 @@ __export(auth_exports, {
25
25
  module.exports = __toCommonJS(auth_exports);
26
26
  var import_http_client = require("../../communication/http-client/index.js");
27
27
  const getToken = async ({
28
+ idpCode,
28
29
  clientId,
29
- redirectUri,
30
- idpCode
30
+ scope,
31
+ redirectUri
31
32
  }) => {
32
33
  const params = new URLSearchParams();
33
34
  params.append("grant_type", "authorization_code");
34
35
  params.append("client_id", clientId);
35
36
  params.append("redirect_uri", redirectUri);
37
+ params.append("scope", scope);
36
38
  params.append("code", idpCode);
37
39
  const { data } = await (0, import_http_client.getHTTPClient)().post(
38
40
  "/oauth2/v1/token",
@@ -112,8 +112,9 @@ const authorize = async ({
112
112
  try {
113
113
  const { tokenType, accessToken } = await (0, import_auth.getToken)({
114
114
  idpCode,
115
- redirectUri,
116
- clientId
115
+ clientId,
116
+ scope,
117
+ redirectUri
117
118
  });
118
119
  const authorizationToken = `${tokenType} ${accessToken}`;
119
120
  (0, import_helper.setAuthorizationHeader)(authorizationToken);
@@ -34,12 +34,18 @@ const Login = ({
34
34
  }) => {
35
35
  const [userAuthorized, setUserAuthorized] = (0, import_react.useState)(false);
36
36
  const dispatch = (0, import_react2.useAppDispatch)();
37
+ const ref = (0, import_react.useRef)(false);
37
38
  (0, import_react.useEffect)(() => {
39
+ if (ref.current)
40
+ return;
41
+ ref.current = true;
38
42
  (0, import_auth.login)({ clientId, scope, responseType }).then(({ authorized }) => {
39
43
  if (authorized)
40
44
  setUserAuthorized(true);
41
45
  dispatch({ type: import_actions.LOGIN_SUCCESS });
42
46
  }).catch(() => {
47
+ }).finally(() => {
48
+ ref.current = false;
43
49
  });
44
50
  }, [dispatch, clientId, scope, responseType]);
45
51
  return userAuthorized ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }) : null;
@@ -1,13 +1,15 @@
1
1
  import { getHTTPClient } from "../../communication/http-client/index.js";
2
2
  const getToken = async ({
3
+ idpCode,
3
4
  clientId,
4
- redirectUri,
5
- idpCode
5
+ scope,
6
+ redirectUri
6
7
  }) => {
7
8
  const params = new URLSearchParams();
8
9
  params.append("grant_type", "authorization_code");
9
10
  params.append("client_id", clientId);
10
11
  params.append("redirect_uri", redirectUri);
12
+ params.append("scope", scope);
11
13
  params.append("code", idpCode);
12
14
  const { data } = await getHTTPClient().post(
13
15
  "/oauth2/v1/token",
@@ -88,8 +88,9 @@ const authorize = async ({
88
88
  try {
89
89
  const { tokenType, accessToken } = await getToken({
90
90
  idpCode,
91
- redirectUri,
92
- clientId
91
+ clientId,
92
+ scope,
93
+ redirectUri
93
94
  });
94
95
  const authorizationToken = `${tokenType} ${accessToken}`;
95
96
  setAuthorizationHeader(authorizationToken);
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
2
+ import { useEffect, useState, useRef } from "react";
3
3
  import { useAppDispatch } from "../../data/react.js";
4
4
  import { login } from "../../utils/auth/index.js";
5
5
  import { LOGIN_SUCCESS } from "../../data/auth/actions.js";
@@ -11,12 +11,18 @@ const Login = ({
11
11
  }) => {
12
12
  const [userAuthorized, setUserAuthorized] = useState(false);
13
13
  const dispatch = useAppDispatch();
14
+ const ref = useRef(false);
14
15
  useEffect(() => {
16
+ if (ref.current)
17
+ return;
18
+ ref.current = true;
15
19
  login({ clientId, scope, responseType }).then(({ authorized }) => {
16
20
  if (authorized)
17
21
  setUserAuthorized(true);
18
22
  dispatch({ type: LOGIN_SUCCESS });
19
23
  }).catch(() => {
24
+ }).finally(() => {
25
+ ref.current = false;
20
26
  });
21
27
  }, [dispatch, clientId, scope, responseType]);
22
28
  return userAuthorized ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
@@ -1,8 +1,9 @@
1
1
  import { AxiosResponse, AxiosError } from 'axios';
2
2
  interface GetTokenRequestParams {
3
+ idpCode: string;
3
4
  clientId: string;
5
+ scope: string;
4
6
  redirectUri: string;
5
- idpCode: string;
6
7
  }
7
8
  export interface GetTokenResponse {
8
9
  token_type: string;
@@ -14,7 +15,7 @@ interface GetTokenError {
14
15
  export interface GetTokenErrorResponse extends AxiosError {
15
16
  response: AxiosResponse<GetTokenError>;
16
17
  }
17
- export declare const getToken: ({ clientId, redirectUri, idpCode, }: GetTokenRequestParams) => Promise<{
18
+ export declare const getToken: ({ idpCode, clientId, scope, redirectUri, }: GetTokenRequestParams) => Promise<{
18
19
  tokenType: string;
19
20
  accessToken: string;
20
21
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-app-sdk",
3
- "version": "5.3.8",
3
+ "version": "5.3.10",
4
4
  "description": "ICE MT UI Platform Application SDK ",
5
5
  "sideEffects": [
6
6
  "*.css",
@@ -111,7 +111,7 @@
111
111
  "indent": 4
112
112
  },
113
113
  "peerDependencies": {
114
- "@elliemae/app-react-dependencies": "^4.9.0",
114
+ "@elliemae/app-react-dependencies": "^4.11.0",
115
115
  "@elliemae/ds-backdrop": "^3.14.16",
116
116
  "@elliemae/ds-basic": "^3.14.16",
117
117
  "@elliemae/ds-button": "^3.14.16",
@@ -126,16 +126,17 @@
126
126
  "@elliemae/ds-modal": "^3.14.16",
127
127
  "@elliemae/ds-popperjs": "^3.14.16",
128
128
  "@elliemae/ds-toast": "^3.14.16",
129
+ "@elliemae/ds-utilities": "^3.14.16",
129
130
  "@elliemae/em-ssf-guest": "^1.11.3",
130
- "@elliemae/pui-diagnostics": "^3.2.0",
131
+ "@elliemae/pui-diagnostics": "^3.4.0",
131
132
  "@elliemae/pui-micro-frontend-base": "^1.14.0",
132
- "@elliemae/pui-scripting-object": "^1.20.0",
133
+ "@elliemae/pui-scripting-object": "^1.27.0",
133
134
  "@elliemae/pui-theme": "^2.7.0",
134
- "@elliemae/pui-user-monitoring": "^1.20.0"
135
+ "@elliemae/pui-user-monitoring": "^1.22.0"
135
136
  },
136
137
  "devDependencies": {
137
- "@elliemae/app-react-dependencies": "~4.10.0",
138
- "@elliemae/browserslist-config-elliemae-latest-browsers": "~1.7.0",
138
+ "@elliemae/app-react-dependencies": "~4.11.0",
139
+ "@elliemae/browserslist-config-elliemae-latest-browsers": "~1.8.0",
139
140
  "@elliemae/ds-backdrop": "~3.14.16",
140
141
  "@elliemae/ds-basic": "~3.14.16",
141
142
  "@elliemae/ds-button": "~3.14.16",
@@ -150,16 +151,16 @@
150
151
  "@elliemae/ds-modal": "~3.14.16",
151
152
  "@elliemae/ds-popperjs": "~3.14.16",
152
153
  "@elliemae/ds-toast": "~3.14.16",
154
+ "@elliemae/ds-utilities": "~3.14.16",
153
155
  "@elliemae/em-ssf-guest": "~1.11.3",
154
- "@elliemae/pui-cli": "~8.13.0",
155
- "@elliemae/pui-diagnostics": "~3.3.1",
156
+ "@elliemae/pui-cli": "~8.14.1",
157
+ "@elliemae/pui-diagnostics": "~3.4.0",
156
158
  "@elliemae/pui-doc-gen": "~1.7.1",
157
159
  "@elliemae/pui-e2e-test-sdk": "~8.1.4",
158
160
  "@elliemae/pui-micro-frontend-base": "~1.14.0",
159
- "@elliemae/pui-scripting-object": "~1.26.0",
161
+ "@elliemae/pui-scripting-object": "~1.27.0",
160
162
  "@elliemae/pui-theme": "~2.7.0",
161
- "@elliemae/pui-user-monitoring": "~1.21.3",
162
- "@types/react-aria-live": "~2.0.2",
163
- "@elliemae/ds-utilities": "^3.19.0"
163
+ "@elliemae/pui-user-monitoring": "~1.22.0",
164
+ "@types/react-aria-live": "~2.0.2"
164
165
  }
165
166
  }