@plyaz/types 1.14.11 → 1.15.0

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.
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Object containing all supported country codes and their corresponding values.
3
+ * Primarily covers European Union countries plus additional regions.
4
+ */
5
+ export declare const COUNTRIES: {
6
+ readonly unitedKingdom: "unitedKingdom";
7
+ readonly germany: "germany";
8
+ readonly france: "france";
9
+ readonly spain: "spain";
10
+ readonly italy: "italy";
11
+ readonly netherlands: "netherlands";
12
+ readonly belgium: "belgium";
13
+ readonly austria: "austria";
14
+ readonly switzerland: "switzerland";
15
+ readonly sweden: "sweden";
16
+ readonly norway: "norway";
17
+ readonly denmark: "denmark";
18
+ readonly finland: "finland";
19
+ readonly portugal: "portugal";
20
+ readonly ireland: "ireland";
21
+ readonly poland: "poland";
22
+ readonly czechRepublic: "czechRepublic";
23
+ readonly hungary: "hungary";
24
+ readonly romania: "romania";
25
+ readonly bulgaria: "bulgaria";
26
+ readonly croatia: "croatia";
27
+ readonly slovenia: "slovenia";
28
+ readonly slovakia: "slovakia";
29
+ readonly estonia: "estonia";
30
+ readonly latvia: "latvia";
31
+ readonly lithuania: "lithuania";
32
+ readonly greece: "greece";
33
+ readonly cyprus: "cyprus";
34
+ readonly malta: "malta";
35
+ readonly luxembourg: "luxembourg";
36
+ readonly other: "other";
37
+ };
38
+ /**
39
+ * Enum containing error message keys for basic profile form validation.
40
+ * Contains localized error message keys that map to translation strings.
41
+ */
42
+ export declare enum BASIC_PROFILE_ERRORS {
43
+ /** Error when name is below minimum length */
44
+ NameMin = "components.BasicProfileForm.errors.nameMin",
45
+ /** Error when name exceeds maximum length */
46
+ NameMax = "components.BasicProfileForm.errors.nameMax",
47
+ /** Error when email format is invalid */
48
+ EmailValid = "components.BasicProfileForm.errors.emailValid",
49
+ /** Error when email is required but not provided */
50
+ EmailRequired = "components.BasicProfileForm.errors.emailRequired",
51
+ /** Error when country is required but not selected */
52
+ CountryRequired = "components.BasicProfileForm.errors.countryRequired",
53
+ /** Error when bio exceeds maximum length */
54
+ BioMax = "components.BasicProfileForm.errors.bioMax",
55
+ /** Error when profile image size exceeds limit */
56
+ ProfileImageSize = "components.BasicProfileForm.errors.profileImageSize",
57
+ /** Error when profile image type is not supported */
58
+ ProfileImageTypes = "components.BasicProfileForm.errors.profileImageTypes"
59
+ }
60
+ /**
61
+ * Enum containing error message keys for athlete profile form validation.
62
+ * Contains localized error message keys that map to translation strings.
63
+ */
64
+ export declare enum ATHLETE_PROFILE_ERRORS {
65
+ /** Error when date of birth is too recent (maximum age validation) */
66
+ DobMax = "components.AthleteProfileForm.errors.dobMax",
67
+ /** Error when date of birth is too old (minimum age validation) */
68
+ DobMin = "components.AthleteProfileForm.errors.dobMin",
69
+ /** Error when height is below minimum value */
70
+ HeightMin = "components.AthleteProfileForm.errors.heightMin",
71
+ /** Error when height exceeds maximum value */
72
+ HeightMax = "components.AthleteProfileForm.errors.heightMax",
73
+ /** Error when height format is invalid */
74
+ HeightInvalid = "components.AthleteProfileForm.errors.heightInvalid",
75
+ /** Error when weight is below minimum value */
76
+ WeightMin = "components.AthleteProfileForm.errors.weightMin",
77
+ /** Error when weight exceeds maximum value */
78
+ WeightMax = "components.AthleteProfileForm.errors.weightMax",
79
+ /** Error when weight format is invalid */
80
+ WeightInvalid = "components.AthleteProfileForm.errors.weightInvalid",
81
+ /** Error when position is below minimum length */
82
+ PositionMin = "components.AthleteProfileForm.errors.positionMin",
83
+ /** Error when position exceeds maximum length */
84
+ PositionMax = "components.AthleteProfileForm.errors.positionMax",
85
+ /** Error when team name is below minimum length */
86
+ TeamMin = "components.AthleteProfileForm.errors.teamMin",
87
+ /** Error when team name exceeds maximum length */
88
+ TeamMax = "components.AthleteProfileForm.errors.teamMax",
89
+ /** Error when Instagram handle format is invalid */
90
+ InstagramInvalid = "components.AthleteProfileForm.errors.instagramInvalid",
91
+ /** Error when TikTok handle format is invalid */
92
+ TiktokInvalid = "components.AthleteProfileForm.errors.tiktokInvalid",
93
+ /** Error when highlight image size exceeds limit */
94
+ HighlightImageSize = "components.AthleteProfileForm.errors.highlightImageSize",
95
+ /** Error when highlight image type is not supported */
96
+ HighlightImageTypes = "components.AthleteProfileForm.errors.highlightImageTypes"
97
+ }
98
+ /**
99
+ * Type representing all possible error keys for basic profile form validation
100
+ */
101
+ export type BasicProfileErrorKey = keyof typeof BASIC_PROFILE_ERRORS;
102
+ /**
103
+ * Type representing all possible error keys for athlete profile form validation
104
+ */
105
+ export type AthleteProfileErrorKey = keyof typeof ATHLETE_PROFILE_ERRORS;
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // @plyaz package - Built with tsup
6
+
7
+ // src/user/enums.ts
8
+ var COUNTRIES = {
9
+ unitedKingdom: "unitedKingdom",
10
+ germany: "germany",
11
+ france: "france",
12
+ spain: "spain",
13
+ italy: "italy",
14
+ netherlands: "netherlands",
15
+ belgium: "belgium",
16
+ austria: "austria",
17
+ switzerland: "switzerland",
18
+ sweden: "sweden",
19
+ norway: "norway",
20
+ denmark: "denmark",
21
+ finland: "finland",
22
+ portugal: "portugal",
23
+ ireland: "ireland",
24
+ poland: "poland",
25
+ czechRepublic: "czechRepublic",
26
+ hungary: "hungary",
27
+ romania: "romania",
28
+ bulgaria: "bulgaria",
29
+ croatia: "croatia",
30
+ slovenia: "slovenia",
31
+ slovakia: "slovakia",
32
+ estonia: "estonia",
33
+ latvia: "latvia",
34
+ lithuania: "lithuania",
35
+ greece: "greece",
36
+ cyprus: "cyprus",
37
+ malta: "malta",
38
+ luxembourg: "luxembourg",
39
+ other: "other"
40
+ };
41
+ var BASIC_PROFILE_ERRORS = /* @__PURE__ */ ((BASIC_PROFILE_ERRORS2) => {
42
+ BASIC_PROFILE_ERRORS2["NameMin"] = "components.BasicProfileForm.errors.nameMin";
43
+ BASIC_PROFILE_ERRORS2["NameMax"] = "components.BasicProfileForm.errors.nameMax";
44
+ BASIC_PROFILE_ERRORS2["EmailValid"] = "components.BasicProfileForm.errors.emailValid";
45
+ BASIC_PROFILE_ERRORS2["EmailRequired"] = "components.BasicProfileForm.errors.emailRequired";
46
+ BASIC_PROFILE_ERRORS2["CountryRequired"] = "components.BasicProfileForm.errors.countryRequired";
47
+ BASIC_PROFILE_ERRORS2["BioMax"] = "components.BasicProfileForm.errors.bioMax";
48
+ BASIC_PROFILE_ERRORS2["ProfileImageSize"] = "components.BasicProfileForm.errors.profileImageSize";
49
+ BASIC_PROFILE_ERRORS2["ProfileImageTypes"] = "components.BasicProfileForm.errors.profileImageTypes";
50
+ return BASIC_PROFILE_ERRORS2;
51
+ })(BASIC_PROFILE_ERRORS || {});
52
+ var ATHLETE_PROFILE_ERRORS = /* @__PURE__ */ ((ATHLETE_PROFILE_ERRORS2) => {
53
+ ATHLETE_PROFILE_ERRORS2["DobMax"] = "components.AthleteProfileForm.errors.dobMax";
54
+ ATHLETE_PROFILE_ERRORS2["DobMin"] = "components.AthleteProfileForm.errors.dobMin";
55
+ ATHLETE_PROFILE_ERRORS2["HeightMin"] = "components.AthleteProfileForm.errors.heightMin";
56
+ ATHLETE_PROFILE_ERRORS2["HeightMax"] = "components.AthleteProfileForm.errors.heightMax";
57
+ ATHLETE_PROFILE_ERRORS2["HeightInvalid"] = "components.AthleteProfileForm.errors.heightInvalid";
58
+ ATHLETE_PROFILE_ERRORS2["WeightMin"] = "components.AthleteProfileForm.errors.weightMin";
59
+ ATHLETE_PROFILE_ERRORS2["WeightMax"] = "components.AthleteProfileForm.errors.weightMax";
60
+ ATHLETE_PROFILE_ERRORS2["WeightInvalid"] = "components.AthleteProfileForm.errors.weightInvalid";
61
+ ATHLETE_PROFILE_ERRORS2["PositionMin"] = "components.AthleteProfileForm.errors.positionMin";
62
+ ATHLETE_PROFILE_ERRORS2["PositionMax"] = "components.AthleteProfileForm.errors.positionMax";
63
+ ATHLETE_PROFILE_ERRORS2["TeamMin"] = "components.AthleteProfileForm.errors.teamMin";
64
+ ATHLETE_PROFILE_ERRORS2["TeamMax"] = "components.AthleteProfileForm.errors.teamMax";
65
+ ATHLETE_PROFILE_ERRORS2["InstagramInvalid"] = "components.AthleteProfileForm.errors.instagramInvalid";
66
+ ATHLETE_PROFILE_ERRORS2["TiktokInvalid"] = "components.AthleteProfileForm.errors.tiktokInvalid";
67
+ ATHLETE_PROFILE_ERRORS2["HighlightImageSize"] = "components.AthleteProfileForm.errors.highlightImageSize";
68
+ ATHLETE_PROFILE_ERRORS2["HighlightImageTypes"] = "components.AthleteProfileForm.errors.highlightImageTypes";
69
+ return ATHLETE_PROFILE_ERRORS2;
70
+ })(ATHLETE_PROFILE_ERRORS || {});
71
+ var MIN_NAME_LENGTH = 2;
72
+ var MAX_NAME_LENGTH = 50;
73
+ var MAX_BIO_LENGTH = 275;
74
+ var basicProfileSchema = zod.z.object({
75
+ name: zod.z.string().min(MIN_NAME_LENGTH, "components.BasicProfileForm.errors.nameMin" /* NameMin */).max(MAX_NAME_LENGTH, "components.BasicProfileForm.errors.nameMax" /* NameMax */),
76
+ email: zod.z.string().email("components.BasicProfileForm.errors.emailValid" /* EmailValid */).min(1, "components.BasicProfileForm.errors.emailRequired" /* EmailRequired */),
77
+ country: zod.z.string().min(1, "components.BasicProfileForm.errors.countryRequired" /* CountryRequired */),
78
+ bio: zod.z.string().max(MAX_BIO_LENGTH, "components.BasicProfileForm.errors.bioMax" /* BioMax */).optional(),
79
+ profileImage: zod.z.union([
80
+ zod.z.instanceof(File).refine(
81
+ (file) => file.size <= 5 * 1024 * 1024,
82
+ // 5MB
83
+ "components.BasicProfileForm.errors.profileImageSize" /* ProfileImageSize */
84
+ ).refine(
85
+ (file) => ["image/png", "image/jpeg", "image/jpg", "image/webp"].includes(file.type),
86
+ "components.BasicProfileForm.errors.profileImageTypes" /* ProfileImageTypes */
87
+ ),
88
+ zod.z.string(),
89
+ zod.z.null()
90
+ ]).optional()
91
+ });
92
+ var fanProfileSchema = basicProfileSchema.extend({});
93
+ var athleteProfileSchema = basicProfileSchema.extend({
94
+ dateOfBirth: zod.z.date().max(/* @__PURE__ */ new Date(), "components.AthleteProfileForm.errors.dobMax" /* DobMax */).min(new Date(1900, 0, 1), "components.AthleteProfileForm.errors.dobMin" /* DobMin */).optional(),
95
+ height: zod.z.number().min(50, "components.AthleteProfileForm.errors.heightMin" /* HeightMin */).max(300, "components.AthleteProfileForm.errors.heightMax" /* HeightMax */).optional(),
96
+ weight: zod.z.number().min(10, "components.AthleteProfileForm.errors.weightMin" /* WeightMin */).max(500, "components.AthleteProfileForm.errors.weightMax" /* WeightMax */).optional(),
97
+ position: zod.z.string().min(2, "components.AthleteProfileForm.errors.positionMin" /* PositionMin */).max(50, "components.AthleteProfileForm.errors.positionMax" /* PositionMax */).optional(),
98
+ teamName: zod.z.string().min(2, "components.AthleteProfileForm.errors.teamMin" /* TeamMin */).max(100, "components.AthleteProfileForm.errors.teamMax" /* TeamMax */).optional(),
99
+ instagramHandle: zod.z.string().regex(/^@?[a-zA-Z0-9._]{1,30}$/, "components.AthleteProfileForm.errors.instagramInvalid" /* InstagramInvalid */).optional(),
100
+ tiktokHandle: zod.z.string().regex(/^@?[a-zA-Z0-9._]{1,24}$/, "components.AthleteProfileForm.errors.tiktokInvalid" /* TiktokInvalid */).optional(),
101
+ highlightImage: zod.z.union([
102
+ zod.z.instanceof(File).refine(
103
+ (file) => file.size <= 5 * 1024 * 1024,
104
+ // 5MB
105
+ "components.AthleteProfileForm.errors.highlightImageSize" /* HighlightImageSize */
106
+ ).refine(
107
+ (file) => ["image/png", "image/jpeg", "image/jpg"].includes(file.type),
108
+ "components.AthleteProfileForm.errors.highlightImageTypes" /* HighlightImageTypes */
109
+ ),
110
+ zod.z.string(),
111
+ zod.z.null()
112
+ ]).optional()
113
+ });
114
+
115
+ exports.ATHLETE_PROFILE_ERRORS = ATHLETE_PROFILE_ERRORS;
116
+ exports.BASIC_PROFILE_ERRORS = BASIC_PROFILE_ERRORS;
117
+ exports.COUNTRIES = COUNTRIES;
118
+ exports.athleteProfileSchema = athleteProfileSchema;
119
+ exports.basicProfileSchema = basicProfileSchema;
120
+ exports.fanProfileSchema = fanProfileSchema;
121
+ //# sourceMappingURL=index.cjs.map
122
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/user/enums.ts","../../src/user/schemas.ts"],"names":["BASIC_PROFILE_ERRORS","ATHLETE_PROFILE_ERRORS","z"],"mappings":";;;;;;;AAIO,IAAM,SAAA,GAAY;AAAA,EACvB,aAAA,EAAe,eAAA;AAAA,EACf,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,WAAA,EAAa,aAAA;AAAA,EACb,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,WAAA,EAAa,aAAA;AAAA,EACb,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,aAAA,EAAe,eAAA;AAAA,EACf,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,QAAA,EAAU,UAAA;AAAA,EACV,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,WAAA;AAAA,EACX,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,OAAA;AAAA,EACP,UAAA,EAAY,YAAA;AAAA,EACZ,KAAA,EAAO;AACT;AAMO,IA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AW,CAAA,CAAE,QAAA,CAAS,KAAK,IAAI,CAAA;AAAA,MAAA,0DAAA;AAAA,KAErE;AAAA,IACFA,MAAE,MAAA,EAAO;AAAA,IACTA,MAAE,IAAA;AAAK,GACR,EACA,QAAA;AACL,CAAC","file":"index.cjs","sourcesContent":["/**\n * Object containing all supported country codes and their corresponding values.\n * Primarily covers European Union countries plus additional regions.\n */\nexport const COUNTRIES = {\n unitedKingdom: 'unitedKingdom',\n germany: 'germany',\n france: 'france',\n spain: 'spain',\n italy: 'italy',\n netherlands: 'netherlands',\n belgium: 'belgium',\n austria: 'austria',\n switzerland: 'switzerland',\n sweden: 'sweden',\n norway: 'norway',\n denmark: 'denmark',\n finland: 'finland',\n portugal: 'portugal',\n ireland: 'ireland',\n poland: 'poland',\n czechRepublic: 'czechRepublic',\n hungary: 'hungary',\n romania: 'romania',\n bulgaria: 'bulgaria',\n croatia: 'croatia',\n slovenia: 'slovenia',\n slovakia: 'slovakia',\n estonia: 'estonia',\n latvia: 'latvia',\n lithuania: 'lithuania',\n greece: 'greece',\n cyprus: 'cyprus',\n malta: 'malta',\n luxembourg: 'luxembourg',\n other: 'other',\n} as const;\n\n/**\n * Enum containing error message keys for basic profile form validation.\n * Contains localized error message keys that map to translation strings.\n */\nexport enum BASIC_PROFILE_ERRORS {\n /** Error when name is below minimum length */\n NameMin = 'components.BasicProfileForm.errors.nameMin',\n /** Error when name exceeds maximum length */\n NameMax = 'components.BasicProfileForm.errors.nameMax',\n /** Error when email format is invalid */\n EmailValid = 'components.BasicProfileForm.errors.emailValid',\n /** Error when email is required but not provided */\n EmailRequired = 'components.BasicProfileForm.errors.emailRequired',\n /** Error when country is required but not selected */\n CountryRequired = 'components.BasicProfileForm.errors.countryRequired',\n /** Error when bio exceeds maximum length */\n BioMax = 'components.BasicProfileForm.errors.bioMax',\n /** Error when profile image size exceeds limit */\n ProfileImageSize = 'components.BasicProfileForm.errors.profileImageSize',\n /** Error when profile image type is not supported */\n ProfileImageTypes = 'components.BasicProfileForm.errors.profileImageTypes',\n}\n\n/**\n * Enum containing error message keys for athlete profile form validation.\n * Contains localized error message keys that map to translation strings.\n */\nexport enum ATHLETE_PROFILE_ERRORS {\n /** Error when date of birth is too recent (maximum age validation) */\n DobMax = 'components.AthleteProfileForm.errors.dobMax',\n /** Error when date of birth is too old (minimum age validation) */\n DobMin = 'components.AthleteProfileForm.errors.dobMin',\n /** Error when height is below minimum value */\n HeightMin = 'components.AthleteProfileForm.errors.heightMin',\n /** Error when height exceeds maximum value */\n HeightMax = 'components.AthleteProfileForm.errors.heightMax',\n /** Error when height format is invalid */\n HeightInvalid = 'components.AthleteProfileForm.errors.heightInvalid',\n /** Error when weight is below minimum value */\n WeightMin = 'components.AthleteProfileForm.errors.weightMin',\n /** Error when weight exceeds maximum value */\n WeightMax = 'components.AthleteProfileForm.errors.weightMax',\n /** Error when weight format is invalid */\n WeightInvalid = 'components.AthleteProfileForm.errors.weightInvalid',\n /** Error when position is below minimum length */\n PositionMin = 'components.AthleteProfileForm.errors.positionMin',\n /** Error when position exceeds maximum length */\n PositionMax = 'components.AthleteProfileForm.errors.positionMax',\n /** Error when team name is below minimum length */\n TeamMin = 'components.AthleteProfileForm.errors.teamMin',\n /** Error when team name exceeds maximum length */\n TeamMax = 'components.AthleteProfileForm.errors.teamMax',\n /** Error when Instagram handle format is invalid */\n InstagramInvalid = 'components.AthleteProfileForm.errors.instagramInvalid',\n /** Error when TikTok handle format is invalid */\n TiktokInvalid = 'components.AthleteProfileForm.errors.tiktokInvalid',\n /** Error when highlight image size exceeds limit */\n HighlightImageSize = 'components.AthleteProfileForm.errors.highlightImageSize',\n /** Error when highlight image type is not supported */\n HighlightImageTypes = 'components.AthleteProfileForm.errors.highlightImageTypes',\n}\n\n/**\n * Type representing all possible error keys for basic profile form validation\n */\nexport type BasicProfileErrorKey = keyof typeof BASIC_PROFILE_ERRORS;\n\n/**\n * Type representing all possible error keys for athlete profile form validation\n */\nexport type AthleteProfileErrorKey = keyof typeof ATHLETE_PROFILE_ERRORS;\n","/* eslint-disable no-magic-numbers */\nimport { z } from 'zod';\nimport { ATHLETE_PROFILE_ERRORS, BASIC_PROFILE_ERRORS } from './enums';\n\nconst MIN_NAME_LENGTH = 2;\nconst MAX_NAME_LENGTH = 50;\nconst MAX_BIO_LENGTH = 275;\n\n/**\n * Zod schema for basic profile form validation.\n * Validates common user profile fields including name, email, country, bio, and profile image.\n */\nexport const basicProfileSchema = z.object({\n name: z\n .string()\n .min(MIN_NAME_LENGTH, BASIC_PROFILE_ERRORS.NameMin)\n .max(MAX_NAME_LENGTH, BASIC_PROFILE_ERRORS.NameMax),\n email: z\n .string()\n .email(BASIC_PROFILE_ERRORS.EmailValid)\n .min(1, BASIC_PROFILE_ERRORS.EmailRequired),\n country: z.string().min(1, BASIC_PROFILE_ERRORS.CountryRequired),\n bio: z.string().max(MAX_BIO_LENGTH, BASIC_PROFILE_ERRORS.BioMax).optional(),\n profileImage: z\n .union([\n z\n .instanceof(File)\n .refine(\n file => file.size <= 5 * 1024 * 1024, // 5MB\n BASIC_PROFILE_ERRORS.ProfileImageSize\n )\n .refine(\n file => ['image/png', 'image/jpeg', 'image/jpg', 'image/webp'].includes(file.type),\n BASIC_PROFILE_ERRORS.ProfileImageTypes\n ),\n z.string(),\n z.null(),\n ])\n .optional(),\n});\n\n/**\n * Zod schema for fan profile form validation.\n * Extends basicProfileSchema without additional fields.\n */\nexport const fanProfileSchema = basicProfileSchema.extend({});\n\n/**\n * Zod schema for athlete profile form validation.\n * Extends basicProfileSchema with athlete-specific fields including physical stats,\n * team information, social media handles, and highlight images.\n */\nexport const athleteProfileSchema = basicProfileSchema.extend({\n dateOfBirth: z\n .date()\n .max(new Date(), ATHLETE_PROFILE_ERRORS.DobMax)\n .min(new Date(1900, 0, 1), ATHLETE_PROFILE_ERRORS.DobMin)\n .optional(),\n height: z\n .number()\n .min(50, ATHLETE_PROFILE_ERRORS.HeightMin)\n .max(300, ATHLETE_PROFILE_ERRORS.HeightMax)\n .optional(),\n weight: z\n .number()\n .min(10, ATHLETE_PROFILE_ERRORS.WeightMin)\n .max(500, ATHLETE_PROFILE_ERRORS.WeightMax)\n .optional(),\n position: z\n .string()\n .min(2, ATHLETE_PROFILE_ERRORS.PositionMin)\n .max(50, ATHLETE_PROFILE_ERRORS.PositionMax)\n .optional(),\n teamName: z\n .string()\n .min(2, ATHLETE_PROFILE_ERRORS.TeamMin)\n .max(100, ATHLETE_PROFILE_ERRORS.TeamMax)\n .optional(),\n instagramHandle: z\n .string()\n .regex(/^@?[a-zA-Z0-9._]{1,30}$/, ATHLETE_PROFILE_ERRORS.InstagramInvalid)\n .optional(),\n tiktokHandle: z\n .string()\n .regex(/^@?[a-zA-Z0-9._]{1,24}$/, ATHLETE_PROFILE_ERRORS.TiktokInvalid)\n .optional(),\n highlightImage: z\n .union([\n z\n .instanceof(File)\n .refine(\n file => file.size <= 5 * 1024 * 1024, // 5MB\n ATHLETE_PROFILE_ERRORS.HighlightImageSize\n )\n .refine(\n file => ['image/png', 'image/jpeg', 'image/jpg'].includes(file.type),\n ATHLETE_PROFILE_ERRORS.HighlightImageTypes\n ),\n z.string(),\n z.null(),\n ])\n .optional(),\n});\n\n/**\n * Type inferred from basicProfileSchema for basic profile form data\n */\nexport type BasicProfileFormData = z.infer<typeof basicProfileSchema>;\n\n/**\n * Type inferred from fanProfileSchema for fan profile form data\n */\nexport type FanProfileFormData = z.infer<typeof fanProfileSchema>;\n\n/**\n * Type inferred from athleteProfileSchema for athlete profile form data\n */\nexport type AthleteProfileFormData = z.infer<typeof athleteProfileSchema>;\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './enums';
2
+ export * from './schemas';
3
+ export type * from './types';
@@ -0,0 +1,115 @@
1
+ import { z } from 'zod';
2
+
3
+ // @plyaz package - Built with tsup
4
+
5
+ // src/user/enums.ts
6
+ var COUNTRIES = {
7
+ unitedKingdom: "unitedKingdom",
8
+ germany: "germany",
9
+ france: "france",
10
+ spain: "spain",
11
+ italy: "italy",
12
+ netherlands: "netherlands",
13
+ belgium: "belgium",
14
+ austria: "austria",
15
+ switzerland: "switzerland",
16
+ sweden: "sweden",
17
+ norway: "norway",
18
+ denmark: "denmark",
19
+ finland: "finland",
20
+ portugal: "portugal",
21
+ ireland: "ireland",
22
+ poland: "poland",
23
+ czechRepublic: "czechRepublic",
24
+ hungary: "hungary",
25
+ romania: "romania",
26
+ bulgaria: "bulgaria",
27
+ croatia: "croatia",
28
+ slovenia: "slovenia",
29
+ slovakia: "slovakia",
30
+ estonia: "estonia",
31
+ latvia: "latvia",
32
+ lithuania: "lithuania",
33
+ greece: "greece",
34
+ cyprus: "cyprus",
35
+ malta: "malta",
36
+ luxembourg: "luxembourg",
37
+ other: "other"
38
+ };
39
+ var BASIC_PROFILE_ERRORS = /* @__PURE__ */ ((BASIC_PROFILE_ERRORS2) => {
40
+ BASIC_PROFILE_ERRORS2["NameMin"] = "components.BasicProfileForm.errors.nameMin";
41
+ BASIC_PROFILE_ERRORS2["NameMax"] = "components.BasicProfileForm.errors.nameMax";
42
+ BASIC_PROFILE_ERRORS2["EmailValid"] = "components.BasicProfileForm.errors.emailValid";
43
+ BASIC_PROFILE_ERRORS2["EmailRequired"] = "components.BasicProfileForm.errors.emailRequired";
44
+ BASIC_PROFILE_ERRORS2["CountryRequired"] = "components.BasicProfileForm.errors.countryRequired";
45
+ BASIC_PROFILE_ERRORS2["BioMax"] = "components.BasicProfileForm.errors.bioMax";
46
+ BASIC_PROFILE_ERRORS2["ProfileImageSize"] = "components.BasicProfileForm.errors.profileImageSize";
47
+ BASIC_PROFILE_ERRORS2["ProfileImageTypes"] = "components.BasicProfileForm.errors.profileImageTypes";
48
+ return BASIC_PROFILE_ERRORS2;
49
+ })(BASIC_PROFILE_ERRORS || {});
50
+ var ATHLETE_PROFILE_ERRORS = /* @__PURE__ */ ((ATHLETE_PROFILE_ERRORS2) => {
51
+ ATHLETE_PROFILE_ERRORS2["DobMax"] = "components.AthleteProfileForm.errors.dobMax";
52
+ ATHLETE_PROFILE_ERRORS2["DobMin"] = "components.AthleteProfileForm.errors.dobMin";
53
+ ATHLETE_PROFILE_ERRORS2["HeightMin"] = "components.AthleteProfileForm.errors.heightMin";
54
+ ATHLETE_PROFILE_ERRORS2["HeightMax"] = "components.AthleteProfileForm.errors.heightMax";
55
+ ATHLETE_PROFILE_ERRORS2["HeightInvalid"] = "components.AthleteProfileForm.errors.heightInvalid";
56
+ ATHLETE_PROFILE_ERRORS2["WeightMin"] = "components.AthleteProfileForm.errors.weightMin";
57
+ ATHLETE_PROFILE_ERRORS2["WeightMax"] = "components.AthleteProfileForm.errors.weightMax";
58
+ ATHLETE_PROFILE_ERRORS2["WeightInvalid"] = "components.AthleteProfileForm.errors.weightInvalid";
59
+ ATHLETE_PROFILE_ERRORS2["PositionMin"] = "components.AthleteProfileForm.errors.positionMin";
60
+ ATHLETE_PROFILE_ERRORS2["PositionMax"] = "components.AthleteProfileForm.errors.positionMax";
61
+ ATHLETE_PROFILE_ERRORS2["TeamMin"] = "components.AthleteProfileForm.errors.teamMin";
62
+ ATHLETE_PROFILE_ERRORS2["TeamMax"] = "components.AthleteProfileForm.errors.teamMax";
63
+ ATHLETE_PROFILE_ERRORS2["InstagramInvalid"] = "components.AthleteProfileForm.errors.instagramInvalid";
64
+ ATHLETE_PROFILE_ERRORS2["TiktokInvalid"] = "components.AthleteProfileForm.errors.tiktokInvalid";
65
+ ATHLETE_PROFILE_ERRORS2["HighlightImageSize"] = "components.AthleteProfileForm.errors.highlightImageSize";
66
+ ATHLETE_PROFILE_ERRORS2["HighlightImageTypes"] = "components.AthleteProfileForm.errors.highlightImageTypes";
67
+ return ATHLETE_PROFILE_ERRORS2;
68
+ })(ATHLETE_PROFILE_ERRORS || {});
69
+ var MIN_NAME_LENGTH = 2;
70
+ var MAX_NAME_LENGTH = 50;
71
+ var MAX_BIO_LENGTH = 275;
72
+ var basicProfileSchema = z.object({
73
+ name: z.string().min(MIN_NAME_LENGTH, "components.BasicProfileForm.errors.nameMin" /* NameMin */).max(MAX_NAME_LENGTH, "components.BasicProfileForm.errors.nameMax" /* NameMax */),
74
+ email: z.string().email("components.BasicProfileForm.errors.emailValid" /* EmailValid */).min(1, "components.BasicProfileForm.errors.emailRequired" /* EmailRequired */),
75
+ country: z.string().min(1, "components.BasicProfileForm.errors.countryRequired" /* CountryRequired */),
76
+ bio: z.string().max(MAX_BIO_LENGTH, "components.BasicProfileForm.errors.bioMax" /* BioMax */).optional(),
77
+ profileImage: z.union([
78
+ z.instanceof(File).refine(
79
+ (file) => file.size <= 5 * 1024 * 1024,
80
+ // 5MB
81
+ "components.BasicProfileForm.errors.profileImageSize" /* ProfileImageSize */
82
+ ).refine(
83
+ (file) => ["image/png", "image/jpeg", "image/jpg", "image/webp"].includes(file.type),
84
+ "components.BasicProfileForm.errors.profileImageTypes" /* ProfileImageTypes */
85
+ ),
86
+ z.string(),
87
+ z.null()
88
+ ]).optional()
89
+ });
90
+ var fanProfileSchema = basicProfileSchema.extend({});
91
+ var athleteProfileSchema = basicProfileSchema.extend({
92
+ dateOfBirth: z.date().max(/* @__PURE__ */ new Date(), "components.AthleteProfileForm.errors.dobMax" /* DobMax */).min(new Date(1900, 0, 1), "components.AthleteProfileForm.errors.dobMin" /* DobMin */).optional(),
93
+ height: z.number().min(50, "components.AthleteProfileForm.errors.heightMin" /* HeightMin */).max(300, "components.AthleteProfileForm.errors.heightMax" /* HeightMax */).optional(),
94
+ weight: z.number().min(10, "components.AthleteProfileForm.errors.weightMin" /* WeightMin */).max(500, "components.AthleteProfileForm.errors.weightMax" /* WeightMax */).optional(),
95
+ position: z.string().min(2, "components.AthleteProfileForm.errors.positionMin" /* PositionMin */).max(50, "components.AthleteProfileForm.errors.positionMax" /* PositionMax */).optional(),
96
+ teamName: z.string().min(2, "components.AthleteProfileForm.errors.teamMin" /* TeamMin */).max(100, "components.AthleteProfileForm.errors.teamMax" /* TeamMax */).optional(),
97
+ instagramHandle: z.string().regex(/^@?[a-zA-Z0-9._]{1,30}$/, "components.AthleteProfileForm.errors.instagramInvalid" /* InstagramInvalid */).optional(),
98
+ tiktokHandle: z.string().regex(/^@?[a-zA-Z0-9._]{1,24}$/, "components.AthleteProfileForm.errors.tiktokInvalid" /* TiktokInvalid */).optional(),
99
+ highlightImage: z.union([
100
+ z.instanceof(File).refine(
101
+ (file) => file.size <= 5 * 1024 * 1024,
102
+ // 5MB
103
+ "components.AthleteProfileForm.errors.highlightImageSize" /* HighlightImageSize */
104
+ ).refine(
105
+ (file) => ["image/png", "image/jpeg", "image/jpg"].includes(file.type),
106
+ "components.AthleteProfileForm.errors.highlightImageTypes" /* HighlightImageTypes */
107
+ ),
108
+ z.string(),
109
+ z.null()
110
+ ]).optional()
111
+ });
112
+
113
+ export { ATHLETE_PROFILE_ERRORS, BASIC_PROFILE_ERRORS, COUNTRIES, athleteProfileSchema, basicProfileSchema, fanProfileSchema };
114
+ //# sourceMappingURL=index.js.map
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/user/enums.ts","../../src/user/schemas.ts"],"names":["BASIC_PROFILE_ERRORS","ATHLETE_PROFILE_ERRORS"],"mappings":";;;;;AAIO,IAAM,SAAA,GAAY;AAAA,EACvB,aAAA,EAAe,eAAA;AAAA,EACf,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,WAAA,EAAa,aAAA;AAAA,EACb,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,WAAA,EAAa,aAAA;AAAA,EACb,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,aA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AA,uDAAA,yBACN,QAAA,EAAS;AAAA,EACZ,cAAc,CAAA,CACX,MAAA,GACA,KAAA,CAAM,yBAAA,EAAA,oDAAA,sBACN,QAAA,EAAS;AAAA,EACZ,cAAA,EAAgB,EACb,KAAA,CAAM;AAAA,IACL,CAAA,CACG,UAAA,CAAW,IAAI,CAAA,CACf,MAAA;AAAA,MACC,CAAA,IAAA,KAAQ,IAAA,CAAK,IAAA,IAAQ,CAAA,GAAI,IAAA,GAAO,IAAA;AAAA;AAAA,MAAA,yDAAA;AAAA,KAElC,CACC,MAAA;AAAA,MACC,CAAA,IAAA,KAAQ,CAAC,WAAA,EAAa,YAAA,EAAc,WAAW,CAAA,CAAE,QAAA,CAAS,KAAK,IAAI,CAAA;AAAA,MAAA,0DAAA;AAAA,KAErE;AAAA,IACF,EAAE,MAAA,EAAO;AAAA,IACT,EAAE,IAAA;AAAK,GACR,EACA,QAAA;AACL,CAAC","file":"index.js","sourcesContent":["/**\n * Object containing all supported country codes and their corresponding values.\n * Primarily covers European Union countries plus additional regions.\n */\nexport const COUNTRIES = {\n unitedKingdom: 'unitedKingdom',\n germany: 'germany',\n france: 'france',\n spain: 'spain',\n italy: 'italy',\n netherlands: 'netherlands',\n belgium: 'belgium',\n austria: 'austria',\n switzerland: 'switzerland',\n sweden: 'sweden',\n norway: 'norway',\n denmark: 'denmark',\n finland: 'finland',\n portugal: 'portugal',\n ireland: 'ireland',\n poland: 'poland',\n czechRepublic: 'czechRepublic',\n hungary: 'hungary',\n romania: 'romania',\n bulgaria: 'bulgaria',\n croatia: 'croatia',\n slovenia: 'slovenia',\n slovakia: 'slovakia',\n estonia: 'estonia',\n latvia: 'latvia',\n lithuania: 'lithuania',\n greece: 'greece',\n cyprus: 'cyprus',\n malta: 'malta',\n luxembourg: 'luxembourg',\n other: 'other',\n} as const;\n\n/**\n * Enum containing error message keys for basic profile form validation.\n * Contains localized error message keys that map to translation strings.\n */\nexport enum BASIC_PROFILE_ERRORS {\n /** Error when name is below minimum length */\n NameMin = 'components.BasicProfileForm.errors.nameMin',\n /** Error when name exceeds maximum length */\n NameMax = 'components.BasicProfileForm.errors.nameMax',\n /** Error when email format is invalid */\n EmailValid = 'components.BasicProfileForm.errors.emailValid',\n /** Error when email is required but not provided */\n EmailRequired = 'components.BasicProfileForm.errors.emailRequired',\n /** Error when country is required but not selected */\n CountryRequired = 'components.BasicProfileForm.errors.countryRequired',\n /** Error when bio exceeds maximum length */\n BioMax = 'components.BasicProfileForm.errors.bioMax',\n /** Error when profile image size exceeds limit */\n ProfileImageSize = 'components.BasicProfileForm.errors.profileImageSize',\n /** Error when profile image type is not supported */\n ProfileImageTypes = 'components.BasicProfileForm.errors.profileImageTypes',\n}\n\n/**\n * Enum containing error message keys for athlete profile form validation.\n * Contains localized error message keys that map to translation strings.\n */\nexport enum ATHLETE_PROFILE_ERRORS {\n /** Error when date of birth is too recent (maximum age validation) */\n DobMax = 'components.AthleteProfileForm.errors.dobMax',\n /** Error when date of birth is too old (minimum age validation) */\n DobMin = 'components.AthleteProfileForm.errors.dobMin',\n /** Error when height is below minimum value */\n HeightMin = 'components.AthleteProfileForm.errors.heightMin',\n /** Error when height exceeds maximum value */\n HeightMax = 'components.AthleteProfileForm.errors.heightMax',\n /** Error when height format is invalid */\n HeightInvalid = 'components.AthleteProfileForm.errors.heightInvalid',\n /** Error when weight is below minimum value */\n WeightMin = 'components.AthleteProfileForm.errors.weightMin',\n /** Error when weight exceeds maximum value */\n WeightMax = 'components.AthleteProfileForm.errors.weightMax',\n /** Error when weight format is invalid */\n WeightInvalid = 'components.AthleteProfileForm.errors.weightInvalid',\n /** Error when position is below minimum length */\n PositionMin = 'components.AthleteProfileForm.errors.positionMin',\n /** Error when position exceeds maximum length */\n PositionMax = 'components.AthleteProfileForm.errors.positionMax',\n /** Error when team name is below minimum length */\n TeamMin = 'components.AthleteProfileForm.errors.teamMin',\n /** Error when team name exceeds maximum length */\n TeamMax = 'components.AthleteProfileForm.errors.teamMax',\n /** Error when Instagram handle format is invalid */\n InstagramInvalid = 'components.AthleteProfileForm.errors.instagramInvalid',\n /** Error when TikTok handle format is invalid */\n TiktokInvalid = 'components.AthleteProfileForm.errors.tiktokInvalid',\n /** Error when highlight image size exceeds limit */\n HighlightImageSize = 'components.AthleteProfileForm.errors.highlightImageSize',\n /** Error when highlight image type is not supported */\n HighlightImageTypes = 'components.AthleteProfileForm.errors.highlightImageTypes',\n}\n\n/**\n * Type representing all possible error keys for basic profile form validation\n */\nexport type BasicProfileErrorKey = keyof typeof BASIC_PROFILE_ERRORS;\n\n/**\n * Type representing all possible error keys for athlete profile form validation\n */\nexport type AthleteProfileErrorKey = keyof typeof ATHLETE_PROFILE_ERRORS;\n","/* eslint-disable no-magic-numbers */\nimport { z } from 'zod';\nimport { ATHLETE_PROFILE_ERRORS, BASIC_PROFILE_ERRORS } from './enums';\n\nconst MIN_NAME_LENGTH = 2;\nconst MAX_NAME_LENGTH = 50;\nconst MAX_BIO_LENGTH = 275;\n\n/**\n * Zod schema for basic profile form validation.\n * Validates common user profile fields including name, email, country, bio, and profile image.\n */\nexport const basicProfileSchema = z.object({\n name: z\n .string()\n .min(MIN_NAME_LENGTH, BASIC_PROFILE_ERRORS.NameMin)\n .max(MAX_NAME_LENGTH, BASIC_PROFILE_ERRORS.NameMax),\n email: z\n .string()\n .email(BASIC_PROFILE_ERRORS.EmailValid)\n .min(1, BASIC_PROFILE_ERRORS.EmailRequired),\n country: z.string().min(1, BASIC_PROFILE_ERRORS.CountryRequired),\n bio: z.string().max(MAX_BIO_LENGTH, BASIC_PROFILE_ERRORS.BioMax).optional(),\n profileImage: z\n .union([\n z\n .instanceof(File)\n .refine(\n file => file.size <= 5 * 1024 * 1024, // 5MB\n BASIC_PROFILE_ERRORS.ProfileImageSize\n )\n .refine(\n file => ['image/png', 'image/jpeg', 'image/jpg', 'image/webp'].includes(file.type),\n BASIC_PROFILE_ERRORS.ProfileImageTypes\n ),\n z.string(),\n z.null(),\n ])\n .optional(),\n});\n\n/**\n * Zod schema for fan profile form validation.\n * Extends basicProfileSchema without additional fields.\n */\nexport const fanProfileSchema = basicProfileSchema.extend({});\n\n/**\n * Zod schema for athlete profile form validation.\n * Extends basicProfileSchema with athlete-specific fields including physical stats,\n * team information, social media handles, and highlight images.\n */\nexport const athleteProfileSchema = basicProfileSchema.extend({\n dateOfBirth: z\n .date()\n .max(new Date(), ATHLETE_PROFILE_ERRORS.DobMax)\n .min(new Date(1900, 0, 1), ATHLETE_PROFILE_ERRORS.DobMin)\n .optional(),\n height: z\n .number()\n .min(50, ATHLETE_PROFILE_ERRORS.HeightMin)\n .max(300, ATHLETE_PROFILE_ERRORS.HeightMax)\n .optional(),\n weight: z\n .number()\n .min(10, ATHLETE_PROFILE_ERRORS.WeightMin)\n .max(500, ATHLETE_PROFILE_ERRORS.WeightMax)\n .optional(),\n position: z\n .string()\n .min(2, ATHLETE_PROFILE_ERRORS.PositionMin)\n .max(50, ATHLETE_PROFILE_ERRORS.PositionMax)\n .optional(),\n teamName: z\n .string()\n .min(2, ATHLETE_PROFILE_ERRORS.TeamMin)\n .max(100, ATHLETE_PROFILE_ERRORS.TeamMax)\n .optional(),\n instagramHandle: z\n .string()\n .regex(/^@?[a-zA-Z0-9._]{1,30}$/, ATHLETE_PROFILE_ERRORS.InstagramInvalid)\n .optional(),\n tiktokHandle: z\n .string()\n .regex(/^@?[a-zA-Z0-9._]{1,24}$/, ATHLETE_PROFILE_ERRORS.TiktokInvalid)\n .optional(),\n highlightImage: z\n .union([\n z\n .instanceof(File)\n .refine(\n file => file.size <= 5 * 1024 * 1024, // 5MB\n ATHLETE_PROFILE_ERRORS.HighlightImageSize\n )\n .refine(\n file => ['image/png', 'image/jpeg', 'image/jpg'].includes(file.type),\n ATHLETE_PROFILE_ERRORS.HighlightImageTypes\n ),\n z.string(),\n z.null(),\n ])\n .optional(),\n});\n\n/**\n * Type inferred from basicProfileSchema for basic profile form data\n */\nexport type BasicProfileFormData = z.infer<typeof basicProfileSchema>;\n\n/**\n * Type inferred from fanProfileSchema for fan profile form data\n */\nexport type FanProfileFormData = z.infer<typeof fanProfileSchema>;\n\n/**\n * Type inferred from athleteProfileSchema for athlete profile form data\n */\nexport type AthleteProfileFormData = z.infer<typeof athleteProfileSchema>;\n"]}
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod schema for basic profile form validation.
4
+ * Validates common user profile fields including name, email, country, bio, and profile image.
5
+ */
6
+ export declare const basicProfileSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ email: z.ZodString;
9
+ country: z.ZodString;
10
+ bio: z.ZodOptional<z.ZodString>;
11
+ profileImage: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodString, z.ZodNull]>>;
12
+ }, z.core.$strip>;
13
+ /**
14
+ * Zod schema for fan profile form validation.
15
+ * Extends basicProfileSchema without additional fields.
16
+ */
17
+ export declare const fanProfileSchema: z.ZodObject<{
18
+ name: z.ZodString;
19
+ email: z.ZodString;
20
+ country: z.ZodString;
21
+ bio: z.ZodOptional<z.ZodString>;
22
+ profileImage: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodString, z.ZodNull]>>;
23
+ }, z.core.$strip>;
24
+ /**
25
+ * Zod schema for athlete profile form validation.
26
+ * Extends basicProfileSchema with athlete-specific fields including physical stats,
27
+ * team information, social media handles, and highlight images.
28
+ */
29
+ export declare const athleteProfileSchema: z.ZodObject<{
30
+ name: z.ZodString;
31
+ email: z.ZodString;
32
+ country: z.ZodString;
33
+ bio: z.ZodOptional<z.ZodString>;
34
+ profileImage: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodString, z.ZodNull]>>;
35
+ dateOfBirth: z.ZodOptional<z.ZodDate>;
36
+ height: z.ZodOptional<z.ZodNumber>;
37
+ weight: z.ZodOptional<z.ZodNumber>;
38
+ position: z.ZodOptional<z.ZodString>;
39
+ teamName: z.ZodOptional<z.ZodString>;
40
+ instagramHandle: z.ZodOptional<z.ZodString>;
41
+ tiktokHandle: z.ZodOptional<z.ZodString>;
42
+ highlightImage: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodString, z.ZodNull]>>;
43
+ }, z.core.$strip>;
44
+ /**
45
+ * Type inferred from basicProfileSchema for basic profile form data
46
+ */
47
+ export type BasicProfileFormData = z.infer<typeof basicProfileSchema>;
48
+ /**
49
+ * Type inferred from fanProfileSchema for fan profile form data
50
+ */
51
+ export type FanProfileFormData = z.infer<typeof fanProfileSchema>;
52
+ /**
53
+ * Type inferred from athleteProfileSchema for athlete profile form data
54
+ */
55
+ export type AthleteProfileFormData = z.infer<typeof athleteProfileSchema>;
@@ -0,0 +1,59 @@
1
+ import type { USER_TYPE } from '../payments';
2
+ import type { COUNTRIES } from './enums';
3
+ /**
4
+ * Type representing valid country codes from the COUNTRIES enum
5
+ */
6
+ export type CountryCode = keyof typeof COUNTRIES;
7
+ /**
8
+ * Base user interface with common fields shared across all user types
9
+ */
10
+ export interface BaseUser {
11
+ /** Unique user identifier */
12
+ id: string;
13
+ /** User's full name */
14
+ name: string;
15
+ /** User's email address */
16
+ email: string;
17
+ /** User's country code */
18
+ country: string;
19
+ /** Optional user biography/description */
20
+ bio?: string;
21
+ /** Optional profile image URL or path */
22
+ profileImage?: string;
23
+ /** Type of user (athlete or fan) */
24
+ userType: USER_TYPE;
25
+ }
26
+ /**
27
+ * Fan user interface extending BaseUser with fan-specific properties
28
+ */
29
+ export interface FanUser extends BaseUser {
30
+ /** Fan user type */
31
+ userType: USER_TYPE.Fan;
32
+ }
33
+ /**
34
+ * Athlete user interface extending BaseUser with athlete-specific properties
35
+ */
36
+ export interface AthleteUser extends BaseUser {
37
+ /** Athlete user type */
38
+ userType: USER_TYPE.Athlete;
39
+ /** Athlete's date of birth */
40
+ dateOfBirth?: Date;
41
+ /** Athlete's height in centimeters */
42
+ height?: number;
43
+ /** Athlete's weight in kilograms */
44
+ weight?: number;
45
+ /** Athlete's playing position */
46
+ position?: string;
47
+ /** Athlete's team name */
48
+ teamName?: string;
49
+ /** Athlete's Instagram handle */
50
+ instagramHandle?: string;
51
+ /** Athlete's TikTok handle */
52
+ tiktokHandle?: string;
53
+ /** Athlete's highlight image URL or path */
54
+ highlightImage?: string;
55
+ }
56
+ /**
57
+ * Union type representing all possible user types in the system
58
+ */
59
+ export type User = FanUser | AthleteUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.14.11",
3
+ "version": "1.15.0",
4
4
  "author": "Redeemer Pace",
5
5
  "license": "ISC",
6
6
  "description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
@@ -190,6 +190,16 @@
190
190
  "import": "./dist/db/index.js",
191
191
  "require": "./dist/db/index.cjs"
192
192
  },
193
+ "./user": {
194
+ "types": "./dist/user/index.d.ts",
195
+ "import": "./dist/user/index.js",
196
+ "require": "./dist/user/index.cjs"
197
+ },
198
+ "./campaign": {
199
+ "types": "./dist/campaign/index.d.ts",
200
+ "import": "./dist/campaign/index.js",
201
+ "require": "./dist/campaign/index.cjs"
202
+ },
193
203
  "./package.json": "./package.json"
194
204
  },
195
205
  "files": [