@bigbinary/neeto-themes-frontend 4.2.3 → 4.2.4-beta2

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.
@@ -9,7 +9,7 @@ var reactI18next = require('react-i18next');
9
9
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
10
10
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
11
11
  var Toastr = require('@bigbinary/neetoui/Toastr');
12
- var useGlobalThemesApi = require('../useGlobalThemesApi-B_qW7yfd.js');
12
+ var useGlobalThemesApi = require('../useGlobalThemesApi-gt4U6XWZ.js');
13
13
  var useExpandedSection = require('../useExpandedSection-BTBI4UqP.js');
14
14
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
15
15
  var classnames = require('classnames');
@@ -54,6 +54,7 @@ var AddImage = require('@bigbinary/neeto-icons/AddImage');
54
54
  var CodeBlock = require('@bigbinary/neeto-icons/CodeBlock');
55
55
  var ColorPicker$1 = require('@bigbinary/neeto-icons/ColorPicker');
56
56
  var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
57
+ var Tag = require('@bigbinary/neetoui/Tag');
57
58
  var LeftArrow = require('@bigbinary/neeto-icons/LeftArrow');
58
59
  var RightArrow = require('@bigbinary/neeto-icons/RightArrow');
59
60
  var Search$1 = require('@bigbinary/neeto-icons/Search');
@@ -644,6 +645,15 @@ var buildProperties = function buildProperties(values, condition, themePropertie
644
645
  return !imageKeys.has(dependsOn);
645
646
  });
646
647
  };
648
+ var buildSystemThemeCopy = function buildSystemThemeCopy(systemTheme) {
649
+ if (!systemTheme) return null;
650
+ return _objectSpread$3(_objectSpread$3({}, ramda.omit(["id"], systemTheme)), {}, {
651
+ name: i18n.t("neetoThemes.common.cloneName", {
652
+ name: systemTheme.name
653
+ }),
654
+ properties: systemTheme.properties.map(ramda.omit(["id", "themeId"]))
655
+ });
656
+ };
647
657
 
