@bigbinary/neeto-themes-frontend 3.0.1 → 3.0.3
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.
|
@@ -161,7 +161,7 @@ var useListThemes = function useListThemes(entityId) {
|
|
|
161
161
|
};
|
|
162
162
|
var useCreateTheme = function useCreateTheme() {
|
|
163
163
|
return reactUtils.useMutationWithInvalidation(themesApi.create, {
|
|
164
|
-
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.THEMES_LIST], [useThemeUtils.QUERY_KEYS.GLOBAL_THEME_DETAILS]]
|
|
164
|
+
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.THEMES_LIST], [useThemeUtils.QUERY_KEYS.THEME_ENTITY_DETAILS], [useThemeUtils.QUERY_KEYS.GLOBAL_THEME_DETAILS]]
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
167
|
var useUpdateTheme = function useUpdateTheme(themeId) {
|
|
@@ -193,7 +193,7 @@ var useApplyTheme = function useApplyTheme(_ref) {
|
|
|
193
193
|
};
|
|
194
194
|
var useApplyGlobalTheme = function useApplyGlobalTheme() {
|
|
195
195
|
return reactUtils.useMutationWithInvalidation(themesApi.applyGlobalTheme, {
|
|
196
|
-
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.GLOBAL_THEME_DETAILS]]
|
|
196
|
+
keysToInvalidate: [[useThemeUtils.QUERY_KEYS.GLOBAL_THEME_DETAILS], [useThemeUtils.QUERY_KEYS.THEMES_LIST], [useThemeUtils.QUERY_KEYS.THEME_ENTITY_DETAILS]]
|
|
197
197
|
});
|
|
198
198
|
};
|
|
199
199
|
|
|
@@ -1167,13 +1167,15 @@ var Customize = function Customize(_ref) {
|
|
|
1167
1167
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1168
1168
|
entityType = _useConfigStore.entityType;
|
|
1169
1169
|
var _useThemeUtils = useThemeUtils.useThemeUtils(),
|
|
1170
|
-
currentTheme = _useThemeUtils.currentTheme
|
|
1170
|
+
currentTheme = _useThemeUtils.currentTheme,
|
|
1171
|
+
setThemeState = _useThemeUtils.setThemeState;
|
|
1171
1172
|
var _useShowGlobalTheme = useShowGlobalTheme(entityType),
|
|
1172
1173
|
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1173
1174
|
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
1174
1175
|
_useShowGlobalTheme$d3 = _useShowGlobalTheme$d2.globalTheme,
|
|
1175
1176
|
globalTheme = _useShowGlobalTheme$d3 === void 0 ? {} : _useShowGlobalTheme$d3;
|
|
1176
1177
|
var isThemeGlobalTheme = (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
|
|
1178
|
+
var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
|
|
1177
1179
|
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1178
1180
|
var submitBtnRef = react.useRef(null);
|
|
1179
1181
|
var _useCreateTheme = useCreateTheme(),
|
|
@@ -1208,11 +1210,15 @@ var Customize = function Customize(_ref) {
|
|
|
1208
1210
|
});
|
|
1209
1211
|
}
|
|
1210
1212
|
return updateTheme(themeToSave, {
|
|
1211
|
-
onSuccess: function onSuccess() {
|
|
1213
|
+
onSuccess: function onSuccess(_ref4) {
|
|
1214
|
+
var theme = _ref4.theme;
|
|
1215
|
+
onUpdateThemeSuccess === null || onUpdateThemeSuccess === void 0 ? void 0 : onUpdateThemeSuccess(theme);
|
|
1216
|
+
setThemeState({
|
|
1217
|
+
previewingTheme: theme
|
|
1218
|
+
});
|
|
1212
1219
|
resetForm({
|
|
1213
|
-
values:
|
|
1220
|
+
values: theme
|
|
1214
1221
|
});
|
|
1215
|
-
onUpdateThemeSuccess === null || onUpdateThemeSuccess === void 0 ? void 0 : onUpdateThemeSuccess(values);
|
|
1216
1222
|
}
|
|
1217
1223
|
});
|
|
1218
1224
|
};
|
|
@@ -1226,10 +1232,10 @@ var Customize = function Customize(_ref) {
|
|
|
1226
1232
|
enableReinitialize: true,
|
|
1227
1233
|
onSubmit: onSubmit
|
|
1228
1234
|
},
|
|
1229
|
-
children: function children(
|
|
1230
|
-
var dirty =
|
|
1231
|
-
values =
|
|
1232
|
-
setFieldValue =
|
|
1235
|
+
children: function children(_ref5) {
|
|
1236
|
+
var dirty = _ref5.dirty,
|
|
1237
|
+
values = _ref5.values,
|
|
1238
|
+
setFieldValue = _ref5.setFieldValue;
|
|
1233
1239
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1234
1240
|
className: "neeto-themes-sidebar__scroll",
|
|
1235
1241
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -1249,8 +1255,8 @@ var Customize = function Customize(_ref) {
|
|
|
1249
1255
|
})
|
|
1250
1256
|
}), neetoCist.filterBy({
|
|
1251
1257
|
kind: "image"
|
|
1252
|
-
}, themePropertiesSchema).map(function (
|
|
1253
|
-
var key =
|
|
1258
|
+
}, themePropertiesSchema).map(function (_ref6) {
|
|
1259
|
+
var key = _ref6.key;
|
|
1254
1260
|
return /*#__PURE__*/react.createElement(Images, {
|
|
1255
1261
|
onPropertiesChange: onPropertiesChange,
|
|
1256
1262
|
attribute: key,
|
|
@@ -1304,7 +1310,6 @@ var Customize = function Customize(_ref) {
|
|
|
1304
1310
|
appendTo: function appendTo() {
|
|
1305
1311
|
return document.body;
|
|
1306
1312
|
},
|
|
1307
|
-
disabled: isEditingCurrentlyAppliedTheme,
|
|
1308
1313
|
position: "top",
|
|
1309
1314
|
reference: submitBtnRef,
|
|
1310
1315
|
trigger: "click",
|
|
@@ -1341,6 +1346,7 @@ var Customize = function Customize(_ref) {
|
|
|
1341
1346
|
}
|
|
1342
1347
|
})]
|
|
1343
1348
|
}),
|
|
1349
|
+
disabled: isEditingCurrentlyAppliedTheme || isCurrentThemeAndGlobalThemeSame && values.shouldSetAsGlobalTheme,
|
|
1344
1350
|
onMount: setPopoverInstance
|
|
1345
1351
|
})]
|
|
1346
1352
|
});
|
|
@@ -1656,6 +1662,7 @@ var Themes = function Themes(_ref) {
|
|
|
1656
1662
|
thumbnail = _ref.thumbnail,
|
|
1657
1663
|
themeBeingApplied = _ref.themeBeingApplied,
|
|
1658
1664
|
onApplyTheme = _ref.onApplyTheme,
|
|
1665
|
+
onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess,
|
|
1659
1666
|
isApplyingTheme = _ref.isApplyingTheme;
|
|
1660
1667
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1661
1668
|
t = _useTranslation.t;
|
|
@@ -1724,6 +1731,10 @@ var Themes = function Themes(_ref) {
|
|
|
1724
1731
|
applyGlobalTheme({
|
|
1725
1732
|
themeId: themeId,
|
|
1726
1733
|
payload: payload
|
|
1734
|
+
}, {
|
|
1735
|
+
onSuccess: function onSuccess() {
|
|
1736
|
+
onApplyGlobalThemeSuccess === null || onApplyGlobalThemeSuccess === void 0 ? void 0 : onApplyGlobalThemeSuccess();
|
|
1737
|
+
}
|
|
1727
1738
|
});
|
|
1728
1739
|
};
|
|
1729
1740
|
if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
|
|
@@ -1879,7 +1890,8 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
1879
1890
|
var thumbnail = _ref.thumbnail,
|
|
1880
1891
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
1881
1892
|
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1882
|
-
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess
|
|
1893
|
+
onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
|
|
1894
|
+
onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess;
|
|
1883
1895
|
var _useState = react.useState(DESIGN_SCREENS.THEMES),
|
|
1884
1896
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1885
1897
|
currentScreen = _useState2[0],
|
|
@@ -2050,6 +2062,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2050
2062
|
highlightTheme: highlightTheme,
|
|
2051
2063
|
isApplyingTheme: isApplyingTheme,
|
|
2052
2064
|
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
2065
|
+
onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
|
|
2053
2066
|
onApplyTheme: onApplyTheme,
|
|
2054
2067
|
themeBeingApplied: themeBeingApplied,
|
|
2055
2068
|
themeToHighlight: themeToHighlight,
|
|
@@ -2105,7 +2118,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2105
2118
|
_ref$onApplyThemeSucc = _ref.onApplyThemeSuccess,
|
|
2106
2119
|
onApplyThemeSuccess = _ref$onApplyThemeSucc === void 0 ? neetoCist.noop : _ref$onApplyThemeSucc,
|
|
2107
2120
|
_ref$onUpdateThemeSuc = _ref.onUpdateThemeSuccess,
|
|
2108
|
-
onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? neetoCist.noop : _ref$onUpdateThemeSuc
|
|
2121
|
+
onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? neetoCist.noop : _ref$onUpdateThemeSuc,
|
|
2122
|
+
_ref$onApplyGlobalThe = _ref.onApplyGlobalThemeSuccess,
|
|
2123
|
+
onApplyGlobalThemeSuccess = _ref$onApplyGlobalThe === void 0 ? neetoCist.noop : _ref$onApplyGlobalThe;
|
|
2109
2124
|
var _useThemeStore = useThemeUtils.useThemeStore(function (store) {
|
|
2110
2125
|
return {
|
|
2111
2126
|
setThemeState: store["setThemeState"]
|
|
@@ -2141,7 +2156,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2141
2156
|
previewingTheme: currentTheme
|
|
2142
2157
|
});
|
|
2143
2158
|
setTheme(currentTheme);
|
|
2144
|
-
}, [isLoading, entityId]);
|
|
2159
|
+
}, [isLoading, entityId, currentTheme]);
|
|
2145
2160
|
react.useEffect(function () {
|
|
2146
2161
|
if (neetoCist.isNotPresent(currentTheme)) return;
|
|
2147
2162
|
setThemeState({
|
|
@@ -2152,6 +2167,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2152
2167
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2153
2168
|
className: "neeto-themes__wrapper",
|
|
2154
2169
|
children: [/*#__PURE__*/jsxRuntime.jsx(Sidebar, {
|
|
2170
|
+
onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
|
|
2155
2171
|
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2156
2172
|
onPropertiesChange: onPropertiesChange,
|
|
2157
2173
|
onUpdateThemeSuccess: onUpdateThemeSuccess,
|