@bigbinary/neeto-themes-frontend 1.1.14 → 1.1.15

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);
@@ -7194,36 +7194,6 @@ var Customize = function Customize(_ref) {
7194
7194
  });
7195
7195
  };
7196
7196
 
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
7197
  var Card = function Card(_ref) {
7228
7198
  var _ref$active = _ref.active,
7229
7199
  active = _ref$active === void 0 ? false : _ref$active,
@@ -7236,30 +7206,21 @@ var Card = function Card(_ref) {
7236
7206
  isApplyingTheme = _ref.isApplyingTheme,
7237
7207
  onCloneTheme = _ref.onCloneTheme,
7238
7208
  isHighLightedTheme = _ref.isHighLightedTheme,
7239
- setThemeBeingApplied = _ref.setThemeBeingApplied;
7209
+ setThemeBeingApplied = _ref.setThemeBeingApplied,
7210
+ Thumbnail = _ref.thumbnail;
7240
7211
  var _useTranslation = useTranslation(),
7241
7212
  t = _useTranslation.t;
7242
7213
  var id = theme.id,
7243
7214
  name = theme.name,
7244
- appliedCount = theme.appliedCount,
7245
- properties = theme.properties,
7246
- styles = _objectWithoutProperties(theme, _excluded);
7215
+ appliedCount = theme.appliedCount;
7247
7216
  var _useConfigStore = useConfigStore(function (store) {
7248
7217
  return {
7249
- themeConfig: store["themeConfig"],
7250
7218
  entityId: store["entityId"],
7251
7219
  entityType: store["entityType"]
7252
7220
  };
7253
7221
  }, shallow),
7254
- _useConfigStore$theme = _useConfigStore.themeConfig,
7255
- themeConfig = _useConfigStore$theme === void 0 ? [] : _useConfigStore$theme,
7256
7222
  entityId = _useConfigStore.entityId,
7257
7223
  entityType = _useConfigStore.entityType;
7258
- var _themeConfig = _slicedToArray$3(themeConfig, 2),
7259
- colorObject1 = _themeConfig[0],
7260
- colorObject2 = _themeConfig[1];
7261
- var primaryLabel = humanize(colorObject1 === null || colorObject1 === void 0 ? void 0 : colorObject1.key);
7262
- var secondaryLabel = humanize(colorObject2 === null || colorObject2 === void 0 ? void 0 : colorObject2.key);
7263
7224
  var handleApplyThemeClick = function handleApplyThemeClick() {
7264
7225
  if (isApplyingTheme) return;
7265
7226
  setThemeBeingApplied(theme);
@@ -7278,64 +7239,19 @@ var Card = function Card(_ref) {
7278
7239
  var handleDeleteTheme = function handleDeleteTheme() {
7279
7240
  return onDeleteTheme(id, name, appliedCount);
7280
7241
  };
7281
- var primaryColor = findBy({
7282
- key: colorObject1.key
7283
- }, properties).value;
7284
- var secondaryColor = findBy({
7285
- key: colorObject2.key
7286
- }, properties).value;
7287
- var backgroundImageUrl = theme[snakeToCamelCase(findBy({
7288
- useAsCardBackground: true
7289
- }, themeConfig).key)].url;
7290
- var isContentBackgroundEnabled = path(["layoutOptions", "isContentBackgroundEnabled"], styles);
7291
7242
  return /*#__PURE__*/React.createElement("div", {
7292
7243
  className: "group space-y-2 pt-0.5",
7293
7244
  "data-cy": active ? "active-theme-card" : "theme-card",
7294
- id: theme.id
7295
- }, /*#__PURE__*/React.createElement("div", {
7296
- className: classnames("neeto-themes-theme-thumbnail neeto-ui-rounded-lg border transition-all duration-300 ease-in-out", {
7297
- "neeto-ui-border-gray-400": !active,
7298
- "neeto-ui-border-gray-800 neeto-themes-theme-thumbnail--active": active,
7299
- "neeto-themes-theme-thumbnail--preview-active": isPreviewing,
7300
- "neeto-themes-theme-thumbnail--highlight-active": isHighLightedTheme
7301
- }),
7302
- style: {
7303
- backgroundColor: path(["colorScheme", "backgroundColor"], styles),
7304
- backgroundImage: backgroundImageUrl ? "url(".concat(backgroundImageUrl, ")") : "initial",
7305
- backgroundSize: "cover"
7306
- },
7245
+ id: theme.id,
7307
7246
  onClick: function onClick() {
7308
7247
  return onSetPreviewTheme(theme);
7309
7248
  }
7310
- }, /*#__PURE__*/React.createElement("div", {
7311
- className: "neeto-ui-rounded-lg cursor-pointer p-3 transition-all duration-300 ease-in-out group-hover:opacity-85"
7312
- }, /*#__PURE__*/React.createElement("div", {
7313
- className: "neeto-ui-rounded-lg p-3",
7314
- style: {
7315
- backgroundColor: isContentBackgroundEnabled && path(["layoutOptions", "contentBackgroundColor"], styles)
7316
- }
7317
- }, /*#__PURE__*/React.createElement("div", {
7318
- className: "mb-3"
7319
- }, /*#__PURE__*/React.createElement(Typography, {
7320
- style: "h3",
7321
- weight: "semibold"
7322
- }, /*#__PURE__*/React.createElement("span", {
7323
- style: {
7324
- color: primaryColor
7325
- }
7326
- }, primaryLabel)), /*#__PURE__*/React.createElement(Typography, {
7327
- className: "neeto-ui-text-gray-600",
7328
- style: "body2"
7329
- }, /*#__PURE__*/React.createElement("span", {
7330
- style: {
7331
- color: secondaryColor
7332
- }
7333
- }, secondaryLabel))), /*#__PURE__*/React.createElement("div", {
7334
- className: "neeto-ui-rounded-lg h-5 w-12",
7335
- style: {
7336
- backgroundColor: path(["colorScheme", "buttonBackgroundColor"], styles)
7337
- }
7338
- })))), /*#__PURE__*/React.createElement("div", {
7249
+ }, Thumbnail && /*#__PURE__*/React.createElement(Thumbnail, {
7250
+ active: active,
7251
+ isHighLightedTheme: isHighLightedTheme,
7252
+ isPreviewing: isPreviewing,
7253
+ theme: theme
7254
+ }), /*#__PURE__*/React.createElement("div", {
7339
7255
  className: "flex items-start justify-between gap-1"
7340
7256
  }, /*#__PURE__*/React.createElement(Typography, {
7341
7257
  className: "line-clamp-2 min-w-0 flex-grow break-words pt-1",
@@ -7401,7 +7317,8 @@ var Themes = function Themes(_ref) {
7401
7317
  didScrollActiveThemeIntoView = _ref.didScrollActiveThemeIntoView,
7402
7318
  isLoading = _ref.isLoading,
7403
7319
  currentTheme = _ref.currentTheme,
7404
- isCurrentThemeLoading = _ref.isCurrentThemeLoading;
7320
+ isCurrentThemeLoading = _ref.isCurrentThemeLoading,
7321
+ thumbnail = _ref.thumbnail;
7405
7322
  var _useTranslation = useTranslation(),
7406
7323
  t = _useTranslation.t;
7407
7324
  var _useThemeUtils = useThemeUtils(),
@@ -7494,6 +7411,7 @@ var Themes = function Themes(_ref) {
7494
7411
  onApplyTheme: onApplyTheme,
7495
7412
  setThemeBeingApplied: setThemeBeingApplied,
7496
7413
  theme: theme,
7414
+ thumbnail: thumbnail,
7497
7415
  active: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.id) === theme.id,
7498
7416
  isPreviewing: (previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id) === theme.id,
7499
7417
  key: theme.id,
@@ -7519,6 +7437,7 @@ var Themes = function Themes(_ref) {
7519
7437
  onEditTheme: onEditTheme,
7520
7438
  setThemeBeingApplied: setThemeBeingApplied,
7521
7439
  theme: theme,
7440
+ thumbnail: thumbnail,
7522
7441
  active: isActive,
7523
7442
  isHighLightedTheme: theme.id === themeToHighlight,
7524
7443
  key: theme.id,
@@ -7584,8 +7503,9 @@ var TitleBar = function TitleBar(_ref) {
7584
7503
  };
7585
7504
 
7586
7505
  var MemoizedAlert = /*#__PURE__*/memo(Alert);
7587
- var Sidebar = function Sidebar() {
7506
+ var Sidebar = function Sidebar(_ref) {
7588
7507
  var _themeToEdit$current, _themeToEdit$current2, _themeToDelete$curren2, _themeToDelete$curren3;
7508
+ var thumbnail = _ref.thumbnail;
7589
7509
  var _useState = useState(DESIGN_SCREENS.THEMES),
7590
7510
  _useState2 = _slicedToArray$3(_useState, 2),
7591
7511
  currentScreen = _useState2[0],
@@ -7718,6 +7638,7 @@ var Sidebar = function Sidebar() {
7718
7638
  isCurrentThemeLoading: isCurrentThemeLoading,
7719
7639
  themeToHighlight: themeToHighlight,
7720
7640
  themes: themes,
7641
+ thumbnail: thumbnail,
7721
7642
  isLoading: isLoading || isFetchingConfig,
7722
7643
  onDeleteTheme: handleDelete,
7723
7644
  onEditTheme: handleEditTheme
@@ -7742,7 +7663,8 @@ var Sidebar = function Sidebar() {
7742
7663
  var NeetoThemes = function NeetoThemes(_ref) {
7743
7664
  var children = _ref.children,
7744
7665
  entityType = _ref.entityType,
7745
- entityId = _ref.entityId;
7666
+ entityId = _ref.entityId,
7667
+ thumbnail = _ref.thumbnail;
7746
7668
  var _useThemeStore = useThemeStore(function (store) {
7747
7669
  return {
7748
7670
  isCurrentThemeLoading: store["isCurrentThemeLoading"]
@@ -7763,7 +7685,9 @@ var NeetoThemes = function NeetoThemes(_ref) {
7763
7685
  }, []);
7764
7686
  return /*#__PURE__*/React.createElement("div", {
7765
7687
  className: "neeto-themes__wrapper"
7766
- }, /*#__PURE__*/React.createElement(Sidebar, null), /*#__PURE__*/React.createElement("div", {
7688
+ }, /*#__PURE__*/React.createElement(Sidebar, {
7689
+ thumbnail: thumbnail
7690
+ }), /*#__PURE__*/React.createElement("div", {
7767
7691
  className: "neeto-themes-preview__wrapper"
7768
7692
  }, isCurrentThemeLoading ? /*#__PURE__*/React.createElement("div", {
7769
7693
  className: "m-auto flex h-full w-full items-center justify-center"