@consilioweb/payload-support 0.6.0 → 0.6.2

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 (85) hide show
  1. package/dist/{styles/theme.css → components/TicketConversation.css} +13 -326
  2. package/dist/components/TicketConversation.js +3004 -0
  3. package/dist/index.cjs +11 -11
  4. package/dist/index.js +11 -11
  5. package/dist/views/BillingView/client.cjs +209 -0
  6. package/dist/views/BillingView/index.cjs +34 -0
  7. package/dist/views/ChatView/client.cjs +253 -0
  8. package/dist/views/ChatView/index.cjs +34 -0
  9. package/dist/views/CrmView/client.cjs +233 -0
  10. package/dist/views/CrmView/index.cjs +34 -0
  11. package/dist/views/EmailTrackingView/client.cjs +159 -0
  12. package/dist/views/EmailTrackingView/index.cjs +34 -0
  13. package/dist/views/ImportConversationView/client.cjs +205 -0
  14. package/dist/views/ImportConversationView/index.cjs +34 -0
  15. package/dist/views/LogsView/client.cjs +149 -0
  16. package/dist/views/LogsView/index.cjs +32 -0
  17. package/dist/views/NewTicketView/client.cjs +229 -0
  18. package/dist/views/NewTicketView/index.cjs +32 -0
  19. package/dist/views/PendingEmailsView/client.cjs +173 -0
  20. package/dist/views/PendingEmailsView/index.cjs +34 -0
  21. package/dist/views/SupportDashboardView/client.cjs +301 -0
  22. package/dist/views/SupportDashboardView/index.cjs +34 -0
  23. package/dist/views/TicketDetailView/client.cjs +850 -0
  24. package/dist/views/TicketDetailView/index.cjs +34 -0
  25. package/dist/views/TicketInboxView/client.cjs +299 -0
  26. package/dist/views/TicketInboxView/index.cjs +32 -0
  27. package/dist/views/TicketingSettingsView/client.cjs +733 -0
  28. package/dist/views/TicketingSettingsView/index.cjs +34 -0
  29. package/dist/views/TimeDashboardView/client.cjs +169 -0
  30. package/dist/views/TimeDashboardView/index.cjs +34 -0
  31. package/dist/views/shared/AdminViewHeader.cjs +68 -0
  32. package/dist/views/shared/ErrorBoundary.cjs +55 -0
  33. package/dist/views/shared/Skeleton.cjs +77 -0
  34. package/dist/views/shared/adminTokens.cjs +34 -0
  35. package/dist/views/shared/adminTokens.js +0 -1
  36. package/dist/{components/TicketConversation/config.js → views/shared/config.cjs} +5 -2
  37. package/dist/views/shared/config.js +0 -1
  38. package/dist/views/shared/index.cjs +58 -0
  39. package/dist/views/shared/index.js +0 -1
  40. package/dist/views.cjs +86 -0
  41. package/dist/views.d.cts +13 -0
  42. package/dist/views.d.ts +13 -0
  43. package/dist/views.js +13 -0
  44. package/package.json +14 -7
  45. package/src/plugin.ts +11 -11
  46. package/src/views.ts +17 -0
  47. package/dist/components/TicketConversation/components/AISummaryPanel.js +0 -76
  48. package/dist/components/TicketConversation/components/ActionPanels.js +0 -118
  49. package/dist/components/TicketConversation/components/ActivityLog.js +0 -23
  50. package/dist/components/TicketConversation/components/ClientBar.js +0 -42
  51. package/dist/components/TicketConversation/components/ClientHistory.js +0 -137
  52. package/dist/components/TicketConversation/components/CodeBlock.js +0 -152
  53. package/dist/components/TicketConversation/components/CodeBlockInserter.js +0 -155
  54. package/dist/components/TicketConversation/components/QuickActions.js +0 -65
  55. package/dist/components/TicketConversation/components/TicketHeader.js +0 -92
  56. package/dist/components/TicketConversation/components/TimeTrackingPanel.js +0 -133
  57. package/dist/components/TicketConversation/constants.js +0 -96
  58. package/dist/components/TicketConversation/context.js +0 -11
  59. package/dist/components/TicketConversation/hooks/useAI.js +0 -176
  60. package/dist/components/TicketConversation/hooks/useMessageActions.js +0 -135
  61. package/dist/components/TicketConversation/hooks/useReply.js +0 -187
  62. package/dist/components/TicketConversation/hooks/useTicketActions.js +0 -230
  63. package/dist/components/TicketConversation/hooks/useTimeTracking.js +0 -122
  64. package/dist/components/TicketConversation/hooks/useTranslation.js +0 -70
  65. package/dist/components/TicketConversation/index.js +0 -1123
  66. package/dist/components/TicketConversation/locales/en.json +0 -878
  67. package/dist/components/TicketConversation/locales/fr.json +0 -878
  68. package/dist/components/TicketConversation/types.js +0 -2
  69. package/dist/components/TicketConversation/utils.js +0 -25
  70. package/dist/styles/BillingView.module.scss +0 -311
  71. package/dist/styles/ChatView.module.scss +0 -438
  72. package/dist/styles/CommandPalette.module.scss +0 -160
  73. package/dist/styles/CrmView.module.scss +0 -554
  74. package/dist/styles/EmailTracking.module.scss +0 -238
  75. package/dist/styles/ImportConversation.module.scss +0 -267
  76. package/dist/styles/Layout.module.scss +0 -55
  77. package/dist/styles/Logs.module.scss +0 -164
  78. package/dist/styles/NewTicket.module.scss +0 -143
  79. package/dist/styles/PendingEmails.module.scss +0 -629
  80. package/dist/styles/SupportDashboard.module.scss +0 -649
  81. package/dist/styles/TicketDetail.module.scss +0 -1050
  82. package/dist/styles/TicketInbox.module.scss +0 -296
  83. package/dist/styles/TicketingSettings.module.scss +0 -358
  84. package/dist/styles/TimeDashboard.module.scss +0 -287
  85. package/dist/styles/_tokens.scss +0 -78
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var templates = require('@payloadcms/next/templates');
7
+ var navigation = require('next/navigation');
8
+ var ErrorBoundary = require('../shared/ErrorBoundary');
9
+ var client = require('./client');
10
+
11
+ const TicketingSettingsView = ({ initPageResult }) => {
12
+ const { req, visibleEntities } = initPageResult;
13
+ if (!req.user) {
14
+ navigation.redirect("/admin/login");
15
+ }
16
+ return /* @__PURE__ */ jsxRuntime.jsx(
17
+ templates.DefaultTemplate,
18
+ {
19
+ i18n: req.i18n,
20
+ locale: initPageResult.locale,
21
+ params: {},
22
+ payload: req.payload,
23
+ permissions: initPageResult.permissions,
24
+ searchParams: {},
25
+ user: req.user,
26
+ visibleEntities,
27
+ children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary.AdminErrorBoundary, { viewName: "TicketingSettingsView", children: /* @__PURE__ */ jsxRuntime.jsx(client.TicketingSettingsClient, {}) })
28
+ }
29
+ );
30
+ };
31
+ var TicketingSettingsView_default = TicketingSettingsView;
32
+
33
+ exports.TicketingSettingsView = TicketingSettingsView;
34
+ exports.default = TicketingSettingsView_default;
@@ -0,0 +1,169 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var useTranslation = require('../../components/TicketConversation/hooks/useTranslation');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefault(React);
10
+
11
+ function formatDuration(minutes) {
12
+ const h = Math.floor(minutes / 60);
13
+ const m = minutes % 60;
14
+ if (h === 0) return `${m}min`;
15
+ if (m === 0) return `${h}h`;
16
+ return `${h}h${m}m`;
17
+ }
18
+ function getWeekNumber(d) {
19
+ const oneJan = new Date(d.getFullYear(), 0, 1);
20
+ return Math.ceil(((d.getTime() - oneJan.getTime()) / 864e5 + oneJan.getDay() + 1) / 7);
21
+ }
22
+ function getMonthRange(offset) {
23
+ const now = /* @__PURE__ */ new Date();
24
+ const start = new Date(now.getFullYear(), now.getMonth() + offset, 1);
25
+ const end = new Date(now.getFullYear(), now.getMonth() + offset + 1, 0);
26
+ return { from: start.toISOString().split("T")[0], to: end.toISOString().split("T")[0] };
27
+ }
28
+ const MONTHS_FR = ["Jan", "Fev", "Mar", "Avr", "Mai", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"];
29
+ const TimeDashboardClient = () => {
30
+ const { t } = useTranslation.useTranslation();
31
+ const [entries, setEntries] = React.useState([]);
32
+ const [loading, setLoading] = React.useState(true);
33
+ const [from, setFrom] = React.useState(() => getMonthRange(0).from);
34
+ const [to, setTo] = React.useState(() => getMonthRange(0).to);
35
+ const [groupBy, setGroupBy] = React.useState("day");
36
+ const fetchEntries = React.useCallback(async () => {
37
+ setLoading(true);
38
+ try {
39
+ const params = new URLSearchParams({ limit: "500", depth: "2", sort: "-date" });
40
+ if (from) params.set("where[date][greater_than_equal]", from);
41
+ if (to) params.set("where[date][less_than_equal]", to);
42
+ const res = await fetch(`/api/time-entries?${params}`);
43
+ if (res.ok) {
44
+ const json = await res.json();
45
+ setEntries(json.docs || []);
46
+ }
47
+ } catch {
48
+ }
49
+ setLoading(false);
50
+ }, [from, to]);
51
+ React.useEffect(() => {
52
+ fetchEntries();
53
+ }, [fetchEntries]);
54
+ const totalMinutes = entries.reduce((sum, e) => sum + (e.duration || 0), 0);
55
+ const grouped = React__default.default.useMemo(() => {
56
+ const map = /* @__PURE__ */ new Map();
57
+ for (const entry of entries) {
58
+ let key;
59
+ if (groupBy === "day") {
60
+ key = entry.date ? entry.date.split("T")[0] : "Sans date";
61
+ } else if (groupBy === "week") {
62
+ const d = new Date(entry.date);
63
+ key = `Semaine ${getWeekNumber(d)} (${MONTHS_FR[d.getMonth()]} ${d.getFullYear()})`;
64
+ } else {
65
+ const ticket = typeof entry.ticket === "object" ? entry.ticket : null;
66
+ const project = ticket && typeof ticket.project === "object" ? ticket.project : null;
67
+ key = project?.name || "Sans projet";
68
+ }
69
+ if (!map.has(key)) map.set(key, []);
70
+ map.get(key).push(entry);
71
+ }
72
+ return Array.from(map.entries()).map(([label, items]) => ({ label, entries: items, totalMinutes: items.reduce((sum, e) => sum + (e.duration || 0), 0) }));
73
+ }, [entries, groupBy]);
74
+ const dailyChart = React__default.default.useMemo(() => {
75
+ const dayMap = /* @__PURE__ */ new Map();
76
+ for (const entry of entries) {
77
+ const day = entry.date ? entry.date.split("T")[0] : null;
78
+ if (day) dayMap.set(day, (dayMap.get(day) || 0) + (entry.duration || 0));
79
+ }
80
+ return Array.from(dayMap.entries()).sort(([a], [b]) => a.localeCompare(b)).slice(-30).map(([day, mins]) => ({ day, minutes: mins }));
81
+ }, [entries]);
82
+ const maxDailyMinutes = Math.max(...dailyChart.map((d) => d.minutes), 1);
83
+ const setPeriod = (range) => {
84
+ setFrom(range.from);
85
+ setTo(range.to);
86
+ };
87
+ const S = {
88
+ page: { padding: "20px 30px", maxWidth: 1100, margin: "0 auto" },
89
+ btn: { padding: "6px 12px", borderRadius: 6, border: "1px solid var(--theme-elevation-200)", fontSize: 12, cursor: "pointer", background: "var(--theme-elevation-0)", color: "var(--theme-text)" },
90
+ btnPrimary: { padding: "6px 12px", borderRadius: 6, border: "none", fontSize: 12, cursor: "pointer", background: "#2563eb", color: "#fff", fontWeight: 600 },
91
+ kpis: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 12, marginBottom: 20 },
92
+ kpiCard: { padding: "16px 20px", borderRadius: 10, border: "1px solid var(--theme-elevation-150)" },
93
+ groupCard: { marginBottom: 12, borderRadius: 10, border: "1px solid var(--theme-elevation-150)", overflow: "hidden" },
94
+ groupHeader: { display: "flex", justifyContent: "space-between", padding: "10px 16px", background: "var(--theme-elevation-50)", borderBottom: "1px solid var(--theme-elevation-150)" },
95
+ table: { width: "100%", borderCollapse: "collapse", fontSize: 12 },
96
+ td: { padding: "6px 8px", borderBottom: "1px solid var(--theme-elevation-100)" }
97
+ };
98
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.page, children: [
99
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }, children: [
100
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
101
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { style: { fontSize: 22, fontWeight: 700, margin: 0 }, children: t("timeDashboard.title") }),
102
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: 13, color: "var(--theme-elevation-500)", margin: "4px 0 0" }, children: t("timeDashboard.subtitle") })
103
+ ] }),
104
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: "/admin/collections/time-entries/create", style: { ...S.btnPrimary, textDecoration: "none", display: "inline-block" }, children: t("timeDashboard.newEntry") })
105
+ ] }),
106
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 16 }, children: [
107
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 6, marginBottom: 8 }, children: [
108
+ /* @__PURE__ */ jsxRuntime.jsx("button", { style: S.btnPrimary, onClick: () => setPeriod(getMonthRange(0)), children: t("timeDashboard.filters.thisMonth") }),
109
+ /* @__PURE__ */ jsxRuntime.jsx("button", { style: S.btn, onClick: () => setPeriod(getMonthRange(-1)), children: t("timeDashboard.filters.lastMonth") }),
110
+ /* @__PURE__ */ jsxRuntime.jsx("button", { style: S.btn, onClick: () => setPeriod(getMonthRange(-2)), children: t("timeDashboard.filters.twoMonthsAgo") })
111
+ ] }),
112
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 12, alignItems: "flex-end" }, children: [
113
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
114
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, display: "block", marginBottom: 4, color: "var(--theme-elevation-500)" }, children: t("timeDashboard.filters.from") }),
115
+ /* @__PURE__ */ jsxRuntime.jsx("input", { type: "date", value: from, onChange: (e) => setFrom(e.target.value), style: { padding: "6px 10px", borderRadius: 6, border: "1px solid var(--theme-elevation-200)", fontSize: 12, color: "var(--theme-text)", background: "var(--theme-elevation-0)" } })
116
+ ] }),
117
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
118
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, display: "block", marginBottom: 4, color: "var(--theme-elevation-500)" }, children: t("timeDashboard.filters.to") }),
119
+ /* @__PURE__ */ jsxRuntime.jsx("input", { type: "date", value: to, onChange: (e) => setTo(e.target.value), style: { padding: "6px 10px", borderRadius: 6, border: "1px solid var(--theme-elevation-200)", fontSize: 12, color: "var(--theme-text)", background: "var(--theme-elevation-0)" } })
120
+ ] }),
121
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
122
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, display: "block", marginBottom: 4, color: "var(--theme-elevation-500)" }, children: t("timeDashboard.filters.groupBy") }),
123
+ /* @__PURE__ */ jsxRuntime.jsxs("select", { value: groupBy, onChange: (e) => setGroupBy(e.target.value), style: { padding: "6px 10px", borderRadius: 6, border: "1px solid var(--theme-elevation-200)", fontSize: 12, color: "var(--theme-text)", background: "var(--theme-elevation-0)" }, children: [
124
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "day", children: t("timeDashboard.filters.day") }),
125
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "week", children: t("timeDashboard.filters.week") }),
126
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "project", children: t("timeDashboard.filters.project") })
127
+ ] })
128
+ ] })
129
+ ] })
130
+ ] }),
131
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 40, textAlign: "center", color: "#94a3b8" }, children: t("common.loading") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
132
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.kpis, children: [
133
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.kpiCard, children: [
134
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, color: "var(--theme-elevation-500)" }, children: t("timeDashboard.kpis.totalTime") }),
135
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 24, fontWeight: 700, color: "#2563eb" }, children: formatDuration(totalMinutes) })
136
+ ] }),
137
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.kpiCard, children: [
138
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, color: "var(--theme-elevation-500)" }, children: t("timeDashboard.kpis.entries") }),
139
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 24, fontWeight: 700, color: "#d97706" }, children: entries.length })
140
+ ] }),
141
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.kpiCard, children: [
142
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, color: "var(--theme-elevation-500)" }, children: t("timeDashboard.kpis.dailyAverage") }),
143
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 24, fontWeight: 700, color: "#ea580c" }, children: dailyChart.length > 0 ? formatDuration(Math.round(totalMinutes / dailyChart.length)) : "-" })
144
+ ] })
145
+ ] }),
146
+ dailyChart.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: 16, borderRadius: 10, border: "1px solid var(--theme-elevation-150)", marginBottom: 20 }, children: [
147
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 700, marginBottom: 8 }, children: t("timeDashboard.chart.title") }),
148
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "flex-end", gap: 3, height: 80 }, children: dailyChart.map((d) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, background: "#3b82f6", borderRadius: "3px 3px 0 0", height: `${Math.max(d.minutes / maxDailyMinutes * 100, 4)}%` }, title: `${d.day}: ${formatDuration(d.minutes)}` }, d.day)) })
149
+ ] }),
150
+ grouped.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 40, textAlign: "center", color: "#94a3b8" }, children: t("timeDashboard.empty") }) : grouped.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.groupCard, children: [
151
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.groupHeader, children: [
152
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 700 }, children: group.label }),
153
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 700, color: "#2563eb" }, children: formatDuration(group.totalMinutes) })
154
+ ] }),
155
+ /* @__PURE__ */ jsxRuntime.jsx("table", { style: S.table, children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: group.entries.map((entry) => {
156
+ const ticket = typeof entry.ticket === "object" ? entry.ticket : null;
157
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
158
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: S.td, children: ticket ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: `/admin/collections/tickets/${ticket.id}`, style: { color: "#2563eb", textDecoration: "none", fontWeight: 600 }, children: ticket.ticketNumber || `#${ticket.id}` }) : "-" }),
159
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: S.td, children: ticket?.subject || "" }),
160
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { ...S.td, color: "var(--theme-elevation-500)" }, children: entry.description || "-" }),
161
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { ...S.td, textAlign: "right", fontWeight: 600 }, children: formatDuration(entry.duration) })
162
+ ] }, entry.id);
163
+ }) }) })
164
+ ] }, group.label))
165
+ ] })
166
+ ] });
167
+ };
168
+
169
+ exports.TimeDashboardClient = TimeDashboardClient;
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var templates = require('@payloadcms/next/templates');
7
+ var navigation = require('next/navigation');
8
+ var ErrorBoundary = require('../shared/ErrorBoundary');
9
+ var client = require('./client');
10
+
11
+ const TimeDashboardView = ({ initPageResult }) => {
12
+ const { req, visibleEntities } = initPageResult;
13
+ if (!req.user) {
14
+ navigation.redirect("/admin/login");
15
+ }
16
+ return /* @__PURE__ */ jsxRuntime.jsx(
17
+ templates.DefaultTemplate,
18
+ {
19
+ i18n: req.i18n,
20
+ locale: initPageResult.locale,
21
+ params: {},
22
+ payload: req.payload,
23
+ permissions: initPageResult.permissions,
24
+ searchParams: {},
25
+ user: req.user,
26
+ visibleEntities,
27
+ children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary.AdminErrorBoundary, { viewName: "TimeDashboardView", children: /* @__PURE__ */ jsxRuntime.jsx(client.TimeDashboardClient, {}) })
28
+ }
29
+ );
30
+ };
31
+ var TimeDashboardView_default = TimeDashboardView;
32
+
33
+ exports.TimeDashboardView = TimeDashboardView;
34
+ exports.default = TimeDashboardView_default;
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var adminTokens = require('./adminTokens');
5
+
6
+ const AdminViewHeader = ({
7
+ icon,
8
+ title,
9
+ subtitle,
10
+ breadcrumb,
11
+ actions
12
+ }) => {
13
+ return /* @__PURE__ */ jsxRuntime.jsxs(
14
+ "div",
15
+ {
16
+ style: {
17
+ display: "flex",
18
+ justifyContent: "space-between",
19
+ alignItems: "flex-start",
20
+ marginBottom: 20
21
+ },
22
+ children: [
23
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
24
+ breadcrumb && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
25
+ "a",
26
+ {
27
+ href: breadcrumb.href,
28
+ style: {
29
+ fontSize: 12,
30
+ fontWeight: 700,
31
+ color: adminTokens.V.cyan,
32
+ textDecoration: "none",
33
+ textTransform: "uppercase"
34
+ },
35
+ children: [
36
+ "\u2190 ",
37
+ breadcrumb.label
38
+ ]
39
+ }
40
+ ) }),
41
+ /* @__PURE__ */ jsxRuntime.jsxs(
42
+ "h1",
43
+ {
44
+ style: {
45
+ fontSize: 28,
46
+ fontWeight: 600,
47
+ letterSpacing: 0,
48
+ margin: 0,
49
+ color: adminTokens.V.text,
50
+ display: "flex",
51
+ alignItems: "center",
52
+ gap: 10
53
+ },
54
+ children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: adminTokens.V.cyan, display: "flex", alignItems: "center" }, children: icon }),
56
+ title
57
+ ]
58
+ }
59
+ ),
60
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: adminTokens.V.textSecondary, margin: "4px 0 0", fontSize: 14 }, children: subtitle })
61
+ ] }),
62
+ actions && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 8 }, children: actions })
63
+ ]
64
+ }
65
+ );
66
+ };
67
+
68
+ exports.AdminViewHeader = AdminViewHeader;
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var React__default = /*#__PURE__*/_interopDefault(React);
9
+
10
+ class AdminErrorBoundary extends React__default.default.Component {
11
+ constructor(props) {
12
+ super(props);
13
+ this.state = { hasError: false, error: null };
14
+ }
15
+ static getDerivedStateFromError(error) {
16
+ return { hasError: true, error };
17
+ }
18
+ componentDidCatch(error, errorInfo) {
19
+ console.error(`[${this.props.viewName || "AdminView"}] Error:`, error, errorInfo);
20
+ }
21
+ render() {
22
+ if (this.state.hasError) {
23
+ if (this.props.fallback) {
24
+ return this.props.fallback;
25
+ }
26
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
27
+ padding: "40px",
28
+ textAlign: "center",
29
+ color: "#dc2626"
30
+ }, children: [
31
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { marginBottom: "16px", fontSize: "18px" }, children: "Une erreur est survenue" }),
32
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { marginBottom: "24px", color: "#6b7280", fontSize: "14px" }, children: this.state.error?.message || "Erreur inattendue" }),
33
+ /* @__PURE__ */ jsxRuntime.jsx(
34
+ "button",
35
+ {
36
+ onClick: () => this.setState({ hasError: false, error: null }),
37
+ style: {
38
+ padding: "8px 20px",
39
+ backgroundColor: "#2563eb",
40
+ color: "#fff",
41
+ border: "none",
42
+ borderRadius: "6px",
43
+ cursor: "pointer",
44
+ fontSize: "14px"
45
+ },
46
+ children: "Reessayer"
47
+ }
48
+ )
49
+ ] });
50
+ }
51
+ return this.props.children;
52
+ }
53
+ }
54
+
55
+ exports.AdminErrorBoundary = AdminErrorBoundary;
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+
6
+ const styleId = "skeleton-shimmer-style";
7
+ function injectSkeletonStyles() {
8
+ if (typeof document === "undefined") return;
9
+ if (document.getElementById(styleId)) return;
10
+ const style = document.createElement("style");
11
+ style.id = styleId;
12
+ style.textContent = `
13
+ @keyframes skeleton-shimmer {
14
+ 0% { background-position: 200% 0; }
15
+ 100% { background-position: -200% 0; }
16
+ }
17
+ `;
18
+ document.head.appendChild(style);
19
+ }
20
+ function Skeleton({ width = "100%", height = "20px", borderRadius = "4px", style }) {
21
+ react.useEffect(() => {
22
+ injectSkeletonStyles();
23
+ }, []);
24
+ return /* @__PURE__ */ jsxRuntime.jsx(
25
+ "div",
26
+ {
27
+ style: {
28
+ width,
29
+ height,
30
+ borderRadius,
31
+ background: "linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%)",
32
+ backgroundSize: "200% 100%",
33
+ animation: "skeleton-shimmer 1.5s infinite",
34
+ ...style
35
+ }
36
+ }
37
+ );
38
+ }
39
+ function SkeletonText({ lines = 3, width = "100%" }) {
40
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px", width }, children: Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "16px", width: i === lines - 1 ? "60%" : "100%" }, i)) });
41
+ }
42
+ function SkeletonCard({ height = "200px" }) {
43
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
44
+ border: "1px solid #e5e7eb",
45
+ borderRadius: "8px",
46
+ padding: "20px",
47
+ display: "flex",
48
+ flexDirection: "column",
49
+ gap: "12px",
50
+ minHeight: height
51
+ }, children: [
52
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "24px", width: "40%" }),
53
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText, { lines: 3 }),
54
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "32px", width: "120px", borderRadius: "6px" })
55
+ ] });
56
+ }
57
+ function SkeletonTable({ rows = 5, columns = 4 }) {
58
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%" }, children: [
59
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: "16px", padding: "12px 0", borderBottom: "2px solid #e5e7eb" }, children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "16px", width: `${100 / columns}%` }, i)) }),
60
+ Array.from({ length: rows }).map((_, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: "16px", padding: "12px 0", borderBottom: "1px solid #f3f4f6" }, children: Array.from({ length: columns }).map((_2, colIdx) => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "14px", width: `${100 / columns}%` }, colIdx)) }, rowIdx))
61
+ ] });
62
+ }
63
+ function SkeletonDashboard() {
64
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "24px", padding: "20px 0" }, children: [
65
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))", gap: "16px" }, children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "20px", border: "1px solid #e5e7eb", borderRadius: "8px" }, children: [
66
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "14px", width: "60%", style: { marginBottom: "8px" } }),
67
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { height: "32px", width: "40%" })
68
+ ] }, i)) }),
69
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonTable, { rows: 5, columns: 4 })
70
+ ] });
71
+ }
72
+
73
+ exports.Skeleton = Skeleton;
74
+ exports.SkeletonCard = SkeletonCard;
75
+ exports.SkeletonDashboard = SkeletonDashboard;
76
+ exports.SkeletonTable = SkeletonTable;
77
+ exports.SkeletonText = SkeletonText;
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ const V = {
4
+ text: "var(--theme-text)",
5
+ textSecondary: "var(--theme-elevation-500)",
6
+ bg: "var(--theme-elevation-50)",
7
+ bgCard: "var(--theme-elevation-100)",
8
+ border: "var(--theme-elevation-300)",
9
+ // Professional palette
10
+ blue: "#2563eb",
11
+ amber: "#d97706",
12
+ orange: "#ea580c",
13
+ green: "#16a34a",
14
+ red: "#dc2626",
15
+ // Legacy aliases (backward compat for views not yet updated)
16
+ cyan: "#2563eb",
17
+ yellow: "#d97706"
18
+ };
19
+ const btnStyle = (bg, opts) => ({
20
+ padding: opts?.small ? "6px 12px" : "8px 14px",
21
+ borderRadius: 6,
22
+ border: `1px solid var(--theme-elevation-300)`,
23
+ backgroundColor: bg,
24
+ color: "#fff",
25
+ fontWeight: 600,
26
+ fontSize: opts?.small ? 12 : 13,
27
+ cursor: opts?.disabled ? "not-allowed" : "pointer",
28
+ opacity: opts?.disabled ? 0.5 : 1,
29
+ textDecoration: "none",
30
+ whiteSpace: "nowrap"
31
+ });
32
+
33
+ exports.V = V;
34
+ exports.btnStyle = btnStyle;
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  const V = {
3
2
  text: "var(--theme-text)",
4
3
  textSecondary: "var(--theme-elevation-500)",
@@ -1,4 +1,5 @@
1
- "use client";
1
+ 'use strict';
2
+
2
3
  const DEFAULT_FEATURES = {
3
4
  timeTracking: true,
4
5
  ai: true,
@@ -38,4 +39,6 @@ function saveFeatures(features) {
38
39
  }
39
40
  }
40
41
 
41
- export { DEFAULT_FEATURES, getFeatures, saveFeatures };
42
+ exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
43
+ exports.getFeatures = getFeatures;
44
+ exports.saveFeatures = saveFeatures;
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  const DEFAULT_FEATURES = {
3
2
  timeTracking: true,
4
3
  ai: true,
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var ErrorBoundary = require('./ErrorBoundary');
4
+ var adminTokens = require('./adminTokens');
5
+ var AdminViewHeader = require('./AdminViewHeader');
6
+ var Skeleton = require('./Skeleton');
7
+ var config = require('./config');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "AdminErrorBoundary", {
12
+ enumerable: true,
13
+ get: function () { return ErrorBoundary.AdminErrorBoundary; }
14
+ });
15
+ Object.defineProperty(exports, "V", {
16
+ enumerable: true,
17
+ get: function () { return adminTokens.V; }
18
+ });
19
+ Object.defineProperty(exports, "btnStyle", {
20
+ enumerable: true,
21
+ get: function () { return adminTokens.btnStyle; }
22
+ });
23
+ Object.defineProperty(exports, "AdminViewHeader", {
24
+ enumerable: true,
25
+ get: function () { return AdminViewHeader.AdminViewHeader; }
26
+ });
27
+ Object.defineProperty(exports, "Skeleton", {
28
+ enumerable: true,
29
+ get: function () { return Skeleton.Skeleton; }
30
+ });
31
+ Object.defineProperty(exports, "SkeletonCard", {
32
+ enumerable: true,
33
+ get: function () { return Skeleton.SkeletonCard; }
34
+ });
35
+ Object.defineProperty(exports, "SkeletonDashboard", {
36
+ enumerable: true,
37
+ get: function () { return Skeleton.SkeletonDashboard; }
38
+ });
39
+ Object.defineProperty(exports, "SkeletonTable", {
40
+ enumerable: true,
41
+ get: function () { return Skeleton.SkeletonTable; }
42
+ });
43
+ Object.defineProperty(exports, "SkeletonText", {
44
+ enumerable: true,
45
+ get: function () { return Skeleton.SkeletonText; }
46
+ });
47
+ Object.defineProperty(exports, "DEFAULT_FEATURES", {
48
+ enumerable: true,
49
+ get: function () { return config.DEFAULT_FEATURES; }
50
+ });
51
+ Object.defineProperty(exports, "getFeatures", {
52
+ enumerable: true,
53
+ get: function () { return config.getFeatures; }
54
+ });
55
+ Object.defineProperty(exports, "saveFeatures", {
56
+ enumerable: true,
57
+ get: function () { return config.saveFeatures; }
58
+ });
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  export { AdminErrorBoundary } from './ErrorBoundary';
3
2
  export { V, btnStyle } from './adminTokens';
4
3
  export { AdminViewHeader } from './AdminViewHeader';
package/dist/views.cjs ADDED
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var index$a = require('./views/TicketInboxView/index');
4
+ var index$9 = require('./views/TicketDetailView/index');
5
+ var index$8 = require('./views/SupportDashboardView/index');
6
+ var index$6 = require('./views/NewTicketView/index');
7
+ var index$b = require('./views/TicketingSettingsView/index');
8
+ var index$5 = require('./views/LogsView/index');
9
+ var index$1 = require('./views/ChatView/index');
10
+ var index$2 = require('./views/CrmView/index');
11
+ var index$7 = require('./views/PendingEmailsView/index');
12
+ var index$3 = require('./views/EmailTrackingView/index');
13
+ var index = require('./views/BillingView/index');
14
+ var index$c = require('./views/TimeDashboardView/index');
15
+ var index$4 = require('./views/ImportConversationView/index');
16
+
17
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
+
19
+ var index__default$a = /*#__PURE__*/_interopDefault(index$a);
20
+ var index__default$9 = /*#__PURE__*/_interopDefault(index$9);
21
+ var index__default$8 = /*#__PURE__*/_interopDefault(index$8);
22
+ var index__default$6 = /*#__PURE__*/_interopDefault(index$6);
23
+ var index__default$b = /*#__PURE__*/_interopDefault(index$b);
24
+ var index__default$5 = /*#__PURE__*/_interopDefault(index$5);
25
+ var index__default$1 = /*#__PURE__*/_interopDefault(index$1);
26
+ var index__default$2 = /*#__PURE__*/_interopDefault(index$2);
27
+ var index__default$7 = /*#__PURE__*/_interopDefault(index$7);
28
+ var index__default$3 = /*#__PURE__*/_interopDefault(index$3);
29
+ var index__default = /*#__PURE__*/_interopDefault(index);
30
+ var index__default$c = /*#__PURE__*/_interopDefault(index$c);
31
+ var index__default$4 = /*#__PURE__*/_interopDefault(index$4);
32
+
33
+
34
+
35
+ Object.defineProperty(exports, "TicketInboxView", {
36
+ enumerable: true,
37
+ get: function () { return index__default$a.default; }
38
+ });
39
+ Object.defineProperty(exports, "TicketDetailView", {
40
+ enumerable: true,
41
+ get: function () { return index__default$9.default; }
42
+ });
43
+ Object.defineProperty(exports, "SupportDashboardView", {
44
+ enumerable: true,
45
+ get: function () { return index__default$8.default; }
46
+ });
47
+ Object.defineProperty(exports, "NewTicketView", {
48
+ enumerable: true,
49
+ get: function () { return index__default$6.default; }
50
+ });
51
+ Object.defineProperty(exports, "TicketingSettingsView", {
52
+ enumerable: true,
53
+ get: function () { return index__default$b.default; }
54
+ });
55
+ Object.defineProperty(exports, "LogsView", {
56
+ enumerable: true,
57
+ get: function () { return index__default$5.default; }
58
+ });
59
+ Object.defineProperty(exports, "ChatView", {
60
+ enumerable: true,
61
+ get: function () { return index__default$1.default; }
62
+ });
63
+ Object.defineProperty(exports, "CrmView", {
64
+ enumerable: true,
65
+ get: function () { return index__default$2.default; }
66
+ });
67
+ Object.defineProperty(exports, "PendingEmailsView", {
68
+ enumerable: true,
69
+ get: function () { return index__default$7.default; }
70
+ });
71
+ Object.defineProperty(exports, "EmailTrackingView", {
72
+ enumerable: true,
73
+ get: function () { return index__default$3.default; }
74
+ });
75
+ Object.defineProperty(exports, "BillingView", {
76
+ enumerable: true,
77
+ get: function () { return index__default.default; }
78
+ });
79
+ Object.defineProperty(exports, "TimeDashboardView", {
80
+ enumerable: true,
81
+ get: function () { return index__default$c.default; }
82
+ });
83
+ Object.defineProperty(exports, "ImportConversationView", {
84
+ enumerable: true,
85
+ get: function () { return index__default$4.default; }
86
+ });