@payloadcms/plugin-seo 3.0.0-canary.cee5702 → 3.0.0-canary.cf66341
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/defaults.js.map +1 -1
- package/dist/exports/client.d.ts +6 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +7 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/fields.d.ts +6 -0
- package/dist/exports/fields.d.ts.map +1 -0
- package/dist/exports/fields.js +7 -0
- package/dist/exports/fields.js.map +1 -0
- package/dist/exports/types.js.map +1 -1
- package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts +8 -0
- package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts.map +1 -0
- package/dist/fields/{MetaDescription.js → MetaDescription/MetaDescriptionComponent.js} +32 -26
- package/dist/fields/MetaDescription/MetaDescriptionComponent.js.map +1 -0
- package/dist/fields/MetaDescription/index.d.ts +12 -0
- package/dist/fields/MetaDescription/index.d.ts.map +1 -0
- package/dist/fields/MetaDescription/index.js +20 -0
- package/dist/fields/MetaDescription/index.js.map +1 -0
- package/dist/fields/MetaImage/MetaImageComponent.d.ts +8 -0
- package/dist/fields/MetaImage/MetaImageComponent.d.ts.map +1 -0
- package/dist/fields/{MetaImage.js → MetaImage/MetaImageComponent.js} +36 -27
- package/dist/fields/MetaImage/MetaImageComponent.js.map +1 -0
- package/dist/fields/MetaImage/index.d.ts +13 -0
- package/dist/fields/MetaImage/index.d.ts.map +1 -0
- package/dist/fields/MetaImage/index.js +23 -0
- package/dist/fields/MetaImage/index.js.map +1 -0
- package/dist/fields/MetaTitle/MetaTitleComponent.d.ts +9 -0
- package/dist/fields/MetaTitle/MetaTitleComponent.d.ts.map +1 -0
- package/dist/fields/{MetaTitle.js → MetaTitle/MetaTitleComponent.js} +33 -27
- package/dist/fields/MetaTitle/MetaTitleComponent.js.map +1 -0
- package/dist/fields/MetaTitle/index.d.ts +12 -0
- package/dist/fields/MetaTitle/index.d.ts.map +1 -0
- package/dist/fields/MetaTitle/index.js +20 -0
- package/dist/fields/MetaTitle/index.js.map +1 -0
- package/dist/fields/Overview/OverviewComponent.d.ts +10 -0
- package/dist/fields/Overview/OverviewComponent.d.ts.map +1 -0
- package/dist/{ui/Overview.js → fields/Overview/OverviewComponent.js} +8 -6
- package/dist/fields/Overview/OverviewComponent.js.map +1 -0
- package/dist/fields/Overview/index.d.ts +26 -0
- package/dist/fields/Overview/index.d.ts.map +1 -0
- package/dist/fields/Overview/index.js +22 -0
- package/dist/fields/Overview/index.js.map +1 -0
- package/dist/fields/Preview/PreviewComponent.d.ts +10 -0
- package/dist/fields/Preview/PreviewComponent.d.ts.map +1 -0
- package/dist/{ui/Preview.js → fields/Preview/PreviewComponent.js} +19 -13
- package/dist/fields/Preview/PreviewComponent.js.map +1 -0
- package/dist/fields/Preview/index.d.ts +24 -0
- package/dist/fields/Preview/index.d.ts.map +1 -0
- package/dist/fields/Preview/index.js +22 -0
- package/dist/fields/Preview/index.js.map +1 -0
- package/dist/fields/index.scss +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -111
- package/dist/index.js.map +1 -1
- package/dist/translations/index.d.ts +22 -0
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/translations/index.js +22 -0
- package/dist/translations/index.js.map +1 -1
- package/dist/translations/ru.json +22 -0
- package/dist/types.d.ts +15 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/LengthIndicator.js +1 -1
- package/dist/ui/LengthIndicator.js.map +1 -1
- package/dist/ui/Pill.js.map +1 -1
- package/package.json +33 -23
- package/dist/fields/MetaDescription.d.ts +0 -9
- package/dist/fields/MetaDescription.d.ts.map +0 -1
- package/dist/fields/MetaDescription.js.map +0 -1
- package/dist/fields/MetaImage.d.ts +0 -8
- package/dist/fields/MetaImage.d.ts.map +0 -1
- package/dist/fields/MetaImage.js.map +0 -1
- package/dist/fields/MetaTitle.d.ts +0 -9
- package/dist/fields/MetaTitle.d.ts.map +0 -1
- package/dist/fields/MetaTitle.js.map +0 -1
- package/dist/ui/Overview.d.ts +0 -3
- package/dist/ui/Overview.d.ts.map +0 -1
- package/dist/ui/Overview.js.map +0 -1
- package/dist/ui/Preview.d.ts +0 -8
- package/dist/ui/Preview.d.ts.map +0 -1
- package/dist/ui/Preview.js.map +0 -1
package/dist/defaults.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const defaults = {\n description: {\n maxLength: 150,\n minLength: 100,\n },\n title: {\n maxLength: 60,\n minLength: 50,\n },\n}\n"],"names":["defaults","description","maxLength","minLength","title"],"
|
|
1
|
+
{"version":3,"sources":["../src/defaults.ts"],"sourcesContent":["export const defaults = {\n description: {\n maxLength: 150,\n minLength: 100,\n },\n title: {\n maxLength: 60,\n minLength: 50,\n },\n}\n"],"names":["defaults","description","maxLength","minLength","title"],"mappings":"AAAA,OAAO,MAAMA,WAAW;IACtBC,aAAa;QACXC,WAAW;QACXC,WAAW;IACb;IACAC,OAAO;QACLF,WAAW;QACXC,WAAW;IACb;AACF,EAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MetaDescriptionComponent } from '../fields/MetaDescription/MetaDescriptionComponent.js';
|
|
2
|
+
export { MetaImageComponent } from '../fields/MetaImage/MetaImageComponent.js';
|
|
3
|
+
export { MetaTitleComponent } from '../fields/MetaTitle/MetaTitleComponent.js';
|
|
4
|
+
export { OverviewComponent } from '../fields/Overview/OverviewComponent.js';
|
|
5
|
+
export { PreviewComponent } from '../fields/Preview/PreviewComponent.js';
|
|
6
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { MetaDescriptionComponent } from '../fields/MetaDescription/MetaDescriptionComponent.js';
|
|
2
|
+
export { MetaImageComponent } from '../fields/MetaImage/MetaImageComponent.js';
|
|
3
|
+
export { MetaTitleComponent } from '../fields/MetaTitle/MetaTitleComponent.js';
|
|
4
|
+
export { OverviewComponent } from '../fields/Overview/OverviewComponent.js';
|
|
5
|
+
export { PreviewComponent } from '../fields/Preview/PreviewComponent.js';
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { MetaDescriptionComponent } from '../fields/MetaDescription/MetaDescriptionComponent.js'\nexport { MetaImageComponent } from '../fields/MetaImage/MetaImageComponent.js'\nexport { MetaTitleComponent } from '../fields/MetaTitle/MetaTitleComponent.js'\nexport { OverviewComponent } from '../fields/Overview/OverviewComponent.js'\nexport { PreviewComponent } from '../fields/Preview/PreviewComponent.js'\n"],"names":["MetaDescriptionComponent","MetaImageComponent","MetaTitleComponent","OverviewComponent","PreviewComponent"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,wDAAuD;AAChG,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SAASC,iBAAiB,QAAQ,0CAAyC;AAC3E,SAASC,gBAAgB,QAAQ,wCAAuC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MetaDescriptionField } from '../fields/MetaDescription/index.js';
|
|
2
|
+
export { MetaImageField } from '../fields/MetaImage/index.js';
|
|
3
|
+
export { MetaTitleField } from '../fields/MetaTitle/index.js';
|
|
4
|
+
export { OverviewField } from '../fields/Overview/index.js';
|
|
5
|
+
export { PreviewField } from '../fields/Preview/index.js';
|
|
6
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/exports/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { MetaDescriptionField } from '../fields/MetaDescription/index.js';
|
|
2
|
+
export { MetaImageField } from '../fields/MetaImage/index.js';
|
|
3
|
+
export { MetaTitleField } from '../fields/MetaTitle/index.js';
|
|
4
|
+
export { OverviewField } from '../fields/Overview/index.js';
|
|
5
|
+
export { PreviewField } from '../fields/Preview/index.js';
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/exports/fields.ts"],"sourcesContent":["export { MetaDescriptionField } from '../fields/MetaDescription/index.js'\nexport { MetaImageField } from '../fields/MetaImage/index.js'\nexport { MetaTitleField } from '../fields/MetaTitle/index.js'\nexport { OverviewField } from '../fields/Overview/index.js'\nexport { PreviewField } from '../fields/Preview/index.js'\n"],"names":["MetaDescriptionField","MetaImageField","MetaTitleField","OverviewField","PreviewField"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,YAAY,QAAQ,6BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export type {\n GenerateDescription,\n GenerateImage,\n GenerateTitle,\n GenerateURL,\n Meta,\n SEOPluginConfig,\n} from '../types.js'\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export type {\n GenerateDescription,\n GenerateImage,\n GenerateTitle,\n GenerateURL,\n Meta,\n SEOPluginConfig,\n} from '../types.js'\n"],"names":[],"mappings":"AAAA,WAOoB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TextareaFieldProps } from 'payload';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type MetaDescriptionProps = {
|
|
4
|
+
readonly hasGenerateDescriptionFn: boolean;
|
|
5
|
+
} & TextareaFieldProps;
|
|
6
|
+
export declare const MetaDescriptionComponent: React.FC<MetaDescriptionProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=MetaDescriptionComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaDescriptionComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaDescription/MetaDescriptionComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAYjD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAU1C,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAA;CAC3C,GAAG,kBAAkB,CAAA;AAEtB,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4InE,CAAA"}
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { TextareaInput } from '@payloadcms/ui
|
|
4
|
-
import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
|
|
5
|
-
import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
|
|
6
|
-
import { useAllFormFields } from '@payloadcms/ui/forms/Form';
|
|
7
|
-
import { useField } from '@payloadcms/ui/forms/useField';
|
|
8
|
-
import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
|
|
9
|
-
import { useLocale } from '@payloadcms/ui/providers/Locale';
|
|
10
|
-
import { useTranslation } from '@payloadcms/ui/providers/Translation';
|
|
3
|
+
import { FieldLabel, TextareaInput, useDocumentInfo, useField, useFieldProps, useForm, useLocale, useTranslation } from '@payloadcms/ui';
|
|
11
4
|
import React, { useCallback } from 'react';
|
|
12
|
-
import { defaults } from '
|
|
13
|
-
import { LengthIndicator } from '
|
|
5
|
+
import { defaults } from '../../defaults.js';
|
|
6
|
+
import { LengthIndicator } from '../../ui/LengthIndicator.js';
|
|
14
7
|
const { maxLength, minLength } = defaults.description;
|
|
15
|
-
export const
|
|
16
|
-
const {
|
|
8
|
+
export const MetaDescriptionComponent = (props)=>{
|
|
9
|
+
const { field: { admin: { components: { Label } }, label, required }, hasGenerateDescriptionFn, labelProps } = props;
|
|
17
10
|
const { path: pathFromContext } = useFieldProps();
|
|
18
11
|
const { t } = useTranslation();
|
|
19
12
|
const locale = useLocale();
|
|
20
|
-
const
|
|
13
|
+
const { getData } = useForm();
|
|
21
14
|
const docInfo = useDocumentInfo();
|
|
22
15
|
const field = useField({
|
|
23
|
-
path
|
|
16
|
+
path: pathFromContext
|
|
24
17
|
});
|
|
25
18
|
const { errorMessage, setValue, showError, value } = field;
|
|
26
19
|
const regenerateDescription = useCallback(async ()=>{
|
|
27
20
|
if (!hasGenerateDescriptionFn) return;
|
|
28
21
|
const genDescriptionResponse = await fetch('/api/plugin-seo/generate-description', {
|
|
29
22
|
body: JSON.stringify({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
id: docInfo.id,
|
|
24
|
+
slug: docInfo.slug,
|
|
25
|
+
doc: getData(),
|
|
26
|
+
docPermissions: docInfo.docPermissions,
|
|
27
|
+
hasPublishPermission: docInfo.hasPublishPermission,
|
|
28
|
+
hasSavePermission: docInfo.hasSavePermission,
|
|
29
|
+
initialData: docInfo.initialData,
|
|
30
|
+
initialState: docInfo.initialState,
|
|
31
|
+
locale: typeof locale === 'object' ? locale?.code : locale,
|
|
32
|
+
title: docInfo.title
|
|
35
33
|
}),
|
|
36
34
|
credentials: 'include',
|
|
37
35
|
headers: {
|
|
@@ -42,11 +40,11 @@ export const MetaDescription = (props)=>{
|
|
|
42
40
|
const { result: generatedDescription } = await genDescriptionResponse.json();
|
|
43
41
|
setValue(generatedDescription || '');
|
|
44
42
|
}, [
|
|
45
|
-
fields,
|
|
46
|
-
setValue,
|
|
47
43
|
hasGenerateDescriptionFn,
|
|
44
|
+
docInfo,
|
|
45
|
+
getData,
|
|
48
46
|
locale,
|
|
49
|
-
|
|
47
|
+
setValue
|
|
50
48
|
]);
|
|
51
49
|
return /*#__PURE__*/ _jsxs("div", {
|
|
52
50
|
style: {
|
|
@@ -63,7 +61,8 @@ export const MetaDescription = (props)=>{
|
|
|
63
61
|
className: "plugin-seo__field",
|
|
64
62
|
children: [
|
|
65
63
|
/*#__PURE__*/ _jsx(FieldLabel, {
|
|
66
|
-
|
|
64
|
+
Label: Label,
|
|
65
|
+
field: null,
|
|
67
66
|
label: label,
|
|
68
67
|
...labelProps || {}
|
|
69
68
|
}),
|
|
@@ -71,7 +70,9 @@ export const MetaDescription = (props)=>{
|
|
|
71
70
|
children: [
|
|
72
71
|
" — ",
|
|
73
72
|
/*#__PURE__*/ _jsx("button", {
|
|
74
|
-
onClick:
|
|
73
|
+
onClick: ()=>{
|
|
74
|
+
void regenerateDescription();
|
|
75
|
+
},
|
|
75
76
|
style: {
|
|
76
77
|
background: 'none',
|
|
77
78
|
backgroundColor: 'transparent',
|
|
@@ -113,7 +114,12 @@ export const MetaDescription = (props)=>{
|
|
|
113
114
|
position: 'relative'
|
|
114
115
|
},
|
|
115
116
|
children: /*#__PURE__*/ _jsx(TextareaInput, {
|
|
116
|
-
|
|
117
|
+
Error: {
|
|
118
|
+
type: 'client',
|
|
119
|
+
Component: null,
|
|
120
|
+
RenderedComponent: errorMessage
|
|
121
|
+
},
|
|
122
|
+
label: label,
|
|
117
123
|
onChange: setValue,
|
|
118
124
|
path: pathFromContext,
|
|
119
125
|
required: required,
|
|
@@ -140,4 +146,4 @@ export const MetaDescription = (props)=>{
|
|
|
140
146
|
});
|
|
141
147
|
};
|
|
142
148
|
|
|
143
|
-
//# sourceMappingURL=
|
|
149
|
+
//# sourceMappingURL=MetaDescriptionComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaDescription/MetaDescriptionComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType, Options } from '@payloadcms/ui'\nimport type { TextareaFieldProps } from 'payload'\n\nimport {\n FieldLabel,\n TextareaInput,\n useDocumentInfo,\n useField,\n useFieldProps,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../../translations/index.js'\nimport type { GenerateDescription } from '../../types.js'\n\nimport { defaults } from '../../defaults.js'\nimport { LengthIndicator } from '../../ui/LengthIndicator.js'\n\nconst { maxLength, minLength } = defaults.description\n\ntype MetaDescriptionProps = {\n readonly hasGenerateDescriptionFn: boolean\n} & TextareaFieldProps\n\nexport const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props) => {\n const {\n field: {\n admin: {\n components: { Label },\n },\n label,\n required,\n },\n hasGenerateDescriptionFn,\n labelProps,\n } = props\n const { path: pathFromContext } = useFieldProps()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const field: FieldType<string> = useField({\n path: pathFromContext,\n } as Options)\n\n const { errorMessage, setValue, showError, value } = field\n\n const regenerateDescription = useCallback(async () => {\n if (!hasGenerateDescriptionFn) return\n\n const genDescriptionResponse = await fetch('/api/plugin-seo/generate-description', {\n body: JSON.stringify({\n id: docInfo.id,\n slug: docInfo.slug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: docInfo.initialState,\n locale: typeof locale === 'object' ? locale?.code : locale,\n title: docInfo.title,\n } satisfies Omit<Parameters<GenerateDescription>[0], 'req'>),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedDescription } = await genDescriptionResponse.json()\n\n setValue(generatedDescription || '')\n }, [hasGenerateDescriptionFn, docInfo, getData, locale, setValue])\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div\n style={{\n marginBottom: '5px',\n position: 'relative',\n }}\n >\n <div className=\"plugin-seo__field\">\n <FieldLabel Label={Label} field={null} label={label} {...(labelProps || {})} />\n {hasGenerateDescriptionFn && (\n <React.Fragment>\n — \n <button\n onClick={() => {\n void regenerateDescription()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n <div\n style={{\n color: '#9A9A9A',\n }}\n >\n {t('plugin-seo:lengthTipDescription', { maxLength, minLength })}\n <a\n href=\"https://developers.google.com/search/docs/advanced/appearance/snippet#meta-descriptions\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {t('plugin-seo:bestPractices')}\n </a>\n </div>\n </div>\n <div\n style={{\n marginBottom: '10px',\n position: 'relative',\n }}\n >\n <TextareaInput\n Error={{\n type: 'client',\n Component: null,\n RenderedComponent: errorMessage,\n }}\n label={label}\n onChange={setValue}\n path={pathFromContext}\n required={required}\n showError={showError}\n style={{\n marginBottom: 0,\n }}\n value={value}\n />\n </div>\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <LengthIndicator maxLength={maxLength} minLength={minLength} text={value} />\n </div>\n </div>\n )\n}\n"],"names":["FieldLabel","TextareaInput","useDocumentInfo","useField","useFieldProps","useForm","useLocale","useTranslation","React","useCallback","defaults","LengthIndicator","maxLength","minLength","description","MetaDescriptionComponent","props","field","admin","components","Label","label","required","hasGenerateDescriptionFn","labelProps","path","pathFromContext","t","locale","getData","docInfo","errorMessage","setValue","showError","value","regenerateDescription","genDescriptionResponse","fetch","body","JSON","stringify","id","slug","doc","docPermissions","hasPublishPermission","hasSavePermission","initialData","initialState","code","title","credentials","headers","method","result","generatedDescription","json","div","style","marginBottom","position","className","Fragment","button","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","a","href","rel","target","Error","Component","RenderedComponent","onChange","alignItems","display","width","text"],"mappings":"AAAA;;AAKA,SACEA,UAAU,EACVC,aAAa,EACbC,eAAe,EACfC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,QAAQ,QAAQ,oBAAmB;AAC5C,SAASC,eAAe,QAAQ,8BAA6B;AAE7D,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH,SAASI,WAAW;AAMrD,OAAO,MAAMC,2BAA2D,CAACC;IACvE,MAAM,EACJC,OAAO,EACLC,OAAO,EACLC,YAAY,EAAEC,KAAK,EAAE,EACtB,EACDC,KAAK,EACLC,QAAQ,EACT,EACDC,wBAAwB,EACxBC,UAAU,EACX,GAAGR;IACJ,MAAM,EAAES,MAAMC,eAAe,E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,KAACC;wCACCC,SAAS;4CACP,KAAK7B;wCACP;wCACAuB,OAAO;4CACLO,YAAY;4CACZC,iBAAiB;4CACjBC,QAAQ;4CACRC,OAAO;4CACPC,QAAQ;4CACRC,SAAS;4CACTC,gBAAgB;wCAClB;wCACAC,MAAK;kDAEJ7C,EAAE;;;;;;kCAKX,MAAC8B;wBACCC,OAAO;4BACLU,OAAO;wBACT;;4BAECzC,EAAE,mCAAmC;gCAAEf;gCAAWC;4BAAU;0CAC7D,KAAC4D;gCACCC,MAAK;gCACLC,KAAI;gCACJC,QAAO;0CAENjD,EAAE;;;;;;0BAIT,KAAC8B;gBACCC,OAAO;oBACLC,cAAc;oBACdC,UAAU;gBACZ;0BAEA,cAAA,KAAC3D;oBACC4E,OAAO;wBACLL,MAAM;wBACNM,WAAW;wBACXC,mBAAmBhD;oBACrB;oBACAV,OAAOA;oBACP2D,UAAUhD;oBACVP,MAAMC;oBACNJ,UAAUA;oBACVW,WAAWA;oBACXyB,OAAO;wBACLC,cAAc;oBAChB;oBACAzB,OAAOA;;;0BAGX,KAACuB;gBACCC,OAAO;oBACLuB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAACxE;oBAAgBC,WAAWA;oBAAWC,WAAWA;oBAAWuE,MAAMlD;;;;;AAI3E,EAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextareaField } from 'payload';
|
|
2
|
+
interface FieldFunctionProps {
|
|
3
|
+
/**
|
|
4
|
+
* Tell the component if the generate function is available as configured in the plugin config
|
|
5
|
+
*/
|
|
6
|
+
hasGenerateFn?: boolean;
|
|
7
|
+
overrides?: Partial<TextareaField>;
|
|
8
|
+
}
|
|
9
|
+
type FieldFunction = ({ hasGenerateFn, overrides }: FieldFunctionProps) => TextareaField;
|
|
10
|
+
export declare const MetaDescriptionField: FieldFunction;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaDescription/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,UAAU,kBAAkB;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;CACnC;AAED,KAAK,aAAa,GAAG,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,kBAAkB,KAAK,aAAa,CAAA;AAExF,eAAO,MAAM,oBAAoB,EAAE,aAiBlC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const MetaDescriptionField = ({ hasGenerateFn = false, overrides })=>{
|
|
2
|
+
return {
|
|
3
|
+
name: 'description',
|
|
4
|
+
type: 'textarea',
|
|
5
|
+
admin: {
|
|
6
|
+
components: {
|
|
7
|
+
Field: {
|
|
8
|
+
clientProps: {
|
|
9
|
+
hasGenerateDescriptionFn: hasGenerateFn
|
|
10
|
+
},
|
|
11
|
+
path: '@payloadcms/plugin-seo/client#MetaDescriptionComponent'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
localized: true,
|
|
16
|
+
...overrides ?? {}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaDescription/index.ts"],"sourcesContent":["import type { TextareaField } from 'payload'\n\ninterface FieldFunctionProps {\n /**\n * Tell the component if the generate function is available as configured in the plugin config\n */\n hasGenerateFn?: boolean\n overrides?: Partial<TextareaField>\n}\n\ntype FieldFunction = ({ hasGenerateFn, overrides }: FieldFunctionProps) => TextareaField\n\nexport const MetaDescriptionField: FieldFunction = ({ hasGenerateFn = false, overrides }) => {\n return {\n name: 'description',\n type: 'textarea',\n admin: {\n components: {\n Field: {\n clientProps: {\n hasGenerateDescriptionFn: hasGenerateFn,\n },\n path: '@payloadcms/plugin-seo/client#MetaDescriptionComponent',\n },\n },\n },\n localized: true,\n ...((overrides as unknown as TextareaField) ?? {}),\n }\n}\n"],"names":["MetaDescriptionField","hasGenerateFn","overrides","name","type","admin","components","Field","clientProps","hasGenerateDescriptionFn","path","localized"],"mappings":"AAYA,OAAO,MAAMA,uBAAsC,CAAC,EAAEC,gBAAgB,KAAK,EAAEC,SAAS,EAAE;IACtF,OAAO;QACLC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,YAAY;gBACVC,OAAO;oBACLC,aAAa;wBACXC,0BAA0BR;oBAC5B;oBACAS,MAAM;gBACR;YACF;QACF;QACAC,WAAW;QACX,GAAI,AAACT,aAA0C,CAAC,CAAC;IACnD;AACF,EAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UploadFieldProps } from '@payloadcms/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type MetaImageProps = {
|
|
4
|
+
readonly hasGenerateImageFn: boolean;
|
|
5
|
+
} & UploadFieldProps;
|
|
6
|
+
export declare const MetaImageComponent: React.FC<MetaImageProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=MetaImageComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaImageComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAa1E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,gBAAgB,CAAA;AAEpB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA6JvD,CAAA"}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { UploadInput } from '@payloadcms/ui
|
|
4
|
-
import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
|
|
5
|
-
import { useAllFormFields } from '@payloadcms/ui/forms/Form';
|
|
6
|
-
import { useField } from '@payloadcms/ui/forms/useField';
|
|
7
|
-
import { useConfig } from '@payloadcms/ui/providers/Config';
|
|
8
|
-
import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
|
|
9
|
-
import { useLocale } from '@payloadcms/ui/providers/Locale';
|
|
10
|
-
import { useTranslation } from '@payloadcms/ui/providers/Translation';
|
|
3
|
+
import { FieldLabel, UploadInput, useConfig, useDocumentInfo, useField, useFieldProps, useForm, useLocale, useTranslation } from '@payloadcms/ui';
|
|
11
4
|
import React, { useCallback } from 'react';
|
|
12
|
-
import { Pill } from '
|
|
13
|
-
export const
|
|
14
|
-
const {
|
|
15
|
-
const
|
|
5
|
+
import { Pill } from '../../ui/Pill.js';
|
|
6
|
+
export const MetaImageComponent = (props)=>{
|
|
7
|
+
const { field: { admin: { components: { Label } }, label, relationTo, required }, hasGenerateImageFn, labelProps } = props || {};
|
|
8
|
+
const { path: pathFromContext } = useFieldProps();
|
|
9
|
+
const field = useField({
|
|
10
|
+
...props,
|
|
11
|
+
path: pathFromContext
|
|
12
|
+
});
|
|
16
13
|
const { t } = useTranslation();
|
|
17
14
|
const locale = useLocale();
|
|
18
|
-
const
|
|
15
|
+
const { getData } = useForm();
|
|
19
16
|
const docInfo = useDocumentInfo();
|
|
20
17
|
const { errorMessage, setValue, showError, value } = field;
|
|
21
18
|
const regenerateImage = useCallback(async ()=>{
|
|
22
19
|
if (!hasGenerateImageFn) return;
|
|
23
20
|
const genImageResponse = await fetch('/api/plugin-seo/generate-image', {
|
|
24
21
|
body: JSON.stringify({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
id: docInfo.id,
|
|
23
|
+
slug: docInfo.slug,
|
|
24
|
+
doc: getData(),
|
|
25
|
+
docPermissions: docInfo.docPermissions,
|
|
26
|
+
hasPublishPermission: docInfo.hasPublishPermission,
|
|
27
|
+
hasSavePermission: docInfo.hasSavePermission,
|
|
28
|
+
initialData: docInfo.initialData,
|
|
29
|
+
initialState: docInfo.initialState,
|
|
30
|
+
locale: typeof locale === 'object' ? locale?.code : locale,
|
|
31
|
+
title: docInfo.title
|
|
30
32
|
}),
|
|
31
33
|
credentials: 'include',
|
|
32
34
|
headers: {
|
|
@@ -34,17 +36,17 @@ export const MetaImage = (props)=>{
|
|
|
34
36
|
},
|
|
35
37
|
method: 'POST'
|
|
36
38
|
});
|
|
37
|
-
const
|
|
39
|
+
const generatedImage = await genImageResponse.text();
|
|
38
40
|
setValue(generatedImage || '');
|
|
39
41
|
}, [
|
|
40
|
-
fields,
|
|
41
|
-
setValue,
|
|
42
42
|
hasGenerateImageFn,
|
|
43
|
+
docInfo,
|
|
44
|
+
getData,
|
|
43
45
|
locale,
|
|
44
|
-
|
|
46
|
+
setValue
|
|
45
47
|
]);
|
|
46
48
|
const hasImage = Boolean(value);
|
|
47
|
-
const config = useConfig();
|
|
49
|
+
const { config } = useConfig();
|
|
48
50
|
const { collections, routes: { api } = {}, serverURL } = config;
|
|
49
51
|
const collection = collections?.find((coll)=>coll.slug === relationTo) || undefined;
|
|
50
52
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -62,7 +64,8 @@ export const MetaImage = (props)=>{
|
|
|
62
64
|
className: "plugin-seo__field",
|
|
63
65
|
children: [
|
|
64
66
|
/*#__PURE__*/ _jsx(FieldLabel, {
|
|
65
|
-
|
|
67
|
+
Label: Label,
|
|
68
|
+
field: null,
|
|
66
69
|
label: label,
|
|
67
70
|
...labelProps || {}
|
|
68
71
|
}),
|
|
@@ -70,7 +73,9 @@ export const MetaImage = (props)=>{
|
|
|
70
73
|
children: [
|
|
71
74
|
" — ",
|
|
72
75
|
/*#__PURE__*/ _jsx("button", {
|
|
73
|
-
onClick:
|
|
76
|
+
onClick: ()=>{
|
|
77
|
+
void regenerateImage();
|
|
78
|
+
},
|
|
74
79
|
style: {
|
|
75
80
|
background: 'none',
|
|
76
81
|
backgroundColor: 'transparent',
|
|
@@ -101,7 +106,11 @@ export const MetaImage = (props)=>{
|
|
|
101
106
|
position: 'relative'
|
|
102
107
|
},
|
|
103
108
|
children: /*#__PURE__*/ _jsx(UploadInput, {
|
|
104
|
-
|
|
109
|
+
Error: {
|
|
110
|
+
type: 'client',
|
|
111
|
+
Component: null,
|
|
112
|
+
RenderedComponent: errorMessage
|
|
113
|
+
},
|
|
105
114
|
api: api,
|
|
106
115
|
collection: collection,
|
|
107
116
|
filterOptions: field.filterOptions,
|
|
@@ -140,4 +149,4 @@ export const MetaImage = (props)=>{
|
|
|
140
149
|
});
|
|
141
150
|
};
|
|
142
151
|
|
|
143
|
-
//# sourceMappingURL=
|
|
152
|
+
//# sourceMappingURL=MetaImageComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType, Options, UploadFieldProps } from '@payloadcms/ui'\n\nimport {\n FieldLabel,\n UploadInput,\n useConfig,\n useDocumentInfo,\n useField,\n useFieldProps,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../../translations/index.js'\nimport type { GenerateImage } from '../../types.js'\n\nimport { Pill } from '../../ui/Pill.js'\n\ntype MetaImageProps = {\n readonly hasGenerateImageFn: boolean\n} & UploadFieldProps\n\nexport const MetaImageComponent: React.FC<MetaImageProps> = (props) => {\n const {\n field: {\n admin: {\n components: { Label },\n },\n label,\n relationTo,\n required,\n },\n hasGenerateImageFn,\n labelProps,\n } = props || {}\n const { path: pathFromContext } = useFieldProps()\n\n const field: FieldType<string> = useField({ ...props, path: pathFromContext } as Options)\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const { errorMessage, setValue, showError, value } = field\n\n const regenerateImage = useCallback(async () => {\n if (!hasGenerateImageFn) return\n\n const genImageResponse = await fetch('/api/plugin-seo/generate-image', {\n body: JSON.stringify({\n id: docInfo.id,\n slug: docInfo.slug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: docInfo.initialState,\n locale: typeof locale === 'object' ? locale?.code : locale,\n title: docInfo.title,\n } satisfies Omit<Parameters<GenerateImage>[0], 'req'>),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const generatedImage = await genImageResponse.text()\n\n setValue(generatedImage || '')\n }, [hasGenerateImageFn, docInfo, getData, locale, setValue])\n\n const hasImage = Boolean(value)\n\n const { config } = useConfig()\n\n const { collections, routes: { api } = {}, serverURL } = config\n\n const collection = collections?.find((coll) => coll.slug === relationTo) || undefined\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div\n style={{\n marginBottom: '5px',\n position: 'relative',\n }}\n >\n <div className=\"plugin-seo__field\">\n <FieldLabel Label={Label} field={null} label={label} {...(labelProps || {})} />\n {hasGenerateImageFn && (\n <React.Fragment>\n — \n <button\n onClick={() => {\n void regenerateImage()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n {hasGenerateImageFn && (\n <div\n style={{\n color: '#9A9A9A',\n }}\n >\n {t('plugin-seo:imageAutoGenerationTip')}\n </div>\n )}\n </div>\n <div\n style={{\n marginBottom: '10px',\n position: 'relative',\n }}\n >\n <UploadInput\n Error={{\n type: 'client',\n Component: null,\n RenderedComponent: errorMessage,\n }}\n api={api}\n collection={collection}\n filterOptions={field.filterOptions}\n label={undefined}\n onChange={(incomingImage) => {\n if (incomingImage !== null) {\n const { id: incomingID } = incomingImage\n setValue(incomingID)\n } else {\n setValue(null)\n }\n }}\n relationTo={relationTo}\n required={required}\n serverURL={serverURL}\n showError={showError}\n style={{\n marginBottom: 0,\n }}\n value={value}\n />\n </div>\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <Pill\n backgroundColor={hasImage ? 'green' : 'red'}\n color=\"white\"\n label={hasImage ? t('plugin-seo:good') : t('plugin-seo:noImage')}\n />\n </div>\n </div>\n )\n}\n"],"names":["FieldLabel","UploadInput","useConfig","useDocumentInfo","useField","useFieldProps","useForm","useLocale","useTranslation","React","useCallback","Pill","MetaImageComponent","props","field","admin","components","Label","label","relationTo","required","hasGenerateImageFn","labelProps","path","pathFromContext","t","locale","getData","docInfo","errorMessage","setValue","showError","value","regenerateImage","genImageResponse","fetch","body","JSON","stringify","id","slug","doc","docPermissions","hasPublishPermission","hasSavePermission","initialData","initialState","code","title","credentials","headers","method","generatedImage","text","hasImage","Boolean","config","collections","routes","api","serverURL","collection","find","coll","undefined","div","style","marginBottom","position","className","Fragment","button","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","Error","Component","RenderedComponent","filterOptions","onChange","incomingImage","incomingID","alignItems","display","width"],"mappings":"AAAA;;AAIA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,IAAI,QAAQ,mBAAkB;AAMvC,OAAO,MAAMC,qBAA+C,CAACC;IAC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gBACCC,OAAO;oBACLsB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAAC/E;oBACC+D,iBAAiBpB,WAAW,UAAU;oBACtCsB,OAAM;oBACN1D,OAAOoC,WAAW7B,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UploadField } from 'payload';
|
|
2
|
+
interface FieldFunctionProps {
|
|
3
|
+
/**
|
|
4
|
+
* Tell the component if the generate function is available as configured in the plugin config
|
|
5
|
+
*/
|
|
6
|
+
hasGenerateFn?: boolean;
|
|
7
|
+
overrides?: Partial<UploadField>;
|
|
8
|
+
relationTo: string;
|
|
9
|
+
}
|
|
10
|
+
type FieldFunction = ({ hasGenerateFn, overrides }: FieldFunctionProps) => UploadField;
|
|
11
|
+
export declare const MetaImageField: FieldFunction;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaImage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,UAAU,kBAAkB;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,KAAK,aAAa,GAAG,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,kBAAkB,KAAK,WAAW,CAAA;AAEtF,eAAO,MAAM,cAAc,EAAE,aAoB5B,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const MetaImageField = ({ hasGenerateFn = false, overrides, relationTo })=>{
|
|
2
|
+
return {
|
|
3
|
+
name: 'image',
|
|
4
|
+
type: 'upload',
|
|
5
|
+
admin: {
|
|
6
|
+
components: {
|
|
7
|
+
Field: {
|
|
8
|
+
clientProps: {
|
|
9
|
+
hasGenerateImageFn: hasGenerateFn
|
|
10
|
+
},
|
|
11
|
+
path: '@payloadcms/plugin-seo/client#MetaImageComponent'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
description: 'Maximum upload file size: 12MB. Recommended file size for images is <500KB.'
|
|
15
|
+
},
|
|
16
|
+
label: 'Meta Image',
|
|
17
|
+
localized: true,
|
|
18
|
+
relationTo,
|
|
19
|
+
...overrides ?? {}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaImage/index.ts"],"sourcesContent":["import type { UploadField } from 'payload'\n\ninterface FieldFunctionProps {\n /**\n * Tell the component if the generate function is available as configured in the plugin config\n */\n hasGenerateFn?: boolean\n overrides?: Partial<UploadField>\n relationTo: string\n}\n\ntype FieldFunction = ({ hasGenerateFn, overrides }: FieldFunctionProps) => UploadField\n\nexport const MetaImageField: FieldFunction = ({ hasGenerateFn = false, overrides, relationTo }) => {\n return {\n name: 'image',\n type: 'upload',\n admin: {\n components: {\n Field: {\n clientProps: {\n hasGenerateImageFn: hasGenerateFn,\n },\n path: '@payloadcms/plugin-seo/client#MetaImageComponent',\n },\n },\n description: 'Maximum upload file size: 12MB. Recommended file size for images is <500KB.',\n },\n label: 'Meta Image',\n localized: true,\n relationTo,\n ...((overrides as unknown as UploadField) ?? {}),\n }\n}\n"],"names":["MetaImageField","hasGenerateFn","overrides","relationTo","name","type","admin","components","Field","clientProps","hasGenerateImageFn","path","description","label","localized"],"mappings":"AAaA,OAAO,MAAMA,iBAAgC,CAAC,EAAEC,gBAAgB,KAAK,EAAEC,SAAS,EAAEC,UAAU,EAAE;IAC5F,OAAO;QACLC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,YAAY;gBACVC,OAAO;oBACLC,aAAa;wBACXC,oBAAoBT;oBACtB;oBACAU,MAAM;gBACR;YACF;YACAC,aAAa;QACf;QACAC,OAAO;QACPC,WAAW;QACXX;QACA,GAAI,AAACD,aAAwC,CAAC,CAAC;IACjD;AACF,EAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextFieldProps } from 'payload';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import '../index.scss';
|
|
4
|
+
type MetaTitleProps = {
|
|
5
|
+
readonly hasGenerateTitleFn: boolean;
|
|
6
|
+
} & TextFieldProps;
|
|
7
|
+
export declare const MetaTitleComponent: React.FC<MetaTitleProps>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=MetaTitleComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaTitleComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaTitle/MetaTitleComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAY7C,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,eAAe,CAAA;AAItB,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,cAAc,CAAA;AAElB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA6IvD,CAAA"}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { TextInput } from '@payloadcms/ui
|
|
4
|
-
import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
|
|
5
|
-
import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
|
|
6
|
-
import { useAllFormFields } from '@payloadcms/ui/forms/Form';
|
|
7
|
-
import { useField } from '@payloadcms/ui/forms/useField';
|
|
8
|
-
import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
|
|
9
|
-
import { useLocale } from '@payloadcms/ui/providers/Locale';
|
|
10
|
-
import { useTranslation } from '@payloadcms/ui/providers/Translation';
|
|
3
|
+
import { FieldLabel, TextInput, useDocumentInfo, useField, useFieldProps, useForm, useLocale, useTranslation } from '@payloadcms/ui';
|
|
11
4
|
import React, { useCallback } from 'react';
|
|
12
|
-
import { defaults } from '
|
|
13
|
-
import { LengthIndicator } from '
|
|
14
|
-
import '
|
|
5
|
+
import { defaults } from '../../defaults.js';
|
|
6
|
+
import { LengthIndicator } from '../../ui/LengthIndicator.js';
|
|
7
|
+
import '../index.scss';
|
|
15
8
|
const { maxLength, minLength } = defaults.title;
|
|
16
|
-
export const
|
|
17
|
-
const {
|
|
9
|
+
export const MetaTitleComponent = (props)=>{
|
|
10
|
+
const { field: { admin: { components: { Label } }, label, required }, hasGenerateTitleFn, labelProps } = props || {};
|
|
18
11
|
const { path: pathFromContext } = useFieldProps();
|
|
19
12
|
const { t } = useTranslation();
|
|
20
13
|
const field = useField({
|
|
21
|
-
path
|
|
14
|
+
path: pathFromContext
|
|
22
15
|
});
|
|
23
16
|
const locale = useLocale();
|
|
24
|
-
const
|
|
17
|
+
const { getData } = useForm();
|
|
25
18
|
const docInfo = useDocumentInfo();
|
|
26
19
|
const { errorMessage, setValue, showError, value } = field;
|
|
27
20
|
const regenerateTitle = useCallback(async ()=>{
|
|
28
21
|
if (!hasGenerateTitleFn) return;
|
|
29
22
|
const genTitleResponse = await fetch('/api/plugin-seo/generate-title', {
|
|
30
23
|
body: JSON.stringify({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
id: docInfo.id,
|
|
25
|
+
slug: docInfo.slug,
|
|
26
|
+
doc: getData(),
|
|
27
|
+
docPermissions: docInfo.docPermissions,
|
|
28
|
+
hasPublishPermission: docInfo.hasPublishPermission,
|
|
29
|
+
hasSavePermission: docInfo.hasSavePermission,
|
|
30
|
+
initialData: docInfo.initialData,
|
|
31
|
+
initialState: docInfo.initialState,
|
|
32
|
+
locale: typeof locale === 'object' ? locale?.code : locale,
|
|
33
|
+
title: docInfo.title
|
|
36
34
|
}),
|
|
37
35
|
credentials: 'include',
|
|
38
36
|
headers: {
|
|
@@ -43,11 +41,11 @@ export const MetaTitle = (props)=>{
|
|
|
43
41
|
const { result: generatedTitle } = await genTitleResponse.json();
|
|
44
42
|
setValue(generatedTitle || '');
|
|
45
43
|
}, [
|
|
46
|
-
fields,
|
|
47
|
-
setValue,
|
|
48
44
|
hasGenerateTitleFn,
|
|
45
|
+
docInfo,
|
|
46
|
+
getData,
|
|
49
47
|
locale,
|
|
50
|
-
|
|
48
|
+
setValue
|
|
51
49
|
]);
|
|
52
50
|
return /*#__PURE__*/ _jsxs("div", {
|
|
53
51
|
style: {
|
|
@@ -64,7 +62,8 @@ export const MetaTitle = (props)=>{
|
|
|
64
62
|
className: "plugin-seo__field",
|
|
65
63
|
children: [
|
|
66
64
|
/*#__PURE__*/ _jsx(FieldLabel, {
|
|
67
|
-
|
|
65
|
+
Label: Label,
|
|
66
|
+
field: null,
|
|
68
67
|
label: label,
|
|
69
68
|
...labelProps || {}
|
|
70
69
|
}),
|
|
@@ -72,7 +71,9 @@ export const MetaTitle = (props)=>{
|
|
|
72
71
|
children: [
|
|
73
72
|
" — ",
|
|
74
73
|
/*#__PURE__*/ _jsx("button", {
|
|
75
|
-
onClick:
|
|
74
|
+
onClick: ()=>{
|
|
75
|
+
void regenerateTitle();
|
|
76
|
+
},
|
|
76
77
|
style: {
|
|
77
78
|
background: 'none',
|
|
78
79
|
backgroundColor: 'transparent',
|
|
@@ -115,7 +116,12 @@ export const MetaTitle = (props)=>{
|
|
|
115
116
|
position: 'relative'
|
|
116
117
|
},
|
|
117
118
|
children: /*#__PURE__*/ _jsx(TextInput, {
|
|
118
|
-
|
|
119
|
+
Error: {
|
|
120
|
+
type: 'client',
|
|
121
|
+
Component: null,
|
|
122
|
+
RenderedComponent: errorMessage
|
|
123
|
+
},
|
|
124
|
+
label: label,
|
|
119
125
|
onChange: setValue,
|
|
120
126
|
path: pathFromContext,
|
|
121
127
|
required: required,
|
|
@@ -142,4 +148,4 @@ export const MetaTitle = (props)=>{
|
|
|
142
148
|
});
|
|
143
149
|
};
|
|
144
150
|
|
|
145
|
-
//# sourceMappingURL=
|
|
151
|
+
//# sourceMappingURL=MetaTitleComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaTitle/MetaTitleComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType, Options } from '@payloadcms/ui'\nimport type { TextFieldProps } from 'payload'\n\nimport {\n FieldLabel,\n TextInput,\n useDocumentInfo,\n useField,\n useFieldProps,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../../translations/index.js'\nimport type { GenerateTitle } from '../../types.js'\n\nimport { defaults } from '../../defaults.js'\nimport { LengthIndicator } from '../../ui/LengthIndicator.js'\nimport '../index.scss'\n\nconst { maxLength, minLength } = defaults.title\n\ntype MetaTitleProps = {\n readonly hasGenerateTitleFn: boolean\n} & TextFieldProps\n\nexport const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {\n const {\n field: {\n admin: {\n components: { Label },\n },\n label,\n required,\n },\n hasGenerateTitleFn,\n labelProps,\n } = props || {}\n const { path: pathFromContext } = useFieldProps()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const field: FieldType<string> = useField({\n path: pathFromContext,\n } as Options)\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const { errorMessage, setValue, showError, value } = field\n\n const regenerateTitle = useCallback(async () => {\n if (!hasGenerateTitleFn) return\n\n const genTitleResponse = await fetch('/api/plugin-seo/generate-title', {\n body: JSON.stringify({\n id: docInfo.id,\n slug: docInfo.slug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: docInfo.initialState,\n locale: typeof locale === 'object' ? locale?.code : locale,\n title: docInfo.title,\n } satisfies Omit<Parameters<GenerateTitle>[0], 'req'>),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedTitle } = await genTitleResponse.json()\n\n setValue(generatedTitle || '')\n }, [hasGenerateTitleFn, docInfo, getData, locale, setValue])\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div\n style={{\n marginBottom: '5px',\n position: 'relative',\n }}\n >\n <div className=\"plugin-seo__field\">\n <FieldLabel Label={Label} field={null} label={label} {...(labelProps || {})} />\n {hasGenerateTitleFn && (\n <React.Fragment>\n — \n <button\n onClick={() => {\n void regenerateTitle()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n <div\n style={{\n color: '#9A9A9A',\n }}\n >\n {t('plugin-seo:lengthTipTitle', { maxLength, minLength })}\n <a\n href=\"https://developers.google.com/search/docs/advanced/appearance/title-link#page-titles\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {t('plugin-seo:bestPractices')}\n </a>\n .\n </div>\n </div>\n <div\n style={{\n marginBottom: '10px',\n position: 'relative',\n }}\n >\n <TextInput\n Error={{\n type: 'client',\n Component: null,\n RenderedComponent: errorMessage,\n }}\n label={label}\n onChange={setValue}\n path={pathFromContext}\n required={required}\n showError={showError}\n style={{\n marginBottom: 0,\n }}\n value={value}\n />\n </div>\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <LengthIndicator maxLength={maxLength} minLength={minLength} text={value} />\n </div>\n </div>\n )\n}\n"],"names":["FieldLabel","TextInput","useDocumentInfo","useField","useFieldProps","useForm","useLocale","useTranslation","React","useCallback","defaults","LengthIndicator","maxLength","minLength","title","MetaTitleComponent","props","field","admin","components","Label","label","required","hasGenerateTitleFn","labelProps","path","pathFromContext","t","locale","getData","docInfo","errorMessage","setValue","showError","value","regenerateTitle","genTitleResponse","fetch","body","JSON","stringify","id","slug","doc","docPermissions","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedTitle","json","div","style","marginBottom","position","className","Fragment","button","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","a","href","rel","target","Error","Component","RenderedComponent","onChange","alignItems","display","width","text"],"mappings":"AAAA;;AAKA,SACEA,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,QAAQ,QAAQ,oBAAmB;AAC5C,SAASC,eAAe,QAAQ,8BAA6B;AAC7D,OAAO,gBAAe;AAEtB,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH,SAASI,KAAK;AAM/C,OAAO,MAAMC,qBAA+C,CAACC;IAC3D,MAAM,EACJC,OAAO,EACLC,OAAO,EACLC,YAAY,EAAEC,KAAK,EAAE,EACtB,EACDC,KAAK,EACLC,QAAQ,EACT,EACDC,kBAAkB,EAClBC,UAAU,EACX,GAAGR,SAAS,CAAC;IACd,MAAM,EAAES,MAAMC,eAAe,EAAE,GAAGtB;IAElC,MAAM,EAAEuB,CAAC,EAAE,GAAGpB;IAEd,MAAMU,QAA2Bd,SAAS;QACxCsB,MAAMC;IACR;IAEA,MAAME,SAAStB;IACf,MAAM,EAAEuB,OAAO,EAAE,GAAGxB;IACpB,MAAMyB,UAAU5B;IAEhB,MAAM,EAAE6B,YAAY,EAAEC,QAAQ,EAAEC,SAAS,E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BACT;;4BAECxC,EAAE,6BAA6B;gCAAEf;gCAAWC;4BAAU;0CACvD,KAAC2D;gCACCC,MAAK;gCACLC,KAAI;gCACJC,QAAO;0CAENhD,EAAE;;4BACD;;;;;0BAIR,KAAC6B;gBACCC,OAAO;oBACLC,cAAc;oBACdC,UAAU;gBACZ;0BAEA,cAAA,KAAC1D;oBACC2E,OAAO;wBACLL,MAAM;wBACNM,WAAW;wBACXC,mBAAmB/C;oBACrB;oBACAV,OAAOA;oBACP0D,UAAU/C;oBACVP,MAAMC;oBACNJ,UAAUA;oBACVW,WAAWA;oBACXwB,OAAO;wBACLC,cAAc;oBAChB;oBACAxB,OAAOA;;;0BAGX,KAACsB;gBACCC,OAAO;oBACLuB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAACvE;oBAAgBC,WAAWA;oBAAWC,WAAWA;oBAAWsE,MAAMjD;;;;;AAI3E,EAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextField } from 'payload';
|
|
2
|
+
interface FieldFunctionProps {
|
|
3
|
+
/**
|
|
4
|
+
* Tell the component if the generate function is available as configured in the plugin config
|
|
5
|
+
*/
|
|
6
|
+
hasGenerateFn?: boolean;
|
|
7
|
+
overrides?: Partial<TextField>;
|
|
8
|
+
}
|
|
9
|
+
type FieldFunction = ({ hasGenerateFn, overrides }: FieldFunctionProps) => TextField;
|
|
10
|
+
export declare const MetaTitleField: FieldFunction;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|