@bigbinary/neeto-themes-frontend 3.0.2 → 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.
@@ -63,7 +63,7 @@
63
63
  "delete": "Delete",
64
64
  "setAsGlobalTheme": {
65
65
  "label": "Set as global theme",
66
- "helpText": "Enabling this will set this theme as the default theme, automatically applying it to all your future {{entityType}}s.",
66
+ "helpText": "Enabling this will set this theme as the default theme, automatically applying it to all your future {{entityType}}s. This theme will also be applied to the {{entityType}}s that uses the previous global theme.",
67
67
  "tooltipContent": "This theme is currently set as the global theme. Select another theme to change it."
68
68
  }
69
69
  },
@@ -140,7 +140,7 @@ var useListThemes = function useListThemes(entityId) {
140
140
  };
141
141
  var useCreateTheme = function useCreateTheme() {
142
142
  return useMutationWithInvalidation(themesApi.create, {
143
- keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.GLOBAL_THEME_DETAILS]]
143
+ keysToInvalidate: [[QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS], [QUERY_KEYS.GLOBAL_THEME_DETAILS]]
144
144
  });
145
145
  };
146
146
  var useUpdateTheme = function useUpdateTheme(themeId) {
@@ -172,7 +172,7 @@ var useApplyTheme = function useApplyTheme(_ref) {
172
172
  };
173
173
  var useApplyGlobalTheme = function useApplyGlobalTheme() {
174
174
  return useMutationWithInvalidation(themesApi.applyGlobalTheme, {
175
- keysToInvalidate: [[QUERY_KEYS.GLOBAL_THEME_DETAILS]]
175
+ keysToInvalidate: [[QUERY_KEYS.GLOBAL_THEME_DETAILS], [QUERY_KEYS.THEMES_LIST], [QUERY_KEYS.THEME_ENTITY_DETAILS]]
176
176
  });
177
177
  };
178
178
 
@@ -1154,6 +1154,7 @@ var Customize = function Customize(_ref) {
1154
1154
  _useShowGlobalTheme$d3 = _useShowGlobalTheme$d2.globalTheme,
1155
1155
  globalTheme = _useShowGlobalTheme$d3 === void 0 ? {} : _useShowGlobalTheme$d3;
1156
1156
  var isThemeGlobalTheme = (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
1157
+ var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
1157
1158
  var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1158
1159
  var submitBtnRef = useRef(null);
1159
1160
  var _useCreateTheme = useCreateTheme(),
@@ -1288,7 +1289,6 @@ var Customize = function Customize(_ref) {
1288
1289
  appendTo: function appendTo() {
1289
1290
  return document.body;
1290
1291
  },
1291
- disabled: isEditingCurrentlyAppliedTheme,
1292
1292
  position: "top",
1293
1293
  reference: submitBtnRef,
1294
1294
  trigger: "click",
@@ -1325,6 +1325,7 @@ var Customize = function Customize(_ref) {
1325
1325
  }
1326
1326
  })]
1327
1327
  }),
1328
+ disabled: isEditingCurrentlyAppliedTheme || isCurrentThemeAndGlobalThemeSame && values.shouldSetAsGlobalTheme,
1328
1329
  onMount: setPopoverInstance
1329
1330
  })]
1330
1331
  });
@@ -1640,6 +1641,7 @@ var Themes = function Themes(_ref) {
1640
1641
  thumbnail = _ref.thumbnail,
1641
1642
  themeBeingApplied = _ref.themeBeingApplied,
1642
1643
  onApplyTheme = _ref.onApplyTheme,
1644
+ onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess,
1643
1645
  isApplyingTheme = _ref.isApplyingTheme;
1644
1646
  var _useTranslation = useTranslation(),
1645
1647
  t = _useTranslation.t;
@@ -1708,6 +1710,10 @@ var Themes = function Themes(_ref) {
1708
1710
  applyGlobalTheme({
1709
1711
  themeId: themeId,
1710
1712
  payload: payload
1713
+ }, {
1714
+ onSuccess: function onSuccess() {
1715
+ onApplyGlobalThemeSuccess === null || onApplyGlobalThemeSuccess === void 0 ? void 0 : onApplyGlobalThemeSuccess();
1716
+ }
1711
1717
  });
1712
1718
  };
1713
1719
  if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
@@ -1863,7 +1869,8 @@ var Sidebar = function Sidebar(_ref) {
1863
1869
  var thumbnail = _ref.thumbnail,
1864
1870
  onPropertiesChange = _ref.onPropertiesChange,
1865
1871
  onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1866
- onUpdateThemeSuccess = _ref.onUpdateThemeSuccess;
1872
+ onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
1873
+ onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess;
1867
1874
  var _useState = useState(DESIGN_SCREENS.THEMES),
1868
1875
  _useState2 = _slicedToArray(_useState, 2),
1869
1876
  currentScreen = _useState2[0],
@@ -2034,6 +2041,7 @@ var Sidebar = function Sidebar(_ref) {
2034
2041
  highlightTheme: highlightTheme,
2035
2042
  isApplyingTheme: isApplyingTheme,
2036
2043
  isCurrentThemeLoading: isCurrentThemeLoading,
2044
+ onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
2037
2045
  onApplyTheme: onApplyTheme,
2038
2046
  themeBeingApplied: themeBeingApplied,
2039
2047
  themeToHighlight: themeToHighlight,
@@ -2089,7 +2097,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2089
2097
  _ref$onApplyThemeSucc = _ref.onApplyThemeSuccess,
2090
2098
  onApplyThemeSuccess = _ref$onApplyThemeSucc === void 0 ? noop : _ref$onApplyThemeSucc,
2091
2099
  _ref$onUpdateThemeSuc = _ref.onUpdateThemeSuccess,
2092
- onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? noop : _ref$onUpdateThemeSuc;
2100
+ onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? noop : _ref$onUpdateThemeSuc,
2101
+ _ref$onApplyGlobalThe = _ref.onApplyGlobalThemeSuccess,
2102
+ onApplyGlobalThemeSuccess = _ref$onApplyGlobalThe === void 0 ? noop : _ref$onApplyGlobalThe;
2093
2103
  var _useThemeStore = useThemeStore(function (store) {
2094
2104
  return {
2095
2105
  setThemeState: store["setThemeState"]
@@ -2125,7 +2135,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2125
2135
  previewingTheme: currentTheme
2126
2136
  });
2127
2137
  setTheme(currentTheme);
2128
- }, [isLoading, entityId]);
2138
+ }, [isLoading, entityId, currentTheme]);
2129
2139
  useEffect(function () {
2130
2140
  if (isNotPresent(currentTheme)) return;
2131
2141
  setThemeState({
@@ -2136,6 +2146,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2136
2146
  return /*#__PURE__*/jsxs("div", {
2137
2147
  className: "neeto-themes__wrapper",
2138
2148
  children: [/*#__PURE__*/jsx(Sidebar, {
2149
+ onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
2139
2150
  onApplyThemeSuccess: onApplyThemeSuccess,
2140
2151
  onPropertiesChange: onPropertiesChange,
2141
2152
  onUpdateThemeSuccess: onUpdateThemeSuccess,