@payloadcms/plugin-seo 3.0.0-canary.6041f49 → 3.0.0-canary.f1db24e

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.
@@ -1,4 +1,5 @@
1
1
  'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { useAllFormFields } from '@payloadcms/ui/forms/Form';
3
4
  import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
4
5
  import { useLocale } from '@payloadcms/ui/providers/Locale';
@@ -40,40 +41,60 @@ export const Preview = ({ hasGenerateURLFn })=>{
40
41
  docInfo,
41
42
  hasGenerateURLFn
42
43
  ]);
43
- return /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("div", null, t('plugin-seo:preview')), /*#__PURE__*/ React.createElement("div", {
44
- style: {
45
- color: '#9A9A9A',
46
- marginBottom: '5px'
47
- }
48
- }, t('plugin-seo:previewDescription')), /*#__PURE__*/ React.createElement("div", {
49
- style: {
50
- background: 'var(--theme-elevation-50)',
51
- borderRadius: '5px',
52
- boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',
53
- maxWidth: '600px',
54
- padding: '20px',
55
- pointerEvents: 'none',
56
- width: '100%'
57
- }
58
- }, /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("a", {
59
- href: href,
60
- style: {
61
- textDecoration: 'none'
62
- }
63
- }, href || 'https://...')), /*#__PURE__*/ React.createElement("h4", {
64
- style: {
65
- margin: 0
66
- }
67
- }, /*#__PURE__*/ React.createElement("a", {
68
- href: "/",
69
- style: {
70
- textDecoration: 'none'
71
- }
72
- }, metaTitle)), /*#__PURE__*/ React.createElement("p", {
73
- style: {
74
- margin: 0
75
- }
76
- }, metaDescription)));
44
+ return /*#__PURE__*/ _jsxs("div", {
45
+ children: [
46
+ /*#__PURE__*/ _jsx("div", {
47
+ children: t('plugin-seo:preview')
48
+ }),
49
+ /*#__PURE__*/ _jsx("div", {
50
+ style: {
51
+ color: '#9A9A9A',
52
+ marginBottom: '5px'
53
+ },
54
+ children: t('plugin-seo:previewDescription')
55
+ }),
56
+ /*#__PURE__*/ _jsxs("div", {
57
+ style: {
58
+ background: 'var(--theme-elevation-50)',
59
+ borderRadius: '5px',
60
+ boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',
61
+ maxWidth: '600px',
62
+ padding: '20px',
63
+ pointerEvents: 'none',
64
+ width: '100%'
65
+ },
66
+ children: [
67
+ /*#__PURE__*/ _jsx("div", {
68
+ children: /*#__PURE__*/ _jsx("a", {
69
+ href: href,
70
+ style: {
71
+ textDecoration: 'none'
72
+ },
73
+ children: href || 'https://...'
74
+ })
75
+ }),
76
+ /*#__PURE__*/ _jsx("h4", {
77
+ style: {
78
+ margin: 0
79
+ },
80
+ children: /*#__PURE__*/ _jsx("a", {
81
+ href: "/",
82
+ style: {
83
+ textDecoration: 'none'
84
+ },
85
+ children: metaTitle
86
+ })
87
+ }),
88
+ /*#__PURE__*/ _jsx("p", {
89
+ style: {
90
+ margin: 0
91
+ },
92
+ children: metaDescription
93
+ })
94
+ ]
95
+ })
96
+ ]
97
+ });
77
98
  };
78
99
 
