@windstream/react-shared-components 0.2.45 → 0.2.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windstream/react-shared-components",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "type": "module",
5
5
  "description": "Shared React components for Kinetic applications",
6
6
  "main": "dist/index.js",
@@ -110,12 +110,14 @@
110
110
  "@types/react-modal": "3.16.3",
111
111
  "@types/react-transition-group": "4.4.12",
112
112
  "clsx": "2.1.1",
113
+ "formik": "^2.4.6",
113
114
  "framer-motion": "10.12.16",
114
115
  "js-base64": "^3.7.7",
115
116
  "js-cookie": "^3.0.5",
116
117
  "react-modal": "3.16.3",
117
118
  "react-select": "5.10.2",
118
- "react-transition-group": "4.4.5"
119
+ "react-transition-group": "4.4.5",
120
+ "yup": "^1.7.0"
119
121
  },
120
122
  "optionalDependencies": {
121
123
  "@types/js-cookie": "^3.0.6"
@@ -263,4 +263,4 @@ describe("VideoLink", () => {
263
263
  "false"
264
264
  );
265
265
  });
266
- });
266
+ });
@@ -20,10 +20,10 @@ export const VideoLink: React.FC<VideoLinkComponentProps> = ({
20
20
  const [isHovered, setIsHovered] = useState(false);
21
21
 
22
22
  const videoSourceType = videoLink?.videoSourceType;
23
+ const usingContentfulAsset =
24
+ videoSourceType === "contentful" && !!videoLink?.videoAssetUrl;
23
25
  const videoHref =
24
- (videoSourceType === "contentful"
25
- ? videoLink?.videoAssetUrl
26
- : videoLink?.link) ?? "";
26
+ (usingContentfulAsset ? videoLink?.videoAssetUrl : videoLink?.link) ?? "";
27
27
 
28
28
  // The video's own poster - never the promo bar's plain image field.
29
29
  const posterImage = videoLink?.image;
@@ -69,7 +69,7 @@ export const VideoLink: React.FC<VideoLinkComponentProps> = ({
69
69
  };
70
70
 
71
71
  const embedSelector = () => {
72
- if (videoSourceType === "contentful") {
72
+ if (usingContentfulAsset) {
73
73
  return (
74
74
  <ContentfulVideoEmbed
75
75
  videoAssetUrl={videoLink?.videoAssetUrl}
@@ -92,7 +92,7 @@ export const VideoLink: React.FC<VideoLinkComponentProps> = ({
92
92
  <>
93
93
  <div
94
94
  className={cx(
95
- "video-section relative w-full cursor-pointer rounded-image transition-all duration-300 lg:w-[486px]",
95
+ "video-section relative mx-auto w-full cursor-pointer rounded-image transition-all duration-300 lg:w-[486px]",
96
96
  !isPlaying && "hover:ring-2 hover:ring-border-focus"
97
97
  )}
98
98
  onClick={handlePlayClick}
@@ -167,4 +167,4 @@ export type {
167
167
  VideoEmbedProps,
168
168
  VideoLinkComponentProps,
169
169
  VideoLinkProps,
170
- } from "./types";
170
+ } from "./types";
@@ -0,0 +1,81 @@
1
+ import type { FiberFormInputList, FiberFormValues } from "../../blocks/fiber-form/types";
2
+ import * as Yup from "yup";
3
+
4
+ export const fiberFormInputInitialValues: FiberFormValues = {
5
+ firstName: "",
6
+ lastName: "",
7
+ address: "",
8
+ phone: "",
9
+ email: "",
10
+ unit: "",
11
+ zip: "",
12
+ isManualAddress: false,
13
+ isMarketingCom: false,
14
+ addressToSend: {},
15
+ notes: "",
16
+ referralCode: "",
17
+ hasUnits: false,
18
+ };
19
+
20
+ export const fiberFormInputList: FiberFormInputList = {
21
+ firstName: { placeholder: "John" },
22
+ lastName: { placeholder: "Doe" },
23
+ address: { placeholder: "Street address" },
24
+ phoneNumber: { placeholder: "Phone number" },
25
+ emailAddress: { placeholder: "Email address" },
26
+ unit: { placeholder: "Unit (optional)" },
27
+ zip: { placeholder: "Zip" },
28
+ notes: { placeholder: "Notes or Comments" },
29
+ referralCode: { placeholder: "Referral Code" },
30
+ };
31
+
32
+ export const fiberFormAddressCollectionFormSchema = Yup.object({
33
+ firstName: Yup.string()
34
+ .required("First name is required")
35
+ .min(2, "Enter a valid First name")
36
+ .matches(/^[a-zA-Z\s]*$/, "Enter a valid First name"),
37
+ lastName: Yup.string()
38
+ .required("Last name is required")
39
+ .min(2, "Enter a valid Last name")
40
+ .matches(/^[a-zA-Z\s]*$/, "Enter a valid Last name"),
41
+ isManualAddress: Yup.boolean(),
42
+ isMarketingCom: Yup.boolean(),
43
+ hasUnits: Yup.boolean(),
44
+ unit: Yup.string().when("hasUnits", {
45
+ is: true,
46
+ then: schema => schema.required("Unit is required"),
47
+ otherwise: schema =>
48
+ schema.matches(/^[a-zA-Z0-9\s#]*$/, "Enter a valid Unit"),
49
+ }),
50
+ zip: Yup.string().when("isManualAddress", {
51
+ is: true,
52
+ then: schema =>
53
+ schema
54
+ .required("Zip is required")
55
+ .matches(/^\d{5}$/, "Enter a valid Zip"),
56
+ }),
57
+ address: Yup.string()
58
+ .required("Enter your home address (street, city, state, and ZIP below)")
59
+ .when("isManualAddress", {
60
+ is: true,
61
+ then: schema =>
62
+ schema.matches(
63
+ /^(\d{1,}) [a-zA-Z0-9\s]+(\,)? [a-zA-Z\s]+(\,)? [A-Z]{2}( [0-9]{5,6})?$/,
64
+ "Enter your home address (street, city, state, and ZIP below)"
65
+ ),
66
+ }),
67
+ phone: Yup.string()
68
+ .required("Phone is required")
69
+ .matches(
70
+ /^\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}$/,
71
+ "Please enter a valid phone number"
72
+ ),
73
+ email: Yup.string()
74
+ .email("Invalid email")
75
+ .matches(/^[^\s@]+@[^\s@]+\.[^\s@]+$/, "Invalid email")
76
+ .required("Email is required"),
77
+ notes: Yup.string(),
78
+ referralCode: Yup.string()
79
+ .max(50, "Referral code must not exceed 50 characters")
80
+ .matches(/^\S*$/, "Referral code must not contain spaces"),
81
+ });