@consilioweb/payload-support 0.8.2 → 0.9.4

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 (50) hide show
  1. package/dist/components/RichTextEditor/index.cjs +233 -0
  2. package/dist/components/RichTextEditor/index.js +232 -0
  3. package/dist/components/TicketConversation/components/CodeBlock.cjs +24 -7
  4. package/dist/components/TicketConversation/components/CodeBlock.js +23 -9
  5. package/dist/index.cjs +19 -1
  6. package/dist/index.js +19 -1
  7. package/dist/views/BillingView/client.cjs +260 -103
  8. package/dist/views/BillingView/client.js +259 -103
  9. package/dist/views/ChatView/client.cjs +184 -137
  10. package/dist/views/ChatView/client.js +180 -137
  11. package/dist/views/CrmView/client.cjs +270 -122
  12. package/dist/views/CrmView/client.js +266 -122
  13. package/dist/views/EmailTrackingView/client.cjs +80 -69
  14. package/dist/views/EmailTrackingView/client.js +80 -70
  15. package/dist/views/ImportConversationView/client.cjs +127 -94
  16. package/dist/views/ImportConversationView/client.js +123 -94
  17. package/dist/views/LogsView/client.cjs +56 -58
  18. package/dist/views/LogsView/client.js +52 -58
  19. package/dist/views/NewTicketView/client.cjs +39 -55
  20. package/dist/views/NewTicketView/client.js +38 -55
  21. package/dist/views/PendingEmailsView/client.cjs +399 -102
  22. package/dist/views/PendingEmailsView/client.js +396 -103
  23. package/dist/views/SupportDashboardView/client.cjs +276 -137
  24. package/dist/views/SupportDashboardView/client.js +275 -137
  25. package/dist/views/TicketDetailView/client.cjs +487 -204
  26. package/dist/views/TicketDetailView/client.js +486 -204
  27. package/dist/views/TicketInboxView/client.cjs +62 -65
  28. package/dist/views/TicketInboxView/client.js +62 -66
  29. package/dist/views/TicketingSettingsView/client.cjs +10 -8
  30. package/dist/views/TicketingSettingsView/client.js +10 -8
  31. package/dist/views/TimeDashboardView/client.cjs +70 -59
  32. package/dist/views/TimeDashboardView/client.js +69 -59
  33. package/package.json +6 -2
  34. package/src/components/RichTextEditor/index.tsx +261 -0
  35. package/src/components/TicketConversation/components/CodeBlock.tsx +53 -14
  36. package/src/plugin.ts +2 -0
  37. package/src/utils/emailTemplate.ts +37 -0
  38. package/src/views/BillingView/client.tsx +362 -69
  39. package/src/views/ChatView/client.tsx +225 -140
  40. package/src/views/CrmView/client.tsx +447 -189
  41. package/src/views/EmailTrackingView/client.tsx +111 -71
  42. package/src/views/ImportConversationView/client.tsx +255 -70
  43. package/src/views/LogsView/client.tsx +85 -50
  44. package/src/views/NewTicketView/client.tsx +37 -53
  45. package/src/views/PendingEmailsView/client.tsx +512 -92
  46. package/src/views/SupportDashboardView/client.tsx +294 -134
  47. package/src/views/TicketDetailView/client.tsx +486 -213
  48. package/src/views/TicketInboxView/client.tsx +52 -61
  49. package/src/views/TicketingSettingsView/client.tsx +10 -9
  50. package/src/views/TimeDashboardView/client.tsx +184 -69
@@ -4,6 +4,7 @@ import { useState, useEffect } from 'react';
4
4
  import Link from 'next/link';
5
5
  import { useRouter } from 'next/navigation';
6
6
  import { useTranslation } from '../../components/TicketConversation/hooks/useTranslation.js';
7
+ import s from '../../styles/NewTicket.module.scss';
7
8
 
8
9
  const CATEGORY_KEYS = [
9
10
  { value: "", key: "ticket.category.select" },
@@ -46,8 +47,7 @@ const NewTicketClient = () => {
46
47
  const d = await res.json();
47
48
  setClientResults(d.docs || []);
48
49
  }
49
- } catch (err) {
50
- console.warn("[support] client search error:", err);
50
+ } catch {
51
51
  }
52
52
  }, 300);
53
53
  return () => clearTimeout(timer);
