@contember/react-client-tenant 2.1.0-alpha.23 → 2.1.0-alpha.25
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/development/src/components/idp/IDP.cjs +1 -1
- package/dist/development/src/components/idp/IDP.cjs.map +1 -1
- package/dist/development/src/components/idp/IDP.js +1 -1
- package/dist/development/src/components/idp/IDP.js.map +1 -1
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs +3 -3
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js +3 -3
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js.map +1 -1
- package/dist/production/src/components/idp/IDP.cjs +1 -1
- package/dist/production/src/components/idp/IDP.cjs.map +1 -1
- package/dist/production/src/components/idp/IDP.js +1 -1
- package/dist/production/src/components/idp/IDP.js.map +1 -1
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs +3 -3
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js +3 -3
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js.map +1 -1
- package/dist/types/internal/hooks/useHandleIDPResponse.d.ts +2 -1
- package/dist/types/internal/hooks/useHandleIDPResponse.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/idp/IDP.tsx +1 -1
- package/src/internal/hooks/useHandleIDPResponse.ts +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/react-client-tenant",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.1.0-alpha.
|
|
4
|
+
"version": "2.1.0-alpha.25",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"directory": "packages/react-client-tenant"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@contember/graphql-client-tenant": "2.1.0-alpha.
|
|
38
|
-
"@contember/react-client": "2.1.0-alpha.
|
|
39
|
-
"@contember/react-utils": "2.1.0-alpha.
|
|
37
|
+
"@contember/graphql-client-tenant": "2.1.0-alpha.25",
|
|
38
|
+
"@contember/react-client": "2.1.0-alpha.25",
|
|
39
|
+
"@contember/react-utils": "2.1.0-alpha.25",
|
|
40
40
|
"@radix-ui/primitive": "^1.1.0",
|
|
41
41
|
"@radix-ui/react-slot": "^1.1.0",
|
|
42
42
|
"graphql-ts-client-api": "^3.1.17"
|
|
@@ -30,7 +30,7 @@ export const IDP = ({ children, onResponseError, onInitError, onLogin, expiratio
|
|
|
30
30
|
}
|
|
31
31
|
return { type: 'nothing' }
|
|
32
32
|
})
|
|
33
|
-
useHandleIDPResponse({ hasOauthResponse, setState, onLogin, expiration: expiration })
|
|
33
|
+
useHandleIDPResponse({ hasOauthResponse, setState, onLogin, expiration: expiration, redirectUrl })
|
|
34
34
|
|
|
35
35
|
const initRedirect = useInitIDPRedirect({ setState, redirectUrl })
|
|
36
36
|
|
|
@@ -12,6 +12,7 @@ export interface UseHandleIDPResponseProps {
|
|
|
12
12
|
|
|
13
13
|
setState: (state: SetStateAction<IDPStateValue>) => void
|
|
14
14
|
hasOauthResponse: boolean
|
|
15
|
+
redirectUrl?: string
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const headers = {
|
|
@@ -20,7 +21,7 @@ const headers = {
|
|
|
20
21
|
|
|
21
22
|
const DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60 // 14 days
|
|
22
23
|
|
|
23
|
-
export const useHandleIDPResponse = ({ onLogin, expiration = DEFAULT_LOGIN_EXPIRATION, setState, hasOauthResponse }: UseHandleIDPResponseProps): void => {
|
|
24
|
+
export const useHandleIDPResponse = ({ onLogin, expiration = DEFAULT_LOGIN_EXPIRATION, setState, hasOauthResponse, redirectUrl }: UseHandleIDPResponseProps): void => {
|
|
24
25
|
const idpSignIn = useSignInIDPMutation({ headers })
|
|
25
26
|
const setSessionToken = useSetSessionToken()
|
|
26
27
|
|
|
@@ -44,7 +45,7 @@ export const useHandleIDPResponse = ({ onLogin, expiration = DEFAULT_LOGIN_EXPIR
|
|
|
44
45
|
const response = await idpSignIn({
|
|
45
46
|
data: {
|
|
46
47
|
url: window.location.href,
|
|
47
|
-
redirectUrl: getBaseHref(),
|
|
48
|
+
redirectUrl: redirectUrl || getBaseHref(),
|
|
48
49
|
sessionData: idpState.sessionData,
|
|
49
50
|
},
|
|
50
51
|
identityProvider: idpState.provider,
|
|
@@ -60,5 +61,5 @@ export const useHandleIDPResponse = ({ onLogin, expiration = DEFAULT_LOGIN_EXPIR
|
|
|
60
61
|
redirectToBackLink()
|
|
61
62
|
}
|
|
62
63
|
})()
|
|
63
|
-
}, [idpSignIn, onLogin, setSessionToken, hasOauthResponse, loadIdpState, expiration, setState, redirectToBackLink])
|
|
64
|
+
}, [idpSignIn, onLogin, setSessionToken, hasOauthResponse, loadIdpState, expiration, setState, redirectToBackLink, redirectUrl])
|
|
64
65
|
}
|