@payloadcms/plugin-seo 3.0.0-beta.10 → 3.0.0-beta.100

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 (97) hide show
  1. package/dist/defaults.js.map +1 -1
  2. package/dist/exports/client.d.ts +6 -0
  3. package/dist/exports/client.d.ts.map +1 -0
  4. package/dist/exports/client.js +7 -0
  5. package/dist/exports/client.js.map +1 -0
  6. package/dist/exports/fields.d.ts +6 -0
  7. package/dist/exports/fields.d.ts.map +1 -0
  8. package/dist/exports/fields.js +7 -0
  9. package/dist/exports/fields.js.map +1 -0
  10. package/dist/exports/types.d.ts +2 -0
  11. package/dist/exports/types.d.ts.map +1 -0
  12. package/dist/exports/types.js +3 -0
  13. package/dist/exports/types.js.map +1 -0
  14. package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts +8 -0
  15. package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts.map +1 -0
  16. package/dist/fields/MetaDescription/MetaDescriptionComponent.js +151 -0
  17. package/dist/fields/MetaDescription/MetaDescriptionComponent.js.map +1 -0
  18. package/dist/fields/MetaDescription/index.d.ts +12 -0
  19. package/dist/fields/MetaDescription/index.d.ts.map +1 -0
  20. package/dist/fields/MetaDescription/index.js +20 -0
  21. package/dist/fields/MetaDescription/index.js.map +1 -0
  22. package/dist/fields/MetaImage/MetaImageComponent.d.ts +8 -0
  23. package/dist/fields/MetaImage/MetaImageComponent.d.ts.map +1 -0
  24. package/dist/fields/MetaImage/MetaImageComponent.js +159 -0
  25. package/dist/fields/MetaImage/MetaImageComponent.js.map +1 -0
  26. package/dist/fields/MetaImage/index.d.ts +13 -0
  27. package/dist/fields/MetaImage/index.d.ts.map +1 -0
  28. package/dist/fields/MetaImage/index.js +23 -0
  29. package/dist/fields/MetaImage/index.js.map +1 -0
  30. package/dist/fields/MetaTitle/MetaTitleComponent.d.ts +9 -0
  31. package/dist/fields/MetaTitle/MetaTitleComponent.d.ts.map +1 -0
  32. package/dist/fields/MetaTitle/MetaTitleComponent.js +153 -0
  33. package/dist/fields/MetaTitle/MetaTitleComponent.js.map +1 -0
  34. package/dist/fields/MetaTitle/index.d.ts +12 -0
  35. package/dist/fields/MetaTitle/index.d.ts.map +1 -0
  36. package/dist/fields/MetaTitle/index.js +20 -0
  37. package/dist/fields/MetaTitle/index.js.map +1 -0
  38. package/dist/fields/Overview/OverviewComponent.d.ts +10 -0
  39. package/dist/fields/Overview/OverviewComponent.d.ts.map +1 -0
  40. package/dist/fields/Overview/OverviewComponent.js +60 -0
  41. package/dist/fields/Overview/OverviewComponent.js.map +1 -0
  42. package/dist/fields/Overview/index.d.ts +26 -0
  43. package/dist/fields/Overview/index.d.ts.map +1 -0
  44. package/dist/fields/Overview/index.js +22 -0
  45. package/dist/fields/Overview/index.js.map +1 -0
  46. package/dist/fields/Preview/PreviewComponent.d.ts +10 -0
  47. package/dist/fields/Preview/PreviewComponent.d.ts.map +1 -0
  48. package/dist/fields/Preview/PreviewComponent.js +106 -0
  49. package/dist/fields/Preview/PreviewComponent.js.map +1 -0
  50. package/dist/fields/Preview/index.d.ts +24 -0
  51. package/dist/fields/Preview/index.d.ts.map +1 -0
  52. package/dist/fields/Preview/index.js +22 -0
  53. package/dist/fields/Preview/index.js.map +1 -0
  54. package/dist/fields/index.scss +1 -1
  55. package/dist/index.d.ts +3 -4
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +58 -90
  58. package/dist/index.js.map +1 -1
  59. package/dist/translations/index.d.ts +69 -0
  60. package/dist/translations/index.d.ts.map +1 -1
  61. package/dist/translations/index.js +66 -0
  62. package/dist/translations/index.js.map +1 -1
  63. package/dist/translations/it.json +22 -0
  64. package/dist/translations/ru.json +22 -0
  65. package/dist/translations/uk.json +22 -0
  66. package/dist/types.d.ts +19 -14
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/types.js.map +1 -1
  69. package/dist/ui/LengthIndicator.d.ts.map +1 -1
  70. package/dist/ui/LengthIndicator.js +62 -41
  71. package/dist/ui/LengthIndicator.js.map +1 -1
  72. package/dist/ui/Pill.js +7 -3
  73. package/dist/ui/Pill.js.map +1 -1
  74. package/package.json +56 -37
  75. package/dist/fields/MetaDescription.d.ts +0 -9
  76. package/dist/fields/MetaDescription.d.ts.map +0 -1
  77. package/dist/fields/MetaDescription.js +0 -117
  78. package/dist/fields/MetaDescription.js.map +0 -1
  79. package/dist/fields/MetaImage.d.ts +0 -8
  80. package/dist/fields/MetaImage.d.ts.map +0 -1
  81. package/dist/fields/MetaImage.js +0 -121
  82. package/dist/fields/MetaImage.js.map +0 -1
  83. package/dist/fields/MetaTitle.d.ts +0 -9
  84. package/dist/fields/MetaTitle.d.ts.map +0 -1
  85. package/dist/fields/MetaTitle.js +0 -118
  86. package/dist/fields/MetaTitle.js.map +0 -1
  87. package/dist/ui/Overview.d.ts +0 -3
  88. package/dist/ui/Overview.d.ts.map +0 -1
  89. package/dist/ui/Overview.js +0 -51
  90. package/dist/ui/Overview.js.map +0 -1
  91. package/dist/ui/Preview.d.ts +0 -8
  92. package/dist/ui/Preview.d.ts.map +0 -1
  93. package/dist/ui/Preview.js +0 -79
  94. package/dist/ui/Preview.js.map +0 -1
  95. package/src/index.tsx +0 -296
  96. package/types.d.ts +0 -1
  97. package/types.js +0 -1