@@ -109,47 +109,29 @@ const NewTicketClient = () => {
109
109
  setSubmitting(false);
110
110
  }
111
111
  };
112
- const S = {
113
- page: { padding: "20px 30px", maxWidth: 720, margin: "0 auto" },
114
- header: { marginBottom: 24 },
115
- backLink: { fontSize: 13, color: "#2563eb", textDecoration: "none" },
116
- title: { fontSize: 24, fontWeight: 700, margin: "8px 0 4px", color: "var(--theme-text)" },
117
- subtitle: { fontSize: 14, color: "var(--theme-elevation-500)" },
118
- error: { padding: "10px 14px", borderRadius: 8, background: "#fef2f2", color: "#dc2626", fontSize: 13, marginBottom: 16, border: "1px solid #fecaca" },
119
- fieldGroup: { marginBottom: 16 },
120
- label: { display: "block", fontSize: 13, fontWeight: 600, marginBottom: 6, color: "var(--theme-text)" },
121
- required: { color: "#dc2626" },
122
- input: { width: "100%", padding: "8px 12px", borderRadius: 8, border: "1px solid var(--theme-elevation-200)", fontSize: 13, color: "var(--theme-text)", background: "var(--theme-elevation-0)" },
123
- select: { width: "100%", padding: "8px 12px", borderRadius: 8, border: "1px solid var(--theme-elevation-200)", fontSize: 13, color: "var(--theme-text)", background: "var(--theme-elevation-0)" },
124
- textarea: { width: "100%", padding: "8px 12px", borderRadius: 8, border: "1px solid var(--theme-elevation-200)", fontSize: 13, color: "var(--theme-text)", background: "var(--theme-elevation-0)", minHeight: 120, fontFamily: "inherit", resize: "vertical" },
125
- row3: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 12, marginBottom: 16 },
126
- submitBtn: { padding: "10px 20px", borderRadius: 8, background: "#2563eb", color: "#fff", fontSize: 14, fontWeight: 600, border: "none", cursor: "pointer" },
127
- searchResults: { position: "absolute", top: "100%", left: 0, right: 0, background: "var(--theme-elevation-0)", border: "1px solid var(--theme-elevation-200)", borderRadius: 8, boxShadow: "0 4px 12px rgba(0,0,0,0.1)", zIndex: 50, maxHeight: 200, overflowY: "auto" },
128
- searchItem: { padding: "8px 12px", cursor: "pointer", fontSize: 13, borderBottom: "1px solid var(--theme-elevation-100)" }
129
- };
130
- return /* @__PURE__ */ jsxs("div", { style: S.page, children: [
131
- /* @__PURE__ */ jsxs("div", { style: S.header, children: [
132
- /* @__PURE__ */ jsxs(Link, { href: "/admin/support/inbox", style: S.backLink, children: [
112
+ return /* @__PURE__ */ jsxs("div", { className: s.page, children: [
113
+ /* @__PURE__ */ jsxs("div", { className: s.header, children: [
114
+ /* @__PURE__ */ jsxs(Link, { href: "/admin/support/inbox", className: s.backLink, children: [
133
115
  "\u2190 ",
134
116
  t("newTicket.backToInbox")
135
117
  ] }),
136
- /* @__PURE__ */ jsx("h1", { style: S.title, children: t("newTicket.title") }),
137
- /* @__PURE__ */ jsx("p", { style: S.subtitle, children: t("newTicket.subtitle") })
118
+ /* @__PURE__ */ jsx("h1", { className: s.title, children: t("newTicket.title") }),
119
+ /* @__PURE__ */ jsx("p", { className: s.subtitle, children: t("newTicket.subtitle") })
138
120
  ] }),
139
- error && /* @__PURE__ */ jsx("div", { style: S.error, children: error }),
140
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
141
- /* @__PURE__ */ jsxs("div", { style: S.fieldGroup, children: [
142
- /* @__PURE__ */ jsxs("label", { style: S.label, children: [
121
+ error && /* @__PURE__ */ jsx("div", { className: s.error, children: error }),
122
+ /* @__PURE__ */ jsxs("form", { className: s.form, onSubmit: handleSubmit, children: [
123
+ /* @__PURE__ */ jsxs("div", { className: s.fieldGroup, children: [
124
+ /* @__PURE__ */ jsxs("label", { className: s.label, children: [
143
125
  t("newTicket.clientLabel"),
144
126
  " ",
145
- /* @__PURE__ */ jsx("span", { style: S.required, children: "*" })
127
+ /* @__PURE__ */ jsx("span", { className: s.required, children: "*" })
146
128
  ] }),
147
129
  selectedClient ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "8px 14px", borderRadius: 10, border: "1px solid var(--theme-elevation-200)", background: "var(--theme-elevation-50)" }, children: [
148
130
  /* @__PURE__ */ jsxs("span", { style: { fontWeight: 600, fontSize: 13, color: "var(--theme-text)" }, children: [
149
131
  selectedClient.firstName,
150
132
  " ",
151
133
  selectedClient.lastName,
152
- " -- ",
134
+ " \u2014 ",
153
135
  selectedClient.company
154
136
  ] }),
155
137
  /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "var(--theme-elevation-500)" }, children: selectedClient.email }),
@@ -158,18 +140,19 @@ const NewTicketClient = () => {
158
140
  setClientId(null);
159
141
  setClientSearch("");
160
142
  }, style: { marginLeft: "auto", background: "none", border: "none", cursor: "pointer", color: "var(--theme-elevation-400)", fontSize: 16 }, children: "\xD7" })
161
- ] }) : /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
143
+ ] }) : /* @__PURE__ */ jsxs("div", { className: s.searchWrap, children: [
162
144
  /* @__PURE__ */ jsx(
163
145
  "input",
164
146
  {
165
147
  type: "text",
166
- style: S.input,
148
+ className: s.input,
167
149
  placeholder: t("newTicket.clientSearchPlaceholder"),
168
150
  value: clientSearch,
169
- onChange: (e) => setClientSearch(e.target.value)
151
+ onChange: (e) => setClientSearch(e.target.value),
152
+ style: { width: "100%" }
170
153
  }
171
154
  ),
172
- clientResults.length > 0 && /* @__PURE__ */ jsx("div", { style: S.searchResults, children: clientResults.map((c) => /* @__PURE__ */ jsxs("div", { style: S.searchItem, onClick: () => {
155
+ clientResults.length > 0 && /* @__PURE__ */ jsx("div", { className: s.searchResults, children: clientResults.map((c) => /* @__PURE__ */ jsxs("div", { className: s.searchItem, onClick: () => {
173
156
  setSelectedClient(c);
174
157
  setClientId(c.id);
175
158
  setClientSearch("");
@@ -180,43 +163,43 @@ const NewTicketClient = () => {
180
163
  " ",
181
164
  c.lastName
182
165
  ] }),
183
- " -- ",
166
+ " \u2014 ",
184
167
  c.company,
185
168
  " ",
186
169
  /* @__PURE__ */ jsx("span", { style: { color: "var(--theme-elevation-400)", fontSize: 12 }, children: c.email })
187
170
  ] }, c.id)) })
188
171
  ] })
189
172
  ] }),
190
- /* @__PURE__ */ jsxs("div", { style: S.fieldGroup, children: [
191
- /* @__PURE__ */ jsxs("label", { style: S.label, children: [
173
+ /* @__PURE__ */ jsxs("div", { className: s.fieldGroup, children: [
174
+ /* @__PURE__ */ jsxs("label", { className: s.label, children: [
192
175
  t("newTicket.subjectLabel"),
193
176
  " ",
194
- /* @__PURE__ */ jsx("span", { style: S.required, children: "*" })
177
+ /* @__PURE__ */ jsx("span", { className: s.required, children: "*" })
195
178
  ] }),
196
- /* @__PURE__ */ jsx("input", { type: "text", style: S.input, placeholder: t("newTicket.subjectPlaceholder"), value: subject, onChange: (e) => setSubject(e.target.value) })
179
+ /* @__PURE__ */ jsx("input", { type: "text", className: s.input, placeholder: t("newTicket.subjectPlaceholder"), value: subject, onChange: (e) => setSubject(e.target.value) })
197
180
  ] }),
198
- /* @__PURE__ */ jsxs("div", { style: S.row3, children: [
199
- /* @__PURE__ */ jsxs("div", { style: S.fieldGroup, children: [
200
- /* @__PURE__ */ jsx("label", { style: S.label, children: t("newTicket.categoryLabel") }),
201
- /* @__PURE__ */ jsx("select", { style: S.select, value: category, onChange: (e) => setCategory(e.target.value), children: CATEGORY_KEYS.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: t(c.key) }, c.value)) })
181
+ /* @__PURE__ */ jsxs("div", { className: s.row3, children: [
182
+ /* @__PURE__ */ jsxs("div", { className: s.fieldGroup, children: [
183
+ /* @__PURE__ */ jsx("label", { className: s.label, children: t("newTicket.categoryLabel") }),
184
+ /* @__PURE__ */ jsx("select", { className: s.select, value: category, onChange: (e) => setCategory(e.target.value), children: CATEGORY_KEYS.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: t(c.key) }, c.value)) })
202
185
  ] }),
203
- /* @__PURE__ */ jsxs("div", { style: S.fieldGroup, children: [
204
- /* @__PURE__ */ jsx("label", { style: S.label, children: t("newTicket.priorityLabel") }),
205
- /* @__PURE__ */ jsx("select", { style: S.select, value: priority, onChange: (e) => setPriority(e.target.value), children: PRIORITY_KEYS.map((p) => /* @__PURE__ */ jsx("option", { value: p.value, children: t(p.key) }, p.value)) })
186
+ /* @__PURE__ */ jsxs("div", { className: s.fieldGroup, children: [
187
+ /* @__PURE__ */ jsx("label", { className: s.label, children: t("newTicket.priorityLabel") }),
188
+ /* @__PURE__ */ jsx("select", { className: s.select, value: priority, onChange: (e) => setPriority(e.target.value), children: PRIORITY_KEYS.map((p) => /* @__PURE__ */ jsx("option", { value: p.value, children: t(p.key) }, p.value)) })
206
189
  ] }),
207
- /* @__PURE__ */ jsxs("div", { style: S.fieldGroup, children: [
208
- /* @__PURE__ */ jsx("label", { style: S.label, children: t("newTicket.projectLabel") }),
209
- /* @__PURE__ */ jsxs("select", { style: S.select, value: projectId || "", onChange: (e) => setProjectId(e.target.value ? Number(e.target.value) : null), children: [
210
- /* @__PURE__ */ jsx("option", { value: "", children: t("ticket.noProject") }),
190
+ /* @__PURE__ */ jsxs("div", { className: s.fieldGroup, children: [
191
+ /* @__PURE__ */ jsx("label", { className: s.label, children: t("newTicket.projectLabel") }),
192
+ /* @__PURE__ */ jsxs("select", { className: s.select, value: projectId || "", onChange: (e) => setProjectId(e.target.value ? Number(e.target.value) : null), children: [
193
+ /* @__PURE__ */ jsx("option", { value: "", children: "\u2014 Aucun \u2014" }),
211
194
  projects.map((p) => /* @__PURE__ */ jsx("option", { value: p.id, children: p.name }, p.id))
212
195
  ] })
213
196
  ] })
214
197
  ] }),
215
- /* @__PURE__ */ jsxs("div", { style: S.fieldGroup, children: [
216
- /* @__PURE__ */ jsx("label", { style: S.label, children: t("newTicket.descriptionLabel") }),
217
- /* @__PURE__ */ jsx("textarea", { style: S.textarea, placeholder: t("newTicket.descriptionPlaceholder"), value: description, onChange: (e) => setDescription(e.target.value) })
198
+ /* @__PURE__ */ jsxs("div", { className: s.fieldGroup, children: [
199
+ /* @__PURE__ */ jsx("label", { className: s.label, children: t("newTicket.descriptionLabel") }),
200
+ /* @__PURE__ */ jsx("textarea", { className: s.textarea, placeholder: t("newTicket.descriptionPlaceholder"), value: description, onChange: (e) => setDescription(e.target.value) })
218
201
  ] }),
219
- /* @__PURE__ */ jsx("button", { type: "submit", style: S.submitBtn, disabled: submitting, children: submitting ? t("newTicket.submitting") : t("newTicket.submitButton") })
202
+ /* @__PURE__ */ jsx("button", { type: "submit", className: s.submitBtn, disabled: submitting, children: submitting ? t("newTicket.submitting") : t("newTicket.submitButton") })
220
203
  ] })
221
204
  ] });
222
205
  };