@mhosaic/feedback 0.18.1 → 0.19.0

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.
@@ -169,6 +169,24 @@ function createApiClient(options) {
169
169
  }
170
170
  return response.json();
171
171
  }
172
+ async function reopenUnresolved(reportId, externalId) {
173
+ const response = await fetcher(
174
+ `${endpoint}/api/feedback/v1/reports/widget/${reportId}/`,
175
+ {
176
+ method: "PATCH",
177
+ headers: {
178
+ ...widgetHeaders(externalId),
179
+ "Content-Type": "application/json"
180
+ },
181
+ body: JSON.stringify({ status: "in_progress" })
182
+ }
183
+ );
184
+ if (!response.ok) {
185
+ const text = await response.text().catch(() => "");
186
+ throw new Error(`reopenUnresolved failed: ${response.status} ${text}`);
187
+ }
188
+ return response.json();
189
+ }
172
190
  function boardQueryString(filters) {
173
191
  if (!filters) return "";
174
192
  const params = new URLSearchParams();
@@ -238,6 +256,7 @@ function createApiClient(options) {
238
256
  getReport,
239
257
  addComment,
240
258
  closeAsResolved,
259
+ reopenUnresolved,
241
260
  listBoard,
242
261
  fetchBoardKpis
243
262
  };
@@ -629,12 +648,15 @@ var DEFAULT_STRINGS = {
629
648
  "detail.compose_sending": "Sending\u2026",
630
649
  "detail.close_cta": "Mark as resolved",
631
650
  "detail.close_busy": "Marking\u2026",
651
+ "detail.reopen_cta": "Still not fixed",
652
+ "detail.reopen_busy": "Reopening\u2026",
632
653
  "detail.teammate_notice": "Viewing a teammate\u2019s report \u2014 replies are private to the submitter.",
633
654
  "detail.load_failed.title": "Report not available",
634
655
  "detail.load_failed.body": "It may have been deleted, or you no longer have access to it.",
635
656
  "detail.load_failed.cta": "Back",
636
657
  "detail.send_failed": "Couldn\u2019t send your reply. Try again.",
637
658
  "detail.close_failed": "Couldn\u2019t mark as resolved. Try again.",
659
+ "detail.reopen_failed": "Couldn\u2019t reopen the report. Try again.",
638
660
  "detail.history": "Status history",
639
661
  "detail.context.submitted_at": "Submitted",
640
662
  "detail.context.page": "Page",
@@ -768,12 +790,15 @@ var FRENCH_STRINGS = {
768
790
  "detail.compose_sending": "Envoi\u2026",
769
791
  "detail.close_cta": "Marquer comme r\xE9solu",
770
792
  "detail.close_busy": "Validation\u2026",
793
+ "detail.reopen_cta": "Toujours pas r\xE9gl\xE9",
794
+ "detail.reopen_busy": "R\xE9ouverture\u2026",
771
795
  "detail.teammate_notice": "Vous consultez le rapport d\u2019un co\xE9quipier \u2014 les r\xE9ponses sont priv\xE9es au soumetteur.",
772
796
  "detail.load_failed.title": "Rapport indisponible",
773
797
  "detail.load_failed.body": "Il a peut-\xEAtre \xE9t\xE9 supprim\xE9, ou vous n\u2019y avez plus acc\xE8s.",
774
798
  "detail.load_failed.cta": "Retour",
775
799
  "detail.send_failed": "Impossible d\u2019envoyer votre r\xE9ponse. R\xE9essayez.",
776
800
  "detail.close_failed": "Impossible de marquer comme r\xE9solu. R\xE9essayez.",
801
+ "detail.reopen_failed": "Impossible de rouvrir le rapport. R\xE9essayez.",
777
802
  "detail.history": "Historique du statut",
778
803
  "detail.context.submitted_at": "Envoy\xE9",
779
804
  "detail.context.page": "Page",
@@ -913,6 +938,7 @@ function ReportDetailView({
913
938
  const [composeBody, setComposeBody] = useState("");
914
939
  const [sending, setSending] = useState(false);
915
940
  const [closing, setClosing] = useState(false);
941
+ const [reopening, setReopening] = useState(false);
916
942
  const mountedRef = useRef(true);
917
943
  const fetchDetail = async () => {
918
944
  try {
@@ -958,7 +984,7 @@ function ReportDetailView({
958
984
  }
959
985
  };
960
986
  const handleClose = async () => {
961
- if (closing) return;
987
+ if (closing || reopening) return;
962
988
  setClosing(true);
963
989
  try {
964
990
  const next = await api.closeAsResolved(reportId, externalId);
@@ -973,6 +999,22 @@ function ReportDetailView({
973
999
  if (mountedRef.current) setClosing(false);
974
1000
  }
975
1001
  };
1002
+ const handleReopen = async () => {
1003
+ if (closing || reopening) return;
1004
+ setReopening(true);
1005
+ try {
1006
+ const next = await api.reopenUnresolved(reportId, externalId);
1007
+ if (!mountedRef.current) return;
1008
+ setDetail(next);
1009
+ } catch (err) {
1010
+ if (typeof console !== "undefined")
1011
+ console.warn("[mhosaic] reopenUnresolved:", err);
1012
+ if (!mountedRef.current) return;
1013
+ setError(strings["detail.reopen_failed"]);
1014
+ } finally {
1015
+ if (mountedRef.current) setReopening(false);
1016
+ }
1017
+ };
976
1018
  if (!detail && !error) {
977
1019
  return /* @__PURE__ */ jsx2("div", { class: "mine-loading", children: strings["mine.loading"] });
978
1020
  }
@@ -1050,10 +1092,20 @@ function ReportDetailView({
1050
1092
  type: "button",
1051
1093
  class: "btn",
1052
1094
  onClick: handleClose,
1053
- disabled: closing,
1095
+ disabled: closing || reopening,
1054
1096
  children: closing ? strings["detail.close_busy"] : strings["detail.close_cta"]
1055
1097
  }
1056
1098
  ),
1099
+ showCloseCta && /* @__PURE__ */ jsx2(
1100
+ "button",
1101
+ {
1102
+ type: "button",
1103
+ class: "btn btn--ghost",
1104
+ onClick: handleReopen,
1105
+ disabled: closing || reopening,
1106
+ children: reopening ? strings["detail.reopen_busy"] : strings["detail.reopen_cta"]
1107
+ }
1108
+ ),
1057
1109
  /* @__PURE__ */ jsx2(
1058
1110
  "button",
1059
1111
  {
@@ -4759,8 +4811,8 @@ function createFeedback(config) {
4759
4811
  capture_method: captureMethod,
4760
4812
  technical_context
4761
4813
  };
4762
- if ("0.18.1") {
4763
- payload.widget_version = "0.18.1";
4814
+ if ("0.19.0") {
4815
+ payload.widget_version = "0.19.0";
4764
4816
  }
4765
4817
  if (manualScreenshot) payload.screenshot = manualScreenshot;
4766
4818
  if (values.synthetic) payload.synthetic = true;
@@ -4853,4 +4905,4 @@ function createFeedback(config) {
4853
4905
  export {
4854
4906
  createFeedback
4855
4907
  };
4856
- //# sourceMappingURL=chunk-5FVEQYA5.mjs.map
4908
+ //# sourceMappingURL=chunk-LCH5O3GT.mjs.map