79
100
  //# sourceMappingURL=Preview.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/Preview.tsx"],"sourcesContent":["'use client'\n\nimport type { FormField, UIField } from 'payload/types'\n\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useLocale } from '@payloadcms/ui/providers/Locale'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useEffect, useState } from 'react'\n\nimport type { GenerateURL } from '../types.js'\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype PreviewProps = UIField & {\n hasGenerateURLFn: boolean\n}\n\nexport const Preview: React.FC<PreviewProps> = ({ hasGenerateURLFn }) => {\n const { t } = useTranslation()\n\n const locale = useLocale()\n const [fields] = useAllFormFields()\n const docInfo = useDocumentInfo()\n\n const {\n 'meta.description': { value: metaDescription } = {} as FormField,\n 'meta.title': { value: metaTitle } = {} as FormField,\n } = fields\n\n const [href, setHref] = useState<string>()\n\n useEffect(() => {\n const getHref = async () => {\n const genURLResponse = await fetch('/api/plugin-seo/generate-url', {\n body: JSON.stringify({\n ...docInfo,\n doc: { ...fields },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateURL>[0]),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: newHref } = await genURLResponse.json()\n\n setHref(newHref)\n }\n\n if (hasGenerateURLFn && !href) {\n void getHref()\n }\n }, [fields, href, locale, docInfo, hasGenerateURLFn])\n\n return (\n <div>\n <div>{t('plugin-seo:preview')}</div>\n <div\n style={{\n color: '#9A9A9A',\n marginBottom: '5px',\n }}\n >\n {t('plugin-seo:previewDescription')}\n </div>\n <div\n style={{\n background: 'var(--theme-elevation-50)',\n borderRadius: '5px',\n boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',\n maxWidth: '600px',\n padding: '20px',\n pointerEvents: 'none',\n width: '100%',\n }}\n >\n <div>\n <a\n href={href}\n style={{\n textDecoration: 'none',\n }}\n >\n {href || 'https://...'}\n </a>\n </div>\n <h4\n style={{\n margin: 0,\n }}\n >\n <a\n href=\"/\"\n style={{\n textDecoration: 'none',\n }}\n >\n {metaTitle as string}\n </a>\n </h4>\n <p\n style={{\n margin: 0,\n }}\n >\n {metaDescription as string}\n </p>\n </div>\n </div>\n )\n}\n"],"names":["useAllFormFields","useDocumentInfo","useLocale","useTranslation","React","useEffect","useState","Preview","hasGenerateURLFn","t","locale","fields","docInfo","value","metaDescription","metaTitle","href","setHref","getHref","genURLResponse","fetch","body","JSON","stringify","doc","code","credentials","headers","method","result","newHref","json","div","style","color","marginBottom","background","borderRadius","boxShadow","maxWidth","padding","pointerEvents","width","a","textDecoration","h4","margin","p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PC,cAAc;QAChB;OAEC1B,EAAE,iDAEL,oBAACuB;QACCC,OAAO;YACLG,YAAY;YACZC,cAAc;YACdC,WAAW;YACXC,UAAU;YACVC,SAAS;YACTC,eAAe;YACfC,OAAO;QACT;qBAEA,oBAACV,2BACC,oBAACW;QACC3B,MAAMA;QACNiB,OAAO;YACLW,gBAAgB;QAClB;OAEC5B,QAAQ,+BAGb,oBAAC6B;QACCZ,OAAO;YACLa,QAAQ;QACV;qBAEA,oBAACH;QACC3B,MAAK;QACLiB,OAAO;YACLW,gBAAgB;QAClB;OAEC7B,2BAGL,oBAACgC;QACCd,OAAO;YACLa,QAAQ;QACV;OAEChC;AAKX,EAAC"}
