@asgardeo/javascript 0.7.3 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,
@@ -48,6 +59,7 @@ __export(index_exports, {
48
59
  EmbeddedSignUpFlowStatusV2: () => EmbeddedSignUpFlowStatus,
49
60
  EmbeddedSignUpFlowTypeV2: () => EmbeddedSignUpFlowType,
50
61
  FieldType: () => FieldType,
62
+ FlowMetaType: () => FlowMetaType,
51
63
  FlowMode: () => FlowMode,
52
64
  IsomorphicCrypto: () => IsomorphicCrypto,
53
65
  OIDCRequestConstants: () => OIDCRequestConstants_default,
@@ -85,6 +97,7 @@ __export(index_exports, {
85
97
  get: () => get_default,
86
98
  getAllOrganizations: () => getAllOrganizations_default,
87
99
  getBrandingPreference: () => getBrandingPreference_default,
100
+ getFlowMetaV2: () => getFlowMetaV2_default,
88
101
  getLatestStateParam: () => getLatestStateParam_default,
89
102
  getMeOrganizations: () => getMeOrganizations_default,
90
103
  getOrganization: () => getOrganization_default,
@@ -103,6 +116,8 @@ __export(index_exports, {
103
116
  removeTrailingSlash: () => removeTrailingSlash_default,
104
117
  resolveFieldName: () => resolveFieldName_default,
105
118
  resolveFieldType: () => resolveFieldType_default,
119
+ resolveMeta: () => resolveMeta,
120
+ resolveVars: () => resolveVars,
106
121
  set: () => set_default,
107
122
  transformBrandingPreferenceToTheme: () => transformBrandingPreferenceToTheme_default,
108
123
  updateMeProfile: () => updateMeProfile_default,
@@ -783,8 +798,9 @@ var IsomorphicCrypto = class {
783
798
  *
784
799
  * @returns - code challenge.
785
800
  */
786
- getCodeChallenge(verifier) {
787
- return this.cryptoUtils.base64URLEncode(this.cryptoUtils.hashSha256(verifier));
801
+ async getCodeChallenge(verifier) {
802
+ const hashed = await this.cryptoUtils.hashSha256(verifier);
803
+ return this.cryptoUtils.base64URLEncode(hashed);
788
804
  }
789
805
  /**
790
806
  * Get JWK used for the id_token
@@ -1004,6 +1020,31 @@ var StorageManager = class _StorageManager {
1004
1020
  };
1005
1021
  var StorageManager_default = StorageManager;
1006
1022
 
1023
+ // src/utils/deepMerge.ts
1024
+ var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
1025
+ var deepMerge = (target, ...sources) => {
1026
+ if (!target || typeof target !== "object") {
1027
+ throw new Error("Target must be an object");
1028
+ }
1029
+ const result = { ...target };
1030
+ sources.forEach((source) => {
1031
+ if (!source || typeof source !== "object") {
1032
+ return;
1033
+ }
1034
+ Object.keys(source).forEach((key) => {
1035
+ const sourceValue = source[key];
1036
+ const targetValue = result[key];
1037
+ if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
1038
+ result[key] = deepMerge(targetValue, sourceValue);
1039
+ } else if (sourceValue !== void 0) {
1040
+ result[key] = sourceValue;
1041
+ }
1042
+ });
1043
+ });
1044
+ return result;
1045
+ };
1046
+ var deepMerge_default = deepMerge;
1047
+
1007
1048
  // src/utils/extractPkceStorageKeyFromState.ts
1008
1049
  var extractPkceStorageKeyFromState = (state) => {
1009
1050
  const index = parseInt(state.split("request_")[1], 10);
@@ -1146,7 +1187,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
1146
1187
  } else {
1147
1188
  this.instanceIdValue += 1;
1148
1189
  }
1149
- if (instanceID) {
1190
+ if (instanceID !== void 0) {
1150
1191
  this.instanceIdValue = instanceID;
1151
1192
  }
1152
1193
  if (!clientId) {
@@ -1244,7 +1285,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
1244
1285
  let codeChallenge;
1245
1286
  if (configData.enablePKCE) {
1246
1287
  codeVerifier = this.cryptoHelper?.getCodeVerifier();
1247
- codeChallenge = this.cryptoHelper?.getCodeChallenge(codeVerifier);
1288
+ codeChallenge = await this.cryptoHelper?.getCodeChallenge(codeVerifier);
1248
1289
  await this.storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);
1249
1290
  }
1250
1291
  if (authRequestConfig["client_secret"]) {
@@ -2011,7 +2052,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
2011
2052
  * @preserve
2012
2053
  */
2013
2054
  async reInitialize(config) {
2014
- await this.storageManager.setConfigData(config);
2055
+ const currentConfig = this.storageManager.getConfigData();
2056
+ const newConfig = deepMerge_default(currentConfig, config);
2057
+ await this.storageManager.setConfigData(newConfig);
2015
2058
  await this.loadOpenIDProviderConfiguration(true);
2016
2059
  }
2017
2060
  static async clearSession(userId) {
@@ -3248,6 +3291,65 @@ var executeEmbeddedUserOnboardingFlowV2 = async ({
3248
3291
  };
3249
3292
  var executeEmbeddedUserOnboardingFlowV2_default = executeEmbeddedUserOnboardingFlowV2;
3250
3293
 
3294
+ // src/api/v2/getFlowMetaV2.ts
3295
+ var getFlowMetaV2 = async ({
3296
+ url,
3297
+ baseUrl,
3298
+ type,
3299
+ id,
3300
+ language,
3301
+ namespace,
3302
+ ...requestConfig
3303
+ }) => {
3304
+ if (!type) {
3305
+ throw new AsgardeoAPIError(
3306
+ 'The "type" parameter is required',
3307
+ "getFlowMetaV2-ValidationError-001",
3308
+ "javascript",
3309
+ 400,
3310
+ 'The "type" query parameter must be either "APP" or "OU".'
3311
+ );
3312
+ }
3313
+ if (!id) {
3314
+ throw new AsgardeoAPIError(
3315
+ 'The "id" parameter is required',
3316
+ "getFlowMetaV2-ValidationError-002",
3317
+ "javascript",
3318
+ 400,
3319
+ 'The "id" query parameter must be a valid UUID of the target application or organization unit.'
3320
+ );
3321
+ }
3322
+ const queryParams = new URLSearchParams({
3323
+ id,
3324
+ type,
3325
+ ...language ? { language } : {},
3326
+ ...namespace ? { namespace } : {}
3327
+ });
3328
+ const baseEndpoint = url ?? `${baseUrl}/flow/meta`;
3329
+ const endpoint = `${baseEndpoint}?${queryParams.toString()}`;
3330
+ const response = await fetch(endpoint, {
3331
+ ...requestConfig,
3332
+ headers: {
3333
+ Accept: "application/json",
3334
+ ...requestConfig.headers
3335
+ },
3336
+ method: "GET"
3337
+ });
3338
+ if (!response.ok) {
3339
+ const errorText = await response.text();
3340
+ throw new AsgardeoAPIError(
3341
+ `Flow metadata request failed: ${errorText}`,
3342
+ "getFlowMetaV2-ResponseError-001",
3343
+ "javascript",
3344
+ response.status,
3345
+ response.statusText
3346
+ );
3347
+ }
3348
+ const flowMetadata = await response.json();
3349
+ return flowMetadata;
3350
+ };
3351
+ var getFlowMetaV2_default = getFlowMetaV2;
3352
+
3251
3353
  // src/constants/ApplicationNativeAuthenticationConstants.ts
3252
3354
  var ApplicationNativeAuthenticationConstants = {
3253
3355
  SupportedAuthenticators: {
@@ -3318,10 +3420,14 @@ var EmbeddedFlowComponentType2 = /* @__PURE__ */ ((EmbeddedFlowComponentType3) =
3318
3420
  EmbeddedFlowComponentType3["Block"] = "BLOCK";
3319
3421
  EmbeddedFlowComponentType3["Divider"] = "DIVIDER";
3320
3422
  EmbeddedFlowComponentType3["EmailInput"] = "EMAIL_INPUT";
3423
+ EmbeddedFlowComponentType3["Icon"] = "ICON";
3424
+ EmbeddedFlowComponentType3["Image"] = "IMAGE";
3321
3425
  EmbeddedFlowComponentType3["OtpInput"] = "OTP_INPUT";
3322
3426
  EmbeddedFlowComponentType3["PasswordInput"] = "PASSWORD_INPUT";
3323
3427
  EmbeddedFlowComponentType3["PhoneInput"] = "PHONE_INPUT";
3428
+ EmbeddedFlowComponentType3["RichText"] = "RICH_TEXT";
3324
3429
  EmbeddedFlowComponentType3["Select"] = "SELECT";
3430
+ EmbeddedFlowComponentType3["Stack"] = "STACK";
3325
3431
  EmbeddedFlowComponentType3["Text"] = "TEXT";
3326
3432
  EmbeddedFlowComponentType3["TextInput"] = "TEXT_INPUT";
3327
3433
  return EmbeddedFlowComponentType3;
@@ -3364,6 +3470,13 @@ var EmbeddedFlowEventType = /* @__PURE__ */ ((EmbeddedFlowEventType2) => {
3364
3470
  return EmbeddedFlowEventType2;
3365
3471
  })(EmbeddedFlowEventType || {});
3366
3472
 
3473
+ // src/models/v2/flow-meta-v2.ts
3474
+ var FlowMetaType = /* @__PURE__ */ ((FlowMetaType2) => {
3475
+ FlowMetaType2["App"] = "APP";
3476
+ FlowMetaType2["Ou"] = "OU";
3477
+ return FlowMetaType2;
3478
+ })(FlowMetaType || {});
3479
+
3367
3480
  // src/models/flow.ts
3368
3481
  var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
3369
3482
  FlowMode2["Embedded"] = "DIRECT";
@@ -3371,6 +3484,12 @@ var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
3371
3484
  return FlowMode2;
3372
3485
  })(FlowMode || {});
3373
3486
 
3487
+ // src/models/agent.ts
3488
+ var AgentConfig;
3489
+ ((AgentConfig2) => {
3490
+ AgentConfig2.DEFAULT_AUTHENTICATOR_NAME = "Username & Password";
3491
+ })(AgentConfig || (AgentConfig = {}));
3492
+
3374
3493
  // src/models/scim2-schema.ts
3375
3494
  var WellKnownSchemaIds = /* @__PURE__ */ ((WellKnownSchemaIds2) => {
3376
3495
  WellKnownSchemaIds2["Core"] = "urn:ietf:params:scim:schemas:core:2.0";
@@ -3397,8 +3516,225 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
3397
3516
  return FieldType2;
3398
3517
  })(FieldType || {});
3399
3518
 
3519
+ // src/DefaultCacheStore.ts
3520
+ var DefaultCacheStore = class {
3521
+ constructor() {
3522
+ __publicField(this, "cache");
3523
+ this.cache = /* @__PURE__ */ new Map();
3524
+ }
3525
+ get length() {
3526
+ return this.cache.size;
3527
+ }
3528
+ getItem(key) {
3529
+ return this.cache.get(key) ?? null;
3530
+ }
3531
+ setItem(key, value) {
3532
+ this.cache.set(key, value);
3533
+ }
3534
+ removeItem(key) {
3535
+ this.cache.delete(key);
3536
+ }
3537
+ clear() {
3538
+ this.cache.clear();
3539
+ }
3540
+ key(index) {
3541
+ const keys = Array.from(this.cache.keys());
3542
+ return keys[index] ?? null;
3543
+ }
3544
+ async setData(key, value) {
3545
+ this.cache.set(key, value);
3546
+ }
3547
+ async getData(key) {
3548
+ return this.cache.get(key) ?? "{}";
3549
+ }
3550
+ async removeData(key) {
3551
+ this.cache.delete(key);
3552
+ }
3553
+ };
3554
+
3555
+ // src/DefaultCrypto.ts
3556
+ var jose = __toESM(require("jose"), 1);
3557
+ var DefaultCrypto = class {
3558
+ // eslint-disable-next-line class-methods-use-this
3559
+ base64URLDecode(value) {
3560
+ const decodedArray = jose.base64url.decode(value);
3561
+ return new TextDecoder().decode(decodedArray);
3562
+ }
3563
+ // eslint-disable-next-line class-methods-use-this
3564
+ base64URLEncode(value) {
3565
+ return jose.base64url.encode(value);
3566
+ }
3567
+ // eslint-disable-next-line class-methods-use-this
3568
+ generateRandomBytes(length) {
3569
+ return crypto.getRandomValues(new Uint8Array(length));
3570
+ }
3571
+ // eslint-disable-next-line class-methods-use-this
3572
+ async hashSha256(data) {
3573
+ const encoder = new TextEncoder();
3574
+ const dataBuffer = encoder.encode(data);
3575
+ const hashBuffer = await crypto.subtle.digest("SHA-256", dataBuffer);
3576
+ return new Uint8Array(hashBuffer);
3577
+ }
3578
+ // eslint-disable-next-line class-methods-use-this
3579
+ async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
3580
+ const key = await jose.importJWK(jwk);
3581
+ await jose.jwtVerify(idToken, key, {
3582
+ algorithms,
3583
+ audience: clientId,
3584
+ clockTolerance,
3585
+ issuer: validateJwtIssuer ? issuer : void 0,
3586
+ subject
3587
+ });
3588
+ return true;
3589
+ }
3590
+ };
3591
+
3400
3592
  // src/AsgardeoJavaScriptClient.ts
3401
3593
  var AsgardeoJavaScriptClient = class {
3594
+ constructor(config, cacheStore, cryptoUtils) {
3595
+ __publicField(this, "cacheStore");
3596
+ __publicField(this, "cryptoUtils");
3597
+ __publicField(this, "auth");
3598
+ __publicField(this, "storageManager");
3599
+ __publicField(this, "baseURL");
3600
+ this.cacheStore = cacheStore ?? new DefaultCacheStore();
3601
+ this.cryptoUtils = cryptoUtils ?? new DefaultCrypto();
3602
+ this.auth = new AsgardeoAuthClient();
3603
+ if (config) {
3604
+ this.auth.initialize(config, this.cacheStore, this.cryptoUtils);
3605
+ this.storageManager = this.auth.getStorageManager();
3606
+ }
3607
+ this.baseURL = config?.baseUrl ?? "";
3608
+ }
3609
+ /* eslint-disable class-methods-use-this, @typescript-eslint/no-unused-vars */
3610
+ switchOrganization(_organization, _sessionId) {
3611
+ throw new Error("Method not implemented.");
3612
+ }
3613
+ initialize(_config, _storage) {
3614
+ throw new Error("Method not implemented.");
3615
+ }
3616
+ reInitialize(_config) {
3617
+ throw new Error("Method not implemented.");
3618
+ }
3619
+ getUser(_options) {
3620
+ throw new Error("Method not implemented.");
3621
+ }
3622
+ getAllOrganizations(_options, _sessionId) {
3623
+ throw new Error("Method not implemented.");
3624
+ }
3625
+ getMyOrganizations(_options, _sessionId) {
3626
+ throw new Error("Method not implemented.");
3627
+ }
3628
+ getCurrentOrganization(_sessionId) {
3629
+ throw new Error("Method not implemented.");
3630
+ }
3631
+ getUserProfile(_options) {
3632
+ throw new Error("Method not implemented.");
3633
+ }
3634
+ isLoading() {
3635
+ throw new Error("Method not implemented.");
3636
+ }
3637
+ isSignedIn() {
3638
+ throw new Error("Method not implemented.");
3639
+ }
3640
+ updateUserProfile(_payload, _userId) {
3641
+ throw new Error("Method not implemented.");
3642
+ }
3643
+ getConfiguration() {
3644
+ throw new Error("Method not implemented.");
3645
+ }
3646
+ exchangeToken(_config, _sessionId) {
3647
+ throw new Error("Method not implemented.");
3648
+ }
3649
+ signInSilently(_options) {
3650
+ throw new Error("Method not implemented.");
3651
+ }
3652
+ getAccessToken(_sessionId) {
3653
+ throw new Error("Method not implemented.");
3654
+ }
3655
+ clearSession(_sessionId) {
3656
+ throw new Error("Method not implemented.");
3657
+ }
3658
+ setSession(_sessionData, _sessionId) {
3659
+ throw new Error("Method not implemented.");
3660
+ }
3661
+ decodeJwtToken(_token) {
3662
+ throw new Error("Method not implemented.");
3663
+ }
3664
+ signIn(_options) {
3665
+ throw new Error("Method not implemented.");
3666
+ }
3667
+ signOut(_options, _sessionIdOrAfterSignOut, _afterSignOut) {
3668
+ throw new Error("Method not implemented.");
3669
+ }
3670
+ signUp(_optionsOrPayload) {
3671
+ throw new Error("Method not implemented.");
3672
+ }
3673
+ /* eslint-enable class-methods-use-this, @typescript-eslint/no-unused-vars */
3674
+ async getAgentToken(agentConfig) {
3675
+ const customParam = {
3676
+ response_mode: "direct"
3677
+ };
3678
+ const authorizeURL = new URL(await this.auth.getSignInUrl(customParam));
3679
+ const authorizeResponse = await initializeEmbeddedSignInFlow_default({
3680
+ payload: Object.fromEntries(authorizeURL.searchParams.entries()),
3681
+ url: `${authorizeURL.origin}${authorizeURL.pathname}`
3682
+ });
3683
+ const authenticatorName = agentConfig.authenticatorName ?? AgentConfig.DEFAULT_AUTHENTICATOR_NAME;
3684
+ const targetAuthenticator = authorizeResponse.nextStep.authenticators.find(
3685
+ (auth) => auth.authenticator === authenticatorName
3686
+ );
3687
+ if (!targetAuthenticator) {
3688
+ throw new Error(`Authenticator '${authenticatorName}' not found among authentication steps.`);
3689
+ }
3690
+ const authnRequest = {
3691
+ baseUrl: this.baseURL,
3692
+ payload: {
3693
+ flowId: authorizeResponse.flowId,
3694
+ selectedAuthenticator: {
3695
+ authenticatorId: targetAuthenticator.authenticatorId,
3696
+ params: {
3697
+ password: agentConfig.agentSecret,
3698
+ username: agentConfig.agentID
3699
+ }
3700
+ }
3701
+ }
3702
+ };
3703
+ const authnResponse = await executeEmbeddedSignInFlow_default(authnRequest);
3704
+ if (authnResponse.flowStatus !== "SUCCESS_COMPLETED" /* SuccessCompleted */) {
3705
+ throw new Error("Agent authentication failed.");
3706
+ }
3707
+ return this.auth.requestAccessToken(
3708
+ authnResponse.authData["code"],
3709
+ authnResponse.authData["session_state"],
3710
+ authnResponse.authData["state"]
3711
+ );
3712
+ }
3713
+ async getOBOSignInURL(agentConfig) {
3714
+ const customParam = {
3715
+ requested_actor: agentConfig.agentID
3716
+ };
3717
+ const authURL = await this.auth.getSignInUrl(customParam);
3718
+ if (authURL) {
3719
+ return authURL.toString();
3720
+ }
3721
+ throw new Error("Could not build Authorize URL");
3722
+ }
3723
+ async getOBOToken(agentConfig, authCodeResponse) {
3724
+ const agentToken = await this.getAgentToken(agentConfig);
3725
+ const tokenRequestConfig = {
3726
+ params: {
3727
+ actor_token: agentToken.accessToken
3728
+ }
3729
+ };
3730
+ return this.auth.requestAccessToken(
3731
+ authCodeResponse.code,
3732
+ authCodeResponse.session_state,
3733
+ authCodeResponse.state,
3734
+ void 0,
3735
+ tokenRequestConfig
3736
+ );
3737
+ }
3402
3738
  };
3403
3739
  var AsgardeoJavaScriptClient_default = AsgardeoJavaScriptClient;
3404
3740
 
@@ -3992,9 +4328,9 @@ var arrayBufferToBase64url = (buffer) => {
3992
4328
  var arrayBufferToBase64url_default = arrayBufferToBase64url;
3993
4329
 
3994
4330
  // src/utils/base64urlToArrayBuffer.ts
3995
- var base64urlToArrayBuffer = (base64url) => {
3996
- const padding = "=".repeat((4 - base64url.length % 4) % 4);
3997
- const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/") + padding;
4331
+ var base64urlToArrayBuffer = (base64url2) => {
4332
+ const padding = "=".repeat((4 - base64url2.length % 4) % 4);
4333
+ const base64 = base64url2.replace(/-/g, "+").replace(/_/g, "/") + padding;
3998
4334
  const binaryString = atob(base64);
3999
4335
  const bytes = new Uint8Array(binaryString.length);
4000
4336
  for (let i = 0; i < binaryString.length; i += 1) {
@@ -4032,31 +4368,6 @@ var formatDate = (dateString) => {
4032
4368
  };
4033
4369
  var formatDate_default = formatDate;
4034
4370
 
4035
- // src/utils/deepMerge.ts
4036
- var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
4037
- var deepMerge = (target, ...sources) => {
4038
- if (!target || typeof target !== "object") {
4039
- throw new Error("Target must be an object");
4040
- }
4041
- const result = { ...target };
4042
- sources.forEach((source) => {
4043
- if (!source || typeof source !== "object") {
4044
- return;
4045
- }
4046
- Object.keys(source).forEach((key) => {
4047
- const sourceValue = source[key];
4048
- const targetValue = result[key];
4049
- if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
4050
- result[key] = deepMerge(targetValue, sourceValue);
4051
- } else if (sourceValue !== void 0) {
4052
- result[key] = sourceValue;
4053
- }
4054
- });
4055
- });
4056
- return result;
4057
- };
4058
- var deepMerge_default = deepMerge;
4059
-
4060
4371
  // src/utils/logger.ts
4061
4372
  var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
4062
4373
  var DEFAULT_CONFIG = {
@@ -4688,6 +4999,48 @@ var resolveFieldName = (field) => {
4688
4999
  };
4689
5000
  var resolveFieldName_default = resolveFieldName;
4690
5001
 
5002
+ // src/utils/v2/resolveMeta.ts
5003
+ function resolveMeta(path, meta) {
5004
+ const value = path.split(".").reduce((current, part) => {
5005
+ if (current == null || typeof current !== "object") {
5006
+ return void 0;
5007
+ }
5008
+ const obj = current;
5009
+ const snakePart = part.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
5010
+ return part in obj ? obj[part] : obj[snakePart];
5011
+ }, meta);
5012
+ return value != null ? String(value) : "";
5013
+ }
5014
+
5015
+ // src/utils/v2/resolveVars.ts
5016
+ function resolveVars(text, { t, meta }) {
5017
+ if (!text) {
5018
+ return "";
5019
+ }
5020
+ return text.replace(/\{\{(.+?)\}\}/g, (match, content) => {
5021
+ const trimmed = content.trim();
5022
+ const tMatch = trimmed.match(/^t\((.+)\)$/);
5023
+ if (tMatch) {
5024
+ let key = tMatch[1].trim();
5025
+ if (key.startsWith('"') && key.endsWith('"') || key.startsWith("'") && key.endsWith("'")) {
5026
+ key = key.slice(1, -1);
5027
+ }
5028
+ return t(key.replace(/:/g, "."));
5029
+ }
5030
+ if (meta) {
5031
+ const metaMatch = trimmed.match(/^meta\((.+)\)$/);
5032
+ if (metaMatch) {
5033
+ let path = metaMatch[1].trim();
5034
+ if (path.startsWith('"') && path.endsWith('"') || path.startsWith("'") && path.endsWith("'")) {
5035
+ path = path.slice(1, -1);
5036
+ }
5037
+ return resolveMeta(path, meta);
5038
+ }
5039
+ }
5040
+ return match;
5041
+ });
5042
+ }
5043
+
4691
5044
  // src/utils/withVendorCSSClassPrefix.ts
4692
5045
  var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
4693
5046
  var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
@@ -4831,6 +5184,7 @@ var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
4831
5184
  var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
4832
5185
  // Annotate the CommonJS export names for ESM import in node:
4833
5186
  0 && (module.exports = {
5187
+ AgentConfig,
4834
5188
  ApplicationNativeAuthenticationConstants,
4835
5189
  AsgardeoAPIError,
4836
5190
  AsgardeoAuthClient,
@@ -4858,6 +5212,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
4858
5212
  EmbeddedSignUpFlowStatusV2,
4859
5213
  EmbeddedSignUpFlowTypeV2,
4860
5214
  FieldType,
5215
+ FlowMetaType,
4861
5216
  FlowMode,
4862
5217
  IsomorphicCrypto,
4863
5218
  OIDCRequestConstants,
@@ -4895,6 +5250,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
4895
5250
  get,
4896
5251
  getAllOrganizations,
4897
5252
  getBrandingPreference,
5253
+ getFlowMetaV2,
4898
5254
  getLatestStateParam,
4899
5255
  getMeOrganizations,
4900
5256
  getOrganization,
@@ -4913,6 +5269,8 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
4913
5269
  removeTrailingSlash,
4914
5270
  resolveFieldName,
4915
5271
  resolveFieldType,
5272
+ resolveMeta,
5273
+ resolveVars,
4916
5274
  set,
4917
5275
  transformBrandingPreferenceToTheme,
4918
5276
  updateMeProfile,