@asgardeo/react 0.4.0 → 0.5.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.
Files changed (87) hide show
  1. package/dist/AsgardeoReactClient.d.ts +13 -5
  2. package/dist/__temp__/api.d.ts +11 -5
  3. package/dist/__temp__/models.d.ts +3 -3
  4. package/dist/api/createOrganization.d.ts +81 -0
  5. package/dist/api/getAllOrganizations.d.ts +73 -0
  6. package/dist/api/getMeOrganizations.d.ts +77 -0
  7. package/dist/api/getOrganization.d.ts +69 -0
  8. package/dist/api/getSchemas.d.ts +67 -0
  9. package/dist/api/getScim2Me.d.ts +67 -0
  10. package/dist/api/updateMeProfile.d.ts +55 -0
  11. package/dist/api/updateOrganization.d.ts +76 -0
  12. package/dist/cjs/index.js +9685 -17275
  13. package/dist/cjs/index.js.map +4 -4
  14. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +5 -5
  15. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +5 -5
  16. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +5 -5
  17. package/dist/components/control/AsgardeoLoading.d.ts +47 -0
  18. package/dist/components/control/SignedIn.d.ts +2 -0
  19. package/dist/components/control/SignedOut.d.ts +2 -0
  20. package/dist/components/factories/FieldFactory.d.ts +6 -11
  21. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +53 -0
  22. package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
  23. package/dist/components/presentation/Organization/BaseOrganization.d.ts +66 -0
  24. package/dist/components/presentation/Organization/Organization.d.ts +66 -0
  25. package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +117 -0
  26. package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
  27. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +153 -0
  28. package/dist/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
  29. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +141 -0
  30. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +70 -0
  31. package/dist/components/presentation/SignIn/BaseSignIn.d.ts +31 -38
  32. package/dist/components/presentation/SignIn/SignIn.d.ts +3 -14
  33. package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +4 -4
  34. package/dist/components/presentation/SignIn/types.d.ts +6 -6
  35. package/dist/components/presentation/SignUp/BaseSignUp.d.ts +126 -0
  36. package/dist/components/presentation/SignUp/SignUp.d.ts +55 -0
  37. package/dist/components/presentation/SignUp/options/CheckboxInput.d.ts +24 -0
  38. package/dist/components/presentation/SignUp/options/DateInput.d.ts +24 -0
  39. package/dist/components/presentation/SignUp/options/DividerComponent.d.ts +24 -0
  40. package/dist/components/presentation/SignUp/options/EmailInput.d.ts +24 -0
  41. package/dist/components/presentation/SignUp/options/FormContainer.d.ts +24 -0
  42. package/dist/components/presentation/SignUp/options/GoogleButton.d.ts +25 -0
  43. package/dist/components/presentation/SignUp/options/ImageComponent.d.ts +24 -0
  44. package/dist/components/presentation/SignUp/options/NumberInput.d.ts +24 -0
  45. package/dist/components/presentation/SignUp/options/PasswordInput.d.ts +24 -0
  46. package/dist/components/presentation/SignUp/options/SignUpOptionFactory.d.ts +100 -0
  47. package/dist/components/presentation/SignUp/options/SocialButton.d.ts +24 -0
  48. package/dist/components/presentation/SignUp/options/SubmitButton.d.ts +24 -0
  49. package/dist/components/presentation/SignUp/options/TelephoneInput.d.ts +24 -0
  50. package/dist/components/presentation/SignUp/options/TextInput.d.ts +24 -0
  51. package/dist/components/presentation/SignUp/options/Typography.d.ts +24 -0
  52. package/dist/components/presentation/SignUp/options/index.d.ts +26 -0
  53. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +34 -22
  54. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +60 -4
  55. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +17 -15
  56. package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
  57. package/dist/components/primitives/Avatar/Avatar.d.ts +21 -8
  58. package/dist/components/primitives/Card/Card.d.ts +8 -9
  59. package/dist/components/primitives/Divider/Divider.d.ts +8 -8
  60. package/dist/components/primitives/Icons/Building.d.ts +40 -0
  61. package/dist/components/primitives/Icons/BuildingAlt.d.ts +40 -0
  62. package/dist/components/primitives/Icons/Check.d.ts +40 -0
  63. package/dist/components/primitives/Icons/ChevronDown.d.ts +40 -0
  64. package/dist/components/primitives/Icons/LogOut.d.ts +23 -0
  65. package/dist/components/primitives/Icons/Plus.d.ts +23 -0
  66. package/dist/components/primitives/Icons/Settings.d.ts +0 -0
  67. package/dist/components/primitives/Icons/User.d.ts +23 -0
  68. package/dist/components/primitives/Icons/X.d.ts +23 -0
  69. package/dist/components/primitives/Icons/index.d.ts +27 -0
  70. package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +123 -0
  71. package/dist/components/primitives/KeyValueInput/index.d.ts +0 -0
  72. package/dist/components/primitives/Popover/Popover.d.ts +19 -19
  73. package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +7 -2
  74. package/dist/contexts/Organization/OrganizationContext.d.ts +74 -0
  75. package/dist/contexts/Organization/OrganizationProvider.d.ts +90 -0
  76. package/dist/contexts/Organization/useOrganization.d.ts +104 -0
  77. package/dist/contexts/Theme/types.d.ts +38 -9
  78. package/dist/contexts/User/UserContext.d.ts +3 -2
  79. package/dist/contexts/User/UserProvider.d.ts +2 -1
  80. package/dist/hooks/useForm.d.ts +52 -52
  81. package/dist/index.d.ts +53 -1
  82. package/dist/index.js +9725 -17303
  83. package/dist/index.js.map +4 -4
  84. package/package.json +1 -1
  85. package/dist/api/scim2/getMeProfile.d.ts +0 -39
  86. package/dist/api/scim2/getSchemas.d.ts +0 -39
  87. package/dist/api/scim2/updateMeProfile.d.ts +0 -38
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User } from '@asgardeo/browser';
18
+ import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User, EmbeddedFlowExecuteResponse, SignUpOptions, EmbeddedFlowExecuteRequestPayload, EmbeddedSignInFlowHandleRequestPayload, Organization, EmbeddedFlowExecuteRequestConfig } from '@asgardeo/browser';
19
19
  import { AsgardeoReactConfig } from './models/config';
