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 [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) {