@consilioweb/payload-support 0.5.2 → 0.6.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.
- package/dist/components/TicketConversation.css +320 -0
- package/dist/components/TicketConversation.js +3004 -0
- package/dist/index.cjs +13 -13
- package/dist/index.js +13 -13
- package/dist/views.cjs +26 -14
- package/dist/views.js +14 -2
- package/package.json +6 -3
- package/src/collections/Tickets.ts +1 -1
- package/src/components/TicketConversation/index.tsx +21 -2
- package/src/plugin.ts +14 -13
- package/src/views.ts +16 -15
package/dist/index.cjs
CHANGED
|
@@ -5658,7 +5658,7 @@ function createTicketsCollection(slugs, options) {
|
|
|
5658
5658
|
type: "ui",
|
|
5659
5659
|
admin: {
|
|
5660
5660
|
components: {
|
|
5661
|
-
Field: options?.conversationComponent || "@consilioweb/payload-support/
|
|
5661
|
+
Field: options?.conversationComponent || "@consilioweb/payload-support/components/TicketConversation"
|
|
5662
5662
|
}
|
|
5663
5663
|
}
|
|
5664
5664
|
});
|
|
@@ -7657,7 +7657,7 @@ function supportPlugin(config) {
|
|
|
7657
7657
|
...config?.features
|
|
7658
7658
|
};
|
|
7659
7659
|
const bp = config?.basePath || "/support";
|
|
7660
|
-
const viewsBase = "@consilioweb/payload-support/
|
|
7660
|
+
const viewsBase = "@consilioweb/payload-support/views";
|
|
7661
7661
|
const slugs = resolveSlugs({
|
|
7662
7662
|
...config?.collectionSlugs,
|
|
7663
7663
|
users: config?.userCollectionSlug || "users"
|
|
@@ -7693,25 +7693,25 @@ function supportPlugin(config) {
|
|
|
7693
7693
|
if (features.pendingEmails) supportCollections.push(createPendingEmailsCollection(slugs));
|
|
7694
7694
|
const existingViews = incomingConfig.admin?.components?.views || {};
|
|
7695
7695
|
const supportViews = {
|
|
7696
|
-
"support-inbox": viewConfig(`${viewsBase}
|
|
7697
|
-
"support-dashboard": viewConfig(`${viewsBase}
|
|
7698
|
-
"support-ticket": viewConfig(`${viewsBase}
|
|
7699
|
-
"support-new-ticket": viewConfig(`${viewsBase}
|
|
7700
|
-
"support-settings": viewConfig(`${viewsBase}
|
|
7701
|
-
"support-logs": viewConfig(`${viewsBase}
|
|
7702
|
-
"support-crm": viewConfig(`${viewsBase}
|
|
7696
|
+
"support-inbox": viewConfig(`${viewsBase}#TicketInboxView`, `${bp}/inbox`),
|
|
7697
|
+
"support-dashboard": viewConfig(`${viewsBase}#SupportDashboardView`, `${bp}/dashboard`),
|
|
7698
|
+
"support-ticket": viewConfig(`${viewsBase}#TicketDetailView`, `${bp}/ticket`),
|
|
7699
|
+
"support-new-ticket": viewConfig(`${viewsBase}#NewTicketView`, `${bp}/new-ticket`),
|
|
7700
|
+
"support-settings": viewConfig(`${viewsBase}#TicketingSettingsView`, `${bp}/settings`),
|
|
7701
|
+
"support-logs": viewConfig(`${viewsBase}#LogsView`, `${bp}/logs`),
|
|
7702
|
+
"support-crm": viewConfig(`${viewsBase}#CrmView`, `${bp}/crm`)
|
|
7703
7703
|
};
|
|
7704
7704
|
if (features.chat) {
|
|
7705
|
-
supportViews["support-chat"] = viewConfig(`${viewsBase}
|
|
7705
|
+
supportViews["support-chat"] = viewConfig(`${viewsBase}#ChatView`, `${bp}/chat`);
|
|
7706
7706
|
}
|
|
7707
7707
|
if (features.pendingEmails) {
|
|
7708
|
-
supportViews["support-emails"] = viewConfig(`${viewsBase}
|
|
7708
|
+
supportViews["support-emails"] = viewConfig(`${viewsBase}#PendingEmailsView`, `${bp}/emails`);
|
|
7709
7709
|
}
|
|
7710
7710
|
if (features.emailTracking) {
|
|
7711
|
-
supportViews["support-tracking"] = viewConfig(`${viewsBase}
|
|
7711
|
+
supportViews["support-tracking"] = viewConfig(`${viewsBase}#EmailTrackingView`, `${bp}/tracking`);
|
|
7712
7712
|
}
|
|
7713
7713
|
if (features.timeTracking) {
|
|
7714
|
-
supportViews["support-time"] = viewConfig(`${viewsBase}
|
|
7714
|
+
supportViews["support-time"] = viewConfig(`${viewsBase}#TimeDashboardView`, `${bp}/time`);
|
|
7715
7715
|
}
|
|
7716
7716
|
const existingEndpoints = incomingConfig.endpoints || [];
|
|
7717
7717
|
const supportEndpoints = createSupportEndpoints(slugs, {
|
package/dist/index.js
CHANGED
|
@@ -5652,7 +5652,7 @@ function createTicketsCollection(slugs, options) {
|
|
|
5652
5652
|
type: "ui",
|
|
5653
5653
|
admin: {
|
|
5654
5654
|
components: {
|
|
5655
|
-
Field: options?.conversationComponent || "@consilioweb/payload-support/
|
|
5655
|
+
Field: options?.conversationComponent || "@consilioweb/payload-support/components/TicketConversation"
|
|
5656
5656
|
}
|
|
5657
5657
|
}
|
|
5658
5658
|
});
|
|
@@ -7651,7 +7651,7 @@ function supportPlugin(config) {
|
|
|
7651
7651
|
...config?.features
|
|
7652
7652
|
};
|
|
7653
7653
|
const bp = config?.basePath || "/support";
|
|
7654
|
-
const viewsBase = "@consilioweb/payload-support/
|
|
7654
|
+
const viewsBase = "@consilioweb/payload-support/views";
|
|
7655
7655
|
const slugs = resolveSlugs({
|
|
7656
7656
|
...config?.collectionSlugs,
|
|
7657
7657
|
users: config?.userCollectionSlug || "users"
|
|
@@ -7687,25 +7687,25 @@ function supportPlugin(config) {
|
|
|
7687
7687
|
if (features.pendingEmails) supportCollections.push(createPendingEmailsCollection(slugs));
|
|
7688
7688
|
const existingViews = incomingConfig.admin?.components?.views || {};
|
|
7689
7689
|
const supportViews = {
|
|
7690
|
-
"support-inbox": viewConfig(`${viewsBase}
|
|
7691
|
-
"support-dashboard": viewConfig(`${viewsBase}
|
|
7692
|
-
"support-ticket": viewConfig(`${viewsBase}
|
|
7693
|
-
"support-new-ticket": viewConfig(`${viewsBase}
|
|
7694
|
-
"support-settings": viewConfig(`${viewsBase}
|
|
7695
|
-
"support-logs": viewConfig(`${viewsBase}
|
|
7696
|
-
"support-crm": viewConfig(`${viewsBase}
|
|
7690
|
+
"support-inbox": viewConfig(`${viewsBase}#TicketInboxView`, `${bp}/inbox`),
|
|
7691
|
+
"support-dashboard": viewConfig(`${viewsBase}#SupportDashboardView`, `${bp}/dashboard`),
|
|
7692
|
+
"support-ticket": viewConfig(`${viewsBase}#TicketDetailView`, `${bp}/ticket`),
|
|
7693
|
+
"support-new-ticket": viewConfig(`${viewsBase}#NewTicketView`, `${bp}/new-ticket`),
|
|
7694
|
+
"support-settings": viewConfig(`${viewsBase}#TicketingSettingsView`, `${bp}/settings`),
|
|
7695
|
+
"support-logs": viewConfig(`${viewsBase}#LogsView`, `${bp}/logs`),
|
|
7696
|
+
"support-crm": viewConfig(`${viewsBase}#CrmView`, `${bp}/crm`)
|
|
7697
7697
|
};
|
|
7698
7698
|
if (features.chat) {
|
|
7699
|
-
supportViews["support-chat"] = viewConfig(`${viewsBase}
|
|
7699
|
+
supportViews["support-chat"] = viewConfig(`${viewsBase}#ChatView`, `${bp}/chat`);
|
|
7700
7700
|
}
|
|
7701
7701
|
if (features.pendingEmails) {
|
|
7702
|
-
supportViews["support-emails"] = viewConfig(`${viewsBase}
|
|
7702
|
+
supportViews["support-emails"] = viewConfig(`${viewsBase}#PendingEmailsView`, `${bp}/emails`);
|
|
7703
7703
|
}
|
|
7704
7704
|
if (features.emailTracking) {
|
|
7705
|
-
supportViews["support-tracking"] = viewConfig(`${viewsBase}
|
|
7705
|
+
supportViews["support-tracking"] = viewConfig(`${viewsBase}#EmailTrackingView`, `${bp}/tracking`);
|
|
7706
7706
|
}
|
|
7707
7707
|
if (features.timeTracking) {
|
|
7708
|
-
supportViews["support-time"] = viewConfig(`${viewsBase}
|
|
7708
|
+
supportViews["support-time"] = viewConfig(`${viewsBase}#TimeDashboardView`, `${bp}/time`);
|
|
7709
7709
|
}
|
|
7710
7710
|
const existingEndpoints = incomingConfig.endpoints || [];
|
|
7711
7711
|
const supportEndpoints = createSupportEndpoints(slugs, {
|
package/dist/views.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
var templates = require('@payloadcms/next/templates');
|
|
@@ -2186,6 +2185,7 @@ var TicketInboxView = ({ initPageResult }) => {
|
|
|
2186
2185
|
}
|
|
2187
2186
|
);
|
|
2188
2187
|
};
|
|
2188
|
+
var TicketInboxView_default = TicketInboxView;
|
|
2189
2189
|
|
|
2190
2190
|
// src/views/shared/config.ts
|
|
2191
2191
|
var DEFAULT_FEATURES = {
|
|
@@ -3073,6 +3073,7 @@ var TicketDetailView = ({ initPageResult }) => {
|
|
|
3073
3073
|
}
|
|
3074
3074
|
);
|
|
3075
3075
|
};
|
|
3076
|
+
var TicketDetailView_default = TicketDetailView;
|
|
3076
3077
|
function formatResponseTime(hours) {
|
|
3077
3078
|
if (hours == null) return "--";
|
|
3078
3079
|
const h = Math.floor(hours);
|
|
@@ -3381,6 +3382,7 @@ var SupportDashboardView = ({ initPageResult }) => {
|
|
|
3381
3382
|
}
|
|
3382
3383
|
);
|
|
3383
3384
|
};
|
|
3385
|
+
var SupportDashboardView_default = SupportDashboardView;
|
|
3384
3386
|
var CATEGORY_KEYS = [
|
|
3385
3387
|
{ value: "", key: "ticket.category.select" },
|
|
3386
3388
|
{ value: "bug", key: "ticket.category.bugFull" },
|
|
@@ -3614,6 +3616,7 @@ var NewTicketView = ({ initPageResult }) => {
|
|
|
3614
3616
|
}
|
|
3615
3617
|
);
|
|
3616
3618
|
};
|
|
3619
|
+
var NewTicketView_default = NewTicketView;
|
|
3617
3620
|
|
|
3618
3621
|
// src/views/shared/adminTokens.ts
|
|
3619
3622
|
var V = {
|
|
@@ -4525,6 +4528,7 @@ var TicketingSettingsView = ({ initPageResult }) => {
|
|
|
4525
4528
|
}
|
|
4526
4529
|
);
|
|
4527
4530
|
};
|
|
4531
|
+
var TicketingSettingsView_default = TicketingSettingsView;
|
|
4528
4532
|
function fmtDate(d) {
|
|
4529
4533
|
return new Date(d).toLocaleDateString("fr-FR", { day: "2-digit", month: "2-digit", year: "2-digit", hour: "2-digit", minute: "2-digit" });
|
|
4530
4534
|
}
|
|
@@ -4683,6 +4687,7 @@ var LogsView = ({ initPageResult }) => {
|
|
|
4683
4687
|
}
|
|
4684
4688
|
);
|
|
4685
4689
|
};
|
|
4690
|
+
var LogsView_default = LogsView;
|
|
4686
4691
|
var ChatViewClient = () => {
|
|
4687
4692
|
const { t } = useTranslation();
|
|
4688
4693
|
const [sessions, setSessions] = React13.useState({ active: [], closed: [] });
|
|
@@ -4948,6 +4953,7 @@ var ChatView = ({ initPageResult }) => {
|
|
|
4948
4953
|
}
|
|
4949
4954
|
);
|
|
4950
4955
|
};
|
|
4956
|
+
var ChatView_default = ChatView;
|
|
4951
4957
|
var statusLabelKeys = { open: "ticket.status.open", waiting_client: "ticket.status.waiting_client", resolved: "ticket.status.resolved" };
|
|
4952
4958
|
var statusColors = { open: "#3b82f6", waiting_client: "#f59e0b", resolved: "#22c55e" };
|
|
4953
4959
|
function formatDuration(minutes) {
|
|
@@ -5193,6 +5199,7 @@ var CrmView = ({ initPageResult }) => {
|
|
|
5193
5199
|
}
|
|
5194
5200
|
);
|
|
5195
5201
|
};
|
|
5202
|
+
var CrmView_default = CrmView;
|
|
5196
5203
|
function timeAgo4(dateStr) {
|
|
5197
5204
|
const diff = Date.now() - new Date(dateStr).getTime();
|
|
5198
5205
|
const mins = Math.floor(diff / 6e4);
|
|
@@ -5378,6 +5385,7 @@ var PendingEmailsView = ({ initPageResult }) => {
|
|
|
5378
5385
|
}
|
|
5379
5386
|
);
|
|
5380
5387
|
};
|
|
5388
|
+
var PendingEmailsView_default = PendingEmailsView;
|
|
5381
5389
|
var STATUS_CFG = {
|
|
5382
5390
|
success: { key: "emailTracking.status.success", bg: "#dcfce7", color: "#16a34a" },
|
|
5383
5391
|
error: { key: "emailTracking.status.error", bg: "#fef2f2", color: "#dc2626" },
|
|
@@ -5545,6 +5553,7 @@ var EmailTrackingView = ({ initPageResult }) => {
|
|
|
5545
5553
|
}
|
|
5546
5554
|
);
|
|
5547
5555
|
};
|
|
5556
|
+
var EmailTrackingView_default = EmailTrackingView;
|
|
5548
5557
|
function formatDuration2(minutes) {
|
|
5549
5558
|
const h = Math.floor(minutes / 60);
|
|
5550
5559
|
const m = minutes % 60;
|
|
@@ -5762,6 +5771,7 @@ var BillingView = ({ initPageResult }) => {
|
|
|
5762
5771
|
}
|
|
5763
5772
|
);
|
|
5764
5773
|
};
|
|
5774
|
+
var BillingView_default = BillingView;
|
|
5765
5775
|
function formatDuration3(minutes) {
|
|
5766
5776
|
const h = Math.floor(minutes / 60);
|
|
5767
5777
|
const m = minutes % 60;
|
|
@@ -5939,6 +5949,7 @@ var TimeDashboardView = ({ initPageResult }) => {
|
|
|
5939
5949
|
}
|
|
5940
5950
|
);
|
|
5941
5951
|
};
|
|
5952
|
+
var TimeDashboardView_default = TimeDashboardView;
|
|
5942
5953
|
function ImportConversationClient() {
|
|
5943
5954
|
const { t } = useTranslation();
|
|
5944
5955
|
const [markdown, setMarkdown] = React13.useState("");
|
|
@@ -6156,17 +6167,18 @@ var ImportConversationView = ({ initPageResult }) => {
|
|
|
6156
6167
|
}
|
|
6157
6168
|
);
|
|
6158
6169
|
};
|
|
6170
|
+
var ImportConversationView_default = ImportConversationView;
|
|
6159
6171
|
|
|
6160
|
-
exports.BillingView =
|
|
6161
|
-
exports.ChatView =
|
|
6162
|
-
exports.CrmView =
|
|
6163
|
-
exports.EmailTrackingView =
|
|
6164
|
-
exports.ImportConversationView =
|
|
6165
|
-
exports.LogsView =
|
|
6166
|
-
exports.NewTicketView =
|
|
6167
|
-
exports.PendingEmailsView =
|
|
6168
|
-
exports.SupportDashboardView =
|
|
6169
|
-
exports.TicketDetailView =
|
|
6170
|
-
exports.TicketInboxView =
|
|
6171
|
-
exports.TicketingSettingsView =
|
|
6172
|
-
exports.TimeDashboardView =
|
|
6172
|
+
exports.BillingView = BillingView_default;
|
|
6173
|
+
exports.ChatView = ChatView_default;
|
|
6174
|
+
exports.CrmView = CrmView_default;
|
|
6175
|
+
exports.EmailTrackingView = EmailTrackingView_default;
|
|
6176
|
+
exports.ImportConversationView = ImportConversationView_default;
|
|
6177
|
+
exports.LogsView = LogsView_default;
|
|
6178
|
+
exports.NewTicketView = NewTicketView_default;
|
|
6179
|
+
exports.PendingEmailsView = PendingEmailsView_default;
|
|
6180
|
+
exports.SupportDashboardView = SupportDashboardView_default;
|
|
6181
|
+
exports.TicketDetailView = TicketDetailView_default;
|
|
6182
|
+
exports.TicketInboxView = TicketInboxView_default;
|
|
6183
|
+
exports.TicketingSettingsView = TicketingSettingsView_default;
|
|
6184
|
+
exports.TimeDashboardView = TimeDashboardView_default;
|
package/dist/views.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { DefaultTemplate } from '@payloadcms/next/templates';
|
|
3
2
|
import { redirect, useSearchParams, useRouter } from 'next/navigation';
|
|
4
3
|
import React13, { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
@@ -2179,6 +2178,7 @@ var TicketInboxView = ({ initPageResult }) => {
|
|
|
2179
2178
|
}
|
|
2180
2179
|
);
|
|
2181
2180
|
};
|
|
2181
|
+
var TicketInboxView_default = TicketInboxView;
|
|
2182
2182
|
|
|
2183
2183
|
// src/views/shared/config.ts
|
|
2184
2184
|
var DEFAULT_FEATURES = {
|
|
@@ -3066,6 +3066,7 @@ var TicketDetailView = ({ initPageResult }) => {
|
|
|
3066
3066
|
}
|
|
3067
3067
|
);
|
|
3068
3068
|
};
|
|
3069
|
+
var TicketDetailView_default = TicketDetailView;
|
|
3069
3070
|
function formatResponseTime(hours) {
|
|
3070
3071
|
if (hours == null) return "--";
|
|
3071
3072
|
const h = Math.floor(hours);
|
|
@@ -3374,6 +3375,7 @@ var SupportDashboardView = ({ initPageResult }) => {
|
|
|
3374
3375
|
}
|
|
3375
3376
|
);
|
|
3376
3377
|
};
|
|
3378
|
+
var SupportDashboardView_default = SupportDashboardView;
|
|
3377
3379
|
var CATEGORY_KEYS = [
|
|
3378
3380
|
{ value: "", key: "ticket.category.select" },
|
|
3379
3381
|
{ value: "bug", key: "ticket.category.bugFull" },
|
|
@@ -3607,6 +3609,7 @@ var NewTicketView = ({ initPageResult }) => {
|
|
|
3607
3609
|
}
|
|
3608
3610
|
);
|
|
3609
3611
|
};
|
|
3612
|
+
var NewTicketView_default = NewTicketView;
|
|
3610
3613
|
|
|
3611
3614
|
// src/views/shared/adminTokens.ts
|
|
3612
3615
|
var V = {
|
|
@@ -4518,6 +4521,7 @@ var TicketingSettingsView = ({ initPageResult }) => {
|
|
|
4518
4521
|
}
|
|
4519
4522
|
);
|
|
4520
4523
|
};
|
|
4524
|
+
var TicketingSettingsView_default = TicketingSettingsView;
|
|
4521
4525
|
function fmtDate(d) {
|
|
4522
4526
|
return new Date(d).toLocaleDateString("fr-FR", { day: "2-digit", month: "2-digit", year: "2-digit", hour: "2-digit", minute: "2-digit" });
|
|
4523
4527
|
}
|
|
@@ -4676,6 +4680,7 @@ var LogsView = ({ initPageResult }) => {
|
|
|
4676
4680
|
}
|
|
4677
4681
|
);
|
|
4678
4682
|
};
|
|
4683
|
+
var LogsView_default = LogsView;
|
|
4679
4684
|
var ChatViewClient = () => {
|
|
4680
4685
|
const { t } = useTranslation();
|
|
4681
4686
|
const [sessions, setSessions] = useState({ active: [], closed: [] });
|
|
@@ -4941,6 +4946,7 @@ var ChatView = ({ initPageResult }) => {
|
|
|
4941
4946
|
}
|
|
4942
4947
|
);
|
|
4943
4948
|
};
|
|
4949
|
+
var ChatView_default = ChatView;
|
|
4944
4950
|
var statusLabelKeys = { open: "ticket.status.open", waiting_client: "ticket.status.waiting_client", resolved: "ticket.status.resolved" };
|
|
4945
4951
|
var statusColors = { open: "#3b82f6", waiting_client: "#f59e0b", resolved: "#22c55e" };
|
|
4946
4952
|
function formatDuration(minutes) {
|
|
@@ -5186,6 +5192,7 @@ var CrmView = ({ initPageResult }) => {
|
|
|
5186
5192
|
}
|
|
5187
5193
|
);
|
|
5188
5194
|
};
|
|
5195
|
+
var CrmView_default = CrmView;
|
|
5189
5196
|
function timeAgo4(dateStr) {
|
|
5190
5197
|
const diff = Date.now() - new Date(dateStr).getTime();
|
|
5191
5198
|
const mins = Math.floor(diff / 6e4);
|
|
@@ -5371,6 +5378,7 @@ var PendingEmailsView = ({ initPageResult }) => {
|
|
|
5371
5378
|
}
|
|
5372
5379
|
);
|
|
5373
5380
|
};
|
|
5381
|
+
var PendingEmailsView_default = PendingEmailsView;
|
|
5374
5382
|
var STATUS_CFG = {
|
|
5375
5383
|
success: { key: "emailTracking.status.success", bg: "#dcfce7", color: "#16a34a" },
|
|
5376
5384
|
error: { key: "emailTracking.status.error", bg: "#fef2f2", color: "#dc2626" },
|
|
@@ -5538,6 +5546,7 @@ var EmailTrackingView = ({ initPageResult }) => {
|
|
|
5538
5546
|
}
|
|
5539
5547
|
);
|
|
5540
5548
|
};
|
|
5549
|
+
var EmailTrackingView_default = EmailTrackingView;
|
|
5541
5550
|
function formatDuration2(minutes) {
|
|
5542
5551
|
const h = Math.floor(minutes / 60);
|
|
5543
5552
|
const m = minutes % 60;
|
|
@@ -5755,6 +5764,7 @@ var BillingView = ({ initPageResult }) => {
|
|
|
5755
5764
|
}
|
|
5756
5765
|
);
|
|
5757
5766
|
};
|
|
5767
|
+
var BillingView_default = BillingView;
|
|
5758
5768
|
function formatDuration3(minutes) {
|
|
5759
5769
|
const h = Math.floor(minutes / 60);
|
|
5760
5770
|
const m = minutes % 60;
|
|
@@ -5932,6 +5942,7 @@ var TimeDashboardView = ({ initPageResult }) => {
|
|
|
5932
5942
|
}
|
|
5933
5943
|
);
|
|
5934
5944
|
};
|
|
5945
|
+
var TimeDashboardView_default = TimeDashboardView;
|
|
5935
5946
|
function ImportConversationClient() {
|
|
5936
5947
|
const { t } = useTranslation();
|
|
5937
5948
|
const [markdown, setMarkdown] = useState("");
|
|
@@ -6149,5 +6160,6 @@ var ImportConversationView = ({ initPageResult }) => {
|
|
|
6149
6160
|
}
|
|
6150
6161
|
);
|
|
6151
6162
|
};
|
|
6163
|
+
var ImportConversationView_default = ImportConversationView;
|
|
6152
6164
|
|
|
6153
|
-
export { BillingView, ChatView, CrmView, EmailTrackingView, ImportConversationView, LogsView, NewTicketView, PendingEmailsView, SupportDashboardView, TicketDetailView, TicketInboxView, TicketingSettingsView, TimeDashboardView };
|
|
6165
|
+
export { BillingView_default as BillingView, ChatView_default as ChatView, CrmView_default as CrmView, EmailTrackingView_default as EmailTrackingView, ImportConversationView_default as ImportConversationView, LogsView_default as LogsView, NewTicketView_default as NewTicketView, PendingEmailsView_default as PendingEmailsView, SupportDashboardView_default as SupportDashboardView, TicketDetailView_default as TicketDetailView, TicketInboxView_default as TicketInboxView, TicketingSettingsView_default as TicketingSettingsView, TimeDashboardView_default as TimeDashboardView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consilioweb/payload-support",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Payload CMS plugin — professional support & ticketing system with AI, SLA, time tracking, live chat, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -37,8 +37,11 @@
|
|
|
37
37
|
"default": "./dist/views.cjs"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
"./
|
|
41
|
-
|
|
40
|
+
"./components/TicketConversation": {
|
|
41
|
+
"import": {
|
|
42
|
+
"default": "./dist/components/TicketConversation.js"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
42
45
|
},
|
|
43
46
|
"files": [
|
|
44
47
|
"dist",
|
|
@@ -440,7 +440,7 @@ export function createTicketsCollection(slugs: CollectionSlugs, options?: {
|
|
|
440
440
|
type: 'ui',
|
|
441
441
|
admin: {
|
|
442
442
|
components: {
|
|
443
|
-
Field: options?.conversationComponent || '@consilioweb/payload-support/
|
|
443
|
+
Field: options?.conversationComponent || '@consilioweb/payload-support/components/TicketConversation',
|
|
444
444
|
},
|
|
445
445
|
},
|
|
446
446
|
})
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import React, { useState, useEffect, useCallback, useRef } from 'react'
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// Replacement for @payloadcms/ui's useDocumentInfo — avoids importing
|
|
6
|
+
// @payloadcms/ui (which has chunk splits that break webpack resolution
|
|
7
|
+
// when this bundle is consumed from node_modules).
|
|
8
|
+
// Extracts the document id from the admin URL pattern:
|
|
9
|
+
// /admin/collections/:slug/:id or /admin/globals/:slug
|
|
10
|
+
function useDocumentIdFromUrl(): { id: string | number | undefined } {
|
|
11
|
+
const [id, setId] = useState<string | number | undefined>(undefined)
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const match = window.location.pathname.match(
|
|
14
|
+
/\/admin\/collections\/[^/]+\/([^/?#]+)/
|
|
15
|
+
)
|
|
16
|
+
if (match && match[1] !== 'create') {
|
|
17
|
+
const raw = match[1]
|
|
18
|
+
const num = Number(raw)
|
|
19
|
+
setId(Number.isFinite(num) && String(num) === raw ? num : raw)
|
|
20
|
+
}
|
|
21
|
+
}, [])
|
|
22
|
+
return { id }
|
|
23
|
+
}
|
|
5
24
|
import type { Message, TimeEntry, ClientInfo, CannedResponse, ActivityEntry, SatisfactionSurvey } from './types'
|
|
6
25
|
import type { RichTextEditorHandle } from './context'
|
|
7
26
|
import { C, s } from './constants'
|
|
@@ -64,7 +83,7 @@ const layoutStyles = {
|
|
|
64
83
|
}
|
|
65
84
|
|
|
66
85
|
const TicketConversation: React.FC = () => {
|
|
67
|
-
const { id } =
|
|
86
|
+
const { id } = useDocumentIdFromUrl()
|
|
68
87
|
const [features] = useState<TicketingFeatures>(() => getFeatures())
|
|
69
88
|
const [messages, setMessages] = useState<Message[]>([])
|
|
70
89
|
const [timeEntries, setTimeEntries] = useState<TimeEntry[]>([])
|
package/src/plugin.ts
CHANGED
|
@@ -54,8 +54,9 @@ export function supportPlugin(config?: SupportPluginConfig): Plugin {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const bp = config?.basePath || '/support'
|
|
57
|
-
//
|
|
58
|
-
|
|
57
|
+
// Use compiled subpath exports (one file per view) — avoids webpack
|
|
58
|
+
// issues with bundled 'use client' files from node_modules.
|
|
59
|
+
const viewsBase = '@consilioweb/payload-support/views'
|
|
59
60
|
const slugs = resolveSlugs({
|
|
60
61
|
...config?.collectionSlugs,
|
|
61
62
|
users: config?.userCollectionSlug || 'users',
|
|
@@ -105,26 +106,26 @@ export function supportPlugin(config?: SupportPluginConfig): Plugin {
|
|
|
105
106
|
(incomingConfig.admin?.components?.views as Record<string, AdminViewConfig>) || {}
|
|
106
107
|
|
|
107
108
|
const supportViews: Record<string, AdminViewConfig> = {
|
|
108
|
-
'support-inbox': viewConfig(`${viewsBase}
|
|
109
|
-
'support-dashboard': viewConfig(`${viewsBase}
|
|
110
|
-
'support-ticket': viewConfig(`${viewsBase}
|
|
111
|
-
'support-new-ticket': viewConfig(`${viewsBase}
|
|
112
|
-
'support-settings': viewConfig(`${viewsBase}
|
|
113
|
-
'support-logs': viewConfig(`${viewsBase}
|
|
114
|
-
'support-crm': viewConfig(`${viewsBase}
|
|
109
|
+
'support-inbox': viewConfig(`${viewsBase}#TicketInboxView`, `${bp}/inbox`),
|
|
110
|
+
'support-dashboard': viewConfig(`${viewsBase}#SupportDashboardView`, `${bp}/dashboard`),
|
|
111
|
+
'support-ticket': viewConfig(`${viewsBase}#TicketDetailView`, `${bp}/ticket`),
|
|
112
|
+
'support-new-ticket': viewConfig(`${viewsBase}#NewTicketView`, `${bp}/new-ticket`),
|
|
113
|
+
'support-settings': viewConfig(`${viewsBase}#TicketingSettingsView`, `${bp}/settings`),
|
|
114
|
+
'support-logs': viewConfig(`${viewsBase}#LogsView`, `${bp}/logs`),
|
|
115
|
+
'support-crm': viewConfig(`${viewsBase}#CrmView`, `${bp}/crm`),
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
if (features.chat) {
|
|
118
|
-
supportViews['support-chat'] = viewConfig(`${viewsBase}
|
|
119
|
+
supportViews['support-chat'] = viewConfig(`${viewsBase}#ChatView`, `${bp}/chat`)
|
|
119
120
|
}
|
|
120
121
|
if (features.pendingEmails) {
|
|
121
|
-
supportViews['support-emails'] = viewConfig(`${viewsBase}
|
|
122
|
+
supportViews['support-emails'] = viewConfig(`${viewsBase}#PendingEmailsView`, `${bp}/emails`)
|
|
122
123
|
}
|
|
123
124
|
if (features.emailTracking) {
|
|
124
|
-
supportViews['support-tracking'] = viewConfig(`${viewsBase}
|
|
125
|
+
supportViews['support-tracking'] = viewConfig(`${viewsBase}#EmailTrackingView`, `${bp}/tracking`)
|
|
125
126
|
}
|
|
126
127
|
if (features.timeTracking) {
|
|
127
|
-
supportViews['support-time'] = viewConfig(`${viewsBase}
|
|
128
|
+
supportViews['support-time'] = viewConfig(`${viewsBase}#TimeDashboardView`, `${bp}/time`)
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
// ─── Endpoints ───────────────────────────────────────
|
package/src/views.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
// Admin
|
|
2
|
-
//
|
|
1
|
+
// Admin views barrel — server components exported for Payload importMap
|
|
2
|
+
// Pattern copied from @consilioweb/payload-admin-theme which works reliably
|
|
3
|
+
// with Next.js transpilePackages.
|
|
3
4
|
|
|
4
|
-
export { TicketInboxView } from './views/TicketInboxView'
|
|
5
|
-
export { TicketDetailView } from './views/TicketDetailView'
|
|
6
|
-
export { SupportDashboardView } from './views/SupportDashboardView'
|
|
7
|
-
export { NewTicketView } from './views/NewTicketView'
|
|
8
|
-
export { TicketingSettingsView } from './views/TicketingSettingsView'
|
|
9
|
-
export { LogsView } from './views/LogsView'
|
|
10
|
-
export { ChatView } from './views/ChatView'
|
|
11
|
-
export { CrmView } from './views/CrmView'
|
|
12
|
-
export { PendingEmailsView } from './views/PendingEmailsView'
|
|
13
|
-
export { EmailTrackingView } from './views/EmailTrackingView'
|
|
14
|
-
export { BillingView } from './views/BillingView'
|
|
15
|
-
export { TimeDashboardView } from './views/TimeDashboardView'
|
|
16
|
-
export { ImportConversationView } from './views/ImportConversationView'
|
|
5
|
+
export { default as TicketInboxView } from './views/TicketInboxView/index'
|
|
6
|
+
export { default as TicketDetailView } from './views/TicketDetailView/index'
|
|
7
|
+
export { default as SupportDashboardView } from './views/SupportDashboardView/index'
|
|
8
|
+
export { default as NewTicketView } from './views/NewTicketView/index'
|
|
9
|
+
export { default as TicketingSettingsView } from './views/TicketingSettingsView/index'
|
|
10
|
+
export { default as LogsView } from './views/LogsView/index'
|
|
11
|
+
export { default as ChatView } from './views/ChatView/index'
|
|
12
|
+
export { default as CrmView } from './views/CrmView/index'
|
|
13
|
+
export { default as PendingEmailsView } from './views/PendingEmailsView/index'
|
|
14
|
+
export { default as EmailTrackingView } from './views/EmailTrackingView/index'
|
|
15
|
+
export { default as BillingView } from './views/BillingView/index'
|
|
16
|
+
export { default as TimeDashboardView } from './views/TimeDashboardView/index'
|
|
17
|
+
export { default as ImportConversationView } from './views/ImportConversationView/index'
|