@thunderid/react 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/{getScim2Me.d.ts → getUsersMe.d.ts} +11 -11
- package/dist/api/{getScim2Me.d.ts.map → getUsersMe.d.ts.map} +1 -1
- package/dist/api/{getScim2Me.js → getUsersMe.js} +12 -12
- package/dist/api/{getScim2Me.js.map → getUsersMe.js.map} +1 -1
- package/dist/api/updateMeProfile.d.ts +5 -5
- package/dist/api/updateMeProfile.js +6 -6
- package/dist/api/updateMeProfile.js.map +1 -1
- package/dist/cjs/api/{getScim2Me.cjs → getUsersMe.cjs} +11 -11
- package/dist/cjs/api/{getScim2Me.cjs.map → getUsersMe.cjs.map} +1 -1
- package/dist/cjs/api/updateMeProfile.cjs +6 -6
- package/dist/cjs/api/updateMeProfile.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs +48 -58
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs +21 -8
- package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +9 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +52 -9
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +11 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +18 -14
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +35 -9
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +18 -13
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +88 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs +130 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -0
- package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +1 -0
- package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +23 -7
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
- package/dist/cjs/contexts/User/UserContext.cjs +0 -1
- package/dist/cjs/contexts/User/UserContext.cjs.map +1 -1
- package/dist/cjs/contexts/User/UserProvider.cjs +0 -2
- package/dist/cjs/contexts/User/UserProvider.cjs.map +1 -1
- package/dist/cjs/contexts/User/useUser.cjs +0 -1
- package/dist/cjs/contexts/User/useUser.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/utils/composeAffixedInputs.cjs +74 -0
- package/dist/cjs/utils/composeAffixedInputs.cjs.map +1 -0
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +0 -20
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.js +50 -60
- package/dist/components/presentation/UserProfile/BaseUserProfile.js.map +1 -1
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
- package/dist/components/presentation/UserProfile/UserProfile.d.ts.map +1 -1
- package/dist/components/presentation/UserProfile/UserProfile.js +22 -9
- package/dist/components/presentation/UserProfile/UserProfile.js.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +9 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts +12 -4
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +52 -9
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +11 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js +19 -15
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js +37 -11
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +18 -13
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.d.ts +52 -0
- package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.js +83 -0
- package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts +25 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.js +127 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -0
- package/dist/components/primitives/AffixedField/index.d.ts +20 -0
- package/dist/components/primitives/AffixedField/index.d.ts.map +1 -0
- package/dist/components/primitives/Dialog/Dialog.js +3 -3
- package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +1 -0
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDContext.d.ts +1 -0
- package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDContext.js +1 -0
- package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js +23 -7
- package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
- package/dist/contexts/User/UserContext.d.ts +1 -2
- package/dist/contexts/User/UserContext.d.ts.map +1 -1
- package/dist/contexts/User/UserContext.js +0 -1
- package/dist/contexts/User/UserContext.js.map +1 -1
- package/dist/contexts/User/UserProvider.d.ts +0 -1
- package/dist/contexts/User/UserProvider.d.ts.map +1 -1
- package/dist/contexts/User/UserProvider.js +0 -2
- package/dist/contexts/User/UserProvider.js.map +1 -1
- package/dist/contexts/User/useUser.d.ts +0 -1
- package/dist/contexts/User/useUser.d.ts.map +1 -1
- package/dist/contexts/User/useUser.js +0 -1
- package/dist/contexts/User/useUser.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/composeAffixedInputs.d.ts +52 -0
- package/dist/utils/composeAffixedInputs.d.ts.map +1 -0
- package/dist/utils/composeAffixedInputs.js +70 -0
- package/dist/utils/composeAffixedInputs.js.map +1 -0
- package/package.json +3 -2
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User,
|
|
18
|
+
import { User, GetUsersMeConfig as BaseGetUsersMeConfig } from '@thunderid/browser';
|
|
19
19
|
/**
|
|
20
|
-
* Configuration for the
|
|
20
|
+
* Configuration for the getUsersMe request (React-specific)
|
|
21
21
|
*/
|
|
22
|
-
export interface
|
|
22
|
+
export interface GetUsersMeConfig extends Omit<BaseGetUsersMeConfig, 'fetcher'> {
|
|
23
23
|
/**
|
|
24
24
|
* Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used
|
|
25
25
|
* which is a wrapper around axios http.request
|
|
@@ -31,7 +31,7 @@ export interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'>
|
|
|
31
31
|
instanceId?: number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Retrieves the user profile information from the specified
|
|
34
|
+
* Retrieves the user profile information from the specified /users/me endpoint.
|
|
35
35
|
* This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.
|
|
36
36
|
*
|
|
37
37
|
* @param requestConfig - Request configuration object.
|
|
@@ -40,8 +40,8 @@ export interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'>
|
|
|
40
40
|
* ```typescript
|
|
41
41
|
* // Using default ThunderID SPA client httpClient
|
|
42
42
|
* try {
|
|
43
|
-
* const userProfile = await
|
|
44
|
-
* url: "https://localhost:8090/
|
|
43
|
+
* const userProfile = await getUsersMe({
|
|
44
|
+
* url: "https://localhost:8090/users/me",
|
|
45
45
|
* });
|
|
46
46
|
* console.log(userProfile);
|
|
47
47
|
* } catch (error) {
|
|
@@ -55,8 +55,8 @@ export interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'>
|
|
|
55
55
|
* ```typescript
|
|
56
56
|
* // Using custom fetcher
|
|
57
57
|
* try {
|
|
58
|
-
* const userProfile = await
|
|
59
|
-
* url: "https://localhost:8090/
|
|
58
|
+
* const userProfile = await getUsersMe({
|
|
59
|
+
* url: "https://localhost:8090/users/me",
|
|
60
60
|
* fetcher: customFetchFunction
|
|
61
61
|
* });
|
|
62
62
|
* console.log(userProfile);
|
|
@@ -67,6 +67,6 @@ export interface GetScim2MeConfig extends Omit<BaseGetScim2MeConfig, 'fetcher'>
|
|
|
67
67
|
* }
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
|
-
declare const
|
|
71
|
-
export default
|
|
72
|
-
//# sourceMappingURL=
|
|
70
|
+
declare const getUsersMe: ({ fetcher, instanceId, ...requestConfig }: GetUsersMeConfig) => Promise<User>;
|
|
71
|
+
export default getUsersMe;
|
|
72
|
+
//# sourceMappingURL=getUsersMe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"getUsersMe.d.ts","sourceRoot":"","sources":["../../src/api/getUsersMe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,IAAI,EAKJ,gBAAgB,IAAI,oBAAoB,EACzC,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC;IAC7E;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,QAAA,MAAM,UAAU,GAAU,2CAA6C,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAsBrG,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FetchHttpClient,
|
|
1
|
+
import { FetchHttpClient, getUsersMe } from "@thunderid/browser";
|
|
2
2
|
|
|
3
|
-
//#region src/api/
|
|
3
|
+
//#region src/api/getUsersMe.ts
|
|
4
4
|
/**
|
|
5
|
-
* Retrieves the user profile information from the specified
|
|
5
|
+
* Retrieves the user profile information from the specified /users/me endpoint.
|
|
6
6
|
* This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.
|
|
7
7
|
*
|
|
8
8
|
* @param requestConfig - Request configuration object.
|
|
@@ -11,8 +11,8 @@ import { FetchHttpClient, getScim2Me } from "@thunderid/browser";
|
|
|
11
11
|
* ```typescript
|
|
12
12
|
* // Using default ThunderID SPA client httpClient
|
|
13
13
|
* try {
|
|
14
|
-
* const userProfile = await
|
|
15
|
-
* url: "https://localhost:8090/
|
|
14
|
+
* const userProfile = await getUsersMe({
|
|
15
|
+
* url: "https://localhost:8090/users/me",
|
|
16
16
|
* });
|
|
17
17
|
* console.log(userProfile);
|
|
18
18
|
* } catch (error) {
|
|
@@ -26,8 +26,8 @@ import { FetchHttpClient, getScim2Me } from "@thunderid/browser";
|
|
|
26
26
|
* ```typescript
|
|
27
27
|
* // Using custom fetcher
|
|
28
28
|
* try {
|
|
29
|
-
* const userProfile = await
|
|
30
|
-
* url: "https://localhost:8090/
|
|
29
|
+
* const userProfile = await getUsersMe({
|
|
30
|
+
* url: "https://localhost:8090/users/me",
|
|
31
31
|
* fetcher: customFetchFunction
|
|
32
32
|
* });
|
|
33
33
|
* console.log(userProfile);
|
|
@@ -38,7 +38,7 @@ import { FetchHttpClient, getScim2Me } from "@thunderid/browser";
|
|
|
38
38
|
* }
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
const
|
|
41
|
+
const getUsersMe$1 = async ({ fetcher, instanceId = 0,...requestConfig }) => {
|
|
42
42
|
const defaultFetcher = async (url, config) => {
|
|
43
43
|
const response = await FetchHttpClient.getInstance(instanceId).request({
|
|
44
44
|
headers: config.headers,
|
|
@@ -53,13 +53,13 @@ const getScim2Me$1 = async ({ fetcher, instanceId = 0,...requestConfig }) => {
|
|
|
53
53
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
|
-
return
|
|
56
|
+
return getUsersMe({
|
|
57
57
|
...requestConfig,
|
|
58
58
|
fetcher: fetcher || defaultFetcher
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
var
|
|
61
|
+
var getUsersMe_default = getUsersMe$1;
|
|
62
62
|
|
|
63
63
|
//#endregion
|
|
64
|
-
export {
|
|
65
|
-
//# sourceMappingURL=
|
|
64
|
+
export { getUsersMe_default as default };
|
|
65
|
+
//# sourceMappingURL=getUsersMe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"getUsersMe.js","names":["getUsersMe","response: HttpResponse<any>","baseGetUsersMe"],"sources":["../../src/api/getUsersMe.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getUsersMe as baseGetUsersMe,\n GetUsersMeConfig as BaseGetUsersMeConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getUsersMe request (React-specific)\n */\nexport interface GetUsersMeConfig extends Omit<BaseGetUsersMeConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves the user profile information from the specified /users/me endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param requestConfig - Request configuration object.\n * @returns A promise that resolves with the user profile information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const userProfile = await getUsersMe({\n * url: \"https://localhost:8090/users/me\",\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const userProfile = await getUsersMe({\n * url: \"https://localhost:8090/users/me\",\n * fetcher: customFetchFunction\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n */\nconst getUsersMe = async ({fetcher, instanceId = 0, ...requestConfig}: GetUsersMeConfig): Promise<User> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetUsersMe({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getUsersMe;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,MAAMA,eAAa,OAAO,EAAC,SAAS,aAAa,EAAG,GAAG,oBAAoD;CACzG,MAAM,iBAAiB,OAAO,KAAa,WAA2C;EAEpF,MAAMC,WAA8B,MADA,gBAAgB,YAAY,WAAW,CACtB,QAAQ;GAC3D,SAAS,OAAO;GAChB,QAAQ,OAAO,UAAU;GACzB;GACD,CAAsB;AAEvB,SAAO;GACL,YAAY,QAAQ,QAAQ,SAAS,KAAK;GAC1C,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS;GAChD,QAAQ,SAAS;GACjB,YAAY,SAAS,cAAc;GACnC,YAAY,QAAQ,QAAQ,OAAO,SAAS,SAAS,WAAW,SAAS,OAAO,KAAK,UAAU,SAAS,KAAK,CAAC;GAC/G;;AAGH,QAAOC,WAAe;EACpB,GAAG;EACH,SAAS,WAAW;EACrB,CAAC;;AAGJ,yBAAeF"}
|
|
@@ -31,7 +31,7 @@ export interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, '
|
|
|
31
31
|
instanceId?: number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Updates the user profile information at the specified
|
|
34
|
+
* Updates the user profile information at the specified /users/me endpoint.
|
|
35
35
|
* This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.
|
|
36
36
|
*
|
|
37
37
|
* @param config - Configuration object with URL, payload and optional request config.
|
|
@@ -40,8 +40,8 @@ export interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, '
|
|
|
40
40
|
* ```typescript
|
|
41
41
|
* // Using default ThunderID SPA client httpClient
|
|
42
42
|
* await updateMeProfile({
|
|
43
|
-
* url: "https://localhost:8090/
|
|
44
|
-
* payload: {
|
|
43
|
+
* url: "https://localhost:8090/users/me",
|
|
44
|
+
* payload: { picture: "https://example.com/pic.jpg" }
|
|
45
45
|
* });
|
|
46
46
|
* ```
|
|
47
47
|
*
|
|
@@ -49,8 +49,8 @@ export interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, '
|
|
|
49
49
|
* ```typescript
|
|
50
50
|
* // Using custom fetcher
|
|
51
51
|
* await updateMeProfile({
|
|
52
|
-
* url: "https://localhost:8090/
|
|
53
|
-
* payload: {
|
|
52
|
+
* url: "https://localhost:8090/users/me",
|
|
53
|
+
* payload: { picture: "https://example.com/pic.jpg" },
|
|
54
54
|
* fetcher: customFetchFunction
|
|
55
55
|
* });
|
|
56
56
|
* ```
|
|
@@ -2,7 +2,7 @@ import { FetchHttpClient, updateMeProfile } from "@thunderid/browser";
|
|
|
2
2
|
|
|
3
3
|
//#region src/api/updateMeProfile.ts
|
|
4
4
|
/**
|
|
5
|
-
* Updates the user profile information at the specified
|
|
5
|
+
* Updates the user profile information at the specified /users/me endpoint.
|
|
6
6
|
* This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.
|
|
7
7
|
*
|
|
8
8
|
* @param config - Configuration object with URL, payload and optional request config.
|
|
@@ -11,8 +11,8 @@ import { FetchHttpClient, updateMeProfile } from "@thunderid/browser";
|
|
|
11
11
|
* ```typescript
|
|
12
12
|
* // Using default ThunderID SPA client httpClient
|
|
13
13
|
* await updateMeProfile({
|
|
14
|
-
* url: "https://localhost:8090/
|
|
15
|
-
* payload: {
|
|
14
|
+
* url: "https://localhost:8090/users/me",
|
|
15
|
+
* payload: { picture: "https://example.com/pic.jpg" }
|
|
16
16
|
* });
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
@@ -20,8 +20,8 @@ import { FetchHttpClient, updateMeProfile } from "@thunderid/browser";
|
|
|
20
20
|
* ```typescript
|
|
21
21
|
* // Using custom fetcher
|
|
22
22
|
* await updateMeProfile({
|
|
23
|
-
* url: "https://localhost:8090/
|
|
24
|
-
* payload: {
|
|
23
|
+
* url: "https://localhost:8090/users/me",
|
|
24
|
+
* payload: { picture: "https://example.com/pic.jpg" },
|
|
25
25
|
* fetcher: customFetchFunction
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
@@ -31,7 +31,7 @@ const updateMeProfile$1 = async ({ fetcher, instanceId = 0,...requestConfig }) =
|
|
|
31
31
|
const response = await FetchHttpClient.getInstance(instanceId).request({
|
|
32
32
|
data: config.body ? JSON.parse(config.body) : void 0,
|
|
33
33
|
headers: config.headers,
|
|
34
|
-
method: config.method || "
|
|
34
|
+
method: config.method || "PUT",
|
|
35
35
|
url
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateMeProfile.js","names":["updateMeProfile","response: HttpResponse<any>","baseUpdateMeProfile"],"sources":["../../src/api/updateMeProfile.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n updateMeProfile as baseUpdateMeProfile,\n UpdateMeProfileConfig as BaseUpdateMeProfileConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the updateMeProfile request (React-specific)\n */\nexport interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Updates the user profile information at the specified
|
|
1
|
+
{"version":3,"file":"updateMeProfile.js","names":["updateMeProfile","response: HttpResponse<any>","baseUpdateMeProfile"],"sources":["../../src/api/updateMeProfile.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n updateMeProfile as baseUpdateMeProfile,\n UpdateMeProfileConfig as BaseUpdateMeProfileConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the updateMeProfile request (React-specific)\n */\nexport interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Updates the user profile information at the specified /users/me endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object with URL, payload and optional request config.\n * @returns A promise that resolves with the updated user profile information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * await updateMeProfile({\n * url: \"https://localhost:8090/users/me\",\n * payload: { picture: \"https://example.com/pic.jpg\" }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * await updateMeProfile({\n * url: \"https://localhost:8090/users/me\",\n * payload: { picture: \"https://example.com/pic.jpg\" },\n * fetcher: customFetchFunction\n * });\n * ```\n */\nconst updateMeProfile = async ({fetcher, instanceId = 0, ...requestConfig}: UpdateMeProfileConfig): Promise<User> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n data: config.body ? JSON.parse(config.body as string) : undefined,\n headers: config.headers as Record<string, string>,\n method: config.method || 'PUT',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseUpdateMeProfile({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default updateMeProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAMA,oBAAkB,OAAO,EAAC,SAAS,aAAa,EAAG,GAAG,oBAAyD;CACnH,MAAM,iBAAiB,OAAO,KAAa,WAA2C;EAEpF,MAAMC,WAA8B,MADA,gBAAgB,YAAY,WAAW,CACtB,QAAQ;GAC3D,MAAM,OAAO,OAAO,KAAK,MAAM,OAAO,KAAe,GAAG;GACxD,SAAS,OAAO;GAChB,QAAQ,OAAO,UAAU;GACzB;GACD,CAAsB;AAEvB,SAAO;GACL,YAAY,QAAQ,QAAQ,SAAS,KAAK;GAC1C,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS;GAChD,QAAQ,SAAS;GACjB,YAAY,SAAS,cAAc;GACnC,YAAY,QAAQ,QAAQ,OAAO,SAAS,SAAS,WAAW,SAAS,OAAO,KAAK,UAAU,SAAS,KAAK,CAAC;GAC/G;;AAGH,QAAOC,gBAAoB;EACzB,GAAG;EACH,SAAS,WAAW;EACrB,CAAC;;AAGJ,8BAAeF"}
|
|
@@ -2,9 +2,9 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
let __thunderid_browser = require("@thunderid/browser");
|
|
3
3
|
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
4
4
|
|
|
5
|
-
//#region src/api/
|
|
5
|
+
//#region src/api/getUsersMe.ts
|
|
6
6
|
/**
|
|
7
|
-
* Retrieves the user profile information from the specified
|
|
7
|
+
* Retrieves the user profile information from the specified /users/me endpoint.
|
|
8
8
|
* This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.
|
|
9
9
|
*
|
|
10
10
|
* @param requestConfig - Request configuration object.
|
|
@@ -13,8 +13,8 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
|
13
13
|
* ```typescript
|
|
14
14
|
* // Using default ThunderID SPA client httpClient
|
|
15
15
|
* try {
|
|
16
|
-
* const userProfile = await
|
|
17
|
-
* url: "https://localhost:8090/
|
|
16
|
+
* const userProfile = await getUsersMe({
|
|
17
|
+
* url: "https://localhost:8090/users/me",
|
|
18
18
|
* });
|
|
19
19
|
* console.log(userProfile);
|
|
20
20
|
* } catch (error) {
|
|
@@ -28,8 +28,8 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
|
28
28
|
* ```typescript
|
|
29
29
|
* // Using custom fetcher
|
|
30
30
|
* try {
|
|
31
|
-
* const userProfile = await
|
|
32
|
-
* url: "https://localhost:8090/
|
|
31
|
+
* const userProfile = await getUsersMe({
|
|
32
|
+
* url: "https://localhost:8090/users/me",
|
|
33
33
|
* fetcher: customFetchFunction
|
|
34
34
|
* });
|
|
35
35
|
* console.log(userProfile);
|
|
@@ -40,7 +40,7 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
|
40
40
|
* }
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
43
|
+
const getUsersMe = async ({ fetcher, instanceId = 0,...requestConfig }) => {
|
|
44
44
|
const defaultFetcher = async (url, config) => {
|
|
45
45
|
const response = await __thunderid_browser.FetchHttpClient.getInstance(instanceId).request({
|
|
46
46
|
headers: config.headers,
|
|
@@ -55,13 +55,13 @@ const getScim2Me = async ({ fetcher, instanceId = 0,...requestConfig }) => {
|
|
|
55
55
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
-
return (0, __thunderid_browser.
|
|
58
|
+
return (0, __thunderid_browser.getUsersMe)({
|
|
59
59
|
...requestConfig,
|
|
60
60
|
fetcher: fetcher || defaultFetcher
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
-
var
|
|
63
|
+
var getUsersMe_default = getUsersMe;
|
|
64
64
|
|
|
65
65
|
//#endregion
|
|
66
|
-
exports.default =
|
|
67
|
-
//# sourceMappingURL=
|
|
66
|
+
exports.default = getUsersMe_default;
|
|
67
|
+
//# sourceMappingURL=getUsersMe.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"getUsersMe.cjs","names":["response: HttpResponse<any>","FetchHttpClient"],"sources":["../../../src/api/getUsersMe.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n getUsersMe as baseGetUsersMe,\n GetUsersMeConfig as BaseGetUsersMeConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the getUsersMe request (React-specific)\n */\nexport interface GetUsersMeConfig extends Omit<BaseGetUsersMeConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Retrieves the user profile information from the specified /users/me endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param requestConfig - Request configuration object.\n * @returns A promise that resolves with the user profile information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * try {\n * const userProfile = await getUsersMe({\n * url: \"https://localhost:8090/users/me\",\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * try {\n * const userProfile = await getUsersMe({\n * url: \"https://localhost:8090/users/me\",\n * fetcher: customFetchFunction\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof ThunderIDAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n */\nconst getUsersMe = async ({fetcher, instanceId = 0, ...requestConfig}: GetUsersMeConfig): Promise<User> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n headers: config.headers as Record<string, string>,\n method: config.method || 'GET',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseGetUsersMe({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default getUsersMe;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,MAAM,aAAa,OAAO,EAAC,SAAS,aAAa,EAAG,GAAG,oBAAoD;CACzG,MAAM,iBAAiB,OAAO,KAAa,WAA2C;EAEpF,MAAMA,WAA8B,MADAC,oCAAgB,YAAY,WAAW,CACtB,QAAQ;GAC3D,SAAS,OAAO;GAChB,QAAQ,OAAO,UAAU;GACzB;GACD,CAAsB;AAEvB,SAAO;GACL,YAAY,QAAQ,QAAQ,SAAS,KAAK;GAC1C,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS;GAChD,QAAQ,SAAS;GACjB,YAAY,SAAS,cAAc;GACnC,YAAY,QAAQ,QAAQ,OAAO,SAAS,SAAS,WAAW,SAAS,OAAO,KAAK,UAAU,SAAS,KAAK,CAAC;GAC/G;;AAGH,4CAAsB;EACpB,GAAG;EACH,SAAS,WAAW;EACrB,CAAC;;AAGJ,yBAAe"}
|
|
@@ -4,7 +4,7 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
|
4
4
|
|
|
5
5
|
//#region src/api/updateMeProfile.ts
|
|
6
6
|
/**
|
|
7
|
-
* Updates the user profile information at the specified
|
|
7
|
+
* Updates the user profile information at the specified /users/me endpoint.
|
|
8
8
|
* This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.
|
|
9
9
|
*
|
|
10
10
|
* @param config - Configuration object with URL, payload and optional request config.
|
|
@@ -13,8 +13,8 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
|
13
13
|
* ```typescript
|
|
14
14
|
* // Using default ThunderID SPA client httpClient
|
|
15
15
|
* await updateMeProfile({
|
|
16
|
-
* url: "https://localhost:8090/
|
|
17
|
-
* payload: {
|
|
16
|
+
* url: "https://localhost:8090/users/me",
|
|
17
|
+
* payload: { picture: "https://example.com/pic.jpg" }
|
|
18
18
|
* });
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
@@ -22,8 +22,8 @@ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
|
22
22
|
* ```typescript
|
|
23
23
|
* // Using custom fetcher
|
|
24
24
|
* await updateMeProfile({
|
|
25
|
-
* url: "https://localhost:8090/
|
|
26
|
-
* payload: {
|
|
25
|
+
* url: "https://localhost:8090/users/me",
|
|
26
|
+
* payload: { picture: "https://example.com/pic.jpg" },
|
|
27
27
|
* fetcher: customFetchFunction
|
|
28
28
|
* });
|
|
29
29
|
* ```
|
|
@@ -33,7 +33,7 @@ const updateMeProfile = async ({ fetcher, instanceId = 0,...requestConfig }) =>
|
|
|
33
33
|
const response = await __thunderid_browser.FetchHttpClient.getInstance(instanceId).request({
|
|
34
34
|
data: config.body ? JSON.parse(config.body) : void 0,
|
|
35
35
|
headers: config.headers,
|
|
36
|
-
method: config.method || "
|
|
36
|
+
method: config.method || "PUT",
|
|
37
37
|
url
|
|
38
38
|
});
|
|
39
39
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateMeProfile.cjs","names":["response: HttpResponse<any>","FetchHttpClient"],"sources":["../../../src/api/updateMeProfile.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n updateMeProfile as baseUpdateMeProfile,\n UpdateMeProfileConfig as BaseUpdateMeProfileConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the updateMeProfile request (React-specific)\n */\nexport interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Updates the user profile information at the specified
|
|
1
|
+
{"version":3,"file":"updateMeProfile.cjs","names":["response: HttpResponse<any>","FetchHttpClient"],"sources":["../../../src/api/updateMeProfile.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n User,\n HttpResponse,\n FetchHttpClient,\n HttpRequestConfig,\n updateMeProfile as baseUpdateMeProfile,\n UpdateMeProfileConfig as BaseUpdateMeProfileConfig,\n} from '@thunderid/browser';\n\n/**\n * Configuration for the updateMeProfile request (React-specific)\n */\nexport interface UpdateMeProfileConfig extends Omit<BaseUpdateMeProfileConfig, 'fetcher'> {\n /**\n * Optional custom fetcher function. If not provided, the ThunderID SPA client's httpClient will be used\n * which is a wrapper around axios http.request\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Optional instance ID for multi-instance support. Defaults to 0.\n */\n instanceId?: number;\n}\n\n/**\n * Updates the user profile information at the specified /users/me endpoint.\n * This function uses the ThunderID SPA client's httpClient by default, but allows for custom fetchers.\n *\n * @param config - Configuration object with URL, payload and optional request config.\n * @returns A promise that resolves with the updated user profile information.\n * @example\n * ```typescript\n * // Using default ThunderID SPA client httpClient\n * await updateMeProfile({\n * url: \"https://localhost:8090/users/me\",\n * payload: { picture: \"https://example.com/pic.jpg\" }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher\n * await updateMeProfile({\n * url: \"https://localhost:8090/users/me\",\n * payload: { picture: \"https://example.com/pic.jpg\" },\n * fetcher: customFetchFunction\n * });\n * ```\n */\nconst updateMeProfile = async ({fetcher, instanceId = 0, ...requestConfig}: UpdateMeProfileConfig): Promise<User> => {\n const defaultFetcher = async (url: string, config: RequestInit): Promise<Response> => {\n const httpClient: FetchHttpClient = FetchHttpClient.getInstance(instanceId);\n const response: HttpResponse<any> = await httpClient.request({\n data: config.body ? JSON.parse(config.body as string) : undefined,\n headers: config.headers as Record<string, string>,\n method: config.method || 'PUT',\n url,\n } as HttpRequestConfig);\n\n return {\n json: () => Promise.resolve(response.data),\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || '',\n text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data)),\n } as Response;\n };\n\n return baseUpdateMeProfile({\n ...requestConfig,\n fetcher: fetcher || defaultFetcher,\n });\n};\n\nexport default updateMeProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAM,kBAAkB,OAAO,EAAC,SAAS,aAAa,EAAG,GAAG,oBAAyD;CACnH,MAAM,iBAAiB,OAAO,KAAa,WAA2C;EAEpF,MAAMA,WAA8B,MADAC,oCAAgB,YAAY,WAAW,CACtB,QAAQ;GAC3D,MAAM,OAAO,OAAO,KAAK,MAAM,OAAO,KAAe,GAAG;GACxD,SAAS,OAAO;GAChB,QAAQ,OAAO,UAAU;GACzB;GACD,CAAsB;AAEvB,SAAO;GACL,YAAY,QAAQ,QAAQ,SAAS,KAAK;GAC1C,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS;GAChD,QAAQ,SAAS;GACjB,YAAY,SAAS,cAAc;GACnC,YAAY,QAAQ,QAAQ,OAAO,SAAS,SAAS,WAAW,SAAS,OAAO,KAAK,UAAU,SAAS,KAAK,CAAC;GAC/G;;AAGH,iDAA2B;EACzB,GAAG;EACH,SAAS,WAAW;EACrB,CAAC;;AAGJ,8BAAe"}
|
|
@@ -43,18 +43,40 @@ const fieldsToSkip = [
|
|
|
43
43
|
"verifiedEmailAddresses",
|
|
44
44
|
"phoneNumbers.mobile",
|
|
45
45
|
"emailAddresses",
|
|
46
|
-
"preferredMFAOption"
|
|
46
|
+
"preferredMFAOption",
|
|
47
|
+
"attributes",
|
|
48
|
+
"picture",
|
|
49
|
+
"isReadOnly",
|
|
50
|
+
"isReadonly"
|
|
47
51
|
];
|
|
48
52
|
const readonlyFields = [
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
53
|
+
"attributes",
|
|
54
|
+
"id",
|
|
55
|
+
"isReadOnly",
|
|
56
|
+
"ouId",
|
|
57
|
+
"username"
|
|
52
58
|
];
|
|
53
|
-
const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, profile,
|
|
59
|
+
const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, profile, flattenedProfile, mode = "inline", title, attributeMapping = {}, editable = true, onOpenChange, onUpdate, open = false, error = null, isLoading = false, preferences, showFields = [], hideFields = [], displayNameAttributes = [] }) => {
|
|
54
60
|
const { theme, colorScheme } = require_useTheme.default();
|
|
55
61
|
const [editedUser, setEditedUser] = (0, react.useState)(flattenedProfile || profile);
|
|
56
62
|
const [editingFields, setEditingFields] = (0, react.useState)({});
|
|
57
63
|
const { t } = require_useTranslation.default(preferences?.i18n);
|
|
64
|
+
(0, react.useEffect)(() => {
|
|
65
|
+
const nextUser = flattenedProfile ?? profile;
|
|
66
|
+
if (!nextUser) return;
|
|
67
|
+
setEditedUser((prev) => {
|
|
68
|
+
if (!prev) return nextUser;
|
|
69
|
+
const updated = { ...nextUser };
|
|
70
|
+
Object.keys(prev).forEach((key) => {
|
|
71
|
+
if (editingFields[key]) updated[key] = prev[key];
|
|
72
|
+
});
|
|
73
|
+
return updated;
|
|
74
|
+
});
|
|
75
|
+
}, [
|
|
76
|
+
flattenedProfile,
|
|
77
|
+
profile,
|
|
78
|
+
editingFields
|
|
79
|
+
]);
|
|
58
80
|
/**
|
|
59
81
|
* Determines if a field should be visible based on showFields, hideFields, and fieldsToSkip arrays.
|
|
60
82
|
* Priority order:
|
|
@@ -132,8 +154,7 @@ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, p
|
|
|
132
154
|
else fieldValue = "";
|
|
133
155
|
if (Array.isArray(fieldValue)) fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
|
|
134
156
|
let payload = {};
|
|
135
|
-
|
|
136
|
-
else set(payload, fieldName, fieldValue);
|
|
157
|
+
set(payload, fieldName, fieldValue);
|
|
137
158
|
onUpdate(payload);
|
|
138
159
|
toggleFieldEdit(fieldName);
|
|
139
160
|
}, [
|
|
@@ -174,7 +195,7 @@ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, p
|
|
|
174
195
|
const renderSchemaField = (schema, isEditing, onEditValue, onStartEdit) => {
|
|
175
196
|
if (!schema) return null;
|
|
176
197
|
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
177
|
-
const label = displayName || description || name
|
|
198
|
+
const label = displayName || description || (name ? (0, __thunderid_browser.startCase)(name) : "");
|
|
178
199
|
if (subAttributes && Array.isArray(subAttributes)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: subAttributes.map((subAttr, index) => {
|
|
179
200
|
let displayValue$1;
|
|
180
201
|
if (Array.isArray(subAttr.value)) displayValue$1 = subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ");
|
|
@@ -388,60 +409,29 @@ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, p
|
|
|
388
409
|
]
|
|
389
410
|
}),
|
|
390
411
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Divider.default, {}),
|
|
391
|
-
profileEntries.map(([key, value]
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
412
|
+
profileEntries.map(([key, value]) => {
|
|
413
|
+
const schemaWithValue = {
|
|
414
|
+
name: key,
|
|
415
|
+
mutability: readonlyFields.includes(key) ? "READ_ONLY" : "READ_WRITE",
|
|
416
|
+
value
|
|
417
|
+
};
|
|
418
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
419
|
+
className: styles.info,
|
|
420
|
+
children: renderUserInfo(schemaWithValue)
|
|
421
|
+
}, key);
|
|
422
|
+
})
|
|
401
423
|
] });
|
|
402
424
|
};
|
|
403
425
|
const profileContent = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Card.default, {
|
|
404
426
|
className: containerClasses,
|
|
405
|
-
children: [
|
|
406
|
-
error
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Avatar.Avatar, {
|
|
414
|
-
imageUrl: require_getMappedUserProfileValue.default("picture", mergedMappings, currentUser),
|
|
415
|
-
name: require_getDisplayName.default(mergedMappings, profile),
|
|
416
|
-
size: 80,
|
|
417
|
-
alt: `${require_getDisplayName.default(mergedMappings, profile)}'s avatar`,
|
|
418
|
-
isLoading
|
|
419
|
-
})
|
|
420
|
-
}),
|
|
421
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
422
|
-
className: styles.infoContainer,
|
|
423
|
-
children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
|
|
424
|
-
if (!schema.name || !shouldShowField(schema.name)) return false;
|
|
425
|
-
if (!editable) {
|
|
426
|
-
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
427
|
-
return value !== void 0 && value !== "" && value !== null;
|
|
428
|
-
}
|
|
429
|
-
return true;
|
|
430
|
-
}).sort((a, b) => {
|
|
431
|
-
return (a.displayOrder ? parseInt(a.displayOrder, 10) : 999) - (b.displayOrder ? parseInt(b.displayOrder, 10) : 999);
|
|
432
|
-
}).map((schema, index) => {
|
|
433
|
-
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
434
|
-
const schemaWithValue = {
|
|
435
|
-
...schema,
|
|
436
|
-
value
|
|
437
|
-
};
|
|
438
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
439
|
-
className: styles.info,
|
|
440
|
-
children: renderUserInfo(schemaWithValue)
|
|
441
|
-
}, schema.name || index);
|
|
442
|
-
}) : renderProfileWithoutSchemas()
|
|
443
|
-
})
|
|
444
|
-
]
|
|
427
|
+
children: [error && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Alert.default, {
|
|
428
|
+
variant: "error",
|
|
429
|
+
className: (0, __emotion_css.cx)((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("user-profile", "alert")), styles.alert),
|
|
430
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Alert.default.Title, { children: t("errors.heading") || "Error" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Alert.default.Description, { children: error })]
|
|
431
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
432
|
+
className: styles.infoContainer,
|
|
433
|
+
children: renderProfileWithoutSchemas()
|
|
434
|
+
})]
|
|
445
435
|
});
|
|
446
436
|
if (mode === "popup") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Dialog.default, {
|
|
447
437
|
open,
|