@griddo/ax 1.61.7 → 1.62.2

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.
Files changed (73) hide show
  1. package/package.json +2 -2
  2. package/src/components/ActionMenu/style.tsx +1 -0
  3. package/src/components/ConfigPanel/Form/ConnectedField/NavConnectedField/index.tsx +3 -1
  4. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +17 -2
  5. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +3 -0
  6. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +3 -0
  7. package/src/components/ConfigPanel/Form/index.tsx +3 -1
  8. package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +3 -1
  9. package/src/components/ConfigPanel/NavigationForm/index.tsx +3 -2
  10. package/src/components/ConfigPanel/index.tsx +4 -1
  11. package/src/components/ElementsTooltip/index.tsx +22 -8
  12. package/src/components/ElementsTooltip/style.tsx +6 -4
  13. package/src/components/FieldContainer/index.tsx +1 -0
  14. package/src/components/Fields/AnalyticsField/PageAnalytics/atoms.tsx +3 -2
  15. package/src/components/Fields/AnalyticsField/PageAnalytics/index.tsx +3 -3
  16. package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/atoms.tsx +3 -2
  17. package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/index.tsx +3 -3
  18. package/src/components/Fields/ColorPicker/index.tsx +28 -3
  19. package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +3 -1
  20. package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +4 -0
  21. package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +3 -0
  22. package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +3 -1
  23. package/src/components/Fields/ComponentContainer/index.tsx +4 -0
  24. package/src/components/Fields/FieldGroup/index.tsx +4 -3
  25. package/src/components/Fields/FileField/index.tsx +0 -7
  26. package/src/components/Fields/ImageField/style.tsx +1 -0
  27. package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/style.tsx +0 -1
  28. package/src/components/Fields/TextArea/index.tsx +14 -3
  29. package/src/components/Fields/VisualUniqueSelection/ImageSelection/index.tsx +8 -2
  30. package/src/components/Fields/VisualUniqueSelection/ScrollableSelection/index.tsx +8 -4
  31. package/src/components/Fields/VisualUniqueSelection/utils.tsx +30 -0
  32. package/src/components/Gallery/index.tsx +10 -4
  33. package/src/components/MainWrapper/AppBar/style.tsx +0 -2
  34. package/src/components/MainWrapper/style.tsx +5 -3
  35. package/src/components/SideModal/SideModalOption/index.tsx +5 -4
  36. package/src/components/SideModal/index.tsx +19 -14
  37. package/src/containers/Analytics/actions.tsx +23 -1
  38. package/src/containers/Analytics/reducer.tsx +2 -0
  39. package/src/containers/Sites/actions.tsx +15 -5
  40. package/src/forms/fields.tsx +7 -2
  41. package/src/helpers/images.tsx +2 -5
  42. package/src/helpers/index.tsx +6 -0
  43. package/src/helpers/schemas.tsx +14 -2
  44. package/src/helpers/thumbnails.tsx +3 -3
  45. package/src/modules/Analytics/DimensionItem/index.tsx +2 -2
  46. package/src/modules/Analytics/DimensionPanel/index.tsx +60 -33
  47. package/src/modules/Analytics/DimensionPanel/style.tsx +10 -1
  48. package/src/modules/Analytics/GroupPanel/index.tsx +22 -5
  49. package/src/modules/Analytics/GroupPanel/style.tsx +1 -1
  50. package/src/modules/Analytics/index.tsx +8 -8
  51. package/src/modules/App/Routing/NavMenu/style.tsx +2 -0
  52. package/src/modules/Content/OptionTable/index.tsx +5 -2
  53. package/src/modules/Content/PageItem/index.tsx +2 -2
  54. package/src/modules/Content/index.tsx +7 -3
  55. package/src/modules/GlobalEditor/Editor/index.tsx +5 -1
  56. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/index.tsx +1 -1
  57. package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +5 -1
  58. package/src/modules/PageEditor/Editor/index.tsx +5 -1
  59. package/src/modules/Settings/Analytics/atoms.tsx +132 -0
  60. package/src/modules/Settings/Analytics/index.tsx +109 -0
  61. package/src/modules/Settings/Analytics/style.tsx +107 -0
  62. package/src/modules/Settings/ContentTypes/DataPacks/AddModal/index.tsx +10 -4
  63. package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +30 -20
  64. package/src/modules/Settings/ContentTypes/DataPacks/Item/index.tsx +12 -6
  65. package/src/modules/StructuredData/Form/ConnectedField/index.tsx +4 -2
  66. package/src/modules/StructuredData/Form/index.tsx +16 -3
  67. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
  68. package/src/modules/StructuredData/StructuredDataList/OptionTable/index.tsx +7 -1
  69. package/src/modules/StructuredData/StructuredDataList/index.tsx +2 -2
  70. package/src/routes/site.tsx +6 -0
  71. package/src/schemas/pages/GlobalPage.tsx +13 -2
  72. package/src/schemas/pages/Page.tsx +13 -2
  73. package/src/types/index.tsx +1 -0
