@consilioweb/payload-support 0.5.1

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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +525 -0
  3. package/dist/client.cjs +7 -0
  4. package/dist/client.d.cts +3 -0
  5. package/dist/client.d.ts +3 -0
  6. package/dist/client.js +5 -0
  7. package/dist/index.cjs +7766 -0
  8. package/dist/index.d.cts +384 -0
  9. package/dist/index.d.ts +384 -0
  10. package/dist/index.js +7730 -0
  11. package/dist/views.d.cts +30 -0
  12. package/dist/views.d.ts +30 -0
  13. package/package.json +131 -0
  14. package/src/client.ts +1 -0
  15. package/src/collections/AuthLogs.ts +65 -0
  16. package/src/collections/CannedResponses.ts +69 -0
  17. package/src/collections/ChatMessages.ts +98 -0
  18. package/src/collections/EmailLogs.ts +94 -0
  19. package/src/collections/KnowledgeBase.ts +99 -0
  20. package/src/collections/Macros.ts +98 -0
  21. package/src/collections/PendingEmails.ts +122 -0
  22. package/src/collections/SatisfactionSurveys.ts +98 -0
  23. package/src/collections/SlaPolicies.ts +123 -0
  24. package/src/collections/SupportClients.ts +210 -0
  25. package/src/collections/TicketActivityLog.ts +81 -0
  26. package/src/collections/TicketMessages.ts +364 -0
  27. package/src/collections/TicketStatuses.ts +108 -0
  28. package/src/collections/Tickets.ts +704 -0
  29. package/src/collections/TimeEntries.ts +105 -0
  30. package/src/collections/WebhookEndpoints.ts +96 -0
  31. package/src/collections/index.ts +16 -0
  32. package/src/components/TicketConversation/components/AISummaryPanel.tsx +85 -0
  33. package/src/components/TicketConversation/components/ActionPanels.tsx +140 -0
  34. package/src/components/TicketConversation/components/ActivityLog.tsx +39 -0
  35. package/src/components/TicketConversation/components/ClientBar.tsx +37 -0
  36. package/src/components/TicketConversation/components/ClientHistory.tsx +117 -0
  37. package/src/components/TicketConversation/components/CodeBlock.tsx +186 -0
  38. package/src/components/TicketConversation/components/CodeBlockInserter.tsx +166 -0
  39. package/src/components/TicketConversation/components/QuickActions.tsx +82 -0
  40. package/src/components/TicketConversation/components/TicketHeader.tsx +91 -0
  41. package/src/components/TicketConversation/components/TimeTrackingPanel.tsx +161 -0
  42. package/src/components/TicketConversation/config.ts +82 -0
  43. package/src/components/TicketConversation/constants.ts +74 -0
  44. package/src/components/TicketConversation/context.ts +63 -0
  45. package/src/components/TicketConversation/hooks/useAI.ts +180 -0
  46. package/src/components/TicketConversation/hooks/useMessageActions.ts +131 -0
  47. package/src/components/TicketConversation/hooks/useReply.ts +190 -0
  48. package/src/components/TicketConversation/hooks/useTicketActions.ts +205 -0
  49. package/src/components/TicketConversation/hooks/useTimeTracking.ts +107 -0
  50. package/src/components/TicketConversation/hooks/useTranslation.ts +116 -0
  51. package/src/components/TicketConversation/index.tsx +1110 -0
  52. package/src/components/TicketConversation/locales/en.json +878 -0
  53. package/src/components/TicketConversation/locales/fr.json +878 -0
  54. package/src/components/TicketConversation/types.ts +54 -0
  55. package/src/components/TicketConversation/utils.ts +25 -0
  56. package/src/endpoints/admin-chat-stream.ts +238 -0
  57. package/src/endpoints/admin-chat.ts +263 -0
  58. package/src/endpoints/admin-stats.ts +200 -0
  59. package/src/endpoints/ai.ts +199 -0
  60. package/src/endpoints/apply-macro.ts +144 -0
  61. package/src/endpoints/auth-2fa.ts +163 -0
  62. package/src/endpoints/auto-close.ts +175 -0
  63. package/src/endpoints/billing.ts +167 -0
  64. package/src/endpoints/bulk-action.ts +103 -0
  65. package/src/endpoints/chat-stream.ts +127 -0
  66. package/src/endpoints/chat.ts +188 -0
  67. package/src/endpoints/chatbot.ts +113 -0
  68. package/src/endpoints/delete-account.ts +129 -0
  69. package/src/endpoints/email-stats.ts +109 -0
  70. package/src/endpoints/export-csv.ts +84 -0
  71. package/src/endpoints/export-data.ts +104 -0
  72. package/src/endpoints/import-conversation.ts +307 -0
  73. package/src/endpoints/index.ts +154 -0
  74. package/src/endpoints/login.ts +92 -0
  75. package/src/endpoints/merge-clients.ts +132 -0
  76. package/src/endpoints/merge-tickets.ts +137 -0
  77. package/src/endpoints/oauth-google.ts +179 -0
  78. package/src/endpoints/pending-emails-process.ts +224 -0
  79. package/src/endpoints/presence.ts +104 -0
  80. package/src/endpoints/process-scheduled.ts +144 -0
  81. package/src/endpoints/purge-logs.ts +58 -0
  82. package/src/endpoints/resend-notification.ts +99 -0
  83. package/src/endpoints/round-robin-config.ts +92 -0
  84. package/src/endpoints/satisfaction.ts +93 -0
  85. package/src/endpoints/search.ts +106 -0
  86. package/src/endpoints/seed-kb.ts +153 -0
  87. package/src/endpoints/settings.ts +144 -0
  88. package/src/endpoints/signature.ts +93 -0
  89. package/src/endpoints/sla-check.ts +124 -0
  90. package/src/endpoints/split-ticket.ts +131 -0
  91. package/src/endpoints/statuses.ts +45 -0
  92. package/src/endpoints/track-open.ts +154 -0
  93. package/src/endpoints/typing.ts +101 -0
  94. package/src/endpoints/user-prefs.ts +125 -0
  95. package/src/hooks/checkSLA.ts +414 -0
  96. package/src/hooks/ticketStatusEmail.ts +182 -0
  97. package/src/index.ts +51 -0
  98. package/src/plugin.ts +157 -0
  99. package/src/portal/LiveChat.tsx +1353 -0
  100. package/src/portal/auth/ChatWidget.tsx +350 -0
  101. package/src/portal/auth/ChatbotWidget.tsx +285 -0
  102. package/src/portal/auth/SupportHeader.tsx +409 -0
  103. package/src/portal/auth/dashboard/DashboardClient.tsx +650 -0
  104. package/src/portal/auth/dashboard/page.tsx +84 -0
  105. package/src/portal/auth/faq/FAQSearch.tsx +117 -0
  106. package/src/portal/auth/faq/page.tsx +199 -0
  107. package/src/portal/auth/layout.tsx +61 -0
  108. package/src/portal/auth/profile/page.tsx +705 -0
  109. package/src/portal/auth/tickets/detail/CloseTicketButton.tsx +74 -0
  110. package/src/portal/auth/tickets/detail/CollapsibleMessages.tsx +46 -0
  111. package/src/portal/auth/tickets/detail/MarkSolutionButton.tsx +50 -0
  112. package/src/portal/auth/tickets/detail/MessageActions.tsx +158 -0
  113. package/src/portal/auth/tickets/detail/PrintButton.tsx +16 -0
  114. package/src/portal/auth/tickets/detail/ReadReceipt.tsx +34 -0
  115. package/src/portal/auth/tickets/detail/ReopenTicketButton.tsx +74 -0
  116. package/src/portal/auth/tickets/detail/SatisfactionForm.tsx +156 -0
  117. package/src/portal/auth/tickets/detail/TicketPolling.tsx +57 -0
  118. package/src/portal/auth/tickets/detail/TicketReplyForm.tsx +294 -0
  119. package/src/portal/auth/tickets/detail/TypingIndicator.tsx +58 -0
  120. package/src/portal/auth/tickets/detail/page.tsx +738 -0
  121. package/src/portal/auth/tickets/new/page.tsx +515 -0
  122. package/src/portal/forgot-password/page.tsx +114 -0
  123. package/src/portal/layout.tsx +26 -0
  124. package/src/portal/locales/en.json +374 -0
  125. package/src/portal/locales/fr.json +374 -0
  126. package/src/portal/login/page.tsx +351 -0
  127. package/src/portal/page.tsx +162 -0
  128. package/src/portal/register/page.tsx +281 -0
  129. package/src/portal/reset-password/page.tsx +152 -0
  130. package/src/styles/BillingView.module.scss +311 -0
  131. package/src/styles/ChatView.module.scss +438 -0
  132. package/src/styles/CommandPalette.module.scss +160 -0
  133. package/src/styles/CrmView.module.scss +554 -0
  134. package/src/styles/EmailTracking.module.scss +238 -0
  135. package/src/styles/ImportConversation.module.scss +267 -0
  136. package/src/styles/Layout.module.scss +55 -0
  137. package/src/styles/Logs.module.scss +164 -0
  138. package/src/styles/NewTicket.module.scss +143 -0
  139. package/src/styles/PendingEmails.module.scss +629 -0
  140. package/src/styles/SupportDashboard.module.scss +649 -0
  141. package/src/styles/TicketDetail.module.scss +1043 -0
  142. package/src/styles/TicketInbox.module.scss +296 -0
  143. package/src/styles/TicketingSettings.module.scss +358 -0
  144. package/src/styles/TimeDashboard.module.scss +287 -0
  145. package/src/styles/_tokens.scss +78 -0
  146. package/src/styles/theme.css +633 -0
  147. package/src/types.ts +255 -0
  148. package/src/utils/adminNotification.ts +38 -0
  149. package/src/utils/auth.ts +46 -0
  150. package/src/utils/emailTemplate.ts +343 -0
  151. package/src/utils/fireWebhooks.ts +84 -0
  152. package/src/utils/index.ts +22 -0
  153. package/src/utils/rateLimiter.ts +52 -0
  154. package/src/utils/readSettings.ts +67 -0
  155. package/src/utils/slugs.ts +54 -0
  156. package/src/utils/webhookDispatcher.ts +120 -0
  157. package/src/views/BillingView/client.tsx +137 -0
  158. package/src/views/BillingView/index.tsx +33 -0
  159. package/src/views/ChatView/client.tsx +294 -0
  160. package/src/views/ChatView/index.tsx +33 -0
  161. package/src/views/CrmView/client.tsx +206 -0
  162. package/src/views/CrmView/index.tsx +33 -0
  163. package/src/views/EmailTrackingView/client.tsx +124 -0
  164. package/src/views/EmailTrackingView/index.tsx +33 -0
  165. package/src/views/ImportConversationView/client.tsx +133 -0
  166. package/src/views/ImportConversationView/index.tsx +33 -0
  167. package/src/views/LogsView/client.tsx +151 -0
  168. package/src/views/LogsView/index.tsx +30 -0
  169. package/src/views/NewTicketView/client.tsx +227 -0
  170. package/src/views/NewTicketView/index.tsx +30 -0
  171. package/src/views/PendingEmailsView/client.tsx +177 -0
  172. package/src/views/PendingEmailsView/index.tsx +33 -0
  173. package/src/views/SupportDashboardView/client.tsx +424 -0
  174. package/src/views/SupportDashboardView/index.tsx +33 -0
  175. package/src/views/TicketDetailView/client.tsx +775 -0
  176. package/src/views/TicketDetailView/index.tsx +33 -0
  177. package/src/views/TicketInboxView/client.tsx +313 -0
  178. package/src/views/TicketInboxView/index.tsx +30 -0
  179. package/src/views/TicketingSettingsView/client.tsx +866 -0
  180. package/src/views/TicketingSettingsView/index.tsx +33 -0
  181. package/src/views/TimeDashboardView/client.tsx +144 -0
  182. package/src/views/TimeDashboardView/index.tsx +33 -0
  183. package/src/views/shared/AdminViewHeader.tsx +69 -0
  184. package/src/views/shared/ErrorBoundary.tsx +68 -0
  185. package/src/views/shared/Skeleton.tsx +125 -0
  186. package/src/views/shared/adminTokens.ts +37 -0
  187. package/src/views/shared/config.ts +82 -0
  188. package/src/views/shared/index.ts +6 -0
  189. package/src/views.ts +16 -0
