@axos-web-dev/shared-components 1.0.77-patch.50 → 1.0.77-patch.51

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.
Files changed (60) hide show
  1. package/dist/ATMLocator/ATMLocator.js +1 -1
  2. package/dist/Auth/SignInPassword.js +2 -2
  3. package/dist/Blockquote/Blockquote.module.js +3 -3
  4. package/dist/BulletItem/BulletItem.js +1 -0
  5. package/dist/Calculators/AnnualFeeCalculator/index.js +1 -1
  6. package/dist/Calculators/BuyDownCalculator/index.js +1 -1
  7. package/dist/Calculators/Calculator.js +1 -1
  8. package/dist/Calculators/MarineLoanMonthlyPaymentCalculator/index.js +1 -1
  9. package/dist/Calculators/MaxLoanCalculator/index.js +1 -1
  10. package/dist/Calculators/MonthlyPaymentCalculator/index.js +1 -1
  11. package/dist/Forms/ApplicationStart.js +1 -1
  12. package/dist/Forms/ApplyNow.js +1 -1
  13. package/dist/Forms/ClearingForm.js +1 -1
  14. package/dist/Forms/CommercialDeposits.js +1 -1
  15. package/dist/Forms/CommercialDepositsNoLendingOption.js +1 -1
  16. package/dist/Forms/CommercialLending.js +1 -1
  17. package/dist/Forms/CommercialPremiumFinance.js +1 -1
  18. package/dist/Forms/ContactCompany.js +1 -1
  19. package/dist/Forms/ContactCompanyTitle.js +1 -1
  20. package/dist/Forms/ContactUs.js +1 -1
  21. package/dist/Forms/ContactUsAAS.js +1 -1
  22. package/dist/Forms/ContactUsBusiness.js +1 -1
  23. package/dist/Forms/ContactUsBusinessNameEmail.js +1 -1
  24. package/dist/Forms/ContactUsLVF.js +1 -1
  25. package/dist/Forms/ContactUsNMLSId.js +1 -1
  26. package/dist/Forms/CpraRequest.js +1 -1
  27. package/dist/Forms/CraPublicFile.js +1 -1
  28. package/dist/Forms/DealerServices.js +1 -1
  29. package/dist/Forms/EmailOnly.js +1 -1
  30. package/dist/Forms/EmailUs.js +1 -1
  31. package/dist/Forms/HoneyPot/index.js +2 -1
  32. package/dist/Forms/MortgageRate/MortgageRateForm.d.ts +1 -1
  33. package/dist/Forms/MortgageRate/MortgageRateForm.js +393 -352
  34. package/dist/Forms/MortgageRate/MortgageRateQuoteFilters.js +11 -5
  35. package/dist/Forms/MortgageWarehouseLending.js +1 -1
  36. package/dist/Forms/QuickPricer/QuickPricerForm.js +1 -1
  37. package/dist/Forms/ScheduleCall.js +1 -1
  38. package/dist/Forms/ScheduleCallPremier.js +1 -1
  39. package/dist/Forms/SuccesForm.js +1 -1
  40. package/dist/Forms/VendorQuestionnaire.js +1 -1
  41. package/dist/Forms/index.js +1 -0
  42. package/dist/ImageLink/ImageLink.js +1 -1
  43. package/dist/LoadingIndicator/index.js +1 -0
  44. package/dist/Modal/contextApi/store.js +1 -1
  45. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +0 -1
  46. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +0 -3
  47. package/dist/NavigationMenu/AxosBank/SubNavBar.js +0 -21
  48. package/dist/SetContainer/SetContainer.js +1 -1
  49. package/dist/Tab/Tab.js +1 -0
  50. package/dist/assets/Blockquote/Blockquote.css.css +68 -68
  51. package/dist/main.js +8 -1
  52. package/dist/utils/emailValidation.d.ts +1 -0
  53. package/dist/utils/emailValidation.js +31 -0
  54. package/dist/utils/index.d.ts +4 -1
  55. package/dist/utils/index.js +9 -1
  56. package/dist/utils/nmlsValidation.d.ts +1 -0
  57. package/dist/utils/nmlsValidation.js +34 -0
  58. package/dist/utils/useCachedValidators.d.ts +2 -0
  59. package/dist/utils/useCachedValidators.js +22 -0
  60. package/package.json +1 -1
@@ -12,8 +12,10 @@ import '../../assets/VideoWrapper/VideoWrapper.css';import '../../assets/Topical
12
12
  /* empty css */
13
13
  /* empty css */
