All files / app/features/auth/verification StrongVerificationPage.tsx

0% Statements 0/17
0% Branches 0/1
0% Functions 0/3
0% Lines 0/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
import NfcIcon from "@mui/icons-material/Nfc";
import { Box, Container, List, ListItem, Typography } from "@mui/material";
import { useMutation } from "@tanstack/react-query";
import Alert from "components/Alert";
import Button from "components/Button";
import HtmlMeta from "components/HtmlMeta";
import PageTitle from "components/PageTitle";
import { RpcError } from "grpc-web";
import { Trans, useTranslation } from "i18n";
import { AUTH, GLOBAL } from "i18n/namespaces";
import { InitiateStrongVerificationRes } from "proto/account_pb";
import { service } from "service";
import { theme } from "theme";
 
import { OpenInNewIcon } from "../../../components/Icons";
 
export default function StrongVerificationInstructions() {
  const { t } = useTranslation([GLOBAL, AUTH]);
 
  const {
    error,
    isPending,
    mutate: startStrongVerification,
  } = useMutation<InitiateStrongVerificationRes.AsObject, RpcError>({
    mutationFn: () => service.account.initiateStrongVerification(),
    onSuccess: async (data) => {
      // Open Iris ID in a new tab so user can keep these instructions open
      window.open(data.redirectUrl, "_blank");
    },
  });
 
  return (
    <>
      <HtmlMeta title={t("auth:strong_verification.title")} />
      <Container maxWidth="md" sx={{ marginTop: theme.spacing(3) }}>
        <PageTitle>{t("auth:strong_verification.title")}</PageTitle>
 
        <Alert severity="warning" sx={{ marginBottom: theme.spacing(3) }}>
          {t("auth:strong_verification.instructions.warning")}
        </Alert>
 
        <Typography
          variant="h2"
          sx={{ marginBottom: theme.spacing(2), marginTop: theme.spacing(3) }}
        >
          {t("auth:strong_verification.instructions.title")}
        </Typography>
 
        <List
          sx={{
            listStyleType: "decimal",
            paddingLeft: theme.spacing(3),
            marginBottom: theme.spacing(4),
          }}
        >
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1" sx={{ marginBottom: 1 }}>
              <Trans i18nKey="auth:strong_verification.instructions.step1">
                Download the <strong>IRIS ID</strong> app
              </Trans>
            </Typography>
            <Typography
              variant="body2"
              color="text.secondary"
              sx={{ marginTop: 1, marginBottom: 1 }}
            >
              <Trans i18nKey="auth:strong_verification.instructions.step1_apple_note">
                <strong>Apple users:</strong> You can skip the download and use
                your browser instead. Just click "Open" when prompted.
              </Trans>
            </Typography>
            <Box
              sx={{
                display: "flex",
                gap: 0,
                marginTop: 1,
                flexWrap: "wrap",
                alignItems: "center",
              }}
            >
              <a
                href="https://apps.apple.com/app/id1575142357"
                target="_blank"
                rel="noopener noreferrer"
              >
                <img
                  src="/img/Download_on_the_App_Store_Badge_US-UK_RGB_blk_092917.svg"
                  alt={t(
                    "auth:strong_verification.instructions.download_app_store",
                  )}
                  style={{ height: "30px", width: "auto" }}
                />
              </a>
              <a
                href="https://play.google.com/store/apps/details?id=seismic.rarity"
                target="_blank"
                rel="noopener noreferrer"
              >
                <img
                  src="/img/GetItOnGooglePlay_Badge_Web_color_English.svg"
                  alt={t(
                    "auth:strong_verification.instructions.download_google_play",
                  )}
                  style={{ height: "45px", width: "auto" }}
                />
              </a>
            </Box>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              <Trans i18nKey="auth:strong_verification.instructions.step2">
                Click <strong>"Start Strong Verification"</strong> below (opens
                in new tab)
              </Trans>
            </Typography>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              {t("auth:strong_verification.instructions.step3")}
            </Typography>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              {t("auth:strong_verification.instructions.step4")}
            </Typography>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              <Trans i18nKey="auth:strong_verification.instructions.step5">
                Select <strong>Passport</strong> (ID cards not supported)
              </Trans>
            </Typography>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              {t("auth:strong_verification.instructions.step6")}
            </Typography>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              {t("auth:strong_verification.instructions.step7")}
            </Typography>
          </ListItem>
          <ListItem sx={{ display: "list-item", paddingY: 0.5 }}>
            <Typography variant="body1">
              {t("auth:strong_verification.instructions.step8")}
            </Typography>
          </ListItem>
        </List>
 
        <Box
          sx={{
            backgroundColor: theme.palette.grey[50],
            borderRadius: theme.shape.borderRadius,
            padding: theme.spacing(3),
            marginBottom: theme.spacing(4),
            marginTop: theme.spacing(4),
          }}
        >
          <Box
            sx={{
              display: "flex",
              alignItems: "center",
              gap: theme.spacing(1),
              marginBottom: theme.spacing(1),
            }}
          >
            <NfcIcon sx={{ fontSize: 28, color: theme.palette.primary.main }} />
            <Typography variant="h3">
              {t("auth:strong_verification.instructions.chip_location.heading")}
            </Typography>
          </Box>
          <Typography variant="body1" sx={{ marginBottom: theme.spacing(1) }}>
            {t(
              "auth:strong_verification.instructions.chip_location.description",
            )}
          </Typography>
          <Box
            component="ul"
            sx={{
              marginTop: theme.spacing(1),
              marginBottom: 0,
              paddingLeft: theme.spacing(3),
            }}
          >
            <li>
              <Trans i18nKey="auth:strong_verification.instructions.chip_location.us_germany_mexico">
                <strong>US, Germany (2016), Mexico:</strong> Back page
              </Trans>
            </li>
            <li>
              <Trans i18nKey="auth:strong_verification.instructions.chip_location.finland_germany_new">
                <strong>Finland, Germany (2017+):</strong> Picture page
              </Trans>
            </li>
            <li>
              <Trans i18nKey="auth:strong_verification.instructions.chip_location.australia">
                <strong>Australia:</strong> Middle page (marked with symbol +
                "chip name")
              </Trans>
            </li>
          </Box>
        </Box>
 
        {error && (
          <Alert severity="error" sx={{ marginBottom: theme.spacing(2) }}>
            {error.message}
          </Alert>
        )}
 
        <Box
          sx={{
            display: "flex",
            justifyContent: "center",
            marginBottom: theme.spacing(4),
          }}
        >
          <Button
            onClick={startStrongVerification}
            loading={isPending}
            size="large"
            endIcon={<OpenInNewIcon />}
          >
            {t("auth:strong_verification.start_button")}
          </Button>
        </Box>
      </Container>
    </>
  );
}