@asgardeo/react 0.21.0 → 0.21.1
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/index.js
CHANGED
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
getBrandingPreference,
|
|
10
10
|
getActiveTheme,
|
|
11
11
|
Platform as Platform4,
|
|
12
|
-
extractUserClaimsFromIdToken as extractUserClaimsFromIdToken2
|
|
12
|
+
extractUserClaimsFromIdToken as extractUserClaimsFromIdToken2,
|
|
13
|
+
createPackageComponentLogger as createPackageComponentLogger3
|
|
13
14
|
} from "@asgardeo/browser";
|
|
14
15
|
import { useEffect as useEffect6, useMemo as useMemo7, useRef as useRef2, useState as useState8, useCallback as useCallback8 } from "react";
|
|
15
16
|
|
|
@@ -361,6 +362,9 @@ var _AuthAPI = class _AuthAPI {
|
|
|
361
362
|
async isSignedIn() {
|
|
362
363
|
return this.client.isSignedIn();
|
|
363
364
|
}
|
|
365
|
+
async startAutoRefreshToken() {
|
|
366
|
+
return this.client.startAutoRefreshToken();
|
|
367
|
+
}
|
|
364
368
|
/**
|
|
365
369
|
* This method specifies if the session is active or not.
|
|
366
370
|
*
|
|
@@ -791,6 +795,9 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
791
795
|
async isSignedIn() {
|
|
792
796
|
return this.asgardeo.isSignedIn();
|
|
793
797
|
}
|
|
798
|
+
async startAutoRefreshToken() {
|
|
799
|
+
return this.asgardeo.startAutoRefreshToken();
|
|
800
|
+
}
|
|
794
801
|
getConfiguration() {
|
|
795
802
|
return this.asgardeo.getConfigData();
|
|
796
803
|
}
|
|
@@ -2001,6 +2008,10 @@ var UserProvider_default = UserProvider;
|
|
|
2001
2008
|
|
|
2002
2009
|
// src/contexts/Asgardeo/AsgardeoProvider.tsx
|
|
2003
2010
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2011
|
+
var logger3 = createPackageComponentLogger3(
|
|
2012
|
+
"@asgardeo/react",
|
|
2013
|
+
"AsgardeoProvider"
|
|
2014
|
+
);
|
|
2004
2015
|
var AsgardeoProvider = ({
|
|
2005
2016
|
afterSignInUrl = window.location.origin,
|
|
2006
2017
|
afterSignOutUrl = window.location.origin,
|
|
@@ -2158,8 +2169,23 @@ var AsgardeoProvider = ({
|
|
|
2158
2169
|
reRenderCheckRef.current = true;
|
|
2159
2170
|
(async () => {
|
|
2160
2171
|
const isAlreadySignedIn = await asgardeo.isSignedIn();
|
|
2161
|
-
|
|
2172
|
+
const scheduleAutoRefresh = async () => {
|
|
2173
|
+
try {
|
|
2174
|
+
await asgardeo.startAutoRefreshToken();
|
|
2175
|
+
} catch (error) {
|
|
2176
|
+
logger3.warn("Failed to schedule automatic token refresh.", error);
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
const resumeSession = async () => {
|
|
2162
2180
|
await updateSession();
|
|
2181
|
+
await scheduleAutoRefresh();
|
|
2182
|
+
};
|
|
2183
|
+
if (isAlreadySignedIn) {
|
|
2184
|
+
await resumeSession();
|
|
2185
|
+
}
|
|
2186
|
+
await scheduleAutoRefresh();
|
|
2187
|
+
if (await asgardeo.isSignedIn()) {
|
|
2188
|
+
await resumeSession();
|
|
2163
2189
|
return;
|
|
2164
2190
|
}
|
|
2165
2191
|
const currentUrl = new URL(window.location.href);
|
|
@@ -2814,8 +2840,8 @@ var useForm = (config = {}) => {
|
|
|
2814
2840
|
var useForm_default = useForm;
|
|
2815
2841
|
|
|
2816
2842
|
// src/hooks/useBranding.ts
|
|
2817
|
-
import { createPackageComponentLogger as
|
|
2818
|
-
var
|
|
2843
|
+
import { createPackageComponentLogger as createPackageComponentLogger4 } from "@asgardeo/browser";
|
|
2844
|
+
var logger4 = createPackageComponentLogger4(
|
|
2819
2845
|
"@asgardeo/react",
|
|
2820
2846
|
"useBranding"
|
|
2821
2847
|
);
|
|
@@ -2823,7 +2849,7 @@ var useBranding = () => {
|
|
|
2823
2849
|
try {
|
|
2824
2850
|
return useBrandingContext_default();
|
|
2825
2851
|
} catch (error) {
|
|
2826
|
-
|
|
2852
|
+
logger4.warn(
|
|
2827
2853
|
"useBranding: BrandingProvider not available. Make sure to wrap your app with BrandingProvider or AsgardeoProvider with branding preferences."
|
|
2828
2854
|
);
|
|
2829
2855
|
return {
|
|
@@ -3702,7 +3728,7 @@ import {
|
|
|
3702
3728
|
AsgardeoAPIError,
|
|
3703
3729
|
withVendorCSSClassPrefix as withVendorCSSClassPrefix19,
|
|
3704
3730
|
handleWebAuthnAuthentication,
|
|
3705
|
-
createPackageComponentLogger as
|
|
3731
|
+
createPackageComponentLogger as createPackageComponentLogger5
|
|
3706
3732
|
} from "@asgardeo/browser";
|
|
3707
3733
|
import { cx as cx19 } from "@emotion/css";
|
|
3708
3734
|
import { useEffect as useEffect14, useState as useState15, useCallback as useCallback10, useRef as useRef5 } from "react";
|
|
@@ -6922,7 +6948,7 @@ var BaseSignIn_styles_default = useStyles16;
|
|
|
6922
6948
|
|
|
6923
6949
|
// src/components/presentation/auth/SignIn/v1/BaseSignIn.tsx
|
|
6924
6950
|
import { jsx as jsx58, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6925
|
-
var
|
|
6951
|
+
var logger5 = createPackageComponentLogger5(
|
|
6926
6952
|
"@asgardeo/react",
|
|
6927
6953
|
"BaseSignIn"
|
|
6928
6954
|
);
|
|
@@ -7009,7 +7035,7 @@ var BaseSignInContent = ({
|
|
|
7009
7035
|
"width=500,height=600,scrollbars=yes,resizable=yes"
|
|
7010
7036
|
);
|
|
7011
7037
|
if (!popup) {
|
|
7012
|
-
|
|
7038
|
+
logger5.error("Failed to open popup window");
|
|
7013
7039
|
return false;
|
|
7014
7040
|
}
|
|
7015
7041
|
let messageHandler;
|
|
@@ -7071,7 +7097,7 @@ var BaseSignInContent = ({
|
|
|
7071
7097
|
const state = url.searchParams.get("state");
|
|
7072
7098
|
const oauthError = url.searchParams.get("error");
|
|
7073
7099
|
if (oauthError) {
|
|
7074
|
-
|
|
7100
|
+
logger5.error("OAuth error:");
|
|
7075
7101
|
popup.close();
|
|
7076
7102
|
cleanup();
|
|
7077
7103
|
return;
|
|
@@ -7101,7 +7127,7 @@ var BaseSignInContent = ({
|
|
|
7101
7127
|
} catch (e) {
|
|
7102
7128
|
}
|
|
7103
7129
|
} catch (e) {
|
|
7104
|
-
|
|
7130
|
+
logger5.error("Error monitoring popup:");
|
|
7105
7131
|
}
|
|
7106
7132
|
}, 1e3);
|
|
7107
7133
|
return true;
|
|
@@ -7240,7 +7266,7 @@ var BaseSignInContent = ({
|
|
|
7240
7266
|
}
|
|
7241
7267
|
}
|
|
7242
7268
|
} catch (passkeyError) {
|
|
7243
|
-
|
|
7269
|
+
logger5.error("Passkey authentication error:");
|
|
7244
7270
|
let errorMessage = passkeyError instanceof Error ? passkeyError.message : t("errors.signin.flow.passkeys.failure");
|
|
7245
7271
|
if (passkeyError instanceof Error && passkeyError.message.includes("security")) {
|
|
7246
7272
|
errorMessage += " This may be due to browser security settings, an insecure connection, or device restrictions.";
|
|
@@ -7810,7 +7836,7 @@ import {
|
|
|
7810
7836
|
FieldType as FieldType7,
|
|
7811
7837
|
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,
|
|
7812
7838
|
EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType,
|
|
7813
|
-
createPackageComponentLogger as
|
|
7839
|
+
createPackageComponentLogger as createPackageComponentLogger6,
|
|
7814
7840
|
resolveFlowTemplateLiterals as resolveFlowTemplateLiterals3,
|
|
7815
7841
|
resolveEmojiUrisInHtml
|
|
7816
7842
|
} from "@asgardeo/browser";
|
|
@@ -8642,7 +8668,7 @@ var flowIconRegistry_default = flowIconRegistry;
|
|
|
8642
8668
|
|
|
8643
8669
|
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
8644
8670
|
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
8645
|
-
var
|
|
8671
|
+
var logger6 = createPackageComponentLogger6(
|
|
8646
8672
|
"@asgardeo/react",
|
|
8647
8673
|
"AuthOptionFactory"
|
|
8648
8674
|
);
|
|
@@ -8885,7 +8911,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8885
8911
|
const identifier = component.ref ?? component.id;
|
|
8886
8912
|
const rootOuId = options.additionalData?.["rootOuId"];
|
|
8887
8913
|
if (!rootOuId || !options.fetchOrganizationUnitChildren) {
|
|
8888
|
-
|
|
8914
|
+
logger6.warn("OU_SELECT requires additionalData.rootOuId and fetchOrganizationUnitChildren. Skipping render.");
|
|
8889
8915
|
return null;
|
|
8890
8916
|
}
|
|
8891
8917
|
return /* @__PURE__ */ jsx68(
|
|
@@ -8966,7 +8992,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8966
8992
|
const iconName = component.name || "";
|
|
8967
8993
|
const IconComponent = flowIconRegistry_default[iconName];
|
|
8968
8994
|
if (!IconComponent) {
|
|
8969
|
-
|
|
8995
|
+
logger6.warn(`Unknown icon name: "${iconName}". Skipping render.`);
|
|
8970
8996
|
return null;
|
|
8971
8997
|
}
|
|
8972
8998
|
return /* @__PURE__ */ jsx68(IconComponent, { size: component.size || 24, color: component.color || "currentColor" }, key);
|
|
@@ -9022,7 +9048,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
9022
9048
|
return /* @__PURE__ */ jsx68(FlowTimer_default, { expiresIn, textTemplate }, key);
|
|
9023
9049
|
}
|
|
9024
9050
|
default:
|
|
9025
|
-
|
|
9051
|
+
logger6.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
9026
9052
|
return null;
|
|
9027
9053
|
}
|
|
9028
9054
|
};
|
|
@@ -10123,7 +10149,7 @@ import {
|
|
|
10123
10149
|
EmbeddedFlowComponentType as EmbeddedFlowComponentType3,
|
|
10124
10150
|
EmbeddedFlowResponseType,
|
|
10125
10151
|
withVendorCSSClassPrefix as withVendorCSSClassPrefix23,
|
|
10126
|
-
createPackageComponentLogger as
|
|
10152
|
+
createPackageComponentLogger as createPackageComponentLogger7
|
|
10127
10153
|
} from "@asgardeo/browser";
|
|
10128
10154
|
import { cx as cx24 } from "@emotion/css";
|
|
10129
10155
|
import { useEffect as useEffect19, useState as useState20, useCallback as useCallback13, useRef as useRef8 } from "react";
|
|
@@ -10781,7 +10807,7 @@ var BaseSignUp_styles_default = useStyles20;
|
|
|
10781
10807
|
|
|
10782
10808
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
10783
10809
|
import { jsx as jsx79, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10784
|
-
var
|
|
10810
|
+
var logger7 = createPackageComponentLogger7(
|
|
10785
10811
|
"@asgardeo/react",
|
|
10786
10812
|
"BaseSignUp"
|
|
10787
10813
|
);
|
|
@@ -10922,7 +10948,7 @@ var BaseSignUpContent = ({
|
|
|
10922
10948
|
const redirectUrl = response.data.redirectURL;
|
|
10923
10949
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
10924
10950
|
if (!popup) {
|
|
10925
|
-
|
|
10951
|
+
logger7.error("Failed to open popup window");
|
|
10926
10952
|
return false;
|
|
10927
10953
|
}
|
|
10928
10954
|
let hasProcessedCallback = false;
|
|
@@ -10991,7 +11017,7 @@ var BaseSignUpContent = ({
|
|
|
10991
11017
|
const state = url.searchParams.get("state");
|
|
10992
11018
|
const error = url.searchParams.get("error");
|
|
10993
11019
|
if (error) {
|
|
10994
|
-
|
|
11020
|
+
logger7.error("OAuth error:");
|
|
10995
11021
|
popup.close();
|
|
10996
11022
|
cleanup();
|
|
10997
11023
|
return;
|
|
@@ -11026,7 +11052,7 @@ var BaseSignUpContent = ({
|
|
|
11026
11052
|
} catch (e) {
|
|
11027
11053
|
}
|
|
11028
11054
|
} catch (e) {
|
|
11029
|
-
|
|
11055
|
+
logger7.error("Error monitoring popup:");
|
|
11030
11056
|
}
|
|
11031
11057
|
}, 1e3);
|
|
11032
11058
|
return true;
|
|
@@ -11229,7 +11255,7 @@ import {
|
|
|
11229
11255
|
EmbeddedFlowResponseType as EmbeddedFlowResponseType2,
|
|
11230
11256
|
withVendorCSSClassPrefix as withVendorCSSClassPrefix24,
|
|
11231
11257
|
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType4,
|
|
11232
|
-
createPackageComponentLogger as
|
|
11258
|
+
createPackageComponentLogger as createPackageComponentLogger8
|
|
11233
11259
|
} from "@asgardeo/browser";
|
|
11234
11260
|
import { cx as cx25 } from "@emotion/css";
|
|
11235
11261
|
import { useEffect as useEffect20, useState as useState21, useCallback as useCallback14, useRef as useRef9 } from "react";
|
|
@@ -11296,7 +11322,7 @@ var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
|
11296
11322
|
|
|
11297
11323
|
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
11298
11324
|
import { jsx as jsx80, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
11299
|
-
var
|
|
11325
|
+
var logger8 = createPackageComponentLogger8(
|
|
11300
11326
|
"@asgardeo/react",
|
|
11301
11327
|
"BaseSignUp"
|
|
11302
11328
|
);
|
|
@@ -11453,7 +11479,7 @@ var BaseSignUpContent2 = ({
|
|
|
11453
11479
|
const redirectUrl = response.data.redirectURL;
|
|
11454
11480
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
11455
11481
|
if (!popup) {
|
|
11456
|
-
|
|
11482
|
+
logger8.error("Failed to open popup window");
|
|
11457
11483
|
return false;
|
|
11458
11484
|
}
|
|
11459
11485
|
let hasProcessedCallback = false;
|
|
@@ -11524,7 +11550,7 @@ var BaseSignUpContent2 = ({
|
|
|
11524
11550
|
const state = url.searchParams.get("state");
|
|
11525
11551
|
const error = url.searchParams.get("error");
|
|
11526
11552
|
if (error) {
|
|
11527
|
-
|
|
11553
|
+
logger8.error("OAuth error:");
|
|
11528
11554
|
popup.close();
|
|
11529
11555
|
cleanup();
|
|
11530
11556
|
return;
|
|
@@ -11559,7 +11585,7 @@ var BaseSignUpContent2 = ({
|
|
|
11559
11585
|
} catch (e) {
|
|
11560
11586
|
}
|
|
11561
11587
|
} catch (e) {
|
|
11562
|
-
|
|
11588
|
+
logger8.error("Error monitoring popup:");
|
|
11563
11589
|
}
|
|
11564
11590
|
}, 1e3);
|
|
11565
11591
|
return true;
|
|
@@ -15812,7 +15838,7 @@ var BuildingAlt_default = BuildingAlt;
|
|
|
15812
15838
|
import { useState as useState32 } from "react";
|
|
15813
15839
|
|
|
15814
15840
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
15815
|
-
import { createPackageComponentLogger as
|
|
15841
|
+
import { createPackageComponentLogger as createPackageComponentLogger9 } from "@asgardeo/browser";
|
|
15816
15842
|
import { cx as cx34 } from "@emotion/css";
|
|
15817
15843
|
import { useState as useState31 } from "react";
|
|
15818
15844
|
|
|
@@ -15956,7 +15982,7 @@ var BaseCreateOrganization_styles_default = useStyles29;
|
|
|
15956
15982
|
|
|
15957
15983
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
15958
15984
|
import { jsx as jsx109, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
15959
|
-
var
|
|
15985
|
+
var logger9 = createPackageComponentLogger9(
|
|
15960
15986
|
"@asgardeo/react",
|
|
15961
15987
|
"BaseCreateOrganization"
|
|
15962
15988
|
);
|
|
@@ -16042,7 +16068,7 @@ var BaseCreateOrganization = ({
|
|
|
16042
16068
|
onSuccess(payload);
|
|
16043
16069
|
}
|
|
16044
16070
|
} catch (submitError) {
|
|
16045
|
-
|
|
16071
|
+
logger9.error("Form submission error:");
|
|
16046
16072
|
}
|
|
16047
16073
|
};
|
|
16048
16074
|
const createOrganizationContent = /* @__PURE__ */ jsx109("div", { className: cx34(styles["root"], cardLayout && styles["card"], className), style, children: /* @__PURE__ */ jsxs50("div", { className: cx34(styles["content"]), children: [
|
|
@@ -16691,7 +16717,7 @@ var OrganizationList = (props) => {
|
|
|
16691
16717
|
var OrganizationList_default = OrganizationList;
|
|
16692
16718
|
|
|
16693
16719
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
16694
|
-
import { createPackageComponentLogger as
|
|
16720
|
+
import { createPackageComponentLogger as createPackageComponentLogger10 } from "@asgardeo/browser";
|
|
16695
16721
|
import { useEffect as useEffect25, useState as useState36 } from "react";
|
|
16696
16722
|
|
|
16697
16723
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
@@ -17579,7 +17605,7 @@ var updateOrganization_default = updateOrganization;
|
|
|
17579
17605
|
|
|
17580
17606
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
17581
17607
|
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
17582
|
-
var
|
|
17608
|
+
var logger10 = createPackageComponentLogger10(
|
|
17583
17609
|
"@asgardeo/react",
|
|
17584
17610
|
"OrganizationProfile"
|
|
17585
17611
|
);
|
|
@@ -17610,7 +17636,7 @@ var OrganizationProfile = ({
|
|
|
17610
17636
|
});
|
|
17611
17637
|
setOrganization(orgData);
|
|
17612
17638
|
} catch (err) {
|
|
17613
|
-
|
|
17639
|
+
logger10.error("Failed to fetch organization:");
|
|
17614
17640
|
setOrganization(null);
|
|
17615
17641
|
}
|
|
17616
17642
|
};
|
|
@@ -17632,7 +17658,7 @@ var OrganizationProfile = ({
|
|
|
17632
17658
|
await onUpdate(payload);
|
|
17633
17659
|
}
|
|
17634
17660
|
} catch (err) {
|
|
17635
|
-
|
|
17661
|
+
logger10.error("Failed to update organization:");
|
|
17636
17662
|
throw err;
|
|
17637
17663
|
}
|
|
17638
17664
|
};
|