@bigbinary/neeto-themes-frontend 1.2.4 → 1.2.6

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.
@@ -1,5 +1,15 @@
1
1
  {
2
2
  "neetoThemes": {
3
+ "entityType": {
4
+ "quiz": "Quiz",
5
+ "quiz_other": "Quizzes",
6
+ "form": "Form",
7
+ "form_other": "Forms",
8
+ "meeting": "Meeting",
9
+ "meeting_other": "Meetings",
10
+ "recording": "Recording",
11
+ "recording_other": "Recordings"
12
+ },
3
13
  "common": {
4
14
  "design": "Design",
5
15
  "preview": "Preview",
@@ -33,8 +43,8 @@
33
43
  },
34
44
  "message": {
35
45
  "deleteTheme_zero": "You are permanently deleting the theme \"{{name, anyCase}}\". Are you sure you want to proceed?",
36
- "deleteTheme_one": "You are permanently deleting the theme \"{{name, anyCase}}\". This theme is being used in one {{entityType, anyCase}}. {{entityType, anyCase}} using this theme would fall back to using the default theme \"Plain blue\". Are you sure you want to proceed?",
37
- "deleteTheme_other": "You are permanently deleting the theme \"{{name, anyCase}}\". This theme is being used in {{count}} {{entityType, anyCase}}. {{entityType, anyCase}}s using this theme would fall back to using the default theme \"Plain blue\". Are you sure you want to proceed?"
46
+ "deleteTheme_one": "You are permanently deleting the theme \"{{name, anyCase}}\". This theme is being used in one {{entityType}. {{entityType, anyCase}} using this theme would fall back to using the default theme \"{{defaultThemeName, anyCase}}\". Are you sure you want to proceed?",
47
+ "deleteTheme_other": "You are permanently deleting the theme \"{{name, anyCase}}\". This theme is being used in {{count}} {{entityType}}. {{entityType, anyCase}} using this theme would fall back to using the default theme \"{{defaultThemeName, anyCase}}\". Are you sure you want to proceed?"
38
48
  }
39
49
  },
40
50
  "build": {
package/dist/index.cjs.js CHANGED
@@ -88,7 +88,9 @@ var useConfigStore = zustand.create(reactUtils.withImmutableActions(function (se
88
88
  entityType: "",
89
89
  entityId: "",
90
90
  variableNamesMap: {},
91
+ defaultThemeName: "Plain blue",
91
92
  isFetchingSchema: true,
93
+ isTemplateThemesEnabled: false,
92
94
  setConfigState: set
93
95
  };
94
96
  }));
@@ -194,8 +196,12 @@ var useShowThemeEntity = function useShowThemeEntity(entityId) {
194
196
  };
195
197
 
196
198
  var _excluded$1 = ["themeId"];
197
- var list$1 = function list() {
198
- return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes"));
199
+ var list$1 = function list(entityId) {
200
+ return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes"), {
201
+ params: {
202
+ entity_id: entityId
203
+ }
204
+ });
199
205
  };
