@volr/react-ui 0.1.121 → 0.1.122
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.cjs
CHANGED
|
@@ -3090,6 +3090,7 @@ function SiweLoginScreen({
|
|
|
3090
3090
|
}
|
|
3091
3091
|
function SigninModal({ isOpen, onClose, onError }) {
|
|
3092
3092
|
const { logout, user } = react.useVolrContext();
|
|
3093
|
+
const { client } = react.useInternalAuth();
|
|
3093
3094
|
const { appName, branding } = useVolrUI();
|
|
3094
3095
|
const { requestEmailCode, verifyEmailCode, handleSocialLogin } = react.useVolrLogin();
|
|
3095
3096
|
const [currentScreen, setCurrentScreen] = React13.useState("method-select");
|
|
@@ -3122,13 +3123,43 @@ function SigninModal({ isOpen, onClose, onError }) {
|
|
|
3122
3123
|
const handleCodeSubmit = async (code) => {
|
|
3123
3124
|
const result = await verifyEmailCode(email, code);
|
|
3124
3125
|
if (result.keyStorageType) {
|
|
3126
|
+
try {
|
|
3127
|
+
const refreshed = await client.post(
|
|
3128
|
+
"/auth/refresh",
|
|
3129
|
+
{}
|
|
3130
|
+
);
|
|
3131
|
+
const currentRpId = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
3132
|
+
const passkeys = refreshed.user?.registeredPasskeys ?? [];
|
|
3133
|
+
const hasCurrent = passkeys.some((p) => p.rpId === currentRpId);
|
|
3134
|
+
const needsMigration = passkeys.length > 0 && !hasCurrent;
|
|
3135
|
+
if (result.keyStorageType === "passkey" && needsMigration) {
|
|
3136
|
+
setCurrentScreen("passkey-setup");
|
|
3137
|
+
return;
|
|
3138
|
+
}
|
|
3139
|
+
} catch {
|
|
3140
|
+
}
|
|
3125
3141
|
onClose();
|
|
3126
3142
|
return;
|
|
3127
3143
|
}
|
|
3128
3144
|
setCurrentScreen("passkey-setup");
|
|
3129
3145
|
};
|
|
3130
|
-
const handleSiweSuccess = (data) => {
|
|
3146
|
+
const handleSiweSuccess = async (data) => {
|
|
3131
3147
|
if (data.keyStorageType) {
|
|
3148
|
+
try {
|
|
3149
|
+
const refreshed = await client.post(
|
|
3150
|
+
"/auth/refresh",
|
|
3151
|
+
{}
|
|
3152
|
+
);
|
|
3153
|
+
const currentRpId = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
3154
|
+
const passkeys = refreshed.user?.registeredPasskeys ?? [];
|
|
3155
|
+
const hasCurrent = passkeys.some((p) => p.rpId === currentRpId);
|
|
3156
|
+
const needsMigration = passkeys.length > 0 && !hasCurrent;
|
|
3157
|
+
if (data.keyStorageType === "passkey" && needsMigration) {
|
|
3158
|
+
setCurrentScreen("passkey-setup");
|
|
3159
|
+
return;
|
|
3160
|
+
}
|
|
3161
|
+
} catch {
|
|
3162
|
+
}
|
|
3132
3163
|
onClose();
|
|
3133
3164
|
return;
|
|
3134
3165
|
}
|
|
@@ -6966,8 +6997,16 @@ function OAuthCallbackHandler({
|
|
|
6966
6997
|
const { isLoading, error } = react.useVolrAuthCallback({
|
|
6967
6998
|
onSuccess: (resultUser) => {
|
|
6968
6999
|
console.log("[OAuthCallbackHandler] Login successful:", resultUser.email);
|
|
7000
|
+
const currentRpId = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
7001
|
+
const passkeys = resultUser.registeredPasskeys ?? [];
|
|
7002
|
+
const hasCurrent = passkeys.some((p) => p.rpId === currentRpId);
|
|
7003
|
+
const needsMigration = passkeys.length > 0 && !hasCurrent;
|
|
6969
7004
|
if (!resultUser.keyStorageType) {
|
|
6970
7005
|
onShowOnboarding();
|
|
7006
|
+
return;
|
|
7007
|
+
}
|
|
7008
|
+
if (resultUser.keyStorageType === "passkey" && needsMigration) {
|
|
7009
|
+
onShowOnboarding();
|
|
6971
7010
|
}
|
|
6972
7011
|
},
|
|
6973
7012
|
onError: (err) => {
|