@zyacreatives/shared 2.5.6 → 2.5.8

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.
@@ -289,6 +289,7 @@ export declare const COUNTRY_OF_OPERATION: {
289
289
  export declare const GATEWAY_PROVIDER: {
290
290
  readonly PAYSTACK: "PAYSTACK";
291
291
  readonly STRIPE: "STRIPE";
292
+ readonly NONE: "NONE";
292
293
  };
293
294
  export declare const PRICING_MODELS: {
294
295
  readonly FREE: "Free";
@@ -308,6 +309,7 @@ export declare const TRANSACTION_STATUSES: {
308
309
  export declare const PAYMENT_PROVIDERS: {
309
310
  readonly STRIPE: "STRIPE";
310
311
  readonly PAYSTACK: "PAYSTACK";
312
+ readonly NONE: "NONE";
311
313
  };
312
314
  export type PaymentProvider = (typeof PAYMENT_PROVIDERS)[keyof typeof PAYMENT_PROVIDERS];
313
315
  export type TransactionStatus = (typeof TRANSACTION_STATUSES)[keyof typeof TRANSACTION_STATUSES];
package/dist/constants.js CHANGED
@@ -287,6 +287,7 @@ exports.COUNTRY_OF_OPERATION = {
287
287
  exports.GATEWAY_PROVIDER = {
288
288
  PAYSTACK: "PAYSTACK",
289
289
  STRIPE: "STRIPE",
290
+ NONE: "NONE",
290
291
  };
291
292
  exports.PRICING_MODELS = {
292
293
  FREE: "Free",
@@ -306,6 +307,7 @@ exports.TRANSACTION_STATUSES = {
306
307
  exports.PAYMENT_PROVIDERS = {
307
308
  STRIPE: "STRIPE",
308
309
  PAYSTACK: "PAYSTACK",
310
+ NONE: "NONE",
309
311
  };
310
312
  exports.API_ROUTES = {
311
313
  healthCheck: "/health",
@@ -5,6 +5,7 @@ export declare const PayoutMethodEntitySchema: z.ZodObject<{
5
5
  provider: z.ZodEnum<{
6
6
  readonly PAYSTACK: "PAYSTACK";
7
7
  readonly STRIPE: "STRIPE";
8
+ readonly NONE: "NONE";
8
9
  }>;
9
10
  currency: z.ZodString;
10
11
  bankName: z.ZodString;
@@ -25,6 +26,7 @@ export declare const CreatePayoutMethodEntitySchema: z.ZodObject<{
25
26
  provider: z.ZodEnum<{
26
27
  readonly PAYSTACK: "PAYSTACK";
27
28
  readonly STRIPE: "STRIPE";
29
+ readonly NONE: "NONE";
28
30
  }>;
29
31
  bankName: z.ZodString;
30
32
  accountLast4: z.ZodString;
@@ -6,7 +6,7 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
6
6
  }>;
7
7
  amount: z.ZodNumber;
8
8
  discountCode: z.ZodOptional<z.ZodString>;
9
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
9
+ active: z.ZodDefault<z.ZodBoolean>;
10
10
  }, z.core.$strip>;
11
11
  export declare const ProductLinkSchema: z.ZodObject<{
12
12
  title: z.ZodNullable<z.ZodString>;
@@ -75,7 +75,7 @@ export declare const CreateProductInputSchema: z.ZodObject<{
75
75
  }>;
76
76
  amount: z.ZodNumber;
77
77
  discountCode: z.ZodOptional<z.ZodString>;
78
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
78
+ active: z.ZodDefault<z.ZodBoolean>;
79
79
  }, z.core.$strip>>>;
80
80
  }, z.core.$strip>;
81
81
  export declare const ProductServiceAndComplianceInputSchema: z.ZodObject<{
@@ -149,7 +149,7 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
149
149
  }>;
150
150
  amount: z.ZodNumber;
151
151
  discountCode: z.ZodOptional<z.ZodString>;
152
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
152
+ active: z.ZodDefault<z.ZodBoolean>;
153
153
  }, z.core.$strip>>>>;
154
154
  supportEmail: z.ZodOptional<z.ZodEmail>;
155
155
  supportPhone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
@@ -231,7 +231,7 @@ export declare const ProductEntitySchema: z.ZodObject<{
231
231
  }>;
232
232
  amount: z.ZodNumber;
233
233
  discountCode: z.ZodOptional<z.ZodString>;
234
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
234
+ active: z.ZodDefault<z.ZodBoolean>;
235
235
  }, z.core.$strip>>>;
236
236
  ownsRights: z.ZodBoolean;
237
237
  noHarmfulContent: z.ZodBoolean;
@@ -11,13 +11,12 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
11
11
  .int("Amount must be a whole number")
12
12
  .min(0, "Discount amount cannot be negative"),
13
13
  discountCode: zod_openapi_1.z.string().optional(),
14
- expiry: zod_openapi_1.z.coerce.date().optional().nullable(),
14
+ active: zod_openapi_1.z.boolean().default(true),
15
15
  });
16
16
  exports.ProductLinkSchema = zod_openapi_1.z.object({
17
17
  title: zod_openapi_1.z.string().nullable(),
18
18
  url: zod_openapi_1.z.string(),
19
19
  });
20
- // --- 3. Input Validation Schemas ---
21
20
  const ProductCoreInputSchema = zod_openapi_1.z.object({
22
21
  id: zod_openapi_1.z.cuid2().openapi({ description: "Client-generated ID for the product" }),
23
22
  title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
@@ -36,7 +35,6 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
36
35
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).max(3).default([]),
37
36
  });
38
37
  exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx) => {
39
- // Pricing Validation
40
38
  if (data.pricingModel === constants_1.PRICING_MODELS.FIXED &&
41
39
  (!data.price || data.price <= 0)) {
42
40
  ctx.addIssue({
@@ -64,7 +62,6 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
64
62
  path: ["price"],
65
63
  });
66
64
  }
67
- // File Validation based on parentType
68
65
  const deliveryFiles = data.files.filter((f) => f.parentType === "PRODUCT_DELIVERY");
69
66
  const coverImages = data.files.filter((f) => f.parentType === "PRODUCT_COVER");
70
67
  if (deliveryFiles.length === 0 && data.productLinks.length === 0) {
@@ -126,7 +123,6 @@ exports.UpdateProductInputSchema = ProductCoreInputSchema.extend(exports.Product
126
123
  .extend({
127
124
  id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product being updated" }),
128
125
  });
129
- // --- 4. Entity & Output Schemas ---
130
126
  exports.ProductEntitySchema = zod_openapi_1.z
131
127
  .object({
132
128
  id: zod_openapi_1.z.cuid2(),
@@ -141,7 +137,6 @@ exports.ProductEntitySchema = zod_openapi_1.z
141
137
  category: zod_openapi_1.z.string(),
142
138
  subcategory: zod_openapi_1.z.string().optional().nullable(),
143
139
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()),
144
- // Unified files array for output
145
140
  files: zod_openapi_1.z.array(file_1.FileEntitySchema).default([]),
146
141
  productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
147
142
  pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
@@ -63,6 +63,7 @@ export declare const SellerProfileSchema: z.ZodObject<{
63
63
  provider: z.ZodEnum<{
64
64
  readonly PAYSTACK: "PAYSTACK";
65
65
  readonly STRIPE: "STRIPE";
66
+ readonly NONE: "NONE";
66
67
  }>;
67
68
  currency: z.ZodString;
68
69
  bankName: z.ZodString;
@@ -36,6 +36,7 @@ export declare const BaseTransactionSchema: z.ZodObject<{
36
36
  paymentProvider: z.ZodEnum<{
37
37
  readonly STRIPE: "STRIPE";
38
38
  readonly PAYSTACK: "PAYSTACK";
39
+ readonly NONE: "NONE";
39
40
  }>;
40
41
  providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
42
  discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -54,8 +55,10 @@ export declare const InitTransactionInputSchema: z.ZodObject<{
54
55
  paymentProvider: z.ZodEnum<{
55
56
  readonly STRIPE: "STRIPE";
56
57
  readonly PAYSTACK: "PAYSTACK";
58
+ readonly NONE: "NONE";
57
59
  }>;
58
60
  discountCode: z.ZodOptional<z.ZodString>;
61
+ amount: z.ZodOptional<z.ZodNumber>;
59
62
  }, z.core.$strip>;
60
63
  export declare const CreateTransactionInputSchema: z.ZodObject<{
61
64
  status: z.ZodDefault<z.ZodEnum<{
@@ -85,6 +88,7 @@ export declare const CreateTransactionInputSchema: z.ZodObject<{
85
88
  paymentProvider: z.ZodEnum<{
86
89
  readonly STRIPE: "STRIPE";
87
90
  readonly PAYSTACK: "PAYSTACK";
91
+ readonly NONE: "NONE";
88
92
  }>;
89
93
  discountApplied: z.ZodOptional<z.ZodObject<{
90
94
  code: z.ZodOptional<z.ZodString>;
@@ -133,6 +137,7 @@ export declare const TransactionEntitySchema: z.ZodObject<{
133
137
  paymentProvider: z.ZodEnum<{
134
138
  readonly STRIPE: "STRIPE";
135
139
  readonly PAYSTACK: "PAYSTACK";
140
+ readonly NONE: "NONE";
136
141
  }>;
137
142
  providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
143
  discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -33,6 +33,14 @@ exports.InitTransactionInputSchema = zod_openapi_1.z.object({
33
33
  .string()
34
34
  .optional()
35
35
  .openapi({ description: "Optional discount code applied at checkout" }),
36
+ amount: zod_openapi_1.z
37
+ .number()
38
+ .int("Amount must be a whole number (cents/kobo)")
39
+ .min(0)
40
+ .optional()
41
+ .openapi({
42
+ description: "Required for PWYW pricing. The amount the buyer chooses to pay in cents/kobo.",
43
+ }),
36
44
  });
37
45
  exports.CreateTransactionInputSchema = exports.BaseTransactionSchema.pick({
38
46
  productId: true,
@@ -761,7 +761,7 @@ export declare const UserWithProductsEntitySchema: z.ZodObject<{
761
761
  }>;
762
762
  amount: z.ZodNumber;
763
763
  discountCode: z.ZodOptional<z.ZodString>;
764
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
764
+ active: z.ZodDefault<z.ZodBoolean>;
765
765
  }, z.core.$strip>>>;
766
766
  ownsRights: z.ZodBoolean;
767
767
  noHarmfulContent: z.ZodBoolean;
@@ -934,7 +934,7 @@ export declare const GetUserWithProductsOutputSchema: z.ZodObject<{
934
934
  }>;
935
935
  amount: z.ZodNumber;
936
936
  discountCode: z.ZodOptional<z.ZodString>;
937
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
937
+ active: z.ZodDefault<z.ZodBoolean>;
938
938
  }, z.core.$strip>>>;
939
939
  ownsRights: z.ZodBoolean;
940
940
  noHarmfulContent: z.ZodBoolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.5.6",
3
+ "version": "2.5.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/constants.ts CHANGED
@@ -327,6 +327,7 @@ export const COUNTRY_OF_OPERATION = {
327
327
  export const GATEWAY_PROVIDER = {
328
328
  PAYSTACK: "PAYSTACK",
329
329
  STRIPE: "STRIPE",
330
+ NONE: "NONE",
330
331
  } as const;
331
332
 
332
333
  export const PRICING_MODELS = {
@@ -350,6 +351,7 @@ export const TRANSACTION_STATUSES = {
350
351
  export const PAYMENT_PROVIDERS = {
351
352
  STRIPE: "STRIPE",
352
353
  PAYSTACK: "PAYSTACK",
354
+ NONE: "NONE",
353
355
  } as const;
354
356
 
355
357
  export type PaymentProvider =
@@ -4,7 +4,6 @@ import {
4
4
  PRICING_MODELS,
5
5
  PRODUCT_STATUS,
6
6
  WAGES_CURRENCY,
7
- ACTIVITY_PARENT_TYPES, // Assumes this includes 'PRODUCT_COVER' and 'PRODUCT_DELIVERY'
8
7
  } from "../constants";
9
8
  import { CreateFileInputSchema, FileEntitySchema } from "./file";
10
9
 
@@ -15,7 +14,7 @@ export const ProductDiscountEntitySchema = z.object({
15
14
  .int("Amount must be a whole number")
16
15
  .min(0, "Discount amount cannot be negative"),
17
16
  discountCode: z.string().optional(),
18
- expiry: z.coerce.date().optional().nullable(),
17
+ active: z.boolean().default(true),
19
18
  });
20
19
 
21
20
  export const ProductLinkSchema = z.object({
@@ -23,8 +22,6 @@ export const ProductLinkSchema = z.object({
23
22
  url: z.string(),
24
23
  });
25
24
 
26
- // --- 3. Input Validation Schemas ---
27
-
28
25
  const ProductCoreInputSchema = z.object({
29
26
  id: z.cuid2().openapi({ description: "Client-generated ID for the product" }),
30
27
 
@@ -47,7 +44,7 @@ const ProductCoreInputSchema = z.object({
47
44
 
48
45
  export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
49
46
  (data, ctx) => {
50
- // Pricing Validation
47
+
51
48
  if (
52
49
  data.pricingModel === PRICING_MODELS.FIXED &&
53
50
  (!data.price || data.price <= 0)
@@ -84,7 +81,6 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
84
81
  });
85
82
  }
86
83
 
87
- // File Validation based on parentType
88
84
  const deliveryFiles = data.files.filter(
89
85
  (f) => f.parentType === "PRODUCT_DELIVERY",
90
86
  );
@@ -168,7 +164,6 @@ export const UpdateProductInputSchema = ProductCoreInputSchema.extend(
168
164
  id: z.cuid2().openapi({ description: "ID of the product being updated" }),
169
165
  });
170
166
 
171
- // --- 4. Entity & Output Schemas ---
172
167
 
173
168
  export const ProductEntitySchema = z
174
169
  .object({
@@ -186,7 +181,6 @@ export const ProductEntitySchema = z
186
181
  subcategory: z.string().optional().nullable(),
187
182
  tags: z.array(z.string()),
188
183
 
189
- // Unified files array for output
190
184
  files: z.array(FileEntitySchema).default([]),
191
185
  productLinks: z.array(ProductLinkSchema).default([]),
192
186
 
@@ -42,9 +42,17 @@ export const InitTransactionInputSchema = z.object({
42
42
  .string()
43
43
  .optional()
44
44
  .openapi({ description: "Optional discount code applied at checkout" }),
45
+ amount: z
46
+ .number()
47
+ .int("Amount must be a whole number (cents/kobo)")
48
+ .min(0)
49
+ .optional()
50
+ .openapi({
51
+ description:
52
+ "Required for PWYW pricing. The amount the buyer chooses to pay in cents/kobo.",
53
+ }),
45
54
  });
46
55
 
47
-
48
56
  export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
49
57
  productId: true,
50
58
  buyerId: true,