@careflair/common 1.0.30 → 1.0.32

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.
@@ -417,6 +417,7 @@ export declare enum PushNotificationType {
417
417
  NDIS_SCREENING_REMINDER = "ndis_screening_reminder",
418
418
  WWCC_REMINDER = "wwcc_reminder",
419
419
  NEW_JOB_OPPORTUNITY = "new_job_opportunity",
420
+ NEW_PROPOSAL = "new_proposal",
420
421
  ID_VERIFICATION_SUCCESS = "id_verification_success",
421
422
  ID_VERIFICATION_RESUBMISSION_REQUESTED = "id_verification_resubmission_requested",
422
423
  ID_VERIFICATION_DECLINED = "id_verification_declined",
@@ -488,6 +488,7 @@ var PushNotificationType;
488
488
  PushNotificationType["NDIS_SCREENING_REMINDER"] = "ndis_screening_reminder";
489
489
  PushNotificationType["WWCC_REMINDER"] = "wwcc_reminder";
490
490
  PushNotificationType["NEW_JOB_OPPORTUNITY"] = "new_job_opportunity";
491
+ PushNotificationType["NEW_PROPOSAL"] = "new_proposal";
491
492
  PushNotificationType["ID_VERIFICATION_SUCCESS"] = "id_verification_success";
492
493
  PushNotificationType["ID_VERIFICATION_RESUBMISSION_REQUESTED"] = "id_verification_resubmission_requested";
493
494
  PushNotificationType["ID_VERIFICATION_DECLINED"] = "id_verification_declined";
@@ -195,39 +195,58 @@ export declare const EducationAndTrainingFormSchema: z.ZodEffects<z.ZodEffects<z
195
195
  /**
196
196
  * Work history form schema
197
197
  */
198
- export declare const WorkHistoryFormSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
198
+ export declare const WorkHistoryFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
199
199
  jobTitle: z.ZodString;
200
200
  organisation: z.ZodString;
201
201
  startDate: z.ZodEffects<z.ZodString, string, string>;
202
- endDate: z.ZodString;
202
+ endDate: z.ZodOptional<z.ZodString>;
203
+ isCurrentlyWorking: z.ZodDefault<z.ZodBoolean>;
203
204
  }, "strip", z.ZodTypeAny, {
204
205
  startDate: string;
205
- endDate: string;
206
206
  jobTitle: string;
207
207
  organisation: string;
208
+ isCurrentlyWorking: boolean;
209
+ endDate?: string | undefined;
208
210
  }, {
209
211
  startDate: string;
210
- endDate: string;
211
212
  jobTitle: string;
212
213
  organisation: string;
214
+ endDate?: string | undefined;
215
+ isCurrentlyWorking?: boolean | undefined;
213
216
  }>, {
214
217
  startDate: string;
215
- endDate: string;
216
218
  jobTitle: string;
217
219
  organisation: string;
220
+ isCurrentlyWorking: boolean;
221
+ endDate?: string | undefined;
218
222
  }, {
219
223
  startDate: string;
220
- endDate: string;
221
224
  jobTitle: string;
222
225
  organisation: string;
226
+ endDate?: string | undefined;
227
+ isCurrentlyWorking?: boolean | undefined;
223
228
  }>, {
224
229
  startDate: string;
225
- endDate: string;
226
230
  jobTitle: string;
227
231
  organisation: string;
232
+ isCurrentlyWorking: boolean;
233
+ endDate?: string | undefined;
228
234
  }, {
229
235
  startDate: string;
230
- endDate: string;
231
236
  jobTitle: string;
232
237
  organisation: string;
238
+ endDate?: string | undefined;
239
+ isCurrentlyWorking?: boolean | undefined;
240
+ }>, {
241
+ startDate: string;
242
+ jobTitle: string;
243
+ organisation: string;
244
+ isCurrentlyWorking: boolean;
245
+ endDate?: string | undefined;
246
+ }, {
247
+ startDate: string;
248
+ jobTitle: string;
249
+ organisation: string;
250
+ endDate?: string | undefined;
251
+ isCurrentlyWorking?: boolean | undefined;
233
252
  }>;
@@ -185,21 +185,39 @@ exports.WorkHistoryFormSchema = zod_1.z
185
185
  .refine((date) => !isDateInFuture(date), {
186
186
  message: "Start date cannot be in the future",
187
187
  }),
188
- endDate: zod_1.z.string().min(1, "End date is required"),
188
+ endDate: zod_1.z.string().optional(),
189
+ isCurrentlyWorking: zod_1.z.boolean().default(false),
189
190
  })
190
191
  .refine((data) => {
191
- // Check if end date is after start date
192
- const startDate = new Date(data.startDate);
193
- const endDate = new Date(data.endDate);
194
- return endDate > startDate;
192
+ // If endDate is provided, validate it's after start date
193
+ if (data.endDate && data.endDate.length > 0) {
194
+ const startDate = new Date(data.startDate);
195
+ const endDate = new Date(data.endDate);
196
+ return endDate > startDate;
197
+ }
198
+ return true;
195
199
  }, {
196
200
  message: "End date must be after start date",
197
201
  path: ["endDate"],
198
202
  })
199
203
  .refine((data) => {
200
- // Check if there's at least 1 month difference
201
- return isAtLeastOneMonthDifference(data.startDate, data.endDate);
204
+ // If endDate is provided, validate there's at least 1 month difference
205
+ if (data.endDate && data.endDate.length > 0) {
206
+ return isAtLeastOneMonthDifference(data.startDate, data.endDate);
207
+ }
208
+ return true;
202
209
  }, {
203
210
  message: "There must be at least 1 month between start and end date",
204
211
  path: ["endDate"],
212
+ })
213
+ .refine((data) => {
214
+ // If there is an endDate, isCurrentlyWorking must be false
215
+ // If isCurrentlyWorking is false, endDate must be provided
216
+ if (data.endDate && data.endDate.length > 0) {
217
+ return !data.isCurrentlyWorking;
218
+ }
219
+ return (data.isCurrentlyWorking || (data.endDate && data.endDate.length > 0));
220
+ }, {
221
+ message: "If there is an endDate, Currently Working must be false. If Currently Working is false, endDate must be provided.",
222
+ path: ["endDate", "isCurrentlyWorking"],
205
223
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@careflair/common",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Shared assets for CareFlair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",