@zyacreatives/shared 2.2.94 → 2.2.96

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.
@@ -191,6 +191,12 @@ export declare const JOB_STATUS: {
191
191
  readonly ARCHIVED: "ARCHIVED";
192
192
  readonly DELETED: "DELETED";
193
193
  };
194
+ export declare const PRODUCT_STATUS: {
195
+ readonly ACTIVE: "ACTIVE";
196
+ readonly DRAFT: "DRAFT";
197
+ readonly ARCHIVED: "ARCHIVED";
198
+ readonly DELETED: "DELETED";
199
+ };
194
200
  export declare const MESSAGE_REQUEST_STATUS: {
195
201
  readonly PENDING: "PENDING";
196
202
  readonly ACCEPTED: "ACCEPTED";
@@ -299,6 +305,7 @@ export type PostBadgeType = (typeof POST_BADGE_TYPES)[keyof typeof POST_BADGE_TY
299
305
  export type JobSections = (typeof JOB_SECTIONS)[keyof typeof JOB_SECTIONS];
300
306
  export type WagesCurrency = (typeof WAGES_CURRENCY)[keyof typeof WAGES_CURRENCY];
301
307
  export type JobStatus = (typeof JOB_STATUS)[keyof typeof JOB_STATUS];
308
+ export type ProductStatus = (typeof PRODUCT_STATUS)[keyof typeof PRODUCT_STATUS];
302
309
  export type Role = (typeof ROLES)[keyof typeof ROLES];
303
310
  export type JobType = (typeof JOB_TYPE)[keyof typeof JOB_TYPE];
304
311
  export type WorkMode = (typeof WORK_MODE)[keyof typeof WORK_MODE];
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ANALYTICS_EVENTS = exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.DISCOUNT_TYPES = exports.PRICING_MODELS = exports.GATEWAY_PROVIDER = exports.COUNTRY_OF_OPERATION = exports.SIGNAL_STATUS = exports.SIGNAL_INTEREST_TYPES = exports.VENTURE_STAGES = exports.NOTIFICATION_TYPES = exports.APPLICATION_STATUS = exports.LINK_TYPES = exports.ACTIVITY_TYPES = exports.POST_BADGE_TYPES = exports.PROJECT_STATUS = exports.MESSAGE_REQUEST_STATUS = exports.JOB_STATUS = exports.WAGES_CURRENCY = exports.GIG_TYPE = exports.MESSAGE_TYPES = exports.JOB_LOCATIONS = exports.JOB_SECTIONS = exports.WAGE_TYPES = exports.JOB_AVAILABILITY_TYPES = exports.EMPLOYMENT_TYPE = exports.WORK_MODE = exports.JOB_TYPE = exports.POST_TYPES = exports.ACTIVITY_PARENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.PAYMENT_METHOD_STATUS = exports.SELLER_STATUS = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
3
+ exports.ANALYTICS_EVENTS = exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.DISCOUNT_TYPES = exports.PRICING_MODELS = exports.GATEWAY_PROVIDER = exports.COUNTRY_OF_OPERATION = exports.SIGNAL_STATUS = exports.SIGNAL_INTEREST_TYPES = exports.VENTURE_STAGES = exports.NOTIFICATION_TYPES = exports.APPLICATION_STATUS = exports.LINK_TYPES = exports.ACTIVITY_TYPES = exports.POST_BADGE_TYPES = exports.PROJECT_STATUS = exports.MESSAGE_REQUEST_STATUS = exports.PRODUCT_STATUS = exports.JOB_STATUS = exports.WAGES_CURRENCY = exports.GIG_TYPE = exports.MESSAGE_TYPES = exports.JOB_LOCATIONS = exports.JOB_SECTIONS = exports.WAGE_TYPES = exports.JOB_AVAILABILITY_TYPES = exports.EMPLOYMENT_TYPE = exports.WORK_MODE = exports.JOB_TYPE = exports.POST_TYPES = exports.ACTIVITY_PARENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.PAYMENT_METHOD_STATUS = exports.SELLER_STATUS = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
4
4
  exports.ROLES = {
5
5
  CREATIVE: "CREATIVE",
6
6
  BRAND: "BRAND",
@@ -189,6 +189,7 @@ exports.JOB_STATUS = {
189
189
  ARCHIVED: "ARCHIVED",
190
190
  DELETED: "DELETED",
191
191
  };
192
+ exports.PRODUCT_STATUS = exports.JOB_STATUS;
192
193
  exports.MESSAGE_REQUEST_STATUS = {
193
194
  PENDING: "PENDING",
194
195
  ACCEPTED: "ACCEPTED",
@@ -27,11 +27,22 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
27
27
  amount: z.ZodNumber;
28
28
  discountCode: z.ZodOptional<z.ZodString>;
29
29
  }, z.core.$strip>;
30
+ export declare const ProductLinkSchema: z.ZodObject<{
31
+ title: z.ZodNullable<z.ZodString>;
32
+ url: z.ZodString;
33
+ }, z.core.$strip>;
34
+ export type ProductLink = z.infer<typeof ProductLinkSchema>;
30
35
  export declare const BaseProductSchema: z.ZodObject<{
31
36
  id: z.ZodCUID2;
32
37
  createdAt: z.ZodDate;
33
38
  updatedAt: z.ZodDate;
34
39
  deletedAt: z.ZodNullable<z.ZodDate>;
40
+ status: z.ZodDefault<z.ZodEnum<{
41
+ readonly ACTIVE: "ACTIVE";
42
+ readonly DRAFT: "DRAFT";
43
+ readonly ARCHIVED: "ARCHIVED";
44
+ readonly DELETED: "DELETED";
45
+ }>>;
35
46
  sellerId: z.ZodCUID2;
36
47
  title: z.ZodString;
37
48
  description: z.ZodString;
@@ -39,13 +50,27 @@ export declare const BaseProductSchema: z.ZodObject<{
39
50
  category: z.ZodString;
40
51
  subcategory: z.ZodNullable<z.ZodString>;
41
52
  tags: z.ZodNullable<z.ZodArray<z.ZodString>>;
42
- productLinks: z.ZodNullable<z.ZodArray<z.ZodString>>;
53
+ productLinks: z.ZodNullable<z.ZodArray<z.ZodObject<{
54
+ title: z.ZodNullable<z.ZodString>;
55
+ url: z.ZodString;
56
+ }, z.core.$strip>>>;
43
57
  pricingModel: z.ZodEnum<{
44
58
  readonly FREE: "Free";
45
59
  readonly FIXED: "Fixed";
46
60
  readonly PWYW: "Pay What You Want";
47
61
  }>;
48
- currency: z.ZodString;
62
+ currency: z.ZodEnum<{
63
+ readonly USD: "USD (United States Dollar)";
64
+ readonly EUR: "EUR (Euro)";
65
+ readonly GBP: "GBP (British Pound Sterling)";
66
+ readonly NGN: "NGN (Nigerian Naira)";
67
+ readonly CAD: "CAD (Canadian Dollar)";
68
+ readonly AUD: "AUD (Australian Dollar)";
69
+ readonly JPY: "JPY (Japanese Yen)";
70
+ readonly CHF: "CHF (Swiss Franc)";
71
+ readonly INR: "INR (Indian Rupee)";
72
+ readonly ZAR: "ZAR (South African Rand)";
73
+ }>;
49
74
  price: z.ZodNullable<z.ZodNumber>;
50
75
  suggestedPrice: z.ZodNullable<z.ZodNumber>;
51
76
  discounts: z.ZodNullable<z.ZodArray<z.ZodObject<{
@@ -64,6 +89,12 @@ export declare const CreateProductInputSchema: z.ZodObject<{
64
89
  title: z.ZodString;
65
90
  description: z.ZodString;
66
91
  keyFeatures: z.ZodString;
92
+ status: z.ZodDefault<z.ZodEnum<{
93
+ readonly ACTIVE: "ACTIVE";
94
+ readonly DRAFT: "DRAFT";
95
+ readonly ARCHIVED: "ARCHIVED";
96
+ readonly DELETED: "DELETED";
97
+ }>>;
67
98
  category: z.ZodString;
68
99
  subcategory: z.ZodOptional<z.ZodString>;
69
100
  tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -73,18 +104,32 @@ export declare const CreateProductInputSchema: z.ZodObject<{
73
104
  isThumbnail: z.ZodDefault<z.ZodBoolean>;
74
105
  order: z.ZodDefault<z.ZodNumber>;
75
106
  }, z.core.$strip>>;
107
+ currency: z.ZodEnum<{
108
+ readonly USD: "USD (United States Dollar)";
109
+ readonly EUR: "EUR (Euro)";
110
+ readonly GBP: "GBP (British Pound Sterling)";
111
+ readonly NGN: "NGN (Nigerian Naira)";
112
+ readonly CAD: "CAD (Canadian Dollar)";
113
+ readonly AUD: "AUD (Australian Dollar)";
114
+ readonly JPY: "JPY (Japanese Yen)";
115
+ readonly CHF: "CHF (Swiss Franc)";
116
+ readonly INR: "INR (Indian Rupee)";
117
+ readonly ZAR: "ZAR (South African Rand)";
118
+ }>;
76
119
  productFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
77
120
  key: z.ZodString;
78
121
  mimeType: z.ZodString;
79
122
  order: z.ZodDefault<z.ZodNumber>;
80
123
  }, z.core.$strip>>>;
81
- productLinks: z.ZodDefault<z.ZodArray<z.ZodURL>>;
124
+ productLinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
125
+ title: z.ZodNullable<z.ZodString>;
126
+ url: z.ZodString;
127
+ }, z.core.$strip>>>;
82
128
  pricingModel: z.ZodDefault<z.ZodEnum<{
83
129
  readonly FREE: "Free";
84
130
  readonly FIXED: "Fixed";
85
131
  readonly PWYW: "Pay What You Want";
86
132
  }>>;
87
- currency: z.ZodDefault<z.ZodString>;
88
133
  price: z.ZodOptional<z.ZodNumber>;
89
134
  suggestedPrice: z.ZodOptional<z.ZodNumber>;
90
135
  discounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -109,6 +154,12 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
109
154
  title: z.ZodOptional<z.ZodString>;
110
155
  description: z.ZodOptional<z.ZodString>;
111
156
  keyFeatures: z.ZodOptional<z.ZodString>;
157
+ status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
158
+ readonly ACTIVE: "ACTIVE";
159
+ readonly DRAFT: "DRAFT";
160
+ readonly ARCHIVED: "ARCHIVED";
161
+ readonly DELETED: "DELETED";
162
+ }>>>;
112
163
  category: z.ZodOptional<z.ZodString>;
113
164
  subcategory: z.ZodOptional<z.ZodOptional<z.ZodString>>;
114
165
  tags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
@@ -118,18 +169,32 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
118
169
  isThumbnail: z.ZodDefault<z.ZodBoolean>;
119
170
  order: z.ZodDefault<z.ZodNumber>;
120
171
  }, z.core.$strip>>>;
172
+ currency: z.ZodOptional<z.ZodEnum<{
173
+ readonly USD: "USD (United States Dollar)";
174
+ readonly EUR: "EUR (Euro)";
175
+ readonly GBP: "GBP (British Pound Sterling)";
176
+ readonly NGN: "NGN (Nigerian Naira)";
177
+ readonly CAD: "CAD (Canadian Dollar)";
178
+ readonly AUD: "AUD (Australian Dollar)";
179
+ readonly JPY: "JPY (Japanese Yen)";
180
+ readonly CHF: "CHF (Swiss Franc)";
181
+ readonly INR: "INR (Indian Rupee)";
182
+ readonly ZAR: "ZAR (South African Rand)";
183
+ }>>;
121
184
  productFiles: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
122
185
  key: z.ZodString;
123
186
  mimeType: z.ZodString;
124
187
  order: z.ZodDefault<z.ZodNumber>;
125
188
  }, z.core.$strip>>>>;
126
- productLinks: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodURL>>>;
189
+ productLinks: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
190
+ title: z.ZodNullable<z.ZodString>;
191
+ url: z.ZodString;
192
+ }, z.core.$strip>>>>;
127
193
  pricingModel: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
128
194
  readonly FREE: "Free";
129
195
  readonly FIXED: "Fixed";
130
196
  readonly PWYW: "Pay What You Want";
131
197
  }>>>;
132
- currency: z.ZodOptional<z.ZodDefault<z.ZodString>>;
133
198
  price: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
134
199
  suggestedPrice: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
135
200
  discounts: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -157,6 +222,12 @@ export declare const ProductEntitySchema: z.ZodObject<{
157
222
  title: z.ZodString;
158
223
  description: z.ZodString;
159
224
  keyFeatures: z.ZodString;
225
+ status: z.ZodDefault<z.ZodEnum<{
226
+ readonly ACTIVE: "ACTIVE";
227
+ readonly DRAFT: "DRAFT";
228
+ readonly ARCHIVED: "ARCHIVED";
229
+ readonly DELETED: "DELETED";
230
+ }>>;
160
231
  category: z.ZodString;
161
232
  subcategory: z.ZodNullable<z.ZodOptional<z.ZodString>>;
162
233
  tags: z.ZodArray<z.ZodString>;
@@ -175,7 +246,18 @@ export declare const ProductEntitySchema: z.ZodObject<{
175
246
  readonly FIXED: "Fixed";
176
247
  readonly PWYW: "Pay What You Want";
177
248
  }>;
178
- currency: z.ZodString;
249
+ currency: z.ZodEnum<{
250
+ readonly USD: "USD (United States Dollar)";
251
+ readonly EUR: "EUR (Euro)";
252
+ readonly GBP: "GBP (British Pound Sterling)";
253
+ readonly NGN: "NGN (Nigerian Naira)";
254
+ readonly CAD: "CAD (Canadian Dollar)";
255
+ readonly AUD: "AUD (Australian Dollar)";
256
+ readonly JPY: "JPY (Japanese Yen)";
257
+ readonly CHF: "CHF (Swiss Franc)";
258
+ readonly INR: "INR (Indian Rupee)";
259
+ readonly ZAR: "ZAR (South African Rand)";
260
+ }>;
179
261
  price: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
180
262
  suggestedPrice: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
181
263
  discounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.BaseProductSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = exports.DeliveryFileInputSchema = exports.CoverImageInputSchema = void 0;
3
+ exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.BaseProductSchema = exports.ProductLinkSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = exports.DeliveryFileInputSchema = exports.CoverImageInputSchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  // --- File Input Schemas ---
@@ -37,11 +37,16 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
37
37
  .min(0, "Discount amount cannot be negative"),
38
38
  discountCode: zod_openapi_1.z.string().optional(),
39
39
  });
40
+ exports.ProductLinkSchema = zod_openapi_1.z.object({
41
+ title: zod_openapi_1.z.string().nullable(),
42
+ url: zod_openapi_1.z.string(),
43
+ });
40
44
  exports.BaseProductSchema = zod_openapi_1.z.object({
41
45
  id: zod_openapi_1.z.cuid2(),
42
46
  createdAt: zod_openapi_1.z.date(),
43
47
  updatedAt: zod_openapi_1.z.date(),
44
48
  deletedAt: zod_openapi_1.z.date().nullable(),
49
+ status: zod_openapi_1.z.enum(constants_1.PRODUCT_STATUS).default("DRAFT"),
45
50
  sellerId: zod_openapi_1.z.cuid2(),
46
51
  title: zod_openapi_1.z.string(),
47
52
  description: zod_openapi_1.z.string(),
@@ -49,9 +54,9 @@ exports.BaseProductSchema = zod_openapi_1.z.object({
49
54
  category: zod_openapi_1.z.string(),
50
55
  subcategory: zod_openapi_1.z.string().nullable(),
51
56
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
52
- productLinks: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
57
+ productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).nullable(),
53
58
  pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
54
- currency: zod_openapi_1.z.string(),
59
+ currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
55
60
  price: zod_openapi_1.z.number().nullable(),
56
61
  suggestedPrice: zod_openapi_1.z.number().nullable(),
57
62
  discounts: zod_openapi_1.z
@@ -70,20 +75,18 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
70
75
  title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
71
76
  description: zod_openapi_1.z.string().min(1, "Description is required"),
72
77
  keyFeatures: zod_openapi_1.z.string(),
78
+ status: zod_openapi_1.z.enum(constants_1.PRODUCT_STATUS).default("DRAFT"),
73
79
  category: zod_openapi_1.z.string().min(1, "Category is required"),
74
80
  subcategory: zod_openapi_1.z.string().optional(),
75
81
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).max(10, "Keep tags to a maximum of 10").default([]),
76
- // Swapped to the new direct-upload input schemas
77
82
  coverImages: zod_openapi_1.z
78
83
  .array(exports.CoverImageInputSchema)
79
84
  .min(1, "At least one cover image is required")
80
85
  .max(3, "Maximum of 3 cover images allowed"),
86
+ currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
81
87
  productFiles: zod_openapi_1.z.array(exports.DeliveryFileInputSchema).default([]),
82
- productLinks: zod_openapi_1.z
83
- .array(zod_openapi_1.z.url().openapi({ example: "https://figma.com/file/..." }))
84
- .default([]),
88
+ productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
85
89
  pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS).default(constants_1.PRICING_MODELS.FIXED),
86
- currency: zod_openapi_1.z.string().default("USD").openapi({ example: "USD" }),
87
90
  price: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
88
91
  suggestedPrice: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
89
92
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
@@ -158,6 +161,7 @@ exports.ProductEntitySchema = zod_openapi_1.z
158
161
  title: zod_openapi_1.z.string(),
159
162
  description: zod_openapi_1.z.string(),
160
163
  keyFeatures: zod_openapi_1.z.string(),
164
+ status: zod_openapi_1.z.enum(constants_1.PRODUCT_STATUS).default("DRAFT"),
161
165
  category: zod_openapi_1.z.string(),
162
166
  subcategory: zod_openapi_1.z.string().optional().nullable(),
163
167
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()),
@@ -165,7 +169,7 @@ exports.ProductEntitySchema = zod_openapi_1.z
165
169
  productFiles: zod_openapi_1.z.array(exports.ProductDeliveryFileEntitySchema).default([]),
166
170
  productLinks: zod_openapi_1.z.array(zod_openapi_1.z.url()).default([]),
167
171
  pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
168
- currency: zod_openapi_1.z.string(),
172
+ currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
169
173
  price: zod_openapi_1.z.number().int().optional().nullable(),
170
174
  suggestedPrice: zod_openapi_1.z.number().int().optional().nullable(),
171
175
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.94",
3
+ "version": "2.2.96",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/constants.ts CHANGED
@@ -217,6 +217,8 @@ export const JOB_STATUS = {
217
217
  DELETED: "DELETED",
218
218
  } as const;
219
219
 
220
+ export const PRODUCT_STATUS = JOB_STATUS;
221
+
220
222
  export const MESSAGE_REQUEST_STATUS = {
221
223
  PENDING: "PENDING",
222
224
  ACCEPTED: "ACCEPTED",
@@ -345,6 +347,8 @@ export type JobSections = (typeof JOB_SECTIONS)[keyof typeof JOB_SECTIONS];
345
347
  export type WagesCurrency =
346
348
  (typeof WAGES_CURRENCY)[keyof typeof WAGES_CURRENCY];
347
349
  export type JobStatus = (typeof JOB_STATUS)[keyof typeof JOB_STATUS];
350
+ export type ProductStatus =
351
+ (typeof PRODUCT_STATUS)[keyof typeof PRODUCT_STATUS];
348
352
  export type Role = (typeof ROLES)[keyof typeof ROLES];
349
353
  export type JobType = (typeof JOB_TYPE)[keyof typeof JOB_TYPE];
350
354
  export type WorkMode = (typeof WORK_MODE)[keyof typeof WORK_MODE];
@@ -1,5 +1,10 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- import { DISCOUNT_TYPES, PRICING_MODELS } from "../constants";
2
+ import {
3
+ DISCOUNT_TYPES,
4
+ PRICING_MODELS,
5
+ PRODUCT_STATUS,
6
+ WAGES_CURRENCY,
7
+ } from "../constants";
3
8
 
4
9
  // --- File Input Schemas ---
5
10
 
@@ -42,14 +47,19 @@ export const ProductDiscountEntitySchema = z.object({
42
47
  discountCode: z.string().optional(),
43
48
  });
44
49
 
50
+ export const ProductLinkSchema = z.object({
51
+ title: z.string().nullable(),
52
+ url: z.string(),
53
+ });
54
+ export type ProductLink = z.infer<typeof ProductLinkSchema>;
55
+
45
56
  export const BaseProductSchema = z.object({
46
57
  id: z.cuid2(),
47
58
  createdAt: z.date(),
48
59
  updatedAt: z.date(),
49
60
  deletedAt: z.date().nullable(),
50
-
61
+ status: z.enum(PRODUCT_STATUS).default("DRAFT"),
51
62
  sellerId: z.cuid2(),
52
-
53
63
  title: z.string(),
54
64
  description: z.string(),
55
65
  keyFeatures: z.string(),
@@ -58,9 +68,9 @@ export const BaseProductSchema = z.object({
58
68
  subcategory: z.string().nullable(),
59
69
  tags: z.array(z.string()).nullable(),
60
70
 
61
- productLinks: z.array(z.string()).nullable(),
71
+ productLinks: z.array(ProductLinkSchema).nullable(),
62
72
  pricingModel: z.enum(PRICING_MODELS),
63
- currency: z.string(),
73
+ currency: z.enum(WAGES_CURRENCY),
64
74
  price: z.number().nullable(),
65
75
  suggestedPrice: z.number().nullable(),
66
76
 
@@ -85,25 +95,21 @@ const ProductCoreInputSchema = z.object({
85
95
  title: z.string().min(1, "Title is required").max(255),
86
96
  description: z.string().min(1, "Description is required"),
87
97
  keyFeatures: z.string(),
88
-
98
+ status: z.enum(PRODUCT_STATUS).default("DRAFT"),
89
99
  category: z.string().min(1, "Category is required"),
90
100
  subcategory: z.string().optional(),
91
101
  tags: z.array(z.string()).max(10, "Keep tags to a maximum of 10").default([]),
92
102
 
93
- // Swapped to the new direct-upload input schemas
94
103
  coverImages: z
95
104
  .array(CoverImageInputSchema)
96
105
  .min(1, "At least one cover image is required")
97
106
  .max(3, "Maximum of 3 cover images allowed"),
98
-
107
+ currency: z.enum(WAGES_CURRENCY),
99
108
  productFiles: z.array(DeliveryFileInputSchema).default([]),
100
109
 
101
- productLinks: z
102
- .array(z.url().openapi({ example: "https://figma.com/file/..." }))
103
- .default([]),
110
+ productLinks: z.array(ProductLinkSchema).default([]),
104
111
 
105
112
  pricingModel: z.enum(PRICING_MODELS).default(PRICING_MODELS.FIXED),
106
- currency: z.string().default("USD").openapi({ example: "USD" }),
107
113
 
108
114
  price: z.number().int("Must be in cents").min(0).optional(),
109
115
  suggestedPrice: z.number().int("Must be in cents").min(0).optional(),
@@ -206,7 +212,7 @@ export const ProductEntitySchema = z
206
212
  title: z.string(),
207
213
  description: z.string(),
208
214
  keyFeatures: z.string(),
209
-
215
+ status: z.enum(PRODUCT_STATUS).default("DRAFT"),
210
216
  category: z.string(),
211
217
  subcategory: z.string().optional().nullable(),
212
218
  tags: z.array(z.string()),
@@ -216,7 +222,7 @@ export const ProductEntitySchema = z
216
222
  productLinks: z.array(z.url()).default([]),
217
223
 
218
224
  pricingModel: z.enum(PRICING_MODELS),
219
- currency: z.string(),
225
+ currency: z.enum(WAGES_CURRENCY),
220
226
  price: z.number().int().optional().nullable(),
221
227
  suggestedPrice: z.number().int().optional().nullable(),
222
228