@thunderid/javascript 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/getUsersMe.d.ts.map +1 -1
- package/dist/api/updateMeProfile.d.ts.map +1 -1
- package/dist/cjs/index.cjs +50 -76
- package/dist/edge/index.js +49 -76
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -76
- package/dist/models/embedded-flow.d.ts +4 -1
- package/dist/models/embedded-flow.d.ts.map +1 -1
- package/dist/utils/substituteTranslationParams.d.ts +24 -0
- package/dist/utils/substituteTranslationParams.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/utils/processUsername.d.ts +0 -57
- package/dist/utils/processUsername.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUsersMe.d.ts","sourceRoot":"","sources":["../../src/api/getUsersMe.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"getUsersMe.d.ts","sourceRoot":"","sources":["../../src/api/getUsersMe.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IACnE;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClE;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,QAAA,MAAM,UAAU,GAAU,6CAA2C,gBAAgB,KAAG,OAAO,CAAC,IAAI,CA8DnG,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateMeProfile.d.ts","sourceRoot":"","sources":["../../src/api/updateMeProfile.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"updateMeProfile.d.ts","sourceRoot":"","sources":["../../src/api/updateMeProfile.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,CAAC;IACjF;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClE;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,QAAA,MAAM,eAAe,GAAU,sDAM5B,qBAAqB,KAAG,OAAO,CAAC,IAAI,CAmEtC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1343,77 +1343,6 @@ const getUserInfo = async ({ url,...requestConfig }) => {
|
|
|
1343
1343
|
};
|
|
1344
1344
|
var getUserInfo_default = getUserInfo;
|
|
1345
1345
|
|
|
1346
|
-
//#endregion
|
|
1347
|
-
//#region src/utils/processUsername.ts
|
|
1348
|
-
/**
|
|
1349
|
-
* Regular expression to match userstore prefixes in usernames.
|
|
1350
|
-
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1351
|
-
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
1352
|
-
*/
|
|
1353
|
-
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
1354
|
-
/**
|
|
1355
|
-
* Removes userstore prefixes from a username if they exist.
|
|
1356
|
-
* This is commonly used to clean usernames returned from profile endpoints
|
|
1357
|
-
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1358
|
-
*
|
|
1359
|
-
* @param username - The username string to process
|
|
1360
|
-
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
1361
|
-
*
|
|
1362
|
-
* @example
|
|
1363
|
-
* ```typescript
|
|
1364
|
-
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
1365
|
-
* console.log(cleanUsername); // "john.doe"
|
|
1366
|
-
*
|
|
1367
|
-
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
1368
|
-
* console.log(thunderidUser); // "jane.doe"
|
|
1369
|
-
*
|
|
1370
|
-
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
1371
|
-
* console.log(primaryUser); // "admin"
|
|
1372
|
-
*
|
|
1373
|
-
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
1374
|
-
* console.log(alreadyClean); // "user.name"
|
|
1375
|
-
*
|
|
1376
|
-
* const emptyInput = removeUserstorePrefix("");
|
|
1377
|
-
* console.log(emptyInput); // ""
|
|
1378
|
-
* ```
|
|
1379
|
-
*/
|
|
1380
|
-
const removeUserstorePrefix = (username) => {
|
|
1381
|
-
if (!username) return "";
|
|
1382
|
-
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
1383
|
-
};
|
|
1384
|
-
/**
|
|
1385
|
-
* Processes a user object to remove userstore prefixes from username fields.
|
|
1386
|
-
* This is a helper function for processing user objects returned from profile endpoints.
|
|
1387
|
-
* Handles various username field variations: username, userName, and user_name.
|
|
1388
|
-
*
|
|
1389
|
-
* @param user - The user object to process
|
|
1390
|
-
* @returns The user object with processed username fields
|
|
1391
|
-
*
|
|
1392
|
-
* @example
|
|
1393
|
-
* ```typescript
|
|
1394
|
-
* const user = { username: "DEFAULT/john.doe", email: "john@example.com" };
|
|
1395
|
-
* const processedUser = processUserUsername(user);
|
|
1396
|
-
* console.log(processedUser.username); // "john.doe"
|
|
1397
|
-
*
|
|
1398
|
-
* const camelCaseUser = { userName: "ASGARDEO_USER/jane.doe", email: "jane@example.com" };
|
|
1399
|
-
* const processedCamelCaseUser = processUserUsername(camelCaseUser);
|
|
1400
|
-
* console.log(processedCamelCaseUser.userName); // "jane.doe"
|
|
1401
|
-
*
|
|
1402
|
-
* const snakeCaseUser = { user_name: "PRIMARY/admin", email: "admin@example.com" };
|
|
1403
|
-
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
1404
|
-
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
1405
|
-
* ```
|
|
1406
|
-
*/
|
|
1407
|
-
const processUsername = (user) => {
|
|
1408
|
-
if (!user) return user;
|
|
1409
|
-
const processedUser = { ...user };
|
|
1410
|
-
if (processedUser.username) processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
1411
|
-
if (processedUser.userName) processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
1412
|
-
if (processedUser.user_name) processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
1413
|
-
return processedUser;
|
|
1414
|
-
};
|
|
1415
|
-
var processUsername_default = processUsername;
|
|
1416
|
-
|
|
1417
1346
|
//#endregion
|
|
1418
1347
|
//#region src/api/getUsersMe.ts
|
|
1419
1348
|
/**
|
|
@@ -1489,10 +1418,10 @@ const getUsersMe = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
|
1489
1418
|
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
|
|
1490
1419
|
const user = await response.json();
|
|
1491
1420
|
const attributes = user["attributes"] ?? {};
|
|
1492
|
-
return
|
|
1421
|
+
return {
|
|
1493
1422
|
...user,
|
|
1494
1423
|
...attributes
|
|
1495
|
-
}
|
|
1424
|
+
};
|
|
1496
1425
|
} catch (error$1) {
|
|
1497
1426
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1498
1427
|
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
|
|
@@ -1602,10 +1531,10 @@ const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig
|
|
|
1602
1531
|
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1603
1532
|
const user = await response.json();
|
|
1604
1533
|
const attributes = user["attributes"] ?? {};
|
|
1605
|
-
return
|
|
1534
|
+
return {
|
|
1606
1535
|
...user,
|
|
1607
1536
|
...attributes
|
|
1608
|
-
}
|
|
1537
|
+
};
|
|
1609
1538
|
} catch (error$1) {
|
|
1610
1539
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1611
1540
|
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");
|
|
@@ -4323,6 +4252,50 @@ const startCase = (str) => {
|
|
|
4323
4252
|
};
|
|
4324
4253
|
var startCase_default = startCase;
|
|
4325
4254
|
|
|
4255
|
+
//#endregion
|
|
4256
|
+
//#region src/utils/substituteTranslationParams.ts
|
|
4257
|
+
/**
|
|
4258
|
+
* Matches the `{{param(name)}}` placeholder syntax used by backend messages.
|
|
4259
|
+
*/
|
|
4260
|
+
const BACKEND_PARAM_PATTERN = /\{\{\s*param\(\s*\w+\s*\)\s*\}\}/;
|
|
4261
|
+
/**
|
|
4262
|
+
* Escapes characters that carry special meaning inside a regular expression.
|
|
4263
|
+
*
|
|
4264
|
+
* @param value - The literal string to escape.
|
|
4265
|
+
* @returns The escaped string, safe to embed in a `RegExp`.
|
|
4266
|
+
*/
|
|
4267
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4268
|
+
/**
|
|
4269
|
+
* Checks whether a translation still contains an unsubstituted `{{param(name)}}` placeholder.
|
|
4270
|
+
*
|
|
4271
|
+
* Used to detect that a resolved translation is not presentable to the user, so the caller can
|
|
4272
|
+
* fall back to a pre-substituted value instead.
|
|
4273
|
+
*
|
|
4274
|
+
* @param translation - The translation string to inspect.
|
|
4275
|
+
* @returns `true` when at least one backend placeholder remains unsubstituted.
|
|
4276
|
+
*/
|
|
4277
|
+
const hasUnresolvedTranslationParams = (translation) => Boolean(translation) && BACKEND_PARAM_PATTERN.test(translation);
|
|
4278
|
+
/**
|
|
4279
|
+
* Substitutes named parameters into a translation string.
|
|
4280
|
+
*
|
|
4281
|
+
* Two placeholder syntaxes are supported, because messages reach the SDK from two sources:
|
|
4282
|
+
* - `{{param(name)}}` is used by backend messages and the server-shipped `system` i18n bundle.
|
|
4283
|
+
* - `{name}` is used by the SDK's own translation bundles.
|
|
4284
|
+
*
|
|
4285
|
+
* @param translation - The translation string, possibly containing placeholders.
|
|
4286
|
+
* @param params - The parameter values to substitute, keyed by placeholder name.
|
|
4287
|
+
* @returns The translation with every matching placeholder replaced.
|
|
4288
|
+
*/
|
|
4289
|
+
const substituteTranslationParams = (translation, params) => {
|
|
4290
|
+
if (!translation || !params || Object.keys(params).length === 0) return translation;
|
|
4291
|
+
return Object.entries(params).reduce((acc, [paramKey, paramValue]) => {
|
|
4292
|
+
const escapedKey = escapeRegExp(paramKey);
|
|
4293
|
+
const value = String(paramValue);
|
|
4294
|
+
return acc.replace(new RegExp(`\\{\\{\\s*param\\(\\s*${escapedKey}\\s*\\)\\s*\\}\\}`, "g"), () => value).replace(new RegExp(`\\{${escapedKey}\\}`, "g"), () => value);
|
|
4295
|
+
}, translation);
|
|
4296
|
+
};
|
|
4297
|
+
var substituteTranslationParams_default = substituteTranslationParams;
|
|
4298
|
+
|
|
4326
4299
|
//#endregion
|
|
4327
4300
|
//#region src/utils/removeTrailingSlash.ts
|
|
4328
4301
|
/**
|
|
@@ -5853,6 +5826,7 @@ exports.getUserInfo = getUserInfo_default;
|
|
|
5853
5826
|
exports.getUsersMe = getUsersMe_default;
|
|
5854
5827
|
exports.getUsersMeMeta = getUsersMeMeta_default;
|
|
5855
5828
|
exports.getVendorPrefix = getVendorPrefix_default;
|
|
5829
|
+
exports.hasUnresolvedTranslationParams = hasUnresolvedTranslationParams;
|
|
5856
5830
|
exports.info = info;
|
|
5857
5831
|
exports.isEmojiUri = isEmojiUri_default;
|
|
5858
5832
|
exports.isEmpty = isEmpty_default;
|
|
@@ -5860,7 +5834,6 @@ exports.isRecognizedBaseUrlPattern = isRecognizedBaseUrlPattern_default;
|
|
|
5860
5834
|
exports.logger = logger_default;
|
|
5861
5835
|
exports.normalizeTranslations = normalizeTranslations_default;
|
|
5862
5836
|
exports.processOpenIDScopes = processOpenIDScopes_default;
|
|
5863
|
-
exports.processUsername = processUsername_default;
|
|
5864
5837
|
exports.removeTrailingSlash = removeTrailingSlash_default;
|
|
5865
5838
|
exports.resolveFieldName = resolveFieldName_default;
|
|
5866
5839
|
exports.resolveFlowTemplateLiterals = resolveFlowTemplateLiterals;
|
|
@@ -5870,6 +5843,7 @@ exports.resolveMeta = resolveMeta;
|
|
|
5870
5843
|
exports.resolveResourceEndpoint = resolveResourceEndpoint_default;
|
|
5871
5844
|
exports.set = set_default;
|
|
5872
5845
|
exports.startCase = startCase_default;
|
|
5846
|
+
exports.substituteTranslationParams = substituteTranslationParams_default;
|
|
5873
5847
|
exports.updateMeProfile = updateMeProfile_default;
|
|
5874
5848
|
exports.warn = warn;
|
|
5875
5849
|
exports.withVendorCSSClassPrefix = withVendorCSSClassPrefix_default;
|
package/dist/edge/index.js
CHANGED
|
@@ -1323,77 +1323,6 @@ const getUserInfo = async ({ url,...requestConfig }) => {
|
|
|
1323
1323
|
};
|
|
1324
1324
|
var getUserInfo_default = getUserInfo;
|
|
1325
1325
|
|
|
1326
|
-
//#endregion
|
|
1327
|
-
//#region src/utils/processUsername.ts
|
|
1328
|
-
/**
|
|
1329
|
-
* Regular expression to match userstore prefixes in usernames.
|
|
1330
|
-
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1331
|
-
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
1332
|
-
*/
|
|
1333
|
-
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
1334
|
-
/**
|
|
1335
|
-
* Removes userstore prefixes from a username if they exist.
|
|
1336
|
-
* This is commonly used to clean usernames returned from profile endpoints
|
|
1337
|
-
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1338
|
-
*
|
|
1339
|
-
* @param username - The username string to process
|
|
1340
|
-
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
1341
|
-
*
|
|
1342
|
-
* @example
|
|
1343
|
-
* ```typescript
|
|
1344
|
-
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
1345
|
-
* console.log(cleanUsername); // "john.doe"
|
|
1346
|
-
*
|
|
1347
|
-
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
1348
|
-
* console.log(thunderidUser); // "jane.doe"
|
|
1349
|
-
*
|
|
1350
|
-
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
1351
|
-
* console.log(primaryUser); // "admin"
|
|
1352
|
-
*
|
|
1353
|
-
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
1354
|
-
* console.log(alreadyClean); // "user.name"
|
|
1355
|
-
*
|
|
1356
|
-
* const emptyInput = removeUserstorePrefix("");
|
|
1357
|
-
* console.log(emptyInput); // ""
|
|
1358
|
-
* ```
|
|
1359
|
-
*/
|
|
1360
|
-
const removeUserstorePrefix = (username) => {
|
|
1361
|
-
if (!username) return "";
|
|
1362
|
-
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
1363
|
-
};
|
|
1364
|
-
/**
|
|
1365
|
-
* Processes a user object to remove userstore prefixes from username fields.
|
|
1366
|
-
* This is a helper function for processing user objects returned from profile endpoints.
|
|
1367
|
-
* Handles various username field variations: username, userName, and user_name.
|
|
1368
|
-
*
|
|
1369
|
-
* @param user - The user object to process
|
|
1370
|
-
* @returns The user object with processed username fields
|
|
1371
|
-
*
|
|
1372
|
-
* @example
|
|
1373
|
-
* ```typescript
|
|
1374
|
-
* const user = { username: "DEFAULT/john.doe", email: "john@example.com" };
|
|
1375
|
-
* const processedUser = processUserUsername(user);
|
|
1376
|
-
* console.log(processedUser.username); // "john.doe"
|
|
1377
|
-
*
|
|
1378
|
-
* const camelCaseUser = { userName: "ASGARDEO_USER/jane.doe", email: "jane@example.com" };
|
|
1379
|
-
* const processedCamelCaseUser = processUserUsername(camelCaseUser);
|
|
1380
|
-
* console.log(processedCamelCaseUser.userName); // "jane.doe"
|
|
1381
|
-
*
|
|
1382
|
-
* const snakeCaseUser = { user_name: "PRIMARY/admin", email: "admin@example.com" };
|
|
1383
|
-
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
1384
|
-
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
1385
|
-
* ```
|
|
1386
|
-
*/
|
|
1387
|
-
const processUsername = (user) => {
|
|
1388
|
-
if (!user) return user;
|
|
1389
|
-
const processedUser = { ...user };
|
|
1390
|
-
if (processedUser.username) processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
1391
|
-
if (processedUser.userName) processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
1392
|
-
if (processedUser.user_name) processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
1393
|
-
return processedUser;
|
|
1394
|
-
};
|
|
1395
|
-
var processUsername_default = processUsername;
|
|
1396
|
-
|
|
1397
1326
|
//#endregion
|
|
1398
1327
|
//#region src/api/getUsersMe.ts
|
|
1399
1328
|
/**
|
|
@@ -1469,10 +1398,10 @@ const getUsersMe = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
|
1469
1398
|
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
|
|
1470
1399
|
const user = await response.json();
|
|
1471
1400
|
const attributes = user["attributes"] ?? {};
|
|
1472
|
-
return
|
|
1401
|
+
return {
|
|
1473
1402
|
...user,
|
|
1474
1403
|
...attributes
|
|
1475
|
-
}
|
|
1404
|
+
};
|
|
1476
1405
|
} catch (error$1) {
|
|
1477
1406
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1478
1407
|
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
|
|
@@ -1582,10 +1511,10 @@ const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig
|
|
|
1582
1511
|
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1583
1512
|
const user = await response.json();
|
|
1584
1513
|
const attributes = user["attributes"] ?? {};
|
|
1585
|
-
return
|
|
1514
|
+
return {
|
|
1586
1515
|
...user,
|
|
1587
1516
|
...attributes
|
|
1588
|
-
}
|
|
1517
|
+
};
|
|
1589
1518
|
} catch (error$1) {
|
|
1590
1519
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1591
1520
|
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");
|
|
@@ -4303,6 +4232,50 @@ const startCase = (str) => {
|
|
|
4303
4232
|
};
|
|
4304
4233
|
var startCase_default = startCase;
|
|
4305
4234
|
|
|
4235
|
+
//#endregion
|
|
4236
|
+
//#region src/utils/substituteTranslationParams.ts
|
|
4237
|
+
/**
|
|
4238
|
+
* Matches the `{{param(name)}}` placeholder syntax used by backend messages.
|
|
4239
|
+
*/
|
|
4240
|
+
const BACKEND_PARAM_PATTERN = /\{\{\s*param\(\s*\w+\s*\)\s*\}\}/;
|
|
4241
|
+
/**
|
|
4242
|
+
* Escapes characters that carry special meaning inside a regular expression.
|
|
4243
|
+
*
|
|
4244
|
+
* @param value - The literal string to escape.
|
|
4245
|
+
* @returns The escaped string, safe to embed in a `RegExp`.
|
|
4246
|
+
*/
|
|
4247
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4248
|
+
/**
|
|
4249
|
+
* Checks whether a translation still contains an unsubstituted `{{param(name)}}` placeholder.
|
|
4250
|
+
*
|
|
4251
|
+
* Used to detect that a resolved translation is not presentable to the user, so the caller can
|
|
4252
|
+
* fall back to a pre-substituted value instead.
|
|
4253
|
+
*
|
|
4254
|
+
* @param translation - The translation string to inspect.
|
|
4255
|
+
* @returns `true` when at least one backend placeholder remains unsubstituted.
|
|
4256
|
+
*/
|
|
4257
|
+
const hasUnresolvedTranslationParams = (translation) => Boolean(translation) && BACKEND_PARAM_PATTERN.test(translation);
|
|
4258
|
+
/**
|
|
4259
|
+
* Substitutes named parameters into a translation string.
|
|
4260
|
+
*
|
|
4261
|
+
* Two placeholder syntaxes are supported, because messages reach the SDK from two sources:
|
|
4262
|
+
* - `{{param(name)}}` is used by backend messages and the server-shipped `system` i18n bundle.
|
|
4263
|
+
* - `{name}` is used by the SDK's own translation bundles.
|
|
4264
|
+
*
|
|
4265
|
+
* @param translation - The translation string, possibly containing placeholders.
|
|
4266
|
+
* @param params - The parameter values to substitute, keyed by placeholder name.
|
|
4267
|
+
* @returns The translation with every matching placeholder replaced.
|
|
4268
|
+
*/
|
|
4269
|
+
const substituteTranslationParams = (translation, params) => {
|
|
4270
|
+
if (!translation || !params || Object.keys(params).length === 0) return translation;
|
|
4271
|
+
return Object.entries(params).reduce((acc, [paramKey, paramValue]) => {
|
|
4272
|
+
const escapedKey = escapeRegExp(paramKey);
|
|
4273
|
+
const value = String(paramValue);
|
|
4274
|
+
return acc.replace(new RegExp(`\\{\\{\\s*param\\(\\s*${escapedKey}\\s*\\)\\s*\\}\\}`, "g"), () => value).replace(new RegExp(`\\{${escapedKey}\\}`, "g"), () => value);
|
|
4275
|
+
}, translation);
|
|
4276
|
+
};
|
|
4277
|
+
var substituteTranslationParams_default = substituteTranslationParams;
|
|
4278
|
+
|
|
4306
4279
|
//#endregion
|
|
4307
4280
|
//#region src/utils/removeTrailingSlash.ts
|
|
4308
4281
|
/**
|
|
@@ -5766,4 +5739,4 @@ const normalizeTranslations = (translations) => {
|
|
|
5766
5739
|
var normalizeTranslations_default = normalizeTranslations;
|
|
5767
5740
|
|
|
5768
5741
|
//#endregion
|
|
5769
|
-
export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, ConsentConstants_default as ConsentConstants, 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, 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, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getUserInfo_default as getUserInfo, getUsersMe_default as getUsersMe, getUsersMeMeta_default as getUsersMeMeta, getVendorPrefix_default as getVendorPrefix, 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,
|
|
5742
|
+
export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, ConsentConstants_default as ConsentConstants, 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, 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, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getUserInfo_default as getUserInfo, getUsersMe_default as getUsersMe, getUsersMeMeta_default as getUsersMeMeta, getVendorPrefix_default as getVendorPrefix, hasUnresolvedTranslationParams, 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, removeTrailingSlash_default as removeTrailingSlash, resolveFieldName_default as resolveFieldName, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji_default as resolveLocaleEmoji, resolveMeta, resolveResourceEndpoint_default as resolveResourceEndpoint, set_default as set, startCase_default as startCase, substituteTranslationParams_default as substituteTranslationParams, updateMeProfile_default as updateMeProfile, warn, withVendorCSSClassPrefix_default as withVendorCSSClassPrefix };
|
package/dist/index.d.ts
CHANGED
|
@@ -63,7 +63,6 @@ export { default as arrayBufferToBase64url } from './utils/arrayBufferToBase64ur
|
|
|
63
63
|
export { default as base64urlToArrayBuffer } from './utils/base64urlToArrayBuffer';
|
|
64
64
|
export { default as bem } from './utils/bem';
|
|
65
65
|
export { default as formatDate } from './utils/formatDate';
|
|
66
|
-
export { default as processUsername } from './utils/processUsername';
|
|
67
66
|
export { default as deepMerge } from './utils/deepMerge';
|
|
68
67
|
export { default as extractUserClaimsFromIdToken } from './utils/extractUserClaimsFromIdToken';
|
|
69
68
|
export { default as isRecognizedBaseUrlPattern } from './utils/isRecognizedBaseUrlPattern';
|
|
@@ -77,6 +76,7 @@ export { default as extractEmojiFromUri } from './utils/extractEmojiFromUri';
|
|
|
77
76
|
export { default as set } from './utils/set';
|
|
78
77
|
export { default as get } from './utils/get';
|
|
79
78
|
export { default as startCase } from './utils/startCase';
|
|
79
|
+
export { default as substituteTranslationParams, hasUnresolvedTranslationParams, } from './utils/substituteTranslationParams';
|
|
80
80
|
export { default as removeTrailingSlash } from './utils/removeTrailingSlash';
|
|
81
81
|
export { default as resolveFieldName } from './utils/resolveFieldName';
|
|
82
82
|
export { default as resolveResourceEndpoint } from './utils/resolveResourceEndpoint';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB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,77 +1323,6 @@ const getUserInfo = async ({ url,...requestConfig }) => {
|
|
|
1323
1323
|
};
|
|
1324
1324
|
var getUserInfo_default = getUserInfo;
|
|
1325
1325
|
|
|
1326
|
-
//#endregion
|
|
1327
|
-
//#region src/utils/processUsername.ts
|
|
1328
|
-
/**
|
|
1329
|
-
* Regular expression to match userstore prefixes in usernames.
|
|
1330
|
-
* Matches patterns like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1331
|
-
* The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.
|
|
1332
|
-
*/
|
|
1333
|
-
const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
1334
|
-
/**
|
|
1335
|
-
* Removes userstore prefixes from a username if they exist.
|
|
1336
|
-
* This is commonly used to clean usernames returned from profile endpoints
|
|
1337
|
-
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
1338
|
-
*
|
|
1339
|
-
* @param username - The username string to process
|
|
1340
|
-
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
1341
|
-
*
|
|
1342
|
-
* @example
|
|
1343
|
-
* ```typescript
|
|
1344
|
-
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
1345
|
-
* console.log(cleanUsername); // "john.doe"
|
|
1346
|
-
*
|
|
1347
|
-
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
1348
|
-
* console.log(thunderidUser); // "jane.doe"
|
|
1349
|
-
*
|
|
1350
|
-
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
1351
|
-
* console.log(primaryUser); // "admin"
|
|
1352
|
-
*
|
|
1353
|
-
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
1354
|
-
* console.log(alreadyClean); // "user.name"
|
|
1355
|
-
*
|
|
1356
|
-
* const emptyInput = removeUserstorePrefix("");
|
|
1357
|
-
* console.log(emptyInput); // ""
|
|
1358
|
-
* ```
|
|
1359
|
-
*/
|
|
1360
|
-
const removeUserstorePrefix = (username) => {
|
|
1361
|
-
if (!username) return "";
|
|
1362
|
-
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
1363
|
-
};
|
|
1364
|
-
/**
|
|
1365
|
-
* Processes a user object to remove userstore prefixes from username fields.
|
|
1366
|
-
* This is a helper function for processing user objects returned from profile endpoints.
|
|
1367
|
-
* Handles various username field variations: username, userName, and user_name.
|
|
1368
|
-
*
|
|
1369
|
-
* @param user - The user object to process
|
|
1370
|
-
* @returns The user object with processed username fields
|
|
1371
|
-
*
|
|
1372
|
-
* @example
|
|
1373
|
-
* ```typescript
|
|
1374
|
-
* const user = { username: "DEFAULT/john.doe", email: "john@example.com" };
|
|
1375
|
-
* const processedUser = processUserUsername(user);
|
|
1376
|
-
* console.log(processedUser.username); // "john.doe"
|
|
1377
|
-
*
|
|
1378
|
-
* const camelCaseUser = { userName: "ASGARDEO_USER/jane.doe", email: "jane@example.com" };
|
|
1379
|
-
* const processedCamelCaseUser = processUserUsername(camelCaseUser);
|
|
1380
|
-
* console.log(processedCamelCaseUser.userName); // "jane.doe"
|
|
1381
|
-
*
|
|
1382
|
-
* const snakeCaseUser = { user_name: "PRIMARY/admin", email: "admin@example.com" };
|
|
1383
|
-
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
1384
|
-
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
1385
|
-
* ```
|
|
1386
|
-
*/
|
|
1387
|
-
const processUsername = (user) => {
|
|
1388
|
-
if (!user) return user;
|
|
1389
|
-
const processedUser = { ...user };
|
|
1390
|
-
if (processedUser.username) processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
1391
|
-
if (processedUser.userName) processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
1392
|
-
if (processedUser.user_name) processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
1393
|
-
return processedUser;
|
|
1394
|
-
};
|
|
1395
|
-
var processUsername_default = processUsername;
|
|
1396
|
-
|
|
1397
1326
|
//#endregion
|
|
1398
1327
|
//#region src/api/getUsersMe.ts
|
|
1399
1328
|
/**
|
|
@@ -1469,10 +1398,10 @@ const getUsersMe = async ({ url, baseUrl, fetcher,...requestConfig }) => {
|
|
|
1469
1398
|
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
|
|
1470
1399
|
const user = await response.json();
|
|
1471
1400
|
const attributes = user["attributes"] ?? {};
|
|
1472
|
-
return
|
|
1401
|
+
return {
|
|
1473
1402
|
...user,
|
|
1474
1403
|
...attributes
|
|
1475
|
-
}
|
|
1404
|
+
};
|
|
1476
1405
|
} catch (error$1) {
|
|
1477
1406
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1478
1407
|
throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
|
|
@@ -1582,10 +1511,10 @@ const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig
|
|
|
1582
1511
|
if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
|
|
1583
1512
|
const user = await response.json();
|
|
1584
1513
|
const attributes = user["attributes"] ?? {};
|
|
1585
|
-
return
|
|
1514
|
+
return {
|
|
1586
1515
|
...user,
|
|
1587
1516
|
...attributes
|
|
1588
|
-
}
|
|
1517
|
+
};
|
|
1589
1518
|
} catch (error$1) {
|
|
1590
1519
|
if (error$1 instanceof ThunderIDAPIError) throw error$1;
|
|
1591
1520
|
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");
|
|
@@ -4303,6 +4232,50 @@ const startCase = (str) => {
|
|
|
4303
4232
|
};
|
|
4304
4233
|
var startCase_default = startCase;
|
|
4305
4234
|
|
|
4235
|
+
//#endregion
|
|
4236
|
+
//#region src/utils/substituteTranslationParams.ts
|
|
4237
|
+
/**
|
|
4238
|
+
* Matches the `{{param(name)}}` placeholder syntax used by backend messages.
|
|
4239
|
+
*/
|
|
4240
|
+
const BACKEND_PARAM_PATTERN = /\{\{\s*param\(\s*\w+\s*\)\s*\}\}/;
|
|
4241
|
+
/**
|
|
4242
|
+
* Escapes characters that carry special meaning inside a regular expression.
|
|
4243
|
+
*
|
|
4244
|
+
* @param value - The literal string to escape.
|
|
4245
|
+
* @returns The escaped string, safe to embed in a `RegExp`.
|
|
4246
|
+
*/
|
|
4247
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4248
|
+
/**
|
|
4249
|
+
* Checks whether a translation still contains an unsubstituted `{{param(name)}}` placeholder.
|
|
4250
|
+
*
|
|
4251
|
+
* Used to detect that a resolved translation is not presentable to the user, so the caller can
|
|
4252
|
+
* fall back to a pre-substituted value instead.
|
|
4253
|
+
*
|
|
4254
|
+
* @param translation - The translation string to inspect.
|
|
4255
|
+
* @returns `true` when at least one backend placeholder remains unsubstituted.
|
|
4256
|
+
*/
|
|
4257
|
+
const hasUnresolvedTranslationParams = (translation) => Boolean(translation) && BACKEND_PARAM_PATTERN.test(translation);
|
|
4258
|
+
/**
|
|
4259
|
+
* Substitutes named parameters into a translation string.
|
|
4260
|
+
*
|
|
4261
|
+
* Two placeholder syntaxes are supported, because messages reach the SDK from two sources:
|
|
4262
|
+
* - `{{param(name)}}` is used by backend messages and the server-shipped `system` i18n bundle.
|
|
4263
|
+
* - `{name}` is used by the SDK's own translation bundles.
|
|
4264
|
+
*
|
|
4265
|
+
* @param translation - The translation string, possibly containing placeholders.
|
|
4266
|
+
* @param params - The parameter values to substitute, keyed by placeholder name.
|
|
4267
|
+
* @returns The translation with every matching placeholder replaced.
|
|
4268
|
+
*/
|
|
4269
|
+
const substituteTranslationParams = (translation, params) => {
|
|
4270
|
+
if (!translation || !params || Object.keys(params).length === 0) return translation;
|
|
4271
|
+
return Object.entries(params).reduce((acc, [paramKey, paramValue]) => {
|
|
4272
|
+
const escapedKey = escapeRegExp(paramKey);
|
|
4273
|
+
const value = String(paramValue);
|
|
4274
|
+
return acc.replace(new RegExp(`\\{\\{\\s*param\\(\\s*${escapedKey}\\s*\\)\\s*\\}\\}`, "g"), () => value).replace(new RegExp(`\\{${escapedKey}\\}`, "g"), () => value);
|
|
4275
|
+
}, translation);
|
|
4276
|
+
};
|
|
4277
|
+
var substituteTranslationParams_default = substituteTranslationParams;
|
|
4278
|
+
|
|
4306
4279
|
//#endregion
|
|
4307
4280
|
//#region src/utils/removeTrailingSlash.ts
|
|
4308
4281
|
/**
|
|
@@ -5766,4 +5739,4 @@ const normalizeTranslations = (translations) => {
|
|
|
5766
5739
|
var normalizeTranslations_default = normalizeTranslations;
|
|
5767
5740
|
|
|
5768
5741
|
//#endregion
|
|
5769
|
-
export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, ConsentConstants_default as ConsentConstants, 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, 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, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getUserInfo_default as getUserInfo, getUsersMe_default as getUsersMe, getUsersMeMeta_default as getUsersMeMeta, getVendorPrefix_default as getVendorPrefix, 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,
|
|
5742
|
+
export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, ConsentConstants_default as ConsentConstants, 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, 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, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getUserInfo_default as getUserInfo, getUsersMe_default as getUsersMe, getUsersMeMeta_default as getUsersMeMeta, getVendorPrefix_default as getVendorPrefix, hasUnresolvedTranslationParams, 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, removeTrailingSlash_default as removeTrailingSlash, resolveFieldName_default as resolveFieldName, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji_default as resolveLocaleEmoji, resolveMeta, resolveResourceEndpoint_default as resolveResourceEndpoint, set_default as set, startCase_default as startCase, substituteTranslationParams_default as substituteTranslationParams, updateMeProfile_default as updateMeProfile, warn, withVendorCSSClassPrefix_default as withVendorCSSClassPrefix };
|
|
@@ -28,11 +28,14 @@ export interface EmbeddedFlowExecuteRequestConfigBase<T = any> extends Partial<R
|
|
|
28
28
|
/**
|
|
29
29
|
* Internationalized message structure returned by the backend.
|
|
30
30
|
*
|
|
31
|
-
* The `defaultValue` field carries the untranslated fallback text
|
|
31
|
+
* The `defaultValue` field carries the untranslated fallback text, already substituted with
|
|
32
|
+
* `params`. When resolving `key` against a translation bundle instead, `params` must be applied
|
|
33
|
+
* to the resolved value, since bundle entries keep their `{{param(name)}}` placeholders.
|
|
32
34
|
*/
|
|
33
35
|
export interface I18nMessage {
|
|
34
36
|
defaultValue?: string;
|
|
35
37
|
key: string;
|
|
38
|
+
params?: Record<string, string>;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Structured error returned in a flow response when flowStatus is ERROR.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedded-flow.d.ts","sourceRoot":"","sources":["../../src/models/embedded-flow.ts"],"names":[],"mappings":"AAGA,oBAAY,gBAAgB;IAC1B,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,cAAc,oBAAoB;CACnC;AAED,oBAAY,wBAAwB;IAClC,WAAW,gBAAgB;IAC3B,IAAI,SAAS;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,oCAAoC,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO,CAAC,OAAO,CAAC;IACrF,OAAO,CAA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AAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,gCAAgC,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,oCAAoC,CAAC,CAAC,CAAC;IACxG;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a translation still contains an unsubstituted `{{param(name)}}` placeholder.
|
|
3
|
+
*
|
|
4
|
+
* Used to detect that a resolved translation is not presentable to the user, so the caller can
|
|
5
|
+
* fall back to a pre-substituted value instead.
|
|
6
|
+
*
|
|
7
|
+
* @param translation - The translation string to inspect.
|
|
8
|
+
* @returns `true` when at least one backend placeholder remains unsubstituted.
|
|
9
|
+
*/
|
|
10
|
+
export declare const hasUnresolvedTranslationParams: (translation: string) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Substitutes named parameters into a translation string.
|
|
13
|
+
*
|
|
14
|
+
* Two placeholder syntaxes are supported, because messages reach the SDK from two sources:
|
|
15
|
+
* - `{{param(name)}}` is used by backend messages and the server-shipped `system` i18n bundle.
|
|
16
|
+
* - `{name}` is used by the SDK's own translation bundles.
|
|
17
|
+
*
|
|
18
|
+
* @param translation - The translation string, possibly containing placeholders.
|
|
19
|
+
* @param params - The parameter values to substitute, keyed by placeholder name.
|
|
20
|
+
* @returns The translation with every matching placeholder replaced.
|
|
21
|
+
*/
|
|
22
|
+
declare const substituteTranslationParams: (translation: string, params?: Record<string, string | number>) => string;
|
|
23
|
+
export default substituteTranslationParams;
|
|
24
|
+
//# sourceMappingURL=substituteTranslationParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"substituteTranslationParams.d.ts","sourceRoot":"","sources":["../../src/utils/substituteTranslationParams.ts"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAAI,aAAa,MAAM,KAAG,OACJ,CAAC;AAElE;;;;;;;;;;GAUG;AACH,QAAA,MAAM,2BAA2B,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAG,MAapG,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/javascript",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "JavaScript Ecosystem SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"directory": "packages/javascript"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@thunderid/eslint-plugin": "0.0
|
|
40
|
-
"@thunderid/prettier-config": "0.0
|
|
39
|
+
"@thunderid/eslint-plugin": "1.0.0",
|
|
40
|
+
"@thunderid/prettier-config": "1.0.0",
|
|
41
41
|
"@types/node": "24.7.2",
|
|
42
42
|
"eslint": "9.39.4",
|
|
43
43
|
"prettier": "3.6.2",
|
|
44
44
|
"rimraf": "6.1.3",
|
|
45
45
|
"rolldown": "1.0.0-beta.45",
|
|
46
46
|
"typescript": "5.9.3",
|
|
47
|
-
"vitest": "4.1.
|
|
47
|
+
"vitest": "4.1.10"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"jose": "6.2.3",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes userstore prefixes from a username if they exist.
|
|
3
|
-
* This is commonly used to clean usernames returned from profile endpoints
|
|
4
|
-
* that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
|
|
5
|
-
*
|
|
6
|
-
* @param username - The username string to process
|
|
7
|
-
* @returns The username without the userstore prefix, or the original username if no prefix exists
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const cleanUsername = removeUserstorePrefix("DEFAULT/john.doe");
|
|
12
|
-
* console.log(cleanUsername); // "john.doe"
|
|
13
|
-
*
|
|
14
|
-
* const thunderidUser = removeUserstorePrefix("ASGARDEO_USER/jane.doe");
|
|
15
|
-
* console.log(thunderidUser); // "jane.doe"
|
|
16
|
-
*
|
|
17
|
-
* const primaryUser = removeUserstorePrefix("PRIMARY/admin");
|
|
18
|
-
* console.log(primaryUser); // "admin"
|
|
19
|
-
*
|
|
20
|
-
* const alreadyClean = removeUserstorePrefix("user.name");
|
|
21
|
-
* console.log(alreadyClean); // "user.name"
|
|
22
|
-
*
|
|
23
|
-
* const emptyInput = removeUserstorePrefix("");
|
|
24
|
-
* console.log(emptyInput); // ""
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const removeUserstorePrefix: (username?: string) => string;
|
|
28
|
-
/**
|
|
29
|
-
* Processes a user object to remove userstore prefixes from username fields.
|
|
30
|
-
* This is a helper function for processing user objects returned from profile endpoints.
|
|
31
|
-
* Handles various username field variations: username, userName, and user_name.
|
|
32
|
-
*
|
|
33
|
-
* @param user - The user object to process
|
|
34
|
-
* @returns The user object with processed username fields
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* const user = { username: "DEFAULT/john.doe", email: "john@example.com" };
|
|
39
|
-
* const processedUser = processUserUsername(user);
|
|
40
|
-
* console.log(processedUser.username); // "john.doe"
|
|
41
|
-
*
|
|
42
|
-
* const camelCaseUser = { userName: "ASGARDEO_USER/jane.doe", email: "jane@example.com" };
|
|
43
|
-
* const processedCamelCaseUser = processUserUsername(camelCaseUser);
|
|
44
|
-
* console.log(processedCamelCaseUser.userName); // "jane.doe"
|
|
45
|
-
*
|
|
46
|
-
* const snakeCaseUser = { user_name: "PRIMARY/admin", email: "admin@example.com" };
|
|
47
|
-
* const processedSnakeCaseUser = processUserUsername(snakeCaseUser);
|
|
48
|
-
* console.log(processedSnakeCaseUser.user_name); // "admin"
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
declare const processUsername: <T extends {
|
|
52
|
-
userName?: string;
|
|
53
|
-
user_name?: string;
|
|
54
|
-
username?: string;
|
|
55
|
-
}>(user: T) => T;
|
|
56
|
-
export default processUsername;
|
|
57
|
-
//# sourceMappingURL=processUsername.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processUsername.d.ts","sourceRoot":"","sources":["../../src/utils/processUsername.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,KAAG,MAMzD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,eAAe,GAAI,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,MAAM,CAAC,KAAG,CAuBxG,CAAC;AAEF,eAAe,eAAe,CAAC"}
|