@asgardeo/javascript 0.1.0 → 0.1.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.
Files changed (47) hide show
  1. package/dist/AsgardeoJavaScriptClient.d.ts +19 -52
  2. package/dist/IsomorphicCrypto.d.ts +2 -2
  3. package/dist/StorageManager.d.ts +1 -1
  4. package/dist/__legacy__/client.d.ts +2 -2
  5. package/dist/__legacy__/helpers/authentication-helper.d.ts +3 -3
  6. package/dist/api/createOrganization.d.ts +129 -0
  7. package/dist/api/executeEmbeddedSignInFlow.d.ts +21 -0
  8. package/dist/api/executeEmbeddedSignUpFlow.d.ts +44 -0
  9. package/dist/api/getAllOrganizations.d.ts +112 -0
  10. package/dist/api/getBrandingPreference.d.ts +103 -0
  11. package/dist/api/getMeOrganizations.d.ts +119 -0
  12. package/dist/api/getOrganization.d.ts +109 -0
  13. package/dist/api/getSchemas.d.ts +89 -0
  14. package/dist/api/getScim2Me.d.ts +89 -0
  15. package/dist/api/initializeEmbeddedSignInFlow.d.ts +51 -0
  16. package/dist/api/updateMeProfile.d.ts +82 -0
  17. package/dist/api/updateOrganization.d.ts +118 -0
  18. package/dist/cjs/index.js +1100 -157
  19. package/dist/cjs/index.js.map +4 -4
  20. package/dist/constants/OIDCRequestConstants.d.ts +1 -1
  21. package/dist/constants/ScopeConstants.d.ts +3 -6
  22. package/dist/constants/TokenExchangeConstants.d.ts +2 -2
  23. package/dist/constants/VendorConstants.d.ts +31 -0
  24. package/dist/index.d.ts +24 -6
  25. package/dist/index.js +1071 -148
  26. package/dist/index.js.map +4 -4
  27. package/dist/models/branding-preference.d.ts +248 -0
  28. package/dist/models/client.d.ts +55 -5
  29. package/dist/models/config.d.ts +54 -12
  30. package/dist/models/embedded-flow.d.ts +66 -0
  31. package/dist/models/embedded-signin-flow.d.ts +99 -0
  32. package/dist/models/flow.d.ts +30 -0
  33. package/dist/models/i18n.d.ts +24 -0
  34. package/dist/models/organization.d.ts +24 -0
  35. package/dist/models/token.d.ts +42 -30
  36. package/dist/theme/createTheme.d.ts +1 -1
  37. package/dist/theme/types.d.ts +42 -17
  38. package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +47 -0
  39. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +2 -2
  40. package/dist/utils/extractUserClaimsFromIdToken.d.ts +2 -2
  41. package/dist/utils/generateFlattenedUserProfile.d.ts +9 -2
  42. package/dist/utils/isEmpty.d.ts +48 -0
  43. package/dist/utils/withVendorCSSClassPrefix.d.ts +32 -0
  44. package/package.json +1 -1
  45. package/dist/api/handleApplicationNativeAuthentication.d.ts +0 -33
  46. package/dist/api/initializeApplicationNativeAuthentication.d.ts +0 -117
  47. package/dist/models/application-native-authentication.d.ts +0 -82
package/dist/cjs/index.js CHANGED
@@ -21,43 +21,63 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21
21
  // src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
- ApplicationNativeAuthenticationAuthenticatorKnownIdPType: () => ApplicationNativeAuthenticationAuthenticatorKnownIdPType,
25
- ApplicationNativeAuthenticationAuthenticatorParamType: () => ApplicationNativeAuthenticationAuthenticatorParamType,
26
- ApplicationNativeAuthenticationAuthenticatorPromptType: () => ApplicationNativeAuthenticationAuthenticatorPromptType,
27
24
  ApplicationNativeAuthenticationConstants: () => ApplicationNativeAuthenticationConstants_default,
28
- ApplicationNativeAuthenticationFlowStatus: () => ApplicationNativeAuthenticationFlowStatus,
29
- ApplicationNativeAuthenticationFlowType: () => ApplicationNativeAuthenticationFlowType,
30
- ApplicationNativeAuthenticationStepType: () => ApplicationNativeAuthenticationStepType,
31
25
  AsgardeoAPIError: () => AsgardeoAPIError,
32
26
  AsgardeoAuthClient: () => AsgardeoAuthClient,
33
27
  AsgardeoAuthException: () => AsgardeoAuthException,
34
28
  AsgardeoError: () => AsgardeoError,
35
29
  AsgardeoJavaScriptClient: () => AsgardeoJavaScriptClient_default,
36
30
  AsgardeoRuntimeError: () => AsgardeoRuntimeError,
31
+ EmbeddedFlowComponentType: () => EmbeddedFlowComponentType,
32
+ EmbeddedFlowResponseType: () => EmbeddedFlowResponseType,
33
+ EmbeddedFlowStatus: () => EmbeddedFlowStatus,
34
+ EmbeddedFlowType: () => EmbeddedFlowType,
35
+ EmbeddedSignInFlowAuthenticatorKnownIdPType: () => EmbeddedSignInFlowAuthenticatorKnownIdPType,
36
+ EmbeddedSignInFlowAuthenticatorParamType: () => EmbeddedSignInFlowAuthenticatorParamType,
37
+ EmbeddedSignInFlowAuthenticatorPromptType: () => EmbeddedSignInFlowAuthenticatorPromptType,
38
+ EmbeddedSignInFlowStatus: () => EmbeddedSignInFlowStatus,
39
+ EmbeddedSignInFlowStepType: () => EmbeddedSignInFlowStepType,
40
+ EmbeddedSignInFlowType: () => EmbeddedSignInFlowType,
37
41
  FieldType: () => FieldType,
42
+ FlowMode: () => FlowMode,
38
43
  IsomorphicCrypto: () => IsomorphicCrypto,
39
44
  OIDCRequestConstants: () => OIDCRequestConstants_default,
40
45
  StorageManager: () => StorageManager_default,
41
46
  TokenConstants: () => TokenConstants_default,
47
+ VendorConstants: () => VendorConstants_default,
42
48
  WellKnownSchemaIds: () => WellKnownSchemaIds,
49
+ createOrganization: () => createOrganization_default,
50
+ createPatchOperations: () => createPatchOperations,
43
51
  createTheme: () => createTheme_default,
44
52
  deepMerge: () => deepMerge_default,
53
+ deriveOrganizationHandleFromBaseUrl: () => deriveOrganizationHandleFromBaseUrl_default,
54
+ executeEmbeddedSignInFlow: () => executeEmbeddedSignInFlow_default,
55
+ executeEmbeddedSignUpFlow: () => executeEmbeddedSignUpFlow_default,
45
56
  extractPkceStorageKeyFromState: () => extractPkceStorageKeyFromState_default,
46
57
  extractUserClaimsFromIdToken: () => extractUserClaimsFromIdToken_default,
47
58
  flattenUserSchema: () => flattenUserSchema_default,
48
59
  generateFlattenedUserProfile: () => generateFlattenedUserProfile_default,
49
60
  generateUserProfile: () => generateUserProfile_default,
50
61
  get: () => get_default,
62
+ getAllOrganizations: () => getAllOrganizations_default,
63
+ getBrandingPreference: () => getBrandingPreference_default,
51
64
  getI18nBundles: () => getI18nBundles_default,
52
65
  getLatestStateParam: () => getLatestStateParam_default,
66
+ getMeOrganizations: () => getMeOrganizations_default,
67
+ getOrganization: () => getOrganization_default,
68
+ getSchemas: () => getSchemas_default,
69
+ getScim2Me: () => getScim2Me_default,
53
70
  getUserInfo: () => getUserInfo_default,
54
- handleApplicationNativeAuthentication: () => handleApplicationNativeAuthentication_default,
55
- initializeApplicationNativeAuthentication: () => initializeApplicationNativeAuthentication_default,
71
+ initializeEmbeddedSignInFlow: () => initializeEmbeddedSignInFlow_default,
72
+ isEmpty: () => isEmpty_default,
56
73
  processOpenIDScopes: () => processOpenIDScopes_default,
57
74
  removeTrailingSlash: () => removeTrailingSlash_default,
58
75
  resolveFieldName: () => resolveFieldName_default,
59
76
  resolveFieldType: () => resolveFieldType_default,
60
- set: () => set_default
77
+ set: () => set_default,
78
+ updateMeProfile: () => updateMeProfile_default,
79
+ updateOrganization: () => updateOrganization_default,
80
+ withVendorCSSClassPrefix: () => withVendorCSSClassPrefix_default
61
81
  });
62
82
  module.exports = __toCommonJS(index_exports);
63
83
 
