@axos-web-dev/shared-components 1.0.99-dev.1 → 1.0.99-dev.12

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 (106) hide show
  1. package/dist/ATMLocator/ATMLocator.js +1 -0
  2. package/dist/Auth/ErrorAlert.js +1 -0
  3. package/dist/Button/Button.js +1 -0
  4. package/dist/Calculators/BuyDownCalculator/index.js +1 -1
  5. package/dist/Calculators/Calculator.d.ts +3 -1
  6. package/dist/Calculators/Calculator.js +5 -2
  7. package/dist/Calculators/MonthlyPaymentCalculator/index.d.ts +3 -1
  8. package/dist/Calculators/MonthlyPaymentCalculator/index.js +23 -15
  9. package/dist/Carousel/index.js +1 -0
  10. package/dist/Chevron/index.js +1 -0
  11. package/dist/Comparison/Comparison.js +1 -0
  12. package/dist/ExecutiveBio/ExecutiveBio.js +1 -0
  13. package/dist/FaqAccordion/index.js +1 -0
  14. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +1 -0
  15. package/dist/Forms/ApplicationStart.d.ts +1 -1
  16. package/dist/Forms/ApplicationStart.js +111 -89
  17. package/dist/Forms/ApplyNow.d.ts +2 -2
  18. package/dist/Forms/ApplyNow.js +164 -139
  19. package/dist/Forms/ClearingForm.d.ts +1 -1
  20. package/dist/Forms/ClearingForm.js +184 -162
  21. package/dist/Forms/CommercialDeposits.d.ts +1 -1
  22. package/dist/Forms/CommercialDeposits.js +201 -179
  23. package/dist/Forms/CommercialLending.d.ts +1 -1
  24. package/dist/Forms/CommercialLending.js +278 -256
  25. package/dist/Forms/CommercialPremiumFinance.d.ts +1 -1
  26. package/dist/Forms/CommercialPremiumFinance.js +128 -106
  27. package/dist/Forms/ContactCompany.d.ts +1 -1
  28. package/dist/Forms/ContactCompany.js +113 -91
  29. package/dist/Forms/ContactCompanyTitle.d.ts +1 -1
  30. package/dist/Forms/ContactCompanyTitle.js +127 -105
  31. package/dist/Forms/ContactUs.d.ts +1 -1
  32. package/dist/Forms/ContactUs.js +99 -77
  33. package/dist/Forms/ContactUsAAS.d.ts +1 -1
  34. package/dist/Forms/ContactUsAAS.js +180 -158
  35. package/dist/Forms/ContactUsBusiness.d.ts +1 -1
  36. package/dist/Forms/ContactUsBusiness.js +134 -112
  37. package/dist/Forms/ContactUsBusinessNameEmail.d.ts +1 -1
  38. package/dist/Forms/ContactUsBusinessNameEmail.js +103 -81
  39. package/dist/Forms/ContactUsLVF.d.ts +3 -1
  40. package/dist/Forms/ContactUsLVF.js +127 -101
  41. package/dist/Forms/ContactUsNMLSId.d.ts +1 -1
  42. package/dist/Forms/ContactUsNMLSId.js +117 -95
  43. package/dist/Forms/CpraRequest.d.ts +1 -1
  44. package/dist/Forms/CpraRequest.js +641 -619
  45. package/dist/Forms/CraPublicFile.d.ts +1 -1
  46. package/dist/Forms/CraPublicFile.js +109 -87
  47. package/dist/Forms/DealerServices.d.ts +1 -1
  48. package/dist/Forms/DealerServices.js +225 -204
  49. package/dist/Forms/EmailOnly.d.ts +1 -1
  50. package/dist/Forms/EmailOnly.js +56 -36
  51. package/dist/Forms/EmailUs.d.ts +1 -1
  52. package/dist/Forms/EmailUs.js +75 -53
  53. package/dist/Forms/FormProps.d.ts +3 -0
  54. package/dist/Forms/Forms.css.d.ts +18 -0
  55. package/dist/Forms/Forms.css.js +44 -38
  56. package/dist/Forms/HoneyPot/HoneyPot.css.d.ts +1 -0
  57. package/dist/Forms/HoneyPot/HoneyPot.css.js +5 -0
  58. package/dist/Forms/HoneyPot/index.d.ts +24 -0
  59. package/dist/Forms/HoneyPot/index.js +71 -0
  60. package/dist/Forms/MortgageRate/MortgageRateForm.d.ts +1 -1
  61. package/dist/Forms/MortgageRate/MortgageRateForm.js +363 -342
  62. package/dist/Forms/MortgageRate/MortgageRateWatch.js +1 -0
  63. package/dist/Forms/QuickPricer/QuickPricerForm.d.ts +1 -1
  64. package/dist/Forms/QuickPricer/QuickPricerForm.js +624 -609
  65. package/dist/Forms/ScheduleCall.d.ts +1 -1
  66. package/dist/Forms/ScheduleCall.js +156 -134
  67. package/dist/Forms/ScheduleCallPremier.d.ts +1 -1
  68. package/dist/Forms/ScheduleCallPremier.js +178 -156
  69. package/dist/Forms/SuccesForm.js +1 -0
  70. package/dist/Forms/VendorQuestionnaire.d.ts +1 -1
  71. package/dist/Forms/VendorQuestionnaire.js +817 -795
  72. package/dist/Forms/WcplSurvey.d.ts +1 -1
  73. package/dist/Forms/WcplSurvey.js +112 -90
  74. package/dist/Forms/applynow-utils.d.ts +1 -0
  75. package/dist/Forms/applynow-utils.js +48 -0
  76. package/dist/Forms/index.d.ts +2 -0
  77. package/dist/Forms/index.js +10 -2
  78. package/dist/Hyperlink/index.js +1 -0
  79. package/dist/IconBillboard/sections/CallToActionSection.js +2 -1
  80. package/dist/ImageLink/ImageLink.js +1 -0
  81. package/dist/ImageLink/ImageLinkSet.js +1 -0
  82. package/dist/ImageLink/index.js +1 -0
  83. package/dist/Input/Input.js +3 -1
  84. package/dist/Insight/Featured/CategorySelector.js +1 -0
  85. package/dist/Insight/Featured/Featured.js +1 -0
  86. package/dist/Insight/Featured/Header.js +1 -0
  87. package/dist/Modal/Modal.js +1 -0
  88. package/dist/NavigationMenu/AxosALTS/NavData.js +1 -0
  89. package/dist/NavigationMenu/AxosALTS/index.js +1 -0
  90. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +13 -4
  91. package/dist/NavigationMenu/AxosBank/NavData.js +1 -0
  92. package/dist/NavigationMenu/AxosBank/SubNavBar.js +14 -5
  93. package/dist/NavigationMenu/AxosBank/index.js +1 -0
  94. package/dist/NavigationMenu/LaVictoire/NavData.js +1 -0
  95. package/dist/NavigationMenu/LaVictoire/index.js +1 -0
  96. package/dist/NavigationMenu/NavDataJson.js +1 -0
  97. package/dist/NavigationMenu/Navbar.js +1 -0
  98. package/dist/NavigationMenu/SignInNavButton.js +1 -0
  99. package/dist/SetContainer/SetContainer.js +1 -0
  100. package/dist/SocialMediaBar/iconsRepository.js +1 -0
  101. package/dist/VideoTile/VideoTile.js +1 -0
  102. package/dist/VideoWrapper/index.js +1 -0
  103. package/dist/assets/Forms/Forms.css +136 -105
  104. package/dist/assets/Forms/HoneyPot/HoneyPot.css +4 -0
  105. package/dist/main.js +10 -2
  106. package/package.json +1 -1
