forked from mrwyndham/fastpocket
82 lines
2.8 KiB
TypeScript
82 lines
2.8 KiB
TypeScript
import { ModalStatus, SourceModal } from '@/types';
|
|
import { useState } from 'react';
|
|
|
|
function useTextsBasedOnActivityState(setStatus: React.Dispatch<React.SetStateAction<ModalStatus>>){
|
|
const signUpTexts = {
|
|
title: "We Are Growing Fast, and We Want You To Join The Party!",
|
|
subTitle: "Join our super awesome waitlist and be one of the first to know when spots open up!",
|
|
buttonText: "Sign Up",
|
|
netlifyFunction: "triggerSignUpEmail",
|
|
source: SourceModal.SignUp
|
|
}
|
|
|
|
const signUpViaPurchaseTexts = {
|
|
title: "Get Ready For Ultimate Productivity",
|
|
subTitle: "Excited to see what we've got! Signup and get started!",
|
|
buttonText: "Sign Up",
|
|
netlifyFunction: "triggerSignUpEmail",
|
|
source: SourceModal.SignUpViaPurchase
|
|
}
|
|
|
|
const bookDemoTexts = {
|
|
title: "Get Ready For Ultimate Productivity",
|
|
subTitle: "Excited to see what we've got! Signup and get started!",
|
|
buttonText: "Book Now",
|
|
netlifyFunction: "triggerBookNowEmail",
|
|
source: SourceModal.BookDemo
|
|
}
|
|
|
|
const TryItTexts = {
|
|
title: "Get Ready For Ultimate Productivity",
|
|
subTitle: "Excited to see what we've got! Send us your details and our marketing rep will schedule a demo ASAP.",
|
|
buttonText: "Try It",
|
|
netlifyFunction: "triggerBookNowEmail",
|
|
source: SourceModal.TryIt
|
|
}
|
|
|
|
const [textOnUse, setTextOnUse] = useState(signUpTexts)
|
|
|
|
const companySizeList = [
|
|
"1-10 employees",
|
|
"10-30 employees",
|
|
"30-70 employees",
|
|
"70-100 employees",
|
|
"100+ employees"
|
|
]
|
|
|
|
const whenModalOpens = () => {
|
|
const signUpModal = document.getElementById("sign-up-modal");
|
|
if (!signUpModal) return;
|
|
const nameAttribute = signUpModal.getAttribute("name");
|
|
switch(nameAttribute){
|
|
case SourceModal.BookDemo:
|
|
setTextOnUse(bookDemoTexts);
|
|
break;
|
|
case SourceModal.TryIt:
|
|
setTextOnUse(TryItTexts);
|
|
break;
|
|
case SourceModal.SignUp:
|
|
setTextOnUse(signUpTexts);
|
|
break;
|
|
case SourceModal.SignUpViaPurchase:
|
|
setTextOnUse(signUpViaPurchaseTexts)
|
|
break;
|
|
default:
|
|
setTextOnUse(bookDemoTexts);
|
|
break;
|
|
}
|
|
setTimeout(() => setStatus(ModalStatus.Default), 500);
|
|
}
|
|
|
|
const getPriceId = () => {
|
|
const signUpModal = document.getElementById("sign-up-modal");
|
|
if (!signUpModal) return undefined;
|
|
const price_id = signUpModal.getAttribute("price_id");
|
|
if (!price_id) return undefined;
|
|
return price_id;
|
|
}
|
|
|
|
return {textOnUse, companySizeList, whenModalOpens, getPriceId}
|
|
}
|
|
|
|
export default useTextsBasedOnActivityState; |