@asgardeo/react 0.16.1 → 0.17.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 +29 -23
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +45 -39
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1296,7 +1296,7 @@ var FlowMetaProvider = ({
|
|
|
1296
1296
|
children,
|
|
1297
1297
|
enabled = true
|
|
1298
1298
|
}) => {
|
|
1299
|
-
const { baseUrl, applicationId } = useAsgardeo_default();
|
|
1299
|
+
const { baseUrl, applicationId, platform } = useAsgardeo_default();
|
|
1300
1300
|
const i18nContext = useI18n_default();
|
|
1301
1301
|
const [meta, setMeta] = (0, import_react10.useState)(null);
|
|
1302
1302
|
const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
|
|
@@ -1304,7 +1304,7 @@ var FlowMetaProvider = ({
|
|
|
1304
1304
|
const [pendingLanguage, setPendingLanguage] = (0, import_react10.useState)(null);
|
|
1305
1305
|
const hasFetchedRef = (0, import_react10.useRef)(false);
|
|
1306
1306
|
const fetchFlowMeta = (0, import_react10.useCallback)(async () => {
|
|
1307
|
-
if (!enabled) {
|
|
1307
|
+
if (!enabled || platform !== import_browser10.Platform.AsgardeoV2) {
|
|
1308
1308
|
setMeta(null);
|
|
1309
1309
|
return;
|
|
1310
1310
|
}
|
|
@@ -1322,10 +1322,10 @@ var FlowMetaProvider = ({
|
|
|
1322
1322
|
} finally {
|
|
1323
1323
|
setIsLoading(false);
|
|
1324
1324
|
}
|
|
1325
|
-
}, [enabled, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1325
|
+
}, [enabled, platform, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1326
1326
|
const switchLanguage = (0, import_react10.useCallback)(
|
|
1327
1327
|
async (language) => {
|
|
1328
|
-
if (!enabled) return;
|
|
1328
|
+
if (!enabled || platform !== import_browser10.Platform.AsgardeoV2) return;
|
|
1329
1329
|
setIsLoading(true);
|
|
1330
1330
|
setError(null);
|
|
1331
1331
|
try {
|
|
@@ -1352,7 +1352,7 @@ var FlowMetaProvider = ({
|
|
|
1352
1352
|
setIsLoading(false);
|
|
1353
1353
|
}
|
|
1354
1354
|
},
|
|
1355
|
-
[enabled, baseUrl, applicationId, i18nContext]
|
|
1355
|
+
[enabled, platform, baseUrl, applicationId, i18nContext]
|
|
1356
1356
|
);
|
|
1357
1357
|
(0, import_react10.useEffect)(() => {
|
|
1358
1358
|
if (pendingLanguage && i18nContext?.setLanguage) {
|
|
@@ -2188,25 +2188,31 @@ var AsgardeoProvider = ({
|
|
|
2188
2188
|
schemas: []
|
|
2189
2189
|
});
|
|
2190
2190
|
} else {
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
setCurrentOrganization(fetchedOrganization);
|
|
2204
|
-
} catch (error) {
|
|
2191
|
+
const shouldFetchUserProfile = preferences?.user?.fetchUserProfile !== false;
|
|
2192
|
+
if (shouldFetchUserProfile) {
|
|
2193
|
+
try {
|
|
2194
|
+
const fetchedUser = await asgardeo.getUser({ baseUrl: resolvedBaseUrl });
|
|
2195
|
+
setUser(fetchedUser);
|
|
2196
|
+
} catch (error) {
|
|
2197
|
+
}
|
|
2198
|
+
try {
|
|
2199
|
+
const fetchedUserProfile = await asgardeo.getUserProfile({ baseUrl: resolvedBaseUrl });
|
|
2200
|
+
setUserProfile(fetchedUserProfile);
|
|
2201
|
+
} catch (error) {
|
|
2202
|
+
}
|
|
2205
2203
|
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2204
|
+
const shouldFetchOrganizations = preferences?.user?.fetchOrganizations !== false;
|
|
2205
|
+
if (shouldFetchOrganizations) {
|
|
2206
|
+
try {
|
|
2207
|
+
const fetchedOrganization = await asgardeo.getCurrentOrganization();
|
|
2208
|
+
setCurrentOrganization(fetchedOrganization);
|
|
2209
|
+
} catch (error) {
|
|
2210
|
+
}
|
|
2211
|
+
try {
|
|
2212
|
+
const fetchedMyOrganizations = await asgardeo.getMyOrganizations();
|
|
2213
|
+
setMyOrganizations(fetchedMyOrganizations);
|
|
2214
|
+
} catch (error) {
|
|
2215
|
+
}
|
|
2210
2216
|
}
|
|
2211
2217
|
}
|
|
2212
2218
|
const currentSignInStatus = await asgardeo.isSignedIn();
|