@localazy/strapi-plugin 0.2.13 → 1.0.0-beta.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.
- package/README.md +3 -1
- package/dist/_chunks/App-BSFfgZKU.mjs +5278 -0
- package/dist/_chunks/App-D1QaIMHX.js +5278 -0
- package/dist/_chunks/ContentTransferSetup-DHXJIxAp.js +1552 -0
- package/dist/_chunks/ContentTransferSetup-DtjcF_jM.mjs +1550 -0
- package/dist/_chunks/GlobalSettings-BON3kjHK.js +228 -0
- package/dist/_chunks/GlobalSettings-BcdibqNS.mjs +228 -0
- package/dist/_chunks/LanguagesSelector-BeijBEjg.js +47 -0
- package/dist/_chunks/LanguagesSelector-fyAIUp7M.mjs +48 -0
- package/dist/_chunks/en-BTf8goGM.mjs +8 -0
- package/dist/_chunks/en-CRtsEFtl.js +8 -0
- package/dist/_chunks/fr-C8Qw4iPZ.js +4 -0
- package/dist/_chunks/fr-hkSxFuzl.mjs +4 -0
- package/dist/_chunks/has-model-changed-BMCQX2Dd.js +316 -0
- package/dist/_chunks/has-model-changed-Dvtzpc9v.mjs +317 -0
- package/dist/_chunks/index-BQw2qi2G.js +2679 -0
- package/dist/_chunks/index-CN3Gyh5F.mjs +2678 -0
- package/dist/_chunks/isEqual-B-YVnzrp.js +205 -0
- package/dist/_chunks/isEqual-CEyT97-3.mjs +206 -0
- package/dist/_chunks/set-DUdH3vE5.js +54557 -0
- package/dist/_chunks/set-DulHAQhq.mjs +54542 -0
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.mjs +5 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/config/development/index.d.ts +15 -0
- package/dist/admin/src/config/example/index.example.d.ts +15 -0
- package/dist/admin/src/config/index.d.ts +15 -0
- package/dist/admin/src/config/local/index.d.ts +15 -0
- package/dist/admin/src/config/production/index.d.ts +15 -0
- package/dist/admin/src/i18n.d.ts +2 -0
- package/dist/admin/src/index.d.ts +10 -0
- package/dist/admin/src/modules/@common/api/strapi-api-base.d.ts +6 -0
- package/dist/admin/src/modules/@common/components/Icons/House.d.ts +2 -0
- package/dist/admin/src/modules/@common/components/Icons/Localazy.d.ts +2 -0
- package/dist/admin/src/modules/@common/components/LanguagesSelector.d.ts +11 -0
- package/dist/admin/src/modules/@common/components/PluginPageLoader.d.ts +2 -0
- package/dist/admin/src/modules/@common/components/SideNav.d.ts +2 -0
- package/dist/admin/src/modules/@common/components/TransferReport.d.ts +5 -0
- package/dist/admin/src/modules/@common/functions/flatten-deep.d.ts +2 -0
- package/dist/admin/src/modules/@common/locale/en.d.ts +14 -0
- package/dist/admin/src/modules/@common/models/supported-content-type-fields.d.ts +2 -0
- package/dist/admin/src/modules/@common/models/supported-custom-field-plugins.d.ts +2 -0
- package/dist/admin/src/modules/@common/services/i18n-service.d.ts +3 -0
- package/dist/admin/src/modules/@common/services/plugin.service.d.ts +3 -0
- package/dist/admin/src/modules/@common/services/product-analytics-service.d.ts +14 -0
- package/dist/admin/src/modules/@common/services/project-service.d.ts +4 -0
- package/dist/admin/src/modules/@common/services/user-service.d.ts +5 -0
- package/dist/admin/src/modules/@common/utils/are-locales-compatible.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/format-number.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/get-default-locale.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/history.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/is-plugin-route.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/iso-locales-utils.d.ts +3 -0
- package/dist/admin/src/modules/@common/utils/redirect-to-plugin-route.d.ts +13 -0
- package/dist/admin/src/modules/@common/utils/sort-by-model-name.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/use-header-subtitle.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/use-header-title.d.ts +2 -0
- package/dist/admin/src/modules/@common/utils/use-nav.d.ts +11 -0
- package/dist/admin/src/modules/alerts/constants/channels.d.ts +1 -0
- package/dist/admin/src/modules/alerts/constants/events.d.ts +4 -0
- package/dist/admin/src/modules/alerts/services/alerts-service.d.ts +8 -0
- package/dist/admin/src/modules/localazy-download/locale/en.d.ts +24 -0
- package/dist/admin/src/modules/localazy-download/services/download-alerts-service.d.ts +5 -0
- package/dist/admin/src/modules/localazy-download/services/localazy-download-service.d.ts +3 -0
- package/dist/admin/src/modules/localazy-upload/components/ReadDocsButton.d.ts +3 -0
- package/dist/admin/src/modules/localazy-upload/locale/en.d.ts +19 -0
- package/dist/admin/src/modules/localazy-upload/services/localazy-upload-service.d.ts +3 -0
- package/dist/admin/src/modules/localazy-upload/services/upload-alerts-service.d.ts +5 -0
- package/dist/admin/src/modules/login/components/FetchIdentity.d.ts +3 -0
- package/dist/admin/src/modules/login/components/LoginButton.d.ts +12 -0
- package/dist/admin/src/modules/login/components/LogoutButton.d.ts +6 -0
- package/dist/admin/src/modules/login/locale/en.d.ts +8 -0
- package/dist/admin/src/modules/login/services/localazy-login-service.d.ts +4 -0
- package/dist/admin/src/modules/overview/components/OverviewItem.d.ts +7 -0
- package/dist/admin/src/modules/overview/components/OverviewItemLink.d.ts +7 -0
- package/dist/admin/src/modules/overview/components/PrerequisitiesInfo.d.ts +3 -0
- package/dist/admin/src/modules/overview/locale/en.d.ts +14 -0
- package/dist/admin/src/modules/plugin-settings/components/ContentTransferSetupEmpty.d.ts +2 -0
- package/dist/admin/src/modules/plugin-settings/components/Tree.d.ts +8 -0
- package/dist/admin/src/modules/plugin-settings/components/TreeItem.d.ts +10 -0
- package/dist/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.d.ts +2 -0
- package/dist/admin/src/modules/plugin-settings/functions/get-content-transfer-setup-keys-sets.d.ts +8 -0
- package/dist/admin/src/modules/plugin-settings/functions/has-model-changed.d.ts +6 -0
- package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +49 -0
- package/dist/admin/src/modules/plugin-settings/services/plugin-settings-service.d.ts +6 -0
- package/dist/admin/src/modules/plugin-settings/services/strapi-model-service.d.ts +4 -0
- package/dist/admin/src/modules/plugin-settings/services/strapi-users-service.d.ts +3 -0
- package/dist/admin/src/modules/plugin-settings/utils/array-of-models-to-object.d.ts +2 -0
- package/dist/admin/src/modules/plugin-settings/utils/find-model-value-by-key.d.ts +2 -0
- package/dist/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.d.ts +7 -0
- package/dist/admin/src/modules/plugin-settings/utils/get-models-tree.d.ts +5 -0
- package/dist/admin/src/modules/strapi/utils/get-default-theme.d.ts +3 -0
- package/dist/admin/src/modules/user/model/localazy-identity.d.ts +15 -0
- package/dist/admin/src/modules/user/services/localazy-user-service.d.ts +6 -0
- package/dist/admin/src/pages/App.d.ts +3 -0
- package/dist/admin/src/pages/ContentTransferSetup.d.ts +4 -0
- package/dist/admin/src/pages/Download.d.ts +7 -0
- package/dist/admin/src/pages/GlobalSettings.d.ts +4 -0
- package/dist/admin/src/pages/HomePage.d.ts +2 -0
- package/dist/admin/src/pages/Login.d.ts +8 -0
- package/dist/admin/src/pages/Overview.d.ts +8 -0
- package/dist/admin/src/pages/Upload.d.ts +7 -0
- package/dist/admin/src/pluginId.d.ts +2 -0
- package/dist/admin/src/plugins/generic-connector-client.d.ts +3 -0
- package/dist/admin/src/state/localazy-identity.d.ts +13 -0
- package/dist/admin/src/utils/getTranslation.d.ts +2 -0
- package/dist/server/index.js +26000 -0
- package/dist/server/index.mjs +25989 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/core/config.d.ts +1 -0
- package/dist/server/src/config/development/index.d.ts +15 -0
- package/dist/server/src/config/example/index.example.d.ts +15 -0
- package/dist/server/src/config/index.d.ts +18 -0
- package/dist/server/src/config/local/index.d.ts +15 -0
- package/dist/server/src/config/production/index.d.ts +15 -0
- package/dist/server/src/constants/channels.d.ts +3 -0
- package/dist/server/src/constants/events.d.ts +6 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/index.d.ts +43 -0
- package/dist/server/src/controllers/localazy-auth-controller.d.ts +8 -0
- package/dist/server/src/controllers/localazy-project-controller.d.ts +7 -0
- package/dist/server/src/controllers/localazy-transfer-controller.d.ts +8 -0
- package/dist/server/src/controllers/localazy-user-controller.d.ts +9 -0
- package/dist/server/src/controllers/plugin-settings-controller.d.ts +10 -0
- package/dist/server/src/controllers/strapi-controller.d.ts +10 -0
- package/dist/server/src/core/index.d.ts +71 -0
- package/dist/server/src/db/model/content-transfer-setup.d.ts +4 -0
- package/dist/server/src/db/model/localazy-user.d.ts +17 -0
- package/dist/server/src/db/model/plugin-settings.d.ts +5 -0
- package/dist/server/src/db/model/utils/get-strapi-store.d.ts +26 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/functions/should-set-downloaded-property.d.ts +12 -0
- package/dist/server/src/index.d.ts +189 -0
- package/dist/server/src/lifecycles/deep-populate-hook.d.ts +20 -0
- package/dist/server/src/lifecycles/deprecate-event-entry-in-localazy-hook.d.ts +4 -0
- package/dist/server/src/lifecycles/upload-event-entry-to-localazy-hook.d.ts +12 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/models/plugin/content-transfer-setup.d.ts +13 -0
- package/dist/server/src/models/strapi/locale.d.ts +8 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/index.d.ts +25 -0
- package/dist/server/src/routes/localazy-auth-routes.d.ts +9 -0
- package/dist/server/src/routes/localazy-project-routes.d.ts +9 -0
- package/dist/server/src/routes/localazy-transfer-routes.d.ts +9 -0
- package/dist/server/src/routes/localazy-user-routes.d.ts +9 -0
- package/dist/server/src/routes/plugin-settings-routes.d.ts +9 -0
- package/dist/server/src/routes/strapi-routes.d.ts +9 -0
- package/dist/server/src/services/helpers/job-notification-service.d.ts +14 -0
- package/dist/server/src/services/helpers/plugin-settings-service-helper.d.ts +16 -0
- package/dist/server/src/services/index.d.ts +92 -0
- package/dist/server/src/services/localazy-pubapi-service.d.ts +12 -0
- package/dist/server/src/services/localazy-transfer-download-service.d.ts +11 -0
- package/dist/server/src/services/localazy-transfer-upload-service.d.ts +11 -0
- package/dist/server/src/services/localazy-upload-service.d.ts +28 -0
- package/dist/server/src/services/localazy-user-service.d.ts +11 -0
- package/dist/server/src/services/plugin-settings-service.d.ts +16 -0
- package/dist/server/src/services/strapi-i18n-service.d.ts +19 -0
- package/dist/server/src/services/strapi-localazy-i18n-service.d.ts +9 -0
- package/dist/server/src/services/strapi-service.d.ts +10 -0
- package/dist/server/src/utils/delay.d.ts +1 -0
- package/dist/server/src/utils/drop-property-deep.d.ts +1 -0
- package/dist/server/src/utils/flatten-object.d.ts +2 -0
- package/dist/server/src/utils/generate-random-id.d.ts +2 -0
- package/dist/server/src/utils/get-full-populate-localazy-download-object.d.ts +17 -0
- package/dist/server/src/utils/get-full-populate-localazy-upload-object.d.ts +9 -0
- package/dist/server/src/utils/get-full-populate-object.d.ts +17 -0
- package/dist/server/src/utils/get-main-keys-of-nested-array-objects.d.ts +2 -0
- package/dist/server/src/utils/get-picked-flatten-keys-for-hook-entry.d.ts +5 -0
- package/dist/server/src/utils/intl-display-name.d.ts +1 -0
- package/dist/server/src/utils/is-generally-applicable-content-type.d.ts +2 -0
- package/dist/server/src/utils/is-localazy-applicable-content-type.d.ts +2 -0
- package/dist/server/src/utils/iso-locales-utils.d.ts +3 -0
- package/dist/server/src/utils/localazy-api-client-factory.d.ts +3 -0
- package/dist/server/src/utils/localazy-generic-connector-client-factory.d.ts +3 -0
- package/dist/server/src/utils/model-utils.d.ts +7 -0
- package/dist/server/src/utils/omit-deep.d.ts +2 -0
- package/dist/server/src/utils/parsed-localazy-entry-to-create-entry.d.ts +7 -0
- package/dist/server/src/utils/parsed-localazy-entry-to-update-entry.d.ts +1 -0
- package/dist/server/src/utils/pick-entries.d.ts +2 -0
- package/dist/server/src/utils/populate-create-update-entry-with-base-entry.d.ts +1 -0
- package/dist/server/src/utils/request-initiator-helper.d.ts +9 -0
- package/dist/server/src/utils/reset-array-keys-deep.d.ts +1 -0
- package/dist/server/src/utils/transfer-setup-utils.d.ts +7 -0
- package/install/index.mjs +88 -34
- package/install/vite.config.example.js +40 -0
- package/install/vite.config.example.ts +41 -0
- package/install/{webpack.example.js → webpack.config.example.js} +2 -2
- package/install/webpack.config.example.ts +30 -0
- package/package.json +93 -55
- package/.babelrc +0 -7
- package/.eslintrc +0 -13
- package/.github/workflows/qa.yml +0 -25
- package/.github/workflows/release.yml +0 -46
- package/.nvmrc +0 -1
- package/.strapi-updater.json +0 -4
- package/CHANGELOG.md +0 -68
- package/LICENSE +0 -21
- package/admin/src/components/Initializer/index.js +0 -26
- package/admin/src/components/PluginIcon/index.js +0 -14
- package/admin/src/config/development/index.js +0 -14
- package/admin/src/config/example/index.js +0 -14
- package/admin/src/config/index.js +0 -19
- package/admin/src/config/local/index.js +0 -14
- package/admin/src/config/production/index.js +0 -15
- package/admin/src/i18n.js +0 -41
- package/admin/src/index.js +0 -138
- package/admin/src/modules/@common/components/Icons/Localazy/index.js +0 -12
- package/admin/src/modules/@common/components/LanguagesSelector/index.js +0 -67
- package/admin/src/modules/@common/components/PluginPageLoader/index.js +0 -20
- package/admin/src/modules/@common/components/SideNav/index.js +0 -46
- package/admin/src/modules/@common/components/TransferReport/index.js +0 -53
- package/admin/src/modules/@common/locale/en.js +0 -14
- package/admin/src/modules/@common/models/supported-content-type-fields.js +0 -9
- package/admin/src/modules/@common/models/supported-custom-field-plugins.js +0 -6
- package/admin/src/modules/@common/services/i18n-service.js +0 -15
- package/admin/src/modules/@common/services/plugin.service.js +0 -16
- package/admin/src/modules/@common/services/product-analytics-service.js +0 -86
- package/admin/src/modules/@common/services/project-service.js +0 -15
- package/admin/src/modules/@common/services/user-service.js +0 -38
- package/admin/src/modules/@common/utils/__tests__/iso-locales-utils.test.js +0 -102
- package/admin/src/modules/@common/utils/are-locales-compatible.js +0 -42
- package/admin/src/modules/@common/utils/format-number.js +0 -1
- package/admin/src/modules/@common/utils/functions/flatten-deep.js +0 -23
- package/admin/src/modules/@common/utils/get-default-locale.js +0 -32
- package/admin/src/modules/@common/utils/get-header-subtitle.js +0 -21
- package/admin/src/modules/@common/utils/get-header-title.js +0 -24
- package/admin/src/modules/@common/utils/get-nav.js +0 -35
- package/admin/src/modules/@common/utils/history.js +0 -6
- package/admin/src/modules/@common/utils/is-plugin-route.js +0 -15
- package/admin/src/modules/@common/utils/iso-locales-utils.js +0 -58
- package/admin/src/modules/@common/utils/redirect-to-plugin-route.js +0 -22
- package/admin/src/modules/@common/utils/sort-by-model-name.js +0 -10
- package/admin/src/modules/alerts/constants/channels.js +0 -1
- package/admin/src/modules/alerts/constants/events.js +0 -4
- package/admin/src/modules/alerts/services/alerts-service.js +0 -41
- package/admin/src/modules/localazy-download/locale/en.js +0 -25
- package/admin/src/modules/localazy-download/services/download-alerts-service.js +0 -12
- package/admin/src/modules/localazy-download/services/localazy-download-service.js +0 -16
- package/admin/src/modules/localazy-upload/components/ReadDocsButton.js +0 -20
- package/admin/src/modules/localazy-upload/locale/en.js +0 -20
- package/admin/src/modules/localazy-upload/services/localazy-upload-service.js +0 -16
- package/admin/src/modules/localazy-upload/services/upload-alerts-service.js +0 -12
- package/admin/src/modules/login/components/LoginButton/index.js +0 -55
- package/admin/src/modules/login/components/LogoutButton/index.js +0 -49
- package/admin/src/modules/login/locale/en.js +0 -7
- package/admin/src/modules/login/services/localazy-login-service.js +0 -29
- package/admin/src/modules/plugin-settings/components/ContentTransferSetup/index.js +0 -308
- package/admin/src/modules/plugin-settings/components/ContentTransferSetupEmpty/index.js +0 -86
- package/admin/src/modules/plugin-settings/components/GlobalSettings/index.js +0 -269
- package/admin/src/modules/plugin-settings/components/Tree/index.js +0 -145
- package/admin/src/modules/plugin-settings/components/TreeItem/index.js +0 -48
- package/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.js +0 -57
- package/admin/src/modules/plugin-settings/functions/get-content-transfer-setup-keys-sets.js +0 -85
- package/admin/src/modules/plugin-settings/functions/has-model-changed.js +0 -75
- package/admin/src/modules/plugin-settings/locale/en.js +0 -61
- package/admin/src/modules/plugin-settings/services/plugin-settings-service.js +0 -55
- package/admin/src/modules/plugin-settings/services/strapi-model-service.js +0 -26
- package/admin/src/modules/plugin-settings/services/strapi-users-service.js +0 -26
- package/admin/src/modules/plugin-settings/utils/__tests__/get-models-tree.test.js +0 -135
- package/admin/src/modules/plugin-settings/utils/array-of-models-to-object.js +0 -6
- package/admin/src/modules/plugin-settings/utils/find-model-value-by-key.js +0 -8
- package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +0 -31
- package/admin/src/modules/plugin-settings/utils/get-models-tree.js +0 -94
- package/admin/src/modules/settings/components/OverviewItem/index.js +0 -44
- package/admin/src/modules/settings/components/OverviewItemLink/index.js +0 -34
- package/admin/src/modules/settings/components/PrerequisitiesInfo/index.js +0 -28
- package/admin/src/modules/settings/locale/en.js +0 -13
- package/admin/src/modules/user/model/localazy-identity.js +0 -14
- package/admin/src/modules/user/services/localazy-user-service.js +0 -38
- package/admin/src/pages/App/index.js +0 -154
- package/admin/src/pages/Download/index.js +0 -280
- package/admin/src/pages/Index/index.js +0 -8
- package/admin/src/pages/Login/index.js +0 -109
- package/admin/src/pages/PluginSettings/index.js +0 -56
- package/admin/src/pages/Settings/index.js +0 -132
- package/admin/src/pages/Upload/index.js +0 -241
- package/admin/src/pluginId.js +0 -5
- package/admin/src/plugins/generic-connector-client.js +0 -9
- package/admin/src/state/localazy-identity.js +0 -29
- package/admin/src/tests/fixtures/all-models.js +0 -877
- package/admin/src/tests/fixtures/restaurant-model.js +0 -230
- package/admin/src/translations/en.json +0 -4
- package/admin/src/translations/fr.json +0 -1
- package/admin/src/utils/createAxiosInstance.js +0 -54
- package/admin/src/utils/getTrad.js +0 -5
- package/jest.config.js +0 -0
- package/server/bootstrap.js +0 -63
- package/server/config/development/index.js +0 -16
- package/server/config/example/index.js +0 -16
- package/server/config/index.js +0 -20
- package/server/config/local/index.js +0 -16
- package/server/config/production/index.js +0 -17
- package/server/config/schema.graphql.js +0 -21
- package/server/constants/channels.js +0 -3
- package/server/constants/events.js +0 -6
- package/server/content-types/index.js +0 -3
- package/server/controllers/index.js +0 -17
- package/server/controllers/localazy-auth-controller.js +0 -22
- package/server/controllers/localazy-project-controller.js +0 -21
- package/server/controllers/localazy-transfer-controller.js +0 -62
- package/server/controllers/localazy-user-controller.js +0 -24
- package/server/controllers/plugin-settings-controller.js +0 -31
- package/server/controllers/strapi-controller.js +0 -27
- package/server/db/model/content-transfer-setup.js +0 -13
- package/server/db/model/localazy-user.js +0 -23
- package/server/db/model/plugin-settings.js +0 -13
- package/server/db/model/utils/get-strapi-store.js +0 -9
- package/server/destroy.js +0 -5
- package/server/functions/should-set-downloaded-property.js +0 -94
- package/server/index.js +0 -25
- package/server/lifecycles/deep-populate-hook.js +0 -12
- package/server/lifecycles/deprecate-event-entry-in-localazy-hook.js +0 -73
- package/server/lifecycles/upload-event-entry-to-localazy-hook.js +0 -36
- package/server/middlewares/index.js +0 -7
- package/server/middlewares/verify-webhook.js +0 -76
- package/server/models/supported-content-type-fields.js +0 -9
- package/server/models/supported-custom-field-plugins.js +0 -6
- package/server/policies/index.js +0 -3
- package/server/register.js +0 -5
- package/server/routes/index.js +0 -28
- package/server/routes/localazy-auth.js +0 -22
- package/server/routes/localazy-project.js +0 -14
- package/server/routes/localazy-public-transfer.js +0 -20
- package/server/routes/localazy-transfer.js +0 -22
- package/server/routes/localazy-user.js +0 -30
- package/server/routes/plugin-settings.js +0 -38
- package/server/routes/strapi.js +0 -38
- package/server/services/helpers/job-notification-service.js +0 -30
- package/server/services/helpers/plugin-settings-service-helper.js +0 -52
- package/server/services/index.js +0 -23
- package/server/services/localazy-pubapi-service.js +0 -53
- package/server/services/localazy-transfer-download-service.js +0 -445
- package/server/services/localazy-transfer-upload-service.js +0 -178
- package/server/services/localazy-upload-service.js +0 -52
- package/server/services/localazy-user-service.js +0 -29
- package/server/services/plugin-settings-service.js +0 -53
- package/server/services/strapi-i18n-service.js +0 -151
- package/server/services/strapi-localazy-i18n-service.js +0 -130
- package/server/services/strapi-service.js +0 -26
- package/server/tests/fixtures/all-models.js +0 -869
- package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-cookbook.js +0 -5761
- package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-lesson-dz.js +0 -402
- package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-page-dz.js +0 -658
- package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-restaurant-simple-menu.js +0 -536
- package/server/tests/fixtures/parsed-localazy-entry-to-update-entry.js +0 -35157
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js +0 -202
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook.js +0 -2700
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz.js +0 -309
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple.js +0 -47
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media.js +0 -169
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty.js +0 -3003
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media.js +0 -2057
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz.js +0 -884
- package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json.js +0 -46
- package/server/tests/fixtures/strapi-plugin-all-models.js +0 -7000
- package/server/utils/__tests__/build-populate.test.js +0 -85
- package/server/utils/__tests__/flatten-object.test.js +0 -171
- package/server/utils/__tests__/get-models-tree.test.js +0 -170
- package/server/utils/__tests__/iso-locales-utils.test.js +0 -104
- package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +0 -258
- package/server/utils/__tests__/parsed-localazy-entry-to-update-entry.test.js +0 -456
- package/server/utils/__tests__/pick-entries.test.js +0 -963
- package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +0 -1176
- package/server/utils/build-populate.js +0 -48
- package/server/utils/delay.js +0 -6
- package/server/utils/flatten-object.js +0 -61
- package/server/utils/generate-random-id.js +0 -3
- package/server/utils/get-full-populate-object.js +0 -66
- package/server/utils/get-main-keys-of-nested-array-objects.js +0 -5
- package/server/utils/get-models-tree.js +0 -47
- package/server/utils/get-picked-flatten-keys-for-hook-entry.js +0 -270
- package/server/utils/intl-display-name.js +0 -4
- package/server/utils/is-generally-applicable-content-type.js +0 -33
- package/server/utils/is-localazy-applicable-content-type.js +0 -36
- package/server/utils/iso-locales-utils.js +0 -60
- package/server/utils/localazy-api-client-factory.js +0 -22
- package/server/utils/localazy-generic-connector-client-factory.js +0 -15
- package/server/utils/model-utils.js +0 -43
- package/server/utils/objectivise-entry.js +0 -41
- package/server/utils/omit-deep.js +0 -24
- package/server/utils/parsed-localazy-entry-to-create-entry.js +0 -194
- package/server/utils/parsed-localazy-entry-to-update-entry.js +0 -83
- package/server/utils/pick-deep.js +0 -22
- package/server/utils/pick-entries.js +0 -37
- package/server/utils/populate-create-update-entry-with-base-entry.js +0 -264
- package/server/utils/request-initiator-helper.js +0 -36
- package/server/utils/reset-array-keys-deep.js +0 -19
- package/server/utils/transfer-setup-utils.js +0 -93
- package/strapi-admin.js +0 -14
- package/strapi-server.js +0 -5
- package/test/helpers/mocks.js +0 -9
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-useless-catch */
|
|
2
|
-
import createAxiosInstance from "../../../utils/createAxiosInstance";
|
|
3
|
-
|
|
4
|
-
const BASE_PATH = "/user";
|
|
5
|
-
const axiosInstance = createAxiosInstance();
|
|
6
|
-
export default class UserService {
|
|
7
|
-
static async generateKeys() {
|
|
8
|
-
try {
|
|
9
|
-
const result = await axiosInstance.get(`${BASE_PATH}/token`);
|
|
10
|
-
|
|
11
|
-
return result.data;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
throw e;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static async continuousPoll(token) {
|
|
18
|
-
try {
|
|
19
|
-
const result = await axiosInstance.post(`${BASE_PATH}/token`, {
|
|
20
|
-
token,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return result.data;
|
|
24
|
-
} catch (e) {
|
|
25
|
-
throw e;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static async deleteToken() {
|
|
30
|
-
try {
|
|
31
|
-
const result = await axiosInstance.delete(`${BASE_PATH}/token`);
|
|
32
|
-
|
|
33
|
-
return result.data;
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw e;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
const { isoStrapiToLocalazy, isoLocalazyToStrapi } = require("../iso-locales-utils");
|
|
2
|
-
|
|
3
|
-
describe("iso-locales-utils.js", () => {
|
|
4
|
-
describe("transform Strapi ISO to Localazy ISO", () => {
|
|
5
|
-
it("should transform codes containing lang only", () => {
|
|
6
|
-
// setup
|
|
7
|
-
const input = ["en", "fr", "de", "es", "it", "ja", "ko", "pt", "ru", "zh"];
|
|
8
|
-
|
|
9
|
-
// execute
|
|
10
|
-
const output = input.map((item) => isoStrapiToLocalazy(item));
|
|
11
|
-
|
|
12
|
-
// verify
|
|
13
|
-
const expected = input;
|
|
14
|
-
expect(output).toEqual(expected);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should transform codes containing lang-region", () => {
|
|
18
|
-
// setup
|
|
19
|
-
const input = ["en-US", "fr-CA", "de-DE", "es-ES", "it-IT", "ja-JP", "ko-KR", "pt-BR", "ru-RU", "zh-CN"];
|
|
20
|
-
|
|
21
|
-
// execute
|
|
22
|
-
const output = input.map((item) => isoStrapiToLocalazy(item));
|
|
23
|
-
|
|
24
|
-
// verify
|
|
25
|
-
const expected = ["en_US", "fr_CA", "de_DE", "es_ES", "it_IT", "ja_JP", "ko_KR", "pt_BR", "ru_RU", "zh_CN"];
|
|
26
|
-
expect(output).toEqual(expected);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("should transform codes containing lang-script", () => {
|
|
30
|
-
// setup
|
|
31
|
-
const input = ["en-Latn", "fr-Latn", "de-Latn", "es-Latn", "it-Latn", "ja-Latn", "ko-Latn", "pt-Latn", "ru-Latn", "zh-Latn"];
|
|
32
|
-
|
|
33
|
-
// execute
|
|
34
|
-
const output = input.map((item) => isoStrapiToLocalazy(item));
|
|
35
|
-
|
|
36
|
-
// verify
|
|
37
|
-
const expected = ["en#Latn", "fr#Latn", "de#Latn", "es#Latn", "it#Latn", "ja#Latn", "ko#Latn", "pt#Latn", "ru#Latn", "zh#Latn"];
|
|
38
|
-
expect(output).toEqual(expected);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should transform codes containing lang-script-region", () => {
|
|
42
|
-
// setup
|
|
43
|
-
const input = ["en-Latn-US", "fr-Latn-CA", "de-Latn-DE", "es-Latn-ES", "it-Latn-IT", "ja-Latn-JP", "ko-Latn-KR", "pt-Latn-BR", "ru-Latn-RU", "zh-Hant-CN"];
|
|
44
|
-
|
|
45
|
-
// execute
|
|
46
|
-
const output = input.map((item) => isoStrapiToLocalazy(item));
|
|
47
|
-
|
|
48
|
-
// verify
|
|
49
|
-
const expected = ["en_US#Latn", "fr_CA#Latn", "de_DE#Latn", "es_ES#Latn", "it_IT#Latn", "ja_JP#Latn", "ko_KR#Latn", "pt_BR#Latn", "ru_RU#Latn", "zh_CN#Hant"];
|
|
50
|
-
expect(output).toEqual(expected);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe("transform Strapi ISO to Localazy ISO", () => {
|
|
55
|
-
it("should transform codes containing lang only", () => {
|
|
56
|
-
// setup
|
|
57
|
-
const input = ["en", "fr", "de", "es", "it", "ja", "ko", "pt", "ru", "zh"];
|
|
58
|
-
|
|
59
|
-
// execute
|
|
60
|
-
const output = input.map((item) => isoLocalazyToStrapi(item));
|
|
61
|
-
|
|
62
|
-
// verify
|
|
63
|
-
const expected = input;
|
|
64
|
-
expect(output).toEqual(expected);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("should transform codes containing lang-region", () => {
|
|
68
|
-
// setup
|
|
69
|
-
const input = ["en_US", "fr_CA", "de_DE", "es_ES", "it_IT", "ja_JP", "ko_KR", "pt_BR", "ru_RU", "zh_CN"];
|
|
70
|
-
|
|
71
|
-
// execute
|
|
72
|
-
const output = input.map((item) => isoLocalazyToStrapi(item));
|
|
73
|
-
|
|
74
|
-
// verify
|
|
75
|
-
const expected = ["en-US", "fr-CA", "de-DE", "es-ES", "it-IT", "ja-JP", "ko-KR", "pt-BR", "ru-RU", "zh-CN"];
|
|
76
|
-
expect(output).toEqual(expected);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("should transform codes containing lang-script", () => {
|
|
80
|
-
// setup
|
|
81
|
-
const input = ["en#Latn", "fr#Latn", "de#Latn", "es#Latn", "it#Latn", "ja#Latn", "ko#Latn", "pt#Latn", "ru#Latn", "zh#Latn"];
|
|
82
|
-
|
|
83
|
-
// execute
|
|
84
|
-
const output = input.map((item) => isoLocalazyToStrapi(item));
|
|
85
|
-
|
|
86
|
-
// verify
|
|
87
|
-
const expected = ["en-Latn", "fr-Latn", "de-Latn", "es-Latn", "it-Latn", "ja-Latn", "ko-Latn", "pt-Latn", "ru-Latn", "zh-Latn"];
|
|
88
|
-
expect(output).toEqual(expected);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("should transform codes containing lang-script-region", () => {
|
|
92
|
-
// setup
|
|
93
|
-
const input = ["en_US#Latn", "fr_CA#Latn", "de_DE#Latn", "es_ES#Latn", "it_IT#Latn", "ja_JP#Latn", "ko_KR#Latn", "pt_BR#Latn", "ru_RU#Latn", "zh_CN#Hant"];
|
|
94
|
-
|
|
95
|
-
// execute
|
|
96
|
-
const output = input.map((item) => isoLocalazyToStrapi(item));
|
|
97
|
-
// verify
|
|
98
|
-
const expected = ["en-Latn-US", "fr-Latn-CA", "de-Latn-DE", "es-Latn-ES", "it-Latn-IT", "ja-Latn-JP", "ko-Latn-KR", "pt-Latn-BR", "ru-Latn-RU", "zh-Hant-CN"];
|
|
99
|
-
expect(output).toEqual(expected);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import I18nService from "../services/i18n-service";
|
|
2
|
-
import ProjectService from "../services/project-service";
|
|
3
|
-
import { isoLocalazyToStrapi } from "./iso-locales-utils";
|
|
4
|
-
|
|
5
|
-
export default async (defaultLocale = null, sourceLanguage = null) => {
|
|
6
|
-
try {
|
|
7
|
-
if (!defaultLocale) {
|
|
8
|
-
const locales = await I18nService.getLocales();
|
|
9
|
-
defaultLocale = locales.find((locale) => !!locale.isDefault);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (!defaultLocale) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!sourceLanguage) {
|
|
17
|
-
const connectedProject = await ProjectService.getConnectedProject();
|
|
18
|
-
|
|
19
|
-
if (!connectedProject) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const sourceLanguageId = connectedProject.sourceLanguage;
|
|
24
|
-
sourceLanguage = connectedProject.languages.find(
|
|
25
|
-
(language) => language.id === sourceLanguageId
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!sourceLanguage) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const defaultLocaleCode = defaultLocale.code;
|
|
34
|
-
const sourceLanguageStrapiCode = isoLocalazyToStrapi(sourceLanguage.code);
|
|
35
|
-
|
|
36
|
-
return defaultLocaleCode === sourceLanguageStrapiCode;
|
|
37
|
-
} catch (e) {
|
|
38
|
-
console.error(e.message);
|
|
39
|
-
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default (value, options = undefined) => new Intl.NumberFormat("en-GB", options).format(value);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import each from "lodash-es/each";
|
|
2
|
-
import isObject from "lodash-es/isObject";
|
|
3
|
-
import isArray from "lodash-es/isArray";
|
|
4
|
-
|
|
5
|
-
export default function flattenObject(obj, delimiter) {
|
|
6
|
-
const delim = delimiter || '.';
|
|
7
|
-
const nobj = {};
|
|
8
|
-
|
|
9
|
-
each(obj, (val, key) => {
|
|
10
|
-
// ensure is JSON key-value map, not array
|
|
11
|
-
if (isObject(val) && !isArray(val)) {
|
|
12
|
-
// union the returned result by concat all keys
|
|
13
|
-
const strip = flattenObject(val, delim);
|
|
14
|
-
each(strip, (v, k) => {
|
|
15
|
-
nobj[key + delim + k] = v;
|
|
16
|
-
})
|
|
17
|
-
} else {
|
|
18
|
-
nobj[key] = val;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return nobj;
|
|
23
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import I18nService from "../services/i18n-service";
|
|
2
|
-
import ProjectService from "../services/project-service";
|
|
3
|
-
|
|
4
|
-
export async function getStrapiDefaultLocale() {
|
|
5
|
-
const locales = await I18nService.getLocales();
|
|
6
|
-
const defaultLocale = locales.find((locale) => !!locale.isDefault);
|
|
7
|
-
|
|
8
|
-
if (!defaultLocale) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return defaultLocale;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export async function getLocalazySourceLanguage() {
|
|
16
|
-
const connectedProject = await ProjectService.getConnectedProject();
|
|
17
|
-
|
|
18
|
-
if (!connectedProject) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const sourceLanguageId = connectedProject.sourceLanguage;
|
|
23
|
-
const sourceLanguage = connectedProject.languages.find(
|
|
24
|
-
(language) => language.id === sourceLanguageId
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (!sourceLanguage) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return sourceLanguage;
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useLocation } from "react-router-dom";
|
|
2
|
-
import getNav from "./get-nav";
|
|
3
|
-
import pluginId from "../../../pluginId";
|
|
4
|
-
|
|
5
|
-
export default (location = null) => {
|
|
6
|
-
if (!location) {
|
|
7
|
-
location = useLocation();
|
|
8
|
-
}
|
|
9
|
-
// segment after pluginId
|
|
10
|
-
const pluginSegment = location.pathname.split(`/${pluginId}/`)[1];
|
|
11
|
-
|
|
12
|
-
if (!pluginSegment) {
|
|
13
|
-
return "";
|
|
14
|
-
}
|
|
15
|
-
const navigation = getNav();
|
|
16
|
-
const currentNavItem = navigation.find((navItem) =>
|
|
17
|
-
pluginSegment.includes(navItem.id)
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
return currentNavItem?.description || "";
|
|
21
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useLocation } from "react-router-dom";
|
|
2
|
-
import getNav from "./get-nav";
|
|
3
|
-
import pluginId from "../../../pluginId";
|
|
4
|
-
import i18n from "../../../i18n";
|
|
5
|
-
|
|
6
|
-
const t = i18n.t;
|
|
7
|
-
|
|
8
|
-
export default (location = null) => {
|
|
9
|
-
if (!location) {
|
|
10
|
-
location = useLocation();
|
|
11
|
-
}
|
|
12
|
-
// segment after pluginId
|
|
13
|
-
const pluginSegment = location.pathname.split(`/${pluginId}/`)[1];
|
|
14
|
-
|
|
15
|
-
if (!pluginSegment) {
|
|
16
|
-
return t("common.localazy_plugin_hand");
|
|
17
|
-
}
|
|
18
|
-
const navigation = getNav();
|
|
19
|
-
const currentNavItem = navigation.find((navItem) =>
|
|
20
|
-
pluginSegment.includes(navItem.id)
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return currentNavItem?.label || t("common.localazy_plugin_hand");
|
|
24
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import House from "@strapi/icons/House";
|
|
3
|
-
import Download from "@strapi/icons/Download";
|
|
4
|
-
import Upload from "@strapi/icons/Upload";
|
|
5
|
-
import pluginId from "../../../pluginId";
|
|
6
|
-
import i18n from "../../../i18n";
|
|
7
|
-
|
|
8
|
-
const BASE_PATH = `${process.env.ADMIN_PATH}plugins/${pluginId}`;
|
|
9
|
-
const t = i18n.t;
|
|
10
|
-
const gevNav = () => {
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
id: "settings",
|
|
14
|
-
label: t("common.settings"),
|
|
15
|
-
description: t("settings.description"),
|
|
16
|
-
icon: <House />,
|
|
17
|
-
to: `${BASE_PATH}/settings`,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: "upload",
|
|
21
|
-
label: t("common.upload_to_localazy"),
|
|
22
|
-
description: t("upload.description"),
|
|
23
|
-
icon: < Upload />,
|
|
24
|
-
to: `${BASE_PATH}/upload`,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: "download",
|
|
28
|
-
label: t("common.download_to_strapi"),
|
|
29
|
-
description: t("download.description"),
|
|
30
|
-
icon: <Download />,
|
|
31
|
-
to: `${BASE_PATH}/download`,
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
};
|
|
35
|
-
export default gevNav;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import pluginId from "../../../pluginId";
|
|
2
|
-
|
|
3
|
-
export default (location, path = "") => {
|
|
4
|
-
if (path) {
|
|
5
|
-
return (
|
|
6
|
-
location.pathname.endsWith(`${pluginId}/${path}`) ||
|
|
7
|
-
location.pathname.endsWith(`${pluginId}/${path}/`)
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
location.pathname.endsWith(pluginId) ||
|
|
13
|
-
location.pathname.endsWith(`${pluginId}/`)
|
|
14
|
-
);
|
|
15
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export const isoStrapiToLocalazy = (isoStrapi) => {
|
|
2
|
-
if (!isoStrapi) {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const split = isoStrapi.split("-");
|
|
7
|
-
const language = split[0];
|
|
8
|
-
|
|
9
|
-
const hasRegionAndScript = split.length === 3;
|
|
10
|
-
|
|
11
|
-
if (hasRegionAndScript) {
|
|
12
|
-
const script = split[1];
|
|
13
|
-
const region = split[2];
|
|
14
|
-
|
|
15
|
-
return `${language}_${region}#${script}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const hasPossiblyRegion = split.length === 2;
|
|
19
|
-
|
|
20
|
-
if (hasPossiblyRegion) {
|
|
21
|
-
const regionOrScript = split[1];
|
|
22
|
-
|
|
23
|
-
// is it script - the way Strapi resolves that
|
|
24
|
-
const isItRegion = regionOrScript.toUpperCase() === regionOrScript;
|
|
25
|
-
|
|
26
|
-
// it is region; otherwise it is script
|
|
27
|
-
return isItRegion ? `${language}_${regionOrScript}` : `${language}#${regionOrScript}`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return isoStrapi.replace("-", "_");
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const isoLocalazyToStrapi = (isoLocalazy) => {
|
|
34
|
-
if (!isoLocalazy) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const scriptIndex = isoLocalazy.indexOf("#");
|
|
39
|
-
const hasScript = scriptIndex > -1;
|
|
40
|
-
|
|
41
|
-
if (hasScript) {
|
|
42
|
-
const script = isoLocalazy.substring(scriptIndex + 1);
|
|
43
|
-
const isoLocalazyWithoutScript = isoLocalazy.substring(0, scriptIndex);
|
|
44
|
-
const split = isoLocalazyWithoutScript.split("_");
|
|
45
|
-
const language = split[0];
|
|
46
|
-
const region = split[1];
|
|
47
|
-
|
|
48
|
-
if (!region) {
|
|
49
|
-
return `${language}-${script}`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const isoStrapi = `${language}-${script}-${region.toUpperCase()}`;
|
|
53
|
-
|
|
54
|
-
return isoStrapi;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return isoLocalazy.replace("_", "-");
|
|
58
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import pluginId from "../../../pluginId";
|
|
2
|
-
import history from "./history";
|
|
3
|
-
|
|
4
|
-
export const PLUGIN_ROUTES = {
|
|
5
|
-
ROOT: "",
|
|
6
|
-
LOGIN: "login",
|
|
7
|
-
UPLOAD: "upload",
|
|
8
|
-
DOWNLOAD: "download",
|
|
9
|
-
SETTINGS: "settings",
|
|
10
|
-
// settings routes
|
|
11
|
-
CONTENT_TRANSFER_SETUP: "content-transfer-setup",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default (route) => {
|
|
15
|
-
if (route === PLUGIN_ROUTES.CONTENT_TRANSFER_SETUP) {
|
|
16
|
-
history.push(`${process.env.ADMIN_PATH}/settings/${pluginId}/${route}`);
|
|
17
|
-
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
history.push(`${process.env.ADMIN_PATH}plugins/${pluginId}/${route}`);
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const LOCALAZY_PLUGIN_CHANNEL = "localazy-plugin";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import SocketIoClient from "socket.io-client";
|
|
2
|
-
import { LOCALAZY_PLUGIN_CHANNEL } from "../constants/channels";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default class AlertsService {
|
|
6
|
-
_client;
|
|
7
|
-
|
|
8
|
-
_streamIdentifier;
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
const uri = process.env.STRAPI_ADMIN_BACKEND_URL;
|
|
12
|
-
let path = '/socket.io'; // SocketIoClient defaults to this path too if it is not defined
|
|
13
|
-
|
|
14
|
-
// If uri is not undefined nor empty, use the correct path to Strapi's socket
|
|
15
|
-
if (uri !== undefined && uri.length > 0) {
|
|
16
|
-
try {
|
|
17
|
-
const { pathname } = new URL(
|
|
18
|
-
uri,
|
|
19
|
-
window.location.href // Mandatory in case uri is not a complete URL (e.g. /cms)
|
|
20
|
-
);
|
|
21
|
-
path = `${pathname}${pathname.endsWith('/') ? '' : '/'}socket.io`;
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.error(e);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this._client = SocketIoClient.connect(uri, { path });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setStreamIdentifier(streamIdentifier) {
|
|
31
|
-
this._streamIdentifier = streamIdentifier;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
subscribe(channel = null) {
|
|
35
|
-
this._client.emit("subscribe", channel || LOCALAZY_PLUGIN_CHANNEL);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
on(event, callback) {
|
|
39
|
-
this._client.on(`${event}:${this._streamIdentifier}`, callback);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
description: "Download content in multiple languages to your Strapi project",
|
|
3
|
-
download_to_strapi: "Start download",
|
|
4
|
-
content_types_model_changed: "Content Types Model Changed",
|
|
5
|
-
close: "Close",
|
|
6
|
-
please_update_your_content:
|
|
7
|
-
"Please update your content transfer setup before proceeding to upload/download",
|
|
8
|
-
languages_incompatible: "Languages incompatible",
|
|
9
|
-
languages_incompatible_message:
|
|
10
|
-
"Strapi default language and Localazy source language are incompatible, to proceed, please update one of them.",
|
|
11
|
-
download_result: "Download completed:",
|
|
12
|
-
download_success: "Content successfully imported to Strapi.",
|
|
13
|
-
download_failed: "Download partially failed, please check the report for details...",
|
|
14
|
-
translate_in_localazy: "Translate in Localazy",
|
|
15
|
-
download_note_a: "Download ",
|
|
16
|
-
download_note_b: "will rewrite all previous translations.",
|
|
17
|
-
make_sure_note_a: "Make sure the translations are approved in Localazy, otherwise they ",
|
|
18
|
-
make_sure_note_b: "will not ",
|
|
19
|
-
make_sure_note_c: "be downloaded to Strapi.",
|
|
20
|
-
ui_languages: "Select languages to download",
|
|
21
|
-
ui_languages_info: "Select translations of which languages wil be downloaded from Localazy",
|
|
22
|
-
ui_languages_placeholder: "Download all languages",
|
|
23
|
-
download_in_progress: "Download in progress: Please do not close or refresh this page if you wish to see the progress information.",
|
|
24
|
-
to_see_to_progress: "The operation will continue running in the background even if you close the page, but you will lose access to the status report.",
|
|
25
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import AlertsService from "../../alerts/services/alerts-service";
|
|
2
|
-
import { DOWNLOAD_EVENT, DOWNLOAD_FINISHED_EVENT } from "../../alerts/constants/events";
|
|
3
|
-
|
|
4
|
-
export default class DownloadAlertsService extends AlertsService {
|
|
5
|
-
onDownload(callback) {
|
|
6
|
-
this.on(DOWNLOAD_EVENT, callback);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
onDownloadFinished(callback) {
|
|
10
|
-
this.on(DOWNLOAD_FINISHED_EVENT, callback);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import createAxiosInstance from "../../../utils/createAxiosInstance";
|
|
2
|
-
|
|
3
|
-
const BASE_PATH = "/transfer";
|
|
4
|
-
const axiosInstance = createAxiosInstance();
|
|
5
|
-
|
|
6
|
-
export default class LocalazyDownloadService {
|
|
7
|
-
static async download(data = {}) {
|
|
8
|
-
try {
|
|
9
|
-
const result = await axiosInstance.post(`${BASE_PATH}/download`, data);
|
|
10
|
-
|
|
11
|
-
return result.data;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
throw e.data;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Button } from "@strapi/design-system/Button";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
|
|
5
|
-
function ReadDocsButton() {
|
|
6
|
-
const { t } = useTranslation();
|
|
7
|
-
|
|
8
|
-
const link = "https://localazy.com/docs/strapi";
|
|
9
|
-
const onReadDocumentationClick = () => {
|
|
10
|
-
window.open(link, "_blank");
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Button variant="tertiary" onClick={onReadDocumentationClick}>
|
|
15
|
-
{t("upload.read_documentation")}
|
|
16
|
-
</Button>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default ReadDocsButton;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
description: "Upload your content from Strapi to Localazy",
|
|
3
|
-
upload_to_localazy: "Start upload",
|
|
4
|
-
default_strapi_language: "Default Strapi language",
|
|
5
|
-
localazy_source_language: "Localazy source language",
|
|
6
|
-
change_settings: "Change settings",
|
|
7
|
-
read_documentation: "Read documentation",
|
|
8
|
-
content_types_model_changed: "Content Types Model Changed",
|
|
9
|
-
close: "Close",
|
|
10
|
-
please_update_your_content:
|
|
11
|
-
"Please update your content transfer configuration before proceeding to upload/download.",
|
|
12
|
-
languages_incompatible: "Languages mismatch!",
|
|
13
|
-
languages_incompatible_message: "The source language at Localazy doesn't match the Strapi default language setting. To continue, please set both languages to be the same.",
|
|
14
|
-
upload_result: "Upload completed:",
|
|
15
|
-
upload_success: "Content successfully imported to the Localazy project.",
|
|
16
|
-
upload_failed:
|
|
17
|
-
"Upload partially failed, please check the report for details...",
|
|
18
|
-
upload_in_progress: "Upload in progress: Please do not close or refresh this page if you wish to see the progress information.",
|
|
19
|
-
to_see_to_progress: "The operation will continue running in the background even if you close the page, but you will lose access to the status report.",
|
|
20
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import createAxiosInstance from "../../../utils/createAxiosInstance";
|
|
2
|
-
|
|
3
|
-
const BASE_PATH = "/transfer";
|
|
4
|
-
const axiosInstance = createAxiosInstance();
|
|
5
|
-
|
|
6
|
-
export default class LocalazyUploadService {
|
|
7
|
-
static async upload(data = {}) {
|
|
8
|
-
try {
|
|
9
|
-
const result = await axiosInstance.post(`${BASE_PATH}/upload`, data);
|
|
10
|
-
|
|
11
|
-
return result.data;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
throw e.data;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import AlertsService from "../../alerts/services/alerts-service";
|
|
2
|
-
import { UPLOAD_EVENT, UPLOAD_FINISHED_EVENT } from "../../alerts/constants/events";
|
|
3
|
-
|
|
4
|
-
export default class UploadAlertsService extends AlertsService {
|
|
5
|
-
onUpload(callback) {
|
|
6
|
-
this.on(UPLOAD_EVENT, callback);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
onUploadFinished(callback) {
|
|
10
|
-
this.on(UPLOAD_FINISHED_EVENT, callback);
|
|
11
|
-
}
|
|
12
|
-
}
|