14
14
  import "../../utils/allowedAxosDomains.js";
15
+ import * as z from "zod";
15
16
  import { associatedEmail } from "../../utils/EverestValidity.js";
16
17
  import { getVariant } from "../../utils/getVariant.js";
18
+ import { useCachedEmailValidator } from "../../utils/useCachedValidators.js";
17
19
  import clsx from "clsx";
18
20
  /* empty css */
19
21
  /* empty css */
@@ -43,10 +45,9 @@ import { DownPaymentInput } from "../../Input/DownPaymentInput.js";
43
45
  import "../../Input/RadioButton.js";
44
46
  import "../../Input/PercentageInput.js";
45
47
  import { useForm, FormProvider } from "react-hook-form";
46
- import * as z from "zod";
47
48
  import "../../Calculators/BuyDownCalculator/BuyDownCalculator.css.js";
48
49
  import { iconForm, headerForm, form, descriptionField, headerContainer, fullRowSelect, formWrapper, centerSelect, mt2rem, fullRowForm, disclosureForm, actions, formBtns, na_cursor, formContainer } from "../Forms.css.js";
49
- import "../HoneyPot/index.js";
50
+ import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "../HoneyPot/index.js";
50
51
  import { SalesforceSchema } from "../SalesforceFieldsForm.js";
51
52
  import "../../Input/RadioButton.css.js";
52
53
  import "../../Input/Checkbox.css.js";