@@ -12,13 +12,6 @@ const FileField = (props: IProps) => {
12
12
 
13
13
  const { isOpen, toggleModal } = useModal(false);
14
14
 
15
- useEffect(() => {
16
- if (!value) {
17
- toggleModal();
18
- }
19
- // eslint-disable-next-line
20
- }, []);
21
-
22
15
  const validFormats = ["pdf", "doc", "docx", "xls", "xlsx", "zip"];
23
16
 
24
17
  const handleClick = () => {
@@ -96,6 +96,7 @@ const ImageDataWrapper = styled.div`
96
96
  border-radius: ${(p) => p.theme.radii.s};
97
97
  color: ${(p) => p.theme.color.textMediumEmphasis};
98
98
  margin-bottom: ${(p) => p.theme.spacing.s};
99
+ max-width: ${(p) => `calc(${p.theme.spacing.xl} * 5)`};
99
100
  `;
100
101
 
101
102
  const FileName = styled.div`
@@ -19,7 +19,6 @@ const IconActionWrapper = styled.div`
19
19
  `;
20
20
 
21
21
  const IconWrapper = styled.div`
22
- opacity: 0;
23
22
  position: absolute;
24
23
  top: 50%;
25
24
  right: ${(p) => `calc((${p.theme.spacing.s} * 2) + ${p.theme.spacing.xxs})`};
@@ -3,7 +3,17 @@ import React, { memo, useEffect, useRef, useState } from "react";
3
3
  import * as S from "./style";
4
4
 
5
5
  const TextArea = (props: ITextAreaProps): JSX.Element => {
6
- const { value, placeholder, error, name, onChange, disabled, handleValidation, editorID } = props;
6
+ const {
7
+ value,
8
+ placeholder,
9
+ error,
10
+ name,
11
+ onChange,
12
+ disabled,
13
+ handleValidation,
14
+ editorID,
15
+ rows = 1
16
+ } = props;
7
17
 
8
18
  const [state, setState] = useState<string>(value);
9
19
  const timeOutRef = useRef<ReturnType<typeof setTimeout>>();
@@ -36,8 +46,8 @@ const TextArea = (props: ITextAreaProps): JSX.Element => {
36
46
  return (
37
47
  <S.TextArea
38
48
  name={name}
39
- minRows={1}
40
- maxRows={3}
49
+ minRows={rows}
50
+ maxRows={4}
41
51
  value={state}
42
52
  onChange={handleOnChange}
43
53
  onBlur={handleOnBlur}
@@ -57,6 +67,7 @@ interface ITextAreaProps {
57
67
  disabled?: boolean;
58
68
  handleValidation?: (value: string) => void;
59
69
  editorID?: number;
70
+ rows?: number;
60
71
  }
61
72
 
62
73
  export default memo(TextArea);
@@ -1,15 +1,20 @@
1
1
  import React from "react";
2
2
 
3
3
  import { VisualOption } from "@ax/components";
4
+ import { getOptions } from "../utils";
4
5
 
5
6
  import * as S from "./style";
6
7
 
7
- const ImageSelection = ({ value, onChange, options, objKey, columns, disabled }: IImageSelectionProps): JSX.Element => {
8
+ const ImageSelection = (props: IImageSelectionProps): JSX.Element => {
9
+ const { value, onChange, options, objKey, columns, disabled, theme } = props;
10
+
11
+ const mappedOptions: any = getOptions(theme, options);
12
+
8
13
  const handleChange = (newValue: string) => onChange(newValue);
9
14
 
10
15
  return (
11
16
  <S.Wrapper columns={columns}>
12
- {options.map((option: any, index: number) => (
17
+ {mappedOptions.map((option: any, index: number) => (
13
18
  <VisualOption
14
19
  value={option.value}
15
20
  onChange={handleChange}
@@ -34,6 +39,7 @@ interface IImageSelectionProps {
34
39
  objKey: string;
35
40
  columns: number;
36
41
  disabled?: boolean;
42
+ theme: string;
37
43
  }
38
44
 
39
45
  export default ImageSelection;
@@ -1,16 +1,19 @@
1
1
  import React, { useState, useRef, useEffect } from "react";
2
2
 
3
3
  import { IconAction, VisualOption } from "@ax/components";
4
+ import { getOptions } from "../utils";
4
5
 
5
6
  import * as S from "./style";
6
7
 
7
8
  const ScrollableSelection = (props: IScrollableSelectionProps): JSX.Element => {
8
- const { value, onChange, actions, options, objKey, columns, disabled, reference } = props;
9
+ const { value, onChange, actions, options, objKey, columns, disabled, reference, theme } = props;
9
10
  const [carouselIndex, setCarouselIndex] = useState(0);
10
11
  const [carouselItemWidth, setCarouselItemWidth] = useState<number>();
11
12
  const carouselRef = useRef<HTMLDivElement>(null);
12
13
 
13
- const slides = Math.ceil(options.length / columns);
14
+ const mappedOptions: any = getOptions(theme, options);
15
+
16
+ const slides = Math.ceil(mappedOptions.length / columns);
14
17
 
15
18
  const handleSelection = (newValue: string) => {
16
19
  onChange(newValue);
@@ -38,7 +41,7 @@ const ScrollableSelection = (props: IScrollableSelectionProps): JSX.Element => {
38
41
  return (
39
42
  <S.Wrapper>
40
43
  <S.Carousel ref={carouselRef}>
41
- {options.map((option: IScrollableUniqueSelectionFieldOptionsProps, index: number) => (
44
+ {mappedOptions.map((option: IScrollableUniqueSelectionFieldOptionsProps, index: number) => (
42
45
  <S.CarouselItem width={carouselItemWidth} columns={columns} key={index}>
43
46
  <VisualOption
44
47
  value={option.value}
@@ -75,7 +78,7 @@ interface IScrollableSelectionProps {
75
78
  value: string;
76
79
  title: string;
77
80
  onChange: (value: string) => void;
78
- options: IScrollableUniqueSelectionFieldOptionsProps[];
81
+ options: any[];
79
82
  name: string;
80
83
  objKey: string;
81
84
  columns: number;
@@ -83,6 +86,7 @@ interface IScrollableSelectionProps {
83
86
  actions: any;
84
87
  selectedContent: any;
85
88
  reference?: string;
89
+ theme: string;
86
90
  }
87
91
 
88
92
  interface IScrollableUniqueSelectionFieldOptionsProps {
@@ -0,0 +1,30 @@
1
+ const hasProps = (obj: Record<string, unknown>, props: string[]) => {
2
+ return (
3
+ !!props &&
4
+ props.map((prop) => Object.prototype.hasOwnProperty.call(obj, prop)).filter(Boolean).length === props.length
5
+ );
6
+ };
7
+
8
+ const defaultOptions = (vusOptions: Record<string, unknown>[]) => {
9
+ return !vusOptions.find((entry) => entry.theme);
10
+ };
11
+
12
+ const getOptions = (theme: string, vusOptions: Record<string, unknown>[]) => {
13
+ const themes = vusOptions.filter((entry) => entry.theme).map((entry) => entry.theme);
14
+ const themeExists = themes.includes(theme);
15
+ const defaultsOptions = vusOptions.filter((entry) => hasProps(entry, ["img", "value"]));
16
+
17
+ // 1 - Si options solo tiene las defaults options (legacy) devuelve las defaults.
18
+ // 2 - Si options no tiene el theme, devuelve las defaults.
19
+ if (defaultOptions(vusOptions) || !themeExists) return defaultsOptions;
20
+
21
+ // Si options tiene el theme, devuelve las options de ese theme.
22
+ if (themeExists) {
23
+ const optionsObj = vusOptions.find((entry) => entry.theme === theme);
24
+ return optionsObj && optionsObj.options;
25
+ }
26
+
27
+ return [];
28
+ };
29
+
30
+ export { getOptions };
@@ -22,6 +22,8 @@ const Gallery = (props: IProps): JSX.Element => {
22
22
  const tabs = [];
23
23
  if (site) tabs.unshift(...["Local", "Global"]);
24
24
  const [selectedTab, setSelectedTab] = useState(tabs[0]);
25
+ const [selectedImage, setSelectedImage] = useState<number>();
26
+ const [imageSelectedData, setImageSelectedData] = useState<IData>(data);
25
27
  const isLocalTab = selectedTab === "Local";
26
28
  const isGlobalTab = selectedTab === "Global";
27
29
  const galleryScope = isLocalTab ? site.id : "global";
@@ -91,7 +93,7 @@ const Gallery = (props: IProps): JSX.Element => {
91
93
  };
92
94
 
93
95
  const setImage = (imageData: any) => {
94
- const updatedImage = { ...data.imageSelected, ...imageData };
96
+ const updatedImage = { ...imageSelectedData.imageSelected, ...imageData };
95
97
  getImageSelected(updatedImage);
96
98
  toggleModal();
97
99
  };
@@ -162,11 +164,15 @@ const Gallery = (props: IProps): JSX.Element => {
162
164
  data.items &&
163
165
  data.items.map((item: IImage, index: number) => {
164
166
  const isSelected = data.imageSelected ? item.id === data.imageSelected.id : false;
167
+ if (isSelected && selectedImage !== item.id) {
168
+ setSelectedImage(item.id);
169
+ setImageSelectedData(data);
170
+ }
165
171
  return (
166
172
  <S.GridItem key={item.name + index} orientation={item.orientation}>
167
173
  <S.ImageWrapper
168
174
  onClick={handleClick(item)}
169
- selected={isSelected}
175
+ selected={isSelected || selectedImage === item.id}
170
176
  orientation={item.orientation}
171
177
  >
172
178
  <img src={item.thumb} alt={item.alt} />
@@ -192,8 +198,8 @@ const Gallery = (props: IProps): JSX.Element => {
192
198
  </S.GalleryWrapper>
193
199
  </S.GalleryTabs>
194
200
  <GalleryPanel
195
- isImageSelected={data?.isImageSelected}
196
- imageSelected={data?.imageSelected}
201
+ isImageSelected={imageSelectedData?.isImageSelected}
202
+ imageSelected={imageSelectedData?.imageSelected}
197
203
  validFormats={validFormats}
198
204
  setImage={setImage}
199
205
  isGlobalTab={!isLocalTab}
@@ -99,8 +99,6 @@ const Header = styled.section<{ inversed?: boolean }>`
99
99
  display: flex;
100
100
  justify-content: space-between;
101
101
  padding-right: ${(p) => p.theme.spacing.s};
102
- border-bottom: ${(p) => `1px solid ${p.theme.color.uiLine}`};
103
- border-left: 1px solid ${(p) => p.theme.color.uiLine};
104
102
 
105
103
  button:first-child {
106
104
  margin-left: ${(p) => p.theme.spacing.m};
@@ -4,12 +4,14 @@ export const Wrapper = styled.section<{ fixedAppBar: boolean | undefined }>`
4
4
  height: 100%;
5
5
  display: flex;
6
6
  flex-direction: column;
7
- padding-top: ${p => p.fixedAppBar ? p.theme.spacing.xl : "0"};
7
+ padding-top: ${(p) => (p.fixedAppBar ? p.theme.spacing.xl : "0")};
8
8
  `;
9
9
 
10
10
  export const Main = styled.article<{ fullWidth: boolean | undefined }>`
11
11
  position: relative;
12
- overflow: ${p => p.fullWidth ? "visible" : "auto"};
13
- background: ${p => p.theme.color.uiBackground01};
12
+ overflow: ${(p) => (p.fullWidth ? "visible" : "auto")};
13
+ background: ${(p) => p.theme.color.uiBackground01};
14
+ border-top: ${(p) => `1px solid ${p.theme.color.uiLine}`};
15
+ margin-top: -1px;
14
16
  flex-grow: 1;
15
17
  `;
@@ -3,18 +3,18 @@ import React, { memo } from "react";
3
3
  import * as S from "./style";
4
4
  import { getDisplayName, getThumbnailProps, filterImageText } from "@ax/helpers";
5
5
 
6
- const getThumbnailData = (option: any) => {
6
+ const getThumbnailData = (option: any, theme: string) => {
7
7
  option = filterImageText(option.component ? option.component : option);
8
8
 
9
- return getThumbnailProps(option, false);
9
+ return getThumbnailProps(option, false, theme);
10
10
  };
11
11
 
12
12
  const SideModalOption = (props: IProps) => {
13
- const { option, handleClick, toggleModal } = props;
13
+ const { option, handleClick, toggleModal, theme } = props;
14
14
 
15
15
  const isNavigationDefault = ["header", "footer"].includes(option.type);
16
16
 
17
- const thumbnailProps = getThumbnailData(option);
17
+ const thumbnailProps = getThumbnailData(option, theme);
18
18
 
19
19
  const optionParam = option.component || option;
20
20
  const label = isNavigationDefault ? option.title : getDisplayName(optionParam);
@@ -37,6 +37,7 @@ interface IProps {
37
37
  handleClick: any;
38
38
  toggleModal: () => void;
39
39
  children: string;
40
+ theme: string;
40
41
  }
41
42
 
42
43
  export default memo(SideModalOption);
@@ -21,6 +21,7 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
21
21
  current,
22
22
  setDefault,
23
23
  showSearch,
24
+ theme,
24
25
  } = props;
25
26
 
26
27
  const componentList: any = [];
@@ -87,9 +88,7 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
87
88
  return (
88
89
  <MenuItem key={`${value}${i}`} active={isSelected}>
89
90
  <S.NavLink onClick={filterOptions}>
90
- <S.Link active={isSelected}>
91
- {label}
92
- </S.Link>
91
+ <S.Link active={isSelected}>{label}</S.Link>
93
92
  </S.NavLink>
94
93
  </MenuItem>
95
94
  );
@@ -121,26 +120,31 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
121
120
  if (searchQuery.length > 0) {
122
121
  const name = displayName.toLowerCase();
123
122
  const search = searchQuery.toLocaleLowerCase();
124
- if (!name.includes(search)) return null
125
- };
123
+ if (!name.includes(search)) return null;
124
+ }
126
125
  return (
127
- <SideModalOption option={option} handleClick={handleClick} toggleModal={toggleModal} key={`${option}${i}`}>
126
+ <SideModalOption
127
+ option={option}
128
+ handleClick={handleClick}
129
+ toggleModal={toggleModal}
130
+ key={`${option}${i}`}
131
+ theme={theme}
132
+ >
128
133
  {displayName}
129
134
  </SideModalOption>
130
- )
131
- }
132
- );
135
+ );
136
+ });
133
137
 
134
138
  return isOpen
135
139
  ? createPortal(
136
140
  <S.Wrapper ref={node} optionsType={optionsType}>
137
141
  <S.Header>
138
142
  <S.Title>{optionsType}</S.Title>
139
- {showSearch && (
140
- <S.SearchWrapper>
141
- <SearchField onChange={setSearchQuery} closeOnInactive />
142
- </S.SearchWrapper>
143
- )}
143
+ {showSearch && (
144
+ <S.SearchWrapper>
145
+ <SearchField onChange={setSearchQuery} closeOnInactive />
146
+ </S.SearchWrapper>
147
+ )}
144
148
  </S.Header>
145
149
  {setDefault && !setDefault.checked && (
146
150
  <S.CheckFieldWrapper>
@@ -179,6 +183,7 @@ interface ISideModalProps {
179
183
  current?: any;
180
184
  setDefault?: any;
181
185
  showSearch?: boolean;
186
+ theme: string;
182
187
  }
183
188
 
184
189
  export default SideModal;
@@ -55,4 +55,26 @@ function updateAnalytics(analyticsState: IAnalytics, siteId: number | string = "
55
55
  };
56
56
  }
57
57
 
58
- export { getAnalytics, updateAnalytics };
58
+ function updateScriptCode(scriptCode: string, siteId: number): (dispatch: any) => Promise<boolean> {
59
+ return async (dispatch) => {
60
+ try {
61
+ const callback = async () => {
62
+ return analytics.updateScriptCode(siteId, { scriptCode });
63
+ }
64
+
65
+ const responseActions = {
66
+ handleSuccess: () => {
67
+ dispatch(getAnalytics(siteId));
68
+ },
69
+ handleError: (response: any) => appActions.handleError(response)(dispatch),
70
+ };
71
+
72
+ return await handleRequest(callback, responseActions, [appActions.setIsSaving])(dispatch);
73
+ } catch (e) {
74
+ console.log(e);
75
+ return false;
76
+ }
77
+ };
78
+ }
79
+
80
+ export { setAnalytics, getAnalytics, updateAnalytics, updateScriptCode };
@@ -4,12 +4,14 @@ import { AnalyticsActionsCreators } from "./interfaces";
4
4
 
5
5
  export interface IAnalyticsState {
6
6
  scriptCode: string;
7
+ siteScriptCodeExists: boolean;
7
8
  dimensions: IDimension[];
8
9
  groups: IDimensionsGroup[];
9
10
  }
10
11
 
11
12
  export const initialState = {
12
13
  scriptCode: "",
14
+ siteScriptCodeExists: false,
13
15
  dimensions: [],
14
16
  groups: [],
15
17
  };
@@ -21,7 +21,7 @@ import {
21
21
 
22
22
  import { ISite, IGetSitePagesParams, ISettingsForm, IGetGlobalPagesParams, IPage } from "@ax/types";
23
23
 
24
- import { sites, languages, dataPack, social, structuredData } from "@ax/api";
24
+ import { sites, languages, dataPack, social, structuredData, analytics } from "@ax/api";
25
25
  import { appActions } from "@ax/containers/App";
26
26
  import { structuredDataActions } from "@ax/containers/StructuredData";
27
27
  import { navigationActions, menuActions } from "@ax/containers/Navigation";
@@ -201,6 +201,14 @@ function setSiteInfo(currentSiteInfo: ISite): (dispatch: any, getState: any) =>
201
201
  } else {
202
202
  console.log("Error en sites getStructuredData"); // TODO: capturar errores mejor
203
203
  }
204
+
205
+ // get analytics
206
+ const analyticsResponse: any = await analytics.getAnalytics(currentSiteInfo.id);
207
+ if (isReqOk(socialResponse.status)) {
208
+ dispatch(analyticsActions.setAnalytics(analyticsResponse.data));
209
+ } else {
210
+ console.log("Error en sites getAnalytics"); // FIXME: capturar errores mejor
211
+ }
204
212
  } catch (e) {
205
213
  console.log(e); // FIXME: capturar errores
206
214
  }
@@ -241,7 +249,7 @@ function getFilteredContent(filter: any): (dispatch: any, getState: any) => Prom
241
249
 
242
250
  function getSitePages(
243
251
  params: IGetSitePagesParams,
244
- structuredData?: string,
252
+ structuredData?: string | null,
245
253
  filterQuery?: string
246
254
  ): (dispatch: any) => Promise<void> {
247
255
  return async (dispatch) => {
@@ -368,8 +376,10 @@ function importPageFromGlobal(pageID: number | number[]): (dispatch: any, getSta
368
376
  return async (dispatch, getState) => {
369
377
  try {
370
378
  const {
371
- sites: { currentSiteInfo },
372
- structuredData: { currentStructuredData },
379
+ sites: {
380
+ currentSiteInfo,
381
+ currentFilter
382
+ },
373
383
  } = getState();
374
384
 
375
385
  const responseActions = {
@@ -378,7 +388,7 @@ function importPageFromGlobal(pageID: number | number[]): (dispatch: any, getSta
378
388
  siteID: currentSiteInfo.id,
379
389
  ...DEFAULT_PARAMS,
380
390
  };
381
- const filter = currentStructuredData ? currentStructuredData.id : null;
391
+ const filter = currentFilter === "unique-pages" ? null : currentFilter;
382
392
  getSitePages(params, filter)(dispatch);
383
393
  },
384
394
  handleError: (response: any) => appActions.handleError(response)(dispatch),
@@ -7,6 +7,7 @@ const getInnerFields = (
7
7
  innerActions: any,
8
8
  selectedContent: IPage,
9
9
  isTemplateActivated: boolean,
10
+ theme: string,
10
11
  errors?: IErrorItem[],
11
12
  deleteError?: (error: IErrorItem) => void
12
13
  ) => {
@@ -24,6 +25,7 @@ const getInnerFields = (
24
25
  innerActions,
25
26
  selectedContent,
26
27
  isTemplateActivated,
28
+ theme,
27
29
  errors,
28
30
  deleteError
29
31
  );
@@ -43,6 +45,7 @@ const getInnerFields = (
43
45
  disabled={!isTemplateActivated || singleFieldProps.disabled}
44
46
  error={error}
45
47
  deleteError={deleteError}
48
+ theme={theme}
46
49
  />
47
50
  );
48
51
  })
@@ -52,7 +55,8 @@ const getInnerFields = (
52
55
  const getStructuredDataInnerFields = (
53
56
  innerFields: any[],
54
57
  content: any,
55
- updateValue: (value: Record<string, unknown>) => void
58
+ updateValue: (value: Record<string, unknown>) => void,
59
+ theme: string
56
60
  ) => {
57
61
  let fieldArr: any[] = [];
58
62
 
@@ -68,7 +72,7 @@ const getStructuredDataInnerFields = (
68
72
  const value = content && content[key];
69
73
 
70
74
  if (type === "ConditionalField" || type === "ArrayFieldGroup") {
71
- fieldArr = getStructuredDataInnerFields(fields, content, updateValue);
75
+ fieldArr = getStructuredDataInnerFields(fields, content, updateValue, theme);
72
76
  }
73
77
 
74
78
  const fieldProps = {
@@ -79,6 +83,7 @@ const getStructuredDataInnerFields = (
79
83
  field: singleFieldProps,
80
84
  onChange: handleChange,
81
85
  ...singleFieldProps,
86
+ theme,
82
87
  };
83
88
 
84
89
  return <FieldsBehavior key={key} {...fieldProps} />;
@@ -1,4 +1,4 @@
1
- const formatBytes = (bytes: number | null, decimals: number = 2) => {
1
+ const formatBytes = (bytes: number | null, decimals = 2) => {
2
2
  if (bytes === 0 || bytes === null) return "0 Bytes";
3
3
 
4
4
  const k = 1024;
@@ -19,7 +19,4 @@ const imageToBase64 = (file: any): Promise<string> => {
19
19
  });
20
20
  };
21
21
 
22
- export {
23
- formatBytes,
24
- imageToBase64
25
- };
22
+ export { formatBytes, imageToBase64 };
@@ -47,6 +47,9 @@ import {
47
47
  getSchemaType,
48
48
  getModuleCategories,
49
49
  getModuleStyles,
50
+ getDataPackSchema,
51
+ getSchemaThumbnails,
52
+ getTemplateThumbnails,
50
53
  } from "./schemas";
51
54
 
52
55
  import {
@@ -116,6 +119,8 @@ export {
116
119
  getDisplayName,
117
120
  getTemplateType,
118
121
  getTemplateDisplayName,
122
+ getSchemaThumbnails,
123
+ getTemplateThumbnails,
119
124
  filterByCategory,
120
125
  getStructuredDataFromPage,
121
126
  getCurrentPageStructuredData,
@@ -156,6 +161,7 @@ export {
156
161
  getFileExtension,
157
162
  moveArrayElement,
158
163
  isDevelopment,
164
+ getDataPackSchema,
159
165
  splitAndJoin,
160
166
  splitAndTrim,
161
167
  };
@@ -7,10 +7,21 @@ const allSChemas = { ...schemas.all, ...pageSchemas };
7
7
 
8
8
  const getSchema = (name: string) => allSChemas[name];
9
9
  const getDefaultSchema = (name: string) => allSChemas[name].default;
10
- const getSchemaThumbnails = (name: string) => allSChemas[name].thumbnails;
10
+
11
+ const getSchemaThumbnails = (name: string, theme?: string) =>
12
+ theme && allSChemas[name].thumbnails[theme] ? allSChemas[name].thumbnails[theme] : allSChemas[name].thumbnails;
13
+
11
14
  const getTemplate = (name: string) => schemas.templates[name];
15
+
12
16
  const getDefaultTemplate = (name: string) => schemas.templates[name].default;
13
- const getTemplateThumbnails = (name: string) => schemas.templates[name] && schemas.templates[name].thumbnails;
17
+
18
+ const getTemplateThumbnails = (name: string, theme?: string) =>
19
+ theme && schemas.templates[name].thumbnails[theme]
20
+ ? schemas.templates[name].thumbnails[theme]
21
+ : schemas.templates[name] && schemas.templates[name].thumbnails;
22
+
23
+ const getDataPackSchema = (name: string) => schemas.dataPacks[name];
24
+
14
25
  const getDisplayName = (component: string) => {
15
26
  const { displayName } = getSchema(component);
16
27
  return displayName;
@@ -87,4 +98,5 @@ export {
87
98
  filterByCategory,
88
99
  getModuleCategories,
89
100
  getModuleStyles,
101
+ getDataPackSchema,
90
102
  };
@@ -7,7 +7,7 @@ const imageExists = (src: string) => {
7
7
  return req.status !== 404;
8
8
  };
9
9
 
10
- const getThumbnailProps = (option: any, template: boolean, path?: string) => {
10
+ const getThumbnailProps = (option: any, template: boolean, theme: string, path?: string) => {
11
11
  let PATH = "";
12
12
  let thumbnails = {
13
13
  "1x": "",
@@ -20,9 +20,9 @@ const getThumbnailProps = (option: any, template: boolean, path?: string) => {
20
20
  thumbnails["2x"] = imageExists(PATH) ? `${PATH}thumbnail@2x.png` : "/img/placeholder/thumbnail@2x.png";
21
21
  } else {
22
22
  if (template) {
23
- thumbnails = getTemplateThumbnails(option);
23
+ thumbnails = getTemplateThumbnails(option, theme);
24
24
  } else {
25
- thumbnails = getSchemaThumbnails(option);
25
+ thumbnails = getSchemaThumbnails(option, theme);
26
26
  }
27
27
  }
28
28
 
@@ -2,7 +2,7 @@ import React from "react";
2
2
 
3
3
  import { IDimension } from "@ax/types";
4
4
  import { useModal } from "@ax/hooks";
5
- import { splitAndJoin, trimText } from "@ax/helpers";
5
+ import { splitAndJoin, splitCamelCase, trimText } from "@ax/helpers";
6
6
  import { Modal } from "@ax/components";
7
7
 
8
8
  import DimensionPanel from "../DimensionPanel";
@@ -38,7 +38,7 @@ const Item = (props: IProps): JSX.Element => {
38
38
  return (
39
39
  <>
40
40
  <S.Component onClick={handleClick}>
41
- <S.Name>{item.name}</S.Name><S.Values>{trimText(valuesText, 75)}</S.Values>
41
+ <S.Name>{splitCamelCase(item.name)}</S.Name><S.Values>{trimText(valuesText, 70)}</S.Values>
42
42
  <S.StyledActionMenu icon="more" options={dimensionOptions} tooltip="Dimension actions" />
43
43
  </S.Component>
44
44
  <DimensionPanel item={item} isOpen={isOpen} toggleModal={toggleModal} setDimensionItem={setDimensionItem} />