Commit b98271b6 authored by tom's avatar tom

remove code for unverified email page

parent bccb1574
<svg viewBox="0 0 177 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.961 7.644a2 2 0 0 0-2.251-2.812l-76.313 17.5a2 2 0 0 0-.727 3.569l17.58 12.744v17.636a2.001 2.001 0 0 0 3.321 1.502l10.716-9.426 21.384 9.744a2 2 0 0 0 2.634-.957l23.656-49.5ZM108.308 35.92 93.583 25.247l62.923-14.43-48.198 25.104Zm.942 1.764v14.173l8.367-7.36a.385.385 0 0 1 .022-.018l.016-.014a.998.998 0 0 1 .214-.242l37.608-30.616-46.227 24.077Zm31.293 15.962-19.927-9.08 39.719-32.335-19.792 41.415ZM93.278 65.729a1.5 1.5 0 0 0 1.93 2.296 93.435 93.435 0 0 0 2.449-2.13 57.65 57.65 0 0 0 .819-.753l.044-.042.012-.011.004-.004.001-.001L97.5 64l1.038 1.083a1.5 1.5 0 0 0-2.075-2.167l-.002.002-.008.008-.037.035a19.011 19.011 0 0 1-.154.145 90.663 90.663 0 0 1-2.984 2.623Zm-5.037 7.714a1.5 1.5 0 0 0-1.751-2.436 105.47 105.47 0 0 1-7.163 4.73 1.5 1.5 0 1 0 1.547 2.57c2.69-1.618 5.17-3.284 7.367-4.864Zm-15.172 9.06a1.5 1.5 0 0 0-1.28-2.714c-2.556 1.205-5.207 2.277-7.906 3.13a1.5 1.5 0 0 0 .905 2.86c2.847-.9 5.624-2.024 8.28-3.276Zm-17.046 5.22a1.5 1.5 0 0 0-.358-2.98A34.938 34.938 0 0 1 51.5 85c-1.392 0-2.728-.09-4.012-.26a1.5 1.5 0 1 0-.394 2.973A33.44 33.44 0 0 0 51.5 88c1.51 0 3.02-.097 4.523-.278Zm-17.422-2.388a1.5 1.5 0 1 0 1.212-2.745c-2.517-1.11-4.783-2.55-6.816-4.194a1.5 1.5 0 1 0-1.887 2.332c2.216 1.792 4.705 3.377 7.491 4.607ZM24.974 74.523a1.5 1.5 0 1 0 2.338-1.881C25.51 70.403 24 68.076 22.756 65.86a1.5 1.5 0 0 0-2.616 1.47c1.311 2.333 2.911 4.803 4.834 7.193Zm-8.515-15a1.5 1.5 0 0 0 2.796-1.086 49.986 49.986 0 0 1-1-2.813 32.043 32.043 0 0 1-.29-.956l-.013-.045-.002-.01a1.5 1.5 0 0 0-2.899.775l1.45-.388-1.45.388.001.003.002.005.004.018.018.061.064.227c.057.196.143.478.258.837.23.718.579 1.741 1.06 2.984Z" fill="currentColor"/>
</svg>
...@@ -157,9 +157,6 @@ export const RESOURCES = { ...@@ -157,9 +157,6 @@ export const RESOURCES = {
user_info: { user_info: {
path: '/api/account/v2/user/info', path: '/api/account/v2/user/info',
}, },
email_resend: {
path: '/api/account/v2/email/resend',
},
custom_abi: { custom_abi: {
path: '/api/account/v2/user/custom_abis{/:id}', path: '/api/account/v2/user/custom_abis{/:id}',
pathParams: [ 'id' as const ], pathParams: [ 'id' as const ],
......
...@@ -5,9 +5,6 @@ import isBrowser from './isBrowser'; ...@@ -5,9 +5,6 @@ import isBrowser from './isBrowser';
export enum NAMES { export enum NAMES {
NAV_BAR_COLLAPSED='nav_bar_collapsed', NAV_BAR_COLLAPSED='nav_bar_collapsed',
API_TOKEN='_explorer_key', API_TOKEN='_explorer_key',
INVALID_SESSION='invalid_session',
// TODO @tom2drum remove everything about unverified email
CONFIRM_EMAIL_PAGE_VIEWED='confirm_email_page_viewed',
TXS_SORT='txs_sort', TXS_SORT='txs_sort',
COLOR_MODE='chakra-ui-color-mode', COLOR_MODE='chakra-ui-color-mode',
COLOR_MODE_HEX='chakra-ui-color-mode-hex', COLOR_MODE_HEX='chakra-ui-color-mode-hex',
......
...@@ -62,8 +62,6 @@ const OG_TYPE_DICT: Record<Route['pathname'], OGPageType> = { ...@@ -62,8 +62,6 @@ const OG_TYPE_DICT: Record<Route['pathname'], OGPageType> = {
'/api/healthz': 'Regular page', '/api/healthz': 'Regular page',
'/api/config': 'Regular page', '/api/config': 'Regular page',
'/api/sprite': 'Regular page', '/api/sprite': 'Regular page',
'/auth/auth0': 'Regular page',
'/auth/unverified-email': 'Regular page',
}; };
export default function getPageOgType(pathname: Route['pathname']) { export default function getPageOgType(pathname: Route['pathname']) {
......
...@@ -66,8 +66,6 @@ const TEMPLATE_MAP: Record<Route['pathname'], string> = { ...@@ -66,8 +66,6 @@ const TEMPLATE_MAP: Record<Route['pathname'], string> = {
'/api/healthz': DEFAULT_TEMPLATE, '/api/healthz': DEFAULT_TEMPLATE,
'/api/config': DEFAULT_TEMPLATE, '/api/config': DEFAULT_TEMPLATE,
'/api/sprite': DEFAULT_TEMPLATE, '/api/sprite': DEFAULT_TEMPLATE,
'/auth/auth0': DEFAULT_TEMPLATE,
'/auth/unverified-email': DEFAULT_TEMPLATE,
}; };
export function make(pathname: Route['pathname']) { export function make(pathname: Route['pathname']) {
......
...@@ -62,8 +62,6 @@ const TEMPLATE_MAP: Record<Route['pathname'], string> = { ...@@ -62,8 +62,6 @@ const TEMPLATE_MAP: Record<Route['pathname'], string> = {
'/api/healthz': '%network_name% node API health check', '/api/healthz': '%network_name% node API health check',
'/api/config': '%network_name% node API app config', '/api/config': '%network_name% node API app config',
'/api/sprite': '%network_name% node API SVG sprite content', '/api/sprite': '%network_name% node API SVG sprite content',
'/auth/auth0': '%network_name% authentication',
'/auth/unverified-email': '%network_name% unverified email',
}; };
const TEMPLATE_MAP_ENHANCED: Partial<Record<Route['pathname'], string>> = { const TEMPLATE_MAP_ENHANCED: Partial<Record<Route['pathname'], string>> = {
......
...@@ -60,8 +60,6 @@ export const PAGE_TYPE_DICT: Record<Route['pathname'], string> = { ...@@ -60,8 +60,6 @@ export const PAGE_TYPE_DICT: Record<Route['pathname'], string> = {
'/api/healthz': 'Node API: Health check', '/api/healthz': 'Node API: Health check',
'/api/config': 'Node API: App config', '/api/config': 'Node API: App config',
'/api/sprite': 'Node API: SVG sprite content', '/api/sprite': 'Node API: SVG sprite content',
'/auth/auth0': 'Auth',
'/auth/unverified-email': 'Unverified email',
}; };
export default function getPageType(pathname: Route['pathname']) { export default function getPageType(pathname: Route['pathname']) {
......
...@@ -54,7 +54,7 @@ Type extends EventTypes.ADD_TO_WALLET ? ( ...@@ -54,7 +54,7 @@ Type extends EventTypes.ADD_TO_WALLET ? (
} }
) : ) :
Type extends EventTypes.ACCOUNT_ACCESS ? { Type extends EventTypes.ACCOUNT_ACCESS ? {
'Action': 'Auth0 init' | 'Verification email resent' | 'Logged out'; 'Action': 'Logged out';
} : } :
Type extends EventTypes.PRIVATE_TAG ? { Type extends EventTypes.PRIVATE_TAG ? {
'Action': 'Form opened' | 'Submit'; 'Action': 'Form opened' | 'Submit';
......
...@@ -28,9 +28,7 @@ declare module "nextjs-routes" { ...@@ -28,9 +28,7 @@ declare module "nextjs-routes" {
| StaticRoute<"/api-docs"> | StaticRoute<"/api-docs">
| DynamicRoute<"/apps/[id]", { "id": string }> | DynamicRoute<"/apps/[id]", { "id": string }>
| StaticRoute<"/apps"> | StaticRoute<"/apps">
| StaticRoute<"/auth/auth0">
| StaticRoute<"/auth/profile"> | StaticRoute<"/auth/profile">
| StaticRoute<"/auth/unverified-email">
| DynamicRoute<"/batches/[number]", { "number": string }> | DynamicRoute<"/batches/[number]", { "number": string }>
| StaticRoute<"/batches"> | StaticRoute<"/batches">
| DynamicRoute<"/blobs/[hash]", { "hash": string }> | DynamicRoute<"/blobs/[hash]", { "hash": string }>
......
import type { NextPage } from 'next';
const Page: NextPage = () => {
return null;
};
export default Page;
export async function getServerSideProps() {
return {
notFound: true,
};
}
import type { NextPage } from 'next';
import React from 'react';
import PageNextJs from 'nextjs/PageNextJs';
import UnverifiedEmail from 'ui/pages/UnverifiedEmail';
const Page: NextPage = () => {
return (
<PageNextJs pathname="/auth/unverified-email">
<UnverifiedEmail/>
</PageNextJs>
);
};
export default Page;
export { account as getServerSideProps } from 'nextjs/getServerSideProps';
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
| "donate" | "donate"
| "dots" | "dots"
| "edit" | "edit"
| "email-sent"
| "email" | "email"
| "empty_search_result" | "empty_search_result"
| "ENS_slim" | "ENS_slim"
......
import { Box, Text, Button, Heading, chakra } from '@chakra-ui/react';
import React from 'react';
import useApiFetch from 'lib/api/useApiFetch';
import dayjs from 'lib/date/dayjs';
import getErrorObjPayload from 'lib/errors/getErrorObjPayload';
import getErrorObjStatusCode from 'lib/errors/getErrorObjStatusCode';
import useToast from 'lib/hooks/useToast';
import * as mixpanel from 'lib/mixpanel/index';
import IconSvg from 'ui/shared/IconSvg';
interface Props {
email?: string; // TODO: obtain email from API
}
const UnverifiedEmail = ({ email }: Props) => {
const apiFetch = useApiFetch();
const [ isLoading, setIsLoading ] = React.useState(false);
const toast = useToast();
const handleButtonClick = React.useCallback(async() => {
const toastId = 'resend-email-error';
setIsLoading(true);
mixpanel.logEvent(
mixpanel.EventTypes.ACCOUNT_ACCESS,
{ Action: 'Verification email resent' },
);
try {
await apiFetch('email_resend');
toast({
id: toastId,
position: 'top-right',
title: 'Success',
description: 'Email successfully resent.',
status: 'success',
variant: 'subtle',
isClosable: true,
});
} catch (error) {
const statusCode = getErrorObjStatusCode(error);
const message = (() => {
if (statusCode !== 429) {
return;
}
const payload = getErrorObjPayload<{ seconds_before_next_resend: number }>(error);
if (!payload) {
return;
}
if (!payload.seconds_before_next_resend) {
return;
}
const timeUntilNextResend = dayjs().add(payload.seconds_before_next_resend, 'seconds').fromNow();
return `Email resend is available ${ timeUntilNextResend }.`;
})();
!toast.isActive(toastId) && toast({
id: toastId,
position: 'top-right',
title: 'Error',
description: message || 'Something went wrong. Try again later.',
status: 'error',
variant: 'subtle',
isClosable: true,
});
}
setIsLoading(false);
}, [ apiFetch, toast ]);
return (
<Box>
<IconSvg name="email-sent" width="180px" height="auto" mt="52px"/>
<Heading mt={ 6 } size="2xl">Verify your email address</Heading>
<Text variant="secondary" mt={ 3 }>
<span>Please confirm your email address to use the My Account feature. A confirmation email was sent to </span>
<span>{ email || 'your email address' }</span>
<span> on signup. { `Didn't receive?` }</span>
</Text>
<Button
mt={ 8 }
size="lg"
variant="outline"
isLoading={ isLoading }
loadingText="Resending..."
onClick={ handleButtonClick }
>
Resend verification email
</Button>
</Box>
);
};
export default chakra(UnverifiedEmail);
...@@ -14,7 +14,6 @@ const PROTECTED_ROUTES: Array<Route['pathname']> = [ ...@@ -14,7 +14,6 @@ const PROTECTED_ROUTES: Array<Route['pathname']> = [
'/account/verified-addresses', '/account/verified-addresses',
'/account/watchlist', '/account/watchlist',
'/auth/profile', '/auth/profile',
'/auth/unverified-email',
]; ];
export default function useLogout() { export default function useLogout() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment