@careflair/common 1.0.27 → 1.0.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.
@@ -125,48 +125,72 @@ export declare const ContactDetailsFormSchema: z.ZodObject<{
125
125
  /**
126
126
  * Education and training form schema
127
127
  */
128
- export declare const EducationAndTrainingFormSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
128
+ export declare const EducationAndTrainingFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
129
129
  type: z.ZodString;
130
130
  school: z.ZodString;
131
131
  degree: z.ZodString;
132
- startDate: z.ZodDate;
133
- endDate: z.ZodDate;
132
+ startDate: z.ZodOptional<z.ZodDate>;
133
+ endDate: z.ZodOptional<z.ZodDate>;
134
134
  }, "strip", z.ZodTypeAny, {
135
135
  type: string;
136
136
  school: string;
137
137
  degree: string;
138
- startDate: Date;
139
- endDate: Date;
138
+ startDate?: Date | undefined;
139
+ endDate?: Date | undefined;
140
140
  }, {
141
141
  type: string;
142
142
  school: string;
143
143
  degree: string;
144
- startDate: Date;
145
- endDate: Date;
144
+ startDate?: Date | undefined;
145
+ endDate?: Date | undefined;
146
146
  }>, {
147
147
  type: string;
148
148
  school: string;
149
149
  degree: string;
150
- startDate: Date;
151
- endDate: Date;
150
+ startDate?: Date | undefined;
151
+ endDate?: Date | undefined;
152
152
  }, {
153
153
  type: string;
154
154
  school: string;
155
155
  degree: string;
156
- startDate: Date;
157
- endDate: Date;
156
+ startDate?: Date | undefined;
157
+ endDate?: Date | undefined;
158
158
  }>, {
159
159
  type: string;
160
160
  school: string;
161
161
  degree: string;
162
- startDate: Date;
163
- endDate: Date;
162
+ startDate?: Date | undefined;
163
+ endDate?: Date | undefined;
164
164
  }, {
165
165
  type: string;
166
166
  school: string;
167
167
  degree: string;
168
- startDate: Date;
169
- endDate: Date;
168
+ startDate?: Date | undefined;
169
+ endDate?: Date | undefined;
170
+ }>, {
171
+ type: string;
172
+ school: string;
173
+ degree: string;
174
+ startDate?: Date | undefined;
175
+ endDate?: Date | undefined;
176
+ }, {
177
+ type: string;
178
+ school: string;
179
+ degree: string;
180
+ startDate?: Date | undefined;
181
+ endDate?: Date | undefined;
182
+ }>, {
183
+ type: string;
184
+ school: string;
185
+ degree: string;
186
+ startDate?: Date | undefined;
187
+ endDate?: Date | undefined;
188
+ }, {
189
+ type: string;
190
+ school: string;
191
+ degree: string;
192
+ startDate?: Date | undefined;
193
+ endDate?: Date | undefined;
170
194
  }>;
171
195
  /**
172
196
  * Work history form schema
@@ -107,24 +107,44 @@ exports.EducationAndTrainingFormSchema = zod_1.z
107
107
  .string()
108
108
  .min(1, "Degree is required")
109
109
  .max(limits_1.EDUTRAINING_DEGREE_MAX_LENGTH, "Degree is too long"),
110
- startDate: zod_1.z.date({
111
- required_error: "Start date is required",
112
- }),
113
- endDate: zod_1.z.date({
114
- required_error: "End date is required",
115
- }),
110
+ startDate: zod_1.z
111
+ .date({
112
+ invalid_type_error: "Please select a start date",
113
+ })
114
+ .optional(),
115
+ endDate: zod_1.z
116
+ .date({
117
+ invalid_type_error: "Please select an end date",
118
+ })
119
+ .optional(),
120
+ })
121
+ .refine((data) => data.startDate !== undefined && data.startDate !== null, {
122
+ message: "Start date is required",
123
+ path: ["startDate"],
124
+ })
125
+ .refine((data) => data.endDate !== undefined && data.endDate !== null, {
126
+ message: "End date is required",
127
+ path: ["endDate"],
116
128
  })
117
129
  .refine((data) => {
118
130
  // Check if end date is after start date
119
- return data.endDate > data.startDate;
131
+ const startDate = data.startDate;
132
+ const endDate = data.endDate;
133
+ if (!startDate || !endDate)
134
+ return true; // Skip if dates are not set yet
135
+ return endDate > startDate;
120
136
  }, {
121
137
  message: "End date must be after start date",
122
138
  path: ["endDate"],
123
139
  })
124
140
  .refine((data) => {
125
141
  // Check if there's at least 1 month difference
126
- const diffInMonths = (data.endDate.getFullYear() - data.startDate.getFullYear()) * 12 +
127
- (data.endDate.getMonth() - data.startDate.getMonth());
142
+ const startDate = data.startDate;
143
+ const endDate = data.endDate;
144
+ if (!startDate || !endDate)
145
+ return true; // Skip if dates are not set yet
146
+ const diffInMonths = (endDate.getFullYear() - startDate.getFullYear()) * 12 +
147
+ (endDate.getMonth() - startDate.getMonth());
128
148
  return diffInMonths >= 1;
129
149
  }, {
130
150
  message: "There must be at least 1 month between start and end date",
@@ -13,7 +13,7 @@ export interface VideoValidationResult {
13
13
  export declare function validateVideoLink(url: string, allowedProviders: VideoProvider[]): VideoValidationResult;
14
14
  /**
15
15
  * Extract YouTube video ID from various URL formats
16
- * Handles: youtube.com, m.youtube.com, youtu.be, /embed, /v, etc.
16
+ * Handles: youtube.com, m.youtube.com, youtu.be, /embed, /v, /shorts, etc.
17
17
  */
18
18
  export declare function extractYouTubeVideoId(url: string): string | null;
19
19
  /**
@@ -38,7 +38,7 @@ function validateVideoLink(url, allowedProviders) {
38
38
  }
39
39
  /**
40
40
  * Extract YouTube video ID from various URL formats
41
- * Handles: youtube.com, m.youtube.com, youtu.be, /embed, /v, etc.
41
+ * Handles: youtube.com, m.youtube.com, youtu.be, /embed, /v, /shorts, etc.
42
42
  */
43
43
  function extractYouTubeVideoId(url) {
44
44
  if (!url)
@@ -46,25 +46,30 @@ function extractYouTubeVideoId(url) {
46
46
  const trimmed = url.trim();
47
47
  let videoId = null;
48
48
  // Handle youtu.be/VIDEO_ID
49
- if (trimmed.includes('youtu.be/')) {
49
+ if (trimmed.includes("youtu.be/")) {
50
50
  const match = trimmed.match(/youtu\.be\/([a-zA-Z0-9_-]{11})/);
51
51
  videoId = match ? match[1] : null;
52
52
  }
53
53
  // Handle youtube.com/watch?v=VIDEO_ID (works for www, m, etc.)
54
- else if (trimmed.includes('youtube.com/watch')) {
54
+ else if (trimmed.includes("youtube.com/watch")) {
55
55
  const match = trimmed.match(/[?&]v=([a-zA-Z0-9_-]{11})/);
56
56
  videoId = match ? match[1] : null;
57
57
  }
58
58
  // Handle youtube.com/embed/VIDEO_ID
59
- else if (trimmed.includes('youtube.com/embed/')) {
59
+ else if (trimmed.includes("youtube.com/embed/")) {
60
60
  const match = trimmed.match(/\/embed\/([a-zA-Z0-9_-]{11})/);
61
61
  videoId = match ? match[1] : null;
62
62
  }
63
63
  // Handle youtube.com/v/VIDEO_ID
64
- else if (trimmed.includes('youtube.com/v/')) {
64
+ else if (trimmed.includes("youtube.com/v/")) {
65
65
  const match = trimmed.match(/\/v\/([a-zA-Z0-9_-]{11})/);
66
66
  videoId = match ? match[1] : null;
67
67
  }
68
+ // Handle youtube.com/shorts/VIDEO_ID
69
+ else if (trimmed.includes("youtube.com/shorts/")) {
70
+ const match = trimmed.match(/\/shorts\/([a-zA-Z0-9_-]{11})/);
71
+ videoId = match ? match[1] : null;
72
+ }
68
73
  return videoId;
69
74
  }
70
75
  /**
@@ -81,7 +86,8 @@ function detectVideoProvider(url) {
81
86
  if (!url)
82
87
  return null;
83
88
  const lower = url.toLowerCase();
84
- if ((lower.includes("youtube.com") || lower.includes("youtu.be")) && extractYouTubeVideoId(url)) {
89
+ if ((lower.includes("youtube.com") || lower.includes("youtu.be")) &&
90
+ extractYouTubeVideoId(url)) {
85
91
  return "youtube";
86
92
  }
87
93
  if (lower.includes("vimeo.com"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@careflair/common",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Shared assets for CareFlair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",