@strapi/i18n 5.13.0-beta.1 → 5.13.0

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.
@@ -175,6 +175,7 @@ var index = {
175
175
  return [];
176
176
  }
177
177
  const hasI18nEnabled = get(contentTypeSchema, [
178
+ 'schema',
178
179
  'pluginOptions',
179
180
  'i18n',
180
181
  'localized'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import get from 'lodash/get';\nimport * as yup from 'yup';\n\nimport { CheckboxConfirmation } from './components/CheckboxConfirmation';\nimport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n} from './components/CMHeaderActions';\nimport {\n DeleteModalAdditionalInfo,\n PublishModalAdditionalInfo,\n UnpublishModalAdditionalInfo,\n} from './components/CMListViewModalsAdditionalInformation';\nimport { LocalePicker } from './components/LocalePicker';\nimport { PERMISSIONS } from './constants';\nimport { mutateEditViewHook } from './contentManagerHooks/editView';\nimport { addColumnToTableHook } from './contentManagerHooks/listView';\nimport { addLocaleToReleasesHook } from './contentReleasesHooks/releaseDetailsView';\nimport { extendCTBAttributeInitialDataMiddleware } from './middlewares/extendCTBAttributeInitialData';\nimport { extendCTBInitialDataMiddleware } from './middlewares/extendCTBInitialData';\nimport { localeMiddleware } from './middlewares/rbac-middleware';\nimport { pluginId } from './pluginId';\nimport { i18nApi } from './services/api';\nimport { LOCALIZED_FIELDS } from './utils/fields';\nimport { getTranslation } from './utils/getTranslation';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\nimport { mutateCTBContentTypeSchema } from './utils/schemas';\n\nimport type { DocumentActionComponent } from '@strapi/content-manager/strapi-admin';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n app.addMiddlewares([extendCTBAttributeInitialDataMiddleware, extendCTBInitialDataMiddleware]);\n app.addMiddlewares([() => i18nApi.middleware]);\n app.addReducers({\n [i18nApi.reducerPath]: i18nApi.reducer,\n });\n app.addRBACMiddleware([localeMiddleware]);\n app.registerPlugin({\n id: pluginId,\n name: pluginId,\n });\n },\n bootstrap(app: any) {\n // // Hook that adds a column into the CM's LV table\n app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', addColumnToTableHook);\n app.registerHook('Admin/CM/pages/EditView/mutate-edit-view-layout', mutateEditViewHook);\n // Hooks that checks if the locale is present in the release\n app.registerHook(\n 'ContentReleases/pages/ReleaseDetails/add-locale-in-releases',\n addLocaleToReleasesHook\n );\n\n // Add the settings link\n app.addSettingsLink('global', {\n intlLabel: {\n id: getTranslation('plugin.name'),\n defaultMessage: 'Internationalization',\n },\n id: 'internationalization',\n to: 'internationalization',\n Component: () =>\n import('./pages/SettingsPage').then((mod) => ({ default: mod.ProtectedSettingsPage })),\n permissions: PERMISSIONS.accessMain,\n });\n\n const contentManager = app.getPlugin('content-manager');\n\n contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n const indexOfDeleteAction = actions.findIndex((action) => action.type === 'delete');\n actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);\n return actions;\n });\n\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n // When enabled the bulk locale publish action should be the first action\n // in 'More Document Actions' and therefore the third action in the array\n actions.splice(2, 0, BulkLocalePublishAction);\n actions.splice(5, 0, BulkLocaleUnpublishAction);\n return actions;\n });\n\n contentManager.injectComponent('listView', 'actions', {\n name: 'i18n-locale-filter',\n Component: LocalePicker,\n });\n\n contentManager.injectComponent('listView', 'publishModalAdditionalInfos', {\n name: 'i18n-publish-bullets-in-modal',\n Component: PublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'unpublishModalAdditionalInfos', {\n name: 'i18n-unpublish-bullets-in-modal',\n Component: UnpublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'deleteModalAdditionalInfos', {\n name: 'i18n-delete-bullets-in-modal',\n Component: DeleteModalAdditionalInfo,\n });\n\n const ctbPlugin = app.getPlugin('content-type-builder');\n\n if (ctbPlugin) {\n const ctbFormsAPI = ctbPlugin.apis.forms;\n ctbFormsAPI.addContentTypeSchemaMutation(mutateCTBContentTypeSchema);\n ctbFormsAPI.components.add({ id: 'checkboxConfirmation', component: CheckboxConfirmation });\n\n ctbFormsAPI.extendContentType({\n validator: () => ({\n i18n: yup.object().shape({\n localized: yup.bool(),\n }),\n }),\n form: {\n advanced() {\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-content-type'),\n defaultMessage: 'Allows translating an entry into different languages',\n },\n type: 'checkboxConfirmation',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-content-type'),\n defaultMessage: 'Localization',\n },\n },\n ];\n },\n },\n });\n\n ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {\n form: {\n advanced({ contentTypeSchema, forTarget, type, step }: any) {\n if (forTarget !== 'contentType') {\n return [];\n }\n\n const hasI18nEnabled = get(\n contentTypeSchema,\n ['pluginOptions', 'i18n', 'localized'],\n false\n );\n\n if (!hasI18nEnabled) {\n return [];\n }\n\n if (type === 'component' && step === '1') {\n return [];\n }\n\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-field'),\n defaultMessage: 'The field can have different values in each locale',\n },\n type: 'checkbox',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-field'),\n defaultMessage: 'Enable localization for this field',\n },\n },\n ];\n },\n },\n });\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["register","app","addMiddlewares","extendCTBAttributeInitialDataMiddleware","extendCTBInitialDataMiddleware","i18nApi","middleware","addReducers","reducerPath","reducer","addRBACMiddleware","localeMiddleware","registerPlugin","id","pluginId","name","bootstrap","registerHook","addColumnToTableHook","mutateEditViewHook","addLocaleToReleasesHook","addSettingsLink","intlLabel","getTranslation","defaultMessage","to","Component","then","mod","default","ProtectedSettingsPage","permissions","PERMISSIONS","accessMain","contentManager","getPlugin","apis","addDocumentHeaderAction","LocalePickerAction","FillFromAnotherLocaleAction","addDocumentAction","actions","indexOfDeleteAction","findIndex","action","type","splice","DeleteLocaleAction","BulkLocalePublishAction","BulkLocaleUnpublishAction","injectComponent","LocalePicker","PublishModalAdditionalInfo","UnpublishModalAdditionalInfo","DeleteModalAdditionalInfo","ctbPlugin","ctbFormsAPI","forms","addContentTypeSchemaMutation","mutateCTBContentTypeSchema","components","add","component","CheckboxConfirmation","extendContentType","validator","i18n","yup","object","shape","localized","bool","form","advanced","description","extendFields","LOCALIZED_FIELDS","contentTypeSchema","forTarget","step","hasI18nEnabled","get","registerTrads","locales","importedTrads","Promise","all","map","locale","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAACC,YAAAA,qEAAAA;AAAyCC,YAAAA;AAA+B,SAAA,CAAA;AAC5FH,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAAC,YAAA,IAAMG,YAAQC;AAAW,SAAA,CAAA;AAC7CL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;AACd,YAAA,CAACF,WAAQG,CAAAA,WAAW,GAAGH,YAAQI;AACjC,SAAA,CAAA;AACAR,QAAAA,GAAAA,CAAIS,iBA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;oCACnBC,cAAgB,EAAA;AAClB,iCAAA;gCACAqB,IAAM,EAAA,UAAA;gCACNvB,SAAW,EAAA;AACTT,oCAAAA,EAAAA,EAAIU,6BAAe,CAAA,0CAAA,CAAA;oCACnBC,cAAgB,EAAA;AAClB;AACF;AACD,yBAAA;AACH;AACF;AACF,aAAA,CAAA;AACF;AACF,KAAA;IACA,MAAM0D,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAQC,CAAAA,GAAG,CACrCH,OAAQI,CAAAA,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1C7D,IAAI,CAAC,CAAC,EAAEE,OAAAA,EAAS4D,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,kDAAyBD,IAAM3E,EAAAA,iBAAAA,CAAAA;AACrC0E,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCG,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPD,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQO,OAAO,CAACR,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import get from 'lodash/get';\nimport * as yup from 'yup';\n\nimport { CheckboxConfirmation } from './components/CheckboxConfirmation';\nimport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n} from './components/CMHeaderActions';\nimport {\n DeleteModalAdditionalInfo,\n PublishModalAdditionalInfo,\n UnpublishModalAdditionalInfo,\n} from './components/CMListViewModalsAdditionalInformation';\nimport { LocalePicker } from './components/LocalePicker';\nimport { PERMISSIONS } from './constants';\nimport { mutateEditViewHook } from './contentManagerHooks/editView';\nimport { addColumnToTableHook } from './contentManagerHooks/listView';\nimport { addLocaleToReleasesHook } from './contentReleasesHooks/releaseDetailsView';\nimport { extendCTBAttributeInitialDataMiddleware } from './middlewares/extendCTBAttributeInitialData';\nimport { extendCTBInitialDataMiddleware } from './middlewares/extendCTBInitialData';\nimport { localeMiddleware } from './middlewares/rbac-middleware';\nimport { pluginId } from './pluginId';\nimport { i18nApi } from './services/api';\nimport { LOCALIZED_FIELDS } from './utils/fields';\nimport { getTranslation } from './utils/getTranslation';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\nimport { mutateCTBContentTypeSchema } from './utils/schemas';\n\nimport type { DocumentActionComponent } from '@strapi/content-manager/strapi-admin';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n app.addMiddlewares([extendCTBAttributeInitialDataMiddleware, extendCTBInitialDataMiddleware]);\n app.addMiddlewares([() => i18nApi.middleware]);\n app.addReducers({\n [i18nApi.reducerPath]: i18nApi.reducer,\n });\n app.addRBACMiddleware([localeMiddleware]);\n app.registerPlugin({\n id: pluginId,\n name: pluginId,\n });\n },\n bootstrap(app: any) {\n // // Hook that adds a column into the CM's LV table\n app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', addColumnToTableHook);\n app.registerHook('Admin/CM/pages/EditView/mutate-edit-view-layout', mutateEditViewHook);\n // Hooks that checks if the locale is present in the release\n app.registerHook(\n 'ContentReleases/pages/ReleaseDetails/add-locale-in-releases',\n addLocaleToReleasesHook\n );\n\n // Add the settings link\n app.addSettingsLink('global', {\n intlLabel: {\n id: getTranslation('plugin.name'),\n defaultMessage: 'Internationalization',\n },\n id: 'internationalization',\n to: 'internationalization',\n Component: () =>\n import('./pages/SettingsPage').then((mod) => ({ default: mod.ProtectedSettingsPage })),\n permissions: PERMISSIONS.accessMain,\n });\n\n const contentManager = app.getPlugin('content-manager');\n\n contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n const indexOfDeleteAction = actions.findIndex((action) => action.type === 'delete');\n actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);\n return actions;\n });\n\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n // When enabled the bulk locale publish action should be the first action\n // in 'More Document Actions' and therefore the third action in the array\n actions.splice(2, 0, BulkLocalePublishAction);\n actions.splice(5, 0, BulkLocaleUnpublishAction);\n return actions;\n });\n\n contentManager.injectComponent('listView', 'actions', {\n name: 'i18n-locale-filter',\n Component: LocalePicker,\n });\n\n contentManager.injectComponent('listView', 'publishModalAdditionalInfos', {\n name: 'i18n-publish-bullets-in-modal',\n Component: PublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'unpublishModalAdditionalInfos', {\n name: 'i18n-unpublish-bullets-in-modal',\n Component: UnpublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'deleteModalAdditionalInfos', {\n name: 'i18n-delete-bullets-in-modal',\n Component: DeleteModalAdditionalInfo,\n });\n\n const ctbPlugin = app.getPlugin('content-type-builder');\n\n if (ctbPlugin) {\n const ctbFormsAPI = ctbPlugin.apis.forms;\n ctbFormsAPI.addContentTypeSchemaMutation(mutateCTBContentTypeSchema);\n ctbFormsAPI.components.add({ id: 'checkboxConfirmation', component: CheckboxConfirmation });\n\n ctbFormsAPI.extendContentType({\n validator: () => ({\n i18n: yup.object().shape({\n localized: yup.bool(),\n }),\n }),\n form: {\n advanced() {\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-content-type'),\n defaultMessage: 'Allows translating an entry into different languages',\n },\n type: 'checkboxConfirmation',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-content-type'),\n defaultMessage: 'Localization',\n },\n },\n ];\n },\n },\n });\n\n ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {\n form: {\n advanced({ contentTypeSchema, forTarget, type, step }: any) {\n if (forTarget !== 'contentType') {\n return [];\n }\n\n const hasI18nEnabled = get(\n contentTypeSchema,\n ['schema', 'pluginOptions', 'i18n', 'localized'],\n false\n );\n\n if (!hasI18nEnabled) {\n return [];\n }\n\n if (type === 'component' && step === '1') {\n return [];\n }\n\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-field'),\n defaultMessage: 'The field can have different values in each locale',\n },\n type: 'checkbox',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-field'),\n defaultMessage: 'Enable localization for this field',\n },\n },\n ];\n },\n },\n });\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["register","app","addMiddlewares","extendCTBAttributeInitialDataMiddleware","extendCTBInitialDataMiddleware","i18nApi","middleware","addReducers","reducerPath","reducer","addRBACMiddleware","localeMiddleware","registerPlugin","id","pluginId","name","bootstrap","registerHook","addColumnToTableHook","mutateEditViewHook","addLocaleToReleasesHook","addSettingsLink","intlLabel","getTranslation","defaultMessage","to","Component","then","mod","default","ProtectedSettingsPage","permissions","PERMISSIONS","accessMain","contentManager","getPlugin","apis","addDocumentHeaderAction","LocalePickerAction","FillFromAnotherLocaleAction","addDocumentAction","actions","indexOfDeleteAction","findIndex","action","type","splice","DeleteLocaleAction","BulkLocalePublishAction","BulkLocaleUnpublishAction","injectComponent","LocalePicker","PublishModalAdditionalInfo","UnpublishModalAdditionalInfo","DeleteModalAdditionalInfo","ctbPlugin","ctbFormsAPI","forms","addContentTypeSchemaMutation","mutateCTBContentTypeSchema","components","add","component","CheckboxConfirmation","extendContentType","validator","i18n","yup","object","shape","localized","bool","form","advanced","description","extendFields","LOCALIZED_FIELDS","contentTypeSchema","forTarget","step","hasI18nEnabled","get","registerTrads","locales","importedTrads","Promise","all","map","locale","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAACC,YAAAA,qEAAAA;AAAyCC,YAAAA;AAA+B,SAAA,CAAA;AAC5FH,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAAC,YAAA,IAAMG,YAAQC;AAAW,SAAA,CAAA;AAC7CL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;AACd,YAAA,CAACF,WAAQG,CAAAA,WAAW,GAAGH,YAAQI;AACjC,SAAA,CAAA;AACAR,QAAAA,GAAAA,CAAIS,iBAAiB,CAAC;AAACC,YAAAA;AAAiB,SAAA,CAAA;AACxCV,QAAAA,GAAAA,CAAIW,cAAc,CAAC;YACjBC,EAAIC,EAAAA,iBAAAA;YACJC,IAAMD,EAAAA;AACR,SAAA,CAAA;AACF,KAAA;AACAE,IAAAA,SAAAA,CAAAA,CAAUf,GAAQ,EAAA;;QAEhBA,GAAIgB,CAAAA,YAAY,CAAC,gDAAkDC,EAAAA,6BAAAA,CAAAA;QACnEjB,GAAIgB,CAAAA,YAAY,CAAC,iDAAmDE,EAAAA,2BAAAA,CAAAA;;QAEpElB,GAAIgB,CAAAA,YAAY,CACd,6DACAG,EAAAA,0CAAAA,CAAAA;;QAIFnB,GAAIoB,CAAAA,eAAe,CAAC,QAAU,EAAA;YAC5BC,SAAW,EAAA;AACTT,gBAAAA,EAAAA,EAAIU,6BAAe,CAAA,aAAA,CAAA;gBACnBC,cAAgB,EAAA;AAClB,aAAA;YACAX,EAAI,EAAA,sBAAA;YACJY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,kDAAyBD,IAAM3E,EAAAA,iBAAAA,CAAAA;AACrC0E,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCG,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPD,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQO,OAAO,CAACR,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
@@ -152,6 +152,7 @@ var index = {
152
152
  return [];
153
153
  }
154
154
  const hasI18nEnabled = get(contentTypeSchema, [
155
+ 'schema',
155
156
  'pluginOptions',
156
157
  'i18n',
157
158
  'localized'
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import get from 'lodash/get';\nimport * as yup from 'yup';\n\nimport { CheckboxConfirmation } from './components/CheckboxConfirmation';\nimport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n} from './components/CMHeaderActions';\nimport {\n DeleteModalAdditionalInfo,\n PublishModalAdditionalInfo,\n UnpublishModalAdditionalInfo,\n} from './components/CMListViewModalsAdditionalInformation';\nimport { LocalePicker } from './components/LocalePicker';\nimport { PERMISSIONS } from './constants';\nimport { mutateEditViewHook } from './contentManagerHooks/editView';\nimport { addColumnToTableHook } from './contentManagerHooks/listView';\nimport { addLocaleToReleasesHook } from './contentReleasesHooks/releaseDetailsView';\nimport { extendCTBAttributeInitialDataMiddleware } from './middlewares/extendCTBAttributeInitialData';\nimport { extendCTBInitialDataMiddleware } from './middlewares/extendCTBInitialData';\nimport { localeMiddleware } from './middlewares/rbac-middleware';\nimport { pluginId } from './pluginId';\nimport { i18nApi } from './services/api';\nimport { LOCALIZED_FIELDS } from './utils/fields';\nimport { getTranslation } from './utils/getTranslation';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\nimport { mutateCTBContentTypeSchema } from './utils/schemas';\n\nimport type { DocumentActionComponent } from '@strapi/content-manager/strapi-admin';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n app.addMiddlewares([extendCTBAttributeInitialDataMiddleware, extendCTBInitialDataMiddleware]);\n app.addMiddlewares([() => i18nApi.middleware]);\n app.addReducers({\n [i18nApi.reducerPath]: i18nApi.reducer,\n });\n app.addRBACMiddleware([localeMiddleware]);\n app.registerPlugin({\n id: pluginId,\n name: pluginId,\n });\n },\n bootstrap(app: any) {\n // // Hook that adds a column into the CM's LV table\n app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', addColumnToTableHook);\n app.registerHook('Admin/CM/pages/EditView/mutate-edit-view-layout', mutateEditViewHook);\n // Hooks that checks if the locale is present in the release\n app.registerHook(\n 'ContentReleases/pages/ReleaseDetails/add-locale-in-releases',\n addLocaleToReleasesHook\n );\n\n // Add the settings link\n app.addSettingsLink('global', {\n intlLabel: {\n id: getTranslation('plugin.name'),\n defaultMessage: 'Internationalization',\n },\n id: 'internationalization',\n to: 'internationalization',\n Component: () =>\n import('./pages/SettingsPage').then((mod) => ({ default: mod.ProtectedSettingsPage })),\n permissions: PERMISSIONS.accessMain,\n });\n\n const contentManager = app.getPlugin('content-manager');\n\n contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n const indexOfDeleteAction = actions.findIndex((action) => action.type === 'delete');\n actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);\n return actions;\n });\n\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n // When enabled the bulk locale publish action should be the first action\n // in 'More Document Actions' and therefore the third action in the array\n actions.splice(2, 0, BulkLocalePublishAction);\n actions.splice(5, 0, BulkLocaleUnpublishAction);\n return actions;\n });\n\n contentManager.injectComponent('listView', 'actions', {\n name: 'i18n-locale-filter',\n Component: LocalePicker,\n });\n\n contentManager.injectComponent('listView', 'publishModalAdditionalInfos', {\n name: 'i18n-publish-bullets-in-modal',\n Component: PublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'unpublishModalAdditionalInfos', {\n name: 'i18n-unpublish-bullets-in-modal',\n Component: UnpublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'deleteModalAdditionalInfos', {\n name: 'i18n-delete-bullets-in-modal',\n Component: DeleteModalAdditionalInfo,\n });\n\n const ctbPlugin = app.getPlugin('content-type-builder');\n\n if (ctbPlugin) {\n const ctbFormsAPI = ctbPlugin.apis.forms;\n ctbFormsAPI.addContentTypeSchemaMutation(mutateCTBContentTypeSchema);\n ctbFormsAPI.components.add({ id: 'checkboxConfirmation', component: CheckboxConfirmation });\n\n ctbFormsAPI.extendContentType({\n validator: () => ({\n i18n: yup.object().shape({\n localized: yup.bool(),\n }),\n }),\n form: {\n advanced() {\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-content-type'),\n defaultMessage: 'Allows translating an entry into different languages',\n },\n type: 'checkboxConfirmation',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-content-type'),\n defaultMessage: 'Localization',\n },\n },\n ];\n },\n },\n });\n\n ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {\n form: {\n advanced({ contentTypeSchema, forTarget, type, step }: any) {\n if (forTarget !== 'contentType') {\n return [];\n }\n\n const hasI18nEnabled = get(\n contentTypeSchema,\n ['pluginOptions', 'i18n', 'localized'],\n false\n );\n\n if (!hasI18nEnabled) {\n return [];\n }\n\n if (type === 'component' && step === '1') {\n return [];\n }\n\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-field'),\n defaultMessage: 'The field can have different values in each locale',\n },\n type: 'checkbox',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-field'),\n defaultMessage: 'Enable localization for this field',\n },\n },\n ];\n },\n },\n });\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["register","app","addMiddlewares","extendCTBAttributeInitialDataMiddleware","extendCTBInitialDataMiddleware","i18nApi","middleware","addReducers","reducerPath","reducer","addRBACMiddleware","localeMiddleware","registerPlugin","id","pluginId","name","bootstrap","registerHook","addColumnToTableHook","mutateEditViewHook","addLocaleToReleasesHook","addSettingsLink","intlLabel","getTranslation","defaultMessage","to","Component","then","mod","default","ProtectedSettingsPage","permissions","PERMISSIONS","accessMain","contentManager","getPlugin","apis","addDocumentHeaderAction","LocalePickerAction","FillFromAnotherLocaleAction","addDocumentAction","actions","indexOfDeleteAction","findIndex","action","type","splice","DeleteLocaleAction","BulkLocalePublishAction","BulkLocaleUnpublishAction","injectComponent","LocalePicker","PublishModalAdditionalInfo","UnpublishModalAdditionalInfo","DeleteModalAdditionalInfo","ctbPlugin","ctbFormsAPI","forms","addContentTypeSchemaMutation","mutateCTBContentTypeSchema","components","add","component","CheckboxConfirmation","extendContentType","validator","i18n","yup","object","shape","localized","bool","form","advanced","description","extendFields","LOCALIZED_FIELDS","contentTypeSchema","forTarget","step","hasI18nEnabled","get","registerTrads","locales","importedTrads","Promise","all","map","locale","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAACC,YAAAA,uCAAAA;AAAyCC,YAAAA;AAA+B,SAAA,CAAA;AAC5FH,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAAC,YAAA,IAAMG,QAAQC;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,4BAAA,OAAO,EAAE;AACX;wBAEA,OAAO;AACL,4BAAA;gCACEhE,IAAM,EAAA,8BAAA;gCACN2D,WAAa,EAAA;AACX7D,oCAAAA,EAAAA,EAAIU,cAAe,CAAA,gDAAA,CAAA;oCACnBC,cAAgB,EAAA;AAClB,iCAAA;gCACAqB,IAAM,EAAA,UAAA;gCACNvB,SAAW,EAAA;AACTT,oCAAAA,EAAAA,EAAIU,cAAe,CAAA,0CAAA,CAAA;oCACnBC,cAAgB,EAAA;AAClB;AACF;AACD,yBAAA;AACH;AACF;AACF,aAAA,CAAA;AACF;AACF,KAAA;IACA,MAAM0D,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAQC,CAAAA,GAAG,CACrCH,OAAQI,CAAAA,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1C7D,IAAI,CAAC,CAAC,EAAEE,OAAAA,EAAS4D,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAM3E,EAAAA,QAAAA,CAAAA;AACrC0E,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCG,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPD,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQO,OAAO,CAACR,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import get from 'lodash/get';\nimport * as yup from 'yup';\n\nimport { CheckboxConfirmation } from './components/CheckboxConfirmation';\nimport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n} from './components/CMHeaderActions';\nimport {\n DeleteModalAdditionalInfo,\n PublishModalAdditionalInfo,\n UnpublishModalAdditionalInfo,\n} from './components/CMListViewModalsAdditionalInformation';\nimport { LocalePicker } from './components/LocalePicker';\nimport { PERMISSIONS } from './constants';\nimport { mutateEditViewHook } from './contentManagerHooks/editView';\nimport { addColumnToTableHook } from './contentManagerHooks/listView';\nimport { addLocaleToReleasesHook } from './contentReleasesHooks/releaseDetailsView';\nimport { extendCTBAttributeInitialDataMiddleware } from './middlewares/extendCTBAttributeInitialData';\nimport { extendCTBInitialDataMiddleware } from './middlewares/extendCTBInitialData';\nimport { localeMiddleware } from './middlewares/rbac-middleware';\nimport { pluginId } from './pluginId';\nimport { i18nApi } from './services/api';\nimport { LOCALIZED_FIELDS } from './utils/fields';\nimport { getTranslation } from './utils/getTranslation';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\nimport { mutateCTBContentTypeSchema } from './utils/schemas';\n\nimport type { DocumentActionComponent } from '@strapi/content-manager/strapi-admin';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n app.addMiddlewares([extendCTBAttributeInitialDataMiddleware, extendCTBInitialDataMiddleware]);\n app.addMiddlewares([() => i18nApi.middleware]);\n app.addReducers({\n [i18nApi.reducerPath]: i18nApi.reducer,\n });\n app.addRBACMiddleware([localeMiddleware]);\n app.registerPlugin({\n id: pluginId,\n name: pluginId,\n });\n },\n bootstrap(app: any) {\n // // Hook that adds a column into the CM's LV table\n app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', addColumnToTableHook);\n app.registerHook('Admin/CM/pages/EditView/mutate-edit-view-layout', mutateEditViewHook);\n // Hooks that checks if the locale is present in the release\n app.registerHook(\n 'ContentReleases/pages/ReleaseDetails/add-locale-in-releases',\n addLocaleToReleasesHook\n );\n\n // Add the settings link\n app.addSettingsLink('global', {\n intlLabel: {\n id: getTranslation('plugin.name'),\n defaultMessage: 'Internationalization',\n },\n id: 'internationalization',\n to: 'internationalization',\n Component: () =>\n import('./pages/SettingsPage').then((mod) => ({ default: mod.ProtectedSettingsPage })),\n permissions: PERMISSIONS.accessMain,\n });\n\n const contentManager = app.getPlugin('content-manager');\n\n contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n const indexOfDeleteAction = actions.findIndex((action) => action.type === 'delete');\n actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);\n return actions;\n });\n\n contentManager.apis.addDocumentAction((actions: DocumentActionComponent[]) => {\n // When enabled the bulk locale publish action should be the first action\n // in 'More Document Actions' and therefore the third action in the array\n actions.splice(2, 0, BulkLocalePublishAction);\n actions.splice(5, 0, BulkLocaleUnpublishAction);\n return actions;\n });\n\n contentManager.injectComponent('listView', 'actions', {\n name: 'i18n-locale-filter',\n Component: LocalePicker,\n });\n\n contentManager.injectComponent('listView', 'publishModalAdditionalInfos', {\n name: 'i18n-publish-bullets-in-modal',\n Component: PublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'unpublishModalAdditionalInfos', {\n name: 'i18n-unpublish-bullets-in-modal',\n Component: UnpublishModalAdditionalInfo,\n });\n\n contentManager.injectComponent('listView', 'deleteModalAdditionalInfos', {\n name: 'i18n-delete-bullets-in-modal',\n Component: DeleteModalAdditionalInfo,\n });\n\n const ctbPlugin = app.getPlugin('content-type-builder');\n\n if (ctbPlugin) {\n const ctbFormsAPI = ctbPlugin.apis.forms;\n ctbFormsAPI.addContentTypeSchemaMutation(mutateCTBContentTypeSchema);\n ctbFormsAPI.components.add({ id: 'checkboxConfirmation', component: CheckboxConfirmation });\n\n ctbFormsAPI.extendContentType({\n validator: () => ({\n i18n: yup.object().shape({\n localized: yup.bool(),\n }),\n }),\n form: {\n advanced() {\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-content-type'),\n defaultMessage: 'Allows translating an entry into different languages',\n },\n type: 'checkboxConfirmation',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-content-type'),\n defaultMessage: 'Localization',\n },\n },\n ];\n },\n },\n });\n\n ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {\n form: {\n advanced({ contentTypeSchema, forTarget, type, step }: any) {\n if (forTarget !== 'contentType') {\n return [];\n }\n\n const hasI18nEnabled = get(\n contentTypeSchema,\n ['schema', 'pluginOptions', 'i18n', 'localized'],\n false\n );\n\n if (!hasI18nEnabled) {\n return [];\n }\n\n if (type === 'component' && step === '1') {\n return [];\n }\n\n return [\n {\n name: 'pluginOptions.i18n.localized',\n description: {\n id: getTranslation('plugin.schema.i18n.localized.description-field'),\n defaultMessage: 'The field can have different values in each locale',\n },\n type: 'checkbox',\n intlLabel: {\n id: getTranslation('plugin.schema.i18n.localized.label-field'),\n defaultMessage: 'Enable localization for this field',\n },\n },\n ];\n },\n },\n });\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["register","app","addMiddlewares","extendCTBAttributeInitialDataMiddleware","extendCTBInitialDataMiddleware","i18nApi","middleware","addReducers","reducerPath","reducer","addRBACMiddleware","localeMiddleware","registerPlugin","id","pluginId","name","bootstrap","registerHook","addColumnToTableHook","mutateEditViewHook","addLocaleToReleasesHook","addSettingsLink","intlLabel","getTranslation","defaultMessage","to","Component","then","mod","default","ProtectedSettingsPage","permissions","PERMISSIONS","accessMain","contentManager","getPlugin","apis","addDocumentHeaderAction","LocalePickerAction","FillFromAnotherLocaleAction","addDocumentAction","actions","indexOfDeleteAction","findIndex","action","type","splice","DeleteLocaleAction","BulkLocalePublishAction","BulkLocaleUnpublishAction","injectComponent","LocalePicker","PublishModalAdditionalInfo","UnpublishModalAdditionalInfo","DeleteModalAdditionalInfo","ctbPlugin","ctbFormsAPI","forms","addContentTypeSchemaMutation","mutateCTBContentTypeSchema","components","add","component","CheckboxConfirmation","extendContentType","validator","i18n","yup","object","shape","localized","bool","form","advanced","description","extendFields","LOCALIZED_FIELDS","contentTypeSchema","forTarget","step","hasI18nEnabled","get","registerTrads","locales","importedTrads","Promise","all","map","locale","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAACC,YAAAA,uCAAAA;AAAyCC,YAAAA;AAA+B,SAAA,CAAA;AAC5FH,QAAAA,GAAAA,CAAIC,cAAc,CAAC;AAAC,YAAA,IAAMG,QAAQC;AAAW,SAAA,CAAA;AAC7CL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;AACd,YAAA,CAACF,OAAQG,CAAAA,WAAW,GAAGH,QAAQI;AACjC,SAAA,CAAA;AACAR,QAAAA,GAAAA,CAAIS,iBAAiB,CAAC;AAACC,YAAAA;AAAiB,SAAA,CAAA;AACxCV,QAAAA,GAAAA,CAAIW,cAAc,CAAC;YACjBC,EAAIC,EAAAA,QAAAA;YACJC,IAAMD,EAAAA;AACR,SAAA,CAAA;AACF,KAAA;AACAE,IAAAA,SAAAA,CAAAA,CAAUf,GAAQ,EAAA;;QAEhBA,GAAIgB,CAAAA,YAAY,CAAC,gDAAkDC,EAAAA,oBAAAA,CAAAA;QACnEjB,GAAIgB,CAAAA,YAAY,CAAC,iDAAmDE,EAAAA,kBAAAA,CAAAA;;QAEpElB,GAAIgB,CAAAA,YAAY,CACd,6DACAG,EAAAA,uBAAAA,CAAAA;;QAIFnB,GAAIoB,CAAAA,eAAe,CAAC,QAAU,EAAA;YAC5BC,SAAW,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CAAA,CAC1C7D,IAAI,CAAC,CAAC,EAAEE,OAAAA,EAAS4D,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAM3E,EAAAA,QAAAA,CAAAA;AACrC0E,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCG,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPD,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQO,OAAO,CAACR,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
@@ -4,38 +4,35 @@ var get = require('lodash/get');
4
4
 
5
5
  const extendCTBAttributeInitialDataMiddleware = ()=>{
6
6
  return ({ getState })=>(next)=>(action)=>{
7
- const enhanceAction = ({ uid })=>{
7
+ const enhanceAction = ()=>{
8
8
  // the block here is to catch the error when trying to access the state
9
9
  // of the ctb when the plugin is not mounted
10
10
  try {
11
11
  const store = getState();
12
- const type = get(store, [
12
+ const hasi18nEnabled = get(store, [
13
13
  'content-type-builder_dataManagerProvider',
14
- 'current',
15
- 'contentTypes',
16
- uid
17
- ]);
18
- if (!type || type.modelType !== 'contentType') {
19
- return next(action);
20
- }
21
- const hasi18nEnabled = get(type, [
14
+ 'modifiedData',
15
+ 'contentType',
16
+ 'schema',
22
17
  'pluginOptions',
23
18
  'i18n',
24
19
  'localized'
25
20
  ], false);
26
21
  if (hasi18nEnabled) {
22
+ const pluginOptions = action.options ? {
23
+ ...action.options.pluginOptions,
24
+ i18n: {
25
+ localized: true
26
+ }
27
+ } : {
28
+ i18n: {
29
+ localized: true
30
+ }
31
+ };
27
32
  return next({
28
33
  ...action,
29
- payload: {
30
- ...action.payload,
31
- options: {
32
- pluginOptions: {
33
- ...action?.payload?.options?.pluginOptions ?? {},
34
- i18n: {
35
- localized: true
36
- }
37
- }
38
- }
34
+ options: {
35
+ pluginOptions
39
36
  }
40
37
  });
41
38
  }
@@ -44,24 +41,17 @@ const extendCTBAttributeInitialDataMiddleware = ()=>{
44
41
  return next(action);
45
42
  }
46
43
  };
47
- const { payload = {}, type } = action ?? {};
48
- if (type === 'formModal/setAttributeDataSchema' && ![
44
+ if (action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' && action.forTarget === 'contentType' && ![
49
45
  'relation',
50
46
  'component'
51
- ].includes(payload.attributeType) && !payload.isEditing) {
52
- return enhanceAction({
53
- uid: payload.uid
54
- });
47
+ ].includes(action.attributeType) && !action.isEditing) {
48
+ return enhanceAction();
55
49
  }
56
- if (type === 'formModal/setCustomFieldDataSchema' && !payload.isEditing) {
57
- return enhanceAction({
58
- uid: payload.uid
59
- });
50
+ if (action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' && action.forTarget === 'contentType' && !action.isEditing) {
51
+ return enhanceAction();
60
52
  }
61
- if (type === 'formModal/resetPropsAndSetFormForAddingAnExistingCompo' || type === 'formModal/resetPropsAndSaveCurrentData') {
62
- return enhanceAction({
63
- uid: payload.uid
64
- });
53
+ if ((action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' || action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') && action.forTarget === 'contentType') {
54
+ return enhanceAction();
65
55
  }
66
56
  return next(action);
67
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"extendCTBAttributeInitialData.js","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = ({ uid }: { uid: string }) => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const type = get(store, [\n 'content-type-builder_dataManagerProvider',\n 'current',\n 'contentTypes',\n uid,\n ]);\n\n if (!type || type.modelType !== 'contentType') {\n return next(action);\n }\n\n const hasi18nEnabled = get(type, ['pluginOptions', 'i18n', 'localized'], false);\n\n if (hasi18nEnabled) {\n return next({\n ...action,\n payload: {\n ...action.payload,\n options: {\n pluginOptions: {\n ...(action?.payload?.options?.pluginOptions ?? {}),\n i18n: {\n localized: true,\n },\n },\n },\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n const { payload = {}, type } = action ?? {};\n\n if (\n type === 'formModal/setAttributeDataSchema' &&\n !['relation', 'component'].includes(payload.attributeType) &&\n !payload.isEditing\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (type === 'formModal/setCustomFieldDataSchema' && !payload.isEditing) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (\n type === 'formModal/resetPropsAndSetFormForAddingAnExistingCompo' ||\n type === 'formModal/resetPropsAndSaveCurrentData'\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","uid","store","type","get","modelType","hasi18nEnabled","payload","options","pluginOptions","i18n","localized","err","includes","attributeType","isEditing"],"mappings":";;;;AAKA,MAAMA,uCAGF,GAAA,IAAA;AACF,IAAA,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAClB,CAACC,OACD,CAACC,MAAAA,GAAAA;AACC,gBAAA,MAAMC,aAAgB,GAAA,CAAC,EAAEC,GAAG,EAAmB,GAAA;;;oBAG7C,IAAI;AACF,wBAAA,MAAMC,KAAQL,GAAAA,QAAAA,EAAAA;wBAEd,MAAMM,IAAAA,GAAOC,IAAIF,KAAO,EAAA;AACtB,4BAAA,0CAAA;AAC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AS,EAAE;AACvE,oBAAA,OAAOf,aAAc,CAAA;AACnBC,wBAAAA,GAAAA,EAAKM,QAAQN;AACf,qBAAA,CAAA;AACF;gBAEA,IACEE,IAAAA,KAAS,wDACTA,IAAAA,IAAAA,KAAS,wCACT,EAAA;AACA,oBAAA,OAAOH,aAAc,CAAA;AACnBC,wBAAAA,GAAAA,EAAKM,QAAQN;AACf,qBAAA,CAAA;AACF;AAEA,gBAAA,OAAOH,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACJ;;;;"}
1
+ {"version":3,"file":"extendCTBAttributeInitialData.js","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = () => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const hasi18nEnabled = get(\n store,\n [\n 'content-type-builder_dataManagerProvider',\n 'modifiedData',\n 'contentType',\n 'schema',\n 'pluginOptions',\n 'i18n',\n 'localized',\n ],\n false\n );\n\n if (hasi18nEnabled) {\n const pluginOptions = action.options\n ? { ...action.options.pluginOptions, i18n: { localized: true } }\n : { i18n: { localized: true } };\n\n return next({\n ...action,\n options: {\n pluginOptions,\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !['relation', 'component'].includes(action.attributeType) &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n (action.type ===\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' ||\n action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') &&\n action.forTarget === 'contentType'\n ) {\n return enhanceAction();\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","store","hasi18nEnabled","get","pluginOptions","options","i18n","localized","err","type","forTarget","includes","attributeType","isEditing"],"mappings":";;;;AAKA,MAAMA,uCAGF,GAAA,IAAA;AACF,IAAA,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAClB,CAACC,OACD,CAACC,MAAAA,GAAAA;AACC,gBAAA,MAAMC,aAAgB,GAAA,IAAA;;;oBAGpB,IAAI;AACF,wBAAA,MAAMC,KAAQJ,GAAAA,QAAAA,EAAAA;wBAEd,MAAMK,cAAAA,GAAiBC,IACrBF,KACA,EAAA;AACE,4BAAA,0CAAA;AACA,4BAAA,cAAA;AACA,4BAAA,aAAA;AACA,4BAAA,QAAA;AACA,4BAAA,eAAA;AACA,4BAAA,MAAA;AACA,4BAAA;yBACD,EACD,KAAA,CAAA;AAGF,wBAAA,IAAIC,cAAgB,EAAA;4BAClB,MAAME,aAAAA,GAAgBL,MAAOM,CAAAA,OAAO,GAChC;gCAAE,GAAGN,MAAAA,CAAOM,OAAO,CAACD,aAAa;gCAAEE,IAAM,EAAA;oCAAEC,SAAW,EAAA;AAAK;6BAC3D,GAAA;gCAAED,IAAM,EAAA;oCAAEC,SAAW,EAAA;AAAK;AAAE,6BAAA;AAEhC,4BAAA,OAAOT,IAAK,CAAA;AACV,gCAAA,GAAGC,MAAM;gCACTM,OAAS,EAAA;AACPD,oCAAAA;AACF;AACF,6BAAA,CAAA;AACF;AAEA,wBAAA,OAAON,IAAKC,CAAAA,MAAAA,CAAAA;AACd,qBAAA,CAAE,OAAOS,GAAK,EAAA;AACZ,wBAAA,OAAOV,IAAKC,CAAAA,MAAAA,CAAAA;AACd;AACF,iBAAA;gBAEA,IACEA,MAAAA,CAAOU,IAAI,KAAK,wDAAA,IAChBV,OAAOW,SAAS,KAAK,iBACrB,CAAC;AAAC,oBAAA,UAAA;AAAY,oBAAA;iBAAY,CAACC,QAAQ,CAACZ,MAAOa,CAAAA,aAAa,KACxD,CAACb,MAAAA,CAAOc,SAAS,EACjB;oBACA,OAAOb,aAAAA,EAAAA;AACT;gBAEA,IACED,MAAAA,CAAOU,IAAI,KAAK,2DAChBV,IAAAA,MAAAA,CAAOW,SAAS,KAAK,aACrB,IAAA,CAACX,MAAOc,CAAAA,SAAS,EACjB;oBACA,OAAOb,aAAAA,EAAAA;AACT;AAEA,gBAAA,IACE,CAACD,MAAOU,CAAAA,IAAI,KACV,oFACAV,IAAAA,MAAAA,CAAOU,IAAI,KAAK,gEAA+D,KACjFV,MAAOW,CAAAA,SAAS,KAAK,aACrB,EAAA;oBACA,OAAOV,aAAAA,EAAAA;AACT;AAEA,gBAAA,OAAOF,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACJ;;;;"}
@@ -2,38 +2,35 @@ import get from 'lodash/get';
2
2
 
3
3
  const extendCTBAttributeInitialDataMiddleware = ()=>{
4
4
  return ({ getState })=>(next)=>(action)=>{
5
- const enhanceAction = ({ uid })=>{
5
+ const enhanceAction = ()=>{
6
6
  // the block here is to catch the error when trying to access the state
7
7
  // of the ctb when the plugin is not mounted
8
8
  try {
9
9
  const store = getState();
10
- const type = get(store, [
10
+ const hasi18nEnabled = get(store, [
11
11
  'content-type-builder_dataManagerProvider',
12
- 'current',
13
- 'contentTypes',
14
- uid
15
- ]);
16
- if (!type || type.modelType !== 'contentType') {
17
- return next(action);
18
- }
19
- const hasi18nEnabled = get(type, [
12
+ 'modifiedData',
13
+ 'contentType',
14
+ 'schema',
20
15
  'pluginOptions',
21
16
  'i18n',
22
17
  'localized'
23
18
  ], false);
24
19
  if (hasi18nEnabled) {
20
+ const pluginOptions = action.options ? {
21
+ ...action.options.pluginOptions,
22
+ i18n: {
23
+ localized: true
24
+ }
25
+ } : {
26
+ i18n: {
27
+ localized: true
28
+ }
29
+ };
25
30
  return next({
26
31
  ...action,
27
- payload: {
28
- ...action.payload,
29
- options: {
30
- pluginOptions: {
31
- ...action?.payload?.options?.pluginOptions ?? {},
32
- i18n: {
33
- localized: true
34
- }
35
- }
36
- }
32
+ options: {
33
+ pluginOptions
37
34
  }
38
35
  });
39
36
  }
@@ -42,24 +39,17 @@ const extendCTBAttributeInitialDataMiddleware = ()=>{
42
39
  return next(action);
43
40
  }
44
41
  };
45
- const { payload = {}, type } = action ?? {};
46
- if (type === 'formModal/setAttributeDataSchema' && ![
42
+ if (action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' && action.forTarget === 'contentType' && ![
47
43
  'relation',
48
44
  'component'
49
- ].includes(payload.attributeType) && !payload.isEditing) {
50
- return enhanceAction({
51
- uid: payload.uid
52
- });
45
+ ].includes(action.attributeType) && !action.isEditing) {
46
+ return enhanceAction();
53
47
  }
54
- if (type === 'formModal/setCustomFieldDataSchema' && !payload.isEditing) {
55
- return enhanceAction({
56
- uid: payload.uid
57
- });
48
+ if (action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' && action.forTarget === 'contentType' && !action.isEditing) {
49
+ return enhanceAction();
58
50
  }
59
- if (type === 'formModal/resetPropsAndSetFormForAddingAnExistingCompo' || type === 'formModal/resetPropsAndSaveCurrentData') {
60
- return enhanceAction({
61
- uid: payload.uid
62
- });
51
+ if ((action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' || action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') && action.forTarget === 'contentType') {
52
+ return enhanceAction();
63
53
  }
64
54
  return next(action);
65
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"extendCTBAttributeInitialData.mjs","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = ({ uid }: { uid: string }) => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const type = get(store, [\n 'content-type-builder_dataManagerProvider',\n 'current',\n 'contentTypes',\n uid,\n ]);\n\n if (!type || type.modelType !== 'contentType') {\n return next(action);\n }\n\n const hasi18nEnabled = get(type, ['pluginOptions', 'i18n', 'localized'], false);\n\n if (hasi18nEnabled) {\n return next({\n ...action,\n payload: {\n ...action.payload,\n options: {\n pluginOptions: {\n ...(action?.payload?.options?.pluginOptions ?? {}),\n i18n: {\n localized: true,\n },\n },\n },\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n const { payload = {}, type } = action ?? {};\n\n if (\n type === 'formModal/setAttributeDataSchema' &&\n !['relation', 'component'].includes(payload.attributeType) &&\n !payload.isEditing\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (type === 'formModal/setCustomFieldDataSchema' && !payload.isEditing) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n if (\n type === 'formModal/resetPropsAndSetFormForAddingAnExistingCompo' ||\n type === 'formModal/resetPropsAndSaveCurrentData'\n ) {\n return enhanceAction({\n uid: payload.uid,\n });\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","uid","store","type","get","modelType","hasi18nEnabled","payload","options","pluginOptions","i18n","localized","err","includes","attributeType","isEditing"],"m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BAE1C,IACEI,IAAAA,KAAS,sCACT,CAAC;AAAC,oBAAA,UAAA;AAAY,oBAAA;iBAAY,CAACU,QAAQ,CAACN,OAAQO,CAAAA,aAAa,KACzD,CAACP,OAAAA,CAAQQ,SAAS,EAClB;AACA,oBAAA,OAAOf,aAAc,CAAA;AACnBC,wBAAAA,GAAAA,EAAKM,QAAQN;AACf,qBAAA,CAAA;AACF;AAEA,gBAAA,IAAIE,IAAS,KAAA,oCAAA,IAAwC,CAACI,OAAAA,CAAQQ,SAAS,EAAE;AACvE,oBAAA,OAAOf,aAAc,CAAA;AACnBC,wBAAAA,GAAAA,EAAKM,QAAQN;AACf,qBAAA,CAAA;AACF;gBAEA,IACEE,IAAAA,KAAS,wDACTA,IAAAA,IAAAA,KAAS,wCACT,EAAA;AACA,oBAAA,OAAOH,aAAc,CAAA;AACnBC,wBAAAA,GAAAA,EAAKM,QAAQN;AACf,qBAAA,CAAA;AACF;AAEA,gBAAA,OAAOH,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACJ;;;;"}
1
+ {"version":3,"file":"extendCTBAttributeInitialData.mjs","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = () => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const hasi18nEnabled = get(\n store,\n [\n 'content-type-builder_dataManagerProvider',\n 'modifiedData',\n 'contentType',\n 'schema',\n 'pluginOptions',\n 'i18n',\n 'localized',\n ],\n false\n );\n\n if (hasi18nEnabled) {\n const pluginOptions = action.options\n ? { ...action.options.pluginOptions, i18n: { localized: true } }\n : { i18n: { localized: true } };\n\n return next({\n ...action,\n options: {\n pluginOptions,\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !['relation', 'component'].includes(action.attributeType) &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n (action.type ===\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' ||\n action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') &&\n action.forTarget === 'contentType'\n ) {\n return enhanceAction();\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","store","hasi18nEnabled","get","pluginOptions","options","i18n","localized","err","type","forTarget","includes","attributeType","isEditing"],"mappings":";;AAKA,MAAMA,uCAGF,GAAA,IAAA;AACF,IAAA,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAClB,CAACC,OACD,CAACC,MAAAA,GAAAA;AACC,gBAAA,MAAMC,aAAgB,GAAA,IAAA;;;oBAGpB,IAAI;AACF,wBAAA,MAAMC,KAAQJ,GAAAA,QAAAA,EAAAA;wBAEd,MAAMK,cAAAA,GAAiBC,IACrBF,KACA,EAAA;AACE,4BAAA,0CAAA;AACA,4BAAA,cAAA;AACA,4BAAA,aAAA;AACA,4BAAA,QAAA;AACA,4BAAA,eAAA;AACA,4BAAA,MAAA;AACA,4BAAA;yBACD,EACD,KAAA,CAAA;AAGF,wBAAA,IAAIC,cAAgB,EAAA;4BAClB,MAAME,aAAAA,GAAgBL,MAAOM,CAAAA,OAAO,GAChC;gCAAE,GAAGN,MAAAA,CAAOM,OAAO,CAACD,aAAa;gCAAEE,IAAM,EAAA;oCAAEC,SAAW,EAAA;AAAK;6BAC3D,GAAA;gCAAED,IAAM,EAAA;oCAAEC,SAAW,EAAA;AAAK;AAAE,6BAAA;AAEhC,4BAAA,OAAOT,IAAK,CAAA;AACV,gCAAA,GAAGC,MAAM;gCACTM,OAAS,EAAA;AACPD,oCAAAA;AACF;AACF,6BAAA,CAAA;AACF;AAEA,wBAAA,OAAON,IAAKC,CAAAA,MAAAA,CAAAA;AACd,qBAAA,CAAE,OAAOS,GAAK,EAAA;AACZ,wBAAA,OAAOV,IAAKC,CAAAA,MAAAA,CAAAA;AACd;AACF,iBAAA;gBAEA,IACEA,MAAAA,CAAOU,IAAI,KAAK,wDAAA,IAChBV,OAAOW,SAAS,KAAK,iBACrB,CAAC;AAAC,oBAAA,UAAA;AAAY,oBAAA;iBAAY,CAACC,QAAQ,CAACZ,MAAOa,CAAAA,aAAa,KACxD,CAACb,MAAAA,CAAOc,SAAS,EACjB;oBACA,OAAOb,aAAAA,EAAAA;AACT;gBAEA,IACED,MAAAA,CAAOU,IAAI,KAAK,2DAChBV,IAAAA,MAAAA,CAAOW,SAAS,KAAK,aACrB,IAAA,CAACX,MAAOc,CAAAA,SAAS,EACjB;oBACA,OAAOb,aAAAA,EAAAA;AACT;AAEA,gBAAA,IACE,CAACD,MAAOU,CAAAA,IAAI,KACV,oFACAV,IAAAA,MAAAA,CAAOU,IAAI,KAAK,gEAA+D,KACjFV,MAAOW,CAAAA,SAAS,KAAK,aACrB,EAAA;oBACA,OAAOV,aAAAA,EAAAA;AACT;AAEA,gBAAA,OAAOF,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACJ;;;;"}
@@ -1,433 +1,25 @@
1
1
  import type { Schema } from '@strapi/types';
2
- declare const mutateCTBContentTypeSchema: (nextSchema: {
3
- pluginOptions: Schema.ContentType['pluginOptions'];
4
- attributes: Schema.Attribute.AnyAttribute[];
2
+ declare const mutateCTBContentTypeSchema: (nextSchema: Schema.ContentType, prevSchema?: {
3
+ apiID?: string;
4
+ schema?: Schema.ContentType;
5
5
  uid?: string;
6
- }, prevSchema?: {
7
- pluginOptions: Schema.ContentType['pluginOptions'];
8
- attributes: Schema.Attribute.AnyAttribute[];
9
- uid?: string;
10
- }) => {
11
- pluginOptions: Schema.ContentType['pluginOptions'];
12
- attributes: Schema.Attribute.AnyAttribute[];
13
- uid?: string | undefined;
14
- } | {
6
+ }) => import("@strapi/types/dist/struct").ContentTypeSchema | {
15
7
  pluginOptions: Pick<{
16
8
  i18n: {
17
9
  localized: boolean;
18
10
  };
19
11
  }, never>;
20
- attributes: Pick<{
21
- type: "biginteger";
22
- pluginOptions?: object | undefined;
23
- searchable?: boolean | undefined;
24
- column?: Partial<Schema.Attribute.Column> | undefined;
25
- configurable?: boolean | undefined;
26
- default?: string | (() => string) | undefined;
27
- min?: string | undefined;
28
- max?: string | undefined;
29
- private?: boolean | undefined;
30
- required?: boolean | undefined;
31
- writable?: boolean | undefined;
32
- visible?: boolean | undefined;
33
- unique?: boolean | undefined;
34
- } | {
35
- type: "boolean";
36
- pluginOptions?: object | undefined;
37
- searchable?: boolean | undefined;
38
- column?: Partial<Schema.Attribute.Column> | undefined;
39
- configurable?: boolean | undefined;
40
- default?: boolean | (() => boolean) | undefined;
41
- private?: boolean | undefined;
42
- required?: boolean | undefined;
43
- writable?: boolean | undefined;
44
- visible?: boolean | undefined;
45
- } | {
46
- type: "blocks";
47
- pluginOptions?: object | undefined;
48
- searchable?: boolean | undefined;
49
- column?: Partial<Schema.Attribute.Column> | undefined;
50
- configurable?: boolean | undefined;
51
- private?: boolean | undefined;
52
- required?: boolean | undefined;
53
- writable?: boolean | undefined;
54
- visible?: boolean | undefined;
55
- } | {
56
- type: "component";
57
- pluginOptions?: object | undefined;
58
- searchable?: boolean | undefined;
59
- column?: Partial<Schema.Attribute.Column> | undefined;
60
- component: `${string}.${string}`;
61
- repeatable?: boolean | undefined;
62
- configurable?: boolean | undefined;
63
- min?: number | undefined;
64
- max?: number | undefined;
65
- private?: boolean | undefined;
66
- required?: boolean | undefined;
67
- writable?: boolean | undefined;
68
- visible?: boolean | undefined;
69
- } | {
70
- type: "datetime";
71
- pluginOptions?: object | undefined;
72
- searchable?: boolean | undefined;
73
- column?: Partial<Schema.Attribute.Column> | undefined;
74
- configurable?: boolean | undefined;
75
- default?: Schema.Attribute.DateTimeValue | (() => Schema.Attribute.DateTimeValue) | undefined;
76
- private?: boolean | undefined;
77
- required?: boolean | undefined;
78
- unique?: boolean | undefined;
79
- writable?: boolean | undefined;
80
- visible?: boolean | undefined;
81
- } | {
82
- type: "date";
83
- pluginOptions?: object | undefined;
84
- searchable?: boolean | undefined;
85
- column?: Partial<Schema.Attribute.Column> | undefined;
86
- configurable?: boolean | undefined;
87
- default?: Schema.Attribute.DateValue | (() => Schema.Attribute.DateValue) | undefined;
88
- private?: boolean | undefined;
89
- required?: boolean | undefined;
90
- unique?: boolean | undefined;
91
- writable?: boolean | undefined;
92
- visible?: boolean | undefined;
93
- } | {
94
- type: "decimal";
95
- pluginOptions?: object | undefined;
96
- searchable?: boolean | undefined;
97
- column?: Partial<Schema.Attribute.Column> | undefined;
98
- configurable?: boolean | undefined;
99
- default?: number | (() => number) | undefined;
100
- min?: number | undefined;
101
- max?: number | undefined;
102
- private?: boolean | undefined;
103
- required?: boolean | undefined;
104
- writable?: boolean | undefined;
105
- visible?: boolean | undefined;
106
- unique?: boolean | undefined;
107
- } | {
108
- type: "dynamiczone";
109
- pluginOptions?: object | undefined;
110
- searchable?: boolean | undefined;
111
- column?: Partial<Schema.Attribute.Column> | undefined;
112
- components: `${string}.${string}`[];
113
- configurable?: boolean | undefined;
114
- min?: number | undefined;
115
- max?: number | undefined;
116
- required?: boolean | undefined;
117
- writable?: boolean | undefined;
118
- visible?: boolean | undefined;
119
- } | {
120
- type: "email";
121
- pluginOptions?: object | undefined;
122
- searchable?: boolean | undefined;
123
- column?: Partial<Schema.Attribute.Column> | undefined;
124
- configurable?: boolean | undefined;
125
- default?: string | (() => string) | undefined;
126
- minLength?: number | undefined;
127
- maxLength?: number | undefined;
128
- private?: boolean | undefined;
129
- required?: boolean | undefined;
130
- unique?: boolean | undefined;
131
- writable?: boolean | undefined;
132
- visible?: boolean | undefined;
133
- } | {
134
- type: "enumeration";
135
- pluginOptions?: object | undefined;
136
- searchable?: boolean | undefined;
137
- column?: Partial<Schema.Attribute.Column> | undefined;
138
- enum: string[];
139
- enumName?: string | undefined;
140
- configurable?: boolean | undefined;
141
- default?: string | (() => string) | undefined;
142
- private?: boolean | undefined;
143
- required?: boolean | undefined;
144
- writable?: boolean | undefined;
145
- visible?: boolean | undefined;
146
- } | {
147
- type: "float";
148
- pluginOptions?: object | undefined;
149
- searchable?: boolean | undefined;
150
- column?: Partial<Schema.Attribute.Column> | undefined;
151
- configurable?: boolean | undefined;
152
- default?: number | (() => number) | undefined;
153
- min?: number | undefined;
154
- max?: number | undefined;
155
- private?: boolean | undefined;
156
- required?: boolean | undefined;
157
- writable?: boolean | undefined;
158
- visible?: boolean | undefined;
159
- unique?: boolean | undefined;
160
- } | {
161
- type: "integer";
162
- pluginOptions?: object | undefined;
163
- searchable?: boolean | undefined;
164
- column?: Partial<Schema.Attribute.Column> | undefined;
165
- configurable?: boolean | undefined;
166
- default?: number | (() => number) | undefined;
167
- min?: number | undefined;
168
- max?: number | undefined;
169
- private?: boolean | undefined;
170
- required?: boolean | undefined;
171
- writable?: boolean | undefined;
172
- visible?: boolean | undefined;
173
- unique?: boolean | undefined;
174
- } | {
175
- type: "json";
176
- pluginOptions?: object | undefined;
177
- searchable?: boolean | undefined;
178
- column?: Partial<Schema.Attribute.Column> | undefined;
179
- configurable?: boolean | undefined;
180
- required?: boolean | undefined;
181
- private?: boolean | undefined;
182
- writable?: boolean | undefined;
183
- visible?: boolean | undefined;
184
- default?: import("@strapi/types/dist/utils").JSONPrimitive | (() => import("@strapi/types/dist/utils").JSONPrimitive) | undefined;
185
- } | {
186
- type: "media";
187
- pluginOptions?: object | undefined;
188
- searchable?: boolean | undefined;
189
- column?: Partial<Schema.Attribute.Column> | undefined;
190
- allowedTypes?: Schema.Attribute.MediaKind | (Schema.Attribute.MediaKind | undefined)[] | undefined;
191
- multiple?: boolean | undefined;
192
- configurable?: boolean | undefined;
193
- required?: boolean | undefined;
194
- private?: boolean | undefined;
195
- writable?: boolean | undefined;
196
- visible?: boolean | undefined;
197
- } | {
198
- type: "password";
199
- pluginOptions?: object | undefined;
200
- searchable?: boolean | undefined;
201
- column?: Partial<Schema.Attribute.Column> | undefined;
202
- configurable?: boolean | undefined;
203
- default?: string | (() => string) | undefined;
204
- minLength?: number | undefined;
205
- maxLength?: number | undefined;
206
- private?: boolean | undefined;
207
- required?: boolean | undefined;
208
- writable?: boolean | undefined;
209
- visible?: boolean | undefined;
210
- } | {
211
- type: "relation";
212
- pluginOptions?: object | undefined;
213
- searchable?: boolean | undefined;
214
- column?: Partial<Schema.Attribute.Column> | undefined;
215
- configurable?: boolean | undefined;
216
- private?: boolean | undefined;
217
- writable?: boolean | undefined;
218
- visible?: boolean | undefined;
219
- required?: boolean | undefined;
220
- useJoinTable?: boolean | undefined;
221
- relation: "morphToOne";
222
- } | {
223
- type: "relation";
224
- pluginOptions?: object | undefined;
225
- searchable?: boolean | undefined;
226
- column?: Partial<Schema.Attribute.Column> | undefined;
227
- configurable?: boolean | undefined;
228
- private?: boolean | undefined;
229
- writable?: boolean | undefined;
230
- visible?: boolean | undefined;
231
- required?: boolean | undefined;
232
- useJoinTable?: boolean | undefined;
233
- relation: "morphToMany";
234
- } | {
235
- type: "relation";
236
- pluginOptions?: object | undefined;
237
- searchable?: boolean | undefined;
238
- column?: Partial<Schema.Attribute.Column> | undefined;
239
- target: import("@strapi/types/dist/uid").ContentType;
240
- inversedBy?: string | undefined;
241
- mappedBy?: string | undefined;
242
- configurable?: boolean | undefined;
243
- private?: boolean | undefined;
244
- writable?: boolean | undefined;
245
- visible?: boolean | undefined;
246
- required?: boolean | undefined;
247
- useJoinTable?: boolean | undefined;
248
- relation: "oneToOne";
249
- } | {
250
- type: "relation";
251
- pluginOptions?: object | undefined;
252
- searchable?: boolean | undefined;
253
- column?: Partial<Schema.Attribute.Column> | undefined;
254
- target: import("@strapi/types/dist/uid").ContentType;
255
- inversedBy?: string | undefined;
256
- mappedBy?: string | undefined;
257
- configurable?: boolean | undefined;
258
- private?: boolean | undefined;
259
- writable?: boolean | undefined;
260
- visible?: boolean | undefined;
261
- required?: boolean | undefined;
262
- useJoinTable?: boolean | undefined;
263
- relation: "oneToMany";
264
- } | {
265
- type: "relation";
266
- pluginOptions?: object | undefined;
267
- searchable?: boolean | undefined;
268
- column?: Partial<Schema.Attribute.Column> | undefined;
269
- target: import("@strapi/types/dist/uid").ContentType;
270
- inversedBy?: string | undefined;
271
- mappedBy?: string | undefined;
272
- configurable?: boolean | undefined;
273
- private?: boolean | undefined;
274
- writable?: boolean | undefined;
275
- visible?: boolean | undefined;
276
- required?: boolean | undefined;
277
- useJoinTable?: boolean | undefined;
278
- relation: "manyToOne";
279
- } | {
280
- type: "relation";
281
- pluginOptions?: object | undefined;
282
- searchable?: boolean | undefined;
283
- column?: Partial<Schema.Attribute.Column> | undefined;
284
- target: import("@strapi/types/dist/uid").ContentType;
285
- inversedBy?: string | undefined;
286
- mappedBy?: string | undefined;
287
- configurable?: boolean | undefined;
288
- private?: boolean | undefined;
289
- writable?: boolean | undefined;
290
- visible?: boolean | undefined;
291
- required?: boolean | undefined;
292
- useJoinTable?: boolean | undefined;
293
- relation: "manyToMany";
294
- } | {
295
- type: "relation";
296
- pluginOptions?: object | undefined;
297
- searchable?: boolean | undefined;
298
- column?: Partial<Schema.Attribute.Column> | undefined;
299
- target: import("@strapi/types/dist/uid").ContentType;
300
- configurable?: boolean | undefined;
301
- private?: boolean | undefined;
302
- writable?: boolean | undefined;
303
- visible?: boolean | undefined;
304
- required?: boolean | undefined;
305
- useJoinTable?: boolean | undefined;
306
- relation: "oneWay";
307
- } | {
308
- type: "relation";
309
- pluginOptions?: object | undefined;
310
- searchable?: boolean | undefined;
311
- column?: Partial<Schema.Attribute.Column> | undefined;
312
- target: import("@strapi/types/dist/uid").ContentType;
313
- configurable?: boolean | undefined;
314
- private?: boolean | undefined;
315
- writable?: boolean | undefined;
316
- visible?: boolean | undefined;
317
- required?: boolean | undefined;
318
- useJoinTable?: boolean | undefined;
319
- relation: "manyWay";
320
- } | {
321
- type: "relation";
322
- pluginOptions?: object | undefined;
323
- searchable?: boolean | undefined;
324
- column?: Partial<Schema.Attribute.Column> | undefined;
325
- target: import("@strapi/types/dist/uid").ContentType;
326
- morphBy?: string | undefined;
327
- configurable?: boolean | undefined;
328
- private?: boolean | undefined;
329
- writable?: boolean | undefined;
330
- visible?: boolean | undefined;
331
- required?: boolean | undefined;
332
- useJoinTable?: boolean | undefined;
333
- relation: "morphOne";
334
- } | {
335
- type: "relation";
336
- pluginOptions?: object | undefined;
337
- searchable?: boolean | undefined;
338
- column?: Partial<Schema.Attribute.Column> | undefined;
339
- target: import("@strapi/types/dist/uid").ContentType;
340
- morphBy?: string | undefined;
341
- configurable?: boolean | undefined;
342
- private?: boolean | undefined;
343
- writable?: boolean | undefined;
344
- visible?: boolean | undefined;
345
- required?: boolean | undefined;
346
- useJoinTable?: boolean | undefined;
347
- relation: "morphMany";
348
- } | {
349
- type: "richtext";
350
- pluginOptions?: object | undefined;
351
- searchable?: boolean | undefined;
352
- column?: Partial<Schema.Attribute.Column> | undefined;
353
- configurable?: boolean | undefined;
354
- default?: string | (() => string) | undefined;
355
- minLength?: number | undefined;
356
- maxLength?: number | undefined;
357
- private?: boolean | undefined;
358
- required?: boolean | undefined;
359
- writable?: boolean | undefined;
360
- visible?: boolean | undefined;
361
- } | {
362
- type: "string";
363
- pluginOptions?: object | undefined;
364
- searchable?: boolean | undefined;
365
- column?: Partial<Schema.Attribute.Column> | undefined;
366
- regex?: RegExp | undefined;
367
- configurable?: boolean | undefined;
368
- default?: string | (() => string) | undefined;
369
- minLength?: number | undefined;
370
- maxLength?: number | undefined;
371
- private?: boolean | undefined;
372
- unique?: boolean | undefined;
373
- required?: boolean | undefined;
374
- writable?: boolean | undefined;
375
- visible?: boolean | undefined;
376
- } | {
377
- type: "text";
378
- pluginOptions?: object | undefined;
379
- searchable?: boolean | undefined;
380
- column?: Partial<Schema.Attribute.Column> | undefined;
381
- regex?: RegExp | undefined;
382
- configurable?: boolean | undefined;
383
- default?: string | (() => string) | undefined;
384
- minLength?: number | undefined;
385
- maxLength?: number | undefined;
386
- private?: boolean | undefined;
387
- unique?: boolean | undefined;
388
- required?: boolean | undefined;
389
- writable?: boolean | undefined;
390
- visible?: boolean | undefined;
391
- } | {
392
- type: "time";
393
- pluginOptions?: object | undefined;
394
- searchable?: boolean | undefined;
395
- column?: Partial<Schema.Attribute.Column> | undefined;
396
- configurable?: boolean | undefined;
397
- default?: Schema.Attribute.TimeValue | (() => Schema.Attribute.TimeValue) | undefined;
398
- private?: boolean | undefined;
399
- required?: boolean | undefined;
400
- unique?: boolean | undefined;
401
- writable?: boolean | undefined;
402
- visible?: boolean | undefined;
403
- } | {
404
- type: "timestamp";
405
- pluginOptions?: object | undefined;
406
- searchable?: boolean | undefined;
407
- column?: Partial<Schema.Attribute.Column> | undefined;
408
- configurable?: boolean | undefined;
409
- default?: Schema.Attribute.TimestampValue | (() => Schema.Attribute.TimestampValue) | undefined;
410
- private?: boolean | undefined;
411
- required?: boolean | undefined;
412
- unique?: boolean | undefined;
413
- writable?: boolean | undefined;
414
- visible?: boolean | undefined;
415
- } | {
416
- type: "uid";
417
- pluginOptions?: object | undefined;
418
- searchable?: boolean | undefined;
419
- column?: Partial<Schema.Attribute.Column> | undefined;
420
- targetField?: string | undefined;
421
- options?: Schema.Attribute.UIDOptions | undefined;
422
- configurable?: boolean | undefined;
423
- default?: string | (() => string) | undefined;
424
- minLength?: number | undefined;
425
- maxLength?: number | undefined;
426
- private?: boolean | undefined;
427
- required?: boolean | undefined;
428
- writable?: boolean | undefined;
429
- visible?: boolean | undefined;
430
- }, "type" | "required" | "column" | "visible" | "pluginOptions" | "writable" | "configurable" | "searchable">[];
431
- uid?: string | undefined;
12
+ attributes: Record<string, OmitByPath<Schema.Attribute.AnyAttribute, ["pluginOptions", "i18n"]>>;
13
+ modelType: "contentType";
14
+ uid: import("@strapi/types/dist/uid").ContentType;
15
+ kind: import("@strapi/types/dist/struct").ContentTypeKind;
16
+ info: import("@strapi/types/dist/struct").ContentTypeSchemaInfo;
17
+ indexes?: unknown[] | undefined;
18
+ foreignKeys?: unknown[] | undefined;
19
+ modelName: string;
20
+ globalId: string;
21
+ options?: import("@strapi/types/dist/struct").SchemaOptions | undefined;
22
+ collectionName?: string | undefined;
432
23
  };
24
+ type OmitByPath<T extends object, K extends string[]> = Pick<T, Exclude<keyof T, K[number]>>;
433
25
  export { mutateCTBContentTypeSchema };
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var has = require('lodash/has');
4
-
5
3
  const LOCALIZED_FIELDS = [
6
4
  'biginteger',
7
5
  'boolean',
@@ -24,10 +22,7 @@ const LOCALIZED_FIELDS = [
24
22
  'text',
25
23
  'time'
26
24
  ];
27
- const doesPluginOptionsHaveI18nLocalized = (opts)=>has(opts, [
28
- 'i18n',
29
- 'localized'
30
- ]);
25
+ const doesPluginOptionsHaveI18nLocalized = (opts)=>typeof opts === 'object' && opts !== null && 'i18n' in opts && typeof opts.i18n === 'object' && opts.i18n !== null && 'localized' in opts.i18n && typeof opts.i18n.localized === 'boolean';
31
26
 
32
27
  exports.LOCALIZED_FIELDS = LOCALIZED_FIELDS;
33
28
  exports.doesPluginOptionsHaveI18nLocalized = doesPluginOptionsHaveI18nLocalized;
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["import has from 'lodash/has';\n\nconst LOCALIZED_FIELDS = [\n 'biginteger',\n 'boolean',\n 'component',\n 'date',\n 'datetime',\n 'decimal',\n 'dynamiczone',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'media',\n 'number',\n 'password',\n 'richtext',\n 'blocks',\n 'string',\n 'text',\n 'time',\n];\n\nconst doesPluginOptionsHaveI18nLocalized = (\n opts?: object\n): opts is { i18n: { localized: boolean } } => has(opts, ['i18n', 'localized']);\n\nexport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };\n"],"names":["LOCALIZED_FIELDS","doesPluginOptionsHaveI18nLocalized","opts","has"],"mappings":";;;;AAEA,MAAMA,gBAAmB,GAAA;AACvB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD;AAED,MAAMC,kCAAqC,GAAA,CACzCC,IAC6CC,GAAAA,GAAAA,CAAID,IAAM,EAAA;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAY,KAAA;;;;;"}
1
+ {"version":3,"file":"fields.js","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["const LOCALIZED_FIELDS = [\n 'biginteger',\n 'boolean',\n 'component',\n 'date',\n 'datetime',\n 'decimal',\n 'dynamiczone',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'media',\n 'number',\n 'password',\n 'richtext',\n 'blocks',\n 'string',\n 'text',\n 'time',\n];\n\nconst doesPluginOptionsHaveI18nLocalized = (\n opts?: object\n): opts is { i18n: { localized: boolean } } =>\n typeof opts === 'object' &&\n opts !== null &&\n 'i18n' in opts &&\n typeof opts.i18n === 'object' &&\n opts.i18n !== null &&\n 'localized' in opts.i18n &&\n typeof opts.i18n.localized === 'boolean';\n\nexport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };\n"],"names":["LOCALIZED_FIELDS","doesPluginOptionsHaveI18nLocalized","opts","i18n","localized"],"mappings":";;AAAA,MAAMA,gBAAmB,GAAA;AACvB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD;AAED,MAAMC,kCAAqC,GAAA,CACzCC,IAEA,GAAA,OAAOA,IAAS,KAAA,QAAA,IAChBA,IAAS,KAAA,IAAA,IACT,MAAUA,IAAAA,IAAAA,IACV,OAAOA,IAAAA,CAAKC,IAAI,KAAK,QACrBD,IAAAA,IAAAA,CAAKC,IAAI,KAAK,IACd,IAAA,WAAA,IAAeD,IAAKC,CAAAA,IAAI,IACxB,OAAOD,IAAKC,CAAAA,IAAI,CAACC,SAAS,KAAK;;;;;"}
@@ -1,5 +1,3 @@
1
- import has from 'lodash/has';
2
-
3
1
  const LOCALIZED_FIELDS = [
4
2
  'biginteger',
5
3
  'boolean',
@@ -22,10 +20,7 @@ const LOCALIZED_FIELDS = [
22
20
  'text',
23
21
  'time'
24
22
  ];
25
- const doesPluginOptionsHaveI18nLocalized = (opts)=>has(opts, [
26
- 'i18n',
27
- 'localized'
28
- ]);
23
+ const doesPluginOptionsHaveI18nLocalized = (opts)=>typeof opts === 'object' && opts !== null && 'i18n' in opts && typeof opts.i18n === 'object' && opts.i18n !== null && 'localized' in opts.i18n && typeof opts.i18n.localized === 'boolean';
29
24
 
30
25
  export { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };
31
26
  //# sourceMappingURL=fields.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.mjs","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["import has from 'lodash/has';\n\nconst LOCALIZED_FIELDS = [\n 'biginteger',\n 'boolean',\n 'component',\n 'date',\n 'datetime',\n 'decimal',\n 'dynamiczone',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'media',\n 'number',\n 'password',\n 'richtext',\n 'blocks',\n 'string',\n 'text',\n 'time',\n];\n\nconst doesPluginOptionsHaveI18nLocalized = (\n opts?: object\n): opts is { i18n: { localized: boolean } } => has(opts, ['i18n', 'localized']);\n\nexport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };\n"],"names":["LOCALIZED_FIELDS","doesPluginOptionsHaveI18nLocalized","opts","has"],"mappings":";;AAEA,MAAMA,gBAAmB,GAAA;AACvB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD;AAED,MAAMC,kCAAqC,GAAA,CACzCC,IAC6CC,GAAAA,GAAAA,CAAID,IAAM,EAAA;AAAC,QAAA,MAAA;AAAQ,QAAA;AAAY,KAAA;;;;"}
1
+ {"version":3,"file":"fields.mjs","sources":["../../../admin/src/utils/fields.ts"],"sourcesContent":["const LOCALIZED_FIELDS = [\n 'biginteger',\n 'boolean',\n 'component',\n 'date',\n 'datetime',\n 'decimal',\n 'dynamiczone',\n 'email',\n 'enumeration',\n 'float',\n 'integer',\n 'json',\n 'media',\n 'number',\n 'password',\n 'richtext',\n 'blocks',\n 'string',\n 'text',\n 'time',\n];\n\nconst doesPluginOptionsHaveI18nLocalized = (\n opts?: object\n): opts is { i18n: { localized: boolean } } =>\n typeof opts === 'object' &&\n opts !== null &&\n 'i18n' in opts &&\n typeof opts.i18n === 'object' &&\n opts.i18n !== null &&\n 'localized' in opts.i18n &&\n typeof opts.i18n.localized === 'boolean';\n\nexport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized };\n"],"names":["LOCALIZED_FIELDS","doesPluginOptionsHaveI18nLocalized","opts","i18n","localized"],"mappings":"AAAA,MAAMA,gBAAmB,GAAA;AACvB,IAAA,YAAA;AACA,IAAA,SAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,UAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA;AACD;AAED,MAAMC,kCAAqC,GAAA,CACzCC,IAEA,GAAA,OAAOA,IAAS,KAAA,QAAA,IAChBA,IAAS,KAAA,IAAA,IACT,MAAUA,IAAAA,IAAAA,IACV,OAAOA,IAAAA,CAAKC,IAAI,KAAK,QACrBD,IAAAA,IAAAA,CAAKC,IAAI,KAAK,IACd,IAAA,WAAA,IAAeD,IAAKC,CAAAA,IAAI,IACxB,OAAOD,IAAKC,CAAAA,IAAI,CAACC,SAAS,KAAK;;;;"}
@@ -5,17 +5,13 @@ var fields = require('./fields.js');
5
5
 
6
6
  /* -------------------------------------------------------------------------------------------------
7
7
  * mutateCTBContentTypeSchema
8
- * -----------------------------------------------------------------------------------------------*/ // TODO: refactor for CTB refactors
9
- const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
10
- if (!prevSchema) {
11
- return nextSchema;
12
- }
8
+ * -----------------------------------------------------------------------------------------------*/ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
13
9
  // Don't perform mutations components
14
10
  if (!fields.doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {
15
11
  return nextSchema;
16
12
  }
17
13
  const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;
18
- const isPrevSchemaLocalized = fields.doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions) ? prevSchema?.pluginOptions.i18n.localized : false;
14
+ const isPrevSchemaLocalized = fields.doesPluginOptionsHaveI18nLocalized(prevSchema?.schema?.pluginOptions) ? prevSchema?.schema?.pluginOptions.i18n.localized : false;
19
15
  // No need to perform modification on the schema, if the i18n feature was not changed
20
16
  // at the ct level
21
17
  if (isNextSchemaLocalized && isPrevSchemaLocalized) {
@@ -42,8 +38,8 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
42
38
  };
43
39
  /* -------------------------------------------------------------------------------------------------
44
40
  * addLocalisationToFields
45
- * -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>{
46
- return attributes.map((currentAttribute)=>{
41
+ * -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>Object.keys(attributes).reduce((acc, current)=>{
42
+ const currentAttribute = attributes[current];
47
43
  if (fields.LOCALIZED_FIELDS.includes(currentAttribute.type)) {
48
44
  const i18n = {
49
45
  localized: true
@@ -54,21 +50,19 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
54
50
  } : {
55
51
  i18n
56
52
  };
57
- return {
53
+ acc[current] = {
58
54
  ...currentAttribute,
59
55
  pluginOptions
60
56
  };
57
+ return acc;
61
58
  }
62
- return currentAttribute;
63
- });
64
- };
65
- /* -------------------------------------------------------------------------------------------------
66
- * disableAttributesLocalisation
67
- * -----------------------------------------------------------------------------------------------*/ const disableAttributesLocalisation = (attributes)=>{
68
- return attributes.map((currentAttribute)=>{
69
- return omit(currentAttribute, 'pluginOptions.i18n');
70
- });
71
- };
59
+ acc[current] = currentAttribute;
60
+ return acc;
61
+ }, {});
62
+ const disableAttributesLocalisation = (attributes)=>Object.keys(attributes).reduce((acc, current)=>{
63
+ acc[current] = omit(attributes[current], 'pluginOptions.i18n');
64
+ return acc;
65
+ }, {});
72
66
 
73
67
  exports.mutateCTBContentTypeSchema = mutateCTBContentTypeSchema;
74
68
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\n// TODO: refactor for CTB refactors\nconst mutateCTBContentTypeSchema = (\n nextSchema: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n },\n prevSchema?: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n }\n) => {\n if (!prevSchema) {\n return nextSchema;\n }\n\n // Don't perform mutations components\n if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {\n return nextSchema;\n }\n\n const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;\n const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions)\n ? prevSchema?.pluginOptions.i18n.localized\n : false;\n\n // No need to perform modification on the schema, if the i18n feature was not changed\n // at the ct level\n if (isNextSchemaLocalized && isPrevSchemaLocalized) {\n return nextSchema;\n }\n\n if (isNextSchemaLocalized) {\n const attributes = addLocalisationToFields(nextSchema.attributes);\n\n return {\n ...nextSchema,\n attributes,\n };\n }\n\n // Remove the i18n object from the pluginOptions\n if (!isNextSchemaLocalized) {\n const pluginOptions = omit(nextSchema.pluginOptions, 'i18n');\n const attributes = disableAttributesLocalisation(nextSchema.attributes);\n\n return {\n ...nextSchema,\n pluginOptions,\n attributes,\n };\n }\n\n return nextSchema;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * addLocalisationToFields\n * -----------------------------------------------------------------------------------------------*/\n\nconst addLocalisationToFields = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {\n const i18n = { localized: true };\n\n const pluginOptions = currentAttribute.pluginOptions\n ? { ...currentAttribute.pluginOptions, i18n }\n : { i18n };\n\n return { ...currentAttribute, pluginOptions };\n }\n\n return currentAttribute;\n });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * disableAttributesLocalisation\n * -----------------------------------------------------------------------------------------------*/\n\nconst disableAttributesLocalisation = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n return omit(currentAttribute, 'pluginOptions.i18n');\n });\n};\n\nexport { mutateCTBContentTypeSchema };\n"],"names":["mutateCTBContentTypeSchema","nextSchema","prevSchema","doesPluginOptionsHaveI18nLocalized","pluginOptions","isNextSchemaLocalized","i18n","localized","isPrevSchemaLocalized","attributes","addLocalisationToFields","omit","disableAttributesLocalisation","map","currentAttribute","LOCALIZED_FIELDS","includes","type"],"mappings":";;;;;AAMA;;AAEkG;AAG5FA,MAAAA,0BAAAA,GAA6B,CACjCC,UAKAC,EAAAA,UAAAA,GAAAA;AAMA,IAAA,IAAI,CAACA,UAAY,EAAA;QACf,OAAOD,UAAAA;AACT;;AAGA,IAAA,IAAI,CAACE,yCAAAA,CAAmCF,UAAWG,CAAAA,aAAa,CAAG,EAAA;QACjE,OAAOH,UAAAA;AACT;AAEA,IAAA,MAAMI,wBAAwBJ,UAAWG,CAAAA,aAAa,CAACE,IAAI,CAACC,SAAS;AACrE,IAAA,MAAMC,wBAAwBL,yCAAmCD,CAAAA,UAAAA,EAAYE,iBACz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,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,OAAOH,KAAKG,gBAAkB,EAAA,oBAAA,CAAA;AAChC,KAAA,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"schemas.js","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\nconst mutateCTBContentTypeSchema = (\n nextSchema: Schema.ContentType,\n prevSchema?: {\n apiID?: string;\n schema?: Schema.ContentType;\n uid?: string;\n }\n) => {\n // Don't perform mutations components\n if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {\n return nextSchema;\n }\n\n const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;\n const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(\n prevSchema?.schema?.pluginOptions\n )\n ? prevSchema?.schema?.pluginOptions.i18n.localized\n : false;\n\n // No need to perform modification on the schema, if the i18n feature was not changed\n // at the ct level\n if (isNextSchemaLocalized && isPrevSchemaLocalized) {\n return nextSchema;\n }\n\n if (isNextSchemaLocalized) {\n const attributes = addLocalisationToFields(nextSchema.attributes);\n\n return { ...nextSchema, attributes };\n }\n\n // Remove the i18n object from the pluginOptions\n if (!isNextSchemaLocalized) {\n const pluginOptions = omit(nextSchema.pluginOptions, 'i18n');\n const attributes = disableAttributesLocalisation(nextSchema.attributes);\n\n return { ...nextSchema, pluginOptions, attributes };\n }\n\n return nextSchema;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * addLocalisationToFields\n * -----------------------------------------------------------------------------------------------*/\n\nconst addLocalisationToFields = (attributes: Schema.ContentType['attributes']) =>\n Object.keys(attributes).reduce<Schema.ContentType['attributes']>((acc, current) => {\n const currentAttribute = attributes[current];\n\n if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {\n const i18n = { localized: true };\n\n const pluginOptions = currentAttribute.pluginOptions\n ? { ...currentAttribute.pluginOptions, i18n }\n : { i18n };\n\n acc[current] = { ...currentAttribute, pluginOptions };\n\n return acc;\n }\n\n acc[current] = currentAttribute;\n\n return acc;\n }, {});\n\n/* -------------------------------------------------------------------------------------------------\n * disableAttributesLocalisation\n * -----------------------------------------------------------------------------------------------*/\n\ntype OmitByPath<T extends object, K extends string[]> = Pick<T, Exclude<keyof T, K[number]>>;\n\nconst disableAttributesLocalisation = (attributes: Schema.ContentType['attributes']) =>\n Object.keys(attributes).reduce<\n Record<string, OmitByPath<Schema.ContentType['attributes'][string], ['pluginOptions', 'i18n']>>\n >((acc, current) => {\n acc[current] = omit(attributes[current], 'pluginOptions.i18n');\n\n return acc;\n }, {});\n\nexport { mutateCTBContentTypeSchema };\n"],"names":["mutateCTBContentTypeSchema","nextSchema","prevSchema","doesPluginOptionsHaveI18nLocalized","pluginOptions","isNextSchemaLocalized","i18n","localized","isPrevSchemaLocalized","schema","attributes","addLocalisationToFields","omit","disableAttributesLocalisation","Object","keys","reduce","acc","current","currentAttribute","LOCALIZED_FIELDS","includes","type"],"mappings":";;;;;AAMA;;qGAIA,MAAMA,0BAA6B,GAAA,CACjCC,UACAC,EAAAA,UAAAA,GAAAA;;AAOA,IAAA,IAAI,CAACC,yCAAAA,CAAmCF,UAAWG,CAAAA,aAAa,CAAG,EAAA;QACjE,OAAOH,UAAAA;AACT;AAEA,IAAA,MAAMI,wBAAwBJ,UAAWG,CAAAA,aAAa,CAACE,IAAI,CAACC,SAAS;IACrE,MAAMC,qBAAAA,GAAwBL,0CAC5BD,UAAYO,EAAAA,MAAAA,EAAQL,iBAElBF,UAAYO,EAAAA,MAAAA,EAAQL,aAAcE,CAAAA,IAAAA,CAAKC,SACvC,GAAA,KAAA;;;AAIJ,IAAA,IAAIF,yBAAyBG,qBAAuB,EAAA;QAClD,OAAOP,UAAAA;AACT;AAEA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AgC,CAACH,UAAAA,GACrCI,MAAOC,CAAAA,IAAI,CAACL,UAAYM,CAAAA,CAAAA,MAAM,CAE5B,CAACC,GAAKC,EAAAA,OAAAA,GAAAA;AACND,QAAAA,GAAG,CAACC,OAAQ,CAAA,GAAGN,KAAKF,UAAU,CAACQ,QAAQ,EAAE,oBAAA,CAAA;QAEzC,OAAOD,GAAAA;AACT,KAAA,EAAG,EAAC,CAAA;;;;"}
@@ -3,17 +3,13 @@ import { doesPluginOptionsHaveI18nLocalized, LOCALIZED_FIELDS } from './fields.m
3
3
 
4
4
  /* -------------------------------------------------------------------------------------------------
5
5
  * mutateCTBContentTypeSchema
6
- * -----------------------------------------------------------------------------------------------*/ // TODO: refactor for CTB refactors
7
- const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
8
- if (!prevSchema) {
9
- return nextSchema;
10
- }
6
+ * -----------------------------------------------------------------------------------------------*/ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
11
7
  // Don't perform mutations components
12
8
  if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {
13
9
  return nextSchema;
14
10
  }
15
11
  const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;
16
- const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions) ? prevSchema?.pluginOptions.i18n.localized : false;
12
+ const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.schema?.pluginOptions) ? prevSchema?.schema?.pluginOptions.i18n.localized : false;
17
13
  // No need to perform modification on the schema, if the i18n feature was not changed
18
14
  // at the ct level
19
15
  if (isNextSchemaLocalized && isPrevSchemaLocalized) {
@@ -40,8 +36,8 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
40
36
  };
41
37
  /* -------------------------------------------------------------------------------------------------
42
38
  * addLocalisationToFields
43
- * -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>{
44
- return attributes.map((currentAttribute)=>{
39
+ * -----------------------------------------------------------------------------------------------*/ const addLocalisationToFields = (attributes)=>Object.keys(attributes).reduce((acc, current)=>{
40
+ const currentAttribute = attributes[current];
45
41
  if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {
46
42
  const i18n = {
47
43
  localized: true
@@ -52,21 +48,19 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema)=>{
52
48
  } : {
53
49
  i18n
54
50
  };
55
- return {
51
+ acc[current] = {
56
52
  ...currentAttribute,
57
53
  pluginOptions
58
54
  };
55
+ return acc;
59
56
  }
60
- return currentAttribute;
61
- });
62
- };
63
- /* -------------------------------------------------------------------------------------------------
64
- * disableAttributesLocalisation
65
- * -----------------------------------------------------------------------------------------------*/ const disableAttributesLocalisation = (attributes)=>{
66
- return attributes.map((currentAttribute)=>{
67
- return omit(currentAttribute, 'pluginOptions.i18n');
68
- });
69
- };
57
+ acc[current] = currentAttribute;
58
+ return acc;
59
+ }, {});
60
+ const disableAttributesLocalisation = (attributes)=>Object.keys(attributes).reduce((acc, current)=>{
61
+ acc[current] = omit(attributes[current], 'pluginOptions.i18n');
62
+ return acc;
63
+ }, {});
70
64
 
71
65
  export { mutateCTBContentTypeSchema };
72
66
  //# sourceMappingURL=schemas.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.mjs","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\n// TODO: refactor for CTB refactors\nconst mutateCTBContentTypeSchema = (\n nextSchema: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n },\n prevSchema?: {\n pluginOptions: Schema.ContentType['pluginOptions'];\n attributes: Schema.Attribute.AnyAttribute[];\n uid?: string;\n }\n) => {\n if (!prevSchema) {\n return nextSchema;\n }\n\n // Don't perform mutations components\n if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {\n return nextSchema;\n }\n\n const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;\n const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(prevSchema?.pluginOptions)\n ? prevSchema?.pluginOptions.i18n.localized\n : false;\n\n // No need to perform modification on the schema, if the i18n feature was not changed\n // at the ct level\n if (isNextSchemaLocalized && isPrevSchemaLocalized) {\n return nextSchema;\n }\n\n if (isNextSchemaLocalized) {\n const attributes = addLocalisationToFields(nextSchema.attributes);\n\n return {\n ...nextSchema,\n attributes,\n };\n }\n\n // Remove the i18n object from the pluginOptions\n if (!isNextSchemaLocalized) {\n const pluginOptions = omit(nextSchema.pluginOptions, 'i18n');\n const attributes = disableAttributesLocalisation(nextSchema.attributes);\n\n return {\n ...nextSchema,\n pluginOptions,\n attributes,\n };\n }\n\n return nextSchema;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * addLocalisationToFields\n * -----------------------------------------------------------------------------------------------*/\n\nconst addLocalisationToFields = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {\n const i18n = { localized: true };\n\n const pluginOptions = currentAttribute.pluginOptions\n ? { ...currentAttribute.pluginOptions, i18n }\n : { i18n };\n\n return { ...currentAttribute, pluginOptions };\n }\n\n return currentAttribute;\n });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * disableAttributesLocalisation\n * -----------------------------------------------------------------------------------------------*/\n\nconst disableAttributesLocalisation = (attributes: Schema.Attribute.AnyAttribute[]) => {\n return attributes.map((currentAttribute) => {\n return omit(currentAttribute, 'pluginOptions.i18n');\n });\n};\n\nexport { mutateCTBContentTypeSchema };\n"],"names":["mutateCTBContentTypeSchema","nextSchema","prevSchema","doesPluginOptionsHaveI18nLocalized","pluginOptions","isNextSchemaLocalized","i18n","localized","isPrevSchemaLocalized","attributes","addLocalisationToFields","omit","disableAttributesLocalisation","map","currentAttribute","LOCALIZED_FIELDS","includes","type"],"mappings":";;;AAMA;;AAEkG;AAG5FA,MAAAA,0BAAAA,GAA6B,CACjCC,UAKAC,EAAAA,UAAAA,GAAAA;AAMA,IAAA,IAAI,CAACA,UAAY,EAAA;QACf,OAAOD,UAAAA;AACT;;AAGA,IAAA,IAAI,CAACE,kCAAAA,CAAmCF,UAAWG,CAAAA,aAAa,CAAG,EAAA;QACjE,OAAOH,UAAAA;AACT;AAEA,IAAA,MAAMI,wBAAwBJ,UAAWG,CAAAA,aAAa,CAACE,IAAI,CAACC,SAAS;AACrE,IAAA,MAAMC,wBAAwBL,kCAAmCD,CAAAA,UAAAA,EAAYE,iBACzEF,UAAYE,EAAAA,aAAAA,CAAcE,KAAKC,SAC/B,GAAA,KAAA;;;AAIJ,IAAA,IAAIF,yBAAyBG,qBAAuB,EAAA;QAClD,OAAOP,UAAAA;AACT;AAEA,IAAA,IAAII,qBAAuB,EAAA;QACzB,MAAMI,UAAAA,GAAaC,uBAAwBT,CAAAA,UAAAA,CAAWQ,UAAU,CAAA;QAEhE,OAAO;AACL,YAAA,GAAGR,UAAU;AACbQ,YAAAA;AACF,SAAA;AACF;;AAGA,IAAA,IAAI,CAACJ,qBAAuB,EAAA;AAC1B,QAAA,MAAMD,aAAgBO,GAAAA,IAAAA,CAAKV,UAAWG,CAAAA,aAAa,EAAE,MAAA,CAAA;QACrD,MAAMK,UAAAA,GAAaG,6BAA8BX,CAAAA,UAAAA,CAAWQ,UAAU,CAAA;QAEtE,OAAO;AACL,YAAA,GAAGR,UAAU;AACbG,YAAAA,aAAAA;AACAK,YAAAA;AACF,SAAA;AACF;IAEA,OAAOR,UAAAA;AACT;AAEA;;qGAIA,MAAMS,0BAA0B,CAACD,UAAAA,GAAAA;IAC/B,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,IAAIC,gBAAiBC,CAAAA,QAAQ,CAACF,gBAAAA,CAAiBG,IAAI,CAAG,EAAA;AACpD,YAAA,MAAMX,IAAO,GAAA;gBAAEC,SAAW,EAAA;AAAK,aAAA;YAE/B,MAAMH,aAAAA,GAAgBU,gBAAiBV,CAAAA,aAAa,GAChD;AAAE,gBAAA,GAAGU,iBAAiBV,aAAa;AAAEE,gBAAAA;aACrC,GAAA;AAAEA,gBAAAA;AAAK,aAAA;YAEX,OAAO;AAAE,gBAAA,GAAGQ,gBAAgB;AAAEV,gBAAAA;AAAc,aAAA;AAC9C;QAEA,OAAOU,gBAAAA;AACT,KAAA,CAAA;AACF,CAAA;AAEA;;qGAIA,MAAMF,gCAAgC,CAACH,UAAAA,GAAAA;IACrC,OAAOA,UAAAA,CAAWI,GAAG,CAAC,CAACC,gBAAAA,GAAAA;AACrB,QAAA,OAAOH,KAAKG,gBAAkB,EAAA,oBAAA,CAAA;AAChC,KAAA,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"schemas.mjs","sources":["../../../admin/src/utils/schemas.ts"],"sourcesContent":["import omit from 'lodash/omit';\n\nimport { LOCALIZED_FIELDS, doesPluginOptionsHaveI18nLocalized } from './fields';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * mutateCTBContentTypeSchema\n * -----------------------------------------------------------------------------------------------*/\n\nconst mutateCTBContentTypeSchema = (\n nextSchema: Schema.ContentType,\n prevSchema?: {\n apiID?: string;\n schema?: Schema.ContentType;\n uid?: string;\n }\n) => {\n // Don't perform mutations components\n if (!doesPluginOptionsHaveI18nLocalized(nextSchema.pluginOptions)) {\n return nextSchema;\n }\n\n const isNextSchemaLocalized = nextSchema.pluginOptions.i18n.localized;\n const isPrevSchemaLocalized = doesPluginOptionsHaveI18nLocalized(\n prevSchema?.schema?.pluginOptions\n )\n ? prevSchema?.schema?.pluginOptions.i18n.localized\n : false;\n\n // No need to perform modification on the schema, if the i18n feature was not changed\n // at the ct level\n if (isNextSchemaLocalized && isPrevSchemaLocalized) {\n return nextSchema;\n }\n\n if (isNextSchemaLocalized) {\n const attributes = addLocalisationToFields(nextSchema.attributes);\n\n return { ...nextSchema, attributes };\n }\n\n // Remove the i18n object from the pluginOptions\n if (!isNextSchemaLocalized) {\n const pluginOptions = omit(nextSchema.pluginOptions, 'i18n');\n const attributes = disableAttributesLocalisation(nextSchema.attributes);\n\n return { ...nextSchema, pluginOptions, attributes };\n }\n\n return nextSchema;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * addLocalisationToFields\n * -----------------------------------------------------------------------------------------------*/\n\nconst addLocalisationToFields = (attributes: Schema.ContentType['attributes']) =>\n Object.keys(attributes).reduce<Schema.ContentType['attributes']>((acc, current) => {\n const currentAttribute = attributes[current];\n\n if (LOCALIZED_FIELDS.includes(currentAttribute.type)) {\n const i18n = { localized: true };\n\n const pluginOptions = currentAttribute.pluginOptions\n ? { ...currentAttribute.pluginOptions, i18n }\n : { i18n };\n\n acc[current] = { ...currentAttribute, pluginOptions };\n\n return acc;\n }\n\n acc[current] = currentAttribute;\n\n return acc;\n }, {});\n\n/* -------------------------------------------------------------------------------------------------\n * disableAttributesLocalisation\n * -----------------------------------------------------------------------------------------------*/\n\ntype OmitByPath<T extends object, K extends string[]> = Pick<T, Exclude<keyof T, K[number]>>;\n\nconst disableAttributesLocalisation = (attributes: Schema.ContentType['attributes']) =>\n Object.keys(attributes).reduce<\n Record<string, OmitByPath<Schema.ContentType['attributes'][string], ['pluginOptions', 'i18n']>>\n >((acc, current) => {\n acc[current] = omit(attributes[current], 'pluginOptions.i18n');\n\n return acc;\n }, {});\n\nexport { mutateCTBContentTypeSchema };\n"],"names":["mutateCTBContentTypeSchema","nextSchema","prevSchema","doesPluginOptionsHaveI18nLocalized","pluginOptions","isNextSchemaLocalized","i18n","localized","isPrevSchemaLocalized","schema","attributes","addLocalisationToFields","omit","disableAttributesLocalisation","Object","keys","reduce","acc","current","currentAttribute","LOCALIZED_FIELDS","includes","type"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ACF,gBAAAA,CAAiBG,IAAI,CAAG,EAAA;AACpD,YAAA,MAAMhB,IAAO,GAAA;gBAAEC,SAAW,EAAA;AAAK,aAAA;YAE/B,MAAMH,aAAAA,GAAgBe,gBAAiBf,CAAAA,aAAa,GAChD;AAAE,gBAAA,GAAGe,iBAAiBf,aAAa;AAAEE,gBAAAA;aACrC,GAAA;AAAEA,gBAAAA;AAAK,aAAA;YAEXW,GAAG,CAACC,QAAQ,GAAG;AAAE,gBAAA,GAAGC,gBAAgB;AAAEf,gBAAAA;AAAc,aAAA;YAEpD,OAAOa,GAAAA;AACT;QAEAA,GAAG,CAACC,QAAQ,GAAGC,gBAAAA;QAEf,OAAOF,GAAAA;AACT,KAAA,EAAG,EAAC,CAAA;AAQN,MAAMJ,6BAAAA,GAAgC,CAACH,UAAAA,GACrCI,MAAOC,CAAAA,IAAI,CAACL,UAAYM,CAAAA,CAAAA,MAAM,CAE5B,CAACC,GAAKC,EAAAA,OAAAA,GAAAA;AACND,QAAAA,GAAG,CAACC,OAAQ,CAAA,GAAGN,KAAKF,UAAU,CAACQ,QAAQ,EAAE,oBAAA,CAAA;QAEzC,OAAOD,GAAAA;AACT,KAAA,EAAG,EAAC,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/i18n",
3
- "version": "5.13.0-beta.1",
3
+ "version": "5.13.0",
4
4
  "description": "Create read and update content in different languages, both from the Admin Panel and from the API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,7 +59,7 @@
59
59
  "@reduxjs/toolkit": "1.9.7",
60
60
  "@strapi/design-system": "2.0.0-rc.23",
61
61
  "@strapi/icons": "2.0.0-rc.23",
62
- "@strapi/utils": "5.13.0-beta.1",
62
+ "@strapi/utils": "5.13.0",
63
63
  "lodash": "4.17.21",
64
64
  "qs": "6.11.1",
65
65
  "react-intl": "6.6.2",
@@ -67,10 +67,10 @@
67
67
  "yup": "0.32.9"
68
68
  },
69
69
  "devDependencies": {
70
- "@strapi/admin": "5.13.0-beta.1",
71
- "@strapi/admin-test-utils": "5.13.0-beta.1",
72
- "@strapi/content-manager": "5.13.0-beta.1",
73
- "@strapi/types": "5.13.0-beta.1",
70
+ "@strapi/admin": "5.13.0",
71
+ "@strapi/admin-test-utils": "5.13.0",
72
+ "@strapi/content-manager": "5.13.0",
73
+ "@strapi/types": "5.13.0",
74
74
  "@testing-library/react": "15.0.7",
75
75
  "@testing-library/user-event": "14.5.2",
76
76
  "msw": "1.3.0",