@bigbinary/neeto-themes-frontend 4.2.8 → 4.2.10

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/cjs/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var useExpandedSection = require('../useExpandedSection-BTBI4UqP.js');
3
+ var useExpandedSection = require('../useExpandedSection-D0PusQFE.js');
4
4
  require('@babel/runtime/helpers/slicedToArray');
5
5
  require('zustand/shallow');
6
6
  require('react');
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var NeetoThemesBuilder = require('./NeetoThemesBuilder.js');
4
- var useExpandedSection = require('../useExpandedSection-BTBI4UqP.js');
5
- var useGlobalThemesApi = require('../useGlobalThemesApi-DjZDCCZE.js');
4
+ var useExpandedSection = require('../useExpandedSection-D0PusQFE.js');
5
+ var useGlobalThemesApi = require('../useGlobalThemesApi-Bx5QeeJE.js');
6
6
  var utils = require('../index-CZdpMMBb.js');
7
7
  require('zustand/shallow');
8
8
  require('react');
@@ -6,8 +6,8 @@ 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-DjZDCCZE.js');
10
- var useExpandedSection = require('../../useExpandedSection-BTBI4UqP.js');
9
+ var useGlobalThemesApi = require('../../useGlobalThemesApi-Bx5QeeJE.js');
10
+ var useExpandedSection = require('../../useExpandedSection-D0PusQFE.js');
11
11
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
12
12
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
13
13
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
@@ -425,12 +425,12 @@ var CustomCSS = function CustomCSS(_ref) {
425
425
  var _useFormikContext = formik.useFormikContext(),
426
426
  values = _useFormikContext.values,
427
427
  setFieldValue = _useFormikContext.setFieldValue;
428
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
428
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
429
429
  return {
430
430
  themePropertiesSchema: store["themePropertiesSchema"],
431
431
  helpPopoverProps: store["helpPopoverProps"]
432
432
  };
433
- }, shallow.shallow),
433
+ })),
434
434
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
435
435
  helpPopoverProps = _useConfigStore.helpPopoverProps;
436
436
  var _helpPopoverProps$cus = helpPopoverProps.customCss,
@@ -934,7 +934,7 @@ var SliderBlock = function SliderBlock(_ref) {
934
934
  });
935
935
  };
936
936
 
937
- var _excluded = ["label", "name", "asCheckbox", "dataTestid"];
937
+ var _excluded = ["label", "name", "asCheckbox", "dataTestid", "checkboxDataTestid"];
938
938
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
939
939
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
940
940
  var SwitchBlock = function SwitchBlock(_ref) {
@@ -943,6 +943,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
943
943
  _ref$asCheckbox = _ref.asCheckbox,
944
944
  asCheckbox = _ref$asCheckbox === void 0 ? false : _ref$asCheckbox,
945
945
  dataTestid = _ref.dataTestid,
946
+ checkboxDataTestid = _ref.checkboxDataTestid,
946
947
  inputProps = _objectWithoutProperties(_ref, _excluded);
947
948
  var _useTranslation = reactI18next.useTranslation(),
948
949
  t = _useTranslation.t,
@@ -957,7 +958,8 @@ var SwitchBlock = function SwitchBlock(_ref) {
957
958
  label: label,
958
959
  name: name
959
960
  }, inputProps)), {}, {
960
- "data-testid": "enable-background-color-toggle"
961
+ "data-testid": "enable-background-color-toggle",
962
+ dataTestId: checkboxDataTestid || neetoCist.hyphenate(name)
961
963
  })), doesHelpTextExist && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
962
964
  className: "shrink-0",
963
965
  description: t(translationKey)
@@ -1020,17 +1022,17 @@ var Properties = function Properties(_ref) {
1020
1022
  var onPropertiesChange = _ref.onPropertiesChange,
1021
1023
  condition = _ref.condition,
1022
1024
  themeId = _ref.themeId;
1023
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1025
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1024
1026
  return {
1025
1027
  themePropertiesSchema: store["themePropertiesSchema"]
1026
1028
  };
1027
- }, shallow.shallow),
1029
+ })),
1028
1030
  themePropertiesSchema = _useConfigStore.themePropertiesSchema;
