@careflair/common 1.0.47 → 1.0.48

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.
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  /**
3
3
  * Registration form schema
4
4
  */
5
- export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
5
+ export declare const registrationFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
6
6
  firstName: z.ZodString;
7
7
  lastName: z.ZodString;
8
8
  email: z.ZodString;
@@ -11,6 +11,8 @@ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
11
11
  password: z.ZodString;
12
12
  confirmPassword: z.ZodString;
13
13
  fingerPrint: z.ZodOptional<z.ZodString>;
14
+ companyRole: z.ZodOptional<z.ZodString>;
15
+ authorizationConfirmed: z.ZodOptional<z.ZodBoolean>;
14
16
  }, "strip", z.ZodTypeAny, {
15
17
  role: string;
16
18
  username: string;
@@ -20,6 +22,8 @@ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
20
22
  password: string;
21
23
  confirmPassword: string;
22
24
  fingerPrint?: string | undefined;
25
+ companyRole?: string | undefined;
26
+ authorizationConfirmed?: boolean | undefined;
23
27
  }, {
24
28
  role: string;
25
29
  username: string;
@@ -29,6 +33,8 @@ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
29
33
  password: string;
30
34
  confirmPassword: string;
31
35
  fingerPrint?: string | undefined;
36
+ companyRole?: string | undefined;
37
+ authorizationConfirmed?: boolean | undefined;
32
38
  }>, {
33
39
  role: string;
34
40
  username: string;
@@ -38,6 +44,8 @@ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
38
44
  password: string;
39
45
  confirmPassword: string;
40
46
  fingerPrint?: string | undefined;
47
+ companyRole?: string | undefined;
48
+ authorizationConfirmed?: boolean | undefined;
41
49
  }, {
42
50
  role: string;
43
51
  username: string;
@@ -47,6 +55,52 @@ export declare const registrationFormSchema: z.ZodEffects<z.ZodObject<{
47
55
  password: string;
48
56
  confirmPassword: string;
49
57
  fingerPrint?: string | undefined;
58
+ companyRole?: string | undefined;
59
+ authorizationConfirmed?: boolean | undefined;
60
+ }>, {
61
+ role: string;
62
+ username: string;
63
+ email: string;
64
+ firstName: string;
65
+ lastName: string;
66
+ password: string;
67
+ confirmPassword: string;
68
+ fingerPrint?: string | undefined;
69
+ companyRole?: string | undefined;
70
+ authorizationConfirmed?: boolean | undefined;
71
+ }, {
72
+ role: string;
73
+ username: string;
74
+ email: string;
75
+ firstName: string;
76
+ lastName: string;
77
+ password: string;
78
+ confirmPassword: string;
79
+ fingerPrint?: string | undefined;
80
+ companyRole?: string | undefined;
81
+ authorizationConfirmed?: boolean | undefined;
82
+ }>, {
83
+ role: string;
84
+ username: string;
85
+ email: string;
86
+ firstName: string;
87
+ lastName: string;
88
+ password: string;
89
+ confirmPassword: string;
90
+ fingerPrint?: string | undefined;
91
+ companyRole?: string | undefined;
92
+ authorizationConfirmed?: boolean | undefined;
93
+ }, {
94
+ role: string;
95
+ username: string;
96
+ email: string;
97
+ firstName: string;
98
+ lastName: string;
99
+ password: string;
100
+ confirmPassword: string;
101
+ fingerPrint?: string | undefined;
102
+ companyRole?: string | undefined;
103
+ authorizationConfirmed?: boolean | undefined;
50
104
  }>;
51
105
  /**
52
106
  * Participant location form schema
@@ -34,11 +34,34 @@ exports.registrationFormSchema = zod_1.z
34
34
  password: validation_1.passwordSchema,
35
35
  confirmPassword: zod_1.z.string().min(1, "Confirm password is required"),
36
36
  fingerPrint: zod_1.z.string().optional(),
37
+ companyRole: zod_1.z.string().optional(),
38
+ authorizationConfirmed: zod_1.z.boolean().optional(),
37
39
  })
38
40
  // Password match validation
39
41
  .refine((data) => data.password === data.confirmPassword, {
40
42
  message: "Passwords don't match",
41
43
  path: ["confirmPassword"],
44
+ })
45
+ // Provider-specific validation
46
+ .refine((data) => {
47
+ // If role is provider, companyRole is required
48
+ if (data.role === "provider") {
49
+ return data.companyRole && data.companyRole.trim().length > 0;
50
+ }
51
+ return true;
52
+ }, {
53
+ message: "Company role is required for providers",
54
+ path: ["companyRole"],
55
+ })
56
+ .refine((data) => {
57
+ // If role is provider, authorizationConfirmed must be true
58
+ if (data.role === "provider") {
59
+ return data.authorizationConfirmed === true;
60
+ }
61
+ return true;
62
+ }, {
63
+ message: "You must confirm your authorization to proceed",
64
+ path: ["authorizationConfirmed"],
42
65
  });
43
66
  /**
44
67
  * Participant location form schema
@@ -1,8 +1,8 @@
1
- export { UserRegistrationInput, UserRegistrationSchema } from "./userValiationSchema";
2
- export { EducationAndTrainingInputValidation, EducationAndTrainingSchema } from "./educationSchemas";
3
- export { WorkHistoryInputValidation, WorkHistorySchema } from "./workHistorySchema";
4
- export { AvailabilitiesSchemaZod, AvailabilityZodInput } from "./availabilitySchemaValidation";
5
- export { HourlyRateInputZod, HourlyRateInputZodType } from "./hourlyRateSchemaValidation";
6
- export { SupportWorkerServicesSchema, validateSupportWorkerServices } from "./businessServicesValidation";
7
- export { ResetPasswordSchema, generalOTPSchema, pinSchema } from "./otp";
8
- export { ApplicationFormValues, applicationSchema, isValidVideoUrl } from "./applicationSchema";
1
+ export { UserRegistrationInput, UserRegistrationSchema, } from "./userValiationSchema";
2
+ export { EducationAndTrainingInputValidation, EducationAndTrainingSchema, } from "./educationSchemas";
3
+ export { WorkHistoryInputValidation, WorkHistorySchema, } from "./workHistorySchema";
4
+ export { AvailabilitiesSchemaZod, AvailabilityZodInput, } from "./availabilitySchemaValidation";
5
+ export { HourlyRateInputZod, HourlyRateInputZodType, } from "./hourlyRateSchemaValidation";
6
+ export { SupportWorkerServicesSchema, validateSupportWorkerServices, } from "./businessServicesValidation";
7
+ export { generalOTPSchema, pinSchema, ResetPasswordSchema } from "./otp";
8
+ export { ApplicationFormValues, applicationSchema, isValidVideoUrl, } from "./applicationSchema";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidVideoUrl = exports.applicationSchema = exports.pinSchema = exports.generalOTPSchema = exports.ResetPasswordSchema = exports.validateSupportWorkerServices = exports.SupportWorkerServicesSchema = exports.HourlyRateInputZod = exports.AvailabilitiesSchemaZod = exports.WorkHistorySchema = exports.EducationAndTrainingSchema = exports.UserRegistrationSchema = void 0;
3
+ exports.isValidVideoUrl = exports.applicationSchema = exports.ResetPasswordSchema = exports.pinSchema = exports.generalOTPSchema = exports.validateSupportWorkerServices = exports.SupportWorkerServicesSchema = exports.HourlyRateInputZod = exports.AvailabilitiesSchemaZod = exports.WorkHistorySchema = exports.EducationAndTrainingSchema = exports.UserRegistrationSchema = void 0;
4
4
  var userValiationSchema_1 = require("./userValiationSchema");
5
5
  Object.defineProperty(exports, "UserRegistrationSchema", { enumerable: true, get: function () { return userValiationSchema_1.UserRegistrationSchema; } });
6
6
  var educationSchemas_1 = require("./educationSchemas");
@@ -15,9 +15,9 @@ var businessServicesValidation_1 = require("./businessServicesValidation");
15
15
  Object.defineProperty(exports, "SupportWorkerServicesSchema", { enumerable: true, get: function () { return businessServicesValidation_1.SupportWorkerServicesSchema; } });
16
16
  Object.defineProperty(exports, "validateSupportWorkerServices", { enumerable: true, get: function () { return businessServicesValidation_1.validateSupportWorkerServices; } });
17
17
  var otp_1 = require("./otp");
18
- Object.defineProperty(exports, "ResetPasswordSchema", { enumerable: true, get: function () { return otp_1.ResetPasswordSchema; } });
19
18
  Object.defineProperty(exports, "generalOTPSchema", { enumerable: true, get: function () { return otp_1.generalOTPSchema; } });
20
19
  Object.defineProperty(exports, "pinSchema", { enumerable: true, get: function () { return otp_1.pinSchema; } });
20
+ Object.defineProperty(exports, "ResetPasswordSchema", { enumerable: true, get: function () { return otp_1.ResetPasswordSchema; } });
21
21
  var applicationSchema_1 = require("./applicationSchema");
22
22
  Object.defineProperty(exports, "applicationSchema", { enumerable: true, get: function () { return applicationSchema_1.applicationSchema; } });
23
23
  Object.defineProperty(exports, "isValidVideoUrl", { enumerable: true, get: function () { return applicationSchema_1.isValidVideoUrl; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@careflair/common",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "Shared assets for CareFlair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",