@stokr/components-library 3.0.44 → 3.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/context/Auth.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Cookies from "js-cookie";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import axiosInstance from "../model/axios.js";
|
|
4
|
+
import axiosInstance$1 from "../model/axiosPublic.js";
|
|
4
5
|
import getCookieDomain from "../utils/get-cookie-domain.js";
|
|
5
6
|
import { getLastFirebaseConfig } from "../config.js";
|
|
6
7
|
import { initFirebase, getFirebaseAuth } from "../firebase-config.js";
|
|
@@ -136,7 +137,7 @@ class Auth {
|
|
|
136
137
|
}
|
|
137
138
|
static reportFailedLoginAttempt(email) {
|
|
138
139
|
return new Promise((resolve, reject) => {
|
|
139
|
-
axiosInstance.post(`auth/failed-login-attempt`, { email }).then((response) => {
|
|
140
|
+
axiosInstance$1.post(`auth/failed-login-attempt`, { email }).then((response) => {
|
|
140
141
|
resolve(response.data);
|
|
141
142
|
}).catch((err) => {
|
|
142
143
|
reject(err);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useContext,
|
|
2
|
+
import { useState, useContext, useCallback, useEffect } from "react";
|
|
3
3
|
import { AuthContext } from "../context/AuthContext.js";
|
|
4
4
|
import fetchDataPublic from "../api/fetchDataPublic.js";
|
|
5
5
|
import parse from "html-react-parser";
|
|
@@ -81,38 +81,6 @@ const useNewVentureForm = ({ project, user, salesChannel, customSuccessMessage }
|
|
|
81
81
|
const { checkboxes, isLoading: isLoadingCheckboxes } = useCheckboxes("newVentureModal", {
|
|
82
82
|
group: "newVentureModal"
|
|
83
83
|
});
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
let formValuesCopy = { ...formValues };
|
|
86
|
-
if (checkboxes) {
|
|
87
|
-
Object.values(checkboxes).forEach((checkbox) => {
|
|
88
|
-
if (checkbox.label === "createPrivateInvestor" && !formValuesCopy.privateInvestorListDisabled) {
|
|
89
|
-
formValuesCopy.privateInvestorListText = parse(checkbox.agreementText);
|
|
90
|
-
} else if (checkbox.label === "subscribeToProject" && !formValuesCopy.mailingListDisabled) {
|
|
91
|
-
formValuesCopy.mailingListText = parse(checkbox.agreementText);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (user?._id) {
|
|
96
|
-
formValuesCopy.email = user.email;
|
|
97
|
-
formValuesCopy.name = user.username;
|
|
98
|
-
const projectSubscription = getProjectSubscription(user, project);
|
|
99
|
-
if (projectSubscription.isPrivateInvestor) {
|
|
100
|
-
formValuesCopy.privateInvestorListText = "You are already registered on the whitelist.";
|
|
101
|
-
formValuesCopy.privateInvestorList = true;
|
|
102
|
-
formValuesCopy.privateInvestorListDisabled = true;
|
|
103
|
-
} else if (projectSubscription.privateInvestorStatus && projectSubscription.privateInvestorStatus !== "Admitted") {
|
|
104
|
-
formValuesCopy.privateInvestorListText = "Your profile is under review. An account manager will reach out to you to confirm your eligibility.";
|
|
105
|
-
formValuesCopy.privateInvestorList = true;
|
|
106
|
-
formValuesCopy.privateInvestorListDisabled = true;
|
|
107
|
-
}
|
|
108
|
-
if (projectSubscription.isSubscribed) {
|
|
109
|
-
formValuesCopy.mailingList = true;
|
|
110
|
-
formValuesCopy.mailingListText = "You already subscribed to the email notification list.";
|
|
111
|
-
formValuesCopy.mailingListDisabled = true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
setFormValues(formValuesCopy);
|
|
115
|
-
}, [user, checkboxes, project, formValues]);
|
|
116
84
|
const handleSubmit = useCallback(
|
|
117
85
|
async (values) => {
|
|
118
86
|
setFormValues((prev) => ({ ...prev, isSubmitting: true }));
|