@turtleclub/hooks 0.5.0-beta.11 → 0.5.0-beta.12

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turtleclub/hooks",
3
3
  "type": "module",
4
- "version": "0.5.0-beta.11",
4
+ "version": "0.5.0-beta.12",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "818601e8d43cc8de7be0e74dd4b4d0316401bf97"
57
+ "gitHead": "aa9845b493cc2633e82bb9f94d76a9bc117af7fb"
58
58
  }
@@ -1,9 +1,10 @@
1
- import { z } from 'zod'
1
+ import { z } from "zod";
2
+ import { opportunitySchema } from "../schemas/shared";
2
3
 
3
4
  // Enum schemas
4
- const ProductTypeSchema = z.enum(['deal', 'campaign'])
5
+ const ProductTypeSchema = z.enum(["deal", "campaign"]);
5
6
 
6
- const ProductStatusSchema = z.enum(['draft', 'active', 'paused', 'ended'])
7
+ const ProductStatusSchema = z.enum(["draft", "active", "paused", "ended"]);
7
8
 
8
9
  // TurtleOrganization schema
9
10
  const TurtleOrganizationSchema = z.object({
@@ -11,7 +12,7 @@ const TurtleOrganizationSchema = z.object({
11
12
  name: z.string(),
12
13
  iconUrl: z.string(),
13
14
  landingUrl: z.string(),
14
- })
15
+ });
15
16
 
16
17
  // Product schema
17
18
  export const ProductSchema = z.object({
@@ -27,8 +28,9 @@ export const ProductSchema = z.object({
27
28
  status: ProductStatusSchema,
28
29
  productType: ProductTypeSchema,
29
30
  organization: TurtleOrganizationSchema.nullable(),
31
+ opportunities: z.array(opportunitySchema).nullish(),
30
32
  createdAt: z.string(),
31
- })
33
+ });
32
34
 
33
35
  // Create Product Request schema
34
36
  export const CreateProductInputSchema = z.object({
@@ -38,39 +40,39 @@ export const CreateProductInputSchema = z.object({
38
40
  organization: true,
39
41
  }),
40
42
  organizationId: z.string().uuid(),
41
- })
43
+ });
42
44
  // Update Product Request schema
43
45
  export const UpdateProductInputSchema = z.object({
44
46
  product: ProductSchema.partial().omit({
45
47
  organization: true,
46
48
  }),
47
49
  // organizationId: z.string().uuid(),
48
- })
50
+ });
49
51
 
50
52
  export const ProductsResponseSchema = z.object({
51
53
  products: z.array(ProductSchema),
52
54
  total: z.number().optional(),
53
- })
55
+ });
54
56
 
55
57
  export const ProductResponseSchema = z.object({
56
58
  product: ProductSchema,
57
- })
59
+ });
58
60
 
59
61
  export const CreateProductResponseSchema = z.object({
60
62
  id: z.string().uuid(),
61
- })
63
+ });
62
64
 
63
65
  export const UpdateProductResponseSchema = z.object({
64
66
  success: z.boolean(),
65
- })
67
+ });
66
68
 
67
69
  // File validation schema for multipart file upload
68
70
  const fileSchema = z.any().refine((value) => {
69
- if (!value) return false
70
- if (!(value instanceof File)) return false
71
- if (value.size > 10 * 1024 * 1024) return false
72
- return true
73
- }, 'Invalid file')
71
+ if (!value) return false;
72
+ if (!(value instanceof File)) return false;
73
+ if (value.size > 10 * 1024 * 1024) return false;
74
+ return true;
75
+ }, "Invalid file");
74
76
 
75
77
  // Request schema for UploadProductLogoHandler
76
78
  export const UploadProductLogoRequestSchema = z.object({
@@ -79,33 +81,29 @@ export const UploadProductLogoRequestSchema = z.object({
79
81
 
80
82
  // Form data - optional filename override
81
83
  filename: z.string().optional(),
82
- })
84
+ });
83
85
 
84
86
  // Response schema for UploadProductLogoHandler
85
87
  export const UploadProductLogoResponseSchema = z.object({
86
88
  url: z.string().url(),
87
89
  error: z.string().optional(),
88
- })
90
+ });
89
91
 
90
92
  export const ProductFiltersSchema = z.object({
91
93
  organizationId: z.string().uuid().optional(),
92
- })
93
- export type ProductFilters = z.infer<typeof ProductFiltersSchema>
94
+ });
95
+ export type ProductFilters = z.infer<typeof ProductFiltersSchema>;
94
96
 
95
97
  // Type exports
96
- export type ProductsResponse = z.infer<typeof ProductsResponseSchema>
97
- export type ProductResponse = z.infer<typeof ProductResponseSchema>
98
- export type UpdateProductResponse = z.infer<typeof UpdateProductResponseSchema>
99
- export type CreateProductResponse = z.infer<typeof CreateProductResponseSchema>
100
- export type CreateProductInput = z.infer<typeof CreateProductInputSchema>
101
- export type UpdateProductInput = z.infer<typeof UpdateProductInputSchema>
102
- export type Product = z.infer<typeof ProductSchema>
103
- export type ProductType = z.infer<typeof ProductTypeSchema>
104
- export type ProductStatus = z.infer<typeof ProductStatusSchema>
105
- export type TurtleOrganization = z.infer<typeof TurtleOrganizationSchema>
106
- export type UploadProductLogoRequest = z.infer<
107
- typeof UploadProductLogoRequestSchema
108
- >
109
- export type UploadProductLogoResponse = z.infer<
110
- typeof UploadProductLogoResponseSchema
111
- >
98
+ export type ProductsResponse = z.infer<typeof ProductsResponseSchema>;
99
+ export type ProductResponse = z.infer<typeof ProductResponseSchema>;
100
+ export type UpdateProductResponse = z.infer<typeof UpdateProductResponseSchema>;
101
+ export type CreateProductResponse = z.infer<typeof CreateProductResponseSchema>;
102
+ export type CreateProductInput = z.infer<typeof CreateProductInputSchema>;
103
+ export type UpdateProductInput = z.infer<typeof UpdateProductInputSchema>;
104
+ export type Product = z.infer<typeof ProductSchema>;
105
+ export type ProductType = z.infer<typeof ProductTypeSchema>;
106
+ export type ProductStatus = z.infer<typeof ProductStatusSchema>;
107
+ export type TurtleOrganization = z.infer<typeof TurtleOrganizationSchema>;
108
+ export type UploadProductLogoRequest = z.infer<typeof UploadProductLogoRequestSchema>;
109
+ export type UploadProductLogoResponse = z.infer<typeof UploadProductLogoResponseSchema>;