@asgardeo/javascript 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AsgardeoJavaScriptClient.d.ts +16 -50
- 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/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 +966 -146
- 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 +20 -5
- package/dist/index.js +939 -137
- package/dist/index.js.map +4 -4
- package/dist/models/client.d.ts +52 -3
- package/dist/models/config.d.ts +36 -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 +29 -16
- 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/cjs/index.js
CHANGED
|
@@ -21,43 +21,61 @@ 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
|
+
executeEmbeddedSignInFlow: () => executeEmbeddedSignInFlow_default,
|
|
54
|
+
executeEmbeddedSignUpFlow: () => executeEmbeddedSignUpFlow_default,
|
|
45
55
|
extractPkceStorageKeyFromState: () => extractPkceStorageKeyFromState_default,
|
|
46
56
|
extractUserClaimsFromIdToken: () => extractUserClaimsFromIdToken_default,
|
|
47
57
|
flattenUserSchema: () => flattenUserSchema_default,
|
|
48
58
|
generateFlattenedUserProfile: () => generateFlattenedUserProfile_default,
|
|
49
59
|
generateUserProfile: () => generateUserProfile_default,
|
|
50
60
|
get: () => get_default,
|
|
61
|
+
getAllOrganizations: () => getAllOrganizations_default,
|
|
51
62
|
getI18nBundles: () => getI18nBundles_default,
|
|
52
63
|
getLatestStateParam: () => getLatestStateParam_default,
|
|
64
|
+
getMeOrganizations: () => getMeOrganizations_default,
|
|
65
|
+
getOrganization: () => getOrganization_default,
|
|
66
|
+
getSchemas: () => getSchemas_default,
|
|
67
|
+
getScim2Me: () => getScim2Me_default,
|
|
53
68
|
getUserInfo: () => getUserInfo_default,
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
initializeEmbeddedSignInFlow: () => initializeEmbeddedSignInFlow_default,
|
|
70
|
+
isEmpty: () => isEmpty_default,
|
|
56
71
|
processOpenIDScopes: () => processOpenIDScopes_default,
|
|
57
72
|
removeTrailingSlash: () => removeTrailingSlash_default,
|
|
58
73
|
resolveFieldName: () => resolveFieldName_default,
|
|
59
74
|
resolveFieldType: () => resolveFieldType_default,
|
|
60
|
-
set: () => set_default
|
|
75
|
+
set: () => set_default,
|
|
76
|
+
updateMeProfile: () => updateMeProfile_default,
|
|
77
|
+
updateOrganization: () => updateOrganization_default,
|
|
78
|
+
withVendorCSSClassPrefix: () => withVendorCSSClassPrefix_default
|
|
61
79
|
});
|
|
62
80
|
module.exports = __toCommonJS(index_exports);
|
|
63
81
|
|
|
@@ -120,8 +138,8 @@ var StorageManager = class {
|
|
|
120
138
|
async setCustomData(key, customData, userId) {
|
|
121
139
|
this.setDataInBulk(this._resolveKey(key, userId), customData);
|
|
122
140
|
}
|
|
123
|
-
async getConfigData() {
|
|
124
|
-
return JSON.parse(await this._store.getData(this._resolveKey("config_data" /* ConfigData
|
|
141
|
+
async getConfigData(userId) {
|
|
142
|
+
return JSON.parse(await this._store.getData(this._resolveKey("config_data" /* ConfigData */, userId)) ?? null);
|
|
125
143
|
}
|
|
126
144
|
async loadOpenIDProviderConfiguration() {
|
|
127
145
|
return JSON.parse(await this._store.getData(this._resolveKey("oidc_provider_meta_data" /* OIDCProviderMetaData */)) ?? null);
|
|
@@ -320,12 +338,24 @@ var OIDCDiscoveryConstants_default = OIDCDiscoveryConstants;
|
|
|
320
338
|
|
|
321
339
|
// src/constants/ScopeConstants.ts
|
|
322
340
|
var ScopeConstants = {
|
|
341
|
+
/**
|
|
342
|
+
* The scope for accessing the user's profile information from SCIM.
|
|
343
|
+
* This scope allows the client to retrieve basic user information such as
|
|
344
|
+
* name, email, profile picture, etc.
|
|
345
|
+
*/
|
|
346
|
+
INTERNAL_LOGIN: "internal_login",
|
|
323
347
|
/**
|
|
324
348
|
* The base OpenID Connect scope.
|
|
325
349
|
* Required for all OpenID Connect flows. Indicates that the client
|
|
326
350
|
* is initiating an OpenID Connect authentication request.
|
|
327
351
|
*/
|
|
328
|
-
OPENID: "openid"
|
|
352
|
+
OPENID: "openid",
|
|
353
|
+
/**
|
|
354
|
+
* The OpenID Connect profile scope.
|
|
355
|
+
* This scope allows the client to access the user's profile information.
|
|
356
|
+
* It includes details such as the user's name, email, and other profile attributes.
|
|
357
|
+
*/
|
|
358
|
+
PROFILE: "profile"
|
|
329
359
|
};
|
|
330
360
|
var ScopeConstants_default = ScopeConstants;
|
|
331
361
|
|
|
@@ -363,7 +393,7 @@ var OIDCRequestConstants = {
|
|
|
363
393
|
/**
|
|
364
394
|
* The default scopes used in OIDC sign-in requests.
|
|
365
395
|
*/
|
|
366
|
-
DEFAULT_SCOPES: [ScopeConstants_default.OPENID]
|
|
396
|
+
DEFAULT_SCOPES: [ScopeConstants_default.OPENID, ScopeConstants_default.PROFILE, ScopeConstants_default.INTERNAL_LOGIN]
|
|
367
397
|
}
|
|
368
398
|
},
|
|
369
399
|
/**
|
|
@@ -584,39 +614,6 @@ var extractPkceStorageKeyFromState = (state) => {
|
|
|
584
614
|
};
|
|
585
615
|
var extractPkceStorageKeyFromState_default = extractPkceStorageKeyFromState;
|
|
586
616
|
|
|
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
617
|
// src/constants/TokenExchangeConstants.ts
|
|
621
618
|
var TokenExchangeConstants = {
|
|
622
619
|
/**
|
|
@@ -629,7 +626,7 @@ var TokenExchangeConstants = {
|
|
|
629
626
|
* Placeholder for the token value in exchange requests.
|
|
630
627
|
* Usually replaced with an access token or refresh token.
|
|
631
628
|
*/
|
|
632
|
-
|
|
629
|
+
ACCESS_TOKEN: "{{accessToken}}",
|
|
633
630
|
/**
|
|
634
631
|
* Placeholder for the username in token exchange operations.
|
|
635
632
|
* Used when user identity needs to be included in the exchange.
|
|
@@ -639,7 +636,7 @@ var TokenExchangeConstants = {
|
|
|
639
636
|
* Placeholder for OAuth scopes in token exchange requests.
|
|
640
637
|
* Replaced with space-separated scope strings.
|
|
641
638
|
*/
|
|
642
|
-
|
|
639
|
+
SCOPES: "{{scopes}}",
|
|
643
640
|
/**
|
|
644
641
|
* Placeholder for client ID in token exchange operations.
|
|
645
642
|
* Required for client authentication.
|
|
@@ -654,6 +651,39 @@ var TokenExchangeConstants = {
|
|
|
654
651
|
};
|
|
655
652
|
var TokenExchangeConstants_default = TokenExchangeConstants;
|
|
656
653
|
|
|
654
|
+
// src/utils/extractUserClaimsFromIdToken.ts
|
|
655
|
+
var extractUserClaimsFromIdToken = (payload) => {
|
|
656
|
+
const filteredPayload = { ...payload };
|
|
657
|
+
const protocolClaims = [
|
|
658
|
+
"iss",
|
|
659
|
+
"aud",
|
|
660
|
+
"exp",
|
|
661
|
+
"iat",
|
|
662
|
+
"acr",
|
|
663
|
+
"amr",
|
|
664
|
+
"azp",
|
|
665
|
+
"auth_time",
|
|
666
|
+
"nonce",
|
|
667
|
+
"c_hash",
|
|
668
|
+
"at_hash",
|
|
669
|
+
"nbf",
|
|
670
|
+
"isk",
|
|
671
|
+
"sid",
|
|
672
|
+
"jti",
|
|
673
|
+
"sub"
|
|
674
|
+
];
|
|
675
|
+
protocolClaims.forEach((claim) => {
|
|
676
|
+
delete filteredPayload[claim];
|
|
677
|
+
});
|
|
678
|
+
const userClaims = {};
|
|
679
|
+
Object.entries(filteredPayload).forEach(([key, value]) => {
|
|
680
|
+
const camelCasedKey = key.split("_").map((part, i) => i === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
|
|
681
|
+
userClaims[camelCasedKey] = value;
|
|
682
|
+
});
|
|
683
|
+
return userClaims;
|
|
684
|
+
};
|
|
685
|
+
var extractUserClaimsFromIdToken_default = extractUserClaimsFromIdToken;
|
|
686
|
+
|
|
657
687
|
// src/errors/AsgardeoError.ts
|
|
658
688
|
var AsgardeoError = class _AsgardeoError extends Error {
|
|
659
689
|
constructor(message, code, origin) {
|
|
@@ -722,17 +752,19 @@ Message: ${this.message}`;
|
|
|
722
752
|
// src/utils/processOpenIDScopes.ts
|
|
723
753
|
var processOpenIDScopes = (scopes) => {
|
|
724
754
|
let processedScopes = [];
|
|
725
|
-
if (
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
755
|
+
if (scopes) {
|
|
756
|
+
if (Array.isArray(scopes)) {
|
|
757
|
+
processedScopes = scopes;
|
|
758
|
+
} else if (typeof scopes === "string") {
|
|
759
|
+
processedScopes = scopes.split(" ");
|
|
760
|
+
} else {
|
|
761
|
+
throw new AsgardeoRuntimeError(
|
|
762
|
+
"Scopes must be a string or an array of strings.",
|
|
763
|
+
"processOpenIDScopes-Invalid-001",
|
|
764
|
+
"javascript",
|
|
765
|
+
"The provided scopes are not in the expected format. Please provide a string or an array of strings."
|
|
766
|
+
);
|
|
767
|
+
}
|
|
736
768
|
}
|
|
737
769
|
OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
|
|
738
770
|
if (!processedScopes.includes(defaultScope)) {
|
|
@@ -751,8 +783,8 @@ var AuthenticationHelper = class {
|
|
|
751
783
|
__publicField(this, "_oidcProviderMetaData");
|
|
752
784
|
__publicField(this, "_cryptoHelper");
|
|
753
785
|
this._storageManager = storageManager;
|
|
754
|
-
this._config = async () =>
|
|
755
|
-
this._oidcProviderMetaData = async () =>
|
|
786
|
+
this._config = async () => this._storageManager.getConfigData();
|
|
787
|
+
this._oidcProviderMetaData = async () => this._storageManager.loadOpenIDProviderConfiguration();
|
|
756
788
|
this._cryptoHelper = cryptoHelper;
|
|
757
789
|
}
|
|
758
790
|
async resolveEndpoints(response) {
|
|
@@ -777,15 +809,15 @@ var AuthenticationHelper = class {
|
|
|
777
809
|
OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.ISSUER,
|
|
778
810
|
OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.USERINFO
|
|
779
811
|
];
|
|
780
|
-
const isRequiredEndpointsContains = configData.endpoints ? requiredEndpoints.every(
|
|
781
|
-
|
|
812
|
+
const isRequiredEndpointsContains = configData.endpoints ? requiredEndpoints.every(
|
|
813
|
+
(reqEndpointName) => configData.endpoints ? Object.keys(configData.endpoints).some((endpointName) => {
|
|
782
814
|
const snakeCasedName = endpointName.replace(
|
|
783
815
|
/[A-Z]/g,
|
|
784
816
|
(letter) => `_${letter.toLowerCase()}`
|
|
785
817
|
);
|
|
786
818
|
return snakeCasedName === reqEndpointName;
|
|
787
|
-
}) : false
|
|
788
|
-
|
|
819
|
+
}) : false
|
|
820
|
+
) : false;
|
|
789
821
|
if (!isRequiredEndpointsContains) {
|
|
790
822
|
throw new AsgardeoAuthException(
|
|
791
823
|
"JS-AUTH_HELPER-REE-NF01",
|
|
@@ -802,7 +834,7 @@ var AuthenticationHelper = class {
|
|
|
802
834
|
async resolveEndpointsByBaseURL() {
|
|
803
835
|
const oidcProviderMetaData = {};
|
|
804
836
|
const configData = await this._config();
|
|
805
|
-
const baseUrl = configData
|
|
837
|
+
const { baseUrl } = configData;
|
|
806
838
|
if (!baseUrl) {
|
|
807
839
|
throw new AsgardeoAuthException(
|
|
808
840
|
"JS-AUTH_HELPER_REBO-NF01",
|
|
@@ -855,7 +887,7 @@ var AuthenticationHelper = class {
|
|
|
855
887
|
await response.json()
|
|
856
888
|
);
|
|
857
889
|
}
|
|
858
|
-
const issuer =
|
|
890
|
+
const { issuer } = await this._oidcProviderMetaData();
|
|
859
891
|
const { keys } = await response.json();
|
|
860
892
|
const jwk = await this._cryptoHelper.getJWKForTheIdToken(idToken.split(".")[0], keys);
|
|
861
893
|
return this._cryptoHelper.isValidIdToken(
|
|
@@ -873,7 +905,7 @@ var AuthenticationHelper = class {
|
|
|
873
905
|
const username = payload?.["username"] ?? "";
|
|
874
906
|
const givenName = payload?.["given_name"] ?? "";
|
|
875
907
|
const familyName = payload?.["family_name"] ?? "";
|
|
876
|
-
const fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName
|
|
908
|
+
const fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || "";
|
|
877
909
|
const displayName = payload.preferred_username ?? fullName;
|
|
878
910
|
return {
|
|
879
911
|
displayName,
|
|
@@ -884,11 +916,14 @@ var AuthenticationHelper = class {
|
|
|
884
916
|
async replaceCustomGrantTemplateTags(text, userId) {
|
|
885
917
|
const configData = await this._config();
|
|
886
918
|
const sessionData = await this._storageManager.getSessionData(userId);
|
|
887
|
-
|
|
888
|
-
|
|
919
|
+
const scope = processOpenIDScopes_default(configData.scopes);
|
|
920
|
+
if (typeof text !== "string") {
|
|
921
|
+
return text;
|
|
922
|
+
}
|
|
923
|
+
return text.replace(TokenExchangeConstants_default.Placeholders.ACCESS_TOKEN, sessionData.access_token).replace(
|
|
889
924
|
TokenExchangeConstants_default.Placeholders.USERNAME,
|
|
890
925
|
this.getAuthenticatedUserInfo(sessionData.id_token).username
|
|
891
|
-
).replace(TokenExchangeConstants_default.Placeholders.
|
|
926
|
+
).replace(TokenExchangeConstants_default.Placeholders.SCOPES, scope).replace(TokenExchangeConstants_default.Placeholders.CLIENT_ID, configData.clientId).replace(TokenExchangeConstants_default.Placeholders.CLIENT_SECRET, configData.clientSecret ?? "");
|
|
892
927
|
}
|
|
893
928
|
async clearSession(userId) {
|
|
894
929
|
await this._storageManager.removeTemporaryData(userId);
|
|
@@ -908,7 +943,7 @@ var AuthenticationHelper = class {
|
|
|
908
943
|
if (shouldValidateIdToken) {
|
|
909
944
|
return this.validateIdToken(parsedResponse.id_token).then(async () => {
|
|
910
945
|
await this._storageManager.setSessionData(parsedResponse, userId);
|
|
911
|
-
const
|
|
946
|
+
const tokenResponse2 = {
|
|
912
947
|
accessToken: parsedResponse.access_token,
|
|
913
948
|
createdAt: parsedResponse.created_at,
|
|
914
949
|
expiresIn: parsedResponse.expires_in,
|
|
@@ -917,21 +952,20 @@ var AuthenticationHelper = class {
|
|
|
917
952
|
scope: parsedResponse.scope,
|
|
918
953
|
tokenType: parsedResponse.token_type
|
|
919
954
|
};
|
|
920
|
-
return Promise.resolve(
|
|
955
|
+
return Promise.resolve(tokenResponse2);
|
|
921
956
|
});
|
|
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
957
|
}
|
|
958
|
+
const tokenResponse = {
|
|
959
|
+
accessToken: parsedResponse.access_token,
|
|
960
|
+
createdAt: parsedResponse.created_at,
|
|
961
|
+
expiresIn: parsedResponse.expires_in,
|
|
962
|
+
idToken: parsedResponse.id_token,
|
|
963
|
+
refreshToken: parsedResponse.refresh_token,
|
|
964
|
+
scope: parsedResponse.scope,
|
|
965
|
+
tokenType: parsedResponse.token_type
|
|
966
|
+
};
|
|
967
|
+
await this._storageManager.setSessionData(parsedResponse, userId);
|
|
968
|
+
return Promise.resolve(tokenResponse);
|
|
935
969
|
}
|
|
936
970
|
};
|
|
937
971
|
|
|
@@ -958,7 +992,7 @@ var generateStateParamForRequestCorrelation_default = generateStateParamForReque
|
|
|
958
992
|
|
|
959
993
|
// src/utils/getAuthorizeRequestUrlParams.ts
|
|
960
994
|
var getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
|
|
961
|
-
const { redirectUri, clientId, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;
|
|
995
|
+
const { redirectUri, clientId, clientSecret, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;
|
|
962
996
|
const authorizeRequestParams = /* @__PURE__ */ new Map();
|
|
963
997
|
authorizeRequestParams.set("response_type", "code");
|
|
964
998
|
authorizeRequestParams.set("client_id", clientId);
|
|
@@ -1161,6 +1195,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1161
1195
|
codeChallenge = this._cryptoHelper?.getCodeChallenge(codeVerifier);
|
|
1162
1196
|
await this._storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);
|
|
1163
1197
|
}
|
|
1198
|
+
if (authRequestConfig["client_secret"]) {
|
|
1199
|
+
authRequestConfig["client_secret"] = configData.clientSecret;
|
|
1200
|
+
}
|
|
1164
1201
|
const authorizeRequestParams = getAuthorizeRequestUrlParams_default(
|
|
1165
1202
|
{
|
|
1166
1203
|
redirectUri: configData.afterSignInUrl,
|
|
@@ -1963,8 +2000,8 @@ Message: ${this.message}`;
|
|
|
1963
2000
|
}
|
|
1964
2001
|
};
|
|
1965
2002
|
|
|
1966
|
-
// src/api/
|
|
1967
|
-
var
|
|
2003
|
+
// src/api/initializeEmbeddedSignInFlow.ts
|
|
2004
|
+
var initializeEmbeddedSignInFlow = async ({
|
|
1968
2005
|
url,
|
|
1969
2006
|
baseUrl,
|
|
1970
2007
|
payload,
|
|
@@ -1973,7 +2010,7 @@ var initializeApplicationNativeAuthentication = async ({
|
|
|
1973
2010
|
if (!payload) {
|
|
1974
2011
|
throw new AsgardeoAPIError(
|
|
1975
2012
|
"Authorization payload is required",
|
|
1976
|
-
"
|
|
2013
|
+
"initializeEmbeddedSignInFlow-ValidationError-002",
|
|
1977
2014
|
"javascript",
|
|
1978
2015
|
400,
|
|
1979
2016
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
@@ -2000,7 +2037,7 @@ var initializeApplicationNativeAuthentication = async ({
|
|
|
2000
2037
|
const errorText = await response.text();
|
|
2001
2038
|
throw new AsgardeoAPIError(
|
|
2002
2039
|
`Authorization request failed: ${errorText}`,
|
|
2003
|
-
"
|
|
2040
|
+
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2004
2041
|
"javascript",
|
|
2005
2042
|
response.status,
|
|
2006
2043
|
response.statusText
|
|
@@ -2008,10 +2045,10 @@ var initializeApplicationNativeAuthentication = async ({
|
|
|
2008
2045
|
}
|
|
2009
2046
|
return await response.json();
|
|
2010
2047
|
};
|
|
2011
|
-
var
|
|
2048
|
+
var initializeEmbeddedSignInFlow_default = initializeEmbeddedSignInFlow;
|
|
2012
2049
|
|
|
2013
|
-
// src/api/
|
|
2014
|
-
var
|
|
2050
|
+
// src/api/executeEmbeddedSignInFlow.ts
|
|
2051
|
+
var executeEmbeddedSignInFlow = async ({
|
|
2015
2052
|
url,
|
|
2016
2053
|
baseUrl,
|
|
2017
2054
|
payload,
|
|
@@ -2020,7 +2057,7 @@ var handleApplicationNativeAuthentication = async ({
|
|
|
2020
2057
|
if (!payload) {
|
|
2021
2058
|
throw new AsgardeoAPIError(
|
|
2022
2059
|
"Authorization payload is required",
|
|
2023
|
-
"
|
|
2060
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
2024
2061
|
"javascript",
|
|
2025
2062
|
400,
|
|
2026
2063
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
@@ -2041,7 +2078,7 @@ var handleApplicationNativeAuthentication = async ({
|
|
|
2041
2078
|
const errorText = await response.text();
|
|
2042
2079
|
throw new AsgardeoAPIError(
|
|
2043
2080
|
`Authorization request failed: ${errorText}`,
|
|
2044
|
-
"
|
|
2081
|
+
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2045
2082
|
"javascript",
|
|
2046
2083
|
response.status,
|
|
2047
2084
|
response.statusText
|
|
@@ -2049,7 +2086,79 @@ var handleApplicationNativeAuthentication = async ({
|
|
|
2049
2086
|
}
|
|
2050
2087
|
return await response.json();
|
|
2051
2088
|
};
|
|
2052
|
-
var
|
|
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 { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
2136
|
+
const response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {
|
|
2137
|
+
method: requestConfig.method || "POST",
|
|
2138
|
+
headers: {
|
|
2139
|
+
"Content-Type": "application/json",
|
|
2140
|
+
Accept: "application/json",
|
|
2141
|
+
...customHeaders
|
|
2142
|
+
},
|
|
2143
|
+
body: JSON.stringify({
|
|
2144
|
+
...payload ?? {},
|
|
2145
|
+
flowType: "REGISTRATION" /* Registration */
|
|
2146
|
+
}),
|
|
2147
|
+
...otherConfig
|
|
2148
|
+
});
|
|
2149
|
+
if (!response.ok) {
|
|
2150
|
+
const errorText = await response.text();
|
|
2151
|
+
throw new AsgardeoAPIError(
|
|
2152
|
+
`Embedded SignUp flow execution failed: ${errorText}`,
|
|
2153
|
+
"javascript-executeEmbeddedSignUpFlow-ResponseError-100",
|
|
2154
|
+
"javascript",
|
|
2155
|
+
response.status,
|
|
2156
|
+
response.statusText
|
|
2157
|
+
);
|
|
2158
|
+
}
|
|
2159
|
+
return await response.json();
|
|
2160
|
+
};
|
|
2161
|
+
var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
|
|
2053
2162
|
|
|
2054
2163
|
// src/api/getUserInfo.ts
|
|
2055
2164
|
var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
@@ -2086,6 +2195,574 @@ 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
|
+
method: "GET",
|
|
2215
|
+
headers: {
|
|
2216
|
+
"Content-Type": "application/scim+json",
|
|
2217
|
+
Accept: "application/json",
|
|
2218
|
+
...requestConfig.headers
|
|
2219
|
+
},
|
|
2220
|
+
...requestConfig
|
|
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
|
+
method: "GET",
|
|
2267
|
+
headers: {
|
|
2268
|
+
"Content-Type": "application/json",
|
|
2269
|
+
Accept: "application/json",
|
|
2270
|
+
...requestConfig.headers
|
|
2271
|
+
},
|
|
2272
|
+
...requestConfig
|
|
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
|
+
method: "GET",
|
|
2335
|
+
headers: {
|
|
2336
|
+
"Content-Type": "application/json",
|
|
2337
|
+
Accept: "application/json",
|
|
2338
|
+
...requestConfig.headers
|
|
2339
|
+
},
|
|
2340
|
+
...requestConfig
|
|
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
|
+
method: "POST",
|
|
2411
|
+
headers: {
|
|
2412
|
+
"Content-Type": "application/json",
|
|
2413
|
+
Accept: "application/json",
|
|
2414
|
+
...requestConfig.headers
|
|
2415
|
+
},
|
|
2416
|
+
body: JSON.stringify(organizationPayload),
|
|
2417
|
+
...requestConfig
|
|
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
|
+
method: "GET",
|
|
2486
|
+
headers: {
|
|
2487
|
+
"Content-Type": "application/json",
|
|
2488
|
+
Accept: "application/json",
|
|
2489
|
+
...requestConfig.headers
|
|
2490
|
+
},
|
|
2491
|
+
...requestConfig
|
|
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
|
+
method: "GET",
|
|
2553
|
+
headers: {
|
|
2554
|
+
"Content-Type": "application/json",
|
|
2555
|
+
Accept: "application/json",
|
|
2556
|
+
...requestConfig.headers
|
|
2557
|
+
},
|
|
2558
|
+
...requestConfig
|
|
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
|
+
method: "PATCH",
|
|
2647
|
+
headers: {
|
|
2648
|
+
"Content-Type": "application/json",
|
|
2649
|
+
Accept: "application/json",
|
|
2650
|
+
...requestConfig.headers
|
|
2651
|
+
},
|
|
2652
|
+
body: JSON.stringify(operations),
|
|
2653
|
+
...requestConfig
|
|
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
|
+
headers: {
|
|
2731
|
+
"Content-Type": "application/scim+json",
|
|
2732
|
+
Accept: "application/json",
|
|
2733
|
+
...requestConfig.headers
|
|
2734
|
+
},
|
|
2735
|
+
body: JSON.stringify(data),
|
|
2736
|
+
...requestConfig
|
|
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
|
+
|
|
2089
2766
|
// src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
2090
2767
|
var ApplicationNativeAuthenticationConstants = {
|
|
2091
2768
|
SupportedAuthenticators: {
|
|
@@ -2107,39 +2784,55 @@ var ApplicationNativeAuthenticationConstants = {
|
|
|
2107
2784
|
};
|
|
2108
2785
|
var ApplicationNativeAuthenticationConstants_default = ApplicationNativeAuthenticationConstants;
|
|
2109
2786
|
|
|
2110
|
-
// src/
|
|
2111
|
-
var
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
return
|
|
2126
|
-
})(
|
|
2127
|
-
var
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2787
|
+
// src/constants/VendorConstants.ts
|
|
2788
|
+
var VendorConstants = {
|
|
2789
|
+
/**
|
|
2790
|
+
* The prefix used for vendor-specific API endpoints, CSS classes, or other identifiers.
|
|
2791
|
+
*/
|
|
2792
|
+
VENDOR_PREFIX: "asgardeo"
|
|
2793
|
+
};
|
|
2794
|
+
var VendorConstants_default = VendorConstants;
|
|
2795
|
+
|
|
2796
|
+
// src/models/embedded-signin-flow.ts
|
|
2797
|
+
var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus2) => {
|
|
2798
|
+
EmbeddedSignInFlowStatus2["FailCompleted"] = "FAIL_COMPLETED";
|
|
2799
|
+
EmbeddedSignInFlowStatus2["FailIncomplete"] = "FAIL_INCOMPLETE";
|
|
2800
|
+
EmbeddedSignInFlowStatus2["Incomplete"] = "INCOMPLETE";
|
|
2801
|
+
EmbeddedSignInFlowStatus2["SuccessCompleted"] = "SUCCESS_COMPLETED";
|
|
2802
|
+
return EmbeddedSignInFlowStatus2;
|
|
2803
|
+
})(EmbeddedSignInFlowStatus || {});
|
|
2804
|
+
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType2) => {
|
|
2805
|
+
EmbeddedSignInFlowType2["Authentication"] = "AUTHENTICATION";
|
|
2806
|
+
return EmbeddedSignInFlowType2;
|
|
2807
|
+
})(EmbeddedSignInFlowType || {});
|
|
2808
|
+
var EmbeddedSignInFlowStepType = /* @__PURE__ */ ((EmbeddedSignInFlowStepType2) => {
|
|
2809
|
+
EmbeddedSignInFlowStepType2["AuthenticatorPrompt"] = "AUTHENTICATOR_PROMPT";
|
|
2810
|
+
EmbeddedSignInFlowStepType2["MultiOptionsPrompt"] = "MULTI_OPTIONS_PROMPT";
|
|
2811
|
+
return EmbeddedSignInFlowStepType2;
|
|
2812
|
+
})(EmbeddedSignInFlowStepType || {});
|
|
2813
|
+
var EmbeddedSignInFlowAuthenticatorParamType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorParamType2) => {
|
|
2814
|
+
EmbeddedSignInFlowAuthenticatorParamType2["Integer"] = "INTEGER";
|
|
2815
|
+
EmbeddedSignInFlowAuthenticatorParamType2["MultiValued"] = "MULTI_VALUED";
|
|
2816
|
+
EmbeddedSignInFlowAuthenticatorParamType2["String"] = "STRING";
|
|
2817
|
+
return EmbeddedSignInFlowAuthenticatorParamType2;
|
|
2818
|
+
})(EmbeddedSignInFlowAuthenticatorParamType || {});
|
|
2819
|
+
var EmbeddedSignInFlowAuthenticatorKnownIdPType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorKnownIdPType2) => {
|
|
2820
|
+
EmbeddedSignInFlowAuthenticatorKnownIdPType2["Local"] = "LOCAL";
|
|
2821
|
+
return EmbeddedSignInFlowAuthenticatorKnownIdPType2;
|
|
2822
|
+
})(EmbeddedSignInFlowAuthenticatorKnownIdPType || {});
|
|
2823
|
+
var EmbeddedSignInFlowAuthenticatorPromptType = /* @__PURE__ */ ((EmbeddedSignInFlowAuthenticatorPromptType2) => {
|
|
2824
|
+
EmbeddedSignInFlowAuthenticatorPromptType2["InternalPrompt"] = "INTERNAL_PROMPT";
|
|
2825
|
+
EmbeddedSignInFlowAuthenticatorPromptType2["RedirectionPrompt"] = "REDIRECTION_PROMPT";
|
|
2826
|
+
EmbeddedSignInFlowAuthenticatorPromptType2["UserPrompt"] = "USER_PROMPT";
|
|
2827
|
+
return EmbeddedSignInFlowAuthenticatorPromptType2;
|
|
2828
|
+
})(EmbeddedSignInFlowAuthenticatorPromptType || {});
|
|
2829
|
+
|
|
2830
|
+
// src/models/flow.ts
|
|
2831
|
+
var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
|
|
2832
|
+
FlowMode2["Embedded"] = "DIRECT";
|
|
2833
|
+
FlowMode2["Redirect"] = "REDIRECTION";
|
|
2834
|
+
return FlowMode2;
|
|
2835
|
+
})(FlowMode || {});
|
|
2143
2836
|
|
|
2144
2837
|
// src/models/scim2-schema.ts
|
|
2145
2838
|
var WellKnownSchemaIds = /* @__PURE__ */ ((WellKnownSchemaIds2) => {
|
|
@@ -2194,6 +2887,14 @@ var lightTheme = {
|
|
|
2194
2887
|
main: "#d32f2f",
|
|
2195
2888
|
contrastText: "#ffffff"
|
|
2196
2889
|
},
|
|
2890
|
+
success: {
|
|
2891
|
+
main: "#4caf50",
|
|
2892
|
+
contrastText: "#ffffff"
|
|
2893
|
+
},
|
|
2894
|
+
warning: {
|
|
2895
|
+
main: "#ff9800",
|
|
2896
|
+
contrastText: "#ffffff"
|
|
2897
|
+
},
|
|
2197
2898
|
text: {
|
|
2198
2899
|
primary: "#1a1a1a",
|
|
2199
2900
|
secondary: "#666666"
|
|
@@ -2207,6 +2908,11 @@ var lightTheme = {
|
|
|
2207
2908
|
small: "4px",
|
|
2208
2909
|
medium: "8px",
|
|
2209
2910
|
large: "16px"
|
|
2911
|
+
},
|
|
2912
|
+
shadows: {
|
|
2913
|
+
small: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
2914
|
+
medium: "0 4px 16px rgba(0, 0, 0, 0.15)",
|
|
2915
|
+
large: "0 8px 32px rgba(0, 0, 0, 0.2)"
|
|
2210
2916
|
}
|
|
2211
2917
|
};
|
|
2212
2918
|
var darkTheme = {
|
|
@@ -2230,6 +2936,14 @@ var darkTheme = {
|
|
|
2230
2936
|
main: "#d32f2f",
|
|
2231
2937
|
contrastText: "#ffffff"
|
|
2232
2938
|
},
|
|
2939
|
+
success: {
|
|
2940
|
+
main: "#4caf50",
|
|
2941
|
+
contrastText: "#ffffff"
|
|
2942
|
+
},
|
|
2943
|
+
warning: {
|
|
2944
|
+
main: "#ff9800",
|
|
2945
|
+
contrastText: "#ffffff"
|
|
2946
|
+
},
|
|
2233
2947
|
text: {
|
|
2234
2948
|
primary: "#ffffff",
|
|
2235
2949
|
secondary: "#b3b3b3"
|
|
@@ -2243,6 +2957,11 @@ var darkTheme = {
|
|
|
2243
2957
|
small: "4px",
|
|
2244
2958
|
medium: "8px",
|
|
2245
2959
|
large: "16px"
|
|
2960
|
+
},
|
|
2961
|
+
shadows: {
|
|
2962
|
+
small: "0 2px 8px rgba(0, 0, 0, 0.3)",
|
|
2963
|
+
medium: "0 4px 16px rgba(0, 0, 0, 0.4)",
|
|
2964
|
+
large: "0 8px 32px rgba(0, 0, 0, 0.5)"
|
|
2246
2965
|
}
|
|
2247
2966
|
};
|
|
2248
2967
|
var toCssVariables = (theme) => {
|
|
@@ -2256,6 +2975,10 @@ var toCssVariables = (theme) => {
|
|
|
2256
2975
|
cssVars["--asgardeo-color-background-body-main"] = theme.colors.background.body.main;
|
|
2257
2976
|
cssVars["--asgardeo-color-error-main"] = theme.colors.error.main;
|
|
2258
2977
|
cssVars["--asgardeo-color-error-contrastText"] = theme.colors.error.contrastText;
|
|
2978
|
+
cssVars["--asgardeo-color-success-main"] = theme.colors.success.main;
|
|
2979
|
+
cssVars["--asgardeo-color-success-contrastText"] = theme.colors.success.contrastText;
|
|
2980
|
+
cssVars["--asgardeo-color-warning-main"] = theme.colors.warning.main;
|
|
2981
|
+
cssVars["--asgardeo-color-warning-contrastText"] = theme.colors.warning.contrastText;
|
|
2259
2982
|
cssVars["--asgardeo-color-text-primary"] = theme.colors.text.primary;
|
|
2260
2983
|
cssVars["--asgardeo-color-text-secondary"] = theme.colors.text.secondary;
|
|
2261
2984
|
cssVars["--asgardeo-color-border"] = theme.colors.border;
|
|
@@ -2263,6 +2986,9 @@ var toCssVariables = (theme) => {
|
|
|
2263
2986
|
cssVars["--asgardeo-border-radius-small"] = theme.borderRadius.small;
|
|
2264
2987
|
cssVars["--asgardeo-border-radius-medium"] = theme.borderRadius.medium;
|
|
2265
2988
|
cssVars["--asgardeo-border-radius-large"] = theme.borderRadius.large;
|
|
2989
|
+
cssVars["--asgardeo-shadow-small"] = theme.shadows.small;
|
|
2990
|
+
cssVars["--asgardeo-shadow-medium"] = theme.shadows.medium;
|
|
2991
|
+
cssVars["--asgardeo-shadow-large"] = theme.shadows.large;
|
|
2266
2992
|
return cssVars;
|
|
2267
2993
|
};
|
|
2268
2994
|
var createTheme = (config = {}, isDark = false) => {
|
|
@@ -2285,6 +3011,10 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
2285
3011
|
borderRadius: {
|
|
2286
3012
|
...baseTheme.borderRadius,
|
|
2287
3013
|
...config.borderRadius
|
|
3014
|
+
},
|
|
3015
|
+
shadows: {
|
|
3016
|
+
...baseTheme.shadows,
|
|
3017
|
+
...config.shadows
|
|
2288
3018
|
}
|
|
2289
3019
|
};
|
|
2290
3020
|
return {
|
|
@@ -2433,27 +3163,67 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
|
|
|
2433
3163
|
const { name, type, multiValued } = schema;
|
|
2434
3164
|
if (!name) return;
|
|
2435
3165
|
const hasChildProperties = allSchemaNames.some(
|
|
2436
|
-
(schemaName) => schemaName !== name && schemaName.startsWith(name
|
|
3166
|
+
(schemaName) => schemaName !== name && schemaName.startsWith(`${name}.`)
|
|
2437
3167
|
);
|
|
2438
3168
|
if (hasChildProperties) {
|
|
2439
3169
|
return;
|
|
2440
3170
|
}
|
|
2441
3171
|
let value = get_default(meResponse, name);
|
|
3172
|
+
if (value === void 0) {
|
|
3173
|
+
const schemaNamespaces = [
|
|
3174
|
+
"urn:ietf:params:scim:schemas:core:2.0:User",
|
|
3175
|
+
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
|
|
3176
|
+
"urn:scim:wso2:schema",
|
|
3177
|
+
"urn:scim:schemas:extension:custom:User"
|
|
3178
|
+
];
|
|
3179
|
+
schemaNamespaces.some((namespace) => {
|
|
3180
|
+
if (meResponse[namespace]) {
|
|
3181
|
+
if (meResponse[namespace][name] !== void 0) {
|
|
3182
|
+
value = meResponse[namespace][name];
|
|
3183
|
+
return true;
|
|
3184
|
+
}
|
|
3185
|
+
const nestedValue = get_default(meResponse[namespace], name);
|
|
3186
|
+
if (nestedValue !== void 0) {
|
|
3187
|
+
value = nestedValue;
|
|
3188
|
+
return true;
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
return false;
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
2442
3194
|
if (value !== void 0) {
|
|
2443
3195
|
if (multiValued && !Array.isArray(value)) {
|
|
2444
3196
|
value = [value];
|
|
2445
3197
|
}
|
|
3198
|
+
} else if (multiValued) {
|
|
3199
|
+
value = void 0;
|
|
3200
|
+
} else if (type === "STRING") {
|
|
3201
|
+
value = "";
|
|
2446
3202
|
} else {
|
|
2447
|
-
|
|
2448
|
-
value = void 0;
|
|
2449
|
-
} else if (type === "STRING") {
|
|
2450
|
-
value = "";
|
|
2451
|
-
} else {
|
|
2452
|
-
value = void 0;
|
|
2453
|
-
}
|
|
3203
|
+
value = void 0;
|
|
2454
3204
|
}
|
|
2455
3205
|
profile[name] = value;
|
|
2456
3206
|
});
|
|
3207
|
+
const flattenObject = (obj, prefix = "") => {
|
|
3208
|
+
if (obj && typeof obj === "object" && !Array.isArray(obj)) {
|
|
3209
|
+
Object.keys(obj).forEach((key) => {
|
|
3210
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
3211
|
+
const value = obj[key];
|
|
3212
|
+
if (Object.prototype.hasOwnProperty.call(profile, fullKey)) {
|
|
3213
|
+
return;
|
|
3214
|
+
}
|
|
3215
|
+
const hasSchemaChildProperties = allSchemaNames.some(
|
|
3216
|
+
(schemaName) => schemaName.startsWith(`${fullKey}.`)
|
|
3217
|
+
);
|
|
3218
|
+
if (hasSchemaChildProperties) {
|
|
3219
|
+
flattenObject(value, fullKey);
|
|
3220
|
+
} else {
|
|
3221
|
+
profile[fullKey] = value;
|
|
3222
|
+
}
|
|
3223
|
+
});
|
|
3224
|
+
}
|
|
3225
|
+
};
|
|
3226
|
+
flattenObject(meResponse);
|
|
2457
3227
|
return profile;
|
|
2458
3228
|
};
|
|
2459
3229
|
var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
@@ -2488,6 +3258,10 @@ var translations = {
|
|
|
2488
3258
|
/* |---------------------------------------------------------------| */
|
|
2489
3259
|
/* Base Sign In */
|
|
2490
3260
|
"signin.title": "Sign In",
|
|
3261
|
+
"signin.subtitle": "Enter your credentials to continue.",
|
|
3262
|
+
/* Base Sign Up */
|
|
3263
|
+
"signup.title": "Sign Up",
|
|
3264
|
+
"signup.subtitle": "Create a new account to get started.",
|
|
2491
3265
|
/* Email OTP */
|
|
2492
3266
|
"email.otp.title": "OTP Verification",
|
|
2493
3267
|
"email.otp.subtitle": "Enter the code sent to your email address.",
|
|
@@ -2509,6 +3283,30 @@ var translations = {
|
|
|
2509
3283
|
"username.password.title": "Sign In",
|
|
2510
3284
|
"username.password.subtitle": "Enter your username and password to continue.",
|
|
2511
3285
|
/* |---------------------------------------------------------------| */
|
|
3286
|
+
/* | Organization Switcher | */
|
|
3287
|
+
/* |---------------------------------------------------------------| */
|
|
3288
|
+
"organization.switcher.select.organization": "Select Organization",
|
|
3289
|
+
"organization.switcher.switch.organization": "Switch Organization",
|
|
3290
|
+
"organization.switcher.loading.organizations": "Loading organizations...",
|
|
3291
|
+
"organization.switcher.members": "members",
|
|
3292
|
+
"organization.switcher.member": "member",
|
|
3293
|
+
"organization.switcher.create.organization": "Create Organization",
|
|
3294
|
+
"organization.switcher.manage.organizations": "Manage Organization",
|
|
3295
|
+
"organization.switcher.manage.button": "Manage",
|
|
3296
|
+
"organization.profile.title": "Organization Profile",
|
|
3297
|
+
"organization.profile.loading": "Loading organization...",
|
|
3298
|
+
"organization.profile.error": "Failed to load organization",
|
|
3299
|
+
"organization.create.title": "Create Organization",
|
|
3300
|
+
"organization.create.name.label": "Organization Name",
|
|
3301
|
+
"organization.create.name.placeholder": "Enter organization name",
|
|
3302
|
+
"organization.create.handle.label": "Organization Handle",
|
|
3303
|
+
"organization.create.handle.placeholder": "my-organization",
|
|
3304
|
+
"organization.create.description.label": "Description",
|
|
3305
|
+
"organization.create.description.placeholder": "Enter organization description",
|
|
3306
|
+
"organization.create.button": "Create Organization",
|
|
3307
|
+
"organization.create.creating": "Creating...",
|
|
3308
|
+
"organization.create.cancel": "Cancel",
|
|
3309
|
+
/* |---------------------------------------------------------------| */
|
|
2512
3310
|
/* | Messages | */
|
|
2513
3311
|
/* |---------------------------------------------------------------| */
|
|
2514
3312
|
"messages.loading": "Loading...",
|
|
@@ -2577,44 +3375,66 @@ var resolveFieldName = (field) => {
|
|
|
2577
3375
|
);
|
|
2578
3376
|
};
|
|
2579
3377
|
var resolveFieldName_default = resolveFieldName;
|
|
3378
|
+
|
|
3379
|
+
// src/utils/withVendorCSSClassPrefix.ts
|
|
3380
|
+
var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
3381
|
+
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
2580
3382
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2581
3383
|
0 && (module.exports = {
|
|
2582
|
-
ApplicationNativeAuthenticationAuthenticatorKnownIdPType,
|
|
2583
|
-
ApplicationNativeAuthenticationAuthenticatorParamType,
|
|
2584
|
-
ApplicationNativeAuthenticationAuthenticatorPromptType,
|
|
2585
3384
|
ApplicationNativeAuthenticationConstants,
|
|
2586
|
-
ApplicationNativeAuthenticationFlowStatus,
|
|
2587
|
-
ApplicationNativeAuthenticationFlowType,
|
|
2588
|
-
ApplicationNativeAuthenticationStepType,
|
|
2589
3385
|
AsgardeoAPIError,
|
|
2590
3386
|
AsgardeoAuthClient,
|
|
2591
3387
|
AsgardeoAuthException,
|
|
2592
3388
|
AsgardeoError,
|
|
2593
3389
|
AsgardeoJavaScriptClient,
|
|
2594
3390
|
AsgardeoRuntimeError,
|
|
3391
|
+
EmbeddedFlowComponentType,
|
|
3392
|
+
EmbeddedFlowResponseType,
|
|
3393
|
+
EmbeddedFlowStatus,
|
|
3394
|
+
EmbeddedFlowType,
|
|
3395
|
+
EmbeddedSignInFlowAuthenticatorKnownIdPType,
|
|
3396
|
+
EmbeddedSignInFlowAuthenticatorParamType,
|
|
3397
|
+
EmbeddedSignInFlowAuthenticatorPromptType,
|
|
3398
|
+
EmbeddedSignInFlowStatus,
|
|
3399
|
+
EmbeddedSignInFlowStepType,
|
|
3400
|
+
EmbeddedSignInFlowType,
|
|
2595
3401
|
FieldType,
|
|
3402
|
+
FlowMode,
|
|
2596
3403
|
IsomorphicCrypto,
|
|
2597
3404
|
OIDCRequestConstants,
|
|
2598
3405
|
StorageManager,
|
|
2599
3406
|
TokenConstants,
|
|
3407
|
+
VendorConstants,
|
|
2600
3408
|
WellKnownSchemaIds,
|
|
3409
|
+
createOrganization,
|
|
3410
|
+
createPatchOperations,
|
|
2601
3411
|
createTheme,
|
|
2602
3412
|
deepMerge,
|
|
3413
|
+
executeEmbeddedSignInFlow,
|
|
3414
|
+
executeEmbeddedSignUpFlow,
|
|
2603
3415
|
extractPkceStorageKeyFromState,
|
|
2604
3416
|
extractUserClaimsFromIdToken,
|
|
2605
3417
|
flattenUserSchema,
|
|
2606
3418
|
generateFlattenedUserProfile,
|
|
2607
3419
|
generateUserProfile,
|
|
2608
3420
|
get,
|
|
3421
|
+
getAllOrganizations,
|
|
2609
3422
|
getI18nBundles,
|
|
2610
3423
|
getLatestStateParam,
|
|
3424
|
+
getMeOrganizations,
|
|
3425
|
+
getOrganization,
|
|
3426
|
+
getSchemas,
|
|
3427
|
+
getScim2Me,
|
|
2611
3428
|
getUserInfo,
|
|
2612
|
-
|
|
2613
|
-
|
|
3429
|
+
initializeEmbeddedSignInFlow,
|
|
3430
|
+
isEmpty,
|
|
2614
3431
|
processOpenIDScopes,
|
|
2615
3432
|
removeTrailingSlash,
|
|
2616
3433
|
resolveFieldName,
|
|
2617
3434
|
resolveFieldType,
|
|
2618
|
-
set
|
|
3435
|
+
set,
|
|
3436
|
+
updateMeProfile,
|
|
3437
|
+
updateOrganization,
|
|
3438
|
+
withVendorCSSClassPrefix
|
|
2619
3439
|
});
|
|
2620
3440
|
//# sourceMappingURL=index.js.map
|