@contember/react-client-tenant 2.1.0-alpha.23 → 2.1.0-alpha.24

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/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.23",
4
+ "version": "2.1.0-alpha.24",
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.23",
38
- "@contember/react-client": "2.1.0-alpha.23",
39
- "@contember/react-utils": "2.1.0-alpha.23",
37
+ "@contember/graphql-client-tenant": "2.1.0-alpha.24",
38
+ "@contember/react-client": "2.1.0-alpha.24",
39
+ "@contember/react-utils": "2.1.0-alpha.24",
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,