@axos-web-dev/shared-components 1.0.99-feature-brand.5 → 1.0.99-feature-brand.7
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/Calculators/BuyDownCalculator/index.d.ts +1 -0
- package/dist/Calculators/BuyDownCalculator/index.js +162 -76
- package/dist/Forms/ContactUsLVF.d.ts +5 -1
- package/dist/Forms/ContactUsLVF.js +8 -6
- package/dist/Forms/FormEnums.js +2 -14
- package/dist/Forms/SalesforceFieldsForm.d.ts +5 -0
- package/dist/Forms/SalesforceFieldsForm.js +11 -1
- package/dist/Input/Dropdown.js +1 -0
- package/dist/assets/ImageBillboard/ImageBillboard.css +3 -3
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4
4
|
import { Button } from "../../Button/Button.js";
|
|
5
5
|
import "../../Button/Button.css.js";
|
|
6
|
-
import { useState } from "react";
|
|
6
|
+
import { useState, useEffect } from "react";
|
|
7
7
|
import "react-use";
|
|
8
8
|
import { Program, Fico, BuydownRate, BuydownTerm, LoanRates } from "../../Forms/FormEnums.js";
|
|
9
9
|
import { Checkbox } from "../../Input/Checkbox.js";
|
|
@@ -39,7 +39,6 @@ const BuyDownCalculator = ({
|
|
|
39
39
|
const [finalNoteRate, setFinalNoteRate] = useState("");
|
|
40
40
|
const [manuContributionPercentage, setManuContributionPercentage] = useState("");
|
|
41
41
|
const [buydownPayment, setBuydownPayment] = useState("");
|
|
42
|
-
const [manuContributionAmount, setManuContributionAmount] = useState("");
|
|
43
42
|
const [nonBuydownPayment, setNonBuydownPayment] = useState("");
|
|
44
43
|
const [totalBuydownCost, setTotalBuydownCost] = useState("");
|
|
45
44
|
const [monthlySavings, setMonthlySavings] = useState("");
|
|
@@ -47,6 +46,11 @@ const BuyDownCalculator = ({
|
|
|
47
46
|
const [enableFullTimeCharter, setEnableFullTimeCharter] = useState(false);
|
|
48
47
|
const [disableMooringOutside, setDisableMooringOutside] = useState(false);
|
|
49
48
|
const [disableLTVAbove60, setDisableLTVAbove60] = useState(true);
|
|
49
|
+
const [isDealerContributionDisabled, setIsDealerContributionDisabled] = useState(false);
|
|
50
|
+
const [
|
|
51
|
+
isManufacturerContributionDisabled,
|
|
52
|
+
setIsManufacturerContributionDisabled
|
|
53
|
+
] = useState(false);
|
|
50
54
|
const schema = z.object({
|
|
51
55
|
purchasePrice: z.string().min(1, { message: "Loan amount is required." }).transform((val) => {
|
|
52
56
|
return formatToNumber(val);
|
|
@@ -54,8 +58,13 @@ const BuyDownCalculator = ({
|
|
|
54
58
|
downpayment: z.string().min(1, { message: "Down Payment is required." }).transform((val) => {
|
|
55
59
|
return formatToNumber(val);
|
|
56
60
|
}),
|
|
57
|
-
dealerContribution: z.string()
|
|
58
|
-
|
|
61
|
+
dealerContribution: z.union([z.string(), z.number()]).optional().transform((val) => {
|
|
62
|
+
if (typeof val === "number") return val;
|
|
63
|
+
return val ? formatToNumber(val) : 0;
|
|
64
|
+
}),
|
|
65
|
+
manufacturerContributionAmount: z.union([z.string(), z.number()]).optional().transform((val) => {
|
|
66
|
+
if (typeof val === "number") return val;
|
|
67
|
+
return val ? formatToNumber(val) : 0;
|
|
59
68
|
}),
|
|
60
69
|
program: z.string().min(1, { message: "Program is required." }),
|
|
61
70
|
fico: z.string().min(1, { message: "FICO is required." }),
|
|
@@ -66,7 +75,32 @@ const BuyDownCalculator = ({
|
|
|
66
75
|
return formatToNumber(val);
|
|
67
76
|
})
|
|
68
77
|
}).superRefine((values, ctx) => {
|
|
69
|
-
const {
|
|
78
|
+
const {
|
|
79
|
+
purchasePrice,
|
|
80
|
+
downpayment,
|
|
81
|
+
program,
|
|
82
|
+
buydownTerm,
|
|
83
|
+
dealerContribution,
|
|
84
|
+
manufacturerContributionAmount
|
|
85
|
+
} = values;
|
|
86
|
+
if (dealerContribution > 0 && manufacturerContributionAmount > 0) {
|
|
87
|
+
ctx.addIssue({
|
|
88
|
+
code: z.ZodIssueCode.custom,
|
|
89
|
+
path: ["dealerContribution"],
|
|
90
|
+
message: "Cannot specify both Dealer Contribution and Manufacturer Contribution Amount. Please choose one."
|
|
91
|
+
});
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: z.ZodIssueCode.custom,
|
|
94
|
+
path: ["manufacturerContributionAmount"],
|
|
95
|
+
message: "Cannot specify both Dealer Contribution and Manufacturer Contribution Amount. Please choose one."
|
|
96
|
+
});
|
|
97
|
+
} else if (dealerContribution === 0 && manufacturerContributionAmount === 0) {
|
|
98
|
+
ctx.addIssue({
|
|
99
|
+
code: z.ZodIssueCode.custom,
|
|
100
|
+
path: ["dealerContribution"],
|
|
101
|
+
message: "Either Dealer Contribution or Manufacturer Contribution Amount is required."
|
|
102
|
+
});
|
|
103
|
+
}
|
|
70
104
|
if (program === "3/6 SOFR ARM" && (buydownTerm === 4 || buydownTerm === 5)) {
|
|
71
105
|
ctx.addIssue({
|
|
72
106
|
code: z.ZodIssueCode.custom,
|
|
@@ -114,8 +148,23 @@ const BuyDownCalculator = ({
|
|
|
114
148
|
handleSubmit,
|
|
115
149
|
register,
|
|
116
150
|
setValue,
|
|
151
|
+
watch,
|
|
152
|
+
trigger,
|
|
117
153
|
formState: { errors, isValid }
|
|
118
154
|
} = methods;
|
|
155
|
+
const watchedFields = watch(["purchasePrice", "downpayment", "program"]);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
const [purchasePrice, downpayment, program] = watchedFields;
|
|
158
|
+
if (purchasePrice && downpayment && program) {
|
|
159
|
+
const purchasePriceNum = typeof purchasePrice === "string" ? formatToNumber(purchasePrice) : purchasePrice;
|
|
160
|
+
const downpaymentNum = typeof downpayment === "string" ? formatToNumber(downpayment) : downpayment;
|
|
161
|
+
if (purchasePriceNum > 0 && downpaymentNum >= 0 && purchasePriceNum > downpaymentNum) {
|
|
162
|
+
const financedAmount2 = purchasePriceNum - downpaymentNum;
|
|
163
|
+
const loanRange2 = getRange(financedAmount2, program);
|
|
164
|
+
setLoanRange(loanRange2);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, [watchedFields]);
|
|
119
168
|
const calculator_variant = getVariant(variant);
|
|
120
169
|
const enableDependentInputs = enableFullTimeCharter;
|
|
121
170
|
const formatToNumber = (value) => {
|
|
@@ -224,6 +273,32 @@ const BuyDownCalculator = ({
|
|
|
224
273
|
setDisableMooringOutside(true);
|
|
225
274
|
}
|
|
226
275
|
};
|
|
276
|
+
const handleDealerContributionChange = (event) => {
|
|
277
|
+
const value = event.target.value;
|
|
278
|
+
const numericValue = formatToNumber(value);
|
|
279
|
+
if (numericValue > 0) {
|
|
280
|
+
setIsManufacturerContributionDisabled(true);
|
|
281
|
+
setValue("manufacturerContributionAmount", 0);
|
|
282
|
+
} else {
|
|
283
|
+
setIsManufacturerContributionDisabled(false);
|
|
284
|
+
}
|
|
285
|
+
setTimeout(() => {
|
|
286
|
+
trigger(["dealerContribution", "manufacturerContributionAmount"]);
|
|
287
|
+
}, 0);
|
|
288
|
+
};
|
|
289
|
+
const handleManufacturerContributionChange = (event) => {
|
|
290
|
+
const value = event.target.value;
|
|
291
|
+
const numericValue = formatToNumber(value);
|
|
292
|
+
if (numericValue > 0) {
|
|
293
|
+
setIsDealerContributionDisabled(true);
|
|
294
|
+
setValue("dealerContribution", 0);
|
|
295
|
+
} else {
|
|
296
|
+
setIsDealerContributionDisabled(false);
|
|
297
|
+
}
|
|
298
|
+
setTimeout(() => {
|
|
299
|
+
trigger(["dealerContribution", "manufacturerContributionAmount"]);
|
|
300
|
+
}, 0);
|
|
301
|
+
};
|
|
227
302
|
const updateFicoRequirements = (loanRangeValue, program) => {
|
|
228
303
|
const ficoOptionsToDisable = ["700-719", "720-759"];
|
|
229
304
|
const ficoSelect = document.getElementById("fico");
|
|
@@ -383,17 +458,17 @@ const BuyDownCalculator = ({
|
|
|
383
458
|
setTotalBuydownCost(formatToCurrency(TBC));
|
|
384
459
|
return TBC;
|
|
385
460
|
};
|
|
386
|
-
const calculateManufacturerContribution = (dealerContribution) => {
|
|
387
|
-
|
|
461
|
+
const calculateManufacturerContribution = (dealerContribution, manufacturerContributionAmount, totalBuydownCost2) => {
|
|
462
|
+
let manufacturerContribution;
|
|
463
|
+
if (manufacturerContributionAmount > 0) {
|
|
464
|
+
manufacturerContribution = manufacturerContributionAmount / totalBuydownCost2 * 100;
|
|
465
|
+
} else {
|
|
466
|
+
manufacturerContribution = 100 - dealerContribution;
|
|
467
|
+
}
|
|
388
468
|
const percentage = formatToPercentage(manufacturerContribution);
|
|
389
469
|
setManuContributionPercentage(percentage);
|
|
390
470
|
return manufacturerContribution;
|
|
391
471
|
};
|
|
392
|
-
const calculateManufacturerAmount = (totalBuydownCost2, manufacturerContribution) => {
|
|
393
|
-
const manufacturerAmount = totalBuydownCost2 * (manufacturerContribution / 100);
|
|
394
|
-
const formattedAmount = formatToCurrency(manufacturerAmount);
|
|
395
|
-
setManuContributionAmount(formattedAmount);
|
|
396
|
-
};
|
|
397
472
|
const calculateDealerContributionAmount = (dealerContribution, totalBuydownCost2) => {
|
|
398
473
|
const dealerContributionValue = totalBuydownCost2 * (dealerContribution / 100);
|
|
399
474
|
const formattedAmount = formatToCurrency(dealerContributionValue);
|
|
@@ -405,6 +480,7 @@ const BuyDownCalculator = ({
|
|
|
405
480
|
buydownRate,
|
|
406
481
|
buydownTerm,
|
|
407
482
|
dealerContribution,
|
|
483
|
+
manufacturerContributionAmount,
|
|
408
484
|
downpayment,
|
|
409
485
|
fico,
|
|
410
486
|
program,
|
|
@@ -436,8 +512,11 @@ const BuyDownCalculator = ({
|
|
|
436
512
|
financedAmountValue,
|
|
437
513
|
buydownTerm
|
|
438
514
|
);
|
|
439
|
-
|
|
440
|
-
|
|
515
|
+
calculateManufacturerContribution(
|
|
516
|
+
dealerContribution,
|
|
517
|
+
manufacturerContributionAmount,
|
|
518
|
+
totalBuydownCost2
|
|
519
|
+
);
|
|
441
520
|
calculateDealerContributionAmount(dealerContribution, totalBuydownCost2);
|
|
442
521
|
}
|
|
443
522
|
};
|
|
@@ -495,16 +574,40 @@ const BuyDownCalculator = ({
|
|
|
495
574
|
PercentageInput,
|
|
496
575
|
{
|
|
497
576
|
id: "dealerContribution",
|
|
498
|
-
...register("dealerContribution", {
|
|
577
|
+
...register("dealerContribution", {
|
|
578
|
+
required: false,
|
|
579
|
+
onChange: handleDealerContributionChange
|
|
580
|
+
}),
|
|
499
581
|
sizes: "medium",
|
|
500
582
|
placeholder: "0.00%",
|
|
501
583
|
label: "Dealer Contribution",
|
|
502
|
-
required:
|
|
584
|
+
required: false,
|
|
503
585
|
error: !!errors["dealerContribution"],
|
|
504
586
|
helperText: errors["dealerContribution"]?.message,
|
|
505
|
-
variant: calculator_variant
|
|
587
|
+
variant: calculator_variant,
|
|
588
|
+
disabled: isDealerContributionDisabled
|
|
506
589
|
}
|
|
507
590
|
) }),
|
|
591
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
592
|
+
CurrencyInput,
|
|
593
|
+
{
|
|
594
|
+
id: "manufacturerContributionAmount",
|
|
595
|
+
...register("manufacturerContributionAmount", {
|
|
596
|
+
required: false,
|
|
597
|
+
onChange: handleManufacturerContributionChange
|
|
598
|
+
}),
|
|
599
|
+
sizes: "medium",
|
|
600
|
+
placeholder: "$0.00",
|
|
601
|
+
label: "Manufacturer Contribution Amount",
|
|
602
|
+
required: false,
|
|
603
|
+
error: !!errors["manufacturerContributionAmount"],
|
|
604
|
+
helperText: errors["manufacturerContributionAmount"]?.message,
|
|
605
|
+
variant: calculator_variant,
|
|
606
|
+
disabled: isManufacturerContributionDisabled
|
|
607
|
+
}
|
|
608
|
+
) })
|
|
609
|
+
] }),
|
|
610
|
+
/* @__PURE__ */ jsxs("div", { className: `${row_form}`, children: [
|
|
508
611
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
509
612
|
Dropdown,
|
|
510
613
|
{
|
|
@@ -526,9 +629,7 @@ const BuyDownCalculator = ({
|
|
|
526
629
|
Program.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.text }, item.value))
|
|
527
630
|
]
|
|
528
631
|
}
|
|
529
|
-
) })
|
|
530
|
-
] }),
|
|
531
|
-
/* @__PURE__ */ jsxs("div", { className: `${row_form}`, children: [
|
|
632
|
+
) }),
|
|
532
633
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
533
634
|
Dropdown,
|
|
534
635
|
{
|
|
@@ -546,7 +647,9 @@ const BuyDownCalculator = ({
|
|
|
546
647
|
Fico.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.text }, item.value))
|
|
547
648
|
]
|
|
548
649
|
}
|
|
549
|
-
) })
|
|
650
|
+
) })
|
|
651
|
+
] }),
|
|
652
|
+
/* @__PURE__ */ jsxs("div", { className: `${row_form}`, children: [
|
|
550
653
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
551
654
|
Input,
|
|
552
655
|
{
|
|
@@ -558,10 +661,8 @@ const BuyDownCalculator = ({
|
|
|
558
661
|
variant: calculator_variant,
|
|
559
662
|
value: loanRange
|
|
560
663
|
}
|
|
561
|
-
) })
|
|
562
|
-
|
|
563
|
-
/* @__PURE__ */ jsxs("div", { className: `${row_form}`, children: [
|
|
564
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
664
|
+
) }),
|
|
665
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
565
666
|
Dropdown,
|
|
566
667
|
{
|
|
567
668
|
id: "buydownRate",
|
|
@@ -574,35 +675,31 @@ const BuyDownCalculator = ({
|
|
|
574
675
|
error: !!errors.buydownRate,
|
|
575
676
|
helperText: errors.buydownRate?.message,
|
|
576
677
|
variant: calculator_variant,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
BuydownRate.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.text }, item.value))
|
|
581
|
-
]
|
|
582
|
-
}
|
|
583
|
-
) }),
|
|
584
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
585
|
-
Dropdown,
|
|
586
|
-
{
|
|
587
|
-
id: "buydownTerm",
|
|
588
|
-
...register("buydownTerm", {
|
|
589
|
-
required: true,
|
|
590
|
-
deps: ["program"]
|
|
591
|
-
}),
|
|
592
|
-
label: "Buydown Term (1-5 Years)",
|
|
593
|
-
sizes: "medium",
|
|
594
|
-
required: true,
|
|
595
|
-
error: !!errors.buydownTerm,
|
|
596
|
-
helperText: errors.buydownTerm?.message,
|
|
597
|
-
variant: calculator_variant,
|
|
598
|
-
defaultValue: 0,
|
|
599
|
-
children: [
|
|
600
|
-
/* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select Buydown Term" }),
|
|
601
|
-
BuydownTerm.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.text }, item.value))
|
|
602
|
-
]
|
|
678
|
+
disabled: true,
|
|
679
|
+
defaultValue: 3.74,
|
|
680
|
+
children: BuydownRate.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.text }, item.value))
|
|
603
681
|
}
|
|
604
682
|
) })
|
|
605
683
|
] }),
|
|
684
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
685
|
+
Dropdown,
|
|
686
|
+
{
|
|
687
|
+
id: "buydownTerm",
|
|
688
|
+
...register("buydownTerm", {
|
|
689
|
+
required: true,
|
|
690
|
+
deps: ["program"]
|
|
691
|
+
}),
|
|
692
|
+
label: "Buydown Term (1-5 Years)",
|
|
693
|
+
sizes: "medium",
|
|
694
|
+
required: true,
|
|
695
|
+
error: !!errors.buydownTerm,
|
|
696
|
+
helperText: errors.buydownTerm?.message,
|
|
697
|
+
variant: calculator_variant,
|
|
698
|
+
disabled: true,
|
|
699
|
+
defaultValue: 3,
|
|
700
|
+
children: BuydownTerm.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.text }, item.value))
|
|
701
|
+
}
|
|
702
|
+
) }) }),
|
|
606
703
|
/* @__PURE__ */ jsx("div", { className: `${row_form}`, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("label", { children: "Loan Level Rate Adjustments" }) }) }),
|
|
607
704
|
/* @__PURE__ */ jsxs("div", { className: `${row_form}`, children: [
|
|
608
705
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: row_form, children: /* @__PURE__ */ jsxs(
|
|
@@ -788,23 +885,23 @@ const BuyDownCalculator = ({
|
|
|
788
885
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
789
886
|
CurrencyInput,
|
|
790
887
|
{
|
|
791
|
-
id: "
|
|
888
|
+
id: "nonBuydownPayment",
|
|
792
889
|
sizes: "medium",
|
|
793
|
-
label: "
|
|
890
|
+
label: "Non-buydown Payment",
|
|
794
891
|
disabled: true,
|
|
795
892
|
variant: calculator_variant,
|
|
796
|
-
value:
|
|
893
|
+
value: nonBuydownPayment
|
|
797
894
|
}
|
|
798
895
|
) }),
|
|
799
896
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
800
897
|
CurrencyInput,
|
|
801
898
|
{
|
|
802
|
-
id: "
|
|
899
|
+
id: "totalBuydownCost",
|
|
803
900
|
sizes: "medium",
|
|
804
|
-
label: "
|
|
901
|
+
label: "Total Buydown Cost",
|
|
805
902
|
disabled: true,
|
|
806
903
|
variant: calculator_variant,
|
|
807
|
-
value:
|
|
904
|
+
value: totalBuydownCost
|
|
808
905
|
}
|
|
809
906
|
) })
|
|
810
907
|
] }),
|
|
@@ -812,38 +909,27 @@ const BuyDownCalculator = ({
|
|
|
812
909
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
813
910
|
CurrencyInput,
|
|
814
911
|
{
|
|
815
|
-
id: "
|
|
912
|
+
id: "monthlySavings",
|
|
816
913
|
sizes: "medium",
|
|
817
|
-
label: "
|
|
914
|
+
label: "Monthly Savings",
|
|
818
915
|
disabled: true,
|
|
819
916
|
variant: calculator_variant,
|
|
820
|
-
value:
|
|
917
|
+
value: monthlySavings
|
|
821
918
|
}
|
|
822
919
|
) }),
|
|
823
920
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
824
921
|
CurrencyInput,
|
|
825
922
|
{
|
|
826
|
-
id: "
|
|
923
|
+
id: "dealerContributionAmount",
|
|
827
924
|
sizes: "medium",
|
|
828
|
-
label: "
|
|
925
|
+
label: "Dealer Contribution Amount",
|
|
829
926
|
disabled: true,
|
|
830
927
|
variant: calculator_variant,
|
|
831
|
-
value:
|
|
928
|
+
value: dealerContributionAmount,
|
|
929
|
+
helperText: "Dealer reserve offset not included in this amount."
|
|
832
930
|
}
|
|
833
931
|
) })
|
|
834
|
-
] })
|
|
835
|
-
/* @__PURE__ */ jsx("div", { className: `${row_form}`, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
836
|
-
CurrencyInput,
|
|
837
|
-
{
|
|
838
|
-
id: "dealerContributionAmount",
|
|
839
|
-
sizes: "medium",
|
|
840
|
-
label: "Dealer Contribution Amount",
|
|
841
|
-
disabled: true,
|
|
842
|
-
variant: calculator_variant,
|
|
843
|
-
value: dealerContributionAmount,
|
|
844
|
-
helperText: "Dealer reserve offset not included in this amount."
|
|
845
|
-
}
|
|
846
|
-
) }) })
|
|
932
|
+
] })
|
|
847
933
|
]
|
|
848
934
|
}
|
|
849
935
|
) }),
|
|
@@ -8,6 +8,10 @@ export type ContactUsLaVictoireInputs = {
|
|
|
8
8
|
message: string;
|
|
9
9
|
checkbox: boolean;
|
|
10
10
|
};
|
|
11
|
-
export declare const ContactUsLVF: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, onValidate, id, dealerCheckbox, }: FormProps & {
|
|
11
|
+
export declare const ContactUsLVF: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, onValidate, id, dealerCheckbox, contextData, }: FormProps & {
|
|
12
12
|
dealerCheckbox?: boolean;
|
|
13
|
+
contextData?: {
|
|
14
|
+
pageName?: string;
|
|
15
|
+
pageUri?: string;
|
|
16
|
+
};
|
|
13
17
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -33,6 +33,7 @@ import { useForm, FormProvider } from "react-hook-form";
|
|
|
33
33
|
import * as z from "zod";
|
|
34
34
|
import { iconForm, headerContainer, headerForm, form, descriptionField, fullRowForm, formWrapper, disclosureForm, actions, formContainer } from "./Forms.css.js";
|
|
35
35
|
import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
|
|
36
|
+
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
36
37
|
const ContactUsLVF = ({
|
|
37
38
|
icon = false,
|
|
38
39
|
children,
|
|
@@ -47,7 +48,8 @@ const ContactUsLVF = ({
|
|
|
47
48
|
validateEmail,
|
|
48
49
|
onValidate,
|
|
49
50
|
id,
|
|
50
|
-
dealerCheckbox = true
|
|
51
|
+
dealerCheckbox = true,
|
|
52
|
+
contextData
|
|
51
53
|
}) => {
|
|
52
54
|
const schema = z.object({
|
|
53
55
|
firstname: z.string().regex(/^[a-zA-Z]*(?:[a-zA-Z][a-zA-Z'-]*\s{0,1}){2,}$/g, {
|
|
@@ -78,7 +80,7 @@ const ContactUsLVF = ({
|
|
|
78
80
|
message: z.string().min(1, { message: "Please complete this required field." }),
|
|
79
81
|
checkbox: z.boolean()
|
|
80
82
|
});
|
|
81
|
-
const gen_schema = schema.merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
83
|
+
const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
82
84
|
if (!isValidHoneyPot(data)) {
|
|
83
85
|
ctx.addIssue({
|
|
84
86
|
code: z.ZodIssueCode.custom,
|
|
@@ -106,9 +108,9 @@ const ContactUsLVF = ({
|
|
|
106
108
|
return { name: key, value: data[key] };
|
|
107
109
|
}
|
|
108
110
|
}).filter((el) => el !== void 0);
|
|
109
|
-
const
|
|
110
|
-
pageName: "La Victoire Finance",
|
|
111
|
-
pageUri: "https://lavictoirefinance.com/contact-us"
|
|
111
|
+
const finalContextData = {
|
|
112
|
+
pageName: contextData?.pageName || "La Victoire Finance",
|
|
113
|
+
pageUri: contextData?.pageUri || "https://lavictoirefinance.com/contact-us"
|
|
112
114
|
};
|
|
113
115
|
const legalConsentData = {
|
|
114
116
|
consent: {
|
|
@@ -125,7 +127,7 @@ const ContactUsLVF = ({
|
|
|
125
127
|
};
|
|
126
128
|
await onSubmit({
|
|
127
129
|
fields: formattedFieldsData,
|
|
128
|
-
context:
|
|
130
|
+
context: finalContextData,
|
|
129
131
|
legalConsentOptions: legalConsentData,
|
|
130
132
|
form: "contactUSLVF"
|
|
131
133
|
});
|
package/dist/Forms/FormEnums.js
CHANGED
|
@@ -177,20 +177,8 @@ const Fico = [
|
|
|
177
177
|
{ value: "720-759", text: "720-759" },
|
|
178
178
|
{ value: "700-719", text: "700-719" }
|
|
179
179
|
];
|
|
180
|
-
const BuydownRate = [
|
|
181
|
-
|
|
182
|
-
{ value: 3.99, text: "3.99%" },
|
|
183
|
-
{ value: 4.99, text: "4.99%" },
|
|
184
|
-
{ value: 5.99, text: "5.99%" },
|
|
185
|
-
{ value: 6.99, text: "6.99%" }
|
|
186
|
-
];
|
|
187
|
-
const BuydownTerm = [
|
|
188
|
-
{ value: 1, text: "1 Year" },
|
|
189
|
-
{ value: 2, text: "2 Years" },
|
|
190
|
-
{ value: 3, text: "3 Years" },
|
|
191
|
-
{ value: 4, text: "4 Years" },
|
|
192
|
-
{ value: 5, text: "5 Years" }
|
|
193
|
-
];
|
|
180
|
+
const BuydownRate = [{ value: 3.74, text: "3.74%" }];
|
|
181
|
+
const BuydownTerm = [{ value: 3, text: "3 Years" }];
|
|
194
182
|
const LoanRates = /* @__PURE__ */ new Map([
|
|
195
183
|
[
|
|
196
184
|
"3/6 SOFR ARM",
|
|
@@ -13,6 +13,7 @@ export interface SalesforceFields {
|
|
|
13
13
|
experience_id: string;
|
|
14
14
|
hem: string;
|
|
15
15
|
identity: string;
|
|
16
|
+
leadPriority: string;
|
|
16
17
|
}
|
|
17
18
|
export interface SalesforceInputs {
|
|
18
19
|
Brand_SFDC2__c: string;
|
|
@@ -46,6 +47,7 @@ export interface SalesforceInputs {
|
|
|
46
47
|
experience_id: string;
|
|
47
48
|
hem: string;
|
|
48
49
|
identity: string;
|
|
50
|
+
LeadPriority__c: string;
|
|
49
51
|
}
|
|
50
52
|
export declare const SalesforceSchema: z.ZodObject<{
|
|
51
53
|
Brand_SFDC2__c: z.ZodOptional<z.ZodString>;
|
|
@@ -71,6 +73,7 @@ export declare const SalesforceSchema: z.ZodObject<{
|
|
|
71
73
|
First_UTMIdentity__c: z.ZodOptional<z.ZodString>;
|
|
72
74
|
First_UTMExperience_Id__c: z.ZodOptional<z.ZodString>;
|
|
73
75
|
Full_Web_Source__c: z.ZodOptional<z.ZodString>;
|
|
76
|
+
LeadPriority__c: z.ZodOptional<z.ZodString>;
|
|
74
77
|
}, "strip", z.ZodTypeAny, {
|
|
75
78
|
Brand_SFDC2__c?: string | undefined;
|
|
76
79
|
Branch_SFDC2__c?: string | undefined;
|
|
@@ -95,6 +98,7 @@ export declare const SalesforceSchema: z.ZodObject<{
|
|
|
95
98
|
First_UTMIdentity__c?: string | undefined;
|
|
96
99
|
First_UTMExperience_Id__c?: string | undefined;
|
|
97
100
|
Full_Web_Source__c?: string | undefined;
|
|
101
|
+
LeadPriority__c?: string | undefined;
|
|
98
102
|
}, {
|
|
99
103
|
Brand_SFDC2__c?: string | undefined;
|
|
100
104
|
Branch_SFDC2__c?: string | undefined;
|
|
@@ -119,6 +123,7 @@ export declare const SalesforceSchema: z.ZodObject<{
|
|
|
119
123
|
First_UTMIdentity__c?: string | undefined;
|
|
120
124
|
First_UTMExperience_Id__c?: string | undefined;
|
|
121
125
|
Full_Web_Source__c?: string | undefined;
|
|
126
|
+
LeadPriority__c?: string | undefined;
|
|
122
127
|
}>;
|
|
123
128
|
export interface QueryParams {
|
|
124
129
|
[str: string]: string;
|
|
@@ -33,7 +33,8 @@ const SalesforceSchema = z.object({
|
|
|
33
33
|
First_UTMHem__c: z.string().optional(),
|
|
34
34
|
First_UTMIdentity__c: z.string().optional(),
|
|
35
35
|
First_UTMExperience_Id__c: z.string().optional(),
|
|
36
|
-
Full_Web_Source__c: z.string().optional()
|
|
36
|
+
Full_Web_Source__c: z.string().optional(),
|
|
37
|
+
LeadPriority__c: z.string().optional()
|
|
37
38
|
});
|
|
38
39
|
const SalesforceFieldsForm = memo(function SaleforceFieldForm({
|
|
39
40
|
salesforceFields,
|
|
@@ -87,6 +88,15 @@ const SalesforceFieldsForm = memo(function SaleforceFieldForm({
|
|
|
87
88
|
})
|
|
88
89
|
}
|
|
89
90
|
),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
"input",
|
|
93
|
+
{
|
|
94
|
+
type: "hidden",
|
|
95
|
+
...register("LeadPriority__c", {
|
|
96
|
+
value: salesforceFields?.leadPriority
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
),
|
|
90
100
|
/* @__PURE__ */ jsx("input", { type: "hidden", ...register("lead_source", { value: "Web RMI" }) }),
|
|
91
101
|
/* @__PURE__ */ jsx(
|
|
92
102
|
"input",
|
package/dist/Input/Dropdown.js
CHANGED
|
@@ -343,15 +343,15 @@ main > div:nth-last-child(2) > ._1m7m2a0:not(._1m7m2ax) {
|
|
|
343
343
|
._1m7m2a0 {
|
|
344
344
|
flex-direction: column;
|
|
345
345
|
}
|
|
346
|
+
._1m7m2a0.reversed {
|
|
347
|
+
flex-direction: column-reverse;
|
|
348
|
+
}
|
|
346
349
|
._18ygy9m5 ._1m7m2a6:only-child {
|
|
347
350
|
flex-direction: column;
|
|
348
351
|
}
|
|
349
352
|
._18ygy9m5 ._1m7m2a7:only-child {
|
|
350
353
|
flex-direction: column-reverse;
|
|
351
354
|
}
|
|
352
|
-
.reversed {
|
|
353
|
-
flex-direction: column-reverse;
|
|
354
|
-
}
|
|
355
355
|
._1m7m2ai > * {
|
|
356
356
|
max-width: 100%;
|
|
357
357
|
}
|
package/package.json
CHANGED