@payloadcms/plugin-seo 3.57.0-canary.6 → 3.57.0-canary.7
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/fields/MetaImage/MetaImageComponent.d.ts.map +1 -1
- package/dist/fields/MetaImage/MetaImageComponent.js +8 -1
- package/dist/fields/MetaImage/MetaImageComponent.js.map +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaImageComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAerD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,sBAAsB,CAAA;AAE1B,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"MetaImageComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAerD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,sBAAsB,CAAA;AAE1B,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAwMvD,CAAA"}
|
|
@@ -39,7 +39,14 @@ export const MetaImageComponent = (props)=>{
|
|
|
39
39
|
method: 'POST'
|
|
40
40
|
});
|
|
41
41
|
const { result: generatedImage } = await genImageResponse.json();
|
|
42
|
-
|
|
42
|
+
// string ids, number ids or nullish values
|
|
43
|
+
let newValue = generatedImage;
|
|
44
|
+
// non-nullish resolved relations
|
|
45
|
+
if (typeof generatedImage === 'object' && generatedImage && 'id' in generatedImage) {
|
|
46
|
+
newValue = generatedImage.id;
|
|
47
|
+
}
|
|
48
|
+
// coerce to an empty string for falsy (=empty) values
|
|
49
|
+
setValue(newValue || '');
|
|
43
50
|
}, [
|
|
44
51
|
hasGenerateImageFn,
|
|
45
52
|
serverURL,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { UploadFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n RenderCustomComponent,\n UploadInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\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} & UploadFieldClientProps\n\nexport const MetaImageComponent: React.FC<MetaImageProps> = (props) => {\n const {\n field: { admin: { allowCreate } = {}, label, localized, relationTo, required },\n hasGenerateImageFn,\n readOnly,\n } = props\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const {\n customComponents: { Error, Label } = {},\n filterOptions,\n path,\n setValue,\n showError,\n value,\n }: FieldType<string> = useField()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const { title } = useDocumentTitle()\n\n const regenerateImage = useCallback(async () => {\n if (!hasGenerateImageFn) {\n return\n }\n\n const endpoint = `${serverURL}${api}/plugin-seo/generate-image`\n\n const genImageResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: typeof locale === 'object' ? locale?.code : locale,\n title,\n } satisfies Omit<\n Parameters<GenerateImage>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedImage } = await genImageResponse.json()\n\n setValue(generatedImage || '')\n }, [\n hasGenerateImageFn,\n serverURL,\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n const hasImage = Boolean(value)\n\n const collection = getEntityConfig({ collectionSlug: relationTo })\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 <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n {hasGenerateImageFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\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 allowCreate={allowCreate !== false}\n api={api}\n collection={collection}\n Error={Error}\n filterOptions={filterOptions}\n onChange={(incomingImage) => {\n if (incomingImage !== null) {\n if (typeof incomingImage === 'object') {\n const { id: incomingID } = incomingImage\n setValue(incomingID)\n } else {\n setValue(incomingImage)\n }\n } else {\n setValue(null)\n }\n }}\n path={path}\n readOnly={readOnly}\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","RenderCustomComponent","UploadInput","useConfig","useDocumentInfo","useDocumentTitle","useField","useForm","useLocale","useTranslation","reduceToSerializableFields","React","useCallback","Pill","MetaImageComponent","props","field","admin","allowCreate","label","localized","relationTo","required","hasGenerateImageFn","readOnly","config","routes","api","serverURL","getEntityConfig","customComponents","Error","Label","filterOptions","path","setValue","showError","value","t","locale","getData","docInfo","title","regenerateImage","endpoint","genImageResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedImage","json","hasImage","Boolean","collection","div","style","marginBottom","position","className","CustomComponent","Fallback","Fragment","button","disabled","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","onChange","incomingImage","incomingID","alignItems","display","width"],"mappings":"AAAA;;AAKA,SACEA,UAAU,EACVC,qBAAqB,EACrBC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,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AAc;oBACdC,UAAU;gBACZ;0BAEA,cAAA,KAACtE;oBACCgB,aAAaA,gBAAgB;oBAC7BS,KAAKA;oBACLyC,YAAYA;oBACZrC,OAAOA;oBACPE,eAAeA;oBACfuD,UAAU,CAACC;wBACT,IAAIA,kBAAkB,MAAM;4BAC1B,IAAI,OAAOA,kBAAkB,UAAU;gCACrC,MAAM,EAAEvC,IAAIwC,UAAU,EAAE,GAAGD;gCAC3BtD,SAASuD;4BACX,OAAO;gCACLvD,SAASsD;4BACX;wBACF,OAAO;4BACLtD,SAAS;wBACX;oBACF;oBACAD,MAAMA;oBACNV,UAAUA;oBACVH,YAAYA;oBACZC,UAAUA;oBACVM,WAAWA;oBACXQ,WAAWA;oBACXkC,OAAO;wBACLC,cAAc;oBAChB;oBACAlC,OAAOA;;;0BAGX,KAACgC;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAAChF;oBACCoE,iBAAiBf,WAAW,UAAU;oBACtCiB,OAAM;oBACNhE,OAAO+C,WAAW5B,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { UploadFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n RenderCustomComponent,\n UploadInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\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} & UploadFieldClientProps\n\nexport const MetaImageComponent: React.FC<MetaImageProps> = (props) => {\n const {\n field: { admin: { allowCreate } = {}, label, localized, relationTo, required },\n hasGenerateImageFn,\n readOnly,\n } = props\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const {\n customComponents: { Error, Label } = {},\n filterOptions,\n path,\n setValue,\n showError,\n value,\n }: FieldType<number | string> = useField()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const { title } = useDocumentTitle()\n\n const regenerateImage = useCallback(async () => {\n if (!hasGenerateImageFn) {\n return\n }\n\n const endpoint = `${serverURL}${api}/plugin-seo/generate-image`\n\n const genImageResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: typeof locale === 'object' ? locale?.code : locale,\n title,\n } satisfies Omit<\n Parameters<GenerateImage>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedImage } = await genImageResponse.json()\n\n // string ids, number ids or nullish values\n let newValue: null | number | string | undefined = generatedImage\n // non-nullish resolved relations\n if (typeof generatedImage === 'object' && generatedImage && 'id' in generatedImage) {\n newValue = generatedImage.id\n }\n\n // coerce to an empty string for falsy (=empty) values\n setValue(newValue || '')\n }, [\n hasGenerateImageFn,\n serverURL,\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n const hasImage = Boolean(value)\n\n const collection = getEntityConfig({ collectionSlug: relationTo })\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 <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n {hasGenerateImageFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\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 allowCreate={allowCreate !== false}\n api={api}\n collection={collection}\n Error={Error}\n filterOptions={filterOptions}\n onChange={(incomingImage) => {\n if (incomingImage !== null) {\n if (typeof incomingImage === 'object') {\n const { id: incomingID } = incomingImage\n setValue(incomingID)\n } else {\n setValue(incomingImage)\n }\n } else {\n setValue(null)\n }\n }}\n path={path}\n readOnly={readOnly}\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","RenderCustomComponent","UploadInput","useConfig","useDocumentInfo","useDocumentTitle","useField","useForm","useLocale","useTranslation","reduceToSerializableFields","React","useCallback","Pill","MetaImageComponent","props","field","admin","allowCreate","label","localized","relationTo","required","hasGenerateImageFn","readOnly","config","routes","api","serverURL","getEntityConfig","customComponents","Error","Label","filterOptions","path","setValue","showError","value","t","locale","getData","docInfo","title","regenerateImage","endpoint","genImageResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedImage","json","newValue","hasImage","Boolean","collection","div","style","marginBottom","position","className","CustomComponent","Fallback","Fragment","button","disabled","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","onChange","incomingImage","incomingID","alignItems","display","width"],"mappings":"AAAA;;AAKA,SACEA,UAAU,EACVC,qBAAqB,EACrBC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,IAAI,QAAQ,mBAAkB;AAMvC,OAAO,MAAMC,qBAA+C,CAACC;IAC3D,MAAM,EACJC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAE,EAC9EC,kBAAkB,EAClBC,QAAQ,EACT,GAAGT;IAEJ,MAAM,EACJU,QAAQ,EACNC,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,EACDC,eAAe,EAChB,GAAG1B;IAEJ,MAAM,EACJ2B,kBAAkB,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAG,CAAC,CAAC,EACvCC,aAAa,EACbC,IAAI,EACJC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACN,GAA+B/B;IAEhC,MAAM,EAAEgC,CAAC,EAAE,GAAG7B;IAEd,MAAM8B,SAAS/B;IACf,MAAM,EAA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qB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAACjF;oBACCqE,iBAAiBf,WAAW,UAAU;oBACtCiB,OAAM;oBACNjE,OAAOgD,WAAW7B,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -24,7 +24,11 @@ export type GenerateImage<T = any> = (args: {
|
|
|
24
24
|
globalConfig?: GlobalConfig;
|
|
25
25
|
locale?: string;
|
|
26
26
|
req: PayloadRequest;
|
|
27
|
-
} & PartialDocumentInfoContext) =>
|
|
27
|
+
} & PartialDocumentInfoContext) => {
|
|
28
|
+
id: number | string;
|
|
29
|
+
} | number | Promise<{
|
|
30
|
+
id: number | string;
|
|
31
|
+
} | number | string> | string;
|
|
28
32
|
export type GenerateURL<T = any> = (args: {
|
|
29
33
|
collectionConfig?: CollectionConfig;
|
|
30
34
|
doc: T;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE;IAAE,aAAa,EAAE,KAAK,EAAE,CAAA;CAAE,KAAK,KAAK,EAAE,CAAA;AAE1E,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,mBAAmB,EACjB,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,sBAAsB,GACtB,mBAAmB,GACnB,IAAI,GACJ,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,OAAO,GACP,cAAc,CACjB,CAAA;AAED,MAAM,MAAM,aAAa,CA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1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { DocumentInfoContext } from '@payloadcms/ui'\nimport type {\n CollectionConfig,\n CollectionSlug,\n Field,\n GlobalConfig,\n GlobalSlug,\n PayloadRequest,\n UploadCollectionSlug,\n} from 'payload'\n\nexport type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\nexport type PartialDocumentInfoContext = Pick<\n DocumentInfoContext,\n | 'collectionSlug'\n | 'docPermissions'\n | 'globalSlug'\n | 'hasPublishedDoc'\n | 'hasPublishPermission'\n | 'hasSavePermission'\n | 'id'\n | 'initialData'\n | 'initialState'\n | 'preferencesKey'\n | 'title'\n | 'versionCount'\n>\n\nexport type GenerateTitle<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateDescription<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateImage<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateURL<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type SEOPluginConfig = {\n /**\n * Collections to include the SEO fields in\n */\n collections?: ({} | CollectionSlug)[]\n /**\n * Override the default fields inserted by the SEO plugin via a function that receives the default fields and returns the new fields\n *\n * If you need more flexibility you can insert the fields manually as needed. @link https://payloadcms.com/docs/plugins/seo#direct-use-of-fields\n */\n fields?: FieldsOverride\n generateDescription?: GenerateDescription\n generateImage?: GenerateImage\n generateTitle?: GenerateTitle\n /**\n *\n */\n generateURL?: GenerateURL\n /**\n * Globals to include the SEO fields in\n */\n globals?: ({} | GlobalSlug)[]\n interfaceName?: string\n /**\n * Group fields into tabs, your content will be automatically put into a general tab and the SEO fields into an SEO tab\n *\n * If you need more flexibility you can insert the fields manually as needed. @link https://payloadcms.com/docs/plugins/seo#direct-use-of-fields\n */\n tabbedUI?: boolean\n /**\n * The slug of the collection used to handle image uploads\n */\n uploadsCollection?: {} | UploadCollectionSlug\n}\n\nexport type Meta = {\n description?: string\n image?: any // TODO: type this\n keywords?: string\n title?: string\n}\n"],"names":[],"mappings":"AAwGA,WAKC"}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { DocumentInfoContext } from '@payloadcms/ui'\nimport type {\n CollectionConfig,\n CollectionSlug,\n Field,\n GlobalConfig,\n GlobalSlug,\n PayloadRequest,\n UploadCollectionSlug,\n} from 'payload'\n\nexport type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\nexport type PartialDocumentInfoContext = Pick<\n DocumentInfoContext,\n | 'collectionSlug'\n | 'docPermissions'\n | 'globalSlug'\n | 'hasPublishedDoc'\n | 'hasPublishPermission'\n | 'hasSavePermission'\n | 'id'\n | 'initialData'\n | 'initialState'\n | 'preferencesKey'\n | 'title'\n | 'versionCount'\n>\n\nexport type GenerateTitle<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateDescription<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateImage<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => { id: number | string } | number | Promise<{ id: number | string } | number | string> | string\n\nexport type GenerateURL<T = any> = (\n args: {\n collectionConfig?: CollectionConfig\n doc: T\n globalConfig?: GlobalConfig\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type SEOPluginConfig = {\n /**\n * Collections to include the SEO fields in\n */\n collections?: ({} | CollectionSlug)[]\n /**\n * Override the default fields inserted by the SEO plugin via a function that receives the default fields and returns the new fields\n *\n * If you need more flexibility you can insert the fields manually as needed. @link https://payloadcms.com/docs/plugins/seo#direct-use-of-fields\n */\n fields?: FieldsOverride\n generateDescription?: GenerateDescription\n generateImage?: GenerateImage\n generateTitle?: GenerateTitle\n /**\n *\n */\n generateURL?: GenerateURL\n /**\n * Globals to include the SEO fields in\n */\n globals?: ({} | GlobalSlug)[]\n interfaceName?: string\n /**\n * Group fields into tabs, your content will be automatically put into a general tab and the SEO fields into an SEO tab\n *\n * If you need more flexibility you can insert the fields manually as needed. @link https://payloadcms.com/docs/plugins/seo#direct-use-of-fields\n */\n tabbedUI?: boolean\n /**\n * The slug of the collection used to handle image uploads\n */\n uploadsCollection?: {} | UploadCollectionSlug\n}\n\nexport type Meta = {\n description?: string\n image?: any // TODO: type this\n keywords?: string\n title?: string\n}\n"],"names":[],"mappings":"AAwGA,WAKC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-seo",
|
|
3
|
-
"version": "3.57.0-canary.
|
|
3
|
+
"version": "3.57.0-canary.7",
|
|
4
4
|
"description": "SEO plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"dist"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@payloadcms/translations": "3.57.0-canary.
|
|
62
|
-
"@payloadcms/ui": "3.57.0-canary.
|
|
61
|
+
"@payloadcms/translations": "3.57.0-canary.7",
|
|
62
|
+
"@payloadcms/ui": "3.57.0-canary.7"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/react": "19.1.12",
|
|
66
66
|
"@types/react-dom": "19.1.9",
|
|
67
|
+
"@payloadcms/next": "3.57.0-canary.7",
|
|
67
68
|
"@payloadcms/eslint-config": "3.28.0",
|
|
68
|
-
"payload": "3.57.0-canary.
|
|
69
|
-
"@payloadcms/next": "3.57.0-canary.6"
|
|
69
|
+
"payload": "3.57.0-canary.7"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
73
73
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
74
|
-
"payload": "3.57.0-canary.
|
|
74
|
+
"payload": "3.57.0-canary.7"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"registry": "https://registry.npmjs.org/"
|