π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update(user):account-deletion-flow-improved
Aswin Asok7baa842ec2b0
diff --git a/web/apps/photos/src/components/DeleteAccount.tsx b/web/apps/photos/src/components/DeleteAccount.tsxindex 8fb4d63bec..6eda19a651 100644--- a/web/apps/photos/src/components/DeleteAccount.tsx+++ b/web/apps/photos/src/components/DeleteAccount.tsx@@ -1,22 +1,43 @@import { DropdownInput, type DropdownOption } from "@/components/DropdownInput";import {+ EnteAuthIcon,+ EnteLockerIcon,+ EntePhotosIcon,+} from "@/components/EnteAppIcon";+import ArrowBackIcon from "@mui/icons-material/ArrowBack";+import {+ Box,Checkbox,+ Dialog,+ DialogContent,+ DialogTitle,FormControlLabel,- FormGroup,+ IconButton,Link,Stack,TextField,Typography,} from "@mui/material";-import { TitledMiniDialog } from "ente-base/components/MiniDialog";-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";+import { SpacedRow } from "ente-base/components/containers";+import { DialogCloseIconButton } from "ente-base/components/mui/DialogCloseIconButton";import { LoadingButton } from "ente-base/components/mui/LoadingButton";import type { ModalVisibilityProps } from "ente-base/components/utils/modal";import { useBaseContext } from "ente-base/context";+import { isHTTPErrorWithStatus } from "ente-base/http";+import { formattedNumber, pt } from "ente-base/i18n";+import log from "ente-base/log";+import {+ uploadSheetMediaQuery,+ uploadSheetPaperSx,+ useIsUploadSheet,+} from "ente-gallery/components/upload-progress/bottom-sheet";+import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";import {decryptDeleteAccountChallenge,deleteAccount,getAccountDeleteChallenge,+ getAccountDeletionSummary,+ type AccountDeletionSummary,} from "ente-new/photos/services/user";import { initiateEmail } from "ente-new/photos/utils/web";import { useFormik } from "formik";@@ -24,62 +45,114 @@ import { t } from "i18next";import React, { useState } from "react";import { Trans } from "react-i18next";-type DeleteAccountProps = ModalVisibilityProps & {- onAuthenticateUser: () => Promise<void>;+type DeleteAccountProps = ModalVisibilityProps;++const surfaceRadius = "20px";+const fieldRadius = "16px";+const sheetPadding = "20px";+const sectionGap = "36px";+const bodyFont = { fontSize: "14px", lineHeight: "20px", fontWeight: 500 };+const miniFont = { fontSize: "12px", lineHeight: "16px", fontWeight: 500 };+const titleFont = {+ fontSize: "24px",+ lineHeight: "32px",+ fontWeight: 600,+ [uploadSheetMediaQuery]: { fontSize: "20px", lineHeight: "28px" },+};++const sheetGrey = {+ subtitle: "#999",+ fieldFill: "#212121",+ placeholder: "#969696",+ disabledFill: "#0a0a0a",+ disabledText: "#d6d6d6",+ surface: "#161616",};+const lightDisabledFill = "#eaeaea";+export const DeleteAccount: React.FC<DeleteAccountProps> = ({open,onClose,- ...rest-}) => (- <TitledMiniDialog open={open} onClose={onClose} title={t("delete_account")}>- <DeleteAccountDialogContents {...{ open, onClose }} {...rest} />- </TitledMiniDialog>-);+}) => {+ const isSheet = useIsUploadSheet();++ return (+ <Dialog+ {...{ open, onClose }}+ fullWidth+ slots={isSheet ? { transition: SlideUpTransition } : undefined}+ slotProps={{+ paper: {+ sx: [+ (theme) => ({+ maxWidth: "620px",+ borderRadius: surfaceRadius,+ ...theme.applyStyles("dark", {+ backgroundColor: sheetGrey.surface,+ }),+ }),+ uploadSheetPaperSx,+ ],+ },+ }}+ >+ <DeleteAccountDialogContents {...{ onClose }} />+ </Dialog>+ );+};-// Keep state in the dialog subtree so closing it resets the form.const DeleteAccountDialogContents: React.FC<Omit<DeleteAccountProps, "open">-> = ({ onClose, onAuthenticateUser }) => {+> = ({ onClose }) => {const { logout, showMiniDialog, onGenericError } = useBaseContext();+ const [step, setStep] = useState<"reason" | "confirmation">("reason");const [acceptDataDeletion, setAcceptDataDeletion] = useState(false);const [loading, setLoading] = useState(false);+ const [summary, setSummary] = useState<AccountDeletionSummary>();- const formik = useFormik({+ const formik = useFormik<{ reason: DeleteReason | ""; feedback: string }>({initialValues: { reason: "", feedback: "" },- validate: ({ reason, feedback }) => {- if (!reason) return { reason: t("required") };- if (!feedback.trim().length) {- return {- feedback:- reason == "found_another_service"- ? t("feedback_required_found_another_service")- : t("feedback_required"),- };- }- return {};- },+ validate: ({ reason }) => (reason ? {} : { reason: t("required") }),onSubmit: async ({ reason, feedback }) => {- feedback = feedback.trim();+ if (step == "reason") {+ setLoading(true);+ try {+ setSummary(await getAccountDeletionSummary());+ setStep("confirmation");+ } catch (e) {+ if (isHTTPErrorWithStatus(e, 404)) {+ log.info(+ "Account deletion summary is not supported by museum",+ );+ setStep("confirmation");+ } else {+ onGenericError(e);+ }+ }+ setLoading(false);+ return;+ }++ if (!acceptDataDeletion) return;+try {setLoading(true);const { allowDelete, encryptedChallenge } =await getAccountDeleteChallenge();- setLoading(false);if (allowDelete && encryptedChallenge) {- await onAuthenticateUser()- .then(confirmAccountDeletion)- .then(() =>- solveChallengeAndDeleteAccount(- encryptedChallenge,- reason,- feedback,- ),- );+ const decryptedChallenge =+ await decryptDeleteAccountChallenge(encryptedChallenge);+ await deleteAccount(+ decryptedChallenge,+ reason,+ feedback.trim() || undefined,+ );+ logout();} else {+ setLoading(false);askToMailForDeletion();}} catch (e) {@@ -89,19 +162,6 @@ const DeleteAccountDialogContents: React.FC<},});- const confirmAccountDeletion = () =>- new Promise<void>((resolve) =>- showMiniDialog({- title: t("delete_account"),- message: <Trans i18nKey="delete_account_confirm_message" />,- continue: {- text: t("delete"),- color: "critical",- action: resolve,- },- }),- );-const askToMailForDeletion = () => {const emailID = "[email protected]";@@ -122,87 +182,355 @@ const DeleteAccountDialogContents: React.FC<});};- const solveChallengeAndDeleteAccount = async (- encryptedChallenge: string,- reason: string,- feedback: string,- ) => {- setLoading(true);- const decryptedChallenge =- await decryptDeleteAccountChallenge(encryptedChallenge);- await deleteAccount(decryptedChallenge, reason, feedback);- logout();+ const handleBack = () => {+ setAcceptDataDeletion(false);+ setStep("reason");};+ const isReasonStep = step == "reason";+return (<form onSubmit={formik.handleSubmit}>- <Stack sx={{ gap: "24px" }}>- <Stack sx={{ gap: "4px" }}>+ <DialogTitle+ sx={{ "&&&": { padding: `${sheetPadding} ${sheetPadding} 0` } }}+ >+ <Stack sx={{ gap: "8px" }}>+ <SpacedRow+ sx={(theme) => ({+ gap: "8px",+ "> .MuiIconButton-root": {+ padding: "10px",+ borderRadius: "50%",+ backgroundColor: "fill.faint",+ ".MuiSvgIcon-root": {+ fontSize: "18px",+ color: "text.base",+ },+ ...theme.applyStyles("dark", {+ backgroundColor: sheetGrey.fieldFill,+ }),+ },+ })}+ >+ <Stack+ direction="row"+ sx={{ gap: "8px", alignItems: "center" }}+ >+ {!isReasonStep && (+ <IconButton+ aria-label={pt("Back")}+ color="primary"+ onClick={handleBack}+ disabled={loading}+ sx={{+ padding: "7px",+ borderRadius: "12px",+ ".MuiSvgIcon-root": {+ fontSize: "24px",+ },+ }}+ >+ <ArrowBackIcon />+ </IconButton>+ )}+ <Typography variant="h3" sx={titleFont}>+ {isReasonStep+ ? pt("Why are you leaving?")+ : pt(+ "Permanently delete your Ente account?",+ )}+ </Typography>+ </Stack>+ <DialogCloseIconButton {...{ onClose }} />+ </SpacedRow><Typography- sx={{- fontWeight: 800,- mb: "24px",- color: "critical.main",- }}+ variant="small"+ sx={(theme) => ({+ ...bodyFont,+ color: "text.muted",+ ...theme.applyStyles("dark", {+ color: sheetGrey.subtitle,+ }),+ })}>- {t("delete_account_multi_app_warning")}+ {isReasonStep+ ? pt("This helps us improve Ente.")+ : pt(+ "One account across Photos, Auth, and Locker.",+ )}</Typography>- <Typography>{t("delete_account_reason_label")}</Typography>- <DropdownInput- options={deleteReasonOptions()}- placeholder={t("delete_account_reason_placeholder")}- selected={formik.values.reason}- onSelect={formik.handleChange("reason")}- />- {formik.touched.reason && formik.errors.reason && (- <Typography- variant="small"- sx={{ px: 1, color: "critical.main" }}- >- {formik.errors.reason}- </Typography>- )}</Stack>- <FeedbackInput- value={formik.values.feedback}- onChange={formik.handleChange("feedback")}- errorMessage={- formik.touched.feedback- ? formik.errors.feedback- : undefined- }- />- <ConfirmationCheckboxInput- checked={acceptDataDeletion}- onChange={setAcceptDataDeletion}- />- <Stack sx={{ gap: "8px" }}>+ </DialogTitle>+ <DialogContent+ sx={{+ "&&&": {+ padding: `0 ${sheetPadding} ${sheetPadding}`,+ paddingTop: sectionGap,+ [uploadSheetMediaQuery]: {+ paddingBottom: `calc(${sheetPadding} + env(safe-area-inset-bottom, 0px))`,+ },+ },+ }}+ >+ <Stack sx={{ gap: sectionGap }}>+ {isReasonStep ? (+ <Stack sx={{ gap: sectionGap }}>+ <Stack sx={{ gap: "8px" }}>+ <Typography+ variant="small"+ sx={{+ ...bodyFont,+ display: "flex",+ gap: "2px",+ }}+ >+ {pt("Reason for leaving")}+ <Box+ component="span"+ sx={{ color: "critical.main" }}+ >+ {"*"}+ </Box>+ </Typography>+ <DropdownInput+ options={deleteReasonOptions()}+ placeholder={t(+ "delete_account_reason_placeholder",+ )}+ selected={formik.values.reason}+ onSelect={formik.handleChange("reason")}+ sx={(theme) => ({+ borderRadius: fieldRadius,+ ".MuiSelect-select": {+ borderRadius: fieldRadius,+ minHeight: "20px",+ paddingBlock: "16px",+ paddingLeft: "16px",+ ...theme.applyStyles("dark", {+ backgroundColor:+ sheetGrey.fieldFill,+ }),+ },+ ".MuiSelect-icon": { right: "16px" },+ ".MuiOutlinedInput-notchedOutline": {+ borderRadius: fieldRadius,+ },+ "&:hover .MuiOutlinedInput-notchedOutline":+ { borderColor: "transparent" },+ "&.Mui-focused .MuiOutlinedInput-notchedOutline":+ {+ borderColor: "stroke.muted",+ borderWidth: "1px",+ },+ "&& .MuiTypography-root": {+ ...bodyFont,+ ...(!formik.values.reason &&+ theme.applyStyles("dark", {+ color: sheetGrey.placeholder,+ })),+ },+ })}+ />+ {formik.touched.reason &&+ formik.errors.reason && (+ <Typography+ variant="small"+ sx={{+ ...bodyFont,+ px: 1,+ color: "critical.main",+ }}+ >+ {formik.errors.reason}+ </Typography>+ )}+ </Stack>+ <Stack sx={{ gap: "8px" }}>+ <Typography variant="small" sx={bodyFont}>+ {pt("Anything else?")}+ </Typography>+ <TextField+ variant="standard"+ margin="none"+ multiline+ rows={5}+ value={formik.values.feedback}+ onChange={formik.handleChange("feedback")}+ placeholder={pt("Share your feedback here")}+ sx={(theme) => ({+ backgroundColor: "fill.faint",+ borderRadius: fieldRadius,+ padding: "20px 16px",+ ...theme.applyStyles("dark", {+ backgroundColor:+ sheetGrey.fieldFill,+ }),+ ".MuiInputBase-formControl": {+ padding: 0,+ "::before, ::after": {+ borderBottom: "none !important",+ },+ },+ ".MuiInputBase-input": {+ ...bodyFont,+ "::placeholder": {+ color: "text.muted",+ opacity: 1,+ ...theme.applyStyles("dark", {+ color: sheetGrey.placeholder,+ }),+ },+ },+ })}+ />+ </Stack>+ </Stack>+ ) : (+ <Stack sx={{ gap: "12px" }}>+ <Stack sx={{ gap: "8px" }}>+ <SummaryRow+ icon={<EntePhotosIcon />}+ unit={pt("photos & videos")}+ app={pt("Ente Photos")}+ count={summary?.photosAndVideosCount}+ />+ <SummaryRow+ icon={<EnteAuthIcon />}+ unit={pt("authenticator codes")}+ app={pt("Ente Auth")}+ count={summary?.authenticatorCodesCount}+ />+ <SummaryRow+ icon={<EnteLockerIcon />}+ unit={pt("records")}+ app={pt("Ente Locker")}+ count={summary?.lockerRecordsCount}+ />+ </Stack>+ <FormControlLabel+ sx={{+ margin: 0,+ gap: "12px",+ alignItems: "flex-start",+ paddingBlock: "8px",+ }}+ control={+ <Checkbox+ size="small"+ checked={acceptDataDeletion}+ onChange={(e) =>+ setAcceptDataDeletion(+ e.target.checked,+ )+ }+ sx={(theme) => ({+ padding: 0,+ color: "text.faint",+ ...theme.applyStyles("dark", {+ color: sheetGrey.placeholder,+ }),+ "&.Mui-checked": {+ color: "critical.main",+ },+ ".MuiSvgIcon-root": {+ fontSize: "20px",+ },+ })}+ />+ }+ label={+ <Typography variant="small" sx={bodyFont}>+ {pt(+ "I understand this deletes my data across Photos, Auth, and Locker.",+ )}+ </Typography>+ }+ />+ </Stack>+ )}<LoadingButtontype="submit"fullWidth- color="critical"- disabled={!acceptDataDeletion}+ color={isReasonStep ? "primary" : "critical"}+ disabled={+ isReasonStep+ ? !formik.values.reason+ : !acceptDataDeletion+ }loading={loading}+ sx={(theme) => ({+ ...bodyFont,+ fontWeight: 500,+ height: "48px",+ padding: "14px 24px",+ borderRadius: surfaceRadius,+ ...(!loading && {+ "&.Mui-disabled": {+ backgroundColor: lightDisabledFill,+ ...theme.applyStyles("dark", {+ backgroundColor: sheetGrey.disabledFill,+ color: sheetGrey.disabledText,+ }),+ },+ }),+ })}>- {t("delete_account_confirm")}+ {isReasonStep+ ? pt("Continue")+ : pt("Delete Ente account")}</LoadingButton>- <FocusVisibleButton- fullWidth- color="secondary"- onClick={onClose}- >- {t("cancel")}- </FocusVisibleButton></Stack>- </Stack>+ </DialogContent></form>);};-// Each value must have a delete_reason translation.+interface SummaryRowProps {+ icon: React.ReactNode;+ unit: string;+ app: string;+ count?: number | undefined;+}++const SummaryRow: React.FC<SummaryRowProps> = ({ icon, unit, app, count }) => (+ <Stack+ direction="row"+ sx={(theme) => ({+ gap: "12px",+ alignItems: "center",+ height: "60px",+ paddingInline: "12px",+ borderRadius: surfaceRadius,+ backgroundColor: "fill.faint",+ ...theme.applyStyles("dark", {+ backgroundColor: sheetGrey.fieldFill,+ }),+ })}+ >+ <Box sx={{ lineHeight: 0, flexShrink: 0 }}>{icon}</Box>+ <Stack sx={{ gap: "4px" }}>+ <Typography variant="small" sx={bodyFont}>+ {count == undefined+ ? unit+ : `${formattedNumber(count)} ${unit}`}+ </Typography>+ <Typography+ variant="mini"+ sx={(theme) => ({+ ...miniFont,+ color: "text.muted",+ ...theme.applyStyles("dark", { color: sheetGrey.subtitle }),+ })}+ >+ {app}+ </Typography>+ </Stack>+ </Stack>+);+const deleteReasons = ["missing_feature",- "behaviour",+ "unexpected_behaviour","found_another_service","not_listed",] as const;@@ -211,74 +539,8 @@ type DeleteReason = (typeof deleteReasons)[number];const deleteReasonOptions = (): DropdownOption<DeleteReason>[] =>deleteReasons.map((reason) => ({- label: t(`delete_reason.${reason}`),+ label: t(+ `delete_reason.${reason == "unexpected_behaviour" ? "behaviour" : reason}`,+ ),value: reason,}));--interface FeedbackInputProps {- value: string;- errorMessage?: string | undefined;- onChange: (value: string) => void;-}--const FeedbackInput: React.FC<FeedbackInputProps> = ({- value,- onChange,- errorMessage,-}) => (- <Stack sx={{ gap: "4px" }}>- <Typography>{t("delete_account_feedback_label")}</Typography>- <TextField- variant="standard"- multiline- rows={3}- value={value}- onChange={(e) => onChange(e.target.value)}- placeholder={t("delete_account_feedback_placeholder")}- sx={{- border: "1px solid",- borderColor: "stroke.faint",- borderRadius: "8px",- padding: "12px",- ".MuiInputBase-formControl": {- "::before, ::after": { borderBottom: "none !important" },- },- }}- />- {errorMessage && (- <Typography- variant="small"- sx={{ px: "8px", color: "critical.main" }}- >- {errorMessage}- </Typography>- )}- </Stack>-);--interface ConfirmationCheckboxInputProps {- checked: boolean;- onChange: (value: boolean) => void;-}--const ConfirmationCheckboxInput: React.FC<ConfirmationCheckboxInputProps> = ({- checked,- onChange,-}) => (- <FormGroup>- <FormControlLabel- control={- <Checkbox- size="small"- checked={checked}- onChange={(e) => onChange(e.target.checked)}- />- }- label={- <Typography sx={{ color: "text.muted" }}>- {t("delete_account_confirm_checkbox_label")}- </Typography>- }- />- </FormGroup>-);diff --git a/web/apps/photos/src/components/DropdownInput.tsx b/web/apps/photos/src/components/DropdownInput.tsxindex 198d968b59..917eb34379 100644--- a/web/apps/photos/src/components/DropdownInput.tsx+++ b/web/apps/photos/src/components/DropdownInput.tsx@@ -2,8 +2,11 @@ import {MenuItem,Select,type SelectChangeEvent,+ type SxProps,+ type Theme,Typography,} from "@mui/material";+import { isSxArray } from "ente-base/components/utils/sx";export interface DropdownOption<T> {label: string;@@ -15,6 +18,8 @@ interface DropdownInputProps<T> {selected: T | undefined;onSelect: (selectedValue: T) => void;placeholder?: string;+ /** Additional styling, applied on top of the defaults. */+ sx?: SxProps<Theme>;}export const DropdownInput = <T extends string>({@@ -22,6 +27,7 @@ export const DropdownInput = <T extends string>({selected,onSelect,placeholder,+ sx,}: DropdownInputProps<T>) => (<Selectvalue={selected}@@ -58,10 +64,15 @@ export const DropdownInput = <T extends string>({},},}}- sx={{- ".MuiOutlinedInput-notchedOutline": { borderColor: "transparent" },- ".MuiSelect-select": { backgroundColor: "fill.faint" },- }}+ sx={[+ {+ ".MuiOutlinedInput-notchedOutline": {+ borderColor: "transparent",+ },+ ".MuiSelect-select": { backgroundColor: "fill.faint" },+ },+ ...(sx ? (isSxArray(sx) ? sx : [sx]) : []),+ ]}>{options.map(({ value, label }) => (<MenuItem key={value} value={value}>diff --git a/web/apps/photos/src/components/EnteAppIcon.tsx b/web/apps/photos/src/components/EnteAppIcon.tsxnew file mode 100644index 0000000000..44120fbada--- /dev/null+++ b/web/apps/photos/src/components/EnteAppIcon.tsx@@ -0,0 +1,128 @@+import React from "react";++/**+ * The app marks for Ente Photos, Ente Auth and Ente Locker.+ *+ * These are inlined instead of being served as static assets because the "e"+ * glyph is knocked out of the surface behind it: both of its colors are bound+ * to theme CSS variables (the glyph follows text.base, the knockout follows+ * background.paper) so that the marks invert along with the theme.+ */+interface EnteAppIconProps {+ /** Side of the (square) mark, in px. Default 36. */+ size?: number;+}++const AppIcon: React.FC<React.PropsWithChildren<EnteAppIconProps>> = ({+ size,+ children,+}) => (+ <svg+ width={size ?? 36}+ height={size ?? 36}+ viewBox="0 0 36 36"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ {children}+ </svg>+);++export const EntePhotosIcon: React.FC<EnteAppIconProps> = ({ size }) => (+ <AppIcon {...{ size }}>+ <path+ d="M8.36 11.8C10.89 7 16.68 4.9 21.75 6.4C25.58 7.48 28.5 10.9 29.28 14.85C29.83 17.54 28.88 19.92 26.39 20.66C25.91 20.81 25.37 20.88 24.85 20.9C23.1 20.93 21.55 20.9 19.75 20.91C18.17 20.91 16.46 20.92 14.91 20.92C14.73 20.92 14.56 20.91 14.39 20.97V20.97L14.39 20.97C14.15 21.05 13.97 21.32 14.02 21.58C14.11 21.98 14.68 22.43 15.01 22.66C16.63 23.74 19.45 23.77 21.21 23.18C21.89 22.95 22.54 22.62 23.16 22.28C23.61 22.04 24.08 21.77 24.59 21.64C26.19 21.19 27.55 22.27 27.83 23.9C28.19 25.91 26.49 27.12 24.98 27.99C22.9 29.22 20.41 29.64 17.98 29.49C11.79 29.2 7 24.3 6.96 17.92C6.92 15.81 7.41 13.54 8.36 11.8ZM18.59 11.84C16.7 11.78 14.91 12.6 14.11 14.25C14.03 14.41 13.95 14.6 13.96 14.79C13.96 15.02 14.11 15.22 14.33 15.29L14.33 15.29C14.45 15.34 14.56 15.35 14.68 15.35C16.78 15.34 20.22 15.36 22.21 15.34C22.45 15.35 22.71 15.26 22.83 15.02C22.88 14.92 22.89 14.8 22.87 14.68C22.86 14.57 22.82 14.45 22.77 14.34C21.98 12.66 20.27 11.85 18.59 11.84Z"+ fill="var(--mui-palette-text-base)"+ />+ <path+ d="M8.36 11.8C10.89 7 16.68 4.9 21.75 6.4C25.58 7.48 28.5 10.9 29.28 14.85C29.83 17.54 28.88 19.92 26.39 20.66C25.91 20.81 25.37 20.88 24.85 20.9C23.1 20.93 21.55 20.9 19.75 20.91C18.17 20.91 16.46 20.92 14.91 20.92C14.73 20.92 14.56 20.91 14.39 20.97V20.97L14.39 20.97C14.15 21.05 13.97 21.32 14.02 21.58C14.11 21.98 14.68 22.43 15.01 22.66C16.63 23.74 19.45 23.77 21.21 23.18C21.89 22.95 22.54 22.62 23.16 22.28C23.61 22.04 24.08 21.77 24.59 21.64C26.19 21.19 27.55 22.27 27.83 23.9C28.19 25.91 26.49 27.12 24.98 27.99C22.9 29.22 20.41 29.64 17.98 29.49C11.79 29.2 7 24.3 6.96 17.92C6.92 15.81 7.41 13.54 8.36 11.8ZM18.59 11.84C16.7 11.78 14.91 12.6 14.11 14.25C14.03 14.41 13.95 14.6 13.96 14.79C13.96 15.02 14.11 15.22 14.33 15.29L14.33 15.29C14.45 15.34 14.56 15.35 14.68 15.35C16.78 15.34 20.22 15.36 22.21 15.34C22.45 15.35 22.71 15.26 22.83 15.02C22.88 14.92 22.89 14.8 22.87 14.68C22.86 14.57 22.82 14.45 22.77 14.34C21.98 12.66 20.27 11.85 18.59 11.84Z"+ stroke="var(--mui-palette-text-base)"+ />+ <path+ d="M10.83 14.59C10.62 14.59 10.42 14.53 10.24 14.41L10.19 14.38C7.56 12.69 5.83 11.58 5.6 9.78C5.49 8.96 5.78 8.13 6.37 7.57C6.88 7.07 7.52 6.81 8.22 6.81C8.8 6.81 9.36 6.99 9.83 7.31C10.05 7 10.35 6.74 10.68 6.54C11.11 6.29 11.58 6.15 12.06 6.15C12.44 6.15 12.82 6.24 13.17 6.41C13.53 6.57 13.86 6.83 14.11 7.16C14.35 7.48 14.53 7.85 14.6 8.25C14.93 9.91 13.82 11.45 12.08 13.68L12.08 13.68L11.69 14.17C11.48 14.44 11.17 14.59 10.83 14.59V14.59Z"+ fill="#20D34F"+ />+ <path+ d="M12.06 6.39C12.39 6.39 12.74 6.46 13.08 6.62C13.75 6.93 14.23 7.57 14.38 8.3C14.71 9.95 13.46 11.54 11.55 13.97L11.51 14.02L11.51 14.02C11.34 14.24 11.09 14.36 10.83 14.36C10.67 14.36 10.51 14.31 10.36 14.21L10.31 14.18C7.73 12.52 6.05 11.43 5.83 9.75C5.73 9.02 5.99 8.25 6.53 7.74C7.02 7.26 7.63 7.05 8.22 7.05C8.83 7.05 9.43 7.27 9.88 7.65C10.32 6.91 11.15 6.39 12.06 6.39M12.06 5.92C11.54 5.92 11.03 6.06 10.57 6.34C10.27 6.51 10 6.74 9.77 7C9.61 6.91 9.44 6.83 9.27 6.76C8.93 6.64 8.58 6.58 8.22 6.58C7.86 6.58 7.51 6.64 7.17 6.77C6.82 6.91 6.49 7.12 6.21 7.39C5.89 7.7 5.65 8.08 5.51 8.5C5.36 8.92 5.31 9.38 5.37 9.81V9.81V9.81C5.43 10.3 5.59 10.74 5.87 11.18C6.11 11.56 6.44 11.94 6.88 12.33C7.68 13.04 8.78 13.75 10.06 14.58L10.11 14.61C10.33 14.75 10.57 14.83 10.83 14.83C11.24 14.83 11.62 14.64 11.87 14.32L12.65 13.33L12.64 13.33C13.28 12.51 13.82 11.76 14.21 11.07C14.49 10.56 14.69 10.09 14.79 9.65C14.91 9.15 14.92 8.67 14.83 8.2C14.74 7.77 14.56 7.36 14.29 7.01C14.01 6.66 13.66 6.37 13.27 6.19C12.88 6.01 12.47 5.92 12.06 5.92H12.06Z"+ fill="var(--mui-palette-background-paper)"+ />+ <path+ d="M7.97 9.97C8.59 9.97 9.1 9.45 9.1 8.81C9.1 8.18 8.59 7.66 7.97 7.66C7.35 7.66 6.84 8.18 6.84 8.81C6.84 9.45 7.35 9.97 7.97 9.97Z"+ fill="#58E87A"+ />+ </AppIcon>+);++export const EnteAuthIcon: React.FC<EnteAppIconProps> = ({ size }) => (+ <AppIcon {...{ size }}>+ <path+ d="M15.36 20.7C15.52 20.65 15.69 20.66 15.85 20.66C17.31 20.66 18.91 20.65 20.4 20.65C22.09 20.64 23.54 20.67 25.19 20.64C25.68 20.62 26.18 20.56 26.64 20.42C28.96 19.75 29.86 17.55 29.34 15.09C28.61 11.45 25.87 8.31 22.27 7.32C17.51 5.95 12.08 7.87 9.71 12.29C8.81 13.88 8.35 15.97 8.39 17.91C8.42 23.77 12.92 28.27 18.73 28.53C21.01 28.67 23.35 28.29 25.31 27.15C26.73 26.36 28.32 25.25 27.98 23.4C27.72 21.9 26.44 20.91 24.94 21.32C24.46 21.44 24.02 21.69 23.59 21.91C23.02 22.22 22.4 22.52 21.77 22.73C20.11 23.28 17.47 23.25 15.94 22.26C15.63 22.05 15.1 21.63 15.02 21.26C14.96 21.02 15.14 20.78 15.36 20.7H15.36H15.36ZM15.3 15.49C15.1 15.42 14.96 15.24 14.96 15.03C14.95 14.86 15.02 14.68 15.1 14.53C15.85 13.02 17.54 12.27 19.31 12.32C20.88 12.33 22.49 13.07 23.23 14.61C23.28 14.72 23.31 14.82 23.33 14.93C23.34 15.04 23.33 15.15 23.28 15.24C23.17 15.46 22.94 15.55 22.71 15.54C20.84 15.55 17.61 15.54 15.64 15.54C15.53 15.54 15.42 15.53 15.3 15.49H15.3V15.49Z"+ fill="var(--mui-palette-text-base)"+ />+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M5.89 7.5C7.41 7.61 8.67 7.19 10.17 6.57C10.27 6.53 10.37 6.54 10.45 6.59C11.83 7.42 13.05 8.02 14.55 8.12C14.71 8.14 14.84 8.28 14.83 8.45L14.54 12.5C14.3 15.86 11.78 16.52 9.67 17.52C9.57 17.56 9.46 17.55 9.37 17.49C7.46 16.22 5.03 15.22 5.28 11.84L5.57 7.78C5.58 7.62 5.72 7.49 5.89 7.5Z"+ fill="#C36FFF"+ />+ <path+ d="M10.34 6.98L9.6 16.83L12.04 16.11L13.68 14.41L14.29 11.29L14.36 8.72L10.34 6.98Z"+ fill="#AC39FF"+ />+ <path+ d="M10.17 6.57C10.27 6.53 10.37 6.54 10.44 6.59C11.83 7.42 13.05 8.02 14.55 8.12C14.71 8.14 14.84 8.28 14.83 8.45L14.54 12.5C14.3 15.86 11.78 16.52 9.67 17.52C9.57 17.56 9.46 17.55 9.37 17.49C7.46 16.22 5.03 15.22 5.28 11.84L5.57 7.78C5.58 7.62 5.72 7.49 5.89 7.5C7.41 7.61 8.67 7.19 10.17 6.57ZM10.25 7.37C8.95 7.9 7.73 8.31 6.31 8.29L6.05 11.89C5.94 13.35 6.4 14.23 7.07 14.91C7.76 15.61 8.62 16.08 9.58 16.7C10.63 16.22 11.56 15.88 12.33 15.28C13.09 14.7 13.66 13.9 13.77 12.45L14.02 8.85C12.63 8.66 11.45 8.08 10.25 7.37Z"+ fill="var(--mui-palette-background-paper)"+ />+ <path+ d="M6.7 9.63L6.57 12.05C6.55 12.5 6.89 12.89 7.35 12.91C7.8 12.94 8.19 12.59 8.21 12.13L8.34 9.72C8.37 9.27 8.02 8.88 7.57 8.86C7.11 8.83 6.73 9.18 6.7 9.63Z"+ fill="#CC84FF"+ />+ </AppIcon>+);++export const EnteLockerIcon: React.FC<EnteAppIconProps> = ({ size }) => (+ <AppIcon {...{ size }}>+ <path+ d="M14.97 21.21C15.13 21.15 15.3 21.16 15.46 21.16C16.97 21.16 18.61 21.16 20.13 21.16C21.87 21.15 23.36 21.18 25.05 21.15C25.55 21.13 26.07 21.06 26.54 20.92C28.93 20.23 29.85 17.98 29.31 15.45C28.57 11.71 25.75 8.49 22.06 7.47C17.17 6.06 11.59 8.04 9.16 12.57C8.23 14.21 7.76 16.35 7.81 18.34C7.84 24.36 12.46 28.98 18.42 29.25C20.77 29.4 23.17 29 25.17 27.84C26.63 27.02 28.26 25.88 27.92 23.98C27.66 22.44 26.34 21.42 24.79 21.84C24.3 21.97 23.85 22.22 23.42 22.45C22.82 22.77 22.19 23.08 21.54 23.3C19.84 23.85 17.13 23.83 15.56 22.81C15.24 22.6 14.7 22.16 14.61 21.79C14.56 21.54 14.73 21.29 14.96 21.21H14.97H14.97ZM14.9 15.86C14.7 15.79 14.55 15.6 14.55 15.38C14.54 15.21 14.62 15.03 14.7 14.88C15.47 13.32 17.2 12.55 19.02 12.61C20.63 12.62 22.29 13.38 23.04 14.96C23.09 15.07 23.13 15.18 23.14 15.29C23.16 15.4 23.15 15.51 23.1 15.6C22.98 15.83 22.74 15.92 22.51 15.91C20.59 15.92 17.27 15.91 15.25 15.91C15.13 15.91 15.02 15.9 14.91 15.86H14.9V15.86Z"+ fill="var(--mui-palette-text-base)"+ />+ <path+ d="M12.05 7.5L10.28 7.02L9.72 9.07L11.48 9.55L12.05 7.5Z"+ fill="var(--mui-palette-background-paper)"+ stroke="var(--mui-palette-text-base)"+ strokeWidth="0.495454"+ strokeMiterlimit="10"+ />+ <path+ d="M10.85 5.89C11.06 5.89 11.27 5.92 11.48 5.98C11.51 5.98 11.54 5.99 11.57 6C12.15 6.19 12.63 6.59 12.92 7.12C13.21 7.66 13.28 8.28 13.12 8.87L12.84 9.92L12.94 9.94C12.95 9.95 12.97 9.95 12.99 9.96C13.6 10.16 13.95 10.8 13.78 11.43L12.8 14.99C12.72 15.3 12.51 15.56 12.23 15.72C12.05 15.82 11.85 15.88 11.64 15.88C11.53 15.88 11.42 15.86 11.32 15.83L6.37 14.48C6.36 14.47 6.34 14.47 6.33 14.46C5.71 14.26 5.36 13.62 5.53 12.99L6.51 9.43C6.6 9.12 6.8 8.86 7.08 8.7C7.26 8.6 7.47 8.54 7.67 8.54C7.78 8.54 7.89 8.56 7.99 8.59L8.3 8.67L8.58 7.62C8.87 6.58 9.82 5.89 10.85 5.89M11.5 9.55L11.78 8.5C11.92 8 11.64 7.48 11.15 7.32C11.13 7.32 11.12 7.32 11.11 7.31C11.02 7.29 10.93 7.28 10.85 7.28C10.42 7.28 10.03 7.56 9.92 7.99L9.63 9.04L11.5 9.55M10.85 5.3C9.53 5.3 8.36 6.19 8.01 7.46L7.87 7.96C7.81 7.95 7.74 7.95 7.67 7.95C7.36 7.95 7.05 8.03 6.78 8.18C6.36 8.42 6.06 8.81 5.94 9.27L4.96 12.84C4.7 13.77 5.22 14.73 6.14 15.03C6.17 15.04 6.19 15.04 6.22 15.05L11.16 16.41C11.32 16.45 11.48 16.47 11.64 16.47C11.95 16.47 12.26 16.39 12.53 16.24C12.95 16 13.25 15.61 13.38 15.15L14.35 11.59C14.57 10.79 14.23 9.97 13.55 9.56L13.7 9.03C13.9 8.29 13.81 7.51 13.44 6.84C13.08 6.17 12.48 5.67 11.75 5.44C11.71 5.42 11.67 5.41 11.63 5.4C11.38 5.33 11.11 5.29 10.85 5.29V5.3ZM10.36 8.62L10.49 8.14C10.54 7.99 10.68 7.87 10.85 7.87C10.88 7.87 10.92 7.88 10.95 7.89C10.95 7.89 10.96 7.89 10.96 7.89C11.15 7.95 11.26 8.15 11.21 8.35L11.08 8.82L10.36 8.62H10.36Z"+ fill="var(--mui-palette-background-paper)"+ />+ <path+ d="M12.01 10.95L8.9 9.95L7.65 13.85L10.76 14.85L12.01 10.95Z"+ fill="var(--mui-palette-background-paper)"+ stroke="var(--mui-palette-text-base)"+ strokeWidth="0.495454"+ strokeMiterlimit="10"+ />+ <path+ d="M6.36 14.37C5.79 14.19 5.47 13.59 5.62 13.02L6.6 9.45C6.77 8.86 7.38 8.51 7.97 8.68L8.36 8.78L8.67 7.65C9 6.44 10.25 5.74 11.45 6.07C11.48 6.07 11.51 6.08 11.54 6.09C12.7 6.46 13.35 7.67 13.03 8.84L12.72 9.98L12.91 10.03C12.93 10.04 12.94 10.04 12.96 10.05C13.53 10.23 13.85 10.82 13.69 11.4L12.71 14.96C12.55 15.55 11.94 15.9 11.34 15.74L6.4 14.38C6.39 14.38 6.37 14.37 6.36 14.37V14.37ZM10.1 11.22C10.09 11.22 10.08 11.21 10.07 11.21C9.83 11.15 9.58 11.21 9.4 11.37C9.31 11.46 9.24 11.58 9.2 11.71C9.13 11.97 9.22 12.26 9.43 12.44C9.48 12.48 9.51 12.56 9.49 12.63L9.29 13.36C9.26 13.45 9.31 13.55 9.41 13.58L9.42 13.59C9.52 13.61 9.62 13.55 9.64 13.46L9.84 12.73C9.86 12.66 9.92 12.6 10 12.59C10.27 12.55 10.49 12.35 10.56 12.08C10.6 11.95 10.6 11.81 10.56 11.68C10.49 11.46 10.31 11.29 10.1 11.22V11.22ZM11.18 7.23C11.16 7.23 11.15 7.23 11.13 7.22C10.57 7.07 9.98 7.4 9.83 7.96L9.52 9.1L11.57 9.67L11.88 8.53C12.03 7.98 11.72 7.41 11.18 7.23V7.23Z"+ fill="#08A7FF"+ />+ <path+ d="M8.39 8.89L9.53 9.2L9.75 8.18C9.75 8.18 9.9 7.35 10.47 7.3C11.05 7.24 11.17 7.24 11.17 7.24L11.8 7.64L11.96 8.37L11.59 9.41L11.51 9.75L12.7 10.08L13.12 8.62L13.04 7.88L12.9 7.32L12.47 6.66L12.13 6.36L11.32 6.02L10.49 5.99L9.86 6.23L9.19 6.69L8.99 7.03L8.75 7.46L8.55 8.07L8.37 8.78L8.4 8.89H8.39Z"+ fill="var(--mui-palette-text-base)"+ />+ <path+ d="M11.51 6.18C12.61 6.54 13.25 7.7 12.94 8.82L12.61 10.05L12.89 10.13C12.9 10.13 12.91 10.14 12.93 10.14C13.44 10.31 13.74 10.85 13.6 11.38L12.62 14.94C12.47 15.48 11.91 15.8 11.37 15.65L6.43 14.29C6.41 14.29 6.4 14.28 6.38 14.28C5.87 14.11 5.57 13.57 5.71 13.04L6.69 9.48C6.84 8.94 7.4 8.62 7.94 8.77L8.43 8.9L8.76 7.67C9.08 6.52 10.27 5.84 11.42 6.16C11.45 6.17 11.48 6.18 11.51 6.18ZM9.4 9.17L11.63 9.78L11.97 8.55C12.13 7.95 11.79 7.33 11.2 7.14C11.19 7.14 11.17 7.13 11.16 7.13C10.54 6.96 9.9 7.32 9.73 7.94L9.4 9.17M9.38 13.67C9.38 13.67 9.39 13.67 9.39 13.68C9.54 13.72 9.69 13.63 9.73 13.48L9.93 12.76C9.94 12.72 9.97 12.69 10.01 12.68C10.31 12.63 10.57 12.42 10.65 12.11C10.7 11.95 10.69 11.79 10.64 11.65C10.57 11.41 10.38 11.21 10.13 11.13C10.12 11.13 10.1 11.12 10.09 11.12C9.82 11.04 9.53 11.12 9.34 11.3C9.23 11.4 9.15 11.53 9.11 11.68C9.02 11.99 9.13 12.31 9.36 12.51C9.39 12.53 9.41 12.57 9.4 12.61L9.2 13.33C9.16 13.48 9.24 13.63 9.38 13.67M11.57 6C11.54 5.99 11.51 5.98 11.48 5.97C10.22 5.63 8.92 6.37 8.58 7.62L8.3 8.67L8 8.59C7.68 8.5 7.36 8.54 7.08 8.7C6.8 8.86 6.6 9.12 6.51 9.43L5.53 12.99C5.36 13.62 5.71 14.26 6.33 14.46C6.34 14.46 6.36 14.47 6.38 14.47L11.32 15.83C11.63 15.92 11.95 15.88 12.23 15.72C12.51 15.56 12.72 15.3 12.8 14.99L13.78 11.43C13.95 10.8 13.6 10.16 12.99 9.96C12.97 9.95 12.95 9.95 12.94 9.94L12.84 9.92L13.12 8.87C13.28 8.28 13.21 7.66 12.92 7.12C12.63 6.59 12.15 6.19 11.57 6V6ZM9.63 9.04L9.92 7.99C10.06 7.48 10.59 7.17 11.11 7.31C11.12 7.32 11.13 7.32 11.15 7.33C11.64 7.48 11.92 8 11.78 8.5L11.5 9.55L9.63 9.04H9.63ZM9.44 13.49C9.39 13.48 9.37 13.43 9.38 13.38L9.58 12.66C9.61 12.55 9.57 12.43 9.49 12.36C9.3 12.21 9.23 11.96 9.29 11.73C9.32 11.62 9.38 11.52 9.46 11.44C9.62 11.3 9.84 11.25 10.04 11.3C10.05 11.3 10.06 11.31 10.07 11.31C10.25 11.37 10.4 11.52 10.46 11.71C10.5 11.82 10.5 11.94 10.47 12.06C10.41 12.29 10.21 12.46 9.98 12.5C9.87 12.52 9.78 12.6 9.75 12.71L9.55 13.43C9.54 13.48 9.49 13.51 9.44 13.49H9.43L9.44 13.49Z"+ fill="var(--mui-palette-background-paper)"+ />+ <path+ d="M9.01 9.68L7.91 9.38C7.6 9.3 7.27 9.48 7.19 9.8C7.11 10.11 7.29 10.43 7.61 10.52L8.71 10.81C9.02 10.9 9.34 10.71 9.43 10.4C9.51 10.08 9.32 9.76 9.01 9.68Z"+ fill="#27BDFF"+ />+ <path+ d="M11.91 16.41L7.42 17.54L7.58 15.12L11.91 16.41Z"+ fill="var(--mui-palette-background-paper)"+ />+ </AppIcon>+);diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsxindex 6464bc5276..d3d062b690 100644--- a/web/apps/photos/src/components/Sidebar.tsx+++ b/web/apps/photos/src/components/Sidebar.tsx@@ -948,7 +948,7 @@ const Account: React.FC<AccountProps> = ({pendingAction,onActionHandled,}) => {- const { showMiniDialog } = useBaseContext();+ const { showMiniDialog, onGenericError } = useBaseContext();const userDetails = useUserDetailsSnapshot();const router = useRouter();@@ -1033,6 +1033,15 @@ const Account: React.FC<AccountProps> = ({showSessions();}, [onAuthenticateUser, showSessions]);+ const handleDeleteAccount = useCallback(async () => {+ try {+ await onAuthenticateUser();+ showDeleteAccount();+ } catch (error) {+ if (!isReauthenticationCancellation(error)) onGenericError(error);+ }+ }, [onAuthenticateUser, onGenericError, showDeleteAccount]);+useEffect(() => {if (!open || !pendingAction) return;switch (pendingAction) {@@ -1056,7 +1065,7 @@ const Account: React.FC<AccountProps> = ({handleChangeEmail();break;case "account.deleteAccount":- showDeleteAccount();+ void handleDeleteAccount();break;case "account.sessions":void handleActiveSessions();@@ -1068,12 +1077,12 @@ const Account: React.FC<AccountProps> = ({handleActiveSessions,handleChangeEmail,handleChangePassword,+ handleDeleteAccount,handleRecoveryKey,handlePasskeys,open,onActionHandled,pendingAction,- showDeleteAccount,showTwoFactor,]);@@ -1124,7 +1133,7 @@ const Account: React.FC<AccountProps> = ({<RowButtoncolor="critical"label={t("delete_account")}- onClick={showDeleteAccount}+ onClick={() => void handleDeleteAccount()}/></RowButtonGroup></Stack>@@ -1146,10 +1155,7 @@ const Account: React.FC<AccountProps> = ({{...sessionsVisibilityProps}onRootClose={onRootClose}/>- <DeleteAccount- {...deleteAccountVisibilityProps}- {...{ onAuthenticateUser }}- />+ <DeleteAccount {...deleteAccountVisibilityProps} /></TitledNestedSidebarDrawer>);};diff --git a/web/packages/new/photos/services/user.ts b/web/packages/new/photos/services/user.tsindex 7df70c918b..28aff9f4d6 100644--- a/web/packages/new/photos/services/user.ts+++ b/web/packages/new/photos/services/user.ts@@ -47,6 +47,22 @@ const DeleteChallengeResponse = z.object({encryptedChallenge: z.string().nullish().transform(nullToUndefined),});+const AccountDeletionSummary = z.object({+ photosAndVideosCount: z.number().int(),+ authenticatorCodesCount: z.number().int(),+ lockerRecordsCount: z.number().int(),+});++export type AccountDeletionSummary = z.infer<typeof AccountDeletionSummary>;++export const getAccountDeletionSummary = async () => {+ const res = await fetch(await apiURL("/users/deletion-summary"), {+ headers: await authenticatedRequestHeaders(),+ });+ ensureOk(res);+ return AccountDeletionSummary.parse(await res.json());+};+export const getAccountDeleteChallenge = async () => {const res = await fetch(await apiURL("/users/delete-challenge"), {headers: await authenticatedRequestHeaders(),@@ -64,13 +80,17 @@ export const decryptDeleteAccountChallenge = async (export const deleteAccount = async (challenge: string,- reason: string,- feedback: string,+ reasonCategory: string,+ feedback?: string,) =>ensureOk(await fetch(await apiURL("/users/delete"), {method: "DELETE",headers: await authenticatedRequestHeaders(),- body: JSON.stringify({ challenge, reason, feedback }),+ body: JSON.stringify({+ challenge,+ reasonCategory,+ ...(feedback && { feedback }),+ }),}),);