1029
- var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
1031
+ var _useThemeStore = useExpandedSection.useThemeStore(shallow.useShallow(function (store) {
1030
1032
  return {
1031
1033
  setThemeState: store["setThemeState"]
1032
1034
  };
1033
- }, shallow.shallow),
1035
+ })),
1034
1036
  setThemeState = _useThemeStore.setThemeState;
1035
1037
  var _useFormikContext = formik.useFormikContext(),
1036
1038
  setFieldValue = _useFormikContext.setFieldValue,
@@ -1200,7 +1202,7 @@ var Properties = function Properties(_ref) {
1200
1202
  }
1201
1203
  case "boolean":
1202
1204
  {
1203
- var _findBy1, _findBy10;
1205
+ var _findBy1, _findBy10, _findBy11;
1204
1206
  var _index2 = neetoCist.findIndexBy({
1205
1207
  key: key
1206
1208
  }, values.properties);
@@ -1212,9 +1214,12 @@ var Properties = function Properties(_ref) {
1212
1214
  checked: value !== "false",
1213
1215
  label: buildLabel(key, kind),
1214
1216
  name: neetoCist.snakeToCamelCase(key),
1215
- dataTestid: (_findBy10 = neetoCist.findBy({
1217
+ checkboxDataTestid: (_findBy10 = neetoCist.findBy({
1216
1218
  key: key
1217
- }, themePropertiesSchema)) === null || _findBy10 === void 0 ? void 0 : _findBy10.dataTestid,
1219
+ }, themePropertiesSchema)) === null || _findBy10 === void 0 ? void 0 : _findBy10.checkboxDataTestid,
1220
+ dataTestid: (_findBy11 = neetoCist.findBy({
1221
+ key: key
1222
+ }, themePropertiesSchema)) === null || _findBy11 === void 0 ? void 0 : _findBy11.dataTestid,
1218
1223
  onCheckedChange: function onCheckedChange(checked) {
1219
1224
  return setFieldValue("properties[".concat(_index2, "].value"), String(checked));
1220
1225
  }
@@ -1222,16 +1227,16 @@ var Properties = function Properties(_ref) {
1222
1227
  }
1223
1228
  case "alignment_block":
1224
1229
  {
1225
- var _findBy11;
1230
+ var _findBy12;
1226
1231
  var _index3 = neetoCist.findIndexBy({
1227
1232
  key: key
1228
1233
  }, values.properties);
1229
1234
  return /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
1230
1235
  label: buildLabel(key, kind),
1231
1236
  name: "properties[".concat(_index3, "].value"),
1232
- dataTestid: (_findBy11 = neetoCist.findBy({
1237
+ dataTestid: (_findBy12 = neetoCist.findBy({
1233
1238
  key: key
1234
- }, themePropertiesSchema)) === null || _findBy11 === void 0 ? void 0 : _findBy11.dataTestid
1239
+ }, themePropertiesSchema)) === null || _findBy12 === void 0 ? void 0 : _findBy12.dataTestid
1235
1240
  }, key);
1236
1241
  }
1237
1242
  default:
@@ -1256,11 +1261,11 @@ var ImageBlock = function ImageBlock(_ref) {
1256
1261
  var _useFormikContext = formik.useFormikContext(),
1257
1262
  setFieldValue = _useFormikContext.setFieldValue,
1258
1263
  values = _useFormikContext.values;
1259
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1264
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1260
1265
  return {
1261
1266
  themePropertiesSchema: store["themePropertiesSchema"]
1262
1267
  };
1263
- }, shallow.shallow),
1268
+ })),
1264
1269
  themePropertiesSchema = _useConfigStore.themePropertiesSchema;
