diff --git a/Frontend/netlify/functions/triggerBookNowEmail/index.js b/Frontend/netlify/functions/triggerBookNowEmail/index.js deleted file mode 100644 index 1e6d703..0000000 --- a/Frontend/netlify/functions/triggerBookNowEmail/index.js +++ /dev/null @@ -1,35 +0,0 @@ -const fetch = require('node-fetch-commonjs') - -exports.handler = async function (event) { - if (event.body === null) { - return { - statusCode: 400, - body: JSON.stringify("Payload required"), - }; - } - - const requestBody = JSON.parse(event.body) - - //automatically generated snippet from the email preview - //sends a request to an email handler for a subscribed email - await fetch(`${process.env.URL}/.netlify/functions/emails/BookNow`, { - headers: { - "netlify-emails-secret": process.env.NEXT_PUBLIC_NETLIFY_EMAILS_SECRET, - }, - method: "POST", - body: JSON.stringify({ - from: process.env.NEXT_PUBLIC_NETLIFY_FROM_EMAIL, - to: requestBody.subscriberEmail, - subject: "Thanks For Booking on Sign365", - parameters: { - email: requestBody.subscriberEmail, - }, - }), - } - ); - - return { - statusCode: 200, - body: JSON.stringify("SignUp email sent!"), - }; -} \ No newline at end of file diff --git a/Frontend/netlify/functions/triggerLearnMoreEmail/assets/Whitepaper.pdf b/Frontend/netlify/functions/triggerLearnMoreEmail/assets/Whitepaper.pdf deleted file mode 100644 index 008b5f8..0000000 Binary files a/Frontend/netlify/functions/triggerLearnMoreEmail/assets/Whitepaper.pdf and /dev/null differ diff --git a/Frontend/netlify/functions/triggerLearnMoreEmail/index.js b/Frontend/netlify/functions/triggerLearnMoreEmail/index.js deleted file mode 100644 index 4f2e33d..0000000 --- a/Frontend/netlify/functions/triggerLearnMoreEmail/index.js +++ /dev/null @@ -1,44 +0,0 @@ -const fetch = require('node-fetch-commonjs') -const fs = require('fs'); -const path = require('path'); - -exports.handler = async function (event) { - if (event.body === null) { - return { - statusCode: 400, - body: JSON.stringify("Payload required"), - }; - } - - const requestBody = JSON.parse(event.body) - - const file = fs.readFileSync(path.resolve("./netlify/functions/triggerLearnMoreEmail/assets/Whitepaper.pdf")).toString("base64"); - - //automatically generated snippet from the email preview - //sends a request to an email handler for a subscribed email - await fetch(`${process.env.URL}/.netlify/functions/emails/WhitePaper`, { - headers: { - "netlify-emails-secret": process.env.NEXT_PUBLIC_NETLIFY_EMAILS_SECRET, - }, - method: "POST", - body: JSON.stringify({ - from: process.env.NEXT_PUBLIC_NETLIFY_FROM_EMAIL, - to: requestBody.subscriberEmail, - subject: "Thanks For Visiting Sign365", - attachments: [{ - content: file, - filename: "Whitepaper.pdf", - type: "pdf", - }], - parameters: { - email: requestBody.subscriberEmail, - }, - }), - } - ); - - return { - statusCode: 200, - body: JSON.stringify("WhitePaper email sent!"), - }; -} \ No newline at end of file diff --git a/Frontend/netlify/functions/triggerSignUpEmail/index.ts b/Frontend/netlify/functions/triggerSignUpEmail/index.ts deleted file mode 100644 index d94098c..0000000 --- a/Frontend/netlify/functions/triggerSignUpEmail/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -exports.handler = async function (event: Event) { - console.log(event); - return { - statusCode: 200, - body: "Hello, World!", - headers: { - "Access-Control-Allow-Origin": "http://localhost:3000", // <-- This allows any domain - // "Access-Control-Allow-Headers": "Content-Type", - }, - }; -}; - -// import fetch from 'node-fetch-commonjs'; - -// export async function handler(event) { -// if (event.body === null) { -// return { -// statusCode: 400, -// body: JSON.stringify("Payload required"), -// headers: { -// "Access-Control-Allow-Origin": "*", -// "Access-Control-Allow-Headers": "Content-Type" -// } -// }; -// } -// console.log("Incoming event.body:", event.body); -// const requestBody = JSON.parse(event.body); -// if(!requestBody){ -// console.log("No Body") -// } -// const url = `./.netlify/functions/emails/SignUp`; -// const email = requestBody.subscriberEmail; -// console.log("Using URL:", url); -// //automatically generated snippet from the email preview -// //sends a request to an email handler for a subscribed email -// try { -// await fetch(`/.netlify/functions/emails/SignUp`, { -// headers: { -// "netlify-emails-secret": process.env.NEXT_PUBLIC_NETLIFY_EMAILS_SECRET, -// }, -// method: "POST", -// body: JSON.stringify({ -// from: process.env.NEXT_PUBLIC_NETLIFY_FROM_EMAIL, -// to: email, -// subject: "Thanks For Signing Up on Sign365", -// parameters: { -// email: email, -// }, -// }), -// }); -// } catch (err) { -// console.log("Error sending Mailchimp email", err.message); -// return { -// statusCode: 500, -// body: JSON.stringify("Failed to send Mailchimp email."), -// headers: { -// "Access-Control-Allow-Origin": "*", -// "Access-Control-Allow-Headers": "Content-Type" -// } -// }; -// } - -// } diff --git a/Frontend/sections/FeaturesZigzag.tsx b/Frontend/sections/FeaturesZigzag.tsx deleted file mode 100755 index 7272c66..0000000 --- a/Frontend/sections/FeaturesZigzag.tsx +++ /dev/null @@ -1,218 +0,0 @@ -import React from "react"; - -import imageConnection from "@/images/zigzag-connection.png"; -import imageGraph from "@/images/zigzag-graph.png"; -import imageStreamLine from "@/images/zigzag-streamline.png"; -import Image from "next/image"; -import { SourceModal } from "@/types"; -import Link from "next/link"; - -const FeaturesZigzag = () => { - const tryItOnClick = () => { - const signUpModal = document.getElementById("sign-up-modal"); - if (!signUpModal) return; - signUpModal.setAttribute("name", SourceModal.TryIt); - signUpModal.removeAttribute("price_id"); - signUpModal.click(); - }; - - return ( -
-
-
- {/* Section header */} -
- -

- One Form, Zero Data Reentry -

-

- Enter data once and let our app do the rest. We'll send the - information to your business systems, so that you don't need - to do it more than once. -

-
- - {/* Items */} -
- {/* 1st item */} -
- {/* Image */} -
- Features 01 -
- {/* Content */} -
-
-
- Revolutionize Your Workflow -
-

- Sign365 removes collecting and filling forms from your - workflow through it's iOS app. You can now fill and - sign your forms without needing to do the work twice. -

-
    - - We give you the app to collect your surveys and forms. - You tell us where you want the information to go and we - send it. - - -
  • - - Is your GTO or labour hire company needing some forms to - collect information? We offer{" "} - - free templates - {" "} - and give you the tools to make your own. - -
  • -
-

-
-
- - {/* 2nd item */} -
- {/* Image */} -
- Features 02 -
- {/* Content */} -
-
-
- More speed. Less spend -
-

- Save Time and Money -

-

- Sign365 reduces your work hours by giving you an assistant - to do all your paperwork. Got forms to store? Let{" "} - - the app - {" "} - do it! -

-
    -
  • - - Get the app to collect info and free up time to focus on - other business operations. - -
  • -
  • - - - The app - {" "} - stores your forms offline and then sends them when you - are back online. You don't need someone to send the - forms for you. You don't need someone to scan for - you. Sign365 does it. - -
  • -
-
-
-
- - {/* 3rd item */} -
- {/* Image */} -
- Features 03 -
- {/* Content */} -
-
-
- Unlock Seamless Business Operations -
-

- Connect to Over 1000 Apps -

-

- Sign365 can submit information to over 1000 apps. Whether - you use Salesforce, Hubspot, or any other business app, - Sign365 has got you covered. -

-
    -
  • - - Sign365 lets you choose where to store your forms. You - can choose which apps to connect to yourself. Or let us - do the heavy lifting! - -
  • -
-
-
-
-
-
-
-
- ); -}; - -export default FeaturesZigzag; diff --git a/Frontend/sections/Newsletter/Newsletter.tsx b/Frontend/sections/Newsletter/Newsletter.tsx index 5b15566..42f5a59 100644 --- a/Frontend/sections/Newsletter/Newsletter.tsx +++ b/Frontend/sections/Newsletter/Newsletter.tsx @@ -1,8 +1,17 @@ -"use client"; +import { newsletterValidationSchema } from "@/utils/form"; +import { yupResolver } from "@hookform/resolvers/yup"; import React from "react"; -import NewsletterForm from "./NewsletterForm"; +import { useForm } from "react-hook-form"; function Newsletter() { + const { + register, + handleSubmit, + reset, + formState: { errors }, + } = useForm({ + resolver: yupResolver(newsletterValidationSchema), + }); return (
@@ -12,7 +21,41 @@ function Newsletter() { data-aos="fade-up" >
- +
+

+ Stay Ahead of the Curve +

+

+ Join our newsletter to get top news before anyone else. +

+
+ +
+
{ + console.log(data); + reset(); + })} + className="flex flex-col sm:flex-row justify-center max-w-xs mx-auto sm:max-w-md lg:max-w-none gap-x-2" + > +
+ +
+ {errors.email?.message}  +
+
+ +
+
diff --git a/Frontend/sections/Newsletter/NewsletterForm.tsx b/Frontend/sections/Newsletter/NewsletterForm.tsx deleted file mode 100644 index fe4929c..0000000 --- a/Frontend/sections/Newsletter/NewsletterForm.tsx +++ /dev/null @@ -1,124 +0,0 @@ -"use client"; - -import React, { useState } from "react"; -import { NewsLetterForm, SourceModal } from "@/types"; -import { mailchimp } from "@/app/(auth)/actions"; -import { toast } from "react-toastify"; -import { ModalStatus } from "@/types"; - -const NewsletterForm = () => { - const [status, setStatus] = useState(ModalStatus.Default); - const [email, setEmail] = useState(""); - - const submitForm = async (event: React.FormEvent) => { - event.preventDefault(); - try { - if (!email) { - throw Error("Email is Empty"); - } - if (email.indexOf("@") === -1) { - throw Error("Email is invalid"); - } - setStatus(ModalStatus.Loading); - const formData = { - email: email, - first_name: "", - last_name: "", - phone_number: "", - company_size: "", - source: SourceModal.Newsletter, - }; - await sendMailchimpRequest(formData); - // await handleSendgridSubmit(formData.email); - setStatus(ModalStatus.Success); - } catch (error) { - if (error instanceof Error) { - toast.error(error.message, { - position: "bottom-left", - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: "colored", - }); - } - setStatus(ModalStatus.Default); - } - }; - - const sendMailchimpRequest = async (data: NewsLetterForm) => { - console.log("sendMailchimpRequest call initiated"); - await mailchimp({ - email: data.email, - first_name: "", - last_name: "", - phone_number: "", - company_size: "", - source: data.source, - }); - console.log("sendMailchimpRequest call success"); - }; - - const handleSendgridSubmit = async (email: string) => { - const data = { - subscriberEmail: email, - }; - //call to the Netlify Function you created - return fetch("./.netlify/functions/triggerLearnMoreEmail", { - method: "POST", - body: JSON.stringify({ - subscriberEmail: data.subscriberEmail, - }), - }); - }; - - return ( - <> -
-

- {status !== ModalStatus.Success - ? "Stay Ahead of the Curve" - : "Thanks for subscribing"} -

-

- {status !== ModalStatus.Success - ? "Join our newsletter to get top news before anyone else." - : "You are going to love what we have to show you"} -

-
- -
-
submitForm(e)} - className="flex flex-col sm:flex-row justify-center max-w-xs mx-auto sm:max-w-md lg:max-w-none gap-x-2" - > - - {/* setEmail(event.target.value)} - value={email} - className="w-full appearance-none bg-transparent border border-white focus:border-white rounded-sm px-4 py-3 mb-2 sm:mb-0 sm:mr-2 placeholder-white disabled:bg-transparent" - placeholder="Your best email…" - aria-label="Your best email…" - disabled={status === ModalStatus.Success} - autoComplete="on" - /> */} - -
-
- - ); -}; - -export default NewsletterForm; diff --git a/Frontend/types/index.ts b/Frontend/types/index.ts index 915be50..8340977 100644 --- a/Frontend/types/index.ts +++ b/Frontend/types/index.ts @@ -6,35 +6,6 @@ export interface PostMetadata { image: string; } -// export type User = { -// onClick: () => void; -// text: string; -// buttonColor: string; -// buttonHover: string; -// } - -export type TextOnUse = { - title: string; - subTitle: string; - buttonText: string; - netlifyFunction: string; - source?: SourceModal; -}; - -export type LearnMoreForm = { - email: string; -} - -export type NewsLetterForm = { - email: string; - source: SourceModal; -} - -export type SignInForm = { - email: string; - password?: string; -} - export type SignUpForm = { email: string; password?: string; @@ -46,23 +17,6 @@ export type SignUpForm = { organisation: string; } -export type LearnMoreValidationForm = { - EMAIL: string; - SOURCE: SourceModal; -} -export type SignInValidationForm = { - EMAIL: string; - SOURCE: SourceModal; -} -export type SignUpValidationForm = { - EMAIL: string; - FNAME: string; - LNAME: string; - PHONE: string; - CSIZE: string; - SOURCE: SourceModal; -} - export type Product = { product_id: string; active: boolean; @@ -195,12 +149,6 @@ export type CheckoutSession = { url: string } -export enum ModalStatus { - Success = 'success', - Loading = 'loading', - Default = 'default', -} - export enum SourceModal { SignUp = 'SignUp', SignUpViaPurchase = 'SignUpViaPurchase', diff --git a/Frontend/utils/form.ts b/Frontend/utils/form.ts index b6421b6..b2b658f 100644 --- a/Frontend/utils/form.ts +++ b/Frontend/utils/form.ts @@ -70,7 +70,7 @@ const contactUsValidationSchema = Yup.object().shape({ email: Yup.string().email().required("E-mail is required"), }); -const learnMoreValidationSchema = Yup.object().shape({ +const newsletterValidationSchema = Yup.object().shape({ email: Yup.string().email().required("E-mail is required"), }); @@ -84,7 +84,7 @@ const signInValidationSchema = Yup.object().shape({ }); export { - learnMoreValidationSchema, + newsletterValidationSchema, signUpValidationSchema, signInValidationSchema, waitinglistValidationSchema,