@elliemae/pui-app-sdk 4.13.5 → 4.13.7
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 +3 -1
- package/dist/cjs/utils/auth/index.js +2 -1
- package/dist/cjs/utils/testing/render-with-router-redux.js +14 -15
- package/dist/esm/api/auth/index.js +3 -1
- package/dist/esm/utils/auth/index.js +2 -1
- package/dist/esm/utils/testing/render-with-router-redux.js +14 -15
- package/dist/types/lib/api/auth/index.d.ts +2 -1
- package/dist/types/lib/utils/testing/render-with-router-redux.d.ts +5 -4
- package/package.json +1 -1
|
@@ -27,13 +27,15 @@ var import_http_client = require("../../communication/http-client/index.js");
|
|
|
27
27
|
const getToken = async ({
|
|
28
28
|
clientId,
|
|
29
29
|
redirectUri,
|
|
30
|
-
idpCode
|
|
30
|
+
idpCode,
|
|
31
|
+
scope
|
|
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);
|
|
36
37
|
params.append("code", idpCode);
|
|
38
|
+
params.append("scope", scope);
|
|
37
39
|
const { data } = await (0, import_http_client.getHTTPClient)().post(
|
|
38
40
|
"/oauth2/v1/token",
|
|
39
41
|
params
|
|
@@ -113,7 +113,8 @@ const authorize = async ({
|
|
|
113
113
|
const { tokenType, accessToken } = await (0, import_auth.getToken)({
|
|
114
114
|
idpCode,
|
|
115
115
|
redirectUri,
|
|
116
|
-
clientId
|
|
116
|
+
clientId,
|
|
117
|
+
scope
|
|
117
118
|
});
|
|
118
119
|
const authorizationToken = `${tokenType} ${accessToken}`;
|
|
119
120
|
(0, import_helper.setAuthorizationHeader)(authorizationToken);
|
|
@@ -26,19 +26,18 @@ var import_react = require("@testing-library/react");
|
|
|
26
26
|
var import_react_redux = require("react-redux");
|
|
27
27
|
var import_history = require("history");
|
|
28
28
|
var import_store = require("../../data/store.js");
|
|
29
|
-
var import_history2 = require("../history.js");
|
|
30
29
|
var import_app_router = require("../../view/app-router.js");
|
|
31
|
-
const renderWithRouterRedux = (ui, {
|
|
32
|
-
route = "/",
|
|
33
|
-
history = (0, import_history.createMemoryHistory)({ initialEntries: [route] })
|
|
34
|
-
initialState,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
30
|
+
const renderWithRouterRedux = (ui, options) => {
|
|
31
|
+
const { route = "/", basename = "/", initialState } = options || {};
|
|
32
|
+
const { history = (0, import_history.createMemoryHistory)({ initialEntries: [route] }) } = options || {};
|
|
33
|
+
const { store = (0, import_store.createAppStore)(initialState, history) } = options || {};
|
|
34
|
+
return {
|
|
35
|
+
...(0, import_react.render)(
|
|
36
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_redux.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_app_router.AppRouter, { basename, history, children: ui }) })
|
|
37
|
+
),
|
|
38
|
+
// adding `store` to the returned utilities to allow us
|
|
39
|
+
// to reference it in our tests (just try to avoid using
|
|
40
|
+
// this to test implementation details).
|
|
41
|
+
store
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -2,13 +2,15 @@ import { getHTTPClient } from "../../communication/http-client/index.js";
|
|
|
2
2
|
const getToken = async ({
|
|
3
3
|
clientId,
|
|
4
4
|
redirectUri,
|
|
5
|
-
idpCode
|
|
5
|
+
idpCode,
|
|
6
|
+
scope
|
|
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);
|
|
11
12
|
params.append("code", idpCode);
|
|
13
|
+
params.append("scope", scope);
|
|
12
14
|
const { data } = await getHTTPClient().post(
|
|
13
15
|
"/oauth2/v1/token",
|
|
14
16
|
params
|
|
@@ -89,7 +89,8 @@ const authorize = async ({
|
|
|
89
89
|
const { tokenType, accessToken } = await getToken({
|
|
90
90
|
idpCode,
|
|
91
91
|
redirectUri,
|
|
92
|
-
clientId
|
|
92
|
+
clientId,
|
|
93
|
+
scope
|
|
93
94
|
});
|
|
94
95
|
const authorizationToken = `${tokenType} ${accessToken}`;
|
|
95
96
|
setAuthorizationHeader(authorizationToken);
|
|
@@ -3,22 +3,21 @@ import { render } from "@testing-library/react";
|
|
|
3
3
|
import { Provider } from "react-redux";
|
|
4
4
|
import { createMemoryHistory } from "history";
|
|
5
5
|
import { createAppStore } from "../../data/store.js";
|
|
6
|
-
import { browserHistory } from "../history.js";
|
|
7
6
|
import { AppRouter } from "../../view/app-router.js";
|
|
8
|
-
const renderWithRouterRedux = (ui, {
|
|
9
|
-
route = "/",
|
|
10
|
-
history = createMemoryHistory({ initialEntries: [route] })
|
|
11
|
-
initialState,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
7
|
+
const renderWithRouterRedux = (ui, options) => {
|
|
8
|
+
const { route = "/", basename = "/", initialState } = options || {};
|
|
9
|
+
const { history = createMemoryHistory({ initialEntries: [route] }) } = options || {};
|
|
10
|
+
const { store = createAppStore(initialState, history) } = options || {};
|
|
11
|
+
return {
|
|
12
|
+
...render(
|
|
13
|
+
/* @__PURE__ */ jsx(Provider, { store, children: /* @__PURE__ */ jsx(AppRouter, { basename, history, children: ui }) })
|
|
14
|
+
),
|
|
15
|
+
// adding `store` to the returned utilities to allow us
|
|
16
|
+
// to reference it in our tests (just try to avoid using
|
|
17
|
+
// this to test implementation details).
|
|
18
|
+
store
|
|
19
|
+
};
|
|
20
|
+
};
|
|
22
21
|
export {
|
|
23
22
|
renderWithRouterRedux
|
|
24
23
|
};
|
|
@@ -3,6 +3,7 @@ interface GetTokenRequestParams {
|
|
|
3
3
|
clientId: string;
|
|
4
4
|
redirectUri: string;
|
|
5
5
|
idpCode: string;
|
|
6
|
+
scope: 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: ({ clientId, redirectUri, idpCode, scope, }: GetTokenRequestParams) => Promise<{
|
|
18
19
|
tokenType: string;
|
|
19
20
|
accessToken: string;
|
|
20
21
|
}>;
|
|
@@ -3,11 +3,12 @@ import { History } from 'history';
|
|
|
3
3
|
import { AppStore, RootState } from '../../data/store.js';
|
|
4
4
|
interface Args {
|
|
5
5
|
initialState: RootState;
|
|
6
|
-
store
|
|
7
|
-
route
|
|
8
|
-
|
|
6
|
+
store?: AppStore;
|
|
7
|
+
route?: string;
|
|
8
|
+
basename?: string;
|
|
9
|
+
history?: History;
|
|
9
10
|
}
|
|
10
|
-
export declare const renderWithRouterRedux: (ui: React.ReactElement,
|
|
11
|
+
export declare const renderWithRouterRedux: (ui: React.ReactElement, options?: Args) => {
|
|
11
12
|
store: import("@reduxjs/toolkit/dist/configureStore.js").ToolkitStore<import("redux").EmptyObject & {
|
|
12
13
|
waitMessage: import("../../data/wait-message/reducer.js").WaitMessageState;
|
|
13
14
|
error: import("../../data/error/index.js").ErrorState;
|