1265
1270
  var propertySchema = neetoCist.findBy({
1266
1271
  key: attribute
@@ -1273,6 +1278,7 @@ var ImageBlock = function ImageBlock(_ref) {
1273
1278
  var positionKeyInSchema = neetoCist.findBy({
1274
1279
  key: "".concat(name, "_position")
1275
1280
  }, themePropertiesSchema);
1281
+ var positionDataTestid = (positionKeyInSchema === null || positionKeyInSchema === void 0 ? void 0 : positionKeyInSchema.dataTestid) || "theme-style-".concat(neetoCist.hyphenate(name), "-position");
1276
1282
  var isPositionChangerVisible = enablePositionChanger && (imageData === null || imageData === void 0 ? void 0 : imageData.url) && neetoCist.isPresent(positionKeyInSchema);
1277
1283
  var positionKeyIndex = neetoCist.findIndexBy({
1278
1284
  key: "".concat(name, "_position")
@@ -1321,7 +1327,7 @@ var ImageBlock = function ImageBlock(_ref) {
1321
1327
  }();
1322
1328
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
1323
1329
  className: "space-y-3",
1324
- "data-testid": "theme-style-".concat(label ? utils$1.joinHyphenCase(label) : "image-block"),
1330
+ "data-testid": "theme-style-image-block",
1325
1331
  children: [label && /*#__PURE__*/jsxRuntime.jsx("div", {
1326
1332
  className: "flex items-center justify-between",
1327
1333
  children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Label, {
@@ -1339,6 +1345,7 @@ var ImageBlock = function ImageBlock(_ref) {
1339
1345
  src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
1340
1346
  onUploadComplete: handleImageChange
1341
1347
  }), isPositionChangerVisible && /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
1348
+ dataTestid: positionDataTestid,
1342
1349
  label: buildLabel("".concat(name, "Position"), "image"),
1343
1350
  options: (options === null || options === void 0 ? void 0 : options.map(toCapitalizedOption)) || POSITION_OPTIONS,
1344
1351
  placeholder: t("neetoThemes.common.left"),
@@ -1363,12 +1370,12 @@ var Images = function Images(_ref) {
1363
1370
  fixedAspectRatio = _ref.fixedAspectRatio;
1364
1371
  var _useFormikContext = formik.useFormikContext(),
1365
1372
  values = _useFormikContext.values;
1366
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1373
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1367
1374
  return {
1368
1375
  helpPopoverProps: store["helpPopoverProps"],
1369
1376
  themePropertiesSchema: store["themePropertiesSchema"]
1370
1377
  };
1371
- }, shallow.shallow),
1378
+ })),
1372
1379
  helpPopoverProps = _useConfigStore.helpPopoverProps,
1373
1380
  themePropertiesSchema = _useConfigStore.themePropertiesSchema;
1374
1381
  var key = neetoCist.snakeToCamelCase(attribute);
@@ -1400,11 +1407,11 @@ var ThemeMeta = function ThemeMeta(_ref) {
1400
1407
  var className = _ref.className;
1401
1408
  var _useTranslation = reactI18next.useTranslation(),
1402
1409
  t = _useTranslation.t;
1403
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1410
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1404
1411
  return {
1405
1412
  helpPopoverProps: store["helpPopoverProps"]
1406
1413
  };
1407
- }, shallow.shallow),
1414
+ })),
1408
1415
  helpPopoverProps = _useConfigStore.helpPopoverProps;
1409
1416
  var _helpPopoverProps$nam = helpPopoverProps.name,
1410
1417
  nameHelpPopoverProps = _helpPopoverProps$nam === void 0 ? {} : _helpPopoverProps$nam;
@@ -1445,7 +1452,7 @@ var Customize = function Customize(_ref) {
1445
1452
  _useState2 = _slicedToArray(_useState, 2),
1446
1453
  isNotAppliedPopoverOpen = _useState2[0],
1447
1454
  setIsNotAppliedPopoverOpen = _useState2[1];
1448
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1455
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1449
1456
  return {
1450
1457
  themePropertiesSchema: store["themePropertiesSchema"],
1451
1458
  entityId: store["entityId"],
@@ -1455,7 +1462,7 @@ var Customize = function Customize(_ref) {
1455
1462
  enabledFeatures: store["enabledFeatures"],
1456
1463
  proFeatures: store["proFeatures"]
1457
1464
  };
1458
- }, shallow.shallow),
1465
+ })),
1459
1466
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1460
1467
  entityId = _useConfigStore.entityId,