package/dist/types.d.ts CHANGED
@@ -1,22 +1,27 @@
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, PayloadRequest, TextareaField, TextField, UploadField } from 'payload';
3
+ export type PartialDocumentInfoContext = Pick<DocumentInfoContext, 'docPermissions' | 'hasPublishPermission' | 'hasSavePermission' | 'id' | 'initialData' | 'initialState' | 'preferencesKey' | 'publishedDoc' | 'slug' | 'title' | 'versionsCount'>;
4
+ export type GenerateTitle<T = any> = (args: {
4
5
  doc: T;
5
6
  locale?: string;
6
- }) => Promise<string> | string;
7
- export type GenerateDescription = <T = any>(args: DocumentInfoContext & {
7
+ req: PayloadRequest;
8
+ } & PartialDocumentInfoContext) => Promise<string> | string;
9
+ export type GenerateDescription<T = any> = (args: {
8
10
  doc: T;
9
11
  locale?: string;
10
- }) => Promise<string> | string;
11
- export type GenerateImage = <T = any>(args: DocumentInfoContext & {
12
+ req: PayloadRequest;
13
+ } & PartialDocumentInfoContext) => Promise<string> | string;
14
+ export type GenerateImage<T = any> = (args: {
12
15
  doc: T;
13
16
  locale?: string;
14
- }) => Promise<string> | string;
15
- export type GenerateURL = <T = any>(args: DocumentInfoContext & {
17
+ req: PayloadRequest;
18
+ } & PartialDocumentInfoContext) => Promise<string> | string;
19
+ export type GenerateURL<T = any> = (args: {
16
20
  doc: T;
17
21
  locale?: string;
18
- }) => Promise<string> | string;
19
- export interface PluginConfig {
22
+ req: PayloadRequest;
23
+ } & PartialDocumentInfoContext) => Promise<string> | string;
24
+ export type SEOPluginConfig = {
20
25
  collections?: string[];
21
26
  fieldOverrides?: {
22
27
  description?: Partial<TextareaField>;
@@ -32,11 +37,11 @@ export interface PluginConfig {
32
37
  interfaceName?: string;
33
38
  tabbedUI?: boolean;
34
39
  uploadsCollection?: string;
35
- }
36
- export interface Meta {
40
+ };
41
+ export type Meta = {
37
42
  description?: string;
38
43
  image?: any;
39
44
  keywords?: string;
40
45
  title?: string;
41
- }
46
+ };
42
47
  //# sourceMappingURL=types.d.ts.map
@@ -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,EA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AAE,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 interface PluginConfig {\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 interface 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, PayloadRequest, TextareaField, TextField, UploadField } from 'payload'\n\nexport type PartialDocumentInfoContext = Pick<\n DocumentInfoContext,\n | 'docPermissions'\n | 'hasPublishPermission'\n | 'hasSavePermission'\n | 'id'\n | 'initialData'\n | 'initialState'\n | 'preferencesKey'\n | 'publishedDoc'\n | 'slug'\n | 'title'\n | 'versionsCount'\n>\n\nexport type GenerateTitle<T = any> = (\n args: { doc: T; locale?: string; req: PayloadRequest } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateDescription<T = any> = (\n args: {\n doc: T\n locale?: string\n req: PayloadRequest\n } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateImage<T = any> = (\n args: { doc: T; locale?: string; req: PayloadRequest } & PartialDocumentInfoContext,\n) => Promise<string> | string\n\nexport type GenerateURL<T = any> = (\n args: { doc: T; locale?: string; req: PayloadRequest } & PartialDocumentInfoContext,\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":"AAwDA,WAKC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LengthIndicator.d.ts","sourceRoot":"","sources":["../../src/ui/LengthIndicator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAI5D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CA2HA,CAAA"}
1
+ {"version":3,"file":"LengthIndicator.d.ts","sourceRoot":"","sources":["../../src/ui/LengthIndicator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAM5D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CA2HA,CAAA"}
@@ -1,5 +1,6 @@
1
1
  'use client';
2
- import { useTranslation } from '@payloadcms/ui/providers/Translation';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useTranslation } from '@payloadcms/ui';
3
4
  import React, { Fragment, useEffect, useState } from 'react';
4
5
  import { Pill } from './Pill.js';
5
6
  export const LengthIndicator = (props)=>{
@@ -65,50 +66,70 @@ export const LengthIndicator = (props)=>{
65
66
  const textLength = text?.length || 0;
66
67
  const charsUntilMax = maxLength - textLength;
67
68
  const charsUntilMin = minLength - textLength;
68
- return /*#__PURE__*/ React.createElement("div", {
69
+ return /*#__PURE__*/ _jsxs("div", {
69
70
  style: {
70
71
  alignItems: 'center',
71
72
  display: 'flex',
72
73
  width: '100%'
73
- }
74
- }, /*#__PURE__*/ React.createElement(Pill, {
75
- backgroundColor: labelStyle.backgroundColor,
76
- color: labelStyle.color,
77
- label: label
78
- }), /*#__PURE__*/ React.createElement("div", {
79
- style: {
80
- flexShrink: 0,
81
- lineHeight: 1,
82
- marginRight: '10px',
83
- whiteSpace: 'nowrap'
84
- }
85
- }, /*#__PURE__*/ React.createElement("small", null, t('plugin-seo:characterCount', {
86
- current: text?.length || 0,
87
- maxLength,
88
- minLength
89
- }), (textLength === 0 || charsUntilMin > 0) && /*#__PURE__*/ React.createElement(Fragment, null, t('plugin-seo:charactersToGo', {
90
- characters: charsUntilMin
91
- })), charsUntilMin <= 0 && charsUntilMax >= 0 && /*#__PURE__*/ React.createElement(Fragment, null, t('plugin-seo:charactersLeftOver', {
92
- characters: charsUntilMax
93
- })), charsUntilMax < 0 && /*#__PURE__*/ React.createElement(Fragment, null, t('plugin-seo:charactersTooMany', {
94
- characters: charsUntilMax * -1
95
- })))), /*#__PURE__*/ React.createElement("div", {
96
- style: {
97
- backgroundColor: '#F3F3F3',
98
- height: '2px',
99
- position: 'relative',
100
- width: '100%'
101
- }
102
- }, /*#__PURE__*/ React.createElement("div", {
103
- style: {
104
- backgroundColor: labelStyle.backgroundColor,
105
- height: '100%',
106
- left: 0,
107
- position: 'absolute',
108
- top: 0,
109
- width: `${barWidth * 100}%`
110
- }
111
- })));
74
+ },
75
+ children: [
76
+ /*#__PURE__*/ _jsx(Pill, {
77
+ backgroundColor: labelStyle.backgroundColor,
78
+ color: labelStyle.color,
79
+ label: label
80
+ }),
81
+ /*#__PURE__*/ _jsx("div", {
82
+ style: {
83
+ flexShrink: 0,
84
+ lineHeight: 1,
85
+ marginRight: '10px',
86
+ whiteSpace: 'nowrap'
87
+ },
88
+ children: /*#__PURE__*/ _jsxs("small", {
89
+ children: [
90
+ t('plugin-seo:characterCount', {
91
+ current: text?.length || 0,
92
+ maxLength,
93
+ minLength
94
+ }),
95
+ (textLength === 0 || charsUntilMin > 0) && /*#__PURE__*/ _jsx(Fragment, {
96
+ children: t('plugin-seo:charactersToGo', {
97
+ characters: charsUntilMin
98
+ })
99
+ }),
100
+ charsUntilMin <= 0 && charsUntilMax >= 0 && /*#__PURE__*/ _jsx(Fragment, {
101
+ children: t('plugin-seo:charactersLeftOver', {
102
+ characters: charsUntilMax
103
+ })
104
+ }),
105
+ charsUntilMax < 0 && /*#__PURE__*/ _jsx(Fragment, {
106
+ children: t('plugin-seo:charactersTooMany', {
107
+ characters: charsUntilMax * -1
108
+ })
109
+ })
110
+ ]
111
+ })
112
+ }),
113
+ /*#__PURE__*/ _jsx("div", {
114
+ style: {
115
+ backgroundColor: '#F3F3F3',
116
+ height: '2px',
117
+ position: 'relative',
118
+ width: '100%'
119
+ },
120
+ children: /*#__PURE__*/ _jsx("div", {
121
+ style: {
122
+ backgroundColor: labelStyle.backgroundColor,
123
+ height: '100%',
124
+ left: 0,
125
+ position: 'absolute',
126
+ top: 0,
127
+ width: `${barWidth * 100}%`
128
+ }
129
+ })
130
+ })
131
+ ]
132
+ });
112
133
  };
113
134
 
114
135
  //# sourceMappingURL=LengthIndicator.js.map
@@ -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 { 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()\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,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE5D,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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ACEhB,EAAE,6BAA6B;QAAEiB,SAAS1B,MAAMW,UAAU;QAAGb;QAAWC;IAAU,IAClF,AAACW,CAAAA,eAAe,KAAKK,gBAAgB,CAAA,mBACpC,oBAACvB,gBAAUiB,EAAE,6BAA6B;QAAEkB,YAAYZ;IAAc,KAEvEA,iBAAiB,KAAKD,iBAAiB,mBACtC,oBAACtB,gBAAUiB,EAAE,iCAAiC;QAAEkB,YAAYb;IAAc,KAE3EA,gBAAgB,mBACf,oBAACtB,gBACEiB,EAAE,gCAAgC;QAAEkB,YAAYb,gBAAgB,CAAC;IAAE,qBAK5E,oBAACE;QACCC,OAAO;YACLd,iBAAiB;YACjByB,QAAQ;YACRC,UAAU;YACVT,OAAO;QACT;qBAEA,oBAACJ;QACCC,OAAO;YACLd,iBAAiBF,WAAWE,eAAe;YAC3CyB,QAAQ;YACRE,MAAM;YACND,UAAU;YACVE,KAAK;YACLX,OAAO,CAAC,EAAEb,WAAW,IAAI,CAAC,CAAC;QAC7B;;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,OAAO;YACT;YACAI,YAAY;QACd,OAAO;YACL,MAAMI,WAAW,AAACF,CAAAA,aAAaX,SAAQ,IAAMD,CAAAA,YAAYC,SAAQ;YAEjE,IAAIa,WAAW,GAAG;gBAChB,MAAMC,gBAAgBH,aAAaX;gBAEnC,IAAIc,gBAAgB,KAAK;oBACvBP,SAASG,EAAE;oBACXP,cAAc;wBACZC,iBAAiB;wBACjBC,OAAO;oBACT;gBACF,OAAO;oBACLE,SAASG,EAAE;oBACXP,cAAc;wBACZC,iBAAiB;wBACjBC,OAAO;oBACT;gBACF;gBAEAI,YAAYK;YACd;YAEA,IAAID,YAAY,KAAKA,YA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AO,CAAC,EAAEb,WAAW,IAAI,CAAC,CAAC;oBAC7B;;;;;AAKV,EAAC"}
package/dist/ui/Pill.js CHANGED
@@ -1,8 +1,9 @@
1
1
  'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import React from 'react';
3
4
  export const Pill = (props)=>{
4
5
  const { backgroundColor, color, label } = props;
5
- return /*#__PURE__*/ React.createElement("div", {
6
+ return /*#__PURE__*/ _jsx("div", {
6
7
  style: {
7
8
  backgroundColor,
8
9
  borderRadius: '2px',
@@ -12,8 +13,11 @@ export const Pill = (props)=>{
12
13
  marginRight: '10px',
13
14
  padding: '4px 6px',
14
15
  whiteSpace: 'nowrap'
15
- }
16
- }, /*#__PURE__*/ React.createElement("small", null, label));
16
+ },
17
+ children: /*#__PURE__*/ _jsx("small", {
18
+ children: label
19
+ })
20
+ });
17
21
  };
18
22
 
19
23
  //# sourceMappingURL=Pill.js.map
@@ -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,oBAACI;QACCC,OAAO;YACLJ;YACAK,cAAc;YACdJ;YACAK,YAAY;YACZC,YAAY;YACZC,aAAa;YACbC,SAAS;YACTC,YAAY;QACd;qBAEA,oBAACC,eAAOT;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"}
package/package.json CHANGED
@@ -1,16 +1,7 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-seo",
3
- "version": "3.0.0-beta.10",
4
- "homepage:": "https://payloadcms.com",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/payloadcms/payload.git",
8
- "directory": "packages/plugin-seo"
9
- },
3
+ "version": "3.0.0-beta.100",
10
4
  "description": "SEO plugin for Payload",
11
- "main": "./dist/index.js",
12
- "types": "./dist/index.d.ts",
13
- "type": "module",
14
5
  "keywords": [
15
6
  "payload",
16
7
  "cms",
@@ -20,44 +11,72 @@
20
11
  "seo",
21
12
  "yoast"
22
13
  ],
23
- "author": "dev@payloadcms.com",
24
- "license": "MIT",
25
- "peerDependencies": {
26
- "react": "^18.0.0",
27
- "@payloadcms/translations": "3.0.0-beta.10",
28
- "@payloadcms/ui": "3.0.0-beta.10",
29
- "payload": "3.0.0-beta.10"
30
- },
31
- "devDependencies": {
32
- "@types/react": "18.2.74",
33
- "react": "^18.0.0",
34
- "@payloadcms/eslint-config": "1.1.1",
35
- "payload": "3.0.0-beta.10",
36
- "@payloadcms/ui": "3.0.0-beta.10",
37
- "@payloadcms/translations": "3.0.0-beta.10"
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/payloadcms/payload.git",
17
+ "directory": "packages/plugin-seo"
38
18
  },
19
+ "license": "MIT",
20
+ "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
21
+ "type": "module",
39
22
  "exports": {
40
23
  ".": {
41
24
  "import": "./dist/index.js",
42
- "require": "./dist/index.js",
43
- "types": "./dist/index.d.ts"
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ },
28
+ "./types": {
29
+ "import": "./dist/exports/types.js",
30
+ "types": "./dist/exports/types.d.ts",
31
+ "default": "./dist/exports/types.js"
32
+ },
33
+ "./fields": {
34
+ "import": "./dist/exports/fields.js",
35
+ "types": "./dist/exports/fields.d.ts",
36
+ "default": "./dist/exports/fields.js"
37
+ },
38
+ "./client": {
39
+ "import": "./dist/exports/client.js",
40
+ "types": "./dist/exports/client.d.ts",
41
+ "default": "./dist/exports/client.js"
44
42
  }
45
43
  },
44
+ "main": "./dist/index.js",
45
+ "types": "./dist/index.d.ts",
46
+ "files": [
47
+ "dist"
48
+ ],
49
+ "dependencies": {
50
+ "@payloadcms/translations": "3.0.0-beta.100",
51
+ "@payloadcms/ui": "3.0.0-beta.100"
52
+ },
53
+ "devDependencies": {
54
+ "@types/react": "npm:types-react@19.0.0-rc.0",
55
+ "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
56
+ "@payloadcms/eslint-config": "3.0.0-beta.97",
57
+ "@payloadcms/next": "3.0.0-beta.100",
58
+ "payload": "3.0.0-beta.100"
59
+ },
60
+ "peerDependencies": {
61
+ "react": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
62
+ "react-dom": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
63
+ "payload": "3.0.0-beta.100"
64
+ },
46
65
  "publishConfig": {
47
66
  "registry": "https://registry.npmjs.org/"
48
67
  },
49
- "files": [
50
- "dist",
51
- "types.js",
52
- "types.d.ts"
53
- ],
68
+ "homepage:": "https://payloadcms.com",
69
+ "overrides": {
70
+ "@types/react": "npm:types-react@19.0.0-rc.0",
71
+ "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0"
72
+ },
54
73
  "scripts": {
55
- "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
56
- "build:swc": "swc ./src -d ./dist --config-file .swcrc",
74
+ "build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
75
+ "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
57
76
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
77
+ "clean": "rimraf {dist,*.tsbuildinfo}",
58
78
  "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
59
- "lint": "eslint src",
60
- "lint:fix": "eslint --fix --ext .ts,.tsx src",
61
- "clean": "rimraf {dist,*.tsbuildinfo}"
79
+ "lint": "eslint .",
80
+ "lint:fix": "eslint . --fix"
62
81
  }
63
82
  }
@@ -1,9 +0,0 @@
1
- import type { FormFieldBase } from '@payloadcms/ui/fields/shared';
2
- import React from 'react';
3
- type MetaDescriptionProps = FormFieldBase & {
4
- hasGenerateDescriptionFn: boolean;
5
- path: string;
6
- };
7
- export declare const MetaDescription: React.FC<MetaDescriptionProps>;
8
- export {};
9
- //# sourceMappingURL=MetaDescription.d.ts.map
@@ -1 +0,0 @@
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;AAU1C,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,CA+H1D,CAAA"}
@@ -1,117 +0,0 @@
1
- 'use client';
2
- import { TextareaInput } from '@payloadcms/ui/fields/Textarea';
3
- import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
4
- import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
5
- import { useAllFormFields } from '@payloadcms/ui/forms/Form';
6
- import { useField } from '@payloadcms/ui/forms/useField';
7
- import { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo';
8
- import { useLocale } from '@payloadcms/ui/providers/Locale';
9
- import { useTranslation } from '@payloadcms/ui/providers/Translation';
10
- import React, { useCallback } from 'react';
11
- import { defaults } from '../defaults.js';
12
- import { LengthIndicator } from '../ui/LengthIndicator.js';
13
- const { maxLength, minLength } = defaults.description;
14
- export const MetaDescription = (props)=>{
15
- const { CustomLabel, hasGenerateDescriptionFn, labelProps, path, required } = props;
16
- const { path: pathFromContext } = useFieldProps();
17
- const { t } = useTranslation();
18
- const locale = useLocale();
19
- const [fields] = useAllFormFields();
20
- const docInfo = useDocumentInfo();
21
- const field = useField({
22
- path
23
- });
24
- const { errorMessage, setValue, showError, value } = field;
25
- const regenerateDescription = useCallback(async ()=>{
26
- if (!hasGenerateDescriptionFn) return;
27
- const genDescriptionResponse = await fetch('/api/plugin-seo/generate-description', {
28
- body: JSON.stringify({
29
- ...docInfo,
30
- doc: {
31
- ...fields
32
- },
33
- locale: typeof locale === 'object' ? locale?.code : locale
34
- }),
35
- credentials: 'include',
36
- headers: {
37
- 'Content-Type': 'application/json'
38
- },
39
- method: 'POST'
40
- });
41
- const { result: generatedDescription } = await genDescriptionResponse.json();
42
- setValue(generatedDescription || '');
43
- }, [
44
- fields,
45
- setValue,
46
- hasGenerateDescriptionFn,
47
- locale,
48
- docInfo
49
- ]);
50
- return /*#__PURE__*/ React.createElement("div", {
51
- style: {
52
- marginBottom: '20px'
53
- }
54
- }, /*#__PURE__*/ React.createElement("div", {
55
- style: {
56
- marginBottom: '5px',
57
- position: 'relative'
58
- }
59
- }, /*#__PURE__*/ React.createElement("div", {
60
- className: "plugin-seo__field"
61
- }, CustomLabel !== undefined ? CustomLabel : /*#__PURE__*/ React.createElement(FieldLabel, labelProps || {}), required && /*#__PURE__*/ React.createElement("span", {
62
- style: {
63
- color: 'var(--theme-error-500)',
64
- marginLeft: '5px'
65
- }
66
- }, "*"), hasGenerateDescriptionFn && /*#__PURE__*/ React.createElement(React.Fragment, null, "  —  ", /*#__PURE__*/ React.createElement("button", {
67
- onClick: regenerateDescription,
68
- style: {
69
- background: 'none',
70
- backgroundColor: 'transparent',
71
- border: 'none',
72
- color: 'currentcolor',
73
- cursor: 'pointer',
74
- padding: 0,
75
- textDecoration: 'underline'
76
- },
77
- type: "button"
78
- }, t('plugin-seo:autoGenerate')))), /*#__PURE__*/ React.createElement("div", {
79
- style: {
80
- color: '#9A9A9A'
81
- }
82
- }, t('plugin-seo:lengthTipDescription', {
83
- maxLength,
84
- minLength
85
- }), /*#__PURE__*/ React.createElement("a", {
86
- href: "https://developers.google.com/search/docs/advanced/appearance/snippet#meta-descriptions",
87
- rel: "noopener noreferrer",
88
- target: "_blank"
89
- }, t('plugin-seo:bestPractices')))), /*#__PURE__*/ React.createElement("div", {
90
- style: {
91
- marginBottom: '10px',
92
- position: 'relative'
93
- }
94
- }, /*#__PURE__*/ React.createElement(TextareaInput, {
95
- CustomError: errorMessage,
96
- onChange: setValue,
97
- path: pathFromContext,
98
- required: required,
99
- showError: showError,
100
- style: {
101
- marginBottom: 0
102
- },
103
- value: value
104
- })), /*#__PURE__*/ React.createElement("div", {
105
- style: {
106
- alignItems: 'center',
107
- display: 'flex',
108
- width: '100%'
109
- }
110
- }, /*#__PURE__*/ React.createElement(LengthIndicator, {
111
- maxLength: maxLength,
112
- minLength: minLength,
113
- text: value
114
- })));
115
- };
116
-
117
- //# sourceMappingURL=MetaDescription.js.map
@@ -1 +0,0 @@
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 { 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, labelProps, path, required } = props\n const { path: pathFromContext } = useFieldProps()\n\n const { t } = useTranslation()\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 {CustomLabel !== undefined ? CustomLabel : <FieldLabel {...(labelProps || {})} />}\n {required && (\n <span\n style={{\n color: 'var(--theme-error-500)',\n marginLeft: '5px',\n }}\n >\n *\n </span>\n )}\n\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","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","undefined","span","color","marginLeft","Fragment","button","onClick","background","backgroundColor","border","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,QAAQ,QAAO;AAI1C,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,UAAU,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGL;IAC9E,MAAM,EAAEI,MAAME,eAAe,EAAE,GAAGpB;IAElC,MAAM,EAAEqB,CAAC,EAAE,GAAGhB;IAEd,MAAMiB,SAASlB;IACf,MAAM,CAACmB,OAAO,GAAGtB;IACjB,MAAMuB,UAAUrB;IAEhB,MAAMsB,QAA2BvB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LC,cAAc;YACdC,UAAU;QACZ;qBAEA,oBAACjD;QACCqE,aAAazC;QACb0C,UAAUzC;QACVT,MAAME;QACND,UAAUA;QACVS,WAAWA;QACXiB,OAAO;YACLC,cAAc;QAChB;QACAjB,OAAOA;uBAGX,oBAACe;QACCC,OAAO;YACLwB,YAAY;YACZC,SAAS;YACTC,OAAO;QACT;qBAEA,oBAAC9D;QAAgBC,WAAWA;QAAWC,WAAWA;QAAW6D,MAAM3C;;AAI3E,EAAC"}
@@ -1,8 +0,0 @@
1
- import type { UploadInputProps } from '@payloadcms/ui/fields/Upload';
2
- import React from 'react';
3
- type MetaImageProps = UploadInputProps & {
4
- hasGenerateImageFn: boolean;
5
- };
6
- export declare const MetaImage: React.FC<MetaImageProps>;
7
- export {};
8
- //# sourceMappingURL=MetaImage.d.ts.map
@@ -1 +0,0 @@
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;AAO1C,KAAK,cAAc,GAAG,gBAAgB,GAAG;IACvC,kBAAkB,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA8I9C,CAAA"}