@@ -147,7 +148,8 @@ const MortgageRate = ({
147
148
  rateWatchOnSubmit,
148
149
  setRateWatchSubmitted,
149
150
  hideModalValue,
150
- showingTables
151
+ showingTables,
152
+ onValidate
151
153
  }) => {
152
154
  const [loanPurpose, setLoanPurpose] = useState(1);
153
155
  const [rateType, setRateType] = useState("Purchase");
@@ -158,6 +160,7 @@ const MortgageRate = ({
158
160
  const [_downPayment, setDownPayment] = useState(0);
159
161
  const [isTypingDownPayment, setIsTypingDownPayment] = useState(false);
160
162
  const [salesPriceVal, setSalesPriceVal] = useState(0);
163
+ const cachedEmailValidator = useCachedEmailValidator(validateEmail);
161
164
  const schema = z.object({
162
165
  firstName: z.string({ message: "First Name is required." }).regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
163
166
  message: "First Name is required."
@@ -165,7 +168,7 @@ const MortgageRate = ({
165
168
  lastName: z.string({ message: "Last Name is required." }).regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
166
169
  message: "Last Name is required."
167
170
  }).trim().min(1, { message: "Last Name is required." }),
168
- email: z.string().email({ message: "Email is required." }).refine(async (val) => await validateEmail(val)),
171
+ email: z.string().email({ message: "Email is required." }).refine(cachedEmailValidator, { message: "Invalid email address." }),
169
172
  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) => {
170
173
  const removeDashes = val.replace(/-/gi, "");
171
174
  if (removeDashes.length !== 10) {
@@ -204,7 +207,7 @@ const MortgageRate = ({
204
207
  }
205
208
  ),
206
209
  creditScore: z.number({ message: "Credit Score is required." }).positive({ message: "Credit Score is required." }),
207
- zipCode: z.number({ message: "Zip Code is required." }).positive({ message: "Zip Code is required." }),
210
+ zipCode: z.string().trim().min(1, { message: "Zip Code is required." }).regex(/^\d{5}$/, { message: "ZIP code must be 5 digits." }),
208
211
  appraisedValue: z.number({ message: "Home Price is required." }).optional().refine(
209
212
  (val) => {
210
213
  if (loanPurpose === 2 && val == null) {
@@ -212,7 +215,7 @@ const MortgageRate = ({
212
215
  }
213
216
  return true;
214
217
  },
215
- { message: "Appraised Value is required for refinance" }
218
+ { message: "Appraised Value is required for refinance." }
216
219
  ),
217
220
  mortgageBalance: z.number({ message: "Mortgage Balance is required." }).optional().refine(
218
221
  (val) => {
@@ -221,30 +224,50 @@ const MortgageRate = ({
221
224
  }
222
225
  return true;
223
226
  },
224
- { message: "Mortgage Balance is required for refinance" }
227
+ { message: "Mortgage Balance is required for refinance." }
225
228
  ),
226
229
  cashOut: z.number({ message: "Cash Out is required." }).optional(),
227
230
  loanPurpose: z.number({ message: "Loan Purpose is required." })
228
231
  });
232
+ const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
233
+ if (!isValidHoneyPot(data)) {
234
+ ctx.addIssue({
235
+ code: z.ZodIssueCode.custom,
236
+ message: "fields are not valid."
237
+ });
238
+ }
239
+ });
229
240
  const methods = useForm({
230
- resolver: zodResolver(schema.merge(SalesforceSchema), {
241
+ resolver: zodResolver(gen_schema, {
231
242
  async: true
232
243
  }),
233
244
  mode: "all",
234
245
  defaultValues: {
235
- loanPurpose: 1
246
+ loanPurpose: 1,
247
+ AlternativeEmail: "bestbank@axos.com",
248
+ AlternativePhone: ""
236
249
  }
237
250
  });
251
+ const setHoneypotDefaults = () => {
252
+ const { AlternativeEmail, AlternativePhone } = methods.getValues();
253
+ methods.setValue(
254
+ "AlternativeEmail",
255
+ AlternativeEmail || "bestbank@axos.com"
256
+ );
257
+ methods.setValue("AlternativePhone", AlternativePhone || "");
258
+ };
238
259
  useEffect(() => {
239
260
  if (loanPurpose === 1) {
240
261
  methods.reset();
241
262
  methods.setValue("appraisedValue", 0);
242
263
  methods.setValue("mortgageBalance", 0);
264
+ setHoneypotDefaults();
243
265
  } else if (loanPurpose === 2) {
244
266
  methods.reset();
245
267
  methods.setValue("loanPurpose", 2);
246
268
  methods.setValue("salesPrice", 0);
247
269
  methods.setValue("downPayment", 0);
270
+ setHoneypotDefaults();
248
271
  }
249
272
  }, [loanPurpose, methods]);
250
273
  useEffect(() => {
@@ -417,361 +440,379 @@ const MortgageRate = ({
417
440
  children: "Tell us about your property and loan to personalize your rate."
418
441
  }
419
442
  ) }),
420
- /* @__PURE__ */ jsxs("form", { className: form, onSubmit: handleSubmit(submitForm), children: [
421
- /* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
422
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
423
- Dropdown,
424
- {
425
- id: "propertyType",
426
- ...register("propertyType", {
427
- required: true,
428
- setValueAs: (value) => Number(value)
429
- }),
430
- label: "Property Type",
431
- sizes: "medium",
432
- required: true,
433
- error: !!errors.propertyType,
434
- helperText: errors.propertyType?.message,
435
- variant,
436
- defaultValue: "Select option",
437
- children: [
438
- /* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
439
- /* @__PURE__ */ jsx("option", { value: "1", children: "Single Family Home" }),
440
- /* @__PURE__ */ jsx("option", { value: "3", children: "Condo" }),
441
- /* @__PURE__ */ jsx("option", { value: "5", children: "Hi-Rise Condo" }),
442
- /* @__PURE__ */ jsx("option", { value: "2", children: "Co-op" }),
443
- /* @__PURE__ */ jsx("option", { value: "4", children: "2-4 Unit" }),
444
- /* @__PURE__ */ jsx("option", { value: "6", children: "Manufactured" })
445
- ]
446
- }
447
- ) }),
448
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
449
- Dropdown,
450
- {
451
- id: "occupancy",
452
- ...register("occupancy", {
453
- required: true,
454
- setValueAs: (value) => Number(value)
455
- }),
456
- label: "Property Usage",
457
- sizes: "medium",
458
- required: true,
459
- error: !!errors.occupancy,
460
- helperText: errors.occupancy?.message,
461
- variant,
462
- defaultValue: "Select option",
463
- children: [
464
- /* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
465
- /* @__PURE__ */ jsx("option", { value: "1", children: "Primary Residence" }),
466
- /* @__PURE__ */ jsx("option", { value: "2", children: "Vacation Home" }),
467
- /* @__PURE__ */ jsx("option", { value: "3", children: "Investment" })
468
- ]
469
- }
470
- ) }),
471
- loanPurpose === 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
472
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
473
- Input,
474
- {
475
- id: "salesPrice",
476
- type: "text",
477
- ...register("salesPrice", {
443
+ /* @__PURE__ */ jsxs(
444
+ "form",
445
+ {
446
+ className: form,
447
+ onSubmit: async (e) => {
448
+ onValidate && onValidate(e);
449
+ await handleSubmit(submitForm)(e);
450
+ e.preventDefault();
451
+ },
452
+ children: [
453
+ /* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
454
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
455
+ Dropdown,
456
+ {
457
+ id: "propertyType",
458
+ ...register("propertyType", {
459
+ required: true,
460
+ setValueAs: (value) => Number(value)
461
+ }),
462
+ label: "Property Type",
463
+ sizes: "medium",
478
464
  required: true,
479
- setValueAs: (value) => parseCurrency(value)
480
- }),
481
- label: "Purchase Price",
482
- sizes: "medium",
483
- required: true,
484
- error: !!errors.salesPrice,
485
- helperText: errors.salesPrice?.message,
486
- variant,
487
- onBlur: (e) => {
488
- setIsTypingDownPayment(false);
489
- const rawValue = e.target.value;
490
- const parsedValue = parseCurrency(rawValue);
491
- if (parsedValue === 0) {
492
- methods.setError("salesPrice", {
493
- type: "manual",
494
- message: "Purchase Price is required."
495
- });
496
- } else {
497
- methods.setValue("salesPrice", parsedValue);
465
+ error: !!errors.propertyType,
466
+ helperText: errors.propertyType?.message,
467
+ variant,
468
+ defaultValue: "Select option",
469
+ children: [
470
+ /* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
471
+ /* @__PURE__ */ jsx("option", { value: "1", children: "Single Family Home" }),
472
+ /* @__PURE__ */ jsx("option", { value: "3", children: "Condo" }),
473
+ /* @__PURE__ */ jsx("option", { value: "5", children: "Hi-Rise Condo" }),
474
+ /* @__PURE__ */ jsx("option", { value: "2", children: "Co-op" }),
475
+ /* @__PURE__ */ jsx("option", { value: "4", children: "2-4 Unit" }),
476
+ /* @__PURE__ */ jsx("option", { value: "6", children: "Manufactured" })
477
+ ]
478
+ }
479
+ ) }),
480
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
481
+ Dropdown,
482
+ {
483
+ id: "occupancy",
484
+ ...register("occupancy", {
485
+ required: true,
486
+ setValueAs: (value) => Number(value)
487
+ }),
488
+ label: "Property Usage",
489
+ sizes: "medium",
490
+ required: true,
491
+ error: !!errors.occupancy,
492
+ helperText: errors.occupancy?.message,
493
+ variant,
494
+ defaultValue: "Select option",
495
+ children: [
496
+ /* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
497
+ /* @__PURE__ */ jsx("option", { value: "1", children: "Primary Residence" }),
498
+ /* @__PURE__ */ jsx("option", { value: "2", children: "Vacation Home" }),
499
+ /* @__PURE__ */ jsx("option", { value: "3", children: "Investment" })
500
+ ]
501
+ }
502
+ ) }),
503
+ loanPurpose === 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
504
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
505
+ Input,
506
+ {
507
+ id: "salesPrice",
508
+ type: "text",
509
+ ...register("salesPrice", {
510
+ required: true,
511
+ setValueAs: (value) => parseCurrency(value)
512
+ }),
513
+ label: "Purchase Price",
514
+ sizes: "medium",
515
+ required: true,
516
+ error: !!errors.salesPrice,
517
+ helperText: errors.salesPrice?.message,
518
+ variant,
519
+ onBlur: (e) => {
520
+ setIsTypingDownPayment(false);
521
+ const rawValue = e.target.value;
522
+ const parsedValue = parseCurrency(rawValue);
523
+ if (parsedValue === 0) {
524
+ methods.setError("salesPrice", {
525
+ type: "manual",
526
+ message: "Purchase Price is required."
527
+ });
528
+ } else {
529
+ methods.setValue("salesPrice", parsedValue);
530
+ e.target.value = formatCurrency(parsedValue);
531
+ }
532
+ methods.trigger("downPayment");
533
+ },
534
+ onFocus: (e) => {
535
+ const currentValue = e.target.value;
536
+ e.target.value = currentValue.replace(/[$,]/g, "");
537
+ }
538
+ }
539
+ ) }),
540
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
541
+ DownPaymentInput,
542
+ {
543
+ id: "downPayment",
544
+ type: "text",
545
+ ...register("downPayment", {
546
+ required: true,
547
+ setValueAs: (value) => parseCurrency(value)
548
+ }),
549
+ salesPrice: watch("salesPrice"),
550
+ downPaymentPercentage,
551
+ setDownPaymentPercentage,
552
+ label: "Down Payment",
553
+ sizes: "medium",
554
+ error: !!errors.downPayment,
555
+ helperText: errors.downPayment?.message,
556
+ onChange: (e) => {
557
+ const value = parseCurrency(e.target.value);
558
+ methods.setValue("downPayment", value);
559
+ },
560
+ variant,
561
+ isTypingDownPayment,
562
+ setIsTypingDownPayment,
563
+ methods
564
+ }
565
+ ) })
566
+ ] }),
567
+ loanPurpose === 2 && /* @__PURE__ */ jsxs(Fragment, { children: [
568
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
569
+ Input,
570
+ {
571
+ id: "appraisedValue",
572
+ type: "text",
573
+ ...register("appraisedValue", {
574
+ required: true,
575
+ setValueAs: (value) => parseCurrency(value)
576
+ }),
577
+ label: "Home Value",
578
+ sizes: "medium",
579
+ required: true,
580
+ error: !!errors.appraisedValue,
581
+ helperText: errors.appraisedValue?.message,
582
+ variant,
583
+ onBlur: (e) => {
584
+ const rawValue = e.target.value;
585
+ const parsedValue = parseCurrency(rawValue);
586
+ methods.setValue("appraisedValue", parsedValue);
587
+ e.target.value = formatCurrency(parsedValue);
588
+ },
589
+ onFocus: (e) => {
590
+ const currentValue = e.target.value;
591
+ e.target.value = currentValue.replace(/[$,]/g, "");
592
+ }
593
+ }
594
+ ) }),
595
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
596
+ Input,
597
+ {
598
+ id: "mortgageBalance",
599
+ type: "text",
600
+ ...register("mortgageBalance", {
601
+ required: true,
602
+ setValueAs: (value) => parseCurrency(value)
603
+ }),
604
+ label: "Mortgage Balance",
605
+ sizes: "medium",
606
+ required: true,
607
+ error: !!errors.mortgageBalance,
608
+ helperText: errors.mortgageBalance?.message,
609
+ variant,
610
+ onBlur: (e) => {
611
+ const rawValue = e.target.value;
612
+ const parsedValue = parseCurrency(rawValue);
613
+ methods.setValue("mortgageBalance", parsedValue);
614
+ e.target.value = formatCurrency(parsedValue);
615
+ },
616
+ onFocus: (e) => {
617
+ const currentValue = e.target.value;
618
+ e.target.value = currentValue.replace(/[$,]/g, "");
619
+ }
620
+ }
621
+ ) })
622
+ ] }),
623
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
624
+ Dropdown,
625
+ {
626
+ id: "creditScore",
627
+ ...register("creditScore", {
628
+ required: true,
629
+ setValueAs: (value) => value === "" ? void 0 : Number(value)
630
+ }),
631
+ label: "Credit Score",
632
+ sizes: "medium",
633
+ required: true,
634
+ error: !!errors.creditScore,
635
+ helperText: errors.creditScore?.message,
636
+ variant,
637
+ defaultValue: "Select option",
638
+ children: [
639
+ /* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
640
+ /* @__PURE__ */ jsx("option", { value: "740", children: "740+" }),
641
+ /* @__PURE__ */ jsx("option", { value: "720", children: "739-720" }),
642
+ /* @__PURE__ */ jsx("option", { value: "700", children: "719-700" }),
643
+ /* @__PURE__ */ jsx("option", { value: "680", children: "699-680" }),
644
+ /* @__PURE__ */ jsx("option", { value: "660", children: "679-660" }),
645
+ /* @__PURE__ */ jsx("option", { value: "640", children: "659-640" }),
646
+ /* @__PURE__ */ jsx("option", { value: "620", children: "639-620" }),
647
+ /* @__PURE__ */ jsx("option", { value: "600", children: "Below 620" })
648
+ ]
649
+ }
650
+ ) }),
651
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
652
+ Input,
653
+ {
654
+ id: "zipCode",
655
+ type: "text",
656
+ inputMode: "numeric",
657
+ ...register("zipCode", {
658
+ required: true,
659
+ pattern: /^\d{5}$/
660
+ }),
661
+ label: "Zip Code",
662
+ sizes: "medium",
663
+ required: true,
664
+ error: !!errors.zipCode,
665
+ helperText: errors.zipCode?.message,
666
+ variant,
667
+ maxLength: 5,
668
+ onInput: (e) => {
669
+ const target = e.target;
670
+ target.value = target.value.replace(/\D/g, "");
671
+ }
672
+ }
673
+ ) }),
674
+ loanPurpose === 2 ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: fullRowForm, children: /* @__PURE__ */ jsx(
675
+ Input,
676
+ {
677
+ id: "cashOut",
678
+ type: "text",
679
+ ...register("cashOut", {
680
+ required: true,
681
+ setValueAs: (value) => parseCurrency(value)
682
+ }),
683
+ label: "Cash Out (Optional)",
684
+ sizes: "medium",
685
+ error: !!errors.cashOut,
686
+ helperText: errors.cashOut?.message,
687
+ variant,
688
+ onBlur: (e) => {
689
+ const rawValue = e.target.value;
690
+ const parsedValue = parseCurrency(rawValue);
691
+ methods.setValue("cashOut", parsedValue);
498
692
  e.target.value = formatCurrency(parsedValue);
693
+ },
694
+ onFocus: (e) => {
695
+ const currentValue = e.target.value;
696
+ e.target.value = currentValue.replace(/[$,]/g, "");
499
697
  }
500
- methods.trigger("downPayment");
501
- },
502
- onFocus: (e) => {
503
- const currentValue = e.target.value;
504
- e.target.value = currentValue.replace(/[$,]/g, "");
505
698
  }
506
- }
507
- ) }),
508
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
509
- DownPaymentInput,
510
- {
511
- id: "downPayment",
512
- type: "text",
513
- ...register("downPayment", {
699
+ ) }) }) : null,
700
+ /* @__PURE__ */ jsx("div", { className: clsx(fullRowForm, "text_center"), children: /* @__PURE__ */ jsx(
701
+ "div",
702
+ {
703
+ className: clsx(
704
+ descriptionField({ variant }),
705
+ "text_center"
706
+ ),
707
+ children: "Almost there! Please provide your contact information to view rates and sign up for Rate Watch."
708
+ }
709
+ ) }),
710
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
711
+ Input,
712
+ {
713
+ id: "firstName",
714
+ ...register("firstName", {
715
+ required: "First Name is required"
716
+ }),
717
+ label: "First Name",
718
+ sizes: "medium",
514
719
  required: true,
515
- setValueAs: (value) => parseCurrency(value)
516
- }),
517
- salesPrice: watch("salesPrice"),
518
- downPaymentPercentage,
519
- setDownPaymentPercentage,
520
- label: "Down Payment",
521
- sizes: "medium",
522
- error: !!errors.downPayment,
523
- helperText: errors.downPayment?.message,
524
- onChange: (e) => {
525
- const value = parseCurrency(e.target.value);
526
- methods.setValue("downPayment", value);
527
- },
528
- variant,
529
- isTypingDownPayment,
530
- setIsTypingDownPayment,
531
- methods
532
- }
533
- ) })
534
- ] }),
535
- loanPurpose === 2 && /* @__PURE__ */ jsxs(Fragment, { children: [
536
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
537
- Input,
538
- {
539
- id: "appraisedValue",
540
- type: "text",
541
- ...register("appraisedValue", {
720
+ error: !!errors.firstName,
721
+ helperText: errors.firstName?.message,
722
+ variant
723
+ }
724
+ ) }),
725
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
726
+ Input,
727
+ {
728
+ id: "lastName",
729
+ ...register("lastName", { required: true }),
730
+ label: "Last Name",
731
+ sizes: "medium",
542
732
  required: true,
543
- setValueAs: (value) => parseCurrency(value)
544
- }),
545
- label: "Home Value",
546
- sizes: "medium",
547
- required: true,
548
- error: !!errors.appraisedValue,
549
- helperText: errors.appraisedValue?.message,
550
- variant,
551
- onBlur: (e) => {
552
- const rawValue = e.target.value;
553
- const parsedValue = parseCurrency(rawValue);
554
- methods.setValue("appraisedValue", parsedValue);
555
- e.target.value = formatCurrency(parsedValue);
556
- },
557
- onFocus: (e) => {
558
- const currentValue = e.target.value;
559
- e.target.value = currentValue.replace(/[$,]/g, "");
733
+ error: !!errors.lastName,
734
+ helperText: errors.lastName?.message,
735
+ variant
560
736
  }
561
- }
562
- ) }),
563
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
564
- Input,
565
- {
566
- id: "mortgageBalance",
567
- type: "text",
568
- ...register("mortgageBalance", {
737
+ ) }),
738
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
739
+ Input,
740
+ {
741
+ id: "email",
742
+ ...register("email", {
743
+ required: true,
744
+ validate: {
745
+ isValid: associatedEmail
746
+ }
747
+ }),
748
+ label: "Email",
749
+ sizes: "medium",
569
750
  required: true,
570
- setValueAs: (value) => parseCurrency(value)
571
- }),
572
- label: "Mortgage Balance",
573
- sizes: "medium",
574
- required: true,
575
- error: !!errors.mortgageBalance,
576
- helperText: errors.mortgageBalance?.message,
577
- variant,
578
- onBlur: (e) => {
579
- const rawValue = e.target.value;
580
- const parsedValue = parseCurrency(rawValue);
581
- methods.setValue("mortgageBalance", parsedValue);
582
- e.target.value = formatCurrency(parsedValue);
583
- },
584
- onFocus: (e) => {
585
- const currentValue = e.target.value;
586
- e.target.value = currentValue.replace(/[$,]/g, "");
751
+ error: !!errors.email,
752
+ helperText: errors.email?.message,
753
+ variant
587
754
  }
