@react-keycloak-refork/web 5.0.0 → 8.0.0

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/LICENSE.md CHANGED
@@ -1,24 +1,24 @@
1
- MIT License
2
-
3
- Copyright (c) 2019-present, Mattia Panzeri <mattia.panzeri93@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person
6
- obtaining a copy of this software and associated documentation
7
- files (the "Software"), to deal in the Software without
8
- restriction, including without limitation the rights to use,
9
- copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the
11
- Software is furnished to do so, subject to the following
12
- conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019-present, Mattia Panzeri <mattia.panzeri93@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # React Keycloak <!-- omit in toc -->
4
4
 
5
- > React bindings for [Keycloak](https://www.keycloak.org/). Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for Keycloak >=26 support.
5
+ > React bindings for [Keycloak](https://www.keycloak.org/). Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for keycloak >=17 support.
6
6
 
7
7
  [![NPM (scoped)](https://img.shields.io/npm/v/@react-keycloak-fork/web?label=npm%20%7C%20web)](https://www.npmjs.com/package/@react-keycloak-fork/web)
8
8
 
@@ -39,13 +39,13 @@ React Keycloak requires:
39
39
  - `keycloak-js` **17.0.0** or later
40
40
 
41
41
  ```shell
42
- yarn add @react-keycloak-refork/web
42
+ yarn add @react-keycloak-fork/web
43
43
  ```
44
44
 
45
45
  or
46
46
 
47
47
  ```shell
48
- npm install --save @react-keycloak-refork/web
48
+ npm install --save @react-keycloak-fork/web
49
49
  ```
50
50
 
51
51
  ## Getting Started
@@ -69,7 +69,7 @@ export default keycloak
69
69
  Wrap your App inside `ReactKeycloakProvider` and pass the `keycloak` instance as prop
70
70
 
71
71
  ```js
72
- import { ReactKeycloakProvider } from '@react-keycloak-refork/web'
72
+ import { ReactKeycloakProvider } from '@react-keycloak-fork/web'
73
73
 
74
74
  import keycloak from './keycloak'
75
75
 
@@ -141,7 +141,7 @@ const App = () => {
141
141
  When a component requires access to `Keycloak`, you can use the `useKeycloak` Hook.
142
142
 
143
143
  ```js
144
- import { useKeycloak } from '@react-keycloak-refork/web'
144
+ import { useKeycloak } from '@react-keycloak-fork/web'
145
145
 
146
146
  export default () => {
147
147
  // Using Object destructuring
@@ -174,11 +174,11 @@ The instance will be initialized by `react-keycloak` but you'll need to be caref
174
174
 
175
175
  ## Examples
176
176
 
177
- See inside `examples` folder of [`@react-keycloak-refork/react-keycloak-examples`](https://github.com/react-keycloak/react-keycloak-examples) repository for various demo implementing this library main features.
177
+ See inside `examples` folder of [`@react-keycloak-fork/react-keycloak-examples`](https://github.com/react-keycloak/react-keycloak-examples) repository for various demo implementing this library main features.
178
178
 
179
179
  ## Guides and Articles
180
180
 
181
- - Migration guide for `@react-keycloak-refork/web` `v2.x to v3.x` can be found here [MIGRATION.md](https://github.com/react-keycloak/react-keycloak/blob/master/packages/web/MIGRATION.md).
181
+ - Migration guide for `@react-keycloak-fork/web` `v2.x to v3.x` can be found here [MIGRATION.md](https://github.com/react-keycloak/react-keycloak/blob/master/packages/web/MIGRATION.md).
182
182
 
183
183
  - [Secure React Routes & Component with Keycloak](https://medium.com/@cagline/authenticate-and-authorize-react-routes-component-with-keycloak-666e85662636), a (slightly outdated) guide on how to setup `Keycloak` and create secured contents in a `React` app, thanks to [@cagline](https://github.com/cagline) for the detailed article.
184
184
 
package/lib/context.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const reactKeycloakWebContext: import("react").Context<import("@react-keycloak-refork/core").IAuthContextProps<import("keycloak-js").default>>;
3
- export declare const ReactKeycloakWebContextConsumer: import("react").Consumer<import("@react-keycloak-refork/core").IAuthContextProps<import("keycloak-js").default>>;
1
+ import Keycloak from 'keycloak-js';
2
+ export declare const reactKeycloakWebContext: import("react").Context<import("@react-keycloak-fork/core").IAuthContextProps<Keycloak>>;
3
+ export declare const ReactKeycloakWebContextConsumer: import("react").Consumer<import("@react-keycloak-fork/core").IAuthContextProps<Keycloak>>;
package/lib/context.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createAuthContext } from '@react-keycloak-refork/core';
2
- export var reactKeycloakWebContext = createAuthContext();
3
- export var ReactKeycloakWebContextConsumer = reactKeycloakWebContext.Consumer;
1
+ import { createAuthContext } from '@react-keycloak-fork/core';
2
+ export var reactKeycloakWebContext = createAuthContext();
3
+ export var ReactKeycloakWebContextConsumer = reactKeycloakWebContext.Consumer;
4
4
  //# sourceMappingURL=context.js.map
@@ -6,5 +6,5 @@
6
6
  "@react-keycloak-refork\\web\\context.ts"
7
7
  ],
8
8
  "names": [],
9
- "mappings": "AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAG/D,MAAM,CAAC,IAAM,uBAAuB,GAAG,iBAAiB,EAAoB,CAAA;AAE5E,MAAM,CAAC,IAAM,+BAA+B,GAAG,uBAAuB,CAAC,QAAQ,CAAA"
9
+ "mappings": "AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG7D,MAAM,CAAC,IAAM,uBAAuB,GAAG,iBAAiB,EAAY,CAAA;AAEpE,MAAM,CAAC,IAAM,+BAA+B,GAAG,uBAAuB,CAAC,QAAQ,CAAA"
10
10
  }
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './provider';
2
- export * from './useKeycloak';
3
- export * from './withKeycloak';
1
+ export * from './provider';
2
+ export * from './useKeycloak';
3
+ export * from './withKeycloak';
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from './provider';
2
- export * from './useKeycloak';
3
- export * from './withKeycloak';
1
+ export * from './provider';
2
+ export * from './useKeycloak';
3
+ export * from './withKeycloak';
4
4
  //# sourceMappingURL=index.js.map
package/lib/provider.d.ts CHANGED
@@ -1,146 +1,140 @@
1
- /// <reference types="react" />
2
- export declare const ReactKeycloakProvider: {
3
- new (props: import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>): {
4
- state: {
5
- initialized: boolean;
6
- isAuthenticated: boolean;
7
- isLoading: boolean;
8
- };
9
- componentDidMount(): void;
10
- componentDidUpdate({ authClient: prevAuthClient, initOptions: prevInitOptions, }: import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>): void;
11
- init(): void;
12
- onError: (event: import("@react-keycloak-refork/core").AuthClientEvent) => (error?: import("@react-keycloak-refork/core").AuthClientError | undefined) => void;
13
- updateState: (event: import("@react-keycloak-refork/core").AuthClientEvent) => () => void;
14
- refreshToken: (event: import("@react-keycloak-refork/core").AuthClientEvent) => () => void;
15
- render(): import("react").JSX.Element;
16
- context: unknown;
17
- setState<K extends keyof {
18
- initialized: boolean;
19
- isAuthenticated: boolean;
20
- isLoading: boolean;
21
- }>(state: {
22
- initialized: boolean;
23
- isAuthenticated: boolean;
24
- isLoading: boolean;
25
- } | ((prevState: Readonly<{
26
- initialized: boolean;
27
- isAuthenticated: boolean;
28
- isLoading: boolean;
29
- }>, props: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>) => {
30
- initialized: boolean;
31
- isAuthenticated: boolean;
32
- isLoading: boolean;
33
- } | Pick<{
34
- initialized: boolean;
35
- isAuthenticated: boolean;
36
- isLoading: boolean;
37
- }, K> | null) | Pick<{
38
- initialized: boolean;
39
- isAuthenticated: boolean;
40
- isLoading: boolean;
41
- }, K> | null, callback?: (() => void) | undefined): void;
42
- forceUpdate(callback?: (() => void) | undefined): void;
43
- readonly props: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>;
44
- refs: {
45
- [key: string]: import("react").ReactInstance;
46
- };
47
- shouldComponentUpdate?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextState: Readonly<{
48
- initialized: boolean;
49
- isAuthenticated: boolean;
50
- isLoading: boolean;
51
- }>, nextContext: any): boolean;
52
- componentWillUnmount?(): void;
53
- componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
54
- getSnapshotBeforeUpdate?(prevProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, prevState: Readonly<{
55
- initialized: boolean;
56
- isAuthenticated: boolean;
57
- isLoading: boolean;
58
- }>): any;
59
- componentWillMount?(): void;
60
- UNSAFE_componentWillMount?(): void;
61
- componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextContext: any): void;
62
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextContext: any): void;
63
- componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextState: Readonly<{
64
- initialized: boolean;
65
- isAuthenticated: boolean;
66
- isLoading: boolean;
67
- }>, nextContext: any): void;
68
- UNSAFE_componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextState: Readonly<{
69
- initialized: boolean;
70
- isAuthenticated: boolean;
71
- isLoading: boolean;
72
- }>, nextContext: any): void;
73
- };
74
- new (props: import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>, context: any): {
75
- state: {
76
- initialized: boolean;
77
- isAuthenticated: boolean;
78
- isLoading: boolean;
79
- };
80
- componentDidMount(): void;
81
- componentDidUpdate({ authClient: prevAuthClient, initOptions: prevInitOptions, }: import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>): void;
82
- init(): void;
83
- onError: (event: import("@react-keycloak-refork/core").AuthClientEvent) => (error?: import("@react-keycloak-refork/core").AuthClientError | undefined) => void;
84
- updateState: (event: import("@react-keycloak-refork/core").AuthClientEvent) => () => void;
85
- refreshToken: (event: import("@react-keycloak-refork/core").AuthClientEvent) => () => void;
86
- render(): import("react").JSX.Element;
87
- context: unknown;
88
- setState<K_1 extends keyof {
89
- initialized: boolean;
90
- isAuthenticated: boolean;
91
- isLoading: boolean;
92
- }>(state: {
93
- initialized: boolean;
94
- isAuthenticated: boolean;
95
- isLoading: boolean;
96
- } | ((prevState: Readonly<{
97
- initialized: boolean;
98
- isAuthenticated: boolean;
99
- isLoading: boolean;
100
- }>, props: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>) => {
101
- initialized: boolean;
102
- isAuthenticated: boolean;
103
- isLoading: boolean;
104
- } | Pick<{
105
- initialized: boolean;
106
- isAuthenticated: boolean;
107
- isLoading: boolean;
108
- }, K_1> | null) | Pick<{
109
- initialized: boolean;
110
- isAuthenticated: boolean;
111
- isLoading: boolean;
112
- }, K_1> | null, callback?: (() => void) | undefined): void;
113
- forceUpdate(callback?: (() => void) | undefined): void;
114
- readonly props: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>;
115
- refs: {
116
- [key: string]: import("react").ReactInstance;
117
- };
118
- shouldComponentUpdate?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextState: Readonly<{
119
- initialized: boolean;
120
- isAuthenticated: boolean;
121
- isLoading: boolean;
122
- }>, nextContext: any): boolean;
123
- componentWillUnmount?(): void;
124
- componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
125
- getSnapshotBeforeUpdate?(prevProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, prevState: Readonly<{
126
- initialized: boolean;
127
- isAuthenticated: boolean;
128
- isLoading: boolean;
129
- }>): any;
130
- componentWillMount?(): void;
131
- UNSAFE_componentWillMount?(): void;
132
- componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextContext: any): void;
133
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextContext: any): void;
134
- componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextState: Readonly<{
135
- initialized: boolean;
136
- isAuthenticated: boolean;
137
- isLoading: boolean;
138
- }>, nextContext: any): void;
139
- UNSAFE_componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-refork/core").AuthProviderProps<import("keycloak-js/lib/keycloak").default>>, nextState: Readonly<{
140
- initialized: boolean;
141
- isAuthenticated: boolean;
142
- isLoading: boolean;
143
- }>, nextContext: any): void;
144
- };
145
- contextType?: import("react").Context<any> | undefined;
146
- };
1
+ export declare const ReactKeycloakProvider: {
2
+ new (props: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>): {
3
+ state: {
4
+ initialized: boolean;
5
+ isAuthenticated: boolean;
6
+ isLoading: boolean;
7
+ };
8
+ componentDidMount(): void;
9
+ componentDidUpdate({ authClient: prevAuthClient, initOptions: prevInitOptions, }: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>): void;
10
+ init(): void;
11
+ onError: (event: import("@react-keycloak-fork/core").AuthClientEvent) => (error?: import("@react-keycloak-fork/core").AuthClientError) => void;
12
+ updateState: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
13
+ refreshToken: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
14
+ render(): React.JSX.Element;
15
+ context: unknown;
16
+ setState<K extends keyof {
17
+ initialized: boolean;
18
+ isAuthenticated: boolean;
19
+ isLoading: boolean;
20
+ }>(state: {
21
+ initialized: boolean;
22
+ isAuthenticated: boolean;
23
+ isLoading: boolean;
24
+ } | ((prevState: Readonly<{
25
+ initialized: boolean;
26
+ isAuthenticated: boolean;
27
+ isLoading: boolean;
28
+ }>, props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>) => {
29
+ initialized: boolean;
30
+ isAuthenticated: boolean;
31
+ isLoading: boolean;
32
+ } | Pick<{
33
+ initialized: boolean;
34
+ isAuthenticated: boolean;
35
+ isLoading: boolean;
36
+ }, K> | null) | Pick<{
37
+ initialized: boolean;
38
+ isAuthenticated: boolean;
39
+ isLoading: boolean;
40
+ }, K> | null, callback?: (() => void) | undefined): void;
41
+ forceUpdate(callback?: (() => void) | undefined): void;
42
+ readonly props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>;
43
+ shouldComponentUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
44
+ initialized: boolean;
45
+ isAuthenticated: boolean;
46
+ isLoading: boolean;
47
+ }>, nextContext: any): boolean;
48
+ componentWillUnmount?(): void;
49
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
50
+ getSnapshotBeforeUpdate?(prevProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, prevState: Readonly<{
51
+ initialized: boolean;
52
+ isAuthenticated: boolean;
53
+ isLoading: boolean;
54
+ }>): any;
55
+ componentWillMount?(): void;
56
+ UNSAFE_componentWillMount?(): void;
57
+ componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
58
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
59
+ componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
60
+ initialized: boolean;
61
+ isAuthenticated: boolean;
62
+ isLoading: boolean;
63
+ }>, nextContext: any): void;
64
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
65
+ initialized: boolean;
66
+ isAuthenticated: boolean;
67
+ isLoading: boolean;
68
+ }>, nextContext: any): void;
69
+ };
70
+ new (props: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>, context: any): {
71
+ state: {
72
+ initialized: boolean;
73
+ isAuthenticated: boolean;
74
+ isLoading: boolean;
75
+ };
76
+ componentDidMount(): void;
77
+ componentDidUpdate({ authClient: prevAuthClient, initOptions: prevInitOptions, }: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>): void;
78
+ init(): void;
79
+ onError: (event: import("@react-keycloak-fork/core").AuthClientEvent) => (error?: import("@react-keycloak-fork/core").AuthClientError) => void;
80
+ updateState: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
81
+ refreshToken: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
82
+ render(): React.JSX.Element;
83
+ context: unknown;
84
+ setState<K extends keyof {
85
+ initialized: boolean;
86
+ isAuthenticated: boolean;
87
+ isLoading: boolean;
88
+ }>(state: {
89
+ initialized: boolean;
90
+ isAuthenticated: boolean;
91
+ isLoading: boolean;
92
+ } | ((prevState: Readonly<{
93
+ initialized: boolean;
94
+ isAuthenticated: boolean;
95
+ isLoading: boolean;
96
+ }>, props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>) => {
97
+ initialized: boolean;
98
+ isAuthenticated: boolean;
99
+ isLoading: boolean;
100
+ } | Pick<{
101
+ initialized: boolean;
102
+ isAuthenticated: boolean;
103
+ isLoading: boolean;
104
+ }, K> | null) | Pick<{
105
+ initialized: boolean;
106
+ isAuthenticated: boolean;
107
+ isLoading: boolean;
108
+ }, K> | null, callback?: (() => void) | undefined): void;
109
+ forceUpdate(callback?: (() => void) | undefined): void;
110
+ readonly props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>;
111
+ shouldComponentUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
112
+ initialized: boolean;
113
+ isAuthenticated: boolean;
114
+ isLoading: boolean;
115
+ }>, nextContext: any): boolean;
116
+ componentWillUnmount?(): void;
117
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
118
+ getSnapshotBeforeUpdate?(prevProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, prevState: Readonly<{
119
+ initialized: boolean;
120
+ isAuthenticated: boolean;
121
+ isLoading: boolean;
122
+ }>): any;
123
+ componentWillMount?(): void;
124
+ UNSAFE_componentWillMount?(): void;
125
+ componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
126
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
127
+ componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
128
+ initialized: boolean;
129
+ isAuthenticated: boolean;
130
+ isLoading: boolean;
131
+ }>, nextContext: any): void;
132
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
133
+ initialized: boolean;
134
+ isAuthenticated: boolean;
135
+ isLoading: boolean;
136
+ }>, nextContext: any): void;
137
+ };
138
+ contextType?: React.Context<any> | undefined;
139
+ propTypes?: any;
140
+ };
package/lib/provider.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createAuthProvider } from '@react-keycloak-refork/core';
2
- import { reactKeycloakWebContext } from './context';
3
- export var ReactKeycloakProvider = createAuthProvider(reactKeycloakWebContext);
1
+ import { createAuthProvider } from '@react-keycloak-fork/core';
2
+ import { reactKeycloakWebContext } from './context';
3
+ export var ReactKeycloakProvider = createAuthProvider(reactKeycloakWebContext);
4
4
  //# sourceMappingURL=provider.js.map
