@axos-web-dev/shared-components 1.0.68 → 1.0.69
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormProps } from './FormProps';
|
|
2
|
+
|
|
3
|
+
export type CommercialPremiumFinanceInputs = {
|
|
4
|
+
first_name: string;
|
|
5
|
+
last_name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
Insurance_Company__c: string;
|
|
8
|
+
Type_of_Policy__c: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const CommercialPremiumFinance: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, callToAction, validateEmail, description, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
5
|
+
import { SalesforceSchema } from "./SalesforceFieldsForm.js";
|
|
6
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
7
|
+
import "../utils/allowedAxosDomains.js";
|
|
8
|
+
import { associatedEmail } from "../utils/EverestValidity.js";
|
|
9
|
+
import { getVariant } from "../utils/getVariant.js";
|
|
10
|
+
import { formContainer, iconForm, headerContainer, headerForm, form, descriptionField, formWrapper, disclosureForm, actions } from "./Forms.css.js";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import "../icons/ArrowIcon/ArrowIcon.css.js";
|
|
13
|
+
import SvgAxosX from "../icons/AxosX/index.js";
|
|
14
|
+
import SvgComponent from "../icons/AxosX/Blue.js";
|
|
15
|
+
import "../icons/CheckIcon/CheckIcon.css.js";
|
|
16
|
+
/* empty css */
|
|
17
|
+
/* empty css */
|
|
18
|
+
/* empty css */
|
|
19
|
+
/* empty css */
|
|
20
|
+
/* empty css */
|
|
21
|
+
import "../Input/Checkbox.js";
|
|
22
|
+
import "../Input/CurrencyInput.js";
|
|
23
|
+
import { Dropdown } from "../Input/Dropdown.js";
|
|
24
|
+
import "../Input/Dropdown.css.js";
|
|
25
|
+
import { Input } from "../Input/Input.js";
|
|
26
|
+
import "../Input/Input.css.js";
|
|
27
|
+
import "../Input/InputAmount.js";
|
|
28
|
+
import "../Input/InputPhone.js";
|
|
29
|
+
import "../Input/InputTextArea.js";
|
|
30
|
+
import "../Input/DownPaymentInput.js";
|
|
31
|
+
import "../Input/RadioButton.js";
|
|
32
|
+
import { LoadingIndicator } from "../LoadingIndicator/index.js";
|
|
33
|
+
import { Button } from "../Button/Button.js";
|
|
34
|
+
import "../Button/Button.css.js";
|
|
35
|
+
import "react";
|
|
36
|
+
import "react-use";
|
|
37
|
+
const CommercialPremiumFinance = ({
|
|
38
|
+
icon = false,
|
|
39
|
+
children,
|
|
40
|
+
onSubmit = (values) => {
|
|
41
|
+
console.log(values);
|
|
42
|
+
},
|
|
43
|
+
disclosure,
|
|
44
|
+
variant: fullVariant = "primary",
|
|
45
|
+
headline,
|
|
46
|
+
callToAction,
|
|
47
|
+
validateEmail,
|
|
48
|
+
description,
|
|
49
|
+
id
|
|
50
|
+
}) => {
|
|
51
|
+
const schema = z.object({
|
|
52
|
+
first_name: z.string({
|
|
53
|
+
required_error: "First name is required",
|
|
54
|
+
invalid_type_error: "Invalid first name"
|
|
55
|
+
}).regex(/^[a-zA-Z]*(?:[a-zA-Z][a-zA-Z'-]*\s{0,1}){2,}$/g, {
|
|
56
|
+
message: "Invalid first name"
|
|
57
|
+
}).trim().min(1, { message: "First Name is required." }),
|
|
58
|
+
last_name: z.string({
|
|
59
|
+
required_error: "Last name is required",
|
|
60
|
+
invalid_type_error: "Invalid last name"
|
|
61
|
+
}).regex(/^[a-zA-Z]*(?:[a-zA-Z][a-zA-Z'-]*\s{0,1}){2,}$/g, {
|
|
62
|
+
message: "Invalid last name"
|
|
63
|
+
}).trim().min(1, { message: "Last Name is required." }),
|
|
64
|
+
email: z.string().email({ message: "Business Email is required." }).refine(async (val) => await validateEmail(val)),
|
|
65
|
+
Insurance_Company__c: z.string(),
|
|
66
|
+
Type_of_Policy__c: z.string()
|
|
67
|
+
});
|
|
68
|
+
const methods = useForm({
|
|
69
|
+
resolver: zodResolver(schema.merge(SalesforceSchema), {
|
|
70
|
+
async: true
|
|
71
|
+
}),
|
|
72
|
+
mode: "all",
|
|
73
|
+
defaultValues: {
|
|
74
|
+
email: ""
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const {
|
|
78
|
+
handleSubmit,
|
|
79
|
+
register,
|
|
80
|
+
formState: { errors, isValid, isSubmitting }
|
|
81
|
+
} = methods;
|
|
82
|
+
const submitForm = async (data) => {
|
|
83
|
+
await onSubmit(data);
|
|
84
|
+
};
|
|
85
|
+
const variant = getVariant(fullVariant);
|
|
86
|
+
return /* @__PURE__ */ jsx("section", { id, className: clsx(formContainer({ variant })), children: /* @__PURE__ */ jsx("div", { className: clsx("containment"), children: /* @__PURE__ */ jsxs(FormProvider, { ...methods, children: [
|
|
87
|
+
icon && /* @__PURE__ */ jsx("div", { className: clsx("text_center", iconForm), children: ["primary", "secondary"].includes(variant) ? /* @__PURE__ */ jsx(SvgComponent, {}) : /* @__PURE__ */ jsx(SvgAxosX, {}) }),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: `${headerContainer} text_center`, children: [
|
|
89
|
+
/* @__PURE__ */ jsx("h2", { className: clsx("header_2", headerForm({ variant })), children: headline }),
|
|
90
|
+
description && /* @__PURE__ */ jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: clsx(
|
|
94
|
+
"text_center",
|
|
95
|
+
form,
|
|
96
|
+
descriptionField({ variant })
|
|
97
|
+
),
|
|
98
|
+
children: description
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ jsx("form", { className: form, onSubmit: handleSubmit(submitForm), children: /* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
|
|
103
|
+
/* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx(
|
|
104
|
+
Input,
|
|
105
|
+
{
|
|
106
|
+
id: "first_name",
|
|
107
|
+
...register("first_name", { required: true }),
|
|
108
|
+
label: "First Name",
|
|
109
|
+
sizes: "medium",
|
|
110
|
+
required: true,
|
|
111
|
+
error: !!errors.first_name,
|
|
112
|
+
helperText: errors.first_name?.message,
|
|
113
|
+
variant
|
|
114
|
+
}
|
|
115
|
+
) }),
|
|
116
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
117
|
+
Input,
|
|
118
|
+
{
|
|
119
|
+
id: "last_name",
|
|
120
|
+
...register("last_name", { required: true }),
|
|
121
|
+
label: "Last Name",
|
|
122
|
+
sizes: "medium",
|
|
123
|
+
required: true,
|
|
124
|
+
error: !!errors.last_name,
|
|
125
|
+
helperText: errors.last_name?.message,
|
|
126
|
+
variant
|
|
127
|
+
}
|
|
128
|
+
) }),
|
|
129
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
130
|
+
Input,
|
|
131
|
+
{
|
|
132
|
+
id: "email",
|
|
133
|
+
...register("email", {
|
|
134
|
+
required: true,
|
|
135
|
+
validate: {
|
|
136
|
+
isValid: associatedEmail
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
label: "Business Email",
|
|
140
|
+
sizes: "medium",
|
|
141
|
+
required: true,
|
|
142
|
+
error: !!errors.email,
|
|
143
|
+
helperText: errors.email?.message,
|
|
144
|
+
variant
|
|
145
|
+
}
|
|
146
|
+
) }),
|
|
147
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
148
|
+
Input,
|
|
149
|
+
{
|
|
150
|
+
id: "Insurance_Company__c",
|
|
151
|
+
...register("Insurance_Company__c", { required: true }),
|
|
152
|
+
label: "Insurance Company",
|
|
153
|
+
sizes: "medium",
|
|
154
|
+
required: true,
|
|
155
|
+
error: !!errors.Insurance_Company__c,
|
|
156
|
+
helperText: errors.Insurance_Company__c?.message,
|
|
157
|
+
variant
|
|
158
|
+
}
|
|
159
|
+
) }),
|
|
160
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
161
|
+
Dropdown,
|
|
162
|
+
{
|
|
163
|
+
id: "Type_of_Policy__c",
|
|
164
|
+
...register("Type_of_Policy__c", {}),
|
|
165
|
+
label: "Type of Policy",
|
|
166
|
+
sizes: "medium",
|
|
167
|
+
variant,
|
|
168
|
+
defaultValue: "",
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ jsx("option", { value: "" }),
|
|
171
|
+
/* @__PURE__ */ jsx("option", { value: "Whole life", children: "Whole life" }),
|
|
172
|
+
/* @__PURE__ */ jsx("option", { value: "Index Universal Life", children: "Index Universal Life" })
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
) }),
|
|
176
|
+
children,
|
|
177
|
+
/* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
|
|
178
|
+
/* @__PURE__ */ jsx("div", { className: actions, children: isSubmitting ? /* @__PURE__ */ jsx(
|
|
179
|
+
LoadingIndicator,
|
|
180
|
+
{
|
|
181
|
+
style: { marginInline: "auto" },
|
|
182
|
+
variant
|
|
183
|
+
}
|
|
184
|
+
) : /* @__PURE__ */ jsx(
|
|
185
|
+
Button,
|
|
186
|
+
{
|
|
187
|
+
color: getVariant(callToAction?.variant),
|
|
188
|
+
as: "button",
|
|
189
|
+
type: "submit",
|
|
190
|
+
disabled: !isValid || isSubmitting,
|
|
191
|
+
children: callToAction?.displayText
|
|
192
|
+
}
|
|
193
|
+
) })
|
|
194
|
+
] }) })
|
|
195
|
+
] }) }) }, id);
|
|
196
|
+
};
|
|
197
|
+
export {
|
|
198
|
+
CommercialPremiumFinance
|
|
199
|
+
};
|
package/dist/Forms/index.d.ts
CHANGED
package/dist/Forms/index.js
CHANGED
|
@@ -34,12 +34,14 @@ import { ScheduleCallPremier } from "./ScheduleCallPremier.js";
|
|
|
34
34
|
import { SuccesFormWrapper } from "./SuccesForm.js";
|
|
35
35
|
import { VendorQuestionnaire } from "./VendorQuestionnaire.js";
|
|
36
36
|
import { WCPLSurvey } from "./WcplSurvey.js";
|
|
37
|
+
import { CommercialPremiumFinance } from "./CommercialPremiumFinance.js";
|
|
37
38
|
export {
|
|
38
39
|
ApplicationStart,
|
|
39
40
|
ApplyNow,
|
|
40
41
|
ClearingForm,
|
|
41
42
|
CommercialDeposits,
|
|
42
43
|
CommercialLending,
|
|
44
|
+
CommercialPremiumFinance,
|
|
43
45
|
ContactCompany,
|
|
44
46
|
ContactCompanyTitle,
|
|
45
47
|
ContactUs,
|
package/dist/main.js
CHANGED
|
@@ -87,6 +87,7 @@ import { ScheduleCallPremier } from "./Forms/ScheduleCallPremier.js";
|
|
|
87
87
|
import { SuccesFormWrapper } from "./Forms/SuccesForm.js";
|
|
88
88
|
import { VendorQuestionnaire } from "./Forms/VendorQuestionnaire.js";
|
|
89
89
|
import { WCPLSurvey } from "./Forms/WcplSurvey.js";
|
|
90
|
+
import { CommercialPremiumFinance } from "./Forms/CommercialPremiumFinance.js";
|
|
90
91
|
import { helpArticle_container, helpArticle_headline, helpArticle_p, insight_headline_2 } from "./HelpArticle/HelpArticle.css.js";
|
|
91
92
|
import { HeroBanner } from "./HeroBanner/HeroBanner.js";
|
|
92
93
|
import { headline_text, heroSupertag, hero_banner, hero_btns, hero_content, hero_embedded_image, hero_img, hero_text, hero_wrapper, img_contents, logout, reversed, reversed_lg_image } from "./HeroBanner/HeroBanner.css.js";
|
|
@@ -250,6 +251,7 @@ export {
|
|
|
250
251
|
CollectInformationAlert,
|
|
251
252
|
CommercialDeposits,
|
|
252
253
|
CommercialLending,
|
|
254
|
+
CommercialPremiumFinance,
|
|
253
255
|
ComparisonSet,
|
|
254
256
|
ContactCompany,
|
|
255
257
|
ContactCompanyTitle,
|