@bigbinary/neeto-themes-frontend 1.2.3 → 1.2.5

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
@@ -8,26 +8,26 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
8
8
  import { isNotPresent, snakeToCamelCase, filterBy, isPresent, isNot, findBy, findIndexBy, toLabelAndValue, humanize, isNotEmpty } from '@bigbinary/neeto-cist';
9
9
  import Alert from '@bigbinary/neetoui/Alert';
10
10
  import { useTranslation, Trans } from 'react-i18next';
11
- import '@babel/runtime/helpers/asyncToGenerator';
12
- import '@babel/runtime/regenerator';
13
- import '@bigbinary/neetoui/Toastr';
11
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
12
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
13
+ import Toastr from '@bigbinary/neetoui/Toastr';
14
14
  import { useQuery } from 'react-query';
15
15
  import axios from 'axios';
16
16
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
17
17
  import { prop, isEmpty, negate } from 'ramda';
18
18
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
19
- import { Close, LeftArrow, Plus } from '@bigbinary/neeto-icons';
19
+ import { LeftAlign, CenterAlign, Close, LeftArrow, Plus } from '@bigbinary/neeto-icons';
20
20
  import Button from '@bigbinary/neetoui/Button';
21
21
  import Popover from '@bigbinary/neetoui/Popover';
22
22
  import Typography from '@bigbinary/neetoui/Typography';
23
23
  import Form from '@bigbinary/neetoui/formik/Form';
24
24
  import * as yup from 'yup';
25
- import { useFormikContext } from 'formik';
25
+ import { useFormikContext, Field } from 'formik';
26
26
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
27
27
  import { ImageUploader } from '@bigbinary/neeto-image-uploader-frontend';
28
28
  import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
29
- import ColorPicker from '@bigbinary/neetoui/ColorPicker';
30
29
  import Select from '@bigbinary/neetoui/Select';
30
+ import ColorPicker from '@bigbinary/neetoui/ColorPicker';
31
31
  import { Slider } from 'antd';
32
32
  import Switch from '@bigbinary/neetoui/Switch';
33
33
  import Input from '@bigbinary/neetoui/formik/Input';
@@ -43,6 +43,7 @@ var useConfigStore = create$1(withImmutableActions(function (set) {
43
43
  entityId: "",
44
44
  variableNamesMap: {},
45
45
  isFetchingSchema: true,
46
+ isTemplateThemesEnabled: false,
46
47
  setConfigState: set
47
48
  };
48
49
  }));
@@ -57,6 +58,52 @@ var useThemeStore = create$1(withImmutableActions(function (set) {
57
58
  };
58
59
  }));
59
60
 