20
20
  /**
21
21
  * Client for mplementing Asgardeo in React applications.
@@ -26,13 +26,21 @@ import { AsgardeoReactConfig } from './models/config';
26
26
  declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> extends AsgardeoBrowserClient<T> {
27
27
  private asgardeo;
28
28
  constructor();
29
- initialize(config: T): Promise<boolean>;
29
+ initialize(config: AsgardeoReactConfig): Promise<boolean>;
30
30
  getUser(): Promise<User>;
31
31
  getUserProfile(): Promise<UserProfile>;
32
+ getOrganizations(): Promise<Organization[]>;
33
+ getCurrentOrganization(): Promise<Organization | null>;
34
+ switchOrganization(organization: Organization): Promise<void>;
32
35
  isLoading(): boolean;
36
+ isInitialized(): Promise<boolean>;
33
37
  isSignedIn(): Promise<boolean>;
34
- signIn(options?: SignInOptions): Promise<User>;
35
- signOut(options?: SignOutOptions, afterSignOut?: (redirectUrl: string) => void): Promise<string>;
36
- signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (redirectUrl: string) => void): Promise<string>;
38
+ getConfiguration(): T;
39
+ signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
40
+ signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
41
+ signOut(options?: SignOutOptions, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
42
+ signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
43
+ signUp(options?: SignUpOptions): Promise<void>;
44
+ signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
37
45
  }
38
46
  export default AsgardeoReactClient;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Copyright (c) 2025, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
3
  *
4
- * WSO2 Inc. licenses this file to you under the Apache License,
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
5
  * Version 2.0 (the "License"); you may not use this file except
6
6
  * in compliance with the License.
7
7
  * You may obtain a copy of the License at
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { AsgardeoSPAClient, AuthClientConfig, User, LegacyConfig as Config, IdTokenPayload, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, SPACustomGrantConfig } from '@asgardeo/browser';
18
+ import { AsgardeoSPAClient, AuthClientConfig, User, LegacyConfig as Config, IdToken, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, SPACustomGrantConfig } from '@asgardeo/browser';
19
19
  import { AuthStateInterface } from './models';
20
20
  declare class AuthAPI {
21
21
  static DEFAULT_STATE: AuthStateInterface;
@@ -44,6 +44,12 @@ declare class AuthAPI {
44
44
  * @returns {Promise<AuthClientConfig<Config>>} - A promise that resolves with the configuration data.
45
45
  */
