From 445fea2027626f44849c6e99ddd597635ce87e51 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Thu, 15 Feb 2024 22:35:24 -0600 Subject: [PATCH] more --- src/Components/SignupPage/SignupPage.js | 30 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/Components/SignupPage/SignupPage.js b/src/Components/SignupPage/SignupPage.js index 0a58356..6a4f5d1 100644 --- a/src/Components/SignupPage/SignupPage.js +++ b/src/Components/SignupPage/SignupPage.js @@ -61,7 +61,6 @@ const SignupPage = () => { const [showAddAccount, setShowAddAccount] = useState(false); const [numberOfAccountsToAdd, setNumberOfAccountsToAdd] = useState(); const [showPromoModal, setShowPromoModal] = useState(false); - const [isPromoMembership, setIsPromoMembership] = useState(); const [issueText, setIssueText] = useState(""); const handleChangeInput = (e, name) => { @@ -73,7 +72,6 @@ const SignupPage = () => { const handleConfirmPromoCode = () => { if (issueText === marchEmailPrm) { - setIsPromoMembership(true); handlePromoSignup(); } }; @@ -174,16 +172,20 @@ const SignupPage = () => { subscriptionCreated, subscriptionPeriodStart, subscriptionPeriodEnd, - subscriptionId + subscriptionId, + isPromotionalMebership ) { + console.log("isPromotionalMebership", isPromotionalMebership); const appUserId = uuidv4(); const firmId = uuidv4(); const fbAuthUid = authId; - const plan = selectedPlan; + let plan = selectedPlan; let docsAllowedPerMonth; - if (isPromoMembership) { + if (isPromotionalMebership?.isPromotionalMebership2 === "correct") { docsAllowedPerMonth = 1; + subscriptionId = uuidv4(); + plan = "promo plan"; } else { docsAllowedPerMonth = selectedPlan[0].docsAllowedPerMonth; } @@ -207,7 +209,10 @@ const SignupPage = () => { const userState = stateDataValues.filter((value) => { if (value.name === state) return value; }); - + console.log( + "isPromotionalMebership directly above userData line 215", + isPromotionalMebership + ); const userData = { docsAllowedPerMonth, docsGenerated, @@ -225,6 +230,7 @@ const SignupPage = () => { barNumber, practiceArea, email, + isPromotionalMebership, customerId: customerId, subscriptionId: subscriptionId, subscriptionPlan: plan, @@ -427,13 +433,12 @@ const SignupPage = () => { setIsBusy(true); try { - //const customerId = data.data.customerId; + const customerId = `${uuidv4()}-promo`; const today = new Date(); const subscriptionCreated = today; const subscriptionPeriodStart = today; - const subscriptionPeriodEnd = today.setDate(today.getDate() + 30); + const subscriptionPeriodEnd = "it edns whatever"; //today.setDate(today.getDate() + 30); const subscriptionId = uuidv4(); - const isPromotionalMebership = true; const userCredential = await createUserWithEmailAndPassword( auth, @@ -443,15 +448,18 @@ const SignupPage = () => { const user = userCredential.user; dataValues = { ...dataValues }; + + const isPromotionalMebership = true; const res = await saveUserData( user.uid, dataValues, + customerId, subscriptionCreated, subscriptionPeriodStart, subscriptionPeriodEnd, - subscriptionId + subscriptionId, + isPromotionalMebership ); - console.log("res", res); setIsBusy(false); navigate("/dashboard"); } catch (error) {