@littlebox/strapi-suite 1.0.35 → 1.0.36

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.
@@ -435,19 +435,6 @@ const bootstrap = async ({ strapi: strapi2 }) => {
435
435
  type: "boolean",
436
436
  value: "false"
437
437
  },
438
- {
439
- module: "template",
440
- property: "active",
441
- type: "boolean",
442
- value: "true"
443
- }
444
- ]
445
- });
446
- } catch (e) {
447
- }
448
- try {
449
- await strapi2.db.query(config2.uuid.app.setting).createMany({
450
- data: [
451
438
  {
452
439
  module: "slug",
453
440
  property: "homepageContentId",
@@ -465,6 +452,18 @@ const bootstrap = async ({ strapi: strapi2 }) => {
465
452
  property: "homepageSlugStrategy",
466
453
  type: "string",
467
454
  value: "language"
455
+ },
456
+ {
457
+ module: "template",
458
+ property: "active",
459
+ type: "boolean",
460
+ value: "true"
461
+ },
462
+ {
463
+ module: "locale",
464
+ property: "active",
465
+ type: "boolean",
466
+ value: "true"
468
467
  }
469
468
  ]
470
469
  });
@@ -1200,6 +1199,17 @@ const TranslationModuleController = ({ strapi: strapi2 }) => ({
1200
1199
  return await strapi2.plugin(PLUGIN_ID).service("TranslationModuleService").getTranslations();
1201
1200
  }
1202
1201
  });
1202
+ const LocalesModuleController = ({ strapi: strapi2 }) => ({
1203
+ async getLocales() {
1204
+ const locales = await strapi2.plugin("i18n").service("locales").find();
1205
+ const mappedLocales = locales.map((locale) => locale.code.toLowerCase());
1206
+ const defaultLocale = await strapi2.plugin("i18n").service("locales").getDefaultLocale();
1207
+ return {
1208
+ locales: mappedLocales,
1209
+ default: defaultLocale
1210
+ };
1211
+ }
1212
+ });
1203
1213
  const controllers = {
1204
1214
  SettingAppController,
1205
1215
  SlugModuleController,
@@ -1207,10 +1217,12 @@ const controllers = {
1207
1217
  TemplateModuleController,
1208
1218
  MenuModuleController,
1209
1219
  ParameterModuleController,
1210
- TranslationModuleController
1220
+ TranslationModuleController,
1221
+ LocalesModuleController
1211
1222
  };
1212
1223
  function getModuleName(url) {
1213
1224
  if (url.includes("/pages")) return "slug";
1225
+ if (url.includes("/locales")) return "locale";
1214
1226
  if (url.includes("/parameters")) return "parameter";
1215
1227
  if (url.includes("/translations")) return "translation";
1216
1228
  if (url.includes("/menus")) return "menu";
@@ -1308,6 +1320,16 @@ const contentAPIRoutes = [
1308
1320
  policies: ["check-api-token"],
1309
1321
  auth: false
1310
1322
  }
1323
+ },
1324
+ {
1325
+ method: "GET",
1326
+ path: "/modules/locales",
1327
+ handler: "LocalesModuleController.getLocales",
1328
+ config: {
1329
+ middlewares: [`plugin::${PLUGIN_ID}.check-module-is-active`],
1330
+ policies: ["check-api-token"],
1331
+ auth: false
1332
+ }
1311
1333
  }
1312
1334
  ];
1313
1335
  const adminAPIRoutes = [
@@ -434,19 +434,6 @@ const bootstrap = async ({ strapi: strapi2 }) => {
434
434
  type: "boolean",
435
435
  value: "false"
436
436
  },
437
- {
438
- module: "template",
439
- property: "active",
440
- type: "boolean",
441
- value: "true"
442
- }
443
- ]
444
- });
445
- } catch (e) {
446
- }
447
- try {
448
- await strapi2.db.query(config2.uuid.app.setting).createMany({
449
- data: [
450
437
  {
451
438
  module: "slug",
452
439
  property: "homepageContentId",
@@ -464,6 +451,18 @@ const bootstrap = async ({ strapi: strapi2 }) => {
464
451
  property: "homepageSlugStrategy",
465
452
  type: "string",
466
453
  value: "language"
454
+ },
455
+ {
456
+ module: "template",
457
+ property: "active",
458
+ type: "boolean",
459
+ value: "true"
460
+ },
461
+ {
462
+ module: "locale",
463
+ property: "active",
464
+ type: "boolean",
465
+ value: "true"
467
466
  }
468
467
  ]
469
468
  });
@@ -1199,6 +1198,17 @@ const TranslationModuleController = ({ strapi: strapi2 }) => ({
1199
1198
  return await strapi2.plugin(PLUGIN_ID).service("TranslationModuleService").getTranslations();
1200
1199
  }
1201
1200
  });
1201
+ const LocalesModuleController = ({ strapi: strapi2 }) => ({
1202
+ async getLocales() {
1203
+ const locales = await strapi2.plugin("i18n").service("locales").find();
1204
+ const mappedLocales = locales.map((locale) => locale.code.toLowerCase());
1205
+ const defaultLocale = await strapi2.plugin("i18n").service("locales").getDefaultLocale();
1206
+ return {
1207
+ locales: mappedLocales,
1208
+ default: defaultLocale
1209
+ };
1210
+ }
1211
+ });
1202
1212
  const controllers = {
1203
1213
  SettingAppController,
1204
1214
  SlugModuleController,
@@ -1206,10 +1216,12 @@ const controllers = {
1206
1216
  TemplateModuleController,
1207
1217
  MenuModuleController,
1208
1218
  ParameterModuleController,
1209
- TranslationModuleController
1219
+ TranslationModuleController,
1220
+ LocalesModuleController
1210
1221
  };
1211
1222
  function getModuleName(url) {
1212
1223
  if (url.includes("/pages")) return "slug";
1224
+ if (url.includes("/locales")) return "locale";
1213
1225
  if (url.includes("/parameters")) return "parameter";
1214
1226
  if (url.includes("/translations")) return "translation";
1215
1227
  if (url.includes("/menus")) return "menu";
@@ -1307,6 +1319,16 @@ const contentAPIRoutes = [
1307
1319
  policies: ["check-api-token"],
1308
1320
  auth: false
1309
1321
  }
1322
+ },
1323
+ {
1324
+ method: "GET",
1325
+ path: "/modules/locales",
1326
+ handler: "LocalesModuleController.getLocales",
1327
+ config: {
1328
+ middlewares: [`plugin::${PLUGIN_ID}.check-module-is-active`],
1329
+ policies: ["check-api-token"],
1330
+ auth: false
1331
+ }
1310
1332
  }
1311
1333
  ];
1312
1334
  const adminAPIRoutes = [
@@ -58,5 +58,13 @@ declare const _default: {
58
58
  adminBulkDelete(): Promise<any>;
59
59
  getTranslations(): Promise<any>;
60
60
  };
61
+ LocalesModuleController: ({ strapi }: {
62
+ strapi: import("@strapi/types/dist/core").Strapi;
63
+ }) => {
64
+ getLocales(): Promise<{
65
+ locales: any;
66
+ default: any;
67
+ }>;
68
+ };
61
69
  };
62
70
  export default _default;
@@ -0,0 +1,10 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const LocalesModuleController: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => {
5
+ getLocales(): Promise<{
6
+ locales: any;
7
+ default: any;
8
+ }>;
9
+ };
10
+ export default LocalesModuleController;
@@ -99,6 +99,14 @@ declare const _default: {
99
99
  adminBulkDelete(): Promise<any>;
100
100
  getTranslations(): Promise<any>;
101
101
  };
102
+ LocalesModuleController: ({ strapi }: {
103
+ strapi: import("@strapi/types/dist/core").Strapi;
104
+ }) => {
105
+ getLocales(): Promise<{
106
+ locales: any;
107
+ default: any;
108
+ }>;
109
+ };
102
110
  };
103
111
  routes: {
104
112
  admin: {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.35",
2
+ "version": "1.0.36",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi plugin",