@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,93 @@
|
|
|
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 { BaseOrganizationListProps, OrganizationWithSwitchAccess } from '@thunderid/react';
|
|
19
|
+
import { FC } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Configuration options for the OrganizationList component.
|
|
22
|
+
*/
|
|
23
|
+
export interface OrganizationListConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Whether to automatically fetch organizations on mount
|
|
26
|
+
*/
|
|
27
|
+
autoFetch?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Filter string for organizations
|
|
30
|
+
*/
|
|
31
|
+
filter?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Number of organizations to fetch per page
|
|
34
|
+
*/
|
|
35
|
+
limit?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to include recursive organizations
|
|
38
|
+
*/
|
|
39
|
+
recursive?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Props interface for the OrganizationList component.
|
|
43
|
+
* Uses the enhanced OrganizationContext instead of the useOrganizations hook.
|
|
44
|
+
*/
|
|
45
|
+
export interface OrganizationListProps extends Omit<BaseOrganizationListProps, 'allOrganizations' | 'error' | 'fetchMore' | 'hasMore' | 'isLoading' | 'isLoadingMore' | 'myOrganizations'>, OrganizationListConfig {
|
|
46
|
+
/**
|
|
47
|
+
* Function called when an organization is selected/clicked
|
|
48
|
+
*/
|
|
49
|
+
onOrganizationSelect?: (organization: OrganizationWithSwitchAccess) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* OrganizationList component that provides organization listing functionality with pagination.
|
|
53
|
+
* This component uses the enhanced OrganizationContext, eliminating the polling issue and
|
|
54
|
+
* providing better integration with the existing context system.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* import { OrganizationList } from '@thunderid/react';
|
|
59
|
+
*
|
|
60
|
+
* // Basic usage
|
|
61
|
+
* <OrganizationList />
|
|
62
|
+
*
|
|
63
|
+
* // With custom limit and filter
|
|
64
|
+
* <OrganizationList
|
|
65
|
+
* limit={20}
|
|
66
|
+
* filter="active"
|
|
67
|
+
* onOrganizationSelect={(org) => {
|
|
68
|
+
* console.log('Selected organization:', org.name);
|
|
69
|
+
* }}
|
|
70
|
+
* />
|
|
71
|
+
*
|
|
72
|
+
* // As a popup dialog
|
|
73
|
+
* <OrganizationList
|
|
74
|
+
* mode="popup"
|
|
75
|
+
* open={isOpen}
|
|
76
|
+
* onOpenChange={setIsOpen}
|
|
77
|
+
* title="Select Organization"
|
|
78
|
+
* />
|
|
79
|
+
*
|
|
80
|
+
* // With custom organization renderer
|
|
81
|
+
* <OrganizationList
|
|
82
|
+
* renderOrganization={(org) => (
|
|
83
|
+
* <div key={org.id}>
|
|
84
|
+
* <h3>{org.name}</h3>
|
|
85
|
+
* <p>Can switch: {org.canSwitch ? 'Yes' : 'No'}</p>
|
|
86
|
+
* </div>
|
|
87
|
+
* )}
|
|
88
|
+
* />
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare const OrganizationList: FC<OrganizationListProps>;
|
|
92
|
+
export default OrganizationList;
|
|
93
|
+
//# sourceMappingURL=OrganizationList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrganizationList.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/OrganizationList/OrganizationList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EACL,yBAAyB,EAGzB,4BAA4B,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,EAAE,EAAoC,MAAM,OAAO,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,qBACf,SAAQ,IAAI,CACR,yBAAyB,EACzB,kBAAkB,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,eAAe,GAAG,iBAAiB,CAC3G,EACD,sBAAsB;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,4BAA4B,KAAK,IAAI,CAAC;CAC7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA0BtD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
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 { BaseOrganizationProfileProps } from '@thunderid/react';
|
|
19
|
+
import { FC, ReactElement } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the OrganizationProfile component.
|
|
22
|
+
* Extends BaseOrganizationProfileProps but makes the organization prop optional
|
|
23
|
+
* since it will be fetched using the organizationId
|
|
24
|
+
*/
|
|
25
|
+
export type OrganizationProfileProps = Omit<BaseOrganizationProfileProps, 'organization' | 'mode'> & {
|
|
26
|
+
/**
|
|
27
|
+
* Component to show when there's an error loading organization data.
|
|
28
|
+
*/
|
|
29
|
+
errorFallback?: ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* Component to show while loading organization data.
|
|
32
|
+
*/
|
|
33
|
+
loadingFallback?: ReactElement;
|
|
34
|
+
/**
|
|
35
|
+
* Display mode for the component.
|
|
36
|
+
*/
|
|
37
|
+
mode?: 'default' | 'popup';
|
|
38
|
+
/**
|
|
39
|
+
* Callback fired when the popup should be closed (only used in popup mode).
|
|
40
|
+
*/
|
|
41
|
+
onOpenChange?: (open: boolean) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Callback fired when the organization should be updated.
|
|
44
|
+
*/
|
|
45
|
+
onUpdate?: (payload: any) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the popup is open (only used in popup mode).
|
|
48
|
+
*/
|
|
49
|
+
open?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The ID of the organization to fetch and display.
|
|
52
|
+
*/
|
|
53
|
+
organizationId: string;
|
|
54
|
+
/**
|
|
55
|
+
* Custom title for the popup dialog (only used in popup mode).
|
|
56
|
+
*/
|
|
57
|
+
popupTitle?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* OrganizationProfile component displays organization information in a
|
|
61
|
+
* structured and styled format. It automatically fetches organization details
|
|
62
|
+
* using the provided organization ID and displays them using BaseOrganizationProfile.
|
|
63
|
+
*
|
|
64
|
+
* The component supports editing functionality, allowing users to modify organization
|
|
65
|
+
* fields inline. Updates are automatically synced with the backend via the SCIM2 API.
|
|
66
|
+
*
|
|
67
|
+
* This component is the React-specific implementation that automatically
|
|
68
|
+
* retrieves the organization data from ThunderID API.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // Basic usage with editing enabled (default)
|
|
73
|
+
* <OrganizationProfile organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1" />
|
|
74
|
+
*
|
|
75
|
+
* // Read-only mode
|
|
76
|
+
* <OrganizationProfile
|
|
77
|
+
* organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
78
|
+
* editable={false}
|
|
79
|
+
* />
|
|
80
|
+
*
|
|
81
|
+
* // With card layout and custom fallbacks
|
|
82
|
+
* <OrganizationProfile
|
|
83
|
+
* organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
84
|
+
* cardLayout={true}
|
|
85
|
+
* loadingFallback={<div>Loading organization...</div>}
|
|
86
|
+
* errorFallback={<div>Failed to load organization</div>}
|
|
87
|
+
* fallback={<div>No organization data available</div>}
|
|
88
|
+
* />
|
|
89
|
+
*
|
|
90
|
+
* // With custom fields configuration and update callback
|
|
91
|
+
* <OrganizationProfile
|
|
92
|
+
* organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
93
|
+
* fields={[
|
|
94
|
+
* { key: 'id', label: 'Organization ID', editable: false },
|
|
95
|
+
* { key: 'name', label: 'Organization Name', editable: true },
|
|
96
|
+
* { key: 'description', label: 'Description', editable: true, render: (value) => value || 'No description' },
|
|
97
|
+
* { key: 'created', label: 'Created Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },
|
|
98
|
+
* { key: 'lastModified', label: 'Last Modified Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },
|
|
99
|
+
* { key: 'attributes', label: 'Custom Attributes', editable: true }
|
|
100
|
+
* ]}
|
|
101
|
+
* onUpdate={async (payload) => {
|
|
102
|
+
* console.log('Organization updated:', payload);
|
|
103
|
+
* // payload contains the updated field values
|
|
104
|
+
* // The component automatically converts these to patch operations
|
|
105
|
+
* }}
|
|
106
|
+
* />
|
|
107
|
+
*
|
|
108
|
+
* // In popup mode
|
|
109
|
+
* <OrganizationProfile
|
|
110
|
+
* organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
111
|
+
* mode="popup"
|
|
112
|
+
* open={isOpen}
|
|
113
|
+
* onOpenChange={setIsOpen}
|
|
114
|
+
* popupTitle="Edit Organization Profile"
|
|
115
|
+
* />
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare const OrganizationProfile: FC<OrganizationProfileProps>;
|
|
119
|
+
export default OrganizationProfile;
|
|
120
|
+
//# sourceMappingURL=OrganizationProfile.d.ts.map
|
package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrganizationProfile.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/OrganizationProfile/OrganizationProfile.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAA0B,4BAA4B,EAAiB,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAC,EAAE,EAAE,YAAY,EAAsB,MAAM,OAAO,CAAC;AAM5D;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,4BAA4B,EAAE,cAAc,GAAG,MAAM,CAAC,GAAG;IACnG;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B;;OAEG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC;IAE/B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,QAAA,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAoFrD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
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 } from '@thunderid/node';
|
|
19
|
+
import { BaseOrganizationSwitcherProps } from '@thunderid/react';
|
|
20
|
+
import { FC, ReactElement } from 'react';
|
|
21
|
+
/**
|
|
22
|
+
* Props interface for the OrganizationSwitcher component.
|
|
23
|
+
* Makes organizations optional since they'll be retrieved from OrganizationContext.
|
|
24
|
+
*/
|
|
25
|
+
export interface OrganizationSwitcherProps extends Omit<BaseOrganizationSwitcherProps, 'organizations' | 'currentOrganization' | 'onOrganizationSwitch'> {
|
|
26
|
+
/**
|
|
27
|
+
* Optional override for current organization (will use context if not provided)
|
|
28
|
+
*/
|
|
29
|
+
currentOrganization?: Organization;
|
|
30
|
+
/**
|
|
31
|
+
* Fallback element to render when the user is not signed in.
|
|
32
|
+
*/
|
|
33
|
+
fallback?: ReactElement;
|
|
34
|
+
/**
|
|
35
|
+
* Optional callback for organization switch (will use context if not provided)
|
|
36
|
+
*/
|
|
37
|
+
onOrganizationSwitch?: (organization: Organization) => Promise<void> | void;
|
|
38
|
+
/**
|
|
39
|
+
* Optional override for organizations list (will use context if not provided)
|
|
40
|
+
*/
|
|
41
|
+
organizations?: Organization[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* OrganizationSwitcher component that provides organization switching functionality.
|
|
45
|
+
* This component automatically retrieves organizations from the OrganizationContext.
|
|
46
|
+
* You can also override the organizations, currentOrganization, and onOrganizationSwitch
|
|
47
|
+
* by passing them as props.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* import { OrganizationSwitcher } from '@thunderid/react';
|
|
52
|
+
*
|
|
53
|
+
* // Basic usage - uses OrganizationContext
|
|
54
|
+
* <OrganizationSwitcher />
|
|
55
|
+
*
|
|
56
|
+
* // With custom organization switch handler
|
|
57
|
+
* <OrganizationSwitcher
|
|
58
|
+
* onOrganizationSwitch={(org) => {
|
|
59
|
+
* console.log('Switching to:', org.name);
|
|
60
|
+
* // Custom logic here
|
|
61
|
+
* }}
|
|
62
|
+
* />
|
|
63
|
+
*
|
|
64
|
+
* // With fallback for unauthenticated users
|
|
65
|
+
* <OrganizationSwitcher
|
|
66
|
+
* fallback={<div>Please sign in to view organizations</div>}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare const OrganizationSwitcher: FC<OrganizationSwitcherProps>;
|
|
71
|
+
export default OrganizationSwitcher;
|
|
72
|
+
//# sourceMappingURL=OrganizationSwitcher.d.ts.map
|
package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrganizationSwitcher.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAEL,6BAA6B,EAI9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,EAAE,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAMjD;;;GAGG;AACH,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,6BAA6B,EAAE,eAAe,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;IAC7G;;OAEG;IACH,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5E;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA+G9D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { BaseSignInProps } from '@thunderid/react';
|
|
19
|
+
import { FC } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the SignIn component.
|
|
22
|
+
* Extends BaseSignInProps for full compatibility with the React BaseSignIn component
|
|
23
|
+
*/
|
|
24
|
+
export type SignInProps = Pick<BaseSignInProps, 'className' | 'onSuccess' | 'onError' | 'variant' | 'size'>;
|
|
25
|
+
/**
|
|
26
|
+
* A SignIn component for Next.js that provides native authentication flow.
|
|
27
|
+
* This component delegates to the BaseSignIn from @thunderid/react and requires
|
|
28
|
+
* the API functions to be provided as props.
|
|
29
|
+
*
|
|
30
|
+
* @remarks This component requires the authentication API functions to be provided
|
|
31
|
+
* as props. For a complete working example, you'll need to implement the server-side
|
|
32
|
+
* authentication endpoints or use the traditional OAuth flow with SignInButton.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { SignIn } from '@thunderid/nextjs';
|
|
37
|
+
* import { executeEmbeddedSignInFlow } from '@thunderid/browser';
|
|
38
|
+
*
|
|
39
|
+
* const LoginPage = () => {
|
|
40
|
+
* const handleInitialize = async () => {
|
|
41
|
+
* return await executeEmbeddedSignInFlow({
|
|
42
|
+
* response_mode: 'direct',
|
|
43
|
+
* });
|
|
44
|
+
* };
|
|
45
|
+
*
|
|
46
|
+
* const handleSubmit = async (flow) => {
|
|
47
|
+
* return await executeEmbeddedSignInFlow({ flow });
|
|
48
|
+
* };
|
|
49
|
+
*
|
|
50
|
+
* return (
|
|
51
|
+
* <SignIn
|
|
52
|
+
* onInitialize={handleInitialize}
|
|
53
|
+
* onSubmit={handleSubmit}
|
|
54
|
+
* onSuccess={(authData) => {
|
|
55
|
+
* console.log('Authentication successful:', authData);
|
|
56
|
+
* }}
|
|
57
|
+
* onError={(error) => {
|
|
58
|
+
* console.error('Authentication failed:', error);
|
|
59
|
+
* }}
|
|
60
|
+
* size="medium"
|
|
61
|
+
* variant="outlined"
|
|
62
|
+
* afterSignInUrl="/dashboard"
|
|
63
|
+
* />
|
|
64
|
+
* );
|
|
65
|
+
* };
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare const SignIn: FC<SignInProps>;
|
|
69
|
+
export default SignIn;
|
|
70
|
+
//# sourceMappingURL=SignIn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/SignIn/SignIn.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,OAAO,EAAa,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAGzB;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;AAE5G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAuC3B,CAAC;AAIF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { BaseSignUpProps } from '@thunderid/react';
|
|
19
|
+
import { FC } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the SignUp component.
|
|
22
|
+
*/
|
|
23
|
+
export type SignUpProps = BaseSignUpProps;
|
|
24
|
+
/**
|
|
25
|
+
* A styled SignUp component that provides embedded sign-up flow with pre-built styling.
|
|
26
|
+
* This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { SignUp } from '@thunderid/react';
|
|
31
|
+
*
|
|
32
|
+
* const App = () => {
|
|
33
|
+
* return (
|
|
34
|
+
* <SignUp
|
|
35
|
+
* onSuccess={(response) => {
|
|
36
|
+
* console.log('Sign-up successful:', response);
|
|
37
|
+
* // Handle successful sign-up (e.g., redirect, show confirmation)
|
|
38
|
+
* }}
|
|
39
|
+
* onError={(error) => {
|
|
40
|
+
* console.error('Sign-up failed:', error);
|
|
41
|
+
* }}
|
|
42
|
+
* onComplete={(redirectUrl) => {
|
|
43
|
+
* // Platform-specific redirect handling (e.g., Next.js router.push)
|
|
44
|
+
* router.push(redirectUrl); // or window.location.href = redirectUrl
|
|
45
|
+
* }}
|
|
46
|
+
* size="medium"
|
|
47
|
+
* variant="outlined"
|
|
48
|
+
* afterSignUpUrl="/welcome"
|
|
49
|
+
* />
|
|
50
|
+
* );
|
|
51
|
+
* };
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const SignUp: FC<SignUpProps>;
|
|
55
|
+
export default SignUp;
|
|
56
|
+
//# sourceMappingURL=SignUp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUp.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/SignUp/SignUp.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,EAAa,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAGzB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAyD3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 { BaseUserProps } from '@thunderid/react';
|
|
19
|
+
import { FC, ReactNode } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the User component.
|
|
22
|
+
* Extends BaseUserProps but makes the user prop optional since it will be obtained from useThunderID
|
|
23
|
+
*/
|
|
24
|
+
export interface UserProps extends Omit<BaseUserProps, 'user'> {
|
|
25
|
+
/**
|
|
26
|
+
* Render prop that takes the user object and returns a ReactNode.
|
|
27
|
+
* @param user - The authenticated user object from ThunderID.
|
|
28
|
+
* @returns A ReactNode to render.
|
|
29
|
+
*/
|
|
30
|
+
children: (user: any | null) => ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Optional element to render when no user is signed in.
|
|
33
|
+
*/
|
|
34
|
+
fallback?: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A component that uses render props to expose the authenticated user object.
|
|
38
|
+
* This component automatically retrieves the user from ThunderID context.
|
|
39
|
+
*
|
|
40
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* import { User } from '@thunderid/auth-react';
|
|
45
|
+
*
|
|
46
|
+
* const App = () => {
|
|
47
|
+
* return (
|
|
48
|
+
* <User fallback={<p>Please sign in</p>}>
|
|
49
|
+
* {(user) => (
|
|
50
|
+
* <div>
|
|
51
|
+
* <h1>Welcome, {user.displayName}!</h1>
|
|
52
|
+
* <p>Email: {user.email}</p>
|
|
53
|
+
* </div>
|
|
54
|
+
* )}
|
|
55
|
+
* </User>
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare const User: FC<UserProps>;
|
|
61
|
+
export default User;
|
|
62
|
+
//# sourceMappingURL=User.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/User/User.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAW,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,EAAE,EAAgB,SAAS,EAAC,MAAM,OAAO,CAAC;AAGlD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IAC5D;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,KAAK,SAAS,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAQvB,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 { BaseUserDropdownProps } from '@thunderid/react';
|
|
19
|
+
import { FC, ReactNode } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Render props data passed to the children function
|
|
22
|
+
*/
|
|
23
|
+
export interface UserDropdownRenderProps {
|
|
24
|
+
/** Function to close the profile dialog */
|
|
25
|
+
closeProfile: () => void;
|
|
26
|
+
/** Whether user data is currently loading */
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
/** Whether the profile dialog is currently open */
|
|
29
|
+
isProfileOpen: boolean;
|
|
30
|
+
/** Function to open the user profile dialog */
|
|
31
|
+
openProfile: () => void;
|
|
32
|
+
/** Function to sign out the user */
|
|
33
|
+
signOut: () => void;
|
|
34
|
+
/** The authenticated user object */
|
|
35
|
+
user: any;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Props for the UserDropdown component.
|
|
39
|
+
* Extends BaseUserDropdownProps but excludes user, onManageProfile, and onSignOut since they're handled internally
|
|
40
|
+
*/
|
|
41
|
+
export type UserDropdownProps = Omit<BaseUserDropdownProps, 'user' | 'onManageProfile'> & {
|
|
42
|
+
/**
|
|
43
|
+
* Render prop function that receives user state and actions.
|
|
44
|
+
* When provided, this completely replaces the default dropdown rendering.
|
|
45
|
+
*/
|
|
46
|
+
children?: (props: UserDropdownRenderProps) => ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Custom render function for the dropdown content.
|
|
49
|
+
* When provided, this replaces just the dropdown content while keeping the trigger.
|
|
50
|
+
*/
|
|
51
|
+
renderDropdown?: (props: UserDropdownRenderProps) => ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Custom render function for the trigger button.
|
|
54
|
+
* When provided, this replaces just the trigger button while keeping the dropdown.
|
|
55
|
+
*/
|
|
56
|
+
renderTrigger?: (props: UserDropdownRenderProps) => ReactNode;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* UserDropdown component displays a user avatar with a dropdown menu.
|
|
60
|
+
* When clicked, it shows a popover with customizable menu items.
|
|
61
|
+
* This component is the React-specific implementation that uses the BaseUserDropdown
|
|
62
|
+
* and automatically retrieves the user data from ThunderID context.
|
|
63
|
+
*
|
|
64
|
+
* Supports render props for complete customization of the dropdown appearance and behavior.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* // Basic usage - will use user from ThunderID context
|
|
69
|
+
* <UserDropdown menuItems={[
|
|
70
|
+
* { label: 'Profile', onClick: () => {} },
|
|
71
|
+
* { label: 'Settings', href: '/settings' },
|
|
72
|
+
* { label: 'Sign Out', onClick: () => {} }
|
|
73
|
+
* ]} />
|
|
74
|
+
*
|
|
75
|
+
* // With custom configuration
|
|
76
|
+
* <UserDropdown
|
|
77
|
+
* showTriggerLabel={true}
|
|
78
|
+
* avatarSize={40}
|
|
79
|
+
* fallback={<div>Please sign in</div>}
|
|
80
|
+
* />
|
|
81
|
+
*
|
|
82
|
+
* // Using render props for complete customization
|
|
83
|
+
* <UserDropdown>
|
|
84
|
+
* {({ user, isLoading, openProfile, signOut }) => (
|
|
85
|
+
* <div>
|
|
86
|
+
* <button onClick={openProfile}>
|
|
87
|
+
* {user?.name || 'Loading...'}
|
|
88
|
+
* </button>
|
|
89
|
+
* <button onClick={signOut}>Logout</button>
|
|
90
|
+
* </div>
|
|
91
|
+
* )}
|
|
92
|
+
* </UserDropdown>
|
|
93
|
+
*
|
|
94
|
+
* // Using partial render props
|
|
95
|
+
* <UserDropdown
|
|
96
|
+
* renderTrigger={({ user, openProfile }) => (
|
|
97
|
+
* <button onClick={openProfile} className="custom-trigger">
|
|
98
|
+
* Welcome, {user?.name}!
|
|
99
|
+
* </button>
|
|
100
|
+
* )}
|
|
101
|
+
* />
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare const UserDropdown: FC<UserDropdownProps>;
|
|
105
|
+
export default UserDropdown;
|
|
106
|
+
//# sourceMappingURL=UserDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserDropdown.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/UserDropdown/UserDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAmB,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,EAAE,EAAgB,SAAS,EAAW,MAAM,OAAO,CAAC;AAI5D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,aAAa,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,oCAAoC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,IAAI,EAAE,GAAG,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,iBAAiB,CAAC,GAAG;IACxF;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;IACzD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;IAC/D;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;CAC/D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAiFvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 { BaseUserProfileProps } from '@thunderid/react';
|
|
19
|
+
import { FC } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the UserProfile component.
|
|
22
|
+
* Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID
|
|
23
|
+
*/
|
|
24
|
+
export type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile' | 'schemas'>;
|
|
25
|
+
/**
|
|
26
|
+
* UserProfile component displays the authenticated user's profile information in a
|
|
27
|
+
* structured and styled format. It shows user details such as display name, email,
|
|
28
|
+
* username, and other available profile information from ThunderID.
|
|
29
|
+
*
|
|
30
|
+
* This component is the React-specific implementation that uses the BaseUserProfile
|
|
31
|
+
* and automatically retrieves the user data from ThunderID context if not provided.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Basic usage - will use user from ThunderID context
|
|
36
|
+
* <UserProfile />
|
|
37
|
+
*
|
|
38
|
+
* // With explicit user data
|
|
39
|
+
* <UserProfile user={specificUser} />
|
|
40
|
+
*
|
|
41
|
+
* // With card layout and custom fallback
|
|
42
|
+
* <UserProfile
|
|
43
|
+
* cardLayout={true}
|
|
44
|
+
* fallback={<div>Please sign in to view your profile</div>}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare const UserProfile: FC<UserProfileProps>;
|
|
49
|
+
export default UserProfile;
|
|
50
|
+
//# sourceMappingURL=UserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/presentation/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAkB,oBAAoB,EAAU,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAC,EAAE,EAAe,MAAM,OAAO,CAAC;AAGvC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAAC,CAAC;AAE/G;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAoBrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|