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.d.mts CHANGED
@@ -338,6 +338,16 @@ export declare interface SeoFieldsPluginConfig {
338
338
  fontSize?: string
339
339
  }
340
340
  | undefined
341
+ /**
342
+ * The `name` of the Sanity structure tool that contains the monitored documents.
343
+ * Required when you have multiple structure tools and the documents live in a
344
+ * non-default one. Clicking a title will navigate to
345
+ * `/{basePath}/{structureTool}/intent/edit/…` directly.
346
+ *
347
+ * @example
348
+ * structureTool: 'common'
349
+ */
350
+ structureTool?: string
341
351
  /**
342
352
  * Enable preview/demo mode to show dummy data.
343
353
  * Useful for testing, documentation, or showcasing the dashboard.
@@ -472,6 +482,19 @@ declare interface SeoHealthDashboardProps {
472
482
  * This is set to `true` automatically by `createSeoHealthPane`.
473
483
  */
474
484
  openInPane?: boolean
485
+ /**
486
+ * The `name` of the Sanity structure tool that contains the monitored documents.
487
+ * When provided, clicking a document title navigates directly to that tool's
488
+ * intent URL (`/{basePath}/{structureTool}/intent/edit/id=…;type=…/`) instead of
489
+ * using the generic intent resolver, which always picks the first registered tool.
490
+ *
491
+ * Required when you have multiple structure tools and the documents live in a
492
+ * non-default one (e.g. `name: 'common'`).
493
+ *
494
+ * @example
495
+ * structureTool: 'common'
496
+ */
497
+ structureTool?: string
475
498
  }
476
499
 
477
500
  export declare interface SeoHealthMetrics {
package/dist/index.d.ts CHANGED
@@ -338,6 +338,16 @@ export declare interface SeoFieldsPluginConfig {
338
338
  fontSize?: string
339
339
  }
340
340
  | undefined
341
+ /**
342
+ * The `name` of the Sanity structure tool that contains the monitored documents.
343
+ * Required when you have multiple structure tools and the documents live in a
344
+ * non-default one. Clicking a title will navigate to
345
+ * `/{basePath}/{structureTool}/intent/edit/…` directly.
346
+ *
347
+ * @example
348
+ * structureTool: 'common'
349
+ */
350
+ structureTool?: string
341
351
  /**
342
352
  * Enable preview/demo mode to show dummy data.
343
353
  * Useful for testing, documentation, or showcasing the dashboard.
@@ -472,6 +482,19 @@ declare interface SeoHealthDashboardProps {
472
482
  * This is set to `true` automatically by `createSeoHealthPane`.
473
483
  */
474
484
  openInPane?: boolean
485
+ /**
486
+ * The `name` of the Sanity structure tool that contains the monitored documents.
487
+ * When provided, clicking a document title navigates directly to that tool's
488
+ * intent URL (`/{basePath}/{structureTool}/intent/edit/id=…;type=…/`) instead of
489
+ * using the generic intent resolver, which always picks the first registered tool.
490
+ *
491
+ * Required when you have multiple structure tools and the documents live in a
492
+ * non-default one (e.g. `name: 'common'`).
493
+ *
494
+ * @example
495
+ * structureTool: 'common'
496
+ */
497
+ structureTool?: string
475
498
  }
476
499
 
477
500
  export declare interface SeoHealthMetrics {
package/dist/index.js CHANGED
@@ -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 } = router.useIntentLink({ intent: "edit", params: { id, type } });
1532
- return /* @__PURE__ */ jsxRuntime.jsx(DocTitleLink, { href, onClick, title: "Open document", children });
1526
+ `, DocTitleAnchor = ({ id, type, structureTool, children }) => {
1527
+ const { basePath } = sanity.useWorkspace(), { onClick: intentOnClick, href: intentHref } = router.useIntentLink({ intent: "edit", params: { id, type } }), href = structureTool ? `${basePath}/${structureTool}/intent/edit/id=${id};type=${type}/` : intentHref;
1528
+ return /* @__PURE__ */ jsxRuntime.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 = sanity.useClient({ apiVersion }), [licenseStatus, setLicenseStatus] = o.useState("loading"), [documents, setDocuments] = o.useState([]), [loading, setLoading] = o.useState(!0), [searchQuery, setSearchQuery] = o.useState(""), [filterStatus, setFilterStatus] = o.useState("all"), [filterType, setFilterType] = o.useState("all"), [sortBy, setSortBy] = o.useState("score"), [activePopover, setActivePopover] = o.useState(null), VALIDATION_ENDPOINT = "https://sanity-plugin-seofields.thehardik.in/api/validate-license", CACHE_TTL_MS = 3600 * 1e3, validateLicense = o.useCallback(
1806
1803
  async (forceRefresh = !1) => {
@@ -2086,7 +2083,7 @@ export default defineConfig({
2086
2083
  filteredAndSortedDocs.map((doc) => /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
2087
2084
  /* @__PURE__ */ jsxRuntime.jsx(ColTitle, { children: /* @__PURE__ */ jsxRuntime.jsxs(TitleWrapper, { children: [
2088
2085
  /* @__PURE__ */ jsxRuntime.jsxs(TitleCell, { children: [
2089
- openInPane ? /* @__PURE__ */ jsxRuntime.jsx(DocTitleAnchorPane, { id: doc._id, type: doc._type, children: doc.title || "Untitled" }) : /* @__PURE__ */ jsxRuntime.jsx(DocTitleAnchor, { id: doc._id, type: doc._type, children: doc.title || "Untitled" }),
2086
+ openInPane ? /* @__PURE__ */ jsxRuntime.jsx(DocTitleAnchorPane, { id: doc._id, type: doc._type, children: doc.title || "Untitled" }) : /* @__PURE__ */ jsxRuntime.jsx(DocTitleAnchor, { id: doc._id, type: doc._type, structureTool, children: doc.title || "Untitled" }),
2090
2087
  showDocumentId && /* @__PURE__ */ jsxRuntime.jsx(DocId, { children: doc._id })
2091
2088
  ] }),
2092
2089
  docBadge && /* @__PURE__ */ jsxRuntime.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 = sanity.definePlugin((config = {}) => {
3114
3112
  const { healthDashboard = !0 } = config, dash = resolveDashboardConfig(healthDashboard), BoundSeoHealthTool = () => o__default.default.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",