@asgardeo/react 0.22.1 → 0.22.3
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 +11 -5
- package/dist/cjs/index.js.map +2 -2
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +4 -0
- package/dist/index.js +11 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -200,6 +200,7 @@ var AsgardeoContext = (0, import_react.createContext)({
|
|
|
200
200
|
instanceId: 0,
|
|
201
201
|
isInitialized: false,
|
|
202
202
|
isLoading: true,
|
|
203
|
+
isMetaLoading: false,
|
|
203
204
|
isSignedIn: false,
|
|
204
205
|
meta: null,
|
|
205
206
|
organization: null,
|
|
@@ -1285,8 +1286,10 @@ var useAsgardeo = () => {
|
|
|
1285
1286
|
const flowMetaContext = (0, import_react8.useContext)(FlowMetaContext_default);
|
|
1286
1287
|
const i18nContext = (0, import_react8.useContext)(I18nContext_default);
|
|
1287
1288
|
const meta = flowMetaContext?.meta ?? null;
|
|
1289
|
+
const isMetaLoading = flowMetaContext?.isLoading ?? false;
|
|
1288
1290
|
return {
|
|
1289
1291
|
...context,
|
|
1292
|
+
isMetaLoading,
|
|
1290
1293
|
meta,
|
|
1291
1294
|
resolveFlowTemplateLiterals: (text) => (0, import_browser9.resolveFlowTemplateLiterals)(text, {
|
|
1292
1295
|
meta,
|
|
@@ -1318,13 +1321,17 @@ var FlowMetaProvider = ({
|
|
|
1318
1321
|
const { baseUrl, applicationId, platform } = useAsgardeo_default();
|
|
1319
1322
|
const i18nContext = useI18n_default();
|
|
1320
1323
|
const [meta, setMeta] = (0, import_react10.useState)(null);
|
|
1321
|
-
const [isLoading, setIsLoading] = (0, import_react10.useState)(
|
|
1324
|
+
const [isLoading, setIsLoading] = (0, import_react10.useState)(true);
|
|
1322
1325
|
const [error, setError] = (0, import_react10.useState)(null);
|
|
1323
1326
|
const [pendingLanguage, setPendingLanguage] = (0, import_react10.useState)(null);
|
|
1324
|
-
const
|
|
1327
|
+
const lastFetchedRef = (0, import_react10.useRef)(null);
|
|
1325
1328
|
const fetchFlowMeta = (0, import_react10.useCallback)(async () => {
|
|
1326
1329
|
if (!enabled || platform !== import_browser10.Platform.AsgardeoV2) {
|
|
1327
1330
|
setMeta(null);
|
|
1331
|
+
setIsLoading(false);
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
if (!applicationId) {
|
|
1328
1335
|
return;
|
|
1329
1336
|
}
|
|
1330
1337
|
setIsLoading(true);
|
|
@@ -1380,11 +1387,10 @@ var FlowMetaProvider = ({
|
|
|
1380
1387
|
}
|
|
1381
1388
|
}, [pendingLanguage, i18nContext?.setLanguage]);
|
|
1382
1389
|
(0, import_react10.useEffect)(() => {
|
|
1383
|
-
if (
|
|
1384
|
-
hasFetchedRef.current = true;
|
|
1385
|
-
fetchFlowMeta();
|
|
1390
|
+
if (lastFetchedRef.current === fetchFlowMeta) {
|
|
1386
1391
|
return;
|
|
1387
1392
|
}
|
|
1393
|
+
lastFetchedRef.current = fetchFlowMeta;
|
|
1388
1394
|
fetchFlowMeta();
|
|
1389
1395
|
}, [fetchFlowMeta]);
|
|
1390
1396
|
(0, import_react10.useEffect)(() => {
|