@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.
Files changed (70) hide show
  1. package/dist/api/common.d.ts +44 -0
  2. package/dist/api/common.d.ts.map +1 -0
  3. package/dist/api/common.js +72 -0
  4. package/dist/api/common.js.map +1 -0
  5. package/dist/api/contact.d.ts +138 -0
  6. package/dist/api/contact.d.ts.map +1 -0
  7. package/dist/api/contact.js +297 -0
  8. package/dist/api/contact.js.map +1 -0
  9. package/dist/api/conversation.d.ts +91 -0
  10. package/dist/api/conversation.d.ts.map +1 -0
  11. package/dist/api/conversation.js +81 -0
  12. package/dist/api/conversation.js.map +1 -0
  13. package/dist/api/index.d.ts +10 -0
  14. package/dist/api/index.js +11 -0
  15. package/dist/api/organization.d.ts +15 -0
  16. package/dist/api/organization.d.ts.map +1 -0
  17. package/dist/api/organization.js +20 -0
  18. package/dist/api/organization.js.map +1 -0
  19. package/dist/api/timeline-item.d.ts +270 -0
  20. package/dist/api/timeline-item.d.ts.map +1 -0
  21. package/dist/api/timeline-item.js +111 -0
  22. package/dist/api/timeline-item.js.map +1 -0
  23. package/dist/api/upload.d.ts +100 -0
  24. package/dist/api/upload.d.ts.map +1 -0
  25. package/dist/api/upload.js +119 -0
  26. package/dist/api/upload.js.map +1 -0
  27. package/dist/api/user.d.ts +27 -0
  28. package/dist/api/user.d.ts.map +1 -0
  29. package/dist/api/user.js +52 -0
  30. package/dist/api/user.js.map +1 -0
  31. package/dist/api/visitor.d.ts +125 -0
  32. package/dist/api/visitor.d.ts.map +1 -0
  33. package/dist/api/visitor.js +301 -0
  34. package/dist/api/visitor.js.map +1 -0
  35. package/dist/api/website.d.ts +192 -0
  36. package/dist/api/website.d.ts.map +1 -0
  37. package/dist/api/website.js +320 -0
  38. package/dist/api/website.js.map +1 -0
  39. package/dist/enums.d.ts +79 -0
  40. package/dist/enums.d.ts.map +1 -0
  41. package/dist/enums.js +69 -0
  42. package/dist/enums.js.map +1 -0
  43. package/dist/index.d.ts +40 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +18 -0
  46. package/dist/presence.d.ts +7 -0
  47. package/dist/presence.d.ts.map +1 -0
  48. package/dist/presence.js +8 -0
  49. package/dist/presence.js.map +1 -0
  50. package/dist/realtime-events.d.ts +136 -0
  51. package/dist/realtime-events.d.ts.map +1 -0
  52. package/dist/realtime-events.js +99 -0
  53. package/dist/realtime-events.js.map +1 -0
  54. package/dist/schemas.d.ts +44 -0
  55. package/dist/schemas.d.ts.map +1 -0
  56. package/dist/schemas.js +46 -0
  57. package/dist/schemas.js.map +1 -0
  58. package/dist/trpc/contact.d.ts +68 -0
  59. package/dist/trpc/contact.d.ts.map +1 -0
  60. package/dist/trpc/contact.js +45 -0
  61. package/dist/trpc/contact.js.map +1 -0
  62. package/dist/trpc/conversation.d.ts +139 -0
  63. package/dist/trpc/conversation.d.ts.map +1 -0
  64. package/dist/trpc/conversation.js +80 -0
  65. package/dist/trpc/conversation.js.map +1 -0
  66. package/dist/trpc/visitor.d.ts +53 -0
  67. package/dist/trpc/visitor.d.ts.map +1 -0
  68. package/dist/trpc/visitor.js +34 -0
  69. package/dist/trpc/visitor.js.map +1 -0
  70. package/package.json +40 -0
