@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.
- package/app/javascript/src/translations/en.json +2 -0
- package/dist/.ready +1 -1
- package/dist/NeetoThemesBuilder.js +189 -87
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +187 -85
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/NeetoThemesBuilder.js +186 -82
- package/dist/cjs/v2/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/v2/index.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{useGlobalThemesApi-L0AWdlhf.js → useGlobalThemesApi-D04VWBoL.js} +4 -7
- package/dist/{useGlobalThemesApi-L0AWdlhf.js.map → useGlobalThemesApi-D04VWBoL.js.map} +1 -1
- package/dist/{useGlobalThemesApi-B_qW7yfd.js → useGlobalThemesApi-gt4U6XWZ.js} +3 -7
- package/dist/{useGlobalThemesApi-B_qW7yfd.js.map → useGlobalThemesApi-gt4U6XWZ.js.map} +1 -1
- package/dist/v2/NeetoThemesBuilder.js +189 -85
- package/dist/v2/NeetoThemesBuilder.js.map +1 -1
- package/dist/v2/index.js +1 -1
- package/package.json +13 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
|
-
import { Suspense, lazy, useId, useEffect, createElement, useState, memo, useRef, useCallback
|
|
3
|
-
import { Toastr, Spinner, Typography, Button, Label, ColorPicker, Select, Slider, Checkbox, Switch, Input, Tooltip, Popover, Alert } from '@bigbinary/neeto-atoms';
|
|
2
|
+
import { Suspense, lazy, useId, useEffect, createElement, useState, useMemo, memo, useRef, useCallback } from 'react';
|
|
3
|
+
import { Toastr, Spinner, Typography, Button, Label, ColorPicker, Select, Slider, Checkbox, Switch, Input, Tooltip, Popover, Badge, Alert } from '@bigbinary/neeto-atoms';
|
|
4
4
|
import { hyphenate, isPresent, findBy, findIndexBy, isNot, filterBy, snakeToCamelCase, isNotPresent, toLabelAndValue, capitalize, humanize, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { useQueryParams, useBreakpoints, PageTitle } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
6
6
|
import { useTranslation, Trans } from 'react-i18next';
|
|
7
|
-
import { n, u as useShowGlobalTheme, a as useFetchTheme, b as
|
|
7
|
+
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';
|
|
8
8
|
import { a as useExpandedSection, b as useConfigStore, c as useThemeStore, u as useThemeUtils, d as useSyncExpandedSectionFromUrl } from '../useExpandedSection-MjgB7rh6.js';
|
|
9
9
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
10
10
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
@@ -15,7 +15,7 @@ import { joinHyphenCase, buildUrl } from '@bigbinary/neeto-commons-frontend/v2/u
|
|
|
15
15
|
import { useHistory, useParams, Switch as Switch$1, Route } from 'react-router-dom';
|
|
16
16
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
17
17
|
import { RadioGroup, Input as Input$1, Form, BlockNavigation } from '@bigbinary/neeto-atoms/formik';
|
|
18
|
-
import { isEmpty, negate, isNotNil } from 'ramda';
|
|
18
|
+
import { isEmpty, omit, negate, isNotNil } from 'ramda';
|
|
19
19
|
import i18n, { t } from 'i18next';
|
|
20
20
|
import * as yup from 'yup';
|
|
21
21
|
import { useFormikContext, Field } from 'formik';
|
|
@@ -741,6 +741,15 @@ var buildProperties = function buildProperties(values, condition, themePropertie
|
|
|
741
741
|
return !imageKeys.has(dependsOn);
|
|
742
742
|
});
|
|
743
743
|
};
|
|
744
|
+
var buildSystemThemeCopy = function buildSystemThemeCopy(systemTheme) {
|
|
745
|
+
if (!systemTheme) return null;
|
|
746
|
+
return _objectSpread$2(_objectSpread$2({}, omit(["id"], systemTheme)), {}, {
|
|
747
|
+
name: t("neetoThemes.common.cloneName", {
|
|
748
|
+
name: systemTheme.name
|
|
749
|
+
}),
|
|
750
|
+
properties: systemTheme.properties.map(omit(["id", "themeId"]))
|
|
751
|
+
});
|
|
752
|
+
};
|
|
744
753
|
|
|
745
754
|
var AlignmentBlock = withT(function (_ref) {
|
|
746
755
|
var t = _ref.t,
|
|
@@ -1359,6 +1368,7 @@ var Customize = function Customize(_ref) {
|
|
|
1359
1368
|
var theme = _ref.theme,
|
|
1360
1369
|
onCreateTheme = _ref.onCreateTheme,
|
|
1361
1370
|
onApplyTheme = _ref.onApplyTheme,
|
|
1371
|
+
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1362
1372
|
onUpdateTheme = _ref.onUpdateTheme,
|
|
1363
1373
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1364
1374
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
@@ -1377,6 +1387,7 @@ var Customize = function Customize(_ref) {
|
|
|
1377
1387
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1378
1388
|
return {
|
|
1379
1389
|
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1390
|
+
entityId: store["entityId"],
|
|
1380
1391
|
entityType: store["entityType"],
|
|
1381
1392
|
isFetchingSchema: store["isFetchingSchema"],
|
|
1382
1393
|
helpPopoverProps: store["helpPopoverProps"],
|
|
@@ -1385,6 +1396,7 @@ var Customize = function Customize(_ref) {
|
|
|
1385
1396
|
};
|
|
1386
1397
|
}, shallow),
|
|
1387
1398
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1399
|
+
entityId = _useConfigStore.entityId,
|
|
1388
1400
|
entityType = _useConfigStore.entityType,
|
|
1389
1401
|
isFetchingSchema = _useConfigStore.isFetchingSchema,
|
|
1390
1402
|
helpPopoverProps = _useConfigStore.helpPopoverProps,
|
|
@@ -1392,6 +1404,9 @@ var Customize = function Customize(_ref) {
|
|
|
1392
1404
|
proFeatures = _useConfigStore.proFeatures;
|
|
1393
1405
|
var _useParams = useParams(),
|
|
1394
1406
|
themeId = _useParams.themeId;
|
|
1407
|
+
var _useQueryParams = useQueryParams(),
|
|
1408
|
+
sourceThemeId = _useQueryParams.source;
|
|
1409
|
+
var isCustomizingSystemTheme = !themeId && isPresent(sourceThemeId);
|
|
1395
1410
|
var _useThemeStore = useThemeStore(function (store) {
|
|
1396
1411
|
return {
|
|
1397
1412
|
currentTheme: store["currentTheme"],
|
|
@@ -1412,22 +1427,79 @@ var Customize = function Customize(_ref) {
|
|
|
1412
1427
|
_useFetchTheme$data = _useFetchTheme.data,
|
|
1413
1428
|
themeData = _useFetchTheme$data === void 0 ? {} : _useFetchTheme$data,
|
|
1414
1429
|
isLoadingTheme = _useFetchTheme.isLoadingTheme;
|
|
1415
|
-
var
|
|
1430
|
+
var _useListThemes = useListThemes(entityId),
|
|
1431
|
+
_useListThemes$data = _useListThemes.data,
|
|
1432
|
+
_useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
|
|
1433
|
+
_useListThemes$data2$ = _useListThemes$data2.defaultThemes,
|
|
1434
|
+
defaultThemes = _useListThemes$data2$ === void 0 ? [] : _useListThemes$data2$,
|
|
1435
|
+
isLoadingSystemThemes = _useListThemes.isLoading;
|
|
1436
|
+
var sourceTheme = isCustomizingSystemTheme ? findBy({
|
|
1437
|
+
id: sourceThemeId
|
|
1438
|
+
}, defaultThemes) : null;
|
|
1439
|
+
var systemThemeCopy = useMemo(function () {
|
|
1440
|
+
return buildSystemThemeCopy(sourceTheme);
|
|
1441
|
+
}, [sourceTheme === null || sourceTheme === void 0 ? void 0 : sourceTheme.id]);
|
|
1442
|
+
var themeToCustomize = isCustomizingSystemTheme ? systemThemeCopy : themeData;
|
|
1443
|
+
var isLoading = isFetchingSchema || isLoadingTheme || isCustomizingSystemTheme && isLoadingSystemThemes;
|
|
1416
1444
|
var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
|
|
1417
1445
|
var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
|
|
1418
1446
|
var _helpPopoverProps$sty = helpPopoverProps.style,
|
|
1419
1447
|
styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
|
|
1420
|
-
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1448
|
+
var isEditingCurrentlyAppliedTheme = (themeId !== null && themeId !== void 0 ? themeId : sourceThemeId) === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1421
1449
|
var _useCreateTheme = useCreateTheme(),
|
|
1422
1450
|
createTheme = _useCreateTheme.mutateAsync,
|
|
1423
1451
|
isCreating = _useCreateTheme.isPending;
|
|
1424
1452
|
var _useUpdateTheme = useUpdateTheme(themeId),
|
|
1425
1453
|
updateTheme = _useUpdateTheme.mutateAsync,
|
|
1426
1454
|
isUpdating = _useUpdateTheme.isPending;
|
|
1427
|
-
var
|
|
1455
|
+
var _useApplyTheme = useApplyTheme({}),
|
|
1456
|
+
applyTheme = _useApplyTheme.mutateAsync,
|
|
1457
|
+
isApplyingCreatedTheme = _useApplyTheme.isPending;
|
|
1458
|
+
var isSubmitting = isCreating || isUpdating || isApplyingCreatedTheme;
|
|
1428
1459
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1429
|
-
var
|
|
1430
|
-
var
|
|
1460
|
+
var createAndOpenTheme = /*#__PURE__*/function () {
|
|
1461
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeToSave, resetForm) {
|
|
1462
|
+
var _yield$createTheme, theme;
|
|
1463
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1464
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1465
|
+
case 0:
|
|
1466
|
+
_context.next = 2;
|
|
1467
|
+
return createTheme(themeToSave);
|
|
1468
|
+
case 2:
|
|
1469
|
+
_yield$createTheme = _context.sent;
|
|
1470
|
+
theme = _yield$createTheme.theme;
|
|
1471
|
+
resetForm({
|
|
1472
|
+
values: theme
|
|
1473
|
+
});
|
|
1474
|
+
if (!isCustomizingSystemTheme) {
|
|
1475
|
+
_context.next = 9;
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
_context.next = 8;
|
|
1479
|
+
return applyTheme({
|
|
1480
|
+
themeId: theme.id,
|
|
1481
|
+
entityId: entityId,
|
|
1482
|
+
entityType: entityType
|
|
1483
|
+
});
|
|
1484
|
+
case 8:
|
|
1485
|
+
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(theme);
|
|
1486
|
+
case 9:
|
|
1487
|
+
onCreateTheme(theme);
|
|
1488
|
+
history.replace(buildUrl(buildPathname(routes.themes.edit), {
|
|
1489
|
+
themeId: theme.id
|
|
1490
|
+
}));
|
|
1491
|
+
case 11:
|
|
1492
|
+
case "end":
|
|
1493
|
+
return _context.stop();
|
|
1494
|
+
}
|
|
1495
|
+
}, _callee);
|
|
1496
|
+
}));
|
|
1497
|
+
return function createAndOpenTheme(_x, _x2) {
|
|
1498
|
+
return _ref2.apply(this, arguments);
|
|
1499
|
+
};
|
|
1500
|
+
}();
|
|
1501
|
+
var onSubmit = function onSubmit(values, _ref3) {
|
|
1502
|
+
var resetForm = _ref3.resetForm;
|
|
1431
1503
|
var imageData = buildImageData(values, themePropertiesSchema);
|
|
1432
1504
|
var themeToSave = _objectSpread({
|
|
1433
1505
|
propertiesAttributes: values.properties,
|
|
@@ -1435,20 +1507,7 @@ var Customize = function Customize(_ref) {
|
|
|
1435
1507
|
shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
|
|
1436
1508
|
entityType: values.entityType
|
|
1437
1509
|
}, imageData);
|
|
1438
|
-
if (!themeId)
|
|
1439
|
-
return createTheme(themeToSave, {
|
|
1440
|
-
onSuccess: function onSuccess(_ref3) {
|
|
1441
|
-
var theme = _ref3.theme;
|
|
1442
|
-
resetForm({
|
|
1443
|
-
values: theme
|
|
1444
|
-
});
|
|
1445
|
-
onCreateTheme(theme);
|
|
1446
|
-
history.replace(buildUrl(buildPathname(routes.themes.edit), {
|
|
1447
|
-
themeId: theme.id
|
|
1448
|
-
}));
|
|
1449
|
-
}
|
|
1450
|
-
});
|
|
1451
|
-
}
|
|
1510
|
+
if (!themeId) return createAndOpenTheme(themeToSave, resetForm);
|
|
1452
1511
|
return updateTheme(themeToSave, {
|
|
1453
1512
|
onSuccess: function onSuccess(_ref4) {
|
|
1454
1513
|
var theme = _ref4.theme;
|
|
@@ -1474,7 +1533,7 @@ var Customize = function Customize(_ref) {
|
|
|
1474
1533
|
}
|
|
1475
1534
|
return /*#__PURE__*/jsx(Form, {
|
|
1476
1535
|
formikProps: {
|
|
1477
|
-
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(
|
|
1536
|
+
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeToCustomize, themePropertiesSchema)), {}, {
|
|
1478
1537
|
shouldSetAsGlobalTheme: isThemeGlobalTheme,
|
|
1479
1538
|
entityType: entityType
|
|
1480
1539
|
}),
|
|
@@ -1573,7 +1632,7 @@ var Customize = function Customize(_ref) {
|
|
|
1573
1632
|
label: t("neetoThemes.buttons.save"),
|
|
1574
1633
|
loading: isSubmitting,
|
|
1575
1634
|
type: "submit",
|
|
1576
|
-
disabled: !dirty && (
|
|
1635
|
+
disabled: !dirty && (themeToCustomize === null || themeToCustomize === void 0 ? void 0 : themeToCustomize.id) || isSubmitting || !isValid,
|
|
1577
1636
|
onClick: function onClick() {
|
|
1578
1637
|
if (isNotAppliedCondition) {
|
|
1579
1638
|
setIsNotAppliedPopoverOpen(true);
|
|
@@ -1620,26 +1679,49 @@ var Customize = function Customize(_ref) {
|
|
|
1620
1679
|
});
|
|
1621
1680
|
};
|
|
1622
1681
|
|
|
1623
|
-
var QuickActionRow = function
|
|
1624
|
-
var
|
|
1682
|
+
var QuickActionRow = withT(function (_ref) {
|
|
1683
|
+
var t = _ref.t,
|
|
1684
|
+
Icon = _ref.icon,
|
|
1625
1685
|
label = _ref.label,
|
|
1626
1686
|
onClick = _ref.onClick,
|
|
1627
|
-
testId = _ref.testId
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
children:
|
|
1640
|
-
|
|
1687
|
+
testId = _ref.testId,
|
|
1688
|
+
_ref$disabled = _ref.disabled,
|
|
1689
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1690
|
+
disabledTooltip = _ref.disabledTooltip,
|
|
1691
|
+
_ref$isProFeature = _ref.isProFeature,
|
|
1692
|
+
isProFeature = _ref$isProFeature === void 0 ? false : _ref$isProFeature;
|
|
1693
|
+
return /*#__PURE__*/jsx(Tooltip, {
|
|
1694
|
+
content: disabledTooltip,
|
|
1695
|
+
disabled: !disabled || !disabledTooltip,
|
|
1696
|
+
position: "top",
|
|
1697
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1698
|
+
className: "border-border border-t",
|
|
1699
|
+
children: /*#__PURE__*/jsxs("button", {
|
|
1700
|
+
disabled: disabled,
|
|
1701
|
+
onClick: onClick,
|
|
1702
|
+
"data-testid": testId,
|
|
1703
|
+
type: "button",
|
|
1704
|
+
className: classnames("flex w-full items-center gap-2 px-3 py-1.5 text-start transition-colors", {
|
|
1705
|
+
"hover:bg-muted cursor-pointer": !disabled,
|
|
1706
|
+
"cursor-not-allowed opacity-50": disabled
|
|
1707
|
+
}),
|
|
1708
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
1709
|
+
className: "text-muted-foreground",
|
|
1710
|
+
size: 16
|
|
1711
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
1712
|
+
className: "text-sm",
|
|
1713
|
+
variant: "body2",
|
|
1714
|
+
children: label
|
|
1715
|
+
}), isProFeature && /*#__PURE__*/jsx(Badge, {
|
|
1716
|
+
"data-testid": "".concat(testId, "-pro-badge"),
|
|
1717
|
+
label: t("neetoThemes.common.pro"),
|
|
1718
|
+
size: "sm",
|
|
1719
|
+
variant: "purple-subtle"
|
|
1720
|
+
})]
|
|
1721
|
+
})
|
|
1722
|
+
})
|
|
1641
1723
|
});
|
|
1642
|
-
};
|
|
1724
|
+
});
|
|
1643
1725
|
|
|
1644
1726
|
var Thumbnail = function Thumbnail(_ref) {
|
|
1645
1727
|
var _theme$snakeToCamelCa, _findBy, _findBy2;
|
|
@@ -1728,7 +1810,7 @@ var Card$1 = function Card(_ref) {
|
|
|
1728
1810
|
onEditTheme = _ref.onEditTheme,
|
|
1729
1811
|
theme = _ref.theme,
|
|
1730
1812
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1731
|
-
|
|
1813
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1732
1814
|
isHighLightedTheme = _ref.isHighLightedTheme,
|
|
1733
1815
|
isGlobalTheme = _ref.isGlobalTheme,
|
|
1734
1816
|
onApplyTheme = _ref.onApplyTheme,
|
|
@@ -1737,22 +1819,32 @@ var Card$1 = function Card(_ref) {
|
|
|
1737
1819
|
t = _useTranslation.t;
|
|
1738
1820
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1739
1821
|
return {
|
|
1740
|
-
themePropertiesSchema: store["themePropertiesSchema"]
|
|
1822
|
+
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1823
|
+
enabledFeatures: store["enabledFeatures"],
|
|
1824
|
+
proFeatures: store["proFeatures"]
|
|
1741
1825
|
};
|
|
1742
1826
|
}, shallow),
|
|
1743
|
-
themePropertiesSchema = _useConfigStore.themePropertiesSchema
|
|
1827
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1828
|
+
enabledFeatures = _useConfigStore.enabledFeatures,
|
|
1829
|
+
proFeatures = _useConfigStore.proFeatures;
|
|
1744
1830
|
var id = theme.id,
|
|
1745
1831
|
name = theme.name;
|
|
1746
1832
|
var imageProperties = filterBy({
|
|
1747
1833
|
kind: "image"
|
|
1748
1834
|
}, themePropertiesSchema);
|
|
1835
|
+
var isCustomCSSInSchema = isPresent(findBy({
|
|
1836
|
+
kind: "custom_css"
|
|
1837
|
+
}, themePropertiesSchema));
|
|
1838
|
+
var isCustomCSSEnabled = Boolean(enabledFeatures.customCSS);
|
|
1839
|
+
var isCustomCSSProFeature = Boolean(proFeatures.customCSS);
|
|
1840
|
+
var showCustomCSSAction = isCustomCSSInSchema && (isCustomCSSEnabled || isCustomCSSProFeature);
|
|
1749
1841
|
var handleDeleteTheme = function handleDeleteTheme() {
|
|
1750
1842
|
return onDeleteTheme(id, name);
|
|
1751
1843
|
};
|
|
1752
1844
|
var handleQuickEdit = function handleQuickEdit(section) {
|
|
1753
1845
|
return function (e) {
|
|
1754
1846
|
e.stopPropagation();
|
|
1755
|
-
if (isPresent(onEditTheme)) onEditTheme(theme, section);else
|
|
1847
|
+
if (isPresent(onEditTheme)) onEditTheme(theme, section);else onCustomizeSystemTheme(theme, section);
|
|
1756
1848
|
};
|
|
1757
1849
|
};
|
|
1758
1850
|
var showMoreDropdown = isFunction(onDeleteTheme);
|
|
@@ -1885,10 +1977,13 @@ var Card$1 = function Card(_ref) {
|
|
|
1885
1977
|
testId: "quick-add-".concat(hyphenate(key)),
|
|
1886
1978
|
onClick: handleQuickEdit(camelKey)
|
|
1887
1979
|
}, key);
|
|
1888
|
-
}), /*#__PURE__*/jsx(QuickActionRow, {
|
|
1980
|
+
}), showCustomCSSAction && /*#__PURE__*/jsx(QuickActionRow, {
|
|
1981
|
+
disabled: !isCustomCSSEnabled,
|
|
1889
1982
|
icon: Code,
|
|
1983
|
+
isProFeature: isCustomCSSProFeature,
|
|
1890
1984
|
label: t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
1891
1985
|
testId: "quick-custom-css",
|
|
1986
|
+
disabledTooltip: t("neetoThemes.common.proFeature.customCSS.description"),
|
|
1892
1987
|
onClick: handleQuickEdit("customcss")
|
|
1893
1988
|
})]
|
|
1894
1989
|
})]
|
|
@@ -1897,8 +1992,21 @@ var Card$1 = function Card(_ref) {
|
|
|
1897
1992
|
};
|
|
1898
1993
|
var Card = /*#__PURE__*/memo(Card$1);
|
|
1899
1994
|
|
|
1995
|
+
var SectionHeading = function SectionHeading(_ref) {
|
|
1996
|
+
var label = _ref.label,
|
|
1997
|
+
testId = _ref.testId;
|
|
1998
|
+
return /*#__PURE__*/jsx(Typography, {
|
|
1999
|
+
className: "px-6 text-xs font-semibold uppercase tracking-wide lg:px-5 xl:px-6",
|
|
2000
|
+
color: "muted",
|
|
2001
|
+
"data-testid": testId,
|
|
2002
|
+
variant: "body2",
|
|
2003
|
+
children: label
|
|
2004
|
+
});
|
|
2005
|
+
};
|
|
2006
|
+
|
|
1900
2007
|
var Themes = function Themes(_ref) {
|
|
1901
2008
|
var onEditTheme = _ref.onEditTheme,
|
|
2009
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1902
2010
|
_ref$themes = _ref.themes,
|
|
1903
2011
|
themes = _ref$themes === void 0 ? [] : _ref$themes,
|
|
1904
2012
|
_ref$defaultThemes = _ref.defaultThemes,
|
|
@@ -1912,7 +2020,6 @@ var Themes = function Themes(_ref) {
|
|
|
1912
2020
|
thumbnail = _ref.thumbnail,
|
|
1913
2021
|
themeBeingApplied = _ref.themeBeingApplied,
|
|
1914
2022
|
onApplyTheme = _ref.onApplyTheme,
|
|
1915
|
-
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1916
2023
|
_ref$isSearchVisible = _ref.isSearchVisible,
|
|
1917
2024
|
isSearchVisible = _ref$isSearchVisible === void 0 ? false : _ref$isSearchVisible;
|
|
1918
2025
|
var _useTranslation = useTranslation(),
|
|
@@ -1929,19 +2036,13 @@ var Themes = function Themes(_ref) {
|
|
|
1929
2036
|
previewingTheme = _useThemeStore.previewingTheme;
|
|
1930
2037
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1931
2038
|
return {
|
|
1932
|
-
entityType: store["entityType"]
|
|
1933
|
-
entityId: store["entityId"]
|
|
2039
|
+
entityType: store["entityType"]
|
|
1934
2040
|
};
|
|
1935
2041
|
}, shallow),
|
|
1936
|
-
entityType = _useConfigStore.entityType
|
|
1937
|
-
entityId = _useConfigStore.entityId;
|
|
2042
|
+
entityType = _useConfigStore.entityType;
|
|
1938
2043
|
var _useQueryParams = useQueryParams(),
|
|
1939
2044
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
1940
2045
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
1941
|
-
var _useCloneTheme = useCloneTheme(),
|
|
1942
|
-
cloneTheme = _useCloneTheme.mutate;
|
|
1943
|
-
var _useApplyTheme = useApplyTheme({}),
|
|
1944
|
-
applyClonedTheme = _useApplyTheme.mutate;
|
|
1945
2046
|
var _useShowGlobalTheme = useShowGlobalTheme(entityType),
|
|
1946
2047
|
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1947
2048
|
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
@@ -1979,23 +2080,7 @@ var Themes = function Themes(_ref) {
|
|
|
1979
2080
|
return theme.id !== activeThemeId && matchesSearch(theme);
|
|
1980
2081
|
});
|
|
1981
2082
|
var showActiveThemeSection = activeTheme && matchesSearch(activeTheme);
|
|
1982
|
-
var
|
|
1983
|
-
cloneTheme(data.id, {
|
|
1984
|
-
onSuccess: function onSuccess(_ref2) {
|
|
1985
|
-
var clonedTheme = _ref2.theme;
|
|
1986
|
-
applyClonedTheme({
|
|
1987
|
-
themeId: clonedTheme.id,
|
|
1988
|
-
entityId: entityId,
|
|
1989
|
-
entityType: entityType
|
|
1990
|
-
}, {
|
|
1991
|
-
onSuccess: function onSuccess() {
|
|
1992
|
-
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(clonedTheme);
|
|
1993
|
-
onEditTheme(clonedTheme, section);
|
|
1994
|
-
}
|
|
1995
|
-
});
|
|
1996
|
-
}
|
|
1997
|
-
});
|
|
1998
|
-
};
|
|
2083
|
+
var hasNoMatchingThemes = !showActiveThemeSection && isEmpty(filteredThemes) && isEmpty(filteredDefaultThemes);
|
|
1999
2084
|
if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
|
|
2000
2085
|
return /*#__PURE__*/jsx("div", {
|
|
2001
2086
|
className: "flex h-full w-full items-center justify-center",
|
|
@@ -2006,6 +2091,7 @@ var Themes = function Themes(_ref) {
|
|
|
2006
2091
|
className: "border-border mb-6 border-b px-6 pb-6 lg:px-5 xl:px-6",
|
|
2007
2092
|
children: /*#__PURE__*/jsx(Card, {
|
|
2008
2093
|
onApplyTheme: onApplyTheme,
|
|
2094
|
+
onCustomizeSystemTheme: onCustomizeSystemTheme,
|
|
2009
2095
|
thumbnail: thumbnail,
|
|
2010
2096
|
active: true,
|
|
2011
2097
|
isApplyingTheme: (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === activeTheme.id,
|
|
@@ -2013,14 +2099,16 @@ var Themes = function Themes(_ref) {
|
|
|
2013
2099
|
isHighLightedTheme: activeTheme.id === themeToHighlight,
|
|
2014
2100
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === activeTheme.id,
|
|
2015
2101
|
theme: activeTheme,
|
|
2016
|
-
onCloneTheme: handleCloneTheme,
|
|
2017
2102
|
onEditTheme: isActiveThemeCustom ? onEditTheme : undefined,
|
|
2018
2103
|
onSetPreviewTheme: setPreviewTheme
|
|
2019
2104
|
})
|
|
2020
2105
|
});
|
|
2021
|
-
var systemThemesSection = isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/
|
|
2106
|
+
var systemThemesSection = isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxs("div", {
|
|
2022
2107
|
className: "mb-6 space-y-3",
|
|
2023
|
-
children: /*#__PURE__*/jsx(
|
|
2108
|
+
children: [/*#__PURE__*/jsx(SectionHeading, {
|
|
2109
|
+
label: t("neetoThemes.build.leftSideBar.themes.systemThemes"),
|
|
2110
|
+
testId: "system-themes-heading"
|
|
2111
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2024
2112
|
className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
|
|
2025
2113
|
"data-testid": "system-themes",
|
|
2026
2114
|
children: filteredDefaultThemes.map(function (theme) {
|
|
@@ -2033,15 +2121,17 @@ var Themes = function Themes(_ref) {
|
|
|
2033
2121
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2034
2122
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
|
|
2035
2123
|
key: theme.id,
|
|
2036
|
-
onCloneTheme: handleCloneTheme,
|
|
2037
2124
|
onSetPreviewTheme: setPreviewTheme
|
|
2038
2125
|
});
|
|
2039
2126
|
})
|
|
2040
|
-
})
|
|
2127
|
+
})]
|
|
2041
2128
|
});
|
|
2042
|
-
var customThemesSection = isNotEmpty(filteredThemes) && /*#__PURE__*/
|
|
2129
|
+
var customThemesSection = isNotEmpty(filteredThemes) && /*#__PURE__*/jsxs("div", {
|
|
2043
2130
|
className: "mb-6 space-y-3",
|
|
2044
|
-
children: /*#__PURE__*/jsx(
|
|
2131
|
+
children: [/*#__PURE__*/jsx(SectionHeading, {
|
|
2132
|
+
label: t("neetoThemes.build.leftSideBar.themes.customThemes"),
|
|
2133
|
+
testId: "custom-themes-heading"
|
|
2134
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2045
2135
|
className: "flex flex-col gap-4 px-6",
|
|
2046
2136
|
"data-testid": "custom-themes",
|
|
2047
2137
|
children: filteredThemes.map(function (theme) {
|
|
@@ -2058,12 +2148,11 @@ var Themes = function Themes(_ref) {
|
|
|
2058
2148
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2059
2149
|
isHighLightedTheme: theme.id === themeToHighlight,
|
|
2060
2150
|
key: theme.id,
|
|
2061
|
-
onCloneTheme: handleCloneTheme,
|
|
2062
2151
|
onDeleteTheme: !isActive && onDeleteTheme,
|
|
2063
2152
|
onSetPreviewTheme: setPreviewTheme
|
|
2064
2153
|
});
|
|
2065
2154
|
})
|
|
2066
|
-
})
|
|
2155
|
+
})]
|
|
2067
2156
|
});
|
|
2068
2157
|
return /*#__PURE__*/jsxs("div", {
|
|
2069
2158
|
className: "neeto-themes-sidebar__scroll",
|
|
@@ -2077,7 +2166,7 @@ var Themes = function Themes(_ref) {
|
|
|
2077
2166
|
autoComplete: "off",
|
|
2078
2167
|
placeholder: t("neetoThemes.common.searchThemes")
|
|
2079
2168
|
})
|
|
2080
|
-
}),
|
|
2169
|
+
}), hasNoMatchingThemes && /*#__PURE__*/jsx(Typography, {
|
|
2081
2170
|
className: "text-center",
|
|
2082
2171
|
color: "muted",
|
|
2083
2172
|
"data-testid": "no-data-title",
|
|
@@ -2109,6 +2198,8 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2109
2198
|
}, shallow),
|
|
2110
2199
|
entityType = _useConfigStore.entityType,
|
|
2111
2200
|
helpDocUrl = _useConfigStore.helpDocUrl;
|
|
2201
|
+
var _useQueryParams = useQueryParams(),
|
|
2202
|
+
sourceThemeId = _useQueryParams.source;
|
|
2112
2203
|
var isCustomizeScreen = isEditThemeRoute() || isNewThemeRoute();
|
|
2113
2204
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
2114
2205
|
var isRTL = i18n.dir() === "rtl";
|
|
@@ -2133,7 +2224,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2133
2224
|
}), /*#__PURE__*/jsxs(Typography, {
|
|
2134
2225
|
"data-testid": "themes-header",
|
|
2135
2226
|
variant: "h5",
|
|
2136
|
-
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")]
|
|
2227
|
+
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")]
|
|
2137
2228
|
})]
|
|
2138
2229
|
})
|
|
2139
2230
|
});
|
|
@@ -2306,6 +2397,17 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2306
2397
|
search: section ? "?section=".concat(section) : ""
|
|
2307
2398
|
});
|
|
2308
2399
|
};
|
|
2400
|
+
var handleCustomizeSystemTheme = function handleCustomizeSystemTheme(theme, section) {
|
|
2401
|
+
themeToEdit.current = theme;
|
|
2402
|
+
var searchParams = new URLSearchParams({
|
|
2403
|
+
source: theme.id
|
|
2404
|
+
});
|
|
2405
|
+
if (section) searchParams.set("section", section);
|
|
2406
|
+
history.push({
|
|
2407
|
+
pathname: buildPathname(routes.themes["new"]),
|
|
2408
|
+
search: "?".concat(searchParams.toString())
|
|
2409
|
+
});
|
|
2410
|
+
};
|
|
2309
2411
|
var onApplyTheme = function onApplyTheme(theme) {
|
|
2310
2412
|
if (themeBeingApplied !== null && themeBeingApplied !== void 0 && themeBeingApplied.id) return;
|
|
2311
2413
|
setThemeBeingApplied(theme);
|
|
@@ -2400,12 +2502,12 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2400
2502
|
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
2401
2503
|
isSearchVisible: isSearchVisible,
|
|
2402
2504
|
onApplyTheme: onApplyTheme,
|
|
2403
|
-
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2404
2505
|
themeBeingApplied: themeBeingApplied,
|
|
2405
2506
|
themeToHighlight: themeToHighlight,
|
|
2406
2507
|
themes: themes,
|
|
2407
2508
|
thumbnail: thumbnail,
|
|
2408
2509
|
isLoading: isLoading || isFetchingSchema,
|
|
2510
|
+
onCustomizeSystemTheme: handleCustomizeSystemTheme,
|
|
2409
2511
|
onDeleteTheme: handleDelete,
|
|
2410
2512
|
onEditTheme: handleEditTheme
|
|
2411
2513
|
});
|
|
@@ -2419,6 +2521,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2419
2521
|
fixedAspectRatio: fixedAspectRatio,
|
|
2420
2522
|
isApplyingTheme: isApplyingTheme,
|
|
2421
2523
|
onApplyTheme: onApplyTheme,
|
|
2524
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2422
2525
|
onCreateTheme: onCreateTheme,
|
|
2423
2526
|
onPropertiesChange: onPropertiesChange,
|
|
2424
2527
|
onUpdateTheme: onUpdateTheme,
|
|
@@ -2435,6 +2538,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2435
2538
|
fixedAspectRatio: fixedAspectRatio,
|
|
2436
2539
|
isApplyingTheme: isApplyingTheme,
|
|
2437
2540
|
onApplyTheme: onApplyTheme,
|
|
2541
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2438
2542
|
onCreateTheme: onCreateTheme,
|
|
2439
2543
|
onPropertiesChange: onPropertiesChange,
|
|
2440
2544
|
onUpdateTheme: onUpdateTheme,
|