@payloadcms/plugin-seo 4.0.0-internal.ea6e8f8 → 4.0.0-internal.ee5d8bd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts +1 -0
- package/dist/fields/MetaDescription/MetaDescriptionComponent.d.ts.map +1 -1
- package/dist/fields/MetaDescription/MetaDescriptionComponent.js +2 -1
- package/dist/fields/MetaDescription/MetaDescriptionComponent.js.map +1 -1
- package/dist/fields/MetaImage/MetaImageComponent.d.ts +1 -0
- package/dist/fields/MetaImage/MetaImageComponent.d.ts.map +1 -1
- package/dist/fields/MetaImage/MetaImageComponent.js +2 -1
- package/dist/fields/MetaImage/MetaImageComponent.js.map +1 -1
- package/dist/fields/MetaTitle/MetaTitleComponent.d.ts +1 -0
- package/dist/fields/MetaTitle/MetaTitleComponent.d.ts.map +1 -1
- package/dist/fields/MetaTitle/MetaTitleComponent.js +2 -1
- package/dist/fields/MetaTitle/MetaTitleComponent.js.map +1 -1
- package/dist/fields/Overview/OverviewComponent.d.ts.map +1 -1
- package/dist/fields/Overview/OverviewComponent.js +4 -1
- package/dist/fields/Overview/OverviewComponent.js.map +1 -1
- package/dist/fields/Preview/PreviewComponent.d.ts +1 -0
- package/dist/fields/Preview/PreviewComponent.d.ts.map +1 -1
- package/dist/fields/Preview/PreviewComponent.js +7 -18
- package/dist/fields/Preview/PreviewComponent.js.map +1 -1
- package/dist/fields/colors.css +27 -0
- package/dist/translations/my.d.ts.map +1 -1
- package/dist/translations/my.js.map +1 -1
- package/dist/translations/ta.d.ts.map +1 -1
- package/dist/translations/ta.js.map +1 -1
- package/dist/translations/th.d.ts.map +1 -1
- package/dist/translations/th.js.map +1 -1
- package/dist/ui/LengthIndicator.d.ts +1 -0
- package/dist/ui/LengthIndicator.d.ts.map +1 -1
- package/dist/ui/LengthIndicator.js +12 -11
- package/dist/ui/LengthIndicator.js.map +1 -1
- package/package.json +24 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaDescriptionComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaDescription/MetaDescriptionComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MetaDescriptionComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaDescription/MetaDescriptionComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAevD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAU1C,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAA;CAC3C,GAAG,wBAAwB,CAAA;AAE5B,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoLnE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import '../colors.css';
|
|
3
4
|
import { FieldLabel, TextareaInput, useConfig, useDocumentInfo, useDocumentTitle, useField, useForm, useLocale, useTranslation } from '@payloadcms/ui';
|
|
4
5
|
import { reduceToSerializableFields } from '@payloadcms/ui/shared';
|
|
5
6
|
import { formatAdminURL } from 'payload/shared';
|
|
@@ -110,7 +111,7 @@ export const MetaDescriptionComponent = (props)=>{
|
|
|
110
111
|
}),
|
|
111
112
|
/*#__PURE__*/ _jsxs("div", {
|
|
112
113
|
style: {
|
|
113
|
-
color: '
|
|
114
|
+
color: 'var(--seo-description-color)'
|
|
114
115
|
},
|
|
115
116
|
children: [
|
|
116
117
|
t('plugin-seo:lengthTipDescription', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/MetaDescription/MetaDescriptionComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { TextareaFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n TextareaInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\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: maxLengthDefault, minLength: minLengthDefault } = defaults.description\n\ntype MetaDescriptionProps = {\n readonly hasGenerateDescriptionFn: boolean\n} & TextareaFieldClientProps\n\nexport const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props) => {\n const {\n field: {\n label,\n localized,\n maxLength: maxLengthFromProps,\n minLength: minLengthFromProps,\n required,\n },\n hasGenerateDescriptionFn,\n readOnly,\n } = props\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const maxLength = maxLengthFromProps || maxLengthDefault\n const minLength = minLengthFromProps || minLengthDefault\n\n const {\n customComponents: { AfterInput, BeforeInput, Label } = {},\n errorMessage,\n path,\n setValue,\n showError,\n value,\n }: FieldType<string> = useField()\n\n const regenerateDescription = useCallback(async () => {\n if (!hasGenerateDescriptionFn) {\n return\n }\n\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-description',\n })\n\n const genDescriptionResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateDescription>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedDescription } = await genDescriptionResponse.json()\n\n setValue(generatedDescription || '')\n }, [\n hasGenerateDescriptionFn,\n\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n 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 {Label ?? (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {hasGenerateDescriptionFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\n onClick={() => {\n void regenerateDescription()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n <div\n style={{\n color: '
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaDescription/MetaDescriptionComponent.tsx"],"sourcesContent":["'use client'\n\nimport '../colors.css'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { TextareaFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n TextareaInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\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: maxLengthDefault, minLength: minLengthDefault } = defaults.description\n\ntype MetaDescriptionProps = {\n readonly hasGenerateDescriptionFn: boolean\n} & TextareaFieldClientProps\n\nexport const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props) => {\n const {\n field: {\n label,\n localized,\n maxLength: maxLengthFromProps,\n minLength: minLengthFromProps,\n required,\n },\n hasGenerateDescriptionFn,\n readOnly,\n } = props\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const maxLength = maxLengthFromProps || maxLengthDefault\n const minLength = minLengthFromProps || minLengthDefault\n\n const {\n customComponents: { AfterInput, BeforeInput, Label } = {},\n errorMessage,\n path,\n setValue,\n showError,\n value,\n }: FieldType<string> = useField()\n\n const regenerateDescription = useCallback(async () => {\n if (!hasGenerateDescriptionFn) {\n return\n }\n\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-description',\n })\n\n const genDescriptionResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateDescription>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedDescription } = await genDescriptionResponse.json()\n\n setValue(generatedDescription || '')\n }, [\n hasGenerateDescriptionFn,\n\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n 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 {Label ?? (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {hasGenerateDescriptionFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\n onClick={() => {\n void regenerateDescription()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n <div\n style={{\n color: 'var(--seo-description-color)',\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 AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n Error={errorMessage}\n onChange={setValue}\n path={path}\n readOnly={readOnly}\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","useConfig","useDocumentInfo","useDocumentTitle","useField","useForm","useLocale","useTranslation","reduceToSerializableFields","formatAdminURL","React","useCallback","defaults","LengthIndicator","maxLength","maxLengthDefault","minLength","minLengthDefault","description","MetaDescriptionComponent","props","field","label","localized","maxLengthFromProps","minLengthFromProps","required","hasGenerateDescriptionFn","readOnly","config","routes","api","t","locale","getData","docInfo","title","customComponents","AfterInput","BeforeInput","Label","errorMessage","path","setValue","showError","value","regenerateDescription","endpoint","apiRoute","genDescriptionResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedDescription","json","div","style","marginBottom","position","className","Fragment","button","disabled","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","a","href","rel","target","Error","onChange","alignItems","display","width","text"],"mappings":"AAAA;;AAEA,OAAO,gBAAe;AAKtB,SACEA,UAAU,EACVC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,QAAQ,QAAQ,oBAAmB;AAC5C,SAASC,eAAe,QAAQ,8BAA6B;AAE7D,MAAM,EAAEC,WAAWC,gBAAgB,EAAEC,WAAWC,gBAAgB,EAAE,GAAGL,SAASM,WAAW;AAMzF,OAAO,MAAMC,2BAA2D,CAACC;IACvE,MAAM,EACJC,OAAO,EACLC,KAAK,EACLC,SAAS,EACTT,WAAWU,kBAAkB,EAC7BR,WAAWS,kBAAkB,EAC7BC,QAAQ,EACT,EACDC,wBAAwB,EACxBC,QAAQ,EACT,GAAGR;IAEJ,MAAM,EACJS,QAAQ,EACNC,QAAQ,EAAEC,GAAG,EAAE,EAChB,EACF,GAAG9B;IAEJ,M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|
|
|
1
|
-
{"version":3,"file":"MetaImageComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MetaImageComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAgBrD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,sBAAsB,CAAA;AAE1B,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA0MvD,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import '../colors.css';
|
|
3
4
|
import { FieldLabel, RenderCustomComponent, UploadInput, useConfig, useDocumentInfo, useDocumentTitle, useField, useForm, useLocale, useTranslation } from '@payloadcms/ui';
|
|
4
5
|
import { reduceToSerializableFields } from '@payloadcms/ui/shared';
|
|
5
6
|
import { formatAdminURL } from 'payload/shared';
|
|
@@ -120,7 +121,7 @@ export const MetaImageComponent = (props)=>{
|
|
|
120
121
|
}),
|
|
121
122
|
hasGenerateImageFn && /*#__PURE__*/ _jsx("div", {
|
|
122
123
|
style: {
|
|
123
|
-
color: '
|
|
124
|
+
color: 'var(--seo-description-color)'
|
|
124
125
|
},
|
|
125
126
|
children: t('plugin-seo:imageAutoGenerationTip')
|
|
126
127
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { UploadFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n RenderCustomComponent,\n UploadInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../../translations/index.js'\nimport type { GenerateImage } from '../../types.js'\n\nimport { Pill } from '../../ui/Pill.js'\n\ntype MetaImageProps = {\n readonly hasGenerateImageFn: boolean\n} & UploadFieldClientProps\n\nexport const MetaImageComponent: React.FC<MetaImageProps> = (props) => {\n const {\n field: { admin: { allowCreate } = {}, label, localized, relationTo, required },\n hasGenerateImageFn,\n readOnly,\n } = props\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const {\n customComponents: { Error, Label } = {},\n filterOptions,\n path,\n setValue,\n showError,\n value,\n }: FieldType<number | string> = useField()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const { title } = useDocumentTitle()\n\n const regenerateImage = useCallback(async () => {\n if (!hasGenerateImageFn) {\n return\n }\n\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-image',\n })\n\n const genImageResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateImage>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedImage } = await genImageResponse.json()\n\n // string ids, number ids or nullish values\n let newValue: null | number | string | undefined = generatedImage\n // non-nullish resolved relations\n if (typeof generatedImage === 'object' && generatedImage && 'id' in generatedImage) {\n newValue = generatedImage.id\n }\n\n // coerce to an empty string for falsy (=empty) values\n setValue(newValue || '')\n }, [\n hasGenerateImageFn,\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n const hasImage = Boolean(value)\n\n const collection = getEntityConfig({ collectionSlug: relationTo })\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div\n style={{\n marginBottom: '5px',\n position: 'relative',\n }}\n >\n <div className=\"plugin-seo__field\">\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n {hasGenerateImageFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\n onClick={() => {\n void regenerateImage()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n {hasGenerateImageFn && (\n <div\n style={{\n color: '#9A9A9A',\n }}\n >\n {t('plugin-seo:imageAutoGenerationTip')}\n </div>\n )}\n </div>\n <div\n style={{\n marginBottom: '10px',\n position: 'relative',\n }}\n >\n <UploadInput\n allowCreate={allowCreate !== false}\n api={api}\n collection={collection}\n Error={Error}\n filterOptions={filterOptions}\n onChange={(incomingImage) => {\n if (incomingImage !== null) {\n if (typeof incomingImage === 'object') {\n const { id: incomingID } = incomingImage\n setValue(incomingID)\n } else {\n setValue(incomingImage)\n }\n } else {\n setValue(null)\n }\n }}\n path={path}\n readOnly={readOnly}\n relationTo={relationTo}\n required={required}\n serverURL={serverURL}\n showError={showError}\n style={{\n marginBottom: 0,\n }}\n value={value}\n />\n </div>\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <Pill\n backgroundColor={hasImage ? 'green' : 'red'}\n color=\"white\"\n label={hasImage ? t('plugin-seo:good') : t('plugin-seo:noImage')}\n />\n </div>\n </div>\n )\n}\n"],"names":["FieldLabel","RenderCustomComponent","UploadInput","useConfig","useDocumentInfo","useDocumentTitle","useField","useForm","useLocale","useTranslation","reduceToSerializableFields","formatAdminURL","React","useCallback","Pill","MetaImageComponent","props","field","admin","allowCreate","label","localized","relationTo","required","hasGenerateImageFn","readOnly","config","routes","api","serverURL","getEntityConfig","customComponents","Error","Label","filterOptions","path","setValue","showError","value","t","locale","getData","docInfo","title","regenerateImage","endpoint","apiRoute","genImageResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedImage","json","newValue","hasImage","Boolean","collection","div","style","marginBottom","position","className","CustomComponent","Fallback","Fragment","button","disabled","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","onChange","incomingImage","incomingID","alignItems","display","width"],"mappings":"AAAA;;AAKA,SACEA,UAAU,EACVC,qBAAqB,EACrBC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,IAAI,QAAQ,mBAAkB;AAMvC,OAAO,MAAMC,qBAA+C,CAACC;IAC3D,MAAM,EACJC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAA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oBACZvC,OAAOA;oBACPE,eAAeA;oBACfyD,UAAU,CAACC;wBACT,IAAIA,kBAAkB,MAAM;4BAC1B,IAAI,OAAOA,kBAAkB,UAAU;gCACrC,MAAM,EAAExC,IAAIyC,UAAU,EAAE,GAAGD;gCAC3BxD,SAASyD;4BACX,OAAO;gCACLzD,SAASwD;4BACX;wBACF,OAAO;4BACLxD,SAAS;wBACX;oBACF;oBACAD,MAAMA;oBACNV,UAAUA;oBACVH,YAAYA;oBACZC,UAAUA;oBACVM,WAAWA;oBACXQ,WAAWA;oBACXoC,OAAO;wBACLC,cAAc;oBAChB;oBACApC,OAAOA;;;0BAGX,KAACkC;gBACCC,OAAO;oBACLqB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAAClF;oBACCsE,iBAAiBf,WAAW,UAAU;oBACtCiB,OAAM;oBACNlE,OAAOiD,WAAW9B,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaImage/MetaImageComponent.tsx"],"sourcesContent":["'use client'\n\nimport '../colors.css'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { UploadFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n RenderCustomComponent,\n UploadInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../../translations/index.js'\nimport type { GenerateImage } from '../../types.js'\n\nimport { Pill } from '../../ui/Pill.js'\n\ntype MetaImageProps = {\n readonly hasGenerateImageFn: boolean\n} & UploadFieldClientProps\n\nexport const MetaImageComponent: React.FC<MetaImageProps> = (props) => {\n const {\n field: { admin: { allowCreate } = {}, label, localized, relationTo, required },\n hasGenerateImageFn,\n readOnly,\n } = props\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const {\n customComponents: { Error, Label } = {},\n filterOptions,\n path,\n setValue,\n showError,\n value,\n }: FieldType<number | string> = useField()\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n\n const { title } = useDocumentTitle()\n\n const regenerateImage = useCallback(async () => {\n if (!hasGenerateImageFn) {\n return\n }\n\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-image',\n })\n\n const genImageResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateImage>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedImage } = await genImageResponse.json()\n\n // string ids, number ids or nullish values\n let newValue: null | number | string | undefined = generatedImage\n // non-nullish resolved relations\n if (typeof generatedImage === 'object' && generatedImage && 'id' in generatedImage) {\n newValue = generatedImage.id\n }\n\n // coerce to an empty string for falsy (=empty) values\n setValue(newValue || '')\n }, [\n hasGenerateImageFn,\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n const hasImage = Boolean(value)\n\n const collection = getEntityConfig({ collectionSlug: relationTo })\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div\n style={{\n marginBottom: '5px',\n position: 'relative',\n }}\n >\n <div className=\"plugin-seo__field\">\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n {hasGenerateImageFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\n onClick={() => {\n void regenerateImage()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n {hasGenerateImageFn && (\n <div\n style={{\n color: 'var(--seo-description-color)',\n }}\n >\n {t('plugin-seo:imageAutoGenerationTip')}\n </div>\n )}\n </div>\n <div\n style={{\n marginBottom: '10px',\n position: 'relative',\n }}\n >\n <UploadInput\n allowCreate={allowCreate !== false}\n api={api}\n collection={collection}\n Error={Error}\n filterOptions={filterOptions}\n onChange={(incomingImage) => {\n if (incomingImage !== null) {\n if (typeof incomingImage === 'object') {\n const { id: incomingID } = incomingImage\n setValue(incomingID)\n } else {\n setValue(incomingImage)\n }\n } else {\n setValue(null)\n }\n }}\n path={path}\n readOnly={readOnly}\n relationTo={relationTo}\n required={required}\n serverURL={serverURL}\n showError={showError}\n style={{\n marginBottom: 0,\n }}\n value={value}\n />\n </div>\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n width: '100%',\n }}\n >\n <Pill\n backgroundColor={hasImage ? 'green' : 'red'}\n color=\"white\"\n label={hasImage ? t('plugin-seo:good') : t('plugin-seo:noImage')}\n />\n </div>\n </div>\n )\n}\n"],"names":["FieldLabel","RenderCustomComponent","UploadInput","useConfig","useDocumentInfo","useDocumentTitle","useField","useForm","useLocale","useTranslation","reduceToSerializableFields","formatAdminURL","React","useCallback","Pill","MetaImageComponent","props","field","admin","allowCreate","label","localized","relationTo","required","hasGenerateImageFn","readOnly","config","routes","api","serverURL","getEntityConfig","customComponents","Error","Label","filterOptions","path","setValue","showError","value","t","locale","getData","docInfo","title","regenerateImage","endpoint","apiRoute","genImageResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedImage","json","newValue","hasImage","Boolean","collection","div","style","marginBottom","position","className","CustomComponent","Fallback","Fragment","button","disabled","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","onChange","incomingImage","incomingID","alignItems","display","width"],"mappings":"AAAA;;AAEA,OAAO,gBAAe;AAKtB,SACEA,UAAU,EACVC,qBAAqB,EACrBC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,IAAI,QAAQ,mBAAkB;AAMvC,OAAO,MAAMC,qBAA+C,CAACC;IAC3D,MAAM,EACJC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAE,EAC9EC,kBAAkB,EAClBC,QAAQ,EACT,GAAGT;IAEJ,MAAM,EACJU,QAAQ,EACNC,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,EACDC,eAAe,EAChB,GAAG3B;IAEJ,MAAM,EACJ4B,kBAAkB,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAG,CAAC,CAAC,EACvCC,aAAa,EACbC,IAAI,EACJC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACN,GAA+BhC;IAEhC,MAAM,EAAEiC,CAAC,EAAE,GAAG9B;IAEd,MAAM+B,SAAShC;IACf,MAA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ACTC,OAAO;gBACT;0BAEA,cAAA,KAAClF;oBACCsE,iBAAiBf,WAAW,UAAU;oBACtCiB,OAAM;oBACNlE,OAAOiD,WAAW9B,EAAE,qBAAqBA,EAAE;;;;;AAKrD,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaTitleComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaTitle/MetaTitleComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAenD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,cAAc,CAAA;AAIrB,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,oBAAoB,CAAA;AAExB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoLvD,CAAA"}
|
|
1
|
+
{"version":3,"file":"MetaTitleComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/MetaTitle/MetaTitleComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAenD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAIrB,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CACrC,GAAG,oBAAoB,CAAA;AAExB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoLvD,CAAA"}
|
|
@@ -6,6 +6,7 @@ import { formatAdminURL } from 'payload/shared';
|
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
import { defaults } from '../../defaults.js';
|
|
8
8
|
import { LengthIndicator } from '../../ui/LengthIndicator.js';
|
|
9
|
+
import '../colors.css';
|
|
9
10
|
import '../index.css';
|
|
10
11
|
const { maxLength: maxLengthDefault, minLength: minLengthDefault } = defaults.title;
|
|
11
12
|
export const MetaTitleComponent = (props)=>{
|
|
@@ -111,7 +112,7 @@ export const MetaTitleComponent = (props)=>{
|
|
|
111
112
|
}),
|
|
112
113
|
/*#__PURE__*/ _jsxs("div", {
|
|
113
114
|
style: {
|
|
114
|
-
color: '
|
|
115
|
+
color: 'var(--seo-description-color)'
|
|
115
116
|
},
|
|
116
117
|
children: [
|
|
117
118
|
t('plugin-seo:lengthTipTitle', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/MetaTitle/MetaTitleComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { TextFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n TextInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\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.css'\n\nconst { maxLength: maxLengthDefault, minLength: minLengthDefault } = defaults.title\n\ntype MetaTitleProps = {\n readonly hasGenerateTitleFn: boolean\n} & TextFieldClientProps\n\nexport const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {\n const {\n field: {\n label,\n localized,\n maxLength: maxLengthFromProps,\n minLength: minLengthFromProps,\n required,\n },\n hasGenerateTitleFn,\n readOnly,\n } = props\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const {\n customComponents: { AfterInput, BeforeInput, Label } = {},\n errorMessage,\n path,\n setValue,\n showError,\n value,\n }: FieldType<string> = useField()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const minLength = minLengthFromProps || minLengthDefault\n const maxLength = maxLengthFromProps || maxLengthDefault\n\n const regenerateTitle = useCallback(async () => {\n if (!hasGenerateTitleFn) {\n return\n }\n\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-title',\n })\n\n const genTitleResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateTitle>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedTitle } = await genTitleResponse.json()\n\n setValue(generatedTitle || '')\n }, [\n hasGenerateTitleFn,\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n 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 {Label ?? (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {hasGenerateTitleFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\n onClick={() => {\n void regenerateTitle()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n <div\n style={{\n color: '
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/MetaTitle/MetaTitleComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldType } from '@payloadcms/ui'\nimport type { TextFieldClientProps } from 'payload'\n\nimport {\n FieldLabel,\n TextInput,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useField,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\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 '../colors.css'\nimport '../index.css'\n\nconst { maxLength: maxLengthDefault, minLength: minLengthDefault } = defaults.title\n\ntype MetaTitleProps = {\n readonly hasGenerateTitleFn: boolean\n} & TextFieldClientProps\n\nexport const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {\n const {\n field: {\n label,\n localized,\n maxLength: maxLengthFromProps,\n minLength: minLengthFromProps,\n required,\n },\n hasGenerateTitleFn,\n readOnly,\n } = props\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const {\n customComponents: { AfterInput, BeforeInput, Label } = {},\n errorMessage,\n path,\n setValue,\n showError,\n value,\n }: FieldType<string> = useField()\n\n const locale = useLocale()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const minLength = minLengthFromProps || minLengthDefault\n const maxLength = maxLengthFromProps || maxLengthDefault\n\n const regenerateTitle = useCallback(async () => {\n if (!hasGenerateTitleFn) {\n return\n }\n\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-title',\n })\n\n const genTitleResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateTitle>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: generatedTitle } = await genTitleResponse.json()\n\n setValue(generatedTitle || '')\n }, [\n hasGenerateTitleFn,\n api,\n docInfo.id,\n docInfo.collectionSlug,\n docInfo.docPermissions,\n docInfo.globalSlug,\n docInfo.hasPublishPermission,\n docInfo.hasSavePermission,\n docInfo.initialData,\n docInfo.initialState,\n getData,\n locale,\n setValue,\n title,\n ])\n\n 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 {Label ?? (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {hasGenerateTitleFn && (\n <React.Fragment>\n — \n <button\n disabled={readOnly}\n onClick={() => {\n void regenerateTitle()\n }}\n style={{\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n color: 'currentcolor',\n cursor: 'pointer',\n padding: 0,\n textDecoration: 'underline',\n }}\n type=\"button\"\n >\n {t('plugin-seo:autoGenerate')}\n </button>\n </React.Fragment>\n )}\n </div>\n <div\n style={{\n color: 'var(--seo-description-color)',\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 AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n Error={errorMessage}\n onChange={setValue}\n path={path}\n readOnly={readOnly}\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","useConfig","useDocumentInfo","useDocumentTitle","useField","useForm","useLocale","useTranslation","reduceToSerializableFields","formatAdminURL","React","useCallback","defaults","LengthIndicator","maxLength","maxLengthDefault","minLength","minLengthDefault","title","MetaTitleComponent","props","field","label","localized","maxLengthFromProps","minLengthFromProps","required","hasGenerateTitleFn","readOnly","t","config","routes","api","customComponents","AfterInput","BeforeInput","Label","errorMessage","path","setValue","showError","value","locale","getData","docInfo","regenerateTitle","endpoint","apiRoute","genTitleResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","generatedTitle","json","div","style","marginBottom","position","className","Fragment","button","disabled","onClick","background","backgroundColor","border","color","cursor","padding","textDecoration","type","a","href","rel","target","Error","onChange","alignItems","display","width","text"],"mappings":"AAAA;;AAKA,SACEA,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,QAAQ,QAAQ,oBAAmB;AAC5C,SAASC,eAAe,QAAQ,8BAA6B;AAC7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;oBACCkC,YAAYA;oBACZC,aAAaA;oBACbuD,OAAOrD;oBACPsD,UAAUpD;oBACVD,MAAMA;oBACNV,UAAUA;oBACVF,UAAUA;oBACVc,WAAWA;oBACX8B,OAAO;wBACLC,cAAc;oBAChB;oBACA9B,OAAOA;;;0BAGX,KAAC4B;gBACCC,OAAO;oBACLsB,YAAY;oBACZC,SAAS;oBACTC,OAAO;gBACT;0BAEA,cAAA,KAACjF;oBAAgBC,WAAWA;oBAAWE,WAAWA;oBAAW+E,MAAMtD;;;;;AAI3E,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverviewComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/Overview/OverviewComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"OverviewComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/Overview/OverviewComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAGtC,OAAO,KAA2C,MAAM,OAAO,CAAA;AAW/D,KAAK,aAAa,GAAG;IACnB,oBAAoB,CAAC,EAAE;QACrB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE;QACf,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,OAAO,CAAA;AAEX,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAqDrD,CAAA"}
|
|
@@ -9,7 +9,10 @@ export const OverviewComponent = ({ descriptionOverrides, descriptionPath: descr
|
|
|
9
9
|
const descriptionPath = descriptionPathFromContext || 'meta.description';
|
|
10
10
|
const titlePath = titlePathFromContext || 'meta.title';
|
|
11
11
|
const imagePath = imagePathFromContext || 'meta.image';
|
|
12
|
-
const [
|
|
12
|
+
const [fields] = useAllFormFields();
|
|
13
|
+
const metaDesc = fields[descriptionPath]?.value;
|
|
14
|
+
const metaImage = fields[imagePath]?.value;
|
|
15
|
+
const metaTitle = fields[titlePath]?.value;
|
|
13
16
|
const { t } = useTranslation();
|
|
14
17
|
const [titleIsValid, setTitleIsValid] = useState();
|
|
15
18
|
const [descIsValid, setDescIsValid] = useState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Overview/OverviewComponent.tsx"],"sourcesContent":["'use client'\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Overview/OverviewComponent.tsx"],"sourcesContent":["'use client'\n\nimport type { UIField } 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: maxDescDefault, minLength: minDescDefault },\n title: { maxLength: maxTitleDefault, minLength: minTitleDefault },\n} = defaults\n\ntype OverviewProps = {\n descriptionOverrides?: {\n maxLength?: number\n minLength?: number\n }\n descriptionPath?: string\n imagePath?: string\n titleOverrides?: {\n maxLength?: number\n minLength?: number\n }\n titlePath?: string\n} & UIField\n\nexport const OverviewComponent: React.FC<OverviewProps> = ({\n descriptionOverrides,\n descriptionPath: descriptionPathFromContext,\n imagePath: imagePathFromContext,\n titleOverrides,\n titlePath: titlePathFromContext,\n}) => {\n const { getFields } = useForm()\n\n const descriptionPath = descriptionPathFromContext || 'meta.description'\n const titlePath = titlePathFromContext || 'meta.title'\n const imagePath = imagePathFromContext || 'meta.image'\n\n const [fields] = useAllFormFields()\n const metaDesc = fields[descriptionPath]?.value\n const metaImage = fields[imagePath]?.value\n const metaTitle = fields[titlePath]?.value\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 const minDesc = descriptionOverrides?.minLength || minDescDefault\n const maxDesc = descriptionOverrides?.maxLength || maxDescDefault\n const minTitle = titleOverrides?.minLength || minTitleDefault\n const maxTitle = titleOverrides?.maxLength || maxTitleDefault\n\n useEffect(() => {\n if (typeof metaTitle === 'string') {\n setTitleIsValid(metaTitle.length >= minTitle && metaTitle.length <= maxTitle)\n }\n if (typeof metaDesc === 'string') {\n setDescIsValid(metaDesc.length >= minDesc && metaDesc.length <= maxDesc)\n }\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","useEffect","useState","defaults","description","maxLength","maxDescDefault","minLength","minDescDefault","title","maxTitleDefault","minTitleDefault","OverviewComponent","descriptionOverrides","descriptionPath","descriptionPathFromContext","imagePath","imagePathFromContext","titleOverrides","titlePath","titlePathFromContext","getFields","fields","metaDesc","value","metaImage","metaTitle","t","titleIsValid","setTitleIsValid","descIsValid","setDescIsValid","imageIsValid","setImageIsValid","minDesc","maxDesc","minTitle","maxTitle","length","Boolean","testResults","numberOfPasses","filter","div","style","marginBottom","current","max"],"mappings":"AAAA;;AAIA,SAASA,gBAAgB,EAAEC,OAAO,EAAEC,cAAc,QAAQ,iBAAgB;AAC1E,OAAOC,SAAsBC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI/D,SAASC,QAAQ,QAAQ,oBAAmB;A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;QAAcE;QAAaE;KAAa;IAE7D,MAAMS,iBAAiBD,YAAYE,MAAM,CAACH,SAASD,MAAM;IAEzD,qBACE,KAACK;QACCC,OAAO;YACLC,cAAc;QAChB;kBAEA,cAAA,KAACF;sBACEhB,EAAE,4BAA4B;gBAAEmB,SAASL;gBAAgBM,KAAKP,YAAYF,MAAM;YAAC;;;AAI1F,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/Preview/PreviewComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"PreviewComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/Preview/PreviewComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAatC,OAAO,KAA8B,MAAM,OAAO,CAAA;AAKlD,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,GAAG,OAAO,CAAA;AAEX,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAiHnD,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import '../colors.css';
|
|
3
4
|
import { useAllFormFields, useConfig, useDocumentInfo, useDocumentTitle, useForm, useLocale, useTranslation } from '@payloadcms/ui';
|
|
4
5
|
import { reduceToSerializableFields } from '@payloadcms/ui/shared';
|
|
5
6
|
import { formatAdminURL } from 'payload/shared';
|
|
@@ -15,7 +16,8 @@ export const PreviewComponent = (props)=>{
|
|
|
15
16
|
const { title } = useDocumentTitle();
|
|
16
17
|
const descriptionPath = descriptionPathFromContext || 'meta.description';
|
|
17
18
|
const titlePath = titlePathFromContext || 'meta.title';
|
|
18
|
-
const
|
|
19
|
+
const metaDescription = fields[descriptionPath]?.value;
|
|
20
|
+
const metaTitle = fields[titlePath]?.value;
|
|
19
21
|
const [href, setHref] = useState();
|
|
20
22
|
useEffect(()=>{
|
|
21
23
|
const endpoint = formatAdminURL({
|
|
@@ -69,7 +71,7 @@ export const PreviewComponent = (props)=>{
|
|
|
69
71
|
}),
|
|
70
72
|
/*#__PURE__*/ _jsx("div", {
|
|
71
73
|
style: {
|
|
72
|
-
color: '
|
|
74
|
+
color: 'var(--seo-description-color)',
|
|
73
75
|
marginBottom: '5px'
|
|
74
76
|
},
|
|
75
77
|
children: t('plugin-seo:previewDescription')
|
|
@@ -81,30 +83,17 @@ export const PreviewComponent = (props)=>{
|
|
|
81
83
|
boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',
|
|
82
84
|
maxWidth: '600px',
|
|
83
85
|
padding: '20px',
|
|
84
|
-
pointerEvents: 'none',
|
|
85
86
|
width: '100%'
|
|
86
87
|
},
|
|
87
88
|
children: [
|
|
88
89
|
/*#__PURE__*/ _jsx("div", {
|
|
89
|
-
children:
|
|
90
|
-
href: href,
|
|
91
|
-
style: {
|
|
92
|
-
textDecoration: 'none'
|
|
93
|
-
},
|
|
94
|
-
children: href || 'https://...'
|
|
95
|
-
})
|
|
90
|
+
children: href || 'https://...'
|
|
96
91
|
}),
|
|
97
|
-
/*#__PURE__*/ _jsx("
|
|
92
|
+
/*#__PURE__*/ _jsx("div", {
|
|
98
93
|
style: {
|
|
99
94
|
margin: 0
|
|
100
95
|
},
|
|
101
|
-
children:
|
|
102
|
-
href: "/",
|
|
103
|
-
style: {
|
|
104
|
-
textDecoration: 'none'
|
|
105
|
-
},
|
|
106
|
-
children: metaTitle
|
|
107
|
-
})
|
|
96
|
+
children: metaTitle
|
|
108
97
|
}),
|
|
109
98
|
/*#__PURE__*/ _jsx("p", {
|
|
110
99
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Preview/PreviewComponent.tsx"],"sourcesContent":["'use client'\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Preview/PreviewComponent.tsx"],"sourcesContent":["'use client'\n\nimport '../colors.css'\n\nimport type { UIField } from 'payload'\n\nimport {\n useAllFormFields,\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useForm,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { reduceToSerializableFields } from '@payloadcms/ui/shared'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect, useState } from 'react'\n\nimport type { PluginSEOTranslationKeys, PluginSEOTranslations } from '../../translations/index.js'\nimport type { GenerateURL } from '../../types.js'\n\ntype PreviewProps = {\n readonly descriptionPath?: string\n readonly hasGenerateURLFn: boolean\n readonly titlePath?: string\n} & UIField\n\nexport const PreviewComponent: React.FC<PreviewProps> = (props) => {\n const {\n descriptionPath: descriptionPathFromContext,\n hasGenerateURLFn,\n titlePath: titlePathFromContext,\n } = props\n\n const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const locale = useLocale()\n const [fields] = useAllFormFields()\n const { getData } = useForm()\n const docInfo = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const descriptionPath = descriptionPathFromContext || 'meta.description'\n const titlePath = titlePathFromContext || 'meta.title'\n\n const metaDescription = fields[descriptionPath]?.value\n const metaTitle = fields[titlePath]?.value\n\n const [href, setHref] = useState<string>()\n\n useEffect(() => {\n const endpoint = formatAdminURL({\n apiRoute: api,\n path: '/plugin-seo/generate-url',\n })\n\n const getHref = async () => {\n const genURLResponse = await fetch(endpoint, {\n body: JSON.stringify({\n id: docInfo.id,\n collectionSlug: docInfo.collectionSlug,\n doc: getData(),\n docPermissions: docInfo.docPermissions,\n globalSlug: docInfo.globalSlug,\n hasPublishPermission: docInfo.hasPublishPermission,\n hasSavePermission: docInfo.hasSavePermission,\n initialData: docInfo.initialData,\n initialState: reduceToSerializableFields(docInfo.initialState ?? {}),\n locale: locale?.code,\n title,\n } satisfies Omit<\n Parameters<GenerateURL>[0],\n 'collectionConfig' | 'globalConfig' | 'hasPublishedDoc' | 'req' | 'versionCount'\n >),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n })\n\n const { result: 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, api, title])\n\n return (\n <div\n style={{\n marginBottom: '20px',\n }}\n >\n <div>{t('plugin-seo:preview')}</div>\n <div\n style={{\n color: 'var(--seo-description-color)',\n marginBottom: '5px',\n }}\n >\n {t('plugin-seo:previewDescription')}\n </div>\n <div\n style={{\n background: 'var(--color-bg-secondary)',\n borderRadius: '5px',\n boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',\n maxWidth: '600px',\n padding: '20px',\n width: '100%',\n }}\n >\n <div>{href || 'https://...'}</div>\n <div\n style={{\n margin: 0,\n }}\n >\n {metaTitle as string}\n </div>\n <p\n style={{\n margin: 0,\n }}\n >\n {metaDescription as string}\n </p>\n </div>\n </div>\n )\n}\n"],"names":["useAllFormFields","useConfig","useDocumentInfo","useDocumentTitle","useForm","useLocale","useTranslation","reduceToSerializableFields","formatAdminURL","React","useEffect","useState","PreviewComponent","props","descriptionPath","descriptionPathFromContext","hasGenerateURLFn","titlePath","titlePathFromContext","t","config","routes","api","locale","fields","getData","docInfo","title","metaDescription","value","metaTitle","href","setHref","endpoint","apiRoute","path","getHref","genURLResponse","fetch","body","JSON","stringify","id","collectionSlug","doc","docPermissions","globalSlug","hasPublishPermission","hasSavePermission","initialData","initialState","code","credentials","headers","method","result","newHref","json","div","style","marginBottom","color","background","borderRadius","boxShadow","maxWidth","padding","width","margin","p"],"mapp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BtB,QAAQsB,iBAAiB;oBAC5CC,aAAavB,QAAQuB,WAAW;oBAChCC,cAAc3C,2BAA2BmB,QAAQwB,YAAY,IAAI,CAAC;oBAClE3B,QAAQA,QAAQ4B;oBAChBxB;gBACF;gBAIAyB,aAAa;gBACbC,SAAS;oBACP,gBAAgB;gBAClB;gBACAC,QAAQ;YACV;YAEA,MAAM,EAAEC,QAAQC,OAAO,EAAE,GAAG,MAAMnB,eAAeoB,IAAI;YAErDzB,QAAQwB;QACV;QAEA,IAAIxC,oBAAoB,CAACe,MAAM;YAC7B,KAAKK;QACP;IACF,GAAG;QAACZ;QAAQO;QAAMR;QAAQG;QAASV;QAAkBS;QAASH;QAAKK;KAAM;IAEzE,qBACE,MAAC+B;QACCC,OAAO;YACLC,cAAc;QAChB;;0BAEA,KAACF;0BAAKvC,EAAE;;0BACR,KAACuC;gBACCC,OAAO;oBACLE,OAAO;oBACPD,cAAc;gBAChB;0BAECzC,EAAE;;0BAEL,MAACuC;gBACCC,OAAO;oBACLG,YAAY;oBACZC,cAAc;oBACdC,WAAW;oBACXC,UAAU;oBACVC,SAAS;oBACTC,OAAO;gBACT;;kCAEA,KAACT;kCAAK3B,QAAQ;;kCACd,KAAC2B;wBACCC,OAAO;4BACLS,QAAQ;wBACV;kCAECtC;;kCAEH,KAACuC;wBACCV,OAAO;4BACLS,QAAQ;wBACV;kCAECxC;;;;;;AAKX,EAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
:root,
|
|
3
|
+
[data-theme] {
|
|
4
|
+
--seo-description-color: #9a9a9a;
|
|
5
|
+
--seo-danger-bg: red;
|
|
6
|
+
--seo-short-bg: orangered;
|
|
7
|
+
--seo-danger-text: white;
|
|
8
|
+
--seo-warning-bg: orange;
|
|
9
|
+
--seo-warning-text: white;
|
|
10
|
+
--seo-success-bg: green;
|
|
11
|
+
--seo-success-text: white;
|
|
12
|
+
--seo-track-bg: #f3f3f3;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html[data-enhanced-contrast],
|
|
16
|
+
html[data-enhanced-contrast] [data-theme] {
|
|
17
|
+
--seo-description-color: var(--color-text-secondary);
|
|
18
|
+
--seo-danger-bg: var(--color-bg-danger);
|
|
19
|
+
--seo-short-bg: var(--color-bg-danger);
|
|
20
|
+
--seo-danger-text: var(--color-text-ondanger);
|
|
21
|
+
--seo-warning-bg: var(--color-bg-warning);
|
|
22
|
+
--seo-warning-text: var(--color-text-onwarning);
|
|
23
|
+
--seo-success-bg: var(--color-bg-success-tertiary);
|
|
24
|
+
--seo-success-text: var(--color-text);
|
|
25
|
+
--seo-track-bg: var(--color-bg-tertiary);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my.d.ts","sourceRoot":"","sources":["../../src/translations/my.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"my.d.ts","sourceRoot":"","sources":["../../src/translations/my.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,yBAwBhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/translations/my.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const my: GenericTranslationsObject = {\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}} အကြားရှိသင့်သည်။ အရည်အသွေးမြင့် meta ဖော်ပြချက်ရေးသားရန်အတွက်အကြံဉာဏ်များကို ကြည့်ရန် ',\n lengthTipTitle:\n 'ဤအကြောင်းအရာသည် {{minLength}} နှင့် {{maxLength}} အကြားရှိသင့်သည်။ အရည်အသွေးမြင့် meta ခေါင်းစဉ်ရေးသားရန်အတွက်အကြံဉာဏ်များကို ကြည့်ရန် ',\n missing: 'ပျောက်နေသည်',\n noImage: 'ပုံမရှိပါ',\n preview: 'မကြိုတင်ကြည့်ရှုနိုင်ပါ',\n previewDescription
|
|
1
|
+
{"version":3,"sources":["../../src/translations/my.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const my: GenericTranslationsObject = {\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}} အကြားရှိသင့်သည်။ အရည်အသွေးမြင့် meta ဖော်ပြချက်ရေးသားရန်အတွက်အကြံဉာဏ်များကို ကြည့်ရန် ',\n lengthTipTitle:\n 'ဤအကြောင်းအရာသည် {{minLength}} နှင့် {{maxLength}} အကြားရှိသင့်သည်။ အရည်အသွေးမြင့် meta ခေါင်းစဉ်ရေးသားရန်အတွက်အကြံဉာဏ်များကို ကြည့်ရန် ',\n missing: 'ပျောက်နေသည်',\n noImage: 'ပုံမရှိပါ',\n preview: 'မကြိုတင်ကြည့်ရှုနိုင်ပါ',\n previewDescription: 'တိကျသော ရှာဖွေမှုရလဒ်များသည် အကြောင်းအရာနှင့် ရှာဖွေရေးအသင့်တော်မှုပေါ်မူတည်၍ မတူကွဲပြားနိုင်သည်။',\n tooLong: 'တော်တော်ကြာသည်',\n tooShort: 'တော်တော်တိုသည်',\n },\n}\n"],"names":["my","$schema","almostThere","autoGenerate","bestPractices","characterCount","charactersLeftOver","charactersToGo","charactersTooMany","checksPassing","good","imageAutoGenerationTip","lengthTipDescription","lengthTipTitle","missing","noImage","preview","previewDescription","tooLong","tooShort"],"mappings":"AAEA,OAAO,MAAMA,KAAgC;IAC3CC,SAAS;IACT,cAAc;QACZC,aAAa;QACbC,cAAc;QACdC,eAAe;QACfC,gBAAgB;QAChBC,oBAAoB;QACpBC,gBAAgB;QAChBC,mBAAmB;QACnBC,eAAe;QACfC,MAAM;QACNC,wBAAwB;QACxBC,sBACE;QACFC,gBACE;QACFC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,oBAAoB;QACpBC,SAAS;QACTC,UAAU;IACZ;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ta.d.ts","sourceRoot":"","sources":["../../src/translations/ta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ta.d.ts","sourceRoot":"","sources":["../../src/translations/ta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,yBAwBhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/translations/ta.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const ta: GenericTranslationsObject = {\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 missing: 'இல்லை',\n noImage: 'படம் இல்லை',\n preview: 'முன்னோட்டம்',\n previewDescription
|
|
1
|
+
{"version":3,"sources":["../../src/translations/ta.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const ta: GenericTranslationsObject = {\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 missing: 'இல்லை',\n noImage: 'படம் இல்லை',\n preview: 'முன்னோட்டம்',\n previewDescription: 'சரியான முடிவு பட்டியல்கள் உள்ளடக்கம் மற்றும் தேடல் தொடர்புக்கு ஏற்ப மாறலாம்.',\n tooLong: 'மிக நீளம்',\n tooShort: 'மிகக் குறைவு',\n },\n}\n"],"names":["ta","$schema","almostThere","autoGenerate","bestPractices","characterCount","charactersLeftOver","charactersToGo","charactersTooMany","checksPassing","good","imageAutoGenerationTip","lengthTipDescription","lengthTipTitle","missing","noImage","preview","previewDescription","tooLong","tooShort"],"mappings":"AAEA,OAAO,MAAMA,KAAgC;IAC3CC,SAAS;IACT,cAAc;QACZC,aAAa;QACbC,cAAc;QACdC,eAAe;QACfC,gBAAgB;QAChBC,oBAAoB;QACpBC,gBAAgB;QAChBC,mBAAmB;QACnBC,eAAe;QACfC,MAAM;QACNC,wBAAwB;QACxBC,sBACE;QACFC,gBACE;QACFC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,oBAAoB;QACpBC,SAAS;QACTC,UAAU;IACZ;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"th.d.ts","sourceRoot":"","sources":["../../src/translations/th.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"th.d.ts","sourceRoot":"","sources":["../../src/translations/th.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,eAAO,MAAM,EAAE,EAAE,yBAwBhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/translations/th.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const th: GenericTranslationsObject = {\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 missing: 'ขาดหายไป',\n noImage: 'ไม่มีภาพ',\n preview: 'ตัวอย่าง',\n previewDescription
|
|
1
|
+
{"version":3,"sources":["../../src/translations/th.ts"],"sourcesContent":["import type { GenericTranslationsObject } from '@payloadcms/translations'\n\nexport const th: GenericTranslationsObject = {\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 missing: 'ขาดหายไป',\n noImage: 'ไม่มีภาพ',\n preview: 'ตัวอย่าง',\n previewDescription: 'ผลลัพธ์การค้นหาที่แท้จริงอาจแตกต่างกันไปตามเนื้อหาและความเกี่ยวข้องของการค้นหา',\n tooLong: 'ยาวเกินไป',\n tooShort: 'สั้นเกินไป',\n },\n}\n"],"names":["th","$schema","almostThere","autoGenerate","bestPractices","characterCount","charactersLeftOver","charactersToGo","charactersTooMany","checksPassing","good","imageAutoGenerationTip","lengthTipDescription","lengthTipTitle","missing","noImage","preview","previewDescription","tooLong","tooShort"],"mappings":"AAEA,OAAO,MAAMA,KAAgC;IAC3CC,SAAS;IACT,cAAc;QACZC,aAAa;QACbC,cAAc;QACdC,eAAe;QACfC,gBAAgB;QAChBC,oBAAoB;QACpBC,gBAAgB;QAChBC,mBAAmB;QACnBC,eAAe;QACfC,MAAM;QACNC,wBAAwB;QACxBC,sBACE;QACFC,gBACE;QACFC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,oBAAoB;QACpBC,SAAS;QACTC,UAAU;IACZ;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LengthIndicator.d.ts","sourceRoot":"","sources":["../../src/ui/LengthIndicator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"LengthIndicator.d.ts","sourceRoot":"","sources":["../../src/ui/LengthIndicator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAI5D,OAAO,sBAAsB,CAAA;AAG7B,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"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslation } from '@payloadcms/ui';
|
|
4
4
|
import React, { Fragment, useEffect, useState } from 'react';
|
|
5
|
+
import '../fields/colors.css';
|
|
5
6
|
import { Pill } from './Pill.js';
|
|
6
7
|
export const LengthIndicator = (props)=>{
|
|
7
8
|
const { maxLength = 0, minLength = 0, text } = props;
|
|
@@ -17,8 +18,8 @@ export const LengthIndicator = (props)=>{
|
|
|
17
18
|
if (textLength === 0) {
|
|
18
19
|
setLabel(t('plugin-seo:missing'));
|
|
19
20
|
setLabelStyle({
|
|
20
|
-
backgroundColor: '
|
|
21
|
-
color: '
|
|
21
|
+
backgroundColor: 'var(--seo-danger-bg)',
|
|
22
|
+
color: 'var(--seo-danger-text)'
|
|
22
23
|
});
|
|
23
24
|
setBarWidth(0);
|
|
24
25
|
} else {
|
|
@@ -28,14 +29,14 @@ export const LengthIndicator = (props)=>{
|
|
|
28
29
|
if (ratioUntilMin > 0.9) {
|
|
29
30
|
setLabel(t('plugin-seo:almostThere'));
|
|
30
31
|
setLabelStyle({
|
|
31
|
-
backgroundColor: '
|
|
32
|
-
color: '
|
|
32
|
+
backgroundColor: 'var(--seo-warning-bg)',
|
|
33
|
+
color: 'var(--seo-warning-text)'
|
|
33
34
|
});
|
|
34
35
|
} else {
|
|
35
36
|
setLabel(t('plugin-seo:tooShort'));
|
|
36
37
|
setLabelStyle({
|
|
37
|
-
backgroundColor: '
|
|
38
|
-
color: '
|
|
38
|
+
backgroundColor: 'var(--seo-short-bg)',
|
|
39
|
+
color: 'var(--seo-danger-text)'
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
setBarWidth(ratioUntilMin);
|
|
@@ -43,16 +44,16 @@ export const LengthIndicator = (props)=>{
|
|
|
43
44
|
if (progress >= 0 && progress <= 1) {
|
|
44
45
|
setLabel(t('plugin-seo:good'));
|
|
45
46
|
setLabelStyle({
|
|
46
|
-
backgroundColor: '
|
|
47
|
-
color: '
|
|
47
|
+
backgroundColor: 'var(--seo-success-bg)',
|
|
48
|
+
color: 'var(--seo-success-text)'
|
|
48
49
|
});
|
|
49
50
|
setBarWidth(progress);
|
|
50
51
|
}
|
|
51
52
|
if (progress > 1) {
|
|
52
53
|
setLabel(t('plugin-seo:tooLong'));
|
|
53
54
|
setLabelStyle({
|
|
54
|
-
backgroundColor: '
|
|
55
|
-
color: '
|
|
55
|
+
backgroundColor: 'var(--seo-danger-bg)',
|
|
56
|
+
color: 'var(--seo-danger-text)'
|
|
56
57
|
});
|
|
57
58
|
setBarWidth(1);
|
|
58
59
|
}
|
|
@@ -112,7 +113,7 @@ export const LengthIndicator = (props)=>{
|
|
|
112
113
|
}),
|
|
113
114
|
/*#__PURE__*/ _jsx("div", {
|
|
114
115
|
style: {
|
|
115
|
-
backgroundColor: '
|
|
116
|
+
backgroundColor: 'var(--seo-track-bg)',
|
|
116
117
|
height: '2px',
|
|
117
118
|
position: 'relative',
|
|
118
119
|
width: '100%'
|
|
@@ -1 +1 @@
|
|
|
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(t('plugin-seo:missing'))\n setLabelStyle({\n backgroundColor: '
|
|
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 '../fields/colors.css'\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(t('plugin-seo:missing'))\n setLabelStyle({\n backgroundColor: 'var(--seo-danger-bg)',\n color: 'var(--seo-danger-text)',\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: 'var(--seo-warning-bg)',\n color: 'var(--seo-warning-text)',\n })\n } else {\n setLabel(t('plugin-seo:tooShort'))\n setLabelStyle({\n backgroundColor: 'var(--seo-short-bg)',\n color: 'var(--seo-danger-text)',\n })\n }\n\n setBarWidth(ratioUntilMin)\n }\n\n if (progress >= 0 && progress <= 1) {\n setLabel(t('plugin-seo:good'))\n setLabelStyle({\n backgroundColor: 'var(--seo-success-bg)',\n color: 'var(--seo-success-text)',\n })\n setBarWidth(progress)\n }\n\n if (progress > 1) {\n setLabel(t('plugin-seo:tooLong'))\n setLabelStyle({\n backgroundColor: 'var(--seo-danger-bg)',\n color: 'var(--seo-danger-text)',\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: 'var(--seo-track-bg)',\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,OAAO,uBAAsB;AAC7B,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,SAASG,EAAE;YACXP,cAAc;gBACZC,iBAAi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vEA,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,GAAGb,WAAW,IAAI,CAAC,CAAC;oBAC7B;;;;;AAKV,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-seo",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.ee5d8bd",
|
|
4
4
|
"description": "SEO plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"payload",
|
|
7
6
|
"cms",
|
|
7
|
+
"payload",
|
|
8
8
|
"plugin",
|
|
9
|
-
"typescript",
|
|
10
9
|
"react",
|
|
11
10
|
"seo",
|
|
11
|
+
"typescript",
|
|
12
12
|
"yoast"
|
|
13
13
|
],
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/payloadcms/payload.git",
|
|
17
|
-
"directory": "packages/plugin-seo"
|
|
18
|
-
},
|
|
19
14
|
"license": "MIT",
|
|
20
15
|
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
21
16
|
"maintainers": [
|
|
@@ -25,10 +20,20 @@
|
|
|
25
20
|
"url": "https://payloadcms.com"
|
|
26
21
|
}
|
|
27
22
|
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/payloadcms/payload.git",
|
|
26
|
+
"directory": "packages/plugin-seo"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
28
32
|
"sideEffects": [
|
|
29
33
|
"*.css"
|
|
30
34
|
],
|
|
31
|
-
"
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
32
37
|
"exports": {
|
|
33
38
|
".": {
|
|
34
39
|
"import": "./dist/index.js",
|
|
@@ -51,29 +56,23 @@
|
|
|
51
56
|
"default": "./dist/exports/client.js"
|
|
52
57
|
}
|
|
53
58
|
},
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"dist"
|
|
58
|
-
],
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"registry": "https://registry.npmjs.org/"
|
|
61
|
+
},
|
|
59
62
|
"dependencies": {
|
|
60
|
-
"@payloadcms/
|
|
61
|
-
"@payloadcms/
|
|
63
|
+
"@payloadcms/translations": "4.0.0-internal.ee5d8bd",
|
|
64
|
+
"@payloadcms/ui": "4.0.0-internal.ee5d8bd"
|
|
62
65
|
},
|
|
63
66
|
"devDependencies": {
|
|
67
|
+
"@payloadcms/next": "4.0.0-internal.ee5d8bd",
|
|
64
68
|
"@types/react": "19.3.0",
|
|
65
69
|
"@types/react-dom": "19.3.0",
|
|
66
|
-
"
|
|
67
|
-
"@payloadcms/next": "4.0.0-internal.ea6e8f8",
|
|
68
|
-
"payload": "4.0.0-internal.ea6e8f8"
|
|
70
|
+
"payload": "4.0.0-internal.ee5d8bd"
|
|
69
71
|
},
|
|
70
72
|
"peerDependencies": {
|
|
73
|
+
"payload": "4.0.0-internal.ee5d8bd",
|
|
71
74
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
72
|
-
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1"
|
|
73
|
-
"payload": "4.0.0-internal.ea6e8f8"
|
|
74
|
-
},
|
|
75
|
-
"publishConfig": {
|
|
76
|
-
"registry": "https://registry.npmjs.org/"
|
|
75
|
+
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1"
|
|
77
76
|
},
|
|
78
77
|
"homepage:": "https://payloadcms.com",
|
|
79
78
|
"scripts": {
|
|
@@ -82,8 +81,6 @@
|
|
|
82
81
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
83
82
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
84
83
|
"clean": "rimraf -g {dist,*.tsbuildinfo}",
|
|
85
|
-
"copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
|
|
86
|
-
"lint": "eslint .",
|
|
87
|
-
"lint:fix": "eslint . --fix"
|
|
84
|
+
"copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
|
|
88
85
|
}
|
|
89
86
|
}
|