@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.
- package/dist/AsgardeoJavaScriptClient.d.ts +19 -52
- package/dist/IsomorphicCrypto.d.ts +2 -2
- package/dist/StorageManager.d.ts +1 -1
- package/dist/__legacy__/client.d.ts +2 -2
- package/dist/__legacy__/helpers/authentication-helper.d.ts +3 -3
- package/dist/api/createOrganization.d.ts +129 -0
- package/dist/api/executeEmbeddedSignInFlow.d.ts +21 -0
- package/dist/api/executeEmbeddedSignUpFlow.d.ts +44 -0
- package/dist/api/getAllOrganizations.d.ts +112 -0
- package/dist/api/getBrandingPreference.d.ts +103 -0
- package/dist/api/getMeOrganizations.d.ts +119 -0
- package/dist/api/getOrganization.d.ts +109 -0
- package/dist/api/getSchemas.d.ts +89 -0
- package/dist/api/getScim2Me.d.ts +89 -0
- package/dist/api/initializeEmbeddedSignInFlow.d.ts +51 -0
- package/dist/api/updateMeProfile.d.ts +82 -0
- package/dist/api/updateOrganization.d.ts +118 -0
- package/dist/cjs/index.js +1100 -157
- package/dist/cjs/index.js.map +4 -4
- package/dist/constants/OIDCRequestConstants.d.ts +1 -1
- package/dist/constants/ScopeConstants.d.ts +3 -6
- package/dist/constants/TokenExchangeConstants.d.ts +2 -2
- package/dist/constants/VendorConstants.d.ts +31 -0
- package/dist/index.d.ts +24 -6
- package/dist/index.js +1071 -148
- package/dist/index.js.map +4 -4
- package/dist/models/branding-preference.d.ts +248 -0
- package/dist/models/client.d.ts +55 -5
- package/dist/models/config.d.ts +54 -12
- package/dist/models/embedded-flow.d.ts +66 -0
- package/dist/models/embedded-signin-flow.d.ts +99 -0
- package/dist/models/flow.d.ts +30 -0
- package/dist/models/i18n.d.ts +24 -0
- package/dist/models/organization.d.ts +24 -0
- package/dist/models/token.d.ts +42 -30
- package/dist/theme/createTheme.d.ts +1 -1
- package/dist/theme/types.d.ts +42 -17
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +47 -0
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +2 -2
- package/dist/utils/extractUserClaimsFromIdToken.d.ts +2 -2
- package/dist/utils/generateFlattenedUserProfile.d.ts +9 -2
- package/dist/utils/isEmpty.d.ts +48 -0
- package/dist/utils/withVendorCSSClassPrefix.d.ts +32 -0
- package/package.json +1 -1
- package/dist/api/handleApplicationNativeAuthentication.d.ts +0 -33
- package/dist/api/initializeApplicationNativeAuthentication.d.ts +0 -117
- package/dist/models/application-native-authentication.d.ts +0 -82
package/dist/index.js
CHANGED
|
@@ -65,8 +65,8 @@ var StorageManager = class {
|
|
|
65
65
|
async setCustomData(key, customData, userId) {
|
|
66
66
|
this.setDataInBulk(this._resolveKey(key, userId), customData);
|
|
67
67
|
}
|
|
68
|
-
async getConfigData() {
|
|
69
|
-
return JSON.parse(await this._store.getData(this._resolveKey("config_data" /* ConfigData
|
|
68
|
+
async getConfigData(userId) {
|
|
69
|
+
return JSON.parse(await this._store.getData(this._resolveKey("config_data" /* ConfigData */, userId)) ?? null);
|
|
70
70
|
}
|
|
71
71
|
async loadOpenIDProviderConfiguration() {
|
|
72
72
|
return JSON.parse(await this._store.getData(this._resolveKey("oidc_provider_meta_data" /* OIDCProviderMetaData */)) ?? null);
|
|
@@ -265,12 +265,24 @@ var OIDCDiscoveryConstants_default = OIDCDiscoveryConstants;
|
|
|
265
265
|
|
|
266
266
|
// src/constants/ScopeConstants.ts
|
|
267
267
|
var ScopeConstants = {
|
|
268
|
+
/**
|
|
269
|
+
* The scope for accessing the user's profile information from SCIM.
|
|
270
|
+
* This scope allows the client to retrieve basic user information such as
|
|
271
|
+
* name, email, profile picture, etc.
|
|
272
|
+
*/
|
|
273
|
+
INTERNAL_LOGIN: "internal_login",
|
|
268
274
|
/**
|
|
269
275
|
* The base OpenID Connect scope.
|
|
270
276
|
* Required for all OpenID Connect flows. Indicates that the client
|
|
271
277
|
* is initiating an OpenID Connect authentication request.
|
|
272
278
|
*/
|
|
273
|
-
OPENID: "openid"
|
|
279
|
+
OPENID: "openid",
|
|
280
|
+
/**
|
|
281
|
+
* The OpenID Connect profile scope.
|
|
282
|
+
* This scope allows the client to access the user's profile information.
|
|
283
|
+
* It includes details such as the user's name, email, and other profile attributes.
|
|
284
|
+
*/
|
|
285
|
+
PROFILE: "profile"
|
|
274
286
|
};
|
|
275
287
|
var ScopeConstants_default = ScopeConstants;
|
|
276
288
|
|
|
@@ -308,7 +320,7 @@ var OIDCRequestConstants = {
|
|
|
308
320
|
/**
|
|
309
321
|
* The default scopes used in OIDC sign-in requests.
|
|
310
322
|
*/
|
|
311
|
-
DEFAULT_SCOPES: [ScopeConstants_default.OPENID]
|
|
323
|
+
DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE, ScopeConstants_default.INTERNAL_LOGIN]
|
|
312
324
|
}
|
|
313
325
|
},
|
|
314
326
|
/**
|
|
@@ -529,39 +541,6 @@ var extractPkceStorageKeyFromState = (state) => {
|
|
|
529
541
|
};
|
|
530
542
|
var extractPkceStorageKeyFromState_default = extractPkceStorageKeyFromState;
|
|
531
543
|
|
|
532
|
-
// src/utils/extractUserClaimsFromIdToken.ts
|
|
533
|
-
var extractUserClaimsFromIdToken = (payload) => {
|
|
534
|
-
const filteredPayload = { ...payload };
|
|
535
|
-
const protocolClaims = [
|
|
536
|
-
"iss",
|
|
537
|
-
"aud",
|
|
538
|
-
"exp",
|
|
539
|
-
"iat",
|
|
540
|
-
"acr",
|
|
541
|
-
"amr",
|
|
542
|
-
"azp",
|
|
543
|
-
"auth_time",
|
|
544
|
-
"nonce",
|
|
545
|
-
"c_hash",
|
|
546
|
-
"at_hash",
|
|
547
|
-
"nbf",
|
|
548
|
-
"isk",
|
|
549
|
-
"sid",
|
|
550
|
-
"jti",
|
|
551
|
-
"sub"
|
|
552
|
-
];
|
|
553
|
-
protocolClaims.forEach((claim) => {
|
|
554
|
-
delete filteredPayload[claim];
|
|
555
|
-
});
|
|
556
|
-
const userClaims = {};
|
|
557
|
-
Object.entries(filteredPayload).forEach(([key, value]) => {
|
|
558
|
-
const camelCasedKey = key.split("_").map((part, i) => i === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
|
|
559
|
-
userClaims[camelCasedKey] = value;
|
|
560
|
-
});
|
|
561
|
-
return userClaims;
|
|
562
|
-
};
|
|
563
|
-
var extractUserClaimsFromIdToken_default = extractUserClaimsFromIdToken;
|
|
564
|
-
|
|
565
544
|
// src/constants/TokenExchangeConstants.ts
|
|
566
545
|
var TokenExchangeConstants = {
|
|
567
546
|
/**
|
|
@@ -574,7 +553,7 @@ var TokenExchangeConstants = {
|
|
|
574
553
|
* Placeholder for the token value in exchange requests.
|
|
575
554
|
* Usually replaced with an access token or refresh token.
|
|
576
555
|
*/
|
|
577
|
-
|
|
556
|
+
ACCESS_TOKEN: "{{accessToken}}",
|
|
578
557
|
/**
|
|
579
558
|
* Placeholder for the username in token exchange operations.
|
|
580
559
|
* Used when user identity needs to be included in the exchange.
|
|
@@ -584,7 +563,7 @@ var TokenExchangeConstants = {
|
|
|
584
563
|
* Placeholder for OAuth scopes in token exchange requests.
|
|
585
564
|
* Replaced with space-separated scope strings.
|
|
586
565
|
*/
|
|
587
|
-
|
|
566
|
+
SCOPES: "{{scopes}}",
|
|
588
567
|
/**
|
|
589
568
|
* Placeholder for client ID in token exchange operations.
|
|
590
569
|
* Required for client authentication.
|
|
@@ -599,6 +578,39 @@ var TokenExchangeConstants = {
|
|
|
599
578
|
};
|
|
600
579
|
var TokenExchangeConstants_default = TokenExchangeConstants;
|
|
601
580
|
|
|
581
|
+
// src/utils/extractUserClaimsFromIdToken.ts
|
|
582
|
+
var extractUserClaimsFromIdToken = (payload) => {
|
|
583
|
+
const filteredPayload = { ...payload };
|
|
584
|
+
const protocolClaims = [
|
|
585
|
+
"iss",
|
|
586
|
+
"aud",
|
|
587
|
+
"exp",
|
|
588
|
+
"iat",
|
|
589
|
+
"acr",
|
|
590
|
+
"amr",
|
|
591
|
+
"azp",
|
|
592
|
+
"auth_time",
|
|
593
|
+
"nonce",
|
|
594
|
+
"c_hash",
|
|
595
|
+
"at_hash",
|
|
596
|
+
"nbf",
|
|
597
|
+
"isk",
|
|
598
|
+
"sid",
|
|
599
|
+
"jti",
|
|
600
|
+
"sub"
|
|
601
|
+
];
|
|
602
|
+
protocolClaims.forEach((claim) => {
|
|
603
|
+
delete filteredPayload[claim];
|
|
604
|
+
});
|
|
605
|
+
const userClaims = {};
|
|
606
|
+
Object.entries(filteredPayload).forEach(([key, value]) => {
|
|
607
|
+
const camelCasedKey = key.split("_").map((part, i) => i === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
|
|
608
|
+
userClaims[camelCasedKey] = value;
|
|
609
|
+
});
|
|
610
|
+
return userClaims;
|
|
611
|
+
};
|
|
612
|
+
var extractUserClaimsFromIdToken_default = extractUserClaimsFromIdToken;
|
|
613
|
+
|
|
602
614
|
// src/errors/AsgardeoError.ts
|
|
603
615
|
var AsgardeoError = class _AsgardeoError extends Error {
|
|
604
616
|
constructor(message, code, origin) {
|
|
@@ -667,17 +679,19 @@ Message: ${this.message}`;
|
|
|
667
679
|
// src/utils/processOpenIDScopes.ts
|
|
668
680
|
var processOpenIDScopes = (scopes) => {
|
|
669
681
|
let processedScopes = [];
|
|
670
|
-
if (
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
682
|
+
if (scopes) {
|
|
683
|
+
if (Array.isArray(scopes)) {
|
|
684
|
+
processedScopes = scopes;
|
|
685
|
+
} else if (typeof scopes === "string") {
|
|
686
|
+
processedScopes = scopes.split(" ");
|
|
687
|
+
} else {
|
|
688
|
+
throw new AsgardeoRuntimeError(
|
|
689
|
+
"Scopes must be a string or an array of strings.",
|
|
690
|
+
"processOpenIDScopes-Invalid-001",
|
|
691
|
+
"javascript",
|
|
692
|
+
"The provided scopes are not in the expected format. Please provide a string or an array of strings."
|
|
693
|
+
);
|
|
694
|
+
}
|
|
681
695
|
}
|
|
682
696
|
OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
|
|
683
697
|
if (!processedScopes.includes(defaultScope)) {
|
|
@@ -696,8 +710,8 @@ var AuthenticationHelper = class {
|
|
|
696
710
|
__publicField(this, "_oidcProviderMetaData");
|
|
697
711
|
__publicField(this, "_cryptoHelper");
|
|
698
712
|
this._storageManager = storageManager;
|
|
699
|
-
this._config = async () =>
|
|
700
|
-
this._oidcProviderMetaData = async () =>
|
|
713
|
+
this._config = async () => this._storageManager.getConfigData();
|
|
714
|
+
this._oidcProviderMetaData = async () => this._storageManager.loadOpenIDProviderConfiguration();
|
|
701
715
|
this._cryptoHelper = cryptoHelper;
|
|
702
716
|
}
|
|
703
717
|
async resolveEndpoints(response) {
|
|
@@ -722,15 +736,15 @@ var AuthenticationHelper = class {
|
|
|
722
736
|
OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.ISSUER,
|
|
723
737
|
OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.USERINFO
|
|
724
738
|
];
|
|
725
|
-
const isRequiredEndpointsContains = configData.endpoints ? requiredEndpoints.every(
|
|
726
|
-
|
|
739
|
+
const isRequiredEndpointsContains = configData.endpoints ? requiredEndpoints.every(
|
|
740
|
+
(reqEndpointName) => configData.endpoints ? Object.keys(configData.endpoints).some((endpointName) => {
|
|
727
741
|
const snakeCasedName = endpointName.replace(
|
|
728
742
|
/[A-Z]/g,
|
|
729
743
|
(letter) => `_${letter.toLowerCase()}`
|
|
730
744
|
);
|
|
731
745
|
return snakeCasedName === reqEndpointName;
|
|
732
|
-
}) : false
|
|
733
|
-
|
|
746
|
+
}) : false
|
|
747
|
+
) : false;
|
|
734
748
|
if (!isRequiredEndpointsContains) {
|
|
735
749
|
throw new AsgardeoAuthException(
|
|
736
750
|
"JS-AUTH_HELPER-REE-NF01",
|
|
@@ -747,7 +761,7 @@ var AuthenticationHelper = class {
|
|
|
747
761
|
async resolveEndpointsByBaseURL() {
|
|
748
762
|
const oidcProviderMetaData = {};
|
|
749
763
|
const configData = await this._config();
|
|
750
|
-
const baseUrl = configData
|
|
764
|
+
const { baseUrl } = configData;
|
|
751
765
|
if (!baseUrl) {
|
|
752
766
|
throw new AsgardeoAuthException(
|
|
753
767
|
"JS-AUTH_HELPER_REBO-NF01",
|
|
@@ -800,7 +814,7 @@ var AuthenticationHelper = class {
|
|
|
800
814
|
await response.json()
|
|
801
815
|
);
|
|
802
816
|
}
|
|
803
|
-
const issuer =
|
|
817
|
+
const { issuer } = await this._oidcProviderMetaData();
|
|
804
818
|
const { keys } = await response.json();
|
|
805
819
|
const jwk = await this._cryptoHelper.getJWKForTheIdToken(idToken.split(".")[0], keys);
|
|
806
820
|
return this._cryptoHelper.isValidIdToken(
|
|
@@ -818,7 +832,7 @@ var AuthenticationHelper = class {
|
|
|
818
832
|
const username = payload?.["username"] ?? "";
|
|
819
833
|
const givenName = payload?.["given_name"] ?? "";
|
|
820
834
|
const familyName = payload?.["family_name"] ?? "";
|
|
821
|
-
const fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName
|
|
835
|
+
const fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || "";
|
|
822
836
|
const displayName = payload.preferred_username ?? fullName;
|
|
823
837
|
return {
|
|
824
838
|
displayName,
|
|
@@ -829,11 +843,14 @@ var AuthenticationHelper = class {
|
|
|
829
843
|
async replaceCustomGrantTemplateTags(text, userId) {
|
|
830
844
|
const configData = await this._config();
|
|
831
845
|
const sessionData = await this._storageManager.getSessionData(userId);
|
|
832
|
-
|
|
833
|
-
|
|
846
|
+
const scope = processOpenIDScopes_default(configData.scopes);
|
|
847
|
+
if (typeof text !== "string") {
|
|
848
|
+
return text;
|
|
849
|
+
}
|
|
850
|
+
return text.replace(TokenExchangeConstants_default.Placeholders.ACCESS_TOKEN, sessionData.access_token).replace(
|
|
834
851
|
TokenExchangeConstants_default.Placeholders.USERNAME,
|
|
835
852
|
this.getAuthenticatedUserInfo(sessionData.id_token).username
|
|
836
|
-
).replace(TokenExchangeConstants_default.Placeholders.
|
|
853
|
+
).replace(TokenExchangeConstants_default.Placeholders.SCOPES, scope).replace(TokenExchangeConstants_default.Placeholders.CLIENT_ID, configData.clientId).replace(TokenExchangeConstants_default.Placeholders.CLIENT_SECRET, configData.clientSecret ?? "");
|
|
837
854
|
}
|
|
838
855
|
async clearSession(userId) {
|
|
839
856
|
await this._storageManager.removeTemporaryData(userId);
|
|
@@ -853,7 +870,7 @@ var AuthenticationHelper = class {
|
|
|
853
870
|
if (shouldValidateIdToken) {
|
|
854
871
|
return this.validateIdToken(parsedResponse.id_token).then(async () => {
|
|
855
872
|
await this._storageManager.setSessionData(parsedResponse, userId);
|
|
856
|
-
const
|
|
873
|
+
const tokenResponse2 = {
|
|
857
874
|
accessToken: parsedResponse.access_token,
|
|
858
875
|
createdAt: parsedResponse.created_at,
|
|
859
876
|
expiresIn: parsedResponse.expires_in,
|
|
@@ -862,21 +879,20 @@ var AuthenticationHelper = class {
|
|
|
862
879
|
scope: parsedResponse.scope,
|
|
863
880
|
tokenType: parsedResponse.token_type
|
|
864
881
|
};
|
|
865
|
-
return Promise.resolve(
|
|
882
|
+
return Promise.resolve(tokenResponse2);
|
|
866
883
|
});
|
|
867
|
-
} else {
|
|
868
|
-
const tokenResponse = {
|
|
869
|
-
accessToken: parsedResponse.access_token,
|
|
870
|
-
createdAt: parsedResponse.created_at,
|
|
871
|
-
expiresIn: parsedResponse.expires_in,
|
|
872
|
-
idToken: parsedResponse.id_token,
|
|
873
|
-
refreshToken: parsedResponse.refresh_token,
|
|
874
|
-
scope: parsedResponse.scope,
|
|
875
|
-
tokenType: parsedResponse.token_type
|
|
876
|
-
};
|
|
877
|
-
await this._storageManager.setSessionData(parsedResponse, userId);
|
|
878
|
-
return Promise.resolve(tokenResponse);
|
|
879
884
|
}
|
|
885
|
+
const tokenResponse = {
|
|
886
|
+
accessToken: parsedResponse.access_token,
|
|
887
|
+
createdAt: parsedResponse.created_at,
|
|
888
|
+
expiresIn: parsedResponse.expires_in,
|
|
889
|
+
idToken: parsedResponse.id_token,
|
|
890
|
+
refreshToken: parsedResponse.refresh_token,
|
|
891
|
+
scope: parsedResponse.scope,
|
|
892
|
+
tokenType: parsedResponse.token_type
|
|
893
|
+
};
|
|
894
|
+
await this._storageManager.setSessionData(parsedResponse, userId);
|
|
895
|
+
return Promise.resolve(tokenResponse);
|
|
880
896
|
}
|
|
881
897
|
};
|
|
882
898
|
|
|
@@ -903,7 +919,7 @@ var generateStateParamForRequestCorrelation_default = generateStateParamForReque
|
|
|
903
919
|
|
|
904
920
|
// src/utils/getAuthorizeRequestUrlParams.ts
|
|
905
921
|
var getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
|
|
906
|
-
const { redirectUri, clientId, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;
|
|
922
|
+
const { redirectUri, clientId, clientSecret, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;
|
|
907
923
|
const authorizeRequestParams = /* @__PURE__ */ new Map();
|
|
908
924
|
authorizeRequestParams.set("response_type", "code");
|
|
909
925
|
authorizeRequestParams.set("client_id", clientId);
|
|
@@ -1106,6 +1122,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1106
1122
|
codeChallenge = this._cryptoHelper?.getCodeChallenge(codeVerifier);
|
|
1107
1123
|
await this._storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);
|
|
1108
1124
|
}
|
|
1125
|
+
if (authRequestConfig["client_secret"]) {
|
|
1126
|
+
authRequestConfig["client_secret"] = configData.clientSecret;
|
|
1127
|
+
}
|
|
1109
1128
|
const authorizeRequestParams = getAuthorizeRequestUrlParams_default(
|
|
1110
1129
|
{
|
|
1111
1130
|
redirectUri: configData.afterSignInUrl,
|
|
@@ -1908,8 +1927,8 @@ Message: ${this.message}`;
|
|
|
1908
1927
|
}
|
|
1909
1928
|
};
|
|
1910
1929
|
|
|
1911
|
-
// src/api/
|
|
1912
|
-
var
|
|
1930
|
+
// src/api/initializeEmbeddedSignInFlow.ts
|
|
1931
|
+
var initializeEmbeddedSignInFlow = async ({
|
|
1913
1932
|
url,
|
|
1914
1933
|
baseUrl,
|
|
1915
1934
|
payload,
|
|
@@ -1918,7 +1937,7 @@ var initializeApplicationNativeAuthentication = async ({
|
|
|
1918
1937
|
if (!payload) {
|
|
1919
1938
|
throw new AsgardeoAPIError(
|
|
1920
1939
|
"Authorization payload is required",
|
|
1921
|
-
"
|
|
1940
|
+
"initializeEmbeddedSignInFlow-ValidationError-002",
|
|
1922
1941
|
"javascript",
|
|
1923
1942
|
400,
|
|
1924
1943
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
@@ -1930,22 +1949,21 @@ var initializeApplicationNativeAuthentication = async ({
|
|
|
1930
1949
|
searchParams.append(key, String(value));
|
|
1931
1950
|
}
|
|
1932
1951
|
});
|
|
1933
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
1934
1952
|
const response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {
|
|
1953
|
+
...requestConfig,
|
|
1935
1954
|
method: requestConfig.method || "POST",
|
|
1936
1955
|
headers: {
|
|
1937
1956
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
1938
1957
|
Accept: "application/json",
|
|
1939
|
-
...
|
|
1958
|
+
...requestConfig.headers
|
|
1940
1959
|
},
|
|
1941
|
-
body: searchParams.toString()
|
|
1942
|
-
...otherConfig
|
|
1960
|
+
body: searchParams.toString()
|
|
1943
1961
|
});
|
|
1944
1962
|
if (!response.ok) {
|
|
1945
1963
|
const errorText = await response.text();
|
|
1946
1964
|
throw new AsgardeoAPIError(
|
|
1947
1965
|
`Authorization request failed: ${errorText}`,
|
|
1948
|
-
"
|
|
1966
|
+
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
1949
1967
|
"javascript",
|
|
1950
1968
|
response.status,
|
|
1951
1969
|
response.statusText
|
|
@@ -1953,10 +1971,10 @@ var initializeApplicationNativeAuthentication = async ({
|
|
|
1953
1971
|
}
|
|
1954
1972
|
return await response.json();
|
|
1955
1973
|
};
|
|
1956
|
-
var
|
|
1974
|
+
var initializeEmbeddedSignInFlow_default = initializeEmbeddedSignInFlow;
|
|
1957
1975
|
|
|
1958
|
-
// src/api/
|
|
1959
|
-
var
|
|
1976
|
+
// src/api/executeEmbeddedSignInFlow.ts
|
|
1977
|
+
var executeEmbeddedSignInFlow = async ({
|
|
1960
1978
|
url,
|
|
1961
1979
|
baseUrl,
|
|
1962
1980
|
payload,
|
|
@@ -1965,28 +1983,27 @@ var handleApplicationNativeAuthentication = async ({
|
|
|
1965
1983
|
if (!payload) {
|
|
1966
1984
|
throw new AsgardeoAPIError(
|
|
1967
1985
|
"Authorization payload is required",
|
|
1968
|
-
"
|
|
1986
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
1969
1987
|
"javascript",
|
|
1970
1988
|
400,
|
|
1971
1989
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
1972
1990
|
);
|
|
1973
1991
|
}
|
|
1974
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
1975
1992
|
const response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {
|
|
1993
|
+
...requestConfig,
|
|
1976
1994
|
method: requestConfig.method || "POST",
|
|
1977
1995
|
headers: {
|
|
1978
1996
|
"Content-Type": "application/json",
|
|
1979
1997
|
Accept: "application/json",
|
|
1980
|
-
...
|
|
1998
|
+
...requestConfig.headers
|
|
1981
1999
|
},
|
|
1982
|
-
body: JSON.stringify(payload)
|
|
1983
|
-
...otherConfig
|
|
2000
|
+
body: JSON.stringify(payload)
|
|
1984
2001
|
});
|
|
1985
2002
|
if (!response.ok) {
|
|
1986
2003
|
const errorText = await response.text();
|
|
1987
2004
|
throw new AsgardeoAPIError(
|
|
1988
2005
|
`Authorization request failed: ${errorText}`,
|
|
1989
|
-
"
|
|
2006
|
+
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
1990
2007
|
"javascript",
|
|
1991
2008
|
response.status,
|
|
1992
2009
|
response.statusText
|
|
@@ -1994,7 +2011,78 @@ var handleApplicationNativeAuthentication = async ({
|
|
|
1994
2011
|
}
|
|
1995
2012
|
return await response.json();
|
|
1996
2013
|
};
|
|
1997
|
-
var
|
|
2014
|
+
var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
2015
|
+
|
|
2016
|
+
// src/models/embedded-flow.ts
|
|
2017
|
+
var EmbeddedFlowType = /* @__PURE__ */ ((EmbeddedFlowType2) => {
|
|
2018
|
+
EmbeddedFlowType2["Registration"] = "REGISTRATION";
|
|
2019
|
+
return EmbeddedFlowType2;
|
|
2020
|
+
})(EmbeddedFlowType || {});
|
|
2021
|
+
var EmbeddedFlowStatus = /* @__PURE__ */ ((EmbeddedFlowStatus2) => {
|
|
2022
|
+
EmbeddedFlowStatus2["Complete"] = "COMPLETE";
|
|
2023
|
+
EmbeddedFlowStatus2["Incomplete"] = "INCOMPLETE";
|
|
2024
|
+
return EmbeddedFlowStatus2;
|
|
2025
|
+
})(EmbeddedFlowStatus || {});
|
|
2026
|
+
var EmbeddedFlowResponseType = /* @__PURE__ */ ((EmbeddedFlowResponseType2) => {
|
|
2027
|
+
EmbeddedFlowResponseType2["Redirection"] = "REDIRECTION";
|
|
2028
|
+
EmbeddedFlowResponseType2["View"] = "VIEW";
|
|
2029
|
+
return EmbeddedFlowResponseType2;
|
|
2030
|
+
})(EmbeddedFlowResponseType || {});
|
|
2031
|
+
var EmbeddedFlowComponentType = /* @__PURE__ */ ((EmbeddedFlowComponentType2) => {
|
|
2032
|
+
EmbeddedFlowComponentType2["Button"] = "BUTTON";
|
|
2033
|
+
EmbeddedFlowComponentType2["Checkbox"] = "CHECKBOX";
|
|
2034
|
+
EmbeddedFlowComponentType2["Divider"] = "DIVIDER";
|
|
2035
|
+
EmbeddedFlowComponentType2["Form"] = "FORM";
|
|
2036
|
+
EmbeddedFlowComponentType2["Image"] = "IMAGE";
|
|
2037
|
+
EmbeddedFlowComponentType2["Input"] = "INPUT";
|
|
2038
|
+
EmbeddedFlowComponentType2["Radio"] = "RADIO";
|
|
2039
|
+
EmbeddedFlowComponentType2["Select"] = "SELECT";
|
|
2040
|
+
EmbeddedFlowComponentType2["Typography"] = "TYPOGRAPHY";
|
|
2041
|
+
return EmbeddedFlowComponentType2;
|
|
2042
|
+
})(EmbeddedFlowComponentType || {});
|
|
2043
|
+
|
|
2044
|
+
// src/api/executeEmbeddedSignUpFlow.ts
|
|
2045
|
+
var executeEmbeddedSignUpFlow = async ({
|
|
2046
|
+
url,
|
|
2047
|
+
baseUrl,
|
|
2048
|
+
payload,
|
|
2049
|
+
...requestConfig
|
|
2050
|
+
}) => {
|
|
2051
|
+
if (!baseUrl && !url) {
|
|
2052
|
+
throw new AsgardeoAPIError(
|
|
2053
|
+
"Embedded SignUp flow execution failed: Base URL or URL is not provided.",
|
|
2054
|
+
"javascript-executeEmbeddedSignUpFlow-ValidationError-001",
|
|
2055
|
+
"javascript",
|
|
2056
|
+
400,
|
|
2057
|
+
"At least one of the baseUrl or url must be provided to execute the embedded sign up flow."
|
|
2058
|
+
);
|
|
2059
|
+
}
|
|
2060
|
+
const response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {
|
|
2061
|
+
...requestConfig,
|
|
2062
|
+
method: requestConfig.method || "POST",
|
|
2063
|
+
headers: {
|
|
2064
|
+
"Content-Type": "application/json",
|
|
2065
|
+
Accept: "application/json",
|
|
2066
|
+
...requestConfig.headers
|
|
2067
|
+
},
|
|
2068
|
+
body: JSON.stringify({
|
|
2069
|
+
...payload ?? {},
|
|
2070
|
+
flowType: "REGISTRATION" /* Registration */
|
|
2071
|
+
})
|
|
2072
|
+
});
|
|
2073
|
+
if (!response.ok) {
|
|
2074
|
+
const errorText = await response.text();
|
|
2075
|
+
throw new AsgardeoAPIError(
|
|
2076
|
+
`Embedded SignUp flow execution failed: ${errorText}`,
|
|
2077
|
+
"javascript-executeEmbeddedSignUpFlow-ResponseError-100",
|
|
2078
|
+
"javascript",
|
|
2079
|
+
response.status,
|
|
2080
|
+
response.statusText
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
return await response.json();
|
|
2084
|
+
};
|
|
2085
|
+
var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
|
|
1998
2086
|
|
|
1999
2087
|
// src/api/getUserInfo.ts
|
|
2000
2088
|
var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
@@ -2010,12 +2098,13 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2010
2098
|
);
|
|
2011
2099
|
}
|
|
2012
2100
|
const response = await fetch(url, {
|
|
2101
|
+
...requestConfig,
|
|
2013
2102
|
method: "GET",
|
|
2014
2103
|
headers: {
|
|
2015
2104
|
"Content-Type": "application/json",
|
|
2016
|
-
Accept: "application/json"
|
|
2017
|
-
|
|
2018
|
-
|
|
2105
|
+
Accept: "application/json",
|
|
2106
|
+
...requestConfig.headers
|
|
2107
|
+
}
|
|
2019
2108
|
});
|
|
2020
2109
|
if (!response.ok) {
|
|
2021
2110
|
const errorText = await response.text();
|
|
@@ -2031,6 +2120,643 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2031
2120
|
};
|
|
2032
2121
|
var getUserInfo_default = getUserInfo;
|
|
2033
2122
|
|
|
2123
|
+
// src/api/getScim2Me.ts
|
|
2124
|
+
var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
2125
|
+
try {
|
|
2126
|
+
new URL(url ?? baseUrl);
|
|
2127
|
+
} catch (error) {
|
|
2128
|
+
throw new AsgardeoAPIError(
|
|
2129
|
+
`Invalid URL provided. ${error?.toString()}`,
|
|
2130
|
+
"getScim2Me-ValidationError-001",
|
|
2131
|
+
"javascript",
|
|
2132
|
+
400,
|
|
2133
|
+
"The provided `url` or `baseUrl` path does not adhere to the URL schema."
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
const fetchFn = fetcher || fetch;
|
|
2137
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
2138
|
+
const requestInit = {
|
|
2139
|
+
...requestConfig,
|
|
2140
|
+
method: "GET",
|
|
2141
|
+
headers: {
|
|
2142
|
+
"Content-Type": "application/scim+json",
|
|
2143
|
+
Accept: "application/json",
|
|
2144
|
+
...requestConfig.headers
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
try {
|
|
2148
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2149
|
+
if (!response?.ok) {
|
|
2150
|
+
const errorText = await response.text();
|
|
2151
|
+
throw new AsgardeoAPIError(
|
|
2152
|
+
`Failed to fetch user profile: ${errorText}`,
|
|
2153
|
+
"getScim2Me-ResponseError-001",
|
|
2154
|
+
"javascript",
|
|
2155
|
+
response.status,
|
|
2156
|
+
response.statusText
|
|
2157
|
+
);
|
|
2158
|
+
}
|
|
2159
|
+
return await response.json();
|
|
2160
|
+
} catch (error) {
|
|
2161
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2162
|
+
throw error;
|
|
2163
|
+
}
|
|
2164
|
+
throw new AsgardeoAPIError(
|
|
2165
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2166
|
+
"getScim2Me-NetworkError-001",
|
|
2167
|
+
"javascript",
|
|
2168
|
+
0,
|
|
2169
|
+
"Network Error"
|
|
2170
|
+
);
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
var getScim2Me_default = getScim2Me;
|
|
2174
|
+
|
|
2175
|
+
// src/api/getSchemas.ts
|
|
2176
|
+
var getSchemas = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
2177
|
+
try {
|
|
2178
|
+
new URL(url ?? baseUrl);
|
|
2179
|
+
} catch (error) {
|
|
2180
|
+
throw new AsgardeoAPIError(
|
|
2181
|
+
`Invalid URL provided. ${error?.toString()}`,
|
|
2182
|
+
"getSchemas-ValidationError-001",
|
|
2183
|
+
"javascript",
|
|
2184
|
+
400,
|
|
2185
|
+
"The provided `url` or `baseUrl` path does not adhere to the URL schema."
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2188
|
+
const fetchFn = fetcher || fetch;
|
|
2189
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
|
|
2190
|
+
const requestInit = {
|
|
2191
|
+
...requestConfig,
|
|
2192
|
+
method: "GET",
|
|
2193
|
+
headers: {
|
|
2194
|
+
"Content-Type": "application/json",
|
|
2195
|
+
Accept: "application/json",
|
|
2196
|
+
...requestConfig.headers
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
try {
|
|
2200
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2201
|
+
if (!response?.ok) {
|
|
2202
|
+
const errorText = await response.text();
|
|
2203
|
+
throw new AsgardeoAPIError(
|
|
2204
|
+
`Failed to fetch SCIM2 schemas: ${errorText}`,
|
|
2205
|
+
"getSchemas-ResponseError-001",
|
|
2206
|
+
"javascript",
|
|
2207
|
+
response.status,
|
|
2208
|
+
response.statusText
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
return await response.json();
|
|
2212
|
+
} catch (error) {
|
|
2213
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2214
|
+
throw error;
|
|
2215
|
+
}
|
|
2216
|
+
throw new AsgardeoAPIError(
|
|
2217
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2218
|
+
"getSchemas-NetworkError-001",
|
|
2219
|
+
"javascript",
|
|
2220
|
+
0,
|
|
2221
|
+
"Network Error"
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
var getSchemas_default = getSchemas;
|
|
2226
|
+
|
|
2227
|
+
// src/api/getAllOrganizations.ts
|
|
2228
|
+
var getAllOrganizations = async ({
|
|
2229
|
+
baseUrl,
|
|
2230
|
+
filter = "",
|
|
2231
|
+
limit = 10,
|
|
2232
|
+
recursive = false,
|
|
2233
|
+
fetcher,
|
|
2234
|
+
...requestConfig
|
|
2235
|
+
}) => {
|
|
2236
|
+
try {
|
|
2237
|
+
new URL(baseUrl);
|
|
2238
|
+
} catch (error) {
|
|
2239
|
+
throw new AsgardeoAPIError(
|
|
2240
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2241
|
+
"getAllOrganizations-ValidationError-001",
|
|
2242
|
+
"javascript",
|
|
2243
|
+
400,
|
|
2244
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2245
|
+
);
|
|
2246
|
+
}
|
|
2247
|
+
const queryParams = new URLSearchParams(
|
|
2248
|
+
Object.fromEntries(
|
|
2249
|
+
Object.entries({
|
|
2250
|
+
filter,
|
|
2251
|
+
limit: limit.toString(),
|
|
2252
|
+
recursive: recursive.toString()
|
|
2253
|
+
}).filter(([, value]) => Boolean(value))
|
|
2254
|
+
)
|
|
2255
|
+
);
|
|
2256
|
+
const fetchFn = fetcher || fetch;
|
|
2257
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;
|
|
2258
|
+
const requestInit = {
|
|
2259
|
+
...requestConfig,
|
|
2260
|
+
method: "GET",
|
|
2261
|
+
headers: {
|
|
2262
|
+
"Content-Type": "application/json",
|
|
2263
|
+
Accept: "application/json",
|
|
2264
|
+
...requestConfig.headers
|
|
2265
|
+
}
|
|
2266
|
+
};
|
|
2267
|
+
try {
|
|
2268
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2269
|
+
if (!response?.ok) {
|
|
2270
|
+
const errorText = await response.text();
|
|
2271
|
+
throw new AsgardeoAPIError(
|
|
2272
|
+
`Failed to get organizations: ${errorText}`,
|
|
2273
|
+
"getAllOrganizations-ResponseError-001",
|
|
2274
|
+
"javascript",
|
|
2275
|
+
response.status,
|
|
2276
|
+
response.statusText
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
const data = await response.json();
|
|
2280
|
+
return {
|
|
2281
|
+
hasMore: data.hasMore,
|
|
2282
|
+
nextCursor: data.nextCursor,
|
|
2283
|
+
organizations: data.organizations || [],
|
|
2284
|
+
totalCount: data.totalCount
|
|
2285
|
+
};
|
|
2286
|
+
} catch (error) {
|
|
2287
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2288
|
+
throw error;
|
|
2289
|
+
}
|
|
2290
|
+
throw new AsgardeoAPIError(
|
|
2291
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2292
|
+
"getAllOrganizations-NetworkError-001",
|
|
2293
|
+
"javascript",
|
|
2294
|
+
0,
|
|
2295
|
+
"Network Error"
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
var getAllOrganizations_default = getAllOrganizations;
|
|
2300
|
+
|
|
2301
|
+
// src/api/createOrganization.ts
|
|
2302
|
+
var createOrganization = async ({
|
|
2303
|
+
baseUrl,
|
|
2304
|
+
payload,
|
|
2305
|
+
fetcher,
|
|
2306
|
+
...requestConfig
|
|
2307
|
+
}) => {
|
|
2308
|
+
try {
|
|
2309
|
+
new URL(baseUrl);
|
|
2310
|
+
} catch (error) {
|
|
2311
|
+
throw new AsgardeoAPIError(
|
|
2312
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2313
|
+
"createOrganization-ValidationError-001",
|
|
2314
|
+
"javascript",
|
|
2315
|
+
400,
|
|
2316
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2317
|
+
);
|
|
2318
|
+
}
|
|
2319
|
+
if (!payload) {
|
|
2320
|
+
throw new AsgardeoAPIError(
|
|
2321
|
+
"Organization payload is required",
|
|
2322
|
+
"createOrganization-ValidationError-002",
|
|
2323
|
+
"javascript",
|
|
2324
|
+
400,
|
|
2325
|
+
"Invalid Request"
|
|
2326
|
+
);
|
|
2327
|
+
}
|
|
2328
|
+
const organizationPayload = {
|
|
2329
|
+
...payload,
|
|
2330
|
+
type: "TENANT"
|
|
2331
|
+
};
|
|
2332
|
+
const fetchFn = fetcher || fetch;
|
|
2333
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;
|
|
2334
|
+
const requestInit = {
|
|
2335
|
+
...requestConfig,
|
|
2336
|
+
method: "POST",
|
|
2337
|
+
headers: {
|
|
2338
|
+
"Content-Type": "application/json",
|
|
2339
|
+
Accept: "application/json",
|
|
2340
|
+
...requestConfig.headers
|
|
2341
|
+
},
|
|
2342
|
+
body: JSON.stringify(organizationPayload)
|
|
2343
|
+
};
|
|
2344
|
+
try {
|
|
2345
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2346
|
+
if (!response?.ok) {
|
|
2347
|
+
const errorText = await response.text();
|
|
2348
|
+
throw new AsgardeoAPIError(
|
|
2349
|
+
`Failed to create organization: ${errorText}`,
|
|
2350
|
+
"createOrganization-ResponseError-001",
|
|
2351
|
+
"javascript",
|
|
2352
|
+
response.status,
|
|
2353
|
+
response.statusText
|
|
2354
|
+
);
|
|
2355
|
+
}
|
|
2356
|
+
return await response.json();
|
|
2357
|
+
} catch (error) {
|
|
2358
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2359
|
+
throw error;
|
|
2360
|
+
}
|
|
2361
|
+
throw new AsgardeoAPIError(
|
|
2362
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2363
|
+
"createOrganization-NetworkError-001",
|
|
2364
|
+
"javascript",
|
|
2365
|
+
0,
|
|
2366
|
+
"Network Error"
|
|
2367
|
+
);
|
|
2368
|
+
}
|
|
2369
|
+
};
|
|
2370
|
+
var createOrganization_default = createOrganization;
|
|
2371
|
+
|
|
2372
|
+
// src/api/getMeOrganizations.ts
|
|
2373
|
+
var getMeOrganizations = async ({
|
|
2374
|
+
baseUrl,
|
|
2375
|
+
after = "",
|
|
2376
|
+
authorizedAppName = "",
|
|
2377
|
+
before = "",
|
|
2378
|
+
filter = "",
|
|
2379
|
+
limit = 10,
|
|
2380
|
+
recursive = false,
|
|
2381
|
+
fetcher,
|
|
2382
|
+
...requestConfig
|
|
2383
|
+
}) => {
|
|
2384
|
+
try {
|
|
2385
|
+
new URL(baseUrl);
|
|
2386
|
+
} catch (error) {
|
|
2387
|
+
throw new AsgardeoAPIError(
|
|
2388
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2389
|
+
"getMeOrganizations-ValidationError-001",
|
|
2390
|
+
"javascript",
|
|
2391
|
+
400,
|
|
2392
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2393
|
+
);
|
|
2394
|
+
}
|
|
2395
|
+
const queryParams = new URLSearchParams(
|
|
2396
|
+
Object.fromEntries(
|
|
2397
|
+
Object.entries({
|
|
2398
|
+
after,
|
|
2399
|
+
authorizedAppName,
|
|
2400
|
+
before,
|
|
2401
|
+
filter,
|
|
2402
|
+
limit: limit.toString(),
|
|
2403
|
+
recursive: recursive.toString()
|
|
2404
|
+
}).filter(([, value]) => Boolean(value))
|
|
2405
|
+
)
|
|
2406
|
+
);
|
|
2407
|
+
const fetchFn = fetcher || fetch;
|
|
2408
|
+
const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;
|
|
2409
|
+
const requestInit = {
|
|
2410
|
+
...requestConfig,
|
|
2411
|
+
method: "GET",
|
|
2412
|
+
headers: {
|
|
2413
|
+
"Content-Type": "application/json",
|
|
2414
|
+
Accept: "application/json",
|
|
2415
|
+
...requestConfig.headers
|
|
2416
|
+
}
|
|
2417
|
+
};
|
|
2418
|
+
try {
|
|
2419
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2420
|
+
if (!response?.ok) {
|
|
2421
|
+
const errorText = await response.text();
|
|
2422
|
+
throw new AsgardeoAPIError(
|
|
2423
|
+
`Failed to fetch associated organizations of the user: ${errorText}`,
|
|
2424
|
+
"getMeOrganizations-ResponseError-001",
|
|
2425
|
+
"javascript",
|
|
2426
|
+
response.status,
|
|
2427
|
+
response.statusText
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
const data = await response.json();
|
|
2431
|
+
return data.organizations || [];
|
|
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
|
+
"getMeOrganizations-NetworkError-001",
|
|
2439
|
+
"javascript",
|
|
2440
|
+
0,
|
|
2441
|
+
"Network Error"
|
|
2442
|
+
);
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
var getMeOrganizations_default = getMeOrganizations;
|
|
2446
|
+
|
|
2447
|
+
// src/api/getOrganization.ts
|
|
2448
|
+
var getOrganization = async ({
|
|
2449
|
+
baseUrl,
|
|
2450
|
+
organizationId,
|
|
2451
|
+
fetcher,
|
|
2452
|
+
...requestConfig
|
|
2453
|
+
}) => {
|
|
2454
|
+
try {
|
|
2455
|
+
new URL(baseUrl);
|
|
2456
|
+
} catch (error) {
|
|
2457
|
+
throw new AsgardeoAPIError(
|
|
2458
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2459
|
+
"getOrganization-ValidationError-001",
|
|
2460
|
+
"javascript",
|
|
2461
|
+
400,
|
|
2462
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2463
|
+
);
|
|
2464
|
+
}
|
|
2465
|
+
if (!organizationId) {
|
|
2466
|
+
throw new AsgardeoAPIError(
|
|
2467
|
+
"Organization ID is required",
|
|
2468
|
+
"getOrganization-ValidationError-002",
|
|
2469
|
+
"javascript",
|
|
2470
|
+
400,
|
|
2471
|
+
"Invalid Request"
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
const fetchFn = fetcher || fetch;
|
|
2475
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
2476
|
+
const requestInit = {
|
|
2477
|
+
...requestConfig,
|
|
2478
|
+
method: "GET",
|
|
2479
|
+
headers: {
|
|
2480
|
+
"Content-Type": "application/json",
|
|
2481
|
+
Accept: "application/json",
|
|
2482
|
+
...requestConfig.headers
|
|
2483
|
+
}
|
|
2484
|
+
};
|
|
2485
|
+
try {
|
|
2486
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2487
|
+
if (!response?.ok) {
|
|
2488
|
+
const errorText = await response.text();
|
|
2489
|
+
throw new AsgardeoAPIError(
|
|
2490
|
+
`Failed to fetch organization details: ${errorText}`,
|
|
2491
|
+
"getOrganization-ResponseError-001",
|
|
2492
|
+
"javascript",
|
|
2493
|
+
response.status,
|
|
2494
|
+
response.statusText
|
|
2495
|
+
);
|
|
2496
|
+
}
|
|
2497
|
+
return await response.json();
|
|
2498
|
+
} catch (error) {
|
|
2499
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2500
|
+
throw error;
|
|
2501
|
+
}
|
|
2502
|
+
throw new AsgardeoAPIError(
|
|
2503
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2504
|
+
"getOrganization-NetworkError-001",
|
|
2505
|
+
"javascript",
|
|
2506
|
+
0,
|
|
2507
|
+
"Network Error"
|
|
2508
|
+
);
|
|
2509
|
+
}
|
|
2510
|
+
};
|
|
2511
|
+
var getOrganization_default = getOrganization;
|
|
2512
|
+
|
|
2513
|
+
// src/utils/isEmpty.ts
|
|
2514
|
+
var isEmpty = (value) => {
|
|
2515
|
+
if (value === null || value === void 0) {
|
|
2516
|
+
return true;
|
|
2517
|
+
}
|
|
2518
|
+
if (typeof value === "string") {
|
|
2519
|
+
return value.trim() === "";
|
|
2520
|
+
}
|
|
2521
|
+
if (Array.isArray(value)) {
|
|
2522
|
+
return value.length === 0;
|
|
2523
|
+
}
|
|
2524
|
+
if (typeof value === "object" && value.constructor === Object) {
|
|
2525
|
+
return Object.keys(value).length === 0;
|
|
2526
|
+
}
|
|
2527
|
+
return false;
|
|
2528
|
+
};
|
|
2529
|
+
var isEmpty_default = isEmpty;
|
|
2530
|
+
|
|
2531
|
+
// src/api/updateOrganization.ts
|
|
2532
|
+
var updateOrganization = async ({
|
|
2533
|
+
baseUrl,
|
|
2534
|
+
organizationId,
|
|
2535
|
+
operations,
|
|
2536
|
+
fetcher,
|
|
2537
|
+
...requestConfig
|
|
2538
|
+
}) => {
|
|
2539
|
+
try {
|
|
2540
|
+
new URL(baseUrl);
|
|
2541
|
+
} catch (error) {
|
|
2542
|
+
throw new AsgardeoAPIError(
|
|
2543
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2544
|
+
"updateOrganization-ValidationError-001",
|
|
2545
|
+
"javascript",
|
|
2546
|
+
400,
|
|
2547
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2548
|
+
);
|
|
2549
|
+
}
|
|
2550
|
+
if (!organizationId) {
|
|
2551
|
+
throw new AsgardeoAPIError(
|
|
2552
|
+
"Organization ID is required",
|
|
2553
|
+
"updateOrganization-ValidationError-002",
|
|
2554
|
+
"javascript",
|
|
2555
|
+
400,
|
|
2556
|
+
"Invalid Request"
|
|
2557
|
+
);
|
|
2558
|
+
}
|
|
2559
|
+
if (!operations || !Array.isArray(operations) || operations.length === 0) {
|
|
2560
|
+
throw new AsgardeoAPIError(
|
|
2561
|
+
"Operations array is required and cannot be empty",
|
|
2562
|
+
"updateOrganization-ValidationError-003",
|
|
2563
|
+
"javascript",
|
|
2564
|
+
400,
|
|
2565
|
+
"Invalid Request"
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2568
|
+
const fetchFn = fetcher || fetch;
|
|
2569
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
2570
|
+
const requestInit = {
|
|
2571
|
+
...requestConfig,
|
|
2572
|
+
method: "PATCH",
|
|
2573
|
+
headers: {
|
|
2574
|
+
"Content-Type": "application/json",
|
|
2575
|
+
Accept: "application/json",
|
|
2576
|
+
...requestConfig.headers
|
|
2577
|
+
},
|
|
2578
|
+
body: JSON.stringify(operations)
|
|
2579
|
+
};
|
|
2580
|
+
try {
|
|
2581
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2582
|
+
if (!response?.ok) {
|
|
2583
|
+
const errorText = await response.text();
|
|
2584
|
+
throw new AsgardeoAPIError(
|
|
2585
|
+
`Failed to update organization: ${errorText}`,
|
|
2586
|
+
"updateOrganization-ResponseError-001",
|
|
2587
|
+
"javascript",
|
|
2588
|
+
response.status,
|
|
2589
|
+
response.statusText
|
|
2590
|
+
);
|
|
2591
|
+
}
|
|
2592
|
+
return await response.json();
|
|
2593
|
+
} catch (error) {
|
|
2594
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2595
|
+
throw error;
|
|
2596
|
+
}
|
|
2597
|
+
throw new AsgardeoAPIError(
|
|
2598
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2599
|
+
"updateOrganization-NetworkError-001",
|
|
2600
|
+
"javascript",
|
|
2601
|
+
0,
|
|
2602
|
+
"Network Error"
|
|
2603
|
+
);
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
var createPatchOperations = (payload) => {
|
|
2607
|
+
return Object.entries(payload).map(([key, value]) => {
|
|
2608
|
+
if (isEmpty_default(value)) {
|
|
2609
|
+
return {
|
|
2610
|
+
operation: "REMOVE",
|
|
2611
|
+
path: `/${key}`
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
return {
|
|
2615
|
+
operation: "REPLACE",
|
|
2616
|
+
path: `/${key}`,
|
|
2617
|
+
value
|
|
2618
|
+
};
|
|
2619
|
+
});
|
|
2620
|
+
};
|
|
2621
|
+
var updateOrganization_default = updateOrganization;
|
|
2622
|
+
|
|
2623
|
+
// src/api/updateMeProfile.ts
|
|
2624
|
+
var updateMeProfile = async ({
|
|
2625
|
+
url,
|
|
2626
|
+
baseUrl,
|
|
2627
|
+
payload,
|
|
2628
|
+
fetcher,
|
|
2629
|
+
...requestConfig
|
|
2630
|
+
}) => {
|
|
2631
|
+
try {
|
|
2632
|
+
new URL(url ?? baseUrl);
|
|
2633
|
+
} catch (error) {
|
|
2634
|
+
throw new AsgardeoAPIError(
|
|
2635
|
+
`Invalid URL provided. ${error?.toString()}`,
|
|
2636
|
+
"updateMeProfile-ValidationError-001",
|
|
2637
|
+
"javascript",
|
|
2638
|
+
400,
|
|
2639
|
+
"The provided `url` or `baseUrl` path does not adhere to the URL schema."
|
|
2640
|
+
);
|
|
2641
|
+
}
|
|
2642
|
+
const data = {
|
|
2643
|
+
Operations: [
|
|
2644
|
+
{
|
|
2645
|
+
op: "replace",
|
|
2646
|
+
value: payload
|
|
2647
|
+
}
|
|
2648
|
+
],
|
|
2649
|
+
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
|
|
2650
|
+
};
|
|
2651
|
+
const fetchFn = fetcher || fetch;
|
|
2652
|
+
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
2653
|
+
const requestInit = {
|
|
2654
|
+
method: "PATCH",
|
|
2655
|
+
...requestConfig,
|
|
2656
|
+
headers: {
|
|
2657
|
+
...requestConfig.headers,
|
|
2658
|
+
"Content-Type": "application/scim+json",
|
|
2659
|
+
Accept: "application/json"
|
|
2660
|
+
},
|
|
2661
|
+
body: JSON.stringify(data)
|
|
2662
|
+
};
|
|
2663
|
+
try {
|
|
2664
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2665
|
+
if (!response?.ok) {
|
|
2666
|
+
const errorText = await response.text();
|
|
2667
|
+
throw new AsgardeoAPIError(
|
|
2668
|
+
`Failed to update user profile: ${errorText}`,
|
|
2669
|
+
"updateMeProfile-ResponseError-001",
|
|
2670
|
+
"javascript",
|
|
2671
|
+
response.status,
|
|
2672
|
+
response.statusText
|
|
2673
|
+
);
|
|
2674
|
+
}
|
|
2675
|
+
return await response.json();
|
|
2676
|
+
} catch (error) {
|
|
2677
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2678
|
+
throw error;
|
|
2679
|
+
}
|
|
2680
|
+
throw new AsgardeoAPIError(
|
|
2681
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2682
|
+
"updateMeProfile-NetworkError-001",
|
|
2683
|
+
"javascript",
|
|
2684
|
+
0,
|
|
2685
|
+
"Network Error"
|
|
2686
|
+
);
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
var updateMeProfile_default = updateMeProfile;
|
|
2690
|
+
|
|
2691
|
+
// src/api/getBrandingPreference.ts
|
|
2692
|
+
var getBrandingPreference = async ({
|
|
2693
|
+
baseUrl,
|
|
2694
|
+
locale,
|
|
2695
|
+
name,
|
|
2696
|
+
type,
|
|
2697
|
+
fetcher,
|
|
2698
|
+
...requestConfig
|
|
2699
|
+
}) => {
|
|
2700
|
+
try {
|
|
2701
|
+
new URL(baseUrl);
|
|
2702
|
+
} catch (error) {
|
|
2703
|
+
throw new AsgardeoAPIError(
|
|
2704
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2705
|
+
"getBrandingPreference-ValidationError-001",
|
|
2706
|
+
"javascript",
|
|
2707
|
+
400,
|
|
2708
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2709
|
+
);
|
|
2710
|
+
}
|
|
2711
|
+
const queryParams = new URLSearchParams(
|
|
2712
|
+
Object.fromEntries(
|
|
2713
|
+
Object.entries({
|
|
2714
|
+
locale: locale || "",
|
|
2715
|
+
name: name || "",
|
|
2716
|
+
type: type || ""
|
|
2717
|
+
}).filter(([, value]) => Boolean(value))
|
|
2718
|
+
)
|
|
2719
|
+
);
|
|
2720
|
+
const fetchFn = fetcher || fetch;
|
|
2721
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2722
|
+
const requestInit = {
|
|
2723
|
+
...requestConfig,
|
|
2724
|
+
method: "GET",
|
|
2725
|
+
headers: {
|
|
2726
|
+
"Content-Type": "application/json",
|
|
2727
|
+
Accept: "application/json",
|
|
2728
|
+
...requestConfig.headers
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
try {
|
|
2732
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2733
|
+
if (!response?.ok) {
|
|
2734
|
+
const errorText = await response.text();
|
|
2735
|
+
throw new AsgardeoAPIError(
|
|
2736
|
+
`Failed to get branding preference: ${errorText}`,
|
|
2737
|
+
"getBrandingPreference-ResponseError-001",
|
|
2738
|
+
"javascript",
|
|
2739
|
+
response.status,
|
|
2740
|
+
response.statusText
|
|
2741
|
+
);
|
|
2742
|
+
}
|
|
2743
|
+
const data = await response.json();
|
|
2744
|
+
return data;
|
|
2745
|
+
} catch (error) {
|
|
2746
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2747
|
+
throw error;
|
|
2748
|
+
}
|
|
2749
|
+
throw new AsgardeoAPIError(
|
|
2750
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2751
|
+
"getBrandingPreference-NetworkError-001",
|
|
2752
|
+
"javascript",
|
|
2753
|
+
0,
|
|
2754
|
+
"Network Error"
|
|
2755
|
+
);
|
|
2756
|
+
}
|
|
2757
|
+
};
|
|
2758
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
2759
|
+
|
|
2034
2760
|
// src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
2035
2761
|
var ApplicationNativeAuthenticationConstants = {
|
|
2036
2762
|
SupportedAuthenticators: {
|
|
@@ -2052,39 +2778,55 @@ var ApplicationNativeAuthenticationConstants = {
|
|
|
2052
2778
|
};
|
|
2053
2779
|
var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
|
|
2054
2780
|
|
|
2055
|
-
// src/
|
|
2056
|
-
var
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
return
|
|
2071
|
-
})(
|
|
2072
|
-
var
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2781
|
+
// src/constants/VendorConstants.ts
|
|
2782
|
+
var VendorConstants = {
|
|
2783
|
+
/**
|
|
2784
|
+
* The prefix used for vendor-specific API endpoints, CSS classes, or other identifiers.
|
|
2785
|
+
*/
|
|
2786
|
+
VENDOR_PREFIX: "asgardeo"
|
|
2787
|
+
};
|
|
2788
|
+
var VendorConstants_default = VendorConstants;
|
|
2789
|
+
|
|
2790
|
+
// src/models/embedded-signin-flow.ts
|
|
2791
|
+
var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus2) => {
|
|
2792
|
+
EmbeddedSignInFlowStatus2["FailCompleted"] = "FAIL_COMPLETED";
|
|
2793
|
+
EmbeddedSignInFlowStatus2["FailIncomplete"] = "FAIL_INCOMPLETE";
|
|
2794
|
+
EmbeddedSignInFlowStatus2["Incomplete"] = "INCOMPLETE";
|
|
2795
|
+
EmbeddedSignInFlowStatus2["SuccessCompleted"] = "SUCCESS_COMPLETED";
|
|
2796
|
+
return EmbeddedSignInFlowStatus2;
|
|
2797
|
+
})(EmbeddedSignInFlowStatus || {});
|
|
2798
|
+
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType2) => {
|
|
2799
|
+
EmbeddedSignInFlowType2["Authentication"] = "AUTHENTICATION";
|
|
2800
|
+
return EmbeddedSignInFlowType2;
|
|
2801
|
+
})(EmbeddedSignInFlowType || {});
|
|
2802
|
+
var EmbeddedSignInFlowStepType = /* @__PURE__ */ ((EmbeddedSignInFlowStepType2) => {
|
|
2803
|
+
EmbeddedSignInFlowStepType2["AuthenticatorPrompt"] = "AUTHENTICATOR_PROMPT";
|
|
2804
|
+
EmbeddedSignInFlowStepType2["MultiOptionsPrompt"] = "MULTI_OPTIONS_PROMPT";
|
|
2805
|
+
return EmbeddedSignInFlowStepType2;
|
|
2806
|
+
})(EmbeddedSignInFlowStepType || {});
|
|
2807
|
+
var EmbeddedSignInFlowAuthenticatorParamType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorParamType2) => {
|
|
2808
|
+
EmbeddedSignInFlowAuthenticatorParamType2["Integer"] = "INTEGER";
|
|
2809
|
+
EmbeddedSignInFlowAuthenticatorParamType2["MultiValued"] = "MULTI_VALUED";
|
|
2810
|
+
EmbeddedSignInFlowAuthenticatorParamType2["String"] = "STRING";
|
|
2811
|
+
return EmbeddedSignInFlowAuthenticatorParamType2;
|
|
2812
|
+
})(EmbeddedSignInFlowAuthenticatorParamType || {});
|
|
2813
|
+
var EmbeddedSignInFlowAuthenticatorKnownIdPType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorKnownIdPType2) => {
|
|
2814
|
+
EmbeddedSignInFlowAuthenticatorKnownIdPType2["Local"] = "LOCAL";
|
|
2815
|
+
return EmbeddedSignInFlowAuthenticatorKnownIdPType2;
|
|
2816
|
+
})(EmbeddedSignInFlowAuthenticatorKnownIdPType || {});
|
|
2817
|
+
var EmbeddedSignInFlowAuthenticatorPromptType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorPromptType2) => {
|
|
2818
|
+
EmbeddedSignInFlowAuthenticatorPromptType2["InternalPrompt"] = "INTERNAL_PROMPT";
|
|
2819
|
+
EmbeddedSignInFlowAuthenticatorPromptType2["RedirectionPrompt"] = "REDIRECTION_PROMPT";
|
|
2820
|
+
EmbeddedSignInFlowAuthenticatorPromptType2["UserPrompt"] = "USER_PROMPT";
|
|
2821
|
+
return EmbeddedSignInFlowAuthenticatorPromptType2;
|
|
2822
|
+
})(EmbeddedSignInFlowAuthenticatorPromptType || {});
|
|
2823
|
+
|
|
2824
|
+
// src/models/flow.ts
|
|
2825
|
+
var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
|
|
2826
|
+
FlowMode2["Embedded"] = "DIRECT";
|
|
2827
|
+
FlowMode2["Redirect"] = "REDIRECTION";
|
|
2828
|
+
return FlowMode2;
|
|
2829
|
+
})(FlowMode || {});
|
|
2088
2830
|
|
|
2089
2831
|
// src/models/scim2-schema.ts
|
|
2090
2832
|
var WellKnownSchemaIds = /* @__PURE__ */ ((WellKnownSchemaIds2) => {
|
|
@@ -2139,6 +2881,14 @@ var lightTheme = {
|
|
|
2139
2881
|
main: "#d32f2f",
|
|
2140
2882
|
contrastText: "#ffffff"
|
|
2141
2883
|
},
|
|
2884
|
+
success: {
|
|
2885
|
+
main: "#4caf50",
|
|
2886
|
+
contrastText: "#ffffff"
|
|
2887
|
+
},
|
|
2888
|
+
warning: {
|
|
2889
|
+
main: "#ff9800",
|
|
2890
|
+
contrastText: "#ffffff"
|
|
2891
|
+
},
|
|
2142
2892
|
text: {
|
|
2143
2893
|
primary: "#1a1a1a",
|
|
2144
2894
|
secondary: "#666666"
|
|
@@ -2152,6 +2902,11 @@ var lightTheme = {
|
|
|
2152
2902
|
small: "4px",
|
|
2153
2903
|
medium: "8px",
|
|
2154
2904
|
large: "16px"
|
|
2905
|
+
},
|
|
2906
|
+
shadows: {
|
|
2907
|
+
small: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
2908
|
+
medium: "0 4px 16px rgba(0, 0, 0, 0.15)",
|
|
2909
|
+
large: "0 8px 32px rgba(0, 0, 0, 0.2)"
|
|
2155
2910
|
}
|
|
2156
2911
|
};
|
|
2157
2912
|
var darkTheme = {
|
|
@@ -2175,6 +2930,14 @@ var darkTheme = {
|
|
|
2175
2930
|
main: "#d32f2f",
|
|
2176
2931
|
contrastText: "#ffffff"
|
|
2177
2932
|
},
|
|
2933
|
+
success: {
|
|
2934
|
+
main: "#4caf50",
|
|
2935
|
+
contrastText: "#ffffff"
|
|
2936
|
+
},
|
|
2937
|
+
warning: {
|
|
2938
|
+
main: "#ff9800",
|
|
2939
|
+
contrastText: "#ffffff"
|
|
2940
|
+
},
|
|
2178
2941
|
text: {
|
|
2179
2942
|
primary: "#ffffff",
|
|
2180
2943
|
secondary: "#b3b3b3"
|
|
@@ -2188,6 +2951,11 @@ var darkTheme = {
|
|
|
2188
2951
|
small: "4px",
|
|
2189
2952
|
medium: "8px",
|
|
2190
2953
|
large: "16px"
|
|
2954
|
+
},
|
|
2955
|
+
shadows: {
|
|
2956
|
+
small: "0 2px 8px rgba(0, 0, 0, 0.3)",
|
|
2957
|
+
medium: "0 4px 16px rgba(0, 0, 0, 0.4)",
|
|
2958
|
+
large: "0 8px 32px rgba(0, 0, 0, 0.5)"
|
|
2191
2959
|
}
|
|
2192
2960
|
};
|
|
2193
2961
|
var toCssVariables = (theme) => {
|
|
@@ -2201,6 +2969,10 @@ var toCssVariables = (theme) => {
|
|
|
2201
2969
|
cssVars["--asgardeo-color-background-body-main"] = theme.colors.background.body.main;
|
|
2202
2970
|
cssVars["--asgardeo-color-error-main"] = theme.colors.error.main;
|
|
2203
2971
|
cssVars["--asgardeo-color-error-contrastText"] = theme.colors.error.contrastText;
|
|
2972
|
+
cssVars["--asgardeo-color-success-main"] = theme.colors.success.main;
|
|
2973
|
+
cssVars["--asgardeo-color-success-contrastText"] = theme.colors.success.contrastText;
|
|
2974
|
+
cssVars["--asgardeo-color-warning-main"] = theme.colors.warning.main;
|
|
2975
|
+
cssVars["--asgardeo-color-warning-contrastText"] = theme.colors.warning.contrastText;
|
|
2204
2976
|
cssVars["--asgardeo-color-text-primary"] = theme.colors.text.primary;
|
|
2205
2977
|
cssVars["--asgardeo-color-text-secondary"] = theme.colors.text.secondary;
|
|
2206
2978
|
cssVars["--asgardeo-color-border"] = theme.colors.border;
|
|
@@ -2208,6 +2980,9 @@ var toCssVariables = (theme) => {
|
|
|
2208
2980
|
cssVars["--asgardeo-border-radius-small"] = theme.borderRadius.small;
|
|
2209
2981
|
cssVars["--asgardeo-border-radius-medium"] = theme.borderRadius.medium;
|
|
2210
2982
|
cssVars["--asgardeo-border-radius-large"] = theme.borderRadius.large;
|
|
2983
|
+
cssVars["--asgardeo-shadow-small"] = theme.shadows.small;
|
|
2984
|
+
cssVars["--asgardeo-shadow-medium"] = theme.shadows.medium;
|
|
2985
|
+
cssVars["--asgardeo-shadow-large"] = theme.shadows.large;
|
|
2211
2986
|
return cssVars;
|
|
2212
2987
|
};
|
|
2213
2988
|
var createTheme = (config = {}, isDark = false) => {
|
|
@@ -2230,6 +3005,10 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
2230
3005
|
borderRadius: {
|
|
2231
3006
|
...baseTheme.borderRadius,
|
|
2232
3007
|
...config.borderRadius
|
|
3008
|
+
},
|
|
3009
|
+
shadows: {
|
|
3010
|
+
...baseTheme.shadows,
|
|
3011
|
+
...config.shadows
|
|
2233
3012
|
}
|
|
2234
3013
|
};
|
|
2235
3014
|
return {
|
|
@@ -2266,6 +3045,58 @@ var deepMerge = (target, ...sources) => {
|
|
|
2266
3045
|
};
|
|
2267
3046
|
var deepMerge_default = deepMerge;
|
|
2268
3047
|
|
|
3048
|
+
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
3049
|
+
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
3050
|
+
if (!baseUrl) {
|
|
3051
|
+
throw new AsgardeoRuntimeError(
|
|
3052
|
+
"Base URL is required to derive organization handle.",
|
|
3053
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001",
|
|
3054
|
+
"javascript",
|
|
3055
|
+
"A valid base URL must be provided to extract the organization handle."
|
|
3056
|
+
);
|
|
3057
|
+
}
|
|
3058
|
+
let parsedUrl;
|
|
3059
|
+
try {
|
|
3060
|
+
parsedUrl = new URL(baseUrl);
|
|
3061
|
+
} catch (error) {
|
|
3062
|
+
throw new AsgardeoRuntimeError(
|
|
3063
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3064
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002",
|
|
3065
|
+
"javascript",
|
|
3066
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3067
|
+
);
|
|
3068
|
+
}
|
|
3069
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
3070
|
+
if (!hostname.endsWith(".asgardeo.io")) {
|
|
3071
|
+
throw new AsgardeoRuntimeError(
|
|
3072
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3073
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-001",
|
|
3074
|
+
"javascript",
|
|
3075
|
+
"The provided base URL uses a custom domain. Please provide the organizationHandle explicitly in the configuration."
|
|
3076
|
+
);
|
|
3077
|
+
}
|
|
3078
|
+
const pathSegments = parsedUrl.pathname.split("/").filter((segment) => segment.length > 0);
|
|
3079
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3080
|
+
throw new AsgardeoRuntimeError(
|
|
3081
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3082
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002",
|
|
3083
|
+
"javascript",
|
|
3084
|
+
"The provided base URL does not follow the expected Asgardeo URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration."
|
|
3085
|
+
);
|
|
3086
|
+
}
|
|
3087
|
+
const organizationHandle = pathSegments[1];
|
|
3088
|
+
if (!organizationHandle || organizationHandle.trim().length === 0) {
|
|
3089
|
+
throw new AsgardeoRuntimeError(
|
|
3090
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3091
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003",
|
|
3092
|
+
"javascript",
|
|
3093
|
+
"The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration."
|
|
3094
|
+
);
|
|
3095
|
+
}
|
|
3096
|
+
return organizationHandle;
|
|
3097
|
+
};
|
|
3098
|
+
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
3099
|
+
|
|
2269
3100
|
// src/utils/flattenUserSchema.ts
|
|
2270
3101
|
var flattenUserSchema = (schemas) => {
|
|
2271
3102
|
const flattenedAttributes = [];
|
|
@@ -2378,27 +3209,67 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
|
|
|
2378
3209
|
const { name, type, multiValued } = schema;
|
|
2379
3210
|
if (!name) return;
|
|
2380
3211
|
const hasChildProperties = allSchemaNames.some(
|
|
2381
|
-
(schemaName) => schemaName !== name && schemaName.startsWith(name
|
|
3212
|
+
(schemaName) => schemaName !== name && schemaName.startsWith(`${name}.`)
|
|
2382
3213
|
);
|
|
2383
3214
|
if (hasChildProperties) {
|
|
2384
3215
|
return;
|
|
2385
3216
|
}
|
|
2386
3217
|
let value = get_default(meResponse, name);
|
|
3218
|
+
if (value === void 0) {
|
|
3219
|
+
const schemaNamespaces = [
|
|
3220
|
+
"urn:ietf:params:scim:schemas:core:2.0:User",
|
|
3221
|
+
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
|
|
3222
|
+
"urn:scim:wso2:schema",
|
|
3223
|
+
"urn:scim:schemas:extension:custom:User"
|
|
3224
|
+
];
|
|
3225
|
+
schemaNamespaces.some((namespace) => {
|
|
3226
|
+
if (meResponse[namespace]) {
|
|
3227
|
+
if (meResponse[namespace][name] !== void 0) {
|
|
3228
|
+
value = meResponse[namespace][name];
|
|
3229
|
+
return true;
|
|
3230
|
+
}
|
|
3231
|
+
const nestedValue = get_default(meResponse[namespace], name);
|
|
3232
|
+
if (nestedValue !== void 0) {
|
|
3233
|
+
value = nestedValue;
|
|
3234
|
+
return true;
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
return false;
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
2387
3240
|
if (value !== void 0) {
|
|
2388
3241
|
if (multiValued && !Array.isArray(value)) {
|
|
2389
3242
|
value = [value];
|
|
2390
3243
|
}
|
|
3244
|
+
} else if (multiValued) {
|
|
3245
|
+
value = void 0;
|
|
3246
|
+
} else if (type === "STRING") {
|
|
3247
|
+
value = "";
|
|
2391
3248
|
} else {
|
|
2392
|
-
|
|
2393
|
-
value = void 0;
|
|
2394
|
-
} else if (type === "STRING") {
|
|
2395
|
-
value = "";
|
|
2396
|
-
} else {
|
|
2397
|
-
value = void 0;
|
|
2398
|
-
}
|
|
3249
|
+
value = void 0;
|
|
2399
3250
|
}
|
|
2400
3251
|
profile[name] = value;
|
|
2401
3252
|
});
|
|
3253
|
+
const flattenObject = (obj, prefix = "") => {
|
|
3254
|
+
if (obj && typeof obj === "object" && !Array.isArray(obj)) {
|
|
3255
|
+
Object.keys(obj).forEach((key) => {
|
|
3256
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
3257
|
+
const value = obj[key];
|
|
3258
|
+
if (Object.prototype.hasOwnProperty.call(profile, fullKey)) {
|
|
3259
|
+
return;
|
|
3260
|
+
}
|
|
3261
|
+
const hasSchemaChildProperties = allSchemaNames.some(
|
|
3262
|
+
(schemaName) => schemaName.startsWith(`${fullKey}.`)
|
|
3263
|
+
);
|
|
3264
|
+
if (hasSchemaChildProperties) {
|
|
3265
|
+
flattenObject(value, fullKey);
|
|
3266
|
+
} else {
|
|
3267
|
+
profile[fullKey] = value;
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
flattenObject(meResponse);
|
|
2402
3273
|
return profile;
|
|
2403
3274
|
};
|
|
2404
3275
|
var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
@@ -2433,6 +3304,10 @@ var translations = {
|
|
|
2433
3304
|
/* |---------------------------------------------------------------| */
|
|
2434
3305
|
/* Base Sign In */
|
|
2435
3306
|
"signin.title": "Sign In",
|
|
3307
|
+
"signin.subtitle": "Enter your credentials to continue.",
|
|
3308
|
+
/* Base Sign Up */
|
|
3309
|
+
"signup.title": "Sign Up",
|
|
3310
|
+
"signup.subtitle": "Create a new account to get started.",
|
|
2436
3311
|
/* Email OTP */
|
|
2437
3312
|
"email.otp.title": "OTP Verification",
|
|
2438
3313
|
"email.otp.subtitle": "Enter the code sent to your email address.",
|
|
@@ -2454,6 +3329,30 @@ var translations = {
|
|
|
2454
3329
|
"username.password.title": "Sign In",
|
|
2455
3330
|
"username.password.subtitle": "Enter your username and password to continue.",
|
|
2456
3331
|
/* |---------------------------------------------------------------| */
|
|
3332
|
+
/* | Organization Switcher | */
|
|
3333
|
+
/* |---------------------------------------------------------------| */
|
|
3334
|
+
"organization.switcher.select.organization": "Select Organization",
|
|
3335
|
+
"organization.switcher.switch.organization": "Switch Organization",
|
|
3336
|
+
"organization.switcher.loading.organizations": "Loading organizations...",
|
|
3337
|
+
"organization.switcher.members": "members",
|
|
3338
|
+
"organization.switcher.member": "member",
|
|
3339
|
+
"organization.switcher.create.organization": "Create Organization",
|
|
3340
|
+
"organization.switcher.manage.organizations": "Manage Organization",
|
|
3341
|
+
"organization.switcher.manage.button": "Manage",
|
|
3342
|
+
"organization.profile.title": "Organization Profile",
|
|
3343
|
+
"organization.profile.loading": "Loading organization...",
|
|
3344
|
+
"organization.profile.error": "Failed to load organization",
|
|
3345
|
+
"organization.create.title": "Create Organization",
|
|
3346
|
+
"organization.create.name.label": "Organization Name",
|
|
3347
|
+
"organization.create.name.placeholder": "Enter organization name",
|
|
3348
|
+
"organization.create.handle.label": "Organization Handle",
|
|
3349
|
+
"organization.create.handle.placeholder": "my-organization",
|
|
3350
|
+
"organization.create.description.label": "Description",
|
|
3351
|
+
"organization.create.description.placeholder": "Enter organization description",
|
|
3352
|
+
"organization.create.button": "Create Organization",
|
|
3353
|
+
"organization.create.creating": "Creating...",
|
|
3354
|
+
"organization.create.cancel": "Cancel",
|
|
3355
|
+
/* |---------------------------------------------------------------| */
|
|
2457
3356
|
/* | Messages | */
|
|
2458
3357
|
/* |---------------------------------------------------------------| */
|
|
2459
3358
|
"messages.loading": "Loading...",
|
|
@@ -2522,43 +3421,67 @@ var resolveFieldName = (field) => {
|
|
|
2522
3421
|
);
|
|
2523
3422
|
};
|
|
2524
3423
|
var resolveFieldName_default = resolveFieldName;
|
|
3424
|
+
|
|
3425
|
+
// src/utils/withVendorCSSClassPrefix.ts
|
|
3426
|
+
var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
3427
|
+
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
2525
3428
|
export {
|
|
2526
|
-
ApplicationNativeAuthenticationAuthenticatorKnownIdPType,
|
|
2527
|
-
ApplicationNativeAuthenticationAuthenticatorParamType,
|
|
2528
|
-
ApplicationNativeAuthenticationAuthenticatorPromptType,
|
|
2529
3429
|
ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants,
|
|
2530
|
-
ApplicationNativeAuthenticationFlowStatus,
|
|
2531
|
-
ApplicationNativeAuthenticationFlowType,
|
|
2532
|
-
ApplicationNativeAuthenticationStepType,
|
|
2533
3430
|
AsgardeoAPIError,
|
|
2534
3431
|
AsgardeoAuthClient,
|
|
2535
3432
|
AsgardeoAuthException,
|
|
2536
3433
|
AsgardeoError,
|
|
2537
3434
|
AsgardeoJavaScriptClient_default as AsgardeoJavaScriptClient,
|
|
2538
3435
|
AsgardeoRuntimeError,
|
|
3436
|
+
EmbeddedFlowComponentType,
|
|
3437
|
+
EmbeddedFlowResponseType,
|
|
3438
|
+
EmbeddedFlowStatus,
|
|
3439
|
+
EmbeddedFlowType,
|
|
3440
|
+
EmbeddedSignInFlowAuthenticatorKnownIdPType,
|
|
3441
|
+
EmbeddedSignInFlowAuthenticatorParamType,
|
|
3442
|
+
EmbeddedSignInFlowAuthenticatorPromptType,
|
|
3443
|
+
EmbeddedSignInFlowStatus,
|
|
3444
|
+
EmbeddedSignInFlowStepType,
|
|
3445
|
+
EmbeddedSignInFlowType,
|
|
2539
3446
|
FieldType,
|
|
3447
|
+
FlowMode,
|
|
2540
3448
|
IsomorphicCrypto,
|
|
2541
3449
|
OIDCRequestConstants_default as OIDCRequestConstants,
|
|
2542
3450
|
StorageManager_default as StorageManager,
|
|
2543
3451
|
TokenConstants_default as TokenConstants,
|
|
3452
|
+
VendorConstants_default as VendorConstants,
|
|
2544
3453
|
WellKnownSchemaIds,
|
|
3454
|
+
createOrganization_default as createOrganization,
|
|
3455
|
+
createPatchOperations,
|
|
2545
3456
|
createTheme_default as createTheme,
|
|
2546
3457
|
deepMerge_default as deepMerge,
|
|
3458
|
+
deriveOrganizationHandleFromBaseUrl_default as deriveOrganizationHandleFromBaseUrl,
|
|
3459
|
+
executeEmbeddedSignInFlow_default as executeEmbeddedSignInFlow,
|
|
3460
|
+
executeEmbeddedSignUpFlow_default as executeEmbeddedSignUpFlow,
|
|
2547
3461
|
extractPkceStorageKeyFromState_default as extractPkceStorageKeyFromState,
|
|
2548
3462
|
extractUserClaimsFromIdToken_default as extractUserClaimsFromIdToken,
|
|
2549
3463
|
flattenUserSchema_default as flattenUserSchema,
|
|
2550
3464
|
generateFlattenedUserProfile_default as generateFlattenedUserProfile,
|
|
2551
3465
|
generateUserProfile_default as generateUserProfile,
|
|
2552
3466
|
get_default as get,
|
|
3467
|
+
getAllOrganizations_default as getAllOrganizations,
|
|
3468
|
+
getBrandingPreference_default as getBrandingPreference,
|
|
2553
3469
|
getI18nBundles_default as getI18nBundles,
|
|
2554
3470
|
getLatestStateParam_default as getLatestStateParam,
|
|
3471
|
+
getMeOrganizations_default as getMeOrganizations,
|
|
3472
|
+
getOrganization_default as getOrganization,
|
|
3473
|
+
getSchemas_default as getSchemas,
|
|
3474
|
+
getScim2Me_default as getScim2Me,
|
|
2555
3475
|
getUserInfo_default as getUserInfo,
|
|
2556
|
-
|
|
2557
|
-
|
|
3476
|
+
initializeEmbeddedSignInFlow_default as initializeEmbeddedSignInFlow,
|
|
3477
|
+
isEmpty_default as isEmpty,
|
|
2558
3478
|
processOpenIDScopes_default as processOpenIDScopes,
|
|
2559
3479
|
removeTrailingSlash_default as removeTrailingSlash,
|
|
2560
3480
|
resolveFieldName_default as resolveFieldName,
|
|
2561
3481
|
resolveFieldType_default as resolveFieldType,
|
|
2562
|
-
set_default as set
|
|
3482
|
+
set_default as set,
|
|
3483
|
+
updateMeProfile_default as updateMeProfile,
|
|
3484
|
+
updateOrganization_default as updateOrganization,
|
|
3485
|
+
withVendorCSSClassPrefix_default as withVendorCSSClassPrefix
|
|
2563
3486
|
};
|
|
2564
3487
|
//# sourceMappingURL=index.js.map
|