@bigbinary/neeto-themes-frontend 1.1.14 → 1.1.16

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/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { useTranslation, Trans } from 'react-i18next';
10
10
  import '@bigbinary/neetoui/Toastr';
11
11
  import { useQuery, useMutation } from 'react-query';
12
12
  import axios from 'axios';
13
- import { prop, mergeRight, equals, pipe, values, flatten as flatten$1, map, toUpper, join, isNil, isEmpty, mergeLeft, concat, __, inc, path } from 'ramda';
13
+ import { prop, mergeRight, equals, pipe, values, flatten as flatten$1, map, toUpper, join, isNil, isEmpty, mergeLeft, concat, __, inc } from 'ramda';
14
14
  import Button$1 from '@bigbinary/neetoui/Button';
15
15
  import Form from '@bigbinary/neetoui/formik/Form';
16
16
  import * as yup from 'yup';
@@ -2662,9 +2662,9 @@ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) {
2662
2662
 
2663
2663
  function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2664
2664
 
2665
- function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$2(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
2665
+ function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
2666
2666
 
2667
- function _objectWithoutPropertiesLoose$2(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
2667
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
2668
2668
  /**
2669
2669
  * Convenience wrapper component for the `useDropzone` hook
2670
2670
  *
@@ -6055,7 +6055,7 @@ var _reactInfiniteScroller2 = _interopRequireDefault(_reactInfiniteScroller);
6055
6055
 
6056
6056
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6057
6057
 
6058
- function _objectWithoutProperties$3(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
6058
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
6059
6059
 
6060
6060
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6061
6061
 
@@ -6159,7 +6159,7 @@ var MasonryInfiniteScroller = (_temp2 = _class = function (_Component) {
6159
6159
  _props.packed;
6160
6160
  _props.position;
6161
6161
  _props.sizes;
6162
- var props = _objectWithoutProperties$3(_props, ['children', 'className', 'style', 'pack', 'packed', 'position', 'sizes']);
6162
+ var props = _objectWithoutProperties(_props, ['children', 'className', 'style', 'pack', 'packed', 'position', 'sizes']);
6163
6163
 
6164
6164
  return _react2.default.createElement(
6165
6165
  _reactInfiniteScroller2.default,
@@ -6731,7 +6731,7 @@ var Modal = function Modal(_ref) {
6731
6731
  })))), /*#__PURE__*/React.createElement("input", getInputProps()));
6732
6732
  };
6733
6733
 
6734
- var _excluded$2 = ["key", "label"];
6734
+ var _excluded = ["key", "label"];
6735
6735
  var Menu = Dropdown.Menu,
6736
6736
  MenuItem = Dropdown.MenuItem;
6737
6737
  var ImageUploader = function ImageUploader(_ref) {
@@ -6851,7 +6851,7 @@ var ImageUploader = function ImageUploader(_ref) {
6851
6851
  }, /*#__PURE__*/React.createElement(Menu, null, options.map(function (_ref2) {
6852
6852
  var key = _ref2.key,
6853
6853
  label = _ref2.label,
6854
- otherProps = _objectWithoutProperties$2(_ref2, _excluded$2);
6854
+ otherProps = _objectWithoutProperties$2(_ref2, _excluded);
6855
6855
  return /*#__PURE__*/React.createElement(MenuItem.Button, _extends$1({}, otherProps, {
6856
6856
  key: key
6857
6857
  }), label);
@@ -7081,11 +7081,12 @@ var buildInitialValues = function buildInitialValues(theme, themeConfig) {
7081
7081
  name: t$2("neetoThemes.build.leftSideBar.themes.createTheme.newThemeName"),
7082
7082
  properties: themeConfig.map(function (_ref) {
7083
7083
  var key = _ref.key,
7084
- kind = _ref.kind;
7084
+ kind = _ref.kind,
7085
+ defaultValue = _ref.defaultValue;
7085
7086
  switch (kind) {
7086
7087
  case "color":
7087
7088
  return {
7088
- value: "#000000",
7089
+ value: defaultValue,
7089
7090
  kind: "color",
7090
7091
  key: key
7091
7092
  };
@@ -7194,105 +7195,39 @@ var Customize = function Customize(_ref) {
7194
7195
  });
7195
7196
  };
7196
7197
 
7197
- function _objectWithoutPropertiesLoose(source, excluded) {
7198
- if (source == null) return {};
7199
- var target = {};
7200
- var sourceKeys = Object.keys(source);
7201
- var key, i;
7202
- for (i = 0; i < sourceKeys.length; i++) {
7203
- key = sourceKeys[i];
7204
- if (excluded.indexOf(key) >= 0) continue;
7205
- target[key] = source[key];
7206
- }
7207
- return target;
7208
- }
7209
-
7210
- function _objectWithoutProperties(source, excluded) {
7211
- if (source == null) return {};
7212
- var target = _objectWithoutPropertiesLoose(source, excluded);
7213
- var key, i;
7214
- if (Object.getOwnPropertySymbols) {
7215
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
7216
- for (i = 0; i < sourceSymbolKeys.length; i++) {
7217
- key = sourceSymbolKeys[i];
7218
- if (excluded.indexOf(key) >= 0) continue;
7219
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
7220
- target[key] = source[key];
7221
- }
7222
- }
7223
- return target;
7224
- }
7225
-
7226
- var _excluded = ["id", "name", "appliedCount", "properties"];
7227
- var Card = function Card(_ref) {
7228
- var _ref$active = _ref.active,
7229
- active = _ref$active === void 0 ? false : _ref$active,
7198
+ var Thumbnail = function Thumbnail(_ref) {
7199
+ var _theme$snakeToCamelCa, _findBy, _findBy2;
7200
+ var active = _ref.active,
7230
7201
  isPreviewing = _ref.isPreviewing,
7231
- onSetPreviewTheme = _ref.onSetPreviewTheme,
7232
- onDeleteTheme = _ref.onDeleteTheme,
7233
- onEditTheme = _ref.onEditTheme,
7234
- onApplyTheme = _ref.onApplyTheme,
7235
- theme = _ref.theme,
7236
- isApplyingTheme = _ref.isApplyingTheme,
7237
- onCloneTheme = _ref.onCloneTheme,
7238
7202
  isHighLightedTheme = _ref.isHighLightedTheme,
7239
- setThemeBeingApplied = _ref.setThemeBeingApplied;
7240
- var _useTranslation = useTranslation(),
7241
- t = _useTranslation.t;
7242
- var id = theme.id,
7243
- name = theme.name,
7244
- appliedCount = theme.appliedCount,
7245
- properties = theme.properties,
7246
- styles = _objectWithoutProperties(theme, _excluded);
7203
+ theme = _ref.theme;
7247
7204
  var _useConfigStore = useConfigStore(function (store) {
7248
7205
  return {
7249
- themeConfig: store["themeConfig"],
7250
- entityId: store["entityId"],
7251
- entityType: store["entityType"]
7206
+ themeConfig: store["themeConfig"]
7252
7207
  };
7253
7208
  }, shallow),
7254
7209
  _useConfigStore$theme = _useConfigStore.themeConfig,
7255
- themeConfig = _useConfigStore$theme === void 0 ? [] : _useConfigStore$theme,
7256
- entityId = _useConfigStore.entityId,
7257
- entityType = _useConfigStore.entityType;
7210
+ themeConfig = _useConfigStore$theme === void 0 ? [] : _useConfigStore$theme;
7258
7211
  var _themeConfig = _slicedToArray$3(themeConfig, 2),
7259
7212
  colorObject1 = _themeConfig[0],
7260
7213
  colorObject2 = _themeConfig[1];
7261
7214
  var primaryLabel = humanize(colorObject1 === null || colorObject1 === void 0 ? void 0 : colorObject1.key);
7262
7215
  var secondaryLabel = humanize(colorObject2 === null || colorObject2 === void 0 ? void 0 : colorObject2.key);
7263
- var handleApplyThemeClick = function handleApplyThemeClick() {
7264
- if (isApplyingTheme) return;
7265
- setThemeBeingApplied(theme);
7266
- onApplyTheme({
7267
- themeId: theme.id,
7268
- entityId: entityId,
7269
- entityType: entityType
7270
- });
7271
- };
7272
- var handleCloneTheme = function handleCloneTheme() {
7273
- return onCloneTheme(theme);
7274
- };
7275
- var handleEditTheme = function handleEditTheme() {
7276
- return onEditTheme(theme);
7277
- };
7278
- var handleDeleteTheme = function handleDeleteTheme() {
7279
- return onDeleteTheme(id, name, appliedCount);
7280
- };
7281
7216
  var primaryColor = findBy({
7282
7217
  key: colorObject1.key
7283
- }, properties).value;
7218
+ }, theme.properties).value;
7284
7219
  var secondaryColor = findBy({
7285
7220
  key: colorObject2.key
7286
- }, properties).value;
7287
- var backgroundImageUrl = theme[snakeToCamelCase(findBy({
7221
+ }, theme.properties).value;
7222
+ var backgroundImageUrl = (_theme$snakeToCamelCa = theme[snakeToCamelCase(findBy({
7288
7223
  useAsCardBackground: true
7289
- }, themeConfig).key)].url;
7290
- var isContentBackgroundEnabled = path(["layoutOptions", "isContentBackgroundEnabled"], styles);
7224
+ }, themeConfig).key)]) === null || _theme$snakeToCamelCa === void 0 ? void 0 : _theme$snakeToCamelCa.url;
7225
+ var buttonBackgroundColor = (_findBy = findBy({
7226
+ key: (_findBy2 = findBy({
7227
+ useAsCardButtonBackground: true
7228
+ }, themeConfig)) === null || _findBy2 === void 0 ? void 0 : _findBy2.key
7229
+ }, theme.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value;
7291
7230
  return /*#__PURE__*/React.createElement("div", {
7292
- className: "group space-y-2 pt-0.5",
7293
- "data-cy": active ? "active-theme-card" : "theme-card",
7294
- id: theme.id
7295
- }, /*#__PURE__*/React.createElement("div", {
7296
7231
  className: classnames("neeto-themes-theme-thumbnail neeto-ui-rounded-lg border transition-all duration-300 ease-in-out", {
7297
7232
  "neeto-ui-border-gray-400": !active,
7298
7233
  "neeto-ui-border-gray-800 neeto-themes-theme-thumbnail--active": active,
@@ -7300,20 +7235,13 @@ var Card = function Card(_ref) {
7300
7235
  "neeto-themes-theme-thumbnail--highlight-active": isHighLightedTheme
7301
7236
  }),
7302
7237
  style: {
7303
- backgroundColor: path(["colorScheme", "backgroundColor"], styles),
7304
7238
  backgroundImage: backgroundImageUrl ? "url(".concat(backgroundImageUrl, ")") : "initial",
7305
7239
  backgroundSize: "cover"
7306
- },
7307
- onClick: function onClick() {
7308
- return onSetPreviewTheme(theme);
7309
7240
  }
7310
7241
  }, /*#__PURE__*/React.createElement("div", {
7311
7242
  className: "neeto-ui-rounded-lg cursor-pointer p-3 transition-all duration-300 ease-in-out group-hover:opacity-85"
7312
7243
  }, /*#__PURE__*/React.createElement("div", {
7313
- className: "neeto-ui-rounded-lg p-3",
7314
- style: {
7315
- backgroundColor: isContentBackgroundEnabled && path(["layoutOptions", "contentBackgroundColor"], styles)
7316
- }
7244
+ className: "neeto-ui-rounded-lg p-3"
7317
7245
  }, /*#__PURE__*/React.createElement("div", {
7318
7246
  className: "mb-3"
7319
7247
  }, /*#__PURE__*/React.createElement(Typography, {
@@ -7333,9 +7261,74 @@ var Card = function Card(_ref) {
7333
7261
  }, secondaryLabel))), /*#__PURE__*/React.createElement("div", {
7334
7262
  className: "neeto-ui-rounded-lg h-5 w-12",
7335
7263
  style: {
7336
- backgroundColor: path(["colorScheme", "buttonBackgroundColor"], styles)
7264
+ backgroundColor: buttonBackgroundColor
7265
+ }
7266
+ }))));
7267
+ };
7268
+
7269
+ var Card = function Card(_ref) {
7270
+ var _ref$active = _ref.active,
7271
+ active = _ref$active === void 0 ? false : _ref$active,
7272
+ isPreviewing = _ref.isPreviewing,
7273
+ onSetPreviewTheme = _ref.onSetPreviewTheme,
7274
+ onDeleteTheme = _ref.onDeleteTheme,
7275
+ onEditTheme = _ref.onEditTheme,
7276
+ onApplyTheme = _ref.onApplyTheme,
7277
+ theme = _ref.theme,
7278
+ isApplyingTheme = _ref.isApplyingTheme,
7279
+ onCloneTheme = _ref.onCloneTheme,
7280
+ isHighLightedTheme = _ref.isHighLightedTheme,
7281
+ setThemeBeingApplied = _ref.setThemeBeingApplied,
7282
+ Thumbnail$1 = _ref.thumbnail;
7283
+ var _useTranslation = useTranslation(),
7284
+ t = _useTranslation.t;
7285
+ var id = theme.id,
7286
+ name = theme.name,
7287
+ appliedCount = theme.appliedCount;
7288
+ var _useConfigStore = useConfigStore(function (store) {
7289
+ return {
7290
+ entityId: store["entityId"],
7291
+ entityType: store["entityType"]
7292
+ };
7293
+ }, shallow),
7294
+ entityId = _useConfigStore.entityId,
7295
+ entityType = _useConfigStore.entityType;
7296
+ var handleApplyThemeClick = function handleApplyThemeClick() {
7297
+ if (isApplyingTheme) return;
7298
+ setThemeBeingApplied(theme);
7299
+ onApplyTheme({
7300
+ themeId: theme.id,
7301
+ entityId: entityId,
7302
+ entityType: entityType
7303
+ });
7304
+ };
7305
+ var handleCloneTheme = function handleCloneTheme() {
7306
+ return onCloneTheme(theme);
7307
+ };
7308
+ var handleEditTheme = function handleEditTheme() {
7309
+ return onEditTheme(theme);
7310
+ };
7311
+ var handleDeleteTheme = function handleDeleteTheme() {
7312
+ return onDeleteTheme(id, name, appliedCount);
7313
+ };
7314
+ return /*#__PURE__*/React.createElement("div", {
7315
+ className: "group space-y-2 pt-0.5",
7316
+ "data-cy": active ? "active-theme-card" : "theme-card",
7317
+ id: theme.id,
7318
+ onClick: function onClick() {
7319
+ return onSetPreviewTheme(theme);
7337
7320
  }
7338
- })))), /*#__PURE__*/React.createElement("div", {
7321
+ }, Thumbnail$1 ? /*#__PURE__*/React.createElement(Thumbnail$1, {
7322
+ active: active,
7323
+ isHighLightedTheme: isHighLightedTheme,
7324
+ isPreviewing: isPreviewing,
7325
+ theme: theme
7326
+ }) : /*#__PURE__*/React.createElement(Thumbnail, {
7327
+ active: active,
7328
+ isHighLightedTheme: isHighLightedTheme,
7329
+ isPreviewing: isPreviewing,
7330
+ theme: theme
7331
+ }), /*#__PURE__*/React.createElement("div", {
7339
7332
  className: "flex items-start justify-between gap-1"
7340
7333
  }, /*#__PURE__*/React.createElement(Typography, {
7341
7334
  className: "line-clamp-2 min-w-0 flex-grow break-words pt-1",
@@ -7401,7 +7394,8 @@ var Themes = function Themes(_ref) {
7401
7394
  didScrollActiveThemeIntoView = _ref.didScrollActiveThemeIntoView,
7402
7395
  isLoading = _ref.isLoading,
7403
7396
  currentTheme = _ref.currentTheme,
7404
- isCurrentThemeLoading = _ref.isCurrentThemeLoading;
7397
+ isCurrentThemeLoading = _ref.isCurrentThemeLoading,
7398
+ thumbnail = _ref.thumbnail;
7405
7399
  var _useTranslation = useTranslation(),
7406
7400
  t = _useTranslation.t;
7407
7401
  var _useThemeUtils = useThemeUtils(),
@@ -7494,6 +7488,7 @@ var Themes = function Themes(_ref) {
7494
7488
  onApplyTheme: onApplyTheme,
7495
7489
  setThemeBeingApplied: setThemeBeingApplied,
7496
7490
  theme: theme,
7491
+ thumbnail: thumbnail,
7497
7492
  active: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === theme.id,
7498
7493
  isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
7499
7494
  key: theme.id,
@@ -7519,6 +7514,7 @@ var Themes = function Themes(_ref) {
7519
7514
  onEditTheme: onEditTheme,
7520
7515
  setThemeBeingApplied: setThemeBeingApplied,
7521
7516
  theme: theme,
7517
+ thumbnail: thumbnail,
7522
7518
  active: isActive,
7523
7519
  isHighLightedTheme: theme.id === themeToHighlight,
7524
7520
  key: theme.id,
@@ -7584,8 +7580,9 @@ var TitleBar = function TitleBar(_ref) {
7584
7580
  };
7585
7581
 
7586
7582
  var MemoizedAlert = /*#__PURE__*/memo(Alert);
7587
- var Sidebar = function Sidebar() {
7583
+ var Sidebar = function Sidebar(_ref) {
7588
7584
  var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3;
7585
+ var thumbnail = _ref.thumbnail;
7589
7586
  var _useState = useState(DESIGN_SCREENS.THEMES),
7590
7587
  _useState2 = _slicedToArray$3(_useState, 2),
7591
7588
  currentScreen = _useState2[0],
@@ -7718,6 +7715,7 @@ var Sidebar = function Sidebar() {
7718
7715
  isCurrentThemeLoading: isCurrentThemeLoading,
7719
7716
  themeToHighlight: themeToHighlight,
7720
7717
  themes: themes,
7718
+ thumbnail: thumbnail,
7721
7719
  isLoading: isLoading || isFetchingConfig,
7722
7720
  onDeleteTheme: handleDelete,
7723
7721
  onEditTheme: handleEditTheme
@@ -7742,7 +7740,8 @@ var Sidebar = function Sidebar() {
7742
7740
  var NeetoThemes = function NeetoThemes(_ref) {
7743
7741
  var children = _ref.children,
7744
7742
  entityType = _ref.entityType,
7745
- entityId = _ref.entityId;
7743
+ entityId = _ref.entityId,
7744
+ thumbnail = _ref.thumbnail;
7746
7745
  var _useThemeStore = useThemeStore(function (store) {
7747
7746
  return {
7748
7747
  isCurrentThemeLoading: store["isCurrentThemeLoading"]
@@ -7763,7 +7762,9 @@ var NeetoThemes = function NeetoThemes(_ref) {
7763
7762
  }, []);
7764
7763
  return /*#__PURE__*/React.createElement("div", {
7765
7764
  className: "neeto-themes__wrapper"
7766
- }, /*#__PURE__*/React.createElement(Sidebar, null), /*#__PURE__*/React.createElement("div", {
7765
+ }, /*#__PURE__*/React.createElement(Sidebar, {
7766
+ thumbnail: thumbnail
7767
+ }), /*#__PURE__*/React.createElement("div", {
7767
7768
  className: "neeto-themes-preview__wrapper"
7768
7769
  }, isCurrentThemeLoading ? /*#__PURE__*/React.createElement("div", {
7769
7770
  className: "m-auto flex h-full w-full items-center justify-center"