Skip to content

Commit

Permalink
lead-send-aulas
Browse files Browse the repository at this point in the history
  • Loading branch information
vogelcodes committed May 5, 2024
1 parent aa73087 commit 2524d4e
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions src/pages/aulas/[aula].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

import { type NextPage } from "next";
import { Dialog, Transition } from "@headlessui/react";
import { Fragment, useEffect, useState } from "react";
Expand All @@ -21,20 +26,23 @@ import Faq from "../../components/faq";
import Footer from "../../components/footer";
import Depos from "../../components/depos";

export default function Page() {
const Page: NextPage = () => {
type E164Number = string | undefined;

const [isOpen, setIsOpen] = useState(false);
const [value, setValue] = useState<E164Number>();

const [email, setEmail] = useState("");
const [name, setName] = useState("");
const [loading, setLoading] = useState(false);

// const [version, setVersion] = useState<string | null>();
const [cta, setCta] = useState("");
const [userIP, setUserIP] = useState("");
const [userLocation, setUserLocation] = useState("");
const [userAgent, setUserAgent] = useState("");
const { mutate } = api.example.saveLead.useMutation();
const router = useRouter();

// useEffect(() => {
// setVersion(!versionParam ? "" : versionParam);
Expand All @@ -57,6 +65,7 @@ export default function Page() {

function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
console.log(formatPhoneNumber(value || ""));
console.log(router.asPath);

Expand All @@ -70,14 +79,21 @@ export default function Page() {
ip: userIP,
agent: userAgent,
});
window.open(
`https://pay.hotmart.com/O84147403X?email=${email}&phoneac=${
formatPhoneNumber(value ?? "") || ""
// value
}&name=${name}&${utmParams.toString()}`
);
setTimeout(() => {
router.push(
`https://pay.hotmart.com/O84147403X?checkoutMode=10&email=${email}&phoneac=${
formatPhoneNumber(value ?? "") || ""
// value
}&name=${name}&${utmParams.toString()}`
);
}, 1200);
// window.open(
// `https://pay.hotmart.com/O84147403X?checkoutMode=10&email=${email}&phoneac=${
// formatPhoneNumber(value ?? "") || ""
// // value
// }&name=${name}&${utmParams.toString()}`
// );
}
const router = useRouter();
const ytUrlOptions: Record<string, string> = {
saciedade: "H6iB3jTKPW8",
"baixa-producao": "L9IrS6AY2DY",
Expand Down Expand Up @@ -316,7 +332,9 @@ export default function Page() {
type="submit"
className="mx-auto mt-4 rounded-lg border-b-4 border-b-[#236C0F] bg-[#40C351] px-2 py-3 text-[13.6px] font-extrabold uppercase text-cream hover:scale-[104%] hover:border-b-[#44972d] hover:bg-[#236C0F] lg:py-5 lg:text-[22.6px]"
>
Quero aumentar minha produção de leite
{loading
? "Enviando..."
: "Quero aumentar minha produção de leite"}
</button>
</form>
{/* </a> */}
Expand All @@ -333,4 +351,5 @@ export default function Page() {
</div>
</div>
);
}
};
export default Page;

0 comments on commit 2524d4e

Please sign in to comment.