@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.
@@ -41,6 +41,8 @@
41
41
  "leftAlign": "Left align",
42
42
  "centerAlign": "Center align",
43
43
  "logo": "Logo",
44
+ "pro": "Pro",
45
+ "cloneName": "{{name, anyCase}} - clone",
44
46
  "proFeature": {
45
47
  "title": "PRO feature",
46
48
  "description": "This is a PRO feature. Please upgrade to a PRO plan to use this feature.",
package/dist/.ready CHANGED
@@ -1 +1 @@
1
- Built at 2026-11-02T07:59:06.274Z
1
+ Built at 2026-11-09T16:33:27.557Z
@@ -1,5 +1,5 @@
1
1
  import { shallow } from 'zustand/shallow';
2
- import { Suspense, lazy, useState, useEffect, createElement, useRef, memo, useCallback, useMemo } from 'react';
2
+ import { Suspense, lazy, useState, useEffect, createElement, useMemo, useRef, memo, useCallback } from 'react';
3
3
  import { isPresent, hyphenate, findBy, findIndexBy, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, capitalize, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
4
4
  import { withT, useQueryParams, useBreakpoints, PageTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
5
5
  import Spinner from '@bigbinary/neetoui/Spinner';
@@ -7,7 +7,7 @@ import { useTranslation, Trans } from 'react-i18next';
7
7
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
8
8
  import _regeneratorRuntime from '@babel/runtime/regenerator';
9
9
  import Toastr from '@bigbinary/neetoui/Toastr';
10
- import { n, u as useShowGlobalTheme, a as useFetchTheme, b as useCreateTheme, c as useUpdateTheme, d as routes, e as useCloneTheme, f as useApplyTheme, g as useListThemes, h as useShowThemeEntity, i as useDeleteTheme, r as registerNeetoThemesTranslations } from './useGlobalThemesApi-L0AWdlhf.js';
10
+ import { n, u as useShowGlobalTheme, a as useFetchTheme, b as useListThemes, c as useCreateTheme, d as useUpdateTheme, e as useApplyTheme, f as routes, g as useShowThemeEntity, h as useDeleteTheme, r as registerNeetoThemesTranslations } from './useGlobalThemesApi-D04VWBoL.js';
11
11
  import { a as useExpandedSection, b as useConfigStore, c as useThemeStore, u as useThemeUtils, P as POSITION_OPTIONS, H as HUNDRED, O as OVERLAY_OPACITY_SLIDER_MARKS, F as FONT_OPTIONS, d as useSyncExpandedSectionFromUrl, T as THEME_VALIDATION_SCHEMA, A as APPLY_SPINNER_DELAY } from './useExpandedSection-MjgB7rh6.js';
12
12
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
13
13
  import classnames from 'classnames';
@@ -24,7 +24,7 @@ import Switch from '@bigbinary/neetoui/Switch';
24
24
  import Tooltip from '@bigbinary/neetoui/Tooltip';
25
25
  import Form from '@bigbinary/neetoui/formik/Form';
26
26
  import BlockNavigation from '@bigbinary/neetoui/formik/BlockNavigation';
27
- import { isEmpty, negate, isNotNil } from 'ramda';
27
+ import { isEmpty, omit, negate, isNotNil } from 'ramda';
28
28
  import { useFormikContext, Field } from 'formik';
29
29
  import { b as setCustomCSS } from './index-CzRk-Wf1.js';
30
30
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -52,6 +52,7 @@ import AddImage from '@bigbinary/neeto-icons/AddImage';
52
52
  import CodeBlock from '@bigbinary/neeto-icons/CodeBlock';
53
53
  import ColorPicker$1 from '@bigbinary/neeto-icons/ColorPicker';
54
54
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
55
+ import Tag from '@bigbinary/neetoui/Tag';
55
56
  import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
56
57
  import RightArrow from '@bigbinary/neeto-icons/RightArrow';
57
58
  import Search$1 from '@bigbinary/neeto-icons/Search';
@@ -642,6 +643,15 @@ var buildProperties = function buildProperties(values, condition, themePropertie
642
643
  return !imageKeys.has(dependsOn);
643
644
  });
644
645
  };
646
+ var buildSystemThemeCopy = function buildSystemThemeCopy(systemTheme) {
647
+ if (!systemTheme) return null;
648
+ return _objectSpread$3(_objectSpread$3({}, omit(["id"], systemTheme)), {}, {
649
+ name: t("neetoThemes.common.cloneName", {
650
+ name: systemTheme.name
651
+ }),
652
+ properties: systemTheme.properties.map(omit(["id", "themeId"]))
653
+ });
654
+ };
645
655
 
646
656
  var AlignmentBlock = function AlignmentBlock(_ref) {
647
657
  var label = _ref.label,
@@ -1399,6 +1409,7 @@ var Customize = function Customize(_ref) {
1399
1409
  var theme = _ref.theme,
1400
1410
  onCreateTheme = _ref.onCreateTheme,
1401
1411
  onApplyTheme = _ref.onApplyTheme,
1412
+ onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1402
1413
  onUpdateTheme = _ref.onUpdateTheme,
1403
1414
  isApplyingTheme = _ref.isApplyingTheme,
1404
1415
  onPropertiesChange = _ref.onPropertiesChange,
@@ -1417,6 +1428,7 @@ var Customize = function Customize(_ref) {
1417
1428
  var _useConfigStore = useConfigStore(function (store) {
1418
1429
  return {
1419
1430
  themePropertiesSchema: store["themePropertiesSchema"],
1431
+ entityId: store["entityId"],
1420
1432
  entityType: store["entityType"],
1421
1433
  isFetchingSchema: store["isFetchingSchema"],
1422
1434
  helpPopoverProps: store["helpPopoverProps"],
@@ -1425,6 +1437,7 @@ var Customize = function Customize(_ref) {
1425
1437
  };
1426
1438
  }, shallow),
1427
1439
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1440
+ entityId = _useConfigStore.entityId,
1428
1441
  entityType = _useConfigStore.entityType,
1429
1442
  isFetchingSchema = _useConfigStore.isFetchingSchema,
1430
1443
  helpPopoverProps = _useConfigStore.helpPopoverProps,
@@ -1432,6 +1445,9 @@ var Customize = function Customize(_ref) {
1432
1445
  proFeatures = _useConfigStore.proFeatures;
1433
1446
  var _useParams = useParams(),
1434
1447
  themeId = _useParams.themeId;
1448
+ var _useQueryParams = useQueryParams(),
1449
+ sourceThemeId = _useQueryParams.source;
1450
+ var isCustomizingSystemTheme = !themeId && isPresent(sourceThemeId);
1435
1451
  var _useThemeStore = useThemeStore(function (store) {
1436
1452
  return {
1437
1453
  currentTheme: store["currentTheme"],
@@ -1452,12 +1468,25 @@ var Customize = function Customize(_ref) {
1452
1468
  _useFetchTheme$data = _useFetchTheme.data,
1453
1469
  themeData = _useFetchTheme$data === void 0 ? {} : _useFetchTheme$data,
1454
1470
  isLoadingTheme = _useFetchTheme.isLoadingTheme;
1455
- var isLoading = isFetchingSchema || isLoadingTheme;
1471
+ var _useListThemes = useListThemes(entityId),
1472
+ _useListThemes$data = _useListThemes.data,
1473
+ _useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
1474
+ _useListThemes$data2$ = _useListThemes$data2.defaultThemes,
1475
+ defaultThemes = _useListThemes$data2$ === void 0 ? [] : _useListThemes$data2$,
1476
+ isLoadingSystemThemes = _useListThemes.isLoading;
1477
+ var sourceTheme = isCustomizingSystemTheme ? findBy({
1478
+ id: sourceThemeId
1479
+ }, defaultThemes) : null;
1480
+ var systemThemeCopy = useMemo(function () {
1481
+ return buildSystemThemeCopy(sourceTheme);
1482
+ }, [sourceTheme === null || sourceTheme === void 0 ? void 0 : sourceTheme.id]);
1483
+ var themeToCustomize = isCustomizingSystemTheme ? systemThemeCopy : themeData;
1484
+ var isLoading = isFetchingSchema || isLoadingTheme || isCustomizingSystemTheme && isLoadingSystemThemes;
1456
1485
  var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
1457
1486
  var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
1458
1487
  var _helpPopoverProps$sty = helpPopoverProps.style,
1459
1488
  styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
1460
- var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1489
+ var isEditingCurrentlyAppliedTheme = (themeId !== null && themeId !== void 0 ? themeId : sourceThemeId) === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
1461
1490
  var submitBtnRef = useRef(null);
1462
1491
  var _useCreateTheme = useCreateTheme(),
1463
1492
  createTheme = _useCreateTheme.mutateAsync,
@@ -1465,13 +1494,57 @@ var Customize = function Customize(_ref) {
1465
1494
  var _useUpdateTheme = useUpdateTheme(themeId),
1466
1495
  updateTheme = _useUpdateTheme.mutateAsync,
1467
1496
  isUpdating = _useUpdateTheme.isPending;
1468
- var isSubmitting = isCreating || isUpdating;
1497
+ var _useApplyTheme = useApplyTheme({}),
1498
+ applyTheme = _useApplyTheme.mutateAsync,
1499
+ isApplyingCreatedTheme = _useApplyTheme.isPending;
1500
+ var isSubmitting = isCreating || isUpdating || isApplyingCreatedTheme;
1469
1501
  var isCustomCssScreen = isScreenCustomCSS(currentScreen);
1470
1502
  var handleGlobalThemeSwitchChange = function handleGlobalThemeSwitchChange(e, setFieldValue) {
1471
1503
  setFieldValue("shouldSetAsGlobalTheme", e.target.checked);
1472
1504
  };
1473
- var onSubmit = function onSubmit(values, _ref2) {
1474
- var resetForm = _ref2.resetForm;
1505
+ var createAndOpenTheme = /*#__PURE__*/function () {
1506
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeToSave, resetForm) {
1507
+ var _yield$createTheme, theme;
1508
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1509
+ while (1) switch (_context.prev = _context.next) {
1510
+ case 0:
1511
+ _context.next = 2;
1512
+ return createTheme(themeToSave);
1513
+ case 2:
1514
+ _yield$createTheme = _context.sent;
1515
+ theme = _yield$createTheme.theme;
1516
+ resetForm({
1517
+ values: theme
1518
+ });
1519
+ if (!isCustomizingSystemTheme) {
1520
+ _context.next = 9;
1521
+ break;
1522
+ }
1523
+ _context.next = 8;
1524
+ return applyTheme({
1525
+ themeId: theme.id,
1526
+ entityId: entityId,
1527
+ entityType: entityType
1528
+ });
1529
+ case 8:
1530
+ onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(theme);
1531
+ case 9:
1532
+ onCreateTheme(theme);
1533
+ history.replace(buildUrl(buildPathname(routes.themes.edit), {
1534
+ themeId: theme.id
1535
+ }));
1536
+ case 11:
1537
+ case "end":
1538
+ return _context.stop();
1539
+ }
1540
+ }, _callee);
1541
+ }));
1542
+ return function createAndOpenTheme(_x, _x2) {
1543
+ return _ref2.apply(this, arguments);
1544
+ };
1545
+ }();
1546
+ var onSubmit = function onSubmit(values, _ref3) {
1547
+ var resetForm = _ref3.resetForm;
1475
1548
  var imageData = buildImageData(values, themePropertiesSchema);
1476
1549
  var themeToSave = _objectSpread({
1477
1550
  propertiesAttributes: values.properties,
@@ -1479,20 +1552,7 @@ var Customize = function Customize(_ref) {
1479
1552
  shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
1480
1553
  entityType: values.entityType
1481
1554
  }, imageData);
1482
- if (!themeId) {
1483
- return createTheme(themeToSave, {
1484
- onSuccess: function onSuccess(_ref3) {
1485
- var theme = _ref3.theme;
1486
- resetForm({
1487
- values: theme
1488
- });
1489
- onCreateTheme(theme);
1490
- history.replace(buildUrl(buildPathname(routes.themes.edit), {
1491
- themeId: theme.id
1492
- }));
1493
- }
1494
- });
1495
- }
1555
+ if (!themeId) return createAndOpenTheme(themeToSave, resetForm);
1496
1556
  return updateTheme(themeToSave, {
1497
1557
  onSuccess: function onSuccess(_ref4) {
1498
1558
  var theme = _ref4.theme;
@@ -1518,7 +1578,7 @@ var Customize = function Customize(_ref) {
1518
1578
  }
1519
1579
  return /*#__PURE__*/jsx(Form, {
1520
1580
  formikProps: {
1521
- initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeData, themePropertiesSchema)), {}, {
1581
+ initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeToCustomize, themePropertiesSchema)), {}, {
1522
1582
  shouldSetAsGlobalTheme: isThemeGlobalTheme,
1523
1583
  entityType: entityType
1524
1584
  }),
@@ -1607,11 +1667,11 @@ var Customize = function Customize(_ref) {
1607
1667
  type: "reset"
1608
1668
  }), /*#__PURE__*/jsx(Button, {
1609
1669
  "data-testid": "save-changes-button",
1610
- disabled: !dirty && (themeData === null || themeData === void 0 ? void 0 : themeData.id) || isSubmitting || !isValid,
1611
1670
  label: t("neetoThemes.buttons.save"),
1612
1671
  loading: isSubmitting,
1613
1672
  ref: submitBtnRef,
1614
- type: "submit"
1673
+ type: "submit",
1674
+ disabled: !dirty && (themeToCustomize === null || themeToCustomize === void 0 ? void 0 : themeToCustomize.id) || isSubmitting || !isValid
1615
1675
  })]
1616
1676
  }), /*#__PURE__*/jsx(Popover, {
1617
1677
  appendTo: function appendTo() {
@@ -1661,25 +1721,48 @@ var Customize = function Customize(_ref) {
1661
1721
  });
1662
1722
  };
1663
1723
 
1664
- var QuickActionRow = function QuickActionRow(_ref) {
1665
- var Icon = _ref.icon,
1724
+ var QuickActionRow = withT(function (_ref) {
1725
+ var t = _ref.t,
1726
+ Icon = _ref.icon,
1666
1727
  label = _ref.label,
1667
1728
  onClick = _ref.onClick,
1668
- testId = _ref.testId;
1669
- return /*#__PURE__*/jsxs("button", {
1670
- onClick: onClick,
1671
- 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",
1672
- "data-testid": testId,
1673
- type: "button",
1674
- children: [/*#__PURE__*/jsx(Icon, {
1675
- size: 16
1676
- }), /*#__PURE__*/jsx(Typography, {
1677
- lineHeight: "normal",
1678
- style: "body2",
1679
- children: label
1680
- })]
1729
+ testId = _ref.testId,
1730
+ _ref$disabled = _ref.disabled,
1731
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1732
+ disabledTooltip = _ref.disabledTooltip,
1733
+ _ref$isProFeature = _ref.isProFeature,
1734
+ isProFeature = _ref$isProFeature === void 0 ? false : _ref$isProFeature;
1735
+ return /*#__PURE__*/jsx(Tooltip, {
1736
+ content: disabledTooltip,
1737
+ disabled: !disabled || !disabledTooltip,
1738
+ position: "top",
1739
+ children: /*#__PURE__*/jsx("div", {
1740
+ className: "neeto-ui-border-gray-100 border-t",
1741
+ children: /*#__PURE__*/jsxs("button", {
1742
+ disabled: disabled,
1743
+ onClick: onClick,
1744
+ "data-testid": testId,
1745
+ type: "button",
1746
+ className: classnames("flex w-full items-center gap-3 px-3 py-2 text-start transition-colors", {
1747
+ "hover:neeto-ui-bg-gray-100 cursor-pointer": !disabled,
1748
+ "cursor-not-allowed opacity-50": disabled
1749
+ }),
1750
+ children: [/*#__PURE__*/jsx(Icon, {
1751
+ size: 16
1752
+ }), /*#__PURE__*/jsx(Typography, {
1753
+ lineHeight: "normal",
1754
+ style: "body2",
1755
+ children: label
1756
+ }), isProFeature && /*#__PURE__*/jsx(Tag, {
1757
+ "data-testid": "".concat(testId, "-pro-badge"),
1758
+ label: t("neetoThemes.common.pro"),
1759
+ size: "small",
1760
+ style: "info"
1761
+ })]
1762
+ })
1763
+ })
1681
1764
  });
1682
- };
1765
+ });
1683
1766
 
1684
1767
  var Thumbnail = function Thumbnail(_ref) {
1685
1768
  var _theme$snakeToCamelCa, _findBy, _findBy2;
@@ -1769,7 +1852,7 @@ var Card$1 = function Card(_ref) {
1769
1852
  onEditTheme = _ref.onEditTheme,
1770
1853
  theme = _ref.theme,
1771
1854
  isApplyingTheme = _ref.isApplyingTheme,
1772
- onCloneTheme = _ref.onCloneTheme,
1855
+ onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
1773
1856
  isHighLightedTheme = _ref.isHighLightedTheme,
1774
1857
  isGlobalTheme = _ref.isGlobalTheme,
1775
1858
  onApplyTheme = _ref.onApplyTheme,
@@ -1778,22 +1861,32 @@ var Card$1 = function Card(_ref) {
1778
1861
  t = _useTranslation.t;
1779
1862
  var _useConfigStore = useConfigStore(function (store) {
1780
1863
  return {
1781
- themePropertiesSchema: store["themePropertiesSchema"]
1864
+ themePropertiesSchema: store["themePropertiesSchema"],
1865
+ enabledFeatures: store["enabledFeatures"],
1866
+ proFeatures: store["proFeatures"]
1782
1867
  };
1783
1868
  }, shallow),
1784
- themePropertiesSchema = _useConfigStore.themePropertiesSchema;
1869
+ themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1870
+ enabledFeatures = _useConfigStore.enabledFeatures,
1871
+ proFeatures = _useConfigStore.proFeatures;
1785
1872
  var id = theme.id,
1786
1873
  name = theme.name;
1787
1874
  var imageProperties = filterBy({
1788
1875
  kind: "image"
1789
1876
  }, themePropertiesSchema);
1877
+ var isCustomCSSInSchema = isPresent(findBy({
1878
+ kind: "custom_css"
1879
+ }, themePropertiesSchema));
1880
+ var isCustomCSSEnabled = Boolean(enabledFeatures.customCSS);
1881
+ var isCustomCSSProFeature = Boolean(proFeatures.customCSS);
1882
+ var showCustomCSSAction = isCustomCSSInSchema && (isCustomCSSEnabled || isCustomCSSProFeature);
1790
1883
  var handleDeleteTheme = function handleDeleteTheme() {
1791
1884
  return onDeleteTheme(id, name);
1792
1885
  };
1793
1886
  var handleQuickEdit = function handleQuickEdit(section) {
1794
1887
  return function (e) {
1795
1888
  e.stopPropagation();
1796
- if (isPresent(onEditTheme)) onEditTheme(theme, section);else onCloneTheme(theme, section);
1889
+ if (isPresent(onEditTheme)) onEditTheme(theme, section);else onCustomizeSystemTheme(theme, section);
1797
1890
  };
1798
1891
  };
1799
1892
  var showMoreDropdown = isFunction(onDeleteTheme);
@@ -1923,10 +2016,13 @@ var Card$1 = function Card(_ref) {
1923
2016
  testId: "quick-add-".concat(hyphenate(key)),
1924
2017
  onClick: handleQuickEdit(camelKey)
1925
2018
  }, key);
1926
- }), /*#__PURE__*/jsx(QuickActionRow, {
2019
+ }), showCustomCSSAction && /*#__PURE__*/jsx(QuickActionRow, {
2020
+ disabled: !isCustomCSSEnabled,
1927
2021
  icon: CodeBlock,
2022
+ isProFeature: isCustomCSSProFeature,
1928
2023
  label: t("neetoThemes.build.leftSideBar.themes.customCSS"),
1929
2024
  testId: "quick-custom-css",
2025
+ disabledTooltip: t("neetoThemes.common.proFeature.customCSS.description"),
1930
2026
  onClick: handleQuickEdit("customcss")
1931
2027
  })]
1932
2028
  })]
@@ -1935,8 +2031,21 @@ var Card$1 = function Card(_ref) {
1935
2031
  };
1936
2032
  var Card = /*#__PURE__*/memo(Card$1);
1937
2033
 
2034
+ var SectionHeading = function SectionHeading(_ref) {
2035
+ var label = _ref.label,
2036
+ testId = _ref.testId;
2037
+ return /*#__PURE__*/jsx(Typography, {
2038
+ className: "neeto-ui-text-gray-600 px-6 uppercase tracking-wide lg:px-5 xl:px-6",
2039
+ "data-testid": testId,
2040
+ style: "body3",
2041
+ weight: "semibold",
2042
+ children: label
2043
+ });
2044
+ };
2045
+
1938
2046
  var Themes = function Themes(_ref) {
1939
2047
  var onEditTheme = _ref.onEditTheme,
2048
+ onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
1940
2049
  _ref$themes = _ref.themes,
1941
2050
  themes = _ref$themes === void 0 ? [] : _ref$themes,
1942
2051
  _ref$defaultThemes = _ref.defaultThemes,
@@ -1950,7 +2059,6 @@ var Themes = function Themes(_ref) {
1950
2059
  thumbnail = _ref.thumbnail,
1951
2060
  themeBeingApplied = _ref.themeBeingApplied,
1952
2061
  onApplyTheme = _ref.onApplyTheme,
1953
- onApplyThemeSuccess = _ref.onApplyThemeSuccess,
1954
2062
  _ref$isSearchVisible = _ref.isSearchVisible,
1955
2063
  isSearchVisible = _ref$isSearchVisible === void 0 ? false : _ref$isSearchVisible;
1956
2064
  var _useTranslation = useTranslation(),
@@ -1967,19 +2075,13 @@ var Themes = function Themes(_ref) {
1967
2075
  previewingTheme = _useThemeStore.previewingTheme;
1968
2076
  var _useConfigStore = useConfigStore(function (store) {
1969
2077
  return {
1970
- entityType: store["entityType"],
1971
- entityId: store["entityId"]
2078
+ entityType: store["entityType"]
1972
2079
  };
1973
2080
  }, shallow),
1974
- entityType = _useConfigStore.entityType,
1975
- entityId = _useConfigStore.entityId;
2081
+ entityType = _useConfigStore.entityType;
1976
2082
  var _useQueryParams = useQueryParams(),
1977
2083
  _useQueryParams$searc = _useQueryParams.searchTerm,
1978
2084
  searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
1979
- var _useCloneTheme = useCloneTheme(),
1980
- cloneTheme = _useCloneTheme.mutate;
1981
- var _useApplyTheme = useApplyTheme({}),
1982
- applyClonedTheme = _useApplyTheme.mutate;
1983
2085
  var _useShowGlobalTheme = useShowGlobalTheme(entityType),
1984
2086
  _useShowGlobalTheme$d = _useShowGlobalTheme.data,
1985
2087
  _useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
@@ -2017,26 +2119,7 @@ var Themes = function Themes(_ref) {
2017
2119
  return theme.id !== activeThemeId && matchesSearch(theme);
2018
2120
  });
2019
2121
  var showActiveThemeSection = activeTheme && matchesSearch(activeTheme);
2020
- var handleCloneTheme = function handleCloneTheme(data, section) {
2021
- cloneTheme(data.id, {
2022
- onSuccess: function onSuccess(_ref2) {
2023
- var clonedTheme = _ref2.theme;
2024
- // A system theme is cloned when the user customizes it. Apply the
2025
- // clone right away so it becomes the active theme — the editor then
2026
- // won't prompt "apply this theme?" on save.
2027
- applyClonedTheme({
2028
- themeId: clonedTheme.id,
2029
- entityId: entityId,
2030
- entityType: entityType
2031
- }, {
2032
- onSuccess: function onSuccess() {
2033
- onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(clonedTheme);
2034
- onEditTheme(clonedTheme, section);
2035
- }
2036
- });
2037
- }
2038
- });
2039
- };
2122
+ var hasNoMatchingThemes = !showActiveThemeSection && isEmpty(filteredThemes) && isEmpty(filteredDefaultThemes);
2040
2123
  if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
2041
2124
  return /*#__PURE__*/jsx("div", {
2042
2125
  className: "flex h-full w-full items-center justify-center",
@@ -2047,6 +2130,7 @@ var Themes = function Themes(_ref) {
2047
2130
  className: "neeto-ui-border-gray-200 mb-6 border-b px-6 pb-6 lg:px-5 xl:px-6",
2048
2131
  children: /*#__PURE__*/jsx(Card, {
2049
2132
  onApplyTheme: onApplyTheme,
2133
+ onCustomizeSystemTheme: onCustomizeSystemTheme,
2050
2134
  thumbnail: thumbnail,
2051
2135
  active: true,
2052
2136
  isApplyingTheme: (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === activeTheme.id,
@@ -2054,14 +2138,16 @@ var Themes = function Themes(_ref) {
2054
2138
  isHighLightedTheme: activeTheme.id === themeToHighlight,
2055
2139
  isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === activeTheme.id,
2056
2140
  theme: activeTheme,
2057
- onCloneTheme: handleCloneTheme,
2058
2141
  onEditTheme: isActiveThemeCustom ? onEditTheme : undefined,
2059
2142
  onSetPreviewTheme: setPreviewTheme
2060
2143
  })
2061
2144
  });
2062
- var systemThemesSection = isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsx("div", {
2145
+ var systemThemesSection = isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxs("div", {
2063
2146
  className: "mb-6 space-y-3",
2064
- children: /*#__PURE__*/jsx("div", {
2147
+ children: [/*#__PURE__*/jsx(SectionHeading, {
2148
+ label: t("neetoThemes.build.leftSideBar.themes.systemThemes"),
2149
+ testId: "system-themes-heading"
2150
+ }), /*#__PURE__*/jsx("div", {
2065
2151
  className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
2066
2152
  "data-testid": "system-themes",
2067
2153
  children: filteredDefaultThemes.map(function (theme) {
@@ -2074,15 +2160,17 @@ var Themes = function Themes(_ref) {
2074
2160
  isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
2075
2161
  isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
2076
2162
  key: theme.id,
2077
- onCloneTheme: handleCloneTheme,
2078
2163
  onSetPreviewTheme: setPreviewTheme
2079
2164
  });
2080
2165
  })
2081
- })
2166
+ })]
2082
2167
  });
2083
- var customThemesSection = isNotEmpty(filteredThemes) && /*#__PURE__*/jsx("div", {
2168
+ var customThemesSection = isNotEmpty(filteredThemes) && /*#__PURE__*/jsxs("div", {
2084
2169
  className: "mb-6 space-y-3",
2085
- children: /*#__PURE__*/jsx("div", {
2170
+ children: [/*#__PURE__*/jsx(SectionHeading, {
2171
+ label: t("neetoThemes.build.leftSideBar.themes.customThemes"),
2172
+ testId: "custom-themes-heading"
2173
+ }), /*#__PURE__*/jsx("div", {
2086
2174
  className: "flex flex-col gap-4 px-6",
2087
2175
  "data-testid": "custom-themes",
2088
2176
  children: filteredThemes.map(function (theme) {
@@ -2099,12 +2187,11 @@ var Themes = function Themes(_ref) {
2099
2187
  isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
2100
2188
  isHighLightedTheme: theme.id === themeToHighlight,
2101
2189
  key: theme.id,
2102
- onCloneTheme: handleCloneTheme,
2103
2190
  onDeleteTheme: !isActive && onDeleteTheme,
2104
2191
  onSetPreviewTheme: setPreviewTheme
2105
2192
  });
2106
2193
  })
2107
- })
2194
+ })]
2108
2195
  });
2109
2196
  return /*#__PURE__*/jsxs("div", {
2110
2197
  className: "neeto-themes-sidebar__scroll",
@@ -2116,7 +2203,7 @@ var Themes = function Themes(_ref) {
2116
2203
  autoComplete: "off",
2117
2204
  className: "mb-4 mt-1 px-6",
2118
2205
  placeholder: t("neetoThemes.common.searchThemes")
2119
- }), isEmpty(filteredThemes) && isEmpty(filteredDefaultThemes) && /*#__PURE__*/jsx(Typography, {
2206
+ }), hasNoMatchingThemes && /*#__PURE__*/jsx(Typography, {
2120
2207
  className: "text-center",
2121
2208
  "data-testid": "no-data-title",
2122
2209
  style: "body2",
@@ -2147,6 +2234,8 @@ var TitleBar = function TitleBar(_ref) {
2147
2234
  }, shallow),
2148
2235
  entityType = _useConfigStore.entityType,
2149
2236
  helpDocUrl = _useConfigStore.helpDocUrl;
2237
+ var _useQueryParams = useQueryParams(),
2238
+ sourceThemeId = _useQueryParams.source;
2150
2239
  var isCustomizeScreen = isEditThemeRoute() || isNewThemeRoute();
2151
2240
  var isCustomCssScreen = isScreenCustomCSS(currentScreen);
2152
2241
  var isRTL = i18n.dir() === "rtl";
@@ -2173,7 +2262,7 @@ var TitleBar = function TitleBar(_ref) {
2173
2262
  lineHeight: "normal",
2174
2263
  style: "h3",
2175
2264
  weight: "semibold",
2176
- 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")]
2265
+ children: [isCustomizeScreen && !isCustomCssScreen && (isNewThemeRoute() && !isPresent(sourceThemeId) ? t("neetoThemes.build.leftSideBar.themes.createTheme.title") : t("neetoThemes.build.leftSideBar.themes.editTheme.title")), isCustomCssScreen && t("neetoThemes.build.leftSideBar.themes.customCSS")]
2177
2266
  })]
2178
2267
  })
2179
2268
  });
@@ -2346,6 +2435,17 @@ var Sidebar = function Sidebar(_ref) {
2346
2435
  search: section ? "?section=".concat(section) : ""
2347
2436
  });
2348
2437
  };
2438
+ var handleCustomizeSystemTheme = function handleCustomizeSystemTheme(theme, section) {
2439
+ themeToEdit.current = theme;
2440
+ var searchParams = new URLSearchParams({
2441
+ source: theme.id
2442
+ });
2443
+ if (section) searchParams.set("section", section);
2444
+ history.push({
2445
+ pathname: buildPathname(routes.themes["new"]),
2446
+ search: "?".concat(searchParams.toString())
2447
+ });
2448
+ };
2349
2449
  var onApplyTheme = function onApplyTheme(theme) {
2350
2450
  if (themeBeingApplied !== null && themeBeingApplied !== void 0 && themeBeingApplied.id) return;
2351
2451
  setThemeBeingApplied(theme);
@@ -2440,12 +2540,12 @@ var Sidebar = function Sidebar(_ref) {
2440
2540
  isCurrentThemeLoading: isCurrentThemeLoading,
2441
2541
  isSearchVisible: isSearchVisible,
2442
2542
  onApplyTheme: onApplyTheme,
2443
- onApplyThemeSuccess: onApplyThemeSuccess,
2444
2543
  themeBeingApplied: themeBeingApplied,
2445
2544
  themeToHighlight: themeToHighlight,
2446
2545
  themes: themes,
2447
2546
  thumbnail: thumbnail,
2448
2547
  isLoading: isLoading || isFetchingSchema,
2548
+ onCustomizeSystemTheme: handleCustomizeSystemTheme,
2449
2549
  onDeleteTheme: handleDelete,
2450
2550
  onEditTheme: handleEditTheme
2451
2551
  });
@@ -2459,6 +2559,7 @@ var Sidebar = function Sidebar(_ref) {
2459
2559
  fixedAspectRatio: fixedAspectRatio,
2460
2560
  isApplyingTheme: isApplyingTheme,
2461
2561
  onApplyTheme: onApplyTheme,
2562
+ onApplyThemeSuccess: onApplyThemeSuccess,
2462
2563
  onCreateTheme: onCreateTheme,
2463
2564
  onPropertiesChange: onPropertiesChange,
2464
2565
  onUpdateTheme: onUpdateTheme,
@@ -2475,6 +2576,7 @@ var Sidebar = function Sidebar(_ref) {
2475
2576
  fixedAspectRatio: fixedAspectRatio,
2476
2577
  isApplyingTheme: isApplyingTheme,
2477
2578
  onApplyTheme: onApplyTheme,
2579
+ onApplyThemeSuccess: onApplyThemeSuccess,
2478
2580
  onCreateTheme: onCreateTheme,
2479
2581
  onPropertiesChange: onPropertiesChange,
2480
2582
  onUpdateTheme: onUpdateTheme,