@cossistant/types 0.0.20 → 0.0.23
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/api/common.d.ts +2 -6
- package/api/common.d.ts.map +1 -1
- package/api/common.js +1 -8
- package/api/common.js.map +1 -1
- package/api/conversation.d.ts +388 -6
- package/api/conversation.d.ts.map +1 -1
- package/api/index.d.ts +4 -3
- package/api/index.js +3 -2
- package/api/notification.d.ts +179 -0
- package/api/notification.d.ts.map +1 -0
- package/api/notification.js +126 -0
- package/api/notification.js.map +1 -0
- package/api/timeline-item.d.ts +148 -15
- package/api/timeline-item.d.ts.map +1 -1
- package/api/timeline-item.js +10 -1
- package/api/timeline-item.js.map +1 -1
- package/api/upload.d.ts.map +1 -1
- package/api/visitor.d.ts +15 -2
- package/api/visitor.d.ts.map +1 -1
- package/api/website.d.ts +33 -8
- package/api/website.d.ts.map +1 -1
- package/api/website.js +5 -0
- package/api/website.js.map +1 -1
- package/checks.d.ts.map +1 -1
- package/core.d.ts.map +1 -1
- package/errors.d.ts.map +1 -1
- package/index.d.ts +4 -3
- package/index.d.ts.map +1 -1
- package/index.js +3 -2
- package/package.json +1 -1
- package/realtime-events.d.ts +325 -6
- package/realtime-events.d.ts.map +1 -1
- package/schemas.d.ts +73 -3
- package/schemas.d.ts.map +1 -1
- package/trpc/contact.d.ts +15 -2
- package/trpc/contact.d.ts.map +1 -1
- package/trpc/conversation.d.ts +371 -20
- package/trpc/conversation.d.ts.map +1 -1
- package/trpc/conversation.js +1 -0
- package/trpc/conversation.js.map +1 -1
- package/trpc/visitor.d.ts +79 -3
- package/trpc/visitor.d.ts.map +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { $loose, $strip } from "../schemas2.js";
|
|
2
|
+
import { output } from "../core.js";
|
|
3
|
+
import { ZodArray, ZodBoolean, ZodEnum, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRecord, ZodString, ZodUnknown } from "../schemas3.js";
|
|
4
|
+
import "../index3.js";
|
|
5
|
+
|
|
6
|
+
//#region src/api/notification.d.ts
|
|
7
|
+
declare const MemberNotificationChannel: {
|
|
8
|
+
readonly EMAIL_MARKETING: "email_marketing";
|
|
9
|
+
readonly EMAIL_NEW_MESSAGE: "email_new_message";
|
|
10
|
+
readonly BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message";
|
|
11
|
+
readonly SOUND_NEW_MESSAGE: "sound_new_message";
|
|
12
|
+
readonly SOUND_TYPING: "sound_typing";
|
|
13
|
+
};
|
|
14
|
+
declare const memberNotificationChannelSchema: ZodEnum<{
|
|
15
|
+
readonly EMAIL_MARKETING: "email_marketing";
|
|
16
|
+
readonly EMAIL_NEW_MESSAGE: "email_new_message";
|
|
17
|
+
readonly BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message";
|
|
18
|
+
readonly SOUND_NEW_MESSAGE: "sound_new_message";
|
|
19
|
+
readonly SOUND_TYPING: "sound_typing";
|
|
20
|
+
}>;
|
|
21
|
+
type MemberNotificationChannel = output<typeof memberNotificationChannelSchema>;
|
|
22
|
+
type MemberNotificationChannelDefinition = {
|
|
23
|
+
channel: MemberNotificationChannel;
|
|
24
|
+
label: string;
|
|
25
|
+
description: string;
|
|
26
|
+
defaultEnabled: boolean;
|
|
27
|
+
defaultDelaySeconds: number;
|
|
28
|
+
defaultPriority: number;
|
|
29
|
+
requiresSetup: boolean;
|
|
30
|
+
supportsDelaySeconds: boolean;
|
|
31
|
+
defaultConfig?: Record<string, unknown> | null;
|
|
32
|
+
};
|
|
33
|
+
declare const MEMBER_NOTIFICATION_CHANNEL_DEFINITIONS: readonly [{
|
|
34
|
+
readonly channel: "email_marketing";
|
|
35
|
+
readonly label: "Marketing emails";
|
|
36
|
+
readonly description: "Product announcements, tips, and updates about Cossistant.";
|
|
37
|
+
readonly defaultEnabled: true;
|
|
38
|
+
readonly defaultDelaySeconds: 0;
|
|
39
|
+
readonly defaultPriority: 30;
|
|
40
|
+
readonly requiresSetup: false;
|
|
41
|
+
readonly supportsDelaySeconds: false;
|
|
42
|
+
readonly defaultConfig: null;
|
|
43
|
+
}, {
|
|
44
|
+
readonly channel: "email_new_message";
|
|
45
|
+
readonly label: "New message emails";
|
|
46
|
+
readonly description: "Send an email if a new customer message hasn't been seen yet.";
|
|
47
|
+
readonly defaultEnabled: true;
|
|
48
|
+
readonly defaultDelaySeconds: 300;
|
|
49
|
+
readonly defaultPriority: 10;
|
|
50
|
+
readonly requiresSetup: false;
|
|
51
|
+
readonly supportsDelaySeconds: true;
|
|
52
|
+
readonly defaultConfig: null;
|
|
53
|
+
}, {
|
|
54
|
+
readonly channel: "browser_push_new_message";
|
|
55
|
+
readonly label: "Browser push notifications";
|
|
56
|
+
readonly description: "Instant alerts in your browser when new customer messages arrive.";
|
|
57
|
+
readonly defaultEnabled: false;
|
|
58
|
+
readonly defaultDelaySeconds: 0;
|
|
59
|
+
readonly defaultPriority: 0;
|
|
60
|
+
readonly requiresSetup: true;
|
|
61
|
+
readonly supportsDelaySeconds: false;
|
|
62
|
+
readonly defaultConfig: null;
|
|
63
|
+
}, {
|
|
64
|
+
readonly channel: "sound_new_message";
|
|
65
|
+
readonly label: "New message sounds";
|
|
66
|
+
readonly description: "Play a sound effect when new customer messages arrive.";
|
|
67
|
+
readonly defaultEnabled: true;
|
|
68
|
+
readonly defaultDelaySeconds: 0;
|
|
69
|
+
readonly defaultPriority: 5;
|
|
70
|
+
readonly requiresSetup: false;
|
|
71
|
+
readonly supportsDelaySeconds: false;
|
|
72
|
+
readonly defaultConfig: null;
|
|
73
|
+
}, {
|
|
74
|
+
readonly channel: "sound_typing";
|
|
75
|
+
readonly label: "Typing indicator sounds";
|
|
76
|
+
readonly description: "Play a sound effect when someone is typing in a conversation.";
|
|
77
|
+
readonly defaultEnabled: true;
|
|
78
|
+
readonly defaultDelaySeconds: 0;
|
|
79
|
+
readonly defaultPriority: 5;
|
|
80
|
+
readonly requiresSetup: false;
|
|
81
|
+
readonly supportsDelaySeconds: false;
|
|
82
|
+
readonly defaultConfig: null;
|
|
83
|
+
}];
|
|
84
|
+
declare const memberNotificationPreferenceSchema: ZodObject<{
|
|
85
|
+
channel: ZodEnum<{
|
|
86
|
+
readonly EMAIL_MARKETING: "email_marketing";
|
|
87
|
+
readonly EMAIL_NEW_MESSAGE: "email_new_message";
|
|
88
|
+
readonly BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message";
|
|
89
|
+
readonly SOUND_NEW_MESSAGE: "sound_new_message";
|
|
90
|
+
readonly SOUND_TYPING: "sound_typing";
|
|
91
|
+
}>;
|
|
92
|
+
label: ZodString;
|
|
93
|
+
description: ZodString;
|
|
94
|
+
enabled: ZodBoolean;
|
|
95
|
+
delaySeconds: ZodNumber;
|
|
96
|
+
priority: ZodNumber;
|
|
97
|
+
requiresSetup: ZodBoolean;
|
|
98
|
+
supportsDelaySeconds: ZodBoolean;
|
|
99
|
+
config: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
|
|
100
|
+
}, $strip>;
|
|
101
|
+
type MemberNotificationPreference = output<typeof memberNotificationPreferenceSchema>;
|
|
102
|
+
declare const memberNotificationSettingsResponseSchema: ZodObject<{
|
|
103
|
+
organizationId: ZodString;
|
|
104
|
+
memberId: ZodString;
|
|
105
|
+
settings: ZodArray<ZodObject<{
|
|
106
|
+
channel: ZodEnum<{
|
|
107
|
+
readonly EMAIL_MARKETING: "email_marketing";
|
|
108
|
+
readonly EMAIL_NEW_MESSAGE: "email_new_message";
|
|
109
|
+
readonly BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message";
|
|
110
|
+
readonly SOUND_NEW_MESSAGE: "sound_new_message";
|
|
111
|
+
readonly SOUND_TYPING: "sound_typing";
|
|
112
|
+
}>;
|
|
113
|
+
label: ZodString;
|
|
114
|
+
description: ZodString;
|
|
115
|
+
enabled: ZodBoolean;
|
|
116
|
+
delaySeconds: ZodNumber;
|
|
117
|
+
priority: ZodNumber;
|
|
118
|
+
requiresSetup: ZodBoolean;
|
|
119
|
+
supportsDelaySeconds: ZodBoolean;
|
|
120
|
+
config: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
|
|
121
|
+
}, $strip>>;
|
|
122
|
+
}, $strip>;
|
|
123
|
+
type MemberNotificationSettingsResponse = output<typeof memberNotificationSettingsResponseSchema>;
|
|
124
|
+
declare const updateMemberNotificationSettingsRequestSchema: ZodObject<{
|
|
125
|
+
websiteSlug: ZodString;
|
|
126
|
+
settings: ZodArray<ZodObject<{
|
|
127
|
+
channel: ZodEnum<{
|
|
128
|
+
readonly EMAIL_MARKETING: "email_marketing";
|
|
129
|
+
readonly EMAIL_NEW_MESSAGE: "email_new_message";
|
|
130
|
+
readonly BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message";
|
|
131
|
+
readonly SOUND_NEW_MESSAGE: "sound_new_message";
|
|
132
|
+
readonly SOUND_TYPING: "sound_typing";
|
|
133
|
+
}>;
|
|
134
|
+
enabled: ZodBoolean;
|
|
135
|
+
delaySeconds: ZodNumber;
|
|
136
|
+
priority: ZodNumber;
|
|
137
|
+
config: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
|
|
138
|
+
}, $strip>>;
|
|
139
|
+
}, $strip>;
|
|
140
|
+
type UpdateMemberNotificationSettingsRequest = output<typeof updateMemberNotificationSettingsRequestSchema>;
|
|
141
|
+
declare const updateMemberNotificationSettingsResponseSchema: ZodObject<{
|
|
142
|
+
organizationId: ZodString;
|
|
143
|
+
memberId: ZodString;
|
|
144
|
+
settings: ZodArray<ZodObject<{
|
|
145
|
+
channel: ZodEnum<{
|
|
146
|
+
readonly EMAIL_MARKETING: "email_marketing";
|
|
147
|
+
readonly EMAIL_NEW_MESSAGE: "email_new_message";
|
|
148
|
+
readonly BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message";
|
|
149
|
+
readonly SOUND_NEW_MESSAGE: "sound_new_message";
|
|
150
|
+
readonly SOUND_TYPING: "sound_typing";
|
|
151
|
+
}>;
|
|
152
|
+
label: ZodString;
|
|
153
|
+
description: ZodString;
|
|
154
|
+
enabled: ZodBoolean;
|
|
155
|
+
delaySeconds: ZodNumber;
|
|
156
|
+
priority: ZodNumber;
|
|
157
|
+
requiresSetup: ZodBoolean;
|
|
158
|
+
supportsDelaySeconds: ZodBoolean;
|
|
159
|
+
config: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
|
|
160
|
+
}, $strip>>;
|
|
161
|
+
}, $strip>;
|
|
162
|
+
type UpdateMemberNotificationSettingsResponse = output<typeof updateMemberNotificationSettingsResponseSchema>;
|
|
163
|
+
declare const contactNotificationChannelConfigSchema: ZodObject<{
|
|
164
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
165
|
+
config: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
|
|
166
|
+
}, $loose>;
|
|
167
|
+
declare const contactNotificationSettingsSchema: ZodObject<{
|
|
168
|
+
emailNotifications: ZodOptional<ZodBoolean>;
|
|
169
|
+
channels: ZodOptional<ZodRecord<ZodString, ZodObject<{
|
|
170
|
+
enabled: ZodOptional<ZodBoolean>;
|
|
171
|
+
config: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
|
|
172
|
+
}, $loose>>>;
|
|
173
|
+
}, $loose>;
|
|
174
|
+
type ContactNotificationSettings = output<typeof contactNotificationSettingsSchema>;
|
|
175
|
+
declare const MEMBER_NOTIFICATION_DEFINITION_MAP: Map<"email_marketing" | "email_new_message" | "browser_push_new_message" | "sound_new_message" | "sound_typing", MemberNotificationChannelDefinition>;
|
|
176
|
+
declare function getDefaultMemberNotificationPreference(channel: MemberNotificationChannel): MemberNotificationPreference;
|
|
177
|
+
//#endregion
|
|
178
|
+
export { ContactNotificationSettings, MEMBER_NOTIFICATION_CHANNEL_DEFINITIONS, MEMBER_NOTIFICATION_DEFINITION_MAP, MemberNotificationChannel, MemberNotificationChannelDefinition, MemberNotificationPreference, MemberNotificationSettingsResponse, UpdateMemberNotificationSettingsRequest, UpdateMemberNotificationSettingsResponse, contactNotificationChannelConfigSchema, contactNotificationSettingsSchema, getDefaultMemberNotificationPreference, memberNotificationChannelSchema, memberNotificationPreferenceSchema, memberNotificationSettingsResponseSchema, updateMemberNotificationSettingsRequestSchema, updateMemberNotificationSettingsResponseSchema };
|
|
179
|
+
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","names":[],"sources":["../../src/api/notification.ts"],"sourcesContent":[],"mappings":";;;;;;cAEa;;;;;EAAA,SAAA,YAAA,EAAA,cAMH;AAEV,CAAA;AAIY,cAJC,+BAKL,EALoC,OAKpC,CAAA;EAGI,SAAA,eAAA,EAAA,iBAAmC;EAYlC,SAAA,iBAAA,EAAA,mBA2DsD;EAEtD,SAAA,wBAAA,EAAA,0BAUX;;;;KAvFU,yBAAA,GAA4B,cAChC;KAGI,mCAAA;WACF;;;;;;;;EAwEqC,aAAA,CAAA,EAhE9B,MAgE8B,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,IAAA;CAAA;AAYnC,cAzEC,uCA0EL,EAAA,SAAA,CAAA;EAGK,SAAA,OAAA,EAAA,iBAAA;;;;;;;;;;;;;;;;;;;CAAwC,EAAA;EAAA,SAAA,OAAA,EAAA,0BAAA;EAMzC,SAAA,KAAA,EAAA,4BAAkC;EAIjC,SAAA,WAAA,EAAA,mEAaX;;;;;;;;;;;;;;;EAbwD,SAAA,oBAAA,EAAA,KAAA;EAAA,SAAA,aAAA,EAAA,IAAA;AAe1D,CAAA,EAAA;EAIa,SAAA,OAAA,EAAA,cAAA;;;;;;;;;;cA7CA,oCAAkC;;;;;;;;;EA6CY,WAAA,WAAA;EAAA,OAAA,YAAA;EAG/C,YAAA,WAAA;EAIC,QAAA,WAAA;;;;;KAxCD,4BAAA,GAA+B,cACnC;cAGK,0CAAwC;;EAoCF,QAAA,WAAA;EAAA,QAAA,UAAA,UAAA,CAAA;IAOtC,OAAA,SAAA,CAAA;;;;;;;;;;;;;;;EAAiC,CAAA,QAAA,CAAA,CAAA;CAAA,QAAA,CAAA;AASlC,KA9CA,kCAAA,GAAqC,MA+CzC,CAAA,OA9CA,wCA6CyC,CAAA;AAIpC,cA9CA,6CA8CkC,EA9CW,SA8CX,CAAA;EAM/B,WAAA,WAAA;;;;;;;;;;;;;;;KArCJ,uCAAA,GAA0C,cAC9C;cAGK,gDAA8C;;;;;;;;;;;;;;;;;;;;;KAG/C,wCAAA,GAA2C,cAC/C;cAGK,wCAAsC;;;;cAOtC,mCAAiC;;;;;;;KASlC,2BAAA,GAA8B,cAClC;cAGK,oCAAkC,iHAAA;iBAM/B,sCAAA,UACN,4BACP"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
//#region src/api/notification.ts
|
|
4
|
+
const MemberNotificationChannel = {
|
|
5
|
+
EMAIL_MARKETING: "email_marketing",
|
|
6
|
+
EMAIL_NEW_MESSAGE: "email_new_message",
|
|
7
|
+
BROWSER_PUSH_NEW_MESSAGE: "browser_push_new_message",
|
|
8
|
+
SOUND_NEW_MESSAGE: "sound_new_message",
|
|
9
|
+
SOUND_TYPING: "sound_typing"
|
|
10
|
+
};
|
|
11
|
+
const memberNotificationChannelSchema = z.nativeEnum(MemberNotificationChannel);
|
|
12
|
+
const MEMBER_NOTIFICATION_CHANNEL_DEFINITIONS = [
|
|
13
|
+
{
|
|
14
|
+
channel: MemberNotificationChannel.EMAIL_MARKETING,
|
|
15
|
+
label: "Marketing emails",
|
|
16
|
+
description: "Product announcements, tips, and updates about Cossistant.",
|
|
17
|
+
defaultEnabled: true,
|
|
18
|
+
defaultDelaySeconds: 0,
|
|
19
|
+
defaultPriority: 30,
|
|
20
|
+
requiresSetup: false,
|
|
21
|
+
supportsDelaySeconds: false,
|
|
22
|
+
defaultConfig: null
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
channel: MemberNotificationChannel.EMAIL_NEW_MESSAGE,
|
|
26
|
+
label: "New message emails",
|
|
27
|
+
description: "Send an email if a new customer message hasn't been seen yet.",
|
|
28
|
+
defaultEnabled: true,
|
|
29
|
+
defaultDelaySeconds: 300,
|
|
30
|
+
defaultPriority: 10,
|
|
31
|
+
requiresSetup: false,
|
|
32
|
+
supportsDelaySeconds: true,
|
|
33
|
+
defaultConfig: null
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
channel: MemberNotificationChannel.BROWSER_PUSH_NEW_MESSAGE,
|
|
37
|
+
label: "Browser push notifications",
|
|
38
|
+
description: "Instant alerts in your browser when new customer messages arrive.",
|
|
39
|
+
defaultEnabled: false,
|
|
40
|
+
defaultDelaySeconds: 0,
|
|
41
|
+
defaultPriority: 0,
|
|
42
|
+
requiresSetup: true,
|
|
43
|
+
supportsDelaySeconds: false,
|
|
44
|
+
defaultConfig: null
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
channel: MemberNotificationChannel.SOUND_NEW_MESSAGE,
|
|
48
|
+
label: "New message sounds",
|
|
49
|
+
description: "Play a sound effect when new customer messages arrive.",
|
|
50
|
+
defaultEnabled: true,
|
|
51
|
+
defaultDelaySeconds: 0,
|
|
52
|
+
defaultPriority: 5,
|
|
53
|
+
requiresSetup: false,
|
|
54
|
+
supportsDelaySeconds: false,
|
|
55
|
+
defaultConfig: null
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
channel: MemberNotificationChannel.SOUND_TYPING,
|
|
59
|
+
label: "Typing indicator sounds",
|
|
60
|
+
description: "Play a sound effect when someone is typing in a conversation.",
|
|
61
|
+
defaultEnabled: true,
|
|
62
|
+
defaultDelaySeconds: 0,
|
|
63
|
+
defaultPriority: 5,
|
|
64
|
+
requiresSetup: false,
|
|
65
|
+
supportsDelaySeconds: false,
|
|
66
|
+
defaultConfig: null
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
const memberNotificationPreferenceSchema = z.object({
|
|
70
|
+
channel: memberNotificationChannelSchema,
|
|
71
|
+
label: z.string(),
|
|
72
|
+
description: z.string(),
|
|
73
|
+
enabled: z.boolean(),
|
|
74
|
+
delaySeconds: z.number().int().min(0),
|
|
75
|
+
priority: z.number().int(),
|
|
76
|
+
requiresSetup: z.boolean(),
|
|
77
|
+
supportsDelaySeconds: z.boolean(),
|
|
78
|
+
config: z.record(z.string(), z.unknown()).nullable()
|
|
79
|
+
});
|
|
80
|
+
const memberNotificationSettingsResponseSchema = z.object({
|
|
81
|
+
organizationId: z.string().ulid(),
|
|
82
|
+
memberId: z.string().ulid(),
|
|
83
|
+
settings: z.array(memberNotificationPreferenceSchema)
|
|
84
|
+
});
|
|
85
|
+
const updateMemberNotificationSettingsRequestSchema = z.object({
|
|
86
|
+
websiteSlug: z.string(),
|
|
87
|
+
settings: z.array(z.object({
|
|
88
|
+
channel: memberNotificationChannelSchema,
|
|
89
|
+
enabled: z.boolean(),
|
|
90
|
+
delaySeconds: z.number().int().min(0),
|
|
91
|
+
priority: z.number().int(),
|
|
92
|
+
config: z.record(z.string(), z.unknown()).nullable().optional()
|
|
93
|
+
})).min(1)
|
|
94
|
+
});
|
|
95
|
+
const updateMemberNotificationSettingsResponseSchema = memberNotificationSettingsResponseSchema;
|
|
96
|
+
const contactNotificationChannelConfigSchema = z.object({
|
|
97
|
+
enabled: z.boolean().optional(),
|
|
98
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
99
|
+
}).passthrough();
|
|
100
|
+
const contactNotificationSettingsSchema = z.object({
|
|
101
|
+
emailNotifications: z.boolean().optional(),
|
|
102
|
+
channels: z.record(z.string(), contactNotificationChannelConfigSchema).optional()
|
|
103
|
+
}).passthrough();
|
|
104
|
+
const MEMBER_NOTIFICATION_DEFINITION_MAP = MEMBER_NOTIFICATION_CHANNEL_DEFINITIONS.reduce((acc, definition) => {
|
|
105
|
+
acc.set(definition.channel, definition);
|
|
106
|
+
return acc;
|
|
107
|
+
}, /* @__PURE__ */ new Map());
|
|
108
|
+
function getDefaultMemberNotificationPreference(channel) {
|
|
109
|
+
const definition = MEMBER_NOTIFICATION_DEFINITION_MAP.get(channel);
|
|
110
|
+
if (!definition) throw new Error(`Unknown notification channel: ${channel}`);
|
|
111
|
+
return {
|
|
112
|
+
channel: definition.channel,
|
|
113
|
+
label: definition.label,
|
|
114
|
+
description: definition.description,
|
|
115
|
+
enabled: definition.defaultEnabled,
|
|
116
|
+
delaySeconds: definition.defaultDelaySeconds,
|
|
117
|
+
priority: definition.defaultPriority,
|
|
118
|
+
requiresSetup: definition.requiresSetup,
|
|
119
|
+
supportsDelaySeconds: definition.supportsDelaySeconds,
|
|
120
|
+
config: definition.defaultConfig ?? null
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
export { MEMBER_NOTIFICATION_CHANNEL_DEFINITIONS, MEMBER_NOTIFICATION_DEFINITION_MAP, MemberNotificationChannel, contactNotificationChannelConfigSchema, contactNotificationSettingsSchema, getDefaultMemberNotificationPreference, memberNotificationChannelSchema, memberNotificationPreferenceSchema, memberNotificationSettingsResponseSchema, updateMemberNotificationSettingsRequestSchema, updateMemberNotificationSettingsResponseSchema };
|
|
126
|
+
//# sourceMappingURL=notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.js","names":[],"sources":["../../src/api/notification.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\n\nexport const MemberNotificationChannel = {\n\tEMAIL_MARKETING: \"email_marketing\",\n\tEMAIL_NEW_MESSAGE: \"email_new_message\",\n\tBROWSER_PUSH_NEW_MESSAGE: \"browser_push_new_message\",\n\tSOUND_NEW_MESSAGE: \"sound_new_message\",\n\tSOUND_TYPING: \"sound_typing\",\n} as const;\n\nexport const memberNotificationChannelSchema = z.nativeEnum(\n\tMemberNotificationChannel\n);\n\nexport type MemberNotificationChannel = z.infer<\n\ttypeof memberNotificationChannelSchema\n>;\n\nexport type MemberNotificationChannelDefinition = {\n\tchannel: MemberNotificationChannel;\n\tlabel: string;\n\tdescription: string;\n\tdefaultEnabled: boolean;\n\tdefaultDelaySeconds: number;\n\tdefaultPriority: number;\n\trequiresSetup: boolean;\n\tsupportsDelaySeconds: boolean;\n\tdefaultConfig?: Record<string, unknown> | null;\n};\n\nexport const MEMBER_NOTIFICATION_CHANNEL_DEFINITIONS = [\n\t{\n\t\tchannel: MemberNotificationChannel.EMAIL_MARKETING,\n\t\tlabel: \"Marketing emails\",\n\t\tdescription: \"Product announcements, tips, and updates about Cossistant.\",\n\t\tdefaultEnabled: true,\n\t\tdefaultDelaySeconds: 0,\n\t\tdefaultPriority: 30,\n\t\trequiresSetup: false,\n\t\tsupportsDelaySeconds: false,\n\t\tdefaultConfig: null,\n\t},\n\t{\n\t\tchannel: MemberNotificationChannel.EMAIL_NEW_MESSAGE,\n\t\tlabel: \"New message emails\",\n\t\tdescription:\n\t\t\t\"Send an email if a new customer message hasn't been seen yet.\",\n\t\tdefaultEnabled: true,\n\t\tdefaultDelaySeconds: 300,\n\t\tdefaultPriority: 10,\n\t\trequiresSetup: false,\n\t\tsupportsDelaySeconds: true,\n\t\tdefaultConfig: null,\n\t},\n\t{\n\t\tchannel: MemberNotificationChannel.BROWSER_PUSH_NEW_MESSAGE,\n\t\tlabel: \"Browser push notifications\",\n\t\tdescription:\n\t\t\t\"Instant alerts in your browser when new customer messages arrive.\",\n\t\tdefaultEnabled: false,\n\t\tdefaultDelaySeconds: 0,\n\t\tdefaultPriority: 0,\n\t\trequiresSetup: true,\n\t\tsupportsDelaySeconds: false,\n\t\tdefaultConfig: null,\n\t},\n\t{\n\t\tchannel: MemberNotificationChannel.SOUND_NEW_MESSAGE,\n\t\tlabel: \"New message sounds\",\n\t\tdescription: \"Play a sound effect when new customer messages arrive.\",\n\t\tdefaultEnabled: true,\n\t\tdefaultDelaySeconds: 0,\n\t\tdefaultPriority: 5,\n\t\trequiresSetup: false,\n\t\tsupportsDelaySeconds: false,\n\t\tdefaultConfig: null,\n\t},\n\t{\n\t\tchannel: MemberNotificationChannel.SOUND_TYPING,\n\t\tlabel: \"Typing indicator sounds\",\n\t\tdescription:\n\t\t\t\"Play a sound effect when someone is typing in a conversation.\",\n\t\tdefaultEnabled: true,\n\t\tdefaultDelaySeconds: 0,\n\t\tdefaultPriority: 5,\n\t\trequiresSetup: false,\n\t\tsupportsDelaySeconds: false,\n\t\tdefaultConfig: null,\n\t},\n] as const satisfies readonly MemberNotificationChannelDefinition[];\n\nexport const memberNotificationPreferenceSchema = z.object({\n\tchannel: memberNotificationChannelSchema,\n\tlabel: z.string(),\n\tdescription: z.string(),\n\tenabled: z.boolean(),\n\tdelaySeconds: z.number().int().min(0),\n\tpriority: z.number().int(),\n\trequiresSetup: z.boolean(),\n\tsupportsDelaySeconds: z.boolean(),\n\tconfig: z.record(z.string(), z.unknown()).nullable(),\n});\n\nexport type MemberNotificationPreference = z.infer<\n\ttypeof memberNotificationPreferenceSchema\n>;\n\nexport const memberNotificationSettingsResponseSchema = z.object({\n\torganizationId: z.string().ulid(),\n\tmemberId: z.string().ulid(),\n\tsettings: z.array(memberNotificationPreferenceSchema),\n});\n\nexport type MemberNotificationSettingsResponse = z.infer<\n\ttypeof memberNotificationSettingsResponseSchema\n>;\n\nexport const updateMemberNotificationSettingsRequestSchema = z.object({\n\twebsiteSlug: z.string(),\n\tsettings: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tchannel: memberNotificationChannelSchema,\n\t\t\t\tenabled: z.boolean(),\n\t\t\t\tdelaySeconds: z.number().int().min(0),\n\t\t\t\tpriority: z.number().int(),\n\t\t\t\tconfig: z.record(z.string(), z.unknown()).nullable().optional(),\n\t\t\t})\n\t\t)\n\t\t.min(1),\n});\n\nexport type UpdateMemberNotificationSettingsRequest = z.infer<\n\ttypeof updateMemberNotificationSettingsRequestSchema\n>;\n\nexport const updateMemberNotificationSettingsResponseSchema =\n\tmemberNotificationSettingsResponseSchema;\n\nexport type UpdateMemberNotificationSettingsResponse = z.infer<\n\ttypeof updateMemberNotificationSettingsResponseSchema\n>;\n\nexport const contactNotificationChannelConfigSchema = z\n\t.object({\n\t\tenabled: z.boolean().optional(),\n\t\tconfig: z.record(z.string(), z.unknown()).optional(),\n\t})\n\t.passthrough();\n\nexport const contactNotificationSettingsSchema = z\n\t.object({\n\t\temailNotifications: z.boolean().optional(),\n\t\tchannels: z\n\t\t\t.record(z.string(), contactNotificationChannelConfigSchema)\n\t\t\t.optional(),\n\t})\n\t.passthrough();\n\nexport type ContactNotificationSettings = z.infer<\n\ttypeof contactNotificationSettingsSchema\n>;\n\nexport const MEMBER_NOTIFICATION_DEFINITION_MAP =\n\tMEMBER_NOTIFICATION_CHANNEL_DEFINITIONS.reduce((acc, definition) => {\n\t\tacc.set(definition.channel, definition);\n\t\treturn acc;\n\t}, new Map<MemberNotificationChannel, MemberNotificationChannelDefinition>());\n\nexport function getDefaultMemberNotificationPreference(\n\tchannel: MemberNotificationChannel\n): MemberNotificationPreference {\n\tconst definition = MEMBER_NOTIFICATION_DEFINITION_MAP.get(channel);\n\n\tif (!definition) {\n\t\tthrow new Error(`Unknown notification channel: ${channel}`);\n\t}\n\n\treturn {\n\t\tchannel: definition.channel,\n\t\tlabel: definition.label,\n\t\tdescription: definition.description,\n\t\tenabled: definition.defaultEnabled,\n\t\tdelaySeconds: definition.defaultDelaySeconds,\n\t\tpriority: definition.defaultPriority,\n\t\trequiresSetup: definition.requiresSetup,\n\t\tsupportsDelaySeconds: definition.supportsDelaySeconds,\n\t\tconfig: definition.defaultConfig ?? null,\n\t};\n}\n"],"mappings":"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"}
|
package/api/timeline-item.d.ts
CHANGED
|
@@ -28,7 +28,20 @@ declare const timelineFileSchema: ZodObject<{
|
|
|
28
28
|
declare const timelinePartEventSchema: ZodObject<{
|
|
29
29
|
type: ZodLiteral<"event">;
|
|
30
30
|
eventType: ZodEnum<{
|
|
31
|
-
|
|
31
|
+
resolved: "resolved";
|
|
32
|
+
assigned: "assigned";
|
|
33
|
+
unassigned: "unassigned";
|
|
34
|
+
participant_requested: "participant_requested";
|
|
35
|
+
participant_joined: "participant_joined";
|
|
36
|
+
participant_left: "participant_left";
|
|
37
|
+
status_changed: "status_changed";
|
|
38
|
+
priority_changed: "priority_changed";
|
|
39
|
+
tag_added: "tag_added";
|
|
40
|
+
tag_removed: "tag_removed";
|
|
41
|
+
reopened: "reopened";
|
|
42
|
+
visitor_blocked: "visitor_blocked";
|
|
43
|
+
visitor_unblocked: "visitor_unblocked";
|
|
44
|
+
visitor_identified: "visitor_identified";
|
|
32
45
|
}>;
|
|
33
46
|
actorUserId: ZodNullable<ZodString>;
|
|
34
47
|
actorAiAgentId: ZodNullable<ZodString>;
|
|
@@ -36,13 +49,34 @@ declare const timelinePartEventSchema: ZodObject<{
|
|
|
36
49
|
targetAiAgentId: ZodNullable<ZodString>;
|
|
37
50
|
message: ZodOptional<ZodNullable<ZodString>>;
|
|
38
51
|
}, $strip>;
|
|
52
|
+
declare const timelinePartMetadataSchema: ZodObject<{
|
|
53
|
+
type: ZodLiteral<"metadata">;
|
|
54
|
+
source: ZodEnum<{
|
|
55
|
+
email: "email";
|
|
56
|
+
widget: "widget";
|
|
57
|
+
api: "api";
|
|
58
|
+
}>;
|
|
59
|
+
}, $strip>;
|
|
39
60
|
declare const timelineItemPartsSchema: ZodArray<ZodUnion<readonly [ZodObject<{
|
|
40
61
|
type: ZodLiteral<"text">;
|
|
41
62
|
text: ZodString;
|
|
42
63
|
}, $strip>, ZodObject<{
|
|
43
64
|
type: ZodLiteral<"event">;
|
|
44
65
|
eventType: ZodEnum<{
|
|
45
|
-
|
|
66
|
+
resolved: "resolved";
|
|
67
|
+
assigned: "assigned";
|
|
68
|
+
unassigned: "unassigned";
|
|
69
|
+
participant_requested: "participant_requested";
|
|
70
|
+
participant_joined: "participant_joined";
|
|
71
|
+
participant_left: "participant_left";
|
|
72
|
+
status_changed: "status_changed";
|
|
73
|
+
priority_changed: "priority_changed";
|
|
74
|
+
tag_added: "tag_added";
|
|
75
|
+
tag_removed: "tag_removed";
|
|
76
|
+
reopened: "reopened";
|
|
77
|
+
visitor_blocked: "visitor_blocked";
|
|
78
|
+
visitor_unblocked: "visitor_unblocked";
|
|
79
|
+
visitor_identified: "visitor_identified";
|
|
46
80
|
}>;
|
|
47
81
|
actorUserId: ZodNullable<ZodString>;
|
|
48
82
|
actorAiAgentId: ZodNullable<ZodString>;
|
|
@@ -63,16 +97,26 @@ declare const timelineItemPartsSchema: ZodArray<ZodUnion<readonly [ZodObject<{
|
|
|
63
97
|
mediaType: ZodString;
|
|
64
98
|
fileName: ZodOptional<ZodString>;
|
|
65
99
|
size: ZodOptional<ZodNumber>;
|
|
100
|
+
}, $strip>, ZodObject<{
|
|
101
|
+
type: ZodLiteral<"metadata">;
|
|
102
|
+
source: ZodEnum<{
|
|
103
|
+
email: "email";
|
|
104
|
+
widget: "widget";
|
|
105
|
+
api: "api";
|
|
106
|
+
}>;
|
|
66
107
|
}, $strip>]>>;
|
|
67
108
|
declare const timelineItemSchema: ZodObject<{
|
|
68
109
|
id: ZodOptional<ZodString>;
|
|
69
110
|
conversationId: ZodString;
|
|
70
111
|
organizationId: ZodString;
|
|
71
112
|
visibility: ZodEnum<{
|
|
72
|
-
|
|
113
|
+
private: "private";
|
|
114
|
+
public: "public";
|
|
73
115
|
}>;
|
|
74
116
|
type: ZodEnum<{
|
|
75
|
-
|
|
117
|
+
message: "message";
|
|
118
|
+
event: "event";
|
|
119
|
+
identification: "identification";
|
|
76
120
|
}>;
|
|
77
121
|
text: ZodNullable<ZodString>;
|
|
78
122
|
tool: ZodOptional<ZodNullable<ZodString>>;
|
|
@@ -82,7 +126,20 @@ declare const timelineItemSchema: ZodObject<{
|
|
|
82
126
|
}, $strip>, ZodObject<{
|
|
83
127
|
type: ZodLiteral<"event">;
|
|
84
128
|
eventType: ZodEnum<{
|
|
85
|
-
|
|
129
|
+
resolved: "resolved";
|
|
130
|
+
assigned: "assigned";
|
|
131
|
+
unassigned: "unassigned";
|
|
132
|
+
participant_requested: "participant_requested";
|
|
133
|
+
participant_joined: "participant_joined";
|
|
134
|
+
participant_left: "participant_left";
|
|
135
|
+
status_changed: "status_changed";
|
|
136
|
+
priority_changed: "priority_changed";
|
|
137
|
+
tag_added: "tag_added";
|
|
138
|
+
tag_removed: "tag_removed";
|
|
139
|
+
reopened: "reopened";
|
|
140
|
+
visitor_blocked: "visitor_blocked";
|
|
141
|
+
visitor_unblocked: "visitor_unblocked";
|
|
142
|
+
visitor_identified: "visitor_identified";
|
|
86
143
|
}>;
|
|
87
144
|
actorUserId: ZodNullable<ZodString>;
|
|
88
145
|
actorAiAgentId: ZodNullable<ZodString>;
|
|
@@ -103,6 +160,13 @@ declare const timelineItemSchema: ZodObject<{
|
|
|
103
160
|
mediaType: ZodString;
|
|
104
161
|
fileName: ZodOptional<ZodString>;
|
|
105
162
|
size: ZodOptional<ZodNumber>;
|
|
163
|
+
}, $strip>, ZodObject<{
|
|
164
|
+
type: ZodLiteral<"metadata">;
|
|
165
|
+
source: ZodEnum<{
|
|
166
|
+
email: "email";
|
|
167
|
+
widget: "widget";
|
|
168
|
+
api: "api";
|
|
169
|
+
}>;
|
|
106
170
|
}, $strip>]>>;
|
|
107
171
|
userId: ZodNullable<ZodString>;
|
|
108
172
|
aiAgentId: ZodNullable<ZodString>;
|
|
@@ -117,6 +181,7 @@ type TimelinePartText = output<typeof timelinePartTextSchema>;
|
|
|
117
181
|
type TimelinePartImage = output<typeof timelinePartImageSchema>;
|
|
118
182
|
type TimelinePartFile = output<typeof timelineFileSchema>;
|
|
119
183
|
type TimelinePartEvent = output<typeof timelinePartEventSchema>;
|
|
184
|
+
type TimelinePartMetadata = output<typeof timelinePartMetadataSchema>;
|
|
120
185
|
declare const getConversationTimelineItemsRequestSchema: ZodObject<{
|
|
121
186
|
limit: ZodDefault<ZodCoercedNumber<unknown>>;
|
|
122
187
|
cursor: ZodOptional<ZodNullable<ZodString>>;
|
|
@@ -128,10 +193,13 @@ declare const getConversationTimelineItemsResponseSchema: ZodObject<{
|
|
|
128
193
|
conversationId: ZodString;
|
|
129
194
|
organizationId: ZodString;
|
|
130
195
|
visibility: ZodEnum<{
|
|
131
|
-
|
|
196
|
+
private: "private";
|
|
197
|
+
public: "public";
|
|
132
198
|
}>;
|
|
133
199
|
type: ZodEnum<{
|
|
134
|
-
|
|
200
|
+
message: "message";
|
|
201
|
+
event: "event";
|
|
202
|
+
identification: "identification";
|
|
135
203
|
}>;
|
|
136
204
|
text: ZodNullable<ZodString>;
|
|
137
205
|
tool: ZodOptional<ZodNullable<ZodString>>;
|
|
@@ -141,7 +209,20 @@ declare const getConversationTimelineItemsResponseSchema: ZodObject<{
|
|
|
141
209
|
}, $strip>, ZodObject<{
|
|
142
210
|
type: ZodLiteral<"event">;
|
|
143
211
|
eventType: ZodEnum<{
|
|
144
|
-
|
|
212
|
+
resolved: "resolved";
|
|
213
|
+
assigned: "assigned";
|
|
214
|
+
unassigned: "unassigned";
|
|
215
|
+
participant_requested: "participant_requested";
|
|
216
|
+
participant_joined: "participant_joined";
|
|
217
|
+
participant_left: "participant_left";
|
|
218
|
+
status_changed: "status_changed";
|
|
219
|
+
priority_changed: "priority_changed";
|
|
220
|
+
tag_added: "tag_added";
|
|
221
|
+
tag_removed: "tag_removed";
|
|
222
|
+
reopened: "reopened";
|
|
223
|
+
visitor_blocked: "visitor_blocked";
|
|
224
|
+
visitor_unblocked: "visitor_unblocked";
|
|
225
|
+
visitor_identified: "visitor_identified";
|
|
145
226
|
}>;
|
|
146
227
|
actorUserId: ZodNullable<ZodString>;
|
|
147
228
|
actorAiAgentId: ZodNullable<ZodString>;
|
|
@@ -162,6 +243,13 @@ declare const getConversationTimelineItemsResponseSchema: ZodObject<{
|
|
|
162
243
|
mediaType: ZodString;
|
|
163
244
|
fileName: ZodOptional<ZodString>;
|
|
164
245
|
size: ZodOptional<ZodNumber>;
|
|
246
|
+
}, $strip>, ZodObject<{
|
|
247
|
+
type: ZodLiteral<"metadata">;
|
|
248
|
+
source: ZodEnum<{
|
|
249
|
+
email: "email";
|
|
250
|
+
widget: "widget";
|
|
251
|
+
api: "api";
|
|
252
|
+
}>;
|
|
165
253
|
}, $strip>]>>;
|
|
166
254
|
userId: ZodNullable<ZodString>;
|
|
167
255
|
aiAgentId: ZodNullable<ZodString>;
|
|
@@ -178,7 +266,8 @@ declare const sendTimelineItemRequestSchema: ZodObject<{
|
|
|
178
266
|
item: ZodObject<{
|
|
179
267
|
id: ZodOptional<ZodString>;
|
|
180
268
|
type: ZodDefault<ZodEnum<{
|
|
181
|
-
|
|
269
|
+
message: "message";
|
|
270
|
+
event: "event";
|
|
182
271
|
}>>;
|
|
183
272
|
text: ZodString;
|
|
184
273
|
parts: ZodOptional<ZodArray<ZodUnion<readonly [ZodObject<{
|
|
@@ -187,7 +276,20 @@ declare const sendTimelineItemRequestSchema: ZodObject<{
|
|
|
187
276
|
}, $strip>, ZodObject<{
|
|
188
277
|
type: ZodLiteral<"event">;
|
|
189
278
|
eventType: ZodEnum<{
|
|
190
|
-
|
|
279
|
+
resolved: "resolved";
|
|
280
|
+
assigned: "assigned";
|
|
281
|
+
unassigned: "unassigned";
|
|
282
|
+
participant_requested: "participant_requested";
|
|
283
|
+
participant_joined: "participant_joined";
|
|
284
|
+
participant_left: "participant_left";
|
|
285
|
+
status_changed: "status_changed";
|
|
286
|
+
priority_changed: "priority_changed";
|
|
287
|
+
tag_added: "tag_added";
|
|
288
|
+
tag_removed: "tag_removed";
|
|
289
|
+
reopened: "reopened";
|
|
290
|
+
visitor_blocked: "visitor_blocked";
|
|
291
|
+
visitor_unblocked: "visitor_unblocked";
|
|
292
|
+
visitor_identified: "visitor_identified";
|
|
191
293
|
}>;
|
|
192
294
|
actorUserId: ZodNullable<ZodString>;
|
|
193
295
|
actorAiAgentId: ZodNullable<ZodString>;
|
|
@@ -208,9 +310,17 @@ declare const sendTimelineItemRequestSchema: ZodObject<{
|
|
|
208
310
|
mediaType: ZodString;
|
|
209
311
|
fileName: ZodOptional<ZodString>;
|
|
210
312
|
size: ZodOptional<ZodNumber>;
|
|
313
|
+
}, $strip>, ZodObject<{
|
|
314
|
+
type: ZodLiteral<"metadata">;
|
|
315
|
+
source: ZodEnum<{
|
|
316
|
+
email: "email";
|
|
317
|
+
widget: "widget";
|
|
318
|
+
api: "api";
|
|
319
|
+
}>;
|
|
211
320
|
}, $strip>]>>>;
|
|
212
321
|
visibility: ZodDefault<ZodEnum<{
|
|
213
|
-
|
|
322
|
+
private: "private";
|
|
323
|
+
public: "public";
|
|
214
324
|
}>>;
|
|
215
325
|
tool: ZodOptional<ZodNullable<ZodString>>;
|
|
216
326
|
userId: ZodOptional<ZodNullable<ZodString>>;
|
|
@@ -226,10 +336,13 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
226
336
|
conversationId: ZodString;
|
|
227
337
|
organizationId: ZodString;
|
|
228
338
|
visibility: ZodEnum<{
|
|
229
|
-
|
|
339
|
+
private: "private";
|
|
340
|
+
public: "public";
|
|
230
341
|
}>;
|
|
231
342
|
type: ZodEnum<{
|
|
232
|
-
|
|
343
|
+
message: "message";
|
|
344
|
+
event: "event";
|
|
345
|
+
identification: "identification";
|
|
233
346
|
}>;
|
|
234
347
|
text: ZodNullable<ZodString>;
|
|
235
348
|
tool: ZodOptional<ZodNullable<ZodString>>;
|
|
@@ -239,7 +352,20 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
239
352
|
}, $strip>, ZodObject<{
|
|
240
353
|
type: ZodLiteral<"event">;
|
|
241
354
|
eventType: ZodEnum<{
|
|
242
|
-
|
|
355
|
+
resolved: "resolved";
|
|
356
|
+
assigned: "assigned";
|
|
357
|
+
unassigned: "unassigned";
|
|
358
|
+
participant_requested: "participant_requested";
|
|
359
|
+
participant_joined: "participant_joined";
|
|
360
|
+
participant_left: "participant_left";
|
|
361
|
+
status_changed: "status_changed";
|
|
362
|
+
priority_changed: "priority_changed";
|
|
363
|
+
tag_added: "tag_added";
|
|
364
|
+
tag_removed: "tag_removed";
|
|
365
|
+
reopened: "reopened";
|
|
366
|
+
visitor_blocked: "visitor_blocked";
|
|
367
|
+
visitor_unblocked: "visitor_unblocked";
|
|
368
|
+
visitor_identified: "visitor_identified";
|
|
243
369
|
}>;
|
|
244
370
|
actorUserId: ZodNullable<ZodString>;
|
|
245
371
|
actorAiAgentId: ZodNullable<ZodString>;
|
|
@@ -260,6 +386,13 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
260
386
|
mediaType: ZodString;
|
|
261
387
|
fileName: ZodOptional<ZodString>;
|
|
262
388
|
size: ZodOptional<ZodNumber>;
|
|
389
|
+
}, $strip>, ZodObject<{
|
|
390
|
+
type: ZodLiteral<"metadata">;
|
|
391
|
+
source: ZodEnum<{
|
|
392
|
+
email: "email";
|
|
393
|
+
widget: "widget";
|
|
394
|
+
api: "api";
|
|
395
|
+
}>;
|
|
263
396
|
}, $strip>]>>;
|
|
264
397
|
userId: ZodNullable<ZodString>;
|
|
265
398
|
aiAgentId: ZodNullable<ZodString>;
|
|
@@ -270,5 +403,5 @@ declare const sendTimelineItemResponseSchema: ZodObject<{
|
|
|
270
403
|
}, $strip>;
|
|
271
404
|
type SendTimelineItemResponse = output<typeof sendTimelineItemResponseSchema>;
|
|
272
405
|
//#endregion
|
|
273
|
-
export { GetConversationTimelineItemsRequest, GetConversationTimelineItemsResponse, SendTimelineItemRequest, SendTimelineItemResponse, TimelineItem, TimelineItemParts, TimelinePartEvent, TimelinePartFile, TimelinePartImage, TimelinePartText, getConversationTimelineItemsRequestSchema, getConversationTimelineItemsResponseSchema, sendTimelineItemRequestSchema, sendTimelineItemResponseSchema, timelineItemPartsSchema, timelineItemSchema };
|
|
406
|
+
export { GetConversationTimelineItemsRequest, GetConversationTimelineItemsResponse, SendTimelineItemRequest, SendTimelineItemResponse, TimelineItem, TimelineItemParts, TimelinePartEvent, TimelinePartFile, TimelinePartImage, TimelinePartMetadata, TimelinePartText, getConversationTimelineItemsRequestSchema, getConversationTimelineItemsResponseSchema, sendTimelineItemRequestSchema, sendTimelineItemResponseSchema, timelineItemPartsSchema, timelineItemSchema };
|
|
274
407
|
//# sourceMappingURL=timeline-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item.d.ts","names":[],"sources":["../../src/api/timeline-item.ts"],"sourcesContent":[],"mappings":";;;;;;;cAQM,yBAAuB;;;;;;EAAvB,KAAA,aAAA,UAsBJ,CAAA;;;cAEI,wBAAsB;;;;cAStB,oBAAkB;;;;;;CAjCK,QAAA,CAAA;cAmDvB,uBAnDuB,EAmDA,SAnDA,CAAA;EAwBvB,IAAA,YAAA,CAAA,OAOJ,CAAA;;;;
|
|
1
|
+
{"version":3,"file":"timeline-item.d.ts","names":[],"sources":["../../src/api/timeline-item.ts"],"sourcesContent":[],"mappings":";;;;;;;cAQM,yBAAuB;;;;;;EAAvB,KAAA,aAAA,UAsBJ,CAAA;;;cAEI,wBAAsB;;;;cAStB,oBAAkB;;;;;;CAjCK,QAAA,CAAA;cAmDvB,uBAnDuB,EAmDA,SAnDA,CAAA;EAwBvB,IAAA,YAAA,CAAA,OAOJ,CAAA;;;;IAP0B,UAAA,EAAA,YAAA;IAAA,qBAAA,EAAA,uBAAA;IAStB,kBAgBJ,EAAA,oBAAA;;;;;;;;;IAhBsB,kBAAA,EAAA,oBAAA;EAAA,CAAA,CAAA;EAkBlB,WAAA,aAuCJ,UAAA,CAAA;;;;;;cAEI,4BAA0B;;;;;;;;cASnB,yBAAuB,SAAA,mBAAA;EAlDP,IAAA,YAAA,CAAA,MAAA,CAAA;EAAA,IAAA,WAAA;AAAA,CAAA,QAyCvB,CAAA,WAAA,CAAA;;;;IAA0B,QAAA,EAAA,UAAA;IAAA,UAAA,EAAA,YAAA;IASnB,qBAAA,EAaV,uBAAA;;;;IAbiC,gBAAA,EAAA,kBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAevB,oBAAkB;;;;;;;EAfK,CAAA,CAAA;EAAA,IAAA,SAAA,CAAA;IAAA,OAAA,EAAA,SAAA;IAevB,KAAA,EAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoDD,kBAAA,GAAqB,cAAe;KAEpC,YAAA,GAAe,cAAe;KAC9B,iBAAA,GAAoB,cAAe;KAEnC,gBAAA,GAAmB,cAAe;KAClC,iBAAA,GAAoB,cAAe;KACnC,gBAAA,GAAmB,cAAe;KAClC,iBAAA,GAAoB,cAAe;KACnC,oBAAA,GAAuB,cAAe;cAGrC,2CAAyC;;;CAhEvB,QAAA,CAAA;AAAA,KA+EnB,mCAAA,GAAsC,MA/EnB,CAAA,OAgFvB,yCAhFuB,CAAA;AAoDnB,cA+BC,0CA/BoB,EA+BsB,SA/Bf,CAAA;EAE5B,KAAA,UAAY,UAAkB,CAAA;IAC9B,EAAA,aAAiB,UAAkB,CAAA;IAEnC,cAAA,WAAkC;IAClC,cAAA,WAAiB;IACjB,UAAA,SAAgB,CAAA;MAChB,OAAA,EAAA,SAAiB;MACjB,MAAA,EAAA,QAAoB;IAGnB,CAAA,CAAA;;;;;;;IAAyC,IAAA,aAAA,YAAA,UAAA,CAAA,CAAA;IAAA,KAAA,UAAA,SAAA,CAAA,SAAA,UAAA,CAAA;MAe1C,IAAA,YAAA,CAAA,MAAA,CAAA;MAIC,IAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiBD,oCAAA,GAAuC,cAC3C;cAIK,+BAA6B;;;;;;;;;;;;;;;;;;;;QAtBa,gBAAA,EAAA,kBAAA;QAAA,cAAA,EAAA,gBAAA;QAiB3C,gBAAA,EAAA,kBAAoC;QAKnC,SAAA,EAAA,WAkDV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAES,uBAAA,GAA0B,cAC9B;cAGK,gCAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAxDD,cAAA,EAAA,gBAAA;QAAA,gBAAA,EAAA,kBAAA;QAoD9B,SAAA,EAAA,WAAuB;QAItB,WAAA,EAAA,aAQV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAES,wBAAA,GAA2B,cAC/B"}
|
package/api/timeline-item.js
CHANGED
|
@@ -46,11 +46,20 @@ const timelinePartEventSchema = z.object({
|
|
|
46
46
|
targetAiAgentId: z.string().nullable().openapi({ description: "AI agent targeted by the event, if applicable" }),
|
|
47
47
|
message: z.string().nullable().optional().openapi({ description: "Optional human readable message attached to the event" })
|
|
48
48
|
});
|
|
49
|
+
const timelinePartMetadataSchema = z.object({
|
|
50
|
+
type: z.literal("metadata").openapi({ description: "Type of timeline part - always 'metadata' for metadata parts" }),
|
|
51
|
+
source: z.enum([
|
|
52
|
+
"email",
|
|
53
|
+
"widget",
|
|
54
|
+
"api"
|
|
55
|
+
]).openapi({ description: "Source channel through which the message was created" })
|
|
56
|
+
});
|
|
49
57
|
const timelineItemPartsSchema = z.array(z.union([
|
|
50
58
|
timelinePartTextSchema,
|
|
51
59
|
timelinePartEventSchema,
|
|
52
60
|
timelinePartImageSchema,
|
|
53
|
-
timelineFileSchema
|
|
61
|
+
timelineFileSchema,
|
|
62
|
+
timelinePartMetadataSchema
|
|
54
63
|
])).openapi({ description: "Array of timeline parts that make up the timeline item content" });
|
|
55
64
|
const timelineItemSchema = z.object({
|
|
56
65
|
id: z.string().optional().openapi({ description: "Unique identifier for the timeline item" }),
|