@@ -6,5 +6,5 @@
6
6
  "@react-keycloak-refork\\web\\provider.ts"
7
7
  ],
8
8
  "names": [],
9
- "mappings": "AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,CAAC,IAAM,qBAAqB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAAA"
9
+ "mappings": "AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,CAAC,IAAM,qBAAqB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAAA"
10
10
  }
@@ -1,4 +1,4 @@
1
- export declare function useKeycloak(): {
2
- initialized: boolean;
3
- keycloak: import("keycloak-js/lib/keycloak").default;
4
- };
1
+ export declare function useKeycloak(): {
2
+ initialized: boolean;
3
+ keycloak: import("keycloak-js").default;
4
+ };
@@ -1,17 +1,17 @@
1
- import { useContext } from 'react';
2
- import { reactKeycloakWebContext } from './context';
3
- export function useKeycloak() {
4
- var ctx = useContext(reactKeycloakWebContext);
5
- if (!ctx) {
6
- throw new Error('useKeycloak hook must be used inside ReactKeycloakProvider context');
7
- }
8
- if (!ctx.authClient) {
9
- throw new Error('authClient has not been assigned to ReactKeycloakProvider');
10
- }
11
- var authClient = ctx.authClient, initialized = ctx.initialized;
12
- return {
13
- initialized: initialized,
14
- keycloak: authClient,
15
- };
16
- }
1
+ import { useContext } from 'react';
2
+ import { reactKeycloakWebContext } from './context';
3
+ export function useKeycloak() {
4
+ var ctx = useContext(reactKeycloakWebContext);
5
+ if (!ctx) {
6
+ throw new Error('useKeycloak hook must be used inside ReactKeycloakProvider context');
7
+ }
8
+ if (!ctx.authClient) {
9
+ throw new Error('authClient has not been assigned to ReactKeycloakProvider');
10
+ }
11
+ var authClient = ctx.authClient, initialized = ctx.initialized;
12
+ return {
13
+ initialized: initialized,
14
+ keycloak: authClient,
15
+ };
16
+ }
17
17
  //# sourceMappingURL=useKeycloak.js.map
