From 193d642f299b6ff0076c9e499b51a260b47c8ab0 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Thu, 15 Feb 2024 21:35:56 -0600 Subject: [PATCH] more --- src/Components/SignupPage/SignupPage.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Components/SignupPage/SignupPage.js b/src/Components/SignupPage/SignupPage.js index 1671f0e..90e5969 100644 --- a/src/Components/SignupPage/SignupPage.js +++ b/src/Components/SignupPage/SignupPage.js @@ -73,6 +73,7 @@ const SignupPage = () => { const handleConfirmPromoCode = () => { if (issueText === marchEmailPrm) { + setIsPromoMembership(true); handlePromoSignup(); } }; @@ -179,7 +180,13 @@ const SignupPage = () => { const firmId = uuidv4(); const fbAuthUid = authId; const plan = selectedPlan; - const docsAllowedPerMonth = selectedPlan[0].docsAllowedPerMonth; + let docsAllowedPerMonth; + + if (isPromoMembership) { + docsAllowedPerMonth = 1; + } else { + docsAllowedPerMonth = selectedPlan[0].docsAllowedPerMonth; + } const docsGenerated = 0; @@ -417,19 +424,17 @@ const SignupPage = () => { return; } - //const planType = determinePlan(isAnnual, activeRadioOption); - if (dataValues) { window.scrollTo({ top: 0, behavior: "smooth" }); setIsBusy(true); try { //const customerId = data.data.customerId; - - const subscriptionCreated = new Date(); - const subscriptionPeriodStart = subscriptionCreated; - //const subscriptionPeriodEnd = 30 days from date created - const subscriptionId = uuidv4(); + const today = new Date(); + const subscriptionCreated = today; + const subscriptionPeriodStart = today; + const subscriptionPeriodEnd = today.setDate(today.getDate() + 30); + const subscriptionId = `promo-${uuidv4()}`; const isPromotionalMebership = true; const userCredential = await createUserWithEmailAndPassword( @@ -443,7 +448,6 @@ const SignupPage = () => { const res = await saveUserData( user.uid, dataValues, - subscriptionCreated, subscriptionPeriodStart, subscriptionPeriodEnd,