@@ -0,0 +1,384 @@
1
+ import { Plugin, Payload, BasePayload, CollectionAfterChangeHook, CollectionConfig } from 'payload';
2
+
3
+ interface SupportFeatures {
4
+ /** Time tracking: timer, manual entries, billing */
5
+ timeTracking?: boolean;
6
+ /** AI features: sentiment, synthesis, suggestion, rewrite */
7
+ ai?: boolean;
8
+ /** Satisfaction surveys: CSAT rating after resolution */
9
+ satisfaction?: boolean;
10
+ /** Live chat integration: chat → ticket conversion */
11
+ chat?: boolean;
12
+ /** Email tracking: pixel tracking, open/sent status per message */
13
+ emailTracking?: boolean;
14
+ /** Canned responses: quick reply templates */
15
+ canned?: boolean;
16
+ /** Ticket merge: combine two tickets into one */
17
+ merge?: boolean;
18
+ /** Snooze: temporarily hide a ticket */
19
+ snooze?: boolean;
20
+ /** External messages: add messages received outside the system */
21
+ externalMessages?: boolean;
22
+ /** Client history: past tickets, projects, notes sidebar */
23
+ clientHistory?: boolean;
24
+ /** Activity log: audit trail of actions on the ticket */
25
+ activityLog?: boolean;
26
+ /** Split ticket: extract a message into a new ticket */
27
+ splitTicket?: boolean;
28
+ /** Scheduled replies: send a message at a future date */
29
+ scheduledReplies?: boolean;
30
+ /** Auto-close: automatically resolve inactive tickets */
31
+ autoClose?: boolean;
32
+ /** Auto-close delay in days */
33
+ autoCloseDays?: number;
34
+ /** Round-robin: distribute new tickets evenly among agents */
35
+ roundRobin?: boolean;
36
+ /** SLA policies: response & resolution time targets */
37
+ sla?: boolean;
38
+ /** Webhooks: outbound HTTP hooks on ticket events */
39
+ webhooks?: boolean;
40
+ /** Macros: multi-action shortcuts */
41
+ macros?: boolean;
42
+ /** Custom statuses: configurable ticket statuses */
43
+ customStatuses?: boolean;
44
+ /** Collision detection: warn when multiple agents view same ticket */
45
+ collisionDetection?: boolean;
46
+ /** Per-agent email signatures */
47
+ signatures?: boolean;
48
+ /** AI chatbot for self-service */
49
+ chatbot?: boolean;
50
+ /** Bulk actions on multiple tickets */
51
+ bulkActions?: boolean;
52
+ /** Command palette (⌘K) */
53
+ commandPalette?: boolean;
54
+ /** Knowledge base / FAQ */
55
+ knowledgeBase?: boolean;
56
+ /** Pending email queue */
57
+ pendingEmails?: boolean;
58
+ /** Authentication audit logs */
59
+ authLogs?: boolean;
60
+ }
61
+ interface AIProviderConfig {
62
+ provider: 'anthropic' | 'openai' | 'ollama' | 'custom';
63
+ apiKey?: string;
64
+ model?: string;
65
+ baseUrl?: string;
66
+ }
67
+ interface EmailConfig {
68
+ fromAddress?: string;
69
+ fromName?: string;
70
+ replyTo?: string;
71
+ }
72
+ interface SupportPluginConfig {
73
+ /** Enable/disable individual features (all enabled by default) */
74
+ features?: SupportFeatures;
75
+ /** AI provider configuration */
76
+ ai?: AIProviderConfig;
77
+ /** Email configuration for ticket notifications */
78
+ email?: EmailConfig;
79
+ /** Locale: 'fr' or 'en' (default: 'fr') */
80
+ locale?: 'fr' | 'en';
81
+ /** Nav group label in Payload admin sidebar */
82
+ navGroup?: string;
83
+ /** Base path for admin views (default: '/support') */
84
+ basePath?: string;
85
+ /** User collection slug for agent relationships (default: 'users') */
86
+ userCollectionSlug?: string;
87
+ /**
88
+ * Restrict Google OAuth auto-registration to specific email domains.
89
+ * When set and non-empty, only emails matching one of these domains can
90
+ * create an account via OAuth. Existing accounts are unaffected.
91
+ * Example: ['acme.com', 'partner.org']
92
+ */
93
+ allowedEmailDomains?: string[];
94
+ /** Skip injecting collections (use your own custom collections) */
95
+ skipCollections?: boolean;
96
+ /** Skip injecting admin views (use your own custom views) */
97
+ skipViews?: boolean;
98
+ /** Skip injecting endpoints (use your own custom API routes) */
99
+ skipEndpoints?: boolean;
100
+ /** Collection slug overrides */
101
+ collectionSlugs?: {
102
+ tickets?: string;
103
+ ticketMessages?: string;
104
+ supportClients?: string;
105
+ timeEntries?: string;
106
+ cannedResponses?: string;
107
+ ticketActivityLog?: string;
108
+ satisfactionSurveys?: string;
109
+ knowledgeBase?: string;
110
+ chatMessages?: string;
111
+ pendingEmails?: string;
112
+ emailLogs?: string;
113
+ authLogs?: string;
114
+ webhookEndpoints?: string;
115
+ slaPolicies?: string;
116
+ macros?: string;
117
+ ticketStatuses?: string;
118
+ };
119
+ /** Admin notification collection slug (default: 'admin-notifications') */
120
+ notificationSlug?: string;
121
+ /** Custom component path for ticket conversation UI field */
122
+ conversationComponent?: string;
123
+ /** Project collection slug — adds a project relationship to tickets (optional) */
124
+ projectCollectionSlug?: string;
125
+ /** Documents upload collection slug — adds quote/invoice upload fields to tickets (optional) */
126
+ documentsCollectionSlug?: string;
127
+ }
128
+ interface TicketData {
129
+ id: number | string;
130
+ ticketNumber: string;
131
+ subject: string;
132
+ status: string;
133
+ priority: string;
134
+ category?: string;
135
+ client?: number | string;
136
+ assignedTo?: number | string;
137
+ totalTimeMinutes?: number;
138
+ createdAt: string;
139
+ updatedAt: string;
140
+ }
141
+ interface MessageData {
142
+ id: number | string;
143
+ ticket: number | string;
144
+ body: string;
145
+ bodyHtml?: string;
146
+ authorType: 'admin' | 'client' | 'email';
147
+ isInternal?: boolean;
148
+ attachments?: Array<{
149
+ file: number | string;
150
+ }>;
151
+ createdAt: string;
152
+ }
153
+ interface TimeEntryData {
154
+ id: number | string;
155
+ ticket: number | string;
156
+ minutes: number;
157
+ description?: string;
158
+ date: string;
159
+ }
160
+ interface ClientData {
161
+ id: number | string;
162
+ email: string;
163
+ firstName: string;
164
+ lastName: string;
165
+ company?: string;
166
+ phone?: string;
167
+ }
168
+ interface CannedResponseData {
169
+ id: number | string;
170
+ title: string;
171
+ body: string;
172
+ category?: string;
173
+ }
174
+ interface ActivityEntryData {
175
+ id: number | string;
176
+ ticket: number | string;
177
+ action: string;
178
+ field?: string;
179
+ oldValue?: string;
180
+ newValue?: string;
181
+ actorType: 'admin' | 'client' | 'system';
182
+ actorEmail?: string;
183
+ createdAt: string;
184
+ }
185
+ interface SatisfactionSurveyData {
186
+ id: number | string;
187
+ ticket: number | string;
188
+ client: number | string;
189
+ rating: number;
190
+ comment?: string;
191
+ }
192
+ declare const DEFAULT_FEATURES: Required<SupportFeatures>;
193
+
194
+ /**
195
+ * Payload CMS Support & Ticketing Plugin.
196
+ *
197
+ * Adds a complete support module with tickets, conversations, SLA,
198
+ * time tracking, AI features, live chat, and much more.
199
+ *
200
+ * @example
201
+ * ```ts
202
+ * import { supportPlugin } from '@consilioweb/payload-support'
203
+ *
204
+ * export default buildConfig({
205
+ * plugins: [
206
+ * supportPlugin({
207
+ * features: { ai: true, timeTracking: true, sla: true },
208
+ * ai: { provider: 'anthropic', model: 'claude-haiku-4-5-20251001' },
209
+ * locale: 'fr',
210
+ * }),
211
+ * ],
212
+ * })
213
+ * ```
214
+ */
215
+ declare function supportPlugin(config?: SupportPluginConfig): Plugin;
216
+
217
+ /**
218
+ * Default collection slugs used by the support plugin.
219
+ * All slugs can be overridden via SupportPluginConfig.collectionSlugs.
220
+ */
221
+ interface CollectionSlugs {
222
+ tickets: string;
223
+ ticketMessages: string;
224
+ supportClients: string;
225
+ timeEntries: string;
226
+ cannedResponses: string;
227
+ ticketActivityLog: string;
228
+ satisfactionSurveys: string;
229
+ knowledgeBase: string;
230
+ chatMessages: string;
231
+ pendingEmails: string;
232
+ emailLogs: string;
233
+ authLogs: string;
234
+ webhookEndpoints: string;
235
+ slaPolicies: string;
236
+ macros: string;
237
+ ticketStatuses: string;
238
+ users: string;
239
+ media: string;
240
+ }
241
+ declare const DEFAULT_SLUGS: CollectionSlugs;
242
+ /**
243
+ * Resolve collection slugs merging user overrides with defaults.
244
+ */
245
+ declare function resolveSlugs(overrides?: Partial<CollectionSlugs>): CollectionSlugs;
246
+
247
+ interface SupportSettings {
248
+ email: {
249
+ fromAddress: string;
250
+ fromName: string;
251
+ replyToAddress: string;
252
+ };
253
+ ai: {
254
+ provider: string;
255
+ model: string;
256
+ enableSentiment: boolean;
257
+ enableSynthesis: boolean;
258
+ enableSuggestion: boolean;
259
+ enableRewrite: boolean;
260
+ };
261
+ sla: {
262
+ firstResponseMinutes: number;
263
+ resolutionMinutes: number;
264
+ businessHoursOnly: boolean;
265
+ escalationEmail: string;
266
+ };
267
+ autoClose: {
268
+ enabled: boolean;
269
+ daysBeforeClose: number;
270
+ reminderDaysBefore: number;
271
+ };
272
+ }
273
+ interface UserPrefs {
274
+ locale: 'fr' | 'en';
275
+ signature: string;
276
+ }
277
+ declare const DEFAULT_SETTINGS: SupportSettings;
278
+ declare const DEFAULT_USER_PREFS: UserPrefs;
279
+ declare function readSupportSettings(payload: Payload): Promise<SupportSettings>;
280
+ declare function readUserPrefs(payload: Payload, userId: string | number): Promise<UserPrefs>;
281
+
282
+ /**
283
+ * Helper to create an admin notification.
284
+ * Can be called from any hook or endpoint.
285
+ *
286
+ * @param payload - Payload instance
287
+ * @param data - Notification data
288
+ * @param collectionSlug - Override collection slug (default: 'admin-notifications')
289
+ */
290
+ declare function createAdminNotification(payload: Payload, data: {
291
+ title: string;
292
+ message?: string;
293
+ type: 'info' | 'new_ticket' | 'client_message' | 'quote_request' | 'urgent_ticket' | 'post_published' | 'satisfaction' | 'sla_alert';
294
+ link?: string;
295
+ recipient?: number | string;
296
+ }, collectionSlug?: string): Promise<void>;
297
+
298
+ type WebhookEvent = 'ticket_created' | 'ticket_resolved' | 'ticket_replied' | 'sla_breached';
299
+ /**
300
+ * Dispatch outbound webhooks for a given event.
301
+ * Fetches all active webhook endpoints matching the event,
302
+ * POSTs JSON to each with optional HMAC-SHA256 signature.
303
+ * Fire-and-forget: errors are logged but never thrown.
304
+ *
305
+ * @param data - Payload data to send
306
+ * @param event - Webhook event type
307
+ * @param payload - Payload instance
308
+ * @param slugs - Collection slugs for dynamic collection references
309
+ */
310
+ declare function dispatchWebhook(data: Record<string, unknown>, event: WebhookEvent, payload: BasePayload, slugs: CollectionSlugs): void;
311
+
312
+ /**
313
+ * Calculate a business-hours deadline from a start date.
314
+ * Business hours: Mon-Fri, 9:00-18:00 (Europe/Paris).
315
+ * @param start - start date
316
+ * @param minutes - number of business-hour minutes to add
317
+ * @returns deadline date
318
+ */
319
+ declare function calculateBusinessHoursDeadline(start: Date, minutes: number): Date;
320
+ /**
321
+ * Factory: Assign SLA deadlines when a ticket is created or SLA policy changes.
322
+ * Runs as afterChange on tickets collection.
323
+ */
324
+ declare function createAssignSlaDeadlines(slugs: CollectionSlugs, notificationSlug?: string): CollectionAfterChangeHook;
325
+ /**
326
+ * Factory: Check SLA resolution breach when ticket is resolved.
327
+ * Runs as afterChange on tickets collection.
328
+ */
329
+ declare function createCheckSlaOnResolve(slugs: CollectionSlugs, notificationSlug?: string): CollectionAfterChangeHook;
330
+ /**
331
+ * Factory: Check SLA breach on first admin response.
332
+ * Runs as afterChange on ticket-messages collection.
333
+ */
334
+ declare function createCheckSlaOnReply(slugs: CollectionSlugs, notificationSlug?: string): CollectionAfterChangeHook;
335
+
336
+ /**
337
+ * Factory: Send email notification to the client when a ticket is created
338
+ * or when its status changes to `waiting_client`.
339
+ *
340
+ * Note: Resolved notifications are handled by the existing
341
+ * `notifyClientOnResolve` hook, so this hook skips those transitions.
342
+ */
343
+ declare function createTicketStatusEmail(slugs: CollectionSlugs): CollectionAfterChangeHook;
344
+
345
+ declare function createTicketsCollection(slugs: CollectionSlugs, options?: {
346
+ conversationComponent?: string;
347
+ projectCollectionSlug?: string;
348
+ documentsCollectionSlug?: string;
349
+ notificationSlug?: string;
350
+ }): CollectionConfig;
351
+
352
+ declare function createTicketMessagesCollection(slugs: CollectionSlugs, options?: {
353
+ notificationSlug?: string;
354
+ }): CollectionConfig;
355
+
356
+ declare function createSupportClientsCollection(slugs: CollectionSlugs): CollectionConfig;
357
+
358
+ declare function createTimeEntriesCollection(slugs: CollectionSlugs): CollectionConfig;
359
+
360
+ declare function createCannedResponsesCollection(slugs: CollectionSlugs): CollectionConfig;
361
+
362
+ declare function createTicketActivityLogCollection(slugs: CollectionSlugs): CollectionConfig;
363
+
364
+ declare function createSatisfactionSurveysCollection(slugs: CollectionSlugs): CollectionConfig;
365
+
366
+ declare function createKnowledgeBaseCollection(slugs: CollectionSlugs): CollectionConfig;
367
+
368
+ declare function createChatMessagesCollection(slugs: CollectionSlugs): CollectionConfig;
369
+
370
+ declare function createPendingEmailsCollection(slugs: CollectionSlugs): CollectionConfig;
371
+
372
+ declare function createEmailLogsCollection(slugs: CollectionSlugs): CollectionConfig;
373
+
374
+ declare function createAuthLogsCollection(slugs: CollectionSlugs): CollectionConfig;
375
+
376
+ declare function createWebhookEndpointsCollection(slugs: CollectionSlugs): CollectionConfig;
377
+
378
+ declare function createSlaPoliciesCollection(slugs: CollectionSlugs): CollectionConfig;
379
+
380
+ declare function createMacrosCollection(slugs: CollectionSlugs): CollectionConfig;
381
+
382
+ declare function createTicketStatusesCollection(slugs: CollectionSlugs): CollectionConfig;
383
+
384
+ export { type AIProviderConfig, type ActivityEntryData, type CannedResponseData, type ClientData, type CollectionSlugs, DEFAULT_FEATURES, DEFAULT_SETTINGS, DEFAULT_SLUGS, DEFAULT_USER_PREFS, type EmailConfig, type MessageData, type SatisfactionSurveyData, type SupportFeatures, type SupportPluginConfig, type SupportSettings, type TicketData, type TimeEntryData, type UserPrefs, calculateBusinessHoursDeadline, createAdminNotification, createAssignSlaDeadlines, createAuthLogsCollection, createCannedResponsesCollection, createChatMessagesCollection, createCheckSlaOnReply, createCheckSlaOnResolve, createEmailLogsCollection, createKnowledgeBaseCollection, createMacrosCollection, createPendingEmailsCollection, createSatisfactionSurveysCollection, createSlaPoliciesCollection, createSupportClientsCollection, createTicketActivityLogCollection, createTicketMessagesCollection, createTicketStatusEmail, createTicketStatusesCollection, createTicketsCollection, createTimeEntriesCollection, createWebhookEndpointsCollection, dispatchWebhook, readSupportSettings, readUserPrefs, resolveSlugs, supportPlugin };