648
658
  var AlignmentBlock = function AlignmentBlock(_ref) {
649
659
  var label = _ref.label,
@@ -1401,6 +1411,7 @@ var Customize = function Customize(_ref) {
1401
1411
  var theme = _ref.theme,
1402
1412
  onCreateTheme = _ref.onCreateTheme,
1403
1413
  onApplyTheme = _ref.onApplyTheme,
1414
+ onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1404
1415
  onUpdateTheme = _ref.onUpdateTheme,
1405
1416
  isApplyingTheme = _ref.isApplyingTheme,
1406
1417
  onPropertiesChange = _ref.onPropertiesChange,
@@ -1419,6 +1430,7 @@ var Customize = function Customize(_ref) {
1419
1430
  var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1420
1431
  return {
1421
1432
  themePropertiesSchema: store["themePropertiesSchema"],
1433
+ entityId: store["entityId"],
1422
1434
  entityType: store["entityType"],
1423
1435
  isFetchingSchema: store["isFetchingSchema"],
1424
1436
  helpPopoverProps: store["helpPopoverProps"],
@@ -1427,6 +1439,7 @@ var Customize = function Customize(_ref) {
1427
1439
  };
1428
1440
  }, shallow.shallow),
1429
1441
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1442
+ entityId = _useConfigStore.entityId,
1430
1443
  entityType = _useConfigStore.entityType,
1431
1444
  isFetchingSchema = _useConfigStore.isFetchingSchema,
1432
1445
  helpPopoverProps = _useConfigStore.helpPopoverProps,
@@ -1434,6 +1447,9 @@ var Customize = function Customize(_ref) {
1434
1447
  proFeatures = _useConfigStore.proFeatures;
1435
1448
  var _useParams = reactRouterDom.useParams(),
1436
1449
  themeId = _useParams.themeId;
1450
+ var _useQueryParams = reactUtils.useQueryParams(),
1451
+ sourceThemeId = _useQueryParams.source;
1452
+ var isCustomizingSystemTheme = !themeId && neetoCist.isPresent(sourceThemeId);
1437
1453
  var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
1438
1454
  return {
1439
1455
  currentTheme: store["currentTheme"],
@@ -1454,12 +1470,25 @@ var Customize = function Customize(_ref) {
1454
1470
  _useFetchTheme$data = _useFetchTheme.data,
1455
1471
  themeData = _useFetchTheme$data === void 0 ? {} : _useFetchTheme$data,
1456
1472
  isLoadingTheme = _useFetchTheme.isLoadingTheme;
1457
- var isLoading = isFetchingSchema || isLoadingTheme;
1473
+ var _useListThemes = useGlobalThemesApi.useListThemes(entityId),
1474
+ _useListThemes$data = _useListThemes.data,
1475
+ _useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
1476
+ _useListThemes$data2$ = _useListThemes$data2.defaultThemes,
1477
+ defaultThemes = _useListThemes$data2$ === void 0 ? [] : _useListThemes$data2$,
1478
+ isLoadingSystemThemes = _useListThemes.isLoading;
1479
+ var sourceTheme = isCustomizingSystemTheme ? neetoCist.findBy({
1480
+ id: sourceThemeId
1481
+ }, defaultThemes) : null;
1482
+ var systemThemeCopy = react.useMemo(function () {
1483
+ return buildSystemThemeCopy(sourceTheme);
1484
+ }, [sourceTheme === null || sourceTheme === void 0 ? void 0 : sourceTheme.id]);
1485
+ var themeToCustomize = isCustomizingSystemTheme ? systemThemeCopy : themeData;
1486
+ var isLoading = isFetchingSchema || isLoadingTheme || isCustomizingSystemTheme && isLoadingSystemThemes;
1458
1487
  var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
1459
1488
  var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
1460
1489
  var _helpPopoverProps$sty = helpPopoverProps.style,
1461
1490
  styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
1462
- var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1491
+ var isEditingCurrentlyAppliedTheme = (themeId !== null && themeId !== void 0 ? themeId : sourceThemeId) === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1463
1492
  var submitBtnRef = react.useRef(null);
1464
1493
  var _useCreateTheme = useGlobalThemesApi.useCreateTheme(),
1465
1494
  createTheme = _useCreateTheme.mutateAsync,
@@ -1467,13 +1496,57 @@ var Customize = function Customize(_ref) {
1467
1496
  var _useUpdateTheme = useGlobalThemesApi.useUpdateTheme(themeId),
1468
1497
  updateTheme = _useUpdateTheme.mutateAsync,
1469
1498
  isUpdating = _useUpdateTheme.isPending;
1470
- var isSubmitting = isCreating || isUpdating;
1499
+ var _useApplyTheme = useGlobalThemesApi.useApplyTheme({}),
1500
+ applyTheme = _useApplyTheme.mutateAsync,
1501
+ isApplyingCreatedTheme = _useApplyTheme.isPending;
1502
+ var isSubmitting = isCreating || isUpdating || isApplyingCreatedTheme;
1471
1503
  var isCustomCssScreen = isScreenCustomCSS(currentScreen);
1472
1504
  var handleGlobalThemeSwitchChange = function handleGlobalThemeSwitchChange(e, setFieldValue) {
1473
1505
  setFieldValue("shouldSetAsGlobalTheme", e.target.checked);
1474
1506
  };
1475
- var onSubmit = function onSubmit(values, _ref2) {
1476
- var resetForm = _ref2.resetForm;
1507
+ var createAndOpenTheme = /*#__PURE__*/function () {
1508
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeToSave, resetForm) {
1509
+ var _yield$createTheme, theme;
1510
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1511
+ while (1) switch (_context.prev = _context.next) {
1512
+ case 0:
1513
+ _context.next = 2;
1514
+ return createTheme(themeToSave);
1515
+ case 2:
1516
+ _yield$createTheme = _context.sent;
1517
+ theme = _yield$createTheme.theme;
1518
+ resetForm({
1519
+ values: theme
1520
+ });
1521
+ if (!isCustomizingSystemTheme) {
1522
+ _context.next = 9;
1523
+ break;
1524
+ }
1525
+ _context.next = 8;
1526
+ return applyTheme({
1527
+ themeId: theme.id,
1528
+ entityId: entityId,
1529
+ entityType: entityType
1530
+ });
1531
+ case 8:
1532
+ onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(theme);
1533
+ case 9:
1534
+ onCreateTheme(theme);
1535
+ history.replace(utils$1.buildUrl(buildPathname(useGlobalThemesApi.routes.themes.edit), {
1536
+ themeId: theme.id
1537
+ }));
1538
+ case 11:
1539
+ case "end":
1540
+ return _context.stop();
1541
+ }
1542
+ }, _callee);
1543
+ }));
1544
+ return function createAndOpenTheme(_x, _x2) {
1545
+ return _ref2.apply(this, arguments);
1546
+ };
1547
+ }();
1548
+ var onSubmit = function onSubmit(values, _ref3) {
1549
+ var resetForm = _ref3.resetForm;
1477
1550
  var imageData = buildImageData(values, themePropertiesSchema);
1478
1551
  var themeToSave = _objectSpread({
1479
1552
  propertiesAttributes: values.properties,
@@ -1481,20 +1554,7 @@ var Customize = function Customize(_ref) {
1481
1554
  shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
1482
1555
  entityType: values.entityType
1483
1556
  }, imageData);
1484
- if (!themeId) {
1485
- return createTheme(themeToSave, {
1486
- onSuccess: function onSuccess(_ref3) {
1487
- var theme = _ref3.theme;
1488
- resetForm({
1489
- values: theme
1490
- });
1491
- onCreateTheme(theme);
1492
- history.replace(utils$1.buildUrl(buildPathname(useGlobalThemesApi.routes.themes.edit), {
1493
- themeId: theme.id
1494
- }));
1495
- }
1496
- });
1497
- }
1557
+ if (!themeId) return createAndOpenTheme(themeToSave, resetForm);
1498
1558
  return updateTheme(themeToSave, {
1499
1559
  onSuccess: function onSuccess(_ref4) {
1500
1560
  var theme = _ref4.theme;
@@ -1520,7 +1580,7 @@ var Customize = function Customize(_ref) {
1520
1580
  }
1521
1581
  return /*#__PURE__*/jsxRuntime.jsx(Form, {
1522
1582
  formikProps: {
1523
- initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeData, themePropertiesSchema)), {}, {
1583
+ initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeToCustomize, themePropertiesSchema)), {}, {
1524
1584
  shouldSetAsGlobalTheme: isThemeGlobalTheme,
1525
1585
  entityType: entityType
1526
1586
  }),
@@ -1609,11 +1669,11 @@ var Customize = function Customize(_ref) {
1609
1669
  type: "reset"
1610
1670
  }), /*#__PURE__*/jsxRuntime.jsx(Button, {
1611
1671
  "data-testid": "save-changes-button",
1612
- disabled: !dirty && (themeData === null || themeData === void 0 ? void 0 : themeData.id) || isSubmitting || !isValid,
1613
1672
  label: t("neetoThemes.buttons.save"),
1614
1673
  loading: isSubmitting,
1615
1674
  ref: submitBtnRef,
1616
- type: "submit"
1675
+ type: "submit",
1676
+ disabled: !dirty && (themeToCustomize === null || themeToCustomize === void 0 ? void 0 : themeToCustomize.id) || isSubmitting || !isValid
1617
1677
  })]
1618
1678
  }), /*#__PURE__*/jsxRuntime.jsx(Popover, {
1619
1679
  appendTo: function appendTo() {
@@ -1663,25 +1723,48 @@ var Customize = function Customize(_ref) {
1663
1723
  });
1664
1724
  };
1665
1725
 
1666
- var QuickActionRow = function QuickActionRow(_ref) {
1667
- var Icon = _ref.icon,
1726
+ var QuickActionRow = reactUtils.withT(function (_ref) {
1727
+ var t = _ref.t,
1728
+ Icon = _ref.icon,
1668
1729
  label = _ref.label,
1669
1730
  onClick = _ref.onClick,
1670
- testId = _ref.testId;
1671
- return /*#__PURE__*/jsxRuntime.jsxs("button", {
1672
- onClick: onClick,
1673
- className: "neeto-ui-border-gray-100 hover:neeto-ui-bg-gray-100 flex w-full cursor-pointer items-center gap-3 border-t px-3 py-2 text-start transition-colors",
1674
- "data-testid": testId,
1675
- type: "button",
1676
- children: [/*#__PURE__*/jsxRuntime.jsx(Icon, {
1677
- size: 16
1678
- }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
1679
- lineHeight: "normal",
1680
- style: "body2",
1681
- children: label
1682
- })]
1731
+ testId = _ref.testId,
1732
+ _ref$disabled = _ref.disabled,
1733
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1734
+ disabledTooltip = _ref.disabledTooltip,
1735
+ _ref$isProFeature = _ref.isProFeature,
1736
+ isProFeature = _ref$isProFeature === void 0 ? false : _ref$isProFeature;
1737
+ return /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
1738
+ content: disabledTooltip,
1739
+ disabled: !disabled || !disabledTooltip,
1740
+ position: "top",
1741
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
1742
+ className: "neeto-ui-border-gray-100 border-t",
1743
+ children: /*#__PURE__*/jsxRuntime.jsxs("button", {
1744
+ disabled: disabled,
1745
+ onClick: onClick,
1746
+ "data-testid": testId,
1747
+ type: "button",
1748
+ className: classnames("flex w-full items-center gap-3 px-3 py-2 text-start transition-colors", {
1749
+ "hover:neeto-ui-bg-gray-100 cursor-pointer": !disabled,
1750
+ "cursor-not-allowed opacity-50": disabled
1751
+ }),
1752
+ children: [/*#__PURE__*/jsxRuntime.jsx(Icon, {
1753
+ size: 16
1754
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
1755
+ lineHeight: "normal",
1756
+ style: "body2",
1757
+ children: label
1758
+ }), isProFeature && /*#__PURE__*/jsxRuntime.jsx(Tag, {
1759
+ "data-testid": "".concat(testId, "-pro-badge"),
1760
+ label: t("neetoThemes.common.pro"),
1761
+ size: "small",
1762
+ style: "info"
1763
+ })]
1764
+ })
1765
+ })
1683
1766
  });
1684
- };
1767
+ });
1685
1768
 
