@bigbinary/neeto-themes-frontend 3.0.2 → 3.0.4

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
 
@@ -1175,6 +1175,7 @@ var Customize = function Customize(_ref) {
1175
1175
  _useShowGlobalTheme$d3 = _useShowGlobalTheme$d2.globalTheme,
1176
1176
  globalTheme = _useShowGlobalTheme$d3 === void 0 ? {} : _useShowGlobalTheme$d3;
1177
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);
1178
1179
  var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1179
1180
  var submitBtnRef = react.useRef(null);
1180
1181
  var _useCreateTheme = useCreateTheme(),
@@ -1309,7 +1310,6 @@ var Customize = function Customize(_ref) {
1309
1310
  appendTo: function appendTo() {
1310
1311
  return document.body;
1311
1312
  },
1312
- disabled: isEditingCurrentlyAppliedTheme,
1313
1313
  position: "top",
1314
1314
  reference: submitBtnRef,
1315
1315
  trigger: "click",
@@ -1346,6 +1346,7 @@ var Customize = function Customize(_ref) {
1346
1346
  }
1347
1347
  })]
1348
1348
  }),
1349
+ disabled: isEditingCurrentlyAppliedTheme || isCurrentThemeAndGlobalThemeSame && values.shouldSetAsGlobalTheme,
1349
1350
  onMount: setPopoverInstance
1350
1351
  })]
1351
1352
  });
@@ -1661,6 +1662,7 @@ var Themes = function Themes(_ref) {
1661
1662
  thumbnail = _ref.thumbnail,
1662
1663
  themeBeingApplied = _ref.themeBeingApplied,
1663
1664
  onApplyTheme = _ref.onApplyTheme,
1665
+ onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess,
1664
1666
  isApplyingTheme = _ref.isApplyingTheme;
1665
1667
  var _useTranslation = reactI18next.useTranslation(),
1666
1668
  t = _useTranslation.t;
@@ -1729,6 +1731,10 @@ var Themes = function Themes(_ref) {
1729
1731
  applyGlobalTheme({
1730
1732
  themeId: themeId,
1731
1733
  payload: payload
1734
+ }, {
1735
+ onSuccess: function onSuccess() {
1736
+ onApplyGlobalThemeSuccess === null || onApplyGlobalThemeSuccess === void 0 ? void 0 : onApplyGlobalThemeSuccess();
1737
+ }
1732
1738
  });
1733
1739
  };
1734
1740
  if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
@@ -1822,18 +1828,37 @@ var TitleBar = function TitleBar(_ref) {
1822
1828
  themeToEdit = _ref.themeToEdit;
1823
1829
  var _useTranslation = reactI18next.useTranslation(),
1824
1830
  t = _useTranslation.t;
1831
+ var _useConfigStore = useThemeUtils.useConfigStore(function (store) {
1832
+ return {
1833
+ entityType: store["entityType"],
1834
+ helpDocUrl: store["helpDocUrl"]
1835
+ };
1836
+ }, shallow.shallow),
1837
+ entityType = _useConfigStore.entityType,
1838
+ helpDocUrl = _useConfigStore.helpDocUrl;
1825
1839
  var isCustomCssScreen = isScreenCustomCSS(currentScreen);
1826
1840
  if (currentScreen === DESIGN_SCREENS.THEMES) {
1827
1841
  return /*#__PURE__*/jsxRuntime.jsx("div", {
1828
1842
  className: "neeto-themes-sidebar__header px-6 lg:px-5 xl:px-6",
1829
1843
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1830
1844
  className: "flex items-center justify-between space-x-2",
1831
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
1832
- "data-cy": "themes-header",
1833
- lineHeight: "normal",
1834
- style: "h3",
1835
- weight: "semibold",
1836
- children: t("neetoThemes.build.leftSideBar.headerTabs.themes")
1845
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1846
+ className: "flex space-x-2",
1847
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
1848
+ "data-cy": "themes-header",
1849
+ lineHeight: "normal",
1850
+ style: "h3",
1851
+ weight: "semibold",
1852
+ children: t("neetoThemes.build.leftSideBar.headerTabs.themes")
1853
+ }), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
1854
+ helpLinkProps: helpDocUrl && {
1855
+ href: helpDocUrl
1856
+ },
1857
+ title: t("neetoThemes.build.leftSideBar.helpPopover.title"),
1858
+ description: t("neetoThemes.build.leftSideBar.helpPopover.description", {
1859
+ entityType: entityType
1860
+ })
1861
+ })]
1837
1862
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
1838
1863
  className: "self-end",
