-
-
Upgrade
-
- Enter your email and password to backup your account and sync across
- devices.
-
-
-
+
+
Backup and Sync
+
-
+
+
+
+
);
}
+
+type UpgradeStep = 'pick-option' | 'upgrade-with-email';
+
+export function UpgradeGuest() {
+ const [step, setStep] = useState
('pick-option');
+ const { initiateGoogleAuth } = useAuthActions();
+ const { toast } = useToast();
+
+ const handleUpgradeWithGoogle = async () => {
+ try {
+ const response = await initiateGoogleAuth();
+ console.debug('Initiate google upgrade response: ', response);
+ window.location.href = response.authUrl;
+ } catch (error) {
+ console.error('Failed to initiate google upgrade', { cause: error });
+ toast({
+ variant: 'destructive',
+ title: 'Error! Google upgrade failed',
+ description: getErrorMessage(error),
+ });
+ }
+ };
+
+ if (step === 'pick-option') {
+ return (
+ {
+ if (option === 'email') {
+ setStep('upgrade-with-email');
+ } else if (option === 'google') {
+ await handleUpgradeWithGoogle();
+ }
+ }}
+ />
+ );
+ }
+
+ return setStep('pick-option')} />;
+}