1686
1769
  var Thumbnail = function Thumbnail(_ref) {
1687
1770
  var _theme$snakeToCamelCa, _findBy, _findBy2;
@@ -1771,7 +1854,7 @@ var Card = function Card(_ref) {
1771
1854
  onEditTheme = _ref.onEditTheme,
1772
1855
  theme = _ref.theme,
1773
1856
  isApplyingTheme = _ref.isApplyingTheme,
1774
- onCloneTheme = _ref.onCloneTheme,
1857
+ onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
1775
1858
  isHighLightedTheme = _ref.isHighLightedTheme,
1776
1859
  isGlobalTheme = _ref.isGlobalTheme,
1777
1860
  onApplyTheme = _ref.onApplyTheme,
@@ -1780,22 +1863,32 @@ var Card = function Card(_ref) {
1780
1863
  t = _useTranslation.t;
1781
1864
  var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1782
1865
  return {
1783
- themePropertiesSchema: store["themePropertiesSchema"]
1866
+ themePropertiesSchema: store["themePropertiesSchema"],
1867
+ enabledFeatures: store["enabledFeatures"],
1868
+ proFeatures: store["proFeatures"]
1784
1869
  };
1785
1870
  }, shallow.shallow),
1786
- themePropertiesSchema = _useConfigStore.themePropertiesSchema;
1871
+ themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1872
+ enabledFeatures = _useConfigStore.enabledFeatures,
1873
+ proFeatures = _useConfigStore.proFeatures;
1787
1874
  var id = theme.id,
1788
1875
  name = theme.name;
1789
1876
  var imageProperties = neetoCist.filterBy({
1790
1877
  kind: "image"
1791
1878
  }, themePropertiesSchema);
1879
+ var isCustomCSSInSchema = neetoCist.isPresent(neetoCist.findBy({
1880
+ kind: "custom_css"
1881
+ }, themePropertiesSchema));
1882
+ var isCustomCSSEnabled = Boolean(enabledFeatures.customCSS);
1883
+ var isCustomCSSProFeature = Boolean(proFeatures.customCSS);
1884
+ var showCustomCSSAction = isCustomCSSInSchema && (isCustomCSSEnabled || isCustomCSSProFeature);
1792
1885
  var handleDeleteTheme = function handleDeleteTheme() {
1793
1886
  return onDeleteTheme(id, name);
1794
1887
  };
1795
1888
  var handleQuickEdit = function handleQuickEdit(section) {
1796
1889
  return function (e) {
1797
1890
  e.stopPropagation();
1798
- if (neetoCist.isPresent(onEditTheme)) onEditTheme(theme, section);else onCloneTheme(theme, section);
1891
+ if (neetoCist.isPresent(onEditTheme)) onEditTheme(theme, section);else onCustomizeSystemTheme(theme, section);
1799
1892
  };
1800
1893
  };
1801
1894
  var showMoreDropdown = isFunction(onDeleteTheme);
@@ -1925,10 +2018,13 @@ var Card = function Card(_ref) {
1925
2018
  testId: "quick-add-".concat(neetoCist.hyphenate(key)),
1926
2019
  onClick: handleQuickEdit(camelKey)
1927
2020
  }, key);
