@conloca/cms-spa 0.1.11 → 0.1.13

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
@@ -1,4 +1,4 @@
1
- import { a as MediaLibrary, c as FolderTreeSidebar, h as configureUI, i as UploadModal, n as CMSMDXEditorModal, t as MDXContent } from "./puck-DyXDFCcg.mjs";
1
+ import { a as MediaLibrary, c as FolderTreeSidebar, g as configureUI, i as UploadModal, n as CMSMDXEditorModal, t as MDXContent } from "./puck-DjVdP1zb.mjs";
2
2
  import { setDataSchemas } from "./data-schemas.mjs";
3
3
 
4
4
  export { CMSMDXEditorModal, FolderTreeSidebar, MDXContent, MediaLibrary, UploadModal, configureUI, setDataSchemas };
package/dist/main.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { _ as useErrorModal, a as MediaLibrary, b as useDeleteAsset, c as FolderTreeSidebar, d as useFolderTree$1, f as useMoveAssets, g as getUIConfig, i as UploadModal, l as cn$1, m as useSiteBaseUrl, n as CMSMDXEditorModal, o as MediaToolbar, p as useUpdateAssetMetadata, r as ImagePicker, s as buildAssetServeUrl, t as MDXContent, u as useAssetUsage, v as useDialogState, y as useClickOutside } from "./puck-DyXDFCcg.mjs";
1
+ import { _ as getUIConfig, a as MediaLibrary, b as useClickOutside, c as FolderTreeSidebar, d as useDeleteAsset, f as useFolderTree$1, h as useSiteBaseUrl, i as UploadModal, l as cn$1, m as useUpdateAssetMetadata, n as CMSMDXEditorModal, o as MediaToolbar, p as useMoveAssets, r as ImagePicker, s as buildAssetServeUrl, t as MDXContent, u as useAssetUsage, v as useErrorModal, y as useDialogState } from "./puck-DjVdP1zb.mjs";
2
2
  import { useDataSchemas } from "./data-schemas.mjs";
3
3
  import { usePageSchemas } from "./page-schemas.mjs";
4
4
  import { usePuckConfig } from "./puck-config.mjs";
5
5
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { AlertCircle, AlertTriangle, ArrowDownToLine, ArrowRight, Check, ChevronDown, Clock, Code, Code2, Database, Edit, Edit2, ExternalLink, Eye, FileEdit, FileJson, FileText, Folder, FolderInput, FolderOpen, GitBranch, Image, ImageIcon, LayoutDashboard, Loader2, Monitor, MoreVertical, Package, Plus, Save, Settings, Smartphone, Tablet, Trash2, Upload, User, X } from "lucide-react";
7
- import { ContentAPIClient, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
7
+ import { ContentAPIClient, blockEditableSchema, dataEditableSchema, formatFileSize, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
8
8
  import cn from "clsx";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
@@ -15,7 +15,6 @@ import * as Select from "@radix-ui/react-select";
15
15
  import { Puck, resolveAllData, useGetPuck } from "@puckeditor/core";
16
16
  import * as Dialog from "@radix-ui/react-dialog";
17
17
  import { z } from "zod";
18
- import { blockEditableSchema, dataEditableSchema, formatFileSize } from "@conloca/content-api";
19
18
 
20
19
  //#region src/components/cards/SectionCard.tsx
21
20
  function SectionCard({ to, icon, title, description, count, countLabel, isLoading, testId }) {
@@ -66,6 +65,9 @@ function SectionCard({ to, icon, title, description, count, countLabel, isLoadin
66
65
 
67
66
  //#endregion
68
67
  //#region src/components/CMSDashboard.tsx
68
+ function countAllAssets(nodes) {
69
+ return nodes.reduce((sum, node) => sum + node.assetCount + countAllAssets(node.children), 0);
70
+ }
69
71
  function CMSDashboard() {
70
72
  const { data: sitePages, isLoading: pagesLoading } = useSitePages("default");
71
73
  const { data: blocks, isLoading: blocksLoading } = useBlocks();
@@ -74,7 +76,7 @@ function CMSDashboard() {
74
76
  const pagesCount = sitePages?.items?.length ?? 0;
75
77
  const blocksCount = blocks?.items?.length ?? 0;
76
78
  const dataCount = dataEntries?.items?.length ?? 0;
77
- const mediaCount = (folderTree?.tree ?? []).reduce((sum, node) => sum + node.assetCount, 0);
79
+ const mediaCount = countAllAssets(folderTree?.tree ?? []);
78
80
  return /* @__PURE__ */ jsxs("div", {
79
81
  className: "p-6 max-w-5xl mx-auto",
80
82
  children: [/* @__PURE__ */ jsxs("div", {
@@ -1801,7 +1803,8 @@ function PageEditor({ pageId, entry, config, metadata, availableLocales, onSave,
1801
1803
  const { buildUrl } = useSiteBaseUrl();
1802
1804
  const handlePreview = useCallback(() => {
1803
1805
  const previewUrl = buildUrl(entry.localized.pathname || "/");
1804
- window.open(previewUrl, "_blank");
1806
+ const cacheBustedUrl = `${previewUrl}${previewUrl.includes("?") ? "&" : "?"}_t=${Date.now()}`;
1807
+ window.open(cacheBustedUrl, "_blank");
1805
1808
  }, [entry.localized.pathname, buildUrl]);
1806
1809
  const headerActionsPropsRef = useRef({
1807
1810
  onPublish,