46
46
  getConfigData(): Promise<AuthClientConfig<Config>>;
47
+ /**
48
+ * Method to get the configuration data.
49
+ *
50
+ * @returns {Promise<AuthClientConfig<Config>>} - A promise that resolves with the configuration data.
51
+ */
52
+ isInitialized(): Promise<boolean>;
47
53
  /**
48
54
  * Method to handle user Sign In requests.
49
55
  *
@@ -129,14 +135,14 @@ declare class AuthAPI {
129
135
  * @return {Promise<DecodedIDTokenPayloadInterface>} - A Promise that resolves with
130
136
  * the decoded payload of the id token.
131
137
  */
132
- getDecodedIdToken(): Promise<IdTokenPayload>;
138
+ getDecodedIdToken(): Promise<IdToken>;
133
139
  /**
134
140
  * This method decodes the payload of the idp id token and returns it.
135
141
  *
136
142
  * @return {Promise<DecodedIDTokenPayloadInterface>} - A Promise that resolves with
137
143
  * the decoded payload of the idp id token.
138
144
  */
139
- getDecodedIDPIDToken(): Promise<IdTokenPayload>;
145
+ getDecodedIDPIDToken(): Promise<IdToken>;
140
146
  /**
141
147
  * This method returns the ID token.
142
148
  *
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { AsgardeoAuthException, AuthClientConfig, AuthSPAClientConfig, Config, TokenExchangeRequestConfig, IdTokenPayload, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, User } from '@asgardeo/browser';
18
+ import { AsgardeoAuthException, AuthClientConfig, AuthSPAClientConfig, Config, TokenExchangeRequestConfig, IdToken, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, User } from '@asgardeo/browser';
19
19
  export interface ReactConfig {
20
20
  /**
21
21
  * The SDK's `AuthProvider` by default is listening to the URL changes to see
@@ -69,8 +69,8 @@ export interface AuthContextInterface {
69
69
  revokeAccessToken(): Promise<boolean>;
70
70
  getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>;
71
71
  getHttpClient(): Promise<HttpClientInstance>;
72
- getDecodedIDPIDToken(): Promise<IdTokenPayload>;
73
- getDecodedIdToken(): Promise<IdTokenPayload>;
72
+ getDecodedIDPIDToken(): Promise<IdToken>;
73
+ getDecodedIdToken(): Promise<IdToken>;
74
74
  getIdToken(): Promise<string>;
75
75
  getAccessToken(): Promise<string>;
76
76
  refreshAccessToken(): Promise<User>;
@@ -0,0 +1,81 @@
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, CreateOrganizationConfig as BaseCreateOrganizationConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the createOrganization request (React-specific)
21
+ */
22
+ export interface CreateOrganizationConfig extends Omit<BaseCreateOrganizationConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Creates a new organization.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Configuration object containing baseUrl, payload and optional request config.
34
+ * @returns A promise that resolves with the created organization information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * try {
39
+ * const organization = await createOrganization({
40
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
41
+ * payload: {
42
+ * description: "Share your screens",
43
+ * name: "Team Viewer",
44
+ * orgHandle: "team-viewer",
45
+ * parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
46
+ * type: "TENANT"
47
+ * }
48
+ * });
49
+ * console.log(organization);
50
+ * } catch (error) {
51
+ * if (error instanceof AsgardeoAPIError) {
52
+ * console.error('Failed to create organization:', error.message);
53
+ * }
54
+ * }
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Using custom fetcher
60
+ * try {
61
+ * const organization = await createOrganization({
62
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
63
+ * payload: {
64
+ * description: "Share your screens",
65
+ * name: "Team Viewer",
66
+ * orgHandle: "team-viewer",
67
+ * parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
68
+ * type: "TENANT"
69
+ * },
70
+ * fetcher: customFetchFunction
71
+ * });
72
+ * console.log(organization);
73
+ * } catch (error) {
74
+ * if (error instanceof AsgardeoAPIError) {
75
+ * console.error('Failed to create organization:', error.message);
76
+ * }
77
+ * }
78
+ * ```
79
+ */
80
+ declare const createOrganization: ({ fetcher, ...requestConfig }: CreateOrganizationConfig) => Promise<Organization>;
81
+ export default createOrganization;
@@ -0,0 +1,73 @@
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 { GetAllOrganizationsConfig as BaseGetAllOrganizationsConfig, PaginatedOrganizationsResponse } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the getAllOrganizations request (React-specific)
21
+ */
22
+ export interface GetAllOrganizationsConfig extends Omit<BaseGetAllOrganizationsConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Retrieves all organizations with pagination support.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Configuration object containing baseUrl, optional query parameters, and request config.
34
+ * @returns A promise that resolves with the paginated organizations information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * try {
39
+ * const response = await getAllOrganizations({
40
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
41
+ * filter: "",
42
+ * limit: 10,
43
+ * recursive: false
44
+ * });
45
+ * console.log(response.organizations);
46
+ * } catch (error) {
47
+ * if (error instanceof AsgardeoAPIError) {
48
+ * console.error('Failed to get organizations:', error.message);
49
+ * }
50
+ * }
51
+ * ```
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * // Using custom fetcher
56
+ * try {
57
+ * const response = await getAllOrganizations({
58
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
59
+ * filter: "",
60
+ * limit: 10,
61
+ * recursive: false,
62
+ * fetcher: customFetchFunction
63
+ * });
64
+ * console.log(response.organizations);
65
+ * } catch (error) {
66
+ * if (error instanceof AsgardeoAPIError) {
67
+ * console.error('Failed to get organizations:', error.message);
68
+ * }
69
+ * }
70
+ * ```
71
+ */
72
+ declare const getAllOrganizations: ({ fetcher, ...requestConfig }: GetAllOrganizationsConfig) => Promise<PaginatedOrganizationsResponse>;
73
+ export default getAllOrganizations;
@@ -0,0 +1,77 @@
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, GetMeOrganizationsConfig as BaseGetMeOrganizationsConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the getMeOrganizations request (React-specific)
21
+ */
22
+ export interface GetMeOrganizationsConfig extends Omit<BaseGetMeOrganizationsConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Retrieves the organizations associated with the current user.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Configuration object containing baseUrl, optional query parameters, and request config.
34
+ * @returns A promise that resolves with the organizations information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * try {
39
+ * const organizations = await getMeOrganizations({
40
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
41
+ * after: "",
42
+ * before: "",
43
+ * filter: "",
44
+ * limit: 10,
45
+ * recursive: false
46
+ * });
47
+ * console.log(organizations);
48
+ * } catch (error) {
49
+ * if (error instanceof AsgardeoAPIError) {
50
+ * console.error('Failed to get organizations:', error.message);
51
+ * }
52
+ * }
53
+ * ```
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // Using custom fetcher
58
+ * try {
59
+ * const organizations = await getMeOrganizations({
60
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
61
+ * after: "",
62
+ * before: "",
63
+ * filter: "",
64
+ * limit: 10,
65
+ * recursive: false,
66
+ * fetcher: customFetchFunction
67
+ * });
68
+ * console.log(organizations);
69
+ * } catch (error) {
70
+ * if (error instanceof AsgardeoAPIError) {
71
+ * console.error('Failed to get organizations:', error.message);
72
+ * }
73
+ * }
74
+ * ```
75
+ */
76
+ declare const getMeOrganizations: ({ fetcher, ...requestConfig }: GetMeOrganizationsConfig) => Promise<Organization[]>;
77
+ export default getMeOrganizations;
@@ -0,0 +1,69 @@
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 { GetOrganizationConfig as BaseGetOrganizationConfig, OrganizationDetails } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the getOrganization request (React-specific)
21
+ */
22
+ export interface GetOrganizationConfig extends Omit<BaseGetOrganizationConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Retrieves detailed information for a specific organization.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Configuration object containing baseUrl, organizationId, and request config.
34
+ * @returns A promise that resolves with the organization details.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * try {
39
+ * const organization = await getOrganization({
40
+ * baseUrl: "https://api.asgardeo.io/t/dxlab",
41
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
42
+ * });
43
+ * console.log(organization);
44
+ * } catch (error) {
45
+ * if (error instanceof AsgardeoAPIError) {
46
+ * console.error('Failed to get organization:', error.message);
47
+ * }
48
+ * }
49
+ * ```
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // Using custom fetcher
54
+ * try {
55
+ * const organization = await getOrganization({
56
+ * baseUrl: "https://api.asgardeo.io/t/dxlab",
57
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
58
+ * fetcher: customFetchFunction
59
+ * });
60
+ * console.log(organization);
61
+ * } catch (error) {
62
+ * if (error instanceof AsgardeoAPIError) {
63
+ * console.error('Failed to get organization:', error.message);
64
+ * }
65
+ * }
66
+ * ```
67
+ */
68
+ declare const getOrganization: ({ fetcher, ...requestConfig }: GetOrganizationConfig) => Promise<OrganizationDetails>;
69
+ export default getOrganization;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { Schema, GetSchemasConfig as BaseGetSchemasConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the getSchemas request (React-specific)
21
+ */
22
+ export interface GetSchemasConfig extends Omit<BaseGetSchemasConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Retrieves the SCIM2 schemas from the specified endpoint.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Request configuration object.
34
+ * @returns A promise that resolves with the SCIM2 schemas information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * try {
39
+ * const schemas = await getSchemas({
40
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas",
41
+ * });
42
+ * console.log(schemas);
43
+ * } catch (error) {
44
+ * if (error instanceof AsgardeoAPIError) {
45
+ * console.error('Failed to get schemas:', error.message);
46
+ * }
47
+ * }
48
+ * ```
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Using custom fetcher
53
+ * try {
54
+ * const schemas = await getSchemas({
55
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas",
56
+ * fetcher: customFetchFunction
57
+ * });
58
+ * console.log(schemas);
59
+ * } catch (error) {
60
+ * if (error instanceof AsgardeoAPIError) {
61
+ * console.error('Failed to get schemas:', error.message);
62
+ * }
63
+ * }
64
+ * ```
65
+ */
66
+ declare const getSchemas: ({ fetcher, ...requestConfig }: GetSchemasConfig) => Promise<Schema[]>;
67
+ export default getSchemas;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { User, GetScim2MeConfig as BaseGetScim2MeConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the getScim2Me request (React-specific)
21
+ */
22
+ export interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Retrieves the user profile information from the specified SCIM2 /Me endpoint.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param requestConfig - Request configuration object.
34
+ * @returns A promise that resolves with the user profile information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * try {
39
+ * const userProfile = await getScim2Me({
40
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me",
41
+ * });
42
+ * console.log(userProfile);
43
+ * } catch (error) {
44
+ * if (error instanceof AsgardeoAPIError) {
45
+ * console.error('Failed to get user profile:', error.message);
46
+ * }
47
+ * }
48
+ * ```
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Using custom fetcher
53
+ * try {
54
+ * const userProfile = await getScim2Me({
55
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me",
56
+ * fetcher: customFetchFunction
57
+ * });
58
+ * console.log(userProfile);
59
+ * } catch (error) {
60
+ * if (error instanceof AsgardeoAPIError) {
61
+ * console.error('Failed to get user profile:', error.message);
62
+ * }
63
+ * }
64
+ * ```
65
+ */
66
+ declare const getScim2Me: ({ fetcher, ...requestConfig }: GetScim2MeConfig) => Promise<User>;
67
+ export default getScim2Me;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { User, UpdateMeProfileConfig as BaseUpdateMeProfileConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the updateMeProfile request (React-specific)
21
+ */
22
+ export interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Updates the user profile information at the specified SCIM2 Me endpoint.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Configuration object with URL, payload and optional request config.
34
+ * @returns A promise that resolves with the updated user profile information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using default Asgardeo SPA client httpClient
38
+ * await updateMeProfile({
39
+ * url: "https://api.asgardeo.io/t/<ORG>/scim2/Me",
40
+ * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
41
+ * });
42
+ * ```
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * // Using custom fetcher
47
+ * await updateMeProfile({
48
+ * url: "https://api.asgardeo.io/t/<ORG>/scim2/Me",
49
+ * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
50
+ * fetcher: customFetchFunction
51
+ * });
52
+ * ```
53
+ */
54
+ declare const updateMeProfile: ({ fetcher, ...requestConfig }: UpdateMeProfileConfig) => Promise<User>;
55
+ export default updateMeProfile;
@@ -0,0 +1,76 @@
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 { UpdateOrganizationConfig as BaseUpdateOrganizationConfig, OrganizationDetails, createPatchOperations } from '@asgardeo/browser';
19
+ /**
20
+ * Configuration for the updateOrganization request (React-specific)
21
+ */
22
+ export interface UpdateOrganizationConfig extends Omit<BaseUpdateOrganizationConfig, 'fetcher'> {
23
+ /**
24
+ * Optional custom fetcher function. If not provided, the Asgardeo SPA client's httpClient will be used
25
+ * which is a wrapper around axios http.request
26
+ */
27
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
28
+ }
29
+ /**
30
+ * Updates the organization information using the Organizations Management API.
31
+ * This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
32
+ *
33
+ * @param config - Configuration object with baseUrl, organizationId, operations and optional request config.
34
+ * @returns A promise that resolves with the updated organization information.
35
+ * @example
36
+ * ```typescript
37
+ * // Using the helper function to create operations automatically
38
+ * const operations = createPatchOperations({
39
+ * name: "Updated Organization Name", // Will use REPLACE
40
+ * description: "", // Will use REMOVE (empty string)
41
+ * customField: "Some value" // Will use REPLACE
42
+ * });
43
+ *
44
+ * await updateOrganization({
45
+ * baseUrl: "https://api.asgardeo.io/t/<ORG>",
46
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
47
+ * operations
48
+ * });
49
+ *
50
+ * // Or manually specify operations
51
+ * await updateOrganization({
52
+ * baseUrl: "https://api.asgardeo.io/t/<ORG>",
53
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
54
+ * operations: [
55
+ * { operation: "REPLACE", path: "/name", value: "Updated Organization Name" },
56
+ * { operation: "REMOVE", path: "/description" }
57
+ * ]
58
+ * });
59
+ * ```
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * // Using custom fetcher
64
+ * await updateOrganization({
65
+ * baseUrl: "https://api.asgardeo.io/t/<ORG>",
66
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
67
+ * operations: [
68
+ * { operation: "REPLACE", path: "/name", value: "Updated Organization Name" }
69
+ * ],
70
+ * fetcher: customFetchFunction
71
+ * });
72
+ * ```
73
+ */
74
+ declare const updateOrganization: ({ fetcher, ...requestConfig }: UpdateOrganizationConfig) => Promise<OrganizationDetails>;
75
+ export { createPatchOperations };
76
+ export default updateOrganization;