sanity-plugin-seo-tools
Version:
> Upgrading from V2 to V3 is a breaking change. The `seo-tools` input has been replaced by a SEO pane which needs to be set-up using a custom desk structure as per the installation guide. Secondly, the previously automatically provided fields (focus keywo
24 lines (23 loc) • 1.52 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import React, { useMemo } from 'react';
import { SeoToolsContext } from '../context';
import { SeoToolsPaneView } from './SeoToolsPaneView';
import { SeoToolsPaneEmptyView } from './SeoToolsPaneEmptyView';
export var SeoToolsPane = function (_a) {
var _b, _c;
var options = _a.options, document = _a.document;
var contextValue = useMemo(function () { return (__assign({ fetch: true, select: function () { return ({}); }, render: function (seo, data, serpPreview) { return serpPreview; }, resolveProductionUrl: function () { return new URL('https://sanity.io'); } }, options)); }, []);
return (React.createElement(SeoToolsContext.Provider, { value: contextValue },
((_b = document === null || document === void 0 ? void 0 : document.displayed) === null || _b === void 0 ? void 0 : _b._rev) && React.createElement(SeoToolsPaneView, { document: document === null || document === void 0 ? void 0 : document.displayed }),
!((_c = document === null || document === void 0 ? void 0 : document.displayed) === null || _c === void 0 ? void 0 : _c._rev) && React.createElement(SeoToolsPaneEmptyView, null)));
};