1461
1468
  entityType = _useConfigStore.entityType,
@@ -1468,12 +1475,12 @@ var Customize = function Customize(_ref) {
1468
1475
  var _useQueryParams = reactUtils$1.useQueryParams(),
1469
1476
  sourceThemeId = _useQueryParams.source;
1470
1477
  var isCustomizingSystemTheme = !themeId && neetoCist.isPresent(sourceThemeId);
1471
- var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
1478
+ var _useThemeStore = useExpandedSection.useThemeStore(shallow.useShallow(function (store) {
1472
1479
  return {
1473
1480
  currentTheme: store["currentTheme"],
1474
1481
  setThemeState: store["setThemeState"]
1475
1482
  };
1476
- }, shallow.shallow),
1483
+ })),
1477
1484
  currentTheme = _useThemeStore.currentTheme,
1478
1485
  setThemeState = _useThemeStore.setThemeState;
1479
1486
  var _useShowGlobalTheme = useGlobalThemesApi.useShowGlobalTheme(entityType),
@@ -1798,11 +1805,11 @@ var Thumbnail = function Thumbnail(_ref) {
1798
1805
  isPreviewing = _ref.isPreviewing,
1799
1806
  isHighLightedTheme = _ref.isHighLightedTheme,
1800
1807
  theme = _ref.theme;
1801
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1808
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1802
1809
  return {
1803
1810
  themePropertiesSchema: store["themePropertiesSchema"]
1804
1811
  };
1805
- }, shallow.shallow),
1812
+ })),
1806
1813
  _useConfigStore$theme = _useConfigStore.themePropertiesSchema,
1807
1814
  themePropertiesSchema = _useConfigStore$theme === void 0 ? [] : _useConfigStore$theme;
1808
1815
  var _themePropertiesSchem = _slicedToArray(themePropertiesSchema, 2),
@@ -1886,13 +1893,13 @@ var Card = function Card(_ref) {
1886
1893
  Thumbnail$1 = _ref.thumbnail;
1887
1894
  var _useTranslation = reactI18next.useTranslation(),
1888
1895
  t = _useTranslation.t;
1889
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
1896
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
1890
1897
  return {
1891
1898
  themePropertiesSchema: store["themePropertiesSchema"],
1892
1899
  enabledFeatures: store["enabledFeatures"],
1893
1900
  proFeatures: store["proFeatures"]
1894
1901
  };
1895
- }, shallow.shallow),
1902
+ })),
1896
1903
  themePropertiesSchema = _useConfigStore.themePropertiesSchema,
1897
1904
  enabledFeatures = _useConfigStore.enabledFeatures,
1898
1905
  proFeatures = _useConfigStore.proFeatures;
@@ -2095,19 +2102,19 @@ var Themes = function Themes(_ref) {
2095
2102
  t = _useTranslation.t;
2096
2103
  var _useThemeUtils = useExpandedSection.useThemeUtils(),
2097
2104
  setTheme = _useThemeUtils.setTheme;
2098
- var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
2105
+ var _useThemeStore = useExpandedSection.useThemeStore(shallow.useShallow(function (store) {
2099
2106
  return {
2100
2107
  setThemeState: store["setThemeState"],
2101
2108
  previewingTheme: store["previewingTheme"]
2102
2109
  };
2103
- }, shallow.shallow),
2110
+ })),
2104
2111
  setThemeState = _useThemeStore.setThemeState,
2105
2112
  previewingTheme = _useThemeStore.previewingTheme;
2106
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
2113
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
2107
2114
  return {
2108
2115
  entityType: store["entityType"]
2109
2116
  };
2110
- }, shallow.shallow),
2117
+ })),
2111
2118
  entityType = _useConfigStore.entityType;
2112
2119
  var _useQueryParams = reactUtils$1.useQueryParams(),
2113
2120
  _useQueryParams$searc = _useQueryParams.searchTerm,
