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

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 (88) 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.js.map +1 -1
  11. package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts +8 -0
  12. package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts.map +1 -0
  13. package/dist/fields/MetaDescription/MetaDescriptionComponent.js +151 -0
  14. package/dist/fields/MetaDescription/MetaDescriptionComponent.js.map +1 -0
  15. package/dist/fields/MetaDescription/index.d.ts +12 -0
  16. package/dist/fields/MetaDescription/index.d.ts.map +1 -0
  17. package/dist/fields/MetaDescription/index.js +20 -0
  18. package/dist/fields/MetaDescription/index.js.map +1 -0
  19. package/dist/fields/MetaImage/MetaImageComponent.d.ts +8 -0
  20. package/dist/fields/MetaImage/MetaImageComponent.d.ts.map +1 -0
  21. package/dist/fields/MetaImage/MetaImageComponent.js +154 -0
  22. package/dist/fields/MetaImage/MetaImageComponent.js.map +1 -0
  23. package/dist/fields/MetaImage/index.d.ts +13 -0
  24. package/dist/fields/MetaImage/index.d.ts.map +1 -0
  25. package/dist/fields/MetaImage/index.js +23 -0
  26. package/dist/fields/MetaImage/index.js.map +1 -0
  27. package/dist/fields/MetaTitle/MetaTitleComponent.d.ts +9 -0
  28. package/dist/fields/MetaTitle/MetaTitleComponent.d.ts.map +1 -0
  29. package/dist/fields/MetaTitle/MetaTitleComponent.js +153 -0
  30. package/dist/fields/MetaTitle/MetaTitleComponent.js.map +1 -0
  31. package/dist/fields/MetaTitle/index.d.ts +12 -0
  32. package/dist/fields/MetaTitle/index.d.ts.map +1 -0
  33. package/dist/fields/MetaTitle/index.js +20 -0
  34. package/dist/fields/MetaTitle/index.js.map +1 -0
  35. package/dist/fields/Overview/OverviewComponent.d.ts +10 -0
  36. package/dist/fields/Overview/OverviewComponent.d.ts.map +1 -0
  37. package/dist/{ui/Overview.js → fields/Overview/OverviewComponent.js} +18 -12
  38. package/dist/fields/Overview/OverviewComponent.js.map +1 -0
  39. package/dist/fields/Overview/index.d.ts +26 -0
  40. package/dist/fields/Overview/index.d.ts.map +1 -0
  41. package/dist/fields/Overview/index.js +22 -0
  42. package/dist/fields/Overview/index.js.map +1 -0
  43. package/dist/fields/Preview/PreviewComponent.d.ts +10 -0
  44. package/dist/fields/Preview/PreviewComponent.d.ts.map +1 -0
  45. package/dist/fields/Preview/PreviewComponent.js +108 -0
  46. package/dist/fields/Preview/PreviewComponent.js.map +1 -0
  47. package/dist/fields/Preview/index.d.ts +24 -0
  48. package/dist/fields/Preview/index.d.ts.map +1 -0
  49. package/dist/fields/Preview/index.js +22 -0
  50. package/dist/fields/Preview/index.js.map +1 -0
  51. package/dist/fields/index.scss +1 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +44 -99
  55. package/dist/index.js.map +1 -1
  56. package/dist/translations/index.d.ts +25 -0
  57. package/dist/translations/index.d.ts.map +1 -1
  58. package/dist/translations/index.js +22 -0
  59. package/dist/translations/index.js.map +1 -1
  60. package/dist/translations/ru.json +22 -0
  61. package/dist/types.d.ts +15 -10
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js.map +1 -1
  64. package/dist/ui/LengthIndicator.d.ts.map +1 -1
  65. package/dist/ui/LengthIndicator.js +62 -41
  66. package/dist/ui/LengthIndicator.js.map +1 -1
  67. package/dist/ui/Pill.js +7 -3
  68. package/dist/ui/Pill.js.map +1 -1
  69. package/package.json +35 -19
  70. package/dist/fields/MetaDescription.d.ts +0 -9
  71. package/dist/fields/MetaDescription.d.ts.map +0 -1
  72. package/dist/fields/MetaDescription.js +0 -116
  73. package/dist/fields/MetaDescription.js.map +0 -1
  74. package/dist/fields/MetaImage.d.ts +0 -8
  75. package/dist/fields/MetaImage.d.ts.map +0 -1
  76. package/dist/fields/MetaImage.js +0 -120
  77. package/dist/fields/MetaImage.js.map +0 -1
  78. package/dist/fields/MetaTitle.d.ts +0 -9
  79. package/dist/fields/MetaTitle.d.ts.map +0 -1
  80. package/dist/fields/MetaTitle.js +0 -117
  81. package/dist/fields/MetaTitle.js.map +0 -1
  82. package/dist/ui/Overview.d.ts +0 -3
  83. package/dist/ui/Overview.d.ts.map +0 -1
  84. package/dist/ui/Overview.js.map +0 -1
  85. package/dist/ui/Preview.d.ts +0 -8
  86. package/dist/ui/Preview.d.ts.map +0 -1
  87. package/dist/ui/Preview.js +0 -79
  88. package/dist/ui/Preview.js.map +0 -1