@@ -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 DealerServices = ({
37
38
  icon = false,
@@ -45,13 +46,13 @@ const DealerServices = ({
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." }),
54
- // .refine(async (val: string) => await validateEmail(val)),
55
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) => {
56
57
  const removeDashes = val.replace(/-/gi, "");
57
58
  if (removeDashes.length !== 10) {
@@ -81,8 +82,16 @@ const DealerServices = ({
81
82
  zip: z.string().trim().max(20).min(1, { message: "Zip code is required." }),
82
83
  description: z.string().trim().max(32e3)
83
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
+ });
84
93
  const methods = useForm({
85
- resolver: zodResolver(schema.merge(SalesforceSchema), {
94
+ resolver: zodResolver(gen_schema, {
86
95
  async: true
87
96
  }),
88
97
  mode: "all",
@@ -118,209 +127,221 @@ const DealerServices = ({
118
127
  }
119
128
  )
120
129
  ] }),
121
- /* @__PURE__ */ jsxs("form", { className: form, onSubmit: handleSubmit(submitForm), children: [
122
- /* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
123
- /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx(
124
- Input,
125
- {
126
- id: "first_name",
127
- ...register("first_name", { required: true }),
128
- label: "First Name",
129
- sizes: "medium",
130
- placeholder: "First Name",
131
- required: true,
132
- error: !!errors.first_name,
133
- helperText: errors.first_name?.message,
134
- variant
135
- }
136
- ) }),
137
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
138
- Input,
139
- {
140
- id: "last_name",
141
- ...register("last_name", { required: true }),
142
- label: "Last Name",
143
- sizes: "medium",
144
- placeholder: "Last Name",
145
- required: true,
146
- error: !!errors.last_name,
147
- helperText: errors.last_name?.message,
148
- variant
149
- }
150
- ) }),
151
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
152
- Input,
153
- {
154
- id: "email",
155
- ...register("email", {
156
- required: true,
157
- validate: {
158
- isValid: async (val) => await associatedEmail(val) && await validateEmail(val)
130
+ /* @__PURE__ */ jsxs(
131
+ "form",
132
+ {
133
+ className: form,
134
+ onSubmit: async (e) => {
135
+ onValidate && onValidate(e);
136
+ await handleSubmit(submitForm)(e);
137
+ e.preventDefault();
138
+ },
139
+ children: [
140
+ /* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant })), children: [
141
+ /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx(
142
+ Input,
143
+ {
144
+ id: "first_name",
145
+ ...register("first_name", { required: true }),
146
+ label: "First Name",
147
+ sizes: "medium",
148
+ placeholder: "First Name",
149
+ required: true,
150
+ error: !!errors.first_name,
151
+ helperText: errors.first_name?.message,
152
+ variant
159
153
  }
160
- }),
161
- label: "Email",
162
- sizes: "medium",
163
- placeholder: "Email",
164
- required: true,
165
- error: !!errors.email,
166
- helperText: errors.email?.message,
167
- variant
168
- }
169
- ) }),
170
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
171
- InputPhone,
172
- {
173
- id: "phone",
174
- ...register("phone", { required: true, maxLength: 12 }),
175
- label: "Phone",
176
- sizes: "medium",
177
- placeholder: "Phone",
178
- required: true,
179
- error: !!errors.phone,
180
- helperText: errors.phone?.message,
181
- variant
182
- }
183
- ) }),
184
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
185
- Input,
186
- {
187
- id: "title",
188
- ...register("title", { required: true }),
189
- label: "Title",
190
- sizes: "medium",
191
- placeholder: "Title",
192
- required: true,
193
- error: !!errors.title,
194
- helperText: errors.title?.message,
195
- variant
196
- }
197
- ) }),
198
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
199
- Input,
200
- {
201
- id: "company",
202
- ...register("company", { required: true }),
203
- label: "Company Name",
204
- sizes: "medium",
205
- placeholder: "Company Name",
206
- required: true,
207
- error: !!errors.company,
208
- helperText: errors.company?.message,
209
- variant
210
- }
211
- ) }),
212
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
213
- Dropdown,
214
- {
215
- id: "Dealer_Type__c",
216
- ...register("Dealer_Type__c", {
217
- required: true,
218
- maxLength: 12
219
- }),
220
- label: "Franchise or Independent",
221
- sizes: "medium",
222
- required: true,
223
- error: !!errors.Dealer_Type__c,
224
- helperText: errors.Dealer_Type__c?.message,
225
- variant,
226
- defaultValue: "Franchise",
227
- children: [
228
- /* @__PURE__ */ jsx("option", { value: "Franchise", children: "Franchise" }),
229
- /* @__PURE__ */ jsx("option", { value: "Independent", children: "Independent" })
230
- ]
231
- }
232
- ) }),
233
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
234
- Dropdown,
235
- {
236
- id: "Lead_Source_Detail_SFDC2__c2",
237
- ...register("Lead_Source_Detail_SFDC2__c2", {
238
- required: true,
239
- maxLength: 12
240
- }),
241
- label: "Dealer Services or Collector Car Program",
242
- sizes: "medium",
243
- required: true,
244
- error: !!errors.Lead_Source_Detail_SFDC2__c2,
245
- helperText: errors.Lead_Source_Detail_SFDC2__c2?.message,
246
- variant,
247
- defaultValue: "Dealer Services",
248
- children: [
249
- /* @__PURE__ */ jsx("option", { value: "Dealer Services", children: "Dealer Services" }),
250
- /* @__PURE__ */ jsx("option", { value: "Collector Car Program", children: "Collector Car Program" })
251
- ]
252
- }
253
- ) }),
254
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
255
- Input,
256
- {
257
- id: "city",
258
- ...register("city", { required: true }),
259
- label: "City",
260
- sizes: "medium",
261
- placeholder: "City",
262
- required: true,
263
- error: !!errors.city,
264
- helperText: errors.city?.message,
265
- variant
266
- }
267
- ) }),
268
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
269
- Input,
270
- {
271
- id: "state",
272
- ...register("state", { required: true }),
273
- label: "State",
274
- sizes: "medium",
275
- placeholder: "State",
276
- required: true,
277
- error: !!errors.state,
278
- helperText: errors.state?.message,
279
- variant
280
- }
281
- ) }),
282
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
283
- Input,
284
- {
285
- id: "zip",
286
- ...register("zip", { required: true }),
287
- label: "Zip Code",
288
- sizes: "medium",
289
- placeholder: "Zip Code",
290
- required: true,
291
- error: !!errors.zip,
292
- helperText: errors.zip?.message,
293
- variant
294
- }
295
- ) }),
296
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
297
- InputTextArea,
298
- {
299
- id: "description",
300
- ...register("description"),
301
- label: "Additional Details",
302
- sizes: "medium",
303
- placeholder: "Additional Details",
304
- error: !!errors.description,
305
- helperText: errors.description?.message,
306
- variant,
307
- rows: 1
308
- }
309
- ) })
310
- ] }),
311
- children,
312
- /* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
313
- /* @__PURE__ */ jsx("div", { className: actions, children: /* @__PURE__ */ jsx(
314
- Button,
315
- {
316
- color: getVariant(callToAction?.variant),
317
- as: "button",
318
- type: "submit",
319
- disabled: !isValid || isSubmitting,
320
- children: callToAction?.displayText
321
- }
322
- ) })
323
- ] })
154
+ ) }),
155
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
156
+ Input,
157
+ {
158
+ id: "last_name",
159
+ ...register("last_name", { required: true }),
160
+ label: "Last Name",
161
+ sizes: "medium",
162
+ placeholder: "Last Name",
163
+ required: true,
164
+ error: !!errors.last_name,
165
+ helperText: errors.last_name?.message,
166
+ variant
167
+ }
168
+ ) }),
169
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
170
+ Input,
171
+ {
172
+ id: "email",
173
+ ...register("email", {
174
+ required: true,
175
+ validate: {
176
+ isValid: async (val) => await associatedEmail(val) && await validateEmail(val)
177
+ }
178
+ }),
179
+ label: "Email",
180
+ sizes: "medium",
181
+ placeholder: "Email",
182
+ required: true,
183
+ error: !!errors.email,
184
+ helperText: errors.email?.message,
185
+ variant
186
+ }
187
+ ) }),
188
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
189
+ InputPhone,
190
+ {
191
+ id: "phone",
192
+ ...register("phone", { required: true, maxLength: 12 }),
193
+ label: "Phone",
194
+ sizes: "medium",
195
+ placeholder: "Phone",
196
+ required: true,
197
+ error: !!errors.phone,
198
+ helperText: errors.phone?.message,
199
+ variant
200
+ }
201
+ ) }),
202
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
203
+ Input,
204
+ {
205
+ id: "title",
206
+ ...register("title", { required: true }),
207
+ label: "Title",
208
+ sizes: "medium",
209
+ placeholder: "Title",
210
+ required: true,
211
+ error: !!errors.title,
212
+ helperText: errors.title?.message,
213
+ variant
214
+ }
215
+ ) }),
216
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
217
+ Input,
218
+ {
219
+ id: "company",
220
+ ...register("company", { required: true }),
221
+ label: "Company Name",
222
+ sizes: "medium",
223
+ placeholder: "Company Name",
224
+ required: true,
225
+ error: !!errors.company,
226
+ helperText: errors.company?.message,
227
+ variant
228
+ }
229
+ ) }),
230
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
231
+ Dropdown,
232
+ {
233
+ id: "Dealer_Type__c",
234
+ ...register("Dealer_Type__c", {
235
+ required: true,
236
+ maxLength: 12
237
+ }),
238
+ label: "Franchise or Independent",
239
+ sizes: "medium",
240
+ required: true,
241
+ error: !!errors.Dealer_Type__c,
242
+ helperText: errors.Dealer_Type__c?.message,
243
+ variant,
244
+ defaultValue: "Franchise",
245
+ children: [
246
+ /* @__PURE__ */ jsx("option", { value: "Franchise", children: "Franchise" }),
247
+ /* @__PURE__ */ jsx("option", { value: "Independent", children: "Independent" })
248
+ ]
249
+ }
250
+ ) }),
251
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
252
+ Dropdown,
253
+ {
254
+ id: "Lead_Source_Detail_SFDC2__c2",
255
+ ...register("Lead_Source_Detail_SFDC2__c2", {
256
+ required: true,
257
+ maxLength: 12
258
+ }),
259
+ label: "Dealer Services or Collector Car Program",
260
+ sizes: "medium",
261
+ required: true,
262
+ error: !!errors.Lead_Source_Detail_SFDC2__c2,
263
+ helperText: errors.Lead_Source_Detail_SFDC2__c2?.message,
264
+ variant,
265
+ defaultValue: "Dealer Services",
266
+ children: [
267
+ /* @__PURE__ */ jsx("option", { value: "Dealer Services", children: "Dealer Services" }),
268
+ /* @__PURE__ */ jsx("option", { value: "Collector Car Program", children: "Collector Car Program" })
269
+ ]
270
+ }
271
+ ) }),
272
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
273
+ Input,
274
+ {
275
+ id: "city",
276
+ ...register("city", { required: true }),
277
+ label: "City",
278
+ sizes: "medium",
279
+ placeholder: "City",
280
+ required: true,
281
+ error: !!errors.city,
282
+ helperText: errors.city?.message,
283
+ variant
284
+ }
285
+ ) }),
286
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
287
+ Input,
288
+ {
289
+ id: "state",
290
+ ...register("state", { required: true }),
291
+ label: "State",
292
+ sizes: "medium",
293
+ placeholder: "State",
294
+ required: true,
295
+ error: !!errors.state,
296
+ helperText: errors.state?.message,
297
+ variant
298
+ }
299
+ ) }),
300
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
301
+ Input,
302
+ {
303
+ id: "zip",
304
+ ...register("zip", { required: true }),
305
+ label: "Zip Code",
306
+ sizes: "medium",
307
+ placeholder: "Zip Code",
308
+ required: true,
309
+ error: !!errors.zip,
310
+ helperText: errors.zip?.message,
311
+ variant
312
+ }
313
+ ) }),
314
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
315
+ InputTextArea,
316
+ {
317
+ id: "description",
318
+ ...register("description"),
319
+ label: "Additional Details",
320
+ sizes: "medium",
321
+ placeholder: "Additional Details",
322
+ error: !!errors.description,
323
+ helperText: errors.description?.message,
324
+ variant,
325
+ rows: 1
326
+ }
327
+ ) }),
328
+ /* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
329
+ ] }),
330
+ children,
331
+ /* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
332
+ /* @__PURE__ */ jsx("div", { className: actions, children: /* @__PURE__ */ jsx(
333
+ Button,
334
+ {
335
+ color: getVariant(callToAction?.variant),
336
+ as: "button",
337
+ type: "submit",
338
+ disabled: !isValid || isSubmitting,
339
+ children: callToAction?.displayText
340
+ }
341
+ ) })
342
+ ]
343
+ }
344
+ )
324
345
  ] }) }) }, id);