588
- }
589
- ) })
590
- ] }),
591
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
592
- Dropdown,
593
- {
594
- id: "creditScore",
595
- ...register("creditScore", {
596
- required: true,
597
- setValueAs: (value) => value === "" ? void 0 : Number(value)
598
- }),
599
- label: "Credit Score",
600
- sizes: "medium",
601
- required: true,
602
- error: !!errors.creditScore,
603
- helperText: errors.creditScore?.message,
604
- variant,
605
- defaultValue: "Select option",
606
- children: [
607
- /* @__PURE__ */ jsx("option", { disabled: true, value: "Select option", children: "Select Option" }),
608
- /* @__PURE__ */ jsx("option", { value: "740", children: "740+" }),
609
- /* @__PURE__ */ jsx("option", { value: "720", children: "739-720" }),
610
- /* @__PURE__ */ jsx("option", { value: "700", children: "719-700" }),
611
- /* @__PURE__ */ jsx("option", { value: "680", children: "699-680" }),
612
- /* @__PURE__ */ jsx("option", { value: "660", children: "679-660" }),
613
- /* @__PURE__ */ jsx("option", { value: "640", children: "659-640" }),
614
- /* @__PURE__ */ jsx("option", { value: "620", children: "639-620" }),
615
- /* @__PURE__ */ jsx("option", { value: "600", children: "Below 620" })
616
- ]
617
- }
618
- ) }),
619
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
620
- Input,
621
- {
622
- id: "zipCode",
623
- type: "number",
624
- ...register("zipCode", {
625
- required: true,
626
- setValueAs: (value) => Number(value)
627
- }),
628
- label: "Zip Code",
629
- sizes: "medium",
630
- required: true,
631
- error: !!errors.zipCode,
632
- helperText: errors.zipCode?.message,
633
- variant
634
- }
635
- ) }),
636
- loanPurpose === 2 ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: fullRowForm, children: /* @__PURE__ */ jsx(
637
- Input,
638
- {
639
- id: "cashOut",
640
- type: "text",
641
- ...register("cashOut", {
642
- required: true,
643
- setValueAs: (value) => parseCurrency(value)
644
- }),
645
- label: "Cash Out (Optional)",
646
- sizes: "medium",
647
- error: !!errors.cashOut,
648
- helperText: errors.cashOut?.message,
649
- variant,
650
- onBlur: (e) => {
651
- const rawValue = e.target.value;
652
- const parsedValue = parseCurrency(rawValue);
653
- methods.setValue("cashOut", parsedValue);
654
- e.target.value = formatCurrency(parsedValue);
655
- },
656
- onFocus: (e) => {
657
- const currentValue = e.target.value;
658
- e.target.value = currentValue.replace(/[$,]/g, "");
659
- }
660
- }
661
- ) }) }) : null,
662
- /* @__PURE__ */ jsx("div", { className: clsx(fullRowForm, "text_center"), children: /* @__PURE__ */ jsx(
663
- "div",
664
- {
665
- className: clsx(
666
- descriptionField({ variant }),
667
- "text_center"
668
- ),
669
- children: "Almost there! Please provide your contact information to view rates and sign up for Rate Watch."
670
- }
671
- ) }),
672
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
673
- Input,
674
- {
675
- id: "firstName",
676
- ...register("firstName", {
677
- required: "First Name is required"
678
- }),
679
- label: "First Name",
680
- sizes: "medium",
681
- required: true,
682
- error: !!errors.firstName,
683
- helperText: errors.firstName?.message,
684
- variant
685
- }
686
- ) }),
687
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
688
- Input,
689
- {
690
- id: "lastName",
691
- ...register("lastName", { required: true }),
692
- label: "Last Name",
693
- sizes: "medium",
694
- required: true,
695
- error: !!errors.lastName,
696
- helperText: errors.lastName?.message,
697
- variant
698
- }
699
- ) }),
700
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
701
- Input,
702
- {
703
- id: "email",
704
- ...register("email", {
705
- required: true,
706
- validate: {
707
- isValid: associatedEmail
755
+ ) }),
756
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
757
+ InputPhone,
758
+ {
759
+ id: "phone",
760
+ ...register("phone", { required: true, maxLength: 12 }),
761
+ label: "Phone Number",
762
+ sizes: "medium",
763
+ required: true,
764
+ error: !!errors.phone,
765
+ helperText: errors.phone?.message,
766
+ variant
708
767
  }
709
- }),
710
- label: "Email",
711
- sizes: "medium",
712
- required: true,
713
- error: !!errors.email,
714
- helperText: errors.email?.message,
715
- variant
716
- }
717
- ) }),
718
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
719
- InputPhone,
720
- {
721
- id: "phone",
722
- ...register("phone", { required: true, maxLength: 12 }),
723
- label: "Phone Number",
724
- sizes: "medium",
725
- required: true,
726
- error: !!errors.phone,
727
- helperText: errors.phone?.message,
728
- variant
729
- }
730
- ) })
731
- ] }),
732
- children,
733
- /* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
734
- /* @__PURE__ */ jsx("div", { className: actions, children: isSubmitting ? /* @__PURE__ */ jsx(
735
- LoadingIndicator,
736
- {
737
- style: { marginInline: "auto" },
738
- variant
739
- }
740
- ) : /* @__PURE__ */ jsxs("div", { className: formBtns, children: [
741
- /* @__PURE__ */ jsx(
742
- "button",
743
- {
744
- type: "submit",
745
- disabled: !isValid,
746
- className: button({
747
- color: "secondary",
748
- size: "large",
749
- rounded: "medium",
750
- disabled: !isValid
751
- }),
752
- children: "Get My Rate"
753
- }
754
- ),
755
- /* @__PURE__ */ jsxs("span", { className: `sc__btn ${chevron_wrapper}`, children: [
756
- /* @__PURE__ */ jsx(
757
- "a",
768
+ ) }),
769
+ /* @__PURE__ */ jsx(HoneyPot, { variant, register })
770
+ ] }),
771
+ children,
772
+ /* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
773
+ /* @__PURE__ */ jsx("div", { className: actions, children: isSubmitting ? /* @__PURE__ */ jsx(
774
+ LoadingIndicator,
758
775
  {
759
- id,
760
- className: `${chevron({ variant })} ${!isValid ? na_cursor : ""}`,
761
- onClick: isValid ? handleSubmit(async (data) => {
762
- await onSubmit(data);
763
- toggleModal();
764
- setHideModal(false);
765
- }) : (e) => {
766
- e.preventDefault();
767
- },
768
- children: "Sign Up For Ratewatch"
776
+ style: { marginInline: "auto" },
777
+ variant
769
778
  }
770
- ),
771
- /* @__PURE__ */ jsx(SvgArrowIcon, { className: "arrow", variant: "tertiary" })
772
- ] })
773
- ] }) })
774
- ] })
779
+ ) : /* @__PURE__ */ jsxs("div", { className: formBtns, children: [
780
+ /* @__PURE__ */ jsx(
781
+ "button",
782
+ {
783
+ type: "submit",
784
+ disabled: !isValid,
785
+ className: button({
786
+ color: "secondary",
787
+ size: "large",
788
+ rounded: "medium",
789
+ disabled: !isValid
790
+ }),
791
+ children: "Get My Rate"
792
+ }
793
+ ),
794
+ /* @__PURE__ */ jsxs("span", { className: `sc__btn ${chevron_wrapper}`, children: [
795
+ /* @__PURE__ */ jsx(
796
+ "a",
797
+ {
798
+ id,
799
+ className: `${chevron({ variant })} ${!isValid ? na_cursor : ""}`,
800
+ onClick: isValid ? handleSubmit(async (data) => {
801
+ await onSubmit(data);
802
+ toggleModal();
803
+ setHideModal(false);
804
+ }) : (e) => {
805
+ e.preventDefault();
806
+ },
807
+ children: "Sign Up For Ratewatch"
808
+ }
809
+ ),
810
+ /* @__PURE__ */ jsx(SvgArrowIcon, { className: "arrow", variant: "tertiary" })
811
+ ] })
812
+ ] }) })
813
+ ]
814
+ }
815
+ )
775
816
  ] }) })
776
817
  },
777
818
  id