@volr/react-ui 0.1.121 → 0.1.123
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.cjs +40 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3085,6 +3085,7 @@ function SiweLoginScreen({
|
|
|
3085
3085
|
}
|
|
3086
3086
|
function SigninModal({ isOpen, onClose, onError }) {
|
|
3087
3087
|
const { logout, user } = useVolrContext();
|
|
3088
|
+
const { client } = useInternalAuth();
|
|
3088
3089
|
const { appName, branding } = useVolrUI();
|
|
3089
3090
|
const { requestEmailCode, verifyEmailCode, handleSocialLogin } = useVolrLogin();
|
|
3090
3091
|
const [currentScreen, setCurrentScreen] = useState("method-select");
|
|
@@ -3117,13 +3118,43 @@ function SigninModal({ isOpen, onClose, onError }) {
|
|
|
3117
3118
|
const handleCodeSubmit = async (code) => {
|
|
3118
3119
|
const result = await verifyEmailCode(email, code);
|
|
3119
3120
|
if (result.keyStorageType) {
|
|
3121
|
+
try {
|
|
3122
|
+
const refreshed = await client.post(
|
|
3123
|
+
"/auth/refresh",
|
|
3124
|
+
{}
|
|
3125
|
+
);
|
|
3126
|
+
const currentRpId = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
3127
|
+
const passkeys = refreshed.user?.registeredPasskeys ?? [];
|
|
3128
|
+
const hasCurrent = passkeys.some((p) => p.rpId === currentRpId);
|
|
3129
|
+
const needsMigration = passkeys.length > 0 && !hasCurrent;
|
|
3130
|
+
if (result.keyStorageType === "passkey" && needsMigration) {
|
|
3131
|
+
setCurrentScreen("passkey-setup");
|
|
3132
|
+
return;
|
|
3133
|
+
}
|
|
3134
|
+
} catch {
|
|
3135
|
+
}
|
|
3120
3136
|
onClose();
|
|
3121
3137
|
return;
|
|
3122
3138
|
}
|
|
3123
3139
|
setCurrentScreen("passkey-setup");
|
|
3124
3140
|
};
|
|
3125
|
-
const handleSiweSuccess = (data) => {
|
|
3141
|
+
const handleSiweSuccess = async (data) => {
|
|
3126
3142
|
if (data.keyStorageType) {
|
|
3143
|
+
try {
|
|
3144
|
+
const refreshed = await client.post(
|
|
3145
|
+
"/auth/refresh",
|
|
3146
|
+
{}
|
|
3147
|
+
);
|
|
3148
|
+
const currentRpId = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
3149
|
+
const passkeys = refreshed.user?.registeredPasskeys ?? [];
|
|
3150
|
+
const hasCurrent = passkeys.some((p) => p.rpId === currentRpId);
|
|
3151
|
+
const needsMigration = passkeys.length > 0 && !hasCurrent;
|
|
3152
|
+
if (data.keyStorageType === "passkey" && needsMigration) {
|
|
3153
|
+
setCurrentScreen("passkey-setup");
|
|
3154
|
+
return;
|
|
3155
|
+
}
|
|
3156
|
+
} catch {
|
|
3157
|
+
}
|
|
3127
3158
|
onClose();
|
|
3128
3159
|
return;
|
|
3129
3160
|
}
|
|
@@ -6961,8 +6992,16 @@ function OAuthCallbackHandler({
|
|
|
6961
6992
|
const { isLoading, error } = useVolrAuthCallback({
|
|
6962
6993
|
onSuccess: (resultUser) => {
|
|
6963
6994
|
console.log("[OAuthCallbackHandler] Login successful:", resultUser.email);
|
|
6995
|
+
const currentRpId = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
6996
|
+
const passkeys = resultUser.registeredPasskeys ?? [];
|
|
6997
|
+
const hasCurrent = passkeys.some((p) => p.rpId === currentRpId);
|
|
6998
|
+
const needsMigration = passkeys.length > 0 && !hasCurrent;
|
|
6964
6999
|
if (!resultUser.keyStorageType) {
|
|
6965
7000
|
onShowOnboarding();
|
|
7001
|
+
return;
|
|
7002
|
+
}
|
|
7003
|
+
if (resultUser.keyStorageType === "passkey" && needsMigration) {
|
|
7004
|
+
onShowOnboarding();
|
|
6966
7005
|
}
|
|
6967
7006
|
},
|
|
6968
7007
|
onError: (err) => {
|