Signup Flow improvements (#4012)
* Get login working * Update website * Fixes * Save * svae * Save * Change translation key * Various fixes after testing * Update website * Add TS Tests * Upate website * Fix tests * Fix linting and other issues * Fix linting and other issues * Fix bugs found during recording of demos * Revert default coookie change * Self review fixe * Link fixes * Removed inline styles, cleanup * Various fixes * Added new envs to e2e Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <[email protected]>
This commit is contained in:
47 files changed
+547
-245
No files matched your search
@@ -41,7 +41,12 @@ const UserSettings = (props: IUserSettingsProps) => {
|
||||
const mutation = trpc.useMutation("viewer.updateProfile", {
|
||||
onSuccess: onSuccess,
|
||||
});
|
||||
const { data: stripeCustomer } = trpc.useQuery(["viewer.stripeCustomer"]);
|
||||
const paymentRequired = stripeCustomer?.isPremium ? !stripeCustomer?.paidForPremium : false;
|
||||
const onSubmit = handleSubmit((data) => {
|
||||
if (paymentRequired) {
|
||||
return;
|
||||
}
|
||||
mutation.mutate({
|
||||
name: data.name,
|
||||
timeZone: selectedTimeZone,
|
||||
@@ -56,6 +61,7 @@ const UserSettings = (props: IUserSettingsProps) => {
|
||||
<div className="space-y-6">
|
||||
{/* Username textfield */}
|
||||
<UsernameAvailability
|
||||
readonly={true}
|
||||
currentUsername={currentUsername}
|
||||
setCurrentUsername={setCurrentUsername}
|
||||
inputUsernameValue={inputUsernameValue}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import classNames from "classnames";
|
||||
import { debounce } from "lodash";
|
||||
import { useRouter } from "next/router";
|
||||
import { MutableRefObject, useCallback, useEffect, useState } from "react";
|
||||
|
||||
import { getPremiumPlanMode, getPremiumPlanPriceValue } from "@calcom/app-store/stripepayment/lib/utils";
|
||||
import { fetchUsername } from "@calcom/lib/fetchUsername";
|
||||
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { User } from "@calcom/prisma/client";
|
||||
import { TRPCClientErrorLike } from "@calcom/trpc/client";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
|
||||
import type { AppRouter } from "@calcom/trpc/server/routers/_app";
|
||||
import Button from "@calcom/ui/Button";
|
||||
import { Dialog, DialogClose, DialogContent, DialogHeader } from "@calcom/ui/Dialog";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import { Icon, StarIconSolid } from "@calcom/ui/Icon";
|
||||
import { Input, Label } from "@calcom/ui/form/fields";
|
||||
|
||||
export enum UsernameChangeStatusEnum {
|
||||
@@ -46,8 +47,39 @@ interface ICustomUsernameProps {
|
||||
| "timeFormat"
|
||||
| "allowDynamicBooking"
|
||||
>;
|
||||
readonly?: boolean;
|
||||
}
|
||||
|
||||
const obtainNewUsernameChangeCondition = ({
|
||||
userIsPremium,
|
||||
isNewUsernamePremium,
|
||||
stripeCustomer,
|
||||
}: {
|
||||
userIsPremium: boolean;
|
||||
isNewUsernamePremium: boolean;
|
||||
stripeCustomer: inferQueryOutput<"viewer.stripeCustomer"> | undefined;
|
||||
}) => {
|
||||
if (!userIsPremium && isNewUsernamePremium && !stripeCustomer?.paidForPremium) {
|
||||
return UsernameChangeStatusEnum.UPGRADE;
|
||||
}
|
||||
if (userIsPremium && !isNewUsernamePremium && getPremiumPlanMode() === "subscription") {
|
||||
return UsernameChangeStatusEnum.DOWNGRADE;
|
||||
}
|
||||
return UsernameChangeStatusEnum.NORMAL;
|
||||
};
|
||||
|
||||
const useIsUsernamePremium = (username: string) => {
|
||||
const [isCurrentUsernamePremium, setIsCurrentUsernamePremium] = useState(false);
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (!username) return;
|
||||
const { data } = await fetchUsername(username);
|
||||
setIsCurrentUsernamePremium(data.premium);
|
||||
})();
|
||||
}, [username]);
|
||||
return isCurrentUsernamePremium;
|
||||
};
|
||||
|
||||
const PremiumTextfield = (props: ICustomUsernameProps) => {
|
||||
const { t } = useLocale();
|
||||
const {
|
||||
@@ -58,73 +90,38 @@ const PremiumTextfield = (props: ICustomUsernameProps) => {
|
||||
usernameRef,
|
||||
onSuccessMutation,
|
||||
onErrorMutation,
|
||||
user,
|
||||
readonly: disabled,
|
||||
} = props;
|
||||
const [usernameIsAvailable, setUsernameIsAvailable] = useState(false);
|
||||
const [markAsError, setMarkAsError] = useState(false);
|
||||
const router = useRouter();
|
||||
const { paymentStatus: recentAttemptPaymentStatus } = router.query;
|
||||
const [openDialogSaveUsername, setOpenDialogSaveUsername] = useState(false);
|
||||
const [usernameChangeCondition, setUsernameChangeCondition] = useState<UsernameChangeStatusEnum | null>(
|
||||
null
|
||||
);
|
||||
|
||||
const userIsPremium =
|
||||
user && user.metadata && hasKeyInMetadata(user, "isPremium") ? !!user.metadata.isPremium : false;
|
||||
const [premiumUsername, setPremiumUsername] = useState(false);
|
||||
const { data: stripeCustomer } = trpc.useQuery(["viewer.stripeCustomer"]);
|
||||
const isCurrentUsernamePremium = useIsUsernamePremium(currentUsername || "");
|
||||
const [isInputUsernamePremium, setIsInputUsernamePremium] = useState(false);
|
||||
|
||||
const debouncedApiCall = useCallback(
|
||||
debounce(async (username) => {
|
||||
const { data } = await fetchUsername(username);
|
||||
setMarkAsError(!data.available);
|
||||
setPremiumUsername(data.premium);
|
||||
setMarkAsError(!data.available && username !== currentUsername);
|
||||
setIsInputUsernamePremium(data.premium);
|
||||
setUsernameIsAvailable(data.available);
|
||||
}, 150),
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentUsername !== inputUsernameValue) {
|
||||
debouncedApiCall(inputUsernameValue);
|
||||
} else if (inputUsernameValue === "") {
|
||||
setMarkAsError(false);
|
||||
setPremiumUsername(false);
|
||||
setUsernameIsAvailable(false);
|
||||
} else {
|
||||
setPremiumUsername(userIsPremium);
|
||||
setUsernameIsAvailable(false);
|
||||
}
|
||||
}, [inputUsernameValue]);
|
||||
// Use the current username or if it's not set, use the one available from stripe
|
||||
setInputUsernameValue(currentUsername || stripeCustomer?.username || "");
|
||||
}, [setInputUsernameValue, currentUsername, stripeCustomer?.username]);
|
||||
|
||||
useEffect(() => {
|
||||
if (usernameIsAvailable || premiumUsername) {
|
||||
const condition = obtainNewUsernameChangeCondition({
|
||||
userIsPremium,
|
||||
isNewUsernamePremium: premiumUsername,
|
||||
});
|
||||
|
||||
setUsernameChangeCondition(condition);
|
||||
}
|
||||
}, [usernameIsAvailable, premiumUsername]);
|
||||
|
||||
const obtainNewUsernameChangeCondition = ({
|
||||
userIsPremium,
|
||||
isNewUsernamePremium,
|
||||
}: {
|
||||
userIsPremium: boolean;
|
||||
isNewUsernamePremium: boolean;
|
||||
}) => {
|
||||
let resultCondition: UsernameChangeStatusEnum;
|
||||
if (!userIsPremium && isNewUsernamePremium) {
|
||||
resultCondition = UsernameChangeStatusEnum.UPGRADE;
|
||||
} else if (userIsPremium && !isNewUsernamePremium) {
|
||||
resultCondition = UsernameChangeStatusEnum.DOWNGRADE;
|
||||
} else {
|
||||
resultCondition = UsernameChangeStatusEnum.NORMAL;
|
||||
}
|
||||
return resultCondition;
|
||||
};
|
||||
if (!inputUsernameValue) return;
|
||||
debouncedApiCall(inputUsernameValue);
|
||||
}, [debouncedApiCall, inputUsernameValue]);
|
||||
|
||||
const utils = trpc.useContext();
|
||||
|
||||
const updateUsername = trpc.useMutation("viewer.updateProfile", {
|
||||
onSuccess: async () => {
|
||||
onSuccessMutation && (await onSuccessMutation());
|
||||
@@ -139,34 +136,62 @@ const PremiumTextfield = (props: ICustomUsernameProps) => {
|
||||
},
|
||||
});
|
||||
|
||||
const ActionButtons = (props: { index: string }) => {
|
||||
const { index } = props;
|
||||
return (usernameIsAvailable || premiumUsername) && currentUsername !== inputUsernameValue ? (
|
||||
<div className="flex flex-row">
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
className="mx-2"
|
||||
onClick={() => setOpenDialogSaveUsername(true)}
|
||||
data-testid={`update-username-btn-${index}`}>
|
||||
{t("update")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
color="secondary"
|
||||
className="mx-2"
|
||||
onClick={() => {
|
||||
if (currentUsername) {
|
||||
setInputUsernameValue(currentUsername);
|
||||
usernameRef.current.value = currentUsername;
|
||||
}
|
||||
}}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
// when current username isn't set - Go to stripe to check what username he wanted to buy and was it a premium and was it paid for
|
||||
const paymentRequired = !currentUsername && stripeCustomer?.isPremium && !stripeCustomer?.paidForPremium;
|
||||
|
||||
const usernameChangeCondition = obtainNewUsernameChangeCondition({
|
||||
userIsPremium: isCurrentUsernamePremium,
|
||||
isNewUsernamePremium: isInputUsernamePremium,
|
||||
stripeCustomer,
|
||||
});
|
||||
|
||||
const usernameFromStripe = stripeCustomer?.username;
|
||||
|
||||
const paymentLink = `/api/integrations/stripepayment/subscription?intentUsername=${
|
||||
inputUsernameValue || usernameFromStripe
|
||||
}&action=${usernameChangeCondition}&callbackUrl=${router.asPath}`;
|
||||
|
||||
const ActionButtons = () => {
|
||||
if (paymentRequired) {
|
||||
return (
|
||||
<div className="flex flex-row">
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
className="mx-2"
|
||||
href={paymentLink}
|
||||
data-testid="reserve-username-btn">
|
||||
{t("Reserve")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if ((usernameIsAvailable || isInputUsernamePremium) && currentUsername !== inputUsernameValue) {
|
||||
return (
|
||||
<div className="flex flex-row">
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
className="mx-2"
|
||||
onClick={() => setOpenDialogSaveUsername(true)}
|
||||
data-testid="update-username-btn">
|
||||
{t("update")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
if (currentUsername) {
|
||||
setInputUsernameValue(currentUsername);
|
||||
usernameRef.current.value = currentUsername;
|
||||
}
|
||||
}}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return <></>;
|
||||
};
|
||||
|
||||
const saveUsername = () => {
|
||||
@@ -179,79 +204,89 @@ const PremiumTextfield = (props: ICustomUsernameProps) => {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ display: "flex", justifyItems: "center" }}>
|
||||
<div className="flex justify-items-center">
|
||||
<Label htmlFor="username">{t("username")}</Label>
|
||||
</div>
|
||||
<div className="mt-2 flex rounded-md">
|
||||
<span
|
||||
className={classNames(
|
||||
"inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500"
|
||||
isInputUsernamePremium ? "border-2 border-orange-400 " : "",
|
||||
"hidden items-center rounded-l-md border border-r-0 border-gray-300 border-r-gray-300 bg-gray-50 px-3 text-sm text-gray-500 md:inline-flex"
|
||||
)}>
|
||||
{process.env.NEXT_PUBLIC_WEBSITE_URL.replace("https://", "").replace("http://", "")}/
|
||||
</span>
|
||||
<div style={{ position: "relative", width: "100%" }}>
|
||||
|
||||
<div className="relative w-full">
|
||||
<Input
|
||||
ref={usernameRef}
|
||||
name="username"
|
||||
autoComplete="none"
|
||||
autoCapitalize="none"
|
||||
autoCorrect="none"
|
||||
disabled={disabled}
|
||||
className={classNames(
|
||||
"mt-0 rounded-md rounded-l-none",
|
||||
"mt-0 rounded-md rounded-l-none border-l-2 focus:!ring-0",
|
||||
isInputUsernamePremium
|
||||
? "border-2 border-orange-400 focus:border-2 focus:border-orange-400"
|
||||
: "border-2 focus:border-2",
|
||||
markAsError
|
||||
? "focus:shadow-0 focus:ring-shadow-0 border-red-500 focus:border-red-500 focus:outline-none focus:ring-0"
|
||||
: ""
|
||||
? "focus:shadow-0 focus:ring-shadow-0 border-red-500 focus:border-red-500 focus:outline-none"
|
||||
: "border-l-gray-300 "
|
||||
)}
|
||||
defaultValue={currentUsername}
|
||||
value={inputUsernameValue}
|
||||
onChange={(event) => {
|
||||
event.preventDefault();
|
||||
setInputUsernameValue(event.target.value);
|
||||
}}
|
||||
data-testid="username-input"
|
||||
/>
|
||||
{currentUsername !== inputUsernameValue && (
|
||||
<div
|
||||
className="top-0"
|
||||
style={{
|
||||
position: "absolute",
|
||||
right: 2,
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
}}>
|
||||
<span
|
||||
className={classNames(
|
||||
"mx-2 py-1",
|
||||
premiumUsername ? "text-orange-500" : "",
|
||||
usernameIsAvailable ? "" : ""
|
||||
)}>
|
||||
{premiumUsername ? <Icon.FiStar className="mt-[4px] w-6" /> : <></>}
|
||||
{!premiumUsername && usernameIsAvailable ? <Icon.FiCheck className="mt-[4px] w-6" /> : <></>}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="xs:hidden">
|
||||
<ActionButtons index="desktop" />
|
||||
<div className="absolute top-0 right-2 flex flex-row">
|
||||
<span
|
||||
className={classNames(
|
||||
"mx-2 py-1",
|
||||
isInputUsernamePremium ? "text-orange-400" : "",
|
||||
usernameIsAvailable ? "" : ""
|
||||
)}>
|
||||
{isInputUsernamePremium ? <StarIconSolid className="mt-[4px] w-6" /> : <></>}
|
||||
{!isInputUsernamePremium && usernameIsAvailable ? (
|
||||
<Icon.FiCheck className="mt-[7px] w-6" />
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{(usernameIsAvailable || isInputUsernamePremium) && currentUsername !== inputUsernameValue && (
|
||||
<div className="flex justify-end">
|
||||
<ActionButtons />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{paymentRequired ? (
|
||||
recentAttemptPaymentStatus && recentAttemptPaymentStatus !== "paid" ? (
|
||||
<span className="text-sm text-red-500">
|
||||
Your payment could not be completed. Your username is still not reserved
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-xs text-orange-400">
|
||||
You need to reserve your premium username for {getPremiumPlanPriceValue()}
|
||||
</span>
|
||||
)
|
||||
) : null}
|
||||
{markAsError && <p className="mt-1 text-xs text-red-500">Username is already taken</p>}
|
||||
|
||||
{usernameIsAvailable && (
|
||||
<p className={classNames("mt-1 text-xs text-gray-900")}>
|
||||
{usernameChangeCondition === UsernameChangeStatusEnum.DOWNGRADE && (
|
||||
<>{t("standard_to_premium_username_description")}</>
|
||||
<>{t("premium_to_standard_username_description")}</>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{(usernameIsAvailable || premiumUsername) && currentUsername !== inputUsernameValue && (
|
||||
<div className="mt-2 flex justify-end sm:hidden">
|
||||
<ActionButtons index="mobile" />
|
||||
</div>
|
||||
)}
|
||||
<Dialog open={openDialogSaveUsername}>
|
||||
<DialogContent>
|
||||
<div style={{ display: "flex", flexDirection: "row" }}>
|
||||
<div className="flex flex-row">
|
||||
<div className="xs:hidden flex h-10 w-10 flex-shrink-0 justify-center rounded-full bg-[#FAFAFA]">
|
||||
<Icon.FiEdit2 className="m-auto h-6 w-6" />
|
||||
</div>
|
||||
@@ -291,7 +326,7 @@ const PremiumTextfield = (props: ICustomUsernameProps) => {
|
||||
type="button"
|
||||
loading={updateUsername.isLoading}
|
||||
data-testid="go-to-billing"
|
||||
href={`/api/integrations/stripepayment/subscription?intentUsername=${inputUsernameValue}`}>
|
||||
href={paymentLink}>
|
||||
<>
|
||||
{t("go_to_stripe_billing")} <Icon.FiExternalLink className="ml-1 h-4 w-4" />
|
||||
</>
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
import { GetStaticPropsContext } from "next";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import z from "zod";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import Button from "@calcom/ui/Button";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import { SkeletonText } from "@calcom/ui/v2";
|
||||
|
||||
import AuthContainer from "@components/ui/AuthContainer";
|
||||
|
||||
import { ssgInit } from "@server/lib/ssg";
|
||||
|
||||
const querySchema = z.object({
|
||||
error: z.string().optional(),
|
||||
});
|
||||
|
||||
export default function Error() {
|
||||
const { t } = useLocale();
|
||||
const router = useRouter();
|
||||
const { error } = router.query;
|
||||
const { error } = querySchema.parse(router.query);
|
||||
const isTokenVerificationError = error?.toLowerCase() === "verification";
|
||||
let errorMsg = <SkeletonText />;
|
||||
if (router.isReady) {
|
||||
errorMsg = isTokenVerificationError ? t("token_invalid_expired") : t("error_during_login");
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthContainer title="" description="">
|
||||
@@ -26,7 +37,7 @@ export default function Error() {
|
||||
{error}
|
||||
</h3>
|
||||
<div className="mt-2">
|
||||
<p className="text-sm text-gray-500">{t("error_during_login")}</p>
|
||||
<p className="text-sm text-gray-500">{errorMsg}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import { CheckIcon, ExclamationIcon, MailOpenIcon } from "@heroicons/react/outline";
|
||||
import { getSession, signIn } from "next-auth/react";
|
||||
import { CheckIcon, MailOpenIcon, ExclamationIcon } from "@heroicons/react/outline";
|
||||
import { signIn } from "next-auth/react";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import * as React from "react";
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import z from "zod";
|
||||
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import showToast from "@calcom/lib/notification";
|
||||
import Button from "@calcom/ui/Button";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/v2/";
|
||||
|
||||
import Loader from "@components/Loader";
|
||||
|
||||
async function sendVerificationLogin(email: string, username: string) {
|
||||
await signIn("email", {
|
||||
@@ -23,25 +28,43 @@ async function sendVerificationLogin(email: string, username: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function useSendFirstVerificationLogin() {
|
||||
const router = useRouter();
|
||||
const { email, username } = router.query;
|
||||
function useSendFirstVerificationLogin({
|
||||
email,
|
||||
username,
|
||||
}: {
|
||||
email: string | undefined;
|
||||
username: string | undefined;
|
||||
}) {
|
||||
const sent = useRef(false);
|
||||
useEffect(() => {
|
||||
if (router.isReady && !sent.current) {
|
||||
(async () => {
|
||||
await sendVerificationLogin(`${email}`, `${username}`);
|
||||
sent.current = true;
|
||||
})();
|
||||
if (!email || !username || sent.current) {
|
||||
return;
|
||||
}
|
||||
}, [email, router.isReady, username]);
|
||||
(async () => {
|
||||
await sendVerificationLogin(email, username);
|
||||
sent.current = true;
|
||||
})();
|
||||
}, [email, username]);
|
||||
}
|
||||
|
||||
const querySchema = z.object({
|
||||
stripeCustomerId: z.string().optional(),
|
||||
sessionId: z.string().optional(),
|
||||
t: z.string().optional(),
|
||||
});
|
||||
|
||||
export default function Verify() {
|
||||
const router = useRouter();
|
||||
const { email, username, t, session_id, cancel } = router.query;
|
||||
const { t, sessionId, stripeCustomerId } = querySchema.parse(router.query);
|
||||
const [secondsLeft, setSecondsLeft] = useState(30);
|
||||
|
||||
const { data } = trpc.useQuery([
|
||||
"viewer.public.stripeCheckoutSession",
|
||||
{
|
||||
stripeCustomerId,
|
||||
checkoutSessionId: sessionId,
|
||||
},
|
||||
]);
|
||||
useSendFirstVerificationLogin({ email: data?.customer?.email, username: data?.customer?.username });
|
||||
// @note: check for t=timestamp and apply disabled state and secondsLeft accordingly
|
||||
// to avoid refresh to skip waiting 30 seconds to re-send email
|
||||
useEffect(() => {
|
||||
@@ -68,35 +91,28 @@ export default function Verify() {
|
||||
}
|
||||
}, [secondsLeft]);
|
||||
|
||||
// @note: check for session, redirect to webapp if session found
|
||||
useEffect(() => {
|
||||
let intervalId: NodeJS.Timer, redirecting: boolean;
|
||||
// eslint-disable-next-line prefer-const
|
||||
intervalId = setInterval(async () => {
|
||||
const session = await getSession();
|
||||
if (session && !redirecting) {
|
||||
// User connected using the magic link -> redirect him/her
|
||||
redirecting = true;
|
||||
// @note: redirect to webapp /getting-started, user will end up with two tabs open with the onboarding 'getting-started' wizard.
|
||||
router.push(WEBAPP_URL + "/getting-started");
|
||||
}
|
||||
}, 1000);
|
||||
return () => {
|
||||
intervalId && clearInterval(intervalId);
|
||||
};
|
||||
}, [router]);
|
||||
if (!router.isReady || !data) {
|
||||
// Loading state
|
||||
return <Loader />;
|
||||
}
|
||||
const { valid, hasPaymentFailed, customer } = data;
|
||||
if (!valid) {
|
||||
throw new Error("Invalid session or customer id");
|
||||
}
|
||||
|
||||
useSendFirstVerificationLogin();
|
||||
if (!stripeCustomerId && !sessionId) {
|
||||
return <div>Invalid Link</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className=" bg-black bg-opacity-90 text-white backdrop-blur-md backdrop-grayscale backdrop-filter">
|
||||
<div className="bg-black bg-opacity-90 text-white backdrop-blur-md backdrop-grayscale backdrop-filter">
|
||||
<Head>
|
||||
<title>
|
||||
{/* @note: Ternary can look ugly ant his might be extracted later but I think at 3 it's not yet worth
|
||||
it or too hard to read. */}
|
||||
{cancel
|
||||
{hasPaymentFailed
|
||||
? "Your payment failed"
|
||||
: session_id
|
||||
: sessionId
|
||||
? "Payment successful!"
|
||||
: "Verify your email" + " | Cal.com"}
|
||||
</title>
|
||||
@@ -104,34 +120,41 @@ export default function Verify() {
|
||||
<div className="flex min-h-screen flex-col items-center justify-center px-6">
|
||||
<div className="m-10 flex max-w-2xl flex-col items-start border border-white p-12 text-left">
|
||||
<div className="rounded-full border border-white p-3">
|
||||
{cancel ? (
|
||||
{hasPaymentFailed ? (
|
||||
<ExclamationIcon className="h-12 w-12 flex-shrink-0 p-0.5 font-extralight text-white" />
|
||||
) : session_id ? (
|
||||
) : sessionId ? (
|
||||
<CheckIcon className="h-12 w-12 flex-shrink-0 p-0.5 font-extralight text-white" />
|
||||
) : (
|
||||
<MailOpenIcon className="h-12 w-12 flex-shrink-0 p-0.5 font-extralight text-white" />
|
||||
)}
|
||||
</div>
|
||||
<h3 className="font-cal my-6 text-3xl font-normal">
|
||||
{cancel ? "Your payment failed" : session_id ? "Payment successful!" : "Check your Inbox"}
|
||||
{hasPaymentFailed
|
||||
? "Your payment failed"
|
||||
: sessionId
|
||||
? "Payment successful!"
|
||||
: "Check your Inbox"}
|
||||
</h3>
|
||||
{cancel && (
|
||||
{hasPaymentFailed && (
|
||||
<p className="my-6">Your account has been created, but your premium has not been reserved.</p>
|
||||
)}
|
||||
<p>
|
||||
We have sent an email to <b>{email} </b>with a link to activate your account.{" "}
|
||||
{cancel &&
|
||||
We have sent an email to <b>{customer?.email} </b>with a link to activate your account.{" "}
|
||||
{hasPaymentFailed &&
|
||||
"Once you activate your account you will be able to try purchase your premium username again or select a different one."}
|
||||
</p>
|
||||
<p className="mt-6 text-gray-400">
|
||||
Don't see an email? Click the button below to send another email.
|
||||
</p>
|
||||
|
||||
<div className="mt-6 space-x-5 text-center">
|
||||
<div className="mt-6 flex space-x-5 text-center">
|
||||
<Button
|
||||
color="secondary"
|
||||
disabled={secondsLeft > 0}
|
||||
onClick={async (e) => {
|
||||
if (!customer) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
setSecondsLeft(30);
|
||||
// Update query params with t:timestamp, shallow: true doesn't re-render the page
|
||||
@@ -139,14 +162,13 @@ export default function Verify() {
|
||||
router.asPath,
|
||||
{
|
||||
query: {
|
||||
email: router.query.email,
|
||||
username: router.query.username,
|
||||
...router.query,
|
||||
t: Date.now(),
|
||||
},
|
||||
},
|
||||
{ shallow: true }
|
||||
);
|
||||
return await sendVerificationLogin(`${email}`, `${username}`);
|
||||
return await sendVerificationLogin(customer.email, customer.username);
|
||||
}}>
|
||||
{secondsLeft > 0 ? `Resend in ${secondsLeft} seconds` : "Send another mail"}
|
||||
</Button>
|
||||
|
||||
@@ -245,7 +245,6 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||
hasGiphyIntegration,
|
||||
hasRainbowIntegration,
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const updateMutation = trpc.useMutation("viewer.eventTypes.update", {
|
||||
|
||||
@@ -10,7 +10,6 @@ test.describe("Change Password Test", () => {
|
||||
await pro.login();
|
||||
// Go to http://localhost:3000/settings/security
|
||||
await page.goto("/settings/security");
|
||||
|
||||
if (!pro.username) throw Error("Test user doesn't have a username");
|
||||
|
||||
// Fill form
|
||||
|
||||
@@ -37,7 +37,7 @@ test.describe("Change username on settings", () => {
|
||||
await usernameInput.fill("demousernamex");
|
||||
|
||||
// Click on save button
|
||||
await page.click("[data-testid=update-username-btn-desktop]");
|
||||
await page.click("[data-testid=update-username-btn]");
|
||||
|
||||
await Promise.all([
|
||||
page.waitForResponse("**/viewer.updateProfile*"),
|
||||
@@ -84,7 +84,7 @@ test.describe("Change username on settings", () => {
|
||||
await usernameInput.fill(`xx${testInfo.workerIndex}`);
|
||||
|
||||
// Click on save button
|
||||
await page.click("[data-testid=update-username-btn-desktop]");
|
||||
await page.click("[data-testid=update-username-btn]");
|
||||
|
||||
// Validate modal text fields
|
||||
const currentUsernameText = page.locator("[data-testid=current-username]").innerText();
|
||||
@@ -130,7 +130,7 @@ test.describe("Change username on settings", () => {
|
||||
await usernameInput.fill(`xx${testInfo.workerIndex}`);
|
||||
|
||||
// Click on save button
|
||||
await page.click("[data-testid=update-username-btn-desktop]");
|
||||
await page.click("[data-testid=update-username-btn]");
|
||||
|
||||
// Validate modal text fields
|
||||
const currentUsernameText = page.locator("[data-testid=current-username]").innerText();
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "يُمكّنك سير العمل من أتمتة إرسال التذكير والإشعارات.",
|
||||
"active_on": "إجراء في",
|
||||
"workflow_updated_successfully": "تم تحديث سير العمل {{workflowName}} بنجاح",
|
||||
"standard_to_premium_username_description": "هذا اسم مستخدم قياسي، سوف ينقلك هذا التحديث إلى صفحة الفوترة لخفض المستوى.",
|
||||
"premium_to_standard_username_description": "هذا اسم مستخدم قياسي، سوف ينقلك هذا التحديث إلى صفحة الفوترة لخفض المستوى.",
|
||||
"current": "الحالي",
|
||||
"premium": "مميز",
|
||||
"standard": "قياسي",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Pracovní postupy umožňují automatizovat zasílání upomínek a oznámení.",
|
||||
"active_on": "Aktivní pro:",
|
||||
"workflow_updated_successfully": "Pracovní postup {{workflowName}} byl aktualizován",
|
||||
"standard_to_premium_username_description": "Toto je standardní uživatelské jméno a při aktualizaci přejdete k fakturaci, kde provedete snížení úrovně.",
|
||||
"premium_to_standard_username_description": "Toto je standardní uživatelské jméno a při aktualizaci přejdete k fakturaci, kde provedete snížení úrovně.",
|
||||
"current": "Aktuální",
|
||||
"premium": "prémiové",
|
||||
"standard": "standardní",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Workflows ermöglichen Ihnen das automatisierte Versenden von Erinnerungen und Benachrichtigungen.",
|
||||
"active_on": "Aktiv am",
|
||||
"workflow_updated_successfully": "{{workflowName}} Workflow erfolgreich aktualisiert",
|
||||
"standard_to_premium_username_description": "Dies ist ein Standard-Benutzername und die Aktualisierung führt Sie zur Rechnungsstellung, um ein Downgrade durchzuführen.",
|
||||
"premium_to_standard_username_description": "Dies ist ein Standard-Benutzername und die Aktualisierung führt Sie zur Rechnungsstellung, um ein Downgrade durchzuführen.",
|
||||
"current": "Aktuell",
|
||||
"premium": "Premium",
|
||||
"standard": "Standard",
|
||||
|
||||
@@ -977,7 +977,7 @@
|
||||
"new_workflow_description": "Workflows enable you to automate sending reminders and notifications.",
|
||||
"active_on": "Active on",
|
||||
"workflow_updated_successfully": "{{workflowName}} workflow updated successfully",
|
||||
"standard_to_premium_username_description": "This is a standard username and updating will take you to billing to downgrade.",
|
||||
"premium_to_standard_username_description": "This is a standard username and updating will take you to billing to downgrade.",
|
||||
"current": "Current",
|
||||
"premium": "premium",
|
||||
"standard": "standard",
|
||||
@@ -1180,5 +1180,6 @@
|
||||
"edit_form_later_subtitle": "You’ll be able to edit this later.",
|
||||
"connect_calendar_later": "I'll connect my calendar later",
|
||||
"set_my_availability_later": "I'll set my availability later",
|
||||
"problem_saving_user_profile": "There was a problem saving your data. Please try again or reach out to customer support."
|
||||
"problem_saving_user_profile": "There was a problem saving your data. Please try again or reach out to customer support.",
|
||||
"token_invalid_expired": "Token is either invalid or expired."
|
||||
}
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Los flujos de trabajo le permiten automatizar el envío de recordatorios y notificaciones.",
|
||||
"active_on": "Activo en",
|
||||
"workflow_updated_successfully": "Flujo de trabajo {{workflowName}} actualizado correctamente",
|
||||
"standard_to_premium_username_description": "Este es un nombre de usuario estándar y la actualización te llevará a la facturación para bajar de categoría.",
|
||||
"premium_to_standard_username_description": "Este es un nombre de usuario estándar y la actualización te llevará a la facturación para bajar de categoría.",
|
||||
"current": "Actual",
|
||||
"premium": "premium",
|
||||
"standard": "estándar",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Les workflows vous permettent d'automatiser l'envoi de rappels et de notifications.",
|
||||
"active_on": "Actif le",
|
||||
"workflow_updated_successfully": "Workflow {{workflowName}} mis à jour avec succès",
|
||||
"standard_to_premium_username_description": "Ceci est un nom d'utilisateur standard et la mise à jour vous mènera à la facturation à downgrader.",
|
||||
"premium_to_standard_username_description": "Ceci est un nom d'utilisateur standard et la mise à jour vous mènera à la facturation à downgrader.",
|
||||
"current": "Actuel",
|
||||
"premium": "premium",
|
||||
"standard": "standard",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "תהליכי עבודה מאפשרים להפוך את פעולת השליחה של תזכורות ועדכונים לאוטומטית.",
|
||||
"active_on": "פעיל ב",
|
||||
"workflow_updated_successfully": "עדכון תהליך העבודה {{workflowName}} בוצע בהצלחה",
|
||||
"standard_to_premium_username_description": "זהו שם משתמש סטנדרטי ועדכון שלו יגרום להעברה שלך אל דף החיוב לצורך שנמוך.",
|
||||
"premium_to_standard_username_description": "זהו שם משתמש סטנדרטי ועדכון שלו יגרום להעברה שלך אל דף החיוב לצורך שנמוך.",
|
||||
"current": "נוכחי",
|
||||
"premium": "פרימיום",
|
||||
"standard": "רגיל",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "I flussi di lavoro consentono di automatizzare l'invio di promemoria e notifiche.",
|
||||
"active_on": "Data attivazione",
|
||||
"workflow_updated_successfully": "Flusso di lavoro {{workflowName}} aggiornato correttamente",
|
||||
"standard_to_premium_username_description": "Questo è un nome utente standard e l'aggiornamento ti porterà alla fatturazione per il downgrade.",
|
||||
"premium_to_standard_username_description": "Questo è un nome utente standard e l'aggiornamento ti porterà alla fatturazione per il downgrade.",
|
||||
"current": "Corrente",
|
||||
"premium": "premium",
|
||||
"standard": "standard",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "ワークフローにより、リマインダーと通知の送信を自動化できます。",
|
||||
"active_on": "有効日時",
|
||||
"workflow_updated_successfully": "{{workflowName}} が正常に更新されました",
|
||||
"standard_to_premium_username_description": "これはスタンダードユーザー名で、更新するとダウングレードするための請求画面に移動します。",
|
||||
"premium_to_standard_username_description": "これはスタンダードユーザー名で、更新するとダウングレードするための請求画面に移動します。",
|
||||
"current": "現在",
|
||||
"premium": "プレミアム",
|
||||
"standard": "スタンダード",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "워크플로를 사용하면 미리 알림 및 알림 보내기를 자동화할 수 있습니다.",
|
||||
"active_on": "유효일",
|
||||
"workflow_updated_successfully": "{{workflowName}} 워크플로 업데이트 완료",
|
||||
"standard_to_premium_username_description": "이것은 표준 사용자 이름이며 업데이트하면 다운그레이드를 위한 청구로 이동합니다.",
|
||||
"premium_to_standard_username_description": "이것은 표준 사용자 이름이며 업데이트하면 다운그레이드를 위한 청구로 이동합니다.",
|
||||
"current": "기존",
|
||||
"premium": "프리미엄",
|
||||
"standard": "표준",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Met werkstromen kunt u het verzenden van herinneringen en meldingen automatiseren.",
|
||||
"active_on": "Actief op",
|
||||
"workflow_updated_successfully": "Werkstroom {{workflowName}} bijgewerkt",
|
||||
"standard_to_premium_username_description": "Dit is een standaard gebruikersnaam, door bij te werken ga je naar facturatie om te downgraden.",
|
||||
"premium_to_standard_username_description": "Dit is een standaard gebruikersnaam, door bij te werken ga je naar facturatie om te downgraden.",
|
||||
"current": "Huidig",
|
||||
"premium": "premium",
|
||||
"standard": "standaard",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Przepływy pracy umożliwiają automatyzację wysyłania przypomnień i powiadomień.",
|
||||
"active_on": "Aktywny dnia",
|
||||
"workflow_updated_successfully": "Pomyślnie zaktualizowano przepływ pracy {{workflowName}}",
|
||||
"standard_to_premium_username_description": "To standardowa nazwa użytkownika i jej aktualizacja spowoduje przejście do płatności za zmianę wersji.",
|
||||
"premium_to_standard_username_description": "To standardowa nazwa użytkownika i jej aktualizacja spowoduje przejście do płatności za zmianę wersji.",
|
||||
"current": "Bieżąca",
|
||||
"premium": "Premium",
|
||||
"standard": "Standardowa",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Fluxos de trabalho permitem que você automatize o envio de lembretes e notificações.",
|
||||
"active_on": "Ativar em",
|
||||
"workflow_updated_successfully": "Fluxo de trabalho {{workflowName}} atualizado com sucesso",
|
||||
"standard_to_premium_username_description": "Este é um nome de usuário padrão. Para atualizá-lo, levaremos você para fazer downgrade na cobrança.",
|
||||
"premium_to_standard_username_description": "Este é um nome de usuário padrão. Para atualizá-lo, levaremos você para fazer downgrade na cobrança.",
|
||||
"current": "Atual",
|
||||
"premium": "premium",
|
||||
"standard": "padrão",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Os fluxos de trabalho permitem automatizar o envio de lembretes e notificações.",
|
||||
"active_on": "Activo em",
|
||||
"workflow_updated_successfully": "Fluxo de trabalho {{workflowName}} actualizado com sucesso",
|
||||
"standard_to_premium_username_description": "Este é um nome de utilizador padrão, e ao atualizar irá para a faturação para fazer o downgrade.",
|
||||
"premium_to_standard_username_description": "Este é um nome de utilizador padrão, e ao atualizar irá para a faturação para fazer o downgrade.",
|
||||
"current": "Atual",
|
||||
"premium": "premium",
|
||||
"standard": "padrão",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Fluxurile de lucru vă permit să automatizați trimiterea mementourilor și a notificărilor.",
|
||||
"active_on": "Activ pe",
|
||||
"workflow_updated_successfully": "Fluxul de lucru {{workflowName}} a fost actualizat cu succes",
|
||||
"standard_to_premium_username_description": "Acesta este un nume de utilizator standard, iar actualizarea vă va duce la facturare pentru retrogradare.",
|
||||
"premium_to_standard_username_description": "Acesta este un nume de utilizator standard, iar actualizarea vă va duce la facturare pentru retrogradare.",
|
||||
"current": "Actual",
|
||||
"premium": "premium",
|
||||
"standard": "standard",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Рабочие процессы позволяют автоматизировать отправку напоминаний и уведомлений.",
|
||||
"active_on": "Активен с",
|
||||
"workflow_updated_successfully": "Рабочий процесс {{workflowName}} обновлен",
|
||||
"standard_to_premium_username_description": "Это стандартное имя пользователя. В случае изменения вы будете перенаправлены на страницу оплаты для смены тарифа.",
|
||||
"premium_to_standard_username_description": "Это стандартное имя пользователя. В случае изменения вы будете перенаправлены на страницу оплаты для смены тарифа.",
|
||||
"current": "Текущее",
|
||||
"premium": "премиум",
|
||||
"standard": "стандартное",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Radni tokovi vam omogućavaju da automatizujete slanje podsetnika i notifikacija.",
|
||||
"active_on": "Aktivan uključen",
|
||||
"workflow_updated_successfully": "Radni tok {{workflowName}} je uspešno ažuriran",
|
||||
"standard_to_premium_username_description": "Ovo je standardno korisničko ime i ažuriranje će vas poslati na naplatu da biste prešli na nižu verziju.",
|
||||
"premium_to_standard_username_description": "Ovo je standardno korisničko ime i ažuriranje će vas poslati na naplatu da biste prešli na nižu verziju.",
|
||||
"current": "Trenutno",
|
||||
"premium": "premijum",
|
||||
"standard": "standardno",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Arbetsflöden gör att du kan automatisera att skicka påminnelser och aviseringar.",
|
||||
"active_on": "Aktiv på",
|
||||
"workflow_updated_successfully": "{{workflowName}} uppdaterades framgångsrikt",
|
||||
"standard_to_premium_username_description": "Detta är ett standardanvändarnamn och uppdatering tar dig till fakturering för att nedgradera.",
|
||||
"premium_to_standard_username_description": "Detta är ett standardanvändarnamn och uppdatering tar dig till fakturering för att nedgradera.",
|
||||
"current": "Nuvarande",
|
||||
"premium": "premium",
|
||||
"standard": "standard",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "İş akışları, hatırlatıcı ve bildirim göndermeyi otomatikleştirmenizi sağlar.",
|
||||
"active_on": "Aktif",
|
||||
"workflow_updated_successfully": "{{workflowName}} iş akışı başarıyla güncellendi",
|
||||
"standard_to_premium_username_description": "Bu, standart bir kullanıcı adıdır ve güncelleme işlemi eski sürüme geçmeniz için sizi faturalandırma sayfasına yönlendirecektir.",
|
||||
"premium_to_standard_username_description": "Bu, standart bir kullanıcı adıdır ve güncelleme işlemi eski sürüme geçmeniz için sizi faturalandırma sayfasına yönlendirecektir.",
|
||||
"current": "Mevcut",
|
||||
"premium": "premium",
|
||||
"standard": "standart",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Робочі процеси дають змогу автоматизувати надсилання нагадувань і сповіщень.",
|
||||
"active_on": "Активується",
|
||||
"workflow_updated_successfully": "Робочий процес «{{workflowName}}» оновлено",
|
||||
"standard_to_premium_username_description": "Це стандандартне ім’я користувача. Якщо оновити його, ви перейдете до виставлення рахунків для переходу на дешевшу підписку.",
|
||||
"premium_to_standard_username_description": "Це стандандартне ім’я користувача. Якщо оновити його, ви перейдете до виставлення рахунків для переходу на дешевшу підписку.",
|
||||
"current": "Поточна",
|
||||
"premium": "преміум",
|
||||
"standard": "стандарт",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "Dòng công việc giúp bạn tự động hóa việc gửi lời nhắc và thông báo.",
|
||||
"active_on": "Hoạt động vào",
|
||||
"workflow_updated_successfully": "Đã cập nhật thành công tiến độ công việc {{workflowName}}",
|
||||
"standard_to_premium_username_description": "Đây là tên người dùng tiêu chuẩn và việc cập nhật sẽ đưa bạn đến khâu thanh toán để hạ cấp độ.",
|
||||
"premium_to_standard_username_description": "Đây là tên người dùng tiêu chuẩn và việc cập nhật sẽ đưa bạn đến khâu thanh toán để hạ cấp độ.",
|
||||
"current": "Hiện tại",
|
||||
"premium": "cao cấp",
|
||||
"standard": "tiêu chuẩn",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "工作流程可让您自动发送提醒和通知。",
|
||||
"active_on": "活跃于",
|
||||
"workflow_updated_successfully": "{{workflowName}} 工作流程已成功更新",
|
||||
"standard_to_premium_username_description": "这是一个标准用户名,更新流程会将您引导至账单页面进行降级。",
|
||||
"premium_to_standard_username_description": "这是一个标准用户名,更新流程会将您引导至账单页面进行降级。",
|
||||
"current": "当前",
|
||||
"premium": "高级",
|
||||
"standard": "标准",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"new_workflow_description": "工作流程可讓您自動傳送提醒和通知。",
|
||||
"active_on": "啟用類型:",
|
||||
"workflow_updated_successfully": "已成功更新 {{workflowName}}",
|
||||
"standard_to_premium_username_description": "此為標準使用者名稱,更新系統會帶您前往付費頁面進行降級。",
|
||||
"premium_to_standard_username_description": "此為標準使用者名稱,更新系統會帶您前往付費頁面進行降級。",
|
||||
"current": "目前",
|
||||
"premium": "高級",
|
||||
"standard": "標準",
|
||||
|
||||
+1
-1
Submodule apps/website updated: f3fba833b8...81ff552ad9.
Reference in new issue
Block a user