1928
- }), /*#__PURE__*/jsxRuntime.jsx(QuickActionRow, {
2021
+ }), showCustomCSSAction && /*#__PURE__*/jsxRuntime.jsx(QuickActionRow, {
2022
+ disabled: !isCustomCSSEnabled,
1929
2023
  icon: CodeBlock,
2024
+ isProFeature: isCustomCSSProFeature,
1930
2025
  label: t("neetoThemes.build.leftSideBar.themes.customCSS"),
1931
2026
  testId: "quick-custom-css",
2027
+ disabledTooltip: t("neetoThemes.common.proFeature.customCSS.description"),
1932
2028
  onClick: handleQuickEdit("customcss")
1933
2029
  })]
1934
2030
  })]
@@ -1937,8 +2033,21 @@ var Card = function Card(_ref) {
1937
2033
  };
1938
2034
  var Card$1 = /*#__PURE__*/react.memo(Card);
1939
2035
 
2036
+ var SectionHeading = function SectionHeading(_ref) {
2037
+ var label = _ref.label,
2038
+ testId = _ref.testId;
2039
+ return /*#__PURE__*/jsxRuntime.jsx(Typography, {
2040
+ className: "neeto-ui-text-gray-600 px-6 uppercase tracking-wide lg:px-5 xl:px-6",
2041
+ "data-testid": testId,
2042
+ style: "body3",
2043
+ weight: "semibold",
2044
+ children: label
2045
+ });
2046
+ };
2047
+
1940
2048
  var Themes = function Themes(_ref) {
1941
2049
  var onEditTheme = _ref.onEditTheme,
2050
+ onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
1942
2051
  _ref$themes = _ref.themes,
1943
2052
  themes = _ref$themes === void 0 ? [] : _ref$themes,
1944
2053
  _ref$defaultThemes = _ref.defaultThemes,
@@ -1952,7 +2061,6 @@ var Themes = function Themes(_ref) {
1952
2061
  thumbnail = _ref.thumbnail,
1953
2062
  themeBeingApplied = _ref.themeBeingApplied,
1954
2063
  onApplyTheme = _ref.onApplyTheme,
1955
- onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1956
2064
  _ref$isSearchVisible = _ref.isSearchVisible,
1957
2065
  isSearchVisible = _ref$isSearchVisible === void 0 ? false : _ref$isSearchVisible;
1958
2066
  var _useTranslation = reactI18next.useTranslation(),
@@ -1969,19 +2077,13 @@ var Themes = function Themes(_ref) {
1969
2077
  previewingTheme = _useThemeStore.previewingTheme;
1970
2078
  var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1971
2079
  return {
1972
- entityType: store["entityType"],
1973
- entityId: store["entityId"]
2080
+ entityType: store["entityType"]
1974
2081
  };
1975
2082
  }, shallow.shallow),
1976
- entityType = _useConfigStore.entityType,
1977
- entityId = _useConfigStore.entityId;
2083
+ entityType = _useConfigStore.entityType;
1978
2084
  var _useQueryParams = reactUtils.useQueryParams(),
1979
2085
  _useQueryParams$searc = _useQueryParams.searchTerm,
1980
2086
  searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
1981
- var _useCloneTheme = useGlobalThemesApi.useCloneTheme(),
1982
- cloneTheme = _useCloneTheme.mutate;
1983
- var _useApplyTheme = useGlobalThemesApi.useApplyTheme({}),
1984
- applyClonedTheme = _useApplyTheme.mutate;
1985
2087
  var _useShowGlobalTheme = useGlobalThemesApi.useShowGlobalTheme(entityType),
1986
2088
  _useShowGlobalTheme$d = _useShowGlobalTheme.data,
1987
2089
  _useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
@@ -2019,26 +2121,7 @@ var Themes = function Themes(_ref) {
2019
2121
  return theme.id !== activeThemeId && matchesSearch(theme);
2020
2122
  });