325
346
  };
326
347
  export {
@@ -3,4 +3,4 @@ import { FormProps } from './FormProps';
3
3
  export type EmailOnlyInputs = {
4
4
  email: string;
5
5
  };
6
- export declare const EmailOnly: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const EmailOnly: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, description, callToAction, validateEmail, onValidate, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
@@ -45,6 +45,7 @@ import "../Calculators/BalanceAPYCalculator/BalanceAPYCalculator.css.js";
45
45
  import { useForm, FormProvider } from "react-hook-form";
46
46
  import { z } from "zod";
47
47
  import { iconForm, headerContainer, headerForm, form, descriptionField, formWrapper, disclosureForm, actions, formContainer } from "./Forms.css.js";
48
+ import { honeyPotSchema, isValidHoneyPot, HoneyPot } from "./HoneyPot/index.js";
48
49
  import { SalesforceSchema } from "./SalesforceFieldsForm.js";
49
50
  /* empty css */
50
51
  /* empty css */
@@ -139,18 +140,23 @@ const EmailOnly = ({
139
140
  description,
140
141
  callToAction,
141
142
  validateEmail,
143
+ onValidate,
142
144
  id
143
145
  }) => {
144
146
  const schema = z.object({
145
147
  email: z.string().email({ message: "Email is required." }).refine(async (val) => await validateEmail(val))
146
148
  });
149
+ const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
150
+ if (!isValidHoneyPot(data)) {
151
+ ctx.addIssue({
152
+ code: z.ZodIssueCode.custom,
153
+ message: "fields are not valid."
154
+ });
155
+ }
156
+ });
147
157
  const methods = useForm({
148
158
  resolver: async (data, context, options) => {
149
- return zodResolver(schema.merge(SalesforceSchema))(
150
- data,
151
- context,
152
- options
153
- );
159
+ return zodResolver(gen_schema)(data, context, options);
154
160
  },
155
161
  mode: "all",
156
162
  defaultValues: {
@@ -183,38 +189,52 @@ const EmailOnly = ({
183
189
  }
184
190
  )
185
191
  ] }),
