@asgardeo/react 0.5.0 → 0.5.2
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/AsgardeoReactClient.d.ts +3 -2
- package/dist/api/{scim2/createOrganization.d.ts → createOrganization.d.ts} +32 -25
- package/dist/api/{scim2/getAllOrganizations.d.ts → getAllOrganizations.d.ts} +30 -13
- package/dist/api/{scim2/getMeOrganizations.d.ts → getMeOrganizations.d.ts} +35 -10
- package/dist/api/{scim2/getOrganization.d.ts → getOrganization.d.ts} +28 -20
- package/dist/api/getSchemas.d.ts +67 -0
- package/dist/api/getScim2Me.d.ts +67 -0
- package/dist/api/updateMeProfile.d.ts +55 -0
- package/dist/api/{scim2/updateOrganization.d.ts → updateOrganization.d.ts} +27 -25
- package/dist/cjs/index.js +278 -498
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/control/AsgardeoLoading.d.ts +2 -0
- package/dist/components/control/SignedIn.d.ts +2 -0
- package/dist/components/control/SignedOut.d.ts +2 -0
- package/dist/components/factories/FieldFactory.d.ts +4 -9
- package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +1 -1
- package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +1 -1
- package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +1 -1
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +4 -0
- package/dist/components/presentation/SignIn/SignIn.d.ts +3 -15
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +6 -2
- package/dist/index.d.ts +10 -4
- package/dist/index.js +316 -511
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/api/scim2/getMeProfile.d.ts +0 -39
- package/dist/api/scim2/getSchemas.d.ts +0 -39
- package/dist/api/scim2/updateMeProfile.d.ts +0 -38
|
@@ -35,10 +35,11 @@ declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactC
|
|
|
35
35
|
isLoading(): boolean;
|
|
36
36
|
isInitialized(): Promise<boolean>;
|
|
37
37
|
isSignedIn(): Promise<boolean>;
|
|
38
|
+
getConfiguration(): T;
|
|
38
39
|
signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
39
40
|
signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
40
|
-
signOut(options?: SignOutOptions, afterSignOut?: (
|
|
41
|
-
signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (
|
|
41
|
+
signOut(options?: SignOutOptions, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
|
|
42
|
+
signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
|
|
42
43
|
signUp(options?: SignUpOptions): Promise<void>;
|
|
43
44
|
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
44
45
|
}
|
|
@@ -15,39 +15,26 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { Organization } from '@asgardeo/browser';
|
|
18
|
+
import { Organization, CreateOrganizationConfig as BaseCreateOrganizationConfig } from '@asgardeo/browser';
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Configuration for the createOrganization request (React-specific)
|
|
21
21
|
*/
|
|
22
|
-
export interface
|
|
22
|
+
export interface CreateOrganizationConfig extends Omit<BaseCreateOrganizationConfig, 'fetcher'> {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
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
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Organization handle/slug.
|
|
29
|
-
*/
|
|
30
|
-
orgHandle?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Organization name.
|
|
33
|
-
*/
|
|
34
|
-
name: string;
|
|
35
|
-
/**
|
|
36
|
-
* Parent organization ID.
|
|
37
|
-
*/
|
|
38
|
-
parentId: string;
|
|
39
|
-
/**
|
|
40
|
-
* Organization type.
|
|
41
|
-
*/
|
|
42
|
-
type: 'TENANT';
|
|
27
|
+
fetcher?: (url: string, config: RequestInit) => Promise<Response>;
|
|
43
28
|
}
|
|
44
29
|
/**
|
|
45
30
|
* Creates a new organization.
|
|
31
|
+
* This function uses the Asgardeo SPA client's httpClient by default, but allows for custom fetchers.
|
|
46
32
|
*
|
|
47
33
|
* @param config - Configuration object containing baseUrl, payload and optional request config.
|
|
48
34
|
* @returns A promise that resolves with the created organization information.
|
|
49
35
|
* @example
|
|
50
36
|
* ```typescript
|
|
37
|
+
* // Using default Asgardeo SPA client httpClient
|
|
51
38
|
* try {
|
|
52
39
|
* const organization = await createOrganization({
|
|
53
40
|
* baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
|
|
@@ -66,9 +53,29 @@ export interface CreateOrganizationPayload {
|
|
|
66
53
|
* }
|
|
67
54
|
* }
|
|
68
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
|
+
* ```
|
|
69
79
|
*/
|
|
70
|
-
declare const createOrganization: ({
|
|
71
|
-
baseUrl: string;
|
|
72
|
-
payload: CreateOrganizationPayload;
|
|
73
|
-
}) => Promise<Organization>;
|
|
80
|
+
declare const createOrganization: ({ fetcher, ...requestConfig }: CreateOrganizationConfig) => Promise<Organization>;
|
|
74
81
|
export default createOrganization;
|
|
@@ -15,23 +15,26 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import { GetAllOrganizationsConfig as BaseGetAllOrganizationsConfig, PaginatedOrganizationsResponse } from '@asgardeo/browser';
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Configuration for the getAllOrganizations request (React-specific)
|
|
21
21
|
*/
|
|
22
|
-
export interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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>;
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
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.
|
|
30
32
|
*
|
|
31
33
|
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
32
34
|
* @returns A promise that resolves with the paginated organizations information.
|
|
33
35
|
* @example
|
|
34
36
|
* ```typescript
|
|
37
|
+
* // Using default Asgardeo SPA client httpClient
|
|
35
38
|
* try {
|
|
36
39
|
* const response = await getAllOrganizations({
|
|
37
40
|
* baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
|
|
@@ -46,11 +49,25 @@ export interface PaginatedOrganizationsResponse {
|
|
|
46
49
|
* }
|
|
47
50
|
* }
|
|
48
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
|
+
* ```
|
|
49
71
|
*/
|
|
50
|
-
declare const getAllOrganizations: ({
|
|
51
|
-
baseUrl: string;
|
|
52
|
-
filter?: string;
|
|
53
|
-
limit?: number;
|
|
54
|
-
recursive?: boolean;
|
|
55
|
-
}) => Promise<PaginatedOrganizationsResponse>;
|
|
72
|
+
declare const getAllOrganizations: ({ fetcher, ...requestConfig }: GetAllOrganizationsConfig) => Promise<PaginatedOrganizationsResponse>;
|
|
56
73
|
export default getAllOrganizations;
|
|
@@ -15,14 +15,26 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { Organization } from '@asgardeo/browser';
|
|
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
|
+
}
|
|
19
29
|
/**
|
|
20
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.
|
|
21
32
|
*
|
|
22
33
|
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
23
34
|
* @returns A promise that resolves with the organizations information.
|
|
24
35
|
* @example
|
|
25
36
|
* ```typescript
|
|
37
|
+
* // Using default Asgardeo SPA client httpClient
|
|
26
38
|
* try {
|
|
27
39
|
* const organizations = await getMeOrganizations({
|
|
28
40
|
* baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
|
|
@@ -39,14 +51,27 @@ import { Organization } from '@asgardeo/browser';
|
|
|
39
51
|
* }
|
|
40
52
|
* }
|
|
41
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
|
+
* ```
|
|
42
75
|
*/
|
|
43
|
-
declare const getMeOrganizations: ({
|
|
44
|
-
baseUrl: string;
|
|
45
|
-
after?: string;
|
|
46
|
-
authorizedAppName?: string;
|
|
47
|
-
before?: string;
|
|
48
|
-
filter?: string;
|
|
49
|
-
limit?: number;
|
|
50
|
-
recursive?: boolean;
|
|
51
|
-
}) => Promise<Organization[]>;
|
|
76
|
+
declare const getMeOrganizations: ({ fetcher, ...requestConfig }: GetMeOrganizationsConfig) => Promise<Organization[]>;
|
|
52
77
|
export default getMeOrganizations;
|
|
@@ -15,32 +15,26 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { GetOrganizationConfig as BaseGetOrganizationConfig, OrganizationDetails } from '@asgardeo/browser';
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Configuration for the getOrganization request (React-specific)
|
|
20
21
|
*/
|
|
21
|
-
export interface
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
name: string;
|
|
28
|
-
orgHandle: string;
|
|
29
|
-
parent?: {
|
|
30
|
-
id: string;
|
|
31
|
-
ref: string;
|
|
32
|
-
};
|
|
33
|
-
permissions?: string[];
|
|
34
|
-
status?: string;
|
|
35
|
-
type?: string;
|
|
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>;
|
|
36
28
|
}
|
|
37
29
|
/**
|
|
38
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.
|
|
39
32
|
*
|
|
40
33
|
* @param config - Configuration object containing baseUrl, organizationId, and request config.
|
|
41
34
|
* @returns A promise that resolves with the organization details.
|
|
42
35
|
* @example
|
|
43
36
|
* ```typescript
|
|
37
|
+
* // Using default Asgardeo SPA client httpClient
|
|
44
38
|
* try {
|
|
45
39
|
* const organization = await getOrganization({
|
|
46
40
|
* baseUrl: "https://api.asgardeo.io/t/dxlab",
|
|
@@ -53,9 +47,23 @@ export interface OrganizationDetails {
|
|
|
53
47
|
* }
|
|
54
48
|
* }
|
|
55
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
|
+
* ```
|
|
56
67
|
*/
|
|
57
|
-
declare const getOrganization: ({
|
|
58
|
-
baseUrl: string;
|
|
59
|
-
organizationId: string;
|
|
60
|
-
}) => Promise<OrganizationDetails>;
|
|
68
|
+
declare const getOrganization: ({ fetcher, ...requestConfig }: GetOrganizationConfig) => Promise<OrganizationDetails>;
|
|
61
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;
|
|
@@ -15,14 +15,22 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { OrganizationDetails } from '
|
|
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
|
+
}
|
|
19
29
|
/**
|
|
20
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.
|
|
21
32
|
*
|
|
22
|
-
* @param
|
|
23
|
-
* @param organizationId - The ID of the organization to update.
|
|
24
|
-
* @param operations - Array of patch operations to apply.
|
|
25
|
-
* @param requestConfig - Additional request config if needed.
|
|
33
|
+
* @param config - Configuration object with baseUrl, organizationId, operations and optional request config.
|
|
26
34
|
* @returns A promise that resolves with the updated organization information.
|
|
27
35
|
* @example
|
|
28
36
|
* ```typescript
|
|
@@ -49,26 +57,20 @@ import { OrganizationDetails } from './getOrganization';
|
|
|
49
57
|
* ]
|
|
50
58
|
* });
|
|
51
59
|
* ```
|
|
52
|
-
*/
|
|
53
|
-
declare const updateOrganization: ({ baseUrl, organizationId, operations, ...requestConfig }: {
|
|
54
|
-
baseUrl: string;
|
|
55
|
-
organizationId: string;
|
|
56
|
-
operations: Array<{
|
|
57
|
-
operation: "REPLACE" | "ADD" | "REMOVE";
|
|
58
|
-
path: string;
|
|
59
|
-
value?: any;
|
|
60
|
-
}>;
|
|
61
|
-
} & Partial<Request>) => Promise<OrganizationDetails>;
|
|
62
|
-
/**
|
|
63
|
-
* Helper function to convert field updates to patch operations format.
|
|
64
|
-
* Uses REMOVE operation when the value is empty, otherwise uses REPLACE.
|
|
65
60
|
*
|
|
66
|
-
* @
|
|
67
|
-
*
|
|
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
|
+
* ```
|
|
68
73
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
path: string;
|
|
72
|
-
value?: any;
|
|
73
|
-
}>;
|
|
74
|
+
declare const updateOrganization: ({ fetcher, ...requestConfig }: UpdateOrganizationConfig) => Promise<OrganizationDetails>;
|
|
75
|
+
export { createPatchOperations };
|
|
74
76
|
export default updateOrganization;
|