@@ -2252,19 +2259,19 @@ var TitleBar = function TitleBar(_ref) {
2252
2259
  handleToggleSearch = _ref.handleToggleSearch;
2253
2260
  var _useTranslation = reactI18next.useTranslation(),
2254
2261
  t = _useTranslation.t;
2255
- var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
2262
+ var _useThemeStore = useExpandedSection.useThemeStore(shallow.useShallow(function (store) {
2256
2263
  return {
2257
2264
  previewingTheme: store["previewingTheme"]
2258
2265
  };
2259
- }, shallow.shallow),
2266
+ })),
2260
2267
  previewingTheme = _useThemeStore.previewingTheme;
2261
2268
  var themeId = previewingTheme === null || previewingTheme === void 0 ? void 0 : previewingTheme.id;
2262
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
2269
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
2263
2270
  return {
2264
2271
  entityType: store["entityType"],
2265
2272
  helpDocUrl: store["helpDocUrl"]
2266
2273
  };
2267
- }, shallow.shallow),
2274
+ })),
2268
2275
  entityType = _useConfigStore.entityType,
2269
2276
  helpDocUrl = _useConfigStore.helpDocUrl;
2270
2277
  var _useQueryParams = reactUtils$1.useQueryParams(),
@@ -2371,23 +2378,23 @@ var Sidebar = function Sidebar(_ref) {
2371
2378
  react.useEffect(function () {
2372
2379
  setIsThemesSidebarCollapsed(!isLargerScreen);
2373
2380
  }, [isLargerScreen]);
2374
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
2381
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
2375
2382
  return {
2376
2383
  entityType: store["entityType"],
2377
2384
  entityId: store["entityId"],
2378
2385
  isFetchingSchema: store["isFetchingSchema"],
2379
2386
  defaultThemeName: store["defaultThemeName"]
2380
2387
  };
2381
- }, shallow.shallow),
2388
+ })),
2382
2389
  entityType = _useConfigStore.entityType,
2383
2390
  entityId = _useConfigStore.entityId,
2384
2391
  isFetchingSchema = _useConfigStore.isFetchingSchema,
2385
2392
  defaultThemeName = _useConfigStore.defaultThemeName;
2386
- var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
2393
+ var _useThemeStore = useExpandedSection.useThemeStore(shallow.useShallow(function (store) {
2387
2394
  return {
2388
2395
  setThemeState: store["setThemeState"]
2389
2396
  };
2390
- }, shallow.shallow),
2397
+ })),
2391
2398
  setThemeState = _useThemeStore.setThemeState;
2392
2399
  var didScrollActiveThemeIntoView = react.useRef(null);
2393
2400
  var _useTranslation = reactI18next.useTranslation(),
@@ -2668,19 +2675,19 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
2668
2675
  _ref$proFeatures = _ref.proFeatures,
2669
2676
  proFeatures = _ref$proFeatures === void 0 ? {} : _ref$proFeatures;
2670
2677
  react.useMemo(useGlobalThemesApi.registerNeetoThemesTranslations, []);
2671
- var _useThemeStore = useExpandedSection.useThemeStore(function (store) {
2678
+ var _useThemeStore = useExpandedSection.useThemeStore(shallow.useShallow(function (store) {
2672
2679
  return {
2673
2680
  setThemeState: store["setThemeState"]
2674
2681
  };
2675
- }, shallow.shallow),
2682
+ })),
2676
2683
  setThemeState = _useThemeStore.setThemeState;
2677
2684
  var _useThemeUtils = useExpandedSection.useThemeUtils(),
2678
2685
  setTheme = _useThemeUtils.setTheme;
2679
- var _useConfigStore = useExpandedSection.useConfigStore(function (store) {
2686
+ var _useConfigStore = useExpandedSection.useConfigStore(shallow.useShallow(function (store) {
2680
2687
  return {
2681
2688
  setConfigState: store["setConfigState"]
2682
2689
  };
2683
- }, shallow.shallow),
2690
+ })),
2684
2691
  setConfigState = _useConfigStore.setConfigState;
2685
2692
  var _useTranslation = reactI18next.useTranslation(),
2686
2693
  t = _useTranslation.t;