@semiont/react-ui 0.2.33-build.84 → 0.2.33-build.85

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/index.mjs CHANGED
@@ -57296,38 +57296,36 @@ function ResourceViewerPage({
57296
57296
  console.error("[RealTime] Event stream error:", error);
57297
57297
  }, [])
57298
57298
  });
57299
+ const updateMutation = resources.update.useMutation();
57300
+ const generateCloneTokenMutation = resources.generateCloneToken.useMutation();
57299
57301
  const handleResourceArchive = useCallback35(async () => {
57300
57302
  try {
57301
- await resources.update.useMutation().mutateAsync({ rUri, data: { archived: true } });
57303
+ await updateMutation.mutateAsync({ rUri, data: { archived: true } });
57302
57304
  await refetchDocument();
57303
- showSuccess("Document archived");
57304
57305
  } catch (err) {
57305
57306
  console.error("Failed to archive document:", err);
57306
57307
  showError("Failed to archive document");
57307
57308
  }
57308
- }, [resources.update, rUri, refetchDocument, showSuccess, showError]);
57309
+ }, [updateMutation, rUri, refetchDocument, showError]);
57309
57310
  const handleResourceUnarchive = useCallback35(async () => {
57310
57311
  try {
57311
- await resources.update.useMutation().mutateAsync({ rUri, data: { archived: false } });
57312
+ await updateMutation.mutateAsync({ rUri, data: { archived: false } });
57312
57313
  await refetchDocument();
57313
- showSuccess("Document unarchived");
57314
57314
  } catch (err) {
57315
57315
  console.error("Failed to unarchive document:", err);
57316
57316
  showError("Failed to unarchive document");
57317
57317
  }
57318
- }, [resources.update, rUri, refetchDocument, showSuccess, showError]);
57318
+ }, [updateMutation, rUri, refetchDocument, showError]);
57319
57319
  const handleResourceClone = useCallback35(async () => {
57320
57320
  try {
57321
- const result2 = await resources.generateCloneToken.useMutation().mutateAsync(rUri);
57321
+ const result2 = await generateCloneTokenMutation.mutateAsync(rUri);
57322
57322
  const token = result2.token;
57323
- const cloneUrl = `${typeof window !== "undefined" ? window.location.origin : ""}/know/clone?token=${token}`;
57324
- await navigator.clipboard.writeText(cloneUrl);
57325
- showSuccess("Clone link copied to clipboard");
57323
+ eventBus.emit("navigation:router-push", { path: `/know/compose?mode=clone&token=${token}`, reason: "clone" });
57326
57324
  } catch (err) {
57327
57325
  console.error("Failed to generate clone token:", err);
57328
57326
  showError("Failed to generate clone link");
57329
57327
  }
57330
- }, [resources.generateCloneToken, rUri, showSuccess, showError]);
57328
+ }, [generateCloneTokenMutation, rUri, showError]);
57331
57329
  const handleAnnotationSparkle = useCallback35(({ annotationId }) => {
57332
57330
  triggerSparkleAnimation(annotationId);
57333
57331
  }, [triggerSparkleAnimation]);