@axos-web-dev/shared-components 2.2.28 → 2.2.29

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.
@@ -73,8 +73,8 @@ import "../Carousel/index.js";
73
73
  /* empty css */
74
74
  import "../Chatbot/store/chat.js";
75
75
  import "../Chatbot/Chatbot.js";
76
- import "../LoadingIndicator/LoadingIndicator.css.js";
77
76
  import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
77
+ import "../LoadingIndicator/LoadingIndicator.css.js";
78
78
  /* empty css */
79
79
  import "../Chatbot/store/messages.js";
80
80
  import { Hyperlink } from "../Hyperlink/index.js";
@@ -54,9 +54,9 @@ import "../Carousel/index.js";
54
54
  /* empty css */
55
55
  import "../Chatbot/store/chat.js";
56
56
  import "../Chatbot/Chatbot.js";
57
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
57
58
  import "../LoadingIndicator/LoadingIndicator.css.js";
58
59
  import "react-use";
59
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
60
60
  /* empty css */
61
61
  import "../Chatbot/store/messages.js";
62
62
  /* empty css */
@@ -3,7 +3,6 @@ import '../assets/Chatbot/ChatWindow.css';import '../assets/Typography/Typograph
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  /* empty css */
6
- import "./Chatbot.css.ts.vanilla.css.js";
7
6
  /* empty css */
8
7
  var windowStyle = "_13n1jqk1";
9
8
  var windowExpandedStyle = "_13n1jqk2";
@@ -1,3 +1,4 @@
1
+ import "./Chatbot.css.ts.vanilla.css.js";
1
2
  var chatbotAXB = "_1hpv6vm0";
2
3
  var chatbotUFB = "_1hpv6vm1";
3
4
  export {
@@ -52,6 +52,40 @@ const ContactUsSchwabAAS = ({
52
52
  id
53
53
  }) => {
54
54
  const cachedEmailValidator = useCachedEmailValidator(validateEmail);
55
+ const isOptionalFieldsMode = typeof window !== "undefined" && new URLSearchParams(window.location.search).get("type")?.toLowerCase() === "optional";
56
+ const phoneSchema = isOptionalFieldsMode ? z.string().trim().optional().or(z.literal("")).refine((val) => val == null || val === "" || /[\d-]{10}/.test(val), {
57
+ message: "Invalid phone number."
58
+ }).transform((val) => {
59
+ if (!val) return "";
60
+ const removeDashes = val.replace(/-/gi, "");
61
+ if (removeDashes.length !== 10) {
62
+ return z.NEVER;
63
+ }
64
+ if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
65
+ return z.NEVER;
66
+ }
67
+ return removeDashes;
68
+ }) : 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) => {
69
+ const removeDashes = val.replace(/-/gi, "");
70
+ if (removeDashes.length !== 10) {
71
+ ctx.addIssue({
72
+ code: z.ZodIssueCode.custom,
73
+ message: "Phone must have at least 10 and no more than 10 characters."
74
+ });
75
+ return z.NEVER;
76
+ }
77
+ if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
78
+ ctx.addIssue({
79
+ code: z.ZodIssueCode.custom,
80
+ message: "Invalid phone number."
81
+ });
82
+ return z.NEVER;
83
+ }
84
+ return removeDashes;
85
+ });
86
+ const roleSchema = isOptionalFieldsMode ? z.string().trim().optional().or(z.literal("")).refine((val) => val == null || val === "" || Roles.includes(val), {
87
+ message: "Role is required"
88
+ }) : z.string().min(1, { message: "Role is required." }).refine((val) => Roles.includes(val), "Role is required");
55
89
  const schema = z.object({
56
90
  first_name: z.string({ message: "First name is required." }).regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
57
91
  message: "Invalid first name"
@@ -60,29 +94,12 @@ const ContactUsSchwabAAS = ({
60
94
  message: "Invalid last name"
61
95
  }).trim().min(1, { message: "Last Name is required." }),
62
96
  email: z.string({ message: "Email is required." }).email({ message: "Email is required." }).refine(cachedEmailValidator, { message: "Invalid email address." }),
63
- 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) => {
64
- const removeDashes = val.replace(/-/gi, "");
65
- if (removeDashes.length !== 10) {
66
- ctx.addIssue({
67
- code: z.ZodIssueCode.custom,
68
- message: "Phone must have at least 10 and no more than 10 characters."
69
- });
70
- return z.NEVER;
71
- }
72
- if (removeDashes.endsWith("00000") || removeDashes.startsWith("999") || removeDashes.length === 10 && /^[01]/.test(removeDashes)) {
73
- ctx.addIssue({
74
- code: z.ZodIssueCode.custom,
75
- message: "Invalid phone number."
76
- });
77
- return z.NEVER;
78
- }
79
- return removeDashes;
80
- }),
97
+ phone: phoneSchema,
81
98
  company: z.string().regex(/^[A-Za-z][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*,.^(){}|~<>;:[\]]{1,}$/g, {
82
99
  message: "Invalid company name"
83
100
  }).trim().optional().or(z.literal("")),