@@ -120,8 +140,8 @@ var StorageManager = class {
120
140
  async setCustomData(key, customData, userId) {
121
141
  this.setDataInBulk(this._resolveKey(key, userId), customData);
122
142
  }
123
- async getConfigData() {
124
- return JSON.parse(await this._store.getData(this._resolveKey("config_data" /* ConfigData */)) ?? null);
143
+ async getConfigData(userId) {
144
+ return JSON.parse(await this._store.getData(this._resolveKey("config_data" /* ConfigData */, userId)) ?? null);
125
145
  }
126
146
  async loadOpenIDProviderConfiguration() {
127
147
  return JSON.parse(await this._store.getData(this._resolveKey("oidc_provider_meta_data" /* OIDCProviderMetaData */)) ?? null);
@@ -320,12 +340,24 @@ var OIDCDiscoveryConstants_default = OIDCDiscoveryConstants;
320
340
 
321
341
  // src/constants/ScopeConstants.ts
322
342
  var ScopeConstants = {
343
+ /**
344
+ * The scope for accessing the user's profile information from SCIM.
345
+ * This scope allows the client to retrieve basic user information such as
346
+ * name, email, profile picture, etc.
347
+ */
348
+ INTERNAL_LOGIN: "internal_login",
323
349
  /**
324
350
  * The base OpenID Connect scope.
325
351
  * Required for all OpenID Connect flows. Indicates that the client
326
352
  * is initiating an OpenID Connect authentication request.
327
353
  */
328
- OPENID: "openid"
354
+ OPENID: "openid",
355
+ /**
356
+ * The OpenID Connect profile scope.
357
+ * This scope allows the client to access the user's profile information.
358
+ * It includes details such as the user's name, email, and other profile attributes.
359
+ */
360
+ PROFILE: "profile"
329
361
  };
330
362
  var ScopeConstants_default = ScopeConstants;
331
363
 
@@ -363,7 +395,7 @@ var OIDCRequestConstants = {
363
395
  /**
364
396
  * The default scopes used in OIDC sign-in requests.
365
397
  */
366
- DEFAULT_SCOPES: [ScopeConstants_default.OPENID]
398
+ DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE, ScopeConstants_default.INTERNAL_LOGIN]
367
399
  }
368
400
  },
369
401
  /**
@@ -584,39 +616,6 @@ var extractPkceStorageKeyFromState = (state) => {
584
616
  };
585
617
  var extractPkceStorageKeyFromState_default = extractPkceStorageKeyFromState;
586
618
 
587
- // src/utils/extractUserClaimsFromIdToken.ts
588
- var extractUserClaimsFromIdToken = (payload) => {
589
- const filteredPayload = { ...payload };
590
- const protocolClaims = [
591
- "iss",
592
- "aud",
593
- "exp",
594
- "iat",
595
- "acr",
596
- "amr",
597
- "azp",
598
- "auth_time",
599
- "nonce",
600
- "c_hash",
601
- "at_hash",
602
- "nbf",
603
- "isk",
604
- "sid",
605
- "jti",
606
- "sub"
607
- ];
608
- protocolClaims.forEach((claim) => {
609
- delete filteredPayload[claim];
610
- });
611
- const userClaims = {};
612
- Object.entries(filteredPayload).forEach(([key, value]) => {
613
- const camelCasedKey = key.split("_").map((part, i) => i === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
614
- userClaims[camelCasedKey] = value;
615
- });
616
- return userClaims;
617
- };
618
- var extractUserClaimsFromIdToken_default = extractUserClaimsFromIdToken;
619
-
620
619
  // src/constants/TokenExchangeConstants.ts
621
620
  var TokenExchangeConstants = {
622
621
  /**
@@ -629,7 +628,7 @@ var TokenExchangeConstants = {
629
628
  * Placeholder for the token value in exchange requests.
630
629
  * Usually replaced with an access token or refresh token.
631
630
  */
632
- TOKEN: "{{token}}",
631
+ ACCESS_TOKEN: "{{accessToken}}",
633
632
  /**
634
633
  * Placeholder for the username in token exchange operations.
635
634
  * Used when user identity needs to be included in the exchange.
@@ -639,7 +638,7 @@ var TokenExchangeConstants = {
639
638
  * Placeholder for OAuth scopes in token exchange requests.
640
639
  * Replaced with space-separated scope strings.
641
640
  */
642
- SCOPE: "{{scope}}",
641
+ SCOPES: "{{scopes}}",
643
642
  /**
644
643
  * Placeholder for client ID in token exchange operations.
645
644
  * Required for client authentication.
@@ -654,6 +653,39 @@ var TokenExchangeConstants = {
654
653
  };
655
654
  var TokenExchangeConstants_default = TokenExchangeConstants;
656
655
 
656
+ // src/utils/extractUserClaimsFromIdToken.ts
657
+ var extractUserClaimsFromIdToken = (payload) => {
658
+ const filteredPayload = { ...payload };
659
+ const protocolClaims = [
660
+ "iss",
661
+ "aud",
662
+ "exp",
663
+ "iat",
664
+ "acr",
665
+ "amr",
666
+ "azp",
667
+ "auth_time",
668
+ "nonce",
669
+ "c_hash",
670
+ "at_hash",
671
+ "nbf",
672
+ "isk",
673
+ "sid",
674
+ "jti",
675
+ "sub"
676
+ ];
677
+ protocolClaims.forEach((claim) => {
678
+ delete filteredPayload[claim];
679
+ });
680
+ const userClaims = {};
681
+ Object.entries(filteredPayload).forEach(([key, value]) => {
682
+ const camelCasedKey = key.split("_").map((part, i) => i === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
683
+ userClaims[camelCasedKey] = value;
684
+ });
685
+ return userClaims;
686
+ };
687
+ var extractUserClaimsFromIdToken_default = extractUserClaimsFromIdToken;
688
+
657
689
  // src/errors/AsgardeoError.ts
658
690
  var AsgardeoError = class _AsgardeoError extends Error {
659
691
  constructor(message, code, origin) {
@@ -722,17 +754,19 @@ Message: ${this.message}`;
722
754
  // src/utils/processOpenIDScopes.ts
723
755
  var processOpenIDScopes = (scopes) => {
724
756
  let processedScopes = [];
725
- if (Array.isArray(scopes)) {
726
- processedScopes = scopes;
727
- } else if (typeof scopes === "string") {
728
- processedScopes = scopes.split(" ");
729
- } else {
730
- throw new AsgardeoRuntimeError(
731
- "Scopes must be a string or an array of strings.",
732
- "processOpenIDScopes-Invalid-001",
733
- "javascript",
734
- "The provided scopes are not in the expected format. Please provide a string or an array of strings."
735
- );
757
+ if (scopes) {
758
+ if (Array.isArray(scopes)) {
759
+ processedScopes = scopes;
760
+ } else if (typeof scopes === "string") {
761
+ processedScopes = scopes.split(" ");
762
+ } else {
763
+ throw new AsgardeoRuntimeError(
764
+ "Scopes must be a string or an array of strings.",
765
+ "processOpenIDScopes-Invalid-001",
766
+ "javascript",
767
+ "The provided scopes are not in the expected format. Please provide a string or an array of strings."
768
+ );
769
+ }
736
770
  }
737
771
  OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
738
772
  if (!processedScopes.includes(defaultScope)) {
@@ -751,8 +785,8 @@ var AuthenticationHelper = class {
751
785
  __publicField(this, "_oidcProviderMetaData");
752
786
  __publicField(this, "_cryptoHelper");
753
787
  this._storageManager = storageManager;
754
- this._config = async () => await this._storageManager.getConfigData();
755
- this._oidcProviderMetaData = async () => await this._storageManager.loadOpenIDProviderConfiguration();
788
+ this._config = async () => this._storageManager.getConfigData();
789
+ this._oidcProviderMetaData = async () => this._storageManager.loadOpenIDProviderConfiguration();
756
790
  this._cryptoHelper = cryptoHelper;
757
791
  }
758
792
  async resolveEndpoints(response) {
@@ -777,15 +811,15 @@ var AuthenticationHelper = class {
777
811
  OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.ISSUER,
778
812
  OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.USERINFO
779
813
  ];
780
- const isRequiredEndpointsContains = configData.endpoints ? requiredEndpoints.every((reqEndpointName) => {
781
- return configData.endpoints ? Object.keys(configData.endpoints).some((endpointName) => {
814
+ const isRequiredEndpointsContains = configData.endpoints ? requiredEndpoints.every(
815
+ (reqEndpointName) => configData.endpoints ? Object.keys(configData.endpoints).some((endpointName) => {
782
816
  const snakeCasedName = endpointName.replace(
783
817
  /[A-Z]/g,
784
818
  (letter) => `_${letter.toLowerCase()}`
785
819
  );
786
820
  return snakeCasedName === reqEndpointName;
787
- }) : false;
788
- }) : false;
821
+ }) : false
822
+ ) : false;
789
823
  if (!isRequiredEndpointsContains) {
790
824
  throw new AsgardeoAuthException(
791
825
  "JS-AUTH_HELPER-REE-NF01",
@@ -802,7 +836,7 @@ var AuthenticationHelper = class {
802
836
  async resolveEndpointsByBaseURL() {
803
837
  const oidcProviderMetaData = {};
804
838
  const configData = await this._config();
805
- const baseUrl = configData.baseUrl;
839
+ const { baseUrl } = configData;
806
840
  if (!baseUrl) {
807
841
  throw new AsgardeoAuthException(
808
842
  "JS-AUTH_HELPER_REBO-NF01",
@@ -855,7 +889,7 @@ var AuthenticationHelper = class {
855
889
  await response.json()
856
890
  );
857
891
  }
858
- const issuer = (await this._oidcProviderMetaData()).issuer;
892
+ const { issuer } = await this._oidcProviderMetaData();
859
893
  const { keys } = await response.json();
860
894
  const jwk = await this._cryptoHelper.getJWKForTheIdToken(idToken.split(".")[0], keys);
861
895
  return this._cryptoHelper.isValidIdToken(
@@ -873,7 +907,7 @@ var AuthenticationHelper = class {
873
907
  const username = payload?.["username"] ?? "";
874
908
  const givenName = payload?.["given_name"] ?? "";
875
909
  const familyName = payload?.["family_name"] ?? "";
876
- const fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName ? givenName : familyName ? familyName : "";
910
+ const fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || "";
877
911
  const displayName = payload.preferred_username ?? fullName;
878
912
  return {
879
913
  displayName,
@@ -884,11 +918,14 @@ var AuthenticationHelper = class {
884
918
  async replaceCustomGrantTemplateTags(text, userId) {
885
919
  const configData = await this._config();
886
920
  const sessionData = await this._storageManager.getSessionData(userId);
887
- let scope = processOpenIDScopes_default(configData.scopes);
888
- return text.replace(TokenExchangeConstants_default.Placeholders.TOKEN, sessionData.access_token).replace(
921
+ const scope = processOpenIDScopes_default(configData.scopes);
922
+ if (typeof text !== "string") {
923
+ return text;
924
+ }
925
+ return text.replace(TokenExchangeConstants_default.Placeholders.ACCESS_TOKEN, sessionData.access_token).replace(
889
926
  TokenExchangeConstants_default.Placeholders.USERNAME,
890
927
  this.getAuthenticatedUserInfo(sessionData.id_token).username
891
- ).replace(TokenExchangeConstants_default.Placeholders.SCOPE, scope).replace(TokenExchangeConstants_default.Placeholders.CLIENT_ID, configData.clientId).replace(TokenExchangeConstants_default.Placeholders.CLIENT_SECRET, configData.clientSecret ?? "");
928
+ ).replace(TokenExchangeConstants_default.Placeholders.SCOPES, scope).replace(TokenExchangeConstants_default.Placeholders.CLIENT_ID, configData.clientId).replace(TokenExchangeConstants_default.Placeholders.CLIENT_SECRET, configData.clientSecret ?? "");
892
929
  }
893
930
  async clearSession(userId) {
894
931
  await this._storageManager.removeTemporaryData(userId);
@@ -908,7 +945,7 @@ var AuthenticationHelper = class {
908
945
  if (shouldValidateIdToken) {
909
946
  return this.validateIdToken(parsedResponse.id_token).then(async () => {
910
947
  await this._storageManager.setSessionData(parsedResponse, userId);
911
- const tokenResponse = {
948
+ const tokenResponse2 = {
912
949
  accessToken: parsedResponse.access_token,
913
950
  createdAt: parsedResponse.created_at,
914
951
  expiresIn: parsedResponse.expires_in,
@@ -917,21 +954,20 @@ var AuthenticationHelper = class {
917
954
  scope: parsedResponse.scope,
918
955
  tokenType: parsedResponse.token_type
919
956
  };
920
- return Promise.resolve(tokenResponse);
957
+ return Promise.resolve(tokenResponse2);
921
958
  });
922
- } else {
923
- const tokenResponse = {
924
- accessToken: parsedResponse.access_token,
925
- createdAt: parsedResponse.created_at,
926
- expiresIn: parsedResponse.expires_in,
927
- idToken: parsedResponse.id_token,
928
- refreshToken: parsedResponse.refresh_token,
929
- scope: parsedResponse.scope,
930
- tokenType: parsedResponse.token_type
931
- };
932
- await this._storageManager.setSessionData(parsedResponse, userId);
933
- return Promise.resolve(tokenResponse);
934
959
  }
960
+ const tokenResponse = {
961
+ accessToken: parsedResponse.access_token,
962
+ createdAt: parsedResponse.created_at,
963
+ expiresIn: parsedResponse.expires_in,
964
+ idToken: parsedResponse.id_token,
965
+ refreshToken: parsedResponse.refresh_token,
966
+ scope: parsedResponse.scope,
967
+ tokenType: parsedResponse.token_type
968
+ };
969
+ await this._storageManager.setSessionData(parsedResponse, userId);
970
+ return Promise.resolve(tokenResponse);
935
971
  }
936
972
  };
937
973
 
@@ -958,7 +994,7 @@ var generateStateParamForRequestCorrelation_default = generateStateParamForReque
958
994
 
959
995
  // src/utils/getAuthorizeRequestUrlParams.ts
960
996
  var getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
961
- const { redirectUri, clientId, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;
997
+ const { redirectUri, clientId, clientSecret, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;
962
998
  const authorizeRequestParams = /* @__PURE__ */ new Map();
963
999
  authorizeRequestParams.set("response_type", "code");
964
1000
  authorizeRequestParams.set("client_id", clientId);
@@ -1161,6 +1197,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
1161
1197
  codeChallenge = this._cryptoHelper?.getCodeChallenge(codeVerifier);
1162
1198
  await this._storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);
