This commit is contained in:
Kenneth Jannette
2024-02-15 22:35:24 -06:00
parent a925f74940
commit 445fea2027

View File

@@ -61,7 +61,6 @@ const SignupPage = () => {
const [showAddAccount, setShowAddAccount] = useState(false); const [showAddAccount, setShowAddAccount] = useState(false);
const [numberOfAccountsToAdd, setNumberOfAccountsToAdd] = useState(); const [numberOfAccountsToAdd, setNumberOfAccountsToAdd] = useState();
const [showPromoModal, setShowPromoModal] = useState(false); const [showPromoModal, setShowPromoModal] = useState(false);
const [isPromoMembership, setIsPromoMembership] = useState();
const [issueText, setIssueText] = useState(""); const [issueText, setIssueText] = useState("");
const handleChangeInput = (e, name) => { const handleChangeInput = (e, name) => {
@@ -73,7 +72,6 @@ const SignupPage = () => {
const handleConfirmPromoCode = () => { const handleConfirmPromoCode = () => {
if (issueText === marchEmailPrm) { if (issueText === marchEmailPrm) {
setIsPromoMembership(true);
handlePromoSignup(); handlePromoSignup();
} }
}; };
@@ -174,16 +172,20 @@ const SignupPage = () => {
subscriptionCreated, subscriptionCreated,
subscriptionPeriodStart, subscriptionPeriodStart,
subscriptionPeriodEnd, subscriptionPeriodEnd,
subscriptionId subscriptionId,
isPromotionalMebership
) { ) {
console.log("isPromotionalMebership", isPromotionalMebership);
const appUserId = uuidv4(); const appUserId = uuidv4();
const firmId = uuidv4(); const firmId = uuidv4();
const fbAuthUid = authId; const fbAuthUid = authId;
const plan = selectedPlan; let plan = selectedPlan;
let docsAllowedPerMonth; let docsAllowedPerMonth;
if (isPromoMembership) { if (isPromotionalMebership?.isPromotionalMebership2 === "correct") {
docsAllowedPerMonth = 1; docsAllowedPerMonth = 1;
subscriptionId = uuidv4();
plan = "promo plan";
} else { } else {
docsAllowedPerMonth = selectedPlan[0].docsAllowedPerMonth; docsAllowedPerMonth = selectedPlan[0].docsAllowedPerMonth;
} }
@@ -207,7 +209,10 @@ const SignupPage = () => {
const userState = stateDataValues.filter((value) => { const userState = stateDataValues.filter((value) => {
if (value.name === state) return value; if (value.name === state) return value;
}); });
console.log(
"isPromotionalMebership directly above userData line 215",
isPromotionalMebership
);
const userData = { const userData = {
docsAllowedPerMonth, docsAllowedPerMonth,
docsGenerated, docsGenerated,
@@ -225,6 +230,7 @@ const SignupPage = () => {
barNumber, barNumber,
practiceArea, practiceArea,
email, email,
isPromotionalMebership,
customerId: customerId, customerId: customerId,
subscriptionId: subscriptionId, subscriptionId: subscriptionId,
subscriptionPlan: plan, subscriptionPlan: plan,
@@ -427,13 +433,12 @@ const SignupPage = () => {
setIsBusy(true); setIsBusy(true);
try { try {
//const customerId = data.data.customerId; const customerId = `${uuidv4()}-promo`;
const today = new Date(); const today = new Date();
const subscriptionCreated = today; const subscriptionCreated = today;
const subscriptionPeriodStart = 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 subscriptionId = uuidv4();
const isPromotionalMebership = true;
const userCredential = await createUserWithEmailAndPassword( const userCredential = await createUserWithEmailAndPassword(
auth, auth,
@@ -443,15 +448,18 @@ const SignupPage = () => {
const user = userCredential.user; const user = userCredential.user;
dataValues = { ...dataValues }; dataValues = { ...dataValues };
const isPromotionalMebership = true;
const res = await saveUserData( const res = await saveUserData(
user.uid, user.uid,
dataValues, dataValues,
customerId,
subscriptionCreated, subscriptionCreated,
subscriptionPeriodStart, subscriptionPeriodStart,
subscriptionPeriodEnd, subscriptionPeriodEnd,
subscriptionId subscriptionId,
isPromotionalMebership
); );
console.log("res", res);
setIsBusy(false); setIsBusy(false);
navigate("/dashboard"); navigate("/dashboard");
} catch (error) { } catch (error) {