@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
package/dist/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var NeetoThemesBuilder = require('./NeetoThemesBuilder.js');
|
|
4
4
|
var useExpandedSection = require('../useExpandedSection-BTBI4UqP.js');
|
|
5
|
-
var useGlobalThemesApi = require('../useGlobalThemesApi-
|
|
5
|
+
var useGlobalThemesApi = require('../useGlobalThemesApi-gt4U6XWZ.js');
|
|
6
6
|
var utils = require('../index-CZdpMMBb.js');
|
|
7
7
|
require('zustand/shallow');
|
|
8
8
|
require('react');
|
|
@@ -55,6 +55,7 @@ require('@bigbinary/neeto-icons/AddImage');
|
|
|
55
55
|
require('@bigbinary/neeto-icons/CodeBlock');
|
|
56
56
|
require('@bigbinary/neeto-icons/ColorPicker');
|
|
57
57
|
require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
58
|
+
require('@bigbinary/neetoui/Tag');
|
|
58
59
|
require('@bigbinary/neeto-icons/LeftArrow');
|
|
59
60
|
require('@bigbinary/neeto-icons/RightArrow');
|
|
60
61
|
require('@bigbinary/neeto-icons/Search');
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
|
6
6
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
7
7
|
var reactUtils$1 = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
|
-
var useGlobalThemesApi = require('../../useGlobalThemesApi-
|
|
9
|
+
var useGlobalThemesApi = require('../../useGlobalThemesApi-gt4U6XWZ.js');
|
|
10
10
|
var useExpandedSection = require('../../useExpandedSection-BTBI4UqP.js');
|
|
11
11
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
12
12
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
@@ -762,6 +762,15 @@ var buildProperties = function buildProperties(values, condition, themePropertie
|
|
|
762
762
|
return !imageKeys.has(dependsOn);
|
|
763
763
|
});
|
|
764
764
|
};
|
|
765
|
+
var buildSystemThemeCopy = function buildSystemThemeCopy(systemTheme) {
|
|
766
|
+
if (!systemTheme) return null;
|
|
767
|
+
return _objectSpread$2(_objectSpread$2({}, ramda.omit(["id"], systemTheme)), {}, {
|
|
768
|
+
name: i18n.t("neetoThemes.common.cloneName", {
|
|
769
|
+
name: systemTheme.name
|
|
770
|
+
}),
|
|
771
|
+
properties: systemTheme.properties.map(ramda.omit(["id", "themeId"]))
|
|
772
|
+
});
|
|
773
|
+
};
|
|
765
774
|
|
|
766
775
|
var AlignmentBlock = reactUtils.withT(function (_ref) {
|
|
767
776
|
var t = _ref.t,
|
|
@@ -1380,6 +1389,7 @@ var Customize = function Customize(_ref) {
|
|
|
1380
1389
|
var theme = _ref.theme,
|
|
1381
1390
|
onCreateTheme = _ref.onCreateTheme,
|
|
1382
1391
|
onApplyTheme = _ref.onApplyTheme,
|
|
1392
|
+
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1383
1393
|
onUpdateTheme = _ref.onUpdateTheme,
|
|
1384
1394
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1385
1395
|
onPropertiesChange = _ref.onPropertiesChange,
|
|
@@ -1398,6 +1408,7 @@ var Customize = function Customize(_ref) {
|
|
|
1398
1408
|
var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
|
|
1399
1409
|
return {
|
|
1400
1410
|
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1411
|
+
entityId: store["entityId"],
|
|
1401
1412
|
entityType: store["entityType"],
|
|
1402
1413
|
isFetchingSchema: store["isFetchingSchema"],
|
|
1403
1414
|
helpPopoverProps: store["helpPopoverProps"],
|
|
@@ -1406,6 +1417,7 @@ var Customize = function Customize(_ref) {
|
|
|
1406
1417
|
};
|
|
1407
1418
|
}, shallow.shallow),
|
|
1408
1419
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1420
|
+
entityId = _useConfigStore.entityId,
|
|
1409
1421
|
entityType = _useConfigStore.entityType,
|
|
1410
1422
|
isFetchingSchema = _useConfigStore.isFetchingSchema,
|
|
1411
1423
|
helpPopoverProps = _useConfigStore.helpPopoverProps,
|
|
@@ -1413,6 +1425,9 @@ var Customize = function Customize(_ref) {
|
|
|
1413
1425
|
proFeatures = _useConfigStore.proFeatures;
|
|
1414
1426
|
var _useParams = reactRouterDom.useParams(),
|
|
1415
1427
|
themeId = _useParams.themeId;
|
|
1428
|
+
var _useQueryParams = reactUtils$1.useQueryParams(),
|
|
1429
|
+
sourceThemeId = _useQueryParams.source;
|
|
1430
|
+
var isCustomizingSystemTheme = !themeId && neetoCist.isPresent(sourceThemeId);
|
|
1416
1431
|
var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
|
|
1417
1432
|
return {
|
|
1418
1433
|
currentTheme: store["currentTheme"],
|
|
@@ -1433,22 +1448,75 @@ var Customize = function Customize(_ref) {
|
|
|
1433
1448
|
_useFetchTheme$data = _useFetchTheme.data,
|
|
1434
1449
|
themeData = _useFetchTheme$data === void 0 ? {} : _useFetchTheme$data,
|
|
1435
1450
|
isLoadingTheme = _useFetchTheme.isLoadingTheme;
|
|
1436
|
-
var
|
|
1451
|
+
var _useListThemes = useGlobalThemesApi.useListThemes(entityId),
|
|
1452
|
+
_useListThemes$data = _useListThemes.data,
|
|
1453
|
+
_useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
|
|
1454
|
+
_useListThemes$data2$ = _useListThemes$data2.defaultThemes,
|
|
1455
|
+
defaultThemes = _useListThemes$data2$ === void 0 ? [] : _useListThemes$data2$,
|
|
1456
|
+
isLoadingSystemThemes = _useListThemes.isLoading;
|
|
1457
|
+
var themeToCustomize = isCustomizingSystemTheme ? buildSystemThemeCopy(neetoCist.findBy({
|
|
1458
|
+
id: sourceThemeId
|
|
1459
|
+
}, defaultThemes)) : themeData;
|
|
1460
|
+
var isLoading = isFetchingSchema || isLoadingTheme || isCustomizingSystemTheme && isLoadingSystemThemes;
|
|
1437
1461
|
var isThemeGlobalTheme = themeId && (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === themeId;
|
|
1438
1462
|
var isCurrentThemeAndGlobalThemeSame = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id);
|
|
1439
1463
|
var _helpPopoverProps$sty = helpPopoverProps.style,
|
|
1440
1464
|
styleHelpPopoverProps = _helpPopoverProps$sty === void 0 ? {} : _helpPopoverProps$sty;
|
|
1441
|
-
var isEditingCurrentlyAppliedTheme = themeId === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1465
|
+
var isEditingCurrentlyAppliedTheme = (themeId !== null && themeId !== void 0 ? themeId : sourceThemeId) === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id);
|
|
1442
1466
|
var _useCreateTheme = useGlobalThemesApi.useCreateTheme(),
|
|
1443
1467
|
createTheme = _useCreateTheme.mutateAsync,
|
|
1444
1468
|
isCreating = _useCreateTheme.isPending;
|
|
1445
1469
|
var _useUpdateTheme = useGlobalThemesApi.useUpdateTheme(themeId),
|
|
1446
1470
|
updateTheme = _useUpdateTheme.mutateAsync,
|
|
1447
1471
|
isUpdating = _useUpdateTheme.isPending;
|
|
1448
|
-
var
|
|
1472
|
+
var _useApplyTheme = useGlobalThemesApi.useApplyTheme({}),
|
|
1473
|
+
applyTheme = _useApplyTheme.mutateAsync,
|
|
1474
|
+
isApplyingCreatedTheme = _useApplyTheme.isPending;
|
|
1475
|
+
var isSubmitting = isCreating || isUpdating || isApplyingCreatedTheme;
|
|
1449
1476
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
1450
|
-
var
|
|
1451
|
-
var
|
|
1477
|
+
var createAndOpenTheme = /*#__PURE__*/function () {
|
|
1478
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeToSave, resetForm) {
|
|
1479
|
+
var _yield$createTheme, theme;
|
|
1480
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1481
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1482
|
+
case 0:
|
|
1483
|
+
_context.next = 2;
|
|
1484
|
+
return createTheme(themeToSave);
|
|
1485
|
+
case 2:
|
|
1486
|
+
_yield$createTheme = _context.sent;
|
|
1487
|
+
theme = _yield$createTheme.theme;
|
|
1488
|
+
resetForm({
|
|
1489
|
+
values: theme
|
|
1490
|
+
});
|
|
1491
|
+
if (!isCustomizingSystemTheme) {
|
|
1492
|
+
_context.next = 9;
|
|
1493
|
+
break;
|
|
1494
|
+
}
|
|
1495
|
+
_context.next = 8;
|
|
1496
|
+
return applyTheme({
|
|
1497
|
+
themeId: theme.id,
|
|
1498
|
+
entityId: entityId,
|
|
1499
|
+
entityType: entityType
|
|
1500
|
+
});
|
|
1501
|
+
case 8:
|
|
1502
|
+
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(theme);
|
|
1503
|
+
case 9:
|
|
1504
|
+
onCreateTheme(theme);
|
|
1505
|
+
history.replace(utils$1.buildUrl(buildPathname(useGlobalThemesApi.routes.themes.edit), {
|
|
1506
|
+
themeId: theme.id
|
|
1507
|
+
}));
|
|
1508
|
+
case 11:
|
|
1509
|
+
case "end":
|
|
1510
|
+
return _context.stop();
|
|
1511
|
+
}
|
|
1512
|
+
}, _callee);
|
|
1513
|
+
}));
|
|
1514
|
+
return function createAndOpenTheme(_x, _x2) {
|
|
1515
|
+
return _ref2.apply(this, arguments);
|
|
1516
|
+
};
|
|
1517
|
+
}();
|
|
1518
|
+
var onSubmit = function onSubmit(values, _ref3) {
|
|
1519
|
+
var resetForm = _ref3.resetForm;
|
|
1452
1520
|
var imageData = buildImageData(values, themePropertiesSchema);
|
|
1453
1521
|
var themeToSave = _objectSpread({
|
|
1454
1522
|
propertiesAttributes: values.properties,
|
|
@@ -1456,20 +1524,7 @@ var Customize = function Customize(_ref) {
|
|
|
1456
1524
|
shouldSetAsGlobalTheme: values.shouldSetAsGlobalTheme,
|
|
1457
1525
|
entityType: values.entityType
|
|
1458
1526
|
}, imageData);
|
|
1459
|
-
if (!themeId)
|
|
1460
|
-
return createTheme(themeToSave, {
|
|
1461
|
-
onSuccess: function onSuccess(_ref3) {
|
|
1462
|
-
var theme = _ref3.theme;
|
|
1463
|
-
resetForm({
|
|
1464
|
-
values: theme
|
|
1465
|
-
});
|
|
1466
|
-
onCreateTheme(theme);
|
|
1467
|
-
history.replace(utils$1.buildUrl(buildPathname(useGlobalThemesApi.routes.themes.edit), {
|
|
1468
|
-
themeId: theme.id
|
|
1469
|
-
}));
|
|
1470
|
-
}
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1527
|
+
if (!themeId) return createAndOpenTheme(themeToSave, resetForm);
|
|
1473
1528
|
return updateTheme(themeToSave, {
|
|
1474
1529
|
onSuccess: function onSuccess(_ref4) {
|
|
1475
1530
|
var theme = _ref4.theme;
|
|
@@ -1495,7 +1550,7 @@ var Customize = function Customize(_ref) {
|
|
|
1495
1550
|
}
|
|
1496
1551
|
return /*#__PURE__*/jsxRuntime.jsx(formik$1.Form, {
|
|
1497
1552
|
formikProps: {
|
|
1498
|
-
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(
|
|
1553
|
+
initialValues: _objectSpread(_objectSpread({}, buildInitialValues(themeToCustomize, themePropertiesSchema)), {}, {
|
|
1499
1554
|
shouldSetAsGlobalTheme: isThemeGlobalTheme,
|
|
1500
1555
|
entityType: entityType
|
|
1501
1556
|
}),
|
|
@@ -1594,7 +1649,7 @@ var Customize = function Customize(_ref) {
|
|
|
1594
1649
|
label: t("neetoThemes.buttons.save"),
|
|
1595
1650
|
loading: isSubmitting,
|
|
1596
1651
|
type: "submit",
|
|
1597
|
-
disabled: !dirty && (
|
|
1652
|
+
disabled: !dirty && (themeToCustomize === null || themeToCustomize === void 0 ? void 0 : themeToCustomize.id) || isSubmitting || !isValid,
|
|
1598
1653
|
onClick: function onClick() {
|
|
1599
1654
|
if (isNotAppliedCondition) {
|
|
1600
1655
|
setIsNotAppliedPopoverOpen(true);
|
|
@@ -1641,26 +1696,49 @@ var Customize = function Customize(_ref) {
|
|
|
1641
1696
|
});
|
|
1642
1697
|
};
|
|
1643
1698
|
|
|
1644
|
-
var QuickActionRow = function
|
|
1645
|
-
var
|
|
1699
|
+
var QuickActionRow = reactUtils.withT(function (_ref) {
|
|
1700
|
+
var t = _ref.t,
|
|
1701
|
+
Icon = _ref.icon,
|
|
1646
1702
|
label = _ref.label,
|
|
1647
1703
|
onClick = _ref.onClick,
|
|
1648
|
-
testId = _ref.testId
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
children:
|
|
1661
|
-
|
|
1704
|
+
testId = _ref.testId,
|
|
1705
|
+
_ref$disabled = _ref.disabled,
|
|
1706
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1707
|
+
disabledTooltip = _ref.disabledTooltip,
|
|
1708
|
+
_ref$isProFeature = _ref.isProFeature,
|
|
1709
|
+
isProFeature = _ref$isProFeature === void 0 ? false : _ref$isProFeature;
|
|
1710
|
+
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
|
|
1711
|
+
content: disabledTooltip,
|
|
1712
|
+
disabled: !disabled || !disabledTooltip,
|
|
1713
|
+
position: "top",
|
|
1714
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1715
|
+
className: "border-border border-t",
|
|
1716
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
1717
|
+
disabled: disabled,
|
|
1718
|
+
onClick: onClick,
|
|
1719
|
+
"data-testid": testId,
|
|
1720
|
+
type: "button",
|
|
1721
|
+
className: classnames("flex w-full items-center gap-2 px-3 py-1.5 text-start transition-colors", {
|
|
1722
|
+
"hover:bg-muted cursor-pointer": !disabled,
|
|
1723
|
+
"cursor-not-allowed opacity-50": disabled
|
|
1724
|
+
}),
|
|
1725
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1726
|
+
className: "text-muted-foreground",
|
|
1727
|
+
size: 16
|
|
1728
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
1729
|
+
className: "text-sm",
|
|
1730
|
+
variant: "body2",
|
|
1731
|
+
children: label
|
|
1732
|
+
}), isProFeature && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
1733
|
+
"data-testid": "".concat(testId, "-pro-badge"),
|
|
1734
|
+
label: t("neetoThemes.common.pro"),
|
|
1735
|
+
size: "sm",
|
|
1736
|
+
variant: "purple-subtle"
|
|
1737
|
+
})]
|
|
1738
|
+
})
|
|
1739
|
+
})
|
|
1662
1740
|
});
|
|
1663
|
-
};
|
|
1741
|
+
});
|
|
1664
1742
|
|
|
1665
1743
|
var Thumbnail = function Thumbnail(_ref) {
|
|
1666
1744
|
var _theme$snakeToCamelCa, _findBy, _findBy2;
|
|
@@ -1749,7 +1827,7 @@ var Card = function Card(_ref) {
|
|
|
1749
1827
|
onEditTheme = _ref.onEditTheme,
|
|
1750
1828
|
theme = _ref.theme,
|
|
1751
1829
|
isApplyingTheme = _ref.isApplyingTheme,
|
|
1752
|
-
|
|
1830
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1753
1831
|
isHighLightedTheme = _ref.isHighLightedTheme,
|
|
1754
1832
|
isGlobalTheme = _ref.isGlobalTheme,
|
|
1755
1833
|
onApplyTheme = _ref.onApplyTheme,
|
|
@@ -1758,22 +1836,32 @@ var Card = function Card(_ref) {
|
|
|
1758
1836
|
t = _useTranslation.t;
|
|
1759
1837
|
var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
|
|
1760
1838
|
return {
|
|
1761
|
-
themePropertiesSchema: store["themePropertiesSchema"]
|
|
1839
|
+
themePropertiesSchema: store["themePropertiesSchema"],
|
|
1840
|
+
enabledFeatures: store["enabledFeatures"],
|
|
1841
|
+
proFeatures: store["proFeatures"]
|
|
1762
1842
|
};
|
|
1763
1843
|
}, shallow.shallow),
|
|
1764
|
-
themePropertiesSchema = _useConfigStore.themePropertiesSchema
|
|
1844
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1845
|
+
enabledFeatures = _useConfigStore.enabledFeatures,
|
|
1846
|
+
proFeatures = _useConfigStore.proFeatures;
|
|
1765
1847
|
var id = theme.id,
|
|
1766
1848
|
name = theme.name;
|
|
1767
1849
|
var imageProperties = neetoCist.filterBy({
|
|
1768
1850
|
kind: "image"
|
|
1769
1851
|
}, themePropertiesSchema);
|
|
1852
|
+
var isCustomCSSInSchema = neetoCist.isPresent(neetoCist.findBy({
|
|
1853
|
+
kind: "custom_css"
|
|
1854
|
+
}, themePropertiesSchema));
|
|
1855
|
+
var isCustomCSSEnabled = Boolean(enabledFeatures.customCSS);
|
|
1856
|
+
var isCustomCSSProFeature = Boolean(proFeatures.customCSS);
|
|
1857
|
+
var showCustomCSSAction = isCustomCSSInSchema && (isCustomCSSEnabled || isCustomCSSProFeature);
|
|
1770
1858
|
var handleDeleteTheme = function handleDeleteTheme() {
|
|
1771
1859
|
return onDeleteTheme(id, name);
|
|
1772
1860
|
};
|
|
1773
1861
|
var handleQuickEdit = function handleQuickEdit(section) {
|
|
1774
1862
|
return function (e) {
|
|
1775
1863
|
e.stopPropagation();
|
|
1776
|
-
if (neetoCist.isPresent(onEditTheme)) onEditTheme(theme, section);else
|
|
1864
|
+
if (neetoCist.isPresent(onEditTheme)) onEditTheme(theme, section);else onCustomizeSystemTheme(theme, section);
|
|
1777
1865
|
};
|
|
1778
1866
|
};
|
|
1779
1867
|
var showMoreDropdown = isFunction(onDeleteTheme);
|
|
@@ -1906,10 +1994,13 @@ var Card = function Card(_ref) {
|
|
|
1906
1994
|
testId: "quick-add-".concat(neetoCist.hyphenate(key)),
|
|
1907
1995
|
onClick: handleQuickEdit(camelKey)
|
|
1908
1996
|
}, key);
|
|
1909
|
-
}), /*#__PURE__*/jsxRuntime.jsx(QuickActionRow, {
|
|
1997
|
+
}), showCustomCSSAction && /*#__PURE__*/jsxRuntime.jsx(QuickActionRow, {
|
|
1998
|
+
disabled: !isCustomCSSEnabled,
|
|
1910
1999
|
icon: lucideReact.Code,
|
|
2000
|
+
isProFeature: isCustomCSSProFeature,
|
|
1911
2001
|
label: t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
1912
2002
|
testId: "quick-custom-css",
|
|
2003
|
+
disabledTooltip: t("neetoThemes.common.proFeature.customCSS.description"),
|
|
1913
2004
|
onClick: handleQuickEdit("customcss")
|
|
1914
2005
|
})]
|
|
1915
2006
|
})]
|
|
@@ -1918,8 +2009,21 @@ var Card = function Card(_ref) {
|
|
|
1918
2009
|
};
|
|
1919
2010
|
var Card$1 = /*#__PURE__*/react.memo(Card);
|
|
1920
2011
|
|
|
2012
|
+
var SectionHeading = function SectionHeading(_ref) {
|
|
2013
|
+
var label = _ref.label,
|
|
2014
|
+
testId = _ref.testId;
|
|
2015
|
+
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
2016
|
+
className: "px-6 text-xs font-semibold uppercase tracking-wide lg:px-5 xl:px-6",
|
|
2017
|
+
color: "muted",
|
|
2018
|
+
"data-testid": testId,
|
|
2019
|
+
variant: "body2",
|
|
2020
|
+
children: label
|
|
2021
|
+
});
|
|
2022
|
+
};
|
|
2023
|
+
|
|
1921
2024
|
var Themes = function Themes(_ref) {
|
|
1922
2025
|
var onEditTheme = _ref.onEditTheme,
|
|
2026
|
+
onCustomizeSystemTheme = _ref.onCustomizeSystemTheme,
|
|
1923
2027
|
_ref$themes = _ref.themes,
|
|
1924
2028
|
themes = _ref$themes === void 0 ? [] : _ref$themes,
|
|
1925
2029
|
_ref$defaultThemes = _ref.defaultThemes,
|
|
@@ -1933,7 +2037,6 @@ var Themes = function Themes(_ref) {
|
|
|
1933
2037
|
thumbnail = _ref.thumbnail,
|
|
1934
2038
|
themeBeingApplied = _ref.themeBeingApplied,
|
|
1935
2039
|
onApplyTheme = _ref.onApplyTheme,
|
|
1936
|
-
onApplyThemeSuccess = _ref.onApplyThemeSuccess,
|
|
1937
2040
|
_ref$isSearchVisible = _ref.isSearchVisible,
|
|
1938
2041
|
isSearchVisible = _ref$isSearchVisible === void 0 ? false : _ref$isSearchVisible;
|
|
1939
2042
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -1950,19 +2053,13 @@ var Themes = function Themes(_ref) {
|
|
|
1950
2053
|
previewingTheme = _useThemeStore.previewingTheme;
|
|
1951
2054
|
var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
|
|
1952
2055
|
return {
|
|
1953
|
-
entityType: store["entityType"]
|
|
1954
|
-
entityId: store["entityId"]
|
|
2056
|
+
entityType: store["entityType"]
|
|
1955
2057
|
};
|
|
1956
2058
|
}, shallow.shallow),
|
|
1957
|
-
entityType = _useConfigStore.entityType
|
|
1958
|
-
entityId = _useConfigStore.entityId;
|
|
2059
|
+
entityType = _useConfigStore.entityType;
|
|
1959
2060
|
var _useQueryParams = reactUtils$1.useQueryParams(),
|
|
1960
2061
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
1961
2062
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
1962
|
-
var _useCloneTheme = useGlobalThemesApi.useCloneTheme(),
|
|
1963
|
-
cloneTheme = _useCloneTheme.mutate;
|
|
1964
|
-
var _useApplyTheme = useGlobalThemesApi.useApplyTheme({}),
|
|
1965
|
-
applyClonedTheme = _useApplyTheme.mutate;
|
|
1966
2063
|
var _useShowGlobalTheme = useGlobalThemesApi.useShowGlobalTheme(entityType),
|
|
1967
2064
|
_useShowGlobalTheme$d = _useShowGlobalTheme.data,
|
|
1968
2065
|
_useShowGlobalTheme$d2 = _useShowGlobalTheme$d === void 0 ? {} : _useShowGlobalTheme$d,
|
|
@@ -2000,23 +2097,7 @@ var Themes = function Themes(_ref) {
|
|
|
2000
2097
|
return theme.id !== activeThemeId && matchesSearch(theme);
|
|
2001
2098
|
});
|
|
2002
2099
|
var showActiveThemeSection = activeTheme && matchesSearch(activeTheme);
|
|
2003
|
-
var
|
|
2004
|
-
cloneTheme(data.id, {
|
|
2005
|
-
onSuccess: function onSuccess(_ref2) {
|
|
2006
|
-
var clonedTheme = _ref2.theme;
|
|
2007
|
-
applyClonedTheme({
|
|
2008
|
-
themeId: clonedTheme.id,
|
|
2009
|
-
entityId: entityId,
|
|
2010
|
-
entityType: entityType
|
|
2011
|
-
}, {
|
|
2012
|
-
onSuccess: function onSuccess() {
|
|
2013
|
-
onApplyThemeSuccess === null || onApplyThemeSuccess === void 0 || onApplyThemeSuccess(clonedTheme);
|
|
2014
|
-
onEditTheme(clonedTheme, section);
|
|
2015
|
-
}
|
|
2016
|
-
});
|
|
2017
|
-
}
|
|
2018
|
-
});
|
|
2019
|
-
};
|
|
2100
|
+
var hasNoMatchingThemes = !showActiveThemeSection && ramda.isEmpty(filteredThemes) && ramda.isEmpty(filteredDefaultThemes);
|
|
2020
2101
|
if (isLoading || isCurrentThemeLoading || isLoadingGlobalTheme) {
|
|
2021
2102
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2022
2103
|
className: "flex h-full w-full items-center justify-center",
|
|
@@ -2027,6 +2108,7 @@ var Themes = function Themes(_ref) {
|
|
|
2027
2108
|
className: "border-border mb-6 border-b px-6 pb-6 lg:px-5 xl:px-6",
|
|
2028
2109
|
children: /*#__PURE__*/jsxRuntime.jsx(Card$1, {
|
|
2029
2110
|
onApplyTheme: onApplyTheme,
|
|
2111
|
+
onCustomizeSystemTheme: onCustomizeSystemTheme,
|
|
2030
2112
|
thumbnail: thumbnail,
|
|
2031
2113
|
active: true,
|
|
2032
2114
|
isApplyingTheme: (themeBeingApplied === null || themeBeingApplied === void 0 ? void 0 : themeBeingApplied.id) === activeTheme.id,
|
|
@@ -2034,14 +2116,16 @@ var Themes = function Themes(_ref) {
|
|
|
2034
2116
|
isHighLightedTheme: activeTheme.id === themeToHighlight,
|
|
2035
2117
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === activeTheme.id,
|
|
2036
2118
|
theme: activeTheme,
|
|
2037
|
-
onCloneTheme: handleCloneTheme,
|
|
2038
2119
|
onEditTheme: isActiveThemeCustom ? onEditTheme : undefined,
|
|
2039
2120
|
onSetPreviewTheme: setPreviewTheme
|
|
2040
2121
|
})
|
|
2041
2122
|
});
|
|
2042
|
-
var systemThemesSection = neetoCist.isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.
|
|
2123
|
+
var systemThemesSection = neetoCist.isNotEmpty(filteredDefaultThemes) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2043
2124
|
className: "mb-6 space-y-3",
|
|
2044
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
2125
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(SectionHeading, {
|
|
2126
|
+
label: t("neetoThemes.build.leftSideBar.themes.systemThemes"),
|
|
2127
|
+
testId: "system-themes-heading"
|
|
2128
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2045
2129
|
className: "flex flex-col gap-4 px-6 pb-10 lg:px-5 xl:px-6",
|
|
2046
2130
|
"data-testid": "system-themes",
|
|
2047
2131
|
children: filteredDefaultThemes.map(function (theme) {
|
|
@@ -2054,15 +2138,17 @@ var Themes = function Themes(_ref) {
|
|
|
2054
2138
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2055
2139
|
isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
|
|
2056
2140
|
key: theme.id,
|
|
2057
|
-
onCloneTheme: handleCloneTheme,
|
|
2058
2141
|
onSetPreviewTheme: setPreviewTheme
|
|
2059
2142
|
});
|
|
2060
2143
|
})
|
|
2061
|
-
})
|
|
2144
|
+
})]
|
|
2062
2145
|
});
|
|
2063
|
-
var customThemesSection = neetoCist.isNotEmpty(filteredThemes) && /*#__PURE__*/jsxRuntime.
|
|
2146
|
+
var customThemesSection = neetoCist.isNotEmpty(filteredThemes) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2064
2147
|
className: "mb-6 space-y-3",
|
|
2065
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
2148
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(SectionHeading, {
|
|
2149
|
+
label: t("neetoThemes.build.leftSideBar.themes.customThemes"),
|
|
2150
|
+
testId: "custom-themes-heading"
|
|
2151
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2066
2152
|
className: "flex flex-col gap-4 px-6",
|
|
2067
2153
|
"data-testid": "custom-themes",
|
|
2068
2154
|
children: filteredThemes.map(function (theme) {
|
|
@@ -2079,12 +2165,11 @@ var Themes = function Themes(_ref) {
|
|
|
2079
2165
|
isGlobalTheme: (globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.id) === theme.id,
|
|
2080
2166
|
isHighLightedTheme: theme.id === themeToHighlight,
|
|
2081
2167
|
key: theme.id,
|
|
2082
|
-
onCloneTheme: handleCloneTheme,
|
|
2083
2168
|
onDeleteTheme: !isActive && onDeleteTheme,
|
|
2084
2169
|
onSetPreviewTheme: setPreviewTheme
|
|
2085
2170
|
});
|
|
2086
2171
|
})
|
|
2087
|
-
})
|
|
2172
|
+
})]
|
|
2088
2173
|
});
|
|
2089
2174
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2090
2175
|
className: "neeto-themes-sidebar__scroll",
|
|
@@ -2098,7 +2183,7 @@ var Themes = function Themes(_ref) {
|
|
|
2098
2183
|
autoComplete: "off",
|
|
2099
2184
|
placeholder: t("neetoThemes.common.searchThemes")
|
|
2100
2185
|
})
|
|
2101
|
-
}),
|
|
2186
|
+
}), hasNoMatchingThemes && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
2102
2187
|
className: "text-center",
|
|
2103
2188
|
color: "muted",
|
|
2104
2189
|
"data-testid": "no-data-title",
|
|
@@ -2130,6 +2215,8 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2130
2215
|
}, shallow.shallow),
|
|
2131
2216
|
entityType = _useConfigStore.entityType,
|
|
2132
2217
|
helpDocUrl = _useConfigStore.helpDocUrl;
|
|
2218
|
+
var _useQueryParams = reactUtils$1.useQueryParams(),
|
|
2219
|
+
sourceThemeId = _useQueryParams.source;
|
|
2133
2220
|
var isCustomizeScreen = isEditThemeRoute() || isNewThemeRoute();
|
|
2134
2221
|
var isCustomCssScreen = isScreenCustomCSS(currentScreen);
|
|
2135
2222
|
var isRTL = i18n.dir() === "rtl";
|
|
@@ -2154,7 +2241,7 @@ var TitleBar = function TitleBar(_ref) {
|
|
|
2154
2241
|
}), /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Typography, {
|
|
2155
2242
|
"data-testid": "themes-header",
|
|
2156
2243
|
variant: "h5",
|
|
2157
|
-
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")]
|
|
2244
|
+
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")]
|
|
2158
2245
|
})]
|
|
2159
2246
|
})
|
|
2160
2247
|
});
|
|
@@ -2327,6 +2414,17 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2327
2414
|
search: section ? "?section=".concat(section) : ""
|
|
2328
2415
|
});
|
|
2329
2416
|
};
|
|
2417
|
+
var handleCustomizeSystemTheme = function handleCustomizeSystemTheme(theme, section) {
|
|
2418
|
+
themeToEdit.current = theme;
|
|
2419
|
+
var searchParams = new URLSearchParams({
|
|
2420
|
+
source: theme.id
|
|
2421
|
+
});
|
|
2422
|
+
if (section) searchParams.set("section", section);
|
|
2423
|
+
history.push({
|
|
2424
|
+
pathname: buildPathname(useGlobalThemesApi.routes.themes["new"]),
|
|
2425
|
+
search: "?".concat(searchParams.toString())
|
|
2426
|
+
});
|
|
2427
|
+
};
|
|
2330
2428
|
var onApplyTheme = function onApplyTheme(theme) {
|
|
2331
2429
|
if (themeBeingApplied !== null && themeBeingApplied !== void 0 && themeBeingApplied.id) return;
|
|
2332
2430
|
setThemeBeingApplied(theme);
|
|
@@ -2421,12 +2519,12 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2421
2519
|
isCurrentThemeLoading: isCurrentThemeLoading,
|
|
2422
2520
|
isSearchVisible: isSearchVisible,
|
|
2423
2521
|
onApplyTheme: onApplyTheme,
|
|
2424
|
-
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2425
2522
|
themeBeingApplied: themeBeingApplied,
|
|
2426
2523
|
themeToHighlight: themeToHighlight,
|
|
2427
2524
|
themes: themes,
|
|
2428
2525
|
thumbnail: thumbnail,
|
|
2429
2526
|
isLoading: isLoading || isFetchingSchema,
|
|
2527
|
+
onCustomizeSystemTheme: handleCustomizeSystemTheme,
|
|
2430
2528
|
onDeleteTheme: handleDelete,
|
|
2431
2529
|
onEditTheme: handleEditTheme
|
|
2432
2530
|
});
|
|
@@ -2440,6 +2538,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2440
2538
|
fixedAspectRatio: fixedAspectRatio,
|
|
2441
2539
|
isApplyingTheme: isApplyingTheme,
|
|
2442
2540
|
onApplyTheme: onApplyTheme,
|
|
2541
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2443
2542
|
onCreateTheme: onCreateTheme,
|
|
2444
2543
|
onPropertiesChange: onPropertiesChange,
|
|
2445
2544
|
onUpdateTheme: onUpdateTheme,
|
|
@@ -2456,6 +2555,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
2456
2555
|
fixedAspectRatio: fixedAspectRatio,
|
|
2457
2556
|
isApplyingTheme: isApplyingTheme,
|
|
2458
2557
|
onApplyTheme: onApplyTheme,
|
|
2558
|
+
onApplyThemeSuccess: onApplyThemeSuccess,
|
|
2459
2559
|
onCreateTheme: onCreateTheme,
|
|
2460
2560
|
onPropertiesChange: onPropertiesChange,
|
|
2461
2561
|
onUpdateTheme: onUpdateTheme,
|