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