@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
@@ -0,0 +1,109 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import { connect } from "react-redux";
3
+
4
+ import { IAnalytics, IRootState } from "@ax/types";
5
+ import { appActions } from "@ax/containers/App";
6
+ import { analyticsActions } from "@ax/containers/Analytics";
7
+ import { MainWrapper, Loading } from "@ax/components";
8
+ import { useIsDirty } from "@ax/hooks";
9
+ import { RouteLeavingGuard } from "@ax/guards";
10
+
11
+ import { Dimensions, Groups, ScriptCode, Warning } from "./atoms";
12
+ import * as S from "./style";
13
+
14
+ const Analytics = (props: IProps): JSX.Element => {
15
+ const {
16
+ isSaving,
17
+ isLoading,
18
+ analytics,
19
+ getAnalytics,
20
+ setHistoryPush,
21
+ site,
22
+ updateScriptCode,
23
+ } = props;
24
+ const [showWarning, setShowWarning] = useState(false);
25
+ const [scriptCode, setScriptCode] = useState(analytics.scriptCode);
26
+ const { isDirty, resetDirty } = useIsDirty(scriptCode);
27
+
28
+ useEffect(() => {
29
+ site?.id && getAnalytics(site.id);
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ }, [site?.id]);
32
+
33
+ useEffect(() => {
34
+ setScriptCode(analytics.scriptCode);
35
+ setShowWarning(!analytics.siteScriptCodeExists);
36
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37
+ }, [analytics]);
38
+
39
+ const handleSave = async () => {
40
+ const isSaved = await updateScriptCode(scriptCode, site.id);
41
+ if (isSaved) resetDirty();
42
+ };
43
+
44
+ const rightButtonProps = {
45
+ label: isSaving ? "Saving" : "Save",
46
+ disabled: isSaving,
47
+ action: () => handleSave(),
48
+ };
49
+
50
+ const setRoute = (path: string) => setHistoryPush(path);
51
+ const modalText = (
52
+ <>
53
+ Analytics Script Code <strong>is not saved</strong>.{" "}
54
+ </>
55
+ );
56
+
57
+ const analyticsSettings = (
58
+ <S.ContentWrapper>
59
+ {showWarning ? (
60
+ <Warning setShowWarning={setShowWarning} />
61
+ ) : (
62
+ <S.AnalyticsWrapper>
63
+ <ScriptCode scriptCode={scriptCode} setScriptCode={setScriptCode} />
64
+ {analytics.dimensions && <Dimensions dimensions={analytics.dimensions} />}
65
+ {analytics.groups && <Groups groups={analytics.groups} />}
66
+ </S.AnalyticsWrapper>
67
+ )}
68
+ </S.ContentWrapper>
69
+ )
70
+
71
+ return (
72
+ <>
73
+ <RouteLeavingGuard when={isDirty} action={setRoute} text={modalText} />
74
+ <MainWrapper backLink={false} title="Analytics Settings" rightButton={rightButtonProps}>
75
+ {isLoading ? <Loading /> : analyticsSettings}
76
+ </MainWrapper>
77
+ </>
78
+ );
79
+ };
80
+
81
+ const mapStateToProps = (state: IRootState) => ({
82
+ isSaving: state.app.isSaving,
83
+ isLoading: state.app.isLoading,
84
+ analytics: state.analytics,
85
+ site: state.sites.currentSiteInfo,
86
+ });
87
+
88
+ const mapDispatchToProps = {
89
+ setHistoryPush: appActions.setHistoryPush,
90
+ getAnalytics: analyticsActions.getAnalytics,
91
+ updateScriptCode: analyticsActions.updateScriptCode,
92
+ };
93
+
94
+ interface IAnalyticsProps {
95
+ isSaving: boolean;
96
+ isLoading: boolean;
97
+ analytics: IAnalytics;
98
+ site: any;
99
+ }
100
+
101
+ interface IDispatchProps {
102
+ getAnalytics(siteId?: number): void;
103
+ setHistoryPush(path: string, isEditor?: boolean): void;
104
+ updateScriptCode(scriptCode: string, siteId: number): Promise<boolean>;
105
+ }
106
+
107
+ type IProps = IAnalyticsProps & IDispatchProps;
108
+
109
+ export default connect(mapStateToProps, mapDispatchToProps)(Analytics);
@@ -0,0 +1,107 @@
1
+ import styled from "styled-components";
2
+
3
+ const Heading = styled.div`
4
+ ${(p) => p.theme.textStyle.headingXS};
5
+ color: ${p => p.theme.color.textHighEmphasis};
6
+ padding-bottom: ${(p) => p.theme.spacing.xs};
7
+ `;
8
+
9
+ const Description = styled.div`
10
+ ${(p) => p.theme.textStyle.uiM};
11
+ color: ${(p) => p.theme.color.textMediumEmphasis};
12
+ margin-bottom: ${(p) => p.theme.spacing.s};
13
+
14
+ strong {
15
+ color: ${(p) => p.theme.color.interactive01};
16
+ }
17
+ `;
18
+
19
+ const WarningHeading = styled.div`
20
+ ${(p) => p.theme.textStyle.headingXXS};
21
+ color: ${p => p.theme.color.textMediumEmphasis};
22
+ padding-bottom: ${(p) => p.theme.spacing.xs};
23
+ `;
24
+
25
+ const WarningText = styled.div`
26
+ ${(p) => p.theme.textStyle.uiM};
27
+ color: ${(p) => p.theme.color.textHighEmphasis};
28
+ width: calc(${(p) => p.theme.spacing.l} * 12);
29
+ margin-bottom: ${(p) => p.theme.spacing.m};
30
+ `;
31
+
32
+ const ContentWrapper = styled.div`
33
+ height: 100%;
34
+ overflow: auto;
35
+ width: 100%;
36
+ padding: ${(p) => p.theme.spacing.m};
37
+ `;
38
+
39
+ const AnalyticsWrapper = styled.div`
40
+ width: 720px;
41
+ `;
42
+
43
+ const ScriptCodeWrapper = styled.div`
44
+ border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
45
+ margin-bottom: ${(p) => p.theme.spacing.m};
46
+ `;
47
+
48
+ const ComponentsWrapper = styled.div<{ itemsSize: number }>`
49
+ display: grid;
50
+ grid-template-columns: repeat(2, calc(100% * ${(p) => p.itemsSize}));
51
+ grid-gap: ${p => p.theme.spacing.xs} ${p => p.theme.spacing.xs};
52
+ border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
53
+ margin-bottom: ${(p) => p.theme.spacing.m};
54
+ padding-bottom: ${(p) => p.theme.spacing.m};
55
+ `;
56
+
57
+ const Component = styled.div`
58
+ width: 100%;
59
+ height: 100%;
60
+ background: ${(p) => p.theme.color.uiBackground02};
61
+ border: 1px solid ${(p) => p.theme.color.uiLine};
62
+ border-radius: ${(p) => p.theme.radii.s};
63
+ padding: ${(p) => p.theme.spacing.s};
64
+ display: flex;
65
+ flex-direction: column;
66
+ justify-content: space-between;
67
+ `;
68
+
69
+ const ComponentName = styled.div`
70
+ ${(p) => p.theme.textStyle.headingXXS};
71
+ color: ${p => p.theme.color.textLowEmphasis};
72
+ text-transform: uppercase;
73
+ margin-bottom: ${(p) => p.theme.spacing.xxs};
74
+ word-break: break-all;
75
+ `
76
+
77
+ const ComponentValues = styled.div`
78
+ ${(p) => p.theme.textStyle.fieldContent};
79
+ color: ${p => p.theme.color.textHighEmphasis};
80
+ padding-top: ${(p) => p.theme.spacing.xxs};
81
+ padding-bottom: ${(p) => p.theme.spacing.xxs};
82
+ `
83
+
84
+ const ContentType = styled.div`
85
+ ${(p) => p.theme.textStyle.uiS};
86
+ color: ${p => p.theme.color.textMediumEmphasis};
87
+ margin-top: ${(p) => p.theme.spacing.xxs};
88
+
89
+ span {
90
+ color: ${p => p.theme.color.interactive01};
91
+ }
92
+ `;
93
+
94
+ export {
95
+ Heading,
96
+ Description,
97
+ WarningHeading,
98
+ WarningText,
99
+ ContentWrapper,
100
+ ScriptCodeWrapper,
101
+ ComponentsWrapper,
102
+ Component,
103
+ ComponentName,
104
+ ComponentValues,
105
+ AnalyticsWrapper,
106
+ ContentType,
107
+ }
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IDataPack, IDataPackCategory, IRootState } from "@ax/types";
5
- import { sortBy } from "@ax/helpers";
4
+ import { IDataPack, IDataPackCategory, IRootState, ISite } from "@ax/types";
5
+ import { getDataPackSchema, sortBy } from "@ax/helpers";
6
6
  import { Icon, Loader } from "@ax/components";
