@payloadcms/plugin-seo 3.0.0-canary.f1db24e → 3.0.0-canary.f83d96a

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.
Files changed (38) hide show
  1. package/dist/defaults.js.map +1 -1
  2. package/dist/exports/types.js.map +1 -1
  3. package/dist/fields/MetaDescription.d.ts +1 -1
  4. package/dist/fields/MetaDescription.d.ts.map +1 -1
  5. package/dist/fields/MetaDescription.js +6 -13
  6. package/dist/fields/MetaDescription.js.map +1 -1
  7. package/dist/fields/MetaImage.d.ts +1 -1
  8. package/dist/fields/MetaImage.d.ts.map +1 -1
  9. package/dist/fields/MetaImage.js +6 -13
  10. package/dist/fields/MetaImage.js.map +1 -1
  11. package/dist/fields/MetaTitle.d.ts +1 -1
  12. package/dist/fields/MetaTitle.d.ts.map +1 -1
  13. package/dist/fields/MetaTitle.js +6 -13
  14. package/dist/fields/MetaTitle.js.map +1 -1
  15. package/dist/fields/index.scss +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/translations/index.d.ts +22 -0
  21. package/dist/translations/index.d.ts.map +1 -1
  22. package/dist/translations/index.js +22 -0
  23. package/dist/translations/index.js.map +1 -1
  24. package/dist/translations/ru.json +22 -0
  25. package/dist/types.d.ts +6 -6
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/types.js.map +1 -1
  28. package/dist/ui/LengthIndicator.js +1 -1
  29. package/dist/ui/LengthIndicator.js.map +1 -1
  30. package/dist/ui/Overview.d.ts.map +1 -1
  31. package/dist/ui/Overview.js +1 -2
  32. package/dist/ui/Overview.js.map +1 -1
  33. package/dist/ui/Pill.js.map +1 -1
  34. package/dist/ui/Preview.d.ts +1 -1
  35. package/dist/ui/Preview.d.ts.map +1 -1
  36. package/dist/ui/Preview.js +5 -6
  37. package/dist/ui/Preview.js.map +1 -1
  38. package/package.json +16 -16
@@ -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"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,OAAO,MAAMA,WAAW;IACtBC,aAAa;QACXC,WAAW;QACXC,WAAW;IACb;IACAC,OAAO;QACLF,WAAW;QACXC,WAAW;IACb;AACF,EAAC"}
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"}
@@ -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":[],"rangeMappings":"","mappings":"AAAA,WAOoB"}
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"}
@@ -1,4 +1,4 @@
1
- import type { FormFieldBase } from '@payloadcms/ui/fields/shared';
1
+ import type { FormFieldBase } from '@payloadcms/ui';
2
2
  import React from 'react';