@@ -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,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,YAAY,GAAG;g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}
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,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;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"}
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-seo",
3
- "version": "3.0.0-canary.6041f49",
3
+ "version": "3.0.0-canary.690108d",
4
4
  "description": "SEO plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -22,13 +22,23 @@
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
+ },
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"
32
42
  }
33
43
  },
34
44
  "main": "./dist/index.js",
@@ -37,26 +47,32 @@
37
47
  "dist"
38
48
  ],
39
49
  "devDependencies": {
40
- "@types/react": "18.2.74",
41
- "@payloadcms/next": "3.0.0-canary.6041f49",
42
- "@payloadcms/eslint-config": "1.1.1",
43
- "@payloadcms/translations": "3.0.0-canary.6041f49",
44
- "@payloadcms/ui": "3.0.0-canary.6041f49",
45
- "payload": "3.0.0-canary.6041f49"
50
+ "@types/react": "npm:types-react@19.0.0-rc.0",
51
+ "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
52
+ "@payloadcms/eslint-config": "3.0.0-beta.59",
53
+ "@payloadcms/translations": "3.0.0-canary.690108d",
54
+ "payload": "3.0.0-canary.690108d",
55
+ "@payloadcms/next": "3.0.0-canary.690108d",
56
+ "@payloadcms/ui": "3.0.0-canary.690108d"
46
57
  },
47
58
  "peerDependencies": {
48
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
49
- "@payloadcms/translations": "3.0.0-canary.6041f49",
50
- "@payloadcms/ui": "3.0.0-canary.6041f49",
51
- "payload": "3.0.0-canary.6041f49"
59
+ "react": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
60
+ "react-dom": "^19.0.0 || ^19.0.0-rc-06d0b89e-20240801",
61
+ "@payloadcms/ui": "3.0.0-canary.690108d",
62
+ "@payloadcms/translations": "3.0.0-canary.690108d",
63
+ "payload": "3.0.0-canary.690108d"
52
64
  },
53
65
  "publishConfig": {
54
66
  "registry": "https://registry.npmjs.org/"
55
67
  },
