@localazy/strapi-plugin 0.1.11-rc.2 → 0.1.12-rc.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 CHANGED
@@ -52,3 +52,9 @@ To run tests, run `npm run test` command. To watch tests, run `npm run test:watc
52
52
  ## Support
53
53
  - If you encounter any issues or have questions, please contact us at [team@localazy.com](mailto:team@localazy.com).
54
54
  - Join the [Localazy Discord](https://discord.gg/CAVhHrh) to discuss all things localization.
55
+
56
+ ## Configuration
57
+ ### API Endpoints Prefix
58
+ In case the Strapi Instance is running under a subfolder (`url` parameter in [Strapi documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/server.html#available-options)), Localazy Plugin needs to be additionally configured.
59
+
60
+ We provide a support for `.env ` variable `STRAPI_ADMIN_LOCALAZY_PLUGIN_BACKEND_PREFIX`. A value assigned to this variable will be used as a prefix.
@@ -6,7 +6,7 @@ import axios from "axios";
6
6
  import { auth } from "@strapi/helper-plugin";
7
7
  import pluginId from "../pluginId";
8
8
 
9
- const BASE_PLUGIN_PATH = `/${pluginId}`;
9
+ const BASE_PLUGIN_PATH = `${process.env.STRAPI_ADMIN_LOCALAZY_PLUGIN_BACKEND_PREFIX}/${pluginId}`;
10
10
 
11
11
  const createAxiosInstance = (baseUrl = null) => {
12
12
  if (baseUrl === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localazy/strapi-plugin",
3
- "version": "0.1.11-rc.2",
3
+ "version": "0.1.12-rc.0",
4
4
  "description": "The official Strapi Plugin by Localazy.",
5
5
  "strapi": {
6
6
  "name": "localazy",
@@ -350,7 +350,7 @@ module.exports = {
350
350
  parsedKey.uid
351
351
  );
352
352
 
353
- if (shouldSetDownloadedProperty(modelContentTransferSetup, parsedKey.rest)) {
353
+ if (typeof modelContentTransferSetup !== "undefined" && shouldSetDownloadedProperty(modelContentTransferSetup, parsedKey.rest)) {
354
354
  const parsedKeyRestWithoutComponents = parsedKey.rest.map((segment) => {
355
355
  const semicolonIndex = segment.indexOf(";");
356
356
 
@@ -438,6 +438,7 @@ module.exports = {
438
438
  messageReport.push(
439
439
  `Created new entry ${uid}[${createdEntry.id}] in language ${isoStrapi}`
440
440
  );
441
+ strapi.log.info(`Created new entry ${uid}[${createdEntry.id}] in language ${isoStrapi}`);
441
442
  } catch (e) {
442
443
  success = false;
443
444
  strapi.log.error(e.message);
@@ -463,6 +464,7 @@ module.exports = {
463
464
  messageReport.push(
464
465
  `Updated ${uid}[${updatedEntry.id}] (${isoStrapi})`
465
466
  );
467
+ strapi.log.info(`Updated ${uid}[${updatedEntry.id}] (${isoStrapi})`);
466
468
  } catch (e) {
467
469
  success = false;
468
470
  strapi.log.error(e.message);
@@ -88,10 +88,13 @@ module.exports = ({ strapi }) => ({
88
88
  "locale",
89
89
  "id",
90
90
  "createdAt",
91
- "publishedAt", // * sets as draft (no timestamp)
91
+ // "publishedAt",
92
92
  "updatedAt",
93
93
  ]);
94
94
  filteredNewEntry.locale = newEntryLocale;
95
+ // * sets as draft (no timestamp)
96
+ // ! do not completely omit as it won't process the required fields
97
+ filteredNewEntry.publishedAt = null;
95
98
 
96
99
  newLocalizationCtx.request.body = filteredNewEntry;
97
100
 
@@ -13,6 +13,11 @@ const findSetupModelByCollectionUid = (
13
13
  const currentModel = strapiContentTypesModels.find(
14
14
  (model) => model.uid === collectionUid
15
15
  );
16
+
17
+ if (!currentModel) {
18
+ return undefined;
19
+ }
20
+
16
21
  const modelContentTransferSetup = contentTransferSetup.setup
17
22
  .find((model) => Object.keys(model)[0] === currentModel.collectionName);
18
23
  return modelContentTransferSetup[currentModel.collectionName];