3
3
  type MetaDescriptionProps = FormFieldBase & {
4
4
  hasGenerateDescriptionFn: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"MetaDescription.d.ts","sourceRoot":"","sources":["../../src/fields/MetaDescription.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAWjE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAW1C,KAAK,oBAAoB,GAAG,aAAa,GAAG;IAC1C,wBAAwB,EAAE,OAAO,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoH1D,CAAA"}
1
+ {"version":3,"file":"MetaDescription.d.ts","sourceRoot":"","sources":["../../src/fields/MetaDescription.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,aAAa,EAAW,MAAM,gBAAgB,CAAA;AAYvE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAW1C,KAAK,oBAAoB,GAAG,aAAa,GAAG;IAC1C,wBAAwB,EAAE,OAAO,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoH1D,CAAA"}
@@ -1,13 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { TextareaInput } from '@payloadcms/ui/fields/Textarea';
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
5
  import { defaults } from '../defaults.js';
13
6
  import { LengthIndicator } from '../ui/LengthIndicator.js';
@@ -17,7 +10,7 @@ export const MetaDescription = (props)=>{
17
10
  const { path: pathFromContext } = useFieldProps();
18
11
  const { t } = useTranslation();
19
12
  const locale = useLocale();
20
- const [fields] = useAllFormFields();
13
+ const { getData } = useForm();
21
14
  const docInfo = useDocumentInfo();
22
15
  const field = useField({
23
16
  path
@@ -29,7 +22,7 @@ export const MetaDescription = (props)=>{
29
22
  body: JSON.stringify({
30
23
  ...docInfo,
31
24
  doc: {
32
- ...fields
25
+ ...getData()
33
26
  },
34
27
  locale: typeof locale === 'object' ? locale?.code : locale
35
28
  }),
@@ -42,11 +35,11 @@ export const MetaDescription = (props)=>{
42
35
  const { result: generatedDescription } = await genDescriptionResponse.json();
43
36
  setValue(generatedDescription || '');
44
37
  }, [
45
- fields,
46
- setValue,
47
38
  hasGenerateDescriptionFn,
39
+ docInfo,
40
+ getData,
48
41
  locale,
49
- docInfo
42
+ setValue
50
43
  ]);
51
44
  return /*#__PURE__*/ _jsxs("div", {
52
45
  style: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fields/MetaDescription.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { FieldType, Options } from '@payloadcms/ui/forms/useField'\n\nimport { TextareaInput } from '@payloadcms/ui/fields/Textarea'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { useField } from '@payloadcms/ui/forms/useField'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useLocale } from '@payloadcms/ui/providers/Locale'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\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\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype MetaDescriptionProps = FormFieldBase & {\n hasGenerateDescriptionFn: boolean\n path: string\n}\n\nexport const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {\n const { CustomLabel, hasGenerateDescriptionFn, label, labelProps, path, required } = props\n const { path: pathFromContext } = useFieldProps()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const [fields] = useAllFormFields()\n const docInfo = useDocumentInfo()\n\n const field: FieldType<string> = useField({\n path,\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 ...docInfo,\n doc: { ...fields },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateDescription>[0]),\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 }, [fields, setValue, hasGenerateDescriptionFn, locale, docInfo])\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 CustomLabel={CustomLabel} label={label} {...(labelProps || {})} />\n {hasGenerateDescriptionFn && (\n <React.Fragment>\n &nbsp; &mdash; &nbsp;\n <button\n onClick={regenerateDescription}\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 CustomError={errorMessage}\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":["TextareaInput","FieldLabel","useFieldProps","useAllFormFields","useField","useDocumentInfo","useLocale","useTranslation","React","useCallback","defaults","LengthIndicator","maxLength","minLength","description","MetaDescription","props","CustomLabel","hasGenerateDescriptionFn","label","labelProps","path","required","pathFromContext","t","locale","fields","docInfo","field","errorMessage","setValue","showError","value","regenerateDescription","genDescriptionResponse","fetch","body","JSON","stringify","doc","code","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","CustomError","onChange","alignItems","display","width","text"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAKA,SAASA,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,QA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OA;gCAAQ,GAAIC,cAAc,CAAC,CAAC;;4BACxEF,0CACC,MAACV,MAAM4C,QAAQ;;oCAAC;kDAEd,KAACC;wCACCC,SAASrB;wCACTe,OAAO;4CACLO,YAAY;4CACZC,iBAAiB;4CACjBC,QAAQ;4CACRC,OAAO;4CACPC,QAAQ;4CACRC,SAAS;4CACTC,gBAAgB;wCAClB;wCACAC,MAAK;kDAEJtC,EAAE;;;;;;kCAKX,MAACuB;wBACCC,OAAO;4BACLU,OAAO;wBACT;;4BAEClC,EAAE,mCAAmC;gCAAEZ;gCAAWC;4BAAU;0CAC7D,KAACkD;gCACCC,MAAK;gCACLC,KAAI;gCACJC,QAAO;0CAEN1C,EAAE;;;;;;0BAIT,KAACuB;gBACCC,OAAO;oBACLC,cAAc;oBACdC,UAAU;gBACZ;0BAEA,cAAA,KAAClD;oBACCmE,aAAatC;oBACbuC,UAAUtC;oBACVT,MAAME;oBACND,UAAUA;oBACVS,WAAWA;oBACXiB,OAAO;wBACLC,cAAc;oBAChB;oBACAjB,OAAOA;;;0BAGX,KAACe;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAAC5D;oBAAgBC,WAAWA;oBAAWC,WAAWA;oBAAW2D,MAAMxC;;;;;AAI3E,EAAC"}
1
+ {"version":3,"sources":["../../src/fields/MetaDescription.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType, FormFieldBase, Options } from '@payloadcms/ui'\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\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype MetaDescriptionProps = FormFieldBase & {\n hasGenerateDescriptionFn: boolean\n path: string\n}\n\nexport const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {\n const { CustomLabel, hasGenerateDescriptionFn, label, labelProps, path, required } = 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,\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 ...docInfo,\n doc: { ...getData() },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateDescription>[0]),\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 CustomLabel={CustomLabel} label={label} {...(labelProps || {})} />\n {hasGenerateDescriptionFn && (\n <React.Fragment>\n &nbsp; &mdash; &nbsp;\n <button\n onClick={regenerateDescription}\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 CustomError={errorMessage}\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","MetaDescription","props","CustomLabel","hasGenerateDescriptionFn","label","labelProps","path","required","pathFromContext","t","locale","getData","docInfo","field","errorMessage","setValue","showError","value","regenerateDescription","genDescriptionResponse","fetch","body","JSON","stringify","doc","code","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","CustomError","onChange","alignItems","display","width","text"],"mappings":"AAAA;;AAIA,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,iBAAgB;AACzC,SAASC,eAAe,QAAQ,2BAA0B;AAE1D,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH,SAASI,WAAW;AAQrD,OAAO,MAAMC,kBAAkD,CAACC;IAC9D,MAAM,EAAEC,WAAW,EAAEC,wBAAwB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGN;IACrF,MAAM,EAAEK,MAAME,eAAe,EAAE,GAAGnB;IAElC,MAAM,EAAEoB,CAAC,EAAE,GA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C7D,KAACkD;gCACCC,MAAK;gCACLC,KAAI;gCACJC,QAAO;0CAEN1C,EAAE;;;;;;0BAIT,KAACuB;gBACCC,OAAO;oBACLC,cAAc;oBACdC,UAAU;gBACZ;0BAEA,cAAA,KAACjD;oBACCkE,aAAatC;oBACbuC,UAAUtC;oBACVT,MAAME;oBACND,UAAUA;oBACVS,WAAWA;oBACXiB,OAAO;wBACLC,cAAc;oBAChB;oBACAjB,OAAOA;;;0BAGX,KAACe;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAAC5D;oBAAgBC,WAAWA;oBAAWC,WAAWA;oBAAW2D,MAAMxC;;;;;AAI3E,EAAC"}
@@ -1,4 +1,4 @@
1
- import type { UploadInputProps } from '@payloadcms/ui/fields/Upload';
1
+ import type { UploadInputProps } from '@payloadcms/ui';
2
2
  import React from 'react';
3
3
  type MetaImageProps = UploadInputProps & {
4
4
  hasGenerateImageFn: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"MetaImage.d.ts","sourceRoot":"","sources":["../../src/fields/MetaImage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAWpE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,KAAK,cAAc,GAAG,gBAAgB,GAAG;IACvC,kBAAkB,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoI9C,CAAA"}
1
+ {"version":3,"file":"MetaImage.d.ts","sourceRoot":"","sources":["../../src/fields/MetaImage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAY1E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,KAAK,cAAc,GAAG,gBAAgB,GAAG;IACvC,kBAAkB,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoI9C,CAAA"}
@@ -1,13 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { UploadInput } from '@payloadcms/ui/fields/Upload';
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, useForm, useLocale, useTranslation } from '@payloadcms/ui';
11
4
  import React, { useCallback } from 'react';
12
5
  import { Pill } from '../ui/Pill.js';
13
6
  export const MetaImage = (props)=>{
@@ -15,7 +8,7 @@ export const MetaImage = (props)=>{
15
8
  const field = useField(props);
16
9
  const { t } = useTranslation();
17
10
  const locale = useLocale();
18
- const [fields] = useAllFormFields();
11
+ const { getData } = useForm();
19
12
  const docInfo = useDocumentInfo();
20
13
  const { errorMessage, setValue, showError, value } = field;
21
14
  const regenerateImage = useCallback(async ()=>{
@@ -24,7 +17,7 @@ export const MetaImage = (props)=>{
24
17
  body: JSON.stringify({
25
18
  ...docInfo,
26
19
  doc: {
27
- ...fields
20
+ ...getData()
28
21
  },
29
22
  locale: typeof locale === 'object' ? locale?.code : locale
30
23
  }),
@@ -37,11 +30,11 @@ export const MetaImage = (props)=>{
37
30
  const { result: generatedImage } = await genImageResponse.json();
38
31
  setValue(generatedImage || '');
39
32
  }, [
40
- fields,
41
- setValue,
42
33
  hasGenerateImageFn,
34
+ docInfo,
35
+ getData,
43
36
  locale,
44
- docInfo
37
+ setValue
45
38
  ]);
46
39
  const hasImage = Boolean(value);
47
40
  const config = useConfig();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fields/MetaImage.tsx"],"sourcesContent":["'use client'\n\nimport type { UploadInputProps } from '@payloadcms/ui/fields/Upload'\nimport type { FieldType, Options } from '@payloadcms/ui/forms/useField'\n\nimport { UploadInput } from '@payloadcms/ui/fields/Upload'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { useField } from '@payloadcms/ui/forms/useField'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useLocale } from '@payloadcms/ui/providers/Locale'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\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\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype MetaImageProps = UploadInputProps & {\n hasGenerateImageFn: boolean\n}\n\nexport const MetaImage: React.FC<MetaImageProps> = (props) => {\n const { CustomLabel, hasGenerateImageFn, label, labelProps, relationTo, required } = props || {}\n\n const field: FieldType<string> = useField(props as Options)\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const [fields] = useAllFormFields()\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 ...docInfo,\n doc: { ...fields },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateImage>[0]),\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 }, [fields, setValue, hasGenerateImageFn, locale, docInfo])\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 CustomLabel={CustomLabel} label={label} {...(labelProps || {})} />\n {hasGenerateImageFn && (\n <React.Fragment>\n &nbsp; &mdash; &nbsp;\n <button\n onClick={regenerateImage}\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 CustomError={errorMessage}\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":["UploadInput","FieldLabel","useAllFormFields","useField","useConfig","useDocumentInfo","useLocale","useTranslation","React","useCallback","Pill","MetaImage","props","CustomLabel","hasGenerateImageFn","label","labelProps","relationTo","required","field","t","locale","fields","docInfo","errorMessage","setValue","showError","value","regenerateImage","genImageResponse","fetch","body","JSON","stringify","doc","code","credentials","headers","method","result","generatedImage","json","hasImage","Boolean","config","collections","routes","api","serverURL","collection","find","coll","slug","undefined","div","style","marginBottom","position","className","Fragment","button","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","CustomError","filterOptions","onChange","incomingImage","id","incomingID","alignItems","display","width"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAKA,SAASA,WAAW,QAAQ,+BAA8B;AAC1D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,IAAI,QAAQ,gBAAe;AAOpC,OAAO,MAAMC,YAAsC,CAACC;IAClD,MAAM,EAAEC,WAAW,EAAEC,kBAAkB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN,SAAS,CAAC;IAE/F,MAAMO,QAA2BhB,SAASS;IAE1C,MAAM,EAAEQ,CAAC,EAAE,GAAGb;IAEd,MAAMc,SAASf;IACf,MAAM,CAACgB,OAAO,GAAGpB;IACjB,MAAMqB,UAAUlB;IAEhB,MAAM,EAAEmB,YAAY,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGR;IAErD,MAAMS,kBAAkBnB,YAAY;QAClC,IAAI,CAACK,oBAAoB;QAEzB,MAAMe,mBAAmB,MAAM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aAAa9C;oBACbuB,KAAKA;oBACLE,YAAYA;oBACZsB,eAAepD,MAAMoD,aAAa;oBAClCxD,OAAOsC;oBACPmB,UAAU,CAACC;wBACT,IAAIA,kBAAkB,MAAM;4BAC1B,MAAM,EAAEC,IAAIC,UAAU,EAAE,GAAGF;4BAC3BhD,SAASkD;wBACX,OAAO;4BACLlD,SAAS;wBACX;oBACF;oBACAR,YAAYA;oBACZC,UAAUA;oBACV8B,WAAWA;oBACXtB,WAAWA;oBACX6B,OAAO;wBACLC,cAAc;oBAChB;oBACA7B,OAAOA;;;0BAGX,KAAC2B;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAACpE;oBACCqD,iBAAiBrB,WAAW,UAAU;oBACtCuB,OAAM;oBACNlD,OAAO2B,WAAWtB,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
1
+ {"version":3,"sources":["../../src/fields/MetaImage.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType, Options, UploadInputProps } from '@payloadcms/ui'\n\nimport {\n FieldLabel,\n UploadInput,\n useConfig,\n useDocumentInfo,\n useField,\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\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype MetaImageProps = UploadInputProps & {\n hasGenerateImageFn: boolean\n}\n\nexport const MetaImage: React.FC<MetaImageProps> = (props) => {\n const { CustomLabel, hasGenerateImageFn, label, labelProps, relationTo, required } = props || {}\n\n const field: FieldType<string> = useField(props 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 ...docInfo,\n doc: { ...getData() },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateImage>[0]),\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 }, [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 CustomLabel={CustomLabel} label={label} {...(labelProps || {})} />\n {hasGenerateImageFn && (\n <React.Fragment>\n &nbsp; &mdash; &nbsp;\n <button\n onClick={regenerateImage}\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 CustomError={errorMessage}\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","useForm","useLocale","useTranslation","React","useCallback","Pill","MetaImage","props","CustomLabel","hasGenerateImageFn","label","labelProps","relationTo","required","field","t","locale","getData","docInfo","errorMessage","setValue","showError","value","regenerateImage","genImageResponse","fetch","body","JSON","stringify","doc","code","credentials","headers","method","result","generatedImage","json","hasImage","Boolean","config","collections","routes","api","serverURL","collection","find","coll","slug","undefined","div","style","marginBottom","position","className","Fragment","button","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","CustomError","filterOptions","onChange","incomingImage","id","incomingID","alignItems","display","width"],"mappings":"AAAA;;AAIA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,IAAI,QAAQ,gBAAe;AAOpC,OAAO,MAAMC,YAAsC,CAACC;IAClD,MAAM,EAAEC,WAAW,EAAEC,kBAAkB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN,SAAS,CAAC;IAE/F,MAAMO,QAA2Bf,SAASQ;IAE1C,MAAM,EAAEQ,CAAC,EAAE,GAAGb;IAEd,MAAMc,SAASf;IACf,MAAM,EAAEgB,OAAO,EAAE,GAAGjB;IACpB,MAAMkB,UAAUpB;IAEhB,MAAM,EAAEqB,YAAY,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGR;IAErD,MAAMS,kBAAkBnB,YAAY;QAClC,IAAI,CAACK,oBAAoB;QAEzB,MAAMe,mBAAmB,MAAMC,MAAM,kCAAkC;YACrEC,MA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ACLE,YAAYA;oBACZsB,eAAepD,MAAMoD,aAAa;oBAClCxD,OAAOsC;oBACPmB,UAAU,CAACC;wBACT,IAAIA,kBAAkB,MAAM;4BAC1B,MAAM,EAAEC,IAAIC,UAAU,EAAE,GAAGF;4BAC3BhD,SAASkD;wBACX,OAAO;4BACLlD,SAAS;wBACX;oBACF;oBACAR,YAAYA;oBACZC,UAAUA;oBACV8B,WAAWA;oBACXtB,WAAWA;oBACX6B,OAAO;wBACLC,cAAc;oBAChB;oBACA7B,OAAOA;;;0BAGX,KAAC2B;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAACpE;oBACCqD,iBAAiBrB,WAAW,UAAU;oBACtCuB,OAAM;oBACNlD,OAAO2B,WAAWtB,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormFieldBase } from '@payloadcms/ui/fields/shared';
1
+ import type { FormFieldBase } from '@payloadcms/ui';
2
2
  import React from 'react';
3
3
  import './index.scss';
4
4
  type MetaTitleProps = FormFieldBase & {
@@ -1 +1 @@
1
- {"version":3,"file":"MetaTitle.d.ts","sourceRoot":"","sources":["../../src/fields/MetaTitle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAYjE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,cAAc,CAAA;AAKrB,KAAK,cAAc,GAAG,aAAa,GAAG;IACpC,kBAAkB,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqH9C,CAAA"}
1
+ {"version":3,"file":"MetaTitle.d.ts","sourceRoot":"","sources":["../../src/fields/MetaTitle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,aAAa,EAAW,MAAM,gBAAgB,CAAA;AAYvE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,cAAc,CAAA;AAKrB,KAAK,cAAc,GAAG,aAAa,GAAG;IACpC,kBAAkB,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqH9C,CAAA"}
@@ -1,13 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { TextInput } from '@payloadcms/ui/fields/Text';
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
5
  import { defaults } from '../defaults.js';
13
6
  import { LengthIndicator } from '../ui/LengthIndicator.js';
@@ -21,7 +14,7 @@ export const MetaTitle = (props)=>{
21
14
  path
22
15
  });
23
16
  const locale = useLocale();
24
- const [fields] = useAllFormFields();
17
+ const { getData } = useForm();
25
18
  const docInfo = useDocumentInfo();
26
19
  const { errorMessage, setValue, showError, value } = field;
27
20
  const regenerateTitle = useCallback(async ()=>{
@@ -30,7 +23,7 @@ export const MetaTitle = (props)=>{
30
23
  body: JSON.stringify({
31
24
  ...docInfo,
32
25
  doc: {
33
- ...fields
26
+ ...getData()
34
27
  },
35
28
  locale: typeof locale === 'object' ? locale?.code : locale
36
29
  }),
@@ -43,11 +36,11 @@ export const MetaTitle = (props)=>{
43
36
  const { result: generatedTitle } = await genTitleResponse.json();
44
37
  setValue(generatedTitle || '');
45
38
  }, [
46
- fields,
47
- setValue,
48
39
  hasGenerateTitleFn,
40
+ docInfo,
41
+ getData,
49
42
  locale,
50
- docInfo
43
+ setValue
51
44
  ]);
52
45
  return /*#__PURE__*/ _jsxs("div", {
53
46
  style: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fields/MetaTitle.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { Options } from '@payloadcms/ui/forms/useField'\nimport type { FieldType } from '@payloadcms/ui/forms/useField'\n\nimport { TextInput } from '@payloadcms/ui/fields/Text'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useAllFormFields } from '@payloadcms/ui/forms/Form'\nimport { useField } from '@payloadcms/ui/forms/useField'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useLocale } from '@payloadcms/ui/providers/Locale'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\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\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype MetaTitleProps = FormFieldBase & {\n hasGenerateTitleFn: boolean\n}\n\nexport const MetaTitle: React.FC<MetaTitleProps> = (props) => {\n const { CustomLabel, hasGenerateTitleFn, label, labelProps, path, required } = props || {}\n const { path: pathFromContext } = useFieldProps()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const field: FieldType<string> = useField({\n path,\n } as Options)\n\n const locale = useLocale()\n const [fields] = useAllFormFields()\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 ...docInfo,\n doc: { ...fields },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateTitle>[0]),\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 }, [fields, setValue, hasGenerateTitleFn, locale, docInfo])\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 CustomLabel={CustomLabel} label={label} {...(labelProps || {})} />\n {hasGenerateTitleFn && (\n <React.Fragment>\n &nbsp; &mdash; &nbsp;\n <button\n onClick={regenerateTitle}\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 CustomError={errorMessage}\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":["TextInput","FieldLabel","useFieldProps","useAllFormFields","useField","useDocumentInfo","useLocale","useTranslation","React","useCallback","defaults","LengthIndicator","maxLength","minLength","title","MetaTitle","props","CustomLabel","hasGenerateTitleFn","label","labelProps","path","required","pathFromContext","t","field","locale","fields","docInfo","errorMessage","setValue","showError","value","regenerateTitle","genTitleResponse","fetch","body","JSON","stringify","doc","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","CustomError","onChange","alignItems","display","width","text"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAMA,SAASA,SAAS,QAAQ,6BAA4B;AACtD,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,QAAQ,QAAQ,iBAAgB;AACzC,SAASC,eAAe,QAAQ,2BAA0B;AAC1D,OAAO,eAAc;AAErB,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH,SAASI,KAAK;AAO/C,OAAO,MAAMC,YAAsC,CAACC;IAClD,MAAM,EAAEC,WAAW,EAAEC,kBAAkB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGN,SAAS,CAAC;IACzF,MAAM,EAAEK,MAAME,eAAe,EAAE,GAAGrB;IAElC,MAAM,EAAEsB,CAAC,EAAE,GAAGjB;IAEd,MAAMkB,QAA2BrB,SAAS;QACxCiB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O;0CAEN1C,EAAE;;4BACD;;;;;0BAIR,KAACuB;gBACCC,OAAO;oBACLC,cAAc;oBACdC,UAAU;gBACZ;0BAEA,cAAA,KAAClD;oBACCmE,aAAatC;oBACbuC,UAAUtC;oBACVT,MAAME;oBACND,UAAUA;oBACVS,WAAWA;oBACXiB,OAAO;wBACLC,cAAc;oBAChB;oBACAjB,OAAOA;;;0BAGX,KAACe;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAAC5D;oBAAgBC,WAAWA;oBAAWC,WAAWA;oBAAW2D,MAAMxC;;;;;AAI3E,EAAC"}
1
+ {"version":3,"sources":["../../src/fields/MetaTitle.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType, FormFieldBase, Options } from '@payloadcms/ui'\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\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\ntype MetaTitleProps = FormFieldBase & {\n hasGenerateTitleFn: boolean\n}\n\nexport const MetaTitle: React.FC<MetaTitleProps> = (props) => {\n const { CustomLabel, hasGenerateTitleFn, label, labelProps, path, required } = props || {}\n const { path: pathFromContext } = useFieldProps()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const field: FieldType<string> = useField({\n path,\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 ...docInfo,\n doc: { ...getData() },\n locale: typeof locale === 'object' ? locale?.code : locale,\n } satisfies Parameters<GenerateTitle>[0]),\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 CustomLabel={CustomLabel} label={label} {...(labelProps || {})} />\n {hasGenerateTitleFn && (\n <React.Fragment>\n &nbsp; &mdash; &nbsp;\n <button\n onClick={regenerateTitle}\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 CustomError={errorMessage}\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","MetaTitle","props","CustomLabel","hasGenerateTitleFn","label","labelProps","path","required","pathFromContext","t","field","locale","getData","docInfo","errorMessage","setValue","showError","value","regenerateTitle","genTitleResponse","fetch","body","JSON","stringify","doc","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","CustomError","onChange","alignItems","display","width","text"],"mappings":"AAAA;;AAIA,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,iBAAgB;AACzC,SAASC,eAAe,QAAQ,2BAA0B;AAC1D,OAAO,eAAc;AAErB,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH,SAASI,KAAK;AAO/C,OAAO,MAAMC,YAAsC,CAACC;IAClD,MAAM,EAAEC,WAAW,EAAEC,kBAAkB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGN,SAAS,CAAC;IACzF,MAAM,EAAEK,MAAME,eAAe,EAAE,GAAGnB;IAElC,MAAM,EAAEoB,CAAC,EAAE,GAAGjB;IAEd,MAAMkB,QAA2BtB,SAAS;QACxCkB;IACF;IAEA,MAAMK,SAASpB;IACf,MAAM,EAAEqB,OAAO,EAAE,GAAGtB;IACpB,MAAMuB,UAAU1B;IAEhB,MAAM,EAAE2B,YAAY,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGP;IAErD,MAAMQ,kBAAkBxB,YAAY;QAClC,IAAI,CAACS,oBAAoB;QAEzB,MAAMgB,mBAAmB,MAAMC,MAAM,kCAAkC;YACrEC,MAAMC,KAAKC,SAAS,CAAC;gBACnB,GAAGV,OAAO;gBACVW,KAAK;oBAAE,GAAGZ,SAAS;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AWA;oBAAW2D,MAAMxC;;;;;AAI3E,EAAC"}
@@ -1,5 +1,5 @@
1
1
  .plugin-seo__field {
2
2
  .field-label {
3
- display: inline!important;
3
+ display: inline !important;
4
4
  }
5
5
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Config } from 'payload/config';
1
+ import type { Config } from 'payload';
2
2
  import type { SEOPluginConfig } from './types.js';
3
3
  export declare const seoPlugin: (pluginConfig: SEOPluginConfig) => (config: Config) => Config;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAO5C,OAAO,KAAK,EAKV,eAAe,EAChB,MAAM,YAAY,CAAA;AASnB,eAAO,MAAM,SAAS,iBACL,eAAe,cACrB,MAAM,KAAG,MAqRjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA2C,MAAM,SAAS,CAAA;AAM9E,OAAO,KAAK,EAKV,eAAe,EAChB,MAAM,YAAY,CAAA;AASnB,eAAO,MAAM,SAAS,iBACL,eAAe,cACrB,MAAM,KAAG,MAqRjB,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { addDataAndFileToRequest } from '@payloadcms/next/utilities';
2
- import { withMergedProps } from '@payloadcms/ui/elements/withMergedProps';
3
- import { deepMerge } from 'payload/utilities';
2
+ import { withMergedProps } from '@payloadcms/ui/shared';
3
+ import { deepMerge } from 'payload/shared';
4
4
  import { MetaDescription } from './fields/MetaDescription.js';
5
5
  import { MetaImage } from './fields/MetaImage.js';
6
6
  import { MetaTitle } from './fields/MetaTitle.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Field, GroupField, TabsField, TextField } from 'payload/types'\n\nimport { addDataAndFileToRequest } from '@payloadcms/next/utilities'\nimport { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'\nimport { deepMerge } from 'payload/utilities'\n\nimport type {\n GenerateDescription,\n GenerateImage,\n GenerateTitle,\n GenerateURL,\n SEOPluginConfig,\n} from './types.js'\n\nimport { MetaDescription } from './fields/MetaDescription.js'\nimport { MetaImage } from './fields/MetaImage.js'\nimport { MetaTitle } from './fields/MetaTitle.js'\nimport { translations } from './translations/index.js'\nimport { Overview } from './ui/Overview.js'\nimport { Preview } from './ui/Preview.js'\n\nexport const seoPlugin =\n (pluginConfig: SEOPluginConfig) =>\n (config: Config): Config => {\n const seoFields: GroupField[] = [\n {\n name: 'meta',\n type: 'group',\n fields: [\n {\n name: 'overview',\n type: 'ui',\n admin: {\n components: {\n Field: Overview,\n },\n },\n label: 'Overview',\n },\n {\n name: 'title',\n type: 'text',\n admin: {\n components: {\n Field: withMergedProps({\n Component: MetaTitle,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateTitleFn: typeof pluginConfig?.generateTitle === 'function',\n },\n }),\n },\n },\n localized: true,\n ...((pluginConfig?.fieldOverrides?.title as unknown as TextField) ?? {}),\n },\n {\n name: 'description',\n type: 'textarea',\n admin: {\n components: {\n Field: withMergedProps({\n Component: MetaDescription,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateDescriptionFn:\n typeof pluginConfig?.generateDescription === 'function',\n },\n }),\n },\n },\n localized: true,\n ...(pluginConfig?.fieldOverrides?.description ?? {}),\n },\n ...(pluginConfig?.uploadsCollection\n ? [\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n {\n name: 'image',\n type: 'upload',\n admin: {\n components: {\n Field: withMergedProps({\n Component: MetaImage,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateImageFn: typeof pluginConfig?.generateImage === 'function',\n },\n }),\n },\n description:\n 'Maximum upload file size: 12MB. Recommended file size for images is <500KB.',\n },\n label: 'Meta Image',\n localized: true,\n relationTo: pluginConfig?.uploadsCollection,\n ...(pluginConfig?.fieldOverrides?.image ?? {}),\n } as Field,\n ]\n : []),\n ...(pluginConfig?.fields || []),\n {\n name: 'preview',\n type: 'ui',\n admin: {\n components: {\n Field: withMergedProps({\n Component: Preview,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateURLFn: typeof pluginConfig?.generateURL === 'function',\n },\n }),\n },\n },\n label: 'Preview',\n },\n ],\n interfaceName: pluginConfig.interfaceName,\n label: 'SEO',\n },\n ]\n\n return {\n ...config,\n collections:\n config.collections?.map((collection) => {\n const { slug } = collection\n const isEnabled = pluginConfig?.collections?.includes(slug)\n\n if (isEnabled) {\n if (pluginConfig?.tabbedUI) {\n // prevent issues with auth enabled collections having an email field that shouldn't be moved to the SEO tab\n const emailField =\n (collection.auth ||\n !(typeof collection.auth === 'object' && collection.auth.disableLocalStrategy)) &&\n collection.fields?.find((field) => 'name' in field && field.name === 'email')\n const hasOnlyEmailField = collection.fields?.length === 1 && emailField\n\n const seoTabs: TabsField[] = hasOnlyEmailField\n ? [\n {\n type: 'tabs',\n tabs: [\n {\n fields: seoFields,\n label: 'SEO',\n },\n ],\n },\n ]\n : [\n {\n type: 'tabs',\n tabs: [\n // append a new tab onto the end of the tabs array, if there is one at the first index\n // if needed, create a new `Content` tab in the first index for this collection's base fields\n ...(collection?.fields?.[0]?.type === 'tabs' &&\n collection?.fields?.[0]?.tabs\n ? collection.fields[0].tabs\n : [\n {\n fields: [\n ...(emailField\n ? collection.fields.filter(\n (field) => 'name' in field && field.name !== 'email',\n )\n : collection.fields),\n ],\n label: collection?.labels?.singular || 'Content',\n },\n ]),\n {\n fields: seoFields,\n label: 'SEO',\n },\n ],\n },\n ]\n\n return {\n ...collection,\n fields: [\n ...(emailField ? [emailField] : []),\n ...seoTabs,\n ...(collection?.fields?.[0]?.type === 'tabs' ? collection.fields.slice(1) : []),\n ],\n }\n }\n\n return {\n ...collection,\n fields: [...(collection?.fields || []), ...seoFields],\n }\n }\n\n return collection\n }) || [],\n endpoints: [\n ...(config.endpoints ?? []),\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateTitle>[0] =\n reqWithData.data as unknown as Parameters<GenerateTitle>[0]\n const result = pluginConfig.generateTitle ? await pluginConfig.generateTitle(args) : ''\n return new Response(JSON.stringify({ result }), { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-title',\n },\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateDescription>[0] =\n reqWithData.data as unknown as Parameters<GenerateDescription>[0]\n const result = pluginConfig.generateDescription\n ? await pluginConfig.generateDescription(args)\n : ''\n return new Response(JSON.stringify({ result }), { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-description',\n },\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateURL>[0] =\n reqWithData.data as unknown as Parameters<GenerateURL>[0]\n const result = pluginConfig.generateURL ? await pluginConfig.generateURL(args) : ''\n return new Response(JSON.stringify({ result }), { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-url',\n },\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateImage>[0] =\n reqWithData.data as unknown as Parameters<GenerateImage>[0]\n const result = pluginConfig.generateImage ? await pluginConfig.generateImage(args) : ''\n return new Response(result, { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-image',\n },\n ],\n globals:\n config.globals?.map((global) => {\n const { slug } = global\n const isEnabled = pluginConfig?.globals?.includes(slug)\n\n if (isEnabled) {\n if (pluginConfig?.tabbedUI) {\n const seoTabs: TabsField[] = [\n {\n type: 'tabs',\n tabs: [\n // append a new tab onto the end of the tabs array, if there is one at the first index\n // if needed, create a new `Content` tab in the first index for this global's base fields\n ...(global?.fields?.[0].type === 'tabs' && global?.fields?.[0].tabs\n ? global.fields[0].tabs\n : [\n {\n fields: [...(global?.fields || [])],\n label: global?.label || 'Content',\n },\n ]),\n {\n fields: seoFields,\n label: 'SEO',\n },\n ],\n },\n ]\n\n return {\n ...global,\n fields: [\n ...seoTabs,\n ...(global?.fields?.[0].type === 'tabs' ? global.fields.slice(1) : []),\n ],\n }\n }\n\n return {\n ...global,\n fields: [...(global?.fields || []), ...seoFields],\n }\n }\n\n return global\n }) || [],\n i18n: {\n ...config.i18n,\n translations: {\n ...deepMerge(translations, config.i18n?.translations),\n },\n },\n }\n }\n"],"names":["addDataAndFileToRequest","withMergedProps","deepMerge","MetaDescription","MetaImage","MetaTitle","translations","Overview","Preview","seoPlugin","pluginConfig","config","seoFields","name","type","fields","admin","components","Field","label","Component","sanitizeServerOnlyProps","toMergeIntoProps","hasGenerateTitleFn","generateTitle","localized","fieldOverrides","title","hasGenerateDescriptionFn","generateDescription","description","uploadsCollection","hasGenerateImageFn","generateImage","relationTo","image","hasGenerateURLFn","generateURL","interfaceName","collections","map","collection","slug","isEnabled","includes","tabbedUI","emailField","auth","disableLocalStrategy","find","field","hasOnlyEmailField","length","seoTabs","tabs","filter","labels","singular","slice","endpoints","handler","req","reqWithData","request","args","data","result","Response","JSON","stringify","status","method","path","globals","global","i18n"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,uBAAuB,QAAQ,6BAA4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B,OAAO3D,MAAM,CAAC,EAAE,CAACuC,IAAI,GACrB;wCACE;4CACEvC,QAAQ;mDAAK2D,QAAQ3D,UAAU,EAAE;6CAAE;4CACnCI,OAAOuD,QAAQvD,SAAS;wCAC1B;qCACD;oCACL;wCACEJ,QAAQH;wCACRO,OAAO;oCACT;iCACD;4BACH;yBACD;wBAED,OAAO;4BACL,GAAGuD,MAAM;4BACT3D,QAAQ;mCACHsC;mCACCqB,QAAQ3D,QAAQ,CAAC,EAAE,CAACD,SAAS,SAAS4D,OAAO3D,MAAM,CAAC2C,KAAK,CAAC,KAAK,EAAE;6BACtE;wBACH;oBACF;oBAEA,OAAO;wBACL,GAAGgB,MAAM;wBACT3D,QAAQ;+BAAK2D,QAAQ3D,UAAU,EAAE;+BAAMH;yBAAU;oBACnD;gBACF;gBAEA,OAAO8D;YACT,MAAM,EAAE;YACVC,MAAM;gBACJ,GAAGhE,OAAOgE,IAAI;gBACdrE,cAAc;oBACZ,GAAGJ,UAAUI,cAAcK,OAAOgE,IAAI,EAAErE,aAAa;gBACvD;YACF;QACF;IACF,EAAC"}
1
+ {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import type { Config, Field, GroupField, TabsField, TextField } from 'payload'\n\nimport { addDataAndFileToRequest } from '@payloadcms/next/utilities'\nimport { withMergedProps } from '@payloadcms/ui/shared'\nimport { deepMerge } from 'payload/shared'\n\nimport type {\n GenerateDescription,\n GenerateImage,\n GenerateTitle,\n GenerateURL,\n SEOPluginConfig,\n} from './types.js'\n\nimport { MetaDescription } from './fields/MetaDescription.js'\nimport { MetaImage } from './fields/MetaImage.js'\nimport { MetaTitle } from './fields/MetaTitle.js'\nimport { translations } from './translations/index.js'\nimport { Overview } from './ui/Overview.js'\nimport { Preview } from './ui/Preview.js'\n\nexport const seoPlugin =\n (pluginConfig: SEOPluginConfig) =>\n (config: Config): Config => {\n const seoFields: GroupField[] = [\n {\n name: 'meta',\n type: 'group',\n fields: [\n {\n name: 'overview',\n type: 'ui',\n admin: {\n components: {\n Field: Overview,\n },\n },\n label: 'Overview',\n },\n {\n name: 'title',\n type: 'text',\n admin: {\n components: {\n Field: withMergedProps({\n Component: MetaTitle,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateTitleFn: typeof pluginConfig?.generateTitle === 'function',\n },\n }),\n },\n },\n localized: true,\n ...((pluginConfig?.fieldOverrides?.title as unknown as TextField) ?? {}),\n },\n {\n name: 'description',\n type: 'textarea',\n admin: {\n components: {\n Field: withMergedProps({\n Component: MetaDescription,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateDescriptionFn:\n typeof pluginConfig?.generateDescription === 'function',\n },\n }),\n },\n },\n localized: true,\n ...(pluginConfig?.fieldOverrides?.description ?? {}),\n },\n ...(pluginConfig?.uploadsCollection\n ? [\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n {\n name: 'image',\n type: 'upload',\n admin: {\n components: {\n Field: withMergedProps({\n Component: MetaImage,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateImageFn: typeof pluginConfig?.generateImage === 'function',\n },\n }),\n },\n description:\n 'Maximum upload file size: 12MB. Recommended file size for images is <500KB.',\n },\n label: 'Meta Image',\n localized: true,\n relationTo: pluginConfig?.uploadsCollection,\n ...(pluginConfig?.fieldOverrides?.image ?? {}),\n } as Field,\n ]\n : []),\n ...(pluginConfig?.fields || []),\n {\n name: 'preview',\n type: 'ui',\n admin: {\n components: {\n Field: withMergedProps({\n Component: Preview,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: {\n hasGenerateURLFn: typeof pluginConfig?.generateURL === 'function',\n },\n }),\n },\n },\n label: 'Preview',\n },\n ],\n interfaceName: pluginConfig.interfaceName,\n label: 'SEO',\n },\n ]\n\n return {\n ...config,\n collections:\n config.collections?.map((collection) => {\n const { slug } = collection\n const isEnabled = pluginConfig?.collections?.includes(slug)\n\n if (isEnabled) {\n if (pluginConfig?.tabbedUI) {\n // prevent issues with auth enabled collections having an email field that shouldn't be moved to the SEO tab\n const emailField =\n (collection.auth ||\n !(typeof collection.auth === 'object' && collection.auth.disableLocalStrategy)) &&\n collection.fields?.find((field) => 'name' in field && field.name === 'email')\n const hasOnlyEmailField = collection.fields?.length === 1 && emailField\n\n const seoTabs: TabsField[] = hasOnlyEmailField\n ? [\n {\n type: 'tabs',\n tabs: [\n {\n fields: seoFields,\n label: 'SEO',\n },\n ],\n },\n ]\n : [\n {\n type: 'tabs',\n tabs: [\n // append a new tab onto the end of the tabs array, if there is one at the first index\n // if needed, create a new `Content` tab in the first index for this collection's base fields\n ...(collection?.fields?.[0]?.type === 'tabs' &&\n collection?.fields?.[0]?.tabs\n ? collection.fields[0].tabs\n : [\n {\n fields: [\n ...(emailField\n ? collection.fields.filter(\n (field) => 'name' in field && field.name !== 'email',\n )\n : collection.fields),\n ],\n label: collection?.labels?.singular || 'Content',\n },\n ]),\n {\n fields: seoFields,\n label: 'SEO',\n },\n ],\n },\n ]\n\n return {\n ...collection,\n fields: [\n ...(emailField ? [emailField] : []),\n ...seoTabs,\n ...(collection?.fields?.[0]?.type === 'tabs' ? collection.fields.slice(1) : []),\n ],\n }\n }\n\n return {\n ...collection,\n fields: [...(collection?.fields || []), ...seoFields],\n }\n }\n\n return collection\n }) || [],\n endpoints: [\n ...(config.endpoints ?? []),\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateTitle>[0] =\n reqWithData.data as unknown as Parameters<GenerateTitle>[0]\n const result = pluginConfig.generateTitle ? await pluginConfig.generateTitle(args) : ''\n return new Response(JSON.stringify({ result }), { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-title',\n },\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateDescription>[0] =\n reqWithData.data as unknown as Parameters<GenerateDescription>[0]\n const result = pluginConfig.generateDescription\n ? await pluginConfig.generateDescription(args)\n : ''\n return new Response(JSON.stringify({ result }), { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-description',\n },\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateURL>[0] =\n reqWithData.data as unknown as Parameters<GenerateURL>[0]\n const result = pluginConfig.generateURL ? await pluginConfig.generateURL(args) : ''\n return new Response(JSON.stringify({ result }), { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-url',\n },\n {\n handler: async (req) => {\n const reqWithData = await addDataAndFileToRequest({ request: req })\n const args: Parameters<GenerateImage>[0] =\n reqWithData.data as unknown as Parameters<GenerateImage>[0]\n const result = pluginConfig.generateImage ? await pluginConfig.generateImage(args) : ''\n return new Response(result, { status: 200 })\n },\n method: 'post',\n path: '/plugin-seo/generate-image',\n },\n ],\n globals:\n config.globals?.map((global) => {\n const { slug } = global\n const isEnabled = pluginConfig?.globals?.includes(slug)\n\n if (isEnabled) {\n if (pluginConfig?.tabbedUI) {\n const seoTabs: TabsField[] = [\n {\n type: 'tabs',\n tabs: [\n // append a new tab onto the end of the tabs array, if there is one at the first index\n // if needed, create a new `Content` tab in the first index for this global's base fields\n ...(global?.fields?.[0].type === 'tabs' && global?.fields?.[0].tabs\n ? global.fields[0].tabs\n : [\n {\n fields: [...(global?.fields || [])],\n label: global?.label || 'Content',\n },\n ]),\n {\n fields: seoFields,\n label: 'SEO',\n },\n ],\n },\n ]\n\n return {\n ...global,\n fields: [\n ...seoTabs,\n ...(global?.fields?.[0].type === 'tabs' ? global.fields.slice(1) : []),\n ],\n }\n }\n\n return {\n ...global,\n fields: [...(global?.fields || []), ...seoFields],\n }\n }\n\n return global\n }) || [],\n i18n: {\n ...config.i18n,\n translations: {\n ...deepMerge(translations, config.i18n?.translations),\n },\n },\n }\n }\n"],"names":["addDataAndFileToRequest","withMergedProps","deepMerge","MetaDescription","MetaImage","MetaTitle","translations","Overview","Preview","seoPlugin","pluginConfig","config","seoFields","name","type","fields","admin","components","Field","label","Component","sanitizeServerOnlyProps","toMergeIntoProps","hasGenerateTitleFn","generateTitle","localized","fieldOverrides","title","hasGenerateDescriptionFn","generateDescription","description","uploadsCollection","hasGenerateImageFn","generateImage","relationTo","image","hasGenerateURLFn","generateURL","interfaceName","collections","map","collection","slug","isEnabled","includes","tabbedUI","emailField","auth","disableLocalStrategy","find","field","hasOnlyEmailField","length","seoTabs","tabs","filter","labels","singular","slice","endpoints","handler","req","reqWithData","request","args","data","result","Response","JSON","stringify","status","method","path","globals","global","i18n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ,6BAA4B;AACpE,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,SAAS,QAAQ,iBAAgB;AAU1C,SAASC,eAAe,QAAQ,8BAA6B;AAC7D,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,QAAQ,QAAQ,mBAAkB;AAC3C,SAASC,OAAO,QAAQ,kBAAiB;AAEzC,OAAO,MAAMC,YACX,CAACC,eACD,CAACC;QACC,MAAMC,YAA0B;YAC9B;gBACEC,MAAM;gBACNC,MAAM;gBACNC,QAAQ;oBACN;wBACEF,MAAM;wBACNC,MAAM;wBACNE,OAAO;4BACLC,YAAY;gCACVC,OAAOX;4BACT;wBACF;wBACAY,OAAO;oBACT;oBACA;wBACEN,MAAM;wBACNC,MAAM;wBACNE,OAAO;4BACLC,YAAY;gCACVC,OAAOjB,gBAAgB;oCACrBmB,WAAWf;oCACXgB,yBAAyB;oCACzBC,kBAAkB;wCAChBC,oBAAoB,OAAOb,cAAcc,kBAAkB;oCAC7D;gCACF;4BACF;wBACF;wBACAC,WAAW;wBACX,GAAI,AAACf,cAAcgB,gBAAgBC,SAAkC,CAAC,CAAC;oBACzE;oBACA;wBACEd,MAAM;wBACNC,MAAM;wBACNE,OAAO;4BACLC,YAAY;gCACVC,OAAOjB,gBAAgB;oCACrBmB,WAAWjB;oCACXkB,yBAAyB;oCAC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AI,CAACkC;gBACnB,MAAM,EAAEhC,IAAI,EAAE,GAAGgC;gBACjB,MAAM/B,YAAYjC,cAAc+D,SAAS7B,SAASF;gBAElD,IAAIC,WAAW;oBACb,IAAIjC,cAAcmC,UAAU;wBAC1B,MAAMQ,UAAuB;4BAC3B;gCACEvC,MAAM;gCACNwC,MAAM;oCACJ,sFAAsF;oCACtF,yFAAyF;uCACrFoB,QAAQ3D,QAAQ,CAAC,EAAE,CAACD,SAAS,UAAU4D,QAAQ3D,QAAQ,CAAC,EAAE,CAACuC,OAC3DoB,OAAO3D,MAAM,CAAC,EAAE,CAACuC,IAAI,GACrB;wCACE;4CACEvC,QAAQ;mDAAK2D,QAAQ3D,UAAU,EAAE;6CAAE;4CACnCI,OAAOuD,QAAQvD,SAAS;wCAC1B;qCACD;oCACL;wCACEJ,QAAQH;wCACRO,OAAO;oCACT;iCACD;4BACH;yBACD;wBAED,OAAO;4BACL,GAAGuD,MAAM;4BACT3D,QAAQ;mCACHsC;mCACCqB,QAAQ3D,QAAQ,CAAC,EAAE,CAACD,SAAS,SAAS4D,OAAO3D,MAAM,CAAC2C,KAAK,CAAC,KAAK,EAAE;6BACtE;wBACH;oBACF;oBAEA,OAAO;wBACL,GAAGgB,MAAM;wBACT3D,QAAQ;+BAAK2D,QAAQ3D,UAAU,EAAE;+BAAMH;yBAAU;oBACnD;gBACF;gBAEA,OAAO8D;YACT,MAAM,EAAE;YACVC,MAAM;gBACJ,GAAGhE,OAAOgE,IAAI;gBACdrE,cAAc;oBACZ,GAAGJ,UAAUI,cAAcK,OAAOgE,IAAI,EAAErE,aAAa;gBACvD;YACF;QACF;IACF,EAAC"}
@@ -132,6 +132,28 @@ export declare const translations: {
132
132
  tooShort: string;
133
133
  };
134
134
  };
135
+ ru: {
136
+ $schema: string;
137
+ 'plugin-seo': {
138
+ almostThere: string;
139
+ autoGenerate: string;
140
+ bestPractices: string;
141
+ characterCount: string;
142
+ charactersLeftOver: string;
143
+ charactersToGo: string;
144
+ charactersTooMany: string;
145
+ checksPassing: string;
146
+ good: string;
147
+ imageAutoGenerationTip: string;
148
+ lengthTipDescription: string;
149
+ lengthTipTitle: string;
150
+ noImage: string;
151
+ preview: string;
152
+ previewDescription: string;
153
+ tooLong: string;
154
+ tooShort: string;
155
+ };
156
+ };
135
157
  uk: {
136
158
  $schema: string;
137
159
  'plugin-seo': {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLxB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,YAAY,CAAC,EAAE,CAAA;AAE1D,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyMxB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,YAAY,CAAC,EAAE,CAAA;AAE1D,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAA"}
@@ -131,6 +131,28 @@ export const translations = {
131
131
  tooShort: 'Zbyt krótkie'
132
132
  }
133
133
  },
134
+ ru: {
135
+ $schema: './translation-schema.json',
136
+ 'plugin-seo': {
137
+ almostThere: 'Почти готово',
138
+ autoGenerate: 'Сгенерировать автоматически',
139
+ bestPractices: 'лучшие практики',
140
+ characterCount: '{{current}}/{{minLength}}-{{maxLength}} символов, ',
141
+ charactersLeftOver: 'осталось {{characters}} символов',
142
+ charactersToGo: 'на {{characters}} символов меньше',
143
+ charactersTooMany: 'на {{characters}} символов больше',
144
+ checksPassing: '{{current}}/{{max}} проверок пройдено',
145
+ good: 'Хорошо',
146
+ imageAutoGenerationTip: 'Автогенерация использует выбранное главное изображение.',
147
+ lengthTipDescription: 'Должно быть от {{minLength}} до {{maxLength}} символов. Для помощи в написании качественных метаописаний см.',
148
+ lengthTipTitle: 'Должно быть от {{minLength}} до {{maxLength}} символов. Для помощи в написании качественных метазаголовков см.',
149
+ noImage: 'Нет изображения',
150
+ preview: 'Предварительный просмотр',
151
+ previewDescription: 'Фактические результаты могут отличаться в зависимости от контента и релевантности поиска.',
152
+ tooLong: 'Слишком длинно',
153
+ tooShort: 'Слишком коротко'
154
+ }
155
+ },
134
156
  uk: {
135
157
  $schema: './translation-schema.json',
136
158
  'plugin-seo': {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/translations/index.ts"],"sourcesContent":["import type { NestedKeysStripped } from '@payloadcms/translations'\n\nexport const translations = {\n en: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Almost there',\n autoGenerate: 'Auto-generate',\n bestPractices: 'best practices',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} chars, ',\n charactersLeftOver: '{{characters}} left over',\n charactersToGo: '{{characters}} to go',\n charactersTooMany: '{{characters}} too many',\n checksPassing: '{{current}}/{{max}} checks are passing',\n good: 'Good',\n imageAutoGenerationTip: 'Auto-generation will retrieve the selected hero image.',\n lengthTipDescription:\n 'This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta descriptions, see ',\n lengthTipTitle:\n 'This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta titles, see ',\n noImage: 'No image',\n preview: 'Preview',\n previewDescription: 'Exact result listings may vary based on content and search relevancy.',\n tooLong: 'Too long',\n tooShort: 'Too short',\n },\n },\n es: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Ya casi está',\n autoGenerate: 'Autogénerar',\n bestPractices: 'mejores prácticas',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} letras, ',\n charactersLeftOver: '{{characters}} letras sobrantes',\n charactersToGo: '{{characters}} letras sobrantes',\n charactersTooMany: '{{characters}} letras demasiados',\n checksPassing: '{{current}}/{{max}} las comprobaciones están pasando',\n good: 'Bien',\n imageAutoGenerationTip: 'La autogeneración recuperará la imagen de héroe seleccionada.',\n lengthTipDescription:\n 'Esto debe estar entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir meta descripciones de calidad, consulte ',\n lengthTipTitle:\n 'Debe tener entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir metatítulos de calidad, consulte ',\n noImage: 'Sin imagen',\n preview: 'Vista previa',\n previewDescription:\n 'Las listas de resultados pueden variar segun la relevancia de buesqueda y el contenido.',\n tooLong: 'Demasiado largo',\n tooShort: 'Demasiado corto',\n },\n },\n fa: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'چیزیی باقی نمونده',\n autoGenerate: 'تولید خودکار',\n bestPractices: 'آموزش بیشتر',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} کلمه، ',\n charactersLeftOver: '{{characters}} باقی مانده',\n charactersToGo: '{{characters}} باقی مانده',\n charactersTooMany: '{{characters}} بیش از حد',\n checksPassing: '{{current}}/{{max}} بررسی‌ها با موفقیت انجام شده است',\n good: 'خوب',\n imageAutoGenerationTip:\n 'این قابلیت، تصویر فعلی بارگذاری شده در مجموعه محتوای شما را بازیابی می‌کند',\n lengthTipDescription:\n 'این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن توضیحات متا با کیفیت، مراجعه کنید به ',\n lengthTipTitle:\n 'این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن عناوین متا با کیفیت، مراجعه کنید به ',\n noImage: 'بدون تصویر',\n preview: 'پیش‌نمایش',\n previewDescription:\n 'فهرست نتایج ممکن است بر اساس محتوا و متناسب با کلمه کلیدی جستجو شده باشند',\n tooLong: 'خیلی طولانی',\n tooShort: 'خیلی کوتاه',\n },\n },\n fr: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'On y est presque',\n autoGenerate: 'Auto-générer',\n bestPractices: 'bonnes pratiques',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} caractères, ',\n charactersLeftOver: '{{characters}} restants',\n charactersToGo: '{{characters}} à ajouter',\n charactersTooMany: '{{characters}} en trop',\n checksPassing: '{{current}}/{{max}} vérifications réussies',\n good: 'Bien',\n imageAutoGenerationTip: \"L'auto-génération récupérera l'image principale sélectionnée.\",\n lengthTipDescription:\n \"Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des descriptions meta de qualité, consultez les \",\n lengthTipTitle:\n \"Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des titres meta de qualité, consultez les \",\n noImage: \"Pas d'image\",\n preview: 'Aperçu',\n previewDescription:\n 'Les résultats exacts peuvent varier en fonction du contenu et de la pertinence de la recherche.',\n tooLong: 'Trop long',\n tooShort: 'Trop court',\n },\n },\n nb: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Nesten der',\n autoGenerate: 'Auto-generer',\n bestPractices: 'beste praksis',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} tegn, ',\n charactersLeftOver: '{{characters}} til overs',\n charactersToGo: '{{characters}} igjen',\n charactersTooMany: '{{characters}} for mange',\n checksPassing: '{{current}}/{{max}} sjekker bestått',\n good: 'Bra',\n imageAutoGenerationTip: 'Auto-generering vil hente det valgte hero-bildet.',\n lengthTipDescription:\n 'Dette bør være mellom {{minLength}} og {{maxLength}} tegn. For hjelp til å skrive beskrivelser av god kvalitet, se ',\n lengthTipTitle:\n 'Dette bør være mellom {{minLength}} og {{maxLength}} tegn. For hjelp til å skrive metatitler av god kvalitet, se ',\n noImage: 'Bilde mangler',\n preview: 'Forhåndsvisning',\n previewDescription:\n 'Eksakte resultatoppføringer kan variere basert på innhold og søke relevans.',\n tooLong: 'For lang',\n tooShort: 'For kort',\n },\n },\n pl: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Prawie gotowe',\n autoGenerate: 'Wygeneruj automatycznie',\n bestPractices: 'najlepsze praktyki',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} znaków, ',\n charactersLeftOver: 'zostało {{characters}} znaków',\n charactersToGo: 'pozostało {{characters}} znaków',\n charactersTooMany: '{{characters}} znaków za dużo',\n checksPassing: '{{current}}/{{max}} testów zakończonych pomyślnie',\n good: 'Dobrze',\n imageAutoGenerationTip: 'Automatyczne generowanie pobierze wybrany główny obraz.',\n lengthTipDescription:\n 'Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta opisów zobacz ',\n lengthTipTitle:\n 'Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta tytułów zobacz ',\n noImage: 'Brak obrazu',\n preview: 'Podgląd',\n previewDescription:\n 'Dokładne wyniki listowania mogą się różnić w zależności od treści i zgodności z kryteriami wyszukiwania.',\n tooLong: 'Zbyt długie',\n tooShort: 'Zbyt krótkie',\n },\n },\n uk: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Ще трошки',\n autoGenerate: 'Згенерувати',\n bestPractices: 'найкращі практики',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} символів, ',\n charactersLeftOver: 'залишилось {{characters}} символів',\n charactersToGo: ' на {{characters}} символів коротше',\n charactersTooMany: 'на {{characters}} символів довше',\n checksPassing: '{{current}}/{{max}} перевірок пройдено',\n good: 'Чудово',\n imageAutoGenerationTip: 'Автоматична генерація використає зображення з головного блоку',\n lengthTipDescription:\n 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метаописи — перегляньте ',\n lengthTipTitle:\n 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метазаголовки — перегляньте ',\n noImage: 'Немає зображення',\n preview: 'Попередній перегляд',\n previewDescription:\n 'Реальне відображення може відрізнятися в залежності від вмісту та релевантності пошуку.',\n tooLong: 'Задовгий',\n tooShort: 'Закороткий',\n },\n },\n}\n\nexport type PluginSEOTranslations = typeof translations.en\n\nexport type PluginSEOTranslationKeys = NestedKeysStripped<PluginSEOTranslations>\n"],"names":["translations","en","$schema","almostThere","autoGenerate","bestPractices","characterCount","charactersLeftOver","charactersToGo","charactersTooMany","checksPassing","good","imageAutoGenerationTip","lengthTipDescription","lengthTipTitle","noImage","preview","previewDescription","tooLong","tooShort","es","fa","fr","nb","pl","uk"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,eAAe;IAC1BC,IAAI;QACFC,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBAAoB;YACpBC,SAAS;YACTC,UAAU;QACZ;IACF;IACAC,IAAI;QACFlB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAE,IAAI;QACFnB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBACE;YACFC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAG,IAAI;QACFpB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAI,IAAI;QACFrB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAK,IAAI;QACFtB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAM,IAAI;QACFvB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/translations/index.ts"],"sourcesContent":["import type { NestedKeysStripped } from '@payloadcms/translations'\n\nexport const translations = {\n en: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Almost there',\n autoGenerate: 'Auto-generate',\n bestPractices: 'best practices',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} chars, ',\n charactersLeftOver: '{{characters}} left over',\n charactersToGo: '{{characters}} to go',\n charactersTooMany: '{{characters}} too many',\n checksPassing: '{{current}}/{{max}} checks are passing',\n good: 'Good',\n imageAutoGenerationTip: 'Auto-generation will retrieve the selected hero image.',\n lengthTipDescription:\n 'This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta descriptions, see ',\n lengthTipTitle:\n 'This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta titles, see ',\n noImage: 'No image',\n preview: 'Preview',\n previewDescription: 'Exact result listings may vary based on content and search relevancy.',\n tooLong: 'Too long',\n tooShort: 'Too short',\n },\n },\n es: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Ya casi está',\n autoGenerate: 'Autogénerar',\n bestPractices: 'mejores prácticas',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} letras, ',\n charactersLeftOver: '{{characters}} letras sobrantes',\n charactersToGo: '{{characters}} letras sobrantes',\n charactersTooMany: '{{characters}} letras demasiados',\n checksPassing: '{{current}}/{{max}} las comprobaciones están pasando',\n good: 'Bien',\n imageAutoGenerationTip: 'La autogeneración recuperará la imagen de héroe seleccionada.',\n lengthTipDescription:\n 'Esto debe estar entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir meta descripciones de calidad, consulte ',\n lengthTipTitle:\n 'Debe tener entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir metatítulos de calidad, consulte ',\n noImage: 'Sin imagen',\n preview: 'Vista previa',\n previewDescription:\n 'Las listas de resultados pueden variar segun la relevancia de buesqueda y el contenido.',\n tooLong: 'Demasiado largo',\n tooShort: 'Demasiado corto',\n },\n },\n fa: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'چیزیی باقی نمونده',\n autoGenerate: 'تولید خودکار',\n bestPractices: 'آموزش بیشتر',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} کلمه، ',\n charactersLeftOver: '{{characters}} باقی مانده',\n charactersToGo: '{{characters}} باقی مانده',\n charactersTooMany: '{{characters}} بیش از حد',\n checksPassing: '{{current}}/{{max}} بررسی‌ها با موفقیت انجام شده است',\n good: 'خوب',\n imageAutoGenerationTip:\n 'این قابلیت، تصویر فعلی بارگذاری شده در مجموعه محتوای شما را بازیابی می‌کند',\n lengthTipDescription:\n 'این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن توضیحات متا با کیفیت، مراجعه کنید به ',\n lengthTipTitle:\n 'این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن عناوین متا با کیفیت، مراجعه کنید به ',\n noImage: 'بدون تصویر',\n preview: 'پیش‌نمایش',\n previewDescription:\n 'فهرست نتایج ممکن است بر اساس محتوا و متناسب با کلمه کلیدی جستجو شده باشند',\n tooLong: 'خیلی طولانی',\n tooShort: 'خیلی کوتاه',\n },\n },\n fr: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'On y est presque',\n autoGenerate: 'Auto-générer',\n bestPractices: 'bonnes pratiques',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} caractères, ',\n charactersLeftOver: '{{characters}} restants',\n charactersToGo: '{{characters}} à ajouter',\n charactersTooMany: '{{characters}} en trop',\n checksPassing: '{{current}}/{{max}} vérifications réussies',\n good: 'Bien',\n imageAutoGenerationTip: \"L'auto-génération récupérera l'image principale sélectionnée.\",\n lengthTipDescription:\n \"Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des descriptions meta de qualité, consultez les \",\n lengthTipTitle:\n \"Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des titres meta de qualité, consultez les \",\n noImage: \"Pas d'image\",\n preview: 'Aperçu',\n previewDescription:\n 'Les résultats exacts peuvent varier en fonction du contenu et de la pertinence de la recherche.',\n tooLong: 'Trop long',\n tooShort: 'Trop court',\n },\n },\n nb: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Nesten der',\n autoGenerate: 'Auto-generer',\n bestPractices: 'beste praksis',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} tegn, ',\n charactersLeftOver: '{{characters}} til overs',\n charactersToGo: '{{characters}} igjen',\n charactersTooMany: '{{characters}} for mange',\n checksPassing: '{{current}}/{{max}} sjekker bestått',\n good: 'Bra',\n imageAutoGenerationTip: 'Auto-generering vil hente det valgte hero-bildet.',\n lengthTipDescription:\n 'Dette bør være mellom {{minLength}} og {{maxLength}} tegn. For hjelp til å skrive beskrivelser av god kvalitet, se ',\n lengthTipTitle:\n 'Dette bør være mellom {{minLength}} og {{maxLength}} tegn. For hjelp til å skrive metatitler av god kvalitet, se ',\n noImage: 'Bilde mangler',\n preview: 'Forhåndsvisning',\n previewDescription:\n 'Eksakte resultatoppføringer kan variere basert på innhold og søke relevans.',\n tooLong: 'For lang',\n tooShort: 'For kort',\n },\n },\n pl: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Prawie gotowe',\n autoGenerate: 'Wygeneruj automatycznie',\n bestPractices: 'najlepsze praktyki',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} znaków, ',\n charactersLeftOver: 'zostało {{characters}} znaków',\n charactersToGo: 'pozostało {{characters}} znaków',\n charactersTooMany: '{{characters}} znaków za dużo',\n checksPassing: '{{current}}/{{max}} testów zakończonych pomyślnie',\n good: 'Dobrze',\n imageAutoGenerationTip: 'Automatyczne generowanie pobierze wybrany główny obraz.',\n lengthTipDescription:\n 'Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta opisów zobacz ',\n lengthTipTitle:\n 'Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta tytułów zobacz ',\n noImage: 'Brak obrazu',\n preview: 'Podgląd',\n previewDescription:\n 'Dokładne wyniki listowania mogą się różnić w zależności od treści i zgodności z kryteriami wyszukiwania.',\n tooLong: 'Zbyt długie',\n tooShort: 'Zbyt krótkie',\n },\n },\n ru: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Почти готово',\n autoGenerate: 'Сгенерировать автоматически',\n bestPractices: 'лучшие практики',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} символов, ',\n charactersLeftOver: 'осталось {{characters}} символов',\n charactersToGo: 'на {{characters}} символов меньше',\n charactersTooMany: 'на {{characters}} символов больше',\n checksPassing: '{{current}}/{{max}} проверок пройдено',\n good: 'Хорошо',\n imageAutoGenerationTip: 'Автогенерация использует выбранное главное изображение.',\n lengthTipDescription:\n 'Должно быть от {{minLength}} до {{maxLength}} символов. Для помощи в написании качественных метаописаний см.',\n lengthTipTitle:\n 'Должно быть от {{minLength}} до {{maxLength}} символов. Для помощи в написании качественных метазаголовков см.',\n noImage: 'Нет изображения',\n preview: 'Предварительный просмотр',\n previewDescription:\n 'Фактические результаты могут отличаться в зависимости от контента и релевантности поиска.',\n tooLong: 'Слишком длинно',\n tooShort: 'Слишком коротко',\n },\n },\n uk: {\n $schema: './translation-schema.json',\n 'plugin-seo': {\n almostThere: 'Ще трошки',\n autoGenerate: 'Згенерувати',\n bestPractices: 'найкращі практики',\n characterCount: '{{current}}/{{minLength}}-{{maxLength}} символів, ',\n charactersLeftOver: 'залишилось {{characters}} символів',\n charactersToGo: ' на {{characters}} символів коротше',\n charactersTooMany: 'на {{characters}} символів довше',\n checksPassing: '{{current}}/{{max}} перевірок пройдено',\n good: 'Чудово',\n imageAutoGenerationTip: 'Автоматична генерація використає зображення з головного блоку',\n lengthTipDescription:\n 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метаописи — перегляньте ',\n lengthTipTitle:\n 'Має бути від {{minLength}} до {{maxLength}} символів. Щоб дізнатися, як писати якісні метазаголовки — перегляньте ',\n noImage: 'Немає зображення',\n preview: 'Попередній перегляд',\n previewDescription:\n 'Реальне відображення може відрізнятися в залежності від вмісту та релевантності пошуку.',\n tooLong: 'Задовгий',\n tooShort: 'Закороткий',\n },\n },\n}\n\nexport type PluginSEOTranslations = typeof translations.en\n\nexport type PluginSEOTranslationKeys = NestedKeysStripped<PluginSEOTranslations>\n"],"names":["translations","en","$schema","almostThere","autoGenerate","bestPractices","characterCount","charactersLeftOver","charactersToGo","charactersTooMany","checksPassing","good","imageAutoGenerationTip","lengthTipDescription","lengthTipTitle","noImage","preview","previewDescription","tooLong","tooShort","es","fa","fr","nb","pl","ru","uk"],"mappings":"AAEA,OAAO,MAAMA,eAAe;IAC1BC,IAAI;QACFC,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBAAoB;YACpBC,SAAS;YACTC,UAAU;QACZ;IACF;IACAC,IAAI;QACFlB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAE,IAAI;QACFnB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBACE;YACFC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAG,IAAI;QACFpB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAI,IAAI;QACFrB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAK,IAAI;QACFtB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAM,IAAI;QACFvB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;IACAO,IAAI;QACFxB,SAAS;QACT,cAAc;YACZC,aAAa;YACbC,cAAc;YACdC,eAAe;YACfC,gBAAgB;YAChBC,oBAAoB;YACpBC,gBAAgB;YAChBC,mBAAmB;YACnBC,eAAe;YACfC,MAAM;YACNC,wBAAwB;YACxBC,sBACE;YACFC,gBACE;YACFC,SAAS;YACTC,SAAS;YACTC,oBACE;YACFC,SAAS;YACTC,UAAU;QACZ;IACF;AACF,EAAC"}
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "./translation-schema.json",
3
+ "plugin-seo": {
4
+ "almostThere": "Почти готово",
5
+ "autoGenerate": "Сгенерировать автоматически",
6
+ "bestPractices": "лучшие практики",
7
+ "characterCount": "{{current}}/{{minLength}}-{{maxLength}} символов, ",
8
+ "charactersLeftOver": "осталось {{characters}} символов",
9
+ "charactersToGo": "на {{characters}} символов меньше",
10
+ "charactersTooMany": "на {{characters}} символов больше",
11
+ "checksPassing": "{{current}}/{{max}} проверок пройдено",
12
+ "good": "Хорошо",
13
+ "imageAutoGenerationTip": "Автогенерация использует выбранное главное изображение.",
14
+ "lengthTipDescription": "Должно быть от {{minLength}} до {{maxLength}} символов. Для помощи в написании качественных метаописаний см.",
15
+ "lengthTipTitle": "Должно быть от {{minLength}} до {{maxLength}} символов. Для помощи в написании качественных метазаголовков см.",
16
+ "noImage": "Нет изображения",
17
+ "preview": "Предварительный просмотр",
18
+ "previewDescription": "Фактические результаты могут отличаться в зависимости от контента и релевантности поиска.",
19
+ "tooLong": "Слишком длинно",
20
+ "tooShort": "Слишком коротко"
21
+ }
22
+ }
package/dist/types.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import type { DocumentInfoContext } from '@payloadcms/ui/providers/DocumentInfo';
2
- import type { Field, TextField, TextareaField, UploadField } from 'payload/types';
3
- export type GenerateTitle = <T = any>(args: DocumentInfoContext & {
1
+ import type { DocumentInfoContext } from '@payloadcms/ui';
2
+ import type { Field, TextField, TextareaField, UploadField } from 'payload';
3
+ export type GenerateTitle<T = any> = (args: DocumentInfoContext & {
4
4
  doc: T;
5
5
  locale?: string;
6
6
  }) => Promise<string> | string;
7
- export type GenerateDescription = <T = any>(args: DocumentInfoContext & {
7
+ export type GenerateDescription<T = any> = (args: DocumentInfoContext & {
8
8
  doc: T;
9
9
  locale?: string;
10
10
  }) => Promise<string> | string;
11
- export type GenerateImage = <T = any>(args: DocumentInfoContext & {
11
+ export type GenerateImage<T = any> = (args: DocumentInfoContext & {
12
12
  doc: T;
13
13
  locale?: string;
14
14
  }) => Promise<string> | string;
15
- export type GenerateURL = <T = any>(args: DocumentInfoContext & {
15
+ export type GenerateURL<T = any> = (args: DocumentInfoContext & {
16
16
  doc: T;
17
17
  locale?: string;
18
18
  }) => Promise<string> | string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEjF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,GAAG,EAClC,IAAI,EAAE,mBAAmB,GAAG;IAAE,GAAG,EAAE,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KACpD,OA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AE,MAAM,CAAA;CAAE,KACpD,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;AAE7B,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,cAAc,CAAC,EAAE;QACf,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;QACpC,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;QAC5B,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;KAC3B,CAAA;IACD,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { DocumentInfoContext } from '@payloadcms/ui/providers/DocumentInfo'\nimport type { Field, TextField, TextareaField, UploadField } from 'payload/types'\n\nexport type GenerateTitle = <T = any>(\n args: DocumentInfoContext & { doc: T; locale?: string },\n) => Promise<string> | string\n\nexport type GenerateDescription = <T = any>(\n args: DocumentInfoContext & {\n doc: T\n locale?: string\n },\n) => Promise<string> | string\n\nexport type GenerateImage = <T = any>(\n args: DocumentInfoContext & { doc: T; locale?: string },\n) => Promise<string> | string\n\nexport type GenerateURL = <T = any>(\n args: DocumentInfoContext & { doc: T; locale?: string },\n) => Promise<string> | string\n\nexport type SEOPluginConfig = {\n collections?: string[]\n fieldOverrides?: {\n description?: Partial<TextareaField>\n image?: Partial<UploadField>\n title?: Partial<TextField>\n }\n fields?: Field[]\n generateDescription?: GenerateDescription\n generateImage?: GenerateImage\n generateTitle?: GenerateTitle\n generateURL?: GenerateURL\n globals?: string[]\n interfaceName?: string\n tabbedUI?: boolean\n uploadsCollection?: string\n}\n\nexport type Meta = {\n description?: string\n image?: any // TODO: type this\n keywords?: string\n title?: string\n}\n"],"names":[],"rangeMappings":"","mappings":"AAwCA,WAKC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { DocumentInfoContext } from '@payloadcms/ui'\nimport type { Field, TextField, TextareaField, UploadField } from 'payload'\n\nexport type GenerateTitle<T = any> = (\n args: DocumentInfoContext & { doc: T; locale?: string },\n) => Promise<string> | string\n\nexport type GenerateDescription<T = any> = (\n args: DocumentInfoContext & {\n doc: T\n locale?: string\n },\n) => Promise<string> | string\n\nexport type GenerateImage<T = any> = (\n args: DocumentInfoContext & { doc: T; locale?: string },\n) => Promise<string> | string\n\nexport type GenerateURL<T = any> = (\n args: DocumentInfoContext & { doc: T; locale?: string },\n) => Promise<string> | string\n\nexport type SEOPluginConfig = {\n collections?: string[]\n fieldOverrides?: {\n description?: Partial<TextareaField>\n image?: Partial<UploadField>\n title?: Partial<TextField>\n }\n fields?: Field[]\n generateDescription?: GenerateDescription\n generateImage?: GenerateImage\n generateTitle?: GenerateTitle\n generateURL?: GenerateURL\n globals?: string[]\n interfaceName?: string\n tabbedUI?: boolean\n uploadsCollection?: string\n}\n\nexport type Meta = {\n description?: string\n image?: any // TODO: type this\n keywords?: string\n title?: string\n}\n"],"names":[],"mappings":"AAwCA,WAKC"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useTranslation } from '@payloadcms/ui/providers/Translation';
3
+ import { useTranslation } from '@payloadcms/ui';
4
4
  import React, { Fragment, useEffect, useState } from 'react';
5
5
  import { Pill } from './Pill.js';
6
6
  export const LengthIndicator = (props)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/LengthIndicator.tsx"],"sourcesContent":["'use client'\n\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { Fragment, useEffect, useState } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../translations/index.js'\n\nimport { Pill } from './Pill.js'\n\nexport const LengthIndicator: React.FC<{\n maxLength?: number\n minLength?: number\n text?: string\n}> = (props) => {\n const { maxLength = 0, minLength = 0, text } = props\n\n const [labelStyle, setLabelStyle] = useState({\n backgroundColor: '',\n color: '',\n })\n\n const [label, setLabel] = useState('')\n const [barWidth, setBarWidth] = useState<number>(0)\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n useEffect(() => {\n const textLength = text?.length || 0\n\n if (textLength === 0) {\n setLabel('Missing')\n setLabelStyle({\n backgroundColor: 'red',\n color: 'white',\n })\n setBarWidth(0)\n } else {\n const progress = (textLength - minLength) / (maxLength - minLength)\n\n if (progress < 0) {\n const ratioUntilMin = textLength / minLength\n\n if (ratioUntilMin > 0.9) {\n setLabel(t('plugin-seo:almostThere'))\n setLabelStyle({\n backgroundColor: 'orange',\n color: 'white',\n })\n } else {\n setLabel(t('plugin-seo:tooShort'))\n setLabelStyle({\n backgroundColor: 'orangered',\n color: 'white',\n })\n }\n\n setBarWidth(ratioUntilMin)\n }\n\n if (progress >= 0 && progress <= 1) {\n setLabel(t('plugin-seo:good'))\n setLabelStyle({\n backgroundColor: 'green',\n color: 'white',\n })\n setBarWidth(progress)\n }\n\n if (progress > 1) {\n setLabel(t('plugin-seo:tooLong'))\n setLabelStyle({\n backgroundColor: 'red',\n color: 'white',\n })\n setBarWidth(1)\n }\n }\n }, [minLength, maxLength, text, t])\n\n const textLength = text?.length || 0\n\n const charsUntilMax = maxLength - textLength\n const charsUntilMin = minLength - textLength\n\n return (\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <Pill backgroundColor={labelStyle.backgroundColor} color={labelStyle.color} label={label} />\n <div\n style={{\n flexShrink: 0,\n lineHeight: 1,\n marginRight: '10px',\n whiteSpace: 'nowrap',\n }}\n >\n <small>\n {t('plugin-seo:characterCount', { current: text?.length || 0, maxLength, minLength })}\n {(textLength === 0 || charsUntilMin > 0) && (\n <Fragment>{t('plugin-seo:charactersToGo', { characters: charsUntilMin })}</Fragment>\n )}\n {charsUntilMin <= 0 && charsUntilMax >= 0 && (\n <Fragment>{t('plugin-seo:charactersLeftOver', { characters: charsUntilMax })}</Fragment>\n )}\n {charsUntilMax < 0 && (\n <Fragment>\n {t('plugin-seo:charactersTooMany', { characters: charsUntilMax * -1 })}\n </Fragment>\n )}\n </small>\n </div>\n <div\n style={{\n backgroundColor: '#F3F3F3',\n height: '2px',\n position: 'relative',\n width: '100%',\n }}\n >\n <div\n style={{\n backgroundColor: labelStyle.backgroundColor,\n height: '100%',\n left: 0,\n position: 'absolute',\n top: 0,\n width: `${barWidth * 100}%`,\n }}\n />\n </div>\n </div>\n )\n}\n"],"names":["useTranslation","React","Fragment","useEffect","useState","Pill","LengthIndicator","props","maxLength","minLength","text","labelStyle","setLabelStyle","backgroundColor","color","label","setLabel","barWidth","setBarWidth","t","textLength","length","progress","ratioUntilMin","charsUntilMax","charsUntilMin","div","style","alignItems","display","width","flexShrink","lineHeight","marginRight","whiteSpace","small","current","characters","height","position","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAEA,SAASA,cAAc,QA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C,aAAaV,MAAMW,UAAU;IAEnC,MAAMG,gBAAgBhB,YAAYY;IAClC,MAAMK,gBAAgBhB,YAAYW;IAElC,qBACE,MAACM;QACCC,OAAO;YACLC,YAAY;YACZC,SAAS;YACTC,OAAO;QACT;;0BAEA,KAACzB;gBAAKQ,iBAAiBF,WAAWE,eAAe;gBAAEC,OAAOH,WAAWG,KAAK;gBAAEC,OAAOA;;0BACnF,KAACW;gBACCC,OAAO;oBACLI,YAAY;oBACZC,YAAY;oBACZC,aAAa;oBACbC,YAAY;gBACd;0BAEA,cAAA,MAACC;;wBACEhB,EAAE,6BAA6B;4BAAEiB,SAAS1B,MAAMW,UAAU;4BAAGb;4BAAWC;wBAAU;wBACjFW,CAAAA,eAAe,KAAKK,gBAAgB,CAAA,mBACpC,KAACvB;sCAAUiB,EAAE,6BAA6B;gCAAEkB,YAAYZ;4BAAc;;wBAEvEA,iBAAiB,KAAKD,iBAAiB,mBACtC,KAACtB;sCAAUiB,EAAE,iCAAiC;gCAAEkB,YAAYb;4BAAc;;wBAE3EA,gBAAgB,mBACf,KAACtB;sCACEiB,EAAE,gCAAgC;gCAAEkB,YAAYb,gBAAgB,CAAC;4BAAE;;;;;0BAK5E,KAACE;gBACCC,OAAO;oBACLd,iBAAiB;oBACjByB,QAAQ;oBACRC,UAAU;oBACVT,OAAO;gBACT;0BAEA,cAAA,KAACJ;oBACCC,OAAO;wBACLd,iBAAiBF,WAAWE,eAAe;wBAC3CyB,QAAQ;wBACRE,MAAM;wBACND,UAAU;wBACVE,KAAK;wBACLX,OAAO,CAAC,EAAEb,WAAW,IAAI,CAAC,CAAC;oBAC7B;;;;;AAKV,EAAC"}
1
+ {"version":3,"sources":["../../src/ui/LengthIndicator.tsx"],"sourcesContent":["'use client'\n\nimport { useTranslation } from '@payloadcms/ui'\nimport React, { Fragment, useEffect, useState } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../translations/index.js'\n\nimport { Pill } from './Pill.js'\n\nexport const LengthIndicator: React.FC<{\n maxLength?: number\n minLength?: number\n text?: string\n}> = (props) => {\n const { maxLength = 0, minLength = 0, text } = props\n\n const [labelStyle, setLabelStyle] = useState({\n backgroundColor: '',\n color: '',\n })\n\n const [label, setLabel] = useState('')\n const [barWidth, setBarWidth] = useState<number>(0)\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n useEffect(() => {\n const textLength = text?.length || 0\n\n if (textLength === 0) {\n setLabel('Missing')\n setLabelStyle({\n backgroundColor: 'red',\n color: 'white',\n })\n setBarWidth(0)\n } else {\n const progress = (textLength - minLength) / (maxLength - minLength)\n\n if (progress < 0) {\n const ratioUntilMin = textLength / minLength\n\n if (ratioUntilMin > 0.9) {\n setLabel(t('plugin-seo:almostThere'))\n setLabelStyle({\n backgroundColor: 'orange',\n color: 'white',\n })\n } else {\n setLabel(t('plugin-seo:tooShort'))\n setLabelStyle({\n backgroundColor: 'orangered',\n color: 'white',\n })\n }\n\n setBarWidth(ratioUntilMin)\n }\n\n if (progress >= 0 && progress <= 1) {\n setLabel(t('plugin-seo:good'))\n setLabelStyle({\n backgroundColor: 'green',\n color: 'white',\n })\n setBarWidth(progress)\n }\n\n if (progress > 1) {\n setLabel(t('plugin-seo:tooLong'))\n setLabelStyle({\n backgroundColor: 'red',\n color: 'white',\n })\n setBarWidth(1)\n }\n }\n }, [minLength, maxLength, text, t])\n\n const textLength = text?.length || 0\n\n const charsUntilMax = maxLength - textLength\n const charsUntilMin = minLength - textLength\n\n return (\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <Pill backgroundColor={labelStyle.backgroundColor} color={labelStyle.color} label={label} />\n <div\n style={{\n flexShrink: 0,\n lineHeight: 1,\n marginRight: '10px',\n whiteSpace: 'nowrap',\n }}\n >\n <small>\n {t('plugin-seo:characterCount', { current: text?.length || 0, maxLength, minLength })}\n {(textLength === 0 || charsUntilMin > 0) && (\n <Fragment>{t('plugin-seo:charactersToGo', { characters: charsUntilMin })}</Fragment>\n )}\n {charsUntilMin <= 0 && charsUntilMax >= 0 && (\n <Fragment>{t('plugin-seo:charactersLeftOver', { characters: charsUntilMax })}</Fragment>\n )}\n {charsUntilMax < 0 && (\n <Fragment>\n {t('plugin-seo:charactersTooMany', { characters: charsUntilMax * -1 })}\n </Fragment>\n )}\n </small>\n </div>\n <div\n style={{\n backgroundColor: '#F3F3F3',\n height: '2px',\n position: 'relative',\n width: '100%',\n }}\n >\n <div\n style={{\n backgroundColor: labelStyle.backgroundColor,\n height: '100%',\n left: 0,\n position: 'absolute',\n top: 0,\n width: `${barWidth * 100}%`,\n }}\n />\n </div>\n </div>\n )\n}\n"],"names":["useTranslation","React","Fragment","useEffect","useState","Pill","LengthIndicator","props","maxLength","minLength","text","labelStyle","setLabelStyle","backgroundColor","color","label","setLabel","barWidth","setBarWidth","t","textLength","length","progress","ratioUntilMin","charsUntilMax","charsUntilMin","div","style","alignItems","display","width","flexShrink","lineHeight","marginRight","whiteSpace","small","current","characters","height","position","left","top"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI5D,SAASC,IAAI,QAAQ,YAAW;AAEhC,OAAO,MAAMC,kBAIR,CAACC;IACJ,MAAM,EAAEC,YAAY,CAAC,EAAEC,YAAY,CAAC,EAAEC,IAAI,EAAE,GAAGH;IAE/C,MAAM,CAACI,YAAYC,cAAc,GAAGR,SAAS;QAC3CS,iBAAiB;QACjBC,OAAO;IACT;IAEA,MAAM,CAACC,OAAOC,SAAS,GAAGZ,SAAS;IACnC,MAAM,CAACa,UAAUC,YAAY,GAAGd,SAAiB;IACjD,MAAM,EAAEe,CAAC,EAAE,GAAGnB;IAEdG,UAAU;QACR,MAAMiB,aAAaV,MAAMW,UAAU;QAEnC,IAAID,eAAe,GAAG;YACpBJ,SAAS;YACTJ,cAAc;gBACZC,iBAAiB;gBACjBC,OA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KAAKD,iBAAiB,mBACtC,KAACtB;sCAAUiB,EAAE,iCAAiC;gCAAEkB,YAAYb;4BAAc;;wBAE3EA,gBAAgB,mBACf,KAACtB;sCACEiB,EAAE,gCAAgC;gCAAEkB,YAAYb,gBAAgB,CAAC;4BAAE;;;;;0BAK5E,KAACE;gBACCC,OAAO;oBACLd,iBAAiB;oBACjByB,QAAQ;oBACRC,UAAU;oBACVT,OAAO;gBACT;0BAEA,cAAA,KAACJ;oBACCC,OAAO;wBACLd,iBAAiBF,WAAWE,eAAe;wBAC3CyB,QAAQ;wBACRE,MAAM;wBACND,UAAU;wBACVE,KAAK;wBACLX,OAAO,CAAC,EAAEb,WAAW,IAAI,CAAC,CAAC;oBAC7B;;;;;AAKV,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Overview.d.ts","sourceRoot":"","sources":["../../src/ui/Overview.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAW/D,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAoD5B,CAAA"}
1
+ {"version":3,"file":"Overview.d.ts","sourceRoot":"","sources":["../../src/ui/Overview.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAW/D,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAoD5B,CAAA"}
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useAllFormFields, useForm } from '@payloadcms/ui/forms/Form';
4
- import { useTranslation } from '@payloadcms/ui/providers/Translation';
3
+ import { useAllFormFields, useForm, useTranslation } from '@payloadcms/ui';
5
4
  import React, { useCallback, useEffect, useState } from 'react';
6
5
  import { defaults } from '../defaults.js';
7
6
  const { description: { maxLength: maxDesc, minLength: minDesc }, title: { maxLength: maxTitle, minLength: minTitle } } = defaults;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/Overview.tsx"],"sourcesContent":["'use client'\n\nimport type { FormField } from 'payload/types'\n\nimport { useAllFormFields, useForm } from '@payloadcms/ui/forms/Form'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../translations/index.js'\n\nimport { defaults } from '../defaults.js'\n\nconst {\n description: { maxLength: maxDesc, minLength: minDesc },\n title: { maxLength: maxTitle, minLength: minTitle },\n} = defaults\n\nexport const Overview: React.FC = () => {\n const {\n // dispatchFields,\n getFields,\n } = useForm()\n\n const [\n {\n 'meta.description': { value: metaDesc } = {} as FormField,\n 'meta.image': { value: metaImage } = {} as FormField,\n 'meta.title': { value: metaTitle } = {} as FormField,\n },\n ] = useAllFormFields()\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const [titleIsValid, setTitleIsValid] = useState<boolean | undefined>()\n const [descIsValid, setDescIsValid] = useState<boolean | undefined>()\n const [imageIsValid, setImageIsValid] = useState<boolean | undefined>()\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const resetAll = useCallback(() => {\n const fields = getFields()\n const fieldsWithoutMeta = fields\n fieldsWithoutMeta['meta.title'].value = ''\n fieldsWithoutMeta['meta.description'].value = ''\n fieldsWithoutMeta['meta.image'].value = ''\n // dispatchFields(fieldsWithoutMeta);\n }, [getFields])\n\n useEffect(() => {\n if (typeof metaTitle === 'string')\n setTitleIsValid(metaTitle.length >= minTitle && metaTitle.length <= maxTitle)\n if (typeof metaDesc === 'string')\n setDescIsValid(metaDesc.length >= minDesc && metaDesc.length <= maxDesc)\n setImageIsValid(Boolean(metaImage))\n }, [metaTitle, metaDesc, metaImage])\n\n const testResults = [titleIsValid, descIsValid, imageIsValid]\n\n const numberOfPasses = testResults.filter(Boolean).length\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div>\n {t('plugin-seo:checksPassing', { current: numberOfPasses, max: testResults.length })}\n </div>\n </div>\n )\n}\n"],"names":["useAllFormFields","useForm","useTranslation","React","useCallback","useEffect","useState","defaults","description","maxLength","maxDesc","minLength","minDesc","title","maxTitle","minTitle","Overview","getFields","value","metaDesc","metaImage","metaTitle","t","titleIsValid","setTitleIsValid","descIsValid","setDescIsValid","imageIsValid","setImageIsValid","resetAll","fields","fieldsWithoutMeta","length","Boolean","testResults","numberOfPasses","filter","div","style","marginBottom","current","max"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,SAASA,gBAAgB,EAAEC,OAAO,QAAQ,4BAA2B;AACrE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI/D,SAASC,QAAQ,QAAQ,iBAAgB;AAEzC,MAAM,EACJC,aAAa,EAAEC,WAAWC,OAAO,EAAEC,WAAWC,OAAO,EAAE,EACvDC,OAAO,EAAEJ,WAAWK,QAAQ,EAAEH,WAAWI,QAAQ,EAAE,EACpD,GAAGR;AAEJ,OAAO,MAAMS,WAAqB;IAChC,MAAM,EACJ,mBAAmB;IACnBC,SAAS,EACV,GAAGhB;IAEJ,MAAM,CACJ,EACE,oBAAoB,EAAEiB,OAAOC,QAAQ,EAAE,GAAG,CAAC,CAAc,EACzD,cAAc,EAAED,OAAOE,SAAS,EAAE,GAAG,CAAC,CAAc,EACpD,cAAc,EAAEF,OAAOG,SAAS,EAAE,GAAG,CAAC,CAAc,EACrD,CACF,GAAGrB;IACJ,MAAM,EAAEsB,CAAC,EAAE,GAAGpB;IAEd,MAAM,CAACqB,cAAcC,gBAAgB,GAAGlB;IACxC,MAAM,CAACmB,aAAaC,eAAe,GAAGpB;IACtC,MAAM,CAACqB,cAAcC,gBAAgB,GAAGtB;IAExC,6DAA6D;IAC7D,MAAMuB,WAAWzB,YAAY;QAC3B,MAAM0B,SAASb;QACf,MAAMc,oBAAoBD;QAC1BC,iBAAiB,CAAC,aAAa,CAACb,KAAK,GAAG;QACxCa,iBAAiB,CAAC,mBAAmB,CAACb,KAAK,GAAG;QAC9Ca,iBAAiB,CAAC,aAAa,CAACb,KAAK,GAAG;IACxC,qCAAqC;IACvC,GAAG;QAACD;KAAU;IAEdZ,UAAU;QACR,IAAI,OAAOgB,cAAc,UACvBG,gBAAgBH,UAAUW,MAAM,IAAIjB,YAAYM,UAAUW,MAAM,IAAIlB;QACtE,IAAI,OAAOK,aAAa,UACtBO,eAAeP,SAASa,MAAM,IAAIpB,WAAWO,SAASa,MAAM,IAAItB;QAClEkB,gBAAgBK,QAAQb;IAC1B,GAAG;QAACC;QAAWF;QAAUC;KAAU;IAEnC,MAAMc,cAAc;QAACX;QAAcE;QAAaE;KAAa;IAE7D,MAAMQ,iBAAiBD,YAAYE,MAAM,CAACH,SAASD,MAAM;IAEzD,qBACE,KAACK;QACCC,OAAO;YACLC,cAAc;QAChB;kBAEA,cAAA,KAACF;sBACEf,EAAE,4BAA4B;gBAAEkB,SAASL;gBAAgBM,KAAKP,YAAYF,MAAM;YAAC;;;AAI1F,EAAC"}
1
+ {"version":3,"sources":["../../src/ui/Overview.tsx"],"sourcesContent":["'use client'\n\nimport type { FormField } from 'payload'\n\nimport { useAllFormFields, useForm, useTranslation } from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../translations/index.js'\n\nimport { defaults } from '../defaults.js'\n\nconst {\n description: { maxLength: maxDesc, minLength: minDesc },\n title: { maxLength: maxTitle, minLength: minTitle },\n} = defaults\n\nexport const Overview: React.FC = () => {\n const {\n // dispatchFields,\n getFields,\n } = useForm()\n\n const [\n {\n 'meta.description': { value: metaDesc } = {} as FormField,\n 'meta.image': { value: metaImage } = {} as FormField,\n 'meta.title': { value: metaTitle } = {} as FormField,\n },\n ] = useAllFormFields()\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const [titleIsValid, setTitleIsValid] = useState<boolean | undefined>()\n const [descIsValid, setDescIsValid] = useState<boolean | undefined>()\n const [imageIsValid, setImageIsValid] = useState<boolean | undefined>()\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const resetAll = useCallback(() => {\n const fields = getFields()\n const fieldsWithoutMeta = fields\n fieldsWithoutMeta['meta.title'].value = ''\n fieldsWithoutMeta['meta.description'].value = ''\n fieldsWithoutMeta['meta.image'].value = ''\n // dispatchFields(fieldsWithoutMeta);\n }, [getFields])\n\n useEffect(() => {\n if (typeof metaTitle === 'string')\n setTitleIsValid(metaTitle.length >= minTitle && metaTitle.length <= maxTitle)\n if (typeof metaDesc === 'string')\n setDescIsValid(metaDesc.length >= minDesc && metaDesc.length <= maxDesc)\n setImageIsValid(Boolean(metaImage))\n }, [metaTitle, metaDesc, metaImage])\n\n const testResults = [titleIsValid, descIsValid, imageIsValid]\n\n const numberOfPasses = testResults.filter(Boolean).length\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div>\n {t('plugin-seo:checksPassing', { current: numberOfPasses, max: testResults.length })}\n </div>\n </div>\n )\n}\n"],"names":["useAllFormFields","useForm","useTranslation","React","useCallback","useEffect","useState","defaults","description","maxLength","maxDesc","minLength","minDesc","title","maxTitle","minTitle","Overview","getFields","value","metaDesc","metaImage","metaTitle","t","titleIsValid","setTitleIsValid","descIsValid","setDescIsValid","imageIsValid","setImageIsValid","resetAll","fields","fieldsWithoutMeta","length","Boolean","testResults","numberOfPasses","filter","div","style","marginBottom","current","max"],"mappings":"AAAA;;AAIA,SAASA,gBAAgB,EAAEC,OAAO,EAAEC,cAAc,QAAQ,iBAAgB;AAC1E,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI/D,SAASC,QAAQ,QAAQ,iBAAgB;AAEzC,MAAM,EACJC,aAAa,EAAEC,WAAWC,OAAO,EAAEC,WAAWC,OAAO,EAAE,EACvDC,OAAO,EAAEJ,WAAWK,QAAQ,EAAEH,W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AAgBM,KAAKP,YAAYF,MAAM;YAAC;;;AAI1F,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/Pill.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\nexport const Pill: React.FC<{\n backgroundColor: string\n color: string\n label: string\n}> = (props) => {\n const { backgroundColor, color, label } = props\n\n return (\n <div\n style={{\n backgroundColor,\n borderRadius: '2px',\n color,\n flexShrink: 0,\n lineHeight: 1,\n marginRight: '10px',\n padding: '4px 6px',\n whiteSpace: 'nowrap',\n }}\n >\n <small>{label}</small>\n </div>\n )\n}\n"],"names":["React","Pill","props","backgroundColor","color","label","div","style","borderRadius","flexShrink","lineHeight","marginRight","padding","whiteSpace","small"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAEA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,OAIR,CAACC;IACJ,MAAM,EAAEC,eAAe,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGH;IAE1C,qBACE,KAACI;QACCC,OAAO;YACLJ;YACAK,cAAc;YACdJ;YACAK,YAAY;YACZC,YAAY;YACZC,aAAa;YACbC,SAAS;YACTC,YAAY;QACd;kBAEA,cAAA,KAACC;sBAAOT;;;AAGd,EAAC"}
1
+ {"version":3,"sources":["../../src/ui/Pill.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\nexport const Pill: React.FC<{\n backgroundColor: string\n color: string\n label: string\n}> = (props) => {\n const { backgroundColor, color, label } = props\n\n return (\n <div\n style={{\n backgroundColor,\n borderRadius: '2px',\n color,\n flexShrink: 0,\n lineHeight: 1,\n marginRight: '10px',\n padding: '4px 6px',\n whiteSpace: 'nowrap',\n }}\n >\n <small>{label}</small>\n </div>\n )\n}\n"],"names":["React","Pill","props","backgroundColor","color","label","div","style","borderRadius","flexShrink","lineHeight","marginRight","padding","whiteSpace","small"],"mappings":"AAAA;;AAEA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,OAIR,CAACC;IACJ,MAAM,EAAEC,eAAe,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGH;IAE1C,qBACE,KAACI;QACCC,OAAO;YACLJ;YACAK,cAAc;YACdJ;YACAK,YAAY;YACZC,YAAY;YACZC,aAAa;YACbC,SAAS;YACTC,YAAY;QACd;kBAEA,cAAA,KAACC;sBAAOT;;;AAGd,EAAC"}
@@ -1,4 +1,4 @@
1
- import type { UIField } from 'payload/types';
1
+ import type { UIField } from 'payload';
2
2
  import React from 'react';
3
3
  type PreviewProps = UIField & {
4
4
  hasGenerateURLFn: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/ui/Preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,eAAe,CAAA;AAMvD,OAAO,KAA8B,MAAM,OAAO,CAAA;AAKlD,KAAK,YAAY,GAAG,OAAO,GAAG;IAC5B,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA+F1C,CAAA"}
1
+ {"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/ui/Preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,SAAS,CAAA;AASjD,OAAO,KAA8B,MAAM,OAAO,CAAA;AAKlD,KAAK,YAAY,GAAG,OAAO,GAAG;IAC5B,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAgG1C,CAAA"}
@@ -1,14 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useAllFormFields } from '@payloadcms/ui/forms/Form';
4
- import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
5
- import { useLocale } from '@payloadcms/ui/providers/Locale';
6
- import { useTranslation } from '@payloadcms/ui/providers/Translation';
3
+ import { useAllFormFields, useDocumentInfo, useForm, useLocale, useTranslation } from '@payloadcms/ui';
7
4
  import React, { useEffect, useState } from 'react';
8
5
  export const Preview = ({ hasGenerateURLFn })=>{
9
6
  const { t } = useTranslation();
10
7
  const locale = useLocale();
11
8
  const [fields] = useAllFormFields();
9
+ const { getData } = useForm();
12
10
  const docInfo = useDocumentInfo();
13
11
  const { 'meta.description': { value: metaDescription } = {}, 'meta.title': { value: metaTitle } = {} } = fields;
14
12
  const [href, setHref] = useState();
@@ -18,7 +16,7 @@ export const Preview = ({ hasGenerateURLFn })=>{
18
16
  body: JSON.stringify({
19
17
  ...docInfo,
20
18
  doc: {
21
- ...fields
19
+ ...getData()
22
20
  },
23
21
  locale: typeof locale === 'object' ? locale?.code : locale
24
22
  }),
@@ -39,7 +37,8 @@ export const Preview = ({ hasGenerateURLFn })=>{
39
37
  href,
40
38
  locale,
41
39
  docInfo,
42
- hasGenerateURLFn
40
+ hasGenerateURLFn,
41
+ getData
43
42
  ]);
44
43
  return /*#__PURE__*/ _jsxs("div", {
45
44
  children: [
@@ -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 { 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":";;;;;;;;;;;;;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BACPC,cAAc;gBAChB;0BAEC1B,EAAE;;0BAEL,MAACuB;gBACCC,OAAO;oBACLG,YAAY;oBACZC,cAAc;oBACdC,WAAW;oBACXC,UAAU;oBACVC,SAAS;oBACTC,eAAe;oBACfC,OAAO;gBACT;;kCAEA,KAACV;kCACC,cAAA,KAACW;4BACC3B,MAAMA;4BACNiB,OAAO;gCACLW,gBAAgB;4BAClB;sCAEC5B,QAAQ;;;kCAGb,KAAC6B;wBACCZ,OAAO;4BACLa,QAAQ;wBACV;kCAEA,cAAA,KAACH;4BACC3B,MAAK;4BACLiB,OAAO;gCACLW,gBAAgB;4BAClB;sCAEC7B;;;kCAGL,KAACgC;wBACCd,OAAO;4BACLa,QAAQ;wBACV;kCAEChC;;;;;;AAKX,EAAC"}
1
+ {"version":3,"sources":["../../src/ui/Preview.tsx"],"sourcesContent":["'use client'\n\nimport type { FormField, UIField } from 'payload'\n\nimport {\n useAllFormFields,\n useDocumentInfo,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\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 { getData } = useForm()\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: { ...getData() },\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, getData])\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","useForm","useLocale","useTranslation","React","useEffect","useState","Preview","hasGenerateURLFn","t","locale","fields","getData","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"],"mappings":"AAAA;;AAIA,SACEA,gBAAgB,EAChBC,eAAe,EACfC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AASlD,OAAO,MAAMC,UAAkC,CAAC,EAAEC,gBAAgB,EAAE;IAClE,MAAM,EAAEC,CAAC,EAAE,GAAGN;IAEd,MAAMO,SAASR;IACf,MAAM,CAACS,OAAO,GAAGZ;IACjB,MAAM,EAAEa,OAAO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O;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.f1db24e",
3
+ "version": "3.0.0-canary.f83d96a",
4
4
  "description": "SEO plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -22,13 +22,13 @@
22
22
  "exports": {
23
23
  ".": {
24
24
  "import": "./dist/index.js",
25
- "require": "./dist/index.js",
26
- "types": "./dist/index.d.ts"
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
27
  },
28
- "./*": {
29
- "import": "./dist/exports/*.js",
30
- "require": "./dist/exports/*.js",
31
- "types": "./dist/exports/*.d.ts"
28
+ "./types": {
29
+ "import": "./dist/exports/types.js",
30
+ "types": "./dist/exports/types.d.ts",
31
+ "default": "./dist/exports/types.js"
32
32
  }
33
33
  },
34
34
  "main": "./dist/index.js",
@@ -40,17 +40,17 @@
40
40
  "@types/react": "npm:types-react@19.0.0-beta.2",
41
41
  "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
42
42
  "@payloadcms/eslint-config": "1.1.1",
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"
43
+ "@payloadcms/translations": "3.0.0-canary.f83d96a",
44
+ "@payloadcms/ui": "3.0.0-canary.f83d96a",
45
+ "@payloadcms/next": "3.0.0-canary.f83d96a",
46
+ "payload": "3.0.0-canary.f83d96a"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
50
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"
51
+ "@payloadcms/translations": "3.0.0-canary.f83d96a",
52
+ "@payloadcms/ui": "3.0.0-canary.f83d96a",
53
+ "payload": "3.0.0-canary.f83d96a"
54
54
  },
55
55
  "publishConfig": {
56
56
  "registry": "https://registry.npmjs.org/"
@@ -61,8 +61,8 @@
61
61
  "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2"
62
62
  },
63
63
  "scripts": {
64
- "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
65
- "build:swc": "swc ./src -d ./dist --config-file .swcrc",
64
+ "build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
65
+ "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
66
66
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
67
67
  "clean": "rimraf {dist,*.tsbuildinfo}",
68
68
  "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",