@axos-web-dev/shared-components 1.0.8 → 1.0.9-9.dev.1
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 +42 -32
- package/dist/Accordion/Accordion.css.d.ts +1 -1
- package/dist/Article/Article.css.d.ts +41 -41
- package/dist/Article/Article.js +3 -13
- package/dist/ArticlesSet/ArticlesSet.css.d.ts +16 -16
- package/dist/Auth/ErrorAlert.css.d.ts +4 -0
- package/dist/Auth/ErrorAlert.css.js +11 -0
- package/dist/Auth/ErrorAlert.d.ts +14 -0
- package/dist/Auth/ErrorAlert.js +184 -0
- package/dist/Auth/Logout.d.ts +3 -0
- package/dist/Auth/Logout.js +29 -0
- package/dist/Auth/SignIn.css.d.ts +6 -0
- package/dist/Auth/SignIn.css.js +18 -0
- package/dist/Auth/SignInPassword.d.ts +15 -0
- package/dist/Auth/SignInPassword.js +118 -0
- package/dist/Auth/index.d.ts +5 -0
- package/dist/Auth/index.js +20 -0
- package/dist/Button/Button.css.d.ts +31 -18
- package/dist/Button/Button.css.js +1 -1
- package/dist/Button/Button.js +14 -4
- package/dist/Calculators/AnnualFeeCalculator/AnnualFeeCalculator.css.d.ts +12 -12
- package/dist/Calculators/ApyCalculator/ApyCalculator.css.d.ts +14 -14
- package/dist/Calculators/ApyCalculator/index.js +20 -12
- package/dist/Calculators/AxosOneCalculator/BalanceAPYCalculator.css.d.ts +8 -8
- package/dist/Calculators/AxosOneCalculator/index.js +18 -10
- package/dist/Calculators/BalanceAPYCalculator/BalanceAPYCalculator.css.d.ts +22 -22
- package/dist/Calculators/BuyDownCalculator/BuyDownCalculator.css.d.ts +101 -0
- package/dist/Calculators/BuyDownCalculator/BuyDownCalculator.css.js +56 -0
- package/dist/Calculators/BuyDownCalculator/index.d.ts +25 -0
- package/dist/Calculators/BuyDownCalculator/index.js +855 -0
- package/dist/Calculators/Calculator.js +29 -10
- package/dist/Calculators/MonthlyPaymentCalculator/MonthlyPaymentCalculator.css.d.ts +12 -12
- package/dist/Calculators/MonthlyPaymentLVFCalculator/MonthlyPaymentCalculator.css.d.ts +12 -12
- package/dist/Calculators/SummitApyCalculator/BalanceAPYCalculator.css.d.ts +8 -8
- package/dist/Calculators/calculator.css.d.ts +12 -12
- package/dist/Calculators/index.d.ts +1 -0
- package/dist/Calculators/index.js +2 -0
- package/dist/CallToActionBar/index.js +3 -1
- package/dist/Carousel/Carousel.css.d.ts +20 -20
- package/dist/Carousel/index.js +23 -13
- package/dist/Chevron/Chevron.css.d.ts +6 -6
- package/dist/Chevron/index.js +14 -4
- package/dist/Comparison/Comparison.css.d.ts +11 -10
- package/dist/Comparison/Comparison.css.js +3 -1
- package/dist/Comparison/Comparison.js +23 -13
- package/dist/Comparison/index.js +2 -1
- package/dist/ContentBanner/ContentBanner.css.d.ts +12 -12
- package/dist/ExecutiveBio/ExecutiveBio.css.d.ts +31 -31
- package/dist/ExecutiveBio/ExecutiveBio.js +16 -22
- package/dist/FaqAccordion/index.js +16 -6
- package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +14 -4
- package/dist/Forms/ApplicationStart.js +21 -4
- package/dist/Forms/ApplyNow.js +14 -4
- package/dist/Forms/ClearingForm.js +19 -2
- package/dist/Forms/CommercialDeposits.js +19 -2
- package/dist/Forms/CommercialLending.js +20 -3
- package/dist/Forms/CommercialPremiumFinance.d.ts +10 -0
- package/dist/Forms/CommercialPremiumFinance.js +212 -0
- package/dist/Forms/ContactCompany.js +20 -3
- package/dist/Forms/ContactCompanyTitle.js +20 -3
- package/dist/Forms/ContactUs.d.ts +1 -1
- package/dist/Forms/ContactUs.js +107 -79
- package/dist/Forms/ContactUsAAS.js +20 -5
- package/dist/Forms/ContactUsBusiness.d.ts +2 -2
- package/dist/Forms/ContactUsBusiness.js +45 -19
- package/dist/Forms/ContactUsBusinessNameEmail.d.ts +9 -0
- package/dist/Forms/ContactUsBusinessNameEmail.js +282 -0
- package/dist/Forms/ContactUsLVF.js +20 -3
- package/dist/Forms/ContactUsNMLSId.js +35 -9
- package/dist/Forms/CpraRequest.d.ts +1 -1
- package/dist/Forms/CpraRequest.js +75 -63
- package/dist/Forms/CraPublicFile.d.ts +5 -5
- package/dist/Forms/CraPublicFile.js +69 -45
- package/dist/Forms/DealerServices.js +20 -4
- package/dist/Forms/EmailOnly.js +45 -28
- package/dist/Forms/EmailUs.js +12 -2
- package/dist/Forms/FormEnums.d.ts +21 -0
- package/dist/Forms/FormEnums.js +308 -0
- package/dist/Forms/FormProps.d.ts +3 -0
- package/dist/Forms/Forms.css.d.ts +42 -42
- package/dist/Forms/HoneyPot/HoneyPot.css.d.ts +1 -0
- package/dist/Forms/HoneyPot/HoneyPot.css.js +5 -0
- package/dist/Forms/HoneyPot/index.d.ts +24 -0
- package/dist/Forms/HoneyPot/index.js +71 -0
- package/dist/Forms/MortgageRate/MortgageRateForm.js +17 -7
- package/dist/Forms/MortgageRate/MortgageRateWatch.js +16 -6
- package/dist/Forms/QuickPricer/QuickPricerForm.js +19 -20
- package/dist/Forms/ScheduleCall.js +20 -3
- package/dist/Forms/ScheduleCallPremier.js +20 -3
- package/dist/Forms/SuccesForm.js +31 -21
- package/dist/Forms/VendorQuestionnaire.js +12 -2
- package/dist/Forms/WcplSurvey.js +20 -3
- package/dist/Forms/index.d.ts +3 -0
- package/dist/Forms/index.js +8 -0
- package/dist/HelpArticle/HelpArticle.css.d.ts +4 -0
- package/dist/HelpArticle/HelpArticle.css.js +12 -0
- package/dist/HelpArticle/index.d.ts +1 -0
- package/dist/HelpArticle/index.js +7 -0
- package/dist/HeroBanner/HeroBanner.css.d.ts +19 -17
- package/dist/HeroBanner/HeroBanner.css.js +9 -5
- package/dist/HeroBanner/HeroBanner.d.ts +1 -1
- package/dist/HeroBanner/HeroBanner.interface.d.ts +3 -0
- package/dist/HeroBanner/HeroBanner.js +47 -1
- package/dist/HeroBanner/LargeBanner.css.d.ts +20 -20
- package/dist/HeroBanner/SelectionBanner.css.d.ts +8 -8
- package/dist/HeroBanner/index.js +3 -1
- package/dist/Hyperlink/index.js +17 -7
- package/dist/IconBillboard/IconBillboard.css.d.ts +26 -25
- package/dist/IconBillboard/IconBillboard.css.js +5 -3
- package/dist/IconBillboard/IconBillboard.d.ts +1 -2
- package/dist/IconBillboard/IconBillboard.interface.d.ts +1 -0
- package/dist/IconBillboard/IconBillboard.js +46 -80
- package/dist/IconBillboard/IconBillboardSet.js +1 -1
- package/dist/IconBillboard/index.js +3 -3
- package/dist/IconBillboard/sections/CallToActionSection.d.ts +12 -0
- package/dist/IconBillboard/sections/CallToActionSection.js +101 -0
- package/dist/IconBillboard/sections/HeaderSection.d.ts +11 -0
- package/dist/IconBillboard/sections/HeaderSection.js +23 -0
- package/dist/IconBillboard/sections/IconSection.d.ts +7 -0
- package/dist/IconBillboard/sections/IconSection.js +18 -0
- package/dist/IconBillboard/sections/ItemsSection.d.ts +11 -0
- package/dist/IconBillboard/sections/ItemsSection.js +11 -0
- package/dist/IconBillboard/sections/LayoutSection.d.ts +8 -0
- package/dist/IconBillboard/sections/LayoutSection.js +6 -0
- package/dist/ImageBillboard/ExitIntentModal/ModalWrapper.d.ts +9 -0
- package/dist/ImageBillboard/ExitIntentModal/ModalWrapper.js +85 -0
- package/dist/ImageBillboard/ExitIntentModal/useExitIntentModal.d.ts +5 -0
- package/dist/ImageBillboard/ExitIntentModal/useExitIntentModal.js +90 -0
- package/dist/ImageBillboard/ImageBillboard.css.d.ts +36 -20
- package/dist/ImageBillboard/ImageBillboard.css.js +50 -18
- package/dist/ImageBillboard/ImageBillboard.interface.d.ts +20 -2
- package/dist/ImageBillboard/ImageBillboardSet.d.ts +1 -1
- package/dist/ImageBillboard/ImageBillboardSet.js +104 -28
- package/dist/ImageBillboard/index.js +17 -1
- package/dist/ImageLink/ImageLink.d.ts +2 -2
- package/dist/ImageLink/ImageLink.js +17 -13
- package/dist/ImageLink/ImageLinkSet.js +20 -10
- package/dist/ImageLink/index.js +17 -7
- package/dist/Input/Checkbox.js +2 -1
- package/dist/Input/Input.css.d.ts +16 -16
- package/dist/Input/Input.js +4 -1
- package/dist/Input/PercentageInput.d.ts +3 -0
- package/dist/Input/PercentageInput.js +32 -0
- package/dist/Input/RadioButton.js +12 -3
- package/dist/Inputs/Input.css.d.ts +14 -14
- package/dist/Insight/Featured/CategorySelector.js +28 -20
- package/dist/Insight/Featured/Featured.js +75 -58
- package/dist/Insight/Featured/Header.js +22 -12
- package/dist/Interstitial/Interstitial-variants.css.d.ts +2 -2
- package/dist/LandingPageHeader/LandingPageHeader.css.d.ts +3 -3
- package/dist/Modal/Modal.js +15 -5
- package/dist/NavigationMenu/AxosALTS/NavData.js +14 -4
- package/dist/NavigationMenu/AxosALTS/index.js +14 -4
- package/dist/NavigationMenu/AxosAdvisor/SubNavBar.js +3 -10
- package/dist/NavigationMenu/AxosAdvisor/index.js +3 -11
- package/dist/NavigationMenu/AxosAdvisorServices/NavData.js +0 -5
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.d.ts +2 -0
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.js +345 -0
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +53 -0
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +272 -0
- package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +664 -0
- package/dist/NavigationMenu/AxosBank/NavBar.module.js +39 -81
- package/dist/NavigationMenu/AxosBank/NavData.js +14 -4
- package/dist/NavigationMenu/AxosBank/SubNavBar.js +432 -108
- package/dist/NavigationMenu/AxosBank/index.d.ts +2 -1
- package/dist/NavigationMenu/AxosBank/index.js +104 -533
- package/dist/NavigationMenu/LaVictoire/NavData.js +14 -4
- package/dist/NavigationMenu/LaVictoire/index.js +40 -20
- package/dist/NavigationMenu/NavDataJson.d.ts +2 -0
- package/dist/NavigationMenu/NavDataJson.js +309 -0
- package/dist/NavigationMenu/Navbar.d.ts +5 -0
- package/dist/NavigationMenu/Navbar.js +195 -0
- package/dist/NavigationMenu/SignInNavButton.d.ts +1 -0
- package/dist/NavigationMenu/SignInNavButton.js +363 -0
- package/dist/PageNavItem/PageNavItem.css.d.ts +2 -2
- package/dist/SetContainer/SetContainer.css.d.ts +17 -18
- package/dist/SetContainer/SetContainer.css.js +2 -4
- package/dist/SetContainer/SetContainer.d.ts +2 -1
- package/dist/SetContainer/SetContainer.js +27 -13
- package/dist/SetContainer/index.js +1 -2
- package/dist/SocialMediaBar/iconsRepository.js +14 -4
- package/dist/StepItem/StepItem.css.d.ts +18 -18
- package/dist/StepItemSet/StepItemSet.css.d.ts +14 -14
- package/dist/StepItemSet/StepItemSet.js +2 -6
- package/dist/Tab/Tab.css.d.ts +12 -12
- package/dist/Table/Table.css.d.ts +25 -25
- package/dist/Table/Table.d.ts +3 -3
- package/dist/Topic/Topic.css.d.ts +4 -0
- package/dist/Topic/Topic.css.js +12 -0
- package/dist/Topic/Topic.d.ts +19 -0
- package/dist/Topic/Topic.js +24 -0
- package/dist/Topic/index.d.ts +2 -0
- package/dist/Topic/index.js +12 -0
- package/dist/VideoTile/VideoTile.interface.d.ts +4 -3
- package/dist/VideoTile/VideoTile.js +183 -28
- package/dist/VideoWrapper/index.js +15 -5
- package/dist/WalnutIframe/index.d.ts +6 -0
- package/dist/WalnutIframe/index.js +21 -0
- package/dist/WalnutIframe/wrapper.module.js +14 -0
- package/dist/assets/Auth/ErrorAlert.css +37 -0
- package/dist/assets/Auth/SignIn.css +86 -0
- package/dist/assets/Button/Button.css +31 -16
- package/dist/assets/Calculators/AxosOneCalculator/BalanceAPYCalculator.css +5 -0
- package/dist/assets/Calculators/BuyDownCalculator/BuyDownCalculator.css +197 -0
- package/dist/assets/Calculators/SummitApyCalculator/BalanceAPYCalculator.css +8 -0
- package/dist/assets/CallToActionBar/CallToActionBar.css +4 -0
- package/dist/assets/Comparison/Comparison.css +9 -2
- package/dist/assets/Forms/HoneyPot/HoneyPot.css +4 -0
- package/dist/assets/HelpArticle/HelpArticle.css +70 -0
- package/dist/assets/HeroBanner/HeroBanner.css +38 -26
- package/dist/assets/HeroBanner/LargeBanner.css +3 -0
- package/dist/assets/IconBillboard/IconBillboard.css +43 -36
- package/dist/assets/ImageBillboard/ImageBillboard.css +336 -36
- package/dist/assets/Insight/Insight.css +12 -0
- package/dist/assets/NavigationMenu/AxosBank/MobileMenu/MobileMenu.css.css +191 -0
- package/dist/assets/NavigationMenu/AxosBank/NavBar.css +6 -0
- package/dist/assets/NavigationMenu/AxosBank/NavBar.css.css +473 -661
- package/dist/assets/SetContainer/SetContainer.css +44 -22
- package/dist/assets/Topic/Topic.css +54 -0
- package/dist/assets/WalnutIframe/wrapper.css.css +49 -0
- package/dist/assets/globals.css +13 -30
- package/dist/assets/utils/optimizeImage/optimizeImage.css.css +47 -0
- package/dist/icons/ArrowIcon/ArrowIcon.css.d.ts +3 -3
- package/dist/icons/CheckIcon/CheckIcon.css.d.ts +2 -2
- package/dist/icons/Logos/AXB.d.ts +8 -0
- package/dist/icons/Logos/AXB.js +74 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +69 -8
- package/dist/themes/axos.css.d.ts +38 -38
- package/dist/utils/allowedAxosDomains.js +19 -3
- package/dist/utils/appendQueryParams.js +3 -6
- package/dist/utils/{lazyImage/lazyImage.d.ts → optimizeImage/OptimizeImage.d.ts} +3 -2
- package/dist/utils/optimizeImage/OptimizeImage.js +46 -0
- package/dist/utils/optimizeImage/index.d.ts +1 -0
- package/dist/utils/optimizeImage/index.js +4 -0
- package/dist/utils/optimizeImage/optimizeImage.module.js +14 -0
- package/package.json +11 -8
- package/dist/utils/lazyImage/imageObserver.d.ts +0 -9
- package/dist/utils/lazyImage/imageObserver.js +0 -29
- package/dist/utils/lazyImage/index.d.ts +0 -2
- package/dist/utils/lazyImage/index.js +0 -7
- package/dist/utils/lazyImage/lazyImage.js +0 -26
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4
|
+
import { Button } from "../Button/Button.js";
|
|
5
|
+
import "../Button/Button.css.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-use";
|
|
8
|
+
import "../icons/ArrowIcon/ArrowIcon.css.js";
|
|
9
|
+
import SvgAxosX from "../icons/AxosX/index.js";
|
|
10
|
+
import SvgComponent from "../icons/AxosX/Blue.js";
|
|
11
|
+
import "../icons/CheckIcon/CheckIcon.css.js";
|
|
12
|
+
import '../assets/icons/FollowIcon/FollowIcon.css';import '../assets/icons/DownloadIcon/DownloadIcon.css';import '../assets/themes/victorie.css';import '../assets/themes/premier.css';import '../assets/themes/axos.css';/* empty css */
|
|
13
|
+
/* empty css */
|
|
14
|
+
/* empty css */
|
|
15
|
+
/* empty css */
|
|
16
|
+
/* empty css */
|
|
17
|
+
import "../Input/Checkbox.js";
|
|
18
|
+
import "../Input/CurrencyInput.js";
|
|
19
|
+
import { Dropdown } from "../Input/Dropdown.js";
|
|
20
|
+
import "../Input/Dropdown.css.js";
|
|
21
|
+
import { Input } from "../Input/Input.js";
|
|
22
|
+
import "../Input/Input.css.js";
|
|
23
|
+
import "../Input/InputAmount.js";
|
|
24
|
+
import "../Input/InputPhone.js";
|
|
25
|
+
import "../Input/InputTextArea.js";
|
|
26
|
+
import "../Input/DownPaymentInput.js";
|
|
27
|
+
import "../Input/RadioButton.js";
|
|
28
|
+
import { LoadingIndicator } from "../LoadingIndicator/index.js";
|
|
29
|
+
import "../utils/allowedAxosDomains.js";
|
|
30
|
+
import { associatedEmail } from "../utils/EverestValidity.js";
|
|
31
|
+
import { getVariant } from "../utils/getVariant.js";
|
|
32
|
+
import clsx from "clsx";
|
|
33
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
34
|
+
import { z } from "zod";
|
|
35
|
+
import { iconForm, headerContainer, headerForm, form, descriptionField, formWrapper, disclosureForm, actions, formContainer } from "./Forms.css.js";
|
|
36
|
+
import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
|
|
37
|
+
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
38
|
+
const CommercialPremiumFinance = ({
|
|
39
|
+
icon = false,
|
|
40
|
+
children,
|
|
41
|
+
onSubmit = (values) => {
|
|
42
|
+
console.log(values);
|
|
43
|
+
},
|
|
44
|
+
disclosure,
|
|
45
|
+
variant: fullVariant = "primary",
|
|
46
|
+
headline,
|
|
47
|
+
callToAction,
|
|
48
|
+
validateEmail,
|
|
49
|
+
description,
|
|
50
|
+
id
|
|
51
|
+
}) => {
|
|
52
|
+
const schema = z.object({
|
|
53
|
+
first_name: z.string({
|
|
54
|
+
required_error: "First name is required",
|
|
55
|
+
invalid_type_error: "Invalid first name"
|
|
56
|
+
}).regex(/^[a-zA-Z]*(?:[a-zA-Z][a-zA-Z'-]*\s{0,1}){2,}$/g, {
|
|
57
|
+
message: "Invalid first name"
|
|
58
|
+
}).trim().min(1, { message: "First Name is required." }),
|
|
59
|
+
last_name: z.string({
|
|
60
|
+
required_error: "Last name is required",
|
|
61
|
+
invalid_type_error: "Invalid last name"
|
|
62
|
+
}).regex(/^[a-zA-Z]*(?:[a-zA-Z][a-zA-Z'-]*\s{0,1}){2,}$/g, {
|
|
63
|
+
message: "Invalid last name"
|
|
64
|
+
}).trim().min(1, { message: "Last Name is required." }),
|
|
65
|
+
email: z.string().email({ message: "Invalid email address" }).refine(async (val) => await validateEmail(val), {
|
|
66
|
+
message: "Invalid email address"
|
|
67
|
+
}),
|
|
68
|
+
Insurance_Company__c: z.string(),
|
|
69
|
+
Type_of_Policy__c: z.string()
|
|
70
|
+
});
|
|
71
|
+
const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
72
|
+
if (!isValidHoneyPot(data)) {
|
|
73
|
+
ctx.addIssue({
|
|
74
|
+
code: z.ZodIssueCode.custom,
|
|
75
|
+
message: "fields are not valid."
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const methods = useForm({
|
|
80
|
+
resolver: zodResolver(gen_schema, {
|
|
81
|
+
async: true
|
|
82
|
+
}),
|
|
83
|
+
mode: "onBlur",
|
|
84
|
+
defaultValues: {
|
|
85
|
+
email: ""
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const {
|
|
89
|
+
handleSubmit,
|
|
90
|
+
register,
|
|
91
|
+
formState: { errors, isValid, isSubmitting }
|
|
92
|
+
} = methods;
|
|
93
|
+
const submitForm = async (data) => {
|
|
94
|
+
await onSubmit(data);
|
|
95
|
+
};
|
|
96
|
+
const variant = getVariant(fullVariant);
|
|
97
|
+
return /* @__PURE__ */ jsx("section", { id, className: clsx(formContainer({ variant })), children: /* @__PURE__ */ jsx("div", { className: clsx("containment"), children: /* @__PURE__ */ jsxs(FormProvider, { ...methods, children: [
|
|
98
|
+
icon && /* @__PURE__ */ jsx("div", { className: clsx("text_center", iconForm), children: ["primary", "secondary"].includes(variant) ? /* @__PURE__ */ jsx(SvgComponent, {}) : /* @__PURE__ */ jsx(SvgAxosX, {}) }),
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: `${headerContainer} text_center`, children: [
|
|
100
|
+
/* @__PURE__ */ jsx("h2", { className: clsx("header_2", headerForm({ variant })), children: headline }),
|
|
101
|
+
description && /* @__PURE__ */ jsx(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
className: clsx(
|
|
105
|
+
"text_center",
|
|
106
|
+
form,
|
|
107
|
+
descriptionField({ variant })
|
|
108
|
+
),
|
|
109
|
+
children: description
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsxs("form", { className: form, onSubmit: handleSubmit(submitForm), children: [
|
|
114
|
+
/* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
|
|
115
|
+
/* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx(
|
|
116
|
+
Input,
|
|
117
|
+
{
|
|
118
|
+
id: "first_name",
|
|
119
|
+
...register("first_name", { required: true }),
|
|
120
|
+
label: "First Name",
|
|
121
|
+
sizes: "medium",
|
|
122
|
+
required: true,
|
|
123
|
+
error: !!errors.first_name,
|
|
124
|
+
helperText: errors.first_name?.message,
|
|
125
|
+
variant
|
|
126
|
+
}
|
|
127
|
+
) }),
|
|
128
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
129
|
+
Input,
|
|
130
|
+
{
|
|
131
|
+
id: "last_name",
|
|
132
|
+
...register("last_name", { required: true }),
|
|
133
|
+
label: "Last Name",
|
|
134
|
+
sizes: "medium",
|
|
135
|
+
required: true,
|
|
136
|
+
error: !!errors.last_name,
|
|
137
|
+
helperText: errors.last_name?.message,
|
|
138
|
+
variant
|
|
139
|
+
}
|
|
140
|
+
) }),
|
|
141
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
142
|
+
Input,
|
|
143
|
+
{
|
|
144
|
+
id: "email",
|
|
145
|
+
...register("email", {
|
|
146
|
+
required: true,
|
|
147
|
+
validate: {
|
|
148
|
+
isValid: associatedEmail
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
151
|
+
label: "Email",
|
|
152
|
+
sizes: "medium",
|
|
153
|
+
required: true,
|
|
154
|
+
error: !!errors.email,
|
|
155
|
+
helperText: errors.email?.message,
|
|
156
|
+
variant
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
159
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
160
|
+
Input,
|
|
161
|
+
{
|
|
162
|
+
id: "Insurance_Company__c",
|
|
163
|
+
...register("Insurance_Company__c", {}),
|
|
164
|
+
label: "Insurance Company",
|
|
165
|
+
sizes: "medium",
|
|
166
|
+
error: !!errors.Insurance_Company__c,
|
|
167
|
+
helperText: errors.Insurance_Company__c?.message,
|
|
168
|
+
variant
|
|
169
|
+
}
|
|
170
|
+
) }),
|
|
171
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
172
|
+
Dropdown,
|
|
173
|
+
{
|
|
174
|
+
id: "Type_of_Policy__c",
|
|
175
|
+
...register("Type_of_Policy__c", {}),
|
|
176
|
+
label: "Type of Policy",
|
|
177
|
+
sizes: "medium",
|
|
178
|
+
variant,
|
|
179
|
+
defaultValue: "",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx("option", { value: "" }),
|
|
182
|
+
/* @__PURE__ */ jsx("option", { value: "Whole life", children: "Whole life" }),
|
|
183
|
+
/* @__PURE__ */ jsx("option", { value: "Index Universal Life", children: "Index Universal Life" })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
) }),
|
|
187
|
+
/* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
|
|
188
|
+
] }),
|
|
189
|
+
children,
|
|
190
|
+
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
191
|
+
/* @__PURE__ */ jsx("div", { className: actions, children: isSubmitting ? /* @__PURE__ */ jsx(
|
|
192
|
+
LoadingIndicator,
|
|
193
|
+
{
|
|
194
|
+
style: { marginInline: "auto" },
|
|
195
|
+
variant
|
|
196
|
+
}
|
|
197
|
+
) : /* @__PURE__ */ jsx(
|
|
198
|
+
Button,
|
|
199
|
+
{
|
|
200
|
+
color: getVariant(callToAction?.variant),
|
|
201
|
+
as: "button",
|
|
202
|
+
type: "submit",
|
|
203
|
+
disabled: !isValid || isSubmitting,
|
|
204
|
+
children: callToAction?.displayText
|
|
205
|
+
}
|
|
206
|
+
) })
|
|
207
|
+
] })
|
|
208
|
+
] }) }) }, id);
|
|
209
|
+
};
|
|
210
|
+
export {
|
|
211
|
+
CommercialPremiumFinance
|
|
212
|
+
};
|
|
@@ -32,6 +32,7 @@ import clsx from "clsx";
|
|
|
32
32
|
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
|
+
import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
|
|
35
36
|
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
36
37
|
const ContactCompany = ({
|
|
37
38
|
icon = false,
|
|
@@ -51,7 +52,7 @@ const ContactCompany = ({
|
|
|
51
52
|
first_name: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "First Name is required." }),
|
|
52
53
|
last_name: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "Last Name is required." }),
|
|
53
54
|
email: z.string().email({ message: "Email is required." }).refine(async (val) => await validateEmail(val)),
|
|
54
|
-
phone: z.string().regex(/[\d-]{10}
|
|
55
|
+
phone: z.string({ message: "Phone is required." }).regex(/[\d-]{10}/, "Invalid phone number.").min(10, { message: "Phone is required." }).max(12, { message: "Phone is required." }).transform((val, ctx) => {
|
|
55
56
|
const removeDashes = val.replace(/-/gi, "");
|
|
56
57
|
if (removeDashes.length !== 10) {
|
|
57
58
|
ctx.addIssue({
|
|
@@ -60,12 +61,27 @@ const ContactCompany = ({
|
|
|
60
61
|
});
|
|
61
62
|
return z.NEVER;
|
|
62
63
|
}
|
|
64
|
+
if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
|
|
65
|
+
ctx.addIssue({
|
|
66
|
+
code: z.ZodIssueCode.custom,
|
|
67
|
+
message: "Invalid phone number."
|
|
68
|
+
});
|
|
69
|
+
return z.NEVER;
|
|
70
|
+
}
|
|
63
71
|
return removeDashes;
|
|
64
72
|
}),
|
|
65
73
|
company: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "Company is required." }).max(255, { message: "Company can have atmost 255 characters." })
|
|
66
74
|
});
|
|
75
|
+
const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
76
|
+
if (!isValidHoneyPot(data)) {
|
|
77
|
+
ctx.addIssue({
|
|
78
|
+
code: z.ZodIssueCode.custom,
|
|
79
|
+
message: "fields are not valid."
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
67
83
|
const methods = useForm({
|
|
68
|
-
resolver: zodResolver(
|
|
84
|
+
resolver: zodResolver(gen_schema, {
|
|
69
85
|
async: true
|
|
70
86
|
}),
|
|
71
87
|
mode: "all",
|
|
@@ -174,7 +190,8 @@ const ContactCompany = ({
|
|
|
174
190
|
helperText: errors.company?.message,
|
|
175
191
|
variant
|
|
176
192
|
}
|
|
177
|
-
) })
|
|
193
|
+
) }),
|
|
194
|
+
/* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
|
|
178
195
|
] }),
|
|
179
196
|
children,
|
|
180
197
|
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
@@ -32,6 +32,7 @@ import clsx from "clsx";
|
|
|
32
32
|
import { useForm, FormProvider } from "react-hook-form";
|
|
33
33
|
import * as z from "zod";
|
|
34
34
|
import { iconForm, headerContainer, headerForm, form, descriptionField, formWrapper, disclosureForm, actions, formContainer } from "./Forms.css.js";
|
|
35
|
+
import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
|
|
35
36
|
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
36
37
|
const ContactCompanyTitle = ({
|
|
37
38
|
icon = false,
|
|
@@ -51,7 +52,7 @@ const ContactCompanyTitle = ({
|
|
|
51
52
|
first_name: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "First Name is required." }),
|
|
52
53
|
last_name: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "Last Name is required." }),
|
|
53
54
|
email: z.string().email({ message: "Email is required." }).refine(async (val) => await validateEmail(val)),
|
|
54
|
-
phone: z.string().regex(/[\d-]{10}
|
|
55
|
+
phone: z.string({ message: "Phone is required." }).regex(/[\d-]{10}/, "Invalid phone number.").min(10, { message: "Phone is required." }).max(12, { message: "Phone is required." }).transform((val, ctx) => {
|
|
55
56
|
const removeDashes = val.replace(/-/gi, "");
|
|
56
57
|
if (removeDashes.length !== 10) {
|
|
57
58
|
ctx.addIssue({
|
|
@@ -60,13 +61,28 @@ const ContactCompanyTitle = ({
|
|
|
60
61
|
});
|
|
61
62
|
return z.NEVER;
|
|
62
63
|
}
|
|
64
|
+
if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
|
|
65
|
+
ctx.addIssue({
|
|
66
|
+
code: z.ZodIssueCode.custom,
|
|
67
|
+
message: "Invalid phone number."
|
|
68
|
+
});
|
|
69
|
+
return z.NEVER;
|
|
70
|
+
}
|
|
63
71
|
return removeDashes;
|
|
64
72
|
}),
|
|
65
73
|
company: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "Company is required." }).max(255, { message: "Company can have at most 255 characters." }),
|
|
66
74
|
title: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "Title is required." }).max(128, { message: "Title can have at most 128 characters." })
|
|
67
75
|
});
|
|
76
|
+
const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
77
|
+
if (!isValidHoneyPot(data)) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: z.ZodIssueCode.custom,
|
|
80
|
+
message: "fields are not valid."
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
68
84
|
const methods = useForm({
|
|
69
|
-
resolver: zodResolver(
|
|
85
|
+
resolver: zodResolver(gen_schema, {
|
|
70
86
|
async: true
|
|
71
87
|
}),
|
|
72
88
|
mode: "all",
|
|
@@ -189,7 +205,8 @@ const ContactCompanyTitle = ({
|
|
|
189
205
|
helperText: errors.title?.message,
|
|
190
206
|
variant
|
|
191
207
|
}
|
|
192
|
-
) })
|
|
208
|
+
) }),
|
|
209
|
+
/* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
|
|
193
210
|
] }),
|
|
194
211
|
children,
|
|
195
212
|
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
@@ -6,4 +6,4 @@ export type Inputs = {
|
|
|
6
6
|
email: string;
|
|
7
7
|
phone: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const ContactUs: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const ContactUs: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, onValidate, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Forms/ContactUs.js
CHANGED
|
@@ -32,6 +32,7 @@ import clsx from "clsx";
|
|
|
32
32
|
import { useForm, FormProvider } from "react-hook-form";
|
|
33
33
|
import * as z from "zod";
|
|
34
34
|
import { iconForm, headerContainer, headerForm, form, descriptionField, formWrapper, disclosureForm, actions, formContainer } from "./Forms.css.js";
|
|
35
|
+
import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
|
|
35
36
|
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
36
37
|
const ContactUs = ({
|
|
37
38
|
icon = false,
|
|
@@ -45,13 +46,14 @@ const ContactUs = ({
|
|
|
45
46
|
description,
|
|
46
47
|
callToAction,
|
|
47
48
|
validateEmail,
|
|
49
|
+
onValidate,
|
|
48
50
|
id
|
|
49
51
|
}) => {
|
|
50
52
|
const schema = z.object({
|
|
51
53
|
first_name: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "First Name is required." }),
|
|
52
54
|
last_name: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g).trim().min(1, { message: "Last Name is required." }),
|
|
53
55
|
email: z.string().email({ message: "Email is required." }).refine(async (val) => await validateEmail(val)),
|
|
54
|
-
phone: z.string().regex(/[\d-]{10}
|
|
56
|
+
phone: z.string({ message: "Phone is required." }).regex(/[\d-]{10}/, "Invalid phone number.").min(10, { message: "Phone is required." }).max(12, { message: "Phone is required." }).transform((val, ctx) => {
|
|
55
57
|
const removeDashes = val.replace(/-/gi, "");
|
|
56
58
|
if (removeDashes.length !== 10) {
|
|
57
59
|
ctx.addIssue({
|
|
@@ -60,11 +62,26 @@ const ContactUs = ({
|
|
|
60
62
|
});
|
|
61
63
|
return z.NEVER;
|
|
62
64
|
}
|
|
65
|
+
if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: z.ZodIssueCode.custom,
|
|
68
|
+
message: "Invalid phone number."
|
|
69
|
+
});
|
|
70
|
+
return z.NEVER;
|
|
71
|
+
}
|
|
63
72
|
return removeDashes;
|
|
64
73
|
})
|
|
65
74
|
});
|
|
75
|
+
const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
76
|
+
if (!isValidHoneyPot(data)) {
|
|
77
|
+
ctx.addIssue({
|
|
78
|
+
code: z.ZodIssueCode.custom,
|
|
79
|
+
message: "fields are not valid."
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
66
83
|
const methods = useForm({
|
|
67
|
-
resolver: zodResolver(
|
|
84
|
+
resolver: zodResolver(gen_schema, {
|
|
68
85
|
async: true
|
|
69
86
|
}),
|
|
70
87
|
mode: "all",
|
|
@@ -75,7 +92,7 @@ const ContactUs = ({
|
|
|
75
92
|
const {
|
|
76
93
|
handleSubmit,
|
|
77
94
|
register,
|
|
78
|
-
formState: { errors
|
|
95
|
+
formState: { errors }
|
|
79
96
|
} = methods;
|
|
80
97
|
const submitForm = async (data) => {
|
|
81
98
|
await onSubmit(data);
|
|
@@ -93,83 +110,94 @@ const ContactUs = ({
|
|
|
93
110
|
}
|
|
94
111
|
)
|
|
95
112
|
] }),
|
|
96
|
-
/* @__PURE__ */ jsxs(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
placeholder: "Last Name",
|
|
120
|
-
required: true,
|
|
121
|
-
error: !!errors.last_name,
|
|
122
|
-
helperText: errors.last_name?.message,
|
|
123
|
-
variant
|
|
124
|
-
}
|
|
125
|
-
) }),
|
|
126
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
127
|
-
Input,
|
|
128
|
-
{
|
|
129
|
-
id: "email",
|
|
130
|
-
...register("email", {
|
|
131
|
-
required: true,
|
|
132
|
-
validate: {
|
|
133
|
-
isValid: associatedEmail
|
|
113
|
+
/* @__PURE__ */ jsxs(
|
|
114
|
+
"form",
|
|
115
|
+
{
|
|
116
|
+
className: form,
|
|
117
|
+
onSubmit: async (e) => {
|
|
118
|
+
onValidate && onValidate(e);
|
|
119
|
+
await handleSubmit(submitForm)(e);
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
|
|
124
|
+
/* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx(
|
|
125
|
+
Input,
|
|
126
|
+
{
|
|
127
|
+
id: "first_name",
|
|
128
|
+
...register("first_name", { required: true }),
|
|
129
|
+
label: "First Name",
|
|
130
|
+
sizes: "medium",
|
|
131
|
+
placeholder: "First Name",
|
|
132
|
+
required: true,
|
|
133
|
+
error: !!errors.first_name,
|
|
134
|
+
helperText: errors.first_name?.message,
|
|
135
|
+
variant
|
|
134
136
|
}
|
|
135
|
-
}),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
137
|
+
) }),
|
|
138
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
139
|
+
Input,
|
|
140
|
+
{
|
|
141
|
+
id: "last_name",
|
|
142
|
+
...register("last_name", { required: true }),
|
|
143
|
+
label: "Last Name",
|
|
144
|
+
sizes: "medium",
|
|
145
|
+
placeholder: "Last Name",
|
|
146
|
+
required: true,
|
|
147
|
+
error: !!errors.last_name,
|
|
148
|
+
helperText: errors.last_name?.message,
|
|
149
|
+
variant
|
|
150
|
+
}
|
|
151
|
+
) }),
|
|
152
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
153
|
+
Input,
|
|
154
|
+
{
|
|
155
|
+
id: "email",
|
|
156
|
+
...register("email", {
|
|
157
|
+
required: true,
|
|
158
|
+
validate: {
|
|
159
|
+
isValid: associatedEmail
|
|
160
|
+
}
|
|
161
|
+
}),
|
|
162
|
+
label: "Email",
|
|
163
|
+
sizes: "medium",
|
|
164
|
+
placeholder: "Email",
|
|
165
|
+
required: true,
|
|
166
|
+
error: !!errors.email,
|
|
167
|
+
helperText: errors.email?.message,
|
|
168
|
+
variant
|
|
169
|
+
}
|
|
170
|
+
) }),
|
|
171
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
172
|
+
InputPhone,
|
|
173
|
+
{
|
|
174
|
+
id: "phone",
|
|
175
|
+
...register("phone", { required: true, maxLength: 12 }),
|
|
176
|
+
label: "Phone",
|
|
177
|
+
sizes: "medium",
|
|
178
|
+
placeholder: "Phone",
|
|
179
|
+
required: true,
|
|
180
|
+
error: !!errors.phone,
|
|
181
|
+
helperText: errors.phone?.message,
|
|
182
|
+
variant
|
|
183
|
+
}
|
|
184
|
+
) }),
|
|
185
|
+
/* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
|
|
186
|
+
] }),
|
|
187
|
+
children,
|
|
188
|
+
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
189
|
+
/* @__PURE__ */ jsx("div", { className: actions, children: /* @__PURE__ */ jsx(
|
|
190
|
+
Button,
|
|
191
|
+
{
|
|
192
|
+
color: getVariant(callToAction?.variant),
|
|
193
|
+
as: "button",
|
|
194
|
+
type: "submit",
|
|
195
|
+
children: callToAction?.displayText
|
|
196
|
+
}
|
|
197
|
+
) })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
)
|
|
173
201
|
] }) }) }, id);
|
|
174
202
|
};
|
|
175
203
|
export {
|
|
@@ -33,6 +33,7 @@ import { useForm, FormProvider } from "react-hook-form";
|
|
|
33
33
|
import { z } from "zod";
|
|
34
34
|
import { Roles } from "./FormEnums.js";
|
|
35
35
|
import { iconForm, headerContainer, headerForm, form, descriptionField, formWrapper, disclosureForm, actions, formContainer } from "./Forms.css.js";
|
|
36
|
+
import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
|
|
36
37
|
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
37
38
|
const ContactUsAAS = ({
|
|
38
39
|
icon = false,
|
|
@@ -56,9 +57,7 @@ const ContactUsAAS = ({
|
|
|
56
57
|
message: "Invalid last name"
|
|
57
58
|
}).trim().min(1, { message: "Last Name is required." }),
|
|
58
59
|
email: z.string({ message: "Email is required." }).email({ message: "Email is required." }).refine(async (val) => await validateEmail(val)),
|
|
59
|
-
phone: z.string({ message: "Phone is required." }).regex(/[\d-]{10}/, {
|
|
60
|
-
message: "Invalid phone number"
|
|
61
|
-
}).min(10, { message: "Phone is required." }).max(12, { message: "Phone is required." }).transform((val, ctx) => {
|
|
60
|
+
phone: z.string({ message: "Phone is required." }).regex(/[\d-]{10}/, "Invalid phone number.").min(10, { message: "Phone is required." }).max(12, { message: "Phone is required." }).transform((val, ctx) => {
|
|
62
61
|
const removeDashes = val.replace(/-/gi, "");
|
|
63
62
|
if (removeDashes.length !== 10) {
|
|
64
63
|
ctx.addIssue({
|
|
@@ -67,6 +66,13 @@ const ContactUsAAS = ({
|
|
|
67
66
|
});
|
|
68
67
|
return z.NEVER;
|
|
69
68
|
}
|
|
69
|
+
if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
|
|
70
|
+
ctx.addIssue({
|
|
71
|
+
code: z.ZodIssueCode.custom,
|
|
72
|
+
message: "Invalid phone number."
|
|
73
|
+
});
|
|
74
|
+
return z.NEVER;
|
|
75
|
+
}
|
|
70
76
|
return removeDashes;
|
|
71
77
|
}),
|
|
72
78
|
company: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
|
|
@@ -76,9 +82,17 @@ const ContactUsAAS = ({
|
|
|
76
82
|
Role__c: z.string().min(1, { message: "Role is required." }).refine((val) => Roles.includes(val), "Role is required"),
|
|
77
83
|
description: z.optional(z.string().trim().max(32e3))
|
|
78
84
|
});
|
|
85
|
+
const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
86
|
+
if (!isValidHoneyPot(data)) {
|
|
87
|
+
ctx.addIssue({
|
|
88
|
+
code: z.ZodIssueCode.custom,
|
|
89
|
+
message: "fields are not valid."
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
79
93
|
const methods = useForm({
|
|
80
94
|
resolver: zodResolver(
|
|
81
|
-
|
|
95
|
+
gen_schema,
|
|
82
96
|
{
|
|
83
97
|
async: true
|
|
84
98
|
},
|
|
@@ -247,7 +261,8 @@ const ContactUsAAS = ({
|
|
|
247
261
|
variant,
|
|
248
262
|
rows: 1
|
|
249
263
|
}
|
|
250
|
-
) })
|
|
264
|
+
) }),
|
|
265
|
+
/* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
|
|
251
266
|
] }),
|
|
252
267
|
children,
|
|
253
268
|
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
@@ -3,9 +3,9 @@ import { FormProps } from './FormProps';
|
|
|
3
3
|
export type ContactUsBusinessNmlsIdInputs = {
|
|
4
4
|
first_name: string;
|
|
5
5
|
last_name: string;
|
|
6
|
-
|
|
6
|
+
Company: string;
|
|
7
7
|
email: string;
|
|
8
8
|
phone: string;
|
|
9
|
-
|
|
9
|
+
Company_NMLS_ID__c: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const ContactUsBusiness: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
|