186
- /* @__PURE__ */ jsxs("form", { className: form, onSubmit: handleSubmit(submitForm), children: [
187
- /* @__PURE__ */ jsx("div", { className: clsx(formWrapper({ variant, formType })), children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
188
- Input,
189
- {
190
- id: "email",
191
- ...register("email", {
192
- required: true,
193
- validate: {
194
- isValid: associatedEmail
192
+ /* @__PURE__ */ jsxs(
193
+ "form",
194
+ {
195
+ className: form,
196
+ onSubmit: async (e) => {
197
+ onValidate && onValidate(e);
198
+ await handleSubmit(submitForm)(e);
199
+ e.preventDefault();
200
+ },
201
+ children: [
202
+ /* @__PURE__ */ jsxs("div", { className: clsx(formWrapper({ variant, formType })), children: [
203
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
204
+ Input,
205
+ {
206
+ id: "email",
207
+ ...register("email", {
208
+ required: true,
209
+ validate: {
210
+ isValid: associatedEmail
211
+ }
212
+ }),
213
+ sizes: "medium",
214
+ placeholder: "Enter Email",
215
+ required: true,
216
+ error: !!errors.email,
217
+ helperText: errors.email?.message,
218
+ variant
219
+ }
220
+ ) }),
221
+ /* @__PURE__ */ jsx(HoneyPot, { register, errors, variant })
222
+ ] }),
223
+ children,
224
+ /* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
225
+ /* @__PURE__ */ jsx("div", { className: actions, children: /* @__PURE__ */ jsx(
226
+ Button,
227
+ {
228
+ color: getVariant(callToAction?.variant),
229
+ as: "button",
230
+ type: "submit",
231
+ disabled: !isValid || isSubmitting,
232
+ children: callToAction?.displayText
195
233
  }
196
- }),
197
- sizes: "medium",
198
- placeholder: "Enter Email",
199
- required: true,
200
- error: !!errors.email,
201
- helperText: errors.email?.message,
202
- variant
203
- }
204
- ) }) }),
205
- children,
206
- /* @__PURE__ */ jsx("div", { className: disclosureForm({ variant }), children: disclosure }),
207
- /* @__PURE__ */ jsx("div", { className: actions, children: /* @__PURE__ */ jsx(
208
- Button,
209
- {
210
- color: getVariant(callToAction?.variant),
211
- as: "button",
212
- type: "submit",
213
- disabled: !isValid || isSubmitting,
214
- children: callToAction?.displayText
215
- }
216
- ) })
217
- ] })
234
+ ) })
235
+ ]
236
+ }
237
+ )
218
238
  ] }) }) }, id);
219
239
  };
220
240
  export {
@@ -4,4 +4,4 @@ export type EmailUsInputs = {
4
4
  email: string;
5
5
  message: string;
6
6
  };
7
- export declare const EmailUs: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, callToAction, validateEmail, description, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const EmailUs: ({ icon, children, onSubmit, disclosure, variant: fullVariant, headline, callToAction, validateEmail, onValidate, description, id, }: FormProps) => import("react/jsx-runtime").JSX.Element;