61
+ var getImageFromUrl = function getImageFromUrl(source) {
62
+ var image = new Image();
63
+ image.crossOrigin = "anonymous";
64
+ image.src = source;
65
+ return new Promise(function (resolve) {
66
+ image.onload = function () {
67
+ resolve(image);
68
+ };
69
+ });
70
+ };
71
+ var getDominantColorFromUrl = /*#__PURE__*/function () {
72
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(imageUrl) {
73
+ var image, context, c;
74
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
75
+ while (1) switch (_context.prev = _context.next) {
76
+ case 0:
77
+ _context.prev = 0;
78
+ _context.next = 3;
79
+ return getImageFromUrl(imageUrl);
80
+ case 3:
81
+ image = _context.sent;
82
+ context = document.createElement("canvas").getContext("2d");
83
+ context === null || context === void 0 || context.drawImage(image, 0, 0, 1, 1);
84
+ c = context === null || context === void 0 ? void 0 : context.getImageData(0, 0, 1, 1).data;
85
+ if (!c) {
86
+ _context.next = 9;
87
+ break;
88
+ }
89
+ return _context.abrupt("return", "#".concat(((1 << 24) + (c[0] << 16) + (c[1] << 8) + c[2]).toString(16).slice(1)));
90
+ case 9:
91
+ return _context.abrupt("return", null);
92
+ case 12:
93
+ _context.prev = 12;
94
+ _context.t0 = _context["catch"](0);
95
+ Toastr.error(_context.t0);
96
+ return _context.abrupt("return", null);
97
+ case 16:
98
+ case "end":
99
+ return _context.stop();
100
+ }
101
+ }, _callee, null, [[0, 12]]);
102
+ }));
103
+ return function getDominantColorFromUrl(_x) {
104
+ return _ref.apply(this, arguments);
105
+ };
106
+ }();
60
107
  var scrollElementIntoView = function scrollElementIntoView(elementId) {
61
108
  var elementToScroll = document.getElementById(elementId);
62
109
  elementToScroll === null || elementToScroll === void 0 || elementToScroll.scrollIntoView({
@@ -102,8 +149,12 @@ var useShowThemeEntity = function useShowThemeEntity(entityId) {
102
149
  };
103
150
 
104
151
  var _excluded$1 = ["themeId"];
105
- var list$1 = function list() {
106
- return axios.get("".concat(BASE_URL, "/api/v1/themes"));
152
+ var list$1 = function list(entityId) {
153
+ return axios.get("".concat(BASE_URL, "/api/v1/themes"), {
154
+ params: {
155
+ entity_id: entityId
156
+ }
157
+ });
107
158
  };
108
159
  var show = function show(id) {
109
160
  return axios.get("".concat(BASE_URL, "/api/v1/themes/").concat(id));
@@ -143,8 +194,17 @@ var themesApi = {
143
194
  apply: apply
144
195
  };
145
196
 
146
- var useListThemes = function useListThemes() {
147
- return useQuery(QUERY_KEYS.THEMES_LIST, themesApi.list);
197
+ var useListThemes = function useListThemes(entityId) {
198
+ var _useConfigStore = useConfigStore(function (store) {
199
+ return {
200
+ isTemplateThemesEnabled: store["isTemplateThemesEnabled"]
201
+ };
202
+ }, shallow),
203
+ isTemplateThemesEnabled = _useConfigStore.isTemplateThemesEnabled;
204
+ var queryKey = isTemplateThemesEnabled ? [QUERY_KEYS.THEMES_LIST, entityId] : [QUERY_KEYS.THEMES_LIST];
205
+ return useQuery(queryKey, function () {
206
+ return themesApi.list(entityId);
207
+ });
148
208
  };
149
209
  var useCreateTheme = function useCreateTheme() {
150
210
  return useMutationWithInvalidation(themesApi.create, {
@@ -195,6 +255,8 @@ var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
195
255
  var overlayOpacity = Number(property.value);
196
256
  setVariable(snakeToCamelCase("".concat(property.key, "_overlay_opacity")), Math.abs(overlayOpacity / 100), variableNamesMap);
197
257
  setVariable(snakeToCamelCase("".concat(property.key, "_overlay_color")), overlayOpacity < 0 ? BLACK : WHITE, variableNamesMap);
258
+ } else if (property.kind === "radius") {
259
+ setVariable(attribute, "".concat(property.value, "px"), variableNamesMap);
198
260
  } else {
199
261
  setVariable(attribute, property.value, variableNamesMap);
200
262
  }
@@ -381,6 +443,12 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
381
443
  kind: "slider",
382
444
  key: key
383
445
  };
446
+ case "radius":
447
+ return {
448
+ value: defaultValue,
449
+ kind: "radius",
450
+ key: key
451
+ };
384
452
  case "boolean":
385
453
  return {
386
454
  value: String(defaultValue),
@@ -393,6 +461,12 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
393
461
  kind: "position_selector",
394
462
  key: key
395
463
  };
464
+ case "alignment_block":
465
+ return {
466
+ value: defaultValue,
467
+ kind: "alignment_block",
468
+ key: key
469
+ };
396
470
  default:
397
471
  return null;
398
472
  }
@@ -410,23 +484,26 @@ var buildImageData = function buildImageData(values, themePropertiesSchema) {
410
484
  }, {});
411
485
  };
412
486
  var isPropertyVisible = function isPropertyVisible(key, formikValues, themePropertiesSchema) {
413
- var _findBy;
414
487
  var property = findBy({
415
488
  key: key
416
489
  }, themePropertiesSchema);
417
490
  if (isNotPresent(property)) return false;
491
+ if (property !== null && property !== void 0 && property.hidden) return false;
418
492
  var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
419
493
  if (isNotPresent(conditionalKey)) return true;
420
- var dependentProperty = findBy({
494
+ var dependentPropertySchema = findBy({
421
495
  key: conditionalKey
422
496
  }, themePropertiesSchema);
423
- if (dependentProperty.kind === "image") {
497
+ var dependentProperty = findBy({
498
+ key: conditionalKey
499
+ }, formikValues.properties);
500
+ if (dependentPropertySchema.kind === "image") {
424
501
  var _formikValues$snakeTo;
425
502
  return isPresent((_formikValues$snakeTo = formikValues[snakeToCamelCase(conditionalKey)]) === null || _formikValues$snakeTo === void 0 ? void 0 : _formikValues$snakeTo.url);
503
+ } else if (dependentPropertySchema.kind === "boolean") {
504
+ return (dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value) !== "false";
426
505
  }
427
- return isPresent((_findBy = findBy({
428
- key: conditionalKey
429
- }, formikValues.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value);
506
+ return isPresent(dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value);
430
507
  };
431
508
  var buildLabel = function buildLabel(key, kind) {
432
509
  return t$1("neetoThemes.properties.".concat(snakeToCamelCase(kind), ".").concat(snakeToCamelCase(key)));
@@ -454,6 +531,32 @@ var Card$2 = function Card(_ref) {
454
531
  });
455
532
  };
456
533
 
534
+ var SelectBlock = function SelectBlock(_ref) {
535
+ var label = _ref.label,
536
+ _ref$placeholder = _ref.placeholder,
537
+ placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
538
+ value = _ref.value,
539
+ options = _ref.options,
540
+ onChange = _ref.onChange;
541
+ return /*#__PURE__*/jsxs("div", {
542
+ className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
543
+ "data-cy": "theme-style-".concat(joinHyphenCase(label)),
544
+ children: [/*#__PURE__*/jsx(Typography, {
545
+ "data-cy": "logo-field-labels",
546
+ style: "body2",
547
+ children: label
548
+ }), /*#__PURE__*/jsx("div", {
549
+ className: "w-40",
550
+ children: /*#__PURE__*/jsx(Select, {
551
+ onChange: onChange,
552
+ options: options,
553
+ placeholder: placeholder,
554
+ value: value
555
+ })
556
+ })]
557
+ });
558
+ };
559
+
457
560
  var DESIGN_SCREENS = {
458
561
  THEMES: "Themes",
459
562
  Customize: "Customize"
@@ -461,6 +564,7 @@ var DESIGN_SCREENS = {
461
564
  var ONE_MEGABYTE = 1;
462
565
 
463
566
  var ImageBlock = function ImageBlock(_ref) {
567
+ var _findBy;
464
568
  var label = _ref.label,
465
569
  name = _ref.name,
466
570
  _ref$imageData = _ref.imageData,
@@ -468,22 +572,73 @@ var ImageBlock = function ImageBlock(_ref) {
468
572
  _ref$uploadConfig = _ref.uploadConfig,
469
573
  uploadConfig = _ref$uploadConfig === void 0 ? {
470
574
  maxImageSize: ONE_MEGABYTE
471
- } : _ref$uploadConfig;
575
+ } : _ref$uploadConfig,
576
+ attribute = _ref.attribute;
577
+ var _useTranslation = useTranslation(),
578
+ t = _useTranslation.t;
472
579
  var _useFormikContext = useFormikContext(),
473
- setFieldValue = _useFormikContext.setFieldValue;
474
- var handleImageChange = function handleImageChange(image) {
475
- if (isEmpty(image.signedId) || isEmpty(image.url)) {
476
- setFieldValue(name, {
477
- signedId: null,
478
- url: image.url
479
- });
480
- return;
481
- }
482
- setFieldValue(name, {
483
- signedId: image.signedId,
484
- url: image.url
485
- });
486
- };
580
+ setFieldValue = _useFormikContext.setFieldValue,
581
+ values = _useFormikContext.values;
582
+ var _useConfigStore = useConfigStore(function (store) {
583
+ return {
584
+ themePropertiesSchema: store["themePropertiesSchema"]
585
+ };
586
+ }, shallow),
587
+ themePropertiesSchema = _useConfigStore.themePropertiesSchema;
588
+ var propertySchema = findBy({
589
+ key: attribute
590
+ }, themePropertiesSchema);
591
+ var enablePositionChanger = (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.enablePositionChanger) || false;
592
+ var options = propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.options;
593
+ var positionKeyInSchema = findBy({
594
+ key: "".concat(name, "_position")
595
+ }, themePropertiesSchema);
596
+ var isPositionChangerVisible = enablePositionChanger && (imageData === null || imageData === void 0 ? void 0 : imageData.url) && isPresent(positionKeyInSchema);
597
+ var positionKeyIndex = findIndexBy({
598
+ key: "".concat(name, "_position")
599
+ }, values.properties);
600
+ var handleImageChange = /*#__PURE__*/function () {
601
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(image) {
602
+ var dominantColor;
603
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
604
+ while (1) switch (_context.prev = _context.next) {
605
+ case 0:
606
+ _context.prev = 0;
607
+ if (!(isEmpty(image.signedId) || isEmpty(image.url))) {
608
+ _context.next = 4;
609
+ break;
610
+ }
611
+ setFieldValue(name, {
612
+ signedId: null,
613
+ url: image.url
614
+ });
615
+ return _context.abrupt("return");
616
+ case 4:
617
+ _context.next = 6;
618
+ return getDominantColorFromUrl(image.url);
619
+ case 6:
620
+ dominantColor = _context.sent;
621
+ setFieldValue(name, {
622
+ signedId: image.signedId,
623
+ url: image.url,
624
+ dominantColor: dominantColor
625
+ });
626
+ _context.next = 13;
627
+ break;
628
+ case 10:
629
+ _context.prev = 10;
630
+ _context.t0 = _context["catch"](0);
631
+ Toastr.error(_context.t0);
632
+ case 13:
633
+ case "end":
634
+ return _context.stop();
635
+ }
636
+ }, _callee, null, [[0, 10]]);
637
+ }));
638
+ return function handleImageChange(_x) {
639
+ return _ref2.apply(this, arguments);
640
+ };
641
+ }();
487
642
  return /*#__PURE__*/jsxs("div", {
488
643
  className: "space-y-3 py-3 first:pt-0 last:pb-0",
489
644
  "data-cy": "theme-style-".concat(joinHyphenCase(label)),
@@ -494,12 +649,25 @@ var ImageBlock = function ImageBlock(_ref) {
494
649
  style: "body2",
495
650
  children: label
496
651
  })
497
- }), /*#__PURE__*/createElement(ImageUploader, {
498
- uploadConfig: uploadConfig,
499
- className: "h-40 w-full",
500
- key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
501
- src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
502
- onUploadComplete: handleImageChange
652
+ }), /*#__PURE__*/jsxs("div", {
653
+ className: "space-y-3 divide-y divide-gray-200",
654
+ children: [/*#__PURE__*/createElement(ImageUploader, {
655
+ uploadConfig: uploadConfig,
656
+ className: "h-40 w-full",
657
+ key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
658
+ src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
659
+ onUploadComplete: handleImageChange
660
+ }), isPositionChangerVisible && /*#__PURE__*/jsx(SelectBlock, {
661
+ label: buildLabel("".concat(name, "Position"), "image"),
662
+ options: options || POSITION_OPTIONS,
663
+ placeholder: t("neetoThemes.common.left"),
664
+ value: toLabelAndValue((_findBy = findBy({
665
+ key: "".concat(name, "_position")
666
+ }, values.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value),
667
+ onChange: function onChange(option) {
668
+ return setFieldValue("properties[".concat(positionKeyIndex, "].value"), option.value);
669
+ }
670
+ })]
503
671
  })]
504
672
  });
505
673
  };
@@ -516,6 +684,7 @@ var Images = function Images(_ref) {
516
684
  children: /*#__PURE__*/jsx("div", {
517
685
  className: "divide-y divide-gray-200",
518
686
  children: /*#__PURE__*/jsx(ImageBlock, {
687
+ attribute: attribute,
519
688
  imageData: imageData,
520
689
  name: key
521
690
  })
@@ -523,6 +692,54 @@ var Images = function Images(_ref) {
523
692
  });
524
693
  };
525
694
 
695
+ var AlignmentBlock = function AlignmentBlock(_ref) {
696
+ var label = _ref.label,
697
+ name = _ref.name;
698
+ return /*#__PURE__*/jsxs("div", {
699
+ className: "flex items-center justify-between gap-2 py-3 first:pt-0 last:pb-0",
700
+ "data-cy": joinHyphenCase(label),
701
+ children: [/*#__PURE__*/jsx(Typography, {
702
+ "data-cy": "style-fields-labels",
703
+ style: "body2",
704
+ children: label
705
+ }), /*#__PURE__*/jsx(Field, {
706
+ name: name,
707
+ children: function children(_ref2) {
708
+ var value = _ref2.field.value,
709
+ setFieldValue = _ref2.form.setFieldValue;
710
+ return /*#__PURE__*/jsxs("div", {
711
+ className: "flex items-center gap-3",
712
+ children: [/*#__PURE__*/jsx(Button, {
713
+ "data-cy": "alignment-left",
714
+ icon: LeftAlign,
715
+ size: "large",
716
+ style: value === "left" ? "primary" : "text",
717
+ tooltipProps: {
718
+ content: "Left align",
719
+ position: "bottom"
720
+ },
721
+ onClick: function onClick() {
722
+ return setFieldValue(name, "left");
723
+ }
724
+ }), /*#__PURE__*/jsx(Button, {
725
+ "data-cy": "alignment-center",
726
+ icon: CenterAlign,
727
+ size: "large",
728
+ style: value === "center" ? "primary" : "text",
729
+ tooltipProps: {
730
+ content: "Center align",
731
+ position: "bottom"
732
+ },
733
+ onClick: function onClick() {
734
+ return setFieldValue(name, "center");
735
+ }
736
+ })]
737
+ });
738
+ }
739
+ })]
740
+ });
741
+ };
742
+
526
743
  var ColorBlock = function ColorBlock(_ref) {
527
744
  var label = _ref.label,
528
745
  _ref$color = _ref.color,
@@ -582,32 +799,6 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
582
799
  });
583
800
  };
584
801
 
585
- var SelectBlock = function SelectBlock(_ref) {
586
- var label = _ref.label,
587
- _ref$placeholder = _ref.placeholder,
588
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
589
- value = _ref.value,
590
- options = _ref.options,
591
- onChange = _ref.onChange;
592
- return /*#__PURE__*/jsxs("div", {
593
- className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
594
- "data-cy": "theme-style-".concat(joinHyphenCase(label)),
595
- children: [/*#__PURE__*/jsx(Typography, {
596
- "data-cy": "logo-field-labels",
597
- style: "body2",
598
- children: label
599
- }), /*#__PURE__*/jsx("div", {
600
- className: "w-40",
601
- children: /*#__PURE__*/jsx(Select, {
602
- onChange: onChange,
603
- options: options,
604
- placeholder: placeholder,
605
- value: value
606
- })
607
- })]
608
- });
609
- };
610
-
611
802
  var SliderBlock = function SliderBlock(_ref) {
612
803
  var label = _ref.label,
613
804
  onChange = _ref.onChange,
@@ -704,7 +895,7 @@ var Properties = function Properties(_ref) {
704
895
  }
705
896
  };
706
897
  useEffect(function () {
707
- onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values, setFieldValue);
898
+ onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values, handleChange, handleColorChange);
708
899
  setTheme(values);
709
900
  setThemeState({
710
901
  previewingTheme: values
@@ -743,11 +934,26 @@ var Properties = function Properties(_ref) {
743
934
  onChange: handleColorChange(key)
744
935
  }, key);
745
936
  }), filterBy({
746
- kind: "overlay_opacity"
937
+ kind: "radius"
747
938
  }, values.properties).map(function (_ref6) {
748
939
  var key = _ref6.key,
749
940
  value = _ref6.value,
750
941
  kind = _ref6.kind;
942
+ return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(SliderBlock, {
943
+ label: buildLabel(key, kind),
944
+ max: 50,
945
+ min: 0,
946
+ value: Number(value) || 0,
947
+ onChange: function onChange(radius) {
948
+ return handleChange(key, radius, "".concat(radius, "px"));
949
+ }
950
+ }, key);
951
+ }), filterBy({
952
+ kind: "overlay_opacity"
953
+ }, values.properties).map(function (_ref7) {
954
+ var key = _ref7.key,
955
+ value = _ref7.value,
956
+ kind = _ref7.kind;
751
957
  return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(SliderBlock, {
752
958
  label: buildLabel(key, kind),
753
959
  marks: OVERLAY_OPACITY_SLIDER_MARKS,
@@ -760,11 +966,11 @@ var Properties = function Properties(_ref) {
760
966
  }, key);
761
967
  }), filterBy({
762
968
  kind: "position_selector"
763
- }, values.properties).map(function (_ref7) {
969
+ }, values.properties).map(function (_ref8) {
764
970
  var _findBy;
765
- var key = _ref7.key,
766
- kind = _ref7.kind,
767
- value = _ref7.value;
971
+ var key = _ref8.key,
972
+ kind = _ref8.kind,
973
+ value = _ref8.value;
768
974
  var index = findIndexBy({
769
975
  key: key
770
976
  }, values.properties);
@@ -782,10 +988,10 @@ var Properties = function Properties(_ref) {
782
988
  }, key);
783
989
  }), filterBy({
784
990
  kind: "boolean"
785
- }, values.properties).map(function (_ref8) {
786
- var key = _ref8.key,
787
- kind = _ref8.kind,
788
- value = _ref8.value;
991
+ }, values.properties).map(function (_ref9) {
992
+ var key = _ref9.key,
993
+ kind = _ref9.kind,
994
+ value = _ref9.value;
789
995
  var index = findIndexBy({
790
996
  key: key
791
997
  }, values.properties);
@@ -796,6 +1002,18 @@ var Properties = function Properties(_ref) {
796
1002
  return setFieldValue("properties[".concat(index, "].value"), String(e.target.checked));
797
1003
  }
798
1004
  }, key);
1005
+ }), filterBy({
1006
+ kind: "alignment_block"
1007
+ }, values.properties).map(function (_ref10) {
1008
+ var key = _ref10.key,
1009
+ kind = _ref10.kind;
1010
+ var index = findIndexBy({
1011
+ key: key
1012
+ }, values.properties);
1013
+ return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsx(AlignmentBlock, {
1014
+ label: buildLabel(key, kind),
1015
+ name: "properties[".concat(index, "].value")
1016
+ });
799
1017
  })]