@@ -0,0 +1,320 @@
1
+ import { APIKeyType, WebsiteInstallationTarget, WebsiteStatus } from "../enums.js";
2
+ import { publicVisitorResponseSchema } from "./visitor.js";
3
+ import { z } from "@hono/zod-openapi";
4
+
5
+ //#region src/api/website.ts
6
+ /**
7
+ * Website creation request schema
8
+ */
9
+ const createWebsiteRequestSchema = z.object({
10
+ name: z.string().openapi({
11
+ description: "The website's name.",
12
+ example: "Dub"
13
+ }).min(3, { message: "Name must be at least 3 characters" }).max(30, { message: "Name must be less than 30 characters" }),
14
+ domain: z.string().regex(/^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/).openapi({
15
+ description: "The website's domain.",
16
+ example: "dub.co"
17
+ }),
18
+ organizationId: z.ulid().openapi({
19
+ description: "The organization's unique identifier.",
20
+ example: "01JG000000000000000000000"
21
+ }),
22
+ installationTarget: z.nativeEnum(WebsiteInstallationTarget).openapi({
23
+ description: "The website's library installation target.",
24
+ example: WebsiteInstallationTarget.NEXTJS
25
+ })
26
+ });
27
+ const API_KEY_TYPE_VALUES = [APIKeyType.PUBLIC, APIKeyType.PRIVATE];
28
+ const WEBSITE_STATUS_VALUES = [WebsiteStatus.ACTIVE, WebsiteStatus.INACTIVE];
29
+ const websiteApiKeySchema = z.object({
30
+ id: z.ulid().openapi({
31
+ description: "The API key's unique identifier.",
32
+ example: "01JG000000000000000000000"
33
+ }),
34
+ name: z.string().openapi({
35
+ description: "The API key's display name.",
36
+ example: "Production public key"
37
+ }),
38
+ key: z.string().nullable().openapi({
39
+ description: "The API key's raw value when available. Private keys will be null when fetched after creation.",
40
+ example: "pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
41
+ }),
42
+ keyType: z.enum(API_KEY_TYPE_VALUES).openapi({
43
+ description: "The API key's type (public or private).",
44
+ example: APIKeyType.PUBLIC
45
+ }),
46
+ isTest: z.boolean().openapi({
47
+ description: "Whether the API key is a test key.",
48
+ example: false
49
+ }),
50
+ isActive: z.boolean().openapi({
51
+ description: "Whether the API key is active.",
52
+ example: true
53
+ }),
54
+ createdAt: z.string().openapi({
55
+ description: "Timestamp indicating when the API key was created.",
56
+ example: "2024-01-01T00:00:00.000Z"
57
+ }),
58
+ lastUsedAt: z.string().nullable().openapi({
59
+ description: "Timestamp indicating when the API key was last used.",
60
+ example: "2024-01-10T12:00:00.000Z"
61
+ }),
62
+ revokedAt: z.string().nullable().openapi({
63
+ description: "Timestamp indicating when the API key was revoked, if applicable.",
64
+ example: null
65
+ })
66
+ }).openapi({ description: "A website API key summary." });
67
+ const websiteSummarySchema = z.object({
68
+ id: z.ulid().openapi({
69
+ description: "The website's unique identifier.",
70
+ example: "01JG000000000000000000000"
71
+ }),
72
+ slug: z.string().openapi({
73
+ description: "The website's slug.",
74
+ example: "dub-co"
75
+ }),
76
+ name: z.string().openapi({
77
+ description: "The website's name.",
78
+ example: "Dub"
79
+ }),
80
+ domain: z.string().openapi({
81
+ description: "The website's domain.",
82
+ example: "dub.co"
83
+ }),
84
+ contactEmail: z.string().email().nullable().openapi({
85
+ description: "The primary email visitors can use to reach you.",
86
+ example: "support@dub.co"
87
+ }),
88
+ logoUrl: z.string().url().nullable().openapi({
89
+ description: "Public URL to the website's logo.",
90
+ example: "https://cdn.example.com/logo.png"
91
+ }),
92
+ organizationId: z.ulid().openapi({
93
+ description: "The owning organization's unique identifier.",
94
+ example: "01JG000000000000000000000"
95
+ }),
96
+ whitelistedDomains: z.array(z.url()).openapi({
97
+ description: "The domains allowed to use the website's public keys.",
98
+ example: ["https://dub.co", "http://localhost:3000"]
99
+ })
100
+ }).openapi({ description: "Summary information for a website used in settings screens." });
101
+ const websiteDeveloperSettingsResponseSchema = z.object({
102
+ website: websiteSummarySchema,
103
+ apiKeys: z.array(websiteApiKeySchema)
104
+ }).openapi({ description: "Developer settings payload including website information and API keys." });
105
+ const createWebsiteApiKeyRequestSchema = z.object({
106
+ organizationId: z.ulid().openapi({
107
+ description: "The organization's unique identifier.",
108
+ example: "01JG000000000000000000000"
109
+ }),
110
+ websiteId: z.ulid().openapi({
111
+ description: "The website's unique identifier.",
112
+ example: "01JG000000000000000000000"
113
+ }),
114
+ name: z.string().min(3).max(80).openapi({
115
+ description: "A human-friendly label for the API key.",
116
+ example: "Docs integration"
117
+ }),
118
+ keyType: z.enum(API_KEY_TYPE_VALUES).openapi({
119
+ description: "The type of API key to generate.",
120
+ example: APIKeyType.PRIVATE
121
+ }),
122
+ isTest: z.boolean().openapi({
123
+ description: "Whether to generate a test key scoped to localhost.",
124
+ example: false
125
+ })
126
+ }).openapi({ description: "Payload to create a website API key." });
127
+ const revokeWebsiteApiKeyRequestSchema = z.object({
128
+ organizationId: z.ulid().openapi({
129
+ description: "The organization's unique identifier.",
130
+ example: "01JG000000000000000000000"
131
+ }),
132
+ websiteId: z.ulid().openapi({
133
+ description: "The website's unique identifier.",
134
+ example: "01JG000000000000000000000"
135
+ }),
136
+ apiKeyId: z.ulid().openapi({
137
+ description: "The API key's unique identifier.",
138
+ example: "01JG000000000000000000000"
139
+ })
140
+ }).openapi({ description: "Payload to revoke a website API key." });
141
+ const websiteUpdateDataSchema = z.object({
142
+ name: z.string().min(1).max(120).optional(),
143
+ slug: z.string().min(1).optional(),
144
+ domain: z.string().min(1).optional(),
145
+ contactEmail: z.string().email().nullable().optional(),
146
+ description: z.string().nullable().optional(),
147
+ logoUrl: z.string().url().nullable().optional(),
148
+ whitelistedDomains: z.array(z.url()).optional(),
149
+ installationTarget: z.nativeEnum(WebsiteInstallationTarget).optional(),
150
+ status: z.enum(WEBSITE_STATUS_VALUES).optional(),
151
+ teamId: z.string().nullable().optional()
152
+ }).refine((value) => Object.keys(value).length > 0, { message: "Provide at least one field to update." });
153
+ const updateWebsiteRequestSchema = z.object({
154
+ organizationId: z.ulid().openapi({
155
+ description: "The organization's unique identifier.",
156
+ example: "01JG000000000000000000000"
157
+ }),
158
+ websiteId: z.ulid().openapi({
159
+ description: "The website's unique identifier.",
160
+ example: "01JG000000000000000000000"
161
+ }),
162
+ data: websiteUpdateDataSchema.openapi({ description: "The fields to update on the website." })
163
+ }).openapi({ description: "Payload to update website settings." });
164
+ /**
165
+ * Website creation response schema
166
+ */
167
+ const createWebsiteResponseSchema = z.object({
168
+ id: z.ulid().openapi({
169
+ description: "The website's unique identifier.",
170
+ example: "01JG000000000000000000000"
171
+ }),
172
+ name: z.string().openapi({
173
+ description: "The website's name.",
174
+ example: "Dub"
175
+ }),
176
+ slug: z.string().openapi({
177
+ description: "The website's slug.",
178
+ example: "dubdotco"
179
+ }),
180
+ whitelistedDomains: z.array(z.url()).openapi({
181
+ description: "The website's whitelisted domains.",
182
+ example: ["http://localhost:3000", "https://dub.co"]
183
+ }),
184
+ organizationId: z.ulid().openapi({
185
+ description: "The organization's unique identifier.",
186
+ example: "01JG000000000000000000000"
187
+ }),
188
+ apiKeys: z.array(websiteApiKeySchema).openapi({
189
+ description: "The website's API keys.",
190
+ example: [{
191
+ id: "01JG000000000000000000000",
192
+ key: "pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
193
+ createdAt: "2021-01-01T00:00:00.000Z",
194
+ isTest: true,
195
+ isActive: true,
196
+ keyType: APIKeyType.PUBLIC,
197
+ lastUsedAt: null,
198
+ revokedAt: null
199
+ }]
200
+ })
201
+ });
202
+ /**
203
+ * Website domain validation request schema
204
+ */
205
+ const checkWebsiteDomainRequestSchema = z.object({ domain: z.string().regex(/^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/).openapi({
206
+ description: "The website's domain.",
207
+ example: "dub.co"
208
+ }) });
209
+ const availableHumanAgentSchema = z.object({
210
+ id: z.ulid().openapi({
211
+ description: "The human agent's unique identifier.",
212
+ example: "01JG000000000000000000000"
213
+ }),
214
+ name: z.string().openapi({
215
+ description: "The agent's name.",
216
+ example: "John Doe"
217
+ }),
218
+ image: z.string().nullable().openapi({
219
+ description: "The agent's avatar URL.",
220
+ example: "https://cossistant.com/avatar.png"
221
+ }),
222
+ lastSeenAt: z.string().nullable().openapi({
223
+ description: "The agent's last online timestamp, used to determine if the agent is online. If the agent is offline, this will be null or more than 5 minutes ago.",
224
+ example: "2021-01-01T00:00:00.000Z"
225
+ })
226
+ });
227
+ const AvailableAIAgentSchema = z.object({
228
+ id: z.ulid().openapi({
229
+ description: "The AI agent's unique identifier.",
230
+ example: "01JG000000000000000000000"
231
+ }),
232
+ name: z.string().openapi({
233
+ description: "The AI agent's name.",
234
+ example: "John Doe"
235
+ }),
236
+ image: z.string().nullable().openapi({
237
+ description: "The AI agent's avatar URL.",
238
+ example: "https://cossistant.com/avatar.png"
239
+ })
240
+ });
241
+ /**
242
+ * Website information response schema
243
+ */
244
+ const publicWebsiteResponseSchema = z.object({
245
+ id: z.ulid().openapi({
246
+ description: "The website's unique identifier.",
247
+ example: "01JG000000000000000000000"
248
+ }),
249
+ name: z.string().openapi({
250
+ description: "The website's name.",
251
+ example: "Dub"
252
+ }),
253
+ domain: z.string().openapi({
254
+ description: "The website's domain.",
255
+ example: "dub.co"
256
+ }),
257
+ description: z.string().nullable().openapi({
258
+ description: "The website's description.",
259
+ example: "Link management for modern marketing teams."
260
+ }),
261
+ logoUrl: z.string().nullable().openapi({
262
+ description: "The website's logo URL.",
263
+ example: "https://dub.co/logo.png"
264
+ }),
265
+ organizationId: z.ulid().openapi({
266
+ description: "The organization's unique identifier.",
267
+ example: "01JG000000000000000000000"
268
+ }),
269
+ status: z.string().openapi({
270
+ description: "The website's status.",
271
+ example: "active"
272
+ }),
273
+ lastOnlineAt: z.string().nullable().openapi({
274
+ description: "The website's support last online date.",
275
+ example: "2021-01-01T00:00:00.000Z"
276
+ }),
277
+ availableHumanAgents: z.array(availableHumanAgentSchema),
278
+ availableAIAgents: z.array(AvailableAIAgentSchema),
279
+ visitor: publicVisitorResponseSchema.openapi({ description: "The visitor information. Either existing visitor data or newly created visitor." })
280
+ });
281
+ /**
282
+ * List websites by organization request schema
283
+ */
284
+ const listByOrganizationRequestSchema = z.object({ organizationId: z.ulid().openapi({
285
+ description: "The organization's unique identifier.",
286
+ example: "01JG000000000000000000000"
287
+ }) });
288
+ /**
289
+ * Website list item schema - simplified website info for listing
290
+ */
291
+ const websiteListItemSchema = z.object({
292
+ id: z.ulid().openapi({
293
+ description: "The website's unique identifier.",
294
+ example: "01JG000000000000000000000"
295
+ }),
296
+ name: z.string().openapi({
297
+ description: "The website's name.",
298
+ example: "Dub"
299
+ }),
300
+ slug: z.string().openapi({
301
+ description: "The website's slug.",
302
+ example: "dub-co"
303
+ }),
304
+ logoUrl: z.string().url().nullable().openapi({
305
+ description: "Public URL to the website's logo.",
306
+ example: "https://cdn.example.com/logo.png"
307
+ }),
308
+ domain: z.string().openapi({
309
+ description: "The website's domain.",
310
+ example: "dub.co"
311
+ }),
312
+ organizationId: z.ulid().openapi({
313
+ description: "The owning organization's unique identifier.",
314
+ example: "01JG000000000000000000000"
315
+ })
316
+ });
317
+
318
+ //#endregion
319
+ export { AvailableAIAgentSchema, availableHumanAgentSchema, checkWebsiteDomainRequestSchema, createWebsiteApiKeyRequestSchema, createWebsiteRequestSchema, createWebsiteResponseSchema, listByOrganizationRequestSchema, publicWebsiteResponseSchema, revokeWebsiteApiKeyRequestSchema, updateWebsiteRequestSchema, websiteApiKeySchema, websiteDeveloperSettingsResponseSchema, websiteListItemSchema, websiteSummarySchema };
320
+ //# sourceMappingURL=website.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"website.js","names":[],"sources":["../../src/api/website.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\nimport { APIKeyType, WebsiteInstallationTarget, WebsiteStatus } from \"../enums\";\nimport { publicVisitorResponseSchema } from \"./visitor\";\n\n/**\n * Website creation request schema\n */\nexport const createWebsiteRequestSchema = z.object({\n\tname: z\n\t\t.string()\n\t\t.openapi({\n\t\t\tdescription: \"The website's name.\",\n\t\t\texample: \"Dub\",\n\t\t})\n\t\t.min(3, {\n\t\t\tmessage: \"Name must be at least 3 characters\",\n\t\t})\n\t\t.max(30, {\n\t\t\tmessage: \"Name must be less than 30 characters\",\n\t\t}),\n\tdomain: z\n\t\t.string()\n\t\t.regex(/^[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*$/)\n\t\t.openapi({\n\t\t\tdescription: \"The website's domain.\",\n\t\t\texample: \"dub.co\",\n\t\t}),\n\torganizationId: z.ulid().openapi({\n\t\tdescription: \"The organization's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tinstallationTarget: z.nativeEnum(WebsiteInstallationTarget).openapi({\n\t\tdescription: \"The website's library installation target.\",\n\t\texample: WebsiteInstallationTarget.NEXTJS,\n\t}),\n});\n\nexport type CreateWebsiteRequest = z.infer<typeof createWebsiteRequestSchema>;\n\nconst API_KEY_TYPE_VALUES = [APIKeyType.PUBLIC, APIKeyType.PRIVATE] as const;\n\nconst WEBSITE_STATUS_VALUES = [\n\tWebsiteStatus.ACTIVE,\n\tWebsiteStatus.INACTIVE,\n] as const;\n\nexport const websiteApiKeySchema = z\n\t.object({\n\t\tid: z.ulid().openapi({\n\t\t\tdescription: \"The API key's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\tname: z.string().openapi({\n\t\t\tdescription: \"The API key's display name.\",\n\t\t\texample: \"Production public key\",\n\t\t}),\n\t\tkey: z.string().nullable().openapi({\n\t\t\tdescription:\n\t\t\t\t\"The API key's raw value when available. Private keys will be null when fetched after creation.\",\n\t\t\texample: \"pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n\t\t}),\n\t\tkeyType: z.enum(API_KEY_TYPE_VALUES).openapi({\n\t\t\tdescription: \"The API key's type (public or private).\",\n\t\t\texample: APIKeyType.PUBLIC,\n\t\t}),\n\t\tisTest: z.boolean().openapi({\n\t\t\tdescription: \"Whether the API key is a test key.\",\n\t\t\texample: false,\n\t\t}),\n\t\tisActive: z.boolean().openapi({\n\t\t\tdescription: \"Whether the API key is active.\",\n\t\t\texample: true,\n\t\t}),\n\t\tcreatedAt: z.string().openapi({\n\t\t\tdescription: \"Timestamp indicating when the API key was created.\",\n\t\t\texample: \"2024-01-01T00:00:00.000Z\",\n\t\t}),\n\t\tlastUsedAt: z.string().nullable().openapi({\n\t\t\tdescription: \"Timestamp indicating when the API key was last used.\",\n\t\t\texample: \"2024-01-10T12:00:00.000Z\",\n\t\t}),\n\t\trevokedAt: z.string().nullable().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Timestamp indicating when the API key was revoked, if applicable.\",\n\t\t\texample: null,\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"A website API key summary.\",\n\t});\n\nexport type WebsiteApiKey = z.infer<typeof websiteApiKeySchema>;\n\nexport const websiteSummarySchema = z\n\t.object({\n\t\tid: z.ulid().openapi({\n\t\t\tdescription: \"The website's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\tslug: z.string().openapi({\n\t\t\tdescription: \"The website's slug.\",\n\t\t\texample: \"dub-co\",\n\t\t}),\n\t\tname: z.string().openapi({\n\t\t\tdescription: \"The website's name.\",\n\t\t\texample: \"Dub\",\n\t\t}),\n\t\tdomain: z.string().openapi({\n\t\t\tdescription: \"The website's domain.\",\n\t\t\texample: \"dub.co\",\n\t\t}),\n\t\tcontactEmail: z.string().email().nullable().openapi({\n\t\t\tdescription: \"The primary email visitors can use to reach you.\",\n\t\t\texample: \"support@dub.co\",\n\t\t}),\n\t\tlogoUrl: z.string().url().nullable().openapi({\n\t\t\tdescription: \"Public URL to the website's logo.\",\n\t\t\texample: \"https://cdn.example.com/logo.png\",\n\t\t}),\n\t\torganizationId: z.ulid().openapi({\n\t\t\tdescription: \"The owning organization's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\twhitelistedDomains: z.array(z.url()).openapi({\n\t\t\tdescription: \"The domains allowed to use the website's public keys.\",\n\t\t\texample: [\"https://dub.co\", \"http://localhost:3000\"],\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Summary information for a website used in settings screens.\",\n\t});\n\nexport type WebsiteSummary = z.infer<typeof websiteSummarySchema>;\n\nexport const websiteDeveloperSettingsResponseSchema = z\n\t.object({\n\t\twebsite: websiteSummarySchema,\n\t\tapiKeys: z.array(websiteApiKeySchema),\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Developer settings payload including website information and API keys.\",\n\t});\n\nexport type WebsiteDeveloperSettingsResponse = z.infer<\n\ttypeof websiteDeveloperSettingsResponseSchema\n>;\n\nexport const createWebsiteApiKeyRequestSchema = z\n\t.object({\n\t\torganizationId: z.ulid().openapi({\n\t\t\tdescription: \"The organization's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\twebsiteId: z.ulid().openapi({\n\t\t\tdescription: \"The website's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\tname: z.string().min(3).max(80).openapi({\n\t\t\tdescription: \"A human-friendly label for the API key.\",\n\t\t\texample: \"Docs integration\",\n\t\t}),\n\t\tkeyType: z.enum(API_KEY_TYPE_VALUES).openapi({\n\t\t\tdescription: \"The type of API key to generate.\",\n\t\t\texample: APIKeyType.PRIVATE,\n\t\t}),\n\t\tisTest: z.boolean().openapi({\n\t\t\tdescription: \"Whether to generate a test key scoped to localhost.\",\n\t\t\texample: false,\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Payload to create a website API key.\",\n\t});\n\nexport type CreateWebsiteApiKeyRequest = z.infer<\n\ttypeof createWebsiteApiKeyRequestSchema\n>;\n\nexport const revokeWebsiteApiKeyRequestSchema = z\n\t.object({\n\t\torganizationId: z.ulid().openapi({\n\t\t\tdescription: \"The organization's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\twebsiteId: z.ulid().openapi({\n\t\t\tdescription: \"The website's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\tapiKeyId: z.ulid().openapi({\n\t\t\tdescription: \"The API key's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Payload to revoke a website API key.\",\n\t});\n\nexport type RevokeWebsiteApiKeyRequest = z.infer<\n\ttypeof revokeWebsiteApiKeyRequestSchema\n>;\n\nconst websiteUpdateDataSchema = z\n\t.object({\n\t\tname: z.string().min(1).max(120).optional(),\n\t\tslug: z.string().min(1).optional(),\n\t\tdomain: z.string().min(1).optional(),\n\t\tcontactEmail: z.string().email().nullable().optional(),\n\t\tdescription: z.string().nullable().optional(),\n\t\tlogoUrl: z.string().url().nullable().optional(),\n\t\twhitelistedDomains: z.array(z.url()).optional(),\n\t\tinstallationTarget: z.nativeEnum(WebsiteInstallationTarget).optional(),\n\t\tstatus: z.enum(WEBSITE_STATUS_VALUES).optional(),\n\t\tteamId: z.string().nullable().optional(),\n\t})\n\t.refine((value) => Object.keys(value).length > 0, {\n\t\tmessage: \"Provide at least one field to update.\",\n\t});\n\nexport const updateWebsiteRequestSchema = z\n\t.object({\n\t\torganizationId: z.ulid().openapi({\n\t\t\tdescription: \"The organization's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\twebsiteId: z.ulid().openapi({\n\t\t\tdescription: \"The website's unique identifier.\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\tdata: websiteUpdateDataSchema.openapi({\n\t\t\tdescription: \"The fields to update on the website.\",\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Payload to update website settings.\",\n\t});\n\nexport type UpdateWebsiteRequest = z.infer<typeof updateWebsiteRequestSchema>;\n\n/**\n * Website creation response schema\n */\nexport const createWebsiteResponseSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The website's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tname: z.string().openapi({\n\t\tdescription: \"The website's name.\",\n\t\texample: \"Dub\",\n\t}),\n\tslug: z.string().openapi({\n\t\tdescription: \"The website's slug.\",\n\t\texample: \"dubdotco\",\n\t}),\n\twhitelistedDomains: z.array(z.url()).openapi({\n\t\tdescription: \"The website's whitelisted domains.\",\n\t\texample: [\"http://localhost:3000\", \"https://dub.co\"],\n\t}),\n\torganizationId: z.ulid().openapi({\n\t\tdescription: \"The organization's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tapiKeys: z.array(websiteApiKeySchema).openapi({\n\t\tdescription: \"The website's API keys.\",\n\t\texample: [\n\t\t\t{\n\t\t\t\tid: \"01JG000000000000000000000\",\n\t\t\t\tkey: \"pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n\t\t\t\tcreatedAt: \"2021-01-01T00:00:00.000Z\",\n\t\t\t\tisTest: true,\n\t\t\t\tisActive: true,\n\t\t\t\tkeyType: APIKeyType.PUBLIC,\n\t\t\t\tlastUsedAt: null,\n\t\t\t\trevokedAt: null,\n\t\t\t},\n\t\t],\n\t}),\n});\n\nexport type CreateWebsiteResponse = z.infer<typeof createWebsiteResponseSchema>;\n\n/**\n * Website domain validation request schema\n */\nexport const checkWebsiteDomainRequestSchema = z.object({\n\tdomain: z\n\t\t.string()\n\t\t.regex(/^[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*$/)\n\t\t.openapi({\n\t\t\tdescription: \"The website's domain.\",\n\t\t\texample: \"dub.co\",\n\t\t}),\n});\n\nexport type CheckWebsiteDomainRequest = z.infer<\n\ttypeof checkWebsiteDomainRequestSchema\n>;\n\nexport const availableHumanAgentSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The human agent's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tname: z.string().openapi({\n\t\tdescription: \"The agent's name.\",\n\t\texample: \"John Doe\",\n\t}),\n\timage: z.string().nullable().openapi({\n\t\tdescription: \"The agent's avatar URL.\",\n\t\texample: \"https://cossistant.com/avatar.png\",\n\t}),\n\tlastSeenAt: z.string().nullable().openapi({\n\t\tdescription:\n\t\t\t\"The agent's last online timestamp, used to determine if the agent is online. If the agent is offline, this will be null or more than 5 minutes ago.\",\n\t\texample: \"2021-01-01T00:00:00.000Z\",\n\t}),\n});\n\nexport const AvailableAIAgentSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The AI agent's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tname: z.string().openapi({\n\t\tdescription: \"The AI agent's name.\",\n\t\texample: \"John Doe\",\n\t}),\n\timage: z.string().nullable().openapi({\n\t\tdescription: \"The AI agent's avatar URL.\",\n\t\texample: \"https://cossistant.com/avatar.png\",\n\t}),\n});\n\n/**\n * Website information response schema\n */\nexport const publicWebsiteResponseSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The website's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tname: z.string().openapi({\n\t\tdescription: \"The website's name.\",\n\t\texample: \"Dub\",\n\t}),\n\tdomain: z.string().openapi({\n\t\tdescription: \"The website's domain.\",\n\t\texample: \"dub.co\",\n\t}),\n\tdescription: z.string().nullable().openapi({\n\t\tdescription: \"The website's description.\",\n\t\texample: \"Link management for modern marketing teams.\",\n\t}),\n\tlogoUrl: z.string().nullable().openapi({\n\t\tdescription: \"The website's logo URL.\",\n\t\texample: \"https://dub.co/logo.png\",\n\t}),\n\torganizationId: z.ulid().openapi({\n\t\tdescription: \"The organization's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tstatus: z.string().openapi({\n\t\tdescription: \"The website's status.\",\n\t\texample: \"active\",\n\t}),\n\tlastOnlineAt: z.string().nullable().openapi({\n\t\tdescription: \"The website's support last online date.\",\n\t\texample: \"2021-01-01T00:00:00.000Z\",\n\t}),\n\tavailableHumanAgents: z.array(availableHumanAgentSchema),\n\tavailableAIAgents: z.array(AvailableAIAgentSchema),\n\tvisitor: publicVisitorResponseSchema.openapi({\n\t\tdescription:\n\t\t\t\"The visitor information. Either existing visitor data or newly created visitor.\",\n\t}),\n});\n\nexport type PublicWebsiteResponse = z.infer<typeof publicWebsiteResponseSchema>;\nexport type AvailableHumanAgent = z.infer<typeof availableHumanAgentSchema>;\nexport type AvailableAIAgent = z.infer<typeof AvailableAIAgentSchema>;\n\n/**\n * List websites by organization request schema\n */\nexport const listByOrganizationRequestSchema = z.object({\n\torganizationId: z.ulid().openapi({\n\t\tdescription: \"The organization's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n});\n\nexport type ListByOrganizationRequest = z.infer<\n\ttypeof listByOrganizationRequestSchema\n>;\n\n/**\n * Website list item schema - simplified website info for listing\n */\nexport const websiteListItemSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"The website's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\tname: z.string().openapi({\n\t\tdescription: \"The website's name.\",\n\t\texample: \"Dub\",\n\t}),\n\tslug: z.string().openapi({\n\t\tdescription: \"The website's slug.\",\n\t\texample: \"dub-co\",\n\t}),\n\tlogoUrl: z.string().url().nullable().openapi({\n\t\tdescription: \"Public URL to the website's logo.\",\n\t\texample: \"https://cdn.example.com/logo.png\",\n\t}),\n\tdomain: z.string().openapi({\n\t\tdescription: \"The website's domain.\",\n\t\texample: \"dub.co\",\n\t}),\n\torganizationId: z.ulid().openapi({\n\t\tdescription: \"The owning organization's unique identifier.\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n});\n\nexport type WebsiteListItem = z.infer<typeof websiteListItemSchema>;\n"],"mappings":";;;;;;;;AAOA,MAAa,6BAA6B,EAAE,OAAO;CAClD,MAAM,EACJ,QAAQ,CACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC,CACD,IAAI,GAAG,EACP,SAAS,sCACT,CAAC,CACD,IAAI,IAAI,EACR,SAAS,wCACT,CAAC;CACH,QAAQ,EACN,QAAQ,CACR,MAAM,oCAAoC,CAC1C,QAAQ;EACR,aAAa;EACb,SAAS;EACT,CAAC;CACH,gBAAgB,EAAE,MAAM,CAAC,QAAQ;EAChC,aAAa;EACb,SAAS;EACT,CAAC;CACF,oBAAoB,EAAE,WAAW,0BAA0B,CAAC,QAAQ;EACnE,aAAa;EACb,SAAS,0BAA0B;EACnC,CAAC;CACF,CAAC;AAIF,MAAM,sBAAsB,CAAC,WAAW,QAAQ,WAAW,QAAQ;AAEnE,MAAM,wBAAwB,CAC7B,cAAc,QACd,cAAc,SACd;AAED,MAAa,sBAAsB,EACjC,OAAO;CACP,IAAI,EAAE,MAAM,CAAC,QAAQ;EACpB,aAAa;EACb,SAAS;EACT,CAAC;CACF,MAAM,EAAE,QAAQ,CAAC,QAAQ;EACxB,aAAa;EACb,SAAS;EACT,CAAC;CACF,KAAK,EAAE,QAAQ,CAAC,UAA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U,CAAC,QAAQ;EACtC,aAAa;EACb,SAAS;EACT,CAAC;CACF,gBAAgB,EAAE,MAAM,CAAC,QAAQ;EAChC,aAAa;EACb,SAAS;EACT,CAAC;CACF,QAAQ,EAAE,QAAQ,CAAC,QAAQ;EAC1B,aAAa;EACb,SAAS;EACT,CAAC;CACF,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ;EAC3C,aAAa;EACb,SAAS;EACT,CAAC;CACF,sBAAsB,EAAE,MAAM,0BAA0B;CACxD,mBAAmB,EAAE,MAAM,uBAAuB;CAClD,SAAS,4BAA4B,QAAQ,EAC5C,aACC,mFACD,CAAC;CACF,CAAC;;;;AASF,MAAa,kCAAkC,EAAE,OAAO,EACvD,gBAAgB,EAAE,MAAM,CAAC,QAAQ;CAChC,aAAa;CACb,SAAS;CACT,CAAC,EACF,CAAC;;;;AASF,MAAa,wBAAwB,EAAE,OAAO;CAC7C,IAAI,EAAE,MAAM,CAAC,QAAQ;EACpB,aAAa;EACb,SAAS;EACT,CAAC;CACF,MAAM,EAAE,QAAQ,CAAC,QAAQ;EACxB,aAAa;EACb,SAAS;EACT,CAAC;CACF,MAAM,EAAE,QAAQ,CAAC,QAAQ;EACxB,aAAa;EACb,SAAS;EACT,CAAC;CACF,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ;EAC5C,aAAa;EACb,SAAS;EACT,CAAC;CACF,QAAQ,EAAE,QAAQ,CAAC,QAAQ;EAC1B,aAAa;EACb,SAAS;EACT,CAAC;CACF,gBAAgB,EAAE,MAAM,CAAC,QAAQ;EAChC,aAAa;EACb,SAAS;EACT,CAAC;CACF,CAAC"}
@@ -0,0 +1,79 @@
1
+ //#region src/enums.d.ts
2
+ declare const SenderType: {
3
+ readonly VISITOR: "visitor";
4
+ readonly TEAM_MEMBER: "team_member";
5
+ readonly AI: "ai";
6
+ };
7
+ type SenderType = (typeof SenderType)[keyof typeof SenderType];
8
+ declare const ConversationStatus: {
9
+ readonly OPEN: "open";
10
+ readonly RESOLVED: "resolved";
11
+ readonly SPAM: "spam";
12
+ };
13
+ type ConversationStatus = (typeof ConversationStatus)[keyof typeof ConversationStatus];
14
+ declare const ConversationPriority: {
15
+ readonly LOW: "low";
16
+ readonly NORMAL: "normal";
17
+ readonly HIGH: "high";
18
+ readonly URGENT: "urgent";
19
+ };
20
+ declare const TimelineItemVisibility: {
21
+ readonly PUBLIC: "public";
22
+ readonly PRIVATE: "private";
23
+ };
24
+ declare const ConversationTimelineType: {
25
+ readonly MESSAGE: "message";
26
+ readonly EVENT: "event";
27
+ readonly IDENTIFICATION: "identification";
28
+ };
29
+ type ConversationTimelineType = (typeof ConversationTimelineType)[keyof typeof ConversationTimelineType];
30
+ declare const ConversationEventType: {
31
+ readonly ASSIGNED: "assigned";
32
+ readonly UNASSIGNED: "unassigned";
33
+ readonly PARTICIPANT_REQUESTED: "participant_requested";
34
+ readonly PARTICIPANT_JOINED: "participant_joined";
35
+ readonly PARTICIPANT_LEFT: "participant_left";
36
+ readonly STATUS_CHANGED: "status_changed";
37
+ readonly PRIORITY_CHANGED: "priority_changed";
38
+ readonly TAG_ADDED: "tag_added";
39
+ readonly TAG_REMOVED: "tag_removed";
40
+ readonly RESOLVED: "resolved";
41
+ readonly REOPENED: "reopened";
42
+ readonly VISITOR_BLOCKED: "visitor_blocked";
43
+ readonly VISITOR_UNBLOCKED: "visitor_unblocked";
44
+ readonly VISITOR_IDENTIFIED: "visitor_identified";
45
+ };
46
+ declare const ConversationParticipationStatus: {
47
+ readonly REQUESTED: "requested";
48
+ readonly ACTIVE: "active";
49
+ readonly LEFT: "left";
50
+ readonly DECLINED: "declined";
51
+ };
52
+ declare const ConversationSentiment: {
53
+ readonly POSITIVE: "positive";
54
+ readonly NEGATIVE: "negative";
55
+ readonly NEUTRAL: "neutral";
56
+ };
57
+ type ConversationSentiment = (typeof ConversationSentiment)[keyof typeof ConversationSentiment];
58
+ type ConversationParticipationStatus = (typeof ConversationParticipationStatus)[keyof typeof ConversationParticipationStatus];
59
+ type ConversationEventType = (typeof ConversationEventType)[keyof typeof ConversationEventType];
60
+ type TimelineItemVisibility = (typeof TimelineItemVisibility)[keyof typeof TimelineItemVisibility];
61
+ type ConversationPriority = (typeof ConversationPriority)[keyof typeof ConversationPriority];
62
+ declare const WebsiteInstallationTarget: {
63
+ readonly NEXTJS: "nextjs";
64
+ readonly REACT: "react";
65
+ };
66
+ declare const WebsiteStatus: {
67
+ readonly ACTIVE: "active";
68
+ readonly INACTIVE: "inactive";
69
+ };
70
+ type WebsiteStatus = (typeof WebsiteStatus)[keyof typeof WebsiteStatus];
71
+ type WebsiteInstallationTarget = (typeof WebsiteInstallationTarget)[keyof typeof WebsiteInstallationTarget];
72
+ declare const APIKeyType: {
73
+ readonly PRIVATE: "private";
74
+ readonly PUBLIC: "public";
75
+ };
76
+ type APIKeyType = (typeof APIKeyType)[keyof typeof APIKeyType];
77
+ //#endregion
78
+ export { APIKeyType, ConversationEventType, ConversationParticipationStatus, ConversationPriority, ConversationSentiment, ConversationStatus, ConversationTimelineType, SenderType, TimelineItemVisibility, WebsiteInstallationTarget, WebsiteStatus };
79
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","names":[],"sources":["../src/enums.ts"],"sourcesContent":[],"mappings":";cAAa;EAAA,SAAA,OAIH,EAAA,SAAA;EAEE,SAAA,WAAU,EAAA,aAAW;EAEpB,SAAA,EAAA,EAAA,IAAA;AAMb,CAAA;AAGa,KAXD,UAAA,GAWC,CAAA,OAXoB,UAgBvB,CAAA,CAAA,MAAA,OAhBgD,UAgBhD,CAAA;AAEG,cAhBA,kBAmBH,EAAA;EAEG,SAAA,IAAA,EAAA,MAAA;EAMD,SAAA,QAAA,EAAA,UAAwB;EAGvB,SAAA,IAAA,EAAA,MAAA;AAiBb,CAAA;AAOa,KAhDD,kBAAA,GAoDF,CAAA,OAnDD,kBAmDC,CAAA,CAAA,MAAA,OAnDgC,kBAmDhC,CAAA;AAEE,cAnDC,oBAoDJ,EAAA;EAEG,SAAA,GAAA,EAAA,KAAA;EAGA,SAAA,MAAA,EAAA,QAAqB;EAGrB,SAAA,IAAA,EAAA,MAAA;EAGA,SAAA,MAAA,EAAA,QAAoB;AAGhC,CAAA;AAKa,cAhEA,sBAmEH,EAAA;EAEE,SAAA,MAAA,EAAa,QAAA;EAEb,SAAA,OAAA,EAAA,SAAA;AAGZ,CAAA;AAKY,cA1EC,wBA0E6C,EAAA;;;;;KApE9C,wBAAA,WACH,uCAAuC;cAEnC;;;;;;;;;;;;;;;;cAiBA;;;;;;cAOA;;;;;KAMD,qBAAA,WACH,oCAAoC;KAEjC,+BAAA,WACH,8CAA8C;KAE3C,qBAAA,WACH,oCAAoC;KAEjC,sBAAA,WACH,qCAAqC;KAElC,oBAAA,WACH,mCAAmC;cAE/B;;;;cAKA;;;;KAKD,aAAA,WAAwB,4BAA4B;KAEpD,yBAAA,WACH,wCAAwC;cAEpC;;;;KAKD,UAAA,WAAqB,yBAAyB"}
package/dist/enums.js ADDED
@@ -0,0 +1,69 @@
1
+ //#region src/enums.ts
2
+ const SenderType = {
3
+ VISITOR: "visitor",
4
+ TEAM_MEMBER: "team_member",
5
+ AI: "ai"
6
+ };
7
+ const ConversationStatus = {
8
+ OPEN: "open",
9
+ RESOLVED: "resolved",
10
+ SPAM: "spam"
11
+ };
12
+ const ConversationPriority = {
13
+ LOW: "low",
14
+ NORMAL: "normal",
15
+ HIGH: "high",
16
+ URGENT: "urgent"
17
+ };
18
+ const TimelineItemVisibility = {
19
+ PUBLIC: "public",
20
+ PRIVATE: "private"
21
+ };
22
+ const ConversationTimelineType = {
23
+ MESSAGE: "message",
24
+ EVENT: "event",
25
+ IDENTIFICATION: "identification"
26
+ };
27
+ const ConversationEventType = {
28
+ ASSIGNED: "assigned",
29
+ UNASSIGNED: "unassigned",
30
+ PARTICIPANT_REQUESTED: "participant_requested",
31
+ PARTICIPANT_JOINED: "participant_joined",
32
+ PARTICIPANT_LEFT: "participant_left",
33
+ STATUS_CHANGED: "status_changed",
34
+ PRIORITY_CHANGED: "priority_changed",
35
+ TAG_ADDED: "tag_added",
36
+ TAG_REMOVED: "tag_removed",
37
+ RESOLVED: "resolved",
38
+ REOPENED: "reopened",
39
+ VISITOR_BLOCKED: "visitor_blocked",
40
+ VISITOR_UNBLOCKED: "visitor_unblocked",
41
+ VISITOR_IDENTIFIED: "visitor_identified"
42
+ };
43
+ const ConversationParticipationStatus = {
44
+ REQUESTED: "requested",
45
+ ACTIVE: "active",
46
+ LEFT: "left",
47
+ DECLINED: "declined"
48
+ };
49
+ const ConversationSentiment = {
50
+ POSITIVE: "positive",
51
+ NEGATIVE: "negative",
52
+ NEUTRAL: "neutral"
53
+ };
54
+ const WebsiteInstallationTarget = {
55
+ NEXTJS: "nextjs",
56
+ REACT: "react"
57
+ };
58
+ const WebsiteStatus = {
59
+ ACTIVE: "active",
60
+ INACTIVE: "inactive"
61
+ };
62
+ const APIKeyType = {
63
+ PRIVATE: "private",
64
+ PUBLIC: "public"
65
+ };
66
+
67
+ //#endregion
68
+ export { APIKeyType, ConversationEventType, ConversationParticipationStatus, ConversationPriority, ConversationSentiment, ConversationStatus, ConversationTimelineType, SenderType, TimelineItemVisibility, WebsiteInstallationTarget, WebsiteStatus };
69
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","names":[],"sources":["../src/enums.ts"],"sourcesContent":["export const SenderType = {\n\tVISITOR: \"visitor\",\n\tTEAM_MEMBER: \"team_member\",\n\tAI: \"ai\",\n} as const;\n\nexport type SenderType = (typeof SenderType)[keyof typeof SenderType];\n\nexport const ConversationStatus = {\n\tOPEN: \"open\",\n\tRESOLVED: \"resolved\",\n\tSPAM: \"spam\",\n} as const;\n\nexport type ConversationStatus =\n\t(typeof ConversationStatus)[keyof typeof ConversationStatus];\n\nexport const ConversationPriority = {\n\tLOW: \"low\",\n\tNORMAL: \"normal\",\n\tHIGH: \"high\",\n\tURGENT: \"urgent\",\n} as const;\n\nexport const TimelineItemVisibility = {\n\tPUBLIC: \"public\",\n\tPRIVATE: \"private\",\n} as const;\n\nexport const ConversationTimelineType = {\n\tMESSAGE: \"message\",\n\tEVENT: \"event\",\n\tIDENTIFICATION: \"identification\",\n} as const;\n\nexport type ConversationTimelineType =\n\t(typeof ConversationTimelineType)[keyof typeof ConversationTimelineType];\n\nexport const ConversationEventType = {\n\tASSIGNED: \"assigned\",\n\tUNASSIGNED: \"unassigned\",\n\tPARTICIPANT_REQUESTED: \"participant_requested\",\n\tPARTICIPANT_JOINED: \"participant_joined\",\n\tPARTICIPANT_LEFT: \"participant_left\",\n\tSTATUS_CHANGED: \"status_changed\",\n\tPRIORITY_CHANGED: \"priority_changed\",\n\tTAG_ADDED: \"tag_added\",\n\tTAG_REMOVED: \"tag_removed\",\n\tRESOLVED: \"resolved\",\n\tREOPENED: \"reopened\",\n\tVISITOR_BLOCKED: \"visitor_blocked\",\n\tVISITOR_UNBLOCKED: \"visitor_unblocked\",\n\tVISITOR_IDENTIFIED: \"visitor_identified\",\n} as const;\n\nexport const ConversationParticipationStatus = {\n\tREQUESTED: \"requested\",\n\tACTIVE: \"active\",\n\tLEFT: \"left\",\n\tDECLINED: \"declined\",\n} as const;\n\nexport const ConversationSentiment = {\n\tPOSITIVE: \"positive\",\n\tNEGATIVE: \"negative\",\n\tNEUTRAL: \"neutral\",\n} as const;\n\nexport type ConversationSentiment =\n\t(typeof ConversationSentiment)[keyof typeof ConversationSentiment];\n\nexport type ConversationParticipationStatus =\n\t(typeof ConversationParticipationStatus)[keyof typeof ConversationParticipationStatus];\n\nexport type ConversationEventType =\n\t(typeof ConversationEventType)[keyof typeof ConversationEventType];\n\nexport type TimelineItemVisibility =\n\t(typeof TimelineItemVisibility)[keyof typeof TimelineItemVisibility];\n\nexport type ConversationPriority =\n\t(typeof ConversationPriority)[keyof typeof ConversationPriority];\n\nexport const WebsiteInstallationTarget = {\n\tNEXTJS: \"nextjs\",\n\tREACT: \"react\",\n} as const;\n\nexport const WebsiteStatus = {\n\tACTIVE: \"active\",\n\tINACTIVE: \"inactive\",\n} as const;\n\nexport type WebsiteStatus = (typeof WebsiteStatus)[keyof typeof WebsiteStatus];\n\nexport type WebsiteInstallationTarget =\n\t(typeof WebsiteInstallationTarget)[keyof typeof WebsiteInstallationTarget];\n\nexport const APIKeyType = {\n\tPRIVATE: \"private\",\n\tPUBLIC: \"public\",\n} as const;\n\nexport type APIKeyType = (typeof APIKeyType)[keyof typeof APIKeyType];\n"],"mappings":";AAAA,MAAa,aAAa;CACzB,SAAS;CACT,aAAa;CACb,IAAI;CACJ;AAID,MAAa,qBAAqB;CACjC,MAAM;CACN,UAAU;CACV,MAAM;CACN;AAKD,MAAa,uBAAuB;CACnC,KAAK;CACL,QAAQ;CACR,MAAM;CACN,QAAQ;CACR;AAED,MAAa,yBAAyB;CACrC,QAAQ;CACR,SAAS;CACT;AAED,MAAa,2BAA2B;CACvC,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB;AAKD,MAAa,wBAAwB;CACpC,UAAU;CACV,YAAY;CACZ,uBAAuB;CACvB,oBAAoB;CACpB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;CAClB,WAAW;CACX,aAAa;CACb,UAAU;CACV,UAAU;CACV,iBAAiB;CACjB,mBAAmB;CACnB,oBAAoB;CACpB;AAED,MAAa,kCAAkC;CAC9C,WAAW;CACX,QAAQ;CACR,MAAM;CACN,UAAU;CACV;AAED,MAAa,wBAAwB;CACpC,UAAU;CACV,UAAU;CACV,SAAS;CACT;AAiBD,MAAa,4BAA4B;CACxC,QAAQ;CACR,OAAO;CACP;AAED,MAAa,gBAAgB;CAC5B,QAAQ;CACR,UAAU;CACV;AAOD,MAAa,aAAa;CACzB,SAAS;CACT,QAAQ;CACR"}
@@ -0,0 +1,40 @@
1
+ import { PaginationInput, PaginationResponse, emailSchema, optionalUserIdSchema, paginationResponseSchema, paginationSchema, referralCodeSchema, userIdSchema } from "./api/common.js";
2
+ import { Contact, ContactMetadata, ContactOrganizationResponse, ContactResponse, CreateContactOrganizationRequest, CreateContactRequest, IdentifyContactRequest, IdentifyContactResponse, UpdateContactMetadataRequest, UpdateContactOrganizationRequest, UpdateContactRequest, contactMetadataSchema, contactOrganization, contactOrganizationResponseSchema, contactResponseSchema, createContactOrganizationRequestSchema, createContactRequestSchema, identifyContactRequestSchema, identifyContactResponseSchema, updateContactMetadataRequestSchema, updateContactOrganizationRequestSchema, updateContactRequestSchema } from "./api/contact.js";
3
+ import { CreateConversationRequestBody, CreateConversationResponseBody, GetConversationRequest, GetConversationResponse, GetConversationSeenDataResponse, ListConversationsRequest, ListConversationsResponse, MarkConversationSeenRequestBody, MarkConversationSeenResponseBody, SetConversationTypingRequestBody, SetConversationTypingResponseBody, createConversationRequestSchema, createConversationResponseSchema, getConversationRequestSchema, getConversationResponseSchema, getConversationSeenDataResponseSchema, listConversationsRequestSchema, listConversationsResponseSchema, markConversationSeenRequestSchema, markConversationSeenResponseSchema, setConversationTypingRequestSchema, setConversationTypingResponseSchema } from "./api/conversation.js";
4
+ import { OrganizationResponse, organizationResponseSchema } from "./api/organization.js";
5
+ import { GetConversationTimelineItemsRequest, GetConversationTimelineItemsResponse, SendTimelineItemRequest, SendTimelineItemResponse, TimelineItem, TimelineItemParts, TimelinePartEvent, TimelinePartFile, TimelinePartImage, TimelinePartText, getConversationTimelineItemsRequestSchema, getConversationTimelineItemsResponseSchema, sendTimelineItemRequestSchema, sendTimelineItemResponseSchema, timelineItemPartsSchema, timelineItemSchema } from "./api/timeline-item.js";
6
+ import { GenerateUploadUrlRequest, GenerateUploadUrlResponse, generateUploadUrlRequestSchema, generateUploadUrlResponseSchema, uploadContactIdSchema, uploadConversationIdSchema, uploadFileExtensionSchema, uploadFileNameSchema, uploadOrganizationIdSchema, uploadPathSchema, uploadScopeContactSchema, uploadScopeConversationSchema, uploadScopeSchema, uploadScopeUserSchema, uploadScopeVisitorSchema, uploadUserIdSchema, uploadVisitorIdSchema, uploadWebsiteIdSchema } from "./api/upload.js";
7
+ import { UpdateUserProfileRequest, UserResponse, updateUserProfileRequestSchema, userResponseSchema } from "./api/user.js";
8
+ import { PublicContact, PublicVisitor, PublicVisitorResponse, UpdateVisitorMetadataRequest, UpdateVisitorRequest, Visitor, VisitorMetadata, VisitorResponse, publicContactResponseSchema, publicVisitorResponseSchema, updateVisitorMetadataRequestSchema, updateVisitorRequestSchema, visitorMetadataSchema, visitorProfileSchema, visitorResponseSchema } from "./api/visitor.js";
9
+ import { AvailableAIAgent, AvailableAIAgentSchema, AvailableHumanAgent, CheckWebsiteDomainRequest, CreateWebsiteApiKeyRequest, CreateWebsiteRequest, CreateWebsiteResponse, ListByOrganizationRequest, PublicWebsiteResponse, RevokeWebsiteApiKeyRequest, UpdateWebsiteRequest, WebsiteApiKey, WebsiteDeveloperSettingsResponse, WebsiteListItem, WebsiteSummary, availableHumanAgentSchema, checkWebsiteDomainRequestSchema, createWebsiteApiKeyRequestSchema, createWebsiteRequestSchema, createWebsiteResponseSchema, listByOrganizationRequestSchema, publicWebsiteResponseSchema, revokeWebsiteApiKeyRequestSchema, updateWebsiteRequestSchema, websiteApiKeySchema, websiteDeveloperSettingsResponseSchema, websiteListItemSchema, websiteSummarySchema } from "./api/website.js";
10
+ import "./api/index.js";
11
+ import { APIKeyType, ConversationEventType, ConversationParticipationStatus, ConversationPriority, ConversationSentiment, ConversationStatus, ConversationTimelineType, SenderType, TimelineItemVisibility, WebsiteInstallationTarget, WebsiteStatus } from "./enums.js";
12
+ import { PRESENCE_AWAY_WINDOW_MS, PRESENCE_ONLINE_WINDOW_MS, PRESENCE_PING_INTERVAL_MS } from "./presence.js";
13
+ import { AnyRealtimeEvent, RealtimeEvent, RealtimeEventData, RealtimeEventPayload, RealtimeEventType, baseRealtimeEvent, getEventPayload, isValidEventType, realtimeSchema, validateRealtimeEvent } from "./realtime-events.js";
14
+ import { Conversation, conversationSchema } from "./schemas.js";
15
+ import { ContactDetailResponse, ContactListItem, ContactListVisitorStatus, ContactVisitorSummary, ListContactsResponse, contactDetailResponseSchema, contactListItemSchema, contactListVisitorStatusSchema, contactVisitorSummarySchema, listContactsResponseSchema } from "./trpc/contact.js";
16
+ import { ConversationHeader, ConversationMutationResponse, ConversationRecordResponse, conversationHeaderSchema, conversationMutationResponseSchema, conversationPrioritySchema, conversationRecordSchema, conversationSentimentSchema, conversationStatusSchema, listConversationHeadersResponseSchema } from "./trpc/conversation.js";
17
+ import { BlockVisitorResponse, ListVisitorPresenceResponse, VisitorPresenceEntry, blockVisitorResponseSchema, listVisitorPresenceResponseSchema, visitorPresenceEntrySchema } from "./trpc/visitor.js";
18
+
19
+ //#region src/index.d.ts
20
+ type CossistantConfig = {
21
+ apiUrl: string;
22
+ wsUrl: string;
23
+ apiKey?: string;
24
+ publicKey?: string;
25
+ userId?: string;
26
+ organizationId?: string;
27
+ };
28
+ type CossistantError = {
29
+ code: string;
30
+ message: string;
31
+ details?: Record<string, unknown>;
32
+ };
33
+ type DefaultMessage = {
34
+ content: string;
35
+ senderType: SenderType;
36
+ senderId?: string;
37
+ };
38
+ //#endregion
39
+ export { APIKeyType, AnyRealtimeEvent, AvailableAIAgent, AvailableAIAgentSchema, AvailableHumanAgent, BlockVisitorResponse, CheckWebsiteDomainRequest, Contact, ContactDetailResponse, ContactListItem, ContactListVisitorStatus, ContactMetadata, ContactOrganizationResponse, ContactResponse, ContactVisitorSummary, type Conversation, ConversationEventType, ConversationHeader, ConversationMutationResponse, ConversationParticipationStatus, ConversationPriority, ConversationRecordResponse, ConversationSentiment, ConversationStatus, ConversationTimelineType, CossistantConfig, CossistantError, CreateContactOrganizationRequest, CreateContactRequest, CreateConversationRequestBody, CreateConversationResponseBody, CreateWebsiteApiKeyRequest, CreateWebsiteRequest, CreateWebsiteResponse, DefaultMessage, GenerateUploadUrlRequest, GenerateUploadUrlResponse, GetConversationRequest, GetConversationResponse, GetConversationSeenDataResponse, GetConversationTimelineItemsRequest, GetConversationTimelineItemsResponse, IdentifyContactRequest, IdentifyContactResponse, ListByOrganizationRequest, ListContactsResponse, ListConversationsRequest, ListConversationsResponse, ListVisitorPresenceResponse, MarkConversationSeenRequestBody, MarkConversationSeenResponseBody, OrganizationResponse, PRESENCE_AWAY_WINDOW_MS, PRESENCE_ONLINE_WINDOW_MS, PRESENCE_PING_INTERVAL_MS, PaginationInput, PaginationResponse, PublicContact, PublicVisitor, PublicVisitorResponse, PublicWebsiteResponse, RealtimeEvent, RealtimeEventData, RealtimeEventPayload, RealtimeEventType, RevokeWebsiteApiKeyRequest, SendTimelineItemRequest, SendTimelineItemResponse, SenderType, SetConversationTypingRequestBody, SetConversationTypingResponseBody, TimelineItem, TimelineItemParts, TimelineItemVisibility, TimelinePartEvent, TimelinePartFile, TimelinePartImage, TimelinePartText, UpdateContactMetadataRequest, UpdateContactOrganizationRequest, UpdateContactRequest, UpdateUserProfileRequest, UpdateVisitorMetadataRequest, UpdateVisitorRequest, UpdateWebsiteRequest, UserResponse, Visitor, VisitorMetadata, VisitorPresenceEntry, VisitorResponse, WebsiteApiKey, WebsiteDeveloperSettingsResponse, WebsiteInstallationTarget, WebsiteListItem, WebsiteStatus, WebsiteSummary, availableHumanAgentSchema, baseRealtimeEvent, blockVisitorResponseSchema, checkWebsiteDomainRequestSchema, contactDetailResponseSchema, contactListItemSchema, contactListVisitorStatusSchema, contactMetadataSchema, contactOrganization, contactOrganizationResponseSchema, contactResponseSchema, contactVisitorSummarySchema, conversationHeaderSchema, conversationMutationResponseSchema, conversationPrioritySchema, conversationRecordSchema, conversationSchema, conversationSentimentSchema, conversationStatusSchema, createContactOrganizationRequestSchema, createContactRequestSchema, createConversationRequestSchema, createConversationResponseSchema, createWebsiteApiKeyRequestSchema, createWebsiteRequestSchema, createWebsiteResponseSchema, emailSchema, generateUploadUrlRequestSchema, generateUploadUrlResponseSchema, getConversationRequestSchema, getConversationResponseSchema, getConversationSeenDataResponseSchema, getConversationTimelineItemsRequestSchema, getConversationTimelineItemsResponseSchema, getEventPayload, identifyContactRequestSchema, identifyContactResponseSchema, isValidEventType, listByOrganizationRequestSchema, listContactsResponseSchema, listConversationHeadersResponseSchema, listConversationsRequestSchema, listConversationsResponseSchema, listVisitorPresenceResponseSchema, markConversationSeenRequestSchema, markConversationSeenResponseSchema, optionalUserIdSchema, organizationResponseSchema, paginationResponseSchema, paginationSchema, publicContactResponseSchema, publicVisitorResponseSchema, publicWebsiteResponseSchema, realtimeSchema, referralCodeSchema, revokeWebsiteApiKeyRequestSchema, sendTimelineItemRequestSchema, sendTimelineItemResponseSchema, setConversationTypingRequestSchema, setConversationTypingResponseSchema, timelineItemPartsSchema, timelineItemSchema, updateContactMetadataRequestSchema, updateContactOrganizationRequestSchema, updateContactRequestSchema, updateUserProfileRequestSchema, updateVisitorMetadataRequestSchema, updateVisitorRequestSchema, updateWebsiteRequestSchema, uploadContactIdSchema, uploadConversationIdSchema, uploadFileExtensionSchema, uploadFileNameSchema, uploadOrganizationIdSchema, uploadPathSchema, uploadScopeContactSchema, uploadScopeConversationSchema, uploadScopeSchema, uploadScopeUserSchema, uploadScopeVisitorSchema, uploadUserIdSchema, uploadVisitorIdSchema, uploadWebsiteIdSchema, userIdSchema, userResponseSchema, validateRealtimeEvent, visitorMetadataSchema, visitorPresenceEntrySchema, visitorProfileSchema, visitorResponseSchema, websiteApiKeySchema, websiteDeveloperSettingsResponseSchema, websiteListItemSchema, websiteSummarySchema };
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;KAYY,gBAAA;;;;;;;;KASA,eAAA;EATA,IAAA,EAAA,MAAA;EASA,OAAA,EAAA,MAAA;EAMA,OAAA,CAAA,EAHD,MAGC,CAAc,MAAA,EAAA,OAEb,CAAA;;KAFD,cAAA;;cAEC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { APIKeyType, ConversationEventType, ConversationParticipationStatus, ConversationPriority, ConversationSentiment, ConversationStatus, ConversationTimelineType, SenderType, TimelineItemVisibility, WebsiteInstallationTarget, WebsiteStatus } from "./enums.js";
2
+ import { emailSchema, optionalUserIdSchema, paginationResponseSchema, paginationSchema, referralCodeSchema, userIdSchema } from "./api/common.js";
3
+ import { contactMetadataSchema, contactOrganizationResponseSchema, contactResponseSchema, createContactOrganizationRequestSchema, createContactRequestSchema, identifyContactRequestSchema, identifyContactResponseSchema, updateContactMetadataRequestSchema, updateContactOrganizationRequestSchema, updateContactRequestSchema } from "./api/contact.js";
4
+ import { getConversationTimelineItemsRequestSchema, getConversationTimelineItemsResponseSchema, sendTimelineItemRequestSchema, sendTimelineItemResponseSchema, timelineItemPartsSchema, timelineItemSchema } from "./api/timeline-item.js";
5
+ import { conversationSchema } from "./schemas.js";
6
+ import { createConversationRequestSchema, createConversationResponseSchema, getConversationRequestSchema, getConversationResponseSchema, getConversationSeenDataResponseSchema, listConversationsRequestSchema, listConversationsResponseSchema, markConversationSeenRequestSchema, markConversationSeenResponseSchema, setConversationTypingRequestSchema, setConversationTypingResponseSchema } from "./api/conversation.js";
7
+ import { organizationResponseSchema } from "./api/organization.js";
8
+ import { generateUploadUrlRequestSchema, generateUploadUrlResponseSchema, uploadContactIdSchema, uploadConversationIdSchema, uploadFileExtensionSchema, uploadFileNameSchema, uploadOrganizationIdSchema, uploadPathSchema, uploadScopeContactSchema, uploadScopeConversationSchema, uploadScopeSchema, uploadScopeUserSchema, uploadScopeVisitorSchema, uploadUserIdSchema, uploadVisitorIdSchema, uploadWebsiteIdSchema } from "./api/upload.js";
9
+ import { updateUserProfileRequestSchema, userResponseSchema } from "./api/user.js";
10
+ import { publicContactResponseSchema, publicVisitorResponseSchema, updateVisitorMetadataRequestSchema, updateVisitorRequestSchema, visitorMetadataSchema, visitorProfileSchema, visitorResponseSchema } from "./api/visitor.js";
11
+ import { AvailableAIAgentSchema, availableHumanAgentSchema, checkWebsiteDomainRequestSchema, createWebsiteApiKeyRequestSchema, createWebsiteRequestSchema, createWebsiteResponseSchema, listByOrganizationRequestSchema, publicWebsiteResponseSchema, revokeWebsiteApiKeyRequestSchema, updateWebsiteRequestSchema, websiteApiKeySchema, websiteDeveloperSettingsResponseSchema, websiteListItemSchema, websiteSummarySchema } from "./api/website.js";
12
+ import { PRESENCE_AWAY_WINDOW_MS, PRESENCE_ONLINE_WINDOW_MS, PRESENCE_PING_INTERVAL_MS } from "./presence.js";
13
+ import { conversationHeaderSchema, conversationMutationResponseSchema, conversationPrioritySchema, conversationRecordSchema, conversationSentimentSchema, conversationStatusSchema, listConversationHeadersResponseSchema } from "./trpc/conversation.js";
14
+ import { baseRealtimeEvent, getEventPayload, isValidEventType, realtimeSchema, validateRealtimeEvent } from "./realtime-events.js";
15
+ import { contactDetailResponseSchema, contactListItemSchema, contactListVisitorStatusSchema, contactVisitorSummarySchema, listContactsResponseSchema } from "./trpc/contact.js";
16
+ import { blockVisitorResponseSchema, listVisitorPresenceResponseSchema, visitorPresenceEntrySchema } from "./trpc/visitor.js";
17
+
18
+ export { APIKeyType, AvailableAIAgentSchema, ConversationEventType, ConversationParticipationStatus, ConversationPriority, ConversationSentiment, ConversationStatus, ConversationTimelineType, PRESENCE_AWAY_WINDOW_MS, PRESENCE_ONLINE_WINDOW_MS, PRESENCE_PING_INTERVAL_MS, SenderType, TimelineItemVisibility, WebsiteInstallationTarget, WebsiteStatus, availableHumanAgentSchema, baseRealtimeEvent, blockVisitorResponseSchema, checkWebsiteDomainRequestSchema, contactDetailResponseSchema, contactListItemSchema, contactListVisitorStatusSchema, contactMetadataSchema, contactOrganizationResponseSchema, contactResponseSchema, contactVisitorSummarySchema, conversationHeaderSchema, conversationMutationResponseSchema, conversationPrioritySchema, conversationRecordSchema, conversationSchema, conversationSentimentSchema, conversationStatusSchema, createContactOrganizationRequestSchema, createContactRequestSchema, createConversationRequestSchema, createConversationResponseSchema, createWebsiteApiKeyRequestSchema, createWebsiteRequestSchema, createWebsiteResponseSchema, emailSchema, generateUploadUrlRequestSchema, generateUploadUrlResponseSchema, getConversationRequestSchema, getConversationResponseSchema, getConversationSeenDataResponseSchema, getConversationTimelineItemsRequestSchema, getConversationTimelineItemsResponseSchema, getEventPayload, identifyContactRequestSchema, identifyContactResponseSchema, isValidEventType, listByOrganizationRequestSchema, listContactsResponseSchema, listConversationHeadersResponseSchema, listConversationsRequestSchema, listConversationsResponseSchema, listVisitorPresenceResponseSchema, markConversationSeenRequestSchema, markConversationSeenResponseSchema, optionalUserIdSchema, organizationResponseSchema, paginationResponseSchema, paginationSchema, publicContactResponseSchema, publicVisitorResponseSchema, publicWebsiteResponseSchema, realtimeSchema, referralCodeSchema, revokeWebsiteApiKeyRequestSchema, sendTimelineItemRequestSchema, sendTimelineItemResponseSchema, setConversationTypingRequestSchema, setConversationTypingResponseSchema, timelineItemPartsSchema, timelineItemSchema, updateContactMetadataRequestSchema, updateContactOrganizationRequestSchema, updateContactRequestSchema, updateUserProfileRequestSchema, updateVisitorMetadataRequestSchema, updateVisitorRequestSchema, updateWebsiteRequestSchema, uploadContactIdSchema, uploadConversationIdSchema, uploadFileExtensionSchema, uploadFileNameSchema, uploadOrganizationIdSchema, uploadPathSchema, uploadScopeContactSchema, uploadScopeConversationSchema, uploadScopeSchema, uploadScopeUserSchema, uploadScopeVisitorSchema, uploadUserIdSchema, uploadVisitorIdSchema, uploadWebsiteIdSchema, userIdSchema, userResponseSchema, validateRealtimeEvent, visitorMetadataSchema, visitorPresenceEntrySchema, visitorProfileSchema, visitorResponseSchema, websiteApiKeySchema, websiteDeveloperSettingsResponseSchema, websiteListItemSchema, websiteSummarySchema };
@@ -0,0 +1,7 @@
1
+ //#region src/presence.d.ts
2
+ declare const PRESENCE_ONLINE_WINDOW_MS: number;
3
+ declare const PRESENCE_AWAY_WINDOW_MS: number;
4
+ declare const PRESENCE_PING_INTERVAL_MS: number;
5
+ //#endregion
6
+ export { PRESENCE_AWAY_WINDOW_MS, PRESENCE_ONLINE_WINDOW_MS, PRESENCE_PING_INTERVAL_MS };
7
+ //# sourceMappingURL=presence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence.d.ts","names":[],"sources":["../src/presence.ts"],"sourcesContent":[],"mappings":";cAAa;AAAA,cAEA,uBAF0C,EAAA,MAAA;AAE1C,cAEA,yBAFwC,EAAA,MAAA"}
@@ -0,0 +1,8 @@
1
+ //#region src/presence.ts
2
+ const PRESENCE_ONLINE_WINDOW_MS = 600 * 1e3;
3
+ const PRESENCE_AWAY_WINDOW_MS = 1800 * 1e3;
4
+ const PRESENCE_PING_INTERVAL_MS = Math.max(6e4, PRESENCE_ONLINE_WINDOW_MS - 6e4);
5
+
6
+ //#endregion
7
+ export { PRESENCE_AWAY_WINDOW_MS, PRESENCE_ONLINE_WINDOW_MS, PRESENCE_PING_INTERVAL_MS };
8
+ //# sourceMappingURL=presence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence.js","names":[],"sources":["../src/presence.ts"],"sourcesContent":["export const PRESENCE_ONLINE_WINDOW_MS = 10 * 60 * 1000; // 10 minutes\n\nexport const PRESENCE_AWAY_WINDOW_MS = 30 * 60 * 1000; // 30 minutes\n\nexport const PRESENCE_PING_INTERVAL_MS = Math.max(\n\t60_000,\n\tPRESENCE_ONLINE_WINDOW_MS - 60_000\n);\n"],"mappings":";AAAA,MAAa,4BAA4B,MAAU;AAEnD,MAAa,0BAA0B,OAAU;AAEjD,MAAa,4BAA4B,KAAK,IAC7C,KACA,4BAA4B,IAC5B"}