@thunderid/javascript 0.3.6 → 0.3.7
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/ThunderIDJavaScriptClient.d.ts +0 -5
- package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -1
- package/dist/api/getOrganizationUnitChildren.d.ts +65 -22
- package/dist/api/getOrganizationUnitChildren.d.ts.map +1 -1
- package/dist/cjs/index.cjs +530 -1340
- package/dist/edge/index.js +531 -1332
- package/dist/errors/exception.d.ts +1 -3
- package/dist/errors/exception.d.ts.map +1 -1
- package/dist/index.d.ts +1 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +531 -1332
- package/dist/models/client.d.ts +0 -25
- package/dist/models/client.d.ts.map +1 -1
- package/dist/models/config.d.ts +0 -15
- package/dist/models/config.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/api/createOrganization.d.ts +0 -130
- package/dist/api/createOrganization.d.ts.map +0 -1
- package/dist/api/getAllOrganizations.d.ts +0 -104
- package/dist/api/getAllOrganizations.d.ts.map +0 -1
- package/dist/api/getBrandingPreference.d.ts +0 -104
- package/dist/api/getBrandingPreference.d.ts.map +0 -1
- package/dist/api/getMeOrganizations.d.ts +0 -120
- package/dist/api/getMeOrganizations.d.ts.map +0 -1
- package/dist/api/getOrganization.d.ts +0 -110
- package/dist/api/getOrganization.d.ts.map +0 -1
- package/dist/api/updateOrganization.d.ts +0 -119
- package/dist/api/updateOrganization.d.ts.map +0 -1
- package/dist/models/branding-preference.d.ts +0 -249
- package/dist/models/branding-preference.d.ts.map +0 -1
- package/dist/models/organization-unit.d.ts +0 -103
- package/dist/models/organization-unit.d.ts.map +0 -1
- package/dist/models/organization.d.ts +0 -34
- package/dist/models/organization.d.ts.map +0 -1
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +0 -40
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts.map +0 -1
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts +0 -49
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -102,12 +102,10 @@ var TokenConstants_default = TokenConstants;
|
|
|
102
102
|
/**
|
|
103
103
|
* @deprecated Use `ThunderIDRuntimeError` for runtime errors and `ThunderIDAPIError` for API errors.
|
|
104
104
|
*/
|
|
105
|
-
var ThunderIDAuthException = class {
|
|
106
|
-
name;
|
|
105
|
+
var ThunderIDAuthException = class extends Error {
|
|
107
106
|
code;
|
|
108
|
-
message;
|
|
109
107
|
constructor(code, name, message) {
|
|
110
|
-
|
|
108
|
+
super(message);
|
|
111
109
|
this.name = name;
|
|
112
110
|
this.code = code;
|
|
113
111
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -1023,44 +1021,41 @@ var getFlowMeta_default = getFlowMeta;
|
|
|
1023
1021
|
//#endregion
|
|
1024
1022
|
//#region src/api/getOrganizationUnitChildren.ts
|
|
1025
1023
|
/**
|
|
1026
|
-
* Retrieves the child organization units of a given
|
|
1027
|
-
*
|
|
1028
|
-
* @param config - Request configuration including `baseUrl`/`url`, `organizationUnitId`,
|
|
1029
|
-
* and optional `limit`/`offset` pagination parameters.
|
|
1030
|
-
* @returns A promise that resolves with the paginated list of child organization units.
|
|
1031
|
-
*
|
|
1032
|
-
* @throws {ThunderIDAPIError} When the server returns a non-OK response.
|
|
1033
|
-
*
|
|
1034
|
-
* @example
|
|
1035
|
-
* ```typescript
|
|
1036
|
-
* const children = await getOrganizationUnitChildren({
|
|
1037
|
-
* baseUrl: 'https://localhost:8090',
|
|
1038
|
-
* organizationUnitId: '0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1',
|
|
1039
|
-
* limit: 10,
|
|
1040
|
-
* offset: 0,
|
|
1041
|
-
* });
|
|
1042
|
-
* console.log(children.organizationUnits);
|
|
1043
|
-
* ```
|
|
1024
|
+
* Retrieves the child organization units of a given organization unit.
|
|
1044
1025
|
*
|
|
1045
|
-
* @
|
|
1026
|
+
* @param config - Request configuration object.
|
|
1027
|
+
* @returns A promise that resolves with the list of child organization units.
|
|
1046
1028
|
*/
|
|
1047
|
-
const getOrganizationUnitChildren = async ({ url, baseUrl, organizationUnitId, limit
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
const
|
|
1054
|
-
const
|
|
1029
|
+
const getOrganizationUnitChildren = async ({ url, baseUrl, organizationUnitId, limit, offset, fetcher,...requestConfig }) => {
|
|
1030
|
+
try {
|
|
1031
|
+
new URL(url ?? baseUrl);
|
|
1032
|
+
} catch (error$1) {
|
|
1033
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getOrganizationUnitChildren-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1034
|
+
}
|
|
1035
|
+
const fetchFn = fetcher || fetch;
|
|
1036
|
+
const queryParams = new URLSearchParams();
|
|
1037
|
+
if (limit !== void 0) queryParams.set("limit", String(limit));
|
|
1038
|
+
if (offset !== void 0) queryParams.set("offset", String(offset));
|
|
1039
|
+
const query = queryParams.toString();
|
|
1040
|
+
const resolvedBase = url ?? `${baseUrl}/api/server/v1/organization-units/${organizationUnitId}/children`;
|
|
1041
|
+
const resolvedUrl = query ? `${resolvedBase}?${query}` : resolvedBase;
|
|
1042
|
+
const requestInit = {
|
|
1055
1043
|
...requestConfig,
|
|
1056
1044
|
headers: {
|
|
1057
1045
|
Accept: "application/json",
|
|
1046
|
+
"Content-Type": "application/json",
|
|
1058
1047
|
...requestConfig.headers
|
|
1059
1048
|
},
|
|
1060
1049
|
method: "GET"
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1050
|
+
};
|
|
1051
|
+
try {
|
|
1052
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1053
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getOrganizationUnitChildren-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch organization unit children");
|
|
1054
|
+
return await response.json();
|
|
1055
|
+
} catch (error$1) {
|
|
1056
|
+
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1057
|
+
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getOrganizationUnitChildren-NetworkError-001", "javascript", 0, "Network Error");
|
|
1058
|
+
}
|
|
1064
1059
|
};
|
|
1065
1060
|
var getOrganizationUnitChildren_default = getOrganizationUnitChildren;
|
|
1066
1061
|
|
|
@@ -1359,1111 +1354,151 @@ const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
|
1359
1354
|
var getSchemas_default = getSchemas;
|
|
1360
1355
|
|
|
1361
1356
|
//#endregion
|
|
1362
|
-
//#region src/api/
|
|
1357
|
+
//#region src/api/updateMeProfile.ts
|
|
1363
1358
|
/**
|
|
1364
|
-
*
|
|
1359
|
+
* Updates the user profile information at the specified SCIM2 Me endpoint.
|
|
1365
1360
|
*
|
|
1366
|
-
* @param config - Configuration object
|
|
1367
|
-
* @returns A promise that resolves with the
|
|
1361
|
+
* @param config - Configuration object with URL, payload and optional request config.
|
|
1362
|
+
* @returns A promise that resolves with the updated user profile information.
|
|
1368
1363
|
* @example
|
|
1369
1364
|
* ```typescript
|
|
1370
1365
|
* // Using default fetch
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1375
|
-
* limit: 10,
|
|
1376
|
-
* recursive: false
|
|
1377
|
-
* });
|
|
1378
|
-
* console.log(response.organizations);
|
|
1379
|
-
* } catch (error) {
|
|
1380
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1381
|
-
* console.error('Failed to get organizations:', error.message);
|
|
1382
|
-
* }
|
|
1383
|
-
* }
|
|
1366
|
+
* await updateMeProfile({
|
|
1367
|
+
* url: "https://localhost:8090/scim2/Me",
|
|
1368
|
+
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
|
|
1369
|
+
* });
|
|
1384
1370
|
* ```
|
|
1385
1371
|
*
|
|
1386
1372
|
* @example
|
|
1387
1373
|
* ```typescript
|
|
1388
1374
|
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1389
|
-
*
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1409
|
-
* } as Response;
|
|
1410
|
-
* }
|
|
1411
|
-
* });
|
|
1412
|
-
* console.log(response.organizations);
|
|
1413
|
-
* } catch (error) {
|
|
1414
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1415
|
-
* console.error('Failed to get organizations:', error.message);
|
|
1375
|
+
* await updateMeProfile({
|
|
1376
|
+
* url: "https://localhost:8090/scim2/Me",
|
|
1377
|
+
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
|
|
1378
|
+
* fetcher: async (url, config) => {
|
|
1379
|
+
* const response = await httpClient({
|
|
1380
|
+
* url,
|
|
1381
|
+
* method: config.method,
|
|
1382
|
+
* headers: config.headers,
|
|
1383
|
+
* data: config.body,
|
|
1384
|
+
* ...config
|
|
1385
|
+
* });
|
|
1386
|
+
* // Convert axios-like response to fetch-like Response
|
|
1387
|
+
* return {
|
|
1388
|
+
* ok: response.status >= 200 && response.status < 300,
|
|
1389
|
+
* status: response.status,
|
|
1390
|
+
* statusText: response.statusText,
|
|
1391
|
+
* json: () => Promise.resolve(response.data),
|
|
1392
|
+
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1393
|
+
* } as Response;
|
|
1416
1394
|
* }
|
|
1417
|
-
* }
|
|
1395
|
+
* });
|
|
1418
1396
|
* ```
|
|
1419
1397
|
*/
|
|
1420
|
-
const
|
|
1398
|
+
const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig }) => {
|
|
1421
1399
|
try {
|
|
1422
|
-
new URL(baseUrl);
|
|
1400
|
+
new URL(url ?? baseUrl);
|
|
1423
1401
|
} catch (error$1) {
|
|
1424
|
-
throw new ThunderIDAPIError(`Invalid
|
|
1402
|
+
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "updateMeProfile-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1425
1403
|
}
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1404
|
+
const data = {
|
|
1405
|
+
Operations: [{
|
|
1406
|
+
op: "replace",
|
|
1407
|
+
value: payload
|
|
1408
|
+
}],
|
|
1409
|
+
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
|
|
1410
|
+
};
|
|
1431
1411
|
const fetchFn = fetcher || fetch;
|
|
1432
|
-
const resolvedUrl = `${baseUrl}/
|
|
1412
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
1433
1413
|
const requestInit = {
|
|
1414
|
+
method: "PATCH",
|
|
1434
1415
|
...requestConfig,
|
|
1416
|
+
body: JSON.stringify(data),
|
|
1435
1417
|
headers: {
|
|
1436
1418
|
...requestConfig.headers,
|
|
1437
1419
|
Accept: "application/json",
|
|
1438
|
-
"Content-Type": "application/json"
|
|
1439
|
-
}
|
|
1440
|
-
method: "GET"
|
|
1420
|
+
"Content-Type": "application/scim+json"
|
|
1421
|
+
}
|
|
1441
1422
|
};
|
|
1442
1423
|
try {
|
|
1443
1424
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1444
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "
|
|
1445
|
-
|
|
1446
|
-
return {
|
|
1447
|
-
hasMore: data.hasMore,
|
|
1448
|
-
nextCursor: data.nextCursor,
|
|
1449
|
-
organizations: data.organizations || [],
|
|
1450
|
-
totalCount: data.totalCount
|
|
1451
|
-
};
|
|
1425
|
+
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1426
|
+
return processUsername_default(await response.json());
|
|
1452
1427
|
} catch (error$1) {
|
|
1453
1428
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1454
|
-
throw new ThunderIDAPIError(
|
|
1429
|
+
throw new ThunderIDAPIError(error$1?.response?.data?.detail || "An error occurred while updating the user profile. Please try again.", "updateMeProfile-NetworkError-001", "javascript", error$1?.data?.status, "Network Error");
|
|
1455
1430
|
}
|
|
1456
1431
|
};
|
|
1457
|
-
var
|
|
1432
|
+
var updateMeProfile_default = updateMeProfile;
|
|
1458
1433
|
|
|
1459
1434
|
//#endregion
|
|
1460
|
-
//#region src/
|
|
1435
|
+
//#region src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
1461
1436
|
/**
|
|
1462
|
-
*
|
|
1437
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1463
1438
|
*
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1468
|
-
* // Using default fetch
|
|
1469
|
-
* try {
|
|
1470
|
-
* const organization = await createOrganization({
|
|
1471
|
-
* baseUrl: "https://localhost:8090",
|
|
1472
|
-
* payload: {
|
|
1473
|
-
* description: "Share your screens",
|
|
1474
|
-
* name: "Team Viewer",
|
|
1475
|
-
* orgHandle: "team-viewer",
|
|
1476
|
-
* parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
|
|
1477
|
-
* type: "TENANT"
|
|
1478
|
-
* }
|
|
1479
|
-
* });
|
|
1480
|
-
* console.log(organization);
|
|
1481
|
-
* } catch (error) {
|
|
1482
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1483
|
-
* console.error('Failed to create organization:', error.message);
|
|
1484
|
-
* }
|
|
1485
|
-
* }
|
|
1486
|
-
* ```
|
|
1439
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1440
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
1441
|
+
* in compliance with the License.
|
|
1442
|
+
* You may obtain a copy of the License at
|
|
1487
1443
|
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
*
|
|
1496
|
-
* name: "Team Viewer",
|
|
1497
|
-
* orgHandle: "team-viewer",
|
|
1498
|
-
* parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
|
|
1499
|
-
* type: "TENANT"
|
|
1500
|
-
* },
|
|
1501
|
-
* fetcher: async (url, config) => {
|
|
1502
|
-
* const response = await httpClient({
|
|
1503
|
-
* url,
|
|
1504
|
-
* method: config.method,
|
|
1505
|
-
* headers: config.headers,
|
|
1506
|
-
* data: config.body,
|
|
1507
|
-
* ...config
|
|
1508
|
-
* });
|
|
1509
|
-
* // Convert axios-like response to fetch-like Response
|
|
1510
|
-
* return {
|
|
1511
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1512
|
-
* status: response.status,
|
|
1513
|
-
* statusText: response.statusText,
|
|
1514
|
-
* json: () => Promise.resolve(response.data),
|
|
1515
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1516
|
-
* } as Response;
|
|
1517
|
-
* }
|
|
1518
|
-
* });
|
|
1519
|
-
* console.log(organization);
|
|
1520
|
-
* } catch (error) {
|
|
1521
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1522
|
-
* console.error('Failed to create organization:', error.message);
|
|
1523
|
-
* }
|
|
1524
|
-
* }
|
|
1525
|
-
* ```
|
|
1444
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1445
|
+
*
|
|
1446
|
+
* Unless required by applicable law or agreed to in writing,
|
|
1447
|
+
* software distributed under the License is distributed on an
|
|
1448
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1449
|
+
* KIND, either express or implied. See the License for the
|
|
1450
|
+
* specific language governing permissions and limitations
|
|
1451
|
+
* under the License.
|
|
1526
1452
|
*/
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
},
|
|
1548
|
-
method: "POST"
|
|
1549
|
-
};
|
|
1550
|
-
try {
|
|
1551
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1552
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "createOrganization-ResponseError-001", "javascript", response.status, response.statusText, "Failed to create organization");
|
|
1553
|
-
return await response.json();
|
|
1554
|
-
} catch (error$1) {
|
|
1555
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1556
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "createOrganization-NetworkError-001", "javascript", 0, "Network Error");
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
var createOrganization_default = createOrganization;
|
|
1453
|
+
/**
|
|
1454
|
+
* Constants representing Application Native Authentication related configurations and constants.
|
|
1455
|
+
*/
|
|
1456
|
+
const ApplicationNativeAuthenticationConstants = { SupportedAuthenticators: {
|
|
1457
|
+
EmailOtp: "ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
1458
|
+
Facebook: "RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r",
|
|
1459
|
+
GitHub: "R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI",
|
|
1460
|
+
Google: "R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl",
|
|
1461
|
+
IdentifierFirst: "SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM",
|
|
1462
|
+
LinkedIn: "TGlua2VkSW5PSURDOkxpbmtlZElu",
|
|
1463
|
+
MagicLink: "TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA",
|
|
1464
|
+
Microsoft: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0",
|
|
1465
|
+
Passkey: "RklET0F1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
1466
|
+
PushNotification: "cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA",
|
|
1467
|
+
SignInWithEthereum: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt",
|
|
1468
|
+
SmsOtp: "c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM",
|
|
1469
|
+
Totp: "dG90cDpMT0NBTA",
|
|
1470
|
+
UsernamePassword: "QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM"
|
|
1471
|
+
} };
|
|
1472
|
+
var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
|
|
1560
1473
|
|
|
1561
1474
|
//#endregion
|
|
1562
|
-
//#region src/
|
|
1475
|
+
//#region src/constants/ScopeConstants.ts
|
|
1563
1476
|
/**
|
|
1564
|
-
*
|
|
1477
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1565
1478
|
*
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1568
|
-
*
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
*
|
|
1573
|
-
*
|
|
1574
|
-
*
|
|
1575
|
-
*
|
|
1576
|
-
*
|
|
1577
|
-
*
|
|
1578
|
-
*
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
1584
|
-
*
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1589
|
-
* ```typescript
|
|
1590
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1591
|
-
* try {
|
|
1592
|
-
* const organizations = await getMeOrganizations({
|
|
1593
|
-
* baseUrl: "https://localhost:8090",
|
|
1594
|
-
* after: "",
|
|
1595
|
-
* before: "",
|
|
1596
|
-
* filter: "",
|
|
1597
|
-
* limit: 10,
|
|
1598
|
-
* recursive: false,
|
|
1599
|
-
* fetcher: async (url, config) => {
|
|
1600
|
-
* const response = await httpClient({
|
|
1601
|
-
* url,
|
|
1602
|
-
* method: config.method,
|
|
1603
|
-
* headers: config.headers,
|
|
1604
|
-
* ...config
|
|
1605
|
-
* });
|
|
1606
|
-
* // Convert axios-like response to fetch-like Response
|
|
1607
|
-
* return {
|
|
1608
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1609
|
-
* status: response.status,
|
|
1610
|
-
* statusText: response.statusText,
|
|
1611
|
-
* json: () => Promise.resolve(response.data),
|
|
1612
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1613
|
-
* } as Response;
|
|
1614
|
-
* }
|
|
1615
|
-
* });
|
|
1616
|
-
* console.log(organizations);
|
|
1617
|
-
* } catch (error) {
|
|
1618
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1619
|
-
* console.error('Failed to get organizations:', error.message);
|
|
1620
|
-
* }
|
|
1621
|
-
* }
|
|
1622
|
-
* ```
|
|
1623
|
-
*/
|
|
1624
|
-
const getMeOrganizations = async ({ baseUrl, after = "", authorizedAppName = "", before = "", filter = "", limit = 10, recursive = false, fetcher,...requestConfig }) => {
|
|
1625
|
-
try {
|
|
1626
|
-
new URL(baseUrl);
|
|
1627
|
-
} catch (error$1) {
|
|
1628
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "getMeOrganizations-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
1629
|
-
}
|
|
1630
|
-
const queryParams = new URLSearchParams(Object.fromEntries(Object.entries({
|
|
1631
|
-
after,
|
|
1632
|
-
authorizedAppName,
|
|
1633
|
-
before,
|
|
1634
|
-
filter,
|
|
1635
|
-
limit: limit.toString(),
|
|
1636
|
-
recursive: recursive.toString()
|
|
1637
|
-
}).filter(([, value]) => Boolean(value))));
|
|
1638
|
-
const fetchFn = fetcher || fetch;
|
|
1639
|
-
const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;
|
|
1640
|
-
const requestInit = {
|
|
1641
|
-
...requestConfig,
|
|
1642
|
-
headers: {
|
|
1643
|
-
Accept: "application/json",
|
|
1644
|
-
"Content-Type": "application/json",
|
|
1645
|
-
...requestConfig.headers
|
|
1646
|
-
},
|
|
1647
|
-
method: "GET"
|
|
1648
|
-
};
|
|
1649
|
-
try {
|
|
1650
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1651
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getMeOrganizations-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch associated organizations of the user");
|
|
1652
|
-
return (await response.json())["organizations"] || [];
|
|
1653
|
-
} catch (error$1) {
|
|
1654
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1655
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getMeOrganizations-NetworkError-001", "javascript", 0, "Network Error");
|
|
1656
|
-
}
|
|
1657
|
-
};
|
|
1658
|
-
var getMeOrganizations_default = getMeOrganizations;
|
|
1659
|
-
|
|
1660
|
-
//#endregion
|
|
1661
|
-
//#region src/api/getOrganization.ts
|
|
1662
|
-
/**
|
|
1663
|
-
* Retrieves detailed information for a specific organization.
|
|
1664
|
-
*
|
|
1665
|
-
* @param config - Configuration object containing baseUrl, organizationId, and request config.
|
|
1666
|
-
* @returns A promise that resolves with the organization details.
|
|
1667
|
-
* @example
|
|
1668
|
-
* ```typescript
|
|
1669
|
-
* // Using default fetch
|
|
1670
|
-
* try {
|
|
1671
|
-
* const organization = await getOrganization({
|
|
1672
|
-
* baseUrl: "https://localhost:8090",
|
|
1673
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
1674
|
-
* });
|
|
1675
|
-
* console.log(organization);
|
|
1676
|
-
* } catch (error) {
|
|
1677
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1678
|
-
* console.error('Failed to get organization:', error.message);
|
|
1679
|
-
* }
|
|
1680
|
-
* }
|
|
1681
|
-
* ```
|
|
1682
|
-
*
|
|
1683
|
-
* @example
|
|
1684
|
-
* ```typescript
|
|
1685
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1686
|
-
* try {
|
|
1687
|
-
* const organization = await getOrganization({
|
|
1688
|
-
* baseUrl: "https://localhost:8090",
|
|
1689
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1690
|
-
* fetcher: async (url, config) => {
|
|
1691
|
-
* const response = await httpClient({
|
|
1692
|
-
* url,
|
|
1693
|
-
* method: config.method,
|
|
1694
|
-
* headers: config.headers,
|
|
1695
|
-
* ...config
|
|
1696
|
-
* });
|
|
1697
|
-
* // Convert axios-like response to fetch-like Response
|
|
1698
|
-
* return {
|
|
1699
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1700
|
-
* status: response.status,
|
|
1701
|
-
* statusText: response.statusText,
|
|
1702
|
-
* json: () => Promise.resolve(response.data),
|
|
1703
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1704
|
-
* } as Response;
|
|
1705
|
-
* }
|
|
1706
|
-
* });
|
|
1707
|
-
* console.log(organization);
|
|
1708
|
-
* } catch (error) {
|
|
1709
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
1710
|
-
* console.error('Failed to get organization:', error.message);
|
|
1711
|
-
* }
|
|
1712
|
-
* }
|
|
1713
|
-
* ```
|
|
1714
|
-
*/
|
|
1715
|
-
const getOrganization = async ({ baseUrl, organizationId, fetcher,...requestConfig }) => {
|
|
1716
|
-
try {
|
|
1717
|
-
new URL(baseUrl);
|
|
1718
|
-
} catch (error$1) {
|
|
1719
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "getOrganization-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
1720
|
-
}
|
|
1721
|
-
if (!organizationId) throw new ThunderIDAPIError("Organization ID is required", "getOrganization-ValidationError-002", "javascript", 400, "Invalid Request");
|
|
1722
|
-
const fetchFn = fetcher || fetch;
|
|
1723
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
1724
|
-
const requestInit = {
|
|
1725
|
-
...requestConfig,
|
|
1726
|
-
headers: {
|
|
1727
|
-
Accept: "application/json",
|
|
1728
|
-
"Content-Type": "application/json",
|
|
1729
|
-
...requestConfig.headers
|
|
1730
|
-
},
|
|
1731
|
-
method: "GET"
|
|
1732
|
-
};
|
|
1733
|
-
try {
|
|
1734
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1735
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getOrganization-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch organization details");
|
|
1736
|
-
return await response.json();
|
|
1737
|
-
} catch (error$1) {
|
|
1738
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1739
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getOrganization-NetworkError-001", "javascript", 0, "Network Error");
|
|
1740
|
-
}
|
|
1741
|
-
};
|
|
1742
|
-
var getOrganization_default = getOrganization;
|
|
1743
|
-
|
|
1744
|
-
//#endregion
|
|
1745
|
-
//#region src/utils/isEmpty.ts
|
|
1746
|
-
/**
|
|
1747
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
1748
|
-
*
|
|
1749
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1750
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
1751
|
-
* in compliance with the License.
|
|
1752
|
-
* You may obtain a copy of the License at
|
|
1753
|
-
*
|
|
1754
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1755
|
-
*
|
|
1756
|
-
* Unless required by applicable law or agreed to in writing,
|
|
1757
|
-
* software distributed under the License is distributed on an
|
|
1758
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1759
|
-
* KIND, either express or implied. See the License for the
|
|
1760
|
-
* specific language governing permissions and limitations
|
|
1761
|
-
* under the License.
|
|
1762
|
-
*/
|
|
1763
|
-
/**
|
|
1764
|
-
* Checks if a value is considered empty.
|
|
1765
|
-
*
|
|
1766
|
-
* A value is considered empty if it is:
|
|
1767
|
-
* - null
|
|
1768
|
-
* - undefined
|
|
1769
|
-
* - empty string ("")
|
|
1770
|
-
* - string containing only whitespace characters
|
|
1771
|
-
* - empty array ([])
|
|
1772
|
-
* - empty object ({})
|
|
1773
|
-
*
|
|
1774
|
-
* @param value - The value to check
|
|
1775
|
-
* @returns true if the value is empty, false otherwise
|
|
1776
|
-
*
|
|
1777
|
-
* @example
|
|
1778
|
-
* ```typescript
|
|
1779
|
-
* isEmpty(null); // true
|
|
1780
|
-
* isEmpty(undefined); // true
|
|
1781
|
-
* isEmpty(""); // true
|
|
1782
|
-
* isEmpty(" "); // true
|
|
1783
|
-
* isEmpty("hello"); // false
|
|
1784
|
-
* isEmpty([]); // true
|
|
1785
|
-
* isEmpty([1, 2, 3]); // false
|
|
1786
|
-
* isEmpty({}); // true
|
|
1787
|
-
* isEmpty({ name: "John" }); // false
|
|
1788
|
-
* isEmpty(0); // false
|
|
1789
|
-
* isEmpty(false); // false
|
|
1790
|
-
* ```
|
|
1791
|
-
*/
|
|
1792
|
-
const isEmpty = (value) => {
|
|
1793
|
-
if (value === null || value === void 0) return true;
|
|
1794
|
-
if (typeof value === "string") return value.trim() === "";
|
|
1795
|
-
if (Array.isArray(value)) return value.length === 0;
|
|
1796
|
-
if (typeof value === "object" && value.constructor === Object) return Object.keys(value).length === 0;
|
|
1797
|
-
return false;
|
|
1798
|
-
};
|
|
1799
|
-
var isEmpty_default = isEmpty;
|
|
1800
|
-
|
|
1801
|
-
//#endregion
|
|
1802
|
-
//#region src/api/updateOrganization.ts
|
|
1803
|
-
/**
|
|
1804
|
-
* Updates the organization information using the Organizations Management API.
|
|
1805
|
-
*
|
|
1806
|
-
* @param config - Configuration object with baseUrl, organizationId, operations and optional request config.
|
|
1807
|
-
* @returns A promise that resolves with the updated organization information.
|
|
1808
|
-
* @example
|
|
1809
|
-
* ```typescript
|
|
1810
|
-
* // Using the helper function to create operations automatically
|
|
1811
|
-
* const operations = createPatchOperations({
|
|
1812
|
-
* name: "Updated Organization Name", // Will use REPLACE
|
|
1813
|
-
* description: "", // Will use REMOVE (empty string)
|
|
1814
|
-
* customField: "Some value" // Will use REPLACE
|
|
1815
|
-
* });
|
|
1816
|
-
*
|
|
1817
|
-
* await updateOrganization({
|
|
1818
|
-
* baseUrl: "https://localhost:8090",
|
|
1819
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1820
|
-
* operations
|
|
1821
|
-
* });
|
|
1822
|
-
*
|
|
1823
|
-
* // Or manually specify operations
|
|
1824
|
-
* await updateOrganization({
|
|
1825
|
-
* baseUrl: "https://localhost:8090",
|
|
1826
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1827
|
-
* operations: [
|
|
1828
|
-
* { operation: "REPLACE", path: "/name", value: "Updated Organization Name" },
|
|
1829
|
-
* { operation: "REMOVE", path: "/description" }
|
|
1830
|
-
* ]
|
|
1831
|
-
* });
|
|
1832
|
-
* ```
|
|
1833
|
-
*
|
|
1834
|
-
* @example
|
|
1835
|
-
* ```typescript
|
|
1836
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1837
|
-
* await updateOrganization({
|
|
1838
|
-
* baseUrl: "https://localhost:8090",
|
|
1839
|
-
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
1840
|
-
* operations: [
|
|
1841
|
-
* { operation: "REPLACE", path: "/name", value: "Updated Organization Name" }
|
|
1842
|
-
* ],
|
|
1843
|
-
* fetcher: async (url, config) => {
|
|
1844
|
-
* const response = await httpClient({
|
|
1845
|
-
* url,
|
|
1846
|
-
* method: config.method,
|
|
1847
|
-
* headers: config.headers,
|
|
1848
|
-
* data: config.body,
|
|
1849
|
-
* ...config
|
|
1850
|
-
* });
|
|
1851
|
-
* // Convert axios-like response to fetch-like Response
|
|
1852
|
-
* return {
|
|
1853
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1854
|
-
* status: response.status,
|
|
1855
|
-
* statusText: response.statusText,
|
|
1856
|
-
* json: () => Promise.resolve(response.data),
|
|
1857
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1858
|
-
* } as Response;
|
|
1859
|
-
* }
|
|
1860
|
-
* });
|
|
1861
|
-
* ```
|
|
1862
|
-
*/
|
|
1863
|
-
const updateOrganization = async ({ baseUrl, organizationId, operations, fetcher,...requestConfig }) => {
|
|
1864
|
-
try {
|
|
1865
|
-
new URL(baseUrl);
|
|
1866
|
-
} catch (error$1) {
|
|
1867
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "updateOrganization-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
1868
|
-
}
|
|
1869
|
-
if (!organizationId) throw new ThunderIDAPIError("Organization ID is required", "updateOrganization-ValidationError-002", "javascript", 400, "Invalid Request");
|
|
1870
|
-
if (!operations || !Array.isArray(operations) || operations.length === 0) throw new ThunderIDAPIError("Operations array is required and cannot be empty", "updateOrganization-ValidationError-003", "javascript", 400, "Invalid Request");
|
|
1871
|
-
const fetchFn = fetcher || fetch;
|
|
1872
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
1873
|
-
const requestInit = {
|
|
1874
|
-
...requestConfig,
|
|
1875
|
-
body: JSON.stringify(operations),
|
|
1876
|
-
headers: {
|
|
1877
|
-
Accept: "application/json",
|
|
1878
|
-
"Content-Type": "application/json",
|
|
1879
|
-
...requestConfig.headers
|
|
1880
|
-
},
|
|
1881
|
-
method: "PATCH"
|
|
1882
|
-
};
|
|
1883
|
-
try {
|
|
1884
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1885
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateOrganization-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update organization");
|
|
1886
|
-
return await response.json();
|
|
1887
|
-
} catch (error$1) {
|
|
1888
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1889
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "updateOrganization-NetworkError-001", "javascript", 0, "Network Error");
|
|
1890
|
-
}
|
|
1891
|
-
};
|
|
1892
|
-
/**
|
|
1893
|
-
* Helper function to convert field updates to patch operations format.
|
|
1894
|
-
* Uses REMOVE operation when the value is empty, otherwise uses REPLACE.
|
|
1895
|
-
*
|
|
1896
|
-
* @param payload - Object containing field updates
|
|
1897
|
-
* @returns Array of patch operations
|
|
1898
|
-
*/
|
|
1899
|
-
const createPatchOperations = (payload) => Object.entries(payload).map(([key, value]) => {
|
|
1900
|
-
if (isEmpty_default(value)) return {
|
|
1901
|
-
operation: "REMOVE",
|
|
1902
|
-
path: `/${key}`
|
|
1903
|
-
};
|
|
1904
|
-
return {
|
|
1905
|
-
operation: "REPLACE",
|
|
1906
|
-
path: `/${key}`,
|
|
1907
|
-
value
|
|
1908
|
-
};
|
|
1909
|
-
});
|
|
1910
|
-
var updateOrganization_default = updateOrganization;
|
|
1911
|
-
|
|
1912
|
-
//#endregion
|
|
1913
|
-
//#region src/api/updateMeProfile.ts
|
|
1914
|
-
/**
|
|
1915
|
-
* Updates the user profile information at the specified SCIM2 Me endpoint.
|
|
1916
|
-
*
|
|
1917
|
-
* @param config - Configuration object with URL, payload and optional request config.
|
|
1918
|
-
* @returns A promise that resolves with the updated user profile information.
|
|
1919
|
-
* @example
|
|
1920
|
-
* ```typescript
|
|
1921
|
-
* // Using default fetch
|
|
1922
|
-
* await updateMeProfile({
|
|
1923
|
-
* url: "https://localhost:8090/scim2/Me",
|
|
1924
|
-
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
|
|
1925
|
-
* });
|
|
1926
|
-
* ```
|
|
1927
|
-
*
|
|
1928
|
-
* @example
|
|
1929
|
-
* ```typescript
|
|
1930
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
1931
|
-
* await updateMeProfile({
|
|
1932
|
-
* url: "https://localhost:8090/scim2/Me",
|
|
1933
|
-
* payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
|
|
1934
|
-
* fetcher: async (url, config) => {
|
|
1935
|
-
* const response = await httpClient({
|
|
1936
|
-
* url,
|
|
1937
|
-
* method: config.method,
|
|
1938
|
-
* headers: config.headers,
|
|
1939
|
-
* data: config.body,
|
|
1940
|
-
* ...config
|
|
1941
|
-
* });
|
|
1942
|
-
* // Convert axios-like response to fetch-like Response
|
|
1943
|
-
* return {
|
|
1944
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
1945
|
-
* status: response.status,
|
|
1946
|
-
* statusText: response.statusText,
|
|
1947
|
-
* json: () => Promise.resolve(response.data),
|
|
1948
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
1949
|
-
* } as Response;
|
|
1950
|
-
* }
|
|
1951
|
-
* });
|
|
1952
|
-
* ```
|
|
1953
|
-
*/
|
|
1954
|
-
const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig }) => {
|
|
1955
|
-
try {
|
|
1956
|
-
new URL(url ?? baseUrl);
|
|
1957
|
-
} catch (error$1) {
|
|
1958
|
-
throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "updateMeProfile-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
|
|
1959
|
-
}
|
|
1960
|
-
const data = {
|
|
1961
|
-
Operations: [{
|
|
1962
|
-
op: "replace",
|
|
1963
|
-
value: payload
|
|
1964
|
-
}],
|
|
1965
|
-
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
|
|
1966
|
-
};
|
|
1967
|
-
const fetchFn = fetcher || fetch;
|
|
1968
|
-
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
1969
|
-
const requestInit = {
|
|
1970
|
-
method: "PATCH",
|
|
1971
|
-
...requestConfig,
|
|
1972
|
-
body: JSON.stringify(data),
|
|
1973
|
-
headers: {
|
|
1974
|
-
...requestConfig.headers,
|
|
1975
|
-
Accept: "application/json",
|
|
1976
|
-
"Content-Type": "application/scim+json"
|
|
1977
|
-
}
|
|
1978
|
-
};
|
|
1979
|
-
try {
|
|
1980
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
1981
|
-
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1982
|
-
return processUsername_default(await response.json());
|
|
1983
|
-
} catch (error$1) {
|
|
1984
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1985
|
-
throw new ThunderIDAPIError(error$1?.response?.data?.detail || "An error occurred while updating the user profile. Please try again.", "updateMeProfile-NetworkError-001", "javascript", error$1?.data?.status, "Network Error");
|
|
1986
|
-
}
|
|
1987
|
-
};
|
|
1988
|
-
var updateMeProfile_default = updateMeProfile;
|
|
1989
|
-
|
|
1990
|
-
//#endregion
|
|
1991
|
-
//#region src/utils/logger.ts
|
|
1992
|
-
const PREFIX = "⚡ ThunderID";
|
|
1993
|
-
/**
|
|
1994
|
-
* Default logger configuration
|
|
1995
|
-
*/
|
|
1996
|
-
const DEFAULT_CONFIG$1 = {
|
|
1997
|
-
level: "info",
|
|
1998
|
-
prefix: `${PREFIX}`,
|
|
1999
|
-
showLevel: true,
|
|
2000
|
-
timestamps: true
|
|
2001
|
-
};
|
|
2002
|
-
/**
|
|
2003
|
-
* Environment detection utilities
|
|
2004
|
-
*/
|
|
2005
|
-
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2006
|
-
const isNode = () => typeof process !== "undefined" && process.versions && process.versions.node;
|
|
2007
|
-
/**
|
|
2008
|
-
* Color codes for terminal output (Node.js)
|
|
2009
|
-
*/
|
|
2010
|
-
const COLORS = {
|
|
2011
|
-
blue: "\x1B[34m",
|
|
2012
|
-
bright: "\x1B[1m",
|
|
2013
|
-
cyan: "\x1B[36m",
|
|
2014
|
-
dim: "\x1B[2m",
|
|
2015
|
-
gray: "\x1B[90m",
|
|
2016
|
-
green: "\x1B[32m",
|
|
2017
|
-
magenta: "\x1B[35m",
|
|
2018
|
-
red: "\x1B[31m",
|
|
2019
|
-
reset: "\x1B[0m",
|
|
2020
|
-
white: "\x1B[37m",
|
|
2021
|
-
yellow: "\x1B[33m"
|
|
2022
|
-
};
|
|
2023
|
-
/**
|
|
2024
|
-
* Browser console styling
|
|
2025
|
-
*/
|
|
2026
|
-
const BROWSER_STYLES = {
|
|
2027
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
2028
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
2029
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
2030
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
2031
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
2032
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
2033
|
-
};
|
|
2034
|
-
const LOG_LEVEL_ORDER = {
|
|
2035
|
-
debug: 0,
|
|
2036
|
-
error: 3,
|
|
2037
|
-
info: 1,
|
|
2038
|
-
warn: 2
|
|
2039
|
-
};
|
|
2040
|
-
/**
|
|
2041
|
-
* Universal logger class that works in both browser and Node.js environments
|
|
2042
|
-
*/
|
|
2043
|
-
var Logger = class Logger {
|
|
2044
|
-
config;
|
|
2045
|
-
constructor(config = {}) {
|
|
2046
|
-
this.config = {
|
|
2047
|
-
...DEFAULT_CONFIG$1,
|
|
2048
|
-
...config
|
|
2049
|
-
};
|
|
2050
|
-
}
|
|
2051
|
-
/**
|
|
2052
|
-
* Update logger configuration
|
|
2053
|
-
*/
|
|
2054
|
-
configure(config) {
|
|
2055
|
-
this.config = {
|
|
2056
|
-
...this.config,
|
|
2057
|
-
...config
|
|
2058
|
-
};
|
|
2059
|
-
}
|
|
2060
|
-
/**
|
|
2061
|
-
* Get current configuration
|
|
2062
|
-
*/
|
|
2063
|
-
getConfig() {
|
|
2064
|
-
return { ...this.config };
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* Check if a log level should be output
|
|
2068
|
-
*/
|
|
2069
|
-
shouldLog(level) {
|
|
2070
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
2071
|
-
}
|
|
2072
|
-
/**
|
|
2073
|
-
* Get timestamp string
|
|
2074
|
-
*/
|
|
2075
|
-
static getTimestamp() {
|
|
2076
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
2077
|
-
}
|
|
2078
|
-
/**
|
|
2079
|
-
* Get log level string
|
|
2080
|
-
*/
|
|
2081
|
-
static getLevelString(level) {
|
|
2082
|
-
switch (level) {
|
|
2083
|
-
case "debug": return "DEBUG";
|
|
2084
|
-
case "info": return "INFO";
|
|
2085
|
-
case "warn": return "WARN";
|
|
2086
|
-
case "error": return "ERROR";
|
|
2087
|
-
default: return "UNKNOWN";
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
/**
|
|
2091
|
-
* Format message for Node.js terminal
|
|
2092
|
-
*/
|
|
2093
|
-
formatForNode(level, message) {
|
|
2094
|
-
const parts = [];
|
|
2095
|
-
if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
|
|
2096
|
-
if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
2097
|
-
if (this.config.showLevel) {
|
|
2098
|
-
const levelStr = Logger.getLevelString(level);
|
|
2099
|
-
let coloredLevel;
|
|
2100
|
-
switch (level) {
|
|
2101
|
-
case "debug":
|
|
2102
|
-
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
2103
|
-
break;
|
|
2104
|
-
case "info":
|
|
2105
|
-
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
2106
|
-
break;
|
|
2107
|
-
case "warn":
|
|
2108
|
-
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
2109
|
-
break;
|
|
2110
|
-
case "error":
|
|
2111
|
-
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
2112
|
-
break;
|
|
2113
|
-
default: coloredLevel = `[${levelStr}]`;
|
|
2114
|
-
}
|
|
2115
|
-
parts.push(coloredLevel);
|
|
2116
|
-
}
|
|
2117
|
-
parts.push(message);
|
|
2118
|
-
return parts.join(" ");
|
|
2119
|
-
}
|
|
2120
|
-
/**
|
|
2121
|
-
* Log message using appropriate method
|
|
2122
|
-
*/
|
|
2123
|
-
logMessage(level, message, ...args) {
|
|
2124
|
-
if (!this.shouldLog(level)) return;
|
|
2125
|
-
if (this.config.formatter) {
|
|
2126
|
-
this.config.formatter(level, message, ...args);
|
|
2127
|
-
return;
|
|
2128
|
-
}
|
|
2129
|
-
if (isBrowser()) this.logToBrowser(level, message, ...args);
|
|
2130
|
-
else if (isNode()) this.logToNode(level, message, ...args);
|
|
2131
|
-
else console.log(message, ...args);
|
|
2132
|
-
}
|
|
2133
|
-
/**
|
|
2134
|
-
* Log to browser console with styling
|
|
2135
|
-
*/
|
|
2136
|
-
logToBrowser(level, message, ...args) {
|
|
2137
|
-
const parts = [];
|
|
2138
|
-
const styles = [];
|
|
2139
|
-
if (this.config.timestamps) {
|
|
2140
|
-
parts.push(`%c[${Logger.getTimestamp()}]`);
|
|
2141
|
-
styles.push(BROWSER_STYLES.timestamp);
|
|
2142
|
-
}
|
|
2143
|
-
if (this.config.prefix) {
|
|
2144
|
-
parts.push(`%c${this.config.prefix}`);
|
|
2145
|
-
styles.push(BROWSER_STYLES.prefix);
|
|
2146
|
-
}
|
|
2147
|
-
if (this.config.showLevel) {
|
|
2148
|
-
const levelStr = Logger.getLevelString(level);
|
|
2149
|
-
parts.push(`%c[${levelStr}]`);
|
|
2150
|
-
switch (level) {
|
|
2151
|
-
case "debug":
|
|
2152
|
-
styles.push(BROWSER_STYLES.debug);
|
|
2153
|
-
break;
|
|
2154
|
-
case "info":
|
|
2155
|
-
styles.push(BROWSER_STYLES.info);
|
|
2156
|
-
break;
|
|
2157
|
-
case "warn":
|
|
2158
|
-
styles.push(BROWSER_STYLES.warn);
|
|
2159
|
-
break;
|
|
2160
|
-
case "error":
|
|
2161
|
-
styles.push(BROWSER_STYLES.error);
|
|
2162
|
-
break;
|
|
2163
|
-
default: styles.push("");
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
parts.push(`%c${message}`);
|
|
2167
|
-
styles.push("color: inherit; font-weight: normal;");
|
|
2168
|
-
const formattedMessage = parts.join(" ");
|
|
2169
|
-
switch (level) {
|
|
2170
|
-
case "debug":
|
|
2171
|
-
console.debug(formattedMessage, ...styles, ...args);
|
|
2172
|
-
break;
|
|
2173
|
-
case "info":
|
|
2174
|
-
console.info(formattedMessage, ...styles, ...args);
|
|
2175
|
-
break;
|
|
2176
|
-
case "warn":
|
|
2177
|
-
console.warn(formattedMessage, ...styles, ...args);
|
|
2178
|
-
break;
|
|
2179
|
-
case "error":
|
|
2180
|
-
console.error(formattedMessage, ...styles, ...args);
|
|
2181
|
-
break;
|
|
2182
|
-
default: console.log(formattedMessage, ...styles, ...args);
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
/**
|
|
2186
|
-
* Log to Node.js console
|
|
2187
|
-
*/
|
|
2188
|
-
logToNode(level, message, ...args) {
|
|
2189
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
2190
|
-
switch (level) {
|
|
2191
|
-
case "debug":
|
|
2192
|
-
console.debug(formattedMessage, ...args);
|
|
2193
|
-
break;
|
|
2194
|
-
case "info":
|
|
2195
|
-
console.info(formattedMessage, ...args);
|
|
2196
|
-
break;
|
|
2197
|
-
case "warn":
|
|
2198
|
-
console.warn(formattedMessage, ...args);
|
|
2199
|
-
break;
|
|
2200
|
-
case "error":
|
|
2201
|
-
console.error(formattedMessage, ...args);
|
|
2202
|
-
break;
|
|
2203
|
-
default: console.log(formattedMessage, ...args);
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
/**
|
|
2207
|
-
* Log debug message
|
|
2208
|
-
*/
|
|
2209
|
-
debug(message, ...args) {
|
|
2210
|
-
this.logMessage("debug", message, ...args);
|
|
2211
|
-
}
|
|
2212
|
-
/**
|
|
2213
|
-
* Log info message
|
|
2214
|
-
*/
|
|
2215
|
-
info(message, ...args) {
|
|
2216
|
-
this.logMessage("info", message, ...args);
|
|
2217
|
-
}
|
|
2218
|
-
/**
|
|
2219
|
-
* Log warning message
|
|
2220
|
-
*/
|
|
2221
|
-
warn(message, ...args) {
|
|
2222
|
-
this.logMessage("warn", message, ...args);
|
|
2223
|
-
}
|
|
2224
|
-
/**
|
|
2225
|
-
* Log error message
|
|
2226
|
-
*/
|
|
2227
|
-
error(message, ...args) {
|
|
2228
|
-
this.logMessage("error", message, ...args);
|
|
2229
|
-
}
|
|
2230
|
-
/**
|
|
2231
|
-
* Create a child logger with additional prefix
|
|
2232
|
-
*/
|
|
2233
|
-
child(prefix) {
|
|
2234
|
-
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
2235
|
-
return new Logger({
|
|
2236
|
-
...this.config,
|
|
2237
|
-
prefix: childPrefix
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
/**
|
|
2241
|
-
* Set log level
|
|
2242
|
-
*/
|
|
2243
|
-
setLevel(level) {
|
|
2244
|
-
this.config.level = level;
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* Get current log level
|
|
2248
|
-
*/
|
|
2249
|
-
getLevel() {
|
|
2250
|
-
return this.config.level;
|
|
2251
|
-
}
|
|
2252
|
-
};
|
|
2253
|
-
/**
|
|
2254
|
-
* Default logger instance
|
|
2255
|
-
*/
|
|
2256
|
-
const logger = new Logger();
|
|
2257
|
-
/**
|
|
2258
|
-
* Create a new logger instance with custom configuration
|
|
2259
|
-
*/
|
|
2260
|
-
const createLogger = (config) => new Logger(config);
|
|
2261
|
-
/**
|
|
2262
|
-
* Default export - global logger instance
|
|
2263
|
-
*/
|
|
2264
|
-
var logger_default = logger;
|
|
2265
|
-
/**
|
|
2266
|
-
* Named exports for convenience
|
|
2267
|
-
*/
|
|
2268
|
-
const debug = (message, ...args) => logger.debug(message, ...args);
|
|
2269
|
-
const info = (message, ...args) => logger.info(message, ...args);
|
|
2270
|
-
const warn = (message, ...args) => logger.warn(message, ...args);
|
|
2271
|
-
const error = (message, ...args) => logger.error(message, ...args);
|
|
2272
|
-
/**
|
|
2273
|
-
* Configure the default logger
|
|
2274
|
-
*/
|
|
2275
|
-
const configure = (config) => logger.configure(config);
|
|
2276
|
-
/**
|
|
2277
|
-
* Create component-specific loggers
|
|
2278
|
-
*/
|
|
2279
|
-
const createComponentLogger = (component) => logger.child(component);
|
|
2280
|
-
/**
|
|
2281
|
-
* Create package-specific logger
|
|
2282
|
-
*/
|
|
2283
|
-
const createPackageLogger = (packageName) => createLogger({
|
|
2284
|
-
level: "info",
|
|
2285
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
2286
|
-
showLevel: true,
|
|
2287
|
-
timestamps: true
|
|
2288
|
-
});
|
|
2289
|
-
/**
|
|
2290
|
-
* Create package component logger (package + component)
|
|
2291
|
-
*/
|
|
2292
|
-
const createPackageComponentLogger = (packageName, component) => {
|
|
2293
|
-
return createPackageLogger(packageName).child(component);
|
|
2294
|
-
};
|
|
2295
|
-
|
|
2296
|
-
//#endregion
|
|
2297
|
-
//#region src/api/getBrandingPreference.ts
|
|
2298
|
-
/**
|
|
2299
|
-
* Retrieves branding preference configuration.
|
|
2300
|
-
*
|
|
2301
|
-
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
2302
|
-
* @returns A promise that resolves with the branding preference information.
|
|
2303
|
-
* @example
|
|
2304
|
-
* ```typescript
|
|
2305
|
-
* // Using default fetch
|
|
2306
|
-
* try {
|
|
2307
|
-
* const response = await getBrandingPreference({
|
|
2308
|
-
* baseUrl: "https://localhost:8090",
|
|
2309
|
-
* locale: "en-US",
|
|
2310
|
-
* name: "my-branding",
|
|
2311
|
-
* type: "org"
|
|
2312
|
-
* });
|
|
2313
|
-
* console.log(response.theme);
|
|
2314
|
-
* } catch (error) {
|
|
2315
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
2316
|
-
* console.error('Failed to get branding preference:', error.message);
|
|
2317
|
-
* }
|
|
2318
|
-
* }
|
|
2319
|
-
* ```
|
|
2320
|
-
*
|
|
2321
|
-
* @example
|
|
2322
|
-
* ```typescript
|
|
2323
|
-
* // Using custom fetcher (e.g., axios-based httpClient)
|
|
2324
|
-
* try {
|
|
2325
|
-
* const response = await getBrandingPreference({
|
|
2326
|
-
* baseUrl: "https://localhost:8090",
|
|
2327
|
-
* locale: "en-US",
|
|
2328
|
-
* name: "my-branding",
|
|
2329
|
-
* type: "org",
|
|
2330
|
-
* fetcher: async (url, config) => {
|
|
2331
|
-
* const response = await httpClient({
|
|
2332
|
-
* url,
|
|
2333
|
-
* method: config.method,
|
|
2334
|
-
* headers: config.headers,
|
|
2335
|
-
* ...config
|
|
2336
|
-
* });
|
|
2337
|
-
* // Convert axios-like response to fetch-like Response
|
|
2338
|
-
* return {
|
|
2339
|
-
* ok: response.status >= 200 && response.status < 300,
|
|
2340
|
-
* status: response.status,
|
|
2341
|
-
* statusText: response.statusText,
|
|
2342
|
-
* json: () => Promise.resolve(response.data),
|
|
2343
|
-
* text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
|
|
2344
|
-
* } as Response;
|
|
2345
|
-
* }
|
|
2346
|
-
* });
|
|
2347
|
-
* console.log(response.theme);
|
|
2348
|
-
* } catch (error) {
|
|
2349
|
-
* if (error instanceof ThunderIDAPIError) {
|
|
2350
|
-
* console.error('Failed to get branding preference:', error.message);
|
|
2351
|
-
* }
|
|
2352
|
-
* }
|
|
2353
|
-
* ```
|
|
2354
|
-
*/
|
|
2355
|
-
const getBrandingPreference = async ({ baseUrl, locale, name, type, fetcher,...requestConfig }) => {
|
|
2356
|
-
try {
|
|
2357
|
-
new URL(baseUrl);
|
|
2358
|
-
} catch (error$1) {
|
|
2359
|
-
throw new ThunderIDAPIError(`Invalid base URL provided. ${error$1?.toString()}`, "getBrandingPreference-ValidationError-001", "javascript", 400, "The provided `baseUrl` does not adhere to the URL schema.");
|
|
2360
|
-
}
|
|
2361
|
-
const queryParams = new URLSearchParams(Object.fromEntries(Object.entries({
|
|
2362
|
-
locale: locale || "",
|
|
2363
|
-
name: name || "",
|
|
2364
|
-
type: type || ""
|
|
2365
|
-
}).filter(([, value]) => Boolean(value))));
|
|
2366
|
-
const fetchFn = fetcher || fetch;
|
|
2367
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2368
|
-
const requestInit = {
|
|
2369
|
-
...requestConfig,
|
|
2370
|
-
headers: {
|
|
2371
|
-
Accept: "application/json",
|
|
2372
|
-
"Content-Type": "application/json",
|
|
2373
|
-
...requestConfig.headers
|
|
2374
|
-
},
|
|
2375
|
-
method: "GET"
|
|
2376
|
-
};
|
|
2377
|
-
try {
|
|
2378
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2379
|
-
if (!response?.ok) {
|
|
2380
|
-
const errorText = await response.text();
|
|
2381
|
-
let errorDescription;
|
|
2382
|
-
try {
|
|
2383
|
-
const errorBody = JSON.parse(errorText);
|
|
2384
|
-
errorDescription = errorBody?.description || errorBody?.message || errorText;
|
|
2385
|
-
} catch {
|
|
2386
|
-
errorDescription = errorText;
|
|
2387
|
-
}
|
|
2388
|
-
logger_default.warn(`[BrandingError] ${errorDescription} To resolve this issue, please configure branding preferences in the ThunderID console. If you want to suppress this warning and stop fetching branding preferences, set \`<ThunderIDProvider>\` -> \`preferences\` -> \`theme\` -> \`inheritFromBranding\` to false.`);
|
|
2389
|
-
throw new ThunderIDAPIError(errorText, "getBrandingPreference-ResponseError-001", "javascript", response.status, response.statusText, "Failed to get branding preference");
|
|
2390
|
-
}
|
|
2391
|
-
return await response.json();
|
|
2392
|
-
} catch (error$1) {
|
|
2393
|
-
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
2394
|
-
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getBrandingPreference-NetworkError-001", "javascript", 0, "Network Error");
|
|
2395
|
-
}
|
|
2396
|
-
};
|
|
2397
|
-
var getBrandingPreference_default = getBrandingPreference;
|
|
2398
|
-
|
|
2399
|
-
//#endregion
|
|
2400
|
-
//#region src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
2401
|
-
/**
|
|
2402
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
2403
|
-
*
|
|
2404
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
2405
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
2406
|
-
* in compliance with the License.
|
|
2407
|
-
* You may obtain a copy of the License at
|
|
2408
|
-
*
|
|
2409
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2410
|
-
*
|
|
2411
|
-
* Unless required by applicable law or agreed to in writing,
|
|
2412
|
-
* software distributed under the License is distributed on an
|
|
2413
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2414
|
-
* KIND, either express or implied. See the License for the
|
|
2415
|
-
* specific language governing permissions and limitations
|
|
2416
|
-
* under the License.
|
|
2417
|
-
*/
|
|
2418
|
-
/**
|
|
2419
|
-
* Constants representing Application Native Authentication related configurations and constants.
|
|
2420
|
-
*/
|
|
2421
|
-
const ApplicationNativeAuthenticationConstants = { SupportedAuthenticators: {
|
|
2422
|
-
EmailOtp: "ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
2423
|
-
Facebook: "RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r",
|
|
2424
|
-
GitHub: "R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI",
|
|
2425
|
-
Google: "R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl",
|
|
2426
|
-
IdentifierFirst: "SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM",
|
|
2427
|
-
LinkedIn: "TGlua2VkSW5PSURDOkxpbmtlZElu",
|
|
2428
|
-
MagicLink: "TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA",
|
|
2429
|
-
Microsoft: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0",
|
|
2430
|
-
Passkey: "RklET0F1dGhlbnRpY2F0b3I6TE9DQUw",
|
|
2431
|
-
PushNotification: "cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA",
|
|
2432
|
-
SignInWithEthereum: "T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt",
|
|
2433
|
-
SmsOtp: "c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM",
|
|
2434
|
-
Totp: "dG90cDpMT0NBTA",
|
|
2435
|
-
UsernamePassword: "QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM"
|
|
2436
|
-
} };
|
|
2437
|
-
var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
|
|
2438
|
-
|
|
2439
|
-
//#endregion
|
|
2440
|
-
//#region src/constants/ScopeConstants.ts
|
|
2441
|
-
/**
|
|
2442
|
-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
2443
|
-
*
|
|
2444
|
-
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
2445
|
-
* Version 2.0 (the "License"); you may not use this file except
|
|
2446
|
-
* in compliance with the License.
|
|
2447
|
-
* You may obtain a copy of the License at
|
|
2448
|
-
*
|
|
2449
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2450
|
-
*
|
|
2451
|
-
* Unless required by applicable law or agreed to in writing,
|
|
2452
|
-
* software distributed under the License is distributed on an
|
|
2453
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2454
|
-
* KIND, either express or implied. See the License for the
|
|
2455
|
-
* specific language governing permissions and limitations
|
|
2456
|
-
* under the License.
|
|
2457
|
-
*/
|
|
2458
|
-
/**
|
|
2459
|
-
* Constants for OAuth 2.0 and OpenID Connect scopes.
|
|
2460
|
-
* These scopes define the level of access that the client application
|
|
2461
|
-
* is requesting from the authorization server.
|
|
2462
|
-
*
|
|
2463
|
-
* @remarks
|
|
2464
|
-
* Scopes are space-separated strings that represent different permissions.
|
|
2465
|
-
* The 'openid' scope is required for OpenID Connect flows, while other
|
|
2466
|
-
* scopes provide access to different resources or user information.
|
|
1479
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
1480
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
1481
|
+
* in compliance with the License.
|
|
1482
|
+
* You may obtain a copy of the License at
|
|
1483
|
+
*
|
|
1484
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1485
|
+
*
|
|
1486
|
+
* Unless required by applicable law or agreed to in writing,
|
|
1487
|
+
* software distributed under the License is distributed on an
|
|
1488
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1489
|
+
* KIND, either express or implied. See the License for the
|
|
1490
|
+
* specific language governing permissions and limitations
|
|
1491
|
+
* under the License.
|
|
1492
|
+
*/
|
|
1493
|
+
/**
|
|
1494
|
+
* Constants for OAuth 2.0 and OpenID Connect scopes.
|
|
1495
|
+
* These scopes define the level of access that the client application
|
|
1496
|
+
* is requesting from the authorization server.
|
|
1497
|
+
*
|
|
1498
|
+
* @remarks
|
|
1499
|
+
* Scopes are space-separated strings that represent different permissions.
|
|
1500
|
+
* The 'openid' scope is required for OpenID Connect flows, while other
|
|
1501
|
+
* scopes provide access to different resources or user information.
|
|
2467
1502
|
*
|
|
2468
1503
|
* @example
|
|
2469
1504
|
* ```typescript
|
|
@@ -2935,51 +1970,357 @@ var DefaultCrypto = class {
|
|
|
2935
1970
|
const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
|
|
2936
1971
|
return new Uint8Array(hashBuffer);
|
|
2937
1972
|
}
|
|
2938
|
-
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
2939
|
-
const key = await jose.importJWK(jwk);
|
|
2940
|
-
await jose.jwtVerify(idToken, key, {
|
|
2941
|
-
algorithms,
|
|
2942
|
-
audience: [clientId],
|
|
2943
|
-
clockTolerance,
|
|
2944
|
-
issuer: validateJwtIssuer ? issuer : void 0,
|
|
2945
|
-
subject
|
|
2946
|
-
});
|
|
2947
|
-
return true;
|
|
1973
|
+
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
1974
|
+
const key = await jose.importJWK(jwk);
|
|
1975
|
+
await jose.jwtVerify(idToken, key, {
|
|
1976
|
+
algorithms,
|
|
1977
|
+
audience: [clientId],
|
|
1978
|
+
clockTolerance,
|
|
1979
|
+
issuer: validateJwtIssuer ? issuer : void 0,
|
|
1980
|
+
subject
|
|
1981
|
+
});
|
|
1982
|
+
return true;
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
|
|
1986
|
+
//#endregion
|
|
1987
|
+
//#region src/models/store.ts
|
|
1988
|
+
/**
|
|
1989
|
+
* Enum representing different types of data stores used in the application.
|
|
1990
|
+
*/
|
|
1991
|
+
let Stores = /* @__PURE__ */ function(Stores$1) {
|
|
1992
|
+
/**
|
|
1993
|
+
* Store for configuration data that defines the application's behavior and settings.
|
|
1994
|
+
*/
|
|
1995
|
+
Stores$1["ConfigData"] = "config_data";
|
|
1996
|
+
/**
|
|
1997
|
+
* Store for OpenID Connect provider metadata, including endpoints and configuration.
|
|
1998
|
+
*/
|
|
1999
|
+
Stores$1["OIDCProviderMetaData"] = "oidc_provider_meta_data";
|
|
2000
|
+
/**
|
|
2001
|
+
* Store for persisted data that needs to be retained across sessions and application restarts.
|
|
2002
|
+
*/
|
|
2003
|
+
Stores$1["PersistedData"] = "persisted_data";
|
|
2004
|
+
/**
|
|
2005
|
+
* Store for user session-related data like tokens and authentication state.
|
|
2006
|
+
*/
|
|
2007
|
+
Stores$1["SessionData"] = "session_data";
|
|
2008
|
+
/**
|
|
2009
|
+
* Store for temporary data that needs to persist only for a short duration.
|
|
2010
|
+
*/
|
|
2011
|
+
Stores$1["TemporaryData"] = "temporary_data";
|
|
2012
|
+
/**
|
|
2013
|
+
* Store for data that leverages local storage if available, falling back to the configured storage.
|
|
2014
|
+
*/
|
|
2015
|
+
Stores$1["HybridData"] = "hybrid_data";
|
|
2016
|
+
return Stores$1;
|
|
2017
|
+
}({});
|
|
2018
|
+
|
|
2019
|
+
//#endregion
|
|
2020
|
+
//#region src/utils/logger.ts
|
|
2021
|
+
const PREFIX = "⚡ ThunderID";
|
|
2022
|
+
/**
|
|
2023
|
+
* Default logger configuration
|
|
2024
|
+
*/
|
|
2025
|
+
const DEFAULT_CONFIG$1 = {
|
|
2026
|
+
level: "info",
|
|
2027
|
+
prefix: `${PREFIX}`,
|
|
2028
|
+
showLevel: true,
|
|
2029
|
+
timestamps: true
|
|
2030
|
+
};
|
|
2031
|
+
/**
|
|
2032
|
+
* Environment detection utilities
|
|
2033
|
+
*/
|
|
2034
|
+
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2035
|
+
const isNode = () => typeof process !== "undefined" && process.versions && process.versions.node;
|
|
2036
|
+
/**
|
|
2037
|
+
* Color codes for terminal output (Node.js)
|
|
2038
|
+
*/
|
|
2039
|
+
const COLORS = {
|
|
2040
|
+
blue: "\x1B[34m",
|
|
2041
|
+
bright: "\x1B[1m",
|
|
2042
|
+
cyan: "\x1B[36m",
|
|
2043
|
+
dim: "\x1B[2m",
|
|
2044
|
+
gray: "\x1B[90m",
|
|
2045
|
+
green: "\x1B[32m",
|
|
2046
|
+
magenta: "\x1B[35m",
|
|
2047
|
+
red: "\x1B[31m",
|
|
2048
|
+
reset: "\x1B[0m",
|
|
2049
|
+
white: "\x1B[37m",
|
|
2050
|
+
yellow: "\x1B[33m"
|
|
2051
|
+
};
|
|
2052
|
+
/**
|
|
2053
|
+
* Browser console styling
|
|
2054
|
+
*/
|
|
2055
|
+
const BROWSER_STYLES = {
|
|
2056
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
2057
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
2058
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
2059
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
2060
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
2061
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
2062
|
+
};
|
|
2063
|
+
const LOG_LEVEL_ORDER = {
|
|
2064
|
+
debug: 0,
|
|
2065
|
+
error: 3,
|
|
2066
|
+
info: 1,
|
|
2067
|
+
warn: 2
|
|
2068
|
+
};
|
|
2069
|
+
/**
|
|
2070
|
+
* Universal logger class that works in both browser and Node.js environments
|
|
2071
|
+
*/
|
|
2072
|
+
var Logger = class Logger {
|
|
2073
|
+
config;
|
|
2074
|
+
constructor(config = {}) {
|
|
2075
|
+
this.config = {
|
|
2076
|
+
...DEFAULT_CONFIG$1,
|
|
2077
|
+
...config
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
/**
|
|
2081
|
+
* Update logger configuration
|
|
2082
|
+
*/
|
|
2083
|
+
configure(config) {
|
|
2084
|
+
this.config = {
|
|
2085
|
+
...this.config,
|
|
2086
|
+
...config
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Get current configuration
|
|
2091
|
+
*/
|
|
2092
|
+
getConfig() {
|
|
2093
|
+
return { ...this.config };
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Check if a log level should be output
|
|
2097
|
+
*/
|
|
2098
|
+
shouldLog(level) {
|
|
2099
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Get timestamp string
|
|
2103
|
+
*/
|
|
2104
|
+
static getTimestamp() {
|
|
2105
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Get log level string
|
|
2109
|
+
*/
|
|
2110
|
+
static getLevelString(level) {
|
|
2111
|
+
switch (level) {
|
|
2112
|
+
case "debug": return "DEBUG";
|
|
2113
|
+
case "info": return "INFO";
|
|
2114
|
+
case "warn": return "WARN";
|
|
2115
|
+
case "error": return "ERROR";
|
|
2116
|
+
default: return "UNKNOWN";
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Format message for Node.js terminal
|
|
2121
|
+
*/
|
|
2122
|
+
formatForNode(level, message) {
|
|
2123
|
+
const parts = [];
|
|
2124
|
+
if (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);
|
|
2125
|
+
if (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
2126
|
+
if (this.config.showLevel) {
|
|
2127
|
+
const levelStr = Logger.getLevelString(level);
|
|
2128
|
+
let coloredLevel;
|
|
2129
|
+
switch (level) {
|
|
2130
|
+
case "debug":
|
|
2131
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
2132
|
+
break;
|
|
2133
|
+
case "info":
|
|
2134
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
2135
|
+
break;
|
|
2136
|
+
case "warn":
|
|
2137
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
2138
|
+
break;
|
|
2139
|
+
case "error":
|
|
2140
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
2141
|
+
break;
|
|
2142
|
+
default: coloredLevel = `[${levelStr}]`;
|
|
2143
|
+
}
|
|
2144
|
+
parts.push(coloredLevel);
|
|
2145
|
+
}
|
|
2146
|
+
parts.push(message);
|
|
2147
|
+
return parts.join(" ");
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Log message using appropriate method
|
|
2151
|
+
*/
|
|
2152
|
+
logMessage(level, message, ...args) {
|
|
2153
|
+
if (!this.shouldLog(level)) return;
|
|
2154
|
+
if (this.config.formatter) {
|
|
2155
|
+
this.config.formatter(level, message, ...args);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
if (isBrowser()) this.logToBrowser(level, message, ...args);
|
|
2159
|
+
else if (isNode()) this.logToNode(level, message, ...args);
|
|
2160
|
+
else console.log(message, ...args);
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Log to browser console with styling
|
|
2164
|
+
*/
|
|
2165
|
+
logToBrowser(level, message, ...args) {
|
|
2166
|
+
const parts = [];
|
|
2167
|
+
const styles = [];
|
|
2168
|
+
if (this.config.timestamps) {
|
|
2169
|
+
parts.push(`%c[${Logger.getTimestamp()}]`);
|
|
2170
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
2171
|
+
}
|
|
2172
|
+
if (this.config.prefix) {
|
|
2173
|
+
parts.push(`%c${this.config.prefix}`);
|
|
2174
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
2175
|
+
}
|
|
2176
|
+
if (this.config.showLevel) {
|
|
2177
|
+
const levelStr = Logger.getLevelString(level);
|
|
2178
|
+
parts.push(`%c[${levelStr}]`);
|
|
2179
|
+
switch (level) {
|
|
2180
|
+
case "debug":
|
|
2181
|
+
styles.push(BROWSER_STYLES.debug);
|
|
2182
|
+
break;
|
|
2183
|
+
case "info":
|
|
2184
|
+
styles.push(BROWSER_STYLES.info);
|
|
2185
|
+
break;
|
|
2186
|
+
case "warn":
|
|
2187
|
+
styles.push(BROWSER_STYLES.warn);
|
|
2188
|
+
break;
|
|
2189
|
+
case "error":
|
|
2190
|
+
styles.push(BROWSER_STYLES.error);
|
|
2191
|
+
break;
|
|
2192
|
+
default: styles.push("");
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
parts.push(`%c${message}`);
|
|
2196
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
2197
|
+
const formattedMessage = parts.join(" ");
|
|
2198
|
+
switch (level) {
|
|
2199
|
+
case "debug":
|
|
2200
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
2201
|
+
break;
|
|
2202
|
+
case "info":
|
|
2203
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
2204
|
+
break;
|
|
2205
|
+
case "warn":
|
|
2206
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
2207
|
+
break;
|
|
2208
|
+
case "error":
|
|
2209
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
2210
|
+
break;
|
|
2211
|
+
default: console.log(formattedMessage, ...styles, ...args);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
/**
|
|
2215
|
+
* Log to Node.js console
|
|
2216
|
+
*/
|
|
2217
|
+
logToNode(level, message, ...args) {
|
|
2218
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
2219
|
+
switch (level) {
|
|
2220
|
+
case "debug":
|
|
2221
|
+
console.debug(formattedMessage, ...args);
|
|
2222
|
+
break;
|
|
2223
|
+
case "info":
|
|
2224
|
+
console.info(formattedMessage, ...args);
|
|
2225
|
+
break;
|
|
2226
|
+
case "warn":
|
|
2227
|
+
console.warn(formattedMessage, ...args);
|
|
2228
|
+
break;
|
|
2229
|
+
case "error":
|
|
2230
|
+
console.error(formattedMessage, ...args);
|
|
2231
|
+
break;
|
|
2232
|
+
default: console.log(formattedMessage, ...args);
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Log debug message
|
|
2237
|
+
*/
|
|
2238
|
+
debug(message, ...args) {
|
|
2239
|
+
this.logMessage("debug", message, ...args);
|
|
2948
2240
|
}
|
|
2949
|
-
};
|
|
2950
|
-
|
|
2951
|
-
//#endregion
|
|
2952
|
-
//#region src/models/store.ts
|
|
2953
|
-
/**
|
|
2954
|
-
* Enum representing different types of data stores used in the application.
|
|
2955
|
-
*/
|
|
2956
|
-
let Stores = /* @__PURE__ */ function(Stores$1) {
|
|
2957
2241
|
/**
|
|
2958
|
-
*
|
|
2242
|
+
* Log info message
|
|
2959
2243
|
*/
|
|
2960
|
-
|
|
2244
|
+
info(message, ...args) {
|
|
2245
|
+
this.logMessage("info", message, ...args);
|
|
2246
|
+
}
|
|
2961
2247
|
/**
|
|
2962
|
-
*
|
|
2248
|
+
* Log warning message
|
|
2963
2249
|
*/
|
|
2964
|
-
|
|
2250
|
+
warn(message, ...args) {
|
|
2251
|
+
this.logMessage("warn", message, ...args);
|
|
2252
|
+
}
|
|
2965
2253
|
/**
|
|
2966
|
-
*
|
|
2254
|
+
* Log error message
|
|
2967
2255
|
*/
|
|
2968
|
-
|
|
2256
|
+
error(message, ...args) {
|
|
2257
|
+
this.logMessage("error", message, ...args);
|
|
2258
|
+
}
|
|
2969
2259
|
/**
|
|
2970
|
-
*
|
|
2260
|
+
* Create a child logger with additional prefix
|
|
2971
2261
|
*/
|
|
2972
|
-
|
|
2262
|
+
child(prefix) {
|
|
2263
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
2264
|
+
return new Logger({
|
|
2265
|
+
...this.config,
|
|
2266
|
+
prefix: childPrefix
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
2973
2269
|
/**
|
|
2974
|
-
*
|
|
2270
|
+
* Set log level
|
|
2975
2271
|
*/
|
|
2976
|
-
|
|
2272
|
+
setLevel(level) {
|
|
2273
|
+
this.config.level = level;
|
|
2274
|
+
}
|
|
2977
2275
|
/**
|
|
2978
|
-
*
|
|
2276
|
+
* Get current log level
|
|
2979
2277
|
*/
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
}
|
|
2278
|
+
getLevel() {
|
|
2279
|
+
return this.config.level;
|
|
2280
|
+
}
|
|
2281
|
+
};
|
|
2282
|
+
/**
|
|
2283
|
+
* Default logger instance
|
|
2284
|
+
*/
|
|
2285
|
+
const logger = new Logger();
|
|
2286
|
+
/**
|
|
2287
|
+
* Create a new logger instance with custom configuration
|
|
2288
|
+
*/
|
|
2289
|
+
const createLogger = (config) => new Logger(config);
|
|
2290
|
+
/**
|
|
2291
|
+
* Default export - global logger instance
|
|
2292
|
+
*/
|
|
2293
|
+
var logger_default = logger;
|
|
2294
|
+
/**
|
|
2295
|
+
* Named exports for convenience
|
|
2296
|
+
*/
|
|
2297
|
+
const debug = (message, ...args) => logger.debug(message, ...args);
|
|
2298
|
+
const info = (message, ...args) => logger.info(message, ...args);
|
|
2299
|
+
const warn = (message, ...args) => logger.warn(message, ...args);
|
|
2300
|
+
const error = (message, ...args) => logger.error(message, ...args);
|
|
2301
|
+
/**
|
|
2302
|
+
* Configure the default logger
|
|
2303
|
+
*/
|
|
2304
|
+
const configure = (config) => logger.configure(config);
|
|
2305
|
+
/**
|
|
2306
|
+
* Create component-specific loggers
|
|
2307
|
+
*/
|
|
2308
|
+
const createComponentLogger = (component) => logger.child(component);
|
|
2309
|
+
/**
|
|
2310
|
+
* Create package-specific logger
|
|
2311
|
+
*/
|
|
2312
|
+
const createPackageLogger = (packageName) => createLogger({
|
|
2313
|
+
level: "info",
|
|
2314
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
2315
|
+
showLevel: true,
|
|
2316
|
+
timestamps: true
|
|
2317
|
+
});
|
|
2318
|
+
/**
|
|
2319
|
+
* Create package component logger (package + component)
|
|
2320
|
+
*/
|
|
2321
|
+
const createPackageComponentLogger = (packageName, component) => {
|
|
2322
|
+
return createPackageLogger(packageName).child(component);
|
|
2323
|
+
};
|
|
2983
2324
|
|
|
2984
2325
|
//#endregion
|
|
2985
2326
|
//#region src/StorageManager.ts
|
|
@@ -3925,18 +3266,6 @@ var ThunderIDJavaScriptClient = class {
|
|
|
3925
3266
|
recover() {
|
|
3926
3267
|
throw new Error("Method not implemented.");
|
|
3927
3268
|
}
|
|
3928
|
-
switchOrganization(_organization, _sessionId) {
|
|
3929
|
-
throw new Error("Method not implemented.");
|
|
3930
|
-
}
|
|
3931
|
-
getCurrentOrganization(_sessionId) {
|
|
3932
|
-
throw new Error("Method not implemented.");
|
|
3933
|
-
}
|
|
3934
|
-
getAllOrganizations(_options, _sessionId) {
|
|
3935
|
-
throw new Error("Method not implemented.");
|
|
3936
|
-
}
|
|
3937
|
-
getMyOrganizations(_options, _sessionId) {
|
|
3938
|
-
throw new Error("Method not implemented.");
|
|
3939
|
-
}
|
|
3940
3269
|
getUserProfile(_options) {
|
|
3941
3270
|
throw new Error("Method not implemented.");
|
|
3942
3271
|
}
|
|
@@ -4971,50 +4300,6 @@ const formatDate = (dateString) => {
|
|
|
4971
4300
|
};
|
|
4972
4301
|
var formatDate_default = formatDate;
|
|
4973
4302
|
|
|
4974
|
-
//#endregion
|
|
4975
|
-
//#region src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
4976
|
-
/**
|
|
4977
|
-
* Extracts the organization handle from a ThunderID base URL.
|
|
4978
|
-
*
|
|
4979
|
-
* Parses URLs following the `/t/{orgHandle}` pattern.
|
|
4980
|
-
*
|
|
4981
|
-
* @param baseUrl - The base URL of the ThunderID identity server
|
|
4982
|
-
* @returns The extracted organization handle
|
|
4983
|
-
* @throws {ThunderIDRuntimeError} When the URL doesn't match the expected ThunderID pattern,
|
|
4984
|
-
* indicating a custom domain is configured and organizationHandle must be provided explicitly
|
|
4985
|
-
*
|
|
4986
|
-
* @example
|
|
4987
|
-
* ```typescript
|
|
4988
|
-
* const handle = deriveOrganizationHandleFromBaseUrl('https://localhost:8090/t/dxlab');
|
|
4989
|
-
* // Returns: 'dxlab'
|
|
4990
|
-
*
|
|
4991
|
-
* // Custom domain - returns empty string with a warning
|
|
4992
|
-
* const handle2 = deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');
|
|
4993
|
-
* // Returns: '' and logs a warning
|
|
4994
|
-
* ```
|
|
4995
|
-
*/
|
|
4996
|
-
const deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
4997
|
-
if (!baseUrl) throw new ThunderIDRuntimeError("Base URL is required to derive organization handle.", "javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001", "javascript", "A valid base URL must be provided to extract the organization handle.");
|
|
4998
|
-
let parsedUrl;
|
|
4999
|
-
try {
|
|
5000
|
-
parsedUrl = new URL(baseUrl);
|
|
5001
|
-
} catch (error$1) {
|
|
5002
|
-
throw new ThunderIDRuntimeError(`Invalid base URL format: ${baseUrl}`, "javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002", "javascript", "The provided base URL does not conform to valid URL syntax.");
|
|
5003
|
-
}
|
|
5004
|
-
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
5005
|
-
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
5006
|
-
logger_default.warn(new ThunderIDRuntimeError("Organization handle is required since a custom domain is configured.", "javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002", "javascript", "The provided base URL does not follow the expected URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration.").toString());
|
|
5007
|
-
return "";
|
|
5008
|
-
}
|
|
5009
|
-
const organizationHandle = pathSegments[1];
|
|
5010
|
-
if (!organizationHandle || organizationHandle.trim().length === 0) {
|
|
5011
|
-
logger_default.warn(new ThunderIDRuntimeError("Organization handle is required since a custom domain is configured.", "javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003", "javascript", "The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration.").toString());
|
|
5012
|
-
return "";
|
|
5013
|
-
}
|
|
5014
|
-
return organizationHandle;
|
|
5015
|
-
};
|
|
5016
|
-
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
5017
|
-
|
|
5018
4303
|
//#endregion
|
|
5019
4304
|
//#region src/utils/isRecognizedBaseUrlPattern.ts
|
|
5020
4305
|
/**
|
|
@@ -5419,6 +4704,63 @@ const getRedirectBasedSignUpUrl = (config) => {
|
|
|
5419
4704
|
};
|
|
5420
4705
|
var getRedirectBasedSignUpUrl_default = getRedirectBasedSignUpUrl;
|
|
5421
4706
|
|
|
4707
|
+
//#endregion
|
|
4708
|
+
//#region src/utils/isEmpty.ts
|
|
4709
|
+
/**
|
|
4710
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
4711
|
+
*
|
|
4712
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
4713
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
4714
|
+
* in compliance with the License.
|
|
4715
|
+
* You may obtain a copy of the License at
|
|
4716
|
+
*
|
|
4717
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4718
|
+
*
|
|
4719
|
+
* Unless required by applicable law or agreed to in writing,
|
|
4720
|
+
* software distributed under the License is distributed on an
|
|
4721
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
4722
|
+
* KIND, either express or implied. See the License for the
|
|
4723
|
+
* specific language governing permissions and limitations
|
|
4724
|
+
* under the License.
|
|
4725
|
+
*/
|
|
4726
|
+
/**
|
|
4727
|
+
* Checks if a value is considered empty.
|
|
4728
|
+
*
|
|
4729
|
+
* A value is considered empty if it is:
|
|
4730
|
+
* - null
|
|
4731
|
+
* - undefined
|
|
4732
|
+
* - empty string ("")
|
|
4733
|
+
* - string containing only whitespace characters
|
|
4734
|
+
* - empty array ([])
|
|
4735
|
+
* - empty object ({})
|
|
4736
|
+
*
|
|
4737
|
+
* @param value - The value to check
|
|
4738
|
+
* @returns true if the value is empty, false otherwise
|
|
4739
|
+
*
|
|
4740
|
+
* @example
|
|
4741
|
+
* ```typescript
|
|
4742
|
+
* isEmpty(null); // true
|
|
4743
|
+
* isEmpty(undefined); // true
|
|
4744
|
+
* isEmpty(""); // true
|
|
4745
|
+
* isEmpty(" "); // true
|
|
4746
|
+
* isEmpty("hello"); // false
|
|
4747
|
+
* isEmpty([]); // true
|
|
4748
|
+
* isEmpty([1, 2, 3]); // false
|
|
4749
|
+
* isEmpty({}); // true
|
|
4750
|
+
* isEmpty({ name: "John" }); // false
|
|
4751
|
+
* isEmpty(0); // false
|
|
4752
|
+
* isEmpty(false); // false
|
|
4753
|
+
* ```
|
|
4754
|
+
*/
|
|
4755
|
+
const isEmpty = (value) => {
|
|
4756
|
+
if (value === null || value === void 0) return true;
|
|
4757
|
+
if (typeof value === "string") return value.trim() === "";
|
|
4758
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
4759
|
+
if (typeof value === "object" && value.constructor === Object) return Object.keys(value).length === 0;
|
|
4760
|
+
return false;
|
|
4761
|
+
};
|
|
4762
|
+
var isEmpty_default = isEmpty;
|
|
4763
|
+
|
|
5422
4764
|
//#endregion
|
|
5423
4765
|
//#region src/utils/isEmojiUri.ts
|
|
5424
4766
|
/**
|
|
@@ -5904,149 +5246,6 @@ var buildValidatorFromRules_default = buildValidatorFromRules;
|
|
|
5904
5246
|
const withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
5905
5247
|
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
5906
5248
|
|
|
5907
|
-
//#endregion
|
|
5908
|
-
//#region src/utils/transformBrandingPreferenceToTheme.ts
|
|
5909
|
-
const extractColorValue = (colorVariant, preferDark = false) => {
|
|
5910
|
-
if (preferDark && colorVariant?.dark?.trim()) return colorVariant.dark;
|
|
5911
|
-
return colorVariant?.main;
|
|
5912
|
-
};
|
|
5913
|
-
/**
|
|
5914
|
-
* Safely extracts contrast text color from the branding preference structure
|
|
5915
|
-
*/
|
|
5916
|
-
const extractContrastText = (colorVariant) => colorVariant?.contrastText;
|
|
5917
|
-
/**
|
|
5918
|
-
* Transforms a ThemeVariant from branding preference to ThemeConfig
|
|
5919
|
-
*/
|
|
5920
|
-
const transformThemeVariant = (themeVariant, isDark = false) => {
|
|
5921
|
-
const { buttons } = themeVariant;
|
|
5922
|
-
const { colors } = themeVariant;
|
|
5923
|
-
const { images } = themeVariant;
|
|
5924
|
-
const { inputs } = themeVariant;
|
|
5925
|
-
const config = {
|
|
5926
|
-
colors: {
|
|
5927
|
-
action: {
|
|
5928
|
-
activatedOpacity: .12,
|
|
5929
|
-
active: isDark ? "rgba(255, 255, 255, 0.70)" : "rgba(0, 0, 0, 0.54)",
|
|
5930
|
-
disabled: isDark ? "rgba(255, 255, 255, 0.26)" : "rgba(0, 0, 0, 0.26)",
|
|
5931
|
-
disabledBackground: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
5932
|
-
disabledOpacity: .38,
|
|
5933
|
-
focus: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
5934
|
-
focusOpacity: .12,
|
|
5935
|
-
hover: isDark ? "rgba(255, 255, 255, 0.04)" : "rgba(0, 0, 0, 0.04)",
|
|
5936
|
-
hoverOpacity: .04,
|
|
5937
|
-
selected: isDark ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.08)",
|
|
5938
|
-
selectedOpacity: .08
|
|
5939
|
-
},
|
|
5940
|
-
background: {
|
|
5941
|
-
body: {
|
|
5942
|
-
dark: (colors?.background?.body)?.dark || (colors?.background?.body)?.main,
|
|
5943
|
-
main: extractColorValue(colors?.background?.body, isDark) ?? ""
|
|
5944
|
-
},
|
|
5945
|
-
dark: (colors?.background?.surface)?.dark || (colors?.background?.surface)?.main,
|
|
5946
|
-
disabled: extractColorValue(colors?.background?.surface, isDark) ?? "",
|
|
5947
|
-
surface: extractColorValue(colors?.background?.surface, isDark) ?? ""
|
|
5948
|
-
},
|
|
5949
|
-
border: colors?.outlined?.default ?? "",
|
|
5950
|
-
error: {
|
|
5951
|
-
contrastText: extractContrastText(colors?.alerts?.error) ?? "",
|
|
5952
|
-
dark: (colors?.alerts?.error)?.dark || (colors?.alerts?.error)?.main,
|
|
5953
|
-
main: extractColorValue(colors?.alerts?.error, isDark) ?? ""
|
|
5954
|
-
},
|
|
5955
|
-
info: {
|
|
5956
|
-
contrastText: extractContrastText(colors?.alerts?.info) ?? "",
|
|
5957
|
-
dark: (colors?.alerts?.info)?.dark || (colors?.alerts?.info)?.main,
|
|
5958
|
-
main: extractColorValue(colors?.alerts?.info, isDark) ?? ""
|
|
5959
|
-
},
|
|
5960
|
-
primary: {
|
|
5961
|
-
contrastText: extractContrastText(colors?.primary) ?? "",
|
|
5962
|
-
dark: colors?.primary?.dark || (colors?.primary)?.main,
|
|
5963
|
-
main: extractColorValue(colors?.primary, isDark) ?? ""
|
|
5964
|
-
},
|
|
5965
|
-
secondary: {
|
|
5966
|
-
contrastText: extractContrastText(colors?.secondary) ?? "",
|
|
5967
|
-
dark: colors?.secondary?.dark || (colors?.secondary)?.main,
|
|
5968
|
-
main: extractColorValue(colors?.secondary, isDark) ?? ""
|
|
5969
|
-
},
|
|
5970
|
-
success: {
|
|
5971
|
-
contrastText: extractContrastText(colors?.alerts?.neutral) ?? "",
|
|
5972
|
-
dark: (colors?.alerts?.neutral)?.dark || (colors?.alerts?.neutral)?.main,
|
|
5973
|
-
main: extractColorValue(colors?.alerts?.neutral, isDark) ?? ""
|
|
5974
|
-
},
|
|
5975
|
-
text: {
|
|
5976
|
-
dark: (colors?.text)?.dark || (colors?.text)?.primary,
|
|
5977
|
-
primary: (colors?.text)?.primary ?? "",
|
|
5978
|
-
secondary: (colors?.text)?.secondary ?? ""
|
|
5979
|
-
},
|
|
5980
|
-
warning: {
|
|
5981
|
-
contrastText: extractContrastText(colors?.alerts?.warning) ?? "",
|
|
5982
|
-
dark: (colors?.alerts?.warning)?.dark || (colors?.alerts?.warning)?.main,
|
|
5983
|
-
main: extractColorValue(colors?.alerts?.warning, isDark) ?? ""
|
|
5984
|
-
}
|
|
5985
|
-
},
|
|
5986
|
-
images: {
|
|
5987
|
-
favicon: images?.favicon ? {
|
|
5988
|
-
alt: images.favicon.altText,
|
|
5989
|
-
title: images.favicon.title,
|
|
5990
|
-
url: images.favicon.imgURL
|
|
5991
|
-
} : void 0,
|
|
5992
|
-
logo: images?.logo ? {
|
|
5993
|
-
alt: images.logo.altText,
|
|
5994
|
-
title: images.logo.title,
|
|
5995
|
-
url: images.logo.imgURL
|
|
5996
|
-
} : void 0
|
|
5997
|
-
}
|
|
5998
|
-
};
|
|
5999
|
-
const buttonBorderRadius = buttons?.primary?.base?.border?.borderRadius;
|
|
6000
|
-
const fieldBorderRadius = inputs?.base?.border?.borderRadius;
|
|
6001
|
-
if (buttonBorderRadius || fieldBorderRadius) config.components = {
|
|
6002
|
-
...buttonBorderRadius && { Button: { styleOverrides: { root: { borderRadius: buttonBorderRadius } } } },
|
|
6003
|
-
...fieldBorderRadius && { Field: { styleOverrides: { root: { borderRadius: fieldBorderRadius } } } }
|
|
6004
|
-
};
|
|
6005
|
-
return config;
|
|
6006
|
-
};
|
|
6007
|
-
/**
|
|
6008
|
-
* Transforms branding preference response to Theme object
|
|
6009
|
-
*
|
|
6010
|
-
* @param brandingPreference - The branding preference response from getBrandingPreference
|
|
6011
|
-
* @param forceTheme - Optional parameter to force a specific theme ('light' or 'dark'),
|
|
6012
|
-
* if not provided, will use the activeTheme from branding preference
|
|
6013
|
-
* @returns Theme object that can be used with the theme system
|
|
6014
|
-
*
|
|
6015
|
-
* The function extracts the following from branding preference:
|
|
6016
|
-
* - Colors (primary, secondary, background, text, alerts, etc.)
|
|
6017
|
-
* - Border radius from buttons and inputs
|
|
6018
|
-
* - Images (logo and favicon with their URLs, titles, and alt text)
|
|
6019
|
-
* - Typography settings
|
|
6020
|
-
*
|
|
6021
|
-
* @example
|
|
6022
|
-
* ```typescript
|
|
6023
|
-
* const brandingPreference = await getBrandingPreference({ baseUrl: "..." });
|
|
6024
|
-
* const theme = transformBrandingPreferenceToTheme(brandingPreference);
|
|
6025
|
-
*
|
|
6026
|
-
* // Access image URLs via CSS variables
|
|
6027
|
-
* // Logo: var(--wso2-image-logo-url)
|
|
6028
|
-
* // Favicon: var(--wso2-image-favicon-url)
|
|
6029
|
-
*
|
|
6030
|
-
* // Force light theme regardless of branding preference activeTheme
|
|
6031
|
-
* const lightTheme = transformBrandingPreferenceToTheme(brandingPreference, 'light');
|
|
6032
|
-
* ```
|
|
6033
|
-
*/
|
|
6034
|
-
const transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
|
|
6035
|
-
const themeConfig = brandingPreference?.preference?.theme;
|
|
6036
|
-
if (!themeConfig) return createTheme_default({}, false);
|
|
6037
|
-
let activeThemeKey;
|
|
6038
|
-
if (forceTheme) activeThemeKey = forceTheme.toUpperCase();
|
|
6039
|
-
else activeThemeKey = themeConfig.activeTheme || "LIGHT";
|
|
6040
|
-
const themeVariant = themeConfig[activeThemeKey];
|
|
6041
|
-
if (!themeVariant) {
|
|
6042
|
-
const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;
|
|
6043
|
-
if (fallbackVariant) return createTheme_default(transformThemeVariant(fallbackVariant, activeThemeKey === "DARK"), activeThemeKey === "DARK");
|
|
6044
|
-
return createTheme_default({}, activeThemeKey === "DARK");
|
|
6045
|
-
}
|
|
6046
|
-
return createTheme_default(transformThemeVariant(themeVariant, activeThemeKey === "DARK"), activeThemeKey === "DARK");
|
|
6047
|
-
};
|
|
6048
|
-
var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
|
|
6049
|
-
|
|
6050
5249
|
//#endregion
|
|
6051
5250
|
//#region src/HttpClient.ts
|
|
6052
5251
|
/**
|
|
@@ -7177,14 +6376,11 @@ exports.configureLogger = configure;
|
|
|
7177
6376
|
exports.countryCodeToFlagEmoji = countryCodeToFlagEmoji;
|
|
7178
6377
|
exports.createComponentLogger = createComponentLogger;
|
|
7179
6378
|
exports.createLogger = createLogger;
|
|
7180
|
-
exports.createOrganization = createOrganization_default;
|
|
7181
6379
|
exports.createPackageComponentLogger = createPackageComponentLogger;
|
|
7182
6380
|
exports.createPackageLogger = createPackageLogger;
|
|
7183
|
-
exports.createPatchOperations = createPatchOperations;
|
|
7184
6381
|
exports.createTheme = createTheme_default;
|
|
7185
6382
|
exports.debug = debug;
|
|
7186
6383
|
exports.deepMerge = deepMerge_default;
|
|
7187
|
-
exports.deriveOrganizationHandleFromBaseUrl = deriveOrganizationHandleFromBaseUrl_default;
|
|
7188
6384
|
exports.error = error;
|
|
7189
6385
|
exports.evaluateValidationRule = evaluateValidationRule_default;
|
|
7190
6386
|
exports.executeEmbeddedRecoveryFlow = executeEmbeddedRecoveryFlow_default;
|
|
@@ -7199,13 +6395,9 @@ exports.formatDate = formatDate_default;
|
|
|
7199
6395
|
exports.generateFlattenedUserProfile = generateFlattenedUserProfile_default;
|
|
7200
6396
|
exports.generateUserProfile = generateUserProfile_default;
|
|
7201
6397
|
exports.get = get_default;
|
|
7202
|
-
exports.getAllOrganizations = getAllOrganizations_default;
|
|
7203
|
-
exports.getBrandingPreference = getBrandingPreference_default;
|
|
7204
6398
|
exports.getDefaultI18nBundles = getDefaultI18nBundles_default;
|
|
7205
6399
|
exports.getFlowMeta = getFlowMeta_default;
|
|
7206
6400
|
exports.getLatestStateParam = getLatestStateParam_default;
|
|
7207
|
-
exports.getMeOrganizations = getMeOrganizations_default;
|
|
7208
|
-
exports.getOrganization = getOrganization_default;
|
|
7209
6401
|
exports.getOrganizationUnitChildren = getOrganizationUnitChildren_default;
|
|
7210
6402
|
exports.getRedirectBasedSignUpUrl = getRedirectBasedSignUpUrl_default;
|
|
7211
6403
|
exports.getSchemas = getSchemas_default;
|
|
@@ -7226,8 +6418,6 @@ exports.resolveLocaleDisplayName = resolveLocaleDisplayName;
|
|
|
7226
6418
|
exports.resolveLocaleEmoji = resolveLocaleEmoji_default;
|
|
7227
6419
|
exports.resolveMeta = resolveMeta;
|
|
7228
6420
|
exports.set = set_default;
|
|
7229
|
-
exports.transformBrandingPreferenceToTheme = transformBrandingPreferenceToTheme_default;
|
|
7230
6421
|
exports.updateMeProfile = updateMeProfile_default;
|
|
7231
|
-
exports.updateOrganization = updateOrganization_default;
|
|
7232
6422
|
exports.warn = warn;
|
|
7233
6423
|
exports.withVendorCSSClassPrefix = withVendorCSSClassPrefix_default;
|