@consilioweb/payload-support 0.9.9 → 0.9.10

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.
@@ -832,10 +832,32 @@ ${uploadedLinks.join("\n")}` : replyBody.trim() || "[Contenu enrichi]";
832
832
  cannedResponses.map((cr) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: String(cr.id), children: cr.title }, cr.id))
833
833
  ] })
834
834
  ] }),
835
- /* @__PURE__ */ jsxRuntime.jsx(index.RichTextEditor, { ref: editorRef, onChange: (html, text) => {
836
- setReplyHtml(html);
837
- setReplyBody(text);
838
- }, placeholder: isInternal ? t("composer.placeholderInternal") : t("composer.placeholderReplyTo", { name: client?.firstName || "client" }), minHeight: 100, borderColor: "transparent" }),
835
+ /* @__PURE__ */ jsxRuntime.jsx(
836
+ index.RichTextEditor,
837
+ {
838
+ ref: editorRef,
839
+ onChange: (html, text) => {
840
+ setReplyHtml(html);
841
+ setReplyBody(text);
842
+ },
843
+ placeholder: isInternal ? t("composer.placeholderInternal") : t("composer.placeholderReplyTo", { name: client?.firstName || "client" }),
844
+ minHeight: 100,
845
+ borderColor: "transparent",
846
+ onFileUpload: async (file) => {
847
+ try {
848
+ const formData = new FormData();
849
+ formData.append("file", file);
850
+ formData.append("_payload", JSON.stringify({ alt: file.name }));
851
+ const ur = await fetch("/api/media", { method: "POST", credentials: "include", body: formData });
852
+ if (!ur.ok) return null;
853
+ const ud = await ur.json();
854
+ return ud.doc?.url || null;
855
+ } catch {
856
+ return null;
857
+ }
858
+ }
859
+ }
860
+ ),
839
861
  pendingFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: s__default.default.uploadPreview, children: pendingFiles.map((f, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: s__default.default.uploadPreviewItem, children: [
840
862
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
841
863
  "PJ ",
@@ -825,10 +825,32 @@ ${uploadedLinks.join("\n")}` : replyBody.trim() || "[Contenu enrichi]";
825
825
  cannedResponses.map((cr) => /* @__PURE__ */ jsx("option", { value: String(cr.id), children: cr.title }, cr.id))
826
826
  ] })
827
827
  ] }),
828
- /* @__PURE__ */ jsx(RichTextEditor, { ref: editorRef, onChange: (html, text) => {
829
- setReplyHtml(html);
830
- setReplyBody(text);
831
- }, placeholder: isInternal ? t("composer.placeholderInternal") : t("composer.placeholderReplyTo", { name: client?.firstName || "client" }), minHeight: 100, borderColor: "transparent" }),
828
+ /* @__PURE__ */ jsx(
829
+ RichTextEditor,
830
+ {
831
+ ref: editorRef,
832
+ onChange: (html, text) => {
833
+ setReplyHtml(html);
834
+ setReplyBody(text);
835
+ },
836
+ placeholder: isInternal ? t("composer.placeholderInternal") : t("composer.placeholderReplyTo", { name: client?.firstName || "client" }),
837
+ minHeight: 100,
838
+ borderColor: "transparent",
839
+ onFileUpload: async (file) => {
840
+ try {
841
+ const formData = new FormData();
842
+ formData.append("file", file);
843
+ formData.append("_payload", JSON.stringify({ alt: file.name }));
844
+ const ur = await fetch("/api/media", { method: "POST", credentials: "include", body: formData });
845
+ if (!ur.ok) return null;
846
+ const ud = await ur.json();
847
+ return ud.doc?.url || null;
848
+ } catch {
849
+ return null;
850
+ }
851
+ }
852
+ }
853
+ ),
832
854
  pendingFiles.length > 0 && /* @__PURE__ */ jsx("div", { className: s.uploadPreview, children: pendingFiles.map((f, i) => /* @__PURE__ */ jsxs("div", { className: s.uploadPreviewItem, children: [
833
855
  /* @__PURE__ */ jsxs("span", { children: [
834
856
  "PJ ",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consilioweb/payload-support",
3
- "version": "0.9.9",
3
+ "version": "0.9.10",
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",
@@ -764,7 +764,24 @@ const [clientTyping, setClientTyping] = useState(false)
764
764
  </select>
765
765
  )}
766
766
  </div>
767
- <RichTextEditor ref={editorRef} onChange={(html, text) => { setReplyHtml(html); setReplyBody(text) }} placeholder={isInternal ? t('composer.placeholderInternal') : t('composer.placeholderReplyTo', { name: client?.firstName || 'client' })} minHeight={100} borderColor="transparent" />
767
+ <RichTextEditor
768
+ ref={editorRef}
769
+ onChange={(html, text) => { setReplyHtml(html); setReplyBody(text) }}
770
+ placeholder={isInternal ? t('composer.placeholderInternal') : t('composer.placeholderReplyTo', { name: client?.firstName || 'client' })}
771
+ minHeight={100}
772
+ borderColor="transparent"
773
+ onFileUpload={async (file) => {
774
+ try {
775
+ const formData = new FormData()
776
+ formData.append('file', file)
777
+ formData.append('_payload', JSON.stringify({ alt: file.name }))
778
+ const ur = await fetch('/api/media', { method: 'POST', credentials: 'include', body: formData })
779
+ if (!ur.ok) return null
780
+ const ud = await ur.json()
781
+ return ud.doc?.url || null
782
+ } catch { return null }
783
+ }}
784
+ />
768
785
  {/* #5 — File upload preview */}
769
786
  {pendingFiles.length > 0 && (
770
787
  <div className={s.uploadPreview}>