2021
2123
  var showActiveThemeSection = activeTheme && matchesSearch(activeTheme);
2022
- var handleCloneTheme = function handleCloneTheme(data, section) {
2023
- cloneTheme(data.id, {
2024
- onSuccess: function onSuccess(_ref2) {
2025
- var clonedTheme = _ref2.theme;
2026
- // A system theme is cloned when the user customizes it. Apply the
2027
- // clone right away so it becomes the active theme — the editor then
2028
- // won't prompt "apply this theme?" on save.
2029
- applyClonedTheme({
2030
- themeId: clonedTheme.id,
2031
- entityId: entityId,
2032
- entityType: entityType
2033
- }, {
2034
- onSuccess: function onSuccess() {
2035
- onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(clonedTheme);
2036
- onEditTheme(clonedTheme, section);
2037
- }
2038
- });
2039
- }
2040
- });
2041
- };
2124
+ var hasNoMatchingThemes = !showActiveThemeSection && ramda.isEmpty(filteredThemes) && ramda.isEmpty(filteredDefaultThemes);
2042
2125
  if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
2043
2126
  return /*#__PURE__*/jsxRuntime.jsx("div", {
2044
2127
  className: "flex h-full w-full items-center justify-center",
@@ -2049,6 +2132,7 @@ var Themes = function Themes(_ref) {
2049
2132
  className: "neeto-ui-border-gray-200 mb-6 border-b px-6 pb-6 lg:px-5 xl:px-6",
2050
2133
  children: /*#__PURE__*/jsxRuntime.jsx(Card$1, {
2051
2134
  onApplyTheme: onApplyTheme,
2135
+ onCustomizeSystemTheme: onCustomizeSystemTheme,
2052
2136
  thumbnail: thumbnail,
2053
2137
  active: true,
2054
2138
  isApplyingTheme: (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === activeTheme.id,
@@ -2056,14 +2140,16 @@ var Themes = function Themes(_ref) {
2056
2140
  isHighLightedTheme: activeTheme.id === themeToHighlight,
2057
2141
  isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === activeTheme.id,
2058
2142
  theme: activeTheme,
2059
- onCloneTheme: handleCloneTheme,
2060
2143
  onEditTheme: isActiveThemeCustom ? onEditTheme : undefined,
2061
2144
  onSetPreviewTheme: setPreviewTheme
2062
2145
  })
2063
2146
  });
2064
- var systemThemesSection = neetoCist.isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.jsx("div", {
2147
+ var systemThemesSection = neetoCist.isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.jsxs("div", {
2065
2148
  className: "mb-6 space-y-3",
2066
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
2149
+ children: [/*#__PURE__*/jsxRuntime.jsx(SectionHeading, {
2150
+ label: t("neetoThemes.build.leftSideBar.themes.systemThemes"),
2151
+ testId: "system-themes-heading"
2152
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2067
2153
  className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
2068
2154
  "data-testid": "system-themes",
2069
2155
  children: filteredDefaultThemes.map(function (theme) {
@@ -2076,15 +2162,17 @@ var Themes = function Themes(_ref) {
2076
2162
  isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
2077
2163
  isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
2078
2164
  key: theme.id,
2079
- onCloneTheme: handleCloneTheme,
2080
2165
  onSetPreviewTheme: setPreviewTheme
2081
2166
  });
2082
2167
  })
2083
- })
2168
+ })]
2084
2169
  });
2085
- var customThemesSection = neetoCist.isNotEmpty(filteredThemes) && /*#__PURE__*/jsxRuntime.jsx("div", {
2170
+ var customThemesSection = neetoCist.isNotEmpty(filteredThemes) && /*#__PURE__*/jsxRuntime.jsxs("div", {
2086
2171
  className: "mb-6 space-y-3",
2087
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
2172
+ children: [/*#__PURE__*/jsxRuntime.jsx(SectionHeading, {
2173
+ label: t("neetoThemes.build.leftSideBar.themes.customThemes"),
2174
+ testId: "custom-themes-heading"
2175
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2088
2176
  className: "flex flex-col gap-4 px-6",
2089
2177
  "data-testid": "custom-themes",
2090
2178
  children: filteredThemes.map(function (theme) {
@@ -2101,12 +2189,11 @@ var Themes = function Themes(_ref) {
2101
2189
  isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
2102
2190
  isHighLightedTheme: theme.id === themeToHighlight,
2103
2191
  key: theme.id,
2104
- onCloneTheme: handleCloneTheme,
2105
2192
  onDeleteTheme: !isActive && onDeleteTheme,
2106
2193
  onSetPreviewTheme: setPreviewTheme
2107
2194
  });
2108
2195
  })
2109
- })
2196
+ })]
2110
2197
  });
2111
2198
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2112
2199
  className: "neeto-themes-sidebar__scroll",
@@ -2118,7 +2205,7 @@ var Themes = function Themes(_ref) {
2118
2205
  autoComplete: "off",
2119
2206
  className: "mb-4 mt-1 px-6",
2120
2207
  placeholder: t("neetoThemes.common.searchThemes")
2121
- }), ramda.isEmpty(filteredThemes) && ramda.isEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.jsx(Typography, {
2208
+ }), hasNoMatchingThemes && /*#__PURE__*/jsxRuntime.jsx(Typography, {
2122
2209
  className: "text-center",
2123
2210
  "data-testid": "no-data-title",
2124
2211
  style: "body2",
@@ -2149,6 +2236,8 @@ var TitleBar = function TitleBar(_ref) {
2149
2236
  }, shallow.shallow),
2150
2237
  entityType = _useConfigStore.entityType,
2151
2238
  helpDocUrl = _useConfigStore.helpDocUrl;
2239
+ var _useQueryParams = reactUtils.useQueryParams(),
2240
+ sourceThemeId = _useQueryParams.source;
2152
2241
  var isCustomizeScreen = isEditThemeRoute() || isNewThemeRoute();
2153
2242
  var isCustomCssScreen = isScreenCustomCSS(currentScreen);
2154
2243
  var isRTL = i18n.dir() === "rtl";
@@ -2175,7 +2264,7 @@ var TitleBar = function TitleBar(_ref) {
2175
2264
  lineHeight: "normal",
2176
2265
  style: "h3",
2177
2266
  weight: "semibold",
2178
- children: [isCustomizeScreen && !isCustomCssScreen && (isNewThemeRoute() ? t("neetoThemes.build.leftSideBar.themes.createTheme.title") : t("neetoThemes.build.leftSideBar.themes.editTheme.title")), isCustomCssScreen && t("neetoThemes.build.leftSideBar.themes.customCSS")]
2267
+ children: [isCustomizeScreen && !isCustomCssScreen && (isNewThemeRoute() && !neetoCist.isPresent(sourceThemeId) ? t("neetoThemes.build.leftSideBar.themes.createTheme.title") : t("neetoThemes.build.leftSideBar.themes.editTheme.title")), isCustomCssScreen && t("neetoThemes.build.leftSideBar.themes.customCSS")]
2179
2268
  })]