56
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
+ },
57
73
  "scripts": {
58
- "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
59
- "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",
60
76
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
61
77
  "clean": "rimraf {dist,*.tsbuildinfo}",
62
78
  "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
@@ -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,CAoH1D,CAAA"}
@@ -1,116 +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, label, 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
- }, /*#__PURE__*/ React.createElement(FieldLabel, {
62
- CustomLabel: CustomLabel,
63
- label: label,
64
- ...labelProps || {}
65
- }), hasGenerateDescriptionFn && /*#__PURE__*/ React.createElement(React.Fragment, null, "  —  ", /*#__PURE__*/ React.createElement("button", {
66
- onClick: regenerateDescription,
67
- style: {
68
- background: 'none',
69
- backgroundColor: 'transparent',
70
- border: 'none',
71
- color: 'currentcolor',
72
- cursor: 'pointer',
73
- padding: 0,
74
- textDecoration: 'underline'
75
- },
76
- type: "button"
77
- }, t('plugin-seo:autoGenerate')))), /*#__PURE__*/ React.createElement("div", {
78
- style: {
79
- color: '#9A9A9A'
80
- }
81
- }, t('plugin-seo:lengthTipDescription', {
82
- maxLength,
83
- minLength
84
- }), /*#__PURE__*/ React.createElement("a", {
85
- href: "https://developers.google.com/search/docs/advanced/appearance/snippet#meta-descriptions",
86
- rel: "noopener noreferrer",
87
- target: "_blank"
88
- }, t('plugin-seo:bestPractices')))), /*#__PURE__*/ React.createElement("div", {
89
- style: {
90
- marginBottom: '10px',
91
- position: 'relative'
92
- }
93
- }, /*#__PURE__*/ React.createElement(TextareaInput, {
94
- CustomError: errorMessage,
95
- onChange: setValue,
96
- path: pathFromContext,
97
- required: required,
98
- showError: showError,
99
- style: {
100
- marginBottom: 0
101
- },
102
- value: value
103
- })), /*#__PURE__*/ React.createElement("div", {
104
- style: {
105
- alignItems: 'center',
106
- display: 'flex',
107
- width: '100%'
108
- }
109
- }, /*#__PURE__*/ React.createElement(LengthIndicator, {
110
- maxLength: maxLength,
111
- minLength: minLength,
112
- text: value
113
- })));
114
- };
115
-
116
- //# 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, label, 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 <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,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,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGN;IACrF,MAAM,EAAEK,MAAME,eAAe,EAAE,GAAGrB;IAElC,MAAM,EAAEsB,CAAC,EAAE,GAAGjB;IAEd,MAAMkB,SAASnB;IACf,MAAM,CAACoB,OAAO,GAAGvB;IACjB,MAAMwB,UAAUtB;IAEhB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AClD;QACCmE,aAAatC;QACbuC,UAAUtC;QACVT,MAAME;QACND,UAAUA;QACVS,WAAWA;QACXiB,OAAO;YACLC,cAAc;QAChB;QACAjB,OAAOA;uBAGX,oBAACe;QACCC,OAAO;YACLqB,YAAY;YACZC,SAAS;YACTC,OAAO;QACT;qBAEA,oBAAC5D;QAAgBC,WAAWA;QAAWC,WAAWA;QAAW2D,MAAMxC;;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,CAoI9C,CAAA"}
@@ -1,120 +0,0 @@
1
- 'use client';
2
- import { UploadInput } from '@payloadcms/ui/fields/Upload';
3
- import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
4
- import { useAllFormFields } from '@payloadcms/ui/forms/Form';
5
- import { useField } from '@payloadcms/ui/forms/useField';
6
- import { useConfig } from '@payloadcms/ui/providers/Config';
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 { Pill } from '../ui/Pill.js';
12
- export const MetaImage = (props)=>{
13
- const { CustomLabel, hasGenerateImageFn, label, labelProps, relationTo, required } = props || {};
14
- const field = useField(props);
15
- const { t } = useTranslation();
16
- const locale = useLocale();
17
- const [fields] = useAllFormFields();
18
- const docInfo = useDocumentInfo();
19
- const { errorMessage, setValue, showError, value } = field;
20
- const regenerateImage = useCallback(async ()=>{
21
- if (!hasGenerateImageFn) return;
22
- const genImageResponse = await fetch('/api/plugin-seo/generate-image', {
23
- body: JSON.stringify({
24
- ...docInfo,
25
- doc: {
26
- ...fields
27
- },
28
- locale: typeof locale === 'object' ? locale?.code : locale
29
- }),
30
- credentials: 'include',
31
- headers: {
32
- 'Content-Type': 'application/json'
33
- },
34
- method: 'POST'
35
- });
36
- const { result: generatedImage } = await genImageResponse.json();
37
- setValue(generatedImage || '');
38
- }, [
39
- fields,
40
- setValue,
41
- hasGenerateImageFn,
42
- locale,
43
- docInfo
44
- ]);
45
- const hasImage = Boolean(value);
46
- const config = useConfig();
47
- const { collections, routes: { api } = {}, serverURL } = config;
48
- const collection = collections?.find((coll)=>coll.slug === relationTo) || undefined;
49
- return /*#__PURE__*/ React.createElement("div", {
50
- style: {
51
- marginBottom: '20px'
52
- }
53
- }, /*#__PURE__*/ React.createElement("div", {
54
- style: {
55
- marginBottom: '5px',
56
- position: 'relative'
57
- }
58
- }, /*#__PURE__*/ React.createElement("div", {
59
- className: "plugin-seo__field"
60
- }, /*#__PURE__*/ React.createElement(FieldLabel, {
61
- CustomLabel: CustomLabel,
62
- label: label,
63
- ...labelProps || {}
64
- }), hasGenerateImageFn && /*#__PURE__*/ React.createElement(React.Fragment, null, "  —  ", /*#__PURE__*/ React.createElement("button", {
65
- onClick: regenerateImage,
66
- style: {
67
- background: 'none',
68
- backgroundColor: 'transparent',
69
- border: 'none',
70
- color: 'currentcolor',
71
- cursor: 'pointer',
72
- padding: 0,
73
- textDecoration: 'underline'
74
- },
75
- type: "button"
76
- }, t('plugin-seo:autoGenerate')))), hasGenerateImageFn && /*#__PURE__*/ React.createElement("div", {
77
- style: {
78
- color: '#9A9A9A'
79
- }
80
- }, t('plugin-seo:imageAutoGenerationTip'))), /*#__PURE__*/ React.createElement("div", {
81
- style: {
82
- marginBottom: '10px',
83
- position: 'relative'
84
- }
85
- }, /*#__PURE__*/ React.createElement(UploadInput, {
86
- CustomError: errorMessage,
87
- api: api,
88
- collection: collection,
89
- filterOptions: {},
90
- label: undefined,
91
- onChange: (incomingImage)=>{
92
- if (incomingImage !== null) {
93
- const { id: incomingID } = incomingImage;
94
- setValue(incomingID);
95
- } else {
96
- setValue(null);
97
- }
98
- },
99
- relationTo: relationTo,
100
- required: required,
101
- serverURL: serverURL,
102
- showError: showError,
103
- style: {
104
- marginBottom: 0
105
- },
106
- value: value
107
- })), /*#__PURE__*/ React.createElement("div", {
108
- style: {
109
- alignItems: 'center',
110
- display: 'flex',
111
- width: '100%'
112
- }
113
- }, /*#__PURE__*/ React.createElement(Pill, {
114
- backgroundColor: hasImage ? 'green' : 'red',
115
- color: "white",
116
- label: hasImage ? t('plugin-seo:good') : t('plugin-seo:noImage')
117
- })));
118
- };
119
-
120
- //# sourceMappingURL=MetaImage.js.map
@@ -1 +0,0 @@
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 { 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()\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={{}}\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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O;YACLC,cAAc;QAChB;qBAEA,oBAACF;QACCC,OAAO;YACLC,cAAc;YACdC,UAAU;QACZ;qBAEA,oBAACH;QAAII,WAAU;qBACb,oBAACzD;QAAWY,aAAaA;QAAaE,OAAOA;QAAQ,GAAIC,cAAc,CAAC,CAAC;QACxEF,oCACC,oBAACN,MAAMmD,QAAQ,QAAC,uBAEd,oBAACC;QACCC,SAASjC;QACT2B,OAAO;YACLO,YAAY;YACZC,iBAAiB;YACjBC,QAAQ;YACRC,OAAO;YACPC,QAAQ;YACRC,SAAS;YACTC,gBAAgB;QAClB;QACAC,MAAK;OAEJjD,EAAE,+BAKVN,oCACC,oBAACwC;QACCC,OAAO;YACLU,OAAO;QACT;OAEC7C,EAAE,sDAIT,oBAACkC;QACCC,OAAO;YACLC,cAAc;YACdC,UAAU;QACZ;qBAEA,oBAACzD;QACCsE,aAAa9C;QACbuB,KAAKA;QACLE,YAAYA;QACZsB,eAAe,CAAC;QAChBxD,OAAOsC;QACPmB,UAAU,CAACC;YACT,IAAIA,kBAAkB,MAAM;gBAC1B,MAAM,EAAEC,IAAIC,UAAU,EAAE,GAAGF;gBAC3BhD,SAASkD;YACX,OAAO;gBACLlD,SAAS;YACX;QACF;QACAR,YAAYA;QACZC,UAAUA;QACV8B,WAAWA;QACXtB,WAAWA;QACX6B,OAAO;YACLC,cAAc;QAChB;QACA7B,OAAOA;uBAGX,oBAAC2B;QACCC,OAAO;YACLqB,YAAY;YACZC,SAAS;YACTC,OAAO;QACT;qBAEA,oBAACpE;QACCqD,iBAAiBrB,WAAW,UAAU;QACtCuB,OAAM;QACNlD,OAAO2B,WAAWtB,EAAE,qBAAqBA,EAAE;;AAKrD,EAAC"}
@@ -1,9 +0,0 @@
1
- import type { FormFieldBase } from '@payloadcms/ui/fields/shared';
2
- import React from 'react';
3
- import './index.scss';
4
- type MetaTitleProps = FormFieldBase & {
5
- hasGenerateTitleFn: boolean;
6
- };
7
- export declare const MetaTitle: React.FC<MetaTitleProps>;
8
- export {};
9
- //# sourceMappingURL=MetaTitle.d.ts.map
@@ -1 +0,0 @@
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;AAM1C,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"}