@bigbinary/neeto-themes-frontend 2.0.3 → 2.0.5
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/dist/index.cjs.js +157 -142
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +154 -139
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/types.d.ts +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var shallow = require('zustand/shallow');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var i18next = require('i18next');
|
|
8
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
8
9
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
9
10
|
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
11
|
+
var reactQuery = require('@tanstack/react-query');
|
|
12
|
+
var axios = require('axios');
|
|
13
|
+
var ramda = require('ramda');
|
|
10
14
|
var zustand = require('zustand');
|
|
11
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
12
|
-
var neetoCist = require('@bigbinary/neeto-cist');
|
|
13
|
-
var Alert = require('@bigbinary/neetoui/Alert');
|
|
14
|
-
var reactI18next = require('react-i18next');
|
|
15
15
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
16
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
17
17
|
var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
19
|
+
var Alert = require('@bigbinary/neetoui/Alert');
|
|
20
|
+
var reactI18next = require('react-i18next');
|
|
20
21
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
21
|
-
var ramda = require('ramda');
|
|
22
22
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
23
23
|
var Close = require('@bigbinary/neeto-icons/Close');
|
|
24
24
|
var Button = require('@bigbinary/neetoui/Button');
|
|
@@ -65,12 +65,12 @@ function _interopNamespace(e) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
68
|
-
var
|
|
69
|
-
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
68
|
+
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
70
69
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
71
70
|
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
72
71
|
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
73
|
-
var
|
|
72
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
73
|
+
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
74
74
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
75
75
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
76
76
|
var Close__default = /*#__PURE__*/_interopDefaultLegacy(Close);
|
|
@@ -92,6 +92,33 @@ var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
|
|
|
92
92
|
var LeftArrow__default = /*#__PURE__*/_interopDefaultLegacy(LeftArrow);
|
|
93
93
|
var Plus__default = /*#__PURE__*/_interopDefaultLegacy(Plus);
|
|
94
94
|
|
|
95
|
+
var BASE_URL = "neeto_themes_engine";
|
|
96
|
+
var WHITE = "255, 255, 255";
|
|
97
|
+
var BLACK = "0, 0, 0";
|
|
98
|
+
|
|
99
|
+
var show$1 = function show(entityId) {
|
|
100
|
+
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/entities/").concat(entityId));
|
|
101
|
+
};
|
|
102
|
+
var entitiesApi = {
|
|
103
|
+
show: show$1
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
var QUERY_KEYS = {
|
|
107
|
+
THEMES_LIST: "themes-list",
|
|
108
|
+
THEME_DETAILS: "theme-details",
|
|
109
|
+
SCHEMA_DETAILS: "schema-details"
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var useShowThemeEntity = function useShowThemeEntity(entityId) {
|
|
113
|
+
return reactQuery.useQuery({
|
|
114
|
+
queryKey: [QUERY_KEYS.THEME_ENTITY_DETAILS, entityId],
|
|
115
|
+
queryFn: function queryFn() {
|
|
116
|
+
return entitiesApi.show(entityId);
|
|
117
|
+
},
|
|
118
|
+
enabled: !!entityId
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
95
122
|
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
96
123
|
var useConfigStore = zustand.create(reactUtils.withImmutableActions(function (set) {
|
|
97
124
|
return {
|
|
@@ -181,35 +208,101 @@ var hexToRgba = function hexToRgba(hex) {
|
|
|
181
208
|
return "".concat(r, ", ").concat(g, ", ").concat(b).concat(a !== undefined ? ", ".concat(a) : "");
|
|
182
209
|
};
|
|
183
210
|
|
|
184
|
-
var
|
|
185
|
-
var
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/entities/").concat(entityId));
|
|
211
|
+
var root = document.querySelector(":root");
|
|
212
|
+
var setVariable = function setVariable(name, value, variableNamesMap) {
|
|
213
|
+
var variableName = variableNamesMap[name];
|
|
214
|
+
if (!variableName) return;
|
|
215
|
+
root.style.setProperty(variableName, value);
|
|
190
216
|
};
|
|
191
|
-
var
|
|
192
|
-
|
|
217
|
+
var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
|
|
218
|
+
if (neetoCist.isNotPresent(theme === null || theme === void 0 ? void 0 : theme.properties)) return;
|
|
219
|
+
theme.properties.forEach(function (property) {
|
|
220
|
+
var attribute = neetoCist.snakeToCamelCase(property.key);
|
|
221
|
+
if (property.kind === "color") {
|
|
222
|
+
setVariable(attribute, hexToRgba(property.value), variableNamesMap);
|
|
223
|
+
} else if (property.kind === "overlay_opacity") {
|
|
224
|
+
var overlayOpacity = Number(property.value);
|
|
225
|
+
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_opacity")), Math.abs(overlayOpacity / 100), variableNamesMap);
|
|
226
|
+
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_color")), overlayOpacity < 0 ? BLACK : WHITE, variableNamesMap);
|
|
227
|
+
} else if (property.kind === "radius") {
|
|
228
|
+
setVariable(attribute, "".concat(property.value, "px"), variableNamesMap);
|
|
229
|
+
} else {
|
|
230
|
+
setVariable(attribute, property.value, variableNamesMap);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
neetoCist.filterBy({
|
|
234
|
+
kind: "image"
|
|
235
|
+
}, themeConfig).forEach(function (_ref) {
|
|
236
|
+
var _theme$attribute;
|
|
237
|
+
var key = _ref.key;
|
|
238
|
+
var attribute = neetoCist.snakeToCamelCase(key);
|
|
239
|
+
setVariable(attribute, "url(".concat((_theme$attribute = theme[attribute]) === null || _theme$attribute === void 0 ? void 0 : _theme$attribute.url, ")"), variableNamesMap);
|
|
240
|
+
});
|
|
193
241
|
};
|
|
194
242
|
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
243
|
+
var list$1 = function list() {
|
|
244
|
+
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/schema"));
|
|
245
|
+
};
|
|
246
|
+
var schemasApi = {
|
|
247
|
+
list: list$1
|
|
199
248
|
};
|
|
200
249
|
|
|
201
|
-
var
|
|
250
|
+
var useListSchema = function useListSchema() {
|
|
202
251
|
return reactQuery.useQuery({
|
|
203
|
-
queryKey: [QUERY_KEYS.
|
|
204
|
-
queryFn:
|
|
205
|
-
return entitiesApi.show(entityId);
|
|
206
|
-
},
|
|
207
|
-
enabled: !!entityId
|
|
252
|
+
queryKey: [QUERY_KEYS.SCHEMA_DETAILS],
|
|
253
|
+
queryFn: schemasApi.list
|
|
208
254
|
});
|
|
209
255
|
};
|
|
210
256
|
|
|
257
|
+
var useThemeUtils = function useThemeUtils() {
|
|
258
|
+
var setConfigState = useConfigStore(ramda.prop("setConfigState"));
|
|
259
|
+
var _useThemeStore = useThemeStore(function (store) {
|
|
260
|
+
return {
|
|
261
|
+
previewingTheme: store["previewingTheme"],
|
|
262
|
+
currentTheme: store["currentTheme"]
|
|
263
|
+
};
|
|
264
|
+
}, shallow.shallow),
|
|
265
|
+
previewingTheme = _useThemeStore.previewingTheme,
|
|
266
|
+
currentTheme = _useThemeStore.currentTheme;
|
|
267
|
+
var _useListSchema = useListSchema(),
|
|
268
|
+
isFetchingSchema = _useListSchema.isLoading,
|
|
269
|
+
data = _useListSchema.data;
|
|
270
|
+
var _ref = data || {},
|
|
271
|
+
_ref$schema = _ref.schema,
|
|
272
|
+
themePropertiesSchema = _ref$schema === void 0 ? [] : _ref$schema,
|
|
273
|
+
_ref$variableNamesMap = _ref.variableNamesMap,
|
|
274
|
+
variableNamesMap = _ref$variableNamesMap === void 0 ? {} : _ref$variableNamesMap;
|
|
275
|
+
react.useEffect(function () {
|
|
276
|
+
if (data) {
|
|
277
|
+
setConfigState({
|
|
278
|
+
themePropertiesSchema: data === null || data === void 0 ? void 0 : data.schema,
|
|
279
|
+
variableNamesMap: data === null || data === void 0 ? void 0 : data.variableNamesMap,
|
|
280
|
+
defaultThemeName: data === null || data === void 0 ? void 0 : data.defaultThemeName
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}, [data]);
|
|
284
|
+
react.useEffect(function () {
|
|
285
|
+
return setConfigState({
|
|
286
|
+
isFetchingSchema: isFetchingSchema
|
|
287
|
+
});
|
|
288
|
+
}, [isFetchingSchema]);
|
|
289
|
+
var setVariable$1 = function setVariable$1(name, value) {
|
|
290
|
+
return setVariable(name, value, variableNamesMap);
|
|
291
|
+
};
|
|
292
|
+
var setTheme$1 = function setTheme$1(theme) {
|
|
293
|
+
return setTheme(theme, variableNamesMap, themePropertiesSchema);
|
|
294
|
+
};
|
|
295
|
+
return {
|
|
296
|
+
setTheme: setTheme$1,
|
|
297
|
+
setVariable: setVariable$1,
|
|
298
|
+
previewingTheme: previewingTheme,
|
|
299
|
+
currentTheme: currentTheme,
|
|
300
|
+
isFetchingSchema: isFetchingSchema
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
|
|
211
304
|
var _excluded$1 = ["themeId"];
|
|
212
|
-
var list
|
|
305
|
+
var list = function list(entityId) {
|
|
213
306
|
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/themes"), {
|
|
214
307
|
params: {
|
|
215
308
|
entity_id: entityId
|
|
@@ -245,7 +338,7 @@ var apply = function apply(_ref2) {
|
|
|
245
338
|
});
|
|
246
339
|
};
|
|
247
340
|
var themesApi = {
|
|
248
|
-
list: list
|
|
341
|
+
list: list,
|
|
249
342
|
show: show,
|
|
250
343
|
create: create,
|
|
251
344
|
update: update,
|
|
@@ -302,99 +395,6 @@ var useApplyTheme = function useApplyTheme(_ref) {
|
|
|
302
395
|
});
|
|
303
396
|
};
|
|
304
397
|
|
|
305
|
-
var root = document.querySelector(":root");
|
|
306
|
-
var setVariable = function setVariable(name, value, variableNamesMap) {
|
|
307
|
-
var variableName = variableNamesMap[name];
|
|
308
|
-
if (!variableName) return;
|
|
309
|
-
root.style.setProperty(variableName, value);
|
|
310
|
-
};
|
|
311
|
-
var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
|
|
312
|
-
if (neetoCist.isNotPresent(theme === null || theme === void 0 ? void 0 : theme.properties)) return;
|
|
313
|
-
theme.properties.forEach(function (property) {
|
|
314
|
-
var attribute = neetoCist.snakeToCamelCase(property.key);
|
|
315
|
-
if (property.kind === "color") {
|
|
316
|
-
setVariable(attribute, hexToRgba(property.value), variableNamesMap);
|
|
317
|
-
} else if (property.kind === "overlay_opacity") {
|
|
318
|
-
var overlayOpacity = Number(property.value);
|
|
319
|
-
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_opacity")), Math.abs(overlayOpacity / 100), variableNamesMap);
|
|
320
|
-
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_color")), overlayOpacity < 0 ? BLACK : WHITE, variableNamesMap);
|
|
321
|
-
} else if (property.kind === "radius") {
|
|
322
|
-
setVariable(attribute, "".concat(property.value, "px"), variableNamesMap);
|
|
323
|
-
} else {
|
|
324
|
-
setVariable(attribute, property.value, variableNamesMap);
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
neetoCist.filterBy({
|
|
328
|
-
kind: "image"
|
|
329
|
-
}, themeConfig).forEach(function (_ref) {
|
|
330
|
-
var _theme$attribute;
|
|
331
|
-
var key = _ref.key;
|
|
332
|
-
var attribute = neetoCist.snakeToCamelCase(key);
|
|
333
|
-
setVariable(attribute, "url(".concat((_theme$attribute = theme[attribute]) === null || _theme$attribute === void 0 ? void 0 : _theme$attribute.url, ")"), variableNamesMap);
|
|
334
|
-
});
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
var list = function list() {
|
|
338
|
-
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/schema"));
|
|
339
|
-
};
|
|
340
|
-
var schemasApi = {
|
|
341
|
-
list: list
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
var useListSchema = function useListSchema() {
|
|
345
|
-
return reactQuery.useQuery({
|
|
346
|
-
queryKey: [QUERY_KEYS.SCHEMA_DETAILS],
|
|
347
|
-
queryFn: schemasApi.list
|
|
348
|
-
});
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
var useThemeUtils = function useThemeUtils() {
|
|
352
|
-
var setConfigState = useConfigStore(ramda.prop("setConfigState"));
|
|
353
|
-
var _useThemeStore = useThemeStore(function (store) {
|
|
354
|
-
return {
|
|
355
|
-
previewingTheme: store["previewingTheme"],
|
|
356
|
-
currentTheme: store["currentTheme"]
|
|
357
|
-
};
|
|
358
|
-
}, shallow.shallow),
|
|
359
|
-
previewingTheme = _useThemeStore.previewingTheme,
|
|
360
|
-
currentTheme = _useThemeStore.currentTheme;
|
|
361
|
-
var _useListSchema = useListSchema(),
|
|
362
|
-
isFetchingSchema = _useListSchema.isLoading,
|
|
363
|
-
data = _useListSchema.data;
|
|
364
|
-
var _ref = data || {},
|
|
365
|
-
_ref$schema = _ref.schema,
|
|
366
|
-
themePropertiesSchema = _ref$schema === void 0 ? [] : _ref$schema,
|
|
367
|
-
_ref$variableNamesMap = _ref.variableNamesMap,
|
|
368
|
-
variableNamesMap = _ref$variableNamesMap === void 0 ? {} : _ref$variableNamesMap;
|
|
369
|
-
react.useEffect(function () {
|
|
370
|
-
if (data) {
|
|
371
|
-
setConfigState({
|
|
372
|
-
themePropertiesSchema: data === null || data === void 0 ? void 0 : data.schema,
|
|
373
|
-
variableNamesMap: data === null || data === void 0 ? void 0 : data.variableNamesMap,
|
|
374
|
-
defaultThemeName: data === null || data === void 0 ? void 0 : data.defaultThemeName
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}, [data]);
|
|
378
|
-
react.useEffect(function () {
|
|
379
|
-
return setConfigState({
|
|
380
|
-
isFetchingSchema: isFetchingSchema
|
|
381
|
-
});
|
|
382
|
-
}, [isFetchingSchema]);
|
|
383
|
-
var setVariable$1 = function setVariable$1(name, value) {
|
|
384
|
-
return setVariable(name, value, variableNamesMap);
|
|
385
|
-
};
|
|
386
|
-
var setTheme$1 = function setTheme$1(theme) {
|
|
387
|
-
return setTheme(theme, variableNamesMap, themePropertiesSchema);
|
|
388
|
-
};
|
|
389
|
-
return {
|
|
390
|
-
setTheme: setTheme$1,
|
|
391
|
-
setVariable: setVariable$1,
|
|
392
|
-
previewingTheme: previewingTheme,
|
|
393
|
-
currentTheme: currentTheme,
|
|
394
|
-
isFetchingSchema: isFetchingSchema
|
|
395
|
-
};
|
|
396
|
-
};
|
|
397
|
-
|
|
398
398
|
var POSITION_OPTIONS = [{
|
|
399
399
|
label: "Left",
|
|
400
400
|
value: "left"
|
|
@@ -1741,7 +1741,8 @@ var MemoizedAlert = /*#__PURE__*/react.memo(Alert__default["default"]);
|
|
|
1741
1741
|
var Sidebar = function Sidebar(_ref) {
|
|
1742
1742
|
var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3, _themeToDelete$curren4;
|
|
1743
1743
|
var thumbnail = _ref.thumbnail,
|
|
1744
|
-
onPropertiesChange = _ref.onPropertiesChange
|
|
1744
|
+
onPropertiesChange = _ref.onPropertiesChange,
|
|
1745
|
+
onApplyThemeSuccess = _ref.onApplyThemeSuccess;
|
|
1745
1746
|
var _useState = react.useState(DESIGN_SCREENS.THEMES),
|
|
1746
1747
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1747
1748
|
currentScreen = _useState2[0],
|
|
@@ -1808,10 +1809,11 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1808
1809
|
});
|
|
1809
1810
|
setThemeBeingApplied({});
|
|
1810
1811
|
setCurrentScreen(DESIGN_SCREENS.THEMES);
|
|
1812
|
+
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess();
|
|
1811
1813
|
}
|
|
1812
1814
|
}),
|
|
1813
1815
|
applyTheme = _useApplyTheme.mutate,
|
|
1814
|
-
isApplyingTheme = _useApplyTheme.
|
|
1816
|
+
isApplyingTheme = _useApplyTheme.isPending;
|
|
1815
1817
|
var themeToDelete = react.useRef(null);
|
|
1816
1818
|
var themeToEdit = react.useRef(null);
|
|
1817
1819
|
var handleEditTheme = function handleEditTheme(theme) {
|
|
@@ -1839,10 +1841,10 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1839
1841
|
var highlightTheme = function highlightTheme(themeToHighlight) {
|
|
1840
1842
|
setTimeout(function () {
|
|
1841
1843
|
scrollElementIntoView(themeToHighlight.id);
|
|
1842
|
-
},
|
|
1844
|
+
}, 1500);
|
|
1843
1845
|
setTimeout(function () {
|
|
1844
1846
|
setThemeToHighlight(null);
|
|
1845
|
-
},
|
|
1847
|
+
}, 4000);
|
|
1846
1848
|
setThemeToHighlight(themeToHighlight.id);
|
|
1847
1849
|
};
|
|
1848
1850
|
var onCreateTheme = function onCreateTheme(createdTheme) {
|
|
@@ -1873,18 +1875,6 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1873
1875
|
}
|
|
1874
1876
|
});
|
|
1875
1877
|
}, [deleteTheme, themeToDelete]);
|
|
1876
|
-
react.useEffect(function () {
|
|
1877
|
-
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
1878
|
-
setTheme(currentTheme);
|
|
1879
|
-
}, [currentTheme, entityId]);
|
|
1880
|
-
react.useEffect(function () {
|
|
1881
|
-
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
1882
|
-
setThemeState({
|
|
1883
|
-
currentTheme: currentTheme,
|
|
1884
|
-
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
1885
|
-
previewingTheme: currentTheme
|
|
1886
|
-
});
|
|
1887
|
-
}, [currentTheme, isCurrentThemeLoading]);
|
|
1888
1878
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1889
1879
|
className: "neeto-themes-sidebar neeto-ui-border-gray-200 flex-shrink-0 border-r",
|
|
1890
1880
|
children: [/*#__PURE__*/jsxRuntime.jsx(TitleBar, {
|
|
@@ -1942,19 +1932,31 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1942
1932
|
thumbnail = _ref.thumbnail,
|
|
1943
1933
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
1944
1934
|
_ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
|
|
1945
|
-
isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes
|
|
1935
|
+
isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes,
|
|
1936
|
+
_ref$onApplyThemeSucc = _ref.onApplyThemeSuccess,
|
|
1937
|
+
onApplyThemeSuccess = _ref$onApplyThemeSucc === void 0 ? neetoCist.noop : _ref$onApplyThemeSucc;
|
|
1946
1938
|
var _useThemeStore = useThemeStore(function (store) {
|
|
1947
1939
|
return {
|
|
1948
|
-
|
|
1940
|
+
setThemeState: store["setThemeState"]
|
|
1949
1941
|
};
|
|
1950
1942
|
}, shallow.shallow),
|
|
1951
|
-
|
|
1943
|
+
setThemeState = _useThemeStore.setThemeState;
|
|
1944
|
+
var _useThemeUtils = useThemeUtils(),
|
|
1945
|
+
setTheme = _useThemeUtils.setTheme;
|
|
1952
1946
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1953
1947
|
return {
|
|
1954
1948
|
setConfigState: store["setConfigState"]
|
|
1955
1949
|
};
|
|
1956
1950
|
}, shallow.shallow),
|
|
1957
1951
|
setConfigState = _useConfigStore.setConfigState;
|
|
1952
|
+
var _useShowThemeEntity = useShowThemeEntity(entityId),
|
|
1953
|
+
_useShowThemeEntity$d = _useShowThemeEntity.data,
|
|
1954
|
+
_useShowThemeEntity$d2 = _useShowThemeEntity$d === void 0 ? {} : _useShowThemeEntity$d,
|
|
1955
|
+
_useShowThemeEntity$d3 = _useShowThemeEntity$d2.theme,
|
|
1956
|
+
currentTheme = _useShowThemeEntity$d3 === void 0 ? {} : _useShowThemeEntity$d3,
|
|
1957
|
+
isLoading = _useShowThemeEntity.isLoading,
|
|
1958
|
+
isFetchingCurrentTheme = _useShowThemeEntity.isFetching;
|
|
1959
|
+
var isCurrentThemeLoading = isLoading || isFetchingCurrentTheme;
|
|
1958
1960
|
react.useEffect(function () {
|
|
1959
1961
|
setConfigState({
|
|
1960
1962
|
entityType: entityType,
|
|
@@ -1962,9 +1964,22 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
1962
1964
|
isTemplateThemesEnabled: isTemplateThemesEnabled
|
|
1963
1965
|
});
|
|
1964
1966
|
}, []);
|
|
1967
|
+
react.useEffect(function () {
|
|
1968
|
+
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
1969
|
+
setThemeState({
|
|
1970
|
+
currentTheme: currentTheme,
|
|
1971
|
+
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
1972
|
+
previewingTheme: currentTheme
|
|
1973
|
+
});
|
|
1974
|
+
}, [currentTheme, isCurrentThemeLoading]);
|
|
1975
|
+
react.useEffect(function () {
|
|
1976
|
+
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
1977
|
+
setTheme(currentTheme);
|
|
1978
|
+
}, [currentTheme, entityId]);
|
|
1965
1979
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1966
1980
|
className: "neeto-themes__wrapper",
|
|
1967
1981
|
children: [/*#__PURE__*/jsxRuntime.jsx(Sidebar, {
|
|
1982
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
1968
1983
|
onPropertiesChange: onPropertiesChange,
|
|
1969
1984
|
thumbnail: thumbnail
|
|
1970
1985
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|