@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ConsilioWEB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,525 @@
1
+ <!-- Header Banner -->
2
+ <div align="center">
3
+
4
+ <a href="https://git.io/typing-svg">
5
+ <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=700&size=32&duration=3000&pause=1000&color=3B82F6&center=true&vCenter=true&width=700&lines=%40consilioweb%2Fpayload-support;Professional+Ticketing+for+Payload+CMS;AI+%7C+SLA+%7C+Time+Tracking+%7C+Live+Chat;15+Collections+%7C+34+API+Routes;Open-Source+%7C+MIT+License" alt="Typing SVG" />
6
+ </a>
7
+
8
+ <br><br>
9
+
10
+ <!-- Badges -->
11
+ <img src="https://img.shields.io/badge/version-0.2.0-blue?style=for-the-badge" alt="version">
12
+ <img src="https://img.shields.io/badge/Payload%20CMS-3.x-0F172A?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTIgMkw0IDdWMTdMMTIgMjJMMjAgMTdWN0wxMiAyWiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=&logoColor=white" alt="Payload CMS 3">
13
+ <img src="https://img.shields.io/badge/AI-Anthropic%20%7C%20OpenAI%20%7C%20Ollama-10B981?style=for-the-badge" alt="AI">
14
+ <img src="https://img.shields.io/badge/i18n-FR%20%7C%20EN-F59E0B?style=for-the-badge&logo=translate&logoColor=white" alt="i18n FR | EN">
15
+ <a href="https://github.com/pOwn3d/payload-support/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-7C3AED?style=for-the-badge" alt="MIT License"></a>
16
+ <img src="https://img.shields.io/badge/TypeScript-5.x-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript">
17
+
18
+ </div>
19
+
20
+ <p align="center">
21
+ <a href="https://buymeacoffee.com/pown3d">
22
+ <img src="https://img.shields.io/badge/Buy%20me%20a%20coffee-☕-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black" alt="Buy me a coffee" />
23
+ </a>
24
+ </p>
25
+
26
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
27
+
28
+ > [!IMPORTANT]
29
+ > ## ⚠️ Next.js 16 + Turbopack — Known Issue
30
+ >
31
+ > If you're using **Next.js 16** with Turbopack (default bundler), you may encounter a `createContext is not a function` error during `next build`. This is a **known Payload CMS issue** ([#15429](https://github.com/payloadcms/payload/issues/15429), [#14330](https://github.com/payloadcms/payload/discussions/14330)) — not specific to this plugin.
32
+ >
33
+ > **Workaround** — Add this to your admin page (`src/app/(payload)/admin/[[...segments]]/page.tsx`):
34
+ > ```ts
35
+ > export const dynamic = 'force-dynamic'
36
+ > ```
37
+ >
38
+ > And ensure all `@consilioweb/*` packages are in `transpilePackages` in your `next.config.ts`:
39
+ > ```ts
40
+ > transpilePackages: ['@consilioweb/seo-analyzer', '@consilioweb/admin-nav', /* ...other @consilioweb packages */],
41
+ > ```
42
+ >
43
+ > ✅ **Next.js 15** works without any workaround.
44
+
45
+ ## About
46
+
47
+ > **@consilioweb/payload-support** — A complete, production-ready support & ticketing system for Payload CMS 3. Comparable to Freshdesk, HelpScout, and Crisp — but free, open-source, and fully integrated into Payload's admin panel.
48
+
49
+ <table>
50
+ <tr>
51
+ <td align="center" width="20%">
52
+ <b>Ticketing</b><br>
53
+ <sub>Auto-increment, SLA, priorities, categories</sub>
54
+ </td>
55
+ <td align="center" width="20%">
56
+ <b>AI-Powered</b><br>
57
+ <sub>Sentiment, synthesis, suggestions, rewrite</sub>
58
+ </td>
59
+ <td align="center" width="20%">
60
+ <b>Time Tracking</b><br>
61
+ <sub>Timer, entries, billing dashboard</sub>
62
+ </td>
63
+ <td align="center" width="20%">
64
+ <b>Live Chat</b><br>
65
+ <sub>Real-time, chat-to-ticket conversion</sub>
66
+ </td>
67
+ <td align="center" width="20%">
68
+ <b>Modular</b><br>
69
+ <sub>25+ feature flags, enable what you need</sub>
70
+ </td>
71
+ </tr>
72
+ </table>
73
+
74
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
75
+
76
+ ## Features
77
+
78
+ ### Core Ticketing
79
+ - Auto-increment ticket numbers (TK-0001, TK-0002...)
80
+ - Statuses, priorities, categories, tags
81
+ - Multi-agent assignment with round-robin distribution
82
+ - Ticket merge, split, snooze
83
+ - Scheduled replies
84
+ - Bulk actions on multiple tickets
85
+ - Command palette (⌘K) for instant search
86
+
87
+ ### AI Integration
88
+ - **Sentiment analysis** — detect client mood from messages
89
+ - **AI summary** — generate conversation synthesis
90
+ - **Smart reply** — suggest contextual responses
91
+ - **Rewrite** — rephrase messages professionally
92
+ - Multi-provider: Anthropic Claude, OpenAI, Ollama, custom endpoint
93
+ - AI chatbot for first-line self-service
94
+
95
+ ### SLA & Compliance
96
+ - Response & resolution time targets per priority
97
+ - Business hours support
98
+ - SLA breach alerts on dashboard
99
+ - Webhook dispatch on `sla_breached` events
100
+
101
+ ### Time Tracking & Billing
102
+ - Built-in timer with pause/resume
103
+ - Manual time entries per ticket
104
+ - Time dashboard with analytics
105
+ - Billing/invoicing foundation
106
+ - Facturable toggle per ticket
107
+
108
+ ### Live Chat
109
+ - Real-time chat sessions via **Server-Sent Events (SSE)** (v0.2.0)
110
+ - Automatic **SSE to polling fallback** when EventSource unavailable (v0.2.0)
111
+ - Typing indicators
112
+ - Chat-to-ticket conversion
113
+ - Agent presence/collision detection
114
+
115
+ ### Email Integration
116
+ - Inbound email → ticket/message (via webhook)
117
+ - Pending email queue with client matching
118
+ - Email pixel tracking (opens)
119
+ - Per-agent email signatures
120
+ - Email log viewer with purge
121
+
122
+ ### Client Management (CRM)
123
+ - Client profiles with history
124
+ - Impersonation (view as client)
125
+ - Client merge
126
+ - Satisfaction surveys (CSAT 1-5)
127
+ - Knowledge base / FAQ
128
+ - Client portal (separate auth)
129
+
130
+ ### Automation
131
+ - Auto-close inactive tickets
132
+ - Canned responses with template variables
133
+ - Macros (multi-action shortcuts)
134
+ - Webhooks (HMAC-SHA256 signed) with dispatch on ticket events (v0.2.0)
135
+ - **Scheduled replies** processing endpoint (v0.2.0)
136
+ - Activity log (full audit trail)
137
+
138
+ ### Security (v0.2.0)
139
+ - **XSS prevention** — escapeHtml on all email template dynamic fields
140
+ - **2FA codes** hashed with HMAC-SHA256 before storage
141
+ - **Tracking pixels** signed with HMAC
142
+ - **OAuth Google** — `allowedEmailDomains` option for domain restriction
143
+ - **Rate limiting** — unified RateLimiter class on all public endpoints
144
+ - **Collection injection protection** — validates collection parameters against whitelist
145
+ - **Password generation** — uses crypto.randomBytes (not Math.random)
146
+
147
+ ### Internationalization
148
+ - Full FR/EN support
149
+ - Locale toggle in settings
150
+ - Extensible translation system
151
+
152
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
153
+
154
+ ## Architecture
155
+
156
+ ### Collections (15)
157
+
158
+ | Collection | Description |
159
+ |------------|-------------|
160
+ | `tickets` | Core ticket with auto-increment, SLA, activity hooks |
161
+ | `ticket-messages` | Conversation messages with author type, attachments |
162
+ | `support-clients` | Client auth collection (email/password) |
163
+ | `time-entries` | Time tracking per ticket |
164
+ | `canned-responses` | Quick reply templates with variables |
165
+ | `ticket-activity-log` | Immutable audit trail |
166
+ | `satisfaction-surveys` | CSAT ratings (1-5) |
167
+ | `knowledge-base` | FAQ articles with rich text |
168
+ | `chat-messages` | Live chat sessions |
169
+ | `pending-emails` | Inbound email queue |
170
+ | `email-logs` | Email delivery audit |
171
+ | `auth-logs` | Authentication audit |
172
+ | `webhook-endpoints` | Outbound webhook config |
173
+ | `sla-policies` | SLA rules per priority |
174
+ | `macros` | Multi-action shortcuts |
175
+ | `ticket-statuses` | Custom configurable statuses |
176
+
177
+ ### API Endpoints (34)
178
+
179
+ | Category | Endpoints |
180
+ |----------|-----------|
181
+ | **Tickets** | search, bulk-action, merge-tickets, split-ticket, export-csv, export-data |
182
+ | **AI** | ai (sentiment/synthesis/suggest/rewrite), chatbot |
183
+ | **Chat** | chat, admin-chat, typing, presence |
184
+ | **Email** | pending-emails/process, resend-notification, track-open, email-stats |
185
+ | **Config** | settings, signature, round-robin-config, statuses, sla-check, auto-close |
186
+ | **Auth** | login, 2fa, oauth/google, delete-account |
187
+ | **SSE** | client-stream, admin-stream (v0.2.0) |
188
+ | **Scheduled** | process-scheduled (v0.2.0) |
189
+ | **Misc** | apply-macro, purge-logs, seed-kb, admin-stats, billing, import-conversation, merge-clients, satisfaction |
190
+
191
+ ### Admin Views (12)
192
+
193
+ | View | Path | Description |
194
+ |------|------|-------------|
195
+ | Inbox | `/support/inbox` | Superhuman-style ticket list with keyboard nav |
196
+ | Dashboard | `/support/dashboard` | KPIs, SLA metrics, active tickets |
197
+ | Ticket Detail | `/support/ticket?id=X` | Full conversation with sidebar panels |
198
+ | New Ticket | `/support/new-ticket` | Create ticket with client search |
199
+ | Settings | `/support/settings` | Feature flags, AI, SLA, auto-close config |
200
+ | CRM | `/support/crm` | Client list and profiles |
201
+ | Chat | `/support/chat` | Live chat sessions |
202
+ | Pending Emails | `/support/emails` | Inbound email queue |
203
+ | Email Tracking | `/support/tracking` | Open/delivery tracking |
204
+ | Time Dashboard | `/support/time` | Time entries analytics |
205
+ | Logs | `/support/logs` | Email & auth audit logs |
206
+ | Billing | `/support/billing` | Invoice management |
207
+
208
+ ### Client Portal (30 files)
209
+
210
+ Full-featured client-facing support portal with its own auth system:
211
+
212
+ | Page | Description |
213
+ |------|-------------|
214
+ | Login / Register | Email + password auth, Google OAuth |
215
+ | Forgot / Reset password | Email-based password recovery |
216
+ | Dashboard | Ticket stats, recent activity, quick actions |
217
+ | Ticket List | Filterable, sortable ticket list |
218
+ | Ticket Detail | Conversation thread, reply form, file attachments, satisfaction survey |
219
+ | New Ticket | Category selection, priority, file upload |
220
+ | FAQ | Knowledge base with search |
221
+ | Profile | Edit name, company, email, password, notification prefs, 2FA, delete account |
222
+ | Chat Widget | Real-time live chat with agent |
223
+ | Chatbot | AI-powered self-service from knowledge base |
224
+
225
+ ### Email Template System
226
+
227
+ Configurable, responsive HTML email templates:
228
+
229
+ ```ts
230
+ import { createEmailTemplateFactory } from '@consilioweb/payload-support'
231
+
232
+ const emails = createEmailTemplateFactory({
233
+ brandName: 'My Company',
234
+ brandColor: '#2563eb',
235
+ logoUrl: 'https://example.com/logo.png',
236
+ supportEmail: 'support@example.com',
237
+ websiteUrl: 'https://example.com',
238
+ })
239
+
240
+ // Use pre-configured functions
241
+ const html = emails.wrapper('Welcome', [
242
+ emails.paragraph('Hello <strong>John</strong>,'),
243
+ emails.button('Open Dashboard', 'https://example.com/dashboard'),
244
+ ].join(''))
245
+ ```
246
+
247
+ Available functions: `emailWrapper`, `emailButton`, `emailParagraph`, `emailQuote`, `emailInfoRow`, `emailRichContent`, `emailTrackingPixel`, `escapeHtml`
248
+
249
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
250
+
251
+ ## Installation
252
+
253
+ ```bash
254
+ pnpm add @consilioweb/payload-support
255
+ ```
256
+
257
+ Or with npm/yarn:
258
+
259
+ ```bash
260
+ npm install @consilioweb/payload-support
261
+ yarn add @consilioweb/payload-support
262
+ ```
263
+
264
+ ### Peer Dependencies
265
+
266
+ | Package | Version | Required |
267
+ |---------|---------|----------|
268
+ | `payload` | `^3.0.0` | **Yes** |
269
+ | `@payloadcms/next` | `^3.0.0` | Optional (admin views) |
270
+ | `@payloadcms/ui` | `^3.0.0` | Optional (admin UI) |
271
+ | `next` | `^14.0.0 \|\| ^15.0.0 \|\| ^16.0.0` | Optional (admin UI) |
272
+ | `react` | `^18.0.0 \|\| ^19.0.0` | Optional (admin UI) |
273
+
274
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
275
+
276
+ ## Quick Start
277
+
278
+ ```ts
279
+ import { buildConfig } from 'payload'
280
+ import { supportPlugin } from '@consilioweb/payload-support'
281
+
282
+ export default buildConfig({
283
+ // ... your existing config
284
+ plugins: [
285
+ supportPlugin({
286
+ // All features enabled by default — disable what you don't need
287
+ features: {
288
+ chat: false, // disable live chat
289
+ billing: false, // disable billing
290
+ roundRobin: true, // enable round-robin (off by default)
291
+ },
292
+
293
+ // AI provider (optional)
294
+ ai: {
295
+ provider: 'anthropic',
296
+ model: 'claude-haiku-4-5-20251001',
297
+ },
298
+
299
+ // Locale
300
+ locale: 'fr',
301
+
302
+ // Email
303
+ email: {
304
+ fromAddress: 'support@example.com',
305
+ fromName: 'Support Team',
306
+ },
307
+ }),
308
+ ],
309
+ })
310
+ ```
311
+
312
+ ### Next.js Configuration
313
+
314
+ Add the plugin to `transpilePackages` in your `next.config.mjs` so Next.js can resolve the view components:
315
+
316
+ ```js
317
+ // next.config.mjs
318
+ import { withPayload } from '@payloadcms/next/withPayload'
319
+
320
+ /** @type {import('next').NextConfig} */
321
+ const nextConfig = {
322
+ transpilePackages: ['@consilioweb/payload-support'],
323
+ }
324
+
325
+ export default withPayload(nextConfig)
326
+ ```
327
+
328
+ Then regenerate the import map:
329
+
330
+ ```bash
331
+ pnpm generate:importmap
332
+ ```
333
+
334
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
335
+
336
+ ## Configuration
337
+
338
+ ### `SupportPluginConfig`
339
+
340
+ ```ts
341
+ supportPlugin({
342
+ features: {}, // Feature flags (see below)
343
+ ai: { provider, apiKey, model }, // AI provider config
344
+ email: { fromAddress, fromName, replyTo },
345
+ locale: 'fr', // 'fr' | 'en'
346
+ navGroup: 'Support', // Sidebar group label
347
+ basePath: '/support', // Admin view base path
348
+ userCollectionSlug: 'users', // Agent collection slug
349
+ collectionSlugs: { // Override any collection slug
350
+ tickets: 'my-tickets',
351
+ ticketMessages: 'my-messages',
352
+ // ...
353
+ },
354
+
355
+ // v0.2.0 — Webhook dispatch
356
+ webhooks: {
357
+ url: 'https://hooks.slack.com/services/...',
358
+ secret: process.env.WEBHOOK_SECRET,
359
+ events: ['ticket.created', 'ticket.resolved', 'ticket.assigned', 'ticket.replied'],
360
+ },
361
+
362
+ // v0.2.0 — OAuth restrictions
363
+ allowedEmailDomains: ['mycompany.com', 'partner.com'],
364
+ })
365
+ ```
366
+
367
+ ### Feature Flags (25+)
368
+
369
+ All features are **enabled by default** except `roundRobin` and `customStatuses`.
370
+
371
+ | Flag | Default | Description |
372
+ |------|---------|-------------|
373
+ | `timeTracking` | `true` | Timer, manual entries, billing |
374
+ | `ai` | `true` | Sentiment, synthesis, suggestion, rewrite |
375
+ | `satisfaction` | `true` | CSAT surveys after resolution |
376
+ | `chat` | `true` | Live chat sessions |
377
+ | `emailTracking` | `true` | Pixel tracking, open status |
378
+ | `canned` | `true` | Quick reply templates |
379
+ | `merge` | `true` | Merge two tickets |
380
+ | `snooze` | `true` | Temporarily hide ticket |
381
+ | `externalMessages` | `true` | Add external messages |
382
+ | `clientHistory` | `true` | Past tickets sidebar |
383
+ | `activityLog` | `true` | Audit trail |
384
+ | `splitTicket` | `true` | Extract message to new ticket |
385
+ | `scheduledReplies` | `true` | Future message sending |
386
+ | `autoClose` | `true` | Close inactive tickets |
387
+ | `autoCloseDays` | `7` | Days before auto-close |
388
+ | `roundRobin` | `false` | Distribute tickets to agents |
389
+ | `sla` | `true` | SLA policies & alerts |
390
+ | `webhooks` | `true` | Outbound HTTP hooks |
391
+ | `macros` | `true` | Multi-action shortcuts |
392
+ | `customStatuses` | `false` | Configurable ticket statuses |
393
+ | `collisionDetection` | `true` | Multi-agent collision warning |
394
+ | `signatures` | `true` | Per-agent email signatures |
395
+ | `chatbot` | `true` | AI self-service chatbot |
396
+ | `bulkActions` | `true` | Bulk ticket operations |
397
+ | `commandPalette` | `true` | ⌘K search |
398
+ | `knowledgeBase` | `true` | FAQ / knowledge base |
399
+ | `pendingEmails` | `true` | Inbound email queue |
400
+ | `authLogs` | `true` | Authentication audit logs (v0.2.0) |
401
+
402
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
403
+
404
+ ## AI Providers
405
+
406
+ ### Anthropic (Claude)
407
+
408
+ ```ts
409
+ supportPlugin({
410
+ ai: {
411
+ provider: 'anthropic',
412
+ apiKey: process.env.ANTHROPIC_API_KEY,
413
+ model: 'claude-haiku-4-5-20251001', // fast & affordable
414
+ },
415
+ })
416
+ ```
417
+
418
+ ### OpenAI
419
+
420
+ ```ts
421
+ supportPlugin({
422
+ ai: {
423
+ provider: 'openai',
424
+ apiKey: process.env.OPENAI_API_KEY,
425
+ model: 'gpt-4o-mini',
426
+ },
427
+ })
428
+ ```
429
+
430
+ ### Ollama (self-hosted)
431
+
432
+ ```ts
433
+ supportPlugin({
434
+ ai: {
435
+ provider: 'ollama',
436
+ baseUrl: 'https://ollama.example.com',
437
+ model: 'qwen2.5:32b',
438
+ },
439
+ })
440
+ ```
441
+
442
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
443
+
444
+ ## Package Exports
445
+
446
+ ```ts
447
+ // Server — plugin, types, collections
448
+ import { supportPlugin, DEFAULT_FEATURES } from '@consilioweb/payload-support'
449
+ import type {
450
+ SupportPluginConfig,
451
+ SupportFeatures,
452
+ AIProviderConfig,
453
+ TicketData,
454
+ MessageData,
455
+ } from '@consilioweb/payload-support'
456
+
457
+ // Client — React components for Payload admin
458
+ import { /* components */ } from '@consilioweb/payload-support/client'
459
+
460
+ // Views — server components wrapped in DefaultTemplate
461
+ import { /* views */ } from '@consilioweb/payload-support/views'
462
+ ```
463
+
464
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
465
+
466
+ ## Roadmap
467
+
468
+ - Custom ticket statuses — dynamic workflow states instead of hardcoded open/waiting/resolved
469
+ - Snooze tickets — hide from inbox until a specified date
470
+ - Billing & invoicing — time-based billing, invoice PDF generation
471
+ - Knowledge base search — client portal FAQ with full-text search
472
+ - Email inbound processing — parse email replies into ticket messages
473
+ - Real-time typing indicators via SSE
474
+ - Canned responses / macros UI — quick reply templates in admin
475
+ - Dashboard analytics — charts, trends, response times, SLA compliance
476
+ - Multi-language client portal — full i18n beyond FR/EN
477
+ - File attachments on ticket messages
478
+ - Ticket tags & custom fields
479
+
480
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
481
+
482
+ ## Requirements
483
+
484
+ - **Node.js** >= 18
485
+ - **Payload CMS** 3.x
486
+ - **React** 18.x or 19.x
487
+ - **Database**: Any Payload-supported adapter (SQLite, PostgreSQL, MongoDB)
488
+
489
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
490
+
491
+ ## ☕ Support
492
+
493
+ If this plugin saves you time, consider buying me a coffee!
494
+
495
+ <a href="https://buymeacoffee.com/pown3d">
496
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="217" />
497
+ </a>
498
+
499
+ ## License
500
+
501
+ [MIT](LICENSE)
502
+
503
+ <img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
504
+
505
+ <div align="center">
506
+
507
+ ### Author
508
+
509
+ **Made with passion by [ConsilioWEB](https://consilioweb.fr)**
510
+
511
+ <a href="https://www.linkedin.com/in/christophe-lopez/">
512
+ <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn">
513
+ </a>
514
+ <a href="https://github.com/pOwn3d">
515
+ <img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white" alt="GitHub">
516
+ </a>
517
+ <a href="https://consilioweb.fr">
518
+ <img src="https://img.shields.io/badge/Website-consilioweb.fr-3B82F6?style=for-the-badge&logo=google-chrome&logoColor=white" alt="Website">
519
+ </a>
520
+
521
+ <br><br>
522
+
523
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&customColorList=6,11,20&height=100&section=footer" width="100%"/>
524
+
525
+ </div>
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ // src/client.ts
5
+ var SUPPORT_CLIENT_VERSION = "0.2.0";
6
+
7
+ exports.SUPPORT_CLIENT_VERSION = SUPPORT_CLIENT_VERSION;
@@ -0,0 +1,3 @@
1
+ declare const SUPPORT_CLIENT_VERSION = "0.2.0";
2
+
3
+ export { SUPPORT_CLIENT_VERSION };
@@ -0,0 +1,3 @@
1
+ declare const SUPPORT_CLIENT_VERSION = "0.2.0";
2
+
3
+ export { SUPPORT_CLIENT_VERSION };
package/dist/client.js ADDED
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ // src/client.ts
3
+ var SUPPORT_CLIENT_VERSION = "0.2.0";
4
+
5
+ export { SUPPORT_CLIENT_VERSION };