@axos-web-dev/shared-components 0.0.147 → 0.0.148
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/ATMLocator/ATMLocator.js +5 -3
- package/dist/Button/Button.js +5 -2
- package/dist/Calculators/Calculator.js +3 -1
- package/dist/Carousel/index.js +3 -1
- package/dist/Chevron/index.js +5 -2
- package/dist/Comparison/Comparison.js +6 -4
- package/dist/FaqAccordion/index.js +6 -4
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +3 -1
- package/dist/Forms/ApplicationStart.js +2 -2
- package/dist/Forms/ClearingForm.js +2 -2
- package/dist/Forms/CommercialDeposits.js +2 -2
- package/dist/Forms/CommercialLending.js +2 -2
- package/dist/Forms/ContactCompany.js +2 -2
- package/dist/Forms/ContactUs.js +2 -2
- package/dist/Forms/ContactUsAAS.js +2 -2
- package/dist/Forms/ContactUsBusiness.js +5 -3
- package/dist/Forms/ContactUsNMLSId.js +5 -3
- package/dist/Forms/CpraRequest.js +2 -2
- package/dist/Forms/DealerServices.js +2 -2
- package/dist/Forms/EmailOnly.js +5 -3
- package/dist/Forms/Forms.css.d.ts +13 -0
- package/dist/Forms/Forms.css.js +26 -0
- package/dist/Forms/MortgageRate/MortgageRateForm.d.ts +26 -0
- package/dist/Forms/MortgageRate/MortgageRateForm.js +735 -0
- package/dist/Forms/MortgageRate/MortgageRateModal.d.ts +16 -0
- package/dist/Forms/MortgageRate/MortgageRateModal.js +65 -0
- package/dist/Forms/MortgageRate/MortgageRateQuoteFilters.d.ts +16 -0
- package/dist/Forms/MortgageRate/MortgageRateQuoteFilters.js +428 -0
- package/dist/Forms/MortgageRate/MortgageRateWatch.d.ts +28 -0
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +484 -0
- package/dist/Forms/QuickPricer.js +2 -2
- package/dist/Forms/ScheduleCall.js +2 -2
- package/dist/Forms/ScheduleCallPremier.js +2 -2
- package/dist/Forms/SuccesForm.js +3 -1
- package/dist/Forms/WcplSurvey.js +2 -2
- package/dist/Forms/index.d.ts +4 -0
- package/dist/Forms/index.js +24 -1
- package/dist/Hyperlink/index.js +3 -1
- package/dist/ImageLink/ImageLink.js +5 -3
- package/dist/ImageLink/ImageLinkSet.js +5 -3
- package/dist/ImageLink/index.js +3 -1
- package/dist/Input/CurrencyInput.js +2 -2
- package/dist/Input/DownPaymentInput.d.ts +12 -0
- package/dist/Input/DownPaymentInput.js +123 -0
- package/dist/Input/Dropdown.css.d.ts +5 -0
- package/dist/Input/Dropdown.css.js +3 -0
- package/dist/Input/Input.js +3 -1
- package/dist/Input/InputAmount.js +2 -2
- package/dist/Input/InputPhone.js +2 -2
- package/dist/Input/InputProps.d.ts +3 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Input/index.js +4 -1
- package/dist/Insight/Featured/CategorySelector.js +3 -1
- package/dist/Insight/Featured/Featured.js +3 -1
- package/dist/Interstitial/Interstitial.module.js +14 -11
- package/dist/Modal/Modal.js +5 -3
- package/dist/NavigationMenu/AxosBank/NavData.js +3 -1
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +3 -1
- package/dist/NavigationMenu/AxosBank/index.js +5 -3
- package/dist/SetContainer/SetContainer.js +5 -3
- package/dist/Table/Table.css.d.ts +1 -0
- package/dist/Table/Table.css.js +2 -0
- package/dist/Table/index.js +2 -1
- package/dist/assets/Forms/Forms.css +81 -3
- package/dist/assets/Input/Dropdown.css +3 -0
- package/dist/assets/Interstitial/Interstitial.css.css +141 -137
- package/dist/assets/Table/Table.css +6 -0
- package/dist/main.js +29 -5
- package/package.json +124 -124
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4
|
+
import "../../IconBillboard/IconBillboard.css.js";
|
|
5
|
+
import SvgArrowIcon from "../../icons/ArrowIcon/index.js";
|
|
6
|
+
import SvgAxosX from "../../icons/AxosX/index.js";
|
|
7
|
+
import SvgComponent from "../../icons/AxosX/Blue.js";
|
|
8
|
+
import "../../icons/CheckIcon/CheckIcon.css.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
/* empty css */
|
|
11
|
+
/* empty css */
|
|
12
|
+
/* empty css */
|
|
13
|
+
import { associatedEmail } from "../../utils/EverestValidity.js";
|
|
14
|
+
import "../../utils/allowedAxosDomains.js";
|
|
15
|
+
import { getVariant } from "../../utils/getVariant.js";
|
|
16
|
+
/* empty css */
|
|
17
|
+
/* empty css */
|
|
18
|
+
import "../../Accordion/Accordion.js";
|
|
19
|
+
import "../../Accordion/Accordion.css.js";
|
|
20
|
+
import "../../AlertBanner/AlertBanner.css.js";
|
|
21
|
+
import "../../Article/Article.css.js";
|
|
22
|
+
import "../../ArticlesSet/ArticlesSet.css.js";
|
|
23
|
+
import clsx from "clsx";
|
|
24
|
+
import { useState, useEffect } from "react";
|
|
25
|
+
import "../../Calculators/calculator.css.js";
|
|
26
|
+
import "../../Calculators/AnnualFeeCalculator/AnnualFeeCalculator.css.js";
|
|
27
|
+
import { button } from "../../Button/Button.css.js";
|
|
28
|
+
import "../../Calculators/ApyCalculator/ApyCalculator.css.js";
|
|
29
|
+
import "../../Table/Table.css.js";
|
|
30
|
+
import "../../Calculators/AxosOneCalculator/BalanceAPYCalculator.css.js";
|
|
31
|
+
import "../../Calculators/BalanceAPYCalculator/BalanceAPYCalculator.css.js";
|
|
32
|
+
import "../../Input/Checkbox.js";
|
|
33
|
+
import "../../Input/CurrencyInput.js";
|
|
34
|
+
import { Dropdown } from "../../Input/Dropdown.js";
|
|
35
|
+
import "../../Input/Dropdown.css.js";
|
|
36
|
+
import { Input } from "../../Input/Input.js";
|
|
37
|
+
import "../../Input/Input.css.js";
|
|
38
|
+
import "../../Input/InputAmount.js";
|
|
39
|
+
import { InputPhone } from "../../Input/InputPhone.js";
|
|
40
|
+
import "../../Input/InputTextArea.js";
|
|
41
|
+
import { DownPaymentInput } from "../../Input/DownPaymentInput.js";
|
|
42
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
43
|
+
import * as z from "zod";
|
|
44
|
+
import { modalMobile, formContainer, iconForm, headerContainer, headerForm, form, descriptionField, fullRowSelect, formWrapper, centerSelect, mt2rem, fullRowForm, disclosureForm, actions, formBtns, na_cursor } from "../Forms.css.js";
|
|
45
|
+
import { SalesforceSchema } from "../SalesforceFieldsForm.js";
|
|
46
|
+
import "../../Input/RadioButton.css.js";
|
|
47
|
+
import "../../Input/Checkbox.css.js";
|
|
48
|
+
import { LoadingIndicator } from "../../LoadingIndicator/index.js";
|
|
49
|
+
import "react-use";
|
|
50
|
+
import "../../Input/RadioButton.js";
|
|
51
|
+
import { RateWatchForm } from "./MortgageRateWatch.js";
|
|
52
|
+
import { marketing_tile } from "../../Interstitial/Interstitial-variants.css.js";
|
|
53
|
+
import css from "../../Interstitial/Interstitial.module.js";
|
|
54
|
+
import "iframe-resizer";
|
|
55
|
+
/* empty css */
|
|
56
|
+
import "../../Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.js";
|
|
57
|
+
/* empty css */
|
|
58
|
+
/* empty css */
|
|
59
|
+
/* empty css */
|
|
60
|
+
import "../../Carousel/index.js";
|
|
61
|
+
import "../../Hyperlink/Hyperlink.css.js";
|
|
62
|
+
/* empty css */
|
|
63
|
+
import "../../Comparison/Comparison.css.js";
|
|
64
|
+
import "../../HeroBanner/HeroBanner.css.js";
|
|
65
|
+
import "../../HeroBanner/LargeBanner.css.js";
|
|
66
|
+
import "../../HeroBanner/SelectionBanner.css.js";
|
|
67
|
+
import "../../SetContainer/SetContainer.css.js";
|
|
68
|
+
import "../../Tab/Tab.css.js";
|
|
69
|
+
import "../../icons/Star/Star.css.js";
|
|
70
|
+
import "../../ContentBanner/ContentBanner.css.js";
|
|
71
|
+
/* empty css */
|
|
72
|
+
import "../../ExecutiveBio/ExecutiveBio.css.js";
|
|
73
|
+
import "../../FaqAccordion/index.js";
|
|
74
|
+
import "../../FooterDisclosure/FooterDisclosure.css.js";
|
|
75
|
+
/* empty css */
|
|
76
|
+
import "../../ImageBillboard/ImageBillboard.css.js";
|
|
77
|
+
/* empty css */
|
|
78
|
+
import "react-wrap-balancer";
|
|
79
|
+
/* empty css */
|
|
80
|
+
/* empty css */
|
|
81
|
+
/* empty css */
|
|
82
|
+
import "../../LandingPageHeader/LandingPageHeader.css.js";
|
|
83
|
+
import { chevron_wrapper, chevron } from "../../Chevron/Chevron.css.js";
|
|
84
|
+
/* empty css */
|
|
85
|
+
import "../../Modal/contextApi/store.js";
|
|
86
|
+
/* empty css */
|
|
87
|
+
/* empty css */
|
|
88
|
+
/* empty css */
|
|
89
|
+
/* empty css */
|
|
90
|
+
/* empty css */
|
|
91
|
+
import "../../NavigationMenu/AxosBank/NavData.js";
|
|
92
|
+
import "next/navigation.js";
|
|
93
|
+
import "next/image.js";
|
|
94
|
+
import "next/link.js";
|
|
95
|
+
/* empty css */
|
|
96
|
+
/* empty css */
|
|
97
|
+
import "../../PageNavItem/PageNavItem.css.js";
|
|
98
|
+
import "react-slick";
|
|
99
|
+
/* empty css */
|
|
100
|
+
/* empty css */
|
|
101
|
+
/* empty css */
|
|
102
|
+
import "../../StepItem/StepItem.css.js";
|
|
103
|
+
import "../../StepItemSet/StepItemSet.css.js";
|
|
104
|
+
/* empty css */
|
|
105
|
+
/* empty css */
|
|
106
|
+
/* empty css */
|
|
107
|
+
import "next/script.js";
|
|
108
|
+
/* empty css */
|
|
109
|
+
/* empty css */
|
|
110
|
+
const MortgageRate = ({
|
|
111
|
+
icon = false,
|
|
112
|
+
children,
|
|
113
|
+
onSubmit = (values) => {
|
|
114
|
+
console.log(values);
|
|
115
|
+
},
|
|
116
|
+
disclosure,
|
|
117
|
+
variant: fullVariant = "primary",
|
|
118
|
+
validateEmail,
|
|
119
|
+
id,
|
|
120
|
+
rateWatchOnSubmit
|
|
121
|
+
}) => {
|
|
122
|
+
const [loanPurpose, setLoanPurpose] = useState(1);
|
|
123
|
+
const [rateType, setRateType] = useState("Purchase");
|
|
124
|
+
const [isModalOpen, setModalOpen] = useState(false);
|
|
125
|
+
const [hasOpenedModal, setHasOpenedModal] = useState(false);
|
|
126
|
+
const [hideModal, setHideModal] = useState(false);
|
|
127
|
+
const [downPaymentPercentage, setDownPaymentPercentage] = useState(10);
|
|
128
|
+
const [_downPayment, setDownPayment] = useState(0);
|
|
129
|
+
const [isTypingDownPayment, setIsTypingDownPayment] = useState(false);
|
|
130
|
+
const [salesPriceVal, setSalesPriceVal] = useState(0);
|
|
131
|
+
const schema = z.object({
|
|
132
|
+
firstName: z.string({ message: "First Name is required." }).regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
|
|
133
|
+
message: "First Name is required."
|
|
134
|
+
}).trim().min(1, { message: "First Name is required." }),
|
|
135
|
+
lastName: z.string({ message: "Last Name is required." }).regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
|
|
136
|
+
message: "Last Name is required."
|
|
137
|
+
}).trim().min(1, { message: "Last Name is required." }),
|
|
138
|
+
email: z.string().email({ message: "Email is required." }).refine(async (val) => await validateEmail(val)),
|
|
139
|
+
phone: z.string({ message: "Phone is required." }).regex(/[\d-]{10}/, { message: "Phone is required." }).min(10, { message: "Phone is required." }).max(12, { message: "Phone is required." }).transform((val, ctx) => {
|
|
140
|
+
const removeDashes = val.replace(/-/gi, "");
|
|
141
|
+
if (removeDashes.length !== 10) {
|
|
142
|
+
ctx.addIssue({
|
|
143
|
+
code: z.ZodIssueCode.custom,
|
|
144
|
+
message: "Phone must have 10 characters."
|
|
145
|
+
});
|
|
146
|
+
return z.NEVER;
|
|
147
|
+
}
|
|
148
|
+
return removeDashes;
|
|
149
|
+
}),
|
|
150
|
+
propertyType: z.number({ message: "Property Type is required." }).positive({ message: "Property Type is required." }),
|
|
151
|
+
occupancy: z.number({ message: "Property Usage is required." }).positive({ message: "Property Usage is required." }),
|
|
152
|
+
salesPrice: z.number({ message: "Purchase Price is required." }).optional().refine((val) => loanPurpose === 1 ? val != null : true, {
|
|
153
|
+
message: "Sales Price is required for purchase"
|
|
154
|
+
}).refine(
|
|
155
|
+
(val) => {
|
|
156
|
+
if (loanPurpose === 1) {
|
|
157
|
+
return val != null && val >= 5e4 && val <= 25e6;
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
},
|
|
161
|
+
{ message: "Value must be between $50,000 and $25,000,000." }
|
|
162
|
+
),
|
|
163
|
+
downPayment: z.number({ message: "Down Payment is required." }).optional().refine((val) => loanPurpose === 1 ? val != null : true, {
|
|
164
|
+
message: "Down Payment is required."
|
|
165
|
+
}).refine(
|
|
166
|
+
(val) => {
|
|
167
|
+
if (loanPurpose === 1) {
|
|
168
|
+
return val != null && val >= salesPriceVal * 0.01 && val <= salesPriceVal;
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
message: `Value must be between ${salesPriceVal * 0.01} and ${salesPriceVal}.`
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
creditScore: z.number({ message: "Credit Score is required." }).positive({ message: "Credit Score is required." }),
|
|
177
|
+
zipCode: z.number({ message: "Zip Code is required." }).positive({ message: "Zip Code is required." }),
|
|
178
|
+
appraisedValue: z.number({ message: "Home Price is required." }).optional().refine(
|
|
179
|
+
(val) => {
|
|
180
|
+
if (loanPurpose === 2 && val == null) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
},
|
|
185
|
+
{ message: "Appraised Value is required for refinance" }
|
|
186
|
+
),
|
|
187
|
+
mortgageBalance: z.number({ message: "Mortgage Balance is required." }).optional().refine(
|
|
188
|
+
(val) => {
|
|
189
|
+
if (loanPurpose === 2 && val == null) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
},
|
|
194
|
+
{ message: "Mortgage Balance is required for refinance" }
|
|
195
|
+
),
|
|
196
|
+
cashOut: z.number({ message: "Cash Out is required." }).optional(),
|
|
197
|
+
loanPurpose: z.number({ message: "Loan Purpose is required." })
|
|
198
|
+
});
|
|
199
|
+
const methods = useForm({
|
|
200
|
+
resolver: zodResolver(schema.merge(SalesforceSchema), {
|
|
201
|
+
async: true
|
|
202
|
+
}),
|
|
203
|
+
mode: "all"
|
|
204
|
+
});
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (loanPurpose === 1) {
|
|
207
|
+
methods.reset();
|
|
208
|
+
methods.setValue("appraisedValue", 0);
|
|
209
|
+
methods.setValue("mortgageBalance", 0);
|
|
210
|
+
} else if (loanPurpose === 2) {
|
|
211
|
+
methods.reset();
|
|
212
|
+
methods.setValue("salesPrice", 0);
|
|
213
|
+
methods.setValue("downPayment", 0);
|
|
214
|
+
}
|
|
215
|
+
}, [loanPurpose, methods]);
|
|
216
|
+
const {
|
|
217
|
+
handleSubmit,
|
|
218
|
+
register,
|
|
219
|
+
formState: { errors, isValid, isSubmitting },
|
|
220
|
+
watch
|
|
221
|
+
} = methods;
|
|
222
|
+
const salesPrice = watch("salesPrice");
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
setSalesPriceVal(salesPrice);
|
|
225
|
+
});
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (salesPrice > 0 && !isTypingDownPayment) {
|
|
228
|
+
const calculatedDownPayment = Math.round(
|
|
229
|
+
salesPrice * downPaymentPercentage / 100
|
|
230
|
+
);
|
|
231
|
+
if (!isTypingDownPayment) setDownPayment(calculatedDownPayment);
|
|
232
|
+
methods.setValue("downPayment", calculatedDownPayment);
|
|
233
|
+
}
|
|
234
|
+
}, [salesPrice, downPaymentPercentage]);
|
|
235
|
+
const submitForm = async (data) => {
|
|
236
|
+
const processData = {
|
|
237
|
+
...data
|
|
238
|
+
};
|
|
239
|
+
await onSubmit(processData);
|
|
240
|
+
setHideModal(true);
|
|
241
|
+
};
|
|
242
|
+
const variant = getVariant(fullVariant);
|
|
243
|
+
const toggleModal = () => {
|
|
244
|
+
if (!hasOpenedModal) {
|
|
245
|
+
setModalOpen(true);
|
|
246
|
+
setHasOpenedModal(true);
|
|
247
|
+
} else {
|
|
248
|
+
setHideModal(true);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
const rateWatchModal = /* @__PURE__ */ jsx(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
className: `${marketing_tile} ${css.overlay} ${css.white_modal} active interstitial`,
|
|
255
|
+
onClick: toggleModal,
|
|
256
|
+
children: /* @__PURE__ */ jsxs(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: `${css.modal} active ${modalMobile}`,
|
|
260
|
+
role: "dialog",
|
|
261
|
+
"aria-modal": "true",
|
|
262
|
+
tabIndex: -1,
|
|
263
|
+
onClick: (e) => e.stopPropagation(),
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx(
|
|
266
|
+
"button",
|
|
267
|
+
{
|
|
268
|
+
className: css.close_button,
|
|
269
|
+
onClick: toggleModal,
|
|
270
|
+
"aria-label": "Close modal",
|
|
271
|
+
children: "×"
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
/* @__PURE__ */ jsxs("div", { className: `${css.modal_content} text_center`, children: [
|
|
275
|
+
/* @__PURE__ */ jsx("h2", { className: `header_3`, children: "Set Up Rate Watch" }),
|
|
276
|
+
/* @__PURE__ */ jsx("div", { className: css.body_copy, children: "We have assumed you will use the same criteria you used for your rate search." }),
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
278
|
+
RateWatchForm,
|
|
279
|
+
{
|
|
280
|
+
email: methods.getValues("email"),
|
|
281
|
+
lastName: methods.getValues("lastName"),
|
|
282
|
+
rateWatchOnSubmit,
|
|
283
|
+
toggleModal
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
] })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
const formatCurrency = (value) => {
|
|
293
|
+
return `$${value.toLocaleString()}`;
|
|
294
|
+
};
|
|
295
|
+
const parseCurrency = (value) => {
|
|
296
|
+
if (typeof value === "string") {
|
|
297
|
+
const cleanedValue = value?.replace(/[^0-9.-]+/g, "");
|
|
298
|
+
return cleanedValue ? Number(cleanedValue) : 0;
|
|
299
|
+
}
|
|
300
|
+
return value;
|
|
301
|
+
};
|
|
302
|
+
return !hideModal && /* @__PURE__ */ jsxs(
|
|
303
|
+
"section",
|
|
304
|
+
{
|
|
305
|
+
id: "MortgageRateQuoteForm",
|
|
306
|
+
className: clsx(formContainer({ variant })),
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsx("div", { className: clsx("containment"), children: /* @__PURE__ */ jsxs(FormProvider, { ...methods, children: [
|
|
309
|
+
icon && /* @__PURE__ */ jsx("div", { className: clsx("text_center", iconForm), children: ["primary", "secondary"].includes(variant) ? /* @__PURE__ */ jsx(SvgComponent, {}) : /* @__PURE__ */ jsx(SvgAxosX, {}) }),
|
|
310
|
+
/* @__PURE__ */ jsxs("div", { className: clsx(headerContainer, "text_center"), children: [
|
|
311
|
+
/* @__PURE__ */ jsxs("h1", { className: clsx("header_1", headerForm({ variant })), children: [
|
|
312
|
+
"Today’s Mortgage Rates:",
|
|
313
|
+
" ",
|
|
314
|
+
/* @__PURE__ */ jsx("span", { id: "dynamic-rate-type", children: rateType })
|
|
315
|
+
] }),
|
|
316
|
+
/* @__PURE__ */ jsx(
|
|
317
|
+
"div",
|
|
318
|
+
{
|
|
319
|
+
className: clsx(
|
|
320
|
+
form,
|
|
321
|
+
descriptionField({ variant }),
|
|
322
|
+
"text_center"
|
|
323
|
+
),
|
|
324
|
+
children: "Select Purchase or Refinance to get started"
|
|
325
|
+
}
|
|
326
|
+
)
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ jsx("div", { className: form, children: /* @__PURE__ */ jsx(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
className: `${fullRowSelect} ${formWrapper({ variant: "primary" })} ${centerSelect}`,
|
|
332
|
+
children: /* @__PURE__ */ jsxs(
|
|
333
|
+
Dropdown,
|
|
334
|
+
{
|
|
335
|
+
id: "loanPurpose",
|
|
336
|
+
...register("loanPurpose", {
|
|
337
|
+
required: true,
|
|
338
|
+
setValueAs: (value) => Number(value)
|
|
339
|
+
}),
|
|
340
|
+
label: "Select Loan Type",
|
|
341
|
+
sizes: "medium",
|
|
342
|
+
required: true,
|
|
343
|
+
error: !!errors.loanPurpose,
|
|
344
|
+
helperText: errors.loanPurpose?.message,
|
|
345
|
+
variant,
|
|
346
|
+
defaultValue: "Select Loan Type",
|
|
347
|
+
onChange: (e) => {
|
|
348
|
+
const selectedValue = Number(e.target.value);
|
|
349
|
+
setLoanPurpose(selectedValue);
|
|
350
|
+
setRateType(selectedValue === 1 ? "Purchase" : "Refinance");
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsx("option", { value: "1", children: "Purchase Rates" }),
|
|
354
|
+
/* @__PURE__ */ jsx("option", { value: "2", children: "Refinance Rates" })
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
) }),
|
|
360
|
+
/* @__PURE__ */ jsx("div", { className: clsx(headerContainer, "text_center"), children: /* @__PURE__ */ jsx(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
className: clsx(
|
|
364
|
+
form,
|
|
365
|
+
descriptionField({ variant }),
|
|
366
|
+
"text_center",
|
|
367
|
+
mt2rem
|
|
368
|
+
),
|
|
369
|
+
children: "Tell us about your property and loan to personalize your rate."
|
|
370
|
+
}
|
|
371
|
+
) }),
|
|
372
|
+
/* @__PURE__ */ jsxs("form", { className: form, onSubmit: handleSubmit(submitForm), children: [
|
|
373
|
+
/* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
|
|
374
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
375
|
+
Dropdown,
|
|
376
|
+
{
|
|
377
|
+
id: "propertyType",
|
|
378
|
+
...register("propertyType", {
|
|
379
|
+
required: true,
|
|
380
|
+
setValueAs: (value) => Number(value)
|
|
381
|
+
}),
|
|
382
|
+
label: "Property Type",
|
|
383
|
+
sizes: "medium",
|
|
384
|
+
required: true,
|
|
385
|
+
error: !!errors.propertyType,
|
|
386
|
+
helperText: errors.propertyType?.message,
|
|
387
|
+
variant,
|
|
388
|
+
defaultValue: "Select option",
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
|
|
391
|
+
/* @__PURE__ */ jsx("option", { value: "1", children: "Single Family Home" }),
|
|
392
|
+
/* @__PURE__ */ jsx("option", { value: "3", children: "Condo" }),
|
|
393
|
+
/* @__PURE__ */ jsx("option", { value: "5", children: "Hi-Rise Condo" }),
|
|
394
|
+
/* @__PURE__ */ jsx("option", { value: "2", children: "Co-op" }),
|
|
395
|
+
/* @__PURE__ */ jsx("option", { value: "4", children: "2-4 Unit" }),
|
|
396
|
+
/* @__PURE__ */ jsx("option", { value: "6", children: "Manufactured" })
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
) }),
|
|
400
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
401
|
+
Dropdown,
|
|
402
|
+
{
|
|
403
|
+
id: "occupancy",
|
|
404
|
+
...register("occupancy", {
|
|
405
|
+
required: true,
|
|
406
|
+
setValueAs: (value) => Number(value)
|
|
407
|
+
}),
|
|
408
|
+
label: "Property Usage",
|
|
409
|
+
sizes: "medium",
|
|
410
|
+
required: true,
|
|
411
|
+
error: !!errors.occupancy,
|
|
412
|
+
helperText: errors.occupancy?.message,
|
|
413
|
+
variant,
|
|
414
|
+
defaultValue: "Select option",
|
|
415
|
+
children: [
|
|
416
|
+
/* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
|
|
417
|
+
/* @__PURE__ */ jsx("option", { value: "1", children: "Primary Residence" }),
|
|
418
|
+
/* @__PURE__ */ jsx("option", { value: "2", children: "Vacation Home" }),
|
|
419
|
+
/* @__PURE__ */ jsx("option", { value: "3", children: "Investment" })
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
) }),
|
|
423
|
+
loanPurpose === 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
424
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
425
|
+
Input,
|
|
426
|
+
{
|
|
427
|
+
id: "salesPrice",
|
|
428
|
+
type: "text",
|
|
429
|
+
...register("salesPrice", {
|
|
430
|
+
required: true,
|
|
431
|
+
setValueAs: (value) => parseCurrency(value)
|
|
432
|
+
}),
|
|
433
|
+
label: "Purchase Price",
|
|
434
|
+
sizes: "medium",
|
|
435
|
+
required: true,
|
|
436
|
+
error: !!errors.salesPrice,
|
|
437
|
+
helperText: errors.salesPrice?.message,
|
|
438
|
+
variant,
|
|
439
|
+
onBlur: (e) => {
|
|
440
|
+
setIsTypingDownPayment(false);
|
|
441
|
+
const rawValue = e.target.value;
|
|
442
|
+
const parsedValue = parseCurrency(rawValue);
|
|
443
|
+
if (parsedValue === 0) {
|
|
444
|
+
methods.setError("salesPrice", {
|
|
445
|
+
type: "manual",
|
|
446
|
+
message: "Purchase Price is required."
|
|
447
|
+
});
|
|
448
|
+
} else {
|
|
449
|
+
methods.setValue("salesPrice", parsedValue);
|
|
450
|
+
e.target.value = formatCurrency(parsedValue);
|
|
451
|
+
}
|
|
452
|
+
methods.trigger("downPayment");
|
|
453
|
+
},
|
|
454
|
+
onFocus: (e) => {
|
|
455
|
+
const currentValue = e.target.value;
|
|
456
|
+
e.target.value = currentValue.replace(/[$,]/g, "");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
) }),
|
|
460
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
461
|
+
DownPaymentInput,
|
|
462
|
+
{
|
|
463
|
+
id: "downPayment",
|
|
464
|
+
type: "text",
|
|
465
|
+
...register("downPayment", {
|
|
466
|
+
required: true,
|
|
467
|
+
setValueAs: (value) => parseCurrency(value)
|
|
468
|
+
}),
|
|
469
|
+
salesPrice: watch("salesPrice"),
|
|
470
|
+
downPaymentPercentage,
|
|
471
|
+
setDownPaymentPercentage,
|
|
472
|
+
label: "Down Payment",
|
|
473
|
+
sizes: "medium",
|
|
474
|
+
error: !!errors.downPayment,
|
|
475
|
+
helperText: errors.downPayment?.message,
|
|
476
|
+
onChange: (e) => {
|
|
477
|
+
const value = parseCurrency(e.target.value);
|
|
478
|
+
methods.setValue("downPayment", value);
|
|
479
|
+
},
|
|
480
|
+
variant,
|
|
481
|
+
isTypingDownPayment,
|
|
482
|
+
setIsTypingDownPayment,
|
|
483
|
+
methods
|
|
484
|
+
}
|
|
485
|
+
) })
|
|
486
|
+
] }),
|
|
487
|
+
loanPurpose === 2 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
488
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
489
|
+
Input,
|
|
490
|
+
{
|
|
491
|
+
id: "appraisedValue",
|
|
492
|
+
type: "text",
|
|
493
|
+
...register("appraisedValue", {
|
|
494
|
+
required: true,
|
|
495
|
+
setValueAs: (value) => parseCurrency(value)
|
|
496
|
+
}),
|
|
497
|
+
label: "Home Value",
|
|
498
|
+
sizes: "medium",
|
|
499
|
+
required: true,
|
|
500
|
+
error: !!errors.appraisedValue,
|
|
501
|
+
helperText: errors.appraisedValue?.message,
|
|
502
|
+
variant,
|
|
503
|
+
onBlur: (e) => {
|
|
504
|
+
const rawValue = e.target.value;
|
|
505
|
+
const parsedValue = parseCurrency(rawValue);
|
|
506
|
+
methods.setValue("appraisedValue", parsedValue);
|
|
507
|
+
e.target.value = formatCurrency(parsedValue);
|
|
508
|
+
},
|
|
509
|
+
onFocus: (e) => {
|
|
510
|
+
const currentValue = e.target.value;
|
|
511
|
+
e.target.value = currentValue.replace(/[$,]/g, "");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
) }),
|
|
515
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
516
|
+
Input,
|
|
517
|
+
{
|
|
518
|
+
id: "mortgageBalance",
|
|
519
|
+
type: "text",
|
|
520
|
+
...register("mortgageBalance", {
|
|
521
|
+
required: true,
|
|
522
|
+
setValueAs: (value) => parseCurrency(value)
|
|
523
|
+
}),
|
|
524
|
+
label: "Mortgage Balance",
|
|
525
|
+
sizes: "medium",
|
|
526
|
+
required: true,
|
|
527
|
+
error: !!errors.mortgageBalance,
|
|
528
|
+
helperText: errors.mortgageBalance?.message,
|
|
529
|
+
variant,
|
|
530
|
+
onBlur: (e) => {
|
|
531
|
+
const rawValue = e.target.value;
|
|
532
|
+
const parsedValue = parseCurrency(rawValue);
|
|
533
|
+
methods.setValue("mortgageBalance", parsedValue);
|
|
534
|
+
e.target.value = formatCurrency(parsedValue);
|
|
535
|
+
},
|
|
536
|
+
onFocus: (e) => {
|
|
537
|
+
const currentValue = e.target.value;
|
|
538
|
+
e.target.value = currentValue.replace(/[$,]/g, "");
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
) })
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
544
|
+
Dropdown,
|
|
545
|
+
{
|
|
546
|
+
id: "creditScore",
|
|
547
|
+
...register("creditScore", {
|
|
548
|
+
required: true,
|
|
549
|
+
setValueAs: (value) => value === "" ? void 0 : Number(value)
|
|
550
|
+
}),
|
|
551
|
+
label: "Credit Score",
|
|
552
|
+
sizes: "medium",
|
|
553
|
+
required: true,
|
|
554
|
+
error: !!errors.creditScore,
|
|
555
|
+
helperText: errors.creditScore?.message,
|
|
556
|
+
variant,
|
|
557
|
+
defaultValue: "Select option",
|
|
558
|
+
children: [
|
|
559
|
+
/* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
|
|
560
|
+
/* @__PURE__ */ jsx("option", { value: "740", children: "740+" }),
|
|
561
|
+
/* @__PURE__ */ jsx("option", { value: "720", children: "739-720" }),
|
|
562
|
+
/* @__PURE__ */ jsx("option", { value: "700", children: "719-700" }),
|
|
563
|
+
/* @__PURE__ */ jsx("option", { value: "680", children: "699-680" }),
|
|
564
|
+
/* @__PURE__ */ jsx("option", { value: "660", children: "679-660" }),
|
|
565
|
+
/* @__PURE__ */ jsx("option", { value: "640", children: "659-640" }),
|
|
566
|
+
/* @__PURE__ */ jsx("option", { value: "620", children: "639-620" }),
|
|
567
|
+
/* @__PURE__ */ jsx("option", { value: "600", children: "Below 620" })
|
|
568
|
+
]
|
|
569
|
+
}
|
|
570
|
+
) }),
|
|
571
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
572
|
+
Input,
|
|
573
|
+
{
|
|
574
|
+
id: "zipCode",
|
|
575
|
+
type: "number",
|
|
576
|
+
...register("zipCode", {
|
|
577
|
+
required: true,
|
|
578
|
+
setValueAs: (value) => Number(value)
|
|
579
|
+
}),
|
|
580
|
+
label: "Zip Code",
|
|
581
|
+
sizes: "medium",
|
|
582
|
+
required: true,
|
|
583
|
+
error: !!errors.zipCode,
|
|
584
|
+
helperText: errors.zipCode?.message,
|
|
585
|
+
variant
|
|
586
|
+
}
|
|
587
|
+
) }),
|
|
588
|
+
loanPurpose === 2 ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: fullRowForm, children: /* @__PURE__ */ jsx(
|
|
589
|
+
Input,
|
|
590
|
+
{
|
|
591
|
+
id: "cashOut",
|
|
592
|
+
type: "text",
|
|
593
|
+
...register("cashOut", {
|
|
594
|
+
required: true,
|
|
595
|
+
setValueAs: (value) => parseCurrency(value)
|
|
596
|
+
}),
|
|
597
|
+
label: "Cash Out (Optional)",
|
|
598
|
+
sizes: "medium",
|
|
599
|
+
error: !!errors.cashOut,
|
|
600
|
+
helperText: errors.cashOut?.message,
|
|
601
|
+
variant,
|
|
602
|
+
onBlur: (e) => {
|
|
603
|
+
const rawValue = e.target.value;
|
|
604
|
+
const parsedValue = parseCurrency(rawValue);
|
|
605
|
+
methods.setValue("cashOut", parsedValue);
|
|
606
|
+
e.target.value = formatCurrency(parsedValue);
|
|
607
|
+
},
|
|
608
|
+
onFocus: (e) => {
|
|
609
|
+
const currentValue = e.target.value;
|
|
610
|
+
e.target.value = currentValue.replace(/[$,]/g, "");
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
) }) }) : null,
|
|
614
|
+
/* @__PURE__ */ jsx("div", { className: clsx(fullRowForm, "text_center"), children: /* @__PURE__ */ jsx(
|
|
615
|
+
"div",
|
|
616
|
+
{
|
|
617
|
+
className: clsx(
|
|
618
|
+
descriptionField({ variant }),
|
|
619
|
+
"text_center"
|
|
620
|
+
),
|
|
621
|
+
children: "Almost there! Please provide your contact information to view rates and sign up for Rate Watch."
|
|
622
|
+
}
|
|
623
|
+
) }),
|
|
624
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
625
|
+
Input,
|
|
626
|
+
{
|
|
627
|
+
id: "firstName",
|
|
628
|
+
...register("firstName", {
|
|
629
|
+
required: "First Name is required"
|
|
630
|
+
}),
|
|
631
|
+
label: "First Name",
|
|
632
|
+
sizes: "medium",
|
|
633
|
+
required: true,
|
|
634
|
+
error: !!errors.firstName,
|
|
635
|
+
helperText: errors.firstName?.message,
|
|
636
|
+
variant
|
|
637
|
+
}
|
|
638
|
+
) }),
|
|
639
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
640
|
+
Input,
|
|
641
|
+
{
|
|
642
|
+
id: "lastName",
|
|
643
|
+
...register("lastName", { required: true }),
|
|
644
|
+
label: "Last Name",
|
|
645
|
+
sizes: "medium",
|
|
646
|
+
required: true,
|
|
647
|
+
error: !!errors.lastName,
|
|
648
|
+
helperText: errors.lastName?.message,
|
|
649
|
+
variant
|
|
650
|
+
}
|
|
651
|
+
) }),
|
|
652
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
653
|
+
Input,
|
|
654
|
+
{
|
|
655
|
+
id: "email",
|
|
656
|
+
...register("email", {
|
|
657
|
+
required: true,
|
|
658
|
+
validate: {
|
|
659
|
+
isValid: associatedEmail
|
|
660
|
+
}
|
|
661
|
+
}),
|
|
662
|
+
label: "Email",
|
|
663
|
+
sizes: "medium",
|
|
664
|
+
required: true,
|
|
665
|
+
error: !!errors.email,
|
|
666
|
+
helperText: errors.email?.message,
|
|
667
|
+
variant
|
|
668
|
+
}
|
|
669
|
+
) }),
|
|
670
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
671
|
+
InputPhone,
|
|
672
|
+
{
|
|
673
|
+
id: "phone",
|
|
674
|
+
...register("phone", { required: true, maxLength: 12 }),
|
|
675
|
+
label: "Phone Number",
|
|
676
|
+
sizes: "medium",
|
|
677
|
+
required: true,
|
|
678
|
+
error: !!errors.phone,
|
|
679
|
+
helperText: errors.phone?.message,
|
|
680
|
+
variant
|
|
681
|
+
}
|
|
682
|
+
) })
|
|
683
|
+
] }),
|
|
684
|
+
children,
|
|
685
|
+
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
686
|
+
/* @__PURE__ */ jsx("div", { className: actions, children: isSubmitting ? /* @__PURE__ */ jsx(
|
|
687
|
+
LoadingIndicator,
|
|
688
|
+
{
|
|
689
|
+
style: { marginInline: "auto" },
|
|
690
|
+
variant
|
|
691
|
+
}
|
|
692
|
+
) : /* @__PURE__ */ jsxs("div", { className: formBtns, children: [
|
|
693
|
+
/* @__PURE__ */ jsx(
|
|
694
|
+
"button",
|
|
695
|
+
{
|
|
696
|
+
type: "submit",
|
|
697
|
+
disabled: !isValid,
|
|
698
|
+
className: button({
|
|
699
|
+
color: "secondary",
|
|
700
|
+
size: "large",
|
|
701
|
+
rounded: "medium",
|
|
702
|
+
disabled: !isValid
|
|
703
|
+
}),
|
|
704
|
+
children: "Get My Rate"
|
|
705
|
+
}
|
|
706
|
+
),
|
|
707
|
+
/* @__PURE__ */ jsxs("span", { className: `sc__btn ${chevron_wrapper}`, children: [
|
|
708
|
+
/* @__PURE__ */ jsx(
|
|
709
|
+
"a",
|
|
710
|
+
{
|
|
711
|
+
id,
|
|
712
|
+
className: `${chevron({ variant })} ${!isValid ? na_cursor : ""}`,
|
|
713
|
+
onClick: isValid ? handleSubmit(async (data) => {
|
|
714
|
+
await onSubmit(data);
|
|
715
|
+
toggleModal();
|
|
716
|
+
}) : (e) => {
|
|
717
|
+
e.preventDefault();
|
|
718
|
+
},
|
|
719
|
+
children: "Sign Up For Ratewatch"
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
/* @__PURE__ */ jsx(SvgArrowIcon, { className: "arrow", variant: "tertiary" })
|
|
723
|
+
] })
|
|
724
|
+
] }) })
|
|
725
|
+
] })
|
|
726
|
+
] }) }),
|
|
727
|
+
isModalOpen && rateWatchModal
|
|
728
|
+
]
|
|
729
|
+
},
|
|
730
|
+
id
|
|
731
|
+
);
|
|
732
|
+
};
|
|
733
|
+
export {
|
|
734
|
+
MortgageRate
|
|
735
|
+
};
|