1839
1864
  children: /*#__PURE__*/jsxRuntime.jsx(Button, {
@@ -1884,7 +1909,8 @@ var Sidebar = function Sidebar(_ref) {
1884
1909
  var thumbnail = _ref.thumbnail,
1885
1910
  onPropertiesChange = _ref.onPropertiesChange,
1886
1911
  onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1887
- onUpdateThemeSuccess = _ref.onUpdateThemeSuccess;
1912
+ onUpdateThemeSuccess = _ref.onUpdateThemeSuccess,
1913
+ onApplyGlobalThemeSuccess = _ref.onApplyGlobalThemeSuccess;
1888
1914
  var _useState = react.useState(DESIGN_SCREENS.THEMES),
1889
1915
  _useState2 = _slicedToArray(_useState, 2),
1890
1916
  currentScreen = _useState2[0],
@@ -2055,6 +2081,7 @@ var Sidebar = function Sidebar(_ref) {
2055
2081
  highlightTheme: highlightTheme,
2056
2082
  isApplyingTheme: isApplyingTheme,
2057
2083
  isCurrentThemeLoading: isCurrentThemeLoading,
2084
+ onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
2058
2085
  onApplyTheme: onApplyTheme,
2059
2086
  themeBeingApplied: themeBeingApplied,
2060
2087
  themeToHighlight: themeToHighlight,
@@ -2105,12 +2132,16 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2105
2132
  entityId = _ref.entityId,
2106
2133
  thumbnail = _ref.thumbnail,
2107
2134
  onPropertiesChange = _ref.onPropertiesChange,
2135
+ _ref$helpDocUrl = _ref.helpDocUrl,
2136
+ helpDocUrl = _ref$helpDocUrl === void 0 ? null : _ref$helpDocUrl,
2108
2137
  _ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
2109
2138
  isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes,
2110
2139
  _ref$onApplyThemeSucc = _ref.onApplyThemeSuccess,
2111
2140
  onApplyThemeSuccess = _ref$onApplyThemeSucc === void 0 ? neetoCist.noop : _ref$onApplyThemeSucc,
2112
2141
  _ref$onUpdateThemeSuc = _ref.onUpdateThemeSuccess,
2113
- onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? neetoCist.noop : _ref$onUpdateThemeSuc;
2142
+ onUpdateThemeSuccess = _ref$onUpdateThemeSuc === void 0 ? neetoCist.noop : _ref$onUpdateThemeSuc,
2143
+ _ref$onApplyGlobalThe = _ref.onApplyGlobalThemeSuccess,
2144
+ onApplyGlobalThemeSuccess = _ref$onApplyGlobalThe === void 0 ? neetoCist.noop : _ref$onApplyGlobalThe;
2114
2145
  var _useThemeStore = useThemeUtils.useThemeStore(function (store) {
2115
2146
  return {
2116
2147
  setThemeState: store["setThemeState"]
@@ -2137,7 +2168,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2137
2168
  setConfigState({
2138
2169
  entityType: entityType,
2139
2170
  entityId: entityId,
2140
- isTemplateThemesEnabled: isTemplateThemesEnabled
2171
+ isTemplateThemesEnabled: isTemplateThemesEnabled,
2172
+ helpDocUrl: helpDocUrl
2141
2173
  });
2142
2174
  }, []);
2143
2175
  react.useEffect(function () {
@@ -2146,7 +2178,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2146
2178
  previewingTheme: currentTheme
2147
2179
  });
2148
2180
  setTheme(currentTheme);
2149
- }, [isLoading, entityId]);
2181
+ }, [isLoading, entityId, currentTheme]);
2150
2182
  react.useEffect(function () {
2151
2183
  if (neetoCist.isNotPresent(currentTheme)) return;
2152
2184
  setThemeState({
@@ -2157,6 +2189,7 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2157
2189
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2158
2190
  className: "neeto-themes__wrapper",
2159
2191
  children: [/*#__PURE__*/jsxRuntime.jsx(Sidebar, {
2192
+ onApplyGlobalThemeSuccess: onApplyGlobalThemeSuccess,
2160
2193
  onApplyThemeSuccess: onApplyThemeSuccess,
2161
2194
  onPropertiesChange: onPropertiesChange,
2162
2195
  onUpdateThemeSuccess: onUpdateThemeSuccess,