@thunderid/javascript 0.3.6 → 0.3.8

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