@thunderid/nextjs 0.0.1
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 +201 -0
- package/dist/SessionManager-CmqWChPm.js +1384 -0
- package/dist/cache-CxW8LP5j.js +7893 -0
- package/dist/cjs/SessionManager-RFfauUwH.js +1397 -0
- package/dist/cjs/cache-TPlce_OL.js +7896 -0
- package/dist/cjs/dynamic-rendering-L2d7BrDx.js +1540 -0
- package/dist/cjs/getAccessToken-Cse753Fb.js +22 -0
- package/dist/cjs/getSessionId-0NYmTSk-.js +5 -0
- package/dist/cjs/getSessionId-CTcwNOBu.js +28 -0
- package/dist/cjs/index.cjs +1033 -0
- package/dist/cjs/index2.cjs +8 -0
- package/dist/cjs/middleware.cjs +5147 -0
- package/dist/cjs/segment-oJYpzazg.js +52 -0
- package/dist/cjs/server-DhPu4EWA.js +2477 -0
- package/dist/dynamic-rendering-qQ5hSvc6.js +1441 -0
- package/dist/getAccessToken-tip3mkrS.js +22 -0
- package/dist/getSessionId-CgVEEnja.js +23 -0
- package/dist/getSessionId-dhNlHUsz.js +5 -0
- package/dist/index.js +977 -0
- package/dist/index2.js +7 -0
- package/dist/middleware.js +5148 -0
- package/dist/segment-BliKCoQf.js +47 -0
- package/dist/server-BUTC5fQO.js +2433 -0
- package/dist/types/ThunderIDNextClient.d.ts +94 -0
- package/dist/types/ThunderIDNextClient.d.ts.map +1 -0
- package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts +55 -0
- package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts.map +1 -0
- package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts +43 -0
- package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts.map +1 -0
- package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts +67 -0
- package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts.map +1 -0
- package/dist/types/client/components/control/Loading/Loading.d.ts +48 -0
- package/dist/types/client/components/control/Loading/Loading.d.ts.map +1 -0
- package/dist/types/client/components/control/SignedIn/SignedIn.d.ts +46 -0
- package/dist/types/client/components/control/SignedIn/SignedIn.d.ts.map +1 -0
- package/dist/types/client/components/control/SignedOut/SignedOut.d.ts +46 -0
- package/dist/types/client/components/control/SignedOut/SignedOut.d.ts.map +1 -0
- package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +68 -0
- package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts.map +1 -0
- package/dist/types/client/components/presentation/Organization/Organization.d.ts +67 -0
- package/dist/types/client/components/presentation/Organization/Organization.d.ts.map +1 -0
- package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
- package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts.map +1 -0
- package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +120 -0
- package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts.map +1 -0
- package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +72 -0
- package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map +1 -0
- package/dist/types/client/components/presentation/SignIn/SignIn.d.ts +70 -0
- package/dist/types/client/components/presentation/SignIn/SignIn.d.ts.map +1 -0
- package/dist/types/client/components/presentation/SignUp/SignUp.d.ts +56 -0
- package/dist/types/client/components/presentation/SignUp/SignUp.d.ts.map +1 -0
- package/dist/types/client/components/presentation/User/User.d.ts +62 -0
- package/dist/types/client/components/presentation/User/User.d.ts.map +1 -0
- package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts +106 -0
- package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -0
- package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts +50 -0
- package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts.map +1 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts +33 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts +59 -0
- package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -0
- package/dist/types/client/contexts/ThunderID/useThunderID.d.ts +21 -0
- package/dist/types/client/contexts/ThunderID/useThunderID.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +47 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts +21 -0
- package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts.map +1 -0
- package/dist/types/constants/sessionConstants.d.ts +49 -0
- package/dist/types/constants/sessionConstants.d.ts.map +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/middleware.d.ts +35 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/models/api.d.ts +49 -0
- package/dist/types/models/api.d.ts.map +1 -0
- package/dist/types/models/config.d.ts +31 -0
- package/dist/types/models/config.d.ts.map +1 -0
- package/dist/types/server/ThunderIDProvider.d.ts +58 -0
- package/dist/types/server/ThunderIDProvider.d.ts.map +1 -0
- package/dist/types/server/actions/clearSession.d.ts +40 -0
- package/dist/types/server/actions/clearSession.d.ts.map +1 -0
- package/dist/types/server/actions/createOrganization.d.ts +24 -0
- package/dist/types/server/actions/createOrganization.d.ts.map +1 -0
- package/dist/types/server/actions/getAccessToken.d.ts +25 -0
- package/dist/types/server/actions/getAccessToken.d.ts.map +1 -0
- package/dist/types/server/actions/getAllOrganizations.d.ts +24 -0
- package/dist/types/server/actions/getAllOrganizations.d.ts.map +1 -0
- package/dist/types/server/actions/getBrandingPreference.d.ts +24 -0
- package/dist/types/server/actions/getBrandingPreference.d.ts.map +1 -0
- package/dist/types/server/actions/getClientOrigin.d.ts +20 -0
- package/dist/types/server/actions/getClientOrigin.d.ts.map +1 -0
- package/dist/types/server/actions/getCurrentOrganizationAction.d.ts +31 -0
- package/dist/types/server/actions/getCurrentOrganizationAction.d.ts.map +1 -0
- package/dist/types/server/actions/getMyOrganizations.d.ts +24 -0
- package/dist/types/server/actions/getMyOrganizations.d.ts.map +1 -0
- package/dist/types/server/actions/getOrganizationAction.d.ts +31 -0
- package/dist/types/server/actions/getOrganizationAction.d.ts.map +1 -0
- package/dist/types/server/actions/getSessionId.d.ts +26 -0
- package/dist/types/server/actions/getSessionId.d.ts.map +1 -0
- package/dist/types/server/actions/getSessionPayload.d.ts +27 -0
- package/dist/types/server/actions/getSessionPayload.d.ts.map +1 -0
- package/dist/types/server/actions/getUserAction.d.ts +31 -0
- package/dist/types/server/actions/getUserAction.d.ts.map +1 -0
- package/dist/types/server/actions/getUserProfileAction.d.ts +31 -0
- package/dist/types/server/actions/getUserProfileAction.d.ts.map +1 -0
- package/dist/types/server/actions/handleOAuthCallbackAction.d.ts +34 -0
- package/dist/types/server/actions/handleOAuthCallbackAction.d.ts.map +1 -0
- package/dist/types/server/actions/isSignedIn.d.ts +32 -0
- package/dist/types/server/actions/isSignedIn.d.ts.map +1 -0
- package/dist/types/server/actions/refreshToken.d.ts +45 -0
- package/dist/types/server/actions/refreshToken.d.ts.map +1 -0
- package/dist/types/server/actions/signInAction.d.ts +36 -0
- package/dist/types/server/actions/signInAction.d.ts.map +1 -0
- package/dist/types/server/actions/signOutAction.d.ts +32 -0
- package/dist/types/server/actions/signOutAction.d.ts.map +1 -0
- package/dist/types/server/actions/signUpAction.d.ts +36 -0
- package/dist/types/server/actions/signUpAction.d.ts.map +1 -0
- package/dist/types/server/actions/switchOrganization.d.ts +24 -0
- package/dist/types/server/actions/switchOrganization.d.ts.map +1 -0
- package/dist/types/server/actions/updateUserProfileAction.d.ts +31 -0
- package/dist/types/server/actions/updateUserProfileAction.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +21 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/middleware/createRouteMatcher.d.ts +40 -0
- package/dist/types/server/middleware/createRouteMatcher.d.ts.map +1 -0
- package/dist/types/server/middleware/thunderIDMiddleware.d.ts +93 -0
- package/dist/types/server/middleware/thunderIDMiddleware.d.ts.map +1 -0
- package/dist/types/server/thunderid.d.ts +27 -0
- package/dist/types/server/thunderid.d.ts.map +1 -0
- package/dist/types/utils/SessionManager.d.ts +115 -0
- package/dist/types/utils/SessionManager.d.ts.map +1 -0
- package/dist/types/utils/createRouteMatcher.d.ts +39 -0
- package/dist/types/utils/createRouteMatcher.d.ts.map +1 -0
- package/dist/types/utils/decorateConfigWithNextEnv.d.ts +21 -0
- package/dist/types/utils/decorateConfigWithNextEnv.d.ts.map +1 -0
- package/dist/types/utils/handleRefreshToken.d.ts +47 -0
- package/dist/types/utils/handleRefreshToken.d.ts.map +1 -0
- package/dist/types/utils/logger.d.ts +20 -0
- package/dist/types/utils/logger.d.ts.map +1 -0
- package/dist/types/utils/sessionUtils.d.ts +51 -0
- package/dist/types/utils/sessionUtils.d.ts.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { AllOrganizationsApiResponse, ThunderIDNodeClient, CreateOrganizationPayload, EmbeddedFlowExecuteRequestConfig, EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse, EmbeddedSignInFlowHandleRequestPayload, ExtendedAuthorizeRequestUrlParams, IdToken, Organization, OrganizationDetails, SignInOptions, SignOutOptions, SignUpOptions, Storage, TokenExchangeRequestConfig, TokenResponse, User, UserProfile } from '@thunderid/node';
|
|
19
|
+
import { ThunderIDNextConfig } from './models/config';
|
|
20
|
+
/**
|
|
21
|
+
* Client for mplementing ThunderID in Next.js applications.
|
|
22
|
+
* This class provides the core functionality for managing user authentication and sessions.
|
|
23
|
+
*
|
|
24
|
+
* This class is implemented as a singleton to ensure a single instance across the application.
|
|
25
|
+
*
|
|
26
|
+
* @typeParam T - Configuration type that extends ThunderIDNextConfig.
|
|
27
|
+
*/
|
|
28
|
+
declare class ThunderIDNextClient<T extends ThunderIDNextConfig = ThunderIDNextConfig> extends ThunderIDNodeClient<T> {
|
|
29
|
+
private static instance;
|
|
30
|
+
private legacyClient;
|
|
31
|
+
isInitialized: boolean;
|
|
32
|
+
private constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Get the singleton instance of ThunderIDNextClient
|
|
35
|
+
*/
|
|
36
|
+
static getInstance<T extends ThunderIDNextConfig = ThunderIDNextConfig>(): ThunderIDNextClient<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Ensures the client is initialized before using it.
|
|
39
|
+
* Throws an error if the client is not initialized.
|
|
40
|
+
*/
|
|
41
|
+
private ensureInitialized;
|
|
42
|
+
initialize(config: T, storage?: Storage): Promise<boolean>;
|
|
43
|
+
reInitialize(config: Partial<T>): Promise<boolean>;
|
|
44
|
+
getUser(userId?: string): Promise<User>;
|
|
45
|
+
getUserProfile(userId?: string): Promise<UserProfile>;
|
|
46
|
+
updateUserProfile(payload: any, userId?: string): Promise<User>;
|
|
47
|
+
createOrganization(payload: CreateOrganizationPayload, userId?: string): Promise<Organization>;
|
|
48
|
+
getOrganization(organizationId: string, userId?: string): Promise<OrganizationDetails>;
|
|
49
|
+
getMyOrganizations(options?: any, userId?: string): Promise<Organization[]>;
|
|
50
|
+
getAllOrganizations(options?: any, userId?: string): Promise<AllOrganizationsApiResponse>;
|
|
51
|
+
getCurrentOrganization(userId?: string): Promise<Organization | null>;
|
|
52
|
+
switchOrganization(organization: Organization, userId?: string): Promise<TokenResponse | Response>;
|
|
53
|
+
isLoading(): boolean;
|
|
54
|
+
isSignedIn(sessionId?: string): Promise<boolean>;
|
|
55
|
+
exchangeToken(config: TokenExchangeRequestConfig, sessionId?: string): Promise<TokenResponse | Response>;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the access token from the session cookie if no sessionId is provided,
|
|
58
|
+
* otherwise falls back to legacy client method.
|
|
59
|
+
*/
|
|
60
|
+
getAccessToken(_sessionId?: string): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Get the decoded ID token for a session
|
|
63
|
+
*/
|
|
64
|
+
getDecodedIdToken(sessionId?: string, idToken?: string): Promise<IdToken>;
|
|
65
|
+
getConfiguration(): T;
|
|
66
|
+
signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
67
|
+
signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
68
|
+
signOut(options?: SignOutOptions, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
|
|
69
|
+
signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
|
|
70
|
+
signUp(options?: SignUpOptions): Promise<void>;
|
|
71
|
+
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
72
|
+
signInSilently(_options?: SignInOptions): Promise<User | boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the sign-in URL for authentication.
|
|
75
|
+
* Ensures the client is initialized before making the call.
|
|
76
|
+
*
|
|
77
|
+
* @param customParams - Custom parameters to include in the sign-in URL.
|
|
78
|
+
* @param userId - The user ID
|
|
79
|
+
* @returns Promise that resolves to the sign-in URL
|
|
80
|
+
*/
|
|
81
|
+
getAuthorizeRequestUrl(customParams: ExtendedAuthorizeRequestUrlParams, userId?: string): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the storage manager from the underlying ThunderID client.
|
|
84
|
+
* Ensures the client is initialized before making the call.
|
|
85
|
+
*
|
|
86
|
+
* @returns Promise that resolves to the storage manager
|
|
87
|
+
*/
|
|
88
|
+
getStorageManager(): Promise<any>;
|
|
89
|
+
clearSession(): Promise<void>;
|
|
90
|
+
setSession(sessionData: Record<string, unknown>, sessionId?: string): Promise<void>;
|
|
91
|
+
decodeJwtToken<R = Record<string, unknown>>(token: string): Promise<R>;
|
|
92
|
+
}
|
|
93
|
+
export default ThunderIDNextClient;
|
|
94
|
+
//# sourceMappingURL=ThunderIDNextClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThunderIDNextClient.d.ts","sourceRoot":"","sources":["../../src/ThunderIDNextClient.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { BaseSignInButtonProps } from '@thunderid/react';
|
|
19
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link SignInButton}
|
|
22
|
+
*/
|
|
23
|
+
export type SignInButtonProps = BaseSignInButtonProps & {
|
|
24
|
+
/**
|
|
25
|
+
* Additional parameters to pass to the `authorize` request.
|
|
26
|
+
*/
|
|
27
|
+
signInOptions?: Record<string, any>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* SignInButton component that uses server actions for authentication in Next.js.
|
|
31
|
+
*
|
|
32
|
+
* @example Using render props
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <SignInButton>
|
|
35
|
+
* {({isLoading}) => (
|
|
36
|
+
* <button type="submit" disabled={isLoading}>
|
|
37
|
+
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
38
|
+
* </button>
|
|
39
|
+
* )}
|
|
40
|
+
* </SignInButton>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Using traditional props
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <SignInButton className="custom-button">Sign In</SignInButton>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* In Next.js with server actions, the sign-in is handled via the server action.
|
|
50
|
+
* When using render props, the custom button should use `type="submit"` instead of `onClick={signIn}`.
|
|
51
|
+
* The `signIn` function in render props is provided for API consistency but should not be used directly.
|
|
52
|
+
*/
|
|
53
|
+
declare const SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
export default SignInButton;
|
|
55
|
+
//# sourceMappingURL=SignInButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/actions/SignInButton/SignInButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAmB,qBAAqB,EAAiB,MAAM,kBAAkB,CAAC;AAGzF,OAAO,EAAa,yBAAyB,EAAqB,aAAa,EAAa,MAAM,OAAO,CAAC;AAG1G;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG;IACtD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,YAAY,EAAE,yBAAyB,CAAC,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CA+CjG,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { BaseSignOutButtonProps } from '@thunderid/react';
|
|
19
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Interface for SignInButton component props.
|
|
22
|
+
*/
|
|
23
|
+
export type SignOutButtonProps = BaseSignOutButtonProps;
|
|
24
|
+
/**
|
|
25
|
+
* SignInButton component. This button initiates the sign-in process when clicked.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { SignInButton } from '@thunderid/auth-react';
|
|
30
|
+
*
|
|
31
|
+
* const App = () => {
|
|
32
|
+
* const buttonRef = useRef<HTMLButtonElement>(null);
|
|
33
|
+
* return (
|
|
34
|
+
* <SignInButton ref={buttonRef} className="custom-class" style={{ backgroundColor: 'blue' }}>
|
|
35
|
+
* Sign In
|
|
36
|
+
* </SignInButton>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare const SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
export default SignOutButton;
|
|
43
|
+
//# sourceMappingURL=SignOutButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignOutButton.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/actions/SignOutButton/SignOutButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAoB,sBAAsB,EAAiB,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAa,yBAAyB,EAAqB,aAAa,EAAuB,MAAM,OAAO,CAAC;AAIpH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,aAAa,EAAE,yBAAyB,CAAC,kBAAkB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAqCnG,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { BaseSignUpButtonProps } from '@thunderid/react';
|
|
19
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link SignUpButton}
|
|
22
|
+
*/
|
|
23
|
+
export type SignUpButtonProps = BaseSignUpButtonProps;
|
|
24
|
+
/**
|
|
25
|
+
* SignUpButton component that supports both render props and traditional props patterns.
|
|
26
|
+
* It redirects the user to the ThunderID sign-up page configured for the application.
|
|
27
|
+
*
|
|
28
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
29
|
+
*
|
|
30
|
+
* @example Using render props pattern
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <SignUpButton>
|
|
33
|
+
* {({ signUp, isLoading }) => (
|
|
34
|
+
* <button onClick={signUp} disabled={isLoading}>
|
|
35
|
+
* {isLoading ? 'Creating Account...' : 'Create Account'}
|
|
36
|
+
* </button>
|
|
37
|
+
* )}
|
|
38
|
+
* </SignUpButton>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Using traditional props pattern
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <SignUpButton className="custom-button">Create Account</SignUpButton>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Using component-level preferences
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <SignUpButton
|
|
49
|
+
* preferences={{
|
|
50
|
+
* i18n: {
|
|
51
|
+
* bundles: {
|
|
52
|
+
* 'en-US': {
|
|
53
|
+
* translations: {
|
|
54
|
+
* 'buttons.signUp': 'Custom Sign Up Text'
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* }}
|
|
60
|
+
* >
|
|
61
|
+
* Custom Sign Up
|
|
62
|
+
* </SignUpButton>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
66
|
+
export default SignUpButton;
|
|
67
|
+
//# sourceMappingURL=SignUpButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUpButton.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/actions/SignUpButton/SignUpButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAmB,qBAAqB,EAAiB,MAAM,kBAAkB,CAAC;AAGzF,OAAO,EAAa,yBAAyB,EAAiC,aAAa,EAAW,MAAM,OAAO,CAAC;AAGpH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,QAAA,MAAM,YAAY,EAAE,yBAAyB,CAAC,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAgDhG,CAAC;AAIH,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Props for the Loading component.
|
|
21
|
+
*/
|
|
22
|
+
export interface LoadingProps {
|
|
23
|
+
/**
|
|
24
|
+
* Content to show when the user is not signed in.
|
|
25
|
+
*/
|
|
26
|
+
fallback?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A component that only renders its children when the ThunderID is loading.
|
|
30
|
+
*
|
|
31
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { Loading } from '@thunderid/auth-react';
|
|
36
|
+
*
|
|
37
|
+
* const App = () => {
|
|
38
|
+
* return (
|
|
39
|
+
* <Loading fallback={<p>Finished Loading...</p>}>
|
|
40
|
+
* <p>Loading...</p>
|
|
41
|
+
* </Loading>
|
|
42
|
+
* );
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const Loading: FC<PropsWithChildren<LoadingProps>>;
|
|
47
|
+
export default Loading;
|
|
48
|
+
//# sourceMappingURL=Loading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/control/Loading/Loading.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAGvD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAQhD,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Props interface of {@link SignedIn}
|
|
21
|
+
*/
|
|
22
|
+
export interface SignedInProps {
|
|
23
|
+
/**
|
|
24
|
+
* Content to show when the user is not signed in.
|
|
25
|
+
*/
|
|
26
|
+
fallback?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A component that only renders its children when the user is signed in.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { SignedIn } from '@thunderid/auth-next';
|
|
34
|
+
*
|
|
35
|
+
* const App = () => {
|
|
36
|
+
* return (
|
|
37
|
+
* <SignedIn fallback={<p>Please sign in to continue</p>}>
|
|
38
|
+
* <p>Welcome! You are signed in.</p>
|
|
39
|
+
* </SignedIn>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const SignedIn: FC<PropsWithChildren<SignedInProps>>;
|
|
45
|
+
export default SignedIn;
|
|
46
|
+
//# sourceMappingURL=SignedIn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedIn.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/control/SignedIn/SignedIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAGvD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAOlD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Props interface of {@link SignedOut}
|
|
21
|
+
*/
|
|
22
|
+
export interface SignedOutProps {
|
|
23
|
+
/**
|
|
24
|
+
* Content to show when the user is not signed-out.
|
|
25
|
+
*/
|
|
26
|
+
fallback?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A component that only renders its children when the user is signed out.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { SignedOut } from '@thunderid/auth-next';
|
|
34
|
+
*
|
|
35
|
+
* const App = () => {
|
|
36
|
+
* return (
|
|
37
|
+
* <SignedOut fallback={<p>Please sign out to continue</p>}>
|
|
38
|
+
* <p>Welcome! You are signed out.</p>
|
|
39
|
+
* </SignedOut>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const SignedOut: FC<PropsWithChildren<SignedOutProps>>;
|
|
45
|
+
export default SignedOut;
|
|
46
|
+
//# sourceMappingURL=SignedOut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedOut.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/control/SignedOut/SignedOut.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAGvD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAOpD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { CreateOrganizationPayload } from '@thunderid/node';
|
|
19
|
+
import { BaseCreateOrganizationProps } from '@thunderid/react';
|
|
20
|
+
import { FC, ReactElement } from 'react';
|
|
21
|
+
/**
|
|
22
|
+
* Props interface for the CreateOrganization component.
|
|
23
|
+
*/
|
|
24
|
+
export interface CreateOrganizationProps extends Omit<BaseCreateOrganizationProps, 'onSubmit' | 'loading' | 'error'> {
|
|
25
|
+
/**
|
|
26
|
+
* Fallback element to render when the user is not signed in.
|
|
27
|
+
*/
|
|
28
|
+
fallback?: ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* Custom organization creation handler (will use default API if not provided).
|
|
31
|
+
*/
|
|
32
|
+
onCreateOrganization?: (payload: CreateOrganizationPayload) => Promise<any>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* CreateOrganization component that provides organization creation functionality.
|
|
36
|
+
* This component automatically integrates with the ThunderID and Organization contexts.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* import { CreateOrganization } from '@thunderid/react';
|
|
41
|
+
*
|
|
42
|
+
* // Basic usage - uses default API and contexts
|
|
43
|
+
* <CreateOrganization
|
|
44
|
+
* onSuccess={(org) => console.log('Created:', org)}
|
|
45
|
+
* onCancel={() => navigate('/organizations')}
|
|
46
|
+
* />
|
|
47
|
+
*
|
|
48
|
+
* // With custom organization creation handler
|
|
49
|
+
* <CreateOrganization
|
|
50
|
+
* onCreateOrganization={async (payload) => {
|
|
51
|
+
* const result = await myCustomAPI.createOrganization(payload);
|
|
52
|
+
* return result;
|
|
53
|
+
* }}
|
|
54
|
+
* onSuccess={(org) => {
|
|
55
|
+
* console.log('Organization created:', org.name);
|
|
56
|
+
* // Custom success logic here
|
|
57
|
+
* }}
|
|
58
|
+
* />
|
|
59
|
+
*
|
|
60
|
+
* // With fallback for unauthenticated users
|
|
61
|
+
* <CreateOrganization
|
|
62
|
+
* fallback={<div>Please sign in to create an organization</div>}
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare const CreateOrganization: FC<CreateOrganizationProps>;
|
|
67
|
+
export default CreateOrganization;
|
|
68
|
+
//# sourceMappingURL=CreateOrganization.d.ts.map
|
package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateOrganization.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/CreateOrganization/CreateOrganization.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,yBAAyB,EAAwB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAyB,2BAA2B,EAAkB,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAC,EAAE,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,2BAA2B,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;IAClH;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAoF1D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { Organization as IOrganization } from '@thunderid/node';
|
|
19
|
+
import { BaseOrganizationProps } from '@thunderid/react';
|
|
20
|
+
import { FC, ReactNode } from 'react';
|
|
21
|
+
/**
|
|
22
|
+
* Props for the Organization component.
|
|
23
|
+
* Extends BaseOrganizationProps but makes the organization prop optional since it will be obtained from useOrganization
|
|
24
|
+
*/
|
|
25
|
+
export interface OrganizationProps extends Omit<BaseOrganizationProps, 'organization'> {
|
|
26
|
+
/**
|
|
27
|
+
* Render prop that takes the organization object and returns a ReactNode.
|
|
28
|
+
* @param organization - The current organization object from Organization context.
|
|
29
|
+
* @returns A ReactNode to render.
|
|
30
|
+
*/
|
|
31
|
+
children: (organization: IOrganization | null) => ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Optional element to render when no organization is selected.
|
|
34
|
+
*/
|
|
35
|
+
fallback?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A component that uses render props to expose the current organization object.
|
|
39
|
+
* This component automatically retrieves the current organization from Organization context.
|
|
40
|
+
*
|
|
41
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { Organization } from '@thunderid/auth-react';
|
|
46
|
+
*
|
|
47
|
+
* const App = () => {
|
|
48
|
+
* return (
|
|
49
|
+
* <Organization fallback={<p>No organization selected</p>}>
|
|
50
|
+
* {(organization) => (
|
|
51
|
+
* <div>
|
|
52
|
+
* <h1>Current Organization: {organization.name}!</h1>
|
|
53
|
+
* <p>ID: {organization.id}</p>
|
|
54
|
+
* <p>Role: {organization.role}</p>
|
|
55
|
+
* {organization.memberCount && (
|
|
56
|
+
* <p>Members: {organization.memberCount}</p>
|
|
57
|
+
* )}
|
|
58
|
+
* </div>
|
|
59
|
+
* )}
|
|
60
|
+
* </Organization>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const Organization: FC<OrganizationProps>;
|
|
66
|
+
export default Organization;
|
|
67
|
+
//# sourceMappingURL=Organization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Organization.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/Organization/Organization.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,YAAY,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAmB,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAC,EAAE,EAAgB,SAAS,EAAC,MAAM,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,cAAc,CAAC;IACpF;;;;OAIG;IACH,QAAQ,EAAE,CAAC,YAAY,EAAE,aAAa,GAAG,IAAI,KAAK,SAAS,CAAC;IAE5D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAQvC,CAAC;AAIF,eAAe,YAAY,CAAC"}
|