1
+ {"version":3,"sources":["../../src/ui/Preview.tsx"],"sourcesContent":["'use client'\n\nimport type { FormField, UIField } from 'payload/types'\n\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useLocale } from '@payloadcms/ui/providers/Locale'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useEffect, useState } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../translations/index.js'\nimport type { GenerateURL } from '../types.js'\n\ntype PreviewProps = UIField & {\n hasGenerateURLFn: boolean\n}\n\nexport const Preview: React.FC<PreviewProps> = ({ hasGenerateURLFn }) => {\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const [fields] = useAllFormFields()\n const docInfo = useDocumentInfo()\n\n const {\n 'meta.description': { value: metaDescription } = {} as FormField,\n 'meta.title': { value: metaTitle } = {} as FormField,\n } = fields\n\n const [href, setHref] = useState<string>()\n\n useEffect(() => {\n const getHref = async () => {\n const genURLResponse = await fetch('/api/plugin-seo/generate-url', {\n body: JSON.stringify({\n ...docInfo,\n doc: { ...fields },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateURL>[0]),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: newHref } = await genURLResponse.json()\n\n setHref(newHref)\n }\n\n if (hasGenerateURLFn && !href) {\n void getHref()\n }\n }, [fields, href, locale, docInfo, hasGenerateURLFn])\n\n return (\n <div>\n <div>{t('plugin-seo:preview')}</div>\n <div\n style={{\n color: '#9A9A9A',\n marginBottom: '5px',\n }}\n >\n {t('plugin-seo:previewDescription')}\n </div>\n <div\n style={{\n background: 'var(--theme-elevation-50)',\n borderRadius: '5px',\n boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',\n maxWidth: '600px',\n padding: '20px',\n pointerEvents: 'none',\n width: '100%',\n }}\n >\n <div>\n <a\n href={href}\n style={{\n textDecoration: 'none',\n }}\n >\n {href || 'https://...'}\n </a>\n </div>\n <h4\n style={{\n margin: 0,\n }}\n >\n <a\n href=\"/\"\n style={{\n textDecoration: 'none',\n }}\n >\n {metaTitle as string}\n </a>\n </h4>\n <p\n style={{\n margin: 0,\n }}\n >\n {metaDescription as string}\n </p>\n </div>\n </div>\n )\n}\n"],"names":["useAllFormFields","useDocumentInfo","useLocale","useTranslation","React","useEffect","useState","Preview","hasGenerateURLFn","t","locale","fields","docInfo","value","metaDescription","metaTitle","href","setHref","getHref","genURLResponse","fetch","body","JSON","stringify","doc","code","credentials","headers","method","result","newHref","json","div","style","color","marginBottom","background","borderRadius","boxShadow","maxWidth","padding","pointerEvents","width","a","textDecoration","h4","margin","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,SAAS,EAAEC,QAAQ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AO;4BACLa,QAAQ;wBACV;kCAEA,cAAA,KAACH;4BACC3B,MAAK;4BACLiB,OAAO;gCACLW,gBAAgB;4BAClB;sCAEC7B;;;kCAGL,KAACgC;wBACCd,OAAO;4BACLa,QAAQ;wBACV;kCAEChC;;;;;;AAKX,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-seo",
3
- "version": "3.0.0-canary.6041f49",
3
+ "version": "3.0.0-canary.f1db24e",
4
4
  "description": "SEO plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -37,23 +37,29 @@
37
37
  "dist"
38
38
  ],
39
39
  "devDependencies": {
40
- "@types/react": "18.2.74",
41
- "@payloadcms/next": "3.0.0-canary.6041f49",
40
+ "@types/react": "npm:types-react@19.0.0-beta.2",
41
+ "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
42
42
  "@payloadcms/eslint-config": "1.1.1",
43
- "@payloadcms/translations": "3.0.0-canary.6041f49",
44
- "@payloadcms/ui": "3.0.0-canary.6041f49",
45
- "payload": "3.0.0-canary.6041f49"
43
+ "@payloadcms/next": "3.0.0-canary.f1db24e",
44
+ "@payloadcms/translations": "3.0.0-canary.f1db24e",
45
+ "payload": "3.0.0-canary.f1db24e",
46
+ "@payloadcms/ui": "3.0.0-canary.f1db24e"
46
47
  },
47
48
  "peerDependencies": {
48
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
49
- "@payloadcms/translations": "3.0.0-canary.6041f49",
50
- "@payloadcms/ui": "3.0.0-canary.6041f49",
51
- "payload": "3.0.0-canary.6041f49"
49
+ "react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
50
+ "react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
51
+ "@payloadcms/translations": "3.0.0-canary.f1db24e",
52
+ "payload": "3.0.0-canary.f1db24e",
53
+ "@payloadcms/ui": "3.0.0-canary.f1db24e"
52
54
  },
53
55
  "publishConfig": {
54
56
  "registry": "https://registry.npmjs.org/"
55
57
  },
56
58
  "homepage:": "https://payloadcms.com",
59
+ "overrides": {
60
+ "@types/react": "npm:types-react@19.0.0-beta.2",
61
+ "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2"
62
+ },
57
63
  "scripts": {
58
64
  "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
59
65
  "build:swc": "swc ./src -d ./dist --config-file .swcrc",