800
1018
  })
801
1019
  });
@@ -1471,7 +1689,7 @@ var Sidebar = function Sidebar(_ref) {
1471
1689
  t = _useTranslation.t;
1472
1690
  var _useThemeUtils = useThemeUtils(),
1473
1691
  setTheme = _useThemeUtils.setTheme;
1474
- var _useListThemes = useListThemes(),
1692
+ var _useListThemes = useListThemes(entityId),
1475
1693
  _useListThemes$data = _useListThemes.data,
1476
1694
  _useListThemes$data2 = _useListThemes$data === void 0 ? {} : _useListThemes$data,
1477
1695
  _useListThemes$data2$ = _useListThemes$data2.themes,
@@ -1624,7 +1842,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
1624
1842
  entityType = _ref.entityType,
1625
1843
  entityId = _ref.entityId,
1626
1844
  thumbnail = _ref.thumbnail,
1627
- onPropertiesChange = _ref.onPropertiesChange;
1845
+ onPropertiesChange = _ref.onPropertiesChange,
1846
+ _ref$isTemplateThemes = _ref.isTemplateThemesEnabled,
1847
+ isTemplateThemesEnabled = _ref$isTemplateThemes === void 0 ? false : _ref$isTemplateThemes;
1628
1848
  var _useThemeStore = useThemeStore(function (store) {
1629
1849
  return {
1630
1850
  isCurrentThemeLoading: store["isCurrentThemeLoading"]
@@ -1640,7 +1860,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
1640
1860
  useEffect(function () {
1641
1861
  setConfigState({
1642
1862
  entityType: entityType,
1643
- entityId: entityId
1863
+ entityId: entityId,
1864
+ isTemplateThemesEnabled: isTemplateThemesEnabled
1644
1865
  });
1645
1866
  }, []);
1646
1867
  return /*#__PURE__*/jsxs("div", {