2180
2269
  })
2181
2270
  });
@@ -2348,6 +2437,17 @@ var Sidebar = function Sidebar(_ref) {
2348
2437
  search: section ? "?section=".concat(section) : ""
2349
2438
  });
2350
2439
  };
2440
+ var handleCustomizeSystemTheme = function handleCustomizeSystemTheme(theme, section) {
2441
+ themeToEdit.current = theme;
2442
+ var searchParams = new URLSearchParams({
2443
+ source: theme.id
2444
+ });
2445
+ if (section) searchParams.set("section", section);
2446
+ history.push({
2447
+ pathname: buildPathname(useGlobalThemesApi.routes.themes["new"]),
2448
+ search: "?".concat(searchParams.toString())
2449
+ });
2450
+ };
2351
2451
  var onApplyTheme = function onApplyTheme(theme) {
2352
2452
  if (themeBeingApplied !== null && themeBeingApplied !== void 0 && themeBeingApplied.id) return;
2353
2453
  setThemeBeingApplied(theme);
@@ -2442,12 +2542,12 @@ var Sidebar = function Sidebar(_ref) {
2442
2542
  isCurrentThemeLoading: isCurrentThemeLoading,
2443
2543
  isSearchVisible: isSearchVisible,
2444
2544
  onApplyTheme: onApplyTheme,
2445
- onApplyThemeSuccess: onApplyThemeSuccess,
2446
2545
  themeBeingApplied: themeBeingApplied,
2447
2546
  themeToHighlight: themeToHighlight,
2448
2547
  themes: themes,
2449
2548
  thumbnail: thumbnail,
2450
2549
  isLoading: isLoading || isFetchingSchema,
2550
+ onCustomizeSystemTheme: handleCustomizeSystemTheme,
2451
2551
  onDeleteTheme: handleDelete,
2452
2552
  onEditTheme: handleEditTheme
2453
2553
  });
@@ -2461,6 +2561,7 @@ var Sidebar = function Sidebar(_ref) {
2461
2561
  fixedAspectRatio: fixedAspectRatio,
2462
2562
  isApplyingTheme: isApplyingTheme,
2463
2563
  onApplyTheme: onApplyTheme,
2564
+ onApplyThemeSuccess: onApplyThemeSuccess,
2464
2565
  onCreateTheme: onCreateTheme,
2465
2566
  onPropertiesChange: onPropertiesChange,
2466
2567
  onUpdateTheme: onUpdateTheme,
@@ -2477,6 +2578,7 @@ var Sidebar = function Sidebar(_ref) {
2477
2578
  fixedAspectRatio: fixedAspectRatio,
2478
2579
  isApplyingTheme: isApplyingTheme,
2479
2580
  onApplyTheme: onApplyTheme,
2581
+ onApplyThemeSuccess: onApplyThemeSuccess,
2480
2582
  onCreateTheme: onCreateTheme,
2481
2583
  onPropertiesChange: onPropertiesChange,
2482
2584
  onUpdateTheme: onUpdateTheme,