@@ -6,5 +6,5 @@
6
6
  "@react-keycloak-refork\\web\\useKeycloak.ts"
7
7
  ],
8
8
  "names": [],
9
- "mappings": "AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,UAAU,WAAW;IACzB,IAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAE/C,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAA;KACF;IAED,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;KAC7E;IAEO,IAAA,UAAU,GAAkB,GAAG,WAArB,EAAE,WAAW,GAAK,GAAG,YAAR,CAAQ;IACvC,OAAO;QACL,WAAW,aAAA;QACX,QAAQ,EAAE,UAAU;KACrB,CAAA;AACH,CAAC"
9
+ "mappings": "AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,UAAU,WAAW;IACzB,IAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAE/C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAA;IACH,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;IAC9E,CAAC;IAEO,IAAA,UAAU,GAAkB,GAAG,WAArB,EAAE,WAAW,GAAK,GAAG,YAAR,CAAQ;IACvC,OAAO;QACL,WAAW,aAAA;QACX,QAAQ,EAAE,UAAU;KACrB,CAAA;AACH,CAAC"
10
10
  }
@@ -1,43 +1,43 @@
1
- import type { KeycloakInstance } from 'keycloak-js';
2
- import * as React from 'react';
3
- type InjectedProps = {
4
- keycloakInitialized: boolean;
5
- keycloak: KeycloakInstance;
6
- };
7
- /**
8
- * An HOC which injects the `keycloak` instance and the `keycloakInitialized` flag as props.
9
- *
10
- * @deprecated Please migrate to useKeycloak hook where/when possible.
11
- */
12
- export declare function withKeycloak<P extends InjectedProps>(Component: React.ComponentType<P>): React.FC<Subtract<P, InjectedProps>>;
13
- /**
14
- * SetDifference (same as Exclude)
15
- * @desc Set difference of given union types `A` and `B`
16
- * @example
17
- * // Expect: "1"
18
- * SetDifference<'1' | '2' | '3', '2' | '3' | '4'>;
19
- *
20
- * // Expect: string | number
21
- * SetDifference<string | number | (() => void), Function>;
22
- */
23
- type SetDifference<A, B> = A extends B ? never : A;
24
- /**
25
- * SetComplement
26
- * @desc Set complement of given union types `A` and (it's subset) `A1`
27
- * @example
28
- * // Expect: "1"
29
- * SetComplement<'1' | '2' | '3', '2' | '3'>;
30
- */
31
- type SetComplement<A, A1 extends A> = SetDifference<A, A1>;
32
- /**
33
- * Subtract
34
- * @desc From `T` remove properties that exist in `T1` (`T1` has a subset of the properties of `T`)
35
- * @example
36
- * type Props = { name: string; age: number; visible: boolean };
37
- * type DefaultProps = { age: number };
38
- *
39
- * // Expect: { name: string; visible: boolean; }
40
- * type RestProps = Subtract<Props, DefaultProps>;
41
- */
42
- type Subtract<T extends T1, T1 extends object> = Pick<T, SetComplement<keyof T, keyof T1>>;
43
- export {};
1
+ import type { KeycloakInstance } from 'keycloak-js';
2
+ import * as React from 'react';
3
+ type InjectedProps = {
4
+ keycloakInitialized: boolean;
5
+ keycloak: KeycloakInstance;
6
+ };
7
+ /**
8
+ * An HOC which injects the `keycloak` instance and the `keycloakInitialized` flag as props.
9
+ *
10
+ * @deprecated Please migrate to useKeycloak hook where/when possible.
11
+ */
12
+ export declare function withKeycloak<P extends InjectedProps>(Component: React.ComponentType<P>): React.FC<Subtract<P, InjectedProps>>;
13
+ /**
14
+ * SetDifference (same as Exclude)
15
+ * @desc Set difference of given union types `A` and `B`
16
+ * @example
17
+ * // Expect: "1"
18
+ * SetDifference<'1' | '2' | '3', '2' | '3' | '4'>;
19
+ *
20
+ * // Expect: string | number
21
+ * SetDifference<string | number | (() => void), Function>;
22
+ */
23
+ type SetDifference<A, B> = A extends B ? never : A;
24
+ /**
25
+ * SetComplement
26
+ * @desc Set complement of given union types `A` and (it's subset) `A1`
27
+ * @example
28
+ * // Expect: "1"
29
+ * SetComplement<'1' | '2' | '3', '2' | '3'>;
30
+ */
31
+ type SetComplement<A, A1 extends A> = SetDifference<A, A1>;
32
+ /**
33
+ * Subtract
34
+ * @desc From `T` remove properties that exist in `T1` (`T1` has a subset of the properties of `T`)
35
+ * @example
36
+ * type Props = { name: string; age: number; visible: boolean };
37
+ * type DefaultProps = { age: number };
38
+ *
39
+ * // Expect: { name: string; visible: boolean; }
40
+ * type RestProps = Subtract<Props, DefaultProps>;
41
+ */
42
+ type Subtract<T extends T1, T1 extends object> = Pick<T, SetComplement<keyof T, keyof T1>>;
43
+ export {};