@bigbinary/neeto-themes-frontend 4.2.2 → 4.2.4-beta1
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/ar.json +1 -1
- package/app/javascript/src/translations/bg.json +1 -1
- package/app/javascript/src/translations/ca.json +1 -1
- package/app/javascript/src/translations/cs.json +1 -1
- package/app/javascript/src/translations/da.json +1 -1
- package/app/javascript/src/translations/de.json +1 -1
- package/app/javascript/src/translations/en.json +2 -0
- package/app/javascript/src/translations/es-MX.json +1 -1
- package/app/javascript/src/translations/es.json +1 -1
- package/app/javascript/src/translations/et.json +1 -1
- package/app/javascript/src/translations/fi.json +1 -1
- package/app/javascript/src/translations/fil.json +1 -1
- package/app/javascript/src/translations/fr.json +1 -1
- package/app/javascript/src/translations/he.json +1 -1
- package/app/javascript/src/translations/hi.json +1 -1
- package/app/javascript/src/translations/hr.json +1 -1
- package/app/javascript/src/translations/hu.json +1 -1
- package/app/javascript/src/translations/id.json +1 -1
- package/app/javascript/src/translations/it.json +1 -1
- package/app/javascript/src/translations/ja.json +1 -1
- package/app/javascript/src/translations/ko.json +1 -1
- package/app/javascript/src/translations/lv.json +1 -1
- package/app/javascript/src/translations/nl.json +1 -1
- package/app/javascript/src/translations/pl.json +1 -1
- package/app/javascript/src/translations/pt-BR.json +1 -1
- package/app/javascript/src/translations/pt.json +1 -1
- package/app/javascript/src/translations/ro.json +1 -1
- package/app/javascript/src/translations/ru.json +1 -1
- package/app/javascript/src/translations/sk.json +1 -1
- package/app/javascript/src/translations/sl.json +1 -1
- package/app/javascript/src/translations/sv.json +1 -1
- package/app/javascript/src/translations/th.json +1 -1
- package/app/javascript/src/translations/tr.json +1 -1
- package/app/javascript/src/translations/uk.json +1 -1
- package/app/javascript/src/translations/vi.json +1 -1
- package/app/javascript/src/translations/zh-CN.json +1 -1
- package/app/javascript/src/translations/zh-TW.json +1 -1
- package/dist/.ready +1 -1
- package/dist/NeetoThemesBuilder.js +184 -86
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +183 -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 +182 -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-C-jx4UaU.js → useGlobalThemesApi-D04VWBoL.js} +39 -42
- package/dist/{useGlobalThemesApi-C-jx4UaU.js.map → useGlobalThemesApi-D04VWBoL.js.map} +1 -1
- package/dist/{useGlobalThemesApi-BUWGKtCL.js → useGlobalThemesApi-gt4U6XWZ.js} +38 -42
- package/dist/{useGlobalThemesApi-BUWGKtCL.js.map → useGlobalThemesApi-gt4U6XWZ.js.map} +1 -1
- package/dist/v2/NeetoThemesBuilder.js +184 -84
- package/dist/v2/NeetoThemesBuilder.js.map +1 -1
- package/dist/v2/index.js +1 -1
- package/package.json +13 -13
|
@@ -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
|
|
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,21 @@ 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
|
|
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 themeToCustomize = isCustomizingSystemTheme ? buildSystemThemeCopy(findBy({
|
|
1478
|
+
id: sourceThemeId
|
|
1479
|
+
}, defaultThemes)) : themeData;
|
|
1480
|
+
var isLoading = isFetchingSchema || isLoadingTheme || isCustomizingSystemTheme && isLoadingSystemThemes;
|
|
1456
1481
|
var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
|
|
1457
1482
|
var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
|
|
1458
1483
|
var _helpPopoverProps$sty = helpPopoverProps.style,
|
|
1459
1484
|
styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
|
|
1460
|
-
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1485
|
+
var isEditingCurrentlyAppliedTheme = (themeId !== null && themeId !== void 0 ? themeId : sourceThemeId) === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1461
1486
|
var submitBtnRef = useRef(null);
|
|
1462
1487
|
var _useCreateTheme = useCreateTheme(),
|
|
1463
1488
|
createTheme = _useCreateTheme.mutateAsync,
|
|
@@ -1465,13 +1490,57 @@ var Customize = function Customize(_ref) {
|
|
|
1465
1490
|
var _useUpdateTheme = useUpdateTheme(themeId),
|
|
1466
1491
|
updateTheme = _useUpdateTheme.mutateAsync,
|
|
1467
1492
|
isUpdating = _useUpdateTheme.isPending;
|
|
1468
|
-
var
|
|
1493
|
+
var _useApplyTheme = useApplyTheme({}),
|
|
1494
|
+
applyTheme = _useApplyTheme.mutateAsync,
|
|
1495
|
+
isApplyingCreatedTheme = _useApplyTheme.isPending;
|
|
1496
|
+
var isSubmitting = isCreating || isUpdating || isApplyingCreatedTheme;
|
|
1469
1497
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1470
1498
|
var handleGlobalThemeSwitchChange = function handleGlobalThemeSwitchChange(e, setFieldValue) {
|
|
1471
1499
|
setFieldValue("shouldSetAsGlobalTheme", e.target.checked);
|
|
1472
1500
|
};
|
|
1473
|
-
var
|
|
1474
|
-
var
|
|
1501
|
+
var createAndOpenTheme = /*#__PURE__*/function () {
|
|
1502
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeToSave, resetForm) {
|
|
1503
|
+
var _yield$createTheme, theme;
|
|
1504
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1505
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1506
|
+
case 0:
|
|
1507
|
+
_context.next = 2;
|
|
1508
|
+
return createTheme(themeToSave);
|
|
1509
|
+
case 2:
|
|
1510
|
+
_yield$createTheme = _context.sent;
|
|
1511
|
+
theme = _yield$createTheme.theme;
|
|
1512
|
+
resetForm({
|
|
1513
|
+
values: theme
|
|
1514
|
+
});
|
|
1515
|
+
if (!isCustomizingSystemTheme) {
|
|
1516
|
+
_context.next = 9;
|
|
1517
|
+
break;
|
|
1518
|
+
}
|
|
1519
|
+
_context.next = 8;
|
|
1520
|
+
return applyTheme({
|
|
1521
|
+
themeId: theme.id,
|
|
1522
|
+
entityId: entityId,
|
|
1523
|
+
entityType: entityType
|
|
1524
|
+
});
|
|
1525
|
+
case 8:
|
|
1526
|
+
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(theme);
|
|
1527
|
+
case 9:
|
|
1528
|
+
onCreateTheme(theme);
|
|
1529
|
+
history.replace(buildUrl(buildPathname(routes.themes.edit), {
|
|
1530
|
+
themeId: theme.id
|
|
1531
|
+
}));
|
|
1532
|
+
case 11:
|
|
1533
|
+
case "end":
|
|
1534
|
+
return _context.stop();
|
|
1535
|
+
}
|
|
1536
|
+
}, _callee);
|
|
1537
|
+
}));
|
|
1538
|
+
return function createAndOpenTheme(_x, _x2) {
|
|
1539
|
+
return _ref2.apply(this, arguments);
|
|
1540
|
+
};
|
|
1541
|
+
}();
|
|
1542
|
+
var onSubmit = function onSubmit(values, _ref3) {
|
|
1543
|
+
var resetForm = _ref3.resetForm;
|
|
1475
1544
|
var imageData = buildImageData(values, themePropertiesSchema);
|
|
1476
1545
|
var themeToSave = _objectSpread({
|
|
1477
1546
|
propertiesAttributes: values.properties,
|
|
@@ -1479,20 +1548,7 @@ var Customize = function Customize(_ref) {
|
|
|
1479
1548
|
shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
|
|
1480
1549
|
entityType: values.entityType
|
|
1481
1550
|
}, 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
|
-
}
|
|
1551
|
+
if (!themeId) return createAndOpenTheme(themeToSave, resetForm);
|
|
1496
1552
|
return updateTheme(themeToSave, {
|
|
1497
1553
|
onSuccess: function onSuccess(_ref4) {
|
|
1498
1554
|
var theme = _ref4.theme;
|
|
@@ -1518,7 +1574,7 @@ var Customize = function Customize(_ref) {
|
|
|
1518
1574
|
}
|
|
1519
1575
|
return /*#__PURE__*/jsx(Form, {
|
|
1520
1576
|
formikProps: {
|
|
1521
|
-
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(
|
|
1577
|
+
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeToCustomize, themePropertiesSchema)), {}, {
|
|
1522
1578
|
shouldSetAsGlobalTheme: isThemeGlobalTheme,
|
|
1523
1579
|
entityType: entityType
|
|
1524
1580
|
}),
|
|
@@ -1607,11 +1663,11 @@ var Customize = function Customize(_ref) {
|
|
|
1607
1663
|
type: "reset"
|
|
1608
1664
|
}), /*#__PURE__*/jsx(Button, {
|
|
1609
1665
|
"data-testid": "save-changes-button",
|
|
1610
|
-
disabled: !dirty && (themeData === null || themeData === void 0 ? void 0 : themeData.id) || isSubmitting || !isValid,
|
|
1611
1666
|
label: t("neetoThemes.buttons.save"),
|
|
1612
1667
|
loading: isSubmitting,
|
|
1613
1668
|
ref: submitBtnRef,
|
|
1614
|
-
type: "submit"
|
|
1669
|
+
type: "submit",
|
|
1670
|
+
disabled: !dirty && (themeToCustomize === null || themeToCustomize === void 0 ? void 0 : themeToCustomize.id) || isSubmitting || !isValid
|
|
1615
1671
|
})]
|
|
1616
1672
|
}), /*#__PURE__*/jsx(Popover, {
|
|
1617
1673
|
appendTo: function appendTo() {
|
|
@@ -1661,25 +1717,48 @@ var Customize = function Customize(_ref) {
|
|
|
1661
1717
|
});
|
|
1662
1718
|
};
|
|
1663
1719
|
|
|
1664
|
-
var QuickActionRow = function
|
|
1665
|
-
var
|
|
1720
|
+
var QuickActionRow = withT(function (_ref) {
|
|
1721
|
+
var t = _ref.t,
|
|
1722
|
+
Icon = _ref.icon,
|
|
1666
1723
|
label = _ref.label,
|
|
1667
1724
|
onClick = _ref.onClick,
|
|
1668
|
-
testId = _ref.testId
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1725
|
+
testId = _ref.testId,
|
|
1726
|
+
_ref$disabled = _ref.disabled,
|
|
1727
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1728
|
+
disabledTooltip = _ref.disabledTooltip,
|
|
1729
|
+
_ref$isProFeature = _ref.isProFeature,
|
|
1730
|
+
isProFeature = _ref$isProFeature === void 0 ? false : _ref$isProFeature;
|
|
1731
|
+
return /*#__PURE__*/jsx(Tooltip, {
|
|
1732
|
+
content: disabledTooltip,
|
|
1733
|
+
disabled: !disabled || !disabledTooltip,
|
|
1734
|
+
position: "top",
|
|
1735
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1736
|
+
className: "neeto-ui-border-gray-100 border-t",
|
|
1737
|
+
children: /*#__PURE__*/jsxs("button", {
|
|
1738
|
+
disabled: disabled,
|
|
1739
|
+
onClick: onClick,
|
|
1740
|
+
"data-testid": testId,
|
|
1741
|
+
type: "button",
|
|
1742
|
+
className: classnames("flex w-full items-center gap-3 px-3 py-2 text-start transition-colors", {
|
|
1743
|
+
"hover:neeto-ui-bg-gray-100 cursor-pointer": !disabled,
|
|
1744
|
+
"cursor-not-allowed opacity-50": disabled
|
|
1745
|
+
}),
|
|
1746
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
1747
|
+
size: 16
|
|
1748
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
1749
|
+
lineHeight: "normal",
|
|
1750
|
+
style: "body2",
|
|
1751
|
+
children: label
|
|
1752
|
+
}), isProFeature && /*#__PURE__*/jsx(Tag, {
|
|
1753
|
+
"data-testid": "".concat(testId, "-pro-badge"),
|
|
1754
|
+
label: t("neetoThemes.common.pro"),
|
|
1755
|
+
size: "small",
|
|
1756
|
+
style: "info"
|
|
1757
|
+
})]
|
|
1758
|
+
})
|
|
1759
|
+
})
|
|
1681
1760
|
});
|
|
1682
|
-
};
|
|
1761
|
+
});
|
|
1683
1762
|
|
|
1684
1763
|
var Thumbnail = function Thumbnail(_ref) {
|
|
1685
1764
|
var _theme$snakeToCamelCa, _findBy, _findBy2;
|
|
@@ -1769,7 +1848,7 @@ var Card$1 = function Card(_ref) {
|
|
|
1769
1848
|
onEditTheme = _ref.onEditTheme,
|
|
1770
1849
|
theme = _ref.theme,
|
|
1771
1850
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1772
|
-
|
|
1851
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1773
1852
|
isHighLightedTheme = _ref.isHighLightedTheme,
|
|
1774
1853
|
isGlobalTheme = _ref.isGlobalTheme,
|
|
1775
1854
|
onApplyTheme = _ref.onApplyTheme,
|
|
@@ -1778,22 +1857,32 @@ var Card$1 = function Card(_ref) {
|
|
|
1778
1857
|
t = _useTranslation.t;
|
|
1779
1858
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1780
1859
|
return {
|
|
1781
|
-
themePropertiesSchema: store["themePropertiesSchema"]
|
|
1860
|
+
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1861
|
+
enabledFeatures: store["enabledFeatures"],
|
|
1862
|
+
proFeatures: store["proFeatures"]
|
|
1782
1863
|
};
|
|
1783
1864
|
}, shallow),
|
|
1784
|
-
themePropertiesSchema = _useConfigStore.themePropertiesSchema
|
|
1865
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1866
|
+
enabledFeatures = _useConfigStore.enabledFeatures,
|
|
1867
|
+
proFeatures = _useConfigStore.proFeatures;
|
|
1785
1868
|
var id = theme.id,
|
|
1786
1869
|
name = theme.name;
|
|
1787
1870
|
var imageProperties = filterBy({
|
|
1788
1871
|
kind: "image"
|
|
1789
1872
|
}, themePropertiesSchema);
|
|
1873
|
+
var isCustomCSSInSchema = isPresent(findBy({
|
|
1874
|
+
kind: "custom_css"
|
|
1875
|
+
}, themePropertiesSchema));
|
|
1876
|
+
var isCustomCSSEnabled = Boolean(enabledFeatures.customCSS);
|
|
1877
|
+
var isCustomCSSProFeature = Boolean(proFeatures.customCSS);
|
|
1878
|
+
var showCustomCSSAction = isCustomCSSInSchema && (isCustomCSSEnabled || isCustomCSSProFeature);
|
|
1790
1879
|
var handleDeleteTheme = function handleDeleteTheme() {
|
|
1791
1880
|
return onDeleteTheme(id, name);
|
|
1792
1881
|
};
|
|
1793
1882
|
var handleQuickEdit = function handleQuickEdit(section) {
|
|
1794
1883
|
return function (e) {
|
|
1795
1884
|
e.stopPropagation();
|
|
1796
|
-
if (isPresent(onEditTheme)) onEditTheme(theme, section);else
|
|
1885
|
+
if (isPresent(onEditTheme)) onEditTheme(theme, section);else onCustomizeSystemTheme(theme, section);
|
|
1797
1886
|
};
|
|
1798
1887
|
};
|
|
1799
1888
|
var showMoreDropdown = isFunction(onDeleteTheme);
|
|
@@ -1923,10 +2012,13 @@ var Card$1 = function Card(_ref) {
|
|
|
1923
2012
|
testId: "quick-add-".concat(hyphenate(key)),
|
|
1924
2013
|
onClick: handleQuickEdit(camelKey)
|
|
1925
2014
|
}, key);
|
|
1926
|
-
}), /*#__PURE__*/jsx(QuickActionRow, {
|
|
2015
|
+
}), showCustomCSSAction && /*#__PURE__*/jsx(QuickActionRow, {
|
|
2016
|
+
disabled: !isCustomCSSEnabled,
|
|
1927
2017
|
icon: CodeBlock,
|
|
2018
|
+
isProFeature: isCustomCSSProFeature,
|
|
1928
2019
|
label: t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
1929
2020
|
testId: "quick-custom-css",
|
|
2021
|
+
disabledTooltip: t("neetoThemes.common.proFeature.customCSS.description"),
|
|
1930
2022
|
onClick: handleQuickEdit("customcss")
|
|
1931
2023
|
})]
|
|
1932
2024
|
})]
|
|
@@ -1935,8 +2027,21 @@ var Card$1 = function Card(_ref) {
|
|
|
1935
2027
|
};
|
|
1936
2028
|
var Card = /*#__PURE__*/memo(Card$1);
|
|
1937
2029
|
|
|
2030
|
+
var SectionHeading = function SectionHeading(_ref) {
|
|
2031
|
+
var label = _ref.label,
|
|
2032
|
+
testId = _ref.testId;
|
|
2033
|
+
return /*#__PURE__*/jsx(Typography, {
|
|
2034
|
+
className: "neeto-ui-text-gray-600 px-6 uppercase tracking-wide lg:px-5 xl:px-6",
|
|
2035
|
+
"data-testid": testId,
|
|
2036
|
+
style: "body3",
|
|
2037
|
+
weight: "semibold",
|
|
2038
|
+
children: label
|
|
2039
|
+
});
|
|
2040
|
+
};
|
|
2041
|
+
|
|
1938
2042
|
var Themes = function Themes(_ref) {
|
|
1939
2043
|
var onEditTheme = _ref.onEditTheme,
|
|
2044
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1940
2045
|
_ref$themes = _ref.themes,
|
|
1941
2046
|
themes = _ref$themes === void 0 ? [] : _ref$themes,
|
|
1942
2047
|
_ref$defaultThemes = _ref.defaultThemes,
|
|
@@ -1950,7 +2055,6 @@ var Themes = function Themes(_ref) {
|
|
|
1950
2055
|
thumbnail = _ref.thumbnail,
|
|
1951
2056
|
themeBeingApplied = _ref.themeBeingApplied,
|
|
1952
2057
|
onApplyTheme = _ref.onApplyTheme,
|
|
1953
|
-
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1954
2058
|
_ref$isSearchVisible = _ref.isSearchVisible,
|
|
1955
2059
|
isSearchVisible = _ref$isSearchVisible === void 0 ? false : _ref$isSearchVisible;
|
|
1956
2060
|
var _useTranslation = useTranslation(),
|
|
@@ -1967,19 +2071,13 @@ var Themes = function Themes(_ref) {
|
|
|
1967
2071
|
previewingTheme = _useThemeStore.previewingTheme;
|
|
1968
2072
|
var _useConfigStore = useConfigStore(function (store) {
|
|
1969
2073
|
return {
|
|
1970
|
-
entityType: store["entityType"]
|
|
1971
|
-
entityId: store["entityId"]
|
|
2074
|
+
entityType: store["entityType"]
|
|
1972
2075
|
};
|
|
1973
2076
|
}, shallow),
|
|
1974
|
-
entityType = _useConfigStore.entityType
|
|
1975
|
-
entityId = _useConfigStore.entityId;
|
|
2077
|
+
entityType = _useConfigStore.entityType;
|
|
1976
2078
|
var _useQueryParams = useQueryParams(),
|
|
1977
2079
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
1978
2080
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
1979
|
-
var _useCloneTheme = useCloneTheme(),
|
|
1980
|
-
cloneTheme = _useCloneTheme.mutate;
|
|
1981
|
-
var _useApplyTheme = useApplyTheme({}),
|
|
1982
|
-
applyClonedTheme = _useApplyTheme.mutate;
|
|
1983
2081
|
var _useShowGlobalTheme = useShowGlobalTheme(entityType),
|
|
1984
2082
|
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1985
2083
|
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
@@ -2017,26 +2115,7 @@ var Themes = function Themes(_ref) {
|
|
|
2017
2115
|
return theme.id !== activeThemeId && matchesSearch(theme);
|
|
2018
2116
|
});
|
|
2019
2117
|
var showActiveThemeSection = activeTheme && matchesSearch(activeTheme);
|
|
2020
|
-
var
|
|
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
|
-
};
|
|
2118
|
+
var hasNoMatchingThemes = !showActiveThemeSection && isEmpty(filteredThemes) && isEmpty(filteredDefaultThemes);
|
|
2040
2119
|
if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
|
|
2041
2120
|
return /*#__PURE__*/jsx("div", {
|
|
2042
2121
|
className: "flex h-full w-full items-center justify-center",
|
|
@@ -2047,6 +2126,7 @@ var Themes = function Themes(_ref) {
|
|
|
2047
2126
|
className: "neeto-ui-border-gray-200 mb-6 border-b px-6 pb-6 lg:px-5 xl:px-6",
|
|
2048
2127
|
children: /*#__PURE__*/jsx(Card, {
|
|
2049
2128
|
onApplyTheme: onApplyTheme,
|
|
2129
|
+
onCustomizeSystemTheme: onCustomizeSystemTheme,
|
|
2050
2130
|
thumbnail: thumbnail,
|
|
2051
2131
|
active: true,
|
|
2052
2132
|
isApplyingTheme: (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === activeTheme.id,
|
|
@@ -2054,14 +2134,16 @@ var Themes = function Themes(_ref) {
|
|
|
2054
2134
|
isHighLightedTheme: activeTheme.id === themeToHighlight,
|
|
2055
2135
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === activeTheme.id,
|
|
2056
2136
|
theme: activeTheme,
|
|
2057
|
-
onCloneTheme: handleCloneTheme,
|
|
2058
2137
|
onEditTheme: isActiveThemeCustom ? onEditTheme : undefined,
|
|
2059
2138
|
onSetPreviewTheme: setPreviewTheme
|
|
2060
2139
|
})
|
|
2061
2140
|
});
|
|
2062
|
-
var systemThemesSection = isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/
|
|
2141
|
+
var systemThemesSection = isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxs("div", {
|
|
2063
2142
|
className: "mb-6 space-y-3",
|
|
2064
|
-
children: /*#__PURE__*/jsx(
|
|
2143
|
+
children: [/*#__PURE__*/jsx(SectionHeading, {
|
|
2144
|
+
label: t("neetoThemes.build.leftSideBar.themes.systemThemes"),
|
|
2145
|
+
testId: "system-themes-heading"
|
|
2146
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2065
2147
|
className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
|
|
2066
2148
|
"data-testid": "system-themes",
|
|
2067
2149
|
children: filteredDefaultThemes.map(function (theme) {
|
|
@@ -2074,15 +2156,17 @@ var Themes = function Themes(_ref) {
|
|
|
2074
2156
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2075
2157
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
|
|
2076
2158
|
key: theme.id,
|
|
2077
|
-
onCloneTheme: handleCloneTheme,
|
|
2078
2159
|
onSetPreviewTheme: setPreviewTheme
|
|
2079
2160
|
});
|
|
2080
2161
|
})
|
|
2081
|
-
})
|
|
2162
|
+
})]
|
|
2082
2163
|
});
|
|
2083
|
-
var customThemesSection = isNotEmpty(filteredThemes) && /*#__PURE__*/
|
|
2164
|
+
var customThemesSection = isNotEmpty(filteredThemes) && /*#__PURE__*/jsxs("div", {
|
|
2084
2165
|
className: "mb-6 space-y-3",
|
|
2085
|
-
children: /*#__PURE__*/jsx(
|
|
2166
|
+
children: [/*#__PURE__*/jsx(SectionHeading, {
|
|
2167
|
+
label: t("neetoThemes.build.leftSideBar.themes.customThemes"),
|
|
2168
|
+
testId: "custom-themes-heading"
|
|
2169
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2086
2170
|
className: "flex flex-col gap-4 px-6",
|
|
2087
2171
|
"data-testid": "custom-themes",
|
|
2088
2172
|
children: filteredThemes.map(function (theme) {
|
|
@@ -2099,12 +2183,11 @@ var Themes = function Themes(_ref) {
|
|
|
2099
2183
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2100
2184
|
isHighLightedTheme: theme.id === themeToHighlight,
|
|
2101
2185
|
key: theme.id,
|
|
2102
|
-
onCloneTheme: handleCloneTheme,
|
|
2103
2186
|
onDeleteTheme: !isActive && onDeleteTheme,
|
|
2104
2187
|
onSetPreviewTheme: setPreviewTheme
|
|
2105
2188
|
});
|
|
2106
2189
|
})
|
|
2107
|
-
})
|
|
2190
|
+
})]
|
|
2108
2191
|
});
|
|
2109
2192
|
return /*#__PURE__*/jsxs("div", {
|
|
2110
2193
|
className: "neeto-themes-sidebar__scroll",
|
|
@@ -2116,7 +2199,7 @@ var Themes = function Themes(_ref) {
|
|
|
2116
2199
|
autoComplete: "off",
|
|
2117
2200
|
className: "mb-4 mt-1 px-6",
|
|
2118
2201
|
placeholder: t("neetoThemes.common.searchThemes")
|
|
2119
|
-
}),
|
|
2202
|
+
}), hasNoMatchingThemes && /*#__PURE__*/jsx(Typography, {
|
|
2120
2203
|
className: "text-center",
|
|
2121
2204
|
"data-testid": "no-data-title",
|
|
2122
2205
|
style: "body2",
|
|
@@ -2147,6 +2230,8 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2147
2230
|
}, shallow),
|
|
2148
2231
|
entityType = _useConfigStore.entityType,
|
|
2149
2232
|
helpDocUrl = _useConfigStore.helpDocUrl;
|
|
2233
|
+
var _useQueryParams = useQueryParams(),
|
|
2234
|
+
sourceThemeId = _useQueryParams.source;
|
|
2150
2235
|
var isCustomizeScreen = isEditThemeRoute() || isNewThemeRoute();
|
|
2151
2236
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
2152
2237
|
var isRTL = i18n.dir() === "rtl";
|
|
@@ -2173,7 +2258,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2173
2258
|
lineHeight: "normal",
|
|
2174
2259
|
style: "h3",
|
|
2175
2260
|
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")]
|
|
2261
|
+
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
2262
|
})]
|
|
2178
2263
|
})
|
|
2179
2264
|
});
|
|
@@ -2346,6 +2431,17 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2346
2431
|
search: section ? "?section=".concat(section) : ""
|
|
2347
2432
|
});
|
|
2348
2433
|
};
|
|
2434
|
+
var handleCustomizeSystemTheme = function handleCustomizeSystemTheme(theme, section) {
|
|
2435
|
+
themeToEdit.current = theme;
|
|
2436
|
+
var searchParams = new URLSearchParams({
|
|
2437
|
+
source: theme.id
|
|
2438
|
+
});
|
|
2439
|
+
if (section) searchParams.set("section", section);
|
|
2440
|
+
history.push({
|
|
2441
|
+
pathname: buildPathname(routes.themes["new"]),
|
|
2442
|
+
search: "?".concat(searchParams.toString())
|
|
2443
|
+
});
|
|
2444
|
+
};
|
|
2349
2445
|
var onApplyTheme = function onApplyTheme(theme) {
|
|
2350
2446
|
if (themeBeingApplied !== null && themeBeingApplied !== void 0 && themeBeingApplied.id) return;
|
|
2351
2447
|
setThemeBeingApplied(theme);
|
|
@@ -2440,12 +2536,12 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2440
2536
|
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
2441
2537
|
isSearchVisible: isSearchVisible,
|
|
2442
2538
|
onApplyTheme: onApplyTheme,
|
|
2443
|
-
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2444
2539
|
themeBeingApplied: themeBeingApplied,
|
|
2445
2540
|
themeToHighlight: themeToHighlight,
|
|
2446
2541
|
themes: themes,
|
|
2447
2542
|
thumbnail: thumbnail,
|
|
2448
2543
|
isLoading: isLoading || isFetchingSchema,
|
|
2544
|
+
onCustomizeSystemTheme: handleCustomizeSystemTheme,
|
|
2449
2545
|
onDeleteTheme: handleDelete,
|
|
2450
2546
|
onEditTheme: handleEditTheme
|
|
2451
2547
|
});
|
|
@@ -2459,6 +2555,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2459
2555
|
fixedAspectRatio: fixedAspectRatio,
|
|
2460
2556
|
isApplyingTheme: isApplyingTheme,
|
|
2461
2557
|
onApplyTheme: onApplyTheme,
|
|
2558
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2462
2559
|
onCreateTheme: onCreateTheme,
|
|
2463
2560
|
onPropertiesChange: onPropertiesChange,
|
|
2464
2561
|
onUpdateTheme: onUpdateTheme,
|
|
@@ -2475,6 +2572,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2475
2572
|
fixedAspectRatio: fixedAspectRatio,
|
|
2476
2573
|
isApplyingTheme: isApplyingTheme,
|
|
2477
2574
|
onApplyTheme: onApplyTheme,
|
|
2575
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2478
2576
|
onCreateTheme: onCreateTheme,
|
|
2479
2577
|
onPropertiesChange: onPropertiesChange,
|
|
2480
2578
|
onUpdateTheme: onUpdateTheme,
|