sanity-plugin-seofields 1.2.2 → 1.2.3

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,5 +1,5 @@
1
1
  import o, { useDebugValue, createElement, useRef, useContext, useState, useCallback, useEffect, useMemo } from "react";
2
- import { useClient, useFormValue, defineType, defineField, definePlugin } from "sanity";
2
+ import { useClient, useWorkspace, useFormValue, defineType, defineField, definePlugin } from "sanity";
3
3
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
4
4
  import { useIntentLink } from "sanity/router";
5
5
  import { usePaneRouter } from "sanity/structure";
@@ -1523,13 +1523,9 @@ const DashboardContainer = dt.div`
1523
1523
  color: #374151;
1524
1524
  border-color: #9ca3af;
1525
1525
  }
1526
- `, DocTitleAnchor = ({
1527
- id,
1528
- type,
1529
- children
1530
- }) => {
1531
- const { onClick, href } = useIntentLink({ intent: "edit", params: { id, type } });
1532
- return /* @__PURE__ */ jsx(DocTitleLink, { href, onClick, title: "Open document", children });
1526
+ `, DocTitleAnchor = ({ id, type, structureTool, children }) => {
1527
+ const { basePath } = useWorkspace(), { onClick: intentOnClick, href: intentHref } = useIntentLink({ intent: "edit", params: { id, type } }), href = structureTool ? `${basePath}/${structureTool}/intent/edit/id=${id};type=${type}/` : intentHref;
1528
+ return /* @__PURE__ */ jsx(DocTitleLink, { href, onClick: structureTool ? void 0 : intentOnClick, title: "Open document", children });
1533
1529
  }, PaneLinkWrapper = dt.span`
1534
1530
  display: block;
1535
1531
  min-width: 0;
@@ -1800,7 +1796,8 @@ const DashboardContainer = dt.div`
1800
1796
  loadingDocuments,
1801
1797
  noDocuments,
1802
1798
  previewMode = !1,
1803
- openInPane = !1
1799
+ openInPane = !1,
1800
+ structureTool
1804
1801
  }) => {
1805
1802
  const client = useClient({ apiVersion }), [licenseStatus, setLicenseStatus] = useState("loading"), [documents, setDocuments] = useState([]), [loading, setLoading] = useState(!0), [searchQuery, setSearchQuery] = useState(""), [filterStatus, setFilterStatus] = useState("all"), [filterType, setFilterType] = useState("all"), [sortBy, setSortBy] = useState("score"), [activePopover, setActivePopover] = useState(null), VALIDATION_ENDPOINT = "https://sanity-plugin-seofields.thehardik.in/api/validate-license", CACHE_TTL_MS = 3600 * 1e3, validateLicense = useCallback(
1806
1803
  async (forceRefresh = !1) => {
@@ -2086,7 +2083,7 @@ export default defineConfig({
2086
2083
  filteredAndSortedDocs.map((doc) => /* @__PURE__ */ jsxs(TableRow, { children: [
2087
2084
  /* @__PURE__ */ jsx(ColTitle, { children: /* @__PURE__ */ jsxs(TitleWrapper, { children: [
2088
2085
  /* @__PURE__ */ jsxs(TitleCell, { children: [
2089
- openInPane ? /* @__PURE__ */ jsx(DocTitleAnchorPane, { id: doc._id, type: doc._type, children: doc.title || "Untitled" }) : /* @__PURE__ */ jsx(DocTitleAnchor, { id: doc._id, type: doc._type, children: doc.title || "Untitled" }),
2086
+ openInPane ? /* @__PURE__ */ jsx(DocTitleAnchorPane, { id: doc._id, type: doc._type, children: doc.title || "Untitled" }) : /* @__PURE__ */ jsx(DocTitleAnchor, { id: doc._id, type: doc._type, structureTool, children: doc.title || "Untitled" }),
2090
2087
  showDocumentId && /* @__PURE__ */ jsx(DocId, { children: doc._id })
2091
2088
  ] }),
2092
2089
  docBadge && /* @__PURE__ */ jsx(
@@ -3108,7 +3105,8 @@ const resolveDashboardConfig = (healthDashboard) => {
3108
3105
  loadingLicense: cfg?.content?.loadingLicense,
3109
3106
  loadingDocuments: cfg?.content?.loadingDocuments,
3110
3107
  noDocuments: cfg?.content?.noDocuments,
3111
- previewMode: cfg?.previewMode
3108
+ previewMode: cfg?.previewMode,
3109
+ structureTool: cfg?.structureTool
3112
3110
  };
3113
3111
  }, seofields = definePlugin((config = {}) => {
3114
3112
  const { healthDashboard = !0 } = config, dash = resolveDashboardConfig(healthDashboard), BoundSeoHealthTool = () => o.createElement(SeoHealthTool, {
@@ -3129,7 +3127,8 @@ const resolveDashboardConfig = (healthDashboard) => {
3129
3127
  loadingLicense: dash.loadingLicense,
3130
3128
  loadingDocuments: dash.loadingDocuments,
3131
3129
  noDocuments: dash.noDocuments,
3132
- previewMode: dash.previewMode
3130
+ previewMode: dash.previewMode,
3131
+ structureTool: dash.structureTool
3133
3132
  });
3134
3133
  return {
3135
3134
  name: "sanity-plugin-seofields",