84
101
  Current_Assets_Under_Management__c: z.union([z.string(), z.undefined()]),
85
- Role__c: z.string().min(1, { message: "Role is required." }).refine((val) => Roles.includes(val), "Role is required"),
102
+ Role__c: roleSchema,
86
103
  description: z.optional(z.string().trim().max(32e3))
87
104
  });
88
105
  const gen_schema = schema.merge(SalesforceSchema).merge(honeyPotSchema).superRefine((data, ctx) => {
@@ -183,14 +200,14 @@ const ContactUsSchwabAAS = ({
183
200
  {
184
201
  id: "phone",
185
202
  ...register("phone", {
186
- required: true,
203
+ required: !isOptionalFieldsMode,
187
204
  maxLength: 12
188
205
  }),
189
- label: "Phone*",
206
+ label: isOptionalFieldsMode ? "Phone" : "Phone*",
190
207
  sizes: "medium",
191
208
  placeholder: "",
192
209
  type: "tel",
193
- required: true,
210
+ required: !isOptionalFieldsMode,
194
211
  error: !!errors.phone,
195
212
  helperText: errors.phone?.message,
196
213
  variant
@@ -214,15 +231,15 @@ const ContactUsSchwabAAS = ({
214
231
  {
215
232
  id: "Role__c",
216
233
  ...register("Role__c", {
217
- required: true
234
+ required: !isOptionalFieldsMode
218
235
  }),
219
- label: "What best describes your role?*",
236
+ label: isOptionalFieldsMode ? "What best describes your role?" : "What best describes your role?*",
220
237
  sizes: "medium",
221
- required: true,
238
+ required: !isOptionalFieldsMode,
222
239
  error: !!errors.Role__c,
223
240
  helperText: errors.Role__c?.message,
224
241
  variant,
225
- defaultValue: "Select option",
242
+ defaultValue: isOptionalFieldsMode ? "" : "Select option",
226
243
  children: [
227
244
  /* @__PURE__ */ jsx("option", { value: "Select option", disabled: true, children: "Select Option" }),
228
245
  /* @__PURE__ */ jsx("option", { value: "RIA Principal", children: "RIA Principal" }),
@@ -69,9 +69,9 @@ import "../Carousel/index.js";
69
69
  /* empty css */
70
70
  import "../Chatbot/store/chat.js";
71
71
  import "../Chatbot/Chatbot.js";
72
+ import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
72
73
  import "../LoadingIndicator/LoadingIndicator.css.js";
73
74
  import "react-use";
74
- import "../Chatbot/Chatbot.css.ts.vanilla.css.js";
75
75
  /* empty css */
76
76
  import "../Chatbot/store/messages.js";
77
77
  /* empty css */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axos-web-dev/shared-components",
3
3
  "description": "Axos shared components library for web.",
4
- "version": "2.2.28",
4
+ "version": "2.2.29",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.js",