@axos-web-dev/shared-components 2.0.0-dev.18 → 2.0.0-dev.19
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.
|
@@ -21,7 +21,10 @@ export type BoatMooringLocationInputs = {
|
|
|
21
21
|
extraState: string;
|
|
22
22
|
extraZip: string;
|
|
23
23
|
extraCountry: string;
|
|
24
|
-
charterType: "Limited Charter" | "Full-time Charter";
|
|
24
|
+
charterType: "Limited Charter" | "Full-time Charter" | "";
|
|
25
25
|
charterCompany: string;
|
|
26
|
+
insuranceCompanyName: string;
|
|
27
|
+
insurancePolicyExpirationDate: string;
|
|
28
|
+
insuranceContactEmailAddress: string;
|
|
26
29
|
};
|
|
27
30
|
export declare const BoatMooringLocation: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, callToAction, validateEmail, onValidate, description, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -53,8 +53,12 @@ const BoatMooringLocation = ({
|
|
|
53
53
|
const cachedEmailValidator = useCachedEmailValidator(validateEmail);
|
|
54
54
|
const schema = z.object({
|
|
55
55
|
email: z.string().email({ message: "Email is required." }).refine(cachedEmailValidator, { message: "Invalid email address." }),
|
|
56
|
-
firstName: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g
|
|
57
|
-
|
|
56
|
+
firstName: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
|
|
57
|
+
message: "First Name is required."
|
|
58
|
+
}).trim().min(1, { message: "First Name is required." }),
|
|
59
|
+
lastName: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
|
|
60
|
+
message: "Last Name is required."
|
|
61
|
+
}).trim().min(1, { message: "Last Name is required." }),
|
|
58
62
|
boatOwnedByLlc: z.string().trim().optional().or(z.literal("")),
|
|
59
63
|
llcName: z.string().trim().optional().or(z.literal("")),
|
|
60
64
|
boatName: z.string().trim(),
|
|
@@ -73,7 +77,16 @@ const BoatMooringLocation = ({
|
|
|
73
77
|
extraZip: z.string().trim().optional().or(z.literal("")),
|
|
74
78
|
extraCountry: z.string().trim().optional().or(z.literal("")),
|
|
75
79
|
charterType: z.string().trim().optional().or(z.literal("")),
|
|
76
|
-
charterCompany: z.string().trim().optional().or(z.literal(""))
|
|
80
|
+
charterCompany: z.string().trim().optional().or(z.literal("")),
|
|
81
|
+
insuranceCompanyName: z.string().trim().optional().or(z.literal("")),
|
|
82
|
+
insurancePolicyExpirationDate: z.string().trim().optional().or(z.literal("")),
|
|
83
|
+
insuranceContactEmailAddress: z.string().trim().email({ message: "Invalid email address." }).optional().or(z.literal("")).refine(
|
|
84
|
+
async (value) => {
|
|
85
|
+
if (!value) return true;
|
|
86
|
+
return await cachedEmailValidator(value);
|
|
87
|
+
},
|
|
88
|
+
{ message: "Invalid email address." }
|
|
89
|
+
)
|
|
77
90
|
});
|
|
78
91
|
const gen_schema = schema.merge(honeyPotSchema).superRefine((data, ctx) => {
|
|
79
92
|
if (!isValidHoneyPot(data)) {
|
|
@@ -89,6 +102,29 @@ const BoatMooringLocation = ({
|
|
|
89
102
|
path: ["llcName"]
|
|
90
103
|
});
|
|
91
104
|
}
|
|
105
|
+
if (data.charter === "No") {
|
|
106
|
+
if (!String(data.insuranceCompanyName ?? "").trim()) {
|
|
107
|
+
ctx.addIssue({
|
|
108
|
+
code: z.ZodIssueCode.custom,
|
|
109
|
+
message: "Insurance Company Name is required.",
|
|
110
|
+
path: ["insuranceCompanyName"]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (!String(data.insurancePolicyExpirationDate ?? "").trim()) {
|
|
114
|
+
ctx.addIssue({
|
|
115
|
+
code: z.ZodIssueCode.custom,
|
|
116
|
+
message: "Insurance Policy Expiration Date is required.",
|
|
117
|
+
path: ["insurancePolicyExpirationDate"]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (!String(data.insuranceContactEmailAddress ?? "").trim()) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
code: z.ZodIssueCode.custom,
|
|
123
|
+
message: "Insurance Contact Email Address is required.",
|
|
124
|
+
path: ["insuranceContactEmailAddress"]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
92
128
|
});
|
|
93
129
|
const methods = useForm({
|
|
94
130
|
resolver: zodResolver(gen_schema),
|
|
@@ -105,10 +141,11 @@ const BoatMooringLocation = ({
|
|
|
105
141
|
formState: { errors, isValid, isSubmitting }
|
|
106
142
|
} = methods;
|
|
107
143
|
const seasonMove = watch("seasonallyMove");
|
|
108
|
-
const
|
|
144
|
+
const charter = watch("charter");
|
|
109
145
|
const boatOwnedByLlc = watch("boatOwnedByLlc");
|
|
110
146
|
const renderExtraFields = seasonMove === "Yes";
|
|
111
|
-
const renderCharterFields =
|
|
147
|
+
const renderCharterFields = charter === "Yes";
|
|
148
|
+
const renderInsuranceFields = charter === "No";
|
|
112
149
|
const renderLlcNameField = boatOwnedByLlc === "Yes";
|
|
113
150
|
const submitForm = async (data) => {
|
|
114
151
|
await onSubmit(data);
|
|
@@ -151,7 +188,7 @@ const BoatMooringLocation = ({
|
|
|
151
188
|
label: "First Name",
|
|
152
189
|
sizes: "medium",
|
|
153
190
|
required: true,
|
|
154
|
-
error: !!errors.
|
|
191
|
+
error: !!errors.firstName,
|
|
155
192
|
helperText: errors.firstName?.message,
|
|
156
193
|
variant
|
|
157
194
|
}
|
|
@@ -166,7 +203,7 @@ const BoatMooringLocation = ({
|
|
|
166
203
|
label: "Last Name",
|
|
167
204
|
sizes: "medium",
|
|
168
205
|
required: true,
|
|
169
|
-
error: !!errors.
|
|
206
|
+
error: !!errors.lastName,
|
|
170
207
|
helperText: errors.lastName?.message,
|
|
171
208
|
variant
|
|
172
209
|
}
|
|
@@ -217,6 +254,7 @@ const BoatMooringLocation = ({
|
|
|
217
254
|
Input,
|
|
218
255
|
{
|
|
219
256
|
id: "marinaAddress2",
|
|
257
|
+
...register("marinaAddress2"),
|
|
220
258
|
label: "Marina Address Line 2 (optional)",
|
|
221
259
|
sizes: "medium",
|
|
222
260
|
required: false,
|
|
@@ -370,6 +408,7 @@ const BoatMooringLocation = ({
|
|
|
370
408
|
Input,
|
|
371
409
|
{
|
|
372
410
|
id: "extraMarinaAddress2",
|
|
411
|
+
...register("extraMarinaAddress2"),
|
|
373
412
|
label: "Marina Address Line 2 (optional)",
|
|
374
413
|
sizes: "medium",
|
|
375
414
|
required: false,
|
|
@@ -430,7 +469,7 @@ const BoatMooringLocation = ({
|
|
|
430
469
|
RadioButtonSet,
|
|
431
470
|
{
|
|
432
471
|
id: "charter",
|
|
433
|
-
label: "Is your boat
|
|
472
|
+
label: "Is your boat in charter?",
|
|
434
473
|
sizes: "medium",
|
|
435
474
|
required: true,
|
|
436
475
|
error: !!errors.charter,
|
|
@@ -504,6 +543,48 @@ const BoatMooringLocation = ({
|
|
|
504
543
|
}
|
|
505
544
|
) })
|
|
506
545
|
] }),
|
|
546
|
+
renderInsuranceFields && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
547
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
548
|
+
Input,
|
|
549
|
+
{
|
|
550
|
+
id: "insuranceCompanyName",
|
|
551
|
+
...register("insuranceCompanyName"),
|
|
552
|
+
label: "Insurance Company Name",
|
|
553
|
+
sizes: "medium",
|
|
554
|
+
required: true,
|
|
555
|
+
error: !!errors.insuranceCompanyName,
|
|
556
|
+
helperText: errors.insuranceCompanyName?.message,
|
|
557
|
+
variant
|
|
558
|
+
}
|
|
559
|
+
) }),
|
|
560
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
561
|
+
Input,
|
|
562
|
+
{
|
|
563
|
+
id: "insurancePolicyExpirationDate",
|
|
564
|
+
...register("insurancePolicyExpirationDate"),
|
|
565
|
+
label: "Insurance Policy Expiration Date",
|
|
566
|
+
sizes: "medium",
|
|
567
|
+
type: "date",
|
|
568
|
+
required: true,
|
|
569
|
+
error: !!errors.insurancePolicyExpirationDate,
|
|
570
|
+
helperText: errors.insurancePolicyExpirationDate?.message,
|
|
571
|
+
variant
|
|
572
|
+
}
|
|
573
|
+
) }),
|
|
574
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
575
|
+
Input,
|
|
576
|
+
{
|
|
577
|
+
id: "insuranceContactEmailAddress",
|
|
578
|
+
...register("insuranceContactEmailAddress"),
|
|
579
|
+
label: "Insurance Contact Email Address",
|
|
580
|
+
sizes: "medium",
|
|
581
|
+
required: true,
|
|
582
|
+
error: !!errors.insuranceContactEmailAddress,
|
|
583
|
+
helperText: errors.insuranceContactEmailAddress?.message,
|
|
584
|
+
variant
|
|
585
|
+
}
|
|
586
|
+
) })
|
|
587
|
+
] }),
|
|
507
588
|
/* @__PURE__ */ jsx(HoneyPot, { register, variant })
|
|
508
589
|
] }),
|
|
509
590
|
children,
|