7
7
 
8
8
  import { dataPacksActions } from "@ax/containers/Settings/DataPacks";
@@ -13,7 +13,7 @@ import SortFilter from "./SortFilter";
13
13
  import * as S from "./style";
14
14
 
15
15
  const AddModal = (props: IProps) => {
16
- const { toggleModal, getAvailableDataPacks, isLoading, available, addDataPacks, categories } = props;
16
+ const { toggleModal, getAvailableDataPacks, isLoading, available, addDataPacks, categories, currentSiteInfo } = props;
17
17
 
18
18
  const initialState: IState = {
19
19
  packsSelected: [],
@@ -78,11 +78,15 @@ const AddModal = (props: IProps) => {
78
78
  {items &&
79
79
  items.map((item: IDataPack, index: number) => {
80
80
  const isSelected = state.packsSelected.find((i: IDataPack) => i.id === item.id);
81
+ const schema = getDataPackSchema(item.id);
82
+ const { image } = schema;
83
+ const imageUrl = typeof image === "string" ? image : image[currentSiteInfo.theme];
84
+
81
85
  return (
82
86
  <S.GridItem key={item.title + index}>
83
87
  <S.PackWrapper onClick={_handleClick(item)} selected={!!isSelected}>
84
88
  <S.ImageWrapper>
85
- <img src={item.image} alt={item.title} />
89
+ <img src={imageUrl} alt={item.title} />
86
90
  </S.ImageWrapper>
87
91
  <S.Title>{item.title}</S.Title>
88
92
  <S.IconUnchecked>
@@ -113,6 +117,7 @@ interface IProps {
113
117
  isLoading: boolean;
114
118
  available: IDataPack[];
115
119
  categories: IDataPackCategory[];
120
+ currentSiteInfo: ISite;
116
121
  toggleModal: () => void;
117
122
  getAvailableDataPacks: (queryParams: string | null) => void;
118
123
  addDataPacks: (dataPackID: string, fromConfig?: boolean) => void;
@@ -122,6 +127,7 @@ const mapStateToProps = (state: IRootState) => ({
122
127
  available: state.dataPacks.available,
123
128
  categories: state.dataPacks.categories,
124
129
  isLoading: state.app.isLoading,
130
+ currentSiteInfo: state.sites.currentSiteInfo,
125
131
  });
126
132
 
127
133
  const mapDispatchToProps = {
@@ -1,14 +1,16 @@
1
1
  import React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IRootState } from "@ax/types";
4
+ import { IRootState, ISite } from "@ax/types";
5
+ import { getSchemaThumbnails, getTemplateThumbnails } from "@ax/helpers";
6
+
5
7
  import Card from "./Card";
6
8
  import Form from "./Form";
7
9
 
8
10
  import * as S from "./style";
9
11
 
10
- const Config = (props: any): JSX.Element => {
11
- const { selected } = props;
12
+ const ConfigPack = (props: any): JSX.Element => {
13
+ const { selected, currentSiteInfo } = props;
12
14
  const { title, description, categories, templates, modules, structuredData } = selected;
13
15
  const isFromPage = templates && templates.length > 0;
14
16
 
@@ -34,23 +36,29 @@ const Config = (props: any): JSX.Element => {
34
36
  </S.CardList>
35
37
  <S.CardList>
36
38
  {modules &&
37
- modules.map((module: any, key: number) => (
38
- <Card
39
- key={`${key}${module.title}`}
40
- title={"Module"}
41
- subtitle={module.title}
42
- thumbnail={module.thumbnails && module.thumbnails["2x"]}
43
- />
44
- ))}
39
+ modules.map((module: any, key: number) => {
40
+ const thumbnails = getSchemaThumbnails(module.id, currentSiteInfo.theme);
41
+ return (
42
+ <Card
43
+ key={`${key}${module.title}`}
44
+ title={"Module"}
45
+ subtitle={module.title}
46
+ thumbnail={thumbnails && thumbnails["2x"]}
47
+ />
48
+ );
49
+ })}
45
50
  {templates &&
46
- templates.map((template: any, key: number) => (
47
- <Card
48
- key={`${key}${template.title}`}
49
- title={"Template"}
50
- subtitle={template.title}
51
- thumbnail={template.thumbnails && template.thumbnails["2x"]}
52
- />
53
- ))}
51
+ templates.map((template: any, key: number) => {
52
+ const thumbnails = getTemplateThumbnails(template.id, currentSiteInfo.theme);
53
+ return (
54
+ <Card
55
+ key={`${key}${template.title}`}
56
+ title={"Template"}
57
+ subtitle={template.title}
58
+ thumbnail={thumbnails && thumbnails["2x"]}
59
+ />
60
+ );
61
+ })}
54
62
  </S.CardList>
55
63
  </S.Items>
56
64
  </S.Pack>
@@ -61,10 +69,12 @@ const Config = (props: any): JSX.Element => {
61
69
 
62
70
  interface IProps {
63
71
  selected: any;
72
+ currentSiteInfo: ISite;
64
73
  }
65
74
 
66
75
  const mapStateToProps = (state: IRootState) => ({
67
76
  selected: state.dataPacks.selected,
77
+ currentSiteInfo: state.sites.currentSiteInfo,
68
78
  });
69
79
 
70
- export default connect(mapStateToProps, null)(Config);
80
+ export default connect(mapStateToProps, null)(ConfigPack);
@@ -2,16 +2,17 @@ import React, { Dispatch, SetStateAction } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
4
  import { useModal } from "@ax/hooks";
5
+ import { getDataPackSchema } from "@ax/helpers";
5
6
  import { dataPacksActions } from "@ax/containers/Settings";
6
- import { IRootState } from "@ax/types";
7
+ import { IRootState, ISite } from "@ax/types";
7
8
  import { IconAction, InformativeMenu, Modal } from "@ax/components";
8
9
 
9
10
  import * as S from "./style";
10
11
 
11
12
  const Item = (props: IProps): JSX.Element => {
12
- const { getActivatedDataPack, pack, toggleToast, deleteSiteDataPack, setDeactivatedPack } = props;
13
+ const { getActivatedDataPack, pack, toggleToast, deleteSiteDataPack, setDeactivatedPack, currentSiteInfo } = props;
13
14
 
14
- const { image, title, id, templates, config } = pack;
15
+ const { title, id, templates, config } = pack;
15
16
  const isFromPage = templates && templates.length > 0;
16
17
  const { isOpen, toggleModal } = useModal();
17
18
 
@@ -76,11 +77,16 @@ const Item = (props: IProps): JSX.Element => {
76
77
 
77
78
  const setPack = () => getActivatedDataPack(pack.id);
78
79
 
80
+ const schema = getDataPackSchema(pack.id);
81
+ const { image } = schema;
82
+
83
+ const imageUrl = typeof image === "string" ? image : image[currentSiteInfo.theme];
84
+
79
85
  return (
80
86
  <>
81
87
  <DeleteModal />
82
88
  <S.Pack onClick={setPack}>
83
- <S.Thumbnail backgroundUrl={image} />
89
+ <S.Thumbnail backgroundUrl={imageUrl} />
84
90
  <S.Footer>
85
91
  <S.Title>{title}</S.Title>
86
92
  <S.IconsWrapper>
@@ -97,7 +103,7 @@ const Item = (props: IProps): JSX.Element => {
97
103
 
98
104
  interface IProps {
99
105
  pack: any;
100
- currentSiteID: number;
106
+ currentSiteInfo: ISite;
101
107
  getActivatedDataPack: (selected: string) => void;
102
108
  toggleToast: () => void;
103
109
  setDeactivatedPack: Dispatch<SetStateAction<string>>;
@@ -105,7 +111,7 @@ interface IProps {
105
111
  }
106
112
 
107
113
  const mapStateToProps = (state: IRootState) => ({
108
- currentSiteID: state.sites.currentSiteInfo && state.sites.currentSiteInfo.id,
114
+ currentSiteInfo: state.sites.currentSiteInfo,
109
115
  });
110
116
 
111
117
  const mapDispatchToProps = {
@@ -9,7 +9,7 @@ import { getStructuredDataInnerFields } from "@ax/forms";
9
9
  import * as S from "./style";
10
10
 
11
11
  const ConnectedField = (props: IProps) => {
12
- const { field, site, form, fieldKey, updateFormValue, disabled, errors, deleteError } = props;
12
+ const { field, site, form, fieldKey, updateFormValue, disabled, errors, deleteError, theme } = props;
13
13
 
14
14
  const value = form.content && form.content[fieldKey];
15
15
  const error = errors.find((err: any) => err.key === field.key);
@@ -22,7 +22,7 @@ const ConnectedField = (props: IProps) => {
22
22
  let innerFields: JSX.Element[] = [];
23
23
 
24
24
  if (isConditional || isArrayGroup) {
25
- innerFields = getStructuredDataInnerFields(field.fields, form.content, updateFormValue);
25
+ innerFields = getStructuredDataInnerFields(field.fields, form.content, updateFormValue, theme);
26
26
  }
27
27
 
28
28
  const fieldProps = {
@@ -36,6 +36,7 @@ const ConnectedField = (props: IProps) => {
36
36
  innerFields,
37
37
  error,
38
38
  deleteError,
39
+ theme,
39
40
  };
40
41
 
41
42
  return (
@@ -54,6 +55,7 @@ interface IProps {
54
55
  errors: IErrorItem[];
55
56
  updateFormValue: (value: any) => void;
56
57
  deleteError: (error: IErrorItem) => void;
58
+ theme: string;
57
59
  }
58
60
 
59
61
  const mapStateToProps = (state: IRootState) => ({
@@ -1,7 +1,8 @@
1
1
  import React, { useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IDataPack, IErrorItem, IRootState } from "@ax/types";
4
+ import { themes } from "components";
5
+ import { IDataPack, IErrorItem, IRootState, ISite } from "@ax/types";
5
6
  import { structuredDataActions } from "@ax/containers/StructuredData";
6
7
  import { MainWrapper, ErrorToast, Notification, Loading } from "@ax/components";
7
8
  import { getActivatedDataPacksIds } from "@ax/helpers";
@@ -51,6 +52,9 @@ const Form = (props: IProps) => {
51
52
 
52
53
  let title = "";
53
54
 
55
+ const defaultTheme = themes.find((theme: any) => theme.default);
56
+ const theme = defaultTheme ? defaultTheme.value : themes[0].value;
57
+
54
58
  const Fields =
55
59
  fields &&
56
60
  fields.map((field: any, i: number) => {
@@ -58,7 +62,16 @@ const Form = (props: IProps) => {
58
62
  if (key === "title") {
59
63
  title = form.content && form.content[key] ? form.content[key] : "";
60
64
  }
61
- return <ConnectedField fieldKey={key} field={field} key={`${type}${i}`} site={site} disabled={isDisabled} />;
65
+ return (
66
+ <ConnectedField
67
+ fieldKey={key}
68
+ field={field}
69
+ key={`${type}${i}`}
70
+ site={site}
71
+ disabled={isDisabled}
72
+ theme={site ? site.theme : theme}
73
+ />
74
+ );
62
75
  });
63
76
 
64
77
  const handleSave = async (publish?: boolean) => {
@@ -274,7 +287,7 @@ const Form = (props: IProps) => {
274
287
  interface IProps {
275
288
  schema: any;
276
289
  form: any;
277
- site: any;
290
+ site: ISite | null;
278
291
  currentStructuredData: any;
279
292
  isSaving: boolean;
280
293
  isLoading: boolean;
@@ -342,7 +342,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
342
342
  )}
343
343
  {!isAllPages && activeColumns.includes("site") && (
344
344
  <S.SiteCell role="cell">
345
- <ElementsTooltip elements={availableSiteNames} />
345
+ <ElementsTooltip elements={availableSiteNames} elementsPerRow={3} />
346
346
  </S.SiteCell>
347
347
  )}
348
348
  {activeColumns.includes("live") && (
@@ -1,4 +1,5 @@
1
1
  import React, { useReducer, useEffect } from "react";
2
+ import { themes } from "components";
2
3
 
3
4
  import { IStructuredDataFilter, IStructuredDataValue } from "@ax/types";
4
5
  import { getThumbnailProps } from "@ax/helpers";
@@ -48,8 +49,13 @@ const OptionTable = (props: IOptionTableProps): JSX.Element => {
48
49
  return columns.includes(optionValues[0]);
49
50
  };
50
51
 
52
+ const defaultTheme = themes.find((theme: any) => theme.default);
53
+ const theme = defaultTheme ? defaultTheme.value : themes[0].value;
54
+
51
55
  const thumbnailProps =
52
- state.showThumbnail && isOptionInType(filteredByTypeOptions) && getThumbnailProps(state.selectedOption, true);
56
+ state.showThumbnail &&
57
+ isOptionInType(filteredByTypeOptions) &&
58
+ getThumbnailProps(state.selectedOption, true, theme);
53
59
 
54
60
  const displayOptions = (item: IStructuredDataFilter) => {
55
61
  const { value } = item;
@@ -112,7 +112,8 @@ const StructuredDataList = (props: IProps): JSX.Element => {
112
112
  const { categoryColors, addCategoryColors } = useCategoryColors();
113
113
 
114
114
  const scope = currentSiteID ? "site" : "global";
115
- const isDataEditable = !currentStructuredData || currentStructuredData.editable;
115
+
116
+ const isDataEditable = filter === "all-pages" || !currentStructuredData || currentStructuredData.editable;
116
117
  const isDataTranslatable = currentStructuredData && currentStructuredData.translate;
117
118
  const isAllPages = filter === "all-pages";
118
119
  const isStructuredDataFromPage = !!currentStructuredData?.fromPage || isAllPages;
@@ -642,7 +643,6 @@ interface IDispatchProps {
642
643
  getAnalytics(): void;
643
644
  }
644
645
 
645
-
646
646
  interface ICategoriesProps {
647
647
  structuredData: { global: IStructuredData[]; site: IStructuredData[] };
648
648
  currentDataContent: IStructuredDataContent[];
@@ -8,6 +8,7 @@ import Settings from "./../modules/Settings";
8
8
  import CategoriesList from "./../modules/Categories/CategoriesList";
9
9
  import StructuredData from "./../modules/StructuredData";
10
10
  import SeoSettings from "./../modules/Settings/SeoSettings";
11
+ import Analytics from "./../modules/Settings/Analytics";
11
12
 
12
13
  const BASE_PATH = "/sites";
13
14
 
@@ -84,6 +85,11 @@ export default [
84
85
  component: SeoSettings,
85
86
  name: "SEO Settings",
86
87
  },
88
+ {
89
+ path: `${BASE_PATH}/settings/analytics`,
90
+ component: Analytics,
91
+ name: "Analytics",
92
+ },
87
93
  ],
88
94
  },
89
95
  ],
@@ -49,6 +49,7 @@ export default {
49
49
  title: "SEO Data",
50
50
  type: "FieldGroup",
51
51
  key: "seoData",
52
+ collapsed: true,
52
53
  fields: [
53
54
  {
54
55
  title: "Meta title",
@@ -129,13 +130,23 @@ export default {
129
130
  ],
130
131
  },
131
132
  {
132
- type: "AnalyticsField",
133
- key: "dimensions",
133
+ title: "Analytics Data Layer",
134
+ type: "FieldGroup",
135
+ key: "analytics",
136
+ collapsed: true,
137
+ fields: [
138
+ {
139
+ type: "AnalyticsField",
140
+ key: "dimensions",
141
+ collapsed: true,
142
+ }
143
+ ]
134
144
  },
135
145
  {
136
146
  title: "Social Media",
137
147
  type: "FieldGroup",
138
148
  key: "socialShare",
149
+ collapsed: true,
139
150
  fields: [
140
151
  {
141
152
  title: "Title",
@@ -57,6 +57,7 @@ export default {
57
57
  title: "SEO Data",
58
58
  type: "FieldGroup",
59
59
  key: "seoData",
60
+ collapsed: true,
60
61
  fields: [
61
62
  {
62
63
  title: "Meta title",
@@ -142,13 +143,23 @@ export default {
142
143
  ],
143
144
  },
144
145
  {
145
- type: "AnalyticsField",
146
- key: "dimensions",
146
+ title: "Analytics Data Layer",
147
+ type: "FieldGroup",
148
+ key: "analytics",
149
+ collapsed: true,
150
+ fields: [
151
+ {
152
+ type: "AnalyticsField",
153
+ key: "dimensions",
154
+ collapsed: true,
155
+ }
156
+ ]
147
157
  },
148
158
  {
149
159
  title: "Social Media",
150
160
  type: "FieldGroup",
151
161
  key: "socialShare",
162
+ collapsed: true,
152
163
  fields: [
153
164
  {
154
165
  title: "Title",
@@ -691,6 +691,7 @@ export interface IRedirect {
691
691
 
692
692
  export interface IAnalytics {
693
693
  scriptCode: string;
694
+ siteScriptCodeExists: boolean;
694
695
  dimensions: IDimension[];
695
696
  groups: IDimensionsGroup[];
696
697
  }