@asgardeo/react 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +724 -482
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/auth/Callback/Callback.d.ts +51 -0
- package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +1 -0
- package/dist/hooks/useBrowserUrl.d.ts +8 -0
- package/dist/hooks/v2/useOAuthCallback.d.ts +82 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +311 -69
- package/dist/index.js.map +4 -4
- package/dist/utils/oauth.d.ts +24 -0
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
Alert: () => Alert_default,
|
|
26
26
|
AsgardeoContext: () => AsgardeoContext_default,
|
|
27
27
|
AsgardeoProvider: () => AsgardeoProvider_default,
|
|
28
|
-
AsgardeoRuntimeError: () =>
|
|
28
|
+
AsgardeoRuntimeError: () => import_browser85.AsgardeoRuntimeError,
|
|
29
29
|
BaseAcceptInvite: () => BaseAcceptInvite_default,
|
|
30
30
|
BaseCreateOrganization: () => BaseCreateOrganization,
|
|
31
31
|
BaseInviteUser: () => BaseInviteUser_default,
|
|
@@ -45,6 +45,7 @@ __export(index_exports, {
|
|
|
45
45
|
BrandingProvider: () => BrandingProvider_default,
|
|
46
46
|
BuildingAlt: () => BuildingAlt_default,
|
|
47
47
|
Button: () => Button_default,
|
|
48
|
+
Callback: () => Callback,
|
|
48
49
|
Card: () => Card_default,
|
|
49
50
|
Checkbox: () => Checkbox_default,
|
|
50
51
|
CircleAlert: () => CircleAlert_default,
|
|
@@ -53,12 +54,12 @@ __export(index_exports, {
|
|
|
53
54
|
DatePicker: () => DatePicker_default,
|
|
54
55
|
Divider: () => Divider_default,
|
|
55
56
|
EmailOtp: () => EmailOtp_default,
|
|
56
|
-
EmbeddedFlowActionVariant: () =>
|
|
57
|
-
EmbeddedFlowComponentType: () =>
|
|
58
|
-
EmbeddedFlowEventType: () =>
|
|
59
|
-
EmbeddedFlowTextVariant: () =>
|
|
60
|
-
EmbeddedSignInFlowStatus: () =>
|
|
61
|
-
EmbeddedSignInFlowType: () =>
|
|
57
|
+
EmbeddedFlowActionVariant: () => import_browser85.EmbeddedFlowActionVariantV2,
|
|
58
|
+
EmbeddedFlowComponentType: () => import_browser85.EmbeddedFlowComponentTypeV2,
|
|
59
|
+
EmbeddedFlowEventType: () => import_browser85.EmbeddedFlowEventTypeV2,
|
|
60
|
+
EmbeddedFlowTextVariant: () => import_browser85.EmbeddedFlowTextVariantV2,
|
|
61
|
+
EmbeddedSignInFlowStatus: () => import_browser85.EmbeddedSignInFlowStatusV2,
|
|
62
|
+
EmbeddedSignInFlowType: () => import_browser85.EmbeddedSignInFlowTypeV2,
|
|
62
63
|
Eye: () => Eye_default,
|
|
63
64
|
EyeOff: () => EyeOff_default,
|
|
64
65
|
FacebookButton: () => FacebookButton_default,
|
|
@@ -117,17 +118,17 @@ __export(index_exports, {
|
|
|
117
118
|
UsernamePassword: () => UsernamePassword_default,
|
|
118
119
|
createField: () => createField,
|
|
119
120
|
createOrganization: () => createOrganization_default,
|
|
120
|
-
createPatchOperations: () =>
|
|
121
|
+
createPatchOperations: () => import_browser83.createPatchOperations,
|
|
121
122
|
createSignInOption: () => createSignInOption,
|
|
122
123
|
createSignInOptionFromAuthenticator: () => createSignInOptionFromAuthenticator,
|
|
123
|
-
getActiveTheme: () =>
|
|
124
|
+
getActiveTheme: () => import_browser85.getActiveTheme,
|
|
124
125
|
getAllOrganizations: () => getAllOrganizations_default,
|
|
125
126
|
getMeOrganizations: () => getMeOrganizations_default,
|
|
126
127
|
getMeProfile: () => getScim2Me_default,
|
|
127
128
|
getOrganization: () => getOrganization_default,
|
|
128
129
|
getSchemas: () => getSchemas_default,
|
|
129
|
-
http: () =>
|
|
130
|
-
navigate: () =>
|
|
130
|
+
http: () => import_browser85.http,
|
|
131
|
+
navigate: () => import_browser85.navigate,
|
|
131
132
|
updateMeProfile: () => updateMeProfile_default,
|
|
132
133
|
updateOrganization: () => updateOrganization_default,
|
|
133
134
|
useAsgardeo: () => useAsgardeo_default,
|
|
@@ -994,7 +995,8 @@ var import_browser7 = require("@asgardeo/browser");
|
|
|
994
995
|
var useBrowserUrl = () => {
|
|
995
996
|
const hasAuthParams = (url, afterSignInUrl) => (0, import_browser7.hasAuthParamsInUrl)() && new URL(url.origin + url.pathname).toString() === new URL(afterSignInUrl).toString() || // authParams?.authorizationCode || // FIXME: These are sent externally. Need to see what we can do about this.
|
|
996
997
|
url.searchParams.get("error") !== null;
|
|
997
|
-
|
|
998
|
+
const hasCalledForThisInstance = (url, instanceId) => (0, import_browser7.hasCalledForThisInstanceInUrl)(instanceId, url.search);
|
|
999
|
+
return { hasAuthParams, hasCalledForThisInstance };
|
|
998
1000
|
};
|
|
999
1001
|
var useBrowserUrl_default = useBrowserUrl;
|
|
1000
1002
|
|
|
@@ -1645,7 +1647,7 @@ var AsgardeoProvider = ({
|
|
|
1645
1647
|
}) => {
|
|
1646
1648
|
const reRenderCheckRef = (0, import_react15.useRef)(false);
|
|
1647
1649
|
const asgardeo = (0, import_react15.useMemo)(() => new AsgardeoReactClient_default(instanceId), [instanceId]);
|
|
1648
|
-
const { hasAuthParams } = useBrowserUrl_default();
|
|
1650
|
+
const { hasAuthParams, hasCalledForThisInstance } = useBrowserUrl_default();
|
|
1649
1651
|
const [user, setUser] = (0, import_react15.useState)(null);
|
|
1650
1652
|
const [currentOrganization, setCurrentOrganization] = (0, import_react15.useState)(null);
|
|
1651
1653
|
const [isSignedInSync, setIsSignedInSync] = (0, import_react15.useState)(false);
|
|
@@ -1784,7 +1786,7 @@ var AsgardeoProvider = ({
|
|
|
1784
1786
|
return;
|
|
1785
1787
|
}
|
|
1786
1788
|
const currentUrl = new URL(window.location.href);
|
|
1787
|
-
const hasAuthParamsResult = hasAuthParams(currentUrl, afterSignInUrl);
|
|
1789
|
+
const hasAuthParamsResult = hasAuthParams(currentUrl, afterSignInUrl) && hasCalledForThisInstance(currentUrl, instanceId ?? 0);
|
|
1788
1790
|
const isV2Platform = config.platform === import_browser12.Platform.AsgardeoV2;
|
|
1789
1791
|
if (hasAuthParamsResult) {
|
|
1790
1792
|
try {
|
|
@@ -7902,17 +7904,144 @@ var BaseSignIn3 = (props) => {
|
|
|
7902
7904
|
var BaseSignIn_default3 = BaseSignIn3;
|
|
7903
7905
|
|
|
7904
7906
|
// src/components/presentation/auth/SignIn/SignIn.tsx
|
|
7905
|
-
var
|
|
7907
|
+
var import_browser51 = require("@asgardeo/browser");
|
|
7906
7908
|
|
|
7907
7909
|
// src/components/presentation/auth/SignIn/v2/SignIn.tsx
|
|
7908
|
-
var
|
|
7910
|
+
var import_browser50 = require("@asgardeo/browser");
|
|
7911
|
+
var import_react60 = require("react");
|
|
7912
|
+
|
|
7913
|
+
// src/hooks/v2/useOAuthCallback.ts
|
|
7909
7914
|
var import_react59 = require("react");
|
|
7915
|
+
function cleanupUrlParams() {
|
|
7916
|
+
if (typeof window === "undefined") return;
|
|
7917
|
+
const url = new URL(window.location.href);
|
|
7918
|
+
url.searchParams.delete("code");
|
|
7919
|
+
url.searchParams.delete("nonce");
|
|
7920
|
+
url.searchParams.delete("state");
|
|
7921
|
+
url.searchParams.delete("error");
|
|
7922
|
+
url.searchParams.delete("error_description");
|
|
7923
|
+
window.history.replaceState({}, "", url.toString());
|
|
7924
|
+
}
|
|
7925
|
+
function useOAuthCallback({
|
|
7926
|
+
currentFlowId,
|
|
7927
|
+
flowIdStorageKey = "asgardeo_flow_id",
|
|
7928
|
+
isInitialized,
|
|
7929
|
+
isSubmitting = false,
|
|
7930
|
+
onComplete,
|
|
7931
|
+
onError,
|
|
7932
|
+
onFlowChange,
|
|
7933
|
+
onProcessingStart,
|
|
7934
|
+
onSubmit,
|
|
7935
|
+
processedRef,
|
|
7936
|
+
setFlowId,
|
|
7937
|
+
tokenValidationAttemptedRef
|
|
7938
|
+
}) {
|
|
7939
|
+
const internalRef = (0, import_react59.useRef)(false);
|
|
7940
|
+
const oauthCodeProcessedRef = processedRef ?? internalRef;
|
|
7941
|
+
(0, import_react59.useEffect)(() => {
|
|
7942
|
+
if (!isInitialized || isSubmitting) {
|
|
7943
|
+
return;
|
|
7944
|
+
}
|
|
7945
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
7946
|
+
const code = urlParams.get("code");
|
|
7947
|
+
const nonce = urlParams.get("nonce");
|
|
7948
|
+
const state = urlParams.get("state");
|
|
7949
|
+
const flowIdFromUrl = urlParams.get("flowId");
|
|
7950
|
+
const error = urlParams.get("error");
|
|
7951
|
+
const errorDescription = urlParams.get("error_description");
|
|
7952
|
+
if (error) {
|
|
7953
|
+
oauthCodeProcessedRef.current = true;
|
|
7954
|
+
if (tokenValidationAttemptedRef) {
|
|
7955
|
+
tokenValidationAttemptedRef.current = true;
|
|
7956
|
+
}
|
|
7957
|
+
onError?.(new Error(errorDescription || error || "OAuth authentication failed"));
|
|
7958
|
+
cleanupUrlParams();
|
|
7959
|
+
return;
|
|
7960
|
+
}
|
|
7961
|
+
if (!code || oauthCodeProcessedRef.current) {
|
|
7962
|
+
return;
|
|
7963
|
+
}
|
|
7964
|
+
if (tokenValidationAttemptedRef?.current) {
|
|
7965
|
+
return;
|
|
7966
|
+
}
|
|
7967
|
+
const storedFlowId = sessionStorage.getItem(flowIdStorageKey);
|
|
7968
|
+
const flowIdToUse = currentFlowId || storedFlowId || flowIdFromUrl || state || null;
|
|
7969
|
+
if (!flowIdToUse) {
|
|
7970
|
+
oauthCodeProcessedRef.current = true;
|
|
7971
|
+
onError?.(new Error("Invalid flow. Missing flowId."));
|
|
7972
|
+
cleanupUrlParams();
|
|
7973
|
+
return;
|
|
7974
|
+
}
|
|
7975
|
+
oauthCodeProcessedRef.current = true;
|
|
7976
|
+
if (tokenValidationAttemptedRef) {
|
|
7977
|
+
tokenValidationAttemptedRef.current = true;
|
|
7978
|
+
}
|
|
7979
|
+
onProcessingStart?.();
|
|
7980
|
+
if (!currentFlowId && setFlowId) {
|
|
7981
|
+
setFlowId(flowIdToUse);
|
|
7982
|
+
}
|
|
7983
|
+
(async () => {
|
|
7984
|
+
try {
|
|
7985
|
+
const payload = {
|
|
7986
|
+
flowId: flowIdToUse,
|
|
7987
|
+
inputs: {
|
|
7988
|
+
code,
|
|
7989
|
+
...nonce && { nonce }
|
|
7990
|
+
}
|
|
7991
|
+
};
|
|
7992
|
+
const response = await onSubmit(payload);
|
|
7993
|
+
onFlowChange?.(response);
|
|
7994
|
+
if (response?.flowStatus === "COMPLETE" || response?.status === "COMPLETE") {
|
|
7995
|
+
onComplete?.();
|
|
7996
|
+
}
|
|
7997
|
+
if (response?.flowStatus === "ERROR" || response?.status === "ERROR") {
|
|
7998
|
+
onError?.(response);
|
|
7999
|
+
}
|
|
8000
|
+
cleanupUrlParams();
|
|
8001
|
+
} catch (err) {
|
|
8002
|
+
onError?.(err);
|
|
8003
|
+
cleanupUrlParams();
|
|
8004
|
+
}
|
|
8005
|
+
})();
|
|
8006
|
+
}, [
|
|
8007
|
+
isInitialized,
|
|
8008
|
+
currentFlowId,
|
|
8009
|
+
isSubmitting,
|
|
8010
|
+
onSubmit,
|
|
8011
|
+
onComplete,
|
|
8012
|
+
onError,
|
|
8013
|
+
onFlowChange,
|
|
8014
|
+
setFlowId,
|
|
8015
|
+
flowIdStorageKey
|
|
8016
|
+
]);
|
|
8017
|
+
}
|
|
7910
8018
|
|
|
7911
|
-
// src/utils/
|
|
8019
|
+
// src/utils/oauth.ts
|
|
7912
8020
|
var import_browser48 = require("@asgardeo/browser");
|
|
8021
|
+
function initiateOAuthRedirect(redirectURL) {
|
|
8022
|
+
const basePath = document.querySelector("base")?.getAttribute("href") || "";
|
|
8023
|
+
let returnPath = window.location.pathname;
|
|
8024
|
+
if (basePath && returnPath.startsWith(basePath)) {
|
|
8025
|
+
returnPath = returnPath.slice(basePath.length) || "/";
|
|
8026
|
+
}
|
|
8027
|
+
const state = crypto.randomUUID();
|
|
8028
|
+
sessionStorage.setItem(
|
|
8029
|
+
`asgardeo_oauth_${state}`,
|
|
8030
|
+
JSON.stringify({
|
|
8031
|
+
path: returnPath,
|
|
8032
|
+
timestamp: Date.now()
|
|
8033
|
+
})
|
|
8034
|
+
);
|
|
8035
|
+
const redirectUrlObj = new URL(redirectURL);
|
|
8036
|
+
redirectUrlObj.searchParams.set("state", state);
|
|
8037
|
+
(0, import_browser48.navigate)(redirectUrlObj.toString());
|
|
8038
|
+
}
|
|
8039
|
+
|
|
8040
|
+
// src/utils/v2/passkey.ts
|
|
8041
|
+
var import_browser49 = require("@asgardeo/browser");
|
|
7913
8042
|
var handlePasskeyRegistration = async (challengeData) => {
|
|
7914
8043
|
if (!window.navigator.credentials || !window.navigator.credentials.create) {
|
|
7915
|
-
throw new
|
|
8044
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
7916
8045
|
"WebAuthn is not supported in this browser.",
|
|
7917
8046
|
"browser-webauthn-not-supported",
|
|
7918
8047
|
"browser",
|
|
@@ -7923,15 +8052,15 @@ var handlePasskeyRegistration = async (challengeData) => {
|
|
|
7923
8052
|
const creationOptions = JSON.parse(challengeData);
|
|
7924
8053
|
const publicKey = {
|
|
7925
8054
|
...creationOptions,
|
|
7926
|
-
challenge: (0,
|
|
8055
|
+
challenge: (0, import_browser49.base64urlToArrayBuffer)(creationOptions.challenge),
|
|
7927
8056
|
user: {
|
|
7928
8057
|
...creationOptions.user,
|
|
7929
|
-
id: (0,
|
|
8058
|
+
id: (0, import_browser49.base64urlToArrayBuffer)(creationOptions.user.id)
|
|
7930
8059
|
},
|
|
7931
8060
|
...creationOptions.excludeCredentials && {
|
|
7932
8061
|
excludeCredentials: creationOptions.excludeCredentials.map((cred) => ({
|
|
7933
8062
|
...cred,
|
|
7934
|
-
id: (0,
|
|
8063
|
+
id: (0, import_browser49.base64urlToArrayBuffer)(cred.id)
|
|
7935
8064
|
}))
|
|
7936
8065
|
}
|
|
7937
8066
|
};
|
|
@@ -7939,7 +8068,7 @@ var handlePasskeyRegistration = async (challengeData) => {
|
|
|
7939
8068
|
publicKey
|
|
7940
8069
|
});
|
|
7941
8070
|
if (!credential) {
|
|
7942
|
-
throw new
|
|
8071
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
7943
8072
|
"No credential returned from WebAuthn registration.",
|
|
7944
8073
|
"browser-webauthn-no-credential",
|
|
7945
8074
|
"browser",
|
|
@@ -7949,10 +8078,10 @@ var handlePasskeyRegistration = async (challengeData) => {
|
|
|
7949
8078
|
const response = credential.response;
|
|
7950
8079
|
const registrationResponse = {
|
|
7951
8080
|
id: credential.id,
|
|
7952
|
-
rawId: (0,
|
|
8081
|
+
rawId: (0, import_browser49.arrayBufferToBase64url)(credential.rawId),
|
|
7953
8082
|
response: {
|
|
7954
|
-
attestationObject: (0,
|
|
7955
|
-
clientDataJSON: (0,
|
|
8083
|
+
attestationObject: (0, import_browser49.arrayBufferToBase64url)(response.attestationObject),
|
|
8084
|
+
clientDataJSON: (0, import_browser49.arrayBufferToBase64url)(response.clientDataJSON),
|
|
7956
8085
|
...response.getTransports && {
|
|
7957
8086
|
transports: response.getTransports()
|
|
7958
8087
|
}
|
|
@@ -7964,18 +8093,18 @@ var handlePasskeyRegistration = async (challengeData) => {
|
|
|
7964
8093
|
};
|
|
7965
8094
|
return JSON.stringify(registrationResponse);
|
|
7966
8095
|
} catch (error) {
|
|
7967
|
-
if (error instanceof
|
|
8096
|
+
if (error instanceof import_browser49.AsgardeoRuntimeError) {
|
|
7968
8097
|
throw error;
|
|
7969
8098
|
}
|
|
7970
8099
|
if (error instanceof Error) {
|
|
7971
|
-
throw new
|
|
8100
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
7972
8101
|
`Passkey registration failed: ${error.message}`,
|
|
7973
8102
|
"browser-webauthn-registration-error",
|
|
7974
8103
|
"browser",
|
|
7975
8104
|
`WebAuthn registration failed with error: ${error.name}`
|
|
7976
8105
|
);
|
|
7977
8106
|
}
|
|
7978
|
-
throw new
|
|
8107
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
7979
8108
|
"Passkey registration failed due to an unexpected error.",
|
|
7980
8109
|
"browser-webauthn-unexpected-error",
|
|
7981
8110
|
"browser",
|
|
@@ -7985,7 +8114,7 @@ var handlePasskeyRegistration = async (challengeData) => {
|
|
|
7985
8114
|
};
|
|
7986
8115
|
var handlePasskeyAuthentication = async (challengeData) => {
|
|
7987
8116
|
if (!window.navigator.credentials || !window.navigator.credentials.get) {
|
|
7988
|
-
throw new
|
|
8117
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
7989
8118
|
"WebAuthn is not supported in this browser.",
|
|
7990
8119
|
"browser-webauthn-not-supported",
|
|
7991
8120
|
"browser",
|
|
@@ -7996,11 +8125,11 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
7996
8125
|
const requestOptions = JSON.parse(challengeData);
|
|
7997
8126
|
const publicKey = {
|
|
7998
8127
|
...requestOptions,
|
|
7999
|
-
challenge: (0,
|
|
8128
|
+
challenge: (0, import_browser49.base64urlToArrayBuffer)(requestOptions.challenge),
|
|
8000
8129
|
...requestOptions.allowCredentials && {
|
|
8001
8130
|
allowCredentials: requestOptions.allowCredentials.map((cred) => ({
|
|
8002
8131
|
...cred,
|
|
8003
|
-
id: (0,
|
|
8132
|
+
id: (0, import_browser49.base64urlToArrayBuffer)(cred.id)
|
|
8004
8133
|
}))
|
|
8005
8134
|
}
|
|
8006
8135
|
};
|
|
@@ -8008,7 +8137,7 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
8008
8137
|
publicKey
|
|
8009
8138
|
});
|
|
8010
8139
|
if (!credential) {
|
|
8011
|
-
throw new
|
|
8140
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
8012
8141
|
"No credential returned from WebAuthn authentication.",
|
|
8013
8142
|
"browser-webauthn-no-credential",
|
|
8014
8143
|
"browser",
|
|
@@ -8018,13 +8147,13 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
8018
8147
|
const response = credential.response;
|
|
8019
8148
|
const authenticationResponse = {
|
|
8020
8149
|
id: credential.id,
|
|
8021
|
-
rawId: (0,
|
|
8150
|
+
rawId: (0, import_browser49.arrayBufferToBase64url)(credential.rawId),
|
|
8022
8151
|
response: {
|
|
8023
|
-
authenticatorData: (0,
|
|
8024
|
-
clientDataJSON: (0,
|
|
8025
|
-
signature: (0,
|
|
8152
|
+
authenticatorData: (0, import_browser49.arrayBufferToBase64url)(response.authenticatorData),
|
|
8153
|
+
clientDataJSON: (0, import_browser49.arrayBufferToBase64url)(response.clientDataJSON),
|
|
8154
|
+
signature: (0, import_browser49.arrayBufferToBase64url)(response.signature),
|
|
8026
8155
|
...response.userHandle && {
|
|
8027
|
-
userHandle: (0,
|
|
8156
|
+
userHandle: (0, import_browser49.arrayBufferToBase64url)(response.userHandle)
|
|
8028
8157
|
}
|
|
8029
8158
|
},
|
|
8030
8159
|
type: credential.type,
|
|
@@ -8034,18 +8163,18 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
8034
8163
|
};
|
|
8035
8164
|
return JSON.stringify(authenticationResponse);
|
|
8036
8165
|
} catch (error) {
|
|
8037
|
-
if (error instanceof
|
|
8166
|
+
if (error instanceof import_browser49.AsgardeoRuntimeError) {
|
|
8038
8167
|
throw error;
|
|
8039
8168
|
}
|
|
8040
8169
|
if (error instanceof Error) {
|
|
8041
|
-
throw new
|
|
8170
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
8042
8171
|
`Passkey authentication failed: ${error.message}`,
|
|
8043
8172
|
"browser-webauthn-authentication-error",
|
|
8044
8173
|
"browser",
|
|
8045
8174
|
`WebAuthn authentication failed with error: ${error.name}`
|
|
8046
8175
|
);
|
|
8047
8176
|
}
|
|
8048
|
-
throw new
|
|
8177
|
+
throw new import_browser49.AsgardeoRuntimeError(
|
|
8049
8178
|
"Passkey authentication failed due to an unexpected error.",
|
|
8050
8179
|
"browser-webauthn-unexpected-error",
|
|
8051
8180
|
"browser",
|
|
@@ -8066,12 +8195,12 @@ var SignIn = ({
|
|
|
8066
8195
|
}) => {
|
|
8067
8196
|
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
|
|
8068
8197
|
const { t } = useTranslation_default();
|
|
8069
|
-
const [components, setComponents] = (0,
|
|
8070
|
-
const [currentFlowId, setCurrentFlowId] = (0,
|
|
8071
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
8072
|
-
const [flowError, setFlowError] = (0,
|
|
8073
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
8074
|
-
const [passkeyState, setPasskeyState] = (0,
|
|
8198
|
+
const [components, setComponents] = (0, import_react60.useState)([]);
|
|
8199
|
+
const [currentFlowId, setCurrentFlowId] = (0, import_react60.useState)(null);
|
|
8200
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react60.useState)(false);
|
|
8201
|
+
const [flowError, setFlowError] = (0, import_react60.useState)(null);
|
|
8202
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react60.useState)(false);
|
|
8203
|
+
const [passkeyState, setPasskeyState] = (0, import_react60.useState)({
|
|
8075
8204
|
actionId: null,
|
|
8076
8205
|
challenge: null,
|
|
8077
8206
|
creationOptions: null,
|
|
@@ -8079,9 +8208,9 @@ var SignIn = ({
|
|
|
8079
8208
|
flowId: null,
|
|
8080
8209
|
isActive: false
|
|
8081
8210
|
});
|
|
8082
|
-
const initializationAttemptedRef = (0,
|
|
8083
|
-
const oauthCodeProcessedRef = (0,
|
|
8084
|
-
const passkeyProcessedRef = (0,
|
|
8211
|
+
const initializationAttemptedRef = (0, import_react60.useRef)(false);
|
|
8212
|
+
const oauthCodeProcessedRef = (0, import_react60.useRef)(false);
|
|
8213
|
+
const passkeyProcessedRef = (0, import_react60.useRef)(false);
|
|
8085
8214
|
const setFlowId = (flowId) => {
|
|
8086
8215
|
setCurrentFlowId(flowId);
|
|
8087
8216
|
if (flowId) {
|
|
@@ -8114,7 +8243,6 @@ var SignIn = ({
|
|
|
8114
8243
|
sessionStorage.setItem("asgardeo_auth_id", authId);
|
|
8115
8244
|
}
|
|
8116
8245
|
};
|
|
8117
|
-
const resolveFlowId = (activeFlowId, state, flowIdFromUrl, storedFlowId) => activeFlowId || state || flowIdFromUrl || storedFlowId || null;
|
|
8118
8246
|
const cleanupOAuthUrlParams = (includeNonce = false) => {
|
|
8119
8247
|
if (!window?.location?.href) return;
|
|
8120
8248
|
const url = new URL(window.location.href);
|
|
@@ -8143,12 +8271,12 @@ var SignIn = ({
|
|
|
8143
8271
|
const handleOAuthError = (error, errorDescription) => {
|
|
8144
8272
|
clearFlowState();
|
|
8145
8273
|
const errorMessage = errorDescription || `OAuth error: ${error}`;
|
|
8146
|
-
const err = new
|
|
8274
|
+
const err = new import_browser50.AsgardeoRuntimeError(errorMessage, "SIGN_IN_ERROR", "react");
|
|
8147
8275
|
setError(err);
|
|
8148
8276
|
cleanupOAuthUrlParams(true);
|
|
8149
8277
|
};
|
|
8150
8278
|
const handleRedirection = (response) => {
|
|
8151
|
-
if (response.type ===
|
|
8279
|
+
if (response.type === import_browser50.EmbeddedSignInFlowTypeV2.Redirection) {
|
|
8152
8280
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
8153
8281
|
if (redirectURL && window?.location) {
|
|
8154
8282
|
if (response.flowId) {
|
|
@@ -8156,7 +8284,7 @@ var SignIn = ({
|
|
|
8156
8284
|
}
|
|
8157
8285
|
const urlParams = getUrlParams2();
|
|
8158
8286
|
handleAuthId(urlParams.authId);
|
|
8159
|
-
|
|
8287
|
+
initiateOAuthRedirect(redirectURL);
|
|
8160
8288
|
return true;
|
|
8161
8289
|
}
|
|
8162
8290
|
}
|
|
@@ -8168,7 +8296,7 @@ var SignIn = ({
|
|
|
8168
8296
|
handleAuthId(urlParams.authId);
|
|
8169
8297
|
const effectiveApplicationId = applicationId || urlParams.applicationId;
|
|
8170
8298
|
if (!urlParams.flowId && !effectiveApplicationId) {
|
|
8171
|
-
const error = new
|
|
8299
|
+
const error = new import_browser50.AsgardeoRuntimeError(
|
|
8172
8300
|
"Either flowId or applicationId is required for authentication",
|
|
8173
8301
|
"SIGN_IN_ERROR",
|
|
8174
8302
|
"react"
|
|
@@ -8186,7 +8314,7 @@ var SignIn = ({
|
|
|
8186
8314
|
} else {
|
|
8187
8315
|
response = await signIn({
|
|
8188
8316
|
applicationId: effectiveApplicationId,
|
|
8189
|
-
flowType:
|
|
8317
|
+
flowType: import_browser50.EmbeddedFlowType.Authentication
|
|
8190
8318
|
});
|
|
8191
8319
|
}
|
|
8192
8320
|
if (handleRedirection(response)) {
|
|
@@ -8209,7 +8337,7 @@ var SignIn = ({
|
|
|
8209
8337
|
initializationAttemptedRef.current = false;
|
|
8210
8338
|
}
|
|
8211
8339
|
};
|
|
8212
|
-
(0,
|
|
8340
|
+
(0, import_react60.useEffect)(() => {
|
|
8213
8341
|
const urlParams = getUrlParams2();
|
|
8214
8342
|
if (urlParams.error) {
|
|
8215
8343
|
handleOAuthError(urlParams.error, urlParams.errorDescription);
|
|
@@ -8258,7 +8386,7 @@ var SignIn = ({
|
|
|
8258
8386
|
const { flowId: normalizedFlowId, components: normalizedComponents } = normalizeFlowResponse(response, t, {
|
|
8259
8387
|
resolveTranslations: !children
|
|
8260
8388
|
});
|
|
8261
|
-
if (response.flowStatus ===
|
|
8389
|
+
if (response.flowStatus === import_browser50.EmbeddedSignInFlowStatusV2.Error) {
|
|
8262
8390
|
clearFlowState();
|
|
8263
8391
|
const failureReason = response?.failureReason;
|
|
8264
8392
|
const errorMessage = failureReason || "Authentication flow failed. Please try again.";
|
|
@@ -8267,7 +8395,7 @@ var SignIn = ({
|
|
|
8267
8395
|
cleanupFlowUrlParams();
|
|
8268
8396
|
throw err;
|
|
8269
8397
|
}
|
|
8270
|
-
if (response.flowStatus ===
|
|
8398
|
+
if (response.flowStatus === import_browser50.EmbeddedSignInFlowStatusV2.Complete) {
|
|
8271
8399
|
const redirectUrl = response?.redirectUrl || response?.redirect_uri;
|
|
8272
8400
|
const finalRedirectUrl = redirectUrl || afterSignInUrl;
|
|
8273
8401
|
setIsSubmitting(false);
|
|
@@ -8306,37 +8434,19 @@ var SignIn = ({
|
|
|
8306
8434
|
const handleError = (error) => {
|
|
8307
8435
|
setError(error);
|
|
8308
8436
|
};
|
|
8309
|
-
(
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
}
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
return;
|
|
8323
|
-
}
|
|
8324
|
-
oauthCodeProcessedRef.current = true;
|
|
8325
|
-
if (!currentFlowId) {
|
|
8326
|
-
setFlowId(flowIdToUse);
|
|
8327
|
-
}
|
|
8328
|
-
const submitPayload = {
|
|
8329
|
-
flowId: flowIdToUse,
|
|
8330
|
-
inputs: {
|
|
8331
|
-
code: urlParams.code,
|
|
8332
|
-
...urlParams.nonce && { nonce: urlParams.nonce }
|
|
8333
|
-
}
|
|
8334
|
-
};
|
|
8335
|
-
handleSubmit(submitPayload).catch(() => {
|
|
8336
|
-
cleanupOAuthUrlParams(true);
|
|
8337
|
-
});
|
|
8338
|
-
}, [isFlowInitialized, currentFlowId, isInitialized, isLoading, isSubmitting, signIn]);
|
|
8339
|
-
(0, import_react59.useEffect)(() => {
|
|
8437
|
+
useOAuthCallback({
|
|
8438
|
+
currentFlowId,
|
|
8439
|
+
isInitialized: isInitialized && !isLoading,
|
|
8440
|
+
isSubmitting,
|
|
8441
|
+
onError: (err) => {
|
|
8442
|
+
clearFlowState();
|
|
8443
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
8444
|
+
},
|
|
8445
|
+
onSubmit: async (payload) => handleSubmit({ flowId: payload.flowId, inputs: payload.inputs }),
|
|
8446
|
+
processedRef: oauthCodeProcessedRef,
|
|
8447
|
+
setFlowId
|
|
8448
|
+
});
|
|
8449
|
+
(0, import_react60.useEffect)(() => {
|
|
8340
8450
|
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.flowId) {
|
|
8341
8451
|
return;
|
|
8342
8452
|
}
|
|
@@ -8431,7 +8541,7 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
8431
8541
|
window.location.href = url.toString();
|
|
8432
8542
|
}
|
|
8433
8543
|
};
|
|
8434
|
-
if (platform ===
|
|
8544
|
+
if (platform === import_browser51.Platform.AsgardeoV2) {
|
|
8435
8545
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8436
8546
|
SignIn_default,
|
|
8437
8547
|
{
|
|
@@ -8464,18 +8574,18 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
8464
8574
|
var SignIn_default2 = SignIn2;
|
|
8465
8575
|
|
|
8466
8576
|
// src/components/presentation/auth/SignUp/BaseSignUp.tsx
|
|
8467
|
-
var
|
|
8577
|
+
var import_browser62 = require("@asgardeo/browser");
|
|
8468
8578
|
|
|
8469
8579
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
8470
|
-
var
|
|
8580
|
+
var import_browser60 = require("@asgardeo/browser");
|
|
8471
8581
|
var import_css38 = require("@emotion/css");
|
|
8472
|
-
var
|
|
8582
|
+
var import_react62 = require("react");
|
|
8473
8583
|
|
|
8474
8584
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
8475
|
-
var
|
|
8585
|
+
var import_browser59 = require("@asgardeo/browser");
|
|
8476
8586
|
|
|
8477
8587
|
// src/components/adapters/CheckboxInput.tsx
|
|
8478
|
-
var
|
|
8588
|
+
var import_browser52 = require("@asgardeo/browser");
|
|
8479
8589
|
var CheckboxInput = ({
|
|
8480
8590
|
component,
|
|
8481
8591
|
formValues,
|
|
@@ -8496,14 +8606,14 @@ var CheckboxInput = ({
|
|
|
8496
8606
|
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8497
8607
|
placeholder: config["placeholder"] || "",
|
|
8498
8608
|
required: config["required"] || false,
|
|
8499
|
-
type:
|
|
8609
|
+
type: import_browser52.FieldType.Checkbox,
|
|
8500
8610
|
value
|
|
8501
8611
|
});
|
|
8502
8612
|
};
|
|
8503
8613
|
var CheckboxInput_default = CheckboxInput;
|
|
8504
8614
|
|
|
8505
8615
|
// src/components/adapters/DateInput.tsx
|
|
8506
|
-
var
|
|
8616
|
+
var import_browser53 = require("@asgardeo/browser");
|
|
8507
8617
|
var DateInput = ({
|
|
8508
8618
|
component,
|
|
8509
8619
|
formValues,
|
|
@@ -8524,7 +8634,7 @@ var DateInput = ({
|
|
|
8524
8634
|
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8525
8635
|
placeholder: config["placeholder"] || "",
|
|
8526
8636
|
required: config["required"] || false,
|
|
8527
|
-
type:
|
|
8637
|
+
type: import_browser53.FieldType.Date,
|
|
8528
8638
|
value
|
|
8529
8639
|
});
|
|
8530
8640
|
};
|
|
@@ -8550,7 +8660,7 @@ var DividerComponent = ({ component }) => {
|
|
|
8550
8660
|
var DividerComponent_default = DividerComponent;
|
|
8551
8661
|
|
|
8552
8662
|
// src/components/adapters/EmailInput.tsx
|
|
8553
|
-
var
|
|
8663
|
+
var import_browser54 = require("@asgardeo/browser");
|
|
8554
8664
|
var EmailInput = ({
|
|
8555
8665
|
component,
|
|
8556
8666
|
formValues,
|
|
@@ -8571,7 +8681,7 @@ var EmailInput = ({
|
|
|
8571
8681
|
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8572
8682
|
placeholder: config["placeholder"] || "Enter your email",
|
|
8573
8683
|
required: config["required"] || false,
|
|
8574
|
-
type:
|
|
8684
|
+
type: import_browser54.FieldType.Email,
|
|
8575
8685
|
value
|
|
8576
8686
|
});
|
|
8577
8687
|
};
|
|
@@ -8635,7 +8745,7 @@ var ImageComponent = ({ component }) => {
|
|
|
8635
8745
|
var ImageComponent_default = ImageComponent;
|
|
8636
8746
|
|
|
8637
8747
|
// src/components/adapters/NumberInput.tsx
|
|
8638
|
-
var
|
|
8748
|
+
var import_browser55 = require("@asgardeo/browser");
|
|
8639
8749
|
var NumberInput = ({
|
|
8640
8750
|
component,
|
|
8641
8751
|
formValues,
|
|
@@ -8656,14 +8766,14 @@ var NumberInput = ({
|
|
|
8656
8766
|
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8657
8767
|
placeholder: config["placeholder"] || "",
|
|
8658
8768
|
required: config["required"] || false,
|
|
8659
|
-
type:
|
|
8769
|
+
type: import_browser55.FieldType.Number,
|
|
8660
8770
|
value
|
|
8661
8771
|
});
|
|
8662
8772
|
};
|
|
8663
8773
|
var NumberInput_default = NumberInput;
|
|
8664
8774
|
|
|
8665
8775
|
// src/components/adapters/PasswordInput.tsx
|
|
8666
|
-
var
|
|
8776
|
+
var import_browser56 = require("@asgardeo/browser");
|
|
8667
8777
|
var PasswordInput = ({
|
|
8668
8778
|
component,
|
|
8669
8779
|
formValues,
|
|
@@ -8715,14 +8825,14 @@ var PasswordInput = ({
|
|
|
8715
8825
|
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8716
8826
|
placeholder: config["placeholder"] || "Enter your password",
|
|
8717
8827
|
required: config["required"] || false,
|
|
8718
|
-
type:
|
|
8828
|
+
type: import_browser56.FieldType.Password,
|
|
8719
8829
|
value
|
|
8720
8830
|
});
|
|
8721
8831
|
};
|
|
8722
8832
|
var PasswordInput_default = PasswordInput;
|
|
8723
8833
|
|
|
8724
8834
|
// src/components/adapters/SelectInput.tsx
|
|
8725
|
-
var
|
|
8835
|
+
var import_browser57 = require("@asgardeo/browser");
|
|
8726
8836
|
var SelectInput = ({
|
|
8727
8837
|
component,
|
|
8728
8838
|
formValues,
|
|
@@ -8749,7 +8859,7 @@ var SelectInput = ({
|
|
|
8749
8859
|
options,
|
|
8750
8860
|
placeholder: config["placeholder"] || "",
|
|
8751
8861
|
required: config["required"] || false,
|
|
8752
|
-
type:
|
|
8862
|
+
type: import_browser57.FieldType.Select,
|
|
8753
8863
|
value
|
|
8754
8864
|
});
|
|
8755
8865
|
};
|
|
@@ -8841,7 +8951,7 @@ var TelephoneInput = ({
|
|
|
8841
8951
|
var TelephoneInput_default = TelephoneInput;
|
|
8842
8952
|
|
|
8843
8953
|
// src/components/adapters/TextInput.tsx
|
|
8844
|
-
var
|
|
8954
|
+
var import_browser58 = require("@asgardeo/browser");
|
|
8845
8955
|
var TextInput = ({
|
|
8846
8956
|
component,
|
|
8847
8957
|
formValues,
|
|
@@ -8862,7 +8972,7 @@ var TextInput = ({
|
|
|
8862
8972
|
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8863
8973
|
placeholder: config["placeholder"] || "",
|
|
8864
8974
|
required: config["required"] || false,
|
|
8865
|
-
type:
|
|
8975
|
+
type: import_browser58.FieldType.Text,
|
|
8866
8976
|
value
|
|
8867
8977
|
});
|
|
8868
8978
|
};
|
|
@@ -8926,9 +9036,9 @@ var Typography_default2 = TypographyComponent;
|
|
|
8926
9036
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8927
9037
|
var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
8928
9038
|
switch (component.type) {
|
|
8929
|
-
case
|
|
9039
|
+
case import_browser59.EmbeddedFlowComponentType.Typography:
|
|
8930
9040
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
8931
|
-
case
|
|
9041
|
+
case import_browser59.EmbeddedFlowComponentType.Input: {
|
|
8932
9042
|
const inputVariant = component.variant?.toUpperCase();
|
|
8933
9043
|
const inputType = component.config["type"]?.toLowerCase();
|
|
8934
9044
|
if (inputVariant === "EMAIL" || inputType === "email") {
|
|
@@ -8951,7 +9061,7 @@ var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
8951
9061
|
}
|
|
8952
9062
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TextInput_default, { component, onSubmit, ...rest });
|
|
8953
9063
|
}
|
|
8954
|
-
case
|
|
9064
|
+
case import_browser59.EmbeddedFlowComponentType.Button: {
|
|
8955
9065
|
const buttonVariant = component.variant?.toUpperCase();
|
|
8956
9066
|
const buttonText = component.config["text"] || component.config["label"] || "";
|
|
8957
9067
|
if (buttonVariant === "SOCIAL") {
|
|
@@ -8976,13 +9086,13 @@ var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
8976
9086
|
}
|
|
8977
9087
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SubmitButton_default, { component, onSubmit, ...rest });
|
|
8978
9088
|
}
|
|
8979
|
-
case
|
|
9089
|
+
case import_browser59.EmbeddedFlowComponentType.Form:
|
|
8980
9090
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormContainer_default, { component, onSubmit, ...rest });
|
|
8981
|
-
case
|
|
9091
|
+
case import_browser59.EmbeddedFlowComponentType.Select:
|
|
8982
9092
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SelectInput_default, { component, onSubmit, ...rest });
|
|
8983
|
-
case
|
|
9093
|
+
case import_browser59.EmbeddedFlowComponentType.Divider:
|
|
8984
9094
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DividerComponent_default, { component, onSubmit, ...rest });
|
|
8985
|
-
case
|
|
9095
|
+
case import_browser59.EmbeddedFlowComponentType.Image:
|
|
8986
9096
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ImageComponent_default, { component, onSubmit, ...rest });
|
|
8987
9097
|
default:
|
|
8988
9098
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", {});
|
|
@@ -9017,8 +9127,8 @@ var renderSignUpComponents2 = (components, formValues, touchedFields, formErrors
|
|
|
9017
9127
|
|
|
9018
9128
|
// src/components/presentation/auth/SignUp/BaseSignUp.styles.ts
|
|
9019
9129
|
var import_css37 = require("@emotion/css");
|
|
9020
|
-
var
|
|
9021
|
-
var useStyles17 = (theme, colorScheme) => (0,
|
|
9130
|
+
var import_react61 = require("react");
|
|
9131
|
+
var useStyles17 = (theme, colorScheme) => (0, import_react61.useMemo)(() => {
|
|
9022
9132
|
const signUp = import_css37.css`
|
|
9023
9133
|
min-width: 420px;
|
|
9024
9134
|
margin: 0 auto;
|
|
@@ -9153,7 +9263,7 @@ var BaseSignUp_styles_default = useStyles17;
|
|
|
9153
9263
|
|
|
9154
9264
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
9155
9265
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9156
|
-
var logger6 = (0,
|
|
9266
|
+
var logger6 = (0, import_browser60.createPackageComponentLogger)(
|
|
9157
9267
|
"@asgardeo/react",
|
|
9158
9268
|
"BaseSignUp"
|
|
9159
9269
|
);
|
|
@@ -9181,7 +9291,7 @@ var BaseSignUpContent = ({
|
|
|
9181
9291
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
9182
9292
|
useAsgardeo_default();
|
|
9183
9293
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9184
|
-
const handleError = (0,
|
|
9294
|
+
const handleError = (0, import_react62.useCallback)(
|
|
9185
9295
|
(error) => {
|
|
9186
9296
|
let errorMessage = t("errors.signup.flow.failure");
|
|
9187
9297
|
if (error && typeof error === "object") {
|
|
@@ -9214,16 +9324,16 @@ var BaseSignUpContent = ({
|
|
|
9214
9324
|
},
|
|
9215
9325
|
[t, addMessage, clearMessages]
|
|
9216
9326
|
);
|
|
9217
|
-
const [isLoading, setIsLoading] = (0,
|
|
9218
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
9219
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
9220
|
-
const initializationAttemptedRef = (0,
|
|
9221
|
-
const extractFormFields = (0,
|
|
9327
|
+
const [isLoading, setIsLoading] = (0, import_react62.useState)(false);
|
|
9328
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react62.useState)(false);
|
|
9329
|
+
const [currentFlow, setCurrentFlow] = (0, import_react62.useState)(null);
|
|
9330
|
+
const initializationAttemptedRef = (0, import_react62.useRef)(false);
|
|
9331
|
+
const extractFormFields = (0, import_react62.useCallback)(
|
|
9222
9332
|
(components) => {
|
|
9223
9333
|
const fields = [];
|
|
9224
9334
|
const processComponents = (comps) => {
|
|
9225
9335
|
comps.forEach((component) => {
|
|
9226
|
-
if (component.type ===
|
|
9336
|
+
if (component.type === import_browser60.EmbeddedFlowComponentType.Input) {
|
|
9227
9337
|
const config = component.config || {};
|
|
9228
9338
|
fields.push({
|
|
9229
9339
|
initialValue: config.defaultValue || "",
|
|
@@ -9271,7 +9381,7 @@ var BaseSignUpContent = ({
|
|
|
9271
9381
|
validateForm,
|
|
9272
9382
|
reset: resetForm
|
|
9273
9383
|
} = form;
|
|
9274
|
-
const setupFormFields = (0,
|
|
9384
|
+
const setupFormFields = (0, import_react62.useCallback)(
|
|
9275
9385
|
(flowResponse) => {
|
|
9276
9386
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
9277
9387
|
const initialValues = {};
|
|
@@ -9290,7 +9400,7 @@ var BaseSignUpContent = ({
|
|
|
9290
9400
|
setFormTouched(name, true);
|
|
9291
9401
|
};
|
|
9292
9402
|
const handleRedirectionIfNeeded = (response) => {
|
|
9293
|
-
if (response?.type ===
|
|
9403
|
+
if (response?.type === import_browser60.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL) {
|
|
9294
9404
|
const redirectUrl = response.data.redirectURL;
|
|
9295
9405
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
9296
9406
|
if (!popup) {
|
|
@@ -9328,9 +9438,9 @@ var BaseSignUpContent = ({
|
|
|
9328
9438
|
try {
|
|
9329
9439
|
const continueResponse = await onSubmit(payload);
|
|
9330
9440
|
onFlowChange?.(continueResponse);
|
|
9331
|
-
if (continueResponse.flowStatus ===
|
|
9441
|
+
if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
9332
9442
|
onComplete?.(continueResponse);
|
|
9333
|
-
} else if (continueResponse.flowStatus ===
|
|
9443
|
+
} else if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
9334
9444
|
setCurrentFlow(continueResponse);
|
|
9335
9445
|
setupFormFields(continueResponse);
|
|
9336
9446
|
}
|
|
@@ -9381,9 +9491,9 @@ var BaseSignUpContent = ({
|
|
|
9381
9491
|
try {
|
|
9382
9492
|
const continueResponse = await onSubmit(payload);
|
|
9383
9493
|
onFlowChange?.(continueResponse);
|
|
9384
|
-
if (continueResponse.flowStatus ===
|
|
9494
|
+
if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
9385
9495
|
onComplete?.(continueResponse);
|
|
9386
|
-
} else if (continueResponse.flowStatus ===
|
|
9496
|
+
} else if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
9387
9497
|
setCurrentFlow(continueResponse);
|
|
9388
9498
|
setupFormFields(continueResponse);
|
|
9389
9499
|
}
|
|
@@ -9429,11 +9539,11 @@ var BaseSignUpContent = ({
|
|
|
9429
9539
|
};
|
|
9430
9540
|
const response = await onSubmit(payload);
|
|
9431
9541
|
onFlowChange?.(response);
|
|
9432
|
-
if (response.flowStatus ===
|
|
9542
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
9433
9543
|
onComplete?.(response);
|
|
9434
9544
|
return;
|
|
9435
9545
|
}
|
|
9436
|
-
if (response.flowStatus ===
|
|
9546
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
9437
9547
|
if (handleRedirectionIfNeeded(response)) {
|
|
9438
9548
|
return;
|
|
9439
9549
|
}
|
|
@@ -9449,31 +9559,31 @@ var BaseSignUpContent = ({
|
|
|
9449
9559
|
};
|
|
9450
9560
|
const containerClasses = (0, import_css38.cx)(
|
|
9451
9561
|
[
|
|
9452
|
-
(0,
|
|
9453
|
-
(0,
|
|
9454
|
-
(0,
|
|
9562
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup"),
|
|
9563
|
+
(0, import_browser60.withVendorCSSClassPrefix)(`signup--${size}`),
|
|
9564
|
+
(0, import_browser60.withVendorCSSClassPrefix)(`signup--${variant}`)
|
|
9455
9565
|
],
|
|
9456
9566
|
className
|
|
9457
9567
|
);
|
|
9458
9568
|
const inputClasses = (0, import_css38.cx)(
|
|
9459
9569
|
[
|
|
9460
|
-
(0,
|
|
9461
|
-
size === "small" && (0,
|
|
9462
|
-
size === "large" && (0,
|
|
9570
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup__input"),
|
|
9571
|
+
size === "small" && (0, import_browser60.withVendorCSSClassPrefix)("signup__input--small"),
|
|
9572
|
+
size === "large" && (0, import_browser60.withVendorCSSClassPrefix)("signup__input--large")
|
|
9463
9573
|
],
|
|
9464
9574
|
inputClassName
|
|
9465
9575
|
);
|
|
9466
9576
|
const buttonClasses = (0, import_css38.cx)(
|
|
9467
9577
|
[
|
|
9468
|
-
(0,
|
|
9469
|
-
size === "small" && (0,
|
|
9470
|
-
size === "large" && (0,
|
|
9578
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup__button"),
|
|
9579
|
+
size === "small" && (0, import_browser60.withVendorCSSClassPrefix)("signup__button--small"),
|
|
9580
|
+
size === "large" && (0, import_browser60.withVendorCSSClassPrefix)("signup__button--large")
|
|
9471
9581
|
],
|
|
9472
9582
|
buttonClassName
|
|
9473
9583
|
);
|
|
9474
|
-
const errorClasses = (0, import_css38.cx)([(0,
|
|
9475
|
-
const messageClasses = (0, import_css38.cx)([(0,
|
|
9476
|
-
const renderComponents = (0,
|
|
9584
|
+
const errorClasses = (0, import_css38.cx)([(0, import_browser60.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
9585
|
+
const messageClasses = (0, import_css38.cx)([(0, import_browser60.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
9586
|
+
const renderComponents = (0, import_react62.useCallback)(
|
|
9477
9587
|
(components) => renderSignUpComponents2(
|
|
9478
9588
|
components,
|
|
9479
9589
|
formValues,
|
|
@@ -9503,7 +9613,7 @@ var BaseSignUpContent = ({
|
|
|
9503
9613
|
handleSubmit
|
|
9504
9614
|
]
|
|
9505
9615
|
);
|
|
9506
|
-
(0,
|
|
9616
|
+
(0, import_react62.useEffect)(() => {
|
|
9507
9617
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
9508
9618
|
initializationAttemptedRef.current = true;
|
|
9509
9619
|
(async () => {
|
|
@@ -9514,11 +9624,11 @@ var BaseSignUpContent = ({
|
|
|
9514
9624
|
setCurrentFlow(response);
|
|
9515
9625
|
setIsFlowInitialized(true);
|
|
9516
9626
|
onFlowChange?.(response);
|
|
9517
|
-
if (response.flowStatus ===
|
|
9627
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
9518
9628
|
onComplete?.(response);
|
|
9519
9629
|
return;
|
|
9520
9630
|
}
|
|
9521
|
-
if (response.flowStatus ===
|
|
9631
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
9522
9632
|
setupFormFields(response);
|
|
9523
9633
|
}
|
|
9524
9634
|
} catch (err) {
|
|
@@ -9596,11 +9706,11 @@ var BaseSignUp = ({ showLogo = true, ...rest }) => {
|
|
|
9596
9706
|
var BaseSignUp_default = BaseSignUp;
|
|
9597
9707
|
|
|
9598
9708
|
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
9599
|
-
var
|
|
9709
|
+
var import_browser61 = require("@asgardeo/browser");
|
|
9600
9710
|
var import_css39 = require("@emotion/css");
|
|
9601
|
-
var
|
|
9711
|
+
var import_react63 = require("react");
|
|
9602
9712
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
9603
|
-
var logger7 = (0,
|
|
9713
|
+
var logger7 = (0, import_browser61.createPackageComponentLogger)(
|
|
9604
9714
|
"@asgardeo/react",
|
|
9605
9715
|
"BaseSignUp"
|
|
9606
9716
|
);
|
|
@@ -9629,20 +9739,20 @@ var BaseSignUpContent2 = ({
|
|
|
9629
9739
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
9630
9740
|
useAsgardeo_default();
|
|
9631
9741
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9632
|
-
const [isLoading, setIsLoading] = (0,
|
|
9633
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
9634
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
9635
|
-
const [apiError, setApiError] = (0,
|
|
9636
|
-
const [passkeyState, setPasskeyState] = (0,
|
|
9742
|
+
const [isLoading, setIsLoading] = (0, import_react63.useState)(false);
|
|
9743
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react63.useState)(false);
|
|
9744
|
+
const [currentFlow, setCurrentFlow] = (0, import_react63.useState)(null);
|
|
9745
|
+
const [apiError, setApiError] = (0, import_react63.useState)(null);
|
|
9746
|
+
const [passkeyState, setPasskeyState] = (0, import_react63.useState)({
|
|
9637
9747
|
actionId: null,
|
|
9638
9748
|
creationOptions: null,
|
|
9639
9749
|
error: null,
|
|
9640
9750
|
flowId: null,
|
|
9641
9751
|
isActive: false
|
|
9642
9752
|
});
|
|
9643
|
-
const initializationAttemptedRef = (0,
|
|
9644
|
-
const passkeyProcessedRef = (0,
|
|
9645
|
-
const handleError = (0,
|
|
9753
|
+
const initializationAttemptedRef = (0, import_react63.useRef)(false);
|
|
9754
|
+
const passkeyProcessedRef = (0, import_react63.useRef)(false);
|
|
9755
|
+
const handleError = (0, import_react63.useCallback)(
|
|
9646
9756
|
(error) => {
|
|
9647
9757
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
9648
9758
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -9654,7 +9764,7 @@ var BaseSignUpContent2 = ({
|
|
|
9654
9764
|
},
|
|
9655
9765
|
[t, addMessage, clearMessages]
|
|
9656
9766
|
);
|
|
9657
|
-
const normalizeFlowResponseLocal = (0,
|
|
9767
|
+
const normalizeFlowResponseLocal = (0, import_react63.useCallback)(
|
|
9658
9768
|
(response) => {
|
|
9659
9769
|
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
9660
9770
|
return response;
|
|
@@ -9676,12 +9786,12 @@ var BaseSignUpContent2 = ({
|
|
|
9676
9786
|
},
|
|
9677
9787
|
[t, children]
|
|
9678
9788
|
);
|
|
9679
|
-
const extractFormFields = (0,
|
|
9789
|
+
const extractFormFields = (0, import_react63.useCallback)(
|
|
9680
9790
|
(components) => {
|
|
9681
9791
|
const fields = [];
|
|
9682
9792
|
const processComponents = (comps) => {
|
|
9683
9793
|
comps.forEach((component) => {
|
|
9684
|
-
if (component.type ===
|
|
9794
|
+
if (component.type === import_browser61.EmbeddedFlowComponentTypeV2.TextInput || component.type === import_browser61.EmbeddedFlowComponentTypeV2.PasswordInput || component.type === import_browser61.EmbeddedFlowComponentTypeV2.EmailInput || component.type === import_browser61.EmbeddedFlowComponentTypeV2.Select) {
|
|
9685
9795
|
const fieldName = component.ref || component.id;
|
|
9686
9796
|
fields.push({
|
|
9687
9797
|
initialValue: "",
|
|
@@ -9691,7 +9801,7 @@ var BaseSignUpContent2 = ({
|
|
|
9691
9801
|
if (component.required && (!value || value.trim() === "")) {
|
|
9692
9802
|
return t("validations.required.field.error");
|
|
9693
9803
|
}
|
|
9694
|
-
if ((component.type ===
|
|
9804
|
+
if ((component.type === import_browser61.EmbeddedFlowComponentTypeV2.EmailInput || component.variant === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
9695
9805
|
return t("field.email.invalid");
|
|
9696
9806
|
}
|
|
9697
9807
|
return null;
|
|
@@ -9727,7 +9837,7 @@ var BaseSignUpContent2 = ({
|
|
|
9727
9837
|
touchAllFields,
|
|
9728
9838
|
reset: resetForm
|
|
9729
9839
|
} = form;
|
|
9730
|
-
const setupFormFields = (0,
|
|
9840
|
+
const setupFormFields = (0, import_react63.useCallback)(
|
|
9731
9841
|
(flowResponse) => {
|
|
9732
9842
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
9733
9843
|
const initialValues = {};
|
|
@@ -9748,7 +9858,7 @@ var BaseSignUpContent2 = ({
|
|
|
9748
9858
|
setFormTouched(name, true);
|
|
9749
9859
|
};
|
|
9750
9860
|
const handleRedirectionIfNeeded = (response) => {
|
|
9751
|
-
if (response?.type ===
|
|
9861
|
+
if (response?.type === import_browser61.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL) {
|
|
9752
9862
|
const redirectUrl = response.data.redirectURL;
|
|
9753
9863
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
9754
9864
|
if (!popup) {
|
|
@@ -9788,9 +9898,9 @@ var BaseSignUpContent2 = ({
|
|
|
9788
9898
|
try {
|
|
9789
9899
|
const continueResponse = await onSubmit(payload);
|
|
9790
9900
|
onFlowChange?.(continueResponse);
|
|
9791
|
-
if (continueResponse.flowStatus ===
|
|
9901
|
+
if (continueResponse.flowStatus === import_browser61.EmbeddedFlowStatus.Complete) {
|
|
9792
9902
|
onComplete?.(continueResponse);
|
|
9793
|
-
} else if (continueResponse.flowStatus ===
|
|
9903
|
+
} else if (continueResponse.flowStatus === import_browser61.EmbeddedFlowStatus.Incomplete) {
|
|
9794
9904
|
setCurrentFlow(continueResponse);
|
|
9795
9905
|
setupFormFields(continueResponse);
|
|
9796
9906
|
}
|
|
@@ -9841,9 +9951,9 @@ var BaseSignUpContent2 = ({
|
|
|
9841
9951
|
try {
|
|
9842
9952
|
const continueResponse = await onSubmit(payload);
|
|
9843
9953
|
onFlowChange?.(continueResponse);
|
|
9844
|
-
if (continueResponse.flowStatus ===
|
|
9954
|
+
if (continueResponse.flowStatus === import_browser61.EmbeddedFlowStatus.Complete) {
|
|
9845
9955
|
onComplete?.(continueResponse);
|
|
9846
|
-
} else if (continueResponse.flowStatus ===
|
|
9956
|
+
} else if (continueResponse.flowStatus === import_browser61.EmbeddedFlowStatus.Incomplete) {
|
|
9847
9957
|
setCurrentFlow(continueResponse);
|
|
9848
9958
|
setupFormFields(continueResponse);
|
|
9849
9959
|
}
|
|
@@ -9897,11 +10007,11 @@ var BaseSignUpContent2 = ({
|
|
|
9897
10007
|
const rawResponse = await onSubmit(payload);
|
|
9898
10008
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
9899
10009
|
onFlowChange?.(response);
|
|
9900
|
-
if (response.flowStatus ===
|
|
10010
|
+
if (response.flowStatus === import_browser61.EmbeddedFlowStatus.Complete) {
|
|
9901
10011
|
onComplete?.(response);
|
|
9902
10012
|
return;
|
|
9903
10013
|
}
|
|
9904
|
-
if (response.flowStatus ===
|
|
10014
|
+
if (response.flowStatus === import_browser61.EmbeddedFlowStatus.Incomplete) {
|
|
9905
10015
|
if (handleRedirectionIfNeeded(response)) {
|
|
9906
10016
|
return;
|
|
9907
10017
|
}
|
|
@@ -9929,7 +10039,7 @@ var BaseSignUpContent2 = ({
|
|
|
9929
10039
|
setIsLoading(false);
|
|
9930
10040
|
}
|
|
9931
10041
|
};
|
|
9932
|
-
(0,
|
|
10042
|
+
(0, import_react63.useEffect)(() => {
|
|
9933
10043
|
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.flowId) {
|
|
9934
10044
|
return;
|
|
9935
10045
|
}
|
|
@@ -9954,7 +10064,7 @@ var BaseSignUpContent2 = ({
|
|
|
9954
10064
|
const nextResponse = await onSubmit(payload);
|
|
9955
10065
|
const processedResponse = normalizeFlowResponseLocal(nextResponse);
|
|
9956
10066
|
onFlowChange?.(processedResponse);
|
|
9957
|
-
if (processedResponse.flowStatus ===
|
|
10067
|
+
if (processedResponse.flowStatus === import_browser61.EmbeddedFlowStatus.Complete) {
|
|
9958
10068
|
onComplete?.(processedResponse);
|
|
9959
10069
|
} else {
|
|
9960
10070
|
setCurrentFlow(processedResponse);
|
|
@@ -9971,31 +10081,31 @@ var BaseSignUpContent2 = ({
|
|
|
9971
10081
|
}, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.flowId]);
|
|
9972
10082
|
const containerClasses = (0, import_css39.cx)(
|
|
9973
10083
|
[
|
|
9974
|
-
(0,
|
|
9975
|
-
(0,
|
|
9976
|
-
(0,
|
|
10084
|
+
(0, import_browser61.withVendorCSSClassPrefix)("signup"),
|
|
10085
|
+
(0, import_browser61.withVendorCSSClassPrefix)(`signup--${size}`),
|
|
10086
|
+
(0, import_browser61.withVendorCSSClassPrefix)(`signup--${variant}`)
|
|
9977
10087
|
],
|
|
9978
10088
|
className
|
|
9979
10089
|
);
|
|
9980
10090
|
const inputClasses = (0, import_css39.cx)(
|
|
9981
10091
|
[
|
|
9982
|
-
(0,
|
|
9983
|
-
size === "small" && (0,
|
|
9984
|
-
size === "large" && (0,
|
|
10092
|
+
(0, import_browser61.withVendorCSSClassPrefix)("signup__input"),
|
|
10093
|
+
size === "small" && (0, import_browser61.withVendorCSSClassPrefix)("signup__input--small"),
|
|
10094
|
+
size === "large" && (0, import_browser61.withVendorCSSClassPrefix)("signup__input--large")
|
|
9985
10095
|
],
|
|
9986
10096
|
inputClassName
|
|
9987
10097
|
);
|
|
9988
10098
|
const buttonClasses = (0, import_css39.cx)(
|
|
9989
10099
|
[
|
|
9990
|
-
(0,
|
|
9991
|
-
size === "small" && (0,
|
|
9992
|
-
size === "large" && (0,
|
|
10100
|
+
(0, import_browser61.withVendorCSSClassPrefix)("signup__button"),
|
|
10101
|
+
size === "small" && (0, import_browser61.withVendorCSSClassPrefix)("signup__button--small"),
|
|
10102
|
+
size === "large" && (0, import_browser61.withVendorCSSClassPrefix)("signup__button--large")
|
|
9993
10103
|
],
|
|
9994
10104
|
buttonClassName
|
|
9995
10105
|
);
|
|
9996
|
-
const errorClasses = (0, import_css39.cx)([(0,
|
|
9997
|
-
const messageClasses = (0, import_css39.cx)([(0,
|
|
9998
|
-
const renderComponents = (0,
|
|
10106
|
+
const errorClasses = (0, import_css39.cx)([(0, import_browser61.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
10107
|
+
const messageClasses = (0, import_css39.cx)([(0, import_browser61.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
10108
|
+
const renderComponents = (0, import_react63.useCallback)(
|
|
9999
10109
|
(components) => renderSignUpComponents(
|
|
10000
10110
|
components,
|
|
10001
10111
|
formValues,
|
|
@@ -10035,7 +10145,7 @@ var BaseSignUpContent2 = ({
|
|
|
10035
10145
|
state: urlParams.get("state")
|
|
10036
10146
|
};
|
|
10037
10147
|
};
|
|
10038
|
-
(0,
|
|
10148
|
+
(0, import_react63.useEffect)(() => {
|
|
10039
10149
|
const urlParams = getUrlParams2();
|
|
10040
10150
|
if (urlParams.code || urlParams.state) {
|
|
10041
10151
|
return;
|
|
@@ -10052,11 +10162,11 @@ var BaseSignUpContent2 = ({
|
|
|
10052
10162
|
setCurrentFlow(response);
|
|
10053
10163
|
setIsFlowInitialized(true);
|
|
10054
10164
|
onFlowChange?.(response);
|
|
10055
|
-
if (response.flowStatus ===
|
|
10165
|
+
if (response.flowStatus === import_browser61.EmbeddedFlowStatus.Complete) {
|
|
10056
10166
|
onComplete?.(response);
|
|
10057
10167
|
return;
|
|
10058
10168
|
}
|
|
10059
|
-
if (response.flowStatus ===
|
|
10169
|
+
if (response.flowStatus === import_browser61.EmbeddedFlowStatus.Incomplete) {
|
|
10060
10170
|
setupFormFields(response);
|
|
10061
10171
|
}
|
|
10062
10172
|
} catch (err) {
|
|
@@ -10151,7 +10261,7 @@ var BaseSignUp_default2 = BaseSignUp2;
|
|
|
10151
10261
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10152
10262
|
var BaseSignUp3 = (props) => {
|
|
10153
10263
|
const { platform } = useAsgardeo_default();
|
|
10154
|
-
if (platform ===
|
|
10264
|
+
if (platform === import_browser62.Platform.AsgardeoV2) {
|
|
10155
10265
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BaseSignUp_default2, { ...props });
|
|
10156
10266
|
}
|
|
10157
10267
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BaseSignUp_default, { ...props });
|
|
@@ -10159,10 +10269,10 @@ var BaseSignUp3 = (props) => {
|
|
|
10159
10269
|
var BaseSignUp_default3 = BaseSignUp3;
|
|
10160
10270
|
|
|
10161
10271
|
// src/components/presentation/auth/SignUp/SignUp.tsx
|
|
10162
|
-
var
|
|
10272
|
+
var import_browser65 = require("@asgardeo/browser");
|
|
10163
10273
|
|
|
10164
10274
|
// src/components/presentation/auth/SignUp/v1/SignUp.tsx
|
|
10165
|
-
var
|
|
10275
|
+
var import_browser63 = require("@asgardeo/browser");
|
|
10166
10276
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10167
10277
|
var SignUp = ({
|
|
10168
10278
|
className,
|
|
@@ -10177,17 +10287,17 @@ var SignUp = ({
|
|
|
10177
10287
|
const { signUp, isInitialized } = useAsgardeo_default();
|
|
10178
10288
|
const handleInitialize = async (payload) => {
|
|
10179
10289
|
const initialPayload = payload || {
|
|
10180
|
-
flowType:
|
|
10290
|
+
flowType: import_browser63.EmbeddedFlowType.Registration
|
|
10181
10291
|
};
|
|
10182
10292
|
return await signUp(initialPayload);
|
|
10183
10293
|
};
|
|
10184
10294
|
const handleOnSubmit = async (payload) => await signUp(payload);
|
|
10185
10295
|
const handleComplete = (response) => {
|
|
10186
10296
|
onComplete?.(response);
|
|
10187
|
-
if (shouldRedirectAfterSignUp && response?.type !==
|
|
10297
|
+
if (shouldRedirectAfterSignUp && response?.type !== import_browser63.EmbeddedFlowResponseType.Redirection && afterSignUpUrl) {
|
|
10188
10298
|
window.location.href = afterSignUpUrl;
|
|
10189
10299
|
}
|
|
10190
|
-
if (shouldRedirectAfterSignUp && response?.type ===
|
|
10300
|
+
if (shouldRedirectAfterSignUp && response?.type === import_browser63.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && // Not a social provider redirect
|
|
10191
10301
|
!response.data.redirectURL.includes("auth")) {
|
|
10192
10302
|
window.location.href = response.data.redirectURL;
|
|
10193
10303
|
}
|
|
@@ -10214,7 +10324,7 @@ var SignUp = ({
|
|
|
10214
10324
|
var SignUp_default = SignUp;
|
|
10215
10325
|
|
|
10216
10326
|
// src/components/presentation/auth/SignUp/v2/SignUp.tsx
|
|
10217
|
-
var
|
|
10327
|
+
var import_browser64 = require("@asgardeo/browser");
|
|
10218
10328
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10219
10329
|
var SignUp2 = ({
|
|
10220
10330
|
className,
|
|
@@ -10232,7 +10342,7 @@ var SignUp2 = ({
|
|
|
10232
10342
|
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
10233
10343
|
const effectiveApplicationId = applicationId || applicationIdFromUrl;
|
|
10234
10344
|
const initialPayload = payload || {
|
|
10235
|
-
flowType:
|
|
10345
|
+
flowType: import_browser64.EmbeddedFlowType.Registration,
|
|
10236
10346
|
...effectiveApplicationId && { applicationId: effectiveApplicationId }
|
|
10237
10347
|
};
|
|
10238
10348
|
return await signUp(initialPayload);
|
|
@@ -10245,10 +10355,10 @@ var SignUp2 = ({
|
|
|
10245
10355
|
window.location.href = oauthRedirectUrl;
|
|
10246
10356
|
return;
|
|
10247
10357
|
}
|
|
10248
|
-
if (shouldRedirectAfterSignUp && response?.type !==
|
|
10358
|
+
if (shouldRedirectAfterSignUp && response?.type !== import_browser64.EmbeddedFlowResponseType.Redirection && afterSignUpUrl) {
|
|
10249
10359
|
window.location.href = afterSignUpUrl;
|
|
10250
10360
|
}
|
|
10251
|
-
if (shouldRedirectAfterSignUp && response?.type ===
|
|
10361
|
+
if (shouldRedirectAfterSignUp && response?.type === import_browser64.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && // Not a social provider redirect
|
|
10252
10362
|
!response.data.redirectURL.includes("auth")) {
|
|
10253
10363
|
window.location.href = response.data.redirectURL;
|
|
10254
10364
|
}
|
|
@@ -10278,7 +10388,7 @@ var SignUp_default2 = SignUp2;
|
|
|
10278
10388
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10279
10389
|
var SignUp3 = (props) => {
|
|
10280
10390
|
const { platform } = useAsgardeo_default();
|
|
10281
|
-
if (platform ===
|
|
10391
|
+
if (platform === import_browser65.Platform.AsgardeoV2) {
|
|
10282
10392
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(SignUp_default2, { ...props });
|
|
10283
10393
|
}
|
|
10284
10394
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(SignUp_default, { ...props });
|
|
@@ -10286,17 +10396,17 @@ var SignUp3 = (props) => {
|
|
|
10286
10396
|
var SignUp_default3 = SignUp3;
|
|
10287
10397
|
|
|
10288
10398
|
// src/components/presentation/auth/InviteUser/v2/InviteUser.tsx
|
|
10289
|
-
var
|
|
10399
|
+
var import_browser67 = require("@asgardeo/browser");
|
|
10290
10400
|
|
|
10291
10401
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx
|
|
10292
|
-
var
|
|
10402
|
+
var import_browser66 = require("@asgardeo/browser");
|
|
10293
10403
|
var import_css41 = require("@emotion/css");
|
|
10294
|
-
var
|
|
10404
|
+
var import_react65 = require("react");
|
|
10295
10405
|
|
|
10296
10406
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.ts
|
|
10297
10407
|
var import_css40 = require("@emotion/css");
|
|
10298
|
-
var
|
|
10299
|
-
var useStyles18 = (theme, colorScheme) => (0,
|
|
10408
|
+
var import_react64 = require("react");
|
|
10409
|
+
var useStyles18 = (theme, colorScheme) => (0, import_react64.useMemo)(() => {
|
|
10300
10410
|
const card = import_css40.css`
|
|
10301
10411
|
background: ${theme.vars.colors.background.surface};
|
|
10302
10412
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -10350,18 +10460,18 @@ var BaseInviteUser = ({
|
|
|
10350
10460
|
const { t } = useTranslation_default();
|
|
10351
10461
|
const { theme } = useTheme_default();
|
|
10352
10462
|
const styles = BaseInviteUser_styles_default(theme, theme.vars.colors.text.primary);
|
|
10353
|
-
const [isLoading, setIsLoading] = (0,
|
|
10354
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
10355
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
10356
|
-
const [apiError, setApiError] = (0,
|
|
10357
|
-
const [formValues, setFormValues] = (0,
|
|
10358
|
-
const [formErrors, setFormErrors] = (0,
|
|
10359
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
10360
|
-
const [inviteLink, setInviteLink] = (0,
|
|
10361
|
-
const [inviteLinkCopied, setInviteLinkCopied] = (0,
|
|
10362
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
10363
|
-
const initializationAttemptedRef = (0,
|
|
10364
|
-
const handleError = (0,
|
|
10463
|
+
const [isLoading, setIsLoading] = (0, import_react65.useState)(false);
|
|
10464
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react65.useState)(false);
|
|
10465
|
+
const [currentFlow, setCurrentFlow] = (0, import_react65.useState)(null);
|
|
10466
|
+
const [apiError, setApiError] = (0, import_react65.useState)(null);
|
|
10467
|
+
const [formValues, setFormValues] = (0, import_react65.useState)({});
|
|
10468
|
+
const [formErrors, setFormErrors] = (0, import_react65.useState)({});
|
|
10469
|
+
const [touchedFields, setTouchedFields] = (0, import_react65.useState)({});
|
|
10470
|
+
const [inviteLink, setInviteLink] = (0, import_react65.useState)();
|
|
10471
|
+
const [inviteLinkCopied, setInviteLinkCopied] = (0, import_react65.useState)(false);
|
|
10472
|
+
const [isFormValid, setIsFormValid] = (0, import_react65.useState)(true);
|
|
10473
|
+
const initializationAttemptedRef = (0, import_react65.useRef)(false);
|
|
10474
|
+
const handleError = (0, import_react65.useCallback)(
|
|
10365
10475
|
(error) => {
|
|
10366
10476
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.inviteUser.errors.generic");
|
|
10367
10477
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -10369,7 +10479,7 @@ var BaseInviteUser = ({
|
|
|
10369
10479
|
},
|
|
10370
10480
|
[t, onError]
|
|
10371
10481
|
);
|
|
10372
|
-
const normalizeFlowResponseLocal = (0,
|
|
10482
|
+
const normalizeFlowResponseLocal = (0, import_react65.useCallback)(
|
|
10373
10483
|
(response) => {
|
|
10374
10484
|
if (!response?.data?.meta?.components) {
|
|
10375
10485
|
return response;
|
|
@@ -10392,7 +10502,7 @@ var BaseInviteUser = ({
|
|
|
10392
10502
|
},
|
|
10393
10503
|
[t, children]
|
|
10394
10504
|
);
|
|
10395
|
-
const handleInputChange = (0,
|
|
10505
|
+
const handleInputChange = (0, import_react65.useCallback)((name, value) => {
|
|
10396
10506
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
10397
10507
|
setFormErrors((prev) => {
|
|
10398
10508
|
const newErrors = { ...prev };
|
|
@@ -10400,10 +10510,10 @@ var BaseInviteUser = ({
|
|
|
10400
10510
|
return newErrors;
|
|
10401
10511
|
});
|
|
10402
10512
|
}, []);
|
|
10403
|
-
const handleInputBlur = (0,
|
|
10513
|
+
const handleInputBlur = (0, import_react65.useCallback)((name) => {
|
|
10404
10514
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
10405
10515
|
}, []);
|
|
10406
|
-
const validateForm = (0,
|
|
10516
|
+
const validateForm = (0, import_react65.useCallback)(
|
|
10407
10517
|
(components2) => {
|
|
10408
10518
|
const errors = {};
|
|
10409
10519
|
const validateComponents = (comps) => {
|
|
@@ -10427,7 +10537,7 @@ var BaseInviteUser = ({
|
|
|
10427
10537
|
},
|
|
10428
10538
|
[formValues]
|
|
10429
10539
|
);
|
|
10430
|
-
const handleSubmit = (0,
|
|
10540
|
+
const handleSubmit = (0, import_react65.useCallback)(
|
|
10431
10541
|
async (component, data) => {
|
|
10432
10542
|
if (!currentFlow) {
|
|
10433
10543
|
return;
|
|
@@ -10490,7 +10600,7 @@ var BaseInviteUser = ({
|
|
|
10490
10600
|
normalizeFlowResponseLocal
|
|
10491
10601
|
]
|
|
10492
10602
|
);
|
|
10493
|
-
const copyInviteLink = (0,
|
|
10603
|
+
const copyInviteLink = (0, import_react65.useCallback)(async () => {
|
|
10494
10604
|
if (!inviteLink) return;
|
|
10495
10605
|
try {
|
|
10496
10606
|
await navigator.clipboard.writeText(inviteLink);
|
|
@@ -10507,7 +10617,7 @@ var BaseInviteUser = ({
|
|
|
10507
10617
|
setTimeout(() => setInviteLinkCopied(false), 3e3);
|
|
10508
10618
|
}
|
|
10509
10619
|
}, [inviteLink]);
|
|
10510
|
-
const resetFlow = (0,
|
|
10620
|
+
const resetFlow = (0, import_react65.useCallback)(() => {
|
|
10511
10621
|
setIsFlowInitialized(false);
|
|
10512
10622
|
setCurrentFlow(null);
|
|
10513
10623
|
setApiError(null);
|
|
@@ -10518,7 +10628,7 @@ var BaseInviteUser = ({
|
|
|
10518
10628
|
setInviteLinkCopied(false);
|
|
10519
10629
|
initializationAttemptedRef.current = false;
|
|
10520
10630
|
}, []);
|
|
10521
|
-
(0,
|
|
10631
|
+
(0, import_react65.useEffect)(() => {
|
|
10522
10632
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
10523
10633
|
initializationAttemptedRef.current = true;
|
|
10524
10634
|
(async () => {
|
|
@@ -10526,7 +10636,7 @@ var BaseInviteUser = ({
|
|
|
10526
10636
|
setApiError(null);
|
|
10527
10637
|
try {
|
|
10528
10638
|
const payload = {
|
|
10529
|
-
flowType:
|
|
10639
|
+
flowType: import_browser66.EmbeddedFlowType.UserOnboarding,
|
|
10530
10640
|
verbose: true
|
|
10531
10641
|
};
|
|
10532
10642
|
const rawResponse = await onInitialize(payload);
|
|
@@ -10545,7 +10655,7 @@ var BaseInviteUser = ({
|
|
|
10545
10655
|
})();
|
|
10546
10656
|
}
|
|
10547
10657
|
}, [isInitialized, isFlowInitialized, onInitialize, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
10548
|
-
(0,
|
|
10658
|
+
(0, import_react65.useEffect)(() => {
|
|
10549
10659
|
if (currentFlow && isFlowInitialized) {
|
|
10550
10660
|
const components2 = currentFlow.data?.components || [];
|
|
10551
10661
|
if (components2.length > 0) {
|
|
@@ -10554,7 +10664,7 @@ var BaseInviteUser = ({
|
|
|
10554
10664
|
}
|
|
10555
10665
|
}
|
|
10556
10666
|
}, [formValues, currentFlow, isFlowInitialized, validateForm]);
|
|
10557
|
-
const extractHeadings = (0,
|
|
10667
|
+
const extractHeadings = (0, import_react65.useCallback)((components2) => {
|
|
10558
10668
|
let title2;
|
|
10559
10669
|
let subtitle2;
|
|
10560
10670
|
components2.forEach((comp) => {
|
|
@@ -10568,13 +10678,13 @@ var BaseInviteUser = ({
|
|
|
10568
10678
|
});
|
|
10569
10679
|
return { subtitle: subtitle2, title: title2 };
|
|
10570
10680
|
}, []);
|
|
10571
|
-
const filterHeadings = (0,
|
|
10681
|
+
const filterHeadings = (0, import_react65.useCallback)(
|
|
10572
10682
|
(components2) => components2.filter(
|
|
10573
10683
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
10574
10684
|
),
|
|
10575
10685
|
[]
|
|
10576
10686
|
);
|
|
10577
|
-
const renderComponents = (0,
|
|
10687
|
+
const renderComponents = (0, import_react65.useCallback)(
|
|
10578
10688
|
(components2) => renderInviteUserComponents(
|
|
10579
10689
|
components2,
|
|
10580
10690
|
formValues,
|
|
@@ -10706,7 +10816,7 @@ var InviteUser = ({
|
|
|
10706
10816
|
const response = await http2.request({
|
|
10707
10817
|
data: {
|
|
10708
10818
|
...payload,
|
|
10709
|
-
flowType:
|
|
10819
|
+
flowType: import_browser67.EmbeddedFlowType.UserOnboarding,
|
|
10710
10820
|
verbose: true
|
|
10711
10821
|
},
|
|
10712
10822
|
headers: {
|
|
@@ -10754,16 +10864,16 @@ var InviteUser = ({
|
|
|
10754
10864
|
var InviteUser_default = InviteUser;
|
|
10755
10865
|
|
|
10756
10866
|
// src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx
|
|
10757
|
-
var
|
|
10867
|
+
var import_react68 = require("react");
|
|
10758
10868
|
|
|
10759
10869
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
10760
10870
|
var import_css43 = require("@emotion/css");
|
|
10761
|
-
var
|
|
10871
|
+
var import_react67 = require("react");
|
|
10762
10872
|
|
|
10763
10873
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.ts
|
|
10764
10874
|
var import_css42 = require("@emotion/css");
|
|
10765
|
-
var
|
|
10766
|
-
var useStyles19 = (theme, colorScheme) => (0,
|
|
10875
|
+
var import_react66 = require("react");
|
|
10876
|
+
var useStyles19 = (theme, colorScheme) => (0, import_react66.useMemo)(() => {
|
|
10767
10877
|
const card = import_css42.css`
|
|
10768
10878
|
background: ${theme.vars.colors.background.surface};
|
|
10769
10879
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -10818,19 +10928,19 @@ var BaseAcceptInvite = ({
|
|
|
10818
10928
|
const { t } = useTranslation_default();
|
|
10819
10929
|
const { theme } = useTheme_default();
|
|
10820
10930
|
const styles = BaseAcceptInvite_styles_default(theme, theme.vars.colors.text.primary);
|
|
10821
|
-
const [isLoading, setIsLoading] = (0,
|
|
10822
|
-
const [isValidatingToken, setIsValidatingToken] = (0,
|
|
10823
|
-
const [isTokenInvalid, setIsTokenInvalid] = (0,
|
|
10824
|
-
const [isComplete, setIsComplete] = (0,
|
|
10825
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
10826
|
-
const [apiError, setApiError] = (0,
|
|
10827
|
-
const [formValues, setFormValues] = (0,
|
|
10828
|
-
const [formErrors, setFormErrors] = (0,
|
|
10829
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
10830
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
10831
|
-
const [completionTitle, setCompletionTitle] = (0,
|
|
10832
|
-
const tokenValidationAttemptedRef = (0,
|
|
10833
|
-
const handleError = (0,
|
|
10931
|
+
const [isLoading, setIsLoading] = (0, import_react67.useState)(false);
|
|
10932
|
+
const [isValidatingToken, setIsValidatingToken] = (0, import_react67.useState)(true);
|
|
10933
|
+
const [isTokenInvalid, setIsTokenInvalid] = (0, import_react67.useState)(false);
|
|
10934
|
+
const [isComplete, setIsComplete] = (0, import_react67.useState)(false);
|
|
10935
|
+
const [currentFlow, setCurrentFlow] = (0, import_react67.useState)(null);
|
|
10936
|
+
const [apiError, setApiError] = (0, import_react67.useState)(null);
|
|
10937
|
+
const [formValues, setFormValues] = (0, import_react67.useState)({});
|
|
10938
|
+
const [formErrors, setFormErrors] = (0, import_react67.useState)({});
|
|
10939
|
+
const [touchedFields, setTouchedFields] = (0, import_react67.useState)({});
|
|
10940
|
+
const [isFormValid, setIsFormValid] = (0, import_react67.useState)(true);
|
|
10941
|
+
const [completionTitle, setCompletionTitle] = (0, import_react67.useState)(void 0);
|
|
10942
|
+
const tokenValidationAttemptedRef = (0, import_react67.useRef)(false);
|
|
10943
|
+
const handleError = (0, import_react67.useCallback)(
|
|
10834
10944
|
(error) => {
|
|
10835
10945
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.acceptInvite.errors.generic");
|
|
10836
10946
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -10838,7 +10948,7 @@ var BaseAcceptInvite = ({
|
|
|
10838
10948
|
},
|
|
10839
10949
|
[t, onError]
|
|
10840
10950
|
);
|
|
10841
|
-
const normalizeFlowResponseLocal = (0,
|
|
10951
|
+
const normalizeFlowResponseLocal = (0, import_react67.useCallback)(
|
|
10842
10952
|
(response) => {
|
|
10843
10953
|
if (!response?.data?.meta?.components) {
|
|
10844
10954
|
return response;
|
|
@@ -10861,7 +10971,39 @@ var BaseAcceptInvite = ({
|
|
|
10861
10971
|
},
|
|
10862
10972
|
[t, children]
|
|
10863
10973
|
);
|
|
10864
|
-
|
|
10974
|
+
useOAuthCallback({
|
|
10975
|
+
currentFlowId: flowId ?? null,
|
|
10976
|
+
isInitialized: true,
|
|
10977
|
+
onComplete: () => {
|
|
10978
|
+
setIsComplete(true);
|
|
10979
|
+
setIsValidatingToken(false);
|
|
10980
|
+
onComplete?.();
|
|
10981
|
+
},
|
|
10982
|
+
onError: (error) => {
|
|
10983
|
+
setIsTokenInvalid(true);
|
|
10984
|
+
setIsValidatingToken(false);
|
|
10985
|
+
handleError(error);
|
|
10986
|
+
},
|
|
10987
|
+
onFlowChange: (response) => {
|
|
10988
|
+
onFlowChange?.(response);
|
|
10989
|
+
if (response.flowStatus !== "COMPLETE") {
|
|
10990
|
+
setCurrentFlow(response);
|
|
10991
|
+
setFormValues({});
|
|
10992
|
+
setFormErrors({});
|
|
10993
|
+
setTouchedFields({});
|
|
10994
|
+
}
|
|
10995
|
+
},
|
|
10996
|
+
onProcessingStart: () => {
|
|
10997
|
+
setIsValidatingToken(true);
|
|
10998
|
+
},
|
|
10999
|
+
onSubmit: async (payload) => {
|
|
11000
|
+
const rawResponse = await onSubmit(payload);
|
|
11001
|
+
const response = normalizeFlowResponseLocal(rawResponse);
|
|
11002
|
+
return response;
|
|
11003
|
+
},
|
|
11004
|
+
tokenValidationAttemptedRef
|
|
11005
|
+
});
|
|
11006
|
+
const handleInputChange = (0, import_react67.useCallback)((name, value) => {
|
|
10865
11007
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
10866
11008
|
setFormErrors((prev) => {
|
|
10867
11009
|
const newErrors = { ...prev };
|
|
@@ -10869,10 +11011,10 @@ var BaseAcceptInvite = ({
|
|
|
10869
11011
|
return newErrors;
|
|
10870
11012
|
});
|
|
10871
11013
|
}, []);
|
|
10872
|
-
const handleInputBlur = (0,
|
|
11014
|
+
const handleInputBlur = (0, import_react67.useCallback)((name) => {
|
|
10873
11015
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
10874
11016
|
}, []);
|
|
10875
|
-
const validateForm = (0,
|
|
11017
|
+
const validateForm = (0, import_react67.useCallback)(
|
|
10876
11018
|
(components2) => {
|
|
10877
11019
|
const errors = {};
|
|
10878
11020
|
const validateComponents = (comps) => {
|
|
@@ -10893,7 +11035,7 @@ var BaseAcceptInvite = ({
|
|
|
10893
11035
|
},
|
|
10894
11036
|
[formValues]
|
|
10895
11037
|
);
|
|
10896
|
-
const handleSubmit = (0,
|
|
11038
|
+
const handleSubmit = (0, import_react67.useCallback)(
|
|
10897
11039
|
async (component, data) => {
|
|
10898
11040
|
if (!currentFlow) {
|
|
10899
11041
|
return;
|
|
@@ -10926,6 +11068,13 @@ var BaseAcceptInvite = ({
|
|
|
10926
11068
|
const rawResponse = await onSubmit(payload);
|
|
10927
11069
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
10928
11070
|
onFlowChange?.(response);
|
|
11071
|
+
if (response.type === "REDIRECTION") {
|
|
11072
|
+
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
11073
|
+
if (redirectURL && typeof window !== "undefined") {
|
|
11074
|
+
initiateOAuthRedirect(redirectURL);
|
|
11075
|
+
return;
|
|
11076
|
+
}
|
|
11077
|
+
}
|
|
10929
11078
|
if (currentFlow?.data?.components || currentFlow?.data?.meta?.components) {
|
|
10930
11079
|
const currentComponents = currentFlow.data.components || currentFlow.data.meta?.components || [];
|
|
10931
11080
|
const heading = currentComponents.find(
|
|
@@ -10965,13 +11114,14 @@ var BaseAcceptInvite = ({
|
|
|
10965
11114
|
normalizeFlowResponseLocal
|
|
10966
11115
|
]
|
|
10967
11116
|
);
|
|
10968
|
-
(0,
|
|
10969
|
-
if (
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
11117
|
+
(0, import_react67.useEffect)(() => {
|
|
11118
|
+
if (tokenValidationAttemptedRef.current) {
|
|
11119
|
+
return;
|
|
11120
|
+
}
|
|
11121
|
+
if (!flowId || !inviteToken) {
|
|
11122
|
+
setIsValidatingToken(false);
|
|
11123
|
+
setIsTokenInvalid(true);
|
|
11124
|
+
handleError(new Error("Invalid invite link. Missing flowId or inviteToken."));
|
|
10975
11125
|
return;
|
|
10976
11126
|
}
|
|
10977
11127
|
tokenValidationAttemptedRef.current = true;
|
|
@@ -10979,6 +11129,9 @@ var BaseAcceptInvite = ({
|
|
|
10979
11129
|
setIsValidatingToken(true);
|
|
10980
11130
|
setApiError(null);
|
|
10981
11131
|
try {
|
|
11132
|
+
if (flowId) {
|
|
11133
|
+
sessionStorage.setItem("asgardeo_flow_id", flowId);
|
|
11134
|
+
}
|
|
10982
11135
|
const payload = {
|
|
10983
11136
|
flowId,
|
|
10984
11137
|
inputs: {
|
|
@@ -11003,7 +11156,7 @@ var BaseAcceptInvite = ({
|
|
|
11003
11156
|
}
|
|
11004
11157
|
})();
|
|
11005
11158
|
}, [flowId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
11006
|
-
const extractHeadings = (0,
|
|
11159
|
+
const extractHeadings = (0, import_react67.useCallback)((components2) => {
|
|
11007
11160
|
let title2;
|
|
11008
11161
|
let subtitle2;
|
|
11009
11162
|
components2.forEach((comp) => {
|
|
@@ -11017,13 +11170,13 @@ var BaseAcceptInvite = ({
|
|
|
11017
11170
|
});
|
|
11018
11171
|
return { subtitle: subtitle2, title: title2 };
|
|
11019
11172
|
}, []);
|
|
11020
|
-
const filterHeadings = (0,
|
|
11173
|
+
const filterHeadings = (0, import_react67.useCallback)(
|
|
11021
11174
|
(components2) => components2.filter(
|
|
11022
11175
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
11023
11176
|
),
|
|
11024
11177
|
[]
|
|
11025
11178
|
);
|
|
11026
|
-
const renderComponents = (0,
|
|
11179
|
+
const renderComponents = (0, import_react67.useCallback)(
|
|
11027
11180
|
(components2) => renderInviteUserComponents(
|
|
11028
11181
|
components2,
|
|
11029
11182
|
formValues,
|
|
@@ -11154,10 +11307,10 @@ var AcceptInvite = ({
|
|
|
11154
11307
|
showTitle = true,
|
|
11155
11308
|
showSubtitle = true
|
|
11156
11309
|
}) => {
|
|
11157
|
-
const { flowId: urlFlowId, inviteToken: urlInviteToken } = (0,
|
|
11310
|
+
const { flowId: urlFlowId, inviteToken: urlInviteToken } = (0, import_react68.useMemo)(() => getUrlParams(), []);
|
|
11158
11311
|
const flowId = flowIdProp || urlFlowId;
|
|
11159
11312
|
const inviteToken = inviteTokenProp || urlInviteToken;
|
|
11160
|
-
const apiBaseUrl = (0,
|
|
11313
|
+
const apiBaseUrl = (0, import_react68.useMemo)(() => {
|
|
11161
11314
|
if (baseUrl) {
|
|
11162
11315
|
return baseUrl;
|
|
11163
11316
|
}
|
|
@@ -11205,6 +11358,95 @@ var AcceptInvite = ({
|
|
|
11205
11358
|
};
|
|
11206
11359
|
var AcceptInvite_default = AcceptInvite;
|
|
11207
11360
|
|
|
11361
|
+
// src/components/auth/Callback/Callback.tsx
|
|
11362
|
+
var import_browser68 = require("@asgardeo/browser");
|
|
11363
|
+
var import_react69 = require("react");
|
|
11364
|
+
var Callback = ({ onNavigate, onError }) => {
|
|
11365
|
+
const processingRef = (0, import_react69.useRef)(false);
|
|
11366
|
+
const navigate6 = (path) => {
|
|
11367
|
+
if (onNavigate) {
|
|
11368
|
+
onNavigate(path);
|
|
11369
|
+
} else {
|
|
11370
|
+
(0, import_browser68.navigate)(path);
|
|
11371
|
+
}
|
|
11372
|
+
};
|
|
11373
|
+
(0, import_react69.useEffect)(() => {
|
|
11374
|
+
const processOAuthCallback = () => {
|
|
11375
|
+
if (processingRef.current) {
|
|
11376
|
+
return;
|
|
11377
|
+
}
|
|
11378
|
+
processingRef.current = true;
|
|
11379
|
+
let returnPath = "/";
|
|
11380
|
+
try {
|
|
11381
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
11382
|
+
const code = urlParams.get("code");
|
|
11383
|
+
const state = urlParams.get("state");
|
|
11384
|
+
const nonce = urlParams.get("nonce");
|
|
11385
|
+
const oauthError = urlParams.get("error");
|
|
11386
|
+
const errorDescription = urlParams.get("error_description");
|
|
11387
|
+
if (!state) {
|
|
11388
|
+
throw new Error("Missing OAuth state parameter - possible security issue");
|
|
11389
|
+
}
|
|
11390
|
+
const storedData = sessionStorage.getItem(`asgardeo_oauth_${state}`);
|
|
11391
|
+
if (!storedData) {
|
|
11392
|
+
if (oauthError) {
|
|
11393
|
+
const errorMsg = errorDescription || oauthError || "OAuth authentication failed";
|
|
11394
|
+
const err = new Error(errorMsg);
|
|
11395
|
+
onError?.(err);
|
|
11396
|
+
const params2 = new URLSearchParams();
|
|
11397
|
+
params2.set("error", oauthError);
|
|
11398
|
+
if (errorDescription) {
|
|
11399
|
+
params2.set("error_description", errorDescription);
|
|
11400
|
+
}
|
|
11401
|
+
navigate6(`/?${params2.toString()}`);
|
|
11402
|
+
return;
|
|
11403
|
+
}
|
|
11404
|
+
throw new Error("Invalid OAuth state - possible CSRF attack");
|
|
11405
|
+
}
|
|
11406
|
+
const { path, timestamp } = JSON.parse(storedData);
|
|
11407
|
+
returnPath = path || "/";
|
|
11408
|
+
const MAX_STATE_AGE = 6e5;
|
|
11409
|
+
if (Date.now() - timestamp > MAX_STATE_AGE) {
|
|
11410
|
+
sessionStorage.removeItem(`asgardeo_oauth_${state}`);
|
|
11411
|
+
throw new Error("OAuth state expired - please try again");
|
|
11412
|
+
}
|
|
11413
|
+
sessionStorage.removeItem(`asgardeo_oauth_${state}`);
|
|
11414
|
+
if (oauthError) {
|
|
11415
|
+
const errorMsg = errorDescription || oauthError || "OAuth authentication failed";
|
|
11416
|
+
const err = new Error(errorMsg);
|
|
11417
|
+
onError?.(err);
|
|
11418
|
+
const params2 = new URLSearchParams();
|
|
11419
|
+
params2.set("error", oauthError);
|
|
11420
|
+
if (errorDescription) {
|
|
11421
|
+
params2.set("error_description", errorDescription);
|
|
11422
|
+
}
|
|
11423
|
+
navigate6(`${returnPath}?${params2.toString()}`);
|
|
11424
|
+
return;
|
|
11425
|
+
}
|
|
11426
|
+
if (!code) {
|
|
11427
|
+
throw new Error("Missing OAuth authorization code");
|
|
11428
|
+
}
|
|
11429
|
+
const params = new URLSearchParams();
|
|
11430
|
+
params.set("code", code);
|
|
11431
|
+
if (nonce) {
|
|
11432
|
+
params.set("nonce", nonce);
|
|
11433
|
+
}
|
|
11434
|
+
navigate6(`${returnPath}?${params.toString()}`);
|
|
11435
|
+
} catch (err) {
|
|
11436
|
+
const errorMessage = err instanceof Error ? err.message : "OAuth callback processing failed";
|
|
11437
|
+
console.error("OAuth callback error:", err);
|
|
11438
|
+
onError?.(err instanceof Error ? err : new Error(errorMessage));
|
|
11439
|
+
const params = new URLSearchParams();
|
|
11440
|
+
params.set("error", "callback_error");
|
|
11441
|
+
params.set("error_description", errorMessage);
|
|
11442
|
+
navigate6(`${returnPath}?${params.toString()}`);
|
|
11443
|
+
}
|
|
11444
|
+
};
|
|
11445
|
+
processOAuthCallback();
|
|
11446
|
+
}, [onNavigate, onError]);
|
|
11447
|
+
return null;
|
|
11448
|
+
};
|
|
11449
|
+
|
|
11208
11450
|
// src/components/presentation/User/BaseUser.tsx
|
|
11209
11451
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11210
11452
|
var BaseUser = ({ user, children, fallback = null }) => {
|
|
@@ -11250,14 +11492,14 @@ Organization5.displayName = "Organization";
|
|
|
11250
11492
|
var Organization_default = Organization5;
|
|
11251
11493
|
|
|
11252
11494
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
11253
|
-
var
|
|
11495
|
+
var import_browser74 = require("@asgardeo/browser");
|
|
11254
11496
|
var import_css51 = require("@emotion/css");
|
|
11255
|
-
var
|
|
11497
|
+
var import_react78 = require("react");
|
|
11256
11498
|
|
|
11257
11499
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
11258
|
-
var
|
|
11500
|
+
var import_browser69 = require("@asgardeo/browser");
|
|
11259
11501
|
var import_css44 = require("@emotion/css");
|
|
11260
|
-
var
|
|
11502
|
+
var import_react70 = require("react");
|
|
11261
11503
|
var useStyles20 = (theme, colorScheme) => {
|
|
11262
11504
|
const valuePlaceholder = import_css44.css`
|
|
11263
11505
|
font-style: italic;
|
|
@@ -11302,7 +11544,7 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
11302
11544
|
padding: ${theme.vars.spacing.unit};
|
|
11303
11545
|
vertical-align: top;
|
|
11304
11546
|
`;
|
|
11305
|
-
return (0,
|
|
11547
|
+
return (0, import_react70.useMemo)(() => {
|
|
11306
11548
|
const root = import_css44.css`
|
|
11307
11549
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
11308
11550
|
min-width: 600px;
|
|
@@ -11393,7 +11635,7 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
11393
11635
|
max-width: 350px;
|
|
11394
11636
|
text-align: start;
|
|
11395
11637
|
|
|
11396
|
-
.${(0,
|
|
11638
|
+
.${(0, import_browser69.withVendorCSSClassPrefix)("form-control")} {
|
|
11397
11639
|
margin-bottom: 0;
|
|
11398
11640
|
}
|
|
11399
11641
|
|
|
@@ -11457,20 +11699,20 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
11457
11699
|
var BaseUserProfile_styles_default = useStyles20;
|
|
11458
11700
|
|
|
11459
11701
|
// src/utils/getMappedUserProfileValue.ts
|
|
11460
|
-
var
|
|
11702
|
+
var import_browser70 = require("@asgardeo/browser");
|
|
11461
11703
|
var getMappedUserProfileValue = (key, mappings, user) => {
|
|
11462
11704
|
if (!key || !mappings || !user) {
|
|
11463
11705
|
return void 0;
|
|
11464
11706
|
}
|
|
11465
11707
|
const mapping = mappings[key];
|
|
11466
11708
|
if (!mapping) {
|
|
11467
|
-
return (0,
|
|
11709
|
+
return (0, import_browser70.get)(user, key);
|
|
11468
11710
|
}
|
|
11469
11711
|
if (Array.isArray(mapping)) {
|
|
11470
11712
|
let foundValue;
|
|
11471
11713
|
let found = false;
|
|
11472
11714
|
mapping.some((path) => {
|
|
11473
|
-
const value = (0,
|
|
11715
|
+
const value = (0, import_browser70.get)(user, path);
|
|
11474
11716
|
if (value !== void 0 && value !== null && value !== "") {
|
|
11475
11717
|
foundValue = value;
|
|
11476
11718
|
found = true;
|
|
@@ -11480,7 +11722,7 @@ var getMappedUserProfileValue = (key, mappings, user) => {
|
|
|
11480
11722
|
});
|
|
11481
11723
|
return found ? foundValue : void 0;
|
|
11482
11724
|
}
|
|
11483
|
-
return (0,
|
|
11725
|
+
return (0, import_browser70.get)(user, mapping);
|
|
11484
11726
|
};
|
|
11485
11727
|
var getMappedUserProfileValue_default = getMappedUserProfileValue;
|
|
11486
11728
|
|
|
@@ -11510,14 +11752,14 @@ var getDisplayName = (mergedMappings, user, displayAttributes) => {
|
|
|
11510
11752
|
var getDisplayName_default = getDisplayName;
|
|
11511
11753
|
|
|
11512
11754
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
11513
|
-
var
|
|
11755
|
+
var import_browser71 = require("@asgardeo/browser");
|
|
11514
11756
|
var import_css46 = require("@emotion/css");
|
|
11515
|
-
var
|
|
11757
|
+
var import_react72 = require("react");
|
|
11516
11758
|
|
|
11517
11759
|
// src/components/primitives/Avatar/Avatar.styles.ts
|
|
11518
11760
|
var import_css45 = require("@emotion/css");
|
|
11519
|
-
var
|
|
11520
|
-
var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0,
|
|
11761
|
+
var import_react71 = require("react");
|
|
11762
|
+
var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0, import_react71.useMemo)(() => {
|
|
11521
11763
|
const baseAvatar = import_css45.css`
|
|
11522
11764
|
align-items: center;
|
|
11523
11765
|
background: ${backgroundColor || theme.vars.colors.background.surface};
|
|
@@ -11610,7 +11852,7 @@ var Avatar = ({
|
|
|
11610
11852
|
const colors = generateColor(seed);
|
|
11611
11853
|
return `linear-gradient(${angle}deg, ${colors})`;
|
|
11612
11854
|
};
|
|
11613
|
-
const backgroundColor = (0,
|
|
11855
|
+
const backgroundColor = (0, import_react72.useMemo)(() => {
|
|
11614
11856
|
if (!name || imageUrl) {
|
|
11615
11857
|
return void 0;
|
|
11616
11858
|
}
|
|
@@ -11632,7 +11874,7 @@ var Avatar = ({
|
|
|
11632
11874
|
{
|
|
11633
11875
|
src: imageUrl,
|
|
11634
11876
|
alt,
|
|
11635
|
-
className: (0, import_css46.cx)((0,
|
|
11877
|
+
className: (0, import_css46.cx)((0, import_browser71.withVendorCSSClassPrefix)((0, import_browser71.bem)("avatar", "image")), styles["image"])
|
|
11636
11878
|
}
|
|
11637
11879
|
);
|
|
11638
11880
|
}
|
|
@@ -11640,14 +11882,14 @@ var Avatar = ({
|
|
|
11640
11882
|
return getInitials(name);
|
|
11641
11883
|
}
|
|
11642
11884
|
if (isLoading) {
|
|
11643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: (0, import_css46.cx)((0,
|
|
11885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: (0, import_css46.cx)((0, import_browser71.withVendorCSSClassPrefix)((0, import_browser71.bem)("avatar", "skeleton")), styles["skeleton"]) });
|
|
11644
11886
|
}
|
|
11645
11887
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
11646
11888
|
"svg",
|
|
11647
11889
|
{
|
|
11648
11890
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11649
11891
|
viewBox: "0 0 640 640",
|
|
11650
|
-
className: (0, import_css46.cx)((0,
|
|
11892
|
+
className: (0, import_css46.cx)((0, import_browser71.withVendorCSSClassPrefix)((0, import_browser71.bem)("avatar", "icon")), styles["icon"]),
|
|
11651
11893
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("path", { d: "M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z" })
|
|
11652
11894
|
}
|
|
11653
11895
|
);
|
|
@@ -11656,11 +11898,11 @@ var Avatar = ({
|
|
|
11656
11898
|
"div",
|
|
11657
11899
|
{
|
|
11658
11900
|
className: (0, import_css46.cx)(
|
|
11659
|
-
(0,
|
|
11901
|
+
(0, import_browser71.withVendorCSSClassPrefix)((0, import_browser71.bem)("avatar")),
|
|
11660
11902
|
styles["avatar"],
|
|
11661
11903
|
styles["variant"],
|
|
11662
|
-
(0,
|
|
11663
|
-
isDefaultState && (0,
|
|
11904
|
+
(0, import_browser71.withVendorCSSClassPrefix)((0, import_browser71.bem)("avatar", null, variant)),
|
|
11905
|
+
isDefaultState && (0, import_browser71.withVendorCSSClassPrefix)((0, import_browser71.bem)("avatar", "default")),
|
|
11664
11906
|
className
|
|
11665
11907
|
),
|
|
11666
11908
|
children: renderContent()
|
|
@@ -11669,15 +11911,15 @@ var Avatar = ({
|
|
|
11669
11911
|
};
|
|
11670
11912
|
|
|
11671
11913
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
11672
|
-
var
|
|
11914
|
+
var import_browser72 = require("@asgardeo/browser");
|
|
11673
11915
|
var import_css48 = require("@emotion/css");
|
|
11674
|
-
var
|
|
11675
|
-
var
|
|
11916
|
+
var import_react74 = require("@floating-ui/react");
|
|
11917
|
+
var import_react75 = require("react");
|
|
11676
11918
|
|
|
11677
11919
|
// src/components/primitives/Dialog/Dialog.styles.ts
|
|
11678
11920
|
var import_css47 = require("@emotion/css");
|
|
11679
|
-
var
|
|
11680
|
-
var useStyles22 = (theme, colorScheme) => (0,
|
|
11921
|
+
var import_react73 = require("react");
|
|
11922
|
+
var useStyles22 = (theme, colorScheme) => (0, import_react73.useMemo)(() => {
|
|
11681
11923
|
const overlay = import_css47.css`
|
|
11682
11924
|
background-color: rgba(0, 0, 0, 0.5);
|
|
11683
11925
|
display: flex;
|
|
@@ -11837,23 +12079,23 @@ function useDialog({
|
|
|
11837
12079
|
open: controlledOpen,
|
|
11838
12080
|
onOpenChange: setControlledOpen
|
|
11839
12081
|
} = {}) {
|
|
11840
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
11841
|
-
const [labelId, setLabelId] = (0,
|
|
11842
|
-
const [descriptionId, setDescriptionId] = (0,
|
|
12082
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react75.useState)(initialOpen);
|
|
12083
|
+
const [labelId, setLabelId] = (0, import_react75.useState)();
|
|
12084
|
+
const [descriptionId, setDescriptionId] = (0, import_react75.useState)();
|
|
11843
12085
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
11844
12086
|
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
11845
|
-
const data = (0,
|
|
12087
|
+
const data = (0, import_react74.useFloating)({
|
|
11846
12088
|
onOpenChange: setOpen,
|
|
11847
12089
|
open
|
|
11848
12090
|
});
|
|
11849
12091
|
const { context } = data;
|
|
11850
|
-
const click = (0,
|
|
12092
|
+
const click = (0, import_react74.useClick)(context, {
|
|
11851
12093
|
enabled: controlledOpen == null
|
|
11852
12094
|
});
|
|
11853
|
-
const dismiss = (0,
|
|
11854
|
-
const role = (0,
|
|
11855
|
-
const interactions = (0,
|
|
11856
|
-
return (0,
|
|
12095
|
+
const dismiss = (0, import_react74.useDismiss)(context, { outsidePressEvent: "mousedown" });
|
|
12096
|
+
const role = (0, import_react74.useRole)(context);
|
|
12097
|
+
const interactions = (0, import_react74.useInteractions)([click, dismiss, role]);
|
|
12098
|
+
return (0, import_react75.useMemo)(
|
|
11857
12099
|
() => ({
|
|
11858
12100
|
open,
|
|
11859
12101
|
setOpen,
|
|
@@ -11867,9 +12109,9 @@ function useDialog({
|
|
|
11867
12109
|
[open, setOpen, interactions, data, labelId, descriptionId]
|
|
11868
12110
|
);
|
|
11869
12111
|
}
|
|
11870
|
-
var DialogContext = (0,
|
|
12112
|
+
var DialogContext = (0, import_react75.createContext)(null);
|
|
11871
12113
|
var useDialogContext = () => {
|
|
11872
|
-
const context = (0,
|
|
12114
|
+
const context = (0, import_react75.useContext)(DialogContext);
|
|
11873
12115
|
if (context == null) {
|
|
11874
12116
|
throw new Error("Dialog components must be wrapped in <Dialog />");
|
|
11875
12117
|
}
|
|
@@ -11879,13 +12121,13 @@ function Dialog({ children, ...options }) {
|
|
|
11879
12121
|
const dialog = useDialog(options);
|
|
11880
12122
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DialogContext.Provider, { value: dialog, children });
|
|
11881
12123
|
}
|
|
11882
|
-
var DialogTrigger = (0,
|
|
12124
|
+
var DialogTrigger = (0, import_react75.forwardRef)(
|
|
11883
12125
|
({ children, asChild = false, ...props }, propRef) => {
|
|
11884
12126
|
const context = useDialogContext();
|
|
11885
12127
|
const childrenRef = children.ref;
|
|
11886
|
-
const ref = (0,
|
|
11887
|
-
if (asChild && (0,
|
|
11888
|
-
return (0,
|
|
12128
|
+
const ref = (0, import_react74.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
12129
|
+
if (asChild && (0, import_react75.isValidElement)(children)) {
|
|
12130
|
+
return (0, import_react75.cloneElement)(
|
|
11889
12131
|
children,
|
|
11890
12132
|
context.getReferenceProps({
|
|
11891
12133
|
ref,
|
|
@@ -11898,23 +12140,23 @@ var DialogTrigger = (0, import_react73.forwardRef)(
|
|
|
11898
12140
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
11899
12141
|
}
|
|
11900
12142
|
);
|
|
11901
|
-
var DialogContent = (0,
|
|
12143
|
+
var DialogContent = (0, import_react75.forwardRef)(
|
|
11902
12144
|
(props, propRef) => {
|
|
11903
12145
|
const { context: floatingContext, ...context } = useDialogContext();
|
|
11904
12146
|
const { theme, colorScheme } = useTheme_default();
|
|
11905
12147
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
11906
|
-
const ref = (0,
|
|
12148
|
+
const ref = (0, import_react74.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
11907
12149
|
if (!floatingContext.open) return null;
|
|
11908
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
11909
|
-
|
|
12150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react74.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12151
|
+
import_react74.FloatingOverlay,
|
|
11910
12152
|
{
|
|
11911
|
-
className: (0, import_css48.cx)((0,
|
|
12153
|
+
className: (0, import_css48.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("dialog", "overlay")), styles["overlay"]),
|
|
11912
12154
|
lockScroll: true,
|
|
11913
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react74.FloatingFocusManager, { context: floatingContext, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
11914
12156
|
"div",
|
|
11915
12157
|
{
|
|
11916
12158
|
ref,
|
|
11917
|
-
className: (0, import_css48.cx)((0,
|
|
12159
|
+
className: (0, import_css48.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("dialog", "content")), styles["content"], props.className),
|
|
11918
12160
|
"aria-labelledby": context.labelId,
|
|
11919
12161
|
"aria-describedby": context.descriptionId,
|
|
11920
12162
|
...context.getFloatingProps(props),
|
|
@@ -11925,26 +12167,26 @@ var DialogContent = (0, import_react73.forwardRef)(
|
|
|
11925
12167
|
) });
|
|
11926
12168
|
}
|
|
11927
12169
|
);
|
|
11928
|
-
var DialogHeading = (0,
|
|
12170
|
+
var DialogHeading = (0, import_react75.forwardRef)(
|
|
11929
12171
|
({ children, ...props }, ref) => {
|
|
11930
12172
|
const context = useDialogContext();
|
|
11931
12173
|
const { theme, colorScheme } = useTheme_default();
|
|
11932
12174
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
11933
|
-
const id = (0,
|
|
11934
|
-
(0,
|
|
12175
|
+
const id = (0, import_react74.useId)();
|
|
12176
|
+
(0, import_react75.useLayoutEffect)(() => {
|
|
11935
12177
|
context.setLabelId(id);
|
|
11936
12178
|
return () => {
|
|
11937
12179
|
context.setLabelId(void 0);
|
|
11938
12180
|
};
|
|
11939
12181
|
}, [id, context.setLabelId]);
|
|
11940
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: (0, import_css48.cx)((0,
|
|
12182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: (0, import_css48.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("dialog", "header")), styles["header"]), children: [
|
|
11941
12183
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
11942
12184
|
"h2",
|
|
11943
12185
|
{
|
|
11944
12186
|
...props,
|
|
11945
12187
|
ref,
|
|
11946
12188
|
id,
|
|
11947
|
-
className: (0, import_css48.cx)((0,
|
|
12189
|
+
className: (0, import_css48.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("dialog", "title")), styles["headerTitle"]),
|
|
11948
12190
|
children
|
|
11949
12191
|
}
|
|
11950
12192
|
),
|
|
@@ -11965,13 +12207,13 @@ var DialogHeading = (0, import_react73.forwardRef)(
|
|
|
11965
12207
|
] });
|
|
11966
12208
|
}
|
|
11967
12209
|
);
|
|
11968
|
-
var DialogDescription = (0,
|
|
12210
|
+
var DialogDescription = (0, import_react75.forwardRef)(
|
|
11969
12211
|
({ children, ...props }, ref) => {
|
|
11970
12212
|
const context = useDialogContext();
|
|
11971
12213
|
const { theme, colorScheme } = useTheme_default();
|
|
11972
12214
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
11973
|
-
const id = (0,
|
|
11974
|
-
(0,
|
|
12215
|
+
const id = (0, import_react74.useId)();
|
|
12216
|
+
(0, import_react75.useLayoutEffect)(() => {
|
|
11975
12217
|
context.setDescriptionId(id);
|
|
11976
12218
|
return () => {
|
|
11977
12219
|
context.setDescriptionId(void 0);
|
|
@@ -11983,23 +12225,23 @@ var DialogDescription = (0, import_react73.forwardRef)(
|
|
|
11983
12225
|
...props,
|
|
11984
12226
|
ref,
|
|
11985
12227
|
id,
|
|
11986
|
-
className: (0, import_css48.cx)((0,
|
|
12228
|
+
className: (0, import_css48.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("dialog", "description")), styles["description"], props.className),
|
|
11987
12229
|
children
|
|
11988
12230
|
}
|
|
11989
12231
|
);
|
|
11990
12232
|
}
|
|
11991
12233
|
);
|
|
11992
|
-
var DialogClose = (0,
|
|
12234
|
+
var DialogClose = (0, import_react75.forwardRef)(
|
|
11993
12235
|
({ children, asChild = false, ...props }, propRef) => {
|
|
11994
12236
|
const context = useDialogContext();
|
|
11995
12237
|
const childrenRef = children?.ref;
|
|
11996
|
-
const ref = (0,
|
|
12238
|
+
const ref = (0, import_react74.useMergeRefs)([propRef, childrenRef]);
|
|
11997
12239
|
const handleClick = (event) => {
|
|
11998
12240
|
context.setOpen(false);
|
|
11999
12241
|
props.onClick?.(event);
|
|
12000
12242
|
};
|
|
12001
|
-
if (asChild && (0,
|
|
12002
|
-
return (0,
|
|
12243
|
+
if (asChild && (0, import_react75.isValidElement)(children)) {
|
|
12244
|
+
return (0, import_react75.cloneElement)(children, {
|
|
12003
12245
|
ref,
|
|
12004
12246
|
...props,
|
|
12005
12247
|
...children.props,
|
|
@@ -12012,7 +12254,7 @@ var DialogClose = (0, import_react73.forwardRef)(
|
|
|
12012
12254
|
...props,
|
|
12013
12255
|
ref,
|
|
12014
12256
|
onClick: handleClick,
|
|
12015
|
-
className: (0, import_css48.cx)((0,
|
|
12257
|
+
className: (0, import_css48.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("dialog", "close")), props.className),
|
|
12016
12258
|
variant: "text",
|
|
12017
12259
|
children
|
|
12018
12260
|
}
|
|
@@ -12032,14 +12274,14 @@ Dialog.Close = DialogClose;
|
|
|
12032
12274
|
var Dialog_default = Dialog;
|
|
12033
12275
|
|
|
12034
12276
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
12035
|
-
var
|
|
12277
|
+
var import_browser73 = require("@asgardeo/browser");
|
|
12036
12278
|
var import_css50 = require("@emotion/css");
|
|
12037
|
-
var
|
|
12279
|
+
var import_react77 = require("react");
|
|
12038
12280
|
|
|
12039
12281
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
12040
12282
|
var import_css49 = require("@emotion/css");
|
|
12041
|
-
var
|
|
12042
|
-
var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0,
|
|
12283
|
+
var import_react76 = require("react");
|
|
12284
|
+
var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0, import_react76.useMemo)(() => {
|
|
12043
12285
|
const container = import_css49.css`
|
|
12044
12286
|
display: flex;
|
|
12045
12287
|
flex-direction: column;
|
|
@@ -12153,7 +12395,7 @@ var MultiInput = ({
|
|
|
12153
12395
|
const styles = MultiInput_styles_default(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);
|
|
12154
12396
|
const PlusIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css50.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
12155
12397
|
const BinIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css50.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14ZM10 11v6M14 11v6" }) });
|
|
12156
|
-
const handleAddValue = (0,
|
|
12398
|
+
const handleAddValue = (0, import_react77.useCallback)(
|
|
12157
12399
|
(newValue) => {
|
|
12158
12400
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
12159
12401
|
onChange([...values, newValue.trim()]);
|
|
@@ -12161,7 +12403,7 @@ var MultiInput = ({
|
|
|
12161
12403
|
},
|
|
12162
12404
|
[values, onChange, maxFields]
|
|
12163
12405
|
);
|
|
12164
|
-
const handleRemoveValue = (0,
|
|
12406
|
+
const handleRemoveValue = (0, import_react77.useCallback)(
|
|
12165
12407
|
(index) => {
|
|
12166
12408
|
if (values.length > minFields) {
|
|
12167
12409
|
const updatedValues = values.filter((_, i) => i !== index);
|
|
@@ -12170,7 +12412,7 @@ var MultiInput = ({
|
|
|
12170
12412
|
},
|
|
12171
12413
|
[values, onChange, minFields]
|
|
12172
12414
|
);
|
|
12173
|
-
const renderInputField = (0,
|
|
12415
|
+
const renderInputField = (0, import_react77.useCallback)(
|
|
12174
12416
|
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
12175
12417
|
const handleInputChange = (e) => {
|
|
12176
12418
|
const newValue = e.target ? e.target.value : e;
|
|
@@ -12212,8 +12454,8 @@ var MultiInput = ({
|
|
|
12212
12454
|
},
|
|
12213
12455
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
12214
12456
|
);
|
|
12215
|
-
const [currentInputValue, setCurrentInputValue] = (0,
|
|
12216
|
-
const handleInputSubmit = (0,
|
|
12457
|
+
const [currentInputValue, setCurrentInputValue] = (0, import_react77.useState)("");
|
|
12458
|
+
const handleInputSubmit = (0, import_react77.useCallback)(() => {
|
|
12217
12459
|
if (currentInputValue.trim() !== "") {
|
|
12218
12460
|
handleAddValue(currentInputValue);
|
|
12219
12461
|
setCurrentInputValue("");
|
|
@@ -12224,26 +12466,26 @@ var MultiInput = ({
|
|
|
12224
12466
|
{
|
|
12225
12467
|
error,
|
|
12226
12468
|
helperText,
|
|
12227
|
-
className: (0, import_css50.cx)((0,
|
|
12469
|
+
className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input")), className),
|
|
12228
12470
|
style,
|
|
12229
12471
|
children: [
|
|
12230
12472
|
label && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(InputLabel_default, { required, error: !!error, children: label }),
|
|
12231
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css50.cx)((0,
|
|
12232
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css50.cx)((0,
|
|
12473
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "container")), styles["container"]), children: [
|
|
12474
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "input-row")), styles["inputRow"]), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "input-wrapper")), styles["inputWrapper"]), children: renderInputField(
|
|
12233
12475
|
currentInputValue,
|
|
12234
12476
|
setCurrentInputValue,
|
|
12235
12477
|
canAddMore ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(PlusIcon, { iconClassName: styles["plusIcon"] }) : void 0,
|
|
12236
12478
|
canAddMore ? handleInputSubmit : void 0
|
|
12237
12479
|
) }) }),
|
|
12238
|
-
values.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css50.cx)((0,
|
|
12480
|
+
values.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "list-container")), styles["listContainer"]), children: values.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
12239
12481
|
"div",
|
|
12240
12482
|
{
|
|
12241
|
-
className: (0, import_css50.cx)((0,
|
|
12483
|
+
className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "list-item")), styles["listItem"]),
|
|
12242
12484
|
children: [
|
|
12243
12485
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
12244
12486
|
"span",
|
|
12245
12487
|
{
|
|
12246
|
-
className: (0, import_css50.cx)((0,
|
|
12488
|
+
className: (0, import_css50.cx)((0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "list-item-text")), styles["listItemText"]),
|
|
12247
12489
|
children: value
|
|
12248
12490
|
}
|
|
12249
12491
|
),
|
|
@@ -12254,7 +12496,7 @@ var MultiInput = ({
|
|
|
12254
12496
|
onClick: () => handleRemoveValue(index),
|
|
12255
12497
|
disabled,
|
|
12256
12498
|
className: (0, import_css50.cx)(
|
|
12257
|
-
(0,
|
|
12499
|
+
(0, import_browser73.withVendorCSSClassPrefix)((0, import_browser73.bem)("multi-input", "remove-button")),
|
|
12258
12500
|
styles["removeButton"]
|
|
12259
12501
|
),
|
|
12260
12502
|
title: "Remove value",
|
|
@@ -12316,10 +12558,10 @@ var BaseUserProfile = ({
|
|
|
12316
12558
|
displayNameAttributes = []
|
|
12317
12559
|
}) => {
|
|
12318
12560
|
const { theme, colorScheme } = useTheme_default();
|
|
12319
|
-
const [editedUser, setEditedUser] = (0,
|
|
12320
|
-
const [editingFields, setEditingFields] = (0,
|
|
12561
|
+
const [editedUser, setEditedUser] = (0, import_react78.useState)(flattenedProfile || profile);
|
|
12562
|
+
const [editingFields, setEditingFields] = (0, import_react78.useState)({});
|
|
12321
12563
|
const { t } = useTranslation_default();
|
|
12322
|
-
const shouldShowField = (0,
|
|
12564
|
+
const shouldShowField = (0, import_react78.useCallback)(
|
|
12323
12565
|
(fieldName) => {
|
|
12324
12566
|
if (fieldsToSkip.includes(fieldName)) {
|
|
12325
12567
|
return false;
|
|
@@ -12348,13 +12590,13 @@ var BaseUserProfile = ({
|
|
|
12348
12590
|
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
12349
12591
|
}
|
|
12350
12592
|
);
|
|
12351
|
-
const toggleFieldEdit = (0,
|
|
12593
|
+
const toggleFieldEdit = (0, import_react78.useCallback)((fieldName) => {
|
|
12352
12594
|
setEditingFields((prev) => ({
|
|
12353
12595
|
...prev,
|
|
12354
12596
|
[fieldName]: !prev[fieldName]
|
|
12355
12597
|
}));
|
|
12356
12598
|
}, []);
|
|
12357
|
-
const getFieldPlaceholder = (0,
|
|
12599
|
+
const getFieldPlaceholder = (0, import_react78.useCallback)((schema) => {
|
|
12358
12600
|
const { type, displayName, description, name } = schema;
|
|
12359
12601
|
const fieldLabel = displayName || description || name || "value";
|
|
12360
12602
|
switch (type) {
|
|
@@ -12368,7 +12610,7 @@ var BaseUserProfile = ({
|
|
|
12368
12610
|
return `Enter your ${fieldLabel.toLowerCase()}`;
|
|
12369
12611
|
}
|
|
12370
12612
|
}, []);
|
|
12371
|
-
const formatLabel = (0,
|
|
12613
|
+
const formatLabel = (0, import_react78.useCallback)(
|
|
12372
12614
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
12373
12615
|
[]
|
|
12374
12616
|
);
|
|
@@ -12398,7 +12640,7 @@ var BaseUserProfile = ({
|
|
|
12398
12640
|
}
|
|
12399
12641
|
}
|
|
12400
12642
|
}
|
|
12401
|
-
const handleFieldSave = (0,
|
|
12643
|
+
const handleFieldSave = (0, import_react78.useCallback)(
|
|
12402
12644
|
(schema) => {
|
|
12403
12645
|
if (!onUpdate || !schema.name) return;
|
|
12404
12646
|
const fieldName = schema.name;
|
|
@@ -12414,7 +12656,7 @@ var BaseUserProfile = ({
|
|
|
12414
12656
|
fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
|
|
12415
12657
|
}
|
|
12416
12658
|
let payload = {};
|
|
12417
|
-
if (schema.schemaId && schema.schemaId !==
|
|
12659
|
+
if (schema.schemaId && schema.schemaId !== import_browser74.WellKnownSchemaIds.User) {
|
|
12418
12660
|
payload = {
|
|
12419
12661
|
[schema.schemaId]: {
|
|
12420
12662
|
[fieldName]: fieldValue
|
|
@@ -12428,7 +12670,7 @@ var BaseUserProfile = ({
|
|
|
12428
12670
|
},
|
|
12429
12671
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
12430
12672
|
);
|
|
12431
|
-
const handleFieldCancel = (0,
|
|
12673
|
+
const handleFieldCancel = (0, import_react78.useCallback)(
|
|
12432
12674
|
(fieldName) => {
|
|
12433
12675
|
const currentUser2 = flattenedProfile || profile;
|
|
12434
12676
|
setEditedUser((prev) => ({
|
|
@@ -12680,7 +12922,7 @@ var BaseUserProfile = ({
|
|
|
12680
12922
|
const containerClasses = (0, import_css51.cx)(
|
|
12681
12923
|
styles.root,
|
|
12682
12924
|
cardLayout ? styles.card : "",
|
|
12683
|
-
(0,
|
|
12925
|
+
(0, import_browser74.withVendorCSSClassPrefix)("user-profile"),
|
|
12684
12926
|
className
|
|
12685
12927
|
);
|
|
12686
12928
|
const currentUser = flattenedProfile || profile;
|
|
@@ -12721,7 +12963,7 @@ var BaseUserProfile = ({
|
|
|
12721
12963
|
Alert_default,
|
|
12722
12964
|
{
|
|
12723
12965
|
variant: "error",
|
|
12724
|
-
className: (0, import_css51.cx)((0,
|
|
12966
|
+
className: (0, import_css51.cx)((0, import_browser74.withVendorCSSClassPrefix)((0, import_browser74.bem)("user-profile", "alert")), styles.alert),
|
|
12725
12967
|
children: [
|
|
12726
12968
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Alert_default.Title, { children: t("errors.heading") || "Error" }),
|
|
12727
12969
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Alert_default.Description, { children: error })
|
|
@@ -12769,12 +13011,12 @@ var BaseUserProfile = ({
|
|
|
12769
13011
|
var BaseUserProfile_default = BaseUserProfile;
|
|
12770
13012
|
|
|
12771
13013
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
12772
|
-
var
|
|
12773
|
-
var
|
|
13014
|
+
var import_browser76 = require("@asgardeo/browser");
|
|
13015
|
+
var import_react79 = require("react");
|
|
12774
13016
|
|
|
12775
13017
|
// src/api/updateMeProfile.ts
|
|
12776
|
-
var
|
|
12777
|
-
var httpClient5 =
|
|
13018
|
+
var import_browser75 = require("@asgardeo/browser");
|
|
13019
|
+
var httpClient5 = import_browser75.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser75.AsgardeoSPAClient.getInstance());
|
|
12778
13020
|
var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
12779
13021
|
const defaultFetcher = async (url, config) => {
|
|
12780
13022
|
const response = await httpClient5({
|
|
@@ -12791,7 +13033,7 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
12791
13033
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
12792
13034
|
};
|
|
12793
13035
|
};
|
|
12794
|
-
return (0,
|
|
13036
|
+
return (0, import_browser75.updateMeProfile)({
|
|
12795
13037
|
...requestConfig,
|
|
12796
13038
|
fetcher: fetcher || defaultFetcher
|
|
12797
13039
|
});
|
|
@@ -12804,7 +13046,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
12804
13046
|
const { baseUrl } = useAsgardeo_default();
|
|
12805
13047
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
12806
13048
|
const { t } = useTranslation_default();
|
|
12807
|
-
const [error, setError] = (0,
|
|
13049
|
+
const [error, setError] = (0, import_react79.useState)(null);
|
|
12808
13050
|
const handleProfileUpdate = async (payload) => {
|
|
12809
13051
|
setError(null);
|
|
12810
13052
|
try {
|
|
@@ -12812,7 +13054,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
12812
13054
|
onUpdateProfile(response);
|
|
12813
13055
|
} catch (caughtError) {
|
|
12814
13056
|
let message = t("user.profile.update.generic.error");
|
|
12815
|
-
if (caughtError instanceof
|
|
13057
|
+
if (caughtError instanceof import_browser76.AsgardeoError) {
|
|
12816
13058
|
message = caughtError?.message;
|
|
12817
13059
|
}
|
|
12818
13060
|
setError(message);
|
|
@@ -12833,15 +13075,15 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
12833
13075
|
var UserProfile_default = UserProfile3;
|
|
12834
13076
|
|
|
12835
13077
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
12836
|
-
var
|
|
13078
|
+
var import_browser77 = require("@asgardeo/browser");
|
|
12837
13079
|
var import_css53 = require("@emotion/css");
|
|
12838
|
-
var
|
|
12839
|
-
var
|
|
13080
|
+
var import_react81 = require("@floating-ui/react");
|
|
13081
|
+
var import_react82 = require("react");
|
|
12840
13082
|
|
|
12841
13083
|
// src/components/presentation/UserDropdown/BaseUserDropdown.styles.ts
|
|
12842
13084
|
var import_css52 = require("@emotion/css");
|
|
12843
|
-
var
|
|
12844
|
-
var useStyles24 = (theme, colorScheme) => (0,
|
|
13085
|
+
var import_react80 = require("react");
|
|
13086
|
+
var useStyles24 = (theme, colorScheme) => (0, import_react80.useMemo)(() => {
|
|
12845
13087
|
const trigger = import_css52.css`
|
|
12846
13088
|
display: inline-flex;
|
|
12847
13089
|
align-items: center;
|
|
@@ -13042,19 +13284,19 @@ var BaseUserDropdown = ({
|
|
|
13042
13284
|
}) => {
|
|
13043
13285
|
const { theme, colorScheme } = useTheme_default();
|
|
13044
13286
|
const styles = BaseUserDropdown_styles_default(theme, colorScheme);
|
|
13045
|
-
const [isOpen, setIsOpen] = (0,
|
|
13046
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
13047
|
-
const { refs, floatingStyles, context } = (0,
|
|
13048
|
-
middleware: [(0,
|
|
13287
|
+
const [isOpen, setIsOpen] = (0, import_react82.useState)(false);
|
|
13288
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react82.useState)(null);
|
|
13289
|
+
const { refs, floatingStyles, context } = (0, import_react81.useFloating)({
|
|
13290
|
+
middleware: [(0, import_react81.offset)(5), (0, import_react81.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react81.shift)({ padding: 5 })],
|
|
13049
13291
|
onOpenChange: setIsOpen,
|
|
13050
13292
|
open: isOpen,
|
|
13051
13293
|
placement: "bottom-end",
|
|
13052
|
-
whileElementsMounted:
|
|
13294
|
+
whileElementsMounted: import_react81.autoUpdate
|
|
13053
13295
|
});
|
|
13054
|
-
const click = (0,
|
|
13055
|
-
const dismiss = (0,
|
|
13056
|
-
const role = (0,
|
|
13057
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
13296
|
+
const click = (0, import_react81.useClick)(context);
|
|
13297
|
+
const dismiss = (0, import_react81.useDismiss)(context);
|
|
13298
|
+
const role = (0, import_react81.useRole)(context);
|
|
13299
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react81.useInteractions)([click, dismiss, role]);
|
|
13058
13300
|
const defaultAttributeMappings = {
|
|
13059
13301
|
email: ["emails"],
|
|
13060
13302
|
firstName: ["name.givenName", "given_name"],
|
|
@@ -13097,12 +13339,12 @@ var BaseUserDropdown = ({
|
|
|
13097
13339
|
}
|
|
13098
13340
|
allMenuItems.push(...defaultMenuItems);
|
|
13099
13341
|
}
|
|
13100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css53.cx)((0,
|
|
13342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown"), className), children: [
|
|
13101
13343
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
13102
13344
|
Button_default,
|
|
13103
13345
|
{
|
|
13104
13346
|
ref: refs.setReference,
|
|
13105
|
-
className: (0, import_css53.cx)((0,
|
|
13347
|
+
className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__trigger"), styles["trigger"]),
|
|
13106
13348
|
color: "tertiary",
|
|
13107
13349
|
variant: "text",
|
|
13108
13350
|
size: "medium",
|
|
@@ -13122,18 +13364,18 @@ var BaseUserDropdown = ({
|
|
|
13122
13364
|
Typography_default,
|
|
13123
13365
|
{
|
|
13124
13366
|
variant: "body2",
|
|
13125
|
-
className: (0, import_css53.cx)((0,
|
|
13367
|
+
className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__trigger-label"), styles["userName"]),
|
|
13126
13368
|
children: getDisplayName_default(mergedMappings, user)
|
|
13127
13369
|
}
|
|
13128
13370
|
)
|
|
13129
13371
|
]
|
|
13130
13372
|
}
|
|
13131
13373
|
),
|
|
13132
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
13374
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react81.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react81.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
13133
13375
|
"div",
|
|
13134
13376
|
{
|
|
13135
13377
|
ref: refs.setFloating,
|
|
13136
|
-
className: (0, import_css53.cx)((0,
|
|
13378
|
+
className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__content"), styles["dropdownContent"]),
|
|
13137
13379
|
style: {
|
|
13138
13380
|
...floatingStyles,
|
|
13139
13381
|
// Floating UI doesn't set a z-index by default, so we set a high value to ensure the dropdown appears above other elements.
|
|
@@ -13142,7 +13384,7 @@ var BaseUserDropdown = ({
|
|
|
13142
13384
|
},
|
|
13143
13385
|
...getFloatingProps(),
|
|
13144
13386
|
children: [
|
|
13145
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css53.cx)((0,
|
|
13387
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__header"), styles["dropdownHeader"]), children: [
|
|
13146
13388
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
13147
13389
|
Avatar,
|
|
13148
13390
|
{
|
|
@@ -13152,12 +13394,12 @@ var BaseUserDropdown = ({
|
|
|
13152
13394
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
13153
13395
|
}
|
|
13154
13396
|
),
|
|
13155
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css53.cx)((0,
|
|
13397
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__header-info"), styles["headerInfo"]), children: [
|
|
13156
13398
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
13157
13399
|
Typography_default,
|
|
13158
13400
|
{
|
|
13159
13401
|
noWrap: true,
|
|
13160
|
-
className: (0,
|
|
13402
|
+
className: (0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__header-name"),
|
|
13161
13403
|
variant: "body1",
|
|
13162
13404
|
fontWeight: "medium",
|
|
13163
13405
|
children: getDisplayName_default(mergedMappings, user)
|
|
@@ -13167,7 +13409,7 @@ var BaseUserDropdown = ({
|
|
|
13167
13409
|
Typography_default,
|
|
13168
13410
|
{
|
|
13169
13411
|
noWrap: true,
|
|
13170
|
-
className: (0,
|
|
13412
|
+
className: (0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__header-email"),
|
|
13171
13413
|
variant: "caption",
|
|
13172
13414
|
color: "secondary",
|
|
13173
13415
|
children: getMappedUserProfileValue_default("username", mergedMappings, user) || getMappedUserProfileValue_default("email", mergedMappings, user)
|
|
@@ -13175,12 +13417,12 @@ var BaseUserDropdown = ({
|
|
|
13175
13417
|
)
|
|
13176
13418
|
] })
|
|
13177
13419
|
] }),
|
|
13178
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: (0, import_css53.cx)((0,
|
|
13420
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__menu"), styles["dropdownMenu"]), children: allMenuItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { children: (() => {
|
|
13179
13421
|
if (item.label === "") {
|
|
13180
13422
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
13181
13423
|
"div",
|
|
13182
13424
|
{
|
|
13183
|
-
className: (0, import_css53.cx)((0,
|
|
13425
|
+
className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__menu-divider"), styles["divider"])
|
|
13184
13426
|
}
|
|
13185
13427
|
);
|
|
13186
13428
|
}
|
|
@@ -13193,7 +13435,7 @@ var BaseUserDropdown = ({
|
|
|
13193
13435
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
13194
13436
|
},
|
|
13195
13437
|
className: (0, import_css53.cx)(
|
|
13196
|
-
(0,
|
|
13438
|
+
(0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__menu-item"),
|
|
13197
13439
|
styles["menuItemAnchor"]
|
|
13198
13440
|
),
|
|
13199
13441
|
onMouseEnter: () => setHoveredItemIndex(index),
|
|
@@ -13214,7 +13456,7 @@ var BaseUserDropdown = ({
|
|
|
13214
13456
|
style: {
|
|
13215
13457
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
13216
13458
|
},
|
|
13217
|
-
className: (0, import_css53.cx)((0,
|
|
13459
|
+
className: (0, import_css53.cx)((0, import_browser77.withVendorCSSClassPrefix)("user-dropdown__menu-item"), styles["menuItem"]),
|
|
13218
13460
|
color: "tertiary",
|
|
13219
13461
|
variant: "text",
|
|
13220
13462
|
size: "small",
|
|
@@ -13233,7 +13475,7 @@ var BaseUserDropdown = ({
|
|
|
13233
13475
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
13234
13476
|
|
|
13235
13477
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
13236
|
-
var
|
|
13478
|
+
var import_react83 = require("react");
|
|
13237
13479
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
13238
13480
|
var UserDropdown = ({
|
|
13239
13481
|
children,
|
|
@@ -13243,7 +13485,7 @@ var UserDropdown = ({
|
|
|
13243
13485
|
...rest
|
|
13244
13486
|
}) => {
|
|
13245
13487
|
const { user, isLoading, signOut } = useAsgardeo_default();
|
|
13246
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
13488
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react83.useState)(false);
|
|
13247
13489
|
const handleManageProfile = () => {
|
|
13248
13490
|
setIsProfileOpen(true);
|
|
13249
13491
|
};
|
|
@@ -13303,13 +13545,13 @@ var UserDropdown_default = UserDropdown;
|
|
|
13303
13545
|
|
|
13304
13546
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
13305
13547
|
var import_css55 = require("@emotion/css");
|
|
13306
|
-
var
|
|
13307
|
-
var
|
|
13548
|
+
var import_react85 = require("@floating-ui/react");
|
|
13549
|
+
var import_react86 = require("react");
|
|
13308
13550
|
|
|
13309
13551
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.ts
|
|
13310
13552
|
var import_css54 = require("@emotion/css");
|
|
13311
|
-
var
|
|
13312
|
-
var useStyles25 = (theme, colorScheme) => (0,
|
|
13553
|
+
var import_react84 = require("react");
|
|
13554
|
+
var useStyles25 = (theme, colorScheme) => (0, import_react84.useMemo)(() => {
|
|
13313
13555
|
const root = import_css54.css`
|
|
13314
13556
|
display: inline-block;
|
|
13315
13557
|
position: relative;
|
|
@@ -13588,21 +13830,21 @@ var BaseOrganizationSwitcher = ({
|
|
|
13588
13830
|
}) => {
|
|
13589
13831
|
const { theme, colorScheme, direction } = useTheme_default();
|
|
13590
13832
|
const styles = BaseOrganizationSwitcher_styles_default(theme, colorScheme);
|
|
13591
|
-
const [isOpen, setIsOpen] = (0,
|
|
13592
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
13833
|
+
const [isOpen, setIsOpen] = (0, import_react86.useState)(false);
|
|
13834
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react86.useState)(null);
|
|
13593
13835
|
const { t } = useTranslation_default();
|
|
13594
13836
|
const isRTL = direction === "rtl";
|
|
13595
|
-
const { refs, floatingStyles, context } = (0,
|
|
13596
|
-
middleware: [(0,
|
|
13837
|
+
const { refs, floatingStyles, context } = (0, import_react85.useFloating)({
|
|
13838
|
+
middleware: [(0, import_react85.offset)(5), (0, import_react85.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react85.shift)({ padding: 5 })],
|
|
13597
13839
|
onOpenChange: setIsOpen,
|
|
13598
13840
|
open: isOpen,
|
|
13599
13841
|
placement: "bottom-end",
|
|
13600
|
-
whileElementsMounted:
|
|
13842
|
+
whileElementsMounted: import_react85.autoUpdate
|
|
13601
13843
|
});
|
|
13602
|
-
const click = (0,
|
|
13603
|
-
const dismiss = (0,
|
|
13604
|
-
const role = (0,
|
|
13605
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
13844
|
+
const click = (0, import_react85.useClick)(context);
|
|
13845
|
+
const dismiss = (0, import_react85.useDismiss)(context);
|
|
13846
|
+
const role = (0, import_react85.useRole)(context);
|
|
13847
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react85.useInteractions)([click, dismiss, role]);
|
|
13606
13848
|
if (fallback && !currentOrganization && !loading && organizations.length === 0) {
|
|
13607
13849
|
return fallback;
|
|
13608
13850
|
}
|
|
@@ -13677,7 +13919,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
13677
13919
|
]
|
|
13678
13920
|
}
|
|
13679
13921
|
),
|
|
13680
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
13922
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react85.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react85.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
13681
13923
|
"div",
|
|
13682
13924
|
{
|
|
13683
13925
|
ref: refs.setFloating,
|
|
@@ -13836,7 +14078,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
13836
14078
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
13837
14079
|
|
|
13838
14080
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
13839
|
-
var
|
|
14081
|
+
var import_react99 = require("react");
|
|
13840
14082
|
|
|
13841
14083
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
13842
14084
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
@@ -13867,17 +14109,17 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
13867
14109
|
var BuildingAlt_default = BuildingAlt;
|
|
13868
14110
|
|
|
13869
14111
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
13870
|
-
var
|
|
14112
|
+
var import_react89 = require("react");
|
|
13871
14113
|
|
|
13872
14114
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
13873
|
-
var
|
|
14115
|
+
var import_browser78 = require("@asgardeo/browser");
|
|
13874
14116
|
var import_css57 = require("@emotion/css");
|
|
13875
|
-
var
|
|
14117
|
+
var import_react88 = require("react");
|
|
13876
14118
|
|
|
13877
14119
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.styles.ts
|
|
13878
14120
|
var import_css56 = require("@emotion/css");
|
|
13879
|
-
var
|
|
13880
|
-
var useStyles26 = (theme, colorScheme) => (0,
|
|
14121
|
+
var import_react87 = require("react");
|
|
14122
|
+
var useStyles26 = (theme, colorScheme) => (0, import_react87.useMemo)(() => {
|
|
13881
14123
|
const root = import_css56.css`
|
|
13882
14124
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
13883
14125
|
min-width: 600px;
|
|
@@ -14012,7 +14254,7 @@ var BaseCreateOrganization_styles_default = useStyles26;
|
|
|
14012
14254
|
|
|
14013
14255
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
14014
14256
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
14015
|
-
var logger8 = (0,
|
|
14257
|
+
var logger8 = (0, import_browser78.createPackageComponentLogger)(
|
|
14016
14258
|
"@asgardeo/react",
|
|
14017
14259
|
"BaseCreateOrganization"
|
|
14018
14260
|
);
|
|
@@ -14037,13 +14279,13 @@ var BaseCreateOrganization = ({
|
|
|
14037
14279
|
const { theme, colorScheme } = useTheme_default();
|
|
14038
14280
|
const styles = BaseCreateOrganization_styles_default(theme, colorScheme);
|
|
14039
14281
|
const { t } = useTranslation_default();
|
|
14040
|
-
const [formData, setFormData] = (0,
|
|
14282
|
+
const [formData, setFormData] = (0, import_react88.useState)({
|
|
14041
14283
|
description: "",
|
|
14042
14284
|
handle: "",
|
|
14043
14285
|
name: "",
|
|
14044
14286
|
...initialValues
|
|
14045
14287
|
});
|
|
14046
|
-
const [formErrors, setFormErrors] = (0,
|
|
14288
|
+
const [formErrors, setFormErrors] = (0, import_react88.useState)({});
|
|
14047
14289
|
const validateForm = () => {
|
|
14048
14290
|
const errors = {};
|
|
14049
14291
|
if (!formData.name.trim()) {
|
|
@@ -14164,8 +14406,8 @@ var BaseCreateOrganization = ({
|
|
|
14164
14406
|
};
|
|
14165
14407
|
|
|
14166
14408
|
// src/api/createOrganization.ts
|
|
14167
|
-
var
|
|
14168
|
-
var httpClient6 =
|
|
14409
|
+
var import_browser79 = require("@asgardeo/browser");
|
|
14410
|
+
var httpClient6 = import_browser79.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser79.AsgardeoSPAClient.getInstance());
|
|
14169
14411
|
var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
14170
14412
|
const defaultFetcher = async (url, config) => {
|
|
14171
14413
|
const response = await httpClient6({
|
|
@@ -14182,7 +14424,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
14182
14424
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
14183
14425
|
};
|
|
14184
14426
|
};
|
|
14185
|
-
return (0,
|
|
14427
|
+
return (0, import_browser79.createOrganization)({
|
|
14186
14428
|
...requestConfig,
|
|
14187
14429
|
fetcher: fetcher || defaultFetcher
|
|
14188
14430
|
});
|
|
@@ -14200,8 +14442,8 @@ var CreateOrganization = ({
|
|
|
14200
14442
|
}) => {
|
|
14201
14443
|
const { isSignedIn, baseUrl } = useAsgardeo_default();
|
|
14202
14444
|
const { currentOrganization, revalidateMyOrganizations } = useOrganization_default();
|
|
14203
|
-
const [loading, setLoading] = (0,
|
|
14204
|
-
const [error, setError] = (0,
|
|
14445
|
+
const [loading, setLoading] = (0, import_react89.useState)(false);
|
|
14446
|
+
const [error, setError] = (0, import_react89.useState)(null);
|
|
14205
14447
|
if (!isSignedIn && fallback) {
|
|
14206
14448
|
return fallback;
|
|
14207
14449
|
}
|
|
@@ -14255,16 +14497,16 @@ var CreateOrganization = ({
|
|
|
14255
14497
|
|
|
14256
14498
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
14257
14499
|
var import_css61 = require("@emotion/css");
|
|
14258
|
-
var
|
|
14500
|
+
var import_react93 = require("react");
|
|
14259
14501
|
|
|
14260
14502
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
14261
14503
|
var import_css59 = require("@emotion/css");
|
|
14262
|
-
var
|
|
14504
|
+
var import_react91 = require("react");
|
|
14263
14505
|
|
|
14264
14506
|
// src/components/presentation/OrganizationList/BaseOrganizationList.styles.ts
|
|
14265
14507
|
var import_css58 = require("@emotion/css");
|
|
14266
|
-
var
|
|
14267
|
-
var useStyles27 = (theme, colorScheme) => (0,
|
|
14508
|
+
var import_react90 = require("react");
|
|
14509
|
+
var useStyles27 = (theme, colorScheme) => (0, import_react90.useMemo)(() => {
|
|
14268
14510
|
const root = import_css58.css`
|
|
14269
14511
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
14270
14512
|
min-width: 600px;
|
|
@@ -14562,7 +14804,7 @@ var BaseOrganizationList = ({
|
|
|
14562
14804
|
const { theme, colorScheme } = useTheme_default();
|
|
14563
14805
|
const styles = BaseOrganizationList_styles_default(theme, colorScheme);
|
|
14564
14806
|
const { t } = useTranslation_default();
|
|
14565
|
-
const organizationsWithSwitchAccess = (0,
|
|
14807
|
+
const organizationsWithSwitchAccess = (0, import_react91.useMemo)(() => {
|
|
14566
14808
|
if (!allOrganizations?.organizations) {
|
|
14567
14809
|
return [];
|
|
14568
14810
|
}
|
|
@@ -14643,8 +14885,8 @@ var BaseOrganizationList_default = BaseOrganizationList;
|
|
|
14643
14885
|
|
|
14644
14886
|
// src/components/presentation/OrganizationList/OrganizationList.styles.ts
|
|
14645
14887
|
var import_css60 = require("@emotion/css");
|
|
14646
|
-
var
|
|
14647
|
-
var useStyles28 = (theme, colorScheme) => (0,
|
|
14888
|
+
var import_react92 = require("react");
|
|
14889
|
+
var useStyles28 = (theme, colorScheme) => (0, import_react92.useMemo)(() => {
|
|
14648
14890
|
const cssOrganizationListWrapper = import_css60.css`
|
|
14649
14891
|
/* Container wrapper styles for OrganizationList component */
|
|
14650
14892
|
width: 100%;
|
|
@@ -14710,10 +14952,10 @@ var OrganizationList = (props) => {
|
|
|
14710
14952
|
const { theme, colorScheme } = useTheme_default();
|
|
14711
14953
|
const styles = OrganizationList_styles_default(theme, colorScheme);
|
|
14712
14954
|
const { getAllOrganizations: getAllOrganizations2, error, isLoading, myOrganizations } = useOrganization_default();
|
|
14713
|
-
const [allOrganizations, setAllOrganizations] = (0,
|
|
14955
|
+
const [allOrganizations, setAllOrganizations] = (0, import_react93.useState)({
|
|
14714
14956
|
organizations: []
|
|
14715
14957
|
});
|
|
14716
|
-
(0,
|
|
14958
|
+
(0, import_react93.useEffect)(() => {
|
|
14717
14959
|
(async () => {
|
|
14718
14960
|
setAllOrganizations(await getAllOrganizations2());
|
|
14719
14961
|
})();
|
|
@@ -14733,18 +14975,18 @@ var OrganizationList = (props) => {
|
|
|
14733
14975
|
var OrganizationList_default = OrganizationList;
|
|
14734
14976
|
|
|
14735
14977
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
14736
|
-
var
|
|
14737
|
-
var
|
|
14978
|
+
var import_browser84 = require("@asgardeo/browser");
|
|
14979
|
+
var import_react98 = require("react");
|
|
14738
14980
|
|
|
14739
14981
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
14740
|
-
var
|
|
14982
|
+
var import_browser81 = require("@asgardeo/browser");
|
|
14741
14983
|
var import_css65 = require("@emotion/css");
|
|
14742
|
-
var
|
|
14984
|
+
var import_react97 = require("react");
|
|
14743
14985
|
|
|
14744
14986
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.ts
|
|
14745
14987
|
var import_css62 = require("@emotion/css");
|
|
14746
|
-
var
|
|
14747
|
-
var useStyles29 = (theme, colorScheme) => (0,
|
|
14988
|
+
var import_react94 = require("react");
|
|
14989
|
+
var useStyles29 = (theme, colorScheme) => (0, import_react94.useMemo)(
|
|
14748
14990
|
() => ({
|
|
14749
14991
|
attributeItem: import_css62.css`
|
|
14750
14992
|
display: flex;
|
|
@@ -14897,14 +15139,14 @@ var useStyles29 = (theme, colorScheme) => (0, import_react92.useMemo)(
|
|
|
14897
15139
|
var BaseOrganizationProfile_styles_default = useStyles29;
|
|
14898
15140
|
|
|
14899
15141
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
14900
|
-
var
|
|
15142
|
+
var import_browser80 = require("@asgardeo/browser");
|
|
14901
15143
|
var import_css64 = require("@emotion/css");
|
|
14902
|
-
var
|
|
15144
|
+
var import_react96 = require("react");
|
|
14903
15145
|
|
|
14904
15146
|
// src/components/primitives/KeyValueInput/KeyValueInput.styles.ts
|
|
14905
15147
|
var import_css63 = require("@emotion/css");
|
|
14906
|
-
var
|
|
14907
|
-
var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0,
|
|
15148
|
+
var import_react95 = require("react");
|
|
15149
|
+
var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0, import_react95.useMemo)(() => {
|
|
14908
15150
|
const container = import_css63.css`
|
|
14909
15151
|
display: flex;
|
|
14910
15152
|
flex-direction: column;
|
|
@@ -15078,10 +15320,10 @@ var KeyValueInput = ({
|
|
|
15078
15320
|
const { theme, colorScheme } = useTheme_default();
|
|
15079
15321
|
const styles = KeyValueInput_styles_default(theme, colorScheme, disabled, readOnly, !!error);
|
|
15080
15322
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
15081
|
-
const [pairs, setPairs] = (0,
|
|
15082
|
-
const [newKey, setNewKey] = (0,
|
|
15083
|
-
const [newValue, setNewValue] = (0,
|
|
15084
|
-
const handleAddPair = (0,
|
|
15323
|
+
const [pairs, setPairs] = (0, import_react96.useState)(initialPairs);
|
|
15324
|
+
const [newKey, setNewKey] = (0, import_react96.useState)("");
|
|
15325
|
+
const [newValue, setNewValue] = (0, import_react96.useState)("");
|
|
15326
|
+
const handleAddPair = (0, import_react96.useCallback)(() => {
|
|
15085
15327
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
15086
15328
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
15087
15329
|
const newPair = {
|
|
@@ -15099,7 +15341,7 @@ var KeyValueInput = ({
|
|
|
15099
15341
|
onAdd(newPair);
|
|
15100
15342
|
}
|
|
15101
15343
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
15102
|
-
const handleRemovePair = (0,
|
|
15344
|
+
const handleRemovePair = (0, import_react96.useCallback)(
|
|
15103
15345
|
(index) => {
|
|
15104
15346
|
const pairToRemove = pairs[index];
|
|
15105
15347
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -15113,7 +15355,7 @@ var KeyValueInput = ({
|
|
|
15113
15355
|
},
|
|
15114
15356
|
[pairs, onChange, onRemove]
|
|
15115
15357
|
);
|
|
15116
|
-
const handleUpdatePair = (0,
|
|
15358
|
+
const handleUpdatePair = (0, import_react96.useCallback)(
|
|
15117
15359
|
(index, field, newVal) => {
|
|
15118
15360
|
const updatedPairs = pairs.map((pair, i) => {
|
|
15119
15361
|
if (i === index) {
|
|
@@ -15132,21 +15374,21 @@ var KeyValueInput = ({
|
|
|
15132
15374
|
const isAddDisabled = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();
|
|
15133
15375
|
const renderReadOnlyContent = () => {
|
|
15134
15376
|
if (pairs.length === 0) {
|
|
15135
|
-
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: (0, import_css64.cx)((0,
|
|
15377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "empty-state")), styles["emptyState"]), children: "No attributes defined" });
|
|
15136
15378
|
}
|
|
15137
15379
|
return pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
15138
15380
|
"div",
|
|
15139
15381
|
{
|
|
15140
|
-
className: (0, import_css64.cx)((0,
|
|
15382
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "readonly-pair")), styles["readOnlyPair"]),
|
|
15141
15383
|
children: [
|
|
15142
|
-
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("span", { className: (0, import_css64.cx)((0,
|
|
15384
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("span", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "readonly-key")), styles["readOnlyKey"]), children: [
|
|
15143
15385
|
pair.key,
|
|
15144
15386
|
":"
|
|
15145
15387
|
] }),
|
|
15146
15388
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15147
15389
|
"span",
|
|
15148
15390
|
{
|
|
15149
|
-
className: (0, import_css64.cx)((0,
|
|
15391
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "readonly-value")), styles["readOnlyValue"]),
|
|
15150
15392
|
children: pair.value
|
|
15151
15393
|
}
|
|
15152
15394
|
)
|
|
@@ -15155,22 +15397,22 @@ var KeyValueInput = ({
|
|
|
15155
15397
|
`${pair.key}-${index}`
|
|
15156
15398
|
));
|
|
15157
15399
|
};
|
|
15158
|
-
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0,
|
|
15159
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("label", { className: (0, import_css64.cx)((0,
|
|
15400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input")), styles["container"], className), children: [
|
|
15401
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("label", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "label")), styles["label"]), children: [
|
|
15160
15402
|
label,
|
|
15161
15403
|
required && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15162
15404
|
"span",
|
|
15163
15405
|
{
|
|
15164
|
-
className: (0, import_css64.cx)((0,
|
|
15406
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "required")), styles["requiredIndicator"]),
|
|
15165
15407
|
children: " *"
|
|
15166
15408
|
}
|
|
15167
15409
|
)
|
|
15168
15410
|
] }),
|
|
15169
|
-
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0,
|
|
15411
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "pairs-list")), styles["pairsList"]), children: [
|
|
15170
15412
|
readOnly ? renderReadOnlyContent() : pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
15171
15413
|
"div",
|
|
15172
15414
|
{
|
|
15173
|
-
className: (0, import_css64.cx)((0,
|
|
15415
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "pair-row")), styles["pairRow"]),
|
|
15174
15416
|
children: [
|
|
15175
15417
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15176
15418
|
TextField_default,
|
|
@@ -15179,7 +15421,7 @@ var KeyValueInput = ({
|
|
|
15179
15421
|
value: pair.key,
|
|
15180
15422
|
onChange: (e) => handleUpdatePair(index, "key", e.target.value),
|
|
15181
15423
|
disabled: disabled || readOnly,
|
|
15182
|
-
className: (0, import_css64.cx)((0,
|
|
15424
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "pair-input")), styles["pairInput"]),
|
|
15183
15425
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
15184
15426
|
}
|
|
15185
15427
|
),
|
|
@@ -15190,7 +15432,7 @@ var KeyValueInput = ({
|
|
|
15190
15432
|
value: pair.value,
|
|
15191
15433
|
onChange: (e) => handleUpdatePair(index, "value", e.target.value),
|
|
15192
15434
|
disabled: disabled || readOnly,
|
|
15193
|
-
className: (0, import_css64.cx)((0,
|
|
15435
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "pair-input")), styles["pairInput"]),
|
|
15194
15436
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
15195
15437
|
}
|
|
15196
15438
|
),
|
|
@@ -15201,7 +15443,7 @@ var KeyValueInput = ({
|
|
|
15201
15443
|
onClick: () => handleRemovePair(index),
|
|
15202
15444
|
disabled,
|
|
15203
15445
|
className: (0, import_css64.cx)(
|
|
15204
|
-
(0,
|
|
15446
|
+
(0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "remove-button")),
|
|
15205
15447
|
styles["removeButton"]
|
|
15206
15448
|
),
|
|
15207
15449
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
@@ -15212,7 +15454,7 @@ var KeyValueInput = ({
|
|
|
15212
15454
|
},
|
|
15213
15455
|
`${pair.key}-${index}`
|
|
15214
15456
|
)),
|
|
15215
|
-
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0,
|
|
15457
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "add-row")), styles["addRow"]), children: [
|
|
15216
15458
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15217
15459
|
TextField_default,
|
|
15218
15460
|
{
|
|
@@ -15220,7 +15462,7 @@ var KeyValueInput = ({
|
|
|
15220
15462
|
value: newKey,
|
|
15221
15463
|
onChange: (e) => setNewKey(e.target.value),
|
|
15222
15464
|
disabled,
|
|
15223
|
-
className: (0, import_css64.cx)((0,
|
|
15465
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "pair-input")), styles["pairInput"]),
|
|
15224
15466
|
"aria-label": "New key"
|
|
15225
15467
|
}
|
|
15226
15468
|
),
|
|
@@ -15231,7 +15473,7 @@ var KeyValueInput = ({
|
|
|
15231
15473
|
value: newValue,
|
|
15232
15474
|
onChange: (e) => setNewValue(e.target.value),
|
|
15233
15475
|
disabled,
|
|
15234
|
-
className: (0, import_css64.cx)((0,
|
|
15476
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "pair-input")), styles["pairInput"]),
|
|
15235
15477
|
"aria-label": "New value",
|
|
15236
15478
|
onKeyPress: (e) => {
|
|
15237
15479
|
if (e.key === "Enter" && !isAddDisabled) {
|
|
@@ -15246,15 +15488,15 @@ var KeyValueInput = ({
|
|
|
15246
15488
|
type: "button",
|
|
15247
15489
|
onClick: handleAddPair,
|
|
15248
15490
|
disabled: isAddDisabled,
|
|
15249
|
-
className: (0, import_css64.cx)((0,
|
|
15491
|
+
className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "add-button")), styles["addButton"]),
|
|
15250
15492
|
"aria-label": "Add new key-value pair",
|
|
15251
15493
|
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Plus_default, { width: 16, height: 16 })
|
|
15252
15494
|
}
|
|
15253
15495
|
)
|
|
15254
15496
|
] })
|
|
15255
15497
|
] }),
|
|
15256
|
-
(helperText || error) && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: (0, import_css64.cx)((0,
|
|
15257
|
-
maxPairs && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0,
|
|
15498
|
+
(helperText || error) && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "helper-text")), styles["helperText"]), children: error || helperText }),
|
|
15499
|
+
maxPairs && /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: (0, import_css64.cx)((0, import_browser80.withVendorCSSClassPrefix)((0, import_browser80.bem)("key-value-input", "counter")), styles["counterText"]), children: [
|
|
15258
15500
|
pairs.length,
|
|
15259
15501
|
" of ",
|
|
15260
15502
|
maxPairs,
|
|
@@ -15300,20 +15542,20 @@ var BaseOrganizationProfile = ({
|
|
|
15300
15542
|
editable: false,
|
|
15301
15543
|
key: "created",
|
|
15302
15544
|
label: "Created Date",
|
|
15303
|
-
render: (value) => (0,
|
|
15545
|
+
render: (value) => (0, import_browser81.formatDate)(value)
|
|
15304
15546
|
},
|
|
15305
15547
|
{
|
|
15306
15548
|
editable: false,
|
|
15307
15549
|
key: "lastModified",
|
|
15308
15550
|
label: "Last Modified Date",
|
|
15309
|
-
render: (value) => (0,
|
|
15551
|
+
render: (value) => (0, import_browser81.formatDate)(value)
|
|
15310
15552
|
}
|
|
15311
15553
|
]
|
|
15312
15554
|
}) => {
|
|
15313
15555
|
const { theme, colorScheme } = useTheme_default();
|
|
15314
15556
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
15315
|
-
const [editedOrganization, setEditedOrganization] = (0,
|
|
15316
|
-
const [editingFields, setEditingFields] = (0,
|
|
15557
|
+
const [editedOrganization, setEditedOrganization] = (0, import_react97.useState)(organization);
|
|
15558
|
+
const [editingFields, setEditingFields] = (0, import_react97.useState)({});
|
|
15317
15559
|
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
15318
15560
|
"svg",
|
|
15319
15561
|
{
|
|
@@ -15328,13 +15570,13 @@ var BaseOrganizationProfile = ({
|
|
|
15328
15570
|
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
15329
15571
|
}
|
|
15330
15572
|
);
|
|
15331
|
-
const toggleFieldEdit = (0,
|
|
15573
|
+
const toggleFieldEdit = (0, import_react97.useCallback)((fieldName) => {
|
|
15332
15574
|
setEditingFields((prev) => ({
|
|
15333
15575
|
...prev,
|
|
15334
15576
|
[fieldName]: !prev[fieldName]
|
|
15335
15577
|
}));
|
|
15336
15578
|
}, []);
|
|
15337
|
-
const getFieldPlaceholder = (0,
|
|
15579
|
+
const getFieldPlaceholder = (0, import_react97.useCallback)((fieldKey) => {
|
|
15338
15580
|
const fieldLabels = {
|
|
15339
15581
|
description: "organization description",
|
|
15340
15582
|
name: "organization name",
|
|
@@ -15345,7 +15587,7 @@ var BaseOrganizationProfile = ({
|
|
|
15345
15587
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
15346
15588
|
return `Enter ${fieldLabel}`;
|
|
15347
15589
|
}, []);
|
|
15348
|
-
const handleFieldSave = (0,
|
|
15590
|
+
const handleFieldSave = (0, import_react97.useCallback)(
|
|
15349
15591
|
(fieldKey) => {
|
|
15350
15592
|
if (!onUpdate || !fieldKey) return;
|
|
15351
15593
|
let fieldValue;
|
|
@@ -15364,7 +15606,7 @@ var BaseOrganizationProfile = ({
|
|
|
15364
15606
|
},
|
|
15365
15607
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
15366
15608
|
);
|
|
15367
|
-
const handleFieldCancel = (0,
|
|
15609
|
+
const handleFieldCancel = (0, import_react97.useCallback)(
|
|
15368
15610
|
(fieldKey) => {
|
|
15369
15611
|
setEditedOrganization((prev) => ({
|
|
15370
15612
|
...prev,
|
|
@@ -15550,8 +15792,8 @@ var BaseOrganizationProfile = ({
|
|
|
15550
15792
|
var BaseOrganizationProfile_default = BaseOrganizationProfile;
|
|
15551
15793
|
|
|
15552
15794
|
// src/api/getOrganization.ts
|
|
15553
|
-
var
|
|
15554
|
-
var httpClient7 =
|
|
15795
|
+
var import_browser82 = require("@asgardeo/browser");
|
|
15796
|
+
var httpClient7 = import_browser82.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser82.AsgardeoSPAClient.getInstance());
|
|
15555
15797
|
var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
15556
15798
|
const defaultFetcher = async (url, config) => {
|
|
15557
15799
|
const response = await httpClient7({
|
|
@@ -15567,7 +15809,7 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
15567
15809
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
15568
15810
|
};
|
|
15569
15811
|
};
|
|
15570
|
-
return (0,
|
|
15812
|
+
return (0, import_browser82.getOrganization)({
|
|
15571
15813
|
...requestConfig,
|
|
15572
15814
|
fetcher: fetcher || defaultFetcher
|
|
15573
15815
|
});
|
|
@@ -15575,8 +15817,8 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
15575
15817
|
var getOrganization_default = getOrganization;
|
|
15576
15818
|
|
|
15577
15819
|
// src/api/updateOrganization.ts
|
|
15578
|
-
var
|
|
15579
|
-
var httpClient8 =
|
|
15820
|
+
var import_browser83 = require("@asgardeo/browser");
|
|
15821
|
+
var httpClient8 = import_browser83.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser83.AsgardeoSPAClient.getInstance());
|
|
15580
15822
|
var updateOrganization = async ({
|
|
15581
15823
|
fetcher,
|
|
15582
15824
|
...requestConfig
|
|
@@ -15596,7 +15838,7 @@ var updateOrganization = async ({
|
|
|
15596
15838
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
15597
15839
|
};
|
|
15598
15840
|
};
|
|
15599
|
-
return (0,
|
|
15841
|
+
return (0, import_browser83.updateOrganization)({
|
|
15600
15842
|
...requestConfig,
|
|
15601
15843
|
fetcher: fetcher || defaultFetcher
|
|
15602
15844
|
});
|
|
@@ -15605,7 +15847,7 @@ var updateOrganization_default = updateOrganization;
|
|
|
15605
15847
|
|
|
15606
15848
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
15607
15849
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
15608
|
-
var logger9 = (0,
|
|
15850
|
+
var logger9 = (0, import_browser84.createPackageComponentLogger)(
|
|
15609
15851
|
"@asgardeo/react",
|
|
15610
15852
|
"OrganizationProfile"
|
|
15611
15853
|
);
|
|
@@ -15622,7 +15864,7 @@ var OrganizationProfile = ({
|
|
|
15622
15864
|
}) => {
|
|
15623
15865
|
const { baseUrl } = useAsgardeo_default();
|
|
15624
15866
|
const { t } = useTranslation_default();
|
|
15625
|
-
const [organization, setOrganization] = (0,
|
|
15867
|
+
const [organization, setOrganization] = (0, import_react98.useState)(null);
|
|
15626
15868
|
const fetchOrganization = async () => {
|
|
15627
15869
|
if (!baseUrl || !organizationId) {
|
|
15628
15870
|
return;
|
|
@@ -15638,13 +15880,13 @@ var OrganizationProfile = ({
|
|
|
15638
15880
|
setOrganization(null);
|
|
15639
15881
|
}
|
|
15640
15882
|
};
|
|
15641
|
-
(0,
|
|
15883
|
+
(0, import_react98.useEffect)(() => {
|
|
15642
15884
|
fetchOrganization();
|
|
15643
15885
|
}, [baseUrl, organizationId]);
|
|
15644
15886
|
const handleOrganizationUpdate = async (payload) => {
|
|
15645
15887
|
if (!baseUrl || !organizationId) return;
|
|
15646
15888
|
try {
|
|
15647
|
-
const operations = (0,
|
|
15889
|
+
const operations = (0, import_browser83.createPatchOperations)(payload);
|
|
15648
15890
|
await updateOrganization_default({
|
|
15649
15891
|
baseUrl,
|
|
15650
15892
|
operations,
|
|
@@ -15691,9 +15933,9 @@ var OrganizationSwitcher = ({
|
|
|
15691
15933
|
isLoading,
|
|
15692
15934
|
error
|
|
15693
15935
|
} = useOrganization_default();
|
|
15694
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0,
|
|
15695
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
15696
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0,
|
|
15936
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0, import_react99.useState)(false);
|
|
15937
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react99.useState)(false);
|
|
15938
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0, import_react99.useState)(false);
|
|
15697
15939
|
const { t } = useTranslation_default();
|
|
15698
15940
|
if (!isSignedIn && fallback) {
|
|
15699
15941
|
return fallback;
|
|
@@ -15784,5 +16026,5 @@ var OrganizationSwitcher = ({
|
|
|
15784
16026
|
var OrganizationSwitcher_default = OrganizationSwitcher;
|
|
15785
16027
|
|
|
15786
16028
|
// src/index.ts
|
|
15787
|
-
var
|
|
16029
|
+
var import_browser85 = require("@asgardeo/browser");
|
|
15788
16030
|
//# sourceMappingURL=index.js.map
|