200
206
  var show = function show(id) {
201
207
  return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes/").concat(id));
@@ -235,8 +241,17 @@ var themesApi = {
235
241
  apply: apply
236
242
  };
237
243
 
238
- var useListThemes = function useListThemes() {
239
- return reactQuery.useQuery(QUERY_KEYS.THEMES_LIST, themesApi.list);
244
+ var useListThemes = function useListThemes(entityId) {
245
+ var _useConfigStore = useConfigStore(function (store) {
246
+ return {
247
+ isTemplateThemesEnabled: store["isTemplateThemesEnabled"]
248
+ };
249
+ }, shallow.shallow),
250
+ isTemplateThemesEnabled = _useConfigStore.isTemplateThemesEnabled;
251
+ var queryKey = isTemplateThemesEnabled ? [QUERY_KEYS.THEMES_LIST, entityId] : [QUERY_KEYS.THEMES_LIST];
252
+ return reactQuery.useQuery(queryKey, function () {
253
+ return themesApi.list(entityId);
254
+ });
240
255
  };
241
256
  var useCreateTheme = function useCreateTheme() {
242
257
  return reactUtils.useMutationWithInvalidation(themesApi.create, {
@@ -332,10 +347,13 @@ var useThemeUtils = function useThemeUtils() {
332
347
  var _ref$schema = _ref.schema,
333
348
  themePropertiesSchema = _ref$schema === void 0 ? [] : _ref$schema,
334
349
  _ref$variableNamesMap = _ref.variableNamesMap,
335
- variableNamesMap = _ref$variableNamesMap === void 0 ? {} : _ref$variableNamesMap;
350
+ variableNamesMap = _ref$variableNamesMap === void 0 ? {} : _ref$variableNamesMap,
351
+ _ref$defaultThemeName = _ref.defaultThemeName,
352
+ defaultThemeName = _ref$defaultThemeName === void 0 ? "" : _ref$defaultThemeName;
336
353
  return setConfigState({
337
354
  themePropertiesSchema: themePropertiesSchema,
338
- variableNamesMap: variableNamesMap
355
+ variableNamesMap: variableNamesMap,
356
+ defaultThemeName: defaultThemeName
339
357
  });
340
358
  }
341
359
  }),
@@ -1681,7 +1699,7 @@ var TitleBar = function TitleBar(_ref) {
1681
1699
 
1682
1700
  var MemoizedAlert = /*#__PURE__*/react.memo(Alert__default["default"]);
1683
1701
  var Sidebar = function Sidebar(_ref) {
1684
- var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3;
1702
+ var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3, _themeToDelete$curren4;
1685
1703
  var thumbnail = _ref.thumbnail,
1686
1704
  onPropertiesChange = _ref.onPropertiesChange;
1687
1705
  var _useState = react.useState(DESIGN_SCREENS.THEMES),
@@ -1704,12 +1722,14 @@ var Sidebar = function Sidebar(_ref) {
1704
1722
  return {
1705
1723
  entityType: store["entityType"],
1706
1724
  entityId: store["entityId"],
1707
- isFetchingSchema: store["isFetchingSchema"]
1725
+ isFetchingSchema: store["isFetchingSchema"],
1726
+ defaultThemeName: store["defaultThemeName"]
1708
1727
  };
1709
1728
  }, shallow.shallow),
1710
1729
  entityType = _useConfigStore.entityType,
1711
1730
  entityId = _useConfigStore.entityId,
1712
- isFetchingSchema = _useConfigStore.isFetchingSchema;
1731
+ isFetchingSchema = _useConfigStore.isFetchingSchema,
1732
+ defaultThemeName = _useConfigStore.defaultThemeName;
1713
1733
  var _useThemeStore = useThemeStore(function (store) {
1714
1734
  return {
1715
1735
  setThemeState: store["setThemeState"]
@@ -1721,7 +1741,7 @@ var Sidebar = function Sidebar(_ref) {
1721
1741
  t = _useTranslation.t;
1722
1742
  var _useThemeUtils = useThemeUtils(),
1723
1743
  setTheme = _useThemeUtils.setTheme;
1724
- var _useListThemes = useListThemes(),
1744
+ var _useListThemes = useListThemes(entityId),
1725
1745
  _useListThemes$data = _useListThemes.data,
1726
1746
  _useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
1727
1747
  _useListThemes$data2$ = _useListThemes$data2.themes,
@@ -1861,7 +1881,10 @@ var Sidebar = function Sidebar(_ref) {
1861
1881
  message: t("neetoThemes.alerts.message.deleteTheme", {
1862
1882
  name: (_themeToDelete$curren2 = themeToDelete.current) === null || _themeToDelete$curren2 === void 0 ? void 0 : _themeToDelete$curren2.name,
1863
1883
  count: (_themeToDelete$curren3 = themeToDelete.current) === null || _themeToDelete$curren3 === void 0 ? void 0 : _themeToDelete$curren3.appliedCount,
1864
- entityType: entityType
1884
+ defaultThemeName: defaultThemeName,
1885
+ entityType: t("neetoThemes.entityType.".concat(entityType.toLowerCase()), {
1886
+ count: (_themeToDelete$curren4 = themeToDelete.current) === null || _themeToDelete$curren4 === void 0 ? void 0 : _themeToDelete$curren4.appliedCount
1887
+ })
1865
1888
  }),
1866
1889
  onClose: handleCloseDeleteAlert,
1867
1890
  onSubmit: handleDeleteTheme
@@ -1874,7 +1897,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
1874
1897
  entityType = _ref.entityType,
1875
1898
  entityId = _ref.entityId,
1876
1899
  thumbnail = _ref.thumbnail,
1877
- onPropertiesChange = _ref.onPropertiesChange;
1900
+ onPropertiesChange = _ref.onPropertiesChange,
1901
+ _ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
1902
+ isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes;
1878
1903
  var _useThemeStore = useThemeStore(function (store) {
1879
1904
  return {
1880
1905
  isCurrentThemeLoading: store["isCurrentThemeLoading"]
@@ -1890,7 +1915,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
1890
1915
  react.useEffect(function () {
1891
1916
  setConfigState({
1892
1917
  entityType: entityType,
1893
- entityId: entityId
1918
+ entityId: entityId,
1919
+ isTemplateThemesEnabled: isTemplateThemesEnabled
1894
1920
  });
1895
1921
  }, []);
1896
1922
  return /*#__PURE__*/jsxRuntime.jsxs("div", {