@asgardeo/react 0.22.3 → 0.22.5
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/AsgardeoReactClient.d.ts +1 -0
- package/dist/cjs/index.js +187 -35
- package/dist/cjs/index.js.map +2 -2
- package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +1 -0
- package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts +1 -0
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +4 -0
- package/dist/index.js +193 -37
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
|
@@ -79,6 +79,7 @@ declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactC
|
|
|
79
79
|
getAccessToken(sessionId?: string): Promise<string>;
|
|
80
80
|
clearSession(sessionId?: string): void;
|
|
81
81
|
setSession(sessionData: Record<string, unknown>, sessionId?: string): Promise<void>;
|
|
82
|
+
getStorageManager(): Promise<any>;
|
|
82
83
|
decodeJwtToken<TResult = Record<string, unknown>>(token: string): Promise<TResult>;
|
|
83
84
|
}
|
|
84
85
|
export default AsgardeoReactClient;
|
package/dist/cjs/index.js
CHANGED
|
@@ -193,6 +193,7 @@ var AsgardeoContext = (0, import_react.createContext)({
|
|
|
193
193
|
getAccessToken: null,
|
|
194
194
|
getDecodedIdToken: null,
|
|
195
195
|
getIdToken: null,
|
|
196
|
+
getStorageManager: () => Promise.resolve(null),
|
|
196
197
|
http: {
|
|
197
198
|
request: () => null,
|
|
198
199
|
requestAll: () => null
|
|
@@ -1052,6 +1053,9 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
|
|
|
1052
1053
|
async setSession(sessionData, sessionId) {
|
|
1053
1054
|
return (await this.asgardeo.getStorageManager()).setSessionData(sessionData, sessionId);
|
|
1054
1055
|
}
|
|
1056
|
+
async getStorageManager() {
|
|
1057
|
+
return this.asgardeo.getStorageManager();
|
|
1058
|
+
}
|
|
1055
1059
|
decodeJwtToken(token) {
|
|
1056
1060
|
return this.asgardeo.decodeJwtToken(token);
|
|
1057
1061
|
}
|
|
@@ -1318,7 +1322,7 @@ var FlowMetaProvider = ({
|
|
|
1318
1322
|
children,
|
|
1319
1323
|
enabled = true
|
|
1320
1324
|
}) => {
|
|
1321
|
-
const { baseUrl, applicationId, platform } = useAsgardeo_default();
|
|
1325
|
+
const { baseUrl, applicationId, platform, isInitialized } = useAsgardeo_default();
|
|
1322
1326
|
const i18nContext = useI18n_default();
|
|
1323
1327
|
const [meta, setMeta] = (0, import_react10.useState)(null);
|
|
1324
1328
|
const [isLoading, setIsLoading] = (0, import_react10.useState)(true);
|
|
@@ -1331,7 +1335,7 @@ var FlowMetaProvider = ({
|
|
|
1331
1335
|
setIsLoading(false);
|
|
1332
1336
|
return;
|
|
1333
1337
|
}
|
|
1334
|
-
if (!applicationId) {
|
|
1338
|
+
if (!isInitialized && !applicationId) {
|
|
1335
1339
|
return;
|
|
1336
1340
|
}
|
|
1337
1341
|
setIsLoading(true);
|
|
@@ -1348,7 +1352,7 @@ var FlowMetaProvider = ({
|
|
|
1348
1352
|
} finally {
|
|
1349
1353
|
setIsLoading(false);
|
|
1350
1354
|
}
|
|
1351
|
-
}, [enabled, platform, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1355
|
+
}, [enabled, platform, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);
|
|
1352
1356
|
const switchLanguage = (0, import_react10.useCallback)(
|
|
1353
1357
|
async (language) => {
|
|
1354
1358
|
if (!enabled || platform !== import_browser10.Platform.AsgardeoV2) return;
|
|
@@ -2154,6 +2158,7 @@ var AsgardeoProvider = ({
|
|
|
2154
2158
|
}) => {
|
|
2155
2159
|
const reRenderCheckRef = (0, import_react20.useRef)(false);
|
|
2156
2160
|
const asgardeo = (0, import_react20.useMemo)(() => new AsgardeoReactClient_default(instanceId), [instanceId]);
|
|
2161
|
+
const storageManagerRef = (0, import_react20.useRef)(null);
|
|
2157
2162
|
const { hasAuthParams, hasCalledForThisInstance } = useBrowserUrl_default();
|
|
2158
2163
|
const [user, setUser] = (0, import_react20.useState)(null);
|
|
2159
2164
|
const [currentOrganization, setCurrentOrganization] = (0, import_react20.useState)(null);
|
|
@@ -2502,6 +2507,13 @@ var AsgardeoProvider = ({
|
|
|
2502
2507
|
async () => asgardeo.getAccessToken(),
|
|
2503
2508
|
[asgardeo]
|
|
2504
2509
|
);
|
|
2510
|
+
const getStorageManager = (0, import_react20.useCallback)(async () => {
|
|
2511
|
+
const storageManager = storageManagerRef.current ?? await asgardeo.getStorageManager();
|
|
2512
|
+
if (storageManager) {
|
|
2513
|
+
storageManagerRef.current = storageManager;
|
|
2514
|
+
}
|
|
2515
|
+
return storageManager;
|
|
2516
|
+
}, [asgardeo]);
|
|
2505
2517
|
const request = (0, import_react20.useCallback)(
|
|
2506
2518
|
async (...args) => asgardeo.request(...args),
|
|
2507
2519
|
[asgardeo]
|
|
@@ -2544,6 +2556,7 @@ var AsgardeoProvider = ({
|
|
|
2544
2556
|
getAccessToken,
|
|
2545
2557
|
getDecodedIdToken,
|
|
2546
2558
|
getIdToken,
|
|
2559
|
+
getStorageManager,
|
|
2547
2560
|
http: {
|
|
2548
2561
|
request,
|
|
2549
2562
|
requestAll
|
|
@@ -2590,6 +2603,7 @@ var AsgardeoProvider = ({
|
|
|
2590
2603
|
switchOrganization,
|
|
2591
2604
|
getDecodedIdToken,
|
|
2592
2605
|
getAccessToken,
|
|
2606
|
+
getStorageManager,
|
|
2593
2607
|
request,
|
|
2594
2608
|
requestAll,
|
|
2595
2609
|
exchangeToken,
|
|
@@ -9858,11 +9872,13 @@ var SignIn = ({
|
|
|
9858
9872
|
variant,
|
|
9859
9873
|
children
|
|
9860
9874
|
}) => {
|
|
9861
|
-
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading, meta } = useAsgardeo_default();
|
|
9875
|
+
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading, meta, getStorageManager } = useAsgardeo_default();
|
|
9862
9876
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
9863
9877
|
const [components, setComponents] = (0, import_react72.useState)([]);
|
|
9864
9878
|
const [additionalData, setAdditionalData] = (0, import_react72.useState)({});
|
|
9865
9879
|
const [currentExecutionId, setCurrentExecutionId] = (0, import_react72.useState)(null);
|
|
9880
|
+
const challengeTokenRef = (0, import_react72.useRef)(null);
|
|
9881
|
+
const [isStorageReady, setIsStorageReady] = (0, import_react72.useState)(false);
|
|
9866
9882
|
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react72.useState)(false);
|
|
9867
9883
|
const [flowError, setFlowError] = (0, import_react72.useState)(null);
|
|
9868
9884
|
const [isSubmitting, setIsSubmitting] = (0, import_react72.useState)(false);
|
|
@@ -9886,8 +9902,38 @@ var SignIn = ({
|
|
|
9886
9902
|
sessionStorage.removeItem("asgardeo_execution_id");
|
|
9887
9903
|
}
|
|
9888
9904
|
};
|
|
9889
|
-
|
|
9905
|
+
(0, import_react72.useEffect)(() => {
|
|
9906
|
+
if (!isInitialized) return;
|
|
9907
|
+
(async () => {
|
|
9908
|
+
try {
|
|
9909
|
+
const storageManager = await getStorageManager();
|
|
9910
|
+
const tempData = await storageManager?.getTemporaryData();
|
|
9911
|
+
if (tempData?.challengeToken) {
|
|
9912
|
+
challengeTokenRef.current = tempData.challengeToken;
|
|
9913
|
+
}
|
|
9914
|
+
} finally {
|
|
9915
|
+
setIsStorageReady(true);
|
|
9916
|
+
}
|
|
9917
|
+
})();
|
|
9918
|
+
}, [isInitialized]);
|
|
9919
|
+
const setChallengeToken = async (challengeToken) => {
|
|
9920
|
+
challengeTokenRef.current = challengeToken;
|
|
9921
|
+
try {
|
|
9922
|
+
const storageManager = await getStorageManager();
|
|
9923
|
+
if (storageManager) {
|
|
9924
|
+
if (challengeToken) {
|
|
9925
|
+
await storageManager.setTemporaryDataParameter("challengeToken", challengeToken);
|
|
9926
|
+
} else {
|
|
9927
|
+
await storageManager.removeTemporaryDataParameter("challengeToken");
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9930
|
+
} catch {
|
|
9931
|
+
import_browser58.logger.warn("Failed to persist challenge token in storage.");
|
|
9932
|
+
}
|
|
9933
|
+
};
|
|
9934
|
+
const clearFlowState = async () => {
|
|
9890
9935
|
setExecutionId(null);
|
|
9936
|
+
await setChallengeToken(null);
|
|
9891
9937
|
setIsFlowInitialized(false);
|
|
9892
9938
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
9893
9939
|
setIsTimeoutDisabled(false);
|
|
@@ -9943,13 +9989,14 @@ var SignIn = ({
|
|
|
9943
9989
|
setError(err);
|
|
9944
9990
|
cleanupOAuthUrlParams(true);
|
|
9945
9991
|
};
|
|
9946
|
-
const handleRedirection = (response) => {
|
|
9992
|
+
const handleRedirection = async (response) => {
|
|
9947
9993
|
if (response.type === import_browser58.EmbeddedSignInFlowTypeV2.Redirection) {
|
|
9948
9994
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
9949
9995
|
if (redirectURL && window?.location) {
|
|
9950
9996
|
if (response.executionId) {
|
|
9951
9997
|
setExecutionId(response.executionId);
|
|
9952
9998
|
}
|
|
9999
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
9953
10000
|
const urlParams = getUrlParams2();
|
|
9954
10001
|
handleAuthId(urlParams.authId);
|
|
9955
10002
|
initiateOAuthRedirect(redirectURL);
|
|
@@ -9985,7 +10032,7 @@ var SignIn = ({
|
|
|
9985
10032
|
flowType: import_browser58.EmbeddedFlowType.Authentication
|
|
9986
10033
|
});
|
|
9987
10034
|
}
|
|
9988
|
-
if (handleRedirection(response)) {
|
|
10035
|
+
if (await handleRedirection(response)) {
|
|
9989
10036
|
return;
|
|
9990
10037
|
}
|
|
9991
10038
|
const {
|
|
@@ -10000,6 +10047,7 @@ var SignIn = ({
|
|
|
10000
10047
|
},
|
|
10001
10048
|
meta
|
|
10002
10049
|
);
|
|
10050
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
10003
10051
|
if (normalizedExecutionId && normalizedComponents) {
|
|
10004
10052
|
setExecutionId(normalizedExecutionId);
|
|
10005
10053
|
setComponents(normalizedComponents);
|
|
@@ -10010,7 +10058,7 @@ var SignIn = ({
|
|
|
10010
10058
|
}
|
|
10011
10059
|
} catch (error) {
|
|
10012
10060
|
const err = error;
|
|
10013
|
-
clearFlowState();
|
|
10061
|
+
await clearFlowState();
|
|
10014
10062
|
const errorMessage = err?.failureReason || (err instanceof Error ? err.message : String(err));
|
|
10015
10063
|
setError(new Error(errorMessage));
|
|
10016
10064
|
initializationAttemptedRef.current = false;
|
|
@@ -10113,15 +10161,17 @@ var SignIn = ({
|
|
|
10113
10161
|
const response = await signIn({
|
|
10114
10162
|
executionId: effectiveExecutionId,
|
|
10115
10163
|
...payload,
|
|
10116
|
-
inputs: processedInputs
|
|
10164
|
+
inputs: processedInputs,
|
|
10165
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {}
|
|
10117
10166
|
});
|
|
10118
|
-
if (handleRedirection(response)) {
|
|
10167
|
+
if (await handleRedirection(response)) {
|
|
10119
10168
|
return;
|
|
10120
10169
|
}
|
|
10121
10170
|
if (response.data?.additionalData?.["passkeyChallenge"] || response.data?.additionalData?.["passkeyCreationOptions"]) {
|
|
10122
10171
|
const { passkeyChallenge, passkeyCreationOptions } = response.data.additionalData;
|
|
10123
10172
|
const effectiveExecutionIdForPasskey = response.executionId || effectiveExecutionId;
|
|
10124
10173
|
passkeyProcessedRef.current = false;
|
|
10174
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
10125
10175
|
setPasskeyState({
|
|
10126
10176
|
actionId: "submit",
|
|
10127
10177
|
challenge: passkeyChallenge,
|
|
@@ -10146,7 +10196,7 @@ var SignIn = ({
|
|
|
10146
10196
|
meta
|
|
10147
10197
|
);
|
|
10148
10198
|
if (response.flowStatus === import_browser58.EmbeddedSignInFlowStatusV2.Error) {
|
|
10149
|
-
clearFlowState();
|
|
10199
|
+
await clearFlowState();
|
|
10150
10200
|
const failureReason = response?.failureReason;
|
|
10151
10201
|
const errorMessage = failureReason || "Authentication flow failed. Please try again.";
|
|
10152
10202
|
const err = new Error(errorMessage);
|
|
@@ -10159,6 +10209,7 @@ var SignIn = ({
|
|
|
10159
10209
|
const finalRedirectUrl = redirectUrl || afterSignInUrl;
|
|
10160
10210
|
setIsSubmitting(false);
|
|
10161
10211
|
setExecutionId(null);
|
|
10212
|
+
await setChallengeToken(null);
|
|
10162
10213
|
setIsFlowInitialized(false);
|
|
10163
10214
|
sessionStorage.removeItem("asgardeo_execution_id");
|
|
10164
10215
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
@@ -10174,6 +10225,7 @@ var SignIn = ({
|
|
|
10174
10225
|
}
|
|
10175
10226
|
return;
|
|
10176
10227
|
}
|
|
10228
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
10177
10229
|
if (normalizedExecutionId && normalizedComponents) {
|
|
10178
10230
|
setExecutionId(normalizedExecutionId);
|
|
10179
10231
|
setComponents(normalizedComponents);
|
|
@@ -10187,7 +10239,7 @@ var SignIn = ({
|
|
|
10187
10239
|
}
|
|
10188
10240
|
} catch (error) {
|
|
10189
10241
|
const err = error;
|
|
10190
|
-
clearFlowState();
|
|
10242
|
+
await clearFlowState();
|
|
10191
10243
|
const errorMessage = err?.failureReason || (err instanceof Error ? err.message : String(err));
|
|
10192
10244
|
setError(new Error(errorMessage));
|
|
10193
10245
|
return;
|
|
@@ -10200,7 +10252,7 @@ var SignIn = ({
|
|
|
10200
10252
|
};
|
|
10201
10253
|
useOAuthCallback({
|
|
10202
10254
|
currentExecutionId,
|
|
10203
|
-
isInitialized: isInitialized && !isLoading,
|
|
10255
|
+
isInitialized: isInitialized && !isLoading && isStorageReady,
|
|
10204
10256
|
isSubmitting,
|
|
10205
10257
|
onError: (err) => {
|
|
10206
10258
|
clearFlowState();
|
|
@@ -11006,7 +11058,7 @@ var BaseSignUp_styles_default = useStyles21;
|
|
|
11006
11058
|
|
|
11007
11059
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
11008
11060
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11009
|
-
var
|
|
11061
|
+
var logger8 = (0, import_browser68.createPackageComponentLogger)(
|
|
11010
11062
|
"@asgardeo/react",
|
|
11011
11063
|
"BaseSignUp"
|
|
11012
11064
|
);
|
|
@@ -11147,7 +11199,7 @@ var BaseSignUpContent = ({
|
|
|
11147
11199
|
const redirectUrl = response.data.redirectURL;
|
|
11148
11200
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
11149
11201
|
if (!popup) {
|
|
11150
|
-
|
|
11202
|
+
logger8.error("Failed to open popup window");
|
|
11151
11203
|
return false;
|
|
11152
11204
|
}
|
|
11153
11205
|
let hasProcessedCallback = false;
|
|
@@ -11216,7 +11268,7 @@ var BaseSignUpContent = ({
|
|
|
11216
11268
|
const state = url.searchParams.get("state");
|
|
11217
11269
|
const error = url.searchParams.get("error");
|
|
11218
11270
|
if (error) {
|
|
11219
|
-
|
|
11271
|
+
logger8.error("OAuth error:");
|
|
11220
11272
|
popup.close();
|
|
11221
11273
|
cleanup();
|
|
11222
11274
|
return;
|
|
@@ -11251,7 +11303,7 @@ var BaseSignUpContent = ({
|
|
|
11251
11303
|
} catch (e) {
|
|
11252
11304
|
}
|
|
11253
11305
|
} catch (e) {
|
|
11254
|
-
|
|
11306
|
+
logger8.error("Error monitoring popup:");
|
|
11255
11307
|
}
|
|
11256
11308
|
}, 1e3);
|
|
11257
11309
|
return true;
|
|
@@ -11515,7 +11567,7 @@ var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
|
11515
11567
|
|
|
11516
11568
|
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
11517
11569
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
11518
|
-
var
|
|
11570
|
+
var logger9 = (0, import_browser69.createPackageComponentLogger)(
|
|
11519
11571
|
"@asgardeo/react",
|
|
11520
11572
|
"BaseSignUp"
|
|
11521
11573
|
);
|
|
@@ -11542,7 +11594,7 @@ var BaseSignUpContent2 = ({
|
|
|
11542
11594
|
const { theme, colorScheme } = useTheme_default();
|
|
11543
11595
|
const { t } = useTranslation_default();
|
|
11544
11596
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
11545
|
-
const { meta } = useAsgardeo_default();
|
|
11597
|
+
const { meta, isInitialized: isSdkInitialized, getStorageManager } = useAsgardeo_default();
|
|
11546
11598
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
11547
11599
|
const [isLoading, setIsLoading] = (0, import_react75.useState)(false);
|
|
11548
11600
|
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react75.useState)(false);
|
|
@@ -11555,8 +11607,37 @@ var BaseSignUpContent2 = ({
|
|
|
11555
11607
|
executionId: null,
|
|
11556
11608
|
isActive: false
|
|
11557
11609
|
});
|
|
11610
|
+
const challengeTokenRef = (0, import_react75.useRef)(null);
|
|
11558
11611
|
const initializationAttemptedRef = (0, import_react75.useRef)(false);
|
|
11559
11612
|
const passkeyProcessedRef = (0, import_react75.useRef)(false);
|
|
11613
|
+
(0, import_react75.useEffect)(() => {
|
|
11614
|
+
if (!isSdkInitialized) return;
|
|
11615
|
+
(async () => {
|
|
11616
|
+
try {
|
|
11617
|
+
const storageManager = await getStorageManager();
|
|
11618
|
+
const tempData = await storageManager?.getTemporaryData();
|
|
11619
|
+
if (tempData?.challengeToken) {
|
|
11620
|
+
challengeTokenRef.current = tempData.challengeToken;
|
|
11621
|
+
}
|
|
11622
|
+
} catch {
|
|
11623
|
+
}
|
|
11624
|
+
})();
|
|
11625
|
+
}, [isSdkInitialized]);
|
|
11626
|
+
const setChallengeToken = async (challengeToken) => {
|
|
11627
|
+
challengeTokenRef.current = challengeToken;
|
|
11628
|
+
try {
|
|
11629
|
+
const storageManager = await getStorageManager();
|
|
11630
|
+
if (storageManager) {
|
|
11631
|
+
if (challengeToken) {
|
|
11632
|
+
await storageManager.setTemporaryDataParameter("challengeToken", challengeToken);
|
|
11633
|
+
} else {
|
|
11634
|
+
await storageManager.removeTemporaryDataParameter("challengeToken");
|
|
11635
|
+
}
|
|
11636
|
+
}
|
|
11637
|
+
} catch {
|
|
11638
|
+
logger9.warn("Failed to persist challenge token in storage.");
|
|
11639
|
+
}
|
|
11640
|
+
};
|
|
11560
11641
|
const handleError = (0, import_react75.useCallback)(
|
|
11561
11642
|
(error) => {
|
|
11562
11643
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
@@ -11672,7 +11753,7 @@ var BaseSignUpContent2 = ({
|
|
|
11672
11753
|
const redirectUrl = response.data.redirectURL;
|
|
11673
11754
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
11674
11755
|
if (!popup) {
|
|
11675
|
-
|
|
11756
|
+
logger9.error("Failed to open popup window");
|
|
11676
11757
|
return false;
|
|
11677
11758
|
}
|
|
11678
11759
|
let hasProcessedCallback = false;
|
|
@@ -11703,7 +11784,8 @@ var BaseSignUpContent2 = ({
|
|
|
11703
11784
|
inputs: {
|
|
11704
11785
|
code,
|
|
11705
11786
|
state
|
|
11706
|
-
}
|
|
11787
|
+
},
|
|
11788
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {}
|
|
11707
11789
|
};
|
|
11708
11790
|
try {
|
|
11709
11791
|
const continueResponse = await onSubmit(payload);
|
|
@@ -11743,7 +11825,7 @@ var BaseSignUpContent2 = ({
|
|
|
11743
11825
|
const state = url.searchParams.get("state");
|
|
11744
11826
|
const error = url.searchParams.get("error");
|
|
11745
11827
|
if (error) {
|
|
11746
|
-
|
|
11828
|
+
logger9.error("OAuth error:");
|
|
11747
11829
|
popup.close();
|
|
11748
11830
|
cleanup();
|
|
11749
11831
|
return;
|
|
@@ -11756,7 +11838,8 @@ var BaseSignUpContent2 = ({
|
|
|
11756
11838
|
inputs: {
|
|
11757
11839
|
code,
|
|
11758
11840
|
state
|
|
11759
|
-
}
|
|
11841
|
+
},
|
|
11842
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {}
|
|
11760
11843
|
};
|
|
11761
11844
|
try {
|
|
11762
11845
|
const continueResponse = await onSubmit(payload);
|
|
@@ -11778,7 +11861,7 @@ var BaseSignUpContent2 = ({
|
|
|
11778
11861
|
} catch (e) {
|
|
11779
11862
|
}
|
|
11780
11863
|
} catch (e) {
|
|
11781
|
-
|
|
11864
|
+
logger9.error("Error monitoring popup:");
|
|
11782
11865
|
}
|
|
11783
11866
|
}, 1e3);
|
|
11784
11867
|
return true;
|
|
@@ -11812,11 +11895,13 @@ var BaseSignUpContent2 = ({
|
|
|
11812
11895
|
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11813
11896
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11814
11897
|
...component.id && { action: component.id },
|
|
11898
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {},
|
|
11815
11899
|
inputs: filteredInputs
|
|
11816
11900
|
};
|
|
11817
11901
|
const rawResponse = await onSubmit(payload);
|
|
11818
11902
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
11819
11903
|
onFlowChange?.(response);
|
|
11904
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
11820
11905
|
if (response.flowStatus === import_browser69.EmbeddedFlowStatus.Complete) {
|
|
11821
11906
|
onComplete?.(response);
|
|
11822
11907
|
return;
|
|
@@ -11969,6 +12054,7 @@ var BaseSignUpContent2 = ({
|
|
|
11969
12054
|
try {
|
|
11970
12055
|
const rawResponse = await onInitialize();
|
|
11971
12056
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
12057
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
11972
12058
|
setCurrentFlow(response);
|
|
11973
12059
|
setIsFlowInitialized(true);
|
|
11974
12060
|
onFlowChange?.(response);
|
|
@@ -12272,7 +12358,7 @@ var BaseInviteUser = ({
|
|
|
12272
12358
|
showTitle = true,
|
|
12273
12359
|
showSubtitle = true
|
|
12274
12360
|
}) => {
|
|
12275
|
-
const { meta } = useAsgardeo_default();
|
|
12361
|
+
const { meta, isInitialized: isSdkInitialized, getStorageManager } = useAsgardeo_default();
|
|
12276
12362
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
12277
12363
|
const { theme } = useTheme_default();
|
|
12278
12364
|
const styles = BaseInviteUser_styles_default(theme, theme.vars.colors.text.primary);
|
|
@@ -12284,7 +12370,36 @@ var BaseInviteUser = ({
|
|
|
12284
12370
|
const [formErrors, setFormErrors] = (0, import_react77.useState)({});
|
|
12285
12371
|
const [touchedFields, setTouchedFields] = (0, import_react77.useState)({});
|
|
12286
12372
|
const [isFormValid, setIsFormValid] = (0, import_react77.useState)(true);
|
|
12373
|
+
const challengeTokenRef = (0, import_react77.useRef)(null);
|
|
12287
12374
|
const initializationAttemptedRef = (0, import_react77.useRef)(false);
|
|
12375
|
+
(0, import_react77.useEffect)(() => {
|
|
12376
|
+
if (!isSdkInitialized) return;
|
|
12377
|
+
(async () => {
|
|
12378
|
+
try {
|
|
12379
|
+
const storageManager = await getStorageManager();
|
|
12380
|
+
const tempData = await storageManager?.getTemporaryData();
|
|
12381
|
+
if (tempData?.challengeToken) {
|
|
12382
|
+
challengeTokenRef.current = tempData.challengeToken;
|
|
12383
|
+
}
|
|
12384
|
+
} catch {
|
|
12385
|
+
}
|
|
12386
|
+
})();
|
|
12387
|
+
}, [isSdkInitialized]);
|
|
12388
|
+
const setChallengeToken = async (challengeToken) => {
|
|
12389
|
+
challengeTokenRef.current = challengeToken;
|
|
12390
|
+
try {
|
|
12391
|
+
const storageManager = await getStorageManager();
|
|
12392
|
+
if (storageManager) {
|
|
12393
|
+
if (challengeToken) {
|
|
12394
|
+
await storageManager.setTemporaryDataParameter("challengeToken", challengeToken);
|
|
12395
|
+
} else {
|
|
12396
|
+
await storageManager.removeTemporaryDataParameter("challengeToken");
|
|
12397
|
+
}
|
|
12398
|
+
}
|
|
12399
|
+
} catch {
|
|
12400
|
+
import_browser74.logger.warn("Failed to persist challenge token in storage.");
|
|
12401
|
+
}
|
|
12402
|
+
};
|
|
12288
12403
|
const handleError = (0, import_react77.useCallback)(
|
|
12289
12404
|
(error) => {
|
|
12290
12405
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.inviteUser.errors.generic");
|
|
@@ -12381,7 +12496,8 @@ var BaseInviteUser = ({
|
|
|
12381
12496
|
const payload = {
|
|
12382
12497
|
executionId: currentFlow.executionId,
|
|
12383
12498
|
inputs,
|
|
12384
|
-
verbose: true
|
|
12499
|
+
verbose: true,
|
|
12500
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {}
|
|
12385
12501
|
};
|
|
12386
12502
|
if (component?.id) {
|
|
12387
12503
|
payload["action"] = component.id;
|
|
@@ -12389,6 +12505,7 @@ var BaseInviteUser = ({
|
|
|
12389
12505
|
const rawResponse = await onSubmit(payload);
|
|
12390
12506
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
12391
12507
|
onFlowChange?.(response);
|
|
12508
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
12392
12509
|
if (response.flowStatus === "ERROR") {
|
|
12393
12510
|
handleError(response);
|
|
12394
12511
|
return;
|
|
@@ -12427,6 +12544,7 @@ var BaseInviteUser = ({
|
|
|
12427
12544
|
};
|
|
12428
12545
|
const rawResponse = await onInitialize(payload);
|
|
12429
12546
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
12547
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
12430
12548
|
setCurrentFlow(response);
|
|
12431
12549
|
setIsFlowInitialized(true);
|
|
12432
12550
|
onFlowChange?.(response);
|
|
@@ -12697,7 +12815,7 @@ var BaseAcceptInvite = ({
|
|
|
12697
12815
|
showTitle = true,
|
|
12698
12816
|
showSubtitle = true
|
|
12699
12817
|
}) => {
|
|
12700
|
-
const { meta } = useAsgardeo_default();
|
|
12818
|
+
const { meta, isInitialized, getStorageManager } = useAsgardeo_default();
|
|
12701
12819
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
12702
12820
|
const { theme } = useTheme_default();
|
|
12703
12821
|
const styles = BaseAcceptInvite_styles_default(theme, theme.vars.colors.text.primary);
|
|
@@ -12711,7 +12829,34 @@ var BaseAcceptInvite = ({
|
|
|
12711
12829
|
const [formErrors, setFormErrors] = (0, import_react80.useState)({});
|
|
12712
12830
|
const [touchedFields, setTouchedFields] = (0, import_react80.useState)({});
|
|
12713
12831
|
const [isFormValid, setIsFormValid] = (0, import_react80.useState)(true);
|
|
12832
|
+
const [isStorageReady, setIsStorageReady] = (0, import_react80.useState)(false);
|
|
12833
|
+
const challengeTokenRef = (0, import_react80.useRef)(null);
|
|
12714
12834
|
const tokenValidationAttemptedRef = (0, import_react80.useRef)(false);
|
|
12835
|
+
(0, import_react80.useEffect)(() => {
|
|
12836
|
+
if (!isInitialized) return;
|
|
12837
|
+
(async () => {
|
|
12838
|
+
try {
|
|
12839
|
+
const storageManager = await getStorageManager();
|
|
12840
|
+
const tempData = await storageManager?.getTemporaryData();
|
|
12841
|
+
if (tempData?.challengeToken) {
|
|
12842
|
+
challengeTokenRef.current = tempData.challengeToken;
|
|
12843
|
+
}
|
|
12844
|
+
} finally {
|
|
12845
|
+
setIsStorageReady(true);
|
|
12846
|
+
}
|
|
12847
|
+
})();
|
|
12848
|
+
}, [isInitialized]);
|
|
12849
|
+
const setChallengeToken = async (challengeToken) => {
|
|
12850
|
+
challengeTokenRef.current = challengeToken;
|
|
12851
|
+
const storageManager = await getStorageManager();
|
|
12852
|
+
if (storageManager) {
|
|
12853
|
+
if (challengeToken) {
|
|
12854
|
+
await storageManager.setTemporaryDataParameter("challengeToken", challengeToken);
|
|
12855
|
+
} else {
|
|
12856
|
+
await storageManager.removeTemporaryDataParameter("challengeToken");
|
|
12857
|
+
}
|
|
12858
|
+
}
|
|
12859
|
+
};
|
|
12715
12860
|
const handleError = (0, import_react80.useCallback)(
|
|
12716
12861
|
(error) => {
|
|
12717
12862
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.acceptInvite.errors.generic");
|
|
@@ -12750,7 +12895,7 @@ var BaseAcceptInvite = ({
|
|
|
12750
12895
|
);
|
|
12751
12896
|
useOAuthCallback({
|
|
12752
12897
|
currentExecutionId: executionId ?? null,
|
|
12753
|
-
isInitialized:
|
|
12898
|
+
isInitialized: isStorageReady,
|
|
12754
12899
|
onComplete: () => {
|
|
12755
12900
|
setIsValidatingToken(false);
|
|
12756
12901
|
onComplete?.();
|
|
@@ -12773,8 +12918,12 @@ var BaseAcceptInvite = ({
|
|
|
12773
12918
|
setIsValidatingToken(true);
|
|
12774
12919
|
},
|
|
12775
12920
|
onSubmit: async (payload) => {
|
|
12776
|
-
const rawResponse = await onSubmit(
|
|
12921
|
+
const rawResponse = await onSubmit({
|
|
12922
|
+
...payload,
|
|
12923
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {}
|
|
12924
|
+
});
|
|
12777
12925
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
12926
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
12778
12927
|
return response;
|
|
12779
12928
|
},
|
|
12780
12929
|
tokenValidationAttemptedRef
|
|
@@ -12836,7 +12985,8 @@ var BaseAcceptInvite = ({
|
|
|
12836
12985
|
const payload = {
|
|
12837
12986
|
executionId: currentFlow.executionId,
|
|
12838
12987
|
inputs,
|
|
12839
|
-
verbose: true
|
|
12988
|
+
verbose: true,
|
|
12989
|
+
...challengeTokenRef.current ? { challengeToken: challengeTokenRef.current } : {}
|
|
12840
12990
|
};
|
|
12841
12991
|
if (component?.id) {
|
|
12842
12992
|
payload["action"] = component.id;
|
|
@@ -12844,6 +12994,7 @@ var BaseAcceptInvite = ({
|
|
|
12844
12994
|
const rawResponse = await onSubmit(payload);
|
|
12845
12995
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
12846
12996
|
onFlowChange?.(response);
|
|
12997
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
12847
12998
|
if (response.type === "REDIRECTION") {
|
|
12848
12999
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
12849
13000
|
if (redirectURL && typeof window !== "undefined") {
|
|
@@ -12913,6 +13064,7 @@ var BaseAcceptInvite = ({
|
|
|
12913
13064
|
const rawResponse = await onSubmit(payload);
|
|
12914
13065
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
12915
13066
|
onFlowChange?.(response);
|
|
13067
|
+
await setChallengeToken(response.challengeToken ?? null);
|
|
12916
13068
|
if (response.flowStatus === "ERROR") {
|
|
12917
13069
|
setIsTokenInvalid(true);
|
|
12918
13070
|
handleError(response);
|
|
@@ -16017,7 +16169,7 @@ var BaseCreateOrganization_styles_default = useStyles30;
|
|
|
16017
16169
|
|
|
16018
16170
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
16019
16171
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
16020
|
-
var
|
|
16172
|
+
var logger11 = (0, import_browser86.createPackageComponentLogger)(
|
|
16021
16173
|
"@asgardeo/react",
|
|
16022
16174
|
"BaseCreateOrganization"
|
|
16023
16175
|
);
|
|
@@ -16103,7 +16255,7 @@ var BaseCreateOrganization = ({
|
|
|
16103
16255
|
onSuccess(payload);
|
|
16104
16256
|
}
|
|
16105
16257
|
} catch (submitError) {
|
|
16106
|
-
|
|
16258
|
+
logger11.error("Form submission error:");
|
|
16107
16259
|
}
|
|
16108
16260
|
};
|
|
16109
16261
|
const createOrganizationContent = /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: (0, import_css65.cx)(styles["root"], cardLayout && styles["card"], className), style, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: (0, import_css65.cx)(styles["content"]), children: [
|
|
@@ -17630,7 +17782,7 @@ var updateOrganization_default = updateOrganization;
|
|
|
17630
17782
|
|
|
17631
17783
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
17632
17784
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17633
|
-
var
|
|
17785
|
+
var logger12 = (0, import_browser92.createPackageComponentLogger)(
|
|
17634
17786
|
"@asgardeo/react",
|
|
17635
17787
|
"OrganizationProfile"
|
|
17636
17788
|
);
|
|
@@ -17661,7 +17813,7 @@ var OrganizationProfile = ({
|
|
|
17661
17813
|
});
|
|
17662
17814
|
setOrganization(orgData);
|
|
17663
17815
|
} catch (err) {
|
|
17664
|
-
|
|
17816
|
+
logger12.error("Failed to fetch organization:");
|
|
17665
17817
|
setOrganization(null);
|
|
17666
17818
|
}
|
|
17667
17819
|
};
|
|
@@ -17683,7 +17835,7 @@ var OrganizationProfile = ({
|
|
|
17683
17835
|
await onUpdate(payload);
|
|
17684
17836
|
}
|
|
17685
17837
|
} catch (err) {
|
|
17686
|
-
|
|
17838
|
+
logger12.error("Failed to update organization:");
|
|
17687
17839
|
throw err;
|
|
17688
17840
|
}
|
|
17689
17841
|
};
|