@asgardeo/nextjs 0.1.2 → 0.1.4

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.
Files changed (59) hide show
  1. package/dist/AsgardeoNextClient.d.ts +11 -4
  2. package/dist/AsgardeoNextClient.js +111 -12
  3. package/dist/AsgardeoNextClient.js.map +1 -1
  4. package/dist/cjs/index.js +18 -0
  5. package/dist/cjs/index.js.map +3 -3
  6. package/dist/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
  7. package/dist/client/components/presentation/CreateOrganization/CreateOrganization.js +109 -0
  8. package/dist/client/components/presentation/CreateOrganization/CreateOrganization.js.map +1 -0
  9. package/dist/client/components/presentation/Organization/Organization.d.ts +66 -0
  10. package/dist/client/components/presentation/Organization/Organization.js +55 -0
  11. package/dist/client/components/presentation/Organization/Organization.js.map +1 -0
  12. package/dist/client/components/presentation/OrganizationList/OrganizationList.d.ts +92 -0
  13. package/dist/client/components/presentation/OrganizationList/OrganizationList.js +75 -0
  14. package/dist/client/components/presentation/OrganizationList/OrganizationList.js.map +1 -0
  15. package/dist/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
  16. package/dist/client/components/presentation/OrganizationProfile/OrganizationProfile.js +145 -0
  17. package/dist/client/components/presentation/OrganizationProfile/OrganizationProfile.js.map +1 -0
  18. package/dist/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +71 -0
  19. package/dist/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.js +102 -0
  20. package/dist/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.js.map +1 -0
  21. package/dist/client/components/presentation/UserProfile/UserProfile.js +3 -4
  22. package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -1
  23. package/dist/client/contexts/Asgardeo/AsgardeoContext.js +2 -0
  24. package/dist/client/contexts/Asgardeo/AsgardeoContext.js.map +1 -1
  25. package/dist/client/contexts/Asgardeo/AsgardeoProvider.d.ts +16 -1
  26. package/dist/client/contexts/Asgardeo/AsgardeoProvider.js +25 -6
  27. package/dist/client/contexts/Asgardeo/AsgardeoProvider.js.map +1 -1
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.js +3 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/server/AsgardeoProvider.js +71 -2
  32. package/dist/server/AsgardeoProvider.js.map +1 -1
  33. package/dist/server/actions/createOrganizationAction.d.ts +37 -0
  34. package/dist/server/actions/createOrganizationAction.js +40 -0
  35. package/dist/server/actions/createOrganizationAction.js.map +1 -0
  36. package/dist/server/actions/getAllOrganizations.d.ts +23 -0
  37. package/dist/server/actions/getAllOrganizations.js +34 -0
  38. package/dist/server/actions/getAllOrganizations.js.map +1 -0
  39. package/dist/server/actions/getBrandingPreference.d.ts +23 -0
  40. package/dist/server/actions/getBrandingPreference.js +32 -0
  41. package/dist/server/actions/getBrandingPreference.js.map +1 -0
  42. package/dist/server/actions/getCurrentOrganizationAction.d.ts +37 -0
  43. package/dist/server/actions/getCurrentOrganizationAction.js +40 -0
  44. package/dist/server/actions/getCurrentOrganizationAction.js.map +1 -0
  45. package/dist/server/actions/getMyOrganizations.d.ts +23 -0
  46. package/dist/server/actions/getMyOrganizations.js +34 -0
  47. package/dist/server/actions/getMyOrganizations.js.map +1 -0
  48. package/dist/server/actions/getOrganizationAction.d.ts +37 -0
  49. package/dist/server/actions/getOrganizationAction.js +40 -0
  50. package/dist/server/actions/getOrganizationAction.js.map +1 -0
  51. package/dist/server/actions/switchOrganization.d.ts +23 -0
  52. package/dist/server/actions/switchOrganization.js +34 -0
  53. package/dist/server/actions/switchOrganization.js.map +1 -0
  54. package/dist/server/actions/updateUserProfileAction.d.ts +2 -8
  55. package/dist/server/actions/updateUserProfileAction.js +2 -2
  56. package/dist/server/actions/updateUserProfileAction.js.map +1 -1
  57. package/dist/utils/decorateConfigWithNextEnv.js +4 -1
  58. package/dist/utils/decorateConfigWithNextEnv.js.map +1 -1
  59. package/package.json +3 -11
@@ -0,0 +1,92 @@
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 } from 'react';
19
+ import { BaseOrganizationListProps, OrganizationWithSwitchAccess } from '@asgardeo/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 '@asgardeo/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;
@@ -0,0 +1,75 @@
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
+ 'use client';
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { useEffect, useState } from 'react';
21
+ import { BaseOrganizationList, useOrganization, } from '@asgardeo/react';
22
+ /**
23
+ * OrganizationList component that provides organization listing functionality with pagination.
24
+ * This component uses the enhanced OrganizationContext, eliminating the polling issue and
25
+ * providing better integration with the existing context system.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * import { OrganizationList } from '@asgardeo/react';
30
+ *
31
+ * // Basic usage
32
+ * <OrganizationList />
33
+ *
34
+ * // With custom limit and filter
35
+ * <OrganizationList
36
+ * limit={20}
37
+ * filter="active"
38
+ * onOrganizationSelect={(org) => {
39
+ * console.log('Selected organization:', org.name);
40
+ * }}
41
+ * />
42
+ *
43
+ * // As a popup dialog
44
+ * <OrganizationList
45
+ * mode="popup"
46
+ * open={isOpen}
47
+ * onOpenChange={setIsOpen}
48
+ * title="Select Organization"
49
+ * />
50
+ *
51
+ * // With custom organization renderer
52
+ * <OrganizationList
53
+ * renderOrganization={(org) => (
54
+ * <div key={org.id}>
55
+ * <h3>{org.name}</h3>
56
+ * <p>Can switch: {org.canSwitch ? 'Yes' : 'No'}</p>
57
+ * </div>
58
+ * )}
59
+ * />
60
+ * ```
61
+ */
62
+ export const OrganizationList = ({ autoFetch = true, filter = '', limit = 10, onOrganizationSelect, recursive = false, ...baseProps }) => {
63
+ const { getAllOrganizations, error, isLoading, myOrganizations } = useOrganization();
64
+ const [allOrganizations, setAllOrganizations] = useState({
65
+ organizations: [],
66
+ });
67
+ useEffect(() => {
68
+ (async () => {
69
+ setAllOrganizations(await getAllOrganizations());
70
+ })();
71
+ }, []);
72
+ return (_jsx(BaseOrganizationList, { allOrganizations: allOrganizations, myOrganizations: myOrganizations, error: error, isLoading: isLoading, onOrganizationSelect: onOrganizationSelect, ...baseProps }));
73
+ };
74
+ export default OrganizationList;
75
+ //# sourceMappingURL=OrganizationList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrganizationList.js","sourceRoot":"","sources":["../../../../../src/client/components/presentation/OrganizationList/OrganizationList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAGb,OAAO,EAAmB,SAAS,EAA0B,QAAQ,EAAC,MAAM,OAAO,CAAC;AACpF,OAAO,EAEL,oBAAoB,EACpB,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AAwCzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,EAC1D,SAAS,GAAG,IAAI,EAChB,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,EAAE,EACV,oBAAoB,EACpB,SAAS,GAAG,KAAK,EACjB,GAAG,SAAS,EACU,EAAgB,EAAE;IACxC,MAAM,EAAC,mBAAmB,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAC,GAAG,eAAe,EAAE,CAAC;IAEnF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAA8B;QACpF,aAAa,EAAE,EAAE;KAClB,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAI,EAAE;YACV,mBAAmB,CAAC,MAAM,mBAAmB,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,oBAAoB,IACnB,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,oBAAoB,EAAE,oBAAoB,KACtC,SAAS,GACb,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,119 @@
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, ReactElement } from 'react';
19
+ import { BaseOrganizationProfileProps } from '@asgardeo/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 Asgardeo 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;
@@ -0,0 +1,145 @@
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
+ 'use client';
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { useEffect, useState } from 'react';
21
+ import { BaseOrganizationProfile, useTranslation } from '@asgardeo/react';
22
+ import { updateOrganization, createPatchOperations } from '@asgardeo/node';
23
+ import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
24
+ import getOrganizationAction from '../../../../server/actions/getOrganizationAction';
25
+ import getSessionId from '../../../../server/actions/getSessionId';
26
+ /**
27
+ * OrganizationProfile component displays organization information in a
28
+ * structured and styled format. It automatically fetches organization details
29
+ * using the provided organization ID and displays them using BaseOrganizationProfile.
30
+ *
31
+ * The component supports editing functionality, allowing users to modify organization
32
+ * fields inline. Updates are automatically synced with the backend via the SCIM2 API.
33
+ *
34
+ * This component is the React-specific implementation that automatically
35
+ * retrieves the organization data from Asgardeo API.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * // Basic usage with editing enabled (default)
40
+ * <OrganizationProfile organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1" />
41
+ *
42
+ * // Read-only mode
43
+ * <OrganizationProfile
44
+ * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
45
+ * editable={false}
46
+ * />
47
+ *
48
+ * // With card layout and custom fallbacks
49
+ * <OrganizationProfile
50
+ * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
51
+ * cardLayout={true}
52
+ * loadingFallback={<div>Loading organization...</div>}
53
+ * errorFallback={<div>Failed to load organization</div>}
54
+ * fallback={<div>No organization data available</div>}
55
+ * />
56
+ *
57
+ * // With custom fields configuration and update callback
58
+ * <OrganizationProfile
59
+ * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
60
+ * fields={[
61
+ * { key: 'id', label: 'Organization ID', editable: false },
62
+ * { key: 'name', label: 'Organization Name', editable: true },
63
+ * { key: 'description', label: 'Description', editable: true, render: (value) => value || 'No description' },
64
+ * { key: 'created', label: 'Created Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },
65
+ * { key: 'lastModified', label: 'Last Modified Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },
66
+ * { key: 'attributes', label: 'Custom Attributes', editable: true }
67
+ * ]}
68
+ * onUpdate={async (payload) => {
69
+ * console.log('Organization updated:', payload);
70
+ * // payload contains the updated field values
71
+ * // The component automatically converts these to patch operations
72
+ * }}
73
+ * />
74
+ *
75
+ * // In popup mode
76
+ * <OrganizationProfile
77
+ * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
78
+ * mode="popup"
79
+ * open={isOpen}
80
+ * onOpenChange={setIsOpen}
81
+ * popupTitle="Edit Organization Profile"
82
+ * />
83
+ * ```
84
+ */
85
+ const OrganizationProfile = ({ organizationId, mode = 'default', open = false, onOpenChange, onUpdate, popupTitle, loadingFallback = _jsx("div", { children: "Loading organization..." }), errorFallback = _jsx("div", { children: "Failed to load organization data" }), ...rest }) => {
86
+ const { baseUrl } = useAsgardeo();
87
+ const { t } = useTranslation();
88
+ const [organization, setOrganization] = useState(null);
89
+ const [loading, setLoading] = useState(true);
90
+ const [error, setError] = useState(false);
91
+ const fetchOrganization = async () => {
92
+ if (!baseUrl || !organizationId) {
93
+ setLoading(false);
94
+ setError(true);
95
+ return;
96
+ }
97
+ try {
98
+ setLoading(true);
99
+ setError(false);
100
+ const result = await getOrganizationAction(organizationId, (await getSessionId()));
101
+ if (result.data?.organization) {
102
+ setOrganization(result.data.organization);
103
+ return;
104
+ }
105
+ setError(true);
106
+ }
107
+ catch (err) {
108
+ console.error('Failed to fetch organization:', err);
109
+ setError(true);
110
+ setOrganization(null);
111
+ }
112
+ finally {
113
+ setLoading(false);
114
+ }
115
+ };
116
+ useEffect(() => {
117
+ fetchOrganization();
118
+ }, [baseUrl, organizationId]);
119
+ const handleOrganizationUpdate = async (payload) => {
120
+ if (!baseUrl || !organizationId)
121
+ return;
122
+ try {
123
+ // Convert payload to patch operations format
124
+ const operations = createPatchOperations(payload);
125
+ await updateOrganization({
126
+ baseUrl,
127
+ organizationId,
128
+ operations,
129
+ });
130
+ // Refetch organization data after update
131
+ await fetchOrganization();
132
+ // Call the optional onUpdate callback
133
+ if (onUpdate) {
134
+ await onUpdate(payload);
135
+ }
136
+ }
137
+ catch (err) {
138
+ console.error('Failed to update organization:', err);
139
+ throw err;
140
+ }
141
+ };
142
+ return (_jsx(BaseOrganizationProfile, { organization: organization, onUpdate: handleOrganizationUpdate, mode: mode === 'popup' ? 'popup' : 'inline', open: open, onOpenChange: onOpenChange, title: popupTitle || t('organization.profile.title'), ...rest }));
143
+ };
144
+ export default OrganizationProfile;
145
+ //# sourceMappingURL=OrganizationProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrganizationProfile.js","sourceRoot":"","sources":["../../../../../src/client/components/presentation/OrganizationProfile/OrganizationProfile.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAmB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAC,uBAAuB,EAAgC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAuC,kBAAkB,EAAE,qBAAqB,EAAC,MAAM,gBAAgB,CAAC;AAC/G,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,qBAAqB,MAAM,kDAAkD,CAAC;AACrF,OAAO,YAAY,MAAM,yCAAyC,CAAC;AAiDnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAM,mBAAmB,GAAiC,CAAC,EACzD,cAAc,EACd,IAAI,GAAG,SAAS,EAChB,IAAI,GAAG,KAAK,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,eAAe,GAAG,oDAAkC,EAC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C,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,EAAE,CAAC;IACtB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;IAE9B,MAAM,wBAAwB,GAAG,KAAK,EAAE,OAAY,EAAiB,EAAE;QACrE,IAAI,CAAC,OAAO,IAAI,CAAC,cAAc;YAAE,OAAO;QAExC,IAAI,CAAC;YACH,6CAA6C;YAC7C,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAElD,MAAM,kBAAkB,CAAC;gBACvB,OAAO;gBACP,cAAc;gBACd,UAAU;aACX,CAAC,CAAC;YACH,yCAAyC;YACzC,MAAM,iBAAiB,EAAE,CAAC;YAE1B,sCAAsC;YACtC,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;YACrD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,uBAAuB,IACtB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAC3C,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,UAAU,IAAI,CAAC,CAAC,4BAA4B,CAAC,KAChD,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,71 @@
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, ReactElement } from 'react';
19
+ import { BaseOrganizationSwitcherProps } from '@asgardeo/react';
20
+ import { Organization } from '@asgardeo/node';
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 '@asgardeo/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;
@@ -0,0 +1,102 @@
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
+ 'use client';
19
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ import { useState } from 'react';
21
+ import { BaseOrganizationSwitcher, BuildingAlt, useOrganization, useTranslation, } from '@asgardeo/react';
22
+ import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
23
+ import { CreateOrganization } from '../CreateOrganization/CreateOrganization';
24
+ import OrganizationProfile from '../OrganizationProfile/OrganizationProfile';
25
+ import OrganizationList from '../OrganizationList/OrganizationList';
26
+ /**
27
+ * OrganizationSwitcher component that provides organization switching functionality.
28
+ * This component automatically retrieves organizations from the OrganizationContext.
29
+ * You can also override the organizations, currentOrganization, and onOrganizationSwitch
30
+ * by passing them as props.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { OrganizationSwitcher } from '@asgardeo/react';
35
+ *
36
+ * // Basic usage - uses OrganizationContext
37
+ * <OrganizationSwitcher />
38
+ *
39
+ * // With custom organization switch handler
40
+ * <OrganizationSwitcher
41
+ * onOrganizationSwitch={(org) => {
42
+ * console.log('Switching to:', org.name);
43
+ * // Custom logic here
44
+ * }}
45
+ * />
46
+ *
47
+ * // With fallback for unauthenticated users
48
+ * <OrganizationSwitcher
49
+ * fallback={<div>Please sign in to view organizations</div>}
50
+ * />
51
+ * ```
52
+ */
53
+ export const OrganizationSwitcher = ({ currentOrganization: propCurrentOrganization, fallback = _jsx(_Fragment, {}), onOrganizationSwitch: propOnOrganizationSwitch, organizations: propOrganizations, ...props }) => {
54
+ const { isSignedIn } = useAsgardeo();
55
+ const { currentOrganization: contextCurrentOrganization, myOrganizations: contextOrganizations, switchOrganization, isLoading, error, } = useOrganization();
56
+ const [isCreateOrgOpen, setIsCreateOrgOpen] = useState(false);
57
+ const [isProfileOpen, setIsProfileOpen] = useState(false);
58
+ const [isOrganizationListOpen, setIsOrganizationListOpen] = useState(false);
59
+ const { t } = useTranslation();
60
+ if (!isSignedIn && fallback) {
61
+ return fallback;
62
+ }
63
+ if (!isSignedIn) {
64
+ return _jsx(_Fragment, {});
65
+ }
66
+ const organizations = propOrganizations || contextOrganizations || [];
67
+ const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
68
+ const onOrganizationSwitch = propOnOrganizationSwitch || switchOrganization;
69
+ const handleManageOrganizations = () => {
70
+ setIsOrganizationListOpen(true);
71
+ };
72
+ const handleManageOrganization = () => {
73
+ setIsProfileOpen(true);
74
+ };
75
+ const defaultMenuItems = [];
76
+ if (currentOrganization) {
77
+ defaultMenuItems.push({
78
+ icon: _jsx(BuildingAlt, {}),
79
+ label: t('organization.switcher.manage.organizations'),
80
+ onClick: handleManageOrganizations,
81
+ });
82
+ }
83
+ defaultMenuItems.push({
84
+ icon: (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M12 5v14m-7-7h14" }) })),
85
+ label: t('organization.switcher.create.organization'),
86
+ onClick: () => setIsCreateOrgOpen(true),
87
+ });
88
+ const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
89
+ return (_jsxs(_Fragment, { children: [_jsx(BaseOrganizationSwitcher, { organizations: organizations, currentOrganization: currentOrganization, onOrganizationSwitch: onOrganizationSwitch, loading: isLoading, error: error, menuItems: menuItems, onManageProfile: handleManageOrganization, ...props }), _jsx(CreateOrganization, { mode: "popup", open: isCreateOrgOpen, onOpenChange: setIsCreateOrgOpen, onSuccess: (org) => {
90
+ if (org && onOrganizationSwitch) {
91
+ onOrganizationSwitch(org);
92
+ }
93
+ setIsCreateOrgOpen(false);
94
+ } }), currentOrganization && (_jsx(OrganizationProfile, { organizationId: currentOrganization.id, mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen, cardLayout: true, loadingFallback: _jsx("div", { children: t('organization.profile.loading') }), errorFallback: _jsx("div", { children: t('organization.profile.error') }) })), _jsx(OrganizationList, { mode: "popup", open: isOrganizationListOpen, onOpenChange: setIsOrganizationListOpen, title: t('organization.switcher.manage.organizations'), onOrganizationSelect: (organization) => {
95
+ if (onOrganizationSwitch) {
96
+ onOrganizationSwitch(organization);
97
+ }
98
+ setIsOrganizationListOpen(false);
99
+ } })] }));
100
+ };
101
+ export default OrganizationSwitcher;
102
+ //# sourceMappingURL=OrganizationSwitcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrganizationSwitcher.js","sourceRoot":"","sources":["../../../../../src/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAmB,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,wBAAwB,EAExB,WAAW,EACX,eAAe,EACf,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,0CAA0C,CAAC;AAC5E,OAAO,mBAAmB,MAAM,4CAA4C,CAAC;AAC7E,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AA2BpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG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oBACD,kBAAkB,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC,GACD,EACD,mBAAmB,IAAI,CACtB,KAAC,mBAAmB,IAClB,cAAc,EAAE,mBAAmB,CAAC,EAAE,EACtC,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,IAAI,EAChB,eAAe,EAAE,wBAAM,CAAC,CAAC,8BAA8B,CAAC,GAAO,EAC/D,aAAa,EAAE,wBAAM,CAAC,CAAC,4BAA4B,CAAC,GAAO,GAC3D,CACH,EACD,KAAC,gBAAgB,IACf,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,sBAAsB,EAC5B,YAAY,EAAE,yBAAyB,EACvC,KAAK,EAAE,CAAC,CAAC,4CAA4C,CAAC,EACtD,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE;oBACnD,IAAI,oBAAoB,EAAE,CAAC;wBACzB,oBAAoB,CAAC,YAAY,CAAC,CAAC;oBACrC,CAAC;oBACD,yBAAyB,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC,GACD,IACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -20,7 +20,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { BaseUserProfile, useUser } from '@asgardeo/react';
21
21
  import useAsgardeo from '../../../contexts/Asgardeo/useAsgardeo';
22
22
  import getSessionId from '../../../../server/actions/getSessionId';
23
- import updateUserProfileAction from '../../../../server/actions/updateUserProfileAction';
24
23
  /**
25
24
  * UserProfile component displays the authenticated user's profile information in a
26
25
  * structured and styled format. It shows user details such as display name, email,
@@ -46,10 +45,10 @@ import updateUserProfileAction from '../../../../server/actions/updateUserProfil
46
45
  */
47
46
  const UserProfile = ({ ...rest }) => {
48
47
  const { baseUrl } = useAsgardeo();
49
- const { profile, flattenedProfile, schemas, revalidateProfile } = useUser();
48
+ const { profile, flattenedProfile, schemas, onUpdateProfile, updateProfile } = useUser();
50
49
  const handleProfileUpdate = async (payload) => {
51
- await updateUserProfileAction(payload, (await getSessionId()));
52
- await revalidateProfile();
50
+ const result = await updateProfile(payload, (await getSessionId()));
51
+ onUpdateProfile(result?.data?.user);
53
52
  };
54
53
  return (_jsx(BaseUserProfile, { profile: profile, flattenedProfile: flattenedProfile, schemas: schemas, onUpdate: handleProfileUpdate, ...rest }));
55
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfile.js","sourceRoot":"","sources":["../../../../../src/client/components/presentation/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAGb,OAAO,EAAC,eAAe,EAAwB,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,YAAY,MAAM,yCAAyC,CAAC;AACnE,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AASzF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,GAAyB,CAAC,EAAC,GAAG,IAAI,EAAmB,EAAgB,EAAE;IACtF,MAAM,EAAC,OAAO,EAAC,GAAG,WAAW,EAAE,CAAC;IAChC,MAAM,EAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAC,GAAG,OAAO,EAAE,CAAC;IAE1E,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAY,EAAiB,EAAE;QAChE,MAAM,uBAAuB,CAAC,OAAO,EAAE,CAAC,MAAM,YAAY,EAAE,CAAW,CAAC,CAAC;QACzE,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IACd,OAAO,EAAE,OAAe,EACxB,gBAAgB,EAAE,gBAAwB,EAC1C,OAAO,EAAE,OAAmB,EAC5B,QAAQ,EAAE,mBAAmB,KACzB,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"UserProfile.js","sourceRoot":"","sources":["../../../../../src/client/components/presentation/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAGb,OAAO,EAAC,eAAe,EAAwB,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,YAAY,MAAM,yCAAyC,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,GAAyB,CAAC,EAAC,GAAG,IAAI,EAAmB,EAAgB,EAAE;IACtF,MAAM,EAAC,OAAO,EAAC,GAAG,WAAW,EAAE,CAAC;IAChC,MAAM,EAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAC,GAAG,OAAO,EAAE,CAAC;IAEvF,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAY,EAAiB,EAAE;QAChE,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC,MAAM,YAAY,EAAE,CAAW,CAAC,CAAC;QAC9E,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IACd,OAAO,EAAE,OAAe,EACxB,gBAAgB,EAAE,gBAAwB,EAC1C,OAAO,EAAE,OAAmB,EAC5B,QAAQ,EAAE,mBAAmB,KACzB,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -21,6 +21,8 @@ import { createContext } from 'react';
21
21
  * Context object for managing the Authentication flow builder core context.
22
22
  */
23
23
  const AsgardeoContext = createContext({
24
+ organizationHandle: undefined,
25
+ applicationId: undefined,
24
26
  signInUrl: undefined,
25
27
  signUpUrl: undefined,
26
28
  afterSignInUrl: undefined,