1163
1199
  }
1200
+ if (authRequestConfig["client_secret"]) {
1201
+ authRequestConfig["client_secret"] = configData.clientSecret;
1202
+ }
1164
1203
  const authorizeRequestParams = getAuthorizeRequestUrlParams_default(
1165
1204
  {
1166
1205
  redirectUri: configData.afterSignInUrl,
@@ -1963,8 +2002,8 @@ Message: ${this.message}`;
1963
2002
  }
1964
2003
  };
1965
2004
 
1966
- // src/api/initializeApplicationNativeAuthentication.ts
1967
- var initializeApplicationNativeAuthentication = async ({
2005
+ // src/api/initializeEmbeddedSignInFlow.ts
2006
+ var initializeEmbeddedSignInFlow = async ({
1968
2007
  url,
1969
2008
  baseUrl,
1970
2009
  payload,
@@ -1973,7 +2012,7 @@ var initializeApplicationNativeAuthentication = async ({
1973
2012
  if (!payload) {
1974
2013
  throw new AsgardeoAPIError(
1975
2014
  "Authorization payload is required",
1976
- "initializeApplicationNativeAuthentication-ValidationError-002",
2015
+ "initializeEmbeddedSignInFlow-ValidationError-002",
1977
2016
  "javascript",
1978
2017
  400,
1979
2018
  "If an authorization payload is not provided, the request cannot be constructed correctly."
@@ -1985,22 +2024,21 @@ var initializeApplicationNativeAuthentication = async ({
1985
2024
  searchParams.append(key, String(value));
1986
2025
  }
1987
2026
  });
1988
- const { headers: customHeaders, ...otherConfig } = requestConfig;
1989
2027
  const response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {
2028
+ ...requestConfig,
1990
2029
  method: requestConfig.method || "POST",
1991
2030
  headers: {
1992
2031
  "Content-Type": "application/x-www-form-urlencoded",
1993
2032
  Accept: "application/json",
1994
- ...customHeaders
2033
+ ...requestConfig.headers
1995
2034
  },
1996
- body: searchParams.toString(),
1997
- ...otherConfig
2035
+ body: searchParams.toString()
1998
2036
  });
1999
2037
  if (!response.ok) {
2000
2038
  const errorText = await response.text();
2001
2039
  throw new AsgardeoAPIError(
2002
2040
  `Authorization request failed: ${errorText}`,
2003
- "initializeApplicationNativeAuthentication-ResponseError-001",
2041
+ "initializeEmbeddedSignInFlow-ResponseError-001",
2004
2042
  "javascript",
2005
2043
  response.status,
2006
2044
  response.statusText
@@ -2008,10 +2046,10 @@ var initializeApplicationNativeAuthentication = async ({
2008
2046
  }
2009
2047
  return await response.json();
2010
2048
  };
2011
- var initializeApplicationNativeAuthentication_default = initializeApplicationNativeAuthentication;
2049
+ var initializeEmbeddedSignInFlow_default = initializeEmbeddedSignInFlow;
2012
2050
 
2013
- // src/api/handleApplicationNativeAuthentication.ts
2014
- var handleApplicationNativeAuthentication = async ({
2051
+ // src/api/executeEmbeddedSignInFlow.ts
2052
+ var executeEmbeddedSignInFlow = async ({
2015
2053
  url,
2016
2054
  baseUrl,
2017
2055
  payload,
@@ -2020,28 +2058,27 @@ var handleApplicationNativeAuthentication = async ({
2020
2058
  if (!payload) {
2021
2059
  throw new AsgardeoAPIError(
2022
2060
  "Authorization payload is required",
2023
- "handleApplicationNativeAuthentication-ValidationError-002",
2061
+ "executeEmbeddedSignInFlow-ValidationError-002",
2024
2062
  "javascript",
2025
2063
  400,
2026
2064
  "If an authorization payload is not provided, the request cannot be constructed correctly."
2027
2065
  );
2028
2066
  }
2029
- const { headers: customHeaders, ...otherConfig } = requestConfig;
2030
2067
  const response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {
2068
+ ...requestConfig,
2031
2069
  method: requestConfig.method || "POST",
2032
2070
  headers: {
2033
2071
  "Content-Type": "application/json",
2034
2072
  Accept: "application/json",
2035
- ...customHeaders
2073
+ ...requestConfig.headers
2036
2074
  },
2037
- body: JSON.stringify(payload),
2038
- ...otherConfig
2075
+ body: JSON.stringify(payload)
2039
2076
  });
2040
2077
  if (!response.ok) {
2041
2078
  const errorText = await response.text();
2042
2079
  throw new AsgardeoAPIError(
2043
2080
  `Authorization request failed: ${errorText}`,
2044
- "initializeApplicationNativeAuthentication-ResponseError-001",
2081
+ "initializeEmbeddedSignInFlow-ResponseError-001",
2045
2082
  "javascript",
2046
2083
  response.status,
2047
2084
  response.statusText
@@ -2049,7 +2086,78 @@ var handleApplicationNativeAuthentication = async ({
2049
2086
  }
2050
2087
  return await response.json();
2051
2088
  };
2052
- var handleApplicationNativeAuthentication_default = handleApplicationNativeAuthentication;
2089
+ var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
2090
+
2091
+ // src/models/embedded-flow.ts
2092
+ var EmbeddedFlowType = /* @__PURE__ */ ((EmbeddedFlowType2) => {
2093
+ EmbeddedFlowType2["Registration"] = "REGISTRATION";
2094
+ return EmbeddedFlowType2;
2095
+ })(EmbeddedFlowType || {});
2096
+ var EmbeddedFlowStatus = /* @__PURE__ */ ((EmbeddedFlowStatus2) => {
2097
+ EmbeddedFlowStatus2["Complete"] = "COMPLETE";
2098
+ EmbeddedFlowStatus2["Incomplete"] = "INCOMPLETE";
2099
+ return EmbeddedFlowStatus2;
2100
+ })(EmbeddedFlowStatus || {});
2101
+ var EmbeddedFlowResponseType = /* @__PURE__ */ ((EmbeddedFlowResponseType2) => {
2102
+ EmbeddedFlowResponseType2["Redirection"] = "REDIRECTION";
2103
+ EmbeddedFlowResponseType2["View"] = "VIEW";
2104
+ return EmbeddedFlowResponseType2;
2105
+ })(EmbeddedFlowResponseType || {});
2106
+ var EmbeddedFlowComponentType = /* @__PURE__ */ ((EmbeddedFlowComponentType2) => {
2107
+ EmbeddedFlowComponentType2["Button"] = "BUTTON";
2108
+ EmbeddedFlowComponentType2["Checkbox"] = "CHECKBOX";
2109
+ EmbeddedFlowComponentType2["Divider"] = "DIVIDER";
2110
+ EmbeddedFlowComponentType2["Form"] = "FORM";
2111
+ EmbeddedFlowComponentType2["Image"] = "IMAGE";
2112
+ EmbeddedFlowComponentType2["Input"] = "INPUT";
2113
+ EmbeddedFlowComponentType2["Radio"] = "RADIO";
2114
+ EmbeddedFlowComponentType2["Select"] = "SELECT";
2115
+ EmbeddedFlowComponentType2["Typography"] = "TYPOGRAPHY";
2116
+ return EmbeddedFlowComponentType2;
2117
+ })(EmbeddedFlowComponentType || {});
2118
+
2119
+ // src/api/executeEmbeddedSignUpFlow.ts
2120
+ var executeEmbeddedSignUpFlow = async ({
2121
+ url,
2122
+ baseUrl,
2123
+ payload,
2124
+ ...requestConfig
2125
+ }) => {
2126
+ if (!baseUrl && !url) {
2127
+ throw new AsgardeoAPIError(
2128
+ "Embedded SignUp flow execution failed: Base URL or URL is not provided.",
2129
+ "javascript-executeEmbeddedSignUpFlow-ValidationError-001",
2130
+ "javascript",
2131
+ 400,
2132
+ "At least one of the baseUrl or url must be provided to execute the embedded sign up flow."
2133
+ );
2134
+ }
2135
+ const response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {
2136
+ ...requestConfig,
2137
+ method: requestConfig.method || "POST",
2138
+ headers: {
2139
+ "Content-Type": "application/json",
2140
+ Accept: "application/json",
2141
+ ...requestConfig.headers
2142
+ },
2143
+ body: JSON.stringify({
2144
+ ...payload ?? {},
2145
+ flowType: "REGISTRATION" /* Registration */
2146
+ })
2147
+ });
2148
+ if (!response.ok) {
2149
+ const errorText = await response.text();
2150
+ throw new AsgardeoAPIError(
2151
+ `Embedded SignUp flow execution failed: ${errorText}`,
2152
+ "javascript-executeEmbeddedSignUpFlow-ResponseError-100",
2153
+ "javascript",
2154
+ response.status,
2155
+ response.statusText
2156
+ );
2157
+ }
2158
+ return await response.json();
2159
+ };
2160
+ var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
2053
2161
 
2054
2162
  // src/api/getUserInfo.ts
2055
2163
  var getUserInfo = async ({ url, ...requestConfig }) => {
@@ -2065,12 +2173,13 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
2065
2173
  );
2066
2174
  }
2067
2175
  const response = await fetch(url, {
2176
+ ...requestConfig,
2068
2177
  method: "GET",
2069
2178
  headers: {
2070
2179
  "Content-Type": "application/json",
2071
- Accept: "application/json"
2072
- },
2073
- ...requestConfig
2180
+ Accept: "application/json",
2181
+ ...requestConfig.headers
2182
+ }
2074
2183
  });
2075
2184
  if (!response.ok) {
2076
2185
  const errorText = await response.text();
@@ -2086,6 +2195,643 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
2086
2195
  };
2087
2196
  var getUserInfo_default = getUserInfo;
2088
2197
 
2198
+ // src/api/getScim2Me.ts
2199
+ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
2200
+ try {
2201
+ new URL(url ?? baseUrl);
2202
+ } catch (error) {
2203
+ throw new AsgardeoAPIError(
2204
+ `Invalid URL provided. ${error?.toString()}`,
2205
+ "getScim2Me-ValidationError-001",
2206
+ "javascript",
2207
+ 400,
2208
+ "The provided `url` or `baseUrl` path does not adhere to the URL schema."
2209
+ );
2210
+ }
2211
+ const fetchFn = fetcher || fetch;
2212
+ const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
2213
+ const requestInit = {
2214
+ ...requestConfig,
2215
+ method: "GET",
2216
+ headers: {
2217
+ "Content-Type": "application/scim+json",
2218
+ Accept: "application/json",
2219
+ ...requestConfig.headers
2220
+ }
2221
+ };
2222
+ try {
2223
+ const response = await fetchFn(resolvedUrl, requestInit);
2224
+ if (!response?.ok) {
2225
+ const errorText = await response.text();
2226
+ throw new AsgardeoAPIError(
2227
+ `Failed to fetch user profile: ${errorText}`,
2228
+ "getScim2Me-ResponseError-001",
2229
+ "javascript",
2230
+ response.status,
2231
+ response.statusText
2232
+ );
2233
+ }
2234
+ return await response.json();
2235
+ } catch (error) {
2236
+ if (error instanceof AsgardeoAPIError) {
2237
+ throw error;
2238
+ }
2239
+ throw new AsgardeoAPIError(
2240
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2241
+ "getScim2Me-NetworkError-001",
2242
+ "javascript",
2243
+ 0,
2244
+ "Network Error"
2245
+ );
2246
+ }
2247
+ };
2248
+ var getScim2Me_default = getScim2Me;
2249
+
2250
+ // src/api/getSchemas.ts
2251
+ var getSchemas = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
2252
+ try {
2253
+ new URL(url ?? baseUrl);
2254
+ } catch (error) {
2255
+ throw new AsgardeoAPIError(
2256
+ `Invalid URL provided. ${error?.toString()}`,
2257
+ "getSchemas-ValidationError-001",
2258
+ "javascript",
2259
+ 400,
2260
+ "The provided `url` or `baseUrl` path does not adhere to the URL schema."
2261
+ );
2262
+ }
2263
+ const fetchFn = fetcher || fetch;
2264
+ const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
2265
+ const requestInit = {
2266
+ ...requestConfig,
2267
+ method: "GET",
2268
+ headers: {
2269
+ "Content-Type": "application/json",
2270
+ Accept: "application/json",
2271
+ ...requestConfig.headers
2272
+ }
2273
+ };
2274
+ try {
2275
+ const response = await fetchFn(resolvedUrl, requestInit);
2276
+ if (!response?.ok) {
2277
+ const errorText = await response.text();
2278
+ throw new AsgardeoAPIError(
2279
+ `Failed to fetch SCIM2 schemas: ${errorText}`,
2280
+ "getSchemas-ResponseError-001",
2281
+ "javascript",
2282
+ response.status,
2283
+ response.statusText
2284
+ );
2285
+ }
2286
+ return await response.json();
2287
+ } catch (error) {
2288
+ if (error instanceof AsgardeoAPIError) {
2289
+ throw error;
2290
+ }
2291
+ throw new AsgardeoAPIError(
2292
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2293
+ "getSchemas-NetworkError-001",
2294
+ "javascript",
2295
+ 0,
2296
+ "Network Error"
2297
+ );
2298
+ }
2299
+ };
2300
+ var getSchemas_default = getSchemas;
2301
+
2302
+ // src/api/getAllOrganizations.ts
2303
+ var getAllOrganizations = async ({
2304
+ baseUrl,
2305
+ filter = "",
2306
+ limit = 10,
2307
+ recursive = false,
2308
+ fetcher,
2309
+ ...requestConfig
2310
+ }) => {
2311
+ try {
2312
+ new URL(baseUrl);
2313
+ } catch (error) {
2314
+ throw new AsgardeoAPIError(
2315
+ `Invalid base URL provided. ${error?.toString()}`,
2316
+ "getAllOrganizations-ValidationError-001",
2317
+ "javascript",
2318
+ 400,
2319
+ "The provided `baseUrl` does not adhere to the URL schema."
2320
+ );
2321
+ }
2322
+ const queryParams = new URLSearchParams(
2323
+ Object.fromEntries(
2324
+ Object.entries({
2325
+ filter,
2326
+ limit: limit.toString(),
2327
+ recursive: recursive.toString()
2328
+ }).filter(([, value]) => Boolean(value))
2329
+ )
2330
+ );
2331
+ const fetchFn = fetcher || fetch;
2332
+ const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;
2333
+ const requestInit = {
2334
+ ...requestConfig,
2335
+ method: "GET",
2336
+ headers: {
2337
+ "Content-Type": "application/json",
2338
+ Accept: "application/json",
2339
+ ...requestConfig.headers
2340
+ }
2341
+ };
2342
+ try {
2343
+ const response = await fetchFn(resolvedUrl, requestInit);
2344
+ if (!response?.ok) {
2345
+ const errorText = await response.text();
2346
+ throw new AsgardeoAPIError(
2347
+ `Failed to get organizations: ${errorText}`,
2348
+ "getAllOrganizations-ResponseError-001",
2349
+ "javascript",
2350
+ response.status,
2351
+ response.statusText
2352
+ );
2353
+ }
2354
+ const data = await response.json();
2355
+ return {
2356
+ hasMore: data.hasMore,
2357
+ nextCursor: data.nextCursor,
2358
+ organizations: data.organizations || [],
2359
+ totalCount: data.totalCount
2360
+ };
2361
+ } catch (error) {
2362
+ if (error instanceof AsgardeoAPIError) {
2363
+ throw error;
2364
+ }
2365
+ throw new AsgardeoAPIError(
2366
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2367
+ "getAllOrganizations-NetworkError-001",
2368
+ "javascript",
2369
+ 0,
2370
+ "Network Error"
2371
+ );
2372
+ }
2373
+ };
2374
+ var getAllOrganizations_default = getAllOrganizations;
2375
+
2376
+ // src/api/createOrganization.ts
2377
+ var createOrganization = async ({
2378
+ baseUrl,
2379
+ payload,
2380
+ fetcher,
2381
+ ...requestConfig
2382
+ }) => {
2383
+ try {
2384
+ new URL(baseUrl);
2385
+ } catch (error) {
2386
+ throw new AsgardeoAPIError(
2387
+ `Invalid base URL provided. ${error?.toString()}`,
2388
+ "createOrganization-ValidationError-001",
2389
+ "javascript",
2390
+ 400,
2391
+ "The provided `baseUrl` does not adhere to the URL schema."
2392
+ );
2393
+ }
2394
+ if (!payload) {
2395
+ throw new AsgardeoAPIError(
2396
+ "Organization payload is required",
2397
+ "createOrganization-ValidationError-002",
2398
+ "javascript",
2399
+ 400,
2400
+ "Invalid Request"
2401
+ );
2402
+ }
2403
+ const organizationPayload = {
2404
+ ...payload,
2405
+ type: "TENANT"
2406
+ };
2407
+ const fetchFn = fetcher || fetch;
2408
+ const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;
2409
+ const requestInit = {
2410
+ ...requestConfig,
2411
+ method: "POST",
2412
+ headers: {
2413
+ "Content-Type": "application/json",
2414
+ Accept: "application/json",
2415
+ ...requestConfig.headers
2416
+ },
2417
+ body: JSON.stringify(organizationPayload)
2418
+ };
2419
+ try {
2420
+ const response = await fetchFn(resolvedUrl, requestInit);
2421
+ if (!response?.ok) {
2422
+ const errorText = await response.text();
2423
+ throw new AsgardeoAPIError(
2424
+ `Failed to create organization: ${errorText}`,
2425
+ "createOrganization-ResponseError-001",
2426
+ "javascript",
2427
+ response.status,
2428
+ response.statusText
2429
+ );
2430
+ }
2431
+ return await response.json();
2432
+ } catch (error) {
2433
+ if (error instanceof AsgardeoAPIError) {
2434
+ throw error;
2435
+ }
2436
+ throw new AsgardeoAPIError(
2437
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2438
+ "createOrganization-NetworkError-001",
2439
+ "javascript",
2440
+ 0,
2441
+ "Network Error"
2442
+ );
2443
+ }
2444
+ };
2445
+ var createOrganization_default = createOrganization;
2446
+
2447
+ // src/api/getMeOrganizations.ts
2448
+ var getMeOrganizations = async ({
2449
+ baseUrl,
2450
+ after = "",
2451
+ authorizedAppName = "",
2452
+ before = "",
2453
+ filter = "",
2454
+ limit = 10,
2455
+ recursive = false,
2456
+ fetcher,
2457
+ ...requestConfig
2458
+ }) => {
2459
+ try {
2460
+ new URL(baseUrl);
2461
+ } catch (error) {
2462
+ throw new AsgardeoAPIError(
2463
+ `Invalid base URL provided. ${error?.toString()}`,
2464
+ "getMeOrganizations-ValidationError-001",
2465
+ "javascript",
2466
+ 400,
2467
+ "The provided `baseUrl` does not adhere to the URL schema."
2468
+ );
2469
+ }
2470
+ const queryParams = new URLSearchParams(
2471
+ Object.fromEntries(
2472
+ Object.entries({
2473
+ after,
2474
+ authorizedAppName,
2475
+ before,
2476
+ filter,
2477
+ limit: limit.toString(),
2478
+ recursive: recursive.toString()
2479
+ }).filter(([, value]) => Boolean(value))
2480
+ )
2481
+ );
2482
+ const fetchFn = fetcher || fetch;
2483
+ const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;
2484
+ const requestInit = {
2485
+ ...requestConfig,
2486
+ method: "GET",
2487
+ headers: {
2488
+ "Content-Type": "application/json",
2489
+ Accept: "application/json",
2490
+ ...requestConfig.headers
2491
+ }
2492
+ };
2493
+ try {
2494
+ const response = await fetchFn(resolvedUrl, requestInit);
2495
+ if (!response?.ok) {
2496
+ const errorText = await response.text();
2497
+ throw new AsgardeoAPIError(
2498
+ `Failed to fetch associated organizations of the user: ${errorText}`,
2499
+ "getMeOrganizations-ResponseError-001",
2500
+ "javascript",
2501
+ response.status,
2502
+ response.statusText
2503
+ );
2504
+ }
2505
+ const data = await response.json();
2506
+ return data.organizations || [];
2507
+ } catch (error) {
2508
+ if (error instanceof AsgardeoAPIError) {
2509
+ throw error;
2510
+ }
2511
+ throw new AsgardeoAPIError(
2512
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2513
+ "getMeOrganizations-NetworkError-001",
2514
+ "javascript",
2515
+ 0,
2516
+ "Network Error"
2517
+ );
2518
+ }
2519
+ };
2520
+ var getMeOrganizations_default = getMeOrganizations;
2521
+
2522
+ // src/api/getOrganization.ts
2523
+ var getOrganization = async ({
2524
+ baseUrl,
2525
+ organizationId,
2526
+ fetcher,
2527
+ ...requestConfig
2528
+ }) => {
2529
+ try {
2530
+ new URL(baseUrl);
2531
+ } catch (error) {
2532
+ throw new AsgardeoAPIError(
2533
+ `Invalid base URL provided. ${error?.toString()}`,
2534
+ "getOrganization-ValidationError-001",
2535
+ "javascript",
2536
+ 400,
2537
+ "The provided `baseUrl` does not adhere to the URL schema."
2538
+ );
2539
+ }
2540
+ if (!organizationId) {
2541
+ throw new AsgardeoAPIError(
2542
+ "Organization ID is required",
2543
+ "getOrganization-ValidationError-002",
2544
+ "javascript",
2545
+ 400,
2546
+ "Invalid Request"
2547
+ );
2548
+ }
2549
+ const fetchFn = fetcher || fetch;
2550
+ const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
2551
+ const requestInit = {
2552
+ ...requestConfig,
2553
+ method: "GET",
2554
+ headers: {
2555
+ "Content-Type": "application/json",
2556
+ Accept: "application/json",
2557
+ ...requestConfig.headers
2558
+ }
2559
+ };
2560
+ try {
2561
+ const response = await fetchFn(resolvedUrl, requestInit);
2562
+ if (!response?.ok) {
2563
+ const errorText = await response.text();
2564
+ throw new AsgardeoAPIError(
2565
+ `Failed to fetch organization details: ${errorText}`,
2566
+ "getOrganization-ResponseError-001",
2567
+ "javascript",
2568
+ response.status,
2569
+ response.statusText
2570
+ );
2571
+ }
2572
+ return await response.json();
2573
+ } catch (error) {
2574
+ if (error instanceof AsgardeoAPIError) {
2575
+ throw error;
2576
+ }
2577
+ throw new AsgardeoAPIError(
2578
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2579
+ "getOrganization-NetworkError-001",
2580
+ "javascript",
2581
+ 0,
2582
+ "Network Error"
2583
+ );
2584
+ }
2585
+ };
2586
+ var getOrganization_default = getOrganization;
2587
+
2588
+ // src/utils/isEmpty.ts
2589
+ var isEmpty = (value) => {
2590
+ if (value === null || value === void 0) {
2591
+ return true;
2592
+ }
2593
+ if (typeof value === "string") {
2594
+ return value.trim() === "";
2595
+ }
2596
+ if (Array.isArray(value)) {
2597
+ return value.length === 0;
2598
+ }
2599
+ if (typeof value === "object" && value.constructor === Object) {
2600
+ return Object.keys(value).length === 0;
2601
+ }
2602
+ return false;
2603
+ };
2604
+ var isEmpty_default = isEmpty;
2605
+
2606
+ // src/api/updateOrganization.ts
2607
+ var updateOrganization = async ({
2608
+ baseUrl,
2609
+ organizationId,
2610
+ operations,
2611
+ fetcher,
2612
+ ...requestConfig
2613
+ }) => {
2614
+ try {
2615
+ new URL(baseUrl);
2616
+ } catch (error) {
2617
+ throw new AsgardeoAPIError(
2618
+ `Invalid base URL provided. ${error?.toString()}`,
2619
+ "updateOrganization-ValidationError-001",
2620
+ "javascript",
2621
+ 400,
2622
+ "The provided `baseUrl` does not adhere to the URL schema."
2623
+ );
2624
+ }
2625
+ if (!organizationId) {
2626
+ throw new AsgardeoAPIError(
2627
+ "Organization ID is required",
2628
+ "updateOrganization-ValidationError-002",
2629
+ "javascript",
2630
+ 400,
2631
+ "Invalid Request"
2632
+ );
2633
+ }
2634
+ if (!operations || !Array.isArray(operations) || operations.length === 0) {
2635
+ throw new AsgardeoAPIError(
2636
+ "Operations array is required and cannot be empty",
2637
+ "updateOrganization-ValidationError-003",
2638
+ "javascript",
2639
+ 400,
2640
+ "Invalid Request"
2641
+ );
2642
+ }
2643
+ const fetchFn = fetcher || fetch;
2644
+ const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
2645
+ const requestInit = {
2646
+ ...requestConfig,
2647
+ method: "PATCH",
2648
+ headers: {
2649
+ "Content-Type": "application/json",
2650
+ Accept: "application/json",
2651
+ ...requestConfig.headers
2652
+ },
2653
+ body: JSON.stringify(operations)
2654
+ };
2655
+ try {
2656
+ const response = await fetchFn(resolvedUrl, requestInit);
2657
+ if (!response?.ok) {
2658
+ const errorText = await response.text();
2659
+ throw new AsgardeoAPIError(
2660
+ `Failed to update organization: ${errorText}`,
2661
+ "updateOrganization-ResponseError-001",
2662
+ "javascript",
2663
+ response.status,
2664
+ response.statusText
2665
+ );
2666
+ }
2667
+ return await response.json();
2668
+ } catch (error) {
2669
+ if (error instanceof AsgardeoAPIError) {
2670
+ throw error;
2671
+ }
2672
+ throw new AsgardeoAPIError(
2673
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2674
+ "updateOrganization-NetworkError-001",
2675
+ "javascript",
2676
+ 0,
2677
+ "Network Error"
2678
+ );
2679
+ }
2680
+ };
2681
+ var createPatchOperations = (payload) => {
2682
+ return Object.entries(payload).map(([key, value]) => {
2683
+ if (isEmpty_default(value)) {
2684
+ return {
2685
+ operation: "REMOVE",
2686
+ path: `/${key}`
2687
+ };
2688
+ }
2689
+ return {
2690
+ operation: "REPLACE",
2691
+ path: `/${key}`,
2692
+ value
2693
+ };
2694
+ });
2695
+ };
2696
+ var updateOrganization_default = updateOrganization;
2697
+
2698
+ // src/api/updateMeProfile.ts
2699
+ var updateMeProfile = async ({
2700
+ url,
2701
+ baseUrl,
2702
+ payload,
2703
+ fetcher,
2704
+ ...requestConfig
2705
+ }) => {
2706
+ try {
2707
+ new URL(url ?? baseUrl);
2708
+ } catch (error) {
2709
+ throw new AsgardeoAPIError(
2710
+ `Invalid URL provided. ${error?.toString()}`,
2711
+ "updateMeProfile-ValidationError-001",
2712
+ "javascript",
2713
+ 400,
2714
+ "The provided `url` or `baseUrl` path does not adhere to the URL schema."
2715
+ );
2716
+ }
2717
+ const data = {
2718
+ Operations: [
2719
+ {
2720
+ op: "replace",
2721
+ value: payload
2722
+ }
2723
+ ],
2724
+ schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
2725
+ };
2726
+ const fetchFn = fetcher || fetch;
2727
+ const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
2728
+ const requestInit = {
2729
+ method: "PATCH",
2730
+ ...requestConfig,
2731
+ headers: {
2732
+ ...requestConfig.headers,
2733
+ "Content-Type": "application/scim+json",
2734
+ Accept: "application/json"
2735
+ },
2736
+ body: JSON.stringify(data)
2737
+ };
2738
+ try {
2739
+ const response = await fetchFn(resolvedUrl, requestInit);
2740
+ if (!response?.ok) {
2741
+ const errorText = await response.text();
2742
+ throw new AsgardeoAPIError(
2743
+ `Failed to update user profile: ${errorText}`,
2744
+ "updateMeProfile-ResponseError-001",
2745
+ "javascript",
2746
+ response.status,
2747
+ response.statusText
2748
+ );
2749
+ }
2750
+ return await response.json();
2751
+ } catch (error) {
2752
+ if (error instanceof AsgardeoAPIError) {
2753
+ throw error;
2754
+ }
2755
+ throw new AsgardeoAPIError(
2756
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2757
+ "updateMeProfile-NetworkError-001",
2758
+ "javascript",
2759
+ 0,
2760
+ "Network Error"
2761
+ );
2762
+ }
2763
+ };
2764
+ var updateMeProfile_default = updateMeProfile;
2765
+
2766
+ // src/api/getBrandingPreference.ts
2767
+ var getBrandingPreference = async ({
2768
+ baseUrl,
2769
+ locale,
2770
+ name,
2771
+ type,
2772
+ fetcher,
2773
+ ...requestConfig
2774
+ }) => {
2775
+ try {
2776
+ new URL(baseUrl);
2777
+ } catch (error) {
2778
+ throw new AsgardeoAPIError(
2779
+ `Invalid base URL provided. ${error?.toString()}`,
2780
+ "getBrandingPreference-ValidationError-001",
2781
+ "javascript",
2782
+ 400,
2783
+ "The provided `baseUrl` does not adhere to the URL schema."
2784
+ );
2785
+ }
2786
+ const queryParams = new URLSearchParams(
2787
+ Object.fromEntries(
2788
+ Object.entries({
2789
+ locale: locale || "",
2790
+ name: name || "",
2791
+ type: type || ""
2792
+ }).filter(([, value]) => Boolean(value))
2793
+ )
2794
+ );
2795
+ const fetchFn = fetcher || fetch;
2796
+ const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2797
+ const requestInit = {
2798
+ ...requestConfig,
2799
+ method: "GET",
2800
+ headers: {
2801
+ "Content-Type": "application/json",
2802
+ Accept: "application/json",
2803
+ ...requestConfig.headers
2804
+ }
2805
+ };
2806
+ try {
2807
+ const response = await fetchFn(resolvedUrl, requestInit);
2808
+ if (!response?.ok) {
2809
+ const errorText = await response.text();
2810
+ throw new AsgardeoAPIError(
2811
+ `Failed to get branding preference: ${errorText}`,
2812
+ "getBrandingPreference-ResponseError-001",
2813
+ "javascript",
2814
+ response.status,
2815
+ response.statusText
2816
+ );
2817
+ }
2818
+ const data = await response.json();
2819
+ return data;
2820
+ } catch (error) {
2821
+ if (error instanceof AsgardeoAPIError) {
2822
+ throw error;
2823
+ }
2824
+ throw new AsgardeoAPIError(
2825
+ `Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
2826
+ "getBrandingPreference-NetworkError-001",
2827
+ "javascript",
2828
+ 0,
2829
+ "Network Error"
2830
+ );
2831
+ }
2832
+ };
2833
+ var getBrandingPreference_default = getBrandingPreference;
2834
+
2089
2835
  // src/constants/ApplicationNativeAuthenticationConstants.ts
2090
2836
  var ApplicationNativeAuthenticationConstants = {
2091
2837
  SupportedAuthenticators: {
@@ -2107,39 +2853,55 @@ var ApplicationNativeAuthenticationConstants = {
2107
2853
  };
2108
2854
  var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
2109
2855
 
2110
- // src/models/application-native-authentication.ts
2111
- var ApplicationNativeAuthenticationFlowStatus = /* @__PURE__ */ ((ApplicationNativeAuthenticationFlowStatus2) => {
2112
- ApplicationNativeAuthenticationFlowStatus2["SuccessCompleted"] = "SUCCESS_COMPLETED";
2113
- ApplicationNativeAuthenticationFlowStatus2["FailCompleted"] = "FAIL_COMPLETED";
2114
- ApplicationNativeAuthenticationFlowStatus2["FailIncomplete"] = "FAIL_INCOMPLETE";
2115
- ApplicationNativeAuthenticationFlowStatus2["Incomplete"] = "INCOMPLETE";
2116
- return ApplicationNativeAuthenticationFlowStatus2;
2117
- })(ApplicationNativeAuthenticationFlowStatus || {});
2118
- var ApplicationNativeAuthenticationFlowType = /* @__PURE__ */ ((ApplicationNativeAuthenticationFlowType2) => {
2119
- ApplicationNativeAuthenticationFlowType2["Authentication"] = "AUTHENTICATION";
2120
- return ApplicationNativeAuthenticationFlowType2;
2121
- })(ApplicationNativeAuthenticationFlowType || {});
2122
- var ApplicationNativeAuthenticationStepType = /* @__PURE__ */ ((ApplicationNativeAuthenticationStepType2) => {
2123
- ApplicationNativeAuthenticationStepType2["AuthenticatorPrompt"] = "AUTHENTICATOR_PROMPT";
2124
- ApplicationNativeAuthenticationStepType2["MultOptionsPrompt"] = "MULTI_OPTIONS_PROMPT";
2125
- return ApplicationNativeAuthenticationStepType2;
2126
- })(ApplicationNativeAuthenticationStepType || {});
2127
- var ApplicationNativeAuthenticationAuthenticatorParamType = /* @__PURE__ */ ((ApplicationNativeAuthenticationAuthenticatorParamType2) => {
2128
- ApplicationNativeAuthenticationAuthenticatorParamType2["String"] = "STRING";
2129
- ApplicationNativeAuthenticationAuthenticatorParamType2["Integer"] = "INTEGER";
2130
- ApplicationNativeAuthenticationAuthenticatorParamType2["MultiValued"] = "MULTI_VALUED";
2131
- return ApplicationNativeAuthenticationAuthenticatorParamType2;
2132
- })(ApplicationNativeAuthenticationAuthenticatorParamType || {});
2133
- var ApplicationNativeAuthenticationAuthenticatorKnownIdPType = /* @__PURE__ */ ((ApplicationNativeAuthenticationAuthenticatorKnownIdPType2) => {
2134
- ApplicationNativeAuthenticationAuthenticatorKnownIdPType2["Local"] = "LOCAL";
2135
- return ApplicationNativeAuthenticationAuthenticatorKnownIdPType2;
2136
- })(ApplicationNativeAuthenticationAuthenticatorKnownIdPType || {});
2137
- var ApplicationNativeAuthenticationAuthenticatorPromptType = /* @__PURE__ */ ((ApplicationNativeAuthenticationAuthenticatorPromptType2) => {
2138
- ApplicationNativeAuthenticationAuthenticatorPromptType2["UserPrompt"] = "USER_PROMPT";
2139
- ApplicationNativeAuthenticationAuthenticatorPromptType2["InternalPrompt"] = "INTERNAL_PROMPT";
2140
- ApplicationNativeAuthenticationAuthenticatorPromptType2["RedirectionPrompt"] = "REDIRECTION_PROMPT";
2141
- return ApplicationNativeAuthenticationAuthenticatorPromptType2;
2142
- })(ApplicationNativeAuthenticationAuthenticatorPromptType || {});
2856
+ // src/constants/VendorConstants.ts
2857
+ var VendorConstants = {
2858
+ /**
2859
+ * The prefix used for vendor-specific API endpoints, CSS classes, or other identifiers.
2860
+ */
2861
+ VENDOR_PREFIX: "asgardeo"
2862
+ };
2863
+ var VendorConstants_default = VendorConstants;
2864
+
2865
+ // src/models/embedded-signin-flow.ts
2866
+ var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus2) => {
2867
+ EmbeddedSignInFlowStatus2["FailCompleted"] = "FAIL_COMPLETED";
2868
+ EmbeddedSignInFlowStatus2["FailIncomplete"] = "FAIL_INCOMPLETE";
2869
+ EmbeddedSignInFlowStatus2["Incomplete"] = "INCOMPLETE";
2870
+ EmbeddedSignInFlowStatus2["SuccessCompleted"] = "SUCCESS_COMPLETED";
2871
+ return EmbeddedSignInFlowStatus2;
2872
+ })(EmbeddedSignInFlowStatus || {});
2873
+ var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType2) => {
2874
+ EmbeddedSignInFlowType2["Authentication"] = "AUTHENTICATION";
2875
+ return EmbeddedSignInFlowType2;
2876
+ })(EmbeddedSignInFlowType || {});
2877
+ var EmbeddedSignInFlowStepType = /* @__PURE__ */ ((EmbeddedSignInFlowStepType2) => {
2878
+ EmbeddedSignInFlowStepType2["AuthenticatorPrompt"] = "AUTHENTICATOR_PROMPT";
2879
+ EmbeddedSignInFlowStepType2["MultiOptionsPrompt"] = "MULTI_OPTIONS_PROMPT";
2880
+ return EmbeddedSignInFlowStepType2;
2881
+ })(EmbeddedSignInFlowStepType || {});
2882
+ var EmbeddedSignInFlowAuthenticatorParamType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorParamType2) => {
2883
+ EmbeddedSignInFlowAuthenticatorParamType2["Integer"] = "INTEGER";
2884
+ EmbeddedSignInFlowAuthenticatorParamType2["MultiValued"] = "MULTI_VALUED";
2885
+ EmbeddedSignInFlowAuthenticatorParamType2["String"] = "STRING";
2886
+ return EmbeddedSignInFlowAuthenticatorParamType2;
2887
+ })(EmbeddedSignInFlowAuthenticatorParamType || {});
2888
+ var EmbeddedSignInFlowAuthenticatorKnownIdPType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorKnownIdPType2) => {
2889
+ EmbeddedSignInFlowAuthenticatorKnownIdPType2["Local"] = "LOCAL";
2890
+ return EmbeddedSignInFlowAuthenticatorKnownIdPType2;
2891
+ })(EmbeddedSignInFlowAuthenticatorKnownIdPType || {});
2892
+ var EmbeddedSignInFlowAuthenticatorPromptType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorPromptType2) => {
2893
+ EmbeddedSignInFlowAuthenticatorPromptType2["InternalPrompt"] = "INTERNAL_PROMPT";
2894
+ EmbeddedSignInFlowAuthenticatorPromptType2["RedirectionPrompt"] = "REDIRECTION_PROMPT";
2895
+ EmbeddedSignInFlowAuthenticatorPromptType2["UserPrompt"] = "USER_PROMPT";
2896
+ return EmbeddedSignInFlowAuthenticatorPromptType2;
2897
+ })(EmbeddedSignInFlowAuthenticatorPromptType || {});
2898
+
2899
+ // src/models/flow.ts
2900
+ var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
2901
+ FlowMode2["Embedded"] = "DIRECT";
2902
+ FlowMode2["Redirect"] = "REDIRECTION";
2903
+ return FlowMode2;
2904
+ })(FlowMode || {});
2143
2905
 
2144
2906
  // src/models/scim2-schema.ts
2145
2907
  var WellKnownSchemaIds = /* @__PURE__ */ ((WellKnownSchemaIds2) => {
@@ -2194,6 +2956,14 @@ var lightTheme = {
2194
2956
  main: "#d32f2f",
2195
2957
  contrastText: "#ffffff"
2196
2958
  },
2959
+ success: {
2960
+ main: "#4caf50",
2961
+ contrastText: "#ffffff"
2962
+ },
2963
+ warning: {
2964
+ main: "#ff9800",
2965
+ contrastText: "#ffffff"
2966
+ },
2197
2967
  text: {
2198
2968
  primary: "#1a1a1a",
2199
2969
  secondary: "#666666"
@@ -2207,6 +2977,11 @@ var lightTheme = {
2207
2977
  small: "4px",
2208
2978
  medium: "8px",
2209
2979
  large: "16px"
2980
+ },
2981
+ shadows: {
2982
+ small: "0 2px 8px rgba(0, 0, 0, 0.1)",
2983
+ medium: "0 4px 16px rgba(0, 0, 0, 0.15)",
2984
+ large: "0 8px 32px rgba(0, 0, 0, 0.2)"
2210
2985
  }
2211
2986
  };
2212
2987
  var darkTheme = {
@@ -2230,6 +3005,14 @@ var darkTheme = {
2230
3005
  main: "#d32f2f",
2231
3006
  contrastText: "#ffffff"
2232
3007
  },
3008
+ success: {
3009
+ main: "#4caf50",
3010
+ contrastText: "#ffffff"
3011
+ },
3012
+ warning: {
3013
+ main: "#ff9800",
3014
+ contrastText: "#ffffff"
3015
+ },
2233
3016
  text: {
2234
3017
  primary: "#ffffff",
2235
3018
  secondary: "#b3b3b3"
@@ -2243,6 +3026,11 @@ var darkTheme = {
2243
3026
  small: "4px",
2244
3027
  medium: "8px",
2245
3028
  large: "16px"
3029
+ },
3030
+ shadows: {
3031
+ small: "0 2px 8px rgba(0, 0, 0, 0.3)",
3032
+ medium: "0 4px 16px rgba(0, 0, 0, 0.4)",
3033
+ large: "0 8px 32px rgba(0, 0, 0, 0.5)"
2246
3034
  }
2247
3035
  };
2248
3036
  var toCssVariables = (theme) => {
@@ -2256,6 +3044,10 @@ var toCssVariables = (theme) => {
2256
3044
  cssVars["--asgardeo-color-background-body-main"] = theme.colors.background.body.main;
2257
3045
  cssVars["--asgardeo-color-error-main"] = theme.colors.error.main;
2258
3046
  cssVars["--asgardeo-color-error-contrastText"] = theme.colors.error.contrastText;
3047
+ cssVars["--asgardeo-color-success-main"] = theme.colors.success.main;
3048
+ cssVars["--asgardeo-color-success-contrastText"] = theme.colors.success.contrastText;
3049
+ cssVars["--asgardeo-color-warning-main"] = theme.colors.warning.main;
3050
+ cssVars["--asgardeo-color-warning-contrastText"] = theme.colors.warning.contrastText;
2259
3051
  cssVars["--asgardeo-color-text-primary"] = theme.colors.text.primary;
2260
3052
  cssVars["--asgardeo-color-text-secondary"] = theme.colors.text.secondary;
2261
3053
  cssVars["--asgardeo-color-border"] = theme.colors.border;
@@ -2263,6 +3055,9 @@ var toCssVariables = (theme) => {
2263
3055
  cssVars["--asgardeo-border-radius-small"] = theme.borderRadius.small;
2264
3056
  cssVars["--asgardeo-border-radius-medium"] = theme.borderRadius.medium;
2265
3057
  cssVars["--asgardeo-border-radius-large"] = theme.borderRadius.large;
3058
+ cssVars["--asgardeo-shadow-small"] = theme.shadows.small;
3059
+ cssVars["--asgardeo-shadow-medium"] = theme.shadows.medium;
3060
+ cssVars["--asgardeo-shadow-large"] = theme.shadows.large;
2266
3061
  return cssVars;
2267
3062
  };
2268
3063
  var createTheme = (config = {}, isDark = false) => {
@@ -2285,6 +3080,10 @@ var createTheme = (config = {}, isDark = false) => {
2285
3080
  borderRadius: {
2286
3081
  ...baseTheme.borderRadius,
2287
3082
  ...config.borderRadius
3083
+ },
3084
+ shadows: {
3085
+ ...baseTheme.shadows,
3086
+ ...config.shadows
2288
3087
  }
2289
3088
  };
2290
3089
  return {
@@ -2321,6 +3120,58 @@ var deepMerge = (target, ...sources) => {
2321
3120
  };
2322
3121
  var deepMerge_default = deepMerge;
2323
3122
 
3123
+ // src/utils/deriveOrganizationHandleFromBaseUrl.ts
3124
+ var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
3125
+ if (!baseUrl) {
3126
+ throw new AsgardeoRuntimeError(
3127
+ "Base URL is required to derive organization handle.",
3128
+ "javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001",
3129
+ "javascript",
3130
+ "A valid base URL must be provided to extract the organization handle."
3131
+ );
3132
+ }
3133
+ let parsedUrl;
3134
+ try {
3135
+ parsedUrl = new URL(baseUrl);
3136
+ } catch (error) {
3137
+ throw new AsgardeoRuntimeError(
3138
+ `Invalid base URL format: ${baseUrl}`,
3139
+ "javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002",
3140
+ "javascript",
3141
+ "The provided base URL does not conform to valid URL syntax."
3142
+ );
3143
+ }
3144
+ const hostname = parsedUrl.hostname.toLowerCase();
3145
+ if (!hostname.endsWith(".asgardeo.io")) {
3146
+ throw new AsgardeoRuntimeError(
3147
+ "Organization handle is required since a custom domain is configured.",
3148
+ "javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-001",
3149
+ "javascript",
3150
+ "The provided base URL uses a custom domain. Please provide the organizationHandle explicitly in the configuration."
3151
+ );
3152
+ }
3153
+ const pathSegments = parsedUrl.pathname.split("/").filter((segment) => segment.length > 0);
3154
+ if (pathSegments.length < 2 || pathSegments[0] !== "t") {
3155
+ throw new AsgardeoRuntimeError(
3156
+ "Organization handle is required since a custom domain is configured.",
3157
+ "javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002",
3158
+ "javascript",
3159
+ "The provided base URL does not follow the expected Asgardeo URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration."
3160
+ );
3161
+ }
3162
+ const organizationHandle = pathSegments[1];
3163
+ if (!organizationHandle || organizationHandle.trim().length === 0) {
3164
+ throw new AsgardeoRuntimeError(
3165
+ "Organization handle is required since a custom domain is configured.",
3166
+ "javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003",
3167
+ "javascript",
3168
+ "The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration."
3169
+ );
3170
+ }
3171
+ return organizationHandle;
3172
+ };
3173
+ var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
3174
+
2324
3175
  // src/utils/flattenUserSchema.ts
2325
3176
  var flattenUserSchema = (schemas) => {
2326
3177
  const flattenedAttributes = [];
@@ -2433,27 +3284,67 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
2433
3284
  const { name, type, multiValued } = schema;
2434
3285
  if (!name) return;
2435
3286
  const hasChildProperties = allSchemaNames.some(
2436
- (schemaName) => schemaName !== name && schemaName.startsWith(name + ".")
3287
+ (schemaName) => schemaName !== name && schemaName.startsWith(`${name}.`)
2437
3288
  );
2438
3289
  if (hasChildProperties) {
2439
3290
  return;
2440
3291
  }
2441
3292
  let value = get_default(meResponse, name);
3293
+ if (value === void 0) {
3294
+ const schemaNamespaces = [
3295
+ "urn:ietf:params:scim:schemas:core:2.0:User",
3296
+ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
3297
+ "urn:scim:wso2:schema",
3298
+ "urn:scim:schemas:extension:custom:User"
3299
+ ];
3300
+ schemaNamespaces.some((namespace) => {
3301
+ if (meResponse[namespace]) {
3302
+ if (meResponse[namespace][name] !== void 0) {
3303
+ value = meResponse[namespace][name];
3304
+ return true;
3305
+ }
3306
+ const nestedValue = get_default(meResponse[namespace], name);
3307
+ if (nestedValue !== void 0) {
3308
+ value = nestedValue;
3309
+ return true;
3310
+ }
3311
+ }
3312
+ return false;
3313
+ });
3314
+ }
2442
3315
  if (value !== void 0) {
2443
3316
  if (multiValued && !Array.isArray(value)) {
2444
3317
  value = [value];
2445
3318
  }
3319
+ } else if (multiValued) {
3320
+ value = void 0;
3321
+ } else if (type === "STRING") {
3322
+ value = "";
2446
3323
  } else {
2447
- if (multiValued) {
2448
- value = void 0;
2449
- } else if (type === "STRING") {
2450
- value = "";
2451
- } else {
2452
- value = void 0;
2453
- }
3324
+ value = void 0;
2454
3325
  }
2455
3326
  profile[name] = value;
2456
3327
  });
3328
+ const flattenObject = (obj, prefix = "") => {
3329
+ if (obj && typeof obj === "object" && !Array.isArray(obj)) {
3330
+ Object.keys(obj).forEach((key) => {
3331
+ const fullKey = prefix ? `${prefix}.${key}` : key;
3332
+ const value = obj[key];
3333
+ if (Object.prototype.hasOwnProperty.call(profile, fullKey)) {
3334
+ return;
3335
+ }
3336
+ const hasSchemaChildProperties = allSchemaNames.some(
3337
+ (schemaName) => schemaName.startsWith(`${fullKey}.`)
3338
+ );
3339
+ if (hasSchemaChildProperties) {
3340
+ flattenObject(value, fullKey);
3341
+ } else {
3342
+ profile[fullKey] = value;
3343
+ }
3344
+ });
3345
+ }
3346
+ };
3347
+ flattenObject(meResponse);
2457
3348
  return profile;
2458
3349
  };
2459
3350
  var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
@@ -2488,6 +3379,10 @@ var translations = {
2488
3379
  /* |---------------------------------------------------------------| */
2489
3380
  /* Base Sign In */
2490
3381
  "signin.title": "Sign In",
3382
+ "signin.subtitle": "Enter your credentials to continue.",
3383
+ /* Base Sign Up */
3384
+ "signup.title": "Sign Up",
3385
+ "signup.subtitle": "Create a new account to get started.",
2491
3386
  /* Email OTP */
2492
3387
  "email.otp.title": "OTP Verification",
2493
3388
  "email.otp.subtitle": "Enter the code sent to your email address.",
@@ -2509,6 +3404,30 @@ var translations = {
2509
3404
  "username.password.title": "Sign In",
2510
3405
  "username.password.subtitle": "Enter your username and password to continue.",
2511
3406
  /* |---------------------------------------------------------------| */
3407
+ /* | Organization Switcher | */
3408
+ /* |---------------------------------------------------------------| */
3409
+ "organization.switcher.select.organization": "Select Organization",
3410
+ "organization.switcher.switch.organization": "Switch Organization",
3411
+ "organization.switcher.loading.organizations": "Loading organizations...",
3412
+ "organization.switcher.members": "members",
3413
+ "organization.switcher.member": "member",
3414
+ "organization.switcher.create.organization": "Create Organization",
3415
+ "organization.switcher.manage.organizations": "Manage Organization",
3416
+ "organization.switcher.manage.button": "Manage",
3417
+ "organization.profile.title": "Organization Profile",
3418
+ "organization.profile.loading": "Loading organization...",
3419
+ "organization.profile.error": "Failed to load organization",
3420
+ "organization.create.title": "Create Organization",
3421
+ "organization.create.name.label": "Organization Name",
3422
+ "organization.create.name.placeholder": "Enter organization name",
3423
+ "organization.create.handle.label": "Organization Handle",
3424
+ "organization.create.handle.placeholder": "my-organization",
3425
+ "organization.create.description.label": "Description",
3426
+ "organization.create.description.placeholder": "Enter organization description",
3427
+ "organization.create.button": "Create Organization",
3428
+ "organization.create.creating": "Creating...",
3429
+ "organization.create.cancel": "Cancel",
3430
+ /* |---------------------------------------------------------------| */
2512
3431
  /* | Messages | */
2513
3432
  /* |---------------------------------------------------------------| */
2514
3433
  "messages.loading": "Loading...",
@@ -2577,44 +3496,68 @@ var resolveFieldName = (field) => {
2577
3496
  );
2578
3497
  };
2579
3498
  var resolveFieldName_default = resolveFieldName;
3499
+
3500
+ // src/utils/withVendorCSSClassPrefix.ts
3501
+ var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
3502
+ var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
2580
3503
  // Annotate the CommonJS export names for ESM import in node:
2581
3504
  0 && (module.exports = {
2582
- ApplicationNativeAuthenticationAuthenticatorKnownIdPType,
2583
- ApplicationNativeAuthenticationAuthenticatorParamType,
2584
- ApplicationNativeAuthenticationAuthenticatorPromptType,
2585
3505
  ApplicationNativeAuthenticationConstants,
2586
- ApplicationNativeAuthenticationFlowStatus,
2587
- ApplicationNativeAuthenticationFlowType,
2588
- ApplicationNativeAuthenticationStepType,
2589
3506
  AsgardeoAPIError,
2590
3507
  AsgardeoAuthClient,
2591
3508
  AsgardeoAuthException,
2592
3509
  AsgardeoError,
2593
3510
  AsgardeoJavaScriptClient,
2594
3511
  AsgardeoRuntimeError,
3512
+ EmbeddedFlowComponentType,
3513
+ EmbeddedFlowResponseType,
3514
+ EmbeddedFlowStatus,
3515
+ EmbeddedFlowType,
3516
+ EmbeddedSignInFlowAuthenticatorKnownIdPType,
3517
+ EmbeddedSignInFlowAuthenticatorParamType,
3518
+ EmbeddedSignInFlowAuthenticatorPromptType,
3519
+ EmbeddedSignInFlowStatus,
3520
+ EmbeddedSignInFlowStepType,
3521
+ EmbeddedSignInFlowType,
2595
3522
  FieldType,
3523
+ FlowMode,
2596
3524
  IsomorphicCrypto,
2597
3525
  OIDCRequestConstants,
2598
3526
  StorageManager,
2599
3527
  TokenConstants,
3528
+ VendorConstants,
2600
3529
  WellKnownSchemaIds,
3530
+ createOrganization,
3531
+ createPatchOperations,
2601
3532
  createTheme,
2602
3533
  deepMerge,
3534
+ deriveOrganizationHandleFromBaseUrl,
3535
+ executeEmbeddedSignInFlow,
3536
+ executeEmbeddedSignUpFlow,
2603
3537
  extractPkceStorageKeyFromState,
2604
3538
  extractUserClaimsFromIdToken,
2605
3539
  flattenUserSchema,
2606
3540
  generateFlattenedUserProfile,
2607
3541
  generateUserProfile,
2608
3542
  get,
3543
+ getAllOrganizations,
3544
+ getBrandingPreference,
2609
3545
  getI18nBundles,
2610
3546
  getLatestStateParam,
3547
+ getMeOrganizations,
3548
+ getOrganization,
3549
+ getSchemas,
3550
+ getScim2Me,
2611
3551
  getUserInfo,
2612
- handleApplicationNativeAuthentication,
2613
- initializeApplicationNativeAuthentication,
3552
+ initializeEmbeddedSignInFlow,
3553
+ isEmpty,
2614
3554
  processOpenIDScopes,
2615
3555
  removeTrailingSlash,
2616
3556
  resolveFieldName,
2617
3557
  resolveFieldType,
2618
- set
3558
+ set,
3559
+ updateMeProfile,
3560
+ updateOrganization,
3561
+ withVendorCSSClassPrefix
2619
3562
  });
2620
3563
  //# sourceMappingURL=index.js.map