@asgardeo/react 0.16.0 → 0.16.2
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 +9 -5
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +25 -21
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@ declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactC
|
|
|
27
27
|
private asgardeo;
|
|
28
28
|
private loadingState;
|
|
29
29
|
private clientInstanceId;
|
|
30
|
+
private initializeConfig;
|
|
30
31
|
/**
|
|
31
32
|
* Creates a new AsgardeoReactClient instance.
|
|
32
33
|
* @param instanceId - Optional instance ID for multi-auth context support. Defaults to 0 for backward compatibility.
|
package/dist/cjs/index.js
CHANGED
|
@@ -706,6 +706,7 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
|
|
|
706
706
|
__publicField(this, "asgardeo");
|
|
707
707
|
__publicField(this, "loadingState", false);
|
|
708
708
|
__publicField(this, "clientInstanceId");
|
|
709
|
+
__publicField(this, "initializeConfig");
|
|
709
710
|
this.clientInstanceId = instanceId;
|
|
710
711
|
this.asgardeo = new api_default(void 0, instanceId);
|
|
711
712
|
}
|
|
@@ -927,6 +928,9 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
|
|
|
927
928
|
const arg1 = args[0];
|
|
928
929
|
const arg2 = args[1];
|
|
929
930
|
const config = await this.asgardeo.getConfigData();
|
|
931
|
+
if (!config || Object.keys(config).length === 0) {
|
|
932
|
+
await this.initialize(this.initializeConfig);
|
|
933
|
+
}
|
|
930
934
|
const isV2Platform = config && config.platform === import_browser6.Platform.AsgardeoV2;
|
|
931
935
|
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && arg1.callOnlyOnRedirect === true) {
|
|
932
936
|
return void 0;
|
|
@@ -1292,7 +1296,7 @@ var FlowMetaProvider = ({
|
|
|
1292
1296
|
children,
|
|
1293
1297
|
enabled = true
|
|
1294
1298
|
}) => {
|
|
1295
|
-
const { baseUrl, applicationId } = useAsgardeo_default();
|
|
1299
|
+
const { baseUrl, applicationId, platform } = useAsgardeo_default();
|
|
1296
1300
|
const i18nContext = useI18n_default();
|
|
1297
1301
|
const [meta, setMeta] = (0, import_react10.useState)(null);
|
|
1298
1302
|
const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
|
|
@@ -1300,7 +1304,7 @@ var FlowMetaProvider = ({
|
|
|
1300
1304
|
const [pendingLanguage, setPendingLanguage] = (0, import_react10.useState)(null);
|
|
1301
1305
|
const hasFetchedRef = (0, import_react10.useRef)(false);
|
|
1302
1306
|
const fetchFlowMeta = (0, import_react10.useCallback)(async () => {
|
|
1303
|
-
if (!enabled) {
|
|
1307
|
+
if (!enabled || platform !== import_browser10.Platform.AsgardeoV2) {
|
|
1304
1308
|
setMeta(null);
|
|
1305
1309
|
return;
|
|
1306
1310
|
}
|
|
@@ -1318,10 +1322,10 @@ var FlowMetaProvider = ({
|
|
|
1318
1322
|
} finally {
|
|
1319
1323
|
setIsLoading(false);
|
|
1320
1324
|
}
|
|
1321
|
-
}, [enabled, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1325
|
+
}, [enabled, platform, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1322
1326
|
const switchLanguage = (0, import_react10.useCallback)(
|
|
1323
1327
|
async (language) => {
|
|
1324
|
-
if (!enabled) return;
|
|
1328
|
+
if (!enabled || platform !== import_browser10.Platform.AsgardeoV2) return;
|
|
1325
1329
|
setIsLoading(true);
|
|
1326
1330
|
setError(null);
|
|
1327
1331
|
try {
|
|
@@ -1348,7 +1352,7 @@ var FlowMetaProvider = ({
|
|
|
1348
1352
|
setIsLoading(false);
|
|
1349
1353
|
}
|
|
1350
1354
|
},
|
|
1351
|
-
[enabled, baseUrl, applicationId, i18nContext]
|
|
1355
|
+
[enabled, platform, baseUrl, applicationId, i18nContext]
|
|
1352
1356
|
);
|
|
1353
1357
|
(0, import_react10.useEffect)(() => {
|
|
1354
1358
|
if (pendingLanguage && i18nContext?.setLanguage) {
|