dauth-context-react 6.6.1 → 6.6.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/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +21 -0
- package/src/reducer/dauth.actions.ts +3 -1
package/dist/index.mjs
CHANGED
|
@@ -459,7 +459,9 @@ async function registerPasskeyAction(ctx, name) {
|
|
|
459
459
|
onError(new Error("Failed to start passkey registration"));
|
|
460
460
|
return null;
|
|
461
461
|
}
|
|
462
|
-
const credential = await createPasskeyCredential(
|
|
462
|
+
const credential = await createPasskeyCredential(
|
|
463
|
+
startResult.data.options
|
|
464
|
+
);
|
|
463
465
|
const finishResult = await finishPasskeyRegistrationAPI(authProxyPath, {
|
|
464
466
|
credential,
|
|
465
467
|
name
|
|
@@ -2198,6 +2200,18 @@ var DauthProvider = (props) => {
|
|
|
2198
2200
|
autoLoginAction(ctx);
|
|
2199
2201
|
}
|
|
2200
2202
|
}, []);
|
|
2203
|
+
useEffect2(() => {
|
|
2204
|
+
const handleVisibilityChange = () => {
|
|
2205
|
+
if (document.visibilityState === "visible" && !dauthState.isAuthenticated && !dauthState.isLoading) {
|
|
2206
|
+
autoLoginAction(ctx);
|
|
2207
|
+
}
|
|
2208
|
+
};
|
|
2209
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2210
|
+
return () => document.removeEventListener(
|
|
2211
|
+
"visibilitychange",
|
|
2212
|
+
handleVisibilityChange
|
|
2213
|
+
);
|
|
2214
|
+
}, [ctx, dauthState.isAuthenticated, dauthState.isLoading]);
|
|
2201
2215
|
const loginWithRedirect = useCallback2(() => {
|
|
2202
2216
|
const base = `${getClientBasePath()}/${domainName}/${routes.signin}`;
|
|
2203
2217
|
const url = env ? `${base}?env=${encodeURIComponent(env)}` : base;
|