@vicacha-devs/strapi-plugin-inbox 1.1.0 → 1.1.1

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.
@@ -3,9 +3,9 @@ import { Box, Flex, Typography, Button, Field, TextInput, SingleSelect, SingleSe
3
3
  import { useFetchClient } from "@strapi/strapi/admin";
4
4
  import * as React from "react";
5
5
  import { useIntl } from "react-intl";
6
- import { A as ALERT_SEVERITIES, P as PLUGIN_ID, S as SUBMISSION_STATUSES, a as SUBMISSION_PRIORITIES, F as FORM_CATEGORIES, b as FORM_BUILDER_CMS_PLUGIN_ID, L as LOCALE_OPTIONS } from "./index-5e9dAMBs.mjs";
6
+ import { A as ALERT_SEVERITIES, P as PLUGIN_ID, S as SUBMISSION_STATUSES, a as SUBMISSION_PRIORITIES, F as FORM_CATEGORIES, b as FORM_BUILDER_CMS_PLUGIN_ID, L as LOCALE_OPTIONS } from "./index-CvxBUxrS.mjs";
7
7
  import { useNavigate } from "react-router-dom";
8
- import { T as TOPIC_OPTIONS } from "./LocalizationRoutingTab-CEXbHNe4.mjs";
8
+ import { T as TOPIC_OPTIONS } from "./LocalizationRoutingTab-C_enaoml.mjs";
9
9
  const STARTER_FORM_TEMPLATES = [
10
10
  {
11
11
  id: "general-contact",
@@ -5,9 +5,9 @@ const designSystem = require("@strapi/design-system");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const React = require("react");
7
7
  const reactIntl = require("react-intl");
8
- const index = require("./index-DLfoIVZP.js");
8
+ const index = require("./index-FRs4UYmW.js");
9
9
  const reactRouterDom = require("react-router-dom");
10
- const LocalizationRoutingTab = require("./LocalizationRoutingTab-Dt6U-kXn.js");
10
+ const LocalizationRoutingTab = require("./LocalizationRoutingTab-DLlVOdSz.js");
11
11
  function _interopNamespace(e) {
12
12
  if (e && e.__esModule) return e;
13
13
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Tabs, Box, Flex, Typography, Badge, Field, SingleSelect, SingleSelectOption, MultiSelect, MultiSelectOption } from "@strapi/design-system";
3
- import { m as mergeSelectOptions, L as LOCALE_OPTIONS } from "./index-5e9dAMBs.mjs";
3
+ import { m as mergeSelectOptions, L as LOCALE_OPTIONS } from "./index-CvxBUxrS.mjs";
4
4
  const DEPARTMENT_OPTIONS = [
5
5
  { value: "general", label: "general — General Inquiries & Info" },
6
6
  { value: "imamate", label: "imamate — Imamate & Religious Guidance (Fatwa)" },
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const designSystem = require("@strapi/design-system");
4
- const index = require("./index-DLfoIVZP.js");
4
+ const index = require("./index-FRs4UYmW.js");
5
5
  const DEPARTMENT_OPTIONS = [
6
6
  { value: "general", label: "general — General Inquiries & Info" },
7
7
  { value: "imamate", label: "imamate — Imamate & Religious Guidance (Fatwa)" },
@@ -5,8 +5,8 @@ const designSystem = require("@strapi/design-system");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const React = require("react");
7
7
  const reactIntl = require("react-intl");
8
- const index = require("./index-DLfoIVZP.js");
9
- const LocalizationRoutingTab = require("./LocalizationRoutingTab-Dt6U-kXn.js");
8
+ const index = require("./index-FRs4UYmW.js");
9
+ const LocalizationRoutingTab = require("./LocalizationRoutingTab-DLlVOdSz.js");
10
10
  function _interopNamespace(e) {
11
11
  if (e && e.__esModule) return e;
12
12
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -3,8 +3,8 @@ import { Box, Flex, Typography, Badge, Button, Field, TextInput, Tabs, NumberInp
3
3
  import { useFetchClient } from "@strapi/strapi/admin";
4
4
  import * as React from "react";
5
5
  import { useIntl } from "react-intl";
6
- import { p as parseCsvList, D as DEFAULT_INBOX_SETTINGS, P as PLUGIN_ID } from "./index-5e9dAMBs.mjs";
7
- import { L as LocalizationRoutingTab } from "./LocalizationRoutingTab-CEXbHNe4.mjs";
6
+ import { p as parseCsvList, D as DEFAULT_INBOX_SETTINGS, P as PLUGIN_ID } from "./index-CvxBUxrS.mjs";
7
+ import { L as LocalizationRoutingTab } from "./LocalizationRoutingTab-C_enaoml.mjs";
8
8
  const subCardStyle$1 = {
9
9
  border: "1px solid rgba(128, 128, 128, 0.2)",
10
10
  display: "flex",
@@ -16,6 +16,41 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
16
16
  );
17
17
  });
18
18
  };
19
+ const SUPPORTED_INTL_CALENDARS = Object.freeze([
20
+ { id: "gregory", intlCalendar: "gregory", defaultLabel: "Gregorian" },
21
+ { id: "iso8601", intlCalendar: "iso8601", defaultLabel: "ISO 8601" },
22
+ {
23
+ id: "islamic-umalqura",
24
+ intlCalendar: "islamic-umalqura",
25
+ defaultLabel: "Hijri (Umm al-Qura)"
26
+ },
27
+ {
28
+ id: "islamic-civil",
29
+ intlCalendar: "islamic-civil",
30
+ defaultLabel: "Hijri (Civil)"
31
+ },
32
+ {
33
+ id: "islamic-tbla",
34
+ intlCalendar: "islamic-tbla",
35
+ defaultLabel: "Hijri (Tabular)"
36
+ },
37
+ { id: "hebrew", intlCalendar: "hebrew", defaultLabel: "Hebrew" },
38
+ {
39
+ id: "persian",
40
+ intlCalendar: "persian",
41
+ defaultLabel: "Persian (Solar Hijri)"
42
+ },
43
+ { id: "buddhist", intlCalendar: "buddhist", defaultLabel: "Buddhist" },
44
+ { id: "japanese", intlCalendar: "japanese", defaultLabel: "Japanese" },
45
+ { id: "chinese", intlCalendar: "chinese", defaultLabel: "Chinese Lunar" },
46
+ { id: "indian", intlCalendar: "indian", defaultLabel: "Indian National" },
47
+ { id: "coptic", intlCalendar: "coptic", defaultLabel: "Coptic" },
48
+ { id: "ethiopic", intlCalendar: "ethiopic", defaultLabel: "Ethiopic" }
49
+ ]);
50
+ Object.freeze([
51
+ "none",
52
+ ...SUPPORTED_INTL_CALENDARS.map((item) => item.id)
53
+ ]);
19
54
  function freezeOptions(items) {
20
55
  return Object.freeze(items.map((item) => Object.freeze({ ...item })));
21
56
  }
@@ -76,6 +111,11 @@ function parseCsvList(raw) {
76
111
  }
77
112
  return result;
78
113
  }
114
+ const FORBIDDEN_OBJECT_KEYS = /* @__PURE__ */ new Set([
115
+ "__proto__",
116
+ "constructor",
117
+ "prototype"
118
+ ]);
79
119
  const VALID_LOCALE_RE = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,4}$/;
80
120
  function isTranslationRecord(value) {
81
121
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -90,15 +130,22 @@ function extractDictionary(loaded) {
90
130
  return loaded;
91
131
  }
92
132
  function getLookupCandidates(locale, fallbackToLanguage) {
93
- const trimmed = locale.trim();
133
+ const trimmed = locale.trim().replace(/_/g, "-");
94
134
  if (!VALID_LOCALE_RE.test(trimmed)) {
95
135
  return [];
96
136
  }
97
- if (!fallbackToLanguage || !trimmed.includes("-")) {
98
- return [trimmed];
137
+ const lower = trimmed.toLowerCase();
138
+ const list = [trimmed];
139
+ if (lower !== trimmed) {
140
+ list.push(lower);
99
141
  }
100
- const base = trimmed.split("-")[0];
101
- return base && base !== trimmed ? [trimmed, base] : [trimmed];
142
+ if (fallbackToLanguage && trimmed.includes("-")) {
143
+ const base = lower.split("-")[0];
144
+ if (base && !list.includes(base)) {
145
+ list.push(base);
146
+ }
147
+ }
148
+ return list;
102
149
  }
103
150
  function prefixPluginTranslations(trad, pluginId, options) {
104
151
  const normalizedPluginId = typeof pluginId === "string" ? pluginId.trim() : "";
@@ -108,7 +155,7 @@ function prefixPluginTranslations(trad, pluginId, options) {
108
155
  const result = {};
109
156
  if (options?.baseTranslations) {
110
157
  for (const [key, value] of Object.entries(options.baseTranslations)) {
111
- if (typeof value === "string") {
158
+ if (typeof value === "string" && !FORBIDDEN_OBJECT_KEYS.has(key)) {
112
159
  result[key] = value;
113
160
  }
114
161
  }
@@ -116,7 +163,7 @@ function prefixPluginTranslations(trad, pluginId, options) {
116
163
  const prefix = `${normalizedPluginId}.`;
117
164
  const explicitPrefixed = [];
118
165
  for (const [key, value] of Object.entries(trad)) {
119
- if (typeof value !== "string") {
166
+ if (typeof value !== "string" || FORBIDDEN_OBJECT_KEYS.has(key)) {
120
167
  continue;
121
168
  }
122
169
  if (options?.keepUnprefixed) {
@@ -129,7 +176,9 @@ function prefixPluginTranslations(trad, pluginId, options) {
129
176
  }
130
177
  }
131
178
  for (const [key, value] of explicitPrefixed) {
132
- result[key] = value;
179
+ if (!FORBIDDEN_OBJECT_KEYS.has(key)) {
180
+ result[key] = value;
181
+ }
133
182
  }
134
183
  return result;
135
184
  }
@@ -152,10 +201,12 @@ function createRegisterTrads(options) {
152
201
  return { data: {}, locale };
153
202
  }
154
203
  let rawData;
204
+ let matchedCandidate;
155
205
  for (const candidate of candidates) {
156
206
  if (translations && Object.hasOwn(translations, candidate)) {
157
207
  rawData = extractDictionary(translations[candidate]);
158
208
  if (rawData) {
209
+ matchedCandidate = candidate;
159
210
  break;
160
211
  }
161
212
  }
@@ -164,13 +215,14 @@ function createRegisterTrads(options) {
164
215
  const loaded = await loadTranslation(candidate);
165
216
  rawData = extractDictionary(loaded);
166
217
  if (rawData) {
218
+ matchedCandidate = candidate;
167
219
  break;
168
220
  }
169
221
  } catch {
170
222
  }
171
223
  }
172
224
  }
173
- const baseTranslations = getBaseTranslations?.(locale);
225
+ const baseTranslations = getBaseTranslations?.(matchedCandidate ?? locale);
174
226
  const hasBase = Boolean(baseTranslations) && Object.keys(baseTranslations).length > 0;
175
227
  if (!rawData && !hasBase) {
176
228
  return { data: {}, locale };
@@ -761,7 +813,7 @@ const index = {
761
813
  id: `${PLUGIN_ID}.plugin.name`,
762
814
  defaultMessage: "Inbox & Form Builder"
763
815
  },
764
- Component: () => import("./InboxHomePage-B5xUPD7Y.mjs").then((mod) => ({
816
+ Component: () => import("./InboxHomePage-CfoiAI1Z.mjs").then((mod) => ({
765
817
  default: mod.InboxHomePage
766
818
  })),
767
819
  permissions: []
@@ -782,7 +834,7 @@ const index = {
782
834
  },
783
835
  id: `${PLUGIN_ID}-settings`,
784
836
  to: `${PLUGIN_ID}`,
785
- Component: () => import("./SettingsPage-Dif7Cq7I.mjs").then((mod) => ({
837
+ Component: () => import("./SettingsPage-Ctvf4SNg.mjs").then((mod) => ({
786
838
  default: mod.SettingsPage
787
839
  })),
788
840
  permissions: []
@@ -35,6 +35,41 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
35
35
  );
36
36
  });
37
37
  };
38
+ const SUPPORTED_INTL_CALENDARS = Object.freeze([
39
+ { id: "gregory", intlCalendar: "gregory", defaultLabel: "Gregorian" },
40
+ { id: "iso8601", intlCalendar: "iso8601", defaultLabel: "ISO 8601" },
41
+ {
42
+ id: "islamic-umalqura",
43
+ intlCalendar: "islamic-umalqura",
44
+ defaultLabel: "Hijri (Umm al-Qura)"
45
+ },
46
+ {
47
+ id: "islamic-civil",
48
+ intlCalendar: "islamic-civil",
49
+ defaultLabel: "Hijri (Civil)"
50
+ },
51
+ {
52
+ id: "islamic-tbla",
53
+ intlCalendar: "islamic-tbla",
54
+ defaultLabel: "Hijri (Tabular)"
55
+ },
56
+ { id: "hebrew", intlCalendar: "hebrew", defaultLabel: "Hebrew" },
57
+ {
58
+ id: "persian",
59
+ intlCalendar: "persian",
60
+ defaultLabel: "Persian (Solar Hijri)"
61
+ },
62
+ { id: "buddhist", intlCalendar: "buddhist", defaultLabel: "Buddhist" },
63
+ { id: "japanese", intlCalendar: "japanese", defaultLabel: "Japanese" },
64
+ { id: "chinese", intlCalendar: "chinese", defaultLabel: "Chinese Lunar" },
65
+ { id: "indian", intlCalendar: "indian", defaultLabel: "Indian National" },
66
+ { id: "coptic", intlCalendar: "coptic", defaultLabel: "Coptic" },
67
+ { id: "ethiopic", intlCalendar: "ethiopic", defaultLabel: "Ethiopic" }
68
+ ]);
69
+ Object.freeze([
70
+ "none",
71
+ ...SUPPORTED_INTL_CALENDARS.map((item) => item.id)
72
+ ]);
38
73
  function freezeOptions(items) {
39
74
  return Object.freeze(items.map((item) => Object.freeze({ ...item })));
40
75
  }
@@ -95,6 +130,11 @@ function parseCsvList(raw) {
95
130
  }
96
131
  return result;
97
132
  }
133
+ const FORBIDDEN_OBJECT_KEYS = /* @__PURE__ */ new Set([
134
+ "__proto__",
135
+ "constructor",
136
+ "prototype"
137
+ ]);
98
138
  const VALID_LOCALE_RE = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,4}$/;
99
139
  function isTranslationRecord(value) {
100
140
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -109,15 +149,22 @@ function extractDictionary(loaded) {
109
149
  return loaded;
110
150
  }
111
151
  function getLookupCandidates(locale, fallbackToLanguage) {
112
- const trimmed = locale.trim();
152
+ const trimmed = locale.trim().replace(/_/g, "-");
113
153
  if (!VALID_LOCALE_RE.test(trimmed)) {
114
154
  return [];
115
155
  }
116
- if (!fallbackToLanguage || !trimmed.includes("-")) {
117
- return [trimmed];
156
+ const lower = trimmed.toLowerCase();
157
+ const list = [trimmed];
158
+ if (lower !== trimmed) {
159
+ list.push(lower);
118
160
  }
119
- const base = trimmed.split("-")[0];
120
- return base && base !== trimmed ? [trimmed, base] : [trimmed];
161
+ if (fallbackToLanguage && trimmed.includes("-")) {
162
+ const base = lower.split("-")[0];
163
+ if (base && !list.includes(base)) {
164
+ list.push(base);
165
+ }
166
+ }
167
+ return list;
121
168
  }
122
169
  function prefixPluginTranslations(trad, pluginId, options) {
123
170
  const normalizedPluginId = typeof pluginId === "string" ? pluginId.trim() : "";
@@ -127,7 +174,7 @@ function prefixPluginTranslations(trad, pluginId, options) {
127
174
  const result = {};
128
175
  if (options?.baseTranslations) {
129
176
  for (const [key, value] of Object.entries(options.baseTranslations)) {
130
- if (typeof value === "string") {
177
+ if (typeof value === "string" && !FORBIDDEN_OBJECT_KEYS.has(key)) {
131
178
  result[key] = value;
132
179
  }
133
180
  }
@@ -135,7 +182,7 @@ function prefixPluginTranslations(trad, pluginId, options) {
135
182
  const prefix = `${normalizedPluginId}.`;
136
183
  const explicitPrefixed = [];
137
184
  for (const [key, value] of Object.entries(trad)) {
138
- if (typeof value !== "string") {
185
+ if (typeof value !== "string" || FORBIDDEN_OBJECT_KEYS.has(key)) {
139
186
  continue;
140
187
  }
141
188
  if (options?.keepUnprefixed) {
@@ -148,7 +195,9 @@ function prefixPluginTranslations(trad, pluginId, options) {
148
195
  }
149
196
  }
150
197
  for (const [key, value] of explicitPrefixed) {
151
- result[key] = value;
198
+ if (!FORBIDDEN_OBJECT_KEYS.has(key)) {
199
+ result[key] = value;
200
+ }
152
201
  }
153
202
  return result;
154
203
  }
@@ -171,10 +220,12 @@ function createRegisterTrads(options) {
171
220
  return { data: {}, locale };
172
221
  }
173
222
  let rawData;
223
+ let matchedCandidate;
174
224
  for (const candidate of candidates) {
175
225
  if (translations && Object.hasOwn(translations, candidate)) {
176
226
  rawData = extractDictionary(translations[candidate]);
177
227
  if (rawData) {
228
+ matchedCandidate = candidate;
178
229
  break;
179
230
  }
180
231
  }
@@ -183,13 +234,14 @@ function createRegisterTrads(options) {
183
234
  const loaded = await loadTranslation(candidate);
184
235
  rawData = extractDictionary(loaded);
185
236
  if (rawData) {
237
+ matchedCandidate = candidate;
186
238
  break;
187
239
  }
188
240
  } catch {
189
241
  }
190
242
  }
191
243
  }
192
- const baseTranslations = getBaseTranslations?.(locale);
244
+ const baseTranslations = getBaseTranslations?.(matchedCandidate ?? locale);
193
245
  const hasBase = Boolean(baseTranslations) && Object.keys(baseTranslations).length > 0;
194
246
  if (!rawData && !hasBase) {
195
247
  return { data: {}, locale };
@@ -780,7 +832,7 @@ const index = {
780
832
  id: `${PLUGIN_ID}.plugin.name`,
781
833
  defaultMessage: "Inbox & Form Builder"
782
834
  },
783
- Component: () => Promise.resolve().then(() => require("./InboxHomePage-BCHbPE2t.js")).then((mod) => ({
835
+ Component: () => Promise.resolve().then(() => require("./InboxHomePage-DPuQPIwL.js")).then((mod) => ({
784
836
  default: mod.InboxHomePage
785
837
  })),
786
838
  permissions: []
@@ -801,7 +853,7 @@ const index = {
801
853
  },
802
854
  id: `${PLUGIN_ID}-settings`,
803
855
  to: `${PLUGIN_ID}`,
804
- Component: () => Promise.resolve().then(() => require("./SettingsPage-qB_efKCl.js")).then((mod) => ({
856
+ Component: () => Promise.resolve().then(() => require("./SettingsPage-CWTOJAEO.js")).then((mod) => ({
805
857
  default: mod.SettingsPage
806
858
  })),
807
859
  permissions: []
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-DLfoIVZP.js");
3
+ const index = require("./index-FRs4UYmW.js");
4
4
  exports.SUPPORTED_ADMIN_LOCALES = index.SUPPORTED_ADMIN_LOCALES;
5
5
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { c, i } from "./index-5e9dAMBs.mjs";
1
+ import { c, i } from "./index-CvxBUxrS.mjs";
2
2
  export {
3
3
  c as SUPPORTED_ADMIN_LOCALES,
4
4
  i as default