@asgardeo/javascript 0.8.0 → 0.8.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/cjs/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
8
  var __export = (target, all) => {
@@ -15,12 +17,21 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
20
30
 
21
31
  // src/index.ts
22
32
  var index_exports = {};
23
33
  __export(index_exports, {
34
+ AgentConfig: () => AgentConfig,
24
35
  ApplicationNativeAuthenticationConstants: () => ApplicationNativeAuthenticationConstants_default,
25
36
  AsgardeoAPIError: () => AsgardeoAPIError,
26
37
  AsgardeoAuthClient: () => AsgardeoAuthClient,
@@ -61,6 +72,7 @@ __export(index_exports, {
61
72
  base64urlToArrayBuffer: () => base64urlToArrayBuffer_default,
62
73
  bem: () => bem_default,
63
74
  configureLogger: () => configure,
75
+ countryCodeToFlagEmoji: () => countryCodeToFlagEmoji,
64
76
  createComponentLogger: () => createComponentLogger,
65
77
  createLogger: () => createLogger,
66
78
  createOrganization: () => createOrganization_default,
@@ -105,6 +117,10 @@ __export(index_exports, {
105
117
  removeTrailingSlash: () => removeTrailingSlash_default,
106
118
  resolveFieldName: () => resolveFieldName_default,
107
119
  resolveFieldType: () => resolveFieldType_default,
120
+ resolveLocaleDisplayName: () => resolveLocaleDisplayName,
121
+ resolveLocaleEmoji: () => resolveLocaleEmoji_default,
122
+ resolveMeta: () => resolveMeta,
123
+ resolveVars: () => resolveVars,
108
124
  set: () => set_default,
109
125
  transformBrandingPreferenceToTheme: () => transformBrandingPreferenceToTheme_default,
110
126
  updateMeProfile: () => updateMeProfile_default,
@@ -785,8 +801,9 @@ var IsomorphicCrypto = class {
785
801
  *
786
802
  * @returns - code challenge.
787
803
  */
788
- getCodeChallenge(verifier) {
789
- return this.cryptoUtils.base64URLEncode(this.cryptoUtils.hashSha256(verifier));
804
+ async getCodeChallenge(verifier) {
805
+ const hashed = await this.cryptoUtils.hashSha256(verifier);
806
+ return this.cryptoUtils.base64URLEncode(hashed);
790
807
  }
791
808
  /**
792
809
  * Get JWK used for the id_token
@@ -1006,6 +1023,31 @@ var StorageManager = class _StorageManager {
1006
1023
  };
1007
1024
  var StorageManager_default = StorageManager;
1008
1025
 
1026
+ // src/utils/deepMerge.ts
1027
+ var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
1028
+ var deepMerge = (target, ...sources) => {
1029
+ if (!target || typeof target !== "object") {
1030
+ throw new Error("Target must be an object");
1031
+ }
1032
+ const result = { ...target };
1033
+ sources.forEach((source) => {
1034
+ if (!source || typeof source !== "object") {
1035
+ return;
1036
+ }
1037
+ Object.keys(source).forEach((key) => {
1038
+ const sourceValue = source[key];
1039
+ const targetValue = result[key];
1040
+ if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
1041
+ result[key] = deepMerge(targetValue, sourceValue);
1042
+ } else if (sourceValue !== void 0) {
1043
+ result[key] = sourceValue;
1044
+ }
1045
+ });
1046
+ });
1047
+ return result;
1048
+ };
1049
+ var deepMerge_default = deepMerge;
1050
+
1009
1051
  // src/utils/extractPkceStorageKeyFromState.ts
1010
1052
  var extractPkceStorageKeyFromState = (state) => {
1011
1053
  const index = parseInt(state.split("request_")[1], 10);
@@ -1246,7 +1288,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
1246
1288
  let codeChallenge;
1247
1289
  if (configData.enablePKCE) {
1248
1290
  codeVerifier = this.cryptoHelper?.getCodeVerifier();
1249
- codeChallenge = this.cryptoHelper?.getCodeChallenge(codeVerifier);
1291
+ codeChallenge = await this.cryptoHelper?.getCodeChallenge(codeVerifier);
1250
1292
  await this.storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);
1251
1293
  }
1252
1294
  if (authRequestConfig["client_secret"]) {
@@ -2013,7 +2055,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
2013
2055
  * @preserve
2014
2056
  */
2015
2057
  async reInitialize(config) {
2016
- await this.storageManager.setConfigData(config);
2058
+ const currentConfig = this.storageManager.getConfigData();
2059
+ const newConfig = deepMerge_default(currentConfig, config);
2060
+ await this.storageManager.setConfigData(newConfig);
2017
2061
  await this.loadOpenIDProviderConfiguration(true);
2018
2062
  }
2019
2063
  static async clearSession(userId) {
@@ -3379,10 +3423,14 @@ var EmbeddedFlowComponentType2 = /* @__PURE__ */ ((EmbeddedFlowComponentType3) =
3379
3423
  EmbeddedFlowComponentType3["Block"] = "BLOCK";
3380
3424
  EmbeddedFlowComponentType3["Divider"] = "DIVIDER";
3381
3425
  EmbeddedFlowComponentType3["EmailInput"] = "EMAIL_INPUT";
3426
+ EmbeddedFlowComponentType3["Icon"] = "ICON";
3427
+ EmbeddedFlowComponentType3["Image"] = "IMAGE";
3382
3428
  EmbeddedFlowComponentType3["OtpInput"] = "OTP_INPUT";
3383
3429
  EmbeddedFlowComponentType3["PasswordInput"] = "PASSWORD_INPUT";
3384
3430
  EmbeddedFlowComponentType3["PhoneInput"] = "PHONE_INPUT";
3431
+ EmbeddedFlowComponentType3["RichText"] = "RICH_TEXT";
3385
3432
  EmbeddedFlowComponentType3["Select"] = "SELECT";
3433
+ EmbeddedFlowComponentType3["Stack"] = "STACK";
3386
3434
  EmbeddedFlowComponentType3["Text"] = "TEXT";
3387
3435
  EmbeddedFlowComponentType3["TextInput"] = "TEXT_INPUT";
3388
3436
  return EmbeddedFlowComponentType3;
@@ -3439,6 +3487,12 @@ var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
3439
3487
  return FlowMode2;
3440
3488
  })(FlowMode || {});
3441
3489
 
3490
+ // src/models/agent.ts
3491
+ var AgentConfig;
3492
+ ((AgentConfig2) => {
3493
+ AgentConfig2.DEFAULT_AUTHENTICATOR_NAME = "Username & Password";
3494
+ })(AgentConfig || (AgentConfig = {}));
3495
+
3442
3496
  // src/models/scim2-schema.ts
3443
3497
  var WellKnownSchemaIds = /* @__PURE__ */ ((WellKnownSchemaIds2) => {
3444
3498
  WellKnownSchemaIds2["Core"] = "urn:ietf:params:scim:schemas:core:2.0";
@@ -3465,8 +3519,225 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
3465
3519
  return FieldType2;
3466
3520
  })(FieldType || {});
3467
3521
 
3522
+ // src/DefaultCacheStore.ts
3523
+ var DefaultCacheStore = class {
3524
+ constructor() {
3525
+ __publicField(this, "cache");
3526
+ this.cache = /* @__PURE__ */ new Map();
3527
+ }
3528
+ get length() {
3529
+ return this.cache.size;
3530
+ }
3531
+ getItem(key) {
3532
+ return this.cache.get(key) ?? null;
3533
+ }
3534
+ setItem(key, value) {
3535
+ this.cache.set(key, value);
3536
+ }
3537
+ removeItem(key) {
3538
+ this.cache.delete(key);
3539
+ }
3540
+ clear() {
3541
+ this.cache.clear();
3542
+ }
3543
+ key(index) {
3544
+ const keys = Array.from(this.cache.keys());
3545
+ return keys[index] ?? null;
3546
+ }
3547
+ async setData(key, value) {
3548
+ this.cache.set(key, value);
3549
+ }
3550
+ async getData(key) {
3551
+ return this.cache.get(key) ?? "{}";
3552
+ }
3553
+ async removeData(key) {
3554
+ this.cache.delete(key);
3555
+ }
3556
+ };
3557
+
3558
+ // src/DefaultCrypto.ts
3559
+ var jose = __toESM(require("jose"), 1);
3560
+ var DefaultCrypto = class {
3561
+ // eslint-disable-next-line class-methods-use-this
3562
+ base64URLDecode(value) {
3563
+ const decodedArray = jose.base64url.decode(value);
3564
+ return new TextDecoder().decode(decodedArray);
3565
+ }
3566
+ // eslint-disable-next-line class-methods-use-this
3567
+ base64URLEncode(value) {
3568
+ return jose.base64url.encode(value);
3569
+ }
3570
+ // eslint-disable-next-line class-methods-use-this
3571
+ generateRandomBytes(length) {
3572
+ return crypto.getRandomValues(new Uint8Array(length));
3573
+ }
3574
+ // eslint-disable-next-line class-methods-use-this
3575
+ async hashSha256(data) {
3576
+ const encoder = new TextEncoder();
3577
+ const dataBuffer = encoder.encode(data);
3578
+ const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
3579
+ return new Uint8Array(hashBuffer);
3580
+ }
3581
+ // eslint-disable-next-line class-methods-use-this
3582
+ async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
3583
+ const key = await jose.importJWK(jwk);
3584
+ await jose.jwtVerify(idToken, key, {
3585
+ algorithms,
3586
+ audience: clientId,
3587
+ clockTolerance,
3588
+ issuer: validateJwtIssuer ? issuer : void 0,
3589
+ subject
3590
+ });
3591
+ return true;
3592
+ }
3593
+ };
3594
+
3468
3595
  // src/AsgardeoJavaScriptClient.ts
3469
3596
  var AsgardeoJavaScriptClient = class {
3597
+ constructor(config, cacheStore, cryptoUtils) {
3598
+ __publicField(this, "cacheStore");
3599
+ __publicField(this, "cryptoUtils");
3600
+ __publicField(this, "auth");
3601
+ __publicField(this, "storageManager");
3602
+ __publicField(this, "baseURL");
3603
+ this.cacheStore = cacheStore ?? new DefaultCacheStore();
3604
+ this.cryptoUtils = cryptoUtils ?? new DefaultCrypto();
3605
+ this.auth = new AsgardeoAuthClient();
3606
+ if (config) {
3607
+ this.auth.initialize(config, this.cacheStore, this.cryptoUtils);
3608
+ this.storageManager = this.auth.getStorageManager();
3609
+ }
3610
+ this.baseURL = config?.baseUrl ?? "";
3611
+ }
3612
+ /* eslint-disable class-methods-use-this, @typescript-eslint/no-unused-vars */
3613
+ switchOrganization(_organization, _sessionId) {
3614
+ throw new Error("Method not implemented.");
3615
+ }
3616
+ initialize(_config, _storage) {
3617
+ throw new Error("Method not implemented.");
3618
+ }
3619
+ reInitialize(_config) {
3620
+ throw new Error("Method not implemented.");
3621
+ }
3622
+ getUser(_options) {
3623
+ throw new Error("Method not implemented.");
3624
+ }
3625
+ getAllOrganizations(_options, _sessionId) {
3626
+ throw new Error("Method not implemented.");
3627
+ }
3628
+ getMyOrganizations(_options, _sessionId) {
3629
+ throw new Error("Method not implemented.");
3630
+ }
3631
+ getCurrentOrganization(_sessionId) {
3632
+ throw new Error("Method not implemented.");
3633
+ }
3634
+ getUserProfile(_options) {
3635
+ throw new Error("Method not implemented.");
3636
+ }
3637
+ isLoading() {
3638
+ throw new Error("Method not implemented.");
3639
+ }
3640
+ isSignedIn() {
3641
+ throw new Error("Method not implemented.");
3642
+ }
3643
+ updateUserProfile(_payload, _userId) {
3644
+ throw new Error("Method not implemented.");
3645
+ }
3646
+ getConfiguration() {
3647
+ throw new Error("Method not implemented.");
3648
+ }
3649
+ exchangeToken(_config, _sessionId) {
3650
+ throw new Error("Method not implemented.");
3651
+ }
3652
+ signInSilently(_options) {
3653
+ throw new Error("Method not implemented.");
3654
+ }
3655
+ getAccessToken(_sessionId) {
3656
+ throw new Error("Method not implemented.");
3657
+ }
3658
+ clearSession(_sessionId) {
3659
+ throw new Error("Method not implemented.");
3660
+ }
3661
+ setSession(_sessionData, _sessionId) {
3662
+ throw new Error("Method not implemented.");
3663
+ }
3664
+ decodeJwtToken(_token) {
3665
+ throw new Error("Method not implemented.");
3666
+ }
3667
+ signIn(_options) {
3668
+ throw new Error("Method not implemented.");
3669
+ }
3670
+ signOut(_options, _sessionIdOrAfterSignOut, _afterSignOut) {
3671
+ throw new Error("Method not implemented.");
3672
+ }
3673
+ signUp(_optionsOrPayload) {
3674
+ throw new Error("Method not implemented.");
3675
+ }
3676
+ /* eslint-enable class-methods-use-this, @typescript-eslint/no-unused-vars */
3677
+ async getAgentToken(agentConfig) {
3678
+ const customParam = {
3679
+ response_mode: "direct"
3680
+ };
3681
+ const authorizeURL = new URL(await this.auth.getSignInUrl(customParam));
3682
+ const authorizeResponse = await initializeEmbeddedSignInFlow_default({
3683
+ payload: Object.fromEntries(authorizeURL.searchParams.entries()),
3684
+ url: `${authorizeURL.origin}${authorizeURL.pathname}`
3685
+ });
3686
+ const authenticatorName = agentConfig.authenticatorName ?? AgentConfig.DEFAULT_AUTHENTICATOR_NAME;
3687
+ const targetAuthenticator = authorizeResponse.nextStep.authenticators.find(
3688
+ (auth) => auth.authenticator === authenticatorName
3689
+ );
3690
+ if (!targetAuthenticator) {
3691
+ throw new Error(`Authenticator '${authenticatorName}' not found among authentication steps.`);
3692
+ }
3693
+ const authnRequest = {
3694
+ baseUrl: this.baseURL,
3695
+ payload: {
3696
+ flowId: authorizeResponse.flowId,
3697
+ selectedAuthenticator: {
3698
+ authenticatorId: targetAuthenticator.authenticatorId,
3699
+ params: {
3700
+ password: agentConfig.agentSecret,
3701
+ username: agentConfig.agentID
3702
+ }
3703
+ }
3704
+ }
3705
+ };
3706
+ const authnResponse = await executeEmbeddedSignInFlow_default(authnRequest);
3707
+ if (authnResponse.flowStatus !== "SUCCESS_COMPLETED" /* SuccessCompleted */) {
3708
+ throw new Error("Agent authentication failed.");
3709
+ }
3710
+ return this.auth.requestAccessToken(
3711
+ authnResponse.authData["code"],
3712
+ authnResponse.authData["session_state"],
3713
+ authnResponse.authData["state"]
3714
+ );
3715
+ }
3716
+ async getOBOSignInURL(agentConfig) {
3717
+ const customParam = {
3718
+ requested_actor: agentConfig.agentID
3719
+ };
3720
+ const authURL = await this.auth.getSignInUrl(customParam);
3721
+ if (authURL) {
3722
+ return authURL.toString();
3723
+ }
3724
+ throw new Error("Could not build Authorize URL");
3725
+ }
3726
+ async getOBOToken(agentConfig, authCodeResponse) {
3727
+ const agentToken = await this.getAgentToken(agentConfig);
3728
+ const tokenRequestConfig = {
3729
+ params: {
3730
+ actor_token: agentToken.accessToken
3731
+ }
3732
+ };
3733
+ return this.auth.requestAccessToken(
3734
+ authCodeResponse.code,
3735
+ authCodeResponse.session_state,
3736
+ authCodeResponse.state,
3737
+ void 0,
3738
+ tokenRequestConfig
3739
+ );
3740
+ }
3470
3741
  };
3471
3742
  var AsgardeoJavaScriptClient_default = AsgardeoJavaScriptClient;
3472
3743
 
@@ -4060,9 +4331,9 @@ var arrayBufferToBase64url = (buffer) => {
4060
4331
  var arrayBufferToBase64url_default = arrayBufferToBase64url;
4061
4332
 
4062
4333
  // src/utils/base64urlToArrayBuffer.ts
4063
- var base64urlToArrayBuffer = (base64url) => {
4064
- const padding = "=".repeat((4 - base64url.length % 4) % 4);
4065
- const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/") + padding;
4334
+ var base64urlToArrayBuffer = (base64url2) => {
4335
+ const padding = "=".repeat((4 - base64url2.length % 4) % 4);
4336
+ const base64 = base64url2.replace(/-/g, "+").replace(/_/g, "/") + padding;
4066
4337
  const binaryString = atob(base64);
4067
4338
  const bytes = new Uint8Array(binaryString.length);
4068
4339
  for (let i = 0; i < binaryString.length; i += 1) {
@@ -4100,31 +4371,6 @@ var formatDate = (dateString) => {
4100
4371
  };
4101
4372
  var formatDate_default = formatDate;
4102
4373
 
4103
- // src/utils/deepMerge.ts
4104
- var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
4105
- var deepMerge = (target, ...sources) => {
4106
- if (!target || typeof target !== "object") {
4107
- throw new Error("Target must be an object");
4108
- }
4109
- const result = { ...target };
4110
- sources.forEach((source) => {
4111
- if (!source || typeof source !== "object") {
4112
- return;
4113
- }
4114
- Object.keys(source).forEach((key) => {
4115
- const sourceValue = source[key];
4116
- const targetValue = result[key];
4117
- if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
4118
- result[key] = deepMerge(targetValue, sourceValue);
4119
- } else if (sourceValue !== void 0) {
4120
- result[key] = sourceValue;
4121
- }
4122
- });
4123
- });
4124
- return result;
4125
- };
4126
- var deepMerge_default = deepMerge;
4127
-
4128
4374
  // src/utils/logger.ts
4129
4375
  var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
4130
4376
  var DEFAULT_CONFIG = {
@@ -4756,6 +5002,116 @@ var resolveFieldName = (field) => {
4756
5002
  };
4757
5003
  var resolveFieldName_default = resolveFieldName;
4758
5004
 
5005
+ // src/utils/v2/resolveMeta.ts
5006
+ function resolveMeta(path, meta) {
5007
+ const value = path.split(".").reduce((current, part) => {
5008
+ if (current == null || typeof current !== "object") {
5009
+ return void 0;
5010
+ }
5011
+ const obj = current;
5012
+ const snakePart = part.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
5013
+ return part in obj ? obj[part] : obj[snakePart];
5014
+ }, meta);
5015
+ return value != null ? String(value) : "";
5016
+ }
5017
+
5018
+ // src/utils/v2/resolveVars.ts
5019
+ function resolveVars(text, { t, meta }) {
5020
+ if (!text) {
5021
+ return "";
5022
+ }
5023
+ return text.replace(/\{\{(.+?)\}\}/g, (match, content) => {
5024
+ const trimmed = content.trim();
5025
+ const tMatch = trimmed.match(/^t\((.+)\)$/);
5026
+ if (tMatch) {
5027
+ let key = tMatch[1].trim();
5028
+ if (key.startsWith('"') && key.endsWith('"') || key.startsWith("'") && key.endsWith("'")) {
5029
+ key = key.slice(1, -1);
5030
+ }
5031
+ return t(key.replace(/:/g, "."));
5032
+ }
5033
+ if (meta) {
5034
+ const metaMatch = trimmed.match(/^meta\((.+)\)$/);
5035
+ if (metaMatch) {
5036
+ let path = metaMatch[1].trim();
5037
+ if (path.startsWith('"') && path.endsWith('"') || path.startsWith("'") && path.endsWith("'")) {
5038
+ path = path.slice(1, -1);
5039
+ }
5040
+ return resolveMeta(path, meta);
5041
+ }
5042
+ }
5043
+ return match;
5044
+ });
5045
+ }
5046
+
5047
+ // src/utils/v2/countryCodeToFlagEmoji.ts
5048
+ function countryCodeToFlagEmoji(countryCode) {
5049
+ return countryCode.toUpperCase().split("").map((char) => String.fromCodePoint(127462 - 65 + char.charCodeAt(0))).join("");
5050
+ }
5051
+
5052
+ // src/utils/v2/resolveLocaleDisplayName.ts
5053
+ function resolveLocaleDisplayName(locale, displayLocale) {
5054
+ try {
5055
+ const displayNames = new Intl.DisplayNames([displayLocale], { type: "language" });
5056
+ return displayNames.of(locale) ?? locale;
5057
+ } catch {
5058
+ return locale;
5059
+ }
5060
+ }
5061
+
5062
+ // src/utils/v2/resolveLocaleEmoji.ts
5063
+ var LANGUAGE_TO_COUNTRY = {
5064
+ am: "ET",
5065
+ ar: "SA",
5066
+ bn: "BD",
5067
+ cs: "CZ",
5068
+ da: "DK",
5069
+ de: "DE",
5070
+ el: "GR",
5071
+ en: "GB",
5072
+ es: "ES",
5073
+ fa: "IR",
5074
+ fi: "FI",
5075
+ fr: "FR",
5076
+ he: "IL",
5077
+ hi: "IN",
5078
+ hu: "HU",
5079
+ id: "ID",
5080
+ it: "IT",
5081
+ ja: "JP",
5082
+ ko: "KR",
5083
+ ml: "IN",
5084
+ ms: "MY",
5085
+ nl: "NL",
5086
+ no: "NO",
5087
+ pl: "PL",
5088
+ pt: "PT",
5089
+ ro: "RO",
5090
+ ru: "RU",
5091
+ si: "LK",
5092
+ sk: "SK",
5093
+ sv: "SE",
5094
+ sw: "KE",
5095
+ ta: "IN",
5096
+ th: "TH",
5097
+ tr: "TR",
5098
+ uk: "UA",
5099
+ ur: "PK",
5100
+ vi: "VN",
5101
+ zh: "CN"
5102
+ };
5103
+ function resolveLocaleEmoji(locale) {
5104
+ const parts = locale.split("-");
5105
+ const languageCode = parts[0].toLowerCase();
5106
+ const countrySubtag = parts.length > 1 ? parts[parts.length - 1].toUpperCase() : void 0;
5107
+ const countryCode = countrySubtag ?? LANGUAGE_TO_COUNTRY[languageCode];
5108
+ if (!countryCode || countryCode.length !== 2) {
5109
+ return "\u{1F310}";
5110
+ }
5111
+ return countryCodeToFlagEmoji(countryCode);
5112
+ }
5113
+ var resolveLocaleEmoji_default = resolveLocaleEmoji;
5114
+
4759
5115
  // src/utils/withVendorCSSClassPrefix.ts
4760
5116
  var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
4761
5117
  var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
@@ -4899,6 +5255,7 @@ var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
4899
5255
  var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
4900
5256
  // Annotate the CommonJS export names for ESM import in node:
4901
5257
  0 && (module.exports = {
5258
+ AgentConfig,
4902
5259
  ApplicationNativeAuthenticationConstants,
4903
5260
  AsgardeoAPIError,
4904
5261
  AsgardeoAuthClient,
@@ -4939,6 +5296,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
4939
5296
  base64urlToArrayBuffer,
4940
5297
  bem,
4941
5298
  configureLogger,
5299
+ countryCodeToFlagEmoji,
4942
5300
  createComponentLogger,
4943
5301
  createLogger,
4944
5302
  createOrganization,
@@ -4983,6 +5341,10 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
4983
5341
  removeTrailingSlash,
4984
5342
  resolveFieldName,
4985
5343
  resolveFieldType,
5344
+ resolveLocaleDisplayName,
5345
+ resolveLocaleEmoji,
5346
+ resolveMeta,
5347
+ resolveVars,
4986
5348
  set,
4987
5349
  transformBrandingPreferenceToTheme,
4988
5350
  updateMeProfile,