@cossistant/types 0.0.7
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/dist/api/common.d.ts +44 -0
- package/dist/api/common.d.ts.map +1 -0
- package/dist/api/common.js +72 -0
- package/dist/api/common.js.map +1 -0
- package/dist/api/contact.d.ts +138 -0
- package/dist/api/contact.d.ts.map +1 -0
- package/dist/api/contact.js +297 -0
- package/dist/api/contact.js.map +1 -0
- package/dist/api/conversation.d.ts +91 -0
- package/dist/api/conversation.d.ts.map +1 -0
- package/dist/api/conversation.js +81 -0
- package/dist/api/conversation.js.map +1 -0
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.js +11 -0
- package/dist/api/organization.d.ts +15 -0
- package/dist/api/organization.d.ts.map +1 -0
- package/dist/api/organization.js +20 -0
- package/dist/api/organization.js.map +1 -0
- package/dist/api/timeline-item.d.ts +270 -0
- package/dist/api/timeline-item.d.ts.map +1 -0
- package/dist/api/timeline-item.js +111 -0
- package/dist/api/timeline-item.js.map +1 -0
- package/dist/api/upload.d.ts +100 -0
- package/dist/api/upload.d.ts.map +1 -0
- package/dist/api/upload.js +119 -0
- package/dist/api/upload.js.map +1 -0
- package/dist/api/user.d.ts +27 -0
- package/dist/api/user.d.ts.map +1 -0
- package/dist/api/user.js +52 -0
- package/dist/api/user.js.map +1 -0
- package/dist/api/visitor.d.ts +125 -0
- package/dist/api/visitor.d.ts.map +1 -0
- package/dist/api/visitor.js +301 -0
- package/dist/api/visitor.js.map +1 -0
- package/dist/api/website.d.ts +192 -0
- package/dist/api/website.d.ts.map +1 -0
- package/dist/api/website.js +320 -0
- package/dist/api/website.js.map +1 -0
- package/dist/enums.d.ts +79 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +69 -0
- package/dist/enums.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/presence.d.ts +7 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +8 -0
- package/dist/presence.js.map +1 -0
- package/dist/realtime-events.d.ts +136 -0
- package/dist/realtime-events.d.ts.map +1 -0
- package/dist/realtime-events.js +99 -0
- package/dist/realtime-events.js.map +1 -0
- package/dist/schemas.d.ts +44 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +46 -0
- package/dist/schemas.js.map +1 -0
- package/dist/trpc/contact.d.ts +68 -0
- package/dist/trpc/contact.d.ts.map +1 -0
- package/dist/trpc/contact.js +45 -0
- package/dist/trpc/contact.js.map +1 -0
- package/dist/trpc/conversation.d.ts +139 -0
- package/dist/trpc/conversation.d.ts.map +1 -0
- package/dist/trpc/conversation.js +80 -0
- package/dist/trpc/conversation.js.map +1 -0
- package/dist/trpc/visitor.d.ts +53 -0
- package/dist/trpc/visitor.d.ts.map +1 -0
- package/dist/trpc/visitor.js +34 -0
- package/dist/trpc/visitor.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
//#region src/api/common.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Common validation schemas used across multiple API endpoints
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Email validation schema
|
|
10
|
+
*/
|
|
11
|
+
declare const emailSchema: z.ZodEmail;
|
|
12
|
+
/**
|
|
13
|
+
* User ID validation schema
|
|
14
|
+
*/
|
|
15
|
+
declare const userIdSchema: z.ZodULID;
|
|
16
|
+
/**
|
|
17
|
+
* Optional user ID validation schema
|
|
18
|
+
*/
|
|
19
|
+
declare const optionalUserIdSchema: z.ZodOptional<z.ZodULID>;
|
|
20
|
+
/**
|
|
21
|
+
* Referral code validation schema
|
|
22
|
+
*/
|
|
23
|
+
declare const referralCodeSchema: z.ZodString;
|
|
24
|
+
/**
|
|
25
|
+
* Common pagination schema
|
|
26
|
+
*/
|
|
27
|
+
declare const paginationSchema: z.ZodObject<{
|
|
28
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
29
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
type PaginationInput = z.infer<typeof paginationSchema>;
|
|
32
|
+
/**
|
|
33
|
+
* Pagination response schema
|
|
34
|
+
*/
|
|
35
|
+
declare const paginationResponseSchema: z.ZodObject<{
|
|
36
|
+
page: z.ZodNumber;
|
|
37
|
+
limit: z.ZodNumber;
|
|
38
|
+
total: z.ZodNumber;
|
|
39
|
+
hasMore: z.ZodBoolean;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type PaginationResponse = z.infer<typeof paginationResponseSchema>;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { PaginationInput, PaginationResponse, emailSchema, optionalUserIdSchema, paginationResponseSchema, paginationSchema, referralCodeSchema, userIdSchema };
|
|
44
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","names":[],"sources":["../../src/api/common.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;AAQA;AAQA;AAQA;AAQa,cAhCA,WAyCX,EAzCsB,CAAA,CAAA,QAyCtB;;;;cAjCW,cAAY,CAAA,CAAA;;;;AAmCb,cA3BC,oBA2BgC,EA3BZ,CAAA,CAAA,WA2BD,CA3BC,CAAA,CAAA,OA2BI,CAAA;AAKrC;;;cAxBa,oBAAkB,CAAA,CAAA;;;;AAwBM,cAhBxB,gBAgBwB,EAhBR,CAAA,CAAA,SAgBQ,CAAA;EAmBzB,IAAA,cAAA,mBAAoC,CAAA,OAAA,CAAA,CAAA;;;KAxBpC,eAAA,GAAkB,CAAA,CAAE,aAAa;;;;cAKhC,0BAAwB,CAAA,CAAA;;;;;;KAmBzB,kBAAA,GAAqB,CAAA,CAAE,aAAa"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
//#region src/api/common.ts
|
|
4
|
+
/**
|
|
5
|
+
* Common validation schemas used across multiple API endpoints
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Email validation schema
|
|
9
|
+
*/
|
|
10
|
+
const emailSchema = z.email().openapi({
|
|
11
|
+
description: "A valid email address.",
|
|
12
|
+
example: "user@example.com"
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* User ID validation schema
|
|
16
|
+
*/
|
|
17
|
+
const userIdSchema = z.ulid().openapi({
|
|
18
|
+
description: "A valid user identifier.",
|
|
19
|
+
example: "01JG000000000000000000000"
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Optional user ID validation schema
|
|
23
|
+
*/
|
|
24
|
+
const optionalUserIdSchema = z.ulid().optional().openapi({
|
|
25
|
+
description: "An optional user identifier.",
|
|
26
|
+
example: "01JG000000000000000000000"
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Referral code validation schema
|
|
30
|
+
*/
|
|
31
|
+
const referralCodeSchema = z.string().min(1).openapi({
|
|
32
|
+
description: "A referral code for accessing features.",
|
|
33
|
+
example: "WELCOME2024"
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Common pagination schema
|
|
37
|
+
*/
|
|
38
|
+
const paginationSchema = z.object({
|
|
39
|
+
page: z.coerce.number().int().positive().default(1).openapi({
|
|
40
|
+
description: "The page number to retrieve.",
|
|
41
|
+
example: 1
|
|
42
|
+
}),
|
|
43
|
+
limit: z.coerce.number().int().positive().max(100).default(20).openapi({
|
|
44
|
+
description: "The number of items per page (max 100).",
|
|
45
|
+
example: 20
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Pagination response schema
|
|
50
|
+
*/
|
|
51
|
+
const paginationResponseSchema = z.object({
|
|
52
|
+
page: z.number().int().positive().openapi({
|
|
53
|
+
description: "The current page number.",
|
|
54
|
+
example: 1
|
|
55
|
+
}),
|
|
56
|
+
limit: z.number().int().positive().openapi({
|
|
57
|
+
description: "The number of items per page.",
|
|
58
|
+
example: 20
|
|
59
|
+
}),
|
|
60
|
+
total: z.number().int().nonnegative().openapi({
|
|
61
|
+
description: "The total number of items.",
|
|
62
|
+
example: 100
|
|
63
|
+
}),
|
|
64
|
+
hasMore: z.boolean().openapi({
|
|
65
|
+
description: "Whether there are more items available.",
|
|
66
|
+
example: true
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { emailSchema, optionalUserIdSchema, paginationResponseSchema, paginationSchema, referralCodeSchema, userIdSchema };
|
|
72
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":[],"sources":["../../src/api/common.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\n\n/**\n * Common validation schemas used across multiple API endpoints\n */\n\n/**\n * Email validation schema\n */\nexport const emailSchema = z.email().openapi({\n\tdescription: \"A valid email address.\",\n\texample: \"user@example.com\",\n});\n\n/**\n * User ID validation schema\n */\nexport const userIdSchema = z.ulid().openapi({\n\tdescription: \"A valid user identifier.\",\n\texample: \"01JG000000000000000000000\",\n});\n\n/**\n * Optional user ID validation schema\n */\nexport const optionalUserIdSchema = z.ulid().optional().openapi({\n\tdescription: \"An optional user identifier.\",\n\texample: \"01JG000000000000000000000\",\n});\n\n/**\n * Referral code validation schema\n */\nexport const referralCodeSchema = z.string().min(1).openapi({\n\tdescription: \"A referral code for accessing features.\",\n\texample: \"WELCOME2024\",\n});\n\n/**\n * Common pagination schema\n */\nexport const paginationSchema = z.object({\n\tpage: z.coerce.number().int().positive().default(1).openapi({\n\t\tdescription: \"The page number to retrieve.\",\n\t\texample: 1,\n\t}),\n\tlimit: z.coerce.number().int().positive().max(100).default(20).openapi({\n\t\tdescription: \"The number of items per page (max 100).\",\n\t\texample: 20,\n\t}),\n});\n\nexport type PaginationInput = z.infer<typeof paginationSchema>;\n\n/**\n * Pagination response schema\n */\nexport const paginationResponseSchema = z.object({\n\tpage: z.number().int().positive().openapi({\n\t\tdescription: \"The current page number.\",\n\t\texample: 1,\n\t}),\n\tlimit: z.number().int().positive().openapi({\n\t\tdescription: \"The number of items per page.\",\n\t\texample: 20,\n\t}),\n\ttotal: z.number().int().nonnegative().openapi({\n\t\tdescription: \"The total number of items.\",\n\t\texample: 100,\n\t}),\n\thasMore: z.boolean().openapi({\n\t\tdescription: \"Whether there are more items available.\",\n\t\texample: true,\n\t}),\n});\n\nexport type PaginationResponse = z.infer<typeof paginationResponseSchema>;\n"],"mappings":";;;;;;;;;AASA,MAAa,cAAc,EAAE,OAAO,CAAC,QAAQ;CAC5C,aAAa;CACb,SAAS;CACT,CAAC;;;;AAKF,MAAa,eAAe,EAAE,MAAM,CAAC,QAAQ;CAC5C,aAAa;CACb,SAAS;CACT,CAAC;;;;AAKF,MAAa,uBAAuB,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ;CAC/D,aAAa;CACb,SAAS;CACT,CAAC;;;;AAKF,MAAa,qBAAqB,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ;CAC3D,aAAa;CACb,SAAS;CACT,CAAC;;;;AAKF,MAAa,mBAAmB,EAAE,OAAO;CACxC,MAAM,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,QAAQ;EAC3D,aAAa;EACb,SAAS;EACT,CAAC;CACF,OAAO,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,QAAQ;EACtE,aAAa;EACb,SAAS;EACT,CAAC;CACF,CAAC;;;;AAOF,MAAa,2BAA2B,EAAE,OAAO;CAChD,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ;EACzC,aAAa;EACb,SAAS;EACT,CAAC;CACF,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ;EAC1C,aAAa;EACb,SAAS;EACT,CAAC;CACF,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ;EAC7C,aAAa;EACb,SAAS;EACT,CAAC;CACF,SAAS,EAAE,SAAS,CAAC,QAAQ;EAC5B,aAAa;EACb,SAAS;EACT,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
//#region src/api/contact.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Contact metadata are stored as key value pairs
|
|
7
|
+
* Values can be strings, numbers, booleans, or null
|
|
8
|
+
*/
|
|
9
|
+
declare const contactMetadataSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>;
|
|
10
|
+
type ContactMetadata = z.infer<typeof contactMetadataSchema>;
|
|
11
|
+
/**
|
|
12
|
+
* Create contact request schema
|
|
13
|
+
*/
|
|
14
|
+
declare const createContactRequestSchema: z.ZodObject<{
|
|
15
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
name: z.ZodOptional<z.ZodString>;
|
|
17
|
+
email: z.ZodOptional<z.ZodString>;
|
|
18
|
+
image: z.ZodOptional<z.ZodString>;
|
|
19
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
20
|
+
contactOrganizationId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
type CreateContactRequest = z.infer<typeof createContactRequestSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* Update contact request schema
|
|
25
|
+
*/
|
|
26
|
+
declare const updateContactRequestSchema: z.ZodObject<{
|
|
27
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
name: z.ZodOptional<z.ZodString>;
|
|
29
|
+
email: z.ZodOptional<z.ZodString>;
|
|
30
|
+
image: z.ZodOptional<z.ZodString>;
|
|
31
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
32
|
+
contactOrganizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
type UpdateContactRequest = z.infer<typeof updateContactRequestSchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Update contact metadata request schema
|
|
37
|
+
*/
|
|
38
|
+
declare const updateContactMetadataRequestSchema: z.ZodObject<{
|
|
39
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
type UpdateContactMetadataRequest = z.infer<typeof updateContactMetadataRequestSchema>;
|
|
42
|
+
/**
|
|
43
|
+
* Identify contact request schema
|
|
44
|
+
* This is used to create or update a contact and link it to a visitor
|
|
45
|
+
*/
|
|
46
|
+
declare const identifyContactRequestSchema: z.ZodObject<{
|
|
47
|
+
id: z.ZodOptional<z.ZodULID>;
|
|
48
|
+
visitorId: z.ZodULID;
|
|
49
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
name: z.ZodOptional<z.ZodString>;
|
|
51
|
+
email: z.ZodOptional<z.ZodString>;
|
|
52
|
+
image: z.ZodOptional<z.ZodString>;
|
|
53
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
54
|
+
contactOrganizationId: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
type IdentifyContactRequest = z.infer<typeof identifyContactRequestSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* Contact response schema
|
|
59
|
+
*/
|
|
60
|
+
declare const contactResponseSchema: z.ZodObject<{
|
|
61
|
+
id: z.ZodULID;
|
|
62
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
63
|
+
name: z.ZodNullable<z.ZodString>;
|
|
64
|
+
email: z.ZodNullable<z.ZodEmail>;
|
|
65
|
+
image: z.ZodNullable<z.ZodURL>;
|
|
66
|
+
metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
67
|
+
contactOrganizationId: z.ZodNullable<z.ZodULID>;
|
|
68
|
+
websiteId: z.ZodULID;
|
|
69
|
+
organizationId: z.ZodULID;
|
|
70
|
+
userId: z.ZodNullable<z.ZodULID>;
|
|
71
|
+
createdAt: z.ZodString;
|
|
72
|
+
updatedAt: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
type Contact = z.infer<typeof contactResponseSchema>;
|
|
75
|
+
type ContactResponse = Contact;
|
|
76
|
+
/**
|
|
77
|
+
* Identify contact response schema
|
|
78
|
+
*/
|
|
79
|
+
declare const identifyContactResponseSchema: z.ZodObject<{
|
|
80
|
+
contact: z.ZodObject<{
|
|
81
|
+
id: z.ZodULID;
|
|
82
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
83
|
+
name: z.ZodNullable<z.ZodString>;
|
|
84
|
+
email: z.ZodNullable<z.ZodEmail>;
|
|
85
|
+
image: z.ZodNullable<z.ZodURL>;
|
|
86
|
+
metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
87
|
+
contactOrganizationId: z.ZodNullable<z.ZodULID>;
|
|
88
|
+
websiteId: z.ZodULID;
|
|
89
|
+
organizationId: z.ZodULID;
|
|
90
|
+
userId: z.ZodNullable<z.ZodULID>;
|
|
91
|
+
createdAt: z.ZodString;
|
|
92
|
+
updatedAt: z.ZodString;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
visitorId: z.ZodULID;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
type IdentifyContactResponse = z.infer<typeof identifyContactResponseSchema>;
|
|
97
|
+
/**
|
|
98
|
+
* Create contact organization request schema
|
|
99
|
+
*/
|
|
100
|
+
declare const createContactOrganizationRequestSchema: z.ZodObject<{
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
104
|
+
description: z.ZodOptional<z.ZodString>;
|
|
105
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
type CreateContactOrganizationRequest = z.infer<typeof createContactOrganizationRequestSchema>;
|
|
108
|
+
/**
|
|
109
|
+
* Update contact organization request schema
|
|
110
|
+
*/
|
|
111
|
+
declare const updateContactOrganizationRequestSchema: z.ZodObject<{
|
|
112
|
+
name: z.ZodOptional<z.ZodString>;
|
|
113
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
115
|
+
description: z.ZodOptional<z.ZodString>;
|
|
116
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
type UpdateContactOrganizationRequest = z.infer<typeof updateContactOrganizationRequestSchema>;
|
|
119
|
+
/**
|
|
120
|
+
* Contact organization response schema
|
|
121
|
+
*/
|
|
122
|
+
declare const contactOrganizationResponseSchema: z.ZodObject<{
|
|
123
|
+
id: z.ZodULID;
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
126
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
127
|
+
description: z.ZodNullable<z.ZodString>;
|
|
128
|
+
metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>>>;
|
|
129
|
+
websiteId: z.ZodULID;
|
|
130
|
+
organizationId: z.ZodULID;
|
|
131
|
+
createdAt: z.ZodString;
|
|
132
|
+
updatedAt: z.ZodString;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
type contactOrganization = z.infer<typeof contactOrganizationResponseSchema>;
|
|
135
|
+
type ContactOrganizationResponse = contactOrganization;
|
|
136
|
+
//#endregion
|
|
137
|
+
export { Contact, ContactMetadata, ContactOrganizationResponse, ContactResponse, CreateContactOrganizationRequest, CreateContactRequest, IdentifyContactRequest, IdentifyContactResponse, UpdateContactMetadataRequest, UpdateContactOrganizationRequest, UpdateContactRequest, contactMetadataSchema, contactOrganization, contactOrganizationResponseSchema, contactResponseSchema, createContactOrganizationRequestSchema, createContactRequestSchema, identifyContactRequestSchema, identifyContactResponseSchema, updateContactMetadataRequestSchema, updateContactOrganizationRequestSchema, updateContactRequestSchema };
|
|
138
|
+
//# sourceMappingURL=contact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.d.ts","names":[],"sources":["../../src/api/contact.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;;AAAkC,cAArB,qBAAqB,EAAA,CAAA,CAAA,SAAA,CAAA,CAAA,CAAA,SAAA,EAAA,CA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eAAA,YAA4B,CAAA;IAQ3B,KAAA,eAAA,WAwDX,CAAA;;;;;;;;;;;;KA2EU,uBAAA,GAA0B,CAAA,CAAE,aAChC;;;;cAQK,wCAAsC,CAAA,CAAA;;;;;;;KAmCvC,gCAAA,GAAmC,CAAA,CAAE,aACzC;;;;AAtHI,cA4HC,sCA3HL,EA2H2C,CAAA,CAAA,SA5Hd,CAAA;EAOxB,IAAA,eAAA,YAkDX,CAAA;;;;;;KAwGU,gCAAA,GAAmC,CAAA,CAAE,aACzC;;;;cAMK,mCAAiC,CAAA,CAAA;;;;;;;;;;;;KA6ClC,mBAAA,GAAsB,CAAA,CAAE,aAC5B;KAEI,2BAAA,GAA8B"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
//#region src/api/contact.ts
|
|
4
|
+
/**
|
|
5
|
+
* Contact metadata are stored as key value pairs
|
|
6
|
+
* Values can be strings, numbers, booleans, or null
|
|
7
|
+
*/
|
|
8
|
+
const contactMetadataSchema = z.record(z.string(), z.string().or(z.number()).or(z.boolean()).or(z.null()));
|
|
9
|
+
/**
|
|
10
|
+
* Create contact request schema
|
|
11
|
+
*/
|
|
12
|
+
const createContactRequestSchema = z.object({
|
|
13
|
+
externalId: z.string().openapi({
|
|
14
|
+
description: "External identifier for the contact (e.g. from your CRM).",
|
|
15
|
+
example: "user_12345"
|
|
16
|
+
}).optional(),
|
|
17
|
+
name: z.string().openapi({
|
|
18
|
+
description: "The contact's name.",
|
|
19
|
+
example: "John Doe"
|
|
20
|
+
}).optional(),
|
|
21
|
+
email: z.string().email().openapi({
|
|
22
|
+
description: "The contact's email address.",
|
|
23
|
+
example: "john.doe@example.com"
|
|
24
|
+
}).optional(),
|
|
25
|
+
image: z.string().url().openapi({
|
|
26
|
+
description: "The contact's avatar/image URL.",
|
|
27
|
+
example: "https://example.com/avatar.png"
|
|
28
|
+
}).optional(),
|
|
29
|
+
metadata: contactMetadataSchema.openapi({
|
|
30
|
+
description: "Additional custom metadata for the contact.",
|
|
31
|
+
example: {
|
|
32
|
+
plan: "premium",
|
|
33
|
+
role: "admin"
|
|
34
|
+
}
|
|
35
|
+
}).optional(),
|
|
36
|
+
contactOrganizationId: z.string().ulid().openapi({
|
|
37
|
+
description: "The contact organization ID this contact belongs to.",
|
|
38
|
+
example: "01JG000000000000000000000"
|
|
39
|
+
}).optional()
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Update contact request schema
|
|
43
|
+
*/
|
|
44
|
+
const updateContactRequestSchema = z.object({
|
|
45
|
+
externalId: z.string().openapi({
|
|
46
|
+
description: "External identifier for the contact.",
|
|
47
|
+
example: "user_12345"
|
|
48
|
+
}).optional(),
|
|
49
|
+
name: z.string().openapi({
|
|
50
|
+
description: "The contact's name.",
|
|
51
|
+
example: "John Doe"
|
|
52
|
+
}).optional(),
|
|
53
|
+
email: z.string().email().openapi({
|
|
54
|
+
description: "The contact's email address.",
|
|
55
|
+
example: "john.doe@example.com"
|
|
56
|
+
}).optional(),
|
|
57
|
+
image: z.string().url().openapi({
|
|
58
|
+
description: "The contact's avatar/image URL.",
|
|
59
|
+
example: "https://example.com/avatar.png"
|
|
60
|
+
}).optional(),
|
|
61
|
+
metadata: contactMetadataSchema.openapi({
|
|
62
|
+
description: "Additional custom metadata for the contact.",
|
|
63
|
+
example: {
|
|
64
|
+
plan: "premium",
|
|
65
|
+
role: "admin"
|
|
66
|
+
}
|
|
67
|
+
}).optional(),
|
|
68
|
+
contactOrganizationId: z.string().ulid().openapi({
|
|
69
|
+
description: "The contact organization ID this contact belongs to.",
|
|
70
|
+
example: "01JG000000000000000000000"
|
|
71
|
+
}).optional().nullable()
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Update contact metadata request schema
|
|
75
|
+
*/
|
|
76
|
+
const updateContactMetadataRequestSchema = z.object({ metadata: contactMetadataSchema.openapi({
|
|
77
|
+
description: "Metadata payload to merge into the contact's profile.",
|
|
78
|
+
example: {
|
|
79
|
+
plan: "premium",
|
|
80
|
+
role: "admin"
|
|
81
|
+
}
|
|
82
|
+
}) });
|
|
83
|
+
/**
|
|
84
|
+
* Identify contact request schema
|
|
85
|
+
* This is used to create or update a contact and link it to a visitor
|
|
86
|
+
*/
|
|
87
|
+
const identifyContactRequestSchema = z.object({
|
|
88
|
+
id: z.ulid().optional().openapi({
|
|
89
|
+
description: "Optional contact ID to update when linking the visitor to an existing contact.",
|
|
90
|
+
example: "01JG000000000000000000000"
|
|
91
|
+
}),
|
|
92
|
+
visitorId: z.ulid().openapi({
|
|
93
|
+
description: "The visitor ID to link to the contact.",
|
|
94
|
+
example: "01JG000000000000000000000"
|
|
95
|
+
}),
|
|
96
|
+
externalId: z.string().openapi({
|
|
97
|
+
description: "External identifier for the contact. Used to find existing contacts.",
|
|
98
|
+
example: "user_12345"
|
|
99
|
+
}).optional(),
|
|
100
|
+
name: z.string().openapi({
|
|
101
|
+
description: "The contact's name.",
|
|
102
|
+
example: "John Doe"
|
|
103
|
+
}).optional(),
|
|
104
|
+
email: z.string().email().openapi({
|
|
105
|
+
description: "The contact's email address. Used to find existing contacts.",
|
|
106
|
+
example: "john.doe@example.com"
|
|
107
|
+
}).optional(),
|
|
108
|
+
image: z.string().url().openapi({
|
|
109
|
+
description: "The contact's avatar/image URL.",
|
|
110
|
+
example: "https://example.com/avatar.png"
|
|
111
|
+
}).optional(),
|
|
112
|
+
metadata: contactMetadataSchema.openapi({
|
|
113
|
+
description: "Additional custom metadata for the contact.",
|
|
114
|
+
example: {
|
|
115
|
+
plan: "premium",
|
|
116
|
+
role: "admin"
|
|
117
|
+
}
|
|
118
|
+
}).optional(),
|
|
119
|
+
contactOrganizationId: z.string().ulid().openapi({
|
|
120
|
+
description: "The contact organization ID this contact belongs to.",
|
|
121
|
+
example: "01JG000000000000000000000"
|
|
122
|
+
}).optional()
|
|
123
|
+
});
|
|
124
|
+
/**
|
|
125
|
+
* Contact response schema
|
|
126
|
+
*/
|
|
127
|
+
const contactResponseSchema = z.object({
|
|
128
|
+
id: z.ulid().openapi({
|
|
129
|
+
description: "The contact's unique identifier (ULID).",
|
|
130
|
+
example: "01JG000000000000000000000"
|
|
131
|
+
}),
|
|
132
|
+
externalId: z.string().nullable().openapi({
|
|
133
|
+
description: "External identifier for the contact.",
|
|
134
|
+
example: "user_12345"
|
|
135
|
+
}),
|
|
136
|
+
name: z.string().nullable().openapi({
|
|
137
|
+
description: "The contact's name.",
|
|
138
|
+
example: "John Doe"
|
|
139
|
+
}),
|
|
140
|
+
email: z.email().nullable().openapi({
|
|
141
|
+
description: "The contact's email address.",
|
|
142
|
+
example: "john.doe@example.com"
|
|
143
|
+
}),
|
|
144
|
+
image: z.url().nullable().openapi({
|
|
145
|
+
description: "The contact's avatar/image URL.",
|
|
146
|
+
example: "https://example.com/avatar.png"
|
|
147
|
+
}),
|
|
148
|
+
metadata: contactMetadataSchema.nullable().openapi({
|
|
149
|
+
description: "Additional custom metadata for the contact.",
|
|
150
|
+
example: {
|
|
151
|
+
plan: "premium",
|
|
152
|
+
role: "admin"
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
contactOrganizationId: z.ulid().nullable().openapi({
|
|
156
|
+
description: "The contact organization ID this contact belongs to.",
|
|
157
|
+
example: "01JG000000000000000000000"
|
|
158
|
+
}),
|
|
159
|
+
websiteId: z.ulid().openapi({
|
|
160
|
+
description: "The website's unique identifier that the contact belongs to.",
|
|
161
|
+
example: "01JG000000000000000000000"
|
|
162
|
+
}),
|
|
163
|
+
organizationId: z.ulid().openapi({
|
|
164
|
+
description: "The organization's unique identifier that the contact belongs to.",
|
|
165
|
+
example: "01JG000000000000000000000"
|
|
166
|
+
}),
|
|
167
|
+
userId: z.ulid().nullable().openapi({
|
|
168
|
+
description: "The user ID if the contact is linked to a registered user.",
|
|
169
|
+
example: "01JG000000000000000000000"
|
|
170
|
+
}),
|
|
171
|
+
createdAt: z.string().openapi({
|
|
172
|
+
description: "When the contact was first created.",
|
|
173
|
+
example: "2021-01-01T00:00:00.000Z"
|
|
174
|
+
}),
|
|
175
|
+
updatedAt: z.string().openapi({
|
|
176
|
+
description: "When the contact record was last updated.",
|
|
177
|
+
example: "2021-01-01T00:00:00.000Z"
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
* Identify contact response schema
|
|
182
|
+
*/
|
|
183
|
+
const identifyContactResponseSchema = z.object({
|
|
184
|
+
contact: contactResponseSchema,
|
|
185
|
+
visitorId: z.ulid().openapi({
|
|
186
|
+
description: "The visitor ID that was linked to the contact.",
|
|
187
|
+
example: "01JG000000000000000000000"
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* Create contact organization request schema
|
|
192
|
+
*/
|
|
193
|
+
const createContactOrganizationRequestSchema = z.object({
|
|
194
|
+
name: z.string().openapi({
|
|
195
|
+
description: "The organization name.",
|
|
196
|
+
example: "Acme Corporation"
|
|
197
|
+
}),
|
|
198
|
+
externalId: z.string().openapi({
|
|
199
|
+
description: "External identifier for the organization (e.g. from your CRM).",
|
|
200
|
+
example: "org_12345"
|
|
201
|
+
}).optional(),
|
|
202
|
+
domain: z.string().openapi({
|
|
203
|
+
description: "The organization's domain.",
|
|
204
|
+
example: "acme.com"
|
|
205
|
+
}).optional(),
|
|
206
|
+
description: z.string().openapi({
|
|
207
|
+
description: "Description of the organization.",
|
|
208
|
+
example: "A leading provider of enterprise solutions"
|
|
209
|
+
}).optional(),
|
|
210
|
+
metadata: contactMetadataSchema.openapi({
|
|
211
|
+
description: "Additional custom metadata for the organization.",
|
|
212
|
+
example: {
|
|
213
|
+
industry: "technology",
|
|
214
|
+
employees: 500
|
|
215
|
+
}
|
|
216
|
+
}).optional()
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* Update contact organization request schema
|
|
220
|
+
*/
|
|
221
|
+
const updateContactOrganizationRequestSchema = z.object({
|
|
222
|
+
name: z.string().openapi({
|
|
223
|
+
description: "The organization name.",
|
|
224
|
+
example: "Acme Corporation"
|
|
225
|
+
}).optional(),
|
|
226
|
+
externalId: z.string().openapi({
|
|
227
|
+
description: "External identifier for the organization.",
|
|
228
|
+
example: "org_12345"
|
|
229
|
+
}).optional(),
|
|
230
|
+
domain: z.string().openapi({
|
|
231
|
+
description: "The organization's domain.",
|
|
232
|
+
example: "acme.com"
|
|
233
|
+
}).optional(),
|
|
234
|
+
description: z.string().openapi({
|
|
235
|
+
description: "Description of the organization.",
|
|
236
|
+
example: "A leading provider of enterprise solutions"
|
|
237
|
+
}).optional(),
|
|
238
|
+
metadata: contactMetadataSchema.openapi({
|
|
239
|
+
description: "Additional custom metadata for the organization.",
|
|
240
|
+
example: {
|
|
241
|
+
industry: "technology",
|
|
242
|
+
employees: 500
|
|
243
|
+
}
|
|
244
|
+
}).optional()
|
|
245
|
+
});
|
|
246
|
+
/**
|
|
247
|
+
* Contact organization response schema
|
|
248
|
+
*/
|
|
249
|
+
const contactOrganizationResponseSchema = z.object({
|
|
250
|
+
id: z.ulid().openapi({
|
|
251
|
+
description: "The organization's unique identifier (ULID).",
|
|
252
|
+
example: "01JG000000000000000000000"
|
|
253
|
+
}),
|
|
254
|
+
name: z.string().openapi({
|
|
255
|
+
description: "The organization name.",
|
|
256
|
+
example: "Acme Corporation"
|
|
257
|
+
}),
|
|
258
|
+
externalId: z.string().nullable().openapi({
|
|
259
|
+
description: "External identifier for the organization.",
|
|
260
|
+
example: "org_12345"
|
|
261
|
+
}),
|
|
262
|
+
domain: z.string().nullable().openapi({
|
|
263
|
+
description: "The organization's domain.",
|
|
264
|
+
example: "acme.com"
|
|
265
|
+
}),
|
|
266
|
+
description: z.string().nullable().openapi({
|
|
267
|
+
description: "Description of the organization.",
|
|
268
|
+
example: "A leading provider of enterprise solutions"
|
|
269
|
+
}),
|
|
270
|
+
metadata: contactMetadataSchema.nullable().openapi({
|
|
271
|
+
description: "Additional custom metadata for the organization.",
|
|
272
|
+
example: {
|
|
273
|
+
industry: "technology",
|
|
274
|
+
employees: 500
|
|
275
|
+
}
|
|
276
|
+
}),
|
|
277
|
+
websiteId: z.ulid().openapi({
|
|
278
|
+
description: "The website's unique identifier that the organization belongs to.",
|
|
279
|
+
example: "01JG000000000000000000000"
|
|
280
|
+
}),
|
|
281
|
+
organizationId: z.ulid().openapi({
|
|
282
|
+
description: "The organization's unique identifier that the organization belongs to.",
|
|
283
|
+
example: "01JG000000000000000000000"
|
|
284
|
+
}),
|
|
285
|
+
createdAt: z.string().openapi({
|
|
286
|
+
description: "When the organization was first created.",
|
|
287
|
+
example: "2021-01-01T00:00:00.000Z"
|
|
288
|
+
}),
|
|
289
|
+
updatedAt: z.string().openapi({
|
|
290
|
+
description: "When the organization record was last updated.",
|
|
291
|
+
example: "2021-01-01T00:00:00.000Z"
|
|
292
|
+
})
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
//#endregion
|
|
296
|
+
export { contactMetadataSchema, contactOrganizationResponseSchema, contactResponseSchema, createContactOrganizationRequestSchema, createContactRequestSchema, identifyContactRequestSchema, identifyContactResponseSchema, updateContactMetadataRequestSchema, updateContactOrganizationRequestSchema, updateContactRequestSchema };
|
|
297
|
+
//# sourceMappingURL=contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.js","names":[],"sources":["../../src/api/contact.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\n\n/**\n * Contact metadata are stored as key value pairs\n * Values can be strings, numbers, booleans, or null\n */\nexport const contactMetadataSchema = z.record(\n\tz.string(),\n\tz.string().or(z.number()).or(z.boolean()).or(z.null())\n);\n\nexport type ContactMetadata = z.infer<typeof contactMetadataSchema>;\n\n/**\n * Create contact request schema\n */\nexport const createContactRequestSchema = z.object({\n\texternalId: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"External identifier for the contact (e.g. from your CRM).\",\n\t\t\texample: \"user_12345\",\n\t\t})\n\t\t.optional(),\n\tname: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's name.\",\n\t\t\texample: \"John Doe\",\n\t\t})\n\t\t.optional(),\n\temail: z\n\t\t.string()\n\t\t.email()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's email address.\",\n\t\t\texample: \"john.doe@example.com\",\n\t\t})\n\t\t.optional(),\n\timage: z\n\t\t.string()\n\t\t.url()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's avatar/image URL.\",\n\t\t\texample: \"https://example.com/avatar.png\",\n\t\t})\n\t\t.optional(),\n\tmetadata: contactMetadataSchema\n\t\t.openapi({\n\t\t\tdescription: \"Additional custom metadata for the contact.\",\n\t\t\texample: { plan: \"premium\", role: \"admin\" },\n\t\t})\n\t\t.optional(),\n\tcontactOrganizationId: z\n\t\t.string()\n\t\t.ulid()\n\t\t.openapi({\n\t\t\tdescription: \"The contact organization ID this contact belongs to.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t})\n\t\t.optional(),\n});\n\nexport type CreateContactRequest = z.infer<typeof createContactRequestSchema>;\n\n/**\n * Update contact request schema\n */\nexport const updateContactRequestSchema = z.object({\n\texternalId: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"External identifier for the contact.\",\n\t\t\texample: \"user_12345\",\n\t\t})\n\t\t.optional(),\n\tname: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's name.\",\n\t\t\texample: \"John Doe\",\n\t\t})\n\t\t.optional(),\n\temail: z\n\t\t.string()\n\t\t.email()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's email address.\",\n\t\t\texample: \"john.doe@example.com\",\n\t\t})\n\t\t.optional(),\n\timage: z\n\t\t.string()\n\t\t.url()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's avatar/image URL.\",\n\t\t\texample: \"https://example.com/avatar.png\",\n\t\t})\n\t\t.optional(),\n\tmetadata: contactMetadataSchema\n\t\t.openapi({\n\t\t\tdescription: \"Additional custom metadata for the contact.\",\n\t\t\texample: { plan: \"premium\", role: \"admin\" },\n\t\t})\n\t\t.optional(),\n\tcontactOrganizationId: z\n\t\t.string()\n\t\t.ulid()\n\t\t.openapi({\n\t\t\tdescription: \"The contact organization ID this contact belongs to.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t})\n\t\t.optional()\n\t\t.nullable(),\n});\n\nexport type UpdateContactRequest = z.infer<typeof updateContactRequestSchema>;\n\n/**\n * Update contact metadata request schema\n */\nexport const updateContactMetadataRequestSchema = z.object({\n\tmetadata: contactMetadataSchema.openapi({\n\t\tdescription: \"Metadata payload to merge into the contact's profile.\",\n\t\texample: { plan: \"premium\", role: \"admin\" },\n\t}),\n});\n\nexport type UpdateContactMetadataRequest = z.infer<\n\ttypeof updateContactMetadataRequestSchema\n>;\n\n/**\n * Identify contact request schema\n * This is used to create or update a contact and link it to a visitor\n */\nexport const identifyContactRequestSchema = z.object({\n\tid: z.ulid().optional().openapi({\n\t\tdescription:\n\t\t\t\"Optional contact ID to update when linking the visitor to an existing contact.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tvisitorId: z.ulid().openapi({\n\t\tdescription: \"The visitor ID to link to the contact.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\texternalId: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription:\n\t\t\t\t\"External identifier for the contact. Used to find existing contacts.\",\n\t\t\texample: \"user_12345\",\n\t\t})\n\t\t.optional(),\n\tname: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's name.\",\n\t\t\texample: \"John Doe\",\n\t\t})\n\t\t.optional(),\n\temail: z\n\t\t.string()\n\t\t.email()\n\t\t.openapi({\n\t\t\tdescription:\n\t\t\t\t\"The contact's email address. Used to find existing contacts.\",\n\t\t\texample: \"john.doe@example.com\",\n\t\t})\n\t\t.optional(),\n\timage: z\n\t\t.string()\n\t\t.url()\n\t\t.openapi({\n\t\t\tdescription: \"The contact's avatar/image URL.\",\n\t\t\texample: \"https://example.com/avatar.png\",\n\t\t})\n\t\t.optional(),\n\tmetadata: contactMetadataSchema\n\t\t.openapi({\n\t\t\tdescription: \"Additional custom metadata for the contact.\",\n\t\t\texample: { plan: \"premium\", role: \"admin\" },\n\t\t})\n\t\t.optional(),\n\tcontactOrganizationId: z\n\t\t.string()\n\t\t.ulid()\n\t\t.openapi({\n\t\t\tdescription: \"The contact organization ID this contact belongs to.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t})\n\t\t.optional(),\n});\n\nexport type IdentifyContactRequest = z.infer<\n\ttypeof identifyContactRequestSchema\n>;\n\n/**\n * Contact response schema\n */\nexport const contactResponseSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The contact's unique identifier (ULID).\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\texternalId: z.string().nullable().openapi({\n\t\tdescription: \"External identifier for the contact.\",\n\t\texample: \"user_12345\",\n\t}),\n\tname: z.string().nullable().openapi({\n\t\tdescription: \"The contact's name.\",\n\t\texample: \"John Doe\",\n\t}),\n\temail: z.email().nullable().openapi({\n\t\tdescription: \"The contact's email address.\",\n\t\texample: \"john.doe@example.com\",\n\t}),\n\timage: z.url().nullable().openapi({\n\t\tdescription: \"The contact's avatar/image URL.\",\n\t\texample: \"https://example.com/avatar.png\",\n\t}),\n\tmetadata: contactMetadataSchema.nullable().openapi({\n\t\tdescription: \"Additional custom metadata for the contact.\",\n\t\texample: { plan: \"premium\", role: \"admin\" },\n\t}),\n\tcontactOrganizationId: z.ulid().nullable().openapi({\n\t\tdescription: \"The contact organization ID this contact belongs to.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\twebsiteId: z.ulid().openapi({\n\t\tdescription: \"The website's unique identifier that the contact belongs to.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\torganizationId: z.ulid().openapi({\n\t\tdescription:\n\t\t\t\"The organization's unique identifier that the contact belongs to.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tuserId: z.ulid().nullable().openapi({\n\t\tdescription: \"The user ID if the contact is linked to a registered user.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tcreatedAt: z.string().openapi({\n\t\tdescription: \"When the contact was first created.\",\n\t\texample: \"2021-01-01T00:00:00.000Z\",\n\t}),\n\tupdatedAt: z.string().openapi({\n\t\tdescription: \"When the contact record was last updated.\",\n\t\texample: \"2021-01-01T00:00:00.000Z\",\n\t}),\n});\n\nexport type Contact = z.infer<typeof contactResponseSchema>;\nexport type ContactResponse = Contact;\n\n/**\n * Identify contact response schema\n */\nexport const identifyContactResponseSchema = z.object({\n\tcontact: contactResponseSchema,\n\tvisitorId: z.ulid().openapi({\n\t\tdescription: \"The visitor ID that was linked to the contact.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n});\n\nexport type IdentifyContactResponse = z.infer<\n\ttypeof identifyContactResponseSchema\n>;\n\n// Contact Organisation Schemas\n\n/**\n * Create contact organization request schema\n */\nexport const createContactOrganizationRequestSchema = z.object({\n\tname: z.string().openapi({\n\t\tdescription: \"The organization name.\",\n\t\texample: \"Acme Corporation\",\n\t}),\n\texternalId: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription:\n\t\t\t\t\"External identifier for the organization (e.g. from your CRM).\",\n\t\t\texample: \"org_12345\",\n\t\t})\n\t\t.optional(),\n\tdomain: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The organization's domain.\",\n\t\t\texample: \"acme.com\",\n\t\t})\n\t\t.optional(),\n\tdescription: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"Description of the organization.\",\n\t\t\texample: \"A leading provider of enterprise solutions\",\n\t\t})\n\t\t.optional(),\n\tmetadata: contactMetadataSchema\n\t\t.openapi({\n\t\t\tdescription: \"Additional custom metadata for the organization.\",\n\t\t\texample: { industry: \"technology\", employees: 500 },\n\t\t})\n\t\t.optional(),\n});\n\nexport type CreateContactOrganizationRequest = z.infer<\n\ttypeof createContactOrganizationRequestSchema\n>;\n\n/**\n * Update contact organization request schema\n */\nexport const updateContactOrganizationRequestSchema = z.object({\n\tname: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The organization name.\",\n\t\t\texample: \"Acme Corporation\",\n\t\t})\n\t\t.optional(),\n\texternalId: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"External identifier for the organization.\",\n\t\t\texample: \"org_12345\",\n\t\t})\n\t\t.optional(),\n\tdomain: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The organization's domain.\",\n\t\t\texample: \"acme.com\",\n\t\t})\n\t\t.optional(),\n\tdescription: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"Description of the organization.\",\n\t\t\texample: \"A leading provider of enterprise solutions\",\n\t\t})\n\t\t.optional(),\n\tmetadata: contactMetadataSchema\n\t\t.openapi({\n\t\t\tdescription: \"Additional custom metadata for the organization.\",\n\t\t\texample: { industry: \"technology\", employees: 500 },\n\t\t})\n\t\t.optional(),\n});\n\nexport type UpdateContactOrganizationRequest = z.infer<\n\ttypeof updateContactOrganizationRequestSchema\n>;\n\n/**\n * Contact organization response schema\n */\nexport const contactOrganizationResponseSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The organization's unique identifier (ULID).\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tname: z.string().openapi({\n\t\tdescription: \"The organization name.\",\n\t\texample: \"Acme Corporation\",\n\t}),\n\texternalId: z.string().nullable().openapi({\n\t\tdescription: \"External identifier for the organization.\",\n\t\texample: \"org_12345\",\n\t}),\n\tdomain: z.string().nullable().openapi({\n\t\tdescription: \"The organization's domain.\",\n\t\texample: \"acme.com\",\n\t}),\n\tdescription: z.string().nullable().openapi({\n\t\tdescription: \"Description of the organization.\",\n\t\texample: \"A leading provider of enterprise solutions\",\n\t}),\n\tmetadata: contactMetadataSchema.nullable().openapi({\n\t\tdescription: \"Additional custom metadata for the organization.\",\n\t\texample: { industry: \"technology\", employees: 500 },\n\t}),\n\twebsiteId: z.ulid().openapi({\n\t\tdescription:\n\t\t\t\"The website's unique identifier that the organization belongs to.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\torganizationId: z.ulid().openapi({\n\t\tdescription:\n\t\t\t\"The organization's unique identifier that the organization belongs to.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tcreatedAt: z.string().openapi({\n\t\tdescription: \"When the organization was first created.\",\n\t\texample: \"2021-01-01T00:00:00.000Z\",\n\t}),\n\tupdatedAt: z.string().openapi({\n\t\tdescription: \"When the organization record was last updated.\",\n\t\texample: \"2021-01-01T00:00:00.000Z\",\n\t}),\n});\n\nexport type contactOrganization = z.infer<\n\ttypeof contactOrganizationResponseSchema\n>;\nexport type ContactOrganizationResponse = contactOrganization;\n"],"mappings":";;;;;;;AAMA,MAAa,wBAAwB,EAAE,OACtC,EAAE,QAAQ,EACV,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CACtD;;;;AAOD,MAAa,6BAA6B,EAAE,OAAO;CAClD,YAAY,EACV,QAAQ,CACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC,CACD,UAAU;CACZ,MAAM,EACJ,QAAQ,CACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC,CACD,UAAU;CACZ,OAAO,EACL,QAAQ,CACR,OAAO,CACP,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC,CACD,UAAU;CACZ,OAAO,EACL,QAAQ,CACR,KAAK,CACL,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC,CACD,UAAU;CACZ,UAAU,sBACR,QAAQ;EACR,aAAa;EACb,SAAS;GAAE,MAAM;GAAW,MAAM;GAAS;EAC3C,CAAC,CACD,UAAU;CACZ,uBAAuB,EACrB,QAAQ,CACR,MAAM,CACN,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC,CACD,UAAU;CACZ,CAAC;;;;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