@asgardeo/nextjs 0.1.2 → 0.1.3
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/dist/AsgardeoNextClient.d.ts +6 -4
- package/dist/AsgardeoNextClient.js +89 -12
- package/dist/AsgardeoNextClient.js.map +1 -1
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +3 -3
- package/dist/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
- package/dist/client/components/presentation/CreateOrganization/CreateOrganization.js +109 -0
- package/dist/client/components/presentation/CreateOrganization/CreateOrganization.js.map +1 -0
- package/dist/client/components/presentation/Organization/Organization.d.ts +66 -0
- package/dist/client/components/presentation/Organization/Organization.js +55 -0
- package/dist/client/components/presentation/Organization/Organization.js.map +1 -0
- package/dist/client/components/presentation/OrganizationList/OrganizationList.d.ts +92 -0
- package/dist/client/components/presentation/OrganizationList/OrganizationList.js +120 -0
- package/dist/client/components/presentation/OrganizationList/OrganizationList.js.map +1 -0
- package/dist/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
- package/dist/client/components/presentation/OrganizationProfile/OrganizationProfile.js +145 -0
- package/dist/client/components/presentation/OrganizationProfile/OrganizationProfile.js.map +1 -0
- package/dist/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +71 -0
- package/dist/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.js +102 -0
- package/dist/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.js.map +1 -0
- package/dist/client/components/presentation/UserProfile/UserProfile.js +3 -4
- package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -1
- package/dist/client/contexts/Asgardeo/AsgardeoContext.js +2 -0
- package/dist/client/contexts/Asgardeo/AsgardeoContext.js.map +1 -1
- package/dist/client/contexts/Asgardeo/AsgardeoProvider.d.ts +11 -1
- package/dist/client/contexts/Asgardeo/AsgardeoProvider.js +44 -6
- package/dist/client/contexts/Asgardeo/AsgardeoProvider.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/server/AsgardeoProvider.js +28 -1
- package/dist/server/AsgardeoProvider.js.map +1 -1
- package/dist/server/actions/createOrganizationAction.d.ts +37 -0
- package/dist/server/actions/createOrganizationAction.js +40 -0
- package/dist/server/actions/createOrganizationAction.js.map +1 -0
- package/dist/server/actions/getCurrentOrganizationAction.d.ts +37 -0
- package/dist/server/actions/getCurrentOrganizationAction.js +40 -0
- package/dist/server/actions/getCurrentOrganizationAction.js.map +1 -0
- package/dist/server/actions/getOrganizationAction.d.ts +37 -0
- package/dist/server/actions/getOrganizationAction.js +40 -0
- package/dist/server/actions/getOrganizationAction.js.map +1 -0
- package/dist/server/actions/getOrganizationsAction.d.ts +37 -0
- package/dist/server/actions/getOrganizationsAction.js +40 -0
- package/dist/server/actions/getOrganizationsAction.js.map +1 -0
- package/dist/server/actions/switchOrganizationAction.d.ts +33 -0
- package/dist/server/actions/switchOrganizationAction.js +40 -0
- package/dist/server/actions/switchOrganizationAction.js.map +1 -0
- package/dist/server/actions/updateUserProfileAction.d.ts +2 -8
- package/dist/server/actions/updateUserProfileAction.js +2 -2
- package/dist/server/actions/updateUserProfileAction.js.map +1 -1
- package/dist/utils/decorateConfigWithNextEnv.js +3 -1
- package/dist/utils/decorateConfigWithNextEnv.js.map +1 -1
- package/package.json +3 -11
|
@@ -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,wCAAw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,IAAI,EAAE,eAAe,EACrB,YAAY,EAAE,kBAAkB,EAChC,SAAS,EAAE,CAAC,GAAiB,EAAE,EAAE;oBAC/B,IAAI,GAAG,IAAI,oBAAoB,EAAE,CAAC;wBAChC,oBAAoB,CAAC,GAAG,CAAC,CAAC;oBAC5B,CAAC;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,
|
|
48
|
+
const { profile, flattenedProfile, schemas, onUpdateProfile, updateProfile } = useUser();
|
|
50
49
|
const handleProfileUpdate = async (payload) => {
|
|
51
|
-
await
|
|
52
|
-
|
|
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;
|
|
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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsgardeoContext.js","sourceRoot":"","sources":["../../../../src/client/contexts/Asgardeo/AsgardeoContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAIb,OAAO,EAAU,aAAa,EAAC,MAAM,OAAO,CAAC;AAO7C;;GAEG;AACH,MAAM,eAAe,GAAyC,aAAa,CAA8B;IACvG,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,SAAS;IACzB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,KAAK;IACjB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAEhD,eAAe,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"AsgardeoContext.js","sourceRoot":"","sources":["../../../../src/client/contexts/Asgardeo/AsgardeoContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAIb,OAAO,EAAU,aAAa,EAAC,MAAM,OAAO,CAAC;AAO7C;;GAEG;AACH,MAAM,eAAe,GAAyC,aAAa,CAA8B;IACvG,kBAAkB,EAAE,SAAS;IAC7B,aAAa,EAAE,SAAS;IACxB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,SAAS;IACzB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,KAAK;IACjB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAEhD,eAAe,eAAe,CAAC"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User, UserProfile } from '@asgardeo/node';
|
|
18
|
+
import { Organization, UpdateMeProfileConfig, User, UserProfile } from '@asgardeo/node';
|
|
19
19
|
import { AsgardeoProviderProps } from '@asgardeo/react';
|
|
20
20
|
import { FC, PropsWithChildren } from 'react';
|
|
21
21
|
import { AsgardeoContextProps } from './AsgardeoContext';
|
|
@@ -26,6 +26,8 @@ export type AsgardeoClientProviderProps = Partial<Omit<AsgardeoProviderProps, 'b
|
|
|
26
26
|
signOut: AsgardeoContextProps['signOut'];
|
|
27
27
|
signIn: AsgardeoContextProps['signIn'];
|
|
28
28
|
signUp: AsgardeoContextProps['signUp'];
|
|
29
|
+
applicationId: AsgardeoContextProps['applicationId'];
|
|
30
|
+
organizationHandle: AsgardeoContextProps['organizationHandle'];
|
|
29
31
|
handleOAuthCallback: (code: string, state: string, sessionState?: string) => Promise<{
|
|
30
32
|
success: boolean;
|
|
31
33
|
error?: string;
|
|
@@ -33,7 +35,15 @@ export type AsgardeoClientProviderProps = Partial<Omit<AsgardeoProviderProps, 'b
|
|
|
33
35
|
}>;
|
|
34
36
|
isSignedIn: boolean;
|
|
35
37
|
userProfile: UserProfile;
|
|
38
|
+
currentOrganization: Organization;
|
|
36
39
|
user: User | null;
|
|
40
|
+
updateProfile: (requestConfig: UpdateMeProfileConfig, sessionId?: string) => Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
data: {
|
|
43
|
+
user: User;
|
|
44
|
+
};
|
|
45
|
+
error: string;
|
|
46
|
+
}>;
|
|
37
47
|
};
|
|
38
48
|
declare const AsgardeoClientProvider: FC<PropsWithChildren<AsgardeoClientProviderProps>>;
|
|
39
49
|
export default AsgardeoClientProvider;
|
|
@@ -17,16 +17,28 @@
|
|
|
17
17
|
*/
|
|
18
18
|
'use client';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { AsgardeoRuntimeError, generateFlattenedUserProfile, } from '@asgardeo/node';
|
|
21
|
+
import { I18nProvider, FlowProvider, UserProvider, ThemeProvider, OrganizationProvider, } from '@asgardeo/react';
|
|
22
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
22
23
|
import { useRouter, useSearchParams } from 'next/navigation';
|
|
23
24
|
import AsgardeoContext from './AsgardeoContext';
|
|
24
|
-
|
|
25
|
+
import getOrganizationsAction from '../../../server/actions/getOrganizationsAction';
|
|
26
|
+
import getSessionId from '../../../server/actions/getSessionId';
|
|
27
|
+
import switchOrganizationAction from '../../../server/actions/switchOrganizationAction';
|
|
28
|
+
const AsgardeoClientProvider = ({ baseUrl, children, signIn, signOut, signUp, handleOAuthCallback, preferences, isSignedIn, signInUrl, signUpUrl, user: _user, userProfile: _userProfile, currentOrganization, updateProfile, applicationId, organizationHandle, }) => {
|
|
29
|
+
const reRenderCheckRef = useRef(false);
|
|
25
30
|
const router = useRouter();
|
|
26
31
|
const searchParams = useSearchParams();
|
|
27
32
|
const [isDarkMode, setIsDarkMode] = useState(false);
|
|
28
33
|
const [isLoading, setIsLoading] = useState(true);
|
|
29
|
-
const [
|
|
34
|
+
const [user, setUser] = useState(_user);
|
|
35
|
+
const [userProfile, setUserProfile] = useState(_userProfile);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setUserProfile(_userProfile);
|
|
38
|
+
}, [_userProfile]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setUser(_user);
|
|
41
|
+
}, [_user]);
|
|
30
42
|
// Handle OAuth callback automatically
|
|
31
43
|
useEffect(() => {
|
|
32
44
|
// Don't handle callback if already signed in
|
|
@@ -144,6 +156,19 @@ const AsgardeoClientProvider = ({ baseUrl, children, signIn, signOut, signUp, ha
|
|
|
144
156
|
throw error;
|
|
145
157
|
}
|
|
146
158
|
};
|
|
159
|
+
const switchOrganization = async (organization) => {
|
|
160
|
+
try {
|
|
161
|
+
await switchOrganizationAction(organization, (await getSessionId()));
|
|
162
|
+
// if (await asgardeo.isSignedIn()) {
|
|
163
|
+
// setUser(await asgardeo.getUser());
|
|
164
|
+
// setUserProfile(await asgardeo.getUserProfile());
|
|
165
|
+
// setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
166
|
+
// }
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
throw new AsgardeoRuntimeError(`Failed to switch organization: ${error instanceof Error ? error.message : String(error)}`, 'AsgardeoClientProvider-switchOrganization-RuntimeError-001', 'nextjs', 'An error occurred while switching to the specified organization.');
|
|
170
|
+
}
|
|
171
|
+
};
|
|
147
172
|
const contextValue = useMemo(() => ({
|
|
148
173
|
baseUrl,
|
|
149
174
|
user,
|
|
@@ -154,8 +179,21 @@ const AsgardeoClientProvider = ({ baseUrl, children, signIn, signOut, signUp, ha
|
|
|
154
179
|
signUp: handleSignUp,
|
|
155
180
|
signInUrl,
|
|
156
181
|
signUpUrl,
|
|
157
|
-
|
|
158
|
-
|
|
182
|
+
applicationId,
|
|
183
|
+
organizationHandle,
|
|
184
|
+
}), [baseUrl, user, isSignedIn, isLoading, signInUrl, signUpUrl, applicationId, organizationHandle]);
|
|
185
|
+
const handleProfileUpdate = (payload) => {
|
|
186
|
+
setUser(payload);
|
|
187
|
+
setUserProfile(prev => ({
|
|
188
|
+
...prev,
|
|
189
|
+
profile: payload,
|
|
190
|
+
flattenedProfile: generateFlattenedUserProfile(payload, prev?.schemas),
|
|
191
|
+
}));
|
|
192
|
+
};
|
|
193
|
+
return (_jsx(AsgardeoContext.Provider, { value: contextValue, children: _jsx(I18nProvider, { preferences: preferences?.i18n, children: _jsx(ThemeProvider, { theme: preferences?.theme?.overrides, mode: isDarkMode ? 'dark' : 'light', children: _jsx(FlowProvider, { children: _jsx(UserProvider, { profile: userProfile, onUpdateProfile: handleProfileUpdate, updateProfile: updateProfile, children: _jsx(OrganizationProvider, { getOrganizations: async () => {
|
|
194
|
+
const result = await getOrganizationsAction((await getSessionId()));
|
|
195
|
+
return result?.data?.organizations || [];
|
|
196
|
+
}, currentOrganization: currentOrganization, onOrganizationSwitch: switchOrganization, children: children }) }) }) }) }) }));
|
|
159
197
|
};
|
|
160
198
|
export default AsgardeoClientProvider;
|
|
161
199
|
//# sourceMappingURL=AsgardeoProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../../../src/client/contexts/Asgardeo/AsgardeoProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../../../src/client/contexts/Asgardeo/AsgardeoProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EACL,oBAAoB,EAIpB,4BAA4B,GAK7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EAEb,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAmC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC3D,OAAO,eAAuC,MAAM,mBAAmB,CAAC;AACxE,OAAO,sBAAsB,MAAM,gDAAgD,CAAC;AACpF,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,wBAAwB,MAAM,kDAAkD,CAAC;AA2BxF,MAAM,sBAAsB,GAAuD,CAAC,EAClF,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,IAAI,EAAE,KAAK,EACX,WAAW,EAAE,YAAY,EACzB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,kBAAkB,GAC6B,EAAE,EAAE;IACnD,MAAM,gBAAgB,GAAuB,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KA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AAE,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,YACtF,KAAC,YAAY,cACX,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,YACpG,KAAC,oBAAoB,IACnB,gBAAgB,EAAE,KAAK,IAAI,EAAE;gCAC3B,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,CAAC,MAAM,YAAY,EAAE,CAAW,CAAC,CAAC;gCAE9E,OAAO,MAAM,EAAE,IAAI,EAAE,aAAa,IAAI,EAAE,CAAC;4BAC3C,CAAC,EACD,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,kBAAkB,YAEvC,QAAQ,GACY,GACV,GACF,GACD,GACH,GACU,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ export { default as useAsgardeo } from './client/contexts/Asgardeo/useAsgardeo';
|
|
|
21
21
|
export * from './client/contexts/Asgardeo/useAsgardeo';
|
|
22
22
|
export { default as isSignedIn } from './server/actions/isSignedIn';
|
|
23
23
|
export { default as handleOAuthCallback } from './server/actions/handleOAuthCallbackAction';
|
|
24
|
+
export { default as CreateOrganization } from './client/components/presentation/CreateOrganization/CreateOrganization';
|
|
25
|
+
export { CreateOrganizationProps } from './client/components/presentation/CreateOrganization/CreateOrganization';
|
|
26
|
+
export { default as OrganizationProfile } from './client/components/presentation/OrganizationProfile/OrganizationProfile';
|
|
27
|
+
export { OrganizationProfileProps } from './client/components/presentation/OrganizationProfile/OrganizationProfile';
|
|
28
|
+
export { default as OrganizationSwitcher } from './client/components/presentation/OrganizationSwitcher/OrganizationSwitcher';
|
|
29
|
+
export { OrganizationSwitcherProps } from './client/components/presentation/OrganizationSwitcher/OrganizationSwitcher';
|
|
24
30
|
export { default as SignedIn } from './client/components/control/SignedIn/SignedIn';
|
|
25
31
|
export { SignedInProps } from './client/components/control/SignedIn/SignedIn';
|
|
26
32
|
export { default as SignedOut } from './client/components/control/SignedOut/SignedOut';
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,9 @@ export { default as useAsgardeo } from './client/contexts/Asgardeo/useAsgardeo';
|
|
|
21
21
|
export * from './client/contexts/Asgardeo/useAsgardeo';
|
|
22
22
|
export { default as isSignedIn } from './server/actions/isSignedIn';
|
|
23
23
|
export { default as handleOAuthCallback } from './server/actions/handleOAuthCallbackAction';
|
|
24
|
+
export { default as CreateOrganization } from './client/components/presentation/CreateOrganization/CreateOrganization';
|
|
25
|
+
export { default as OrganizationProfile } from './client/components/presentation/OrganizationProfile/OrganizationProfile';
|
|
26
|
+
export { default as OrganizationSwitcher } from './client/components/presentation/OrganizationSwitcher/OrganizationSwitcher';
|
|
24
27
|
export { default as SignedIn } from './client/components/control/SignedIn/SignedIn';
|
|
25
28
|
export { default as SignedOut } from './client/components/control/SignedOut/SignedOut';
|
|
26
29
|
export { default as SignInButton } from './client/components/actions/SignInButton/SignInButton';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACtE,cAAc,2BAA2B,CAAC;AAE1C,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,wCAAwC,CAAC;AAC9E,cAAc,wCAAwC,CAAC;AAEvD,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAC,OAAO,IAAI,mBAAmB,EAAC,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,+CAA+C,CAAC;AAGlF,OAAO,EAAC,OAAO,IAAI,SAAS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,OAAO,IAAI,oBAAoB,EAAC,MAAM,4EAA4E,CAAC;AAG3H,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,+CAA+C,CAAC;AAGlF,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,iDAAiD,CAAC;AAGrF,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,uDAAuD,CAAC;AAG9F,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,uDAAuD,CAAC;AAG9F,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,gDAAgD,CAAC;AAGjF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,yDAAyD,CAAC;AAGjG,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,4CAA4C,CAAC;AAG3E,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,gDAAgD,CAAC;AAGjF,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,4DAA4D,CAAC;AAGnG,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,0DAA0D,CAAC;AAGhG,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,iCAAiC,CAAC"}
|
|
@@ -1,3 +1,21 @@
|
|
|
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 server';
|
|
1
19
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
20
|
import { AsgardeoRuntimeError } from '@asgardeo/node';
|
|
3
21
|
import AsgardeoClientProvider from '../client/contexts/Asgardeo/AsgardeoProvider';
|
|
@@ -10,6 +28,8 @@ import getSessionId from './actions/getSessionId';
|
|
|
10
28
|
import getUserProfileAction from './actions/getUserProfileAction';
|
|
11
29
|
import signUpAction from './actions/signUpAction';
|
|
12
30
|
import handleOAuthCallbackAction from './actions/handleOAuthCallbackAction';
|
|
31
|
+
import getCurrentOrganizationAction from './actions/getCurrentOrganizationAction';
|
|
32
|
+
import updateUserProfileAction from './actions/updateUserProfileAction';
|
|
13
33
|
/**
|
|
14
34
|
* Server-side provider component for Asgardeo authentication.
|
|
15
35
|
* Wraps the client-side provider and handles server-side authentication logic.
|
|
@@ -47,13 +67,20 @@ const AsgardeoServerProvider = async ({ children, afterSignInUrl, afterSignOutUr
|
|
|
47
67
|
profile: {},
|
|
48
68
|
flattenedProfile: {},
|
|
49
69
|
};
|
|
70
|
+
let currentOrganization = {
|
|
71
|
+
id: '',
|
|
72
|
+
name: '',
|
|
73
|
+
orgHandle: '',
|
|
74
|
+
};
|
|
50
75
|
if (_isSignedIn) {
|
|
51
76
|
const userResponse = await getUserAction(sessionId);
|
|
52
77
|
const userProfileResponse = await getUserProfileAction(sessionId);
|
|
78
|
+
const currentOrganizationResponse = await getCurrentOrganizationAction(sessionId);
|
|
53
79
|
user = userResponse.data?.user || {};
|
|
54
80
|
userProfile = userProfileResponse.data?.userProfile;
|
|
81
|
+
currentOrganization = currentOrganizationResponse?.data?.organization;
|
|
55
82
|
}
|
|
56
|
-
return (_jsx(AsgardeoClientProvider, { baseUrl: config
|
|
83
|
+
return (_jsx(AsgardeoClientProvider, { organizationHandle: config?.organizationHandle, applicationId: config?.applicationId, baseUrl: config?.baseUrl, signIn: signInAction, signOut: signOutAction, signUp: signUpAction, handleOAuthCallback: handleOAuthCallbackAction, signInUrl: config?.signInUrl, signUpUrl: config?.signUpUrl, preferences: config?.preferences, clientId: config?.clientId, user: user, currentOrganization: currentOrganization, userProfile: userProfile, updateProfile: updateUserProfileAction, isSignedIn: _isSignedIn, children: children }));
|
|
57
84
|
};
|
|
58
85
|
export default AsgardeoServerProvider;
|
|
59
86
|
//# sourceMappingURL=AsgardeoProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../src/server/AsgardeoProvider.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../src/server/AsgardeoProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAGb,OAAO,EAAC,oBAAoB,EAAkC,MAAM,gBAAgB,CAAC;AACrF,OAAO,sBAAsB,MAAM,8CAA8C,CAAC;AAClF,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,aAAa,MAAM,yBAAyB,CAAC;AAEpD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,oBAAoB,MAAM,gCAAgC,CAAC;AAClE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,yBAAyB,MAAM,qCAAqC,CAAC;AAE5E,OAAO,4BAA4B,MAAM,wCAAwC,CAAC;AAClF,OAAO,uBAAuB,MAAM,mCAAmC,CAAC;AASxE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,sBAAsB,GAAuD,KAAK,EAAE,EACxF,QAAQ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BAAmB,CAAC,IAAI,EAAE,WAAW,CAAC;QACpD,mBAAmB,GAAG,2BAA2B,EAAE,IAAI,EAAE,YAA4B,CAAC;IACxF,CAAC;IAED,OAAO,CACL,KAAC,sBAAsB,IACrB,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAC9C,aAAa,EAAE,MAAM,EAAE,aAAa,EACpC,OAAO,EAAE,MAAM,EAAE,OAAO,EACxB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,EACpB,mBAAmB,EAAE,yBAAyB,EAC9C,SAAS,EAAE,MAAM,EAAE,SAAS,EAC5B,SAAS,EAAE,MAAM,EAAE,SAAS,EAC5B,WAAW,EAAE,MAAM,EAAE,WAAW,EAChC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAC1B,IAAI,EAAE,IAAI,EACV,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,uBAAuB,EACtC,UAAU,EAAE,WAAW,YAEtB,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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, Organization } from '@asgardeo/node';
|
|
19
|
+
/**
|
|
20
|
+
* Server action to create an organization.
|
|
21
|
+
*/
|
|
22
|
+
declare const createOrganizationAction: (payload: CreateOrganizationPayload, sessionId: string) => Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
data: {
|
|
25
|
+
organization: Organization;
|
|
26
|
+
user?: undefined;
|
|
27
|
+
};
|
|
28
|
+
error: null;
|
|
29
|
+
} | {
|
|
30
|
+
success: boolean;
|
|
31
|
+
data: {
|
|
32
|
+
user: {};
|
|
33
|
+
organization?: undefined;
|
|
34
|
+
};
|
|
35
|
+
error: string;
|
|
36
|
+
}>;
|
|
37
|
+
export default createOrganizationAction;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 server';
|
|
19
|
+
import AsgardeoNextClient from '../../AsgardeoNextClient';
|
|
20
|
+
/**
|
|
21
|
+
* Server action to create an organization.
|
|
22
|
+
*/
|
|
23
|
+
const createOrganizationAction = async (payload, sessionId) => {
|
|
24
|
+
try {
|
|
25
|
+
const client = AsgardeoNextClient.getInstance();
|
|
26
|
+
const organization = await client.createOrganization(payload, sessionId);
|
|
27
|
+
return { success: true, data: { organization }, error: null };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
data: {
|
|
33
|
+
user: {},
|
|
34
|
+
},
|
|
35
|
+
error: 'Failed to create organization',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default createOrganizationAction;
|
|
40
|
+
//# sourceMappingURL=createOrganizationAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOrganizationAction.js","sourceRoot":"","sources":["../../../src/server/actions/createOrganizationAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAGb,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,wBAAwB,GAAG,KAAK,EAAE,OAAkC,EAAE,SAAiB,EAAE,EAAE;IAC/F,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,YAAY,GAAiB,MAAM,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACvF,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,YAAY,EAAC,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,EAAE;aACT;YACD,KAAK,EAAE,+BAA+B;SACvC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 '@asgardeo/node';
|
|
19
|
+
/**
|
|
20
|
+
* Server action to create an organization.
|
|
21
|
+
*/
|
|
22
|
+
declare const getCurrentOrganizationAction: (sessionId: string) => Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
data: {
|
|
25
|
+
organization: Organization;
|
|
26
|
+
user?: undefined;
|
|
27
|
+
};
|
|
28
|
+
error: null;
|
|
29
|
+
} | {
|
|
30
|
+
success: boolean;
|
|
31
|
+
data: {
|
|
32
|
+
user: {};
|
|
33
|
+
organization?: undefined;
|
|
34
|
+
};
|
|
35
|
+
error: string;
|
|
36
|
+
}>;
|
|
37
|
+
export default getCurrentOrganizationAction;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 server';
|
|
19
|
+
import AsgardeoNextClient from '../../AsgardeoNextClient';
|
|
20
|
+
/**
|
|
21
|
+
* Server action to create an organization.
|
|
22
|
+
*/
|
|
23
|
+
const getCurrentOrganizationAction = async (sessionId) => {
|
|
24
|
+
try {
|
|
25
|
+
const client = AsgardeoNextClient.getInstance();
|
|
26
|
+
const organization = await client.getCurrentOrganization(sessionId);
|
|
27
|
+
return { success: true, data: { organization }, error: null };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
data: {
|
|
33
|
+
user: {},
|
|
34
|
+
},
|
|
35
|
+
error: 'Failed to get the current organization',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default getCurrentOrganizationAction;
|
|
40
|
+
//# sourceMappingURL=getCurrentOrganizationAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrentOrganizationAction.js","sourceRoot":"","sources":["../../../src/server/actions/getCurrentOrganizationAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAGb,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,4BAA4B,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE;IAC/D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,YAAY,GAAiB,MAAM,MAAM,CAAC,sBAAsB,CAAC,SAAS,CAAiB,CAAC;QAClG,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,YAAY,EAAC,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,EAAE;aACT;YACD,KAAK,EAAE,wCAAwC;SAChD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { OrganizationDetails } from '@asgardeo/node';
|
|
19
|
+
/**
|
|
20
|
+
* Server action to create an organization.
|
|
21
|
+
*/
|
|
22
|
+
declare const getOrganizationAction: (organizationId: string, sessionId: string) => Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
data: {
|
|
25
|
+
organization: OrganizationDetails;
|
|
26
|
+
user?: undefined;
|
|
27
|
+
};
|
|
28
|
+
error: null;
|
|
29
|
+
} | {
|
|
30
|
+
success: boolean;
|
|
31
|
+
data: {
|
|
32
|
+
user: {};
|
|
33
|
+
organization?: undefined;
|
|
34
|
+
};
|
|
35
|
+
error: string;
|
|
36
|
+
}>;
|
|
37
|
+
export default getOrganizationAction;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 server';
|
|
19
|
+
import AsgardeoNextClient from '../../AsgardeoNextClient';
|
|
20
|
+
/**
|
|
21
|
+
* Server action to create an organization.
|
|
22
|
+
*/
|
|
23
|
+
const getOrganizationAction = async (organizationId, sessionId) => {
|
|
24
|
+
try {
|
|
25
|
+
const client = AsgardeoNextClient.getInstance();
|
|
26
|
+
const organization = await client.getOrganization(organizationId, sessionId);
|
|
27
|
+
return { success: true, data: { organization }, error: null };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
data: {
|
|
33
|
+
user: {},
|
|
34
|
+
},
|
|
35
|
+
error: 'Failed to get organization',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default getOrganizationAction;
|
|
40
|
+
//# sourceMappingURL=getOrganizationAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrganizationAction.js","sourceRoot":"","sources":["../../../src/server/actions/getOrganizationAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAGb,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,qBAAqB,GAAG,KAAK,EAAE,cAAsB,EAAE,SAAiB,EAAE,EAAE;IAChF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,YAAY,GAAwB,MAAM,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;QAClG,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,YAAY,EAAC,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,EAAE;aACT;YACD,KAAK,EAAE,4BAA4B;SACpC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 '@asgardeo/node';
|
|
19
|
+
/**
|
|
20
|
+
* Server action to get organizations.
|
|
21
|
+
*/
|
|
22
|
+
declare const getOrganizationsAction: (sessionId: string) => Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
data: {
|
|
25
|
+
organizations: Organization[];
|
|
26
|
+
user?: undefined;
|
|
27
|
+
};
|
|
28
|
+
error: null;
|
|
29
|
+
} | {
|
|
30
|
+
success: boolean;
|
|
31
|
+
data: {
|
|
32
|
+
user: {};
|
|
33
|
+
organizations?: undefined;
|
|
34
|
+
};
|
|
35
|
+
error: string;
|
|
36
|
+
}>;
|
|
37
|
+
export default getOrganizationsAction;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 server';
|
|
19
|
+
import AsgardeoNextClient from '../../AsgardeoNextClient';
|
|
20
|
+
/**
|
|
21
|
+
* Server action to get organizations.
|
|
22
|
+
*/
|
|
23
|
+
const getOrganizationsAction = async (sessionId) => {
|
|
24
|
+
try {
|
|
25
|
+
const client = AsgardeoNextClient.getInstance();
|
|
26
|
+
const organizations = await client.getOrganizations(sessionId);
|
|
27
|
+
return { success: true, data: { organizations }, error: null };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
data: {
|
|
33
|
+
user: {},
|
|
34
|
+
},
|
|
35
|
+
error: 'Failed to get organizations',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default getOrganizationsAction;
|
|
40
|
+
//# sourceMappingURL=getOrganizationsAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrganizationsAction.js","sourceRoot":"","sources":["../../../src/server/actions/getOrganizationsAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAGb,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,sBAAsB,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,aAAa,GAAmB,MAAM,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC/E,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,aAAa,EAAC,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,EAAE;aACT;YACD,KAAK,EAAE,6BAA6B;SACrC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|