@react-keycloak-refork/web 5.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 ADDED
@@ -0,0 +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.
package/README.md ADDED
@@ -0,0 +1,205 @@
1
+ ![React Keycloak](/art/react-keycloak-logo.png?raw=true 'React Keycloak Logo')
2
+
3
+ # React Keycloak <!-- omit in toc -->
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.
6
+
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
+
9
+ [![License](https://img.shields.io/github/license/react-keycloak/react-keycloak.svg)](https://github.com/react-keycloak/react-keycloak/blob/master/LICENSE.md)
10
+ [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
11
+ [![GitHub contributors](https://img.shields.io/github/contributors/react-keycloak/react-keycloak)](https://github.com/react-keycloak/react-keycloak/graphs/contributors)
12
+ [![Github Issues](https://img.shields.io/github/issues/react-keycloak/react-keycloak.svg)](https://github.com/react-keycloak/react-keycloak/issues)
13
+
14
+ [![Gitter](https://img.shields.io/gitter/room/react-keycloak/community)](https://gitter.im/react-keycloak/community)
15
+
16
+ ---
17
+
18
+ ## Table of Contents <!-- omit in toc -->
19
+
20
+ - [Install](#install)
21
+ - [Getting Started](#getting-started)
22
+ - [Setup Keycloak instance](#setup-keycloak-instance)
23
+ - [Setup KeycloakProvider](#setup-keycloakprovider)
24
+ - [Hook Usage](#hook-usage)
25
+ - [External Usage (Advanced)](#external-usage-advanced)
26
+ - [Examples](#examples)
27
+ - [Guides and Articles](#guides-and-articles)
28
+ - [Alternatives](#alternatives)
29
+ - [Contributing](#contributing)
30
+ - [License](#license)
31
+
32
+ ---
33
+
34
+ ## Install
35
+
36
+ React Keycloak requires:
37
+
38
+ - React **18.0** or later
39
+ - `keycloak-js` **17.0.0** or later
40
+
41
+ ```shell
42
+ yarn add @react-keycloak-refork/web
43
+ ```
44
+
45
+ or
46
+
47
+ ```shell
48
+ npm install --save @react-keycloak-refork/web
49
+ ```
50
+
51
+ ## Getting Started
52
+
53
+ ### Setup Keycloak instance
54
+
55
+ Create a `keycloak.js` file in the `src` folder of your project (where `App.js` is located) with the following content
56
+
57
+ ```js
58
+ import Keycloak from 'keycloak-js'
59
+
60
+ // Setup Keycloak instance as needed
61
+ // Pass initialization options as required or leave blank to load from 'keycloak.json'
62
+ const keycloak = new Keycloak()
63
+
64
+ export default keycloak
65
+ ```
66
+
67
+ ### Setup KeycloakProvider
68
+
69
+ Wrap your App inside `ReactKeycloakProvider` and pass the `keycloak` instance as prop
70
+
71
+ ```js
72
+ import { ReactKeycloakProvider } from '@react-keycloak-refork/web'
73
+
74
+ import keycloak from './keycloak'
75
+
76
+ // Wrap everything inside KeycloakProvider
77
+ const App = () => {
78
+ return (
79
+ <ReactKeycloakProvider authClient={keycloak}>...</ReactKeycloakProvider>
80
+ )
81
+ }
82
+ ```
83
+
84
+ **N.B.** If your using other providers (such as `react-redux`) it is recommended to place them inside `ReactKeycloakProvider`.
85
+
86
+ `ReactKeycloakProvider` automatically invokes `keycloak.init()` method when needed and supports the following props:
87
+
88
+ - `initOptions`, contains the object to be passed to `keycloak.init()` method, by default the following is used
89
+
90
+ {
91
+ onLoad: 'check-sso',
92
+ }
93
+
94
+ for more options see [Keycloak docs](https://www.keycloak.org/docs/latest/securing_apps/index.html#init-options).
95
+
96
+ - `LoadingComponent`, a component to be displayed while `keycloak` is being initialized, if not provided child components will be rendered immediately. Defaults to `null`
97
+
98
+ - `isLoadingCheck`, an optional loading check function to customize LoadingComponent display condition. Return `true` to display LoadingComponent, `false` to hide it.
99
+
100
+ Can be implemented as follow
101
+
102
+ ```js
103
+ ;(keycloak) => !keycloak.authenticated
104
+ ```
105
+
106
+ - `onEvent`, an handler function that receives events launched by `keycloak`, defaults to `null`.
107
+
108
+ It can be implemented as follow
109
+
110
+ ```js
111
+ ;(event, error) => {
112
+ console.log('onKeycloakEvent', event, error)
113
+ }
114
+ ```
115
+
116
+ Published events are:
117
+
118
+ - `onReady`
119
+ - `onInitError`
120
+ - `onAuthSuccess`
121
+ - `onAuthError`
122
+ - `onAuthRefreshSuccess`
123
+ - `onAuthRefreshError`
124
+ - `onTokenExpired`
125
+ - `onAuthLogout`
126
+
127
+ - `onTokens`, an handler function that receives `keycloak` tokens as an object every time they change, defaults to `null`.
128
+
129
+ Keycloak tokens are returned as follow
130
+
131
+ ```json
132
+ {
133
+ "idToken": string,
134
+ "refreshToken": string,
135
+ "token": string
136
+ }
137
+ ```
138
+
139
+ ### Hook Usage
140
+
141
+ When a component requires access to `Keycloak`, you can use the `useKeycloak` Hook.
142
+
143
+ ```js
144
+ import { useKeycloak } from '@react-keycloak-refork/web'
145
+
146
+ export default () => {
147
+ // Using Object destructuring
148
+ const { keycloak, initialized } = useKeycloak()
149
+
150
+ // Here you can access all of keycloak methods and variables.
151
+ // See https://www.keycloak.org/docs/latest/securing_apps/index.html#javascript-adapter-reference
152
+
153
+ return (
154
+ <div>
155
+ <div>{`User is ${
156
+ !keycloak.authenticated ? 'NOT ' : ''
157
+ }authenticated`}</div>
158
+
159
+ {!!keycloak.authenticated && (
160
+ <button type="button" onClick={() => keycloak.logout()}>
161
+ Logout
162
+ </button>
163
+ )}
164
+ </div>
165
+ )
166
+ }
167
+ ```
168
+
169
+ ### External Usage (Advanced)
170
+
171
+ If you need to access `keycloak` instance from non-`React` files (such as `sagas`, `utils`, `providers` ...), you can import the instance directly from the `keycloak.js` file.
172
+
173
+ The instance will be initialized by `react-keycloak` but you'll need to be carefull when using the instance and avoid setting/overriding any props, you can however freely access the exposed methods (such as `refreshToken`, `login`, etc...).
174
+
175
+ ## Examples
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.
178
+
179
+ ## Guides and Articles
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).
182
+
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
+
185
+ ## Alternatives
186
+
187
+ If you need to connect using a more generic OIDC client instead of `keycloak.js`, consider using one of the following libraries:
188
+
189
+ - [bjerkio/oidc-react](https://github.com/bjerkio/oidc-react)
190
+ - [thchia/react-oidc](https://github.com/thchia/react-oidc)
191
+ - [@axa-fr/react-oidc](https://github.com/AxaGuilDEv/react-oidc)
192
+
193
+ ## Contributing
194
+
195
+ See the [contributing guide](https://github.com/react-keycloak/react-keycloak/blob/master/CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
196
+
197
+ ## License
198
+
199
+ MIT
200
+
201
+ ---
202
+
203
+ If you found this project to be helpful, please consider buying me a coffee.
204
+
205
+ [![buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoff.ee/4f18nT0Nk)
@@ -0,0 +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>>;
package/lib/context.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createAuthContext } from '@react-keycloak-refork/core';
2
+ export var reactKeycloakWebContext = createAuthContext();
3
+ export var ReactKeycloakWebContextConsumer = reactKeycloakWebContext.Consumer;
4
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "context.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\context.ts"
7
+ ],
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"
10
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './provider';
2
+ export * from './useKeycloak';
3
+ export * from './withKeycloak';
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './provider';
2
+ export * from './useKeycloak';
3
+ export * from './withKeycloak';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "index.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\index.ts"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA"
10
+ }
@@ -0,0 +1,146 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ import { createAuthProvider } from '@react-keycloak-refork/core';
2
+ import { reactKeycloakWebContext } from './context';
3
+ export var ReactKeycloakProvider = createAuthProvider(reactKeycloakWebContext);
4
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "provider.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\provider.ts"
7
+ ],
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"
10
+ }
@@ -0,0 +1,4 @@
1
+ export declare function useKeycloak(): {
2
+ initialized: boolean;
3
+ keycloak: import("keycloak-js/lib/keycloak").default;
4
+ };
@@ -0,0 +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
+ }
17
+ //# sourceMappingURL=useKeycloak.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "useKeycloak.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\useKeycloak.ts"
7
+ ],
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"
10
+ }
@@ -0,0 +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 {};
@@ -0,0 +1,25 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as React from 'react';
13
+ import { useKeycloak } from './useKeycloak';
14
+ /**
15
+ * An HOC which injects the `keycloak` instance and the `keycloakInitialized` flag as props.
16
+ *
17
+ * @deprecated Please migrate to useKeycloak hook where/when possible.
18
+ */
19
+ export function withKeycloak(Component) {
20
+ return function WrappedComponent(props) {
21
+ var _a = useKeycloak(), keycloak = _a.keycloak, initialized = _a.initialized;
22
+ return (React.createElement(Component, __assign({}, props, { keycloakInitialized: initialized, keycloak: keycloak })));
23
+ };
24
+ }
25
+ //# sourceMappingURL=withKeycloak.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "withKeycloak.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\withKeycloak.tsx"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;;;;;;;;;AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAQ3C;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAiC;IAEjC,OAAO,SAAS,gBAAgB,CAAC,KAAQ;QACjC,IAAA,KAA4B,WAAW,EAAE,EAAvC,QAAQ,cAAA,EAAE,WAAW,iBAAkB,CAAA;QAE/C,OAAO,CACL,oBAAC,SAAS,eACH,KAAW,IAChB,mBAAmB,EAAE,WAAW,EAChC,QAAQ,EAAE,QAAQ,IAClB,CACH,CAAA;IACH,CAAC,CAAA;AACH,CAAC"
10
+ }
@@ -0,0 +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>>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReactKeycloakWebContextConsumer = exports.reactKeycloakWebContext = void 0;
4
+ var core_1 = require("@react-keycloak-refork/core");
5
+ exports.reactKeycloakWebContext = (0, core_1.createAuthContext)();
6
+ exports.ReactKeycloakWebContextConsumer = exports.reactKeycloakWebContext.Consumer;
7
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "context.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\context.ts"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;AAAA,oDAA+D;AAGlD,QAAA,uBAAuB,GAAG,IAAA,wBAAiB,GAAoB,CAAA;AAE/D,QAAA,+BAA+B,GAAG,+BAAuB,CAAC,QAAQ,CAAA"
10
+ }
@@ -0,0 +1,3 @@
1
+ export * from './provider';
2
+ export * from './useKeycloak';
3
+ export * from './withKeycloak';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./provider"), exports);
18
+ __exportStar(require("./useKeycloak"), exports);
19
+ __exportStar(require("./withKeycloak"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "index.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\index.ts"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,gDAA6B;AAC7B,iDAA8B"
10
+ }
@@ -0,0 +1,146 @@
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
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReactKeycloakProvider = void 0;
4
+ var core_1 = require("@react-keycloak-refork/core");
5
+ var context_1 = require("./context");
6
+ exports.ReactKeycloakProvider = (0, core_1.createAuthProvider)(context_1.reactKeycloakWebContext);
7
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "provider.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\provider.ts"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;AAAA,oDAAgE;AAEhE,qCAAmD;AAEtC,QAAA,qBAAqB,GAAG,IAAA,yBAAkB,EAAC,iCAAuB,CAAC,CAAA"
10
+ }
@@ -0,0 +1,4 @@
1
+ export declare function useKeycloak(): {
2
+ initialized: boolean;
3
+ keycloak: import("keycloak-js/lib/keycloak").default;
4
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useKeycloak = void 0;
4
+ var react_1 = require("react");
5
+ var context_1 = require("./context");
6
+ function useKeycloak() {
7
+ var ctx = (0, react_1.useContext)(context_1.reactKeycloakWebContext);
8
+ if (!ctx) {
9
+ throw new Error('useKeycloak hook must be used inside ReactKeycloakProvider context');
10
+ }
11
+ if (!ctx.authClient) {
12
+ throw new Error('authClient has not been assigned to ReactKeycloakProvider');
13
+ }
14
+ var authClient = ctx.authClient, initialized = ctx.initialized;
15
+ return {
16
+ initialized: initialized,
17
+ keycloak: authClient,
18
+ };
19
+ }
20
+ exports.useKeycloak = useKeycloak;
21
+ //# sourceMappingURL=useKeycloak.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "useKeycloak.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\useKeycloak.ts"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;AAAA,+BAAkC;AAElC,qCAAmD;AAEnD,SAAgB,WAAW;IACzB,IAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,iCAAuB,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;AAlBD,kCAkBC"
10
+ }
@@ -0,0 +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 {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.withKeycloak = void 0;
38
+ var React = __importStar(require("react"));
39
+ var useKeycloak_1 = require("./useKeycloak");
40
+ /**
41
+ * An HOC which injects the `keycloak` instance and the `keycloakInitialized` flag as props.
42
+ *
43
+ * @deprecated Please migrate to useKeycloak hook where/when possible.
44
+ */
45
+ function withKeycloak(Component) {
46
+ return function WrappedComponent(props) {
47
+ var _a = (0, useKeycloak_1.useKeycloak)(), keycloak = _a.keycloak, initialized = _a.initialized;
48
+ return (React.createElement(Component, __assign({}, props, { keycloakInitialized: initialized, keycloak: keycloak })));
49
+ };
50
+ }
51
+ exports.withKeycloak = withKeycloak;
52
+ //# sourceMappingURL=withKeycloak.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "withKeycloak.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "@react-keycloak-refork\\web\\withKeycloak.tsx"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA8B;AAE9B,6CAA2C;AAQ3C;;;;GAIG;AACH,SAAgB,YAAY,CAC1B,SAAiC;IAEjC,OAAO,SAAS,gBAAgB,CAAC,KAAQ;QACjC,IAAA,KAA4B,IAAA,yBAAW,GAAE,EAAvC,QAAQ,cAAA,EAAE,WAAW,iBAAkB,CAAA;QAE/C,OAAO,CACL,oBAAC,SAAS,eACH,KAAW,IAChB,mBAAmB,EAAE,WAAW,EAChC,QAAQ,EAAE,QAAQ,IAClB,CACH,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAdD,oCAcC"
10
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@react-keycloak-refork/web",
3
+ "version": "5.0.0",
4
+ "license": "MIT",
5
+ "description": "Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for Keycloak >=26. React bindings for Keycloak javascript adapter.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/leoluzh/react-keycloak-fork.git"
9
+ },
10
+ "author": "leoluzh",
11
+ "bugs": {
12
+ "url": "https://github.com/leoluzh/react-keycloak-fork/issues"
13
+ },
14
+ "homepage": "https://github.com/leoluzh/react-keycloak-fork#readme",
15
+ "keywords": [
16
+ "react",
17
+ "keycloak",
18
+ "keycloak-js"
19
+ ],
20
+ "main": "lib-commonjs/index.js",
21
+ "jsnext:main": "lib/index.js",
22
+ "module": "lib/index.js",
23
+ "typings": "lib/index.d.ts",
24
+ "files": [
25
+ "lib",
26
+ "lib-commonjs"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "clean": "rimraf lib lib-commonjs",
33
+ "prebuild": "npm run clean",
34
+ "compile:commonjs": "tsc --module commonjs --outDir lib-commonjs",
35
+ "compile:esnext": "tsc --module esnext --outDir lib",
36
+ "compile": "run-p compile:*",
37
+ "fixmaps:lib": "tweak_sourcemap_paths -a --include 'lib/**/*.js.map' 'lib-commonjs/**/*.js.map'",
38
+ "fixmaps": "run-p fixmaps:*",
39
+ "build": "run-s compile fixmaps",
40
+ "test": "jest",
41
+ "test:coverage": "jest --coverage",
42
+ "prepublishOnly": "npm run build && cp ../../LICENSE.md ."
43
+ },
44
+ "peerDependencies": {
45
+ "keycloak-js": ">=26.2.0",
46
+ "react": ">=18.0",
47
+ "react-dom": ">=18.0",
48
+ "typescript": ">=3.8"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "typescript": {
52
+ "optional": true
53
+ }
54
+ },
55
+ "dependencies": {
56
+ "@babel/runtime": "^7.17.9",
57
+ "@react-keycloak-refork/core": "file:../core",
58
+ "hoist-non-react-statics": "^3.3.2"
59
+ },
60
+ "jest": {
61
+ "preset": "ts-jest",
62
+ "testEnvironment": "jsdom"
63
+ },
64
+ "devDependencies": {
65
+ "keycloak-js": "^26.2.0"
66
+ }
67
+ }