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,