@griddo/ax 1.60.9 → 1.61.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 (147) hide show
  1. package/package.json +4 -2
  2. package/public/fonts/fonts.css +48 -660
  3. package/public/index.html +19 -16
  4. package/public/templates/template-redirects.csv +2 -0
  5. package/src/GlobalStore.tsx +3 -0
  6. package/src/Style/fonts.tsx +98 -72
  7. package/src/api/analytics.tsx +78 -0
  8. package/src/api/index.tsx +2 -0
  9. package/src/api/redirects.tsx +30 -2
  10. package/src/components/Button/style.tsx +1 -0
  11. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +1 -1
  12. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +4 -3
  13. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +6 -1
  14. package/src/components/FieldContainer/index.tsx +2 -2
  15. package/src/components/Fields/AnalyticsField/PageAnalytics/atoms.tsx +75 -0
  16. package/src/components/Fields/AnalyticsField/PageAnalytics/index.tsx +139 -0
  17. package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/atoms.tsx +77 -0
  18. package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/index.tsx +89 -0
  19. package/src/components/Fields/AnalyticsField/index.tsx +38 -0
  20. package/src/components/Fields/AnalyticsField/style.tsx +13 -0
  21. package/src/components/Fields/AnalyticsField/utils.tsx +13 -0
  22. package/src/components/Fields/FieldGroup/style.tsx +1 -1
  23. package/src/components/Fields/ImageField/index.tsx +1 -1
  24. package/src/components/Fields/MultiCheckSelect/index.tsx +23 -6
  25. package/src/components/Fields/MultiCheckSelect/style.tsx +1 -0
  26. package/src/components/Fields/NoteField/index.tsx +1 -1
  27. package/src/components/Fields/RadioGroup/index.tsx +4 -3
  28. package/src/components/Fields/RadioGroup/style.tsx +8 -3
  29. package/src/components/Fields/RichText/index.tsx +13 -8
  30. package/src/components/Fields/TextArea/index.tsx +1 -3
  31. package/src/components/Fields/TextArea/style.tsx +3 -3
  32. package/src/components/Fields/UrlField/style.tsx +1 -0
  33. package/src/components/Fields/index.tsx +2 -0
  34. package/src/components/Modal/index.tsx +1 -1
  35. package/src/components/Modal/style.tsx +5 -1
  36. package/src/components/Notification/style.tsx +2 -5
  37. package/src/components/TableFilters/LiveFilter/index.tsx +4 -0
  38. package/src/components/TableFilters/NameFilter/style.tsx +1 -0
  39. package/src/components/TableFilters/TypeFilter/index.tsx +7 -2
  40. package/src/containers/Analytics/actions.tsx +58 -0
  41. package/src/containers/Analytics/constants.tsx +5 -0
  42. package/src/containers/Analytics/index.tsx +4 -0
  43. package/src/containers/Analytics/interfaces.tsx +9 -0
  44. package/src/containers/Analytics/reducer.tsx +26 -0
  45. package/src/containers/PageEditor/actions.tsx +1 -0
  46. package/src/containers/Redirects/actions.tsx +49 -3
  47. package/src/containers/Redirects/constants.tsx +12 -1
  48. package/src/containers/Redirects/interfaces.tsx +11 -1
  49. package/src/containers/Redirects/reducer.tsx +12 -1
  50. package/src/containers/Sites/actions.tsx +3 -0
  51. package/src/global.d.ts +2 -0
  52. package/src/helpers/index.tsx +4 -0
  53. package/src/helpers/requests.tsx +12 -7
  54. package/src/helpers/strings.tsx +13 -0
  55. package/src/hooks/forms.tsx +1 -1
  56. package/src/modules/Analytics/DimensionItem/index.tsx +71 -0
  57. package/src/modules/Analytics/DimensionItem/style.tsx +59 -0
  58. package/src/modules/Analytics/DimensionPanel/index.tsx +110 -0
  59. package/src/modules/Analytics/DimensionPanel/style.tsx +14 -0
  60. package/src/modules/Analytics/GroupItem/index.tsx +75 -0
  61. package/src/modules/Analytics/GroupItem/style.tsx +80 -0
  62. package/src/modules/Analytics/GroupPanel/index.tsx +178 -0
  63. package/src/modules/Analytics/GroupPanel/style.tsx +67 -0
  64. package/src/modules/Analytics/GroupPanel/utils.tsx +29 -0
  65. package/src/modules/Analytics/index.tsx +207 -0
  66. package/src/modules/Analytics/style.tsx +68 -0
  67. package/src/modules/Content/BulkHeader/TableHeader/index.tsx +1 -1
  68. package/src/modules/Content/PageItem/index.tsx +3 -3
  69. package/src/modules/Content/PageItem/style.tsx +1 -1
  70. package/src/modules/Content/hooks.tsx +2 -2
  71. package/src/modules/Content/index.tsx +22 -20
  72. package/src/modules/GlobalEditor/index.tsx +1 -1
  73. package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +2 -2
  74. package/src/modules/PageEditor/index.tsx +1 -1
  75. package/src/modules/Redirects/RedirectItem/index.tsx +6 -2
  76. package/src/modules/Redirects/RedirectPanel/index.tsx +2 -0
  77. package/src/modules/Redirects/atoms.tsx +212 -0
  78. package/src/modules/Redirects/index.tsx +85 -27
  79. package/src/modules/Redirects/style.tsx +124 -3
  80. package/src/modules/Settings/ContentTypes/DataPacks/index.tsx +1 -1
  81. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +1 -1
  82. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +12 -3
  83. package/src/modules/StructuredData/StructuredDataList/index.tsx +17 -2
  84. package/src/routes/multisite.tsx +20 -2
  85. package/src/schemas/pages/GlobalPage.tsx +75 -64
  86. package/src/schemas/pages/Page.tsx +79 -67
  87. package/src/types/index.tsx +25 -3
  88. package/public/fonts/Source_Sans_Pro-200-cyrillic-ext107.woff2 +0 -0
  89. package/public/fonts/Source_Sans_Pro-200-cyrillic-ext149.woff2 +0 -0
  90. package/public/fonts/Source_Sans_Pro-200-cyrillic108.woff2 +0 -0
  91. package/public/fonts/Source_Sans_Pro-200-cyrillic150.woff2 +0 -0
  92. package/public/fonts/Source_Sans_Pro-200-greek-ext109.woff2 +0 -0
  93. package/public/fonts/Source_Sans_Pro-200-greek-ext151.woff2 +0 -0
  94. package/public/fonts/Source_Sans_Pro-200-greek110.woff2 +0 -0
  95. package/public/fonts/Source_Sans_Pro-200-greek152.woff2 +0 -0
  96. package/public/fonts/Source_Sans_Pro-200-vietnamese111.woff2 +0 -0
  97. package/public/fonts/Source_Sans_Pro-200-vietnamese153.woff2 +0 -0
  98. package/public/fonts/Source_Sans_Pro-300-cyrillic-ext114.woff2 +0 -0
  99. package/public/fonts/Source_Sans_Pro-300-cyrillic-ext156.woff2 +0 -0
  100. package/public/fonts/Source_Sans_Pro-300-cyrillic115.woff2 +0 -0
  101. package/public/fonts/Source_Sans_Pro-300-cyrillic157.woff2 +0 -0
  102. package/public/fonts/Source_Sans_Pro-300-greek-ext116.woff2 +0 -0
  103. package/public/fonts/Source_Sans_Pro-300-greek-ext158.woff2 +0 -0
  104. package/public/fonts/Source_Sans_Pro-300-greek117.woff2 +0 -0
  105. package/public/fonts/Source_Sans_Pro-300-greek159.woff2 +0 -0
  106. package/public/fonts/Source_Sans_Pro-300-vietnamese118.woff2 +0 -0
  107. package/public/fonts/Source_Sans_Pro-300-vietnamese160.woff2 +0 -0
  108. package/public/fonts/Source_Sans_Pro-400-cyrillic-ext121.woff2 +0 -0
  109. package/public/fonts/Source_Sans_Pro-400-cyrillic-ext163.woff2 +0 -0
  110. package/public/fonts/Source_Sans_Pro-400-cyrillic122.woff2 +0 -0
  111. package/public/fonts/Source_Sans_Pro-400-cyrillic164.woff2 +0 -0
  112. package/public/fonts/Source_Sans_Pro-400-greek-ext123.woff2 +0 -0
  113. package/public/fonts/Source_Sans_Pro-400-greek-ext165.woff2 +0 -0
  114. package/public/fonts/Source_Sans_Pro-400-greek124.woff2 +0 -0
  115. package/public/fonts/Source_Sans_Pro-400-greek166.woff2 +0 -0
  116. package/public/fonts/Source_Sans_Pro-400-vietnamese125.woff2 +0 -0
  117. package/public/fonts/Source_Sans_Pro-400-vietnamese167.woff2 +0 -0
  118. package/public/fonts/Source_Sans_Pro-600-cyrillic-ext128.woff2 +0 -0
  119. package/public/fonts/Source_Sans_Pro-600-cyrillic-ext170.woff2 +0 -0
  120. package/public/fonts/Source_Sans_Pro-600-cyrillic129.woff2 +0 -0
  121. package/public/fonts/Source_Sans_Pro-600-cyrillic171.woff2 +0 -0
  122. package/public/fonts/Source_Sans_Pro-600-greek-ext130.woff2 +0 -0
  123. package/public/fonts/Source_Sans_Pro-600-greek-ext172.woff2 +0 -0
  124. package/public/fonts/Source_Sans_Pro-600-greek131.woff2 +0 -0
  125. package/public/fonts/Source_Sans_Pro-600-greek173.woff2 +0 -0
  126. package/public/fonts/Source_Sans_Pro-600-vietnamese132.woff2 +0 -0
  127. package/public/fonts/Source_Sans_Pro-600-vietnamese174.woff2 +0 -0
  128. package/public/fonts/Source_Sans_Pro-700-cyrillic-ext135.woff2 +0 -0
  129. package/public/fonts/Source_Sans_Pro-700-cyrillic-ext177.woff2 +0 -0
  130. package/public/fonts/Source_Sans_Pro-700-cyrillic136.woff2 +0 -0
  131. package/public/fonts/Source_Sans_Pro-700-cyrillic178.woff2 +0 -0
  132. package/public/fonts/Source_Sans_Pro-700-greek-ext137.woff2 +0 -0
  133. package/public/fonts/Source_Sans_Pro-700-greek-ext179.woff2 +0 -0
  134. package/public/fonts/Source_Sans_Pro-700-greek138.woff2 +0 -0
  135. package/public/fonts/Source_Sans_Pro-700-greek180.woff2 +0 -0
  136. package/public/fonts/Source_Sans_Pro-700-vietnamese139.woff2 +0 -0
  137. package/public/fonts/Source_Sans_Pro-700-vietnamese181.woff2 +0 -0
  138. package/public/fonts/Source_Sans_Pro-900-cyrillic-ext142.woff2 +0 -0
  139. package/public/fonts/Source_Sans_Pro-900-cyrillic-ext184.woff2 +0 -0
  140. package/public/fonts/Source_Sans_Pro-900-cyrillic143.woff2 +0 -0
  141. package/public/fonts/Source_Sans_Pro-900-cyrillic185.woff2 +0 -0
  142. package/public/fonts/Source_Sans_Pro-900-greek-ext144.woff2 +0 -0
  143. package/public/fonts/Source_Sans_Pro-900-greek-ext186.woff2 +0 -0
  144. package/public/fonts/Source_Sans_Pro-900-greek145.woff2 +0 -0
  145. package/public/fonts/Source_Sans_Pro-900-greek187.woff2 +0 -0
  146. package/public/fonts/Source_Sans_Pro-900-vietnamese146.woff2 +0 -0
  147. package/public/fonts/Source_Sans_Pro-900-vietnamese188.woff2 +0 -0
@@ -75,7 +75,7 @@ const ImageField = (props: IImageFieldProps) => {
75
75
  <IconAction icon="delete" onClick={handleDelete} />
76
76
  </S.PreviewActions>
77
77
  </S.Preview>
78
- <Modal isOpen={isOpen} hide={toggleModal} size="L" title="Select image">
78
+ <Modal isOpen={isOpen} hide={toggleModal} size="XL" title="Select image">
79
79
  <Gallery getImageSelected={getImageSelected} toggleModal={toggleModal} site={site} />
80
80
  </Modal>
81
81
  </>
@@ -1,12 +1,12 @@
1
1
  import React, { useState, memo } from "react";
2
2
 
3
3
  import { ISite } from "@ax/types";
4
- import { AsyncCheckGroup } from "@ax/components";
4
+ import { AsyncCheckGroup, CheckGroup } from "@ax/components";
5
5
 
6
6
  import * as S from "./style";
7
7
 
8
8
  const MultiCheckSelect = (props: IProps) => {
9
- const { placeholder, source, value, onChange, site, className, mandatory } = props;
9
+ const { placeholder, source, value, onChange, site, className, mandatory, options, selectAllOption } = props;
10
10
 
11
11
  const [isOpen, setIsOpen] = useState(false);
12
12
 
@@ -21,7 +21,22 @@ const MultiCheckSelect = (props: IProps) => {
21
21
  </S.Field>
22
22
  {isOpen && (
23
23
  <S.DropDown>
24
- <AsyncCheckGroup source={source} site={site} value={value} onChange={onChange} fullHeight={true} />
24
+ {options && (
25
+ <CheckGroup
26
+ options={options}
27
+ value={value}
28
+ onChange={onChange}
29
+ selectAllOption={selectAllOption}
30
+ />
31
+ )}
32
+ {source && (
33
+ <AsyncCheckGroup
34
+ source={source}
35
+ site={site}
36
+ value={value}
37
+ onChange={onChange}
38
+ fullHeight={true} />
39
+ )}
25
40
  </S.DropDown>
26
41
  )}
27
42
  </S.Wrapper>
@@ -29,13 +44,15 @@ const MultiCheckSelect = (props: IProps) => {
29
44
  };
30
45
 
31
46
  interface IProps {
32
- value: any[];
33
- onChange: (value: string | string[]) => void;
47
+ value: (string | number)[];
48
+ onChange: (value: string | (string | number)[]) => void;
34
49
  site?: ISite | null;
35
50
  placeholder: string;
36
- source: string;
51
+ source?: string;
37
52
  className?: string;
38
53
  mandatory?: boolean;
54
+ options?: { name: string, value: string, title: string }[];
55
+ selectAllOption?: string;
39
56
  }
40
57
 
41
58
  export default memo(MultiCheckSelect);
@@ -49,6 +49,7 @@ const DropDown = styled.div`
49
49
  z-index: 2;
50
50
  max-height: 130px;
51
51
  overflow: auto;
52
+ position: absolute;
52
53
  `;
53
54
 
54
55
  const Asterisk = styled.span`
@@ -15,7 +15,7 @@ const NoteField = (props: INoteFieldProps): JSX.Element => {
15
15
  };
16
16
 
17
17
  export interface INoteFieldProps {
18
- value: { title?: string; text: string };
18
+ value: { title?: string; text: string | JSX.Element };
19
19
  className?: string;
20
20
  }
21
21
 
@@ -4,7 +4,7 @@ import RadioField, { IRadioFieldProps } from "../RadioField";
4
4
  import * as S from "./style";
5
5
 
6
6
  const RadioGroup = (props: IRadioGroupProps): JSX.Element => {
7
- const { value, name, options, onChange, disabled, optionsOnSelect } = props;
7
+ const { value, name, options, onChange, disabled, optionsOnSelect, inline } = props;
8
8
 
9
9
  const handleChange = (newValue: string) => {
10
10
  onChange(str2bool(newValue));
@@ -22,7 +22,7 @@ const RadioGroup = (props: IRadioGroupProps): JSX.Element => {
22
22
  ? options.map((item: IRadioFieldProps) => {
23
23
  const checked = value !== null && value !== undefined ? str2bool(value) === str2bool(item.value) : false;
24
24
  return (
25
- <S.RadioFieldWrapper key={item.name}>
25
+ <S.RadioFieldWrapper key={item.name} inline={inline}>
26
26
  <RadioField
27
27
  onChange={handleChange}
28
28
  checked={checked}
@@ -38,7 +38,7 @@ const RadioGroup = (props: IRadioGroupProps): JSX.Element => {
38
38
  })
39
39
  : null;
40
40
 
41
- return <S.FieldGroup>{radiosArray}</S.FieldGroup>;
41
+ return <S.FieldGroup inline={inline}>{radiosArray}</S.FieldGroup>;
42
42
  };
43
43
 
44
44
  interface IRadioGroupProps {
@@ -49,6 +49,7 @@ interface IRadioGroupProps {
49
49
  onChange: (value: string | boolean) => void;
50
50
  disabled?: boolean;
51
51
  optionsOnSelect?: React.ReactElement;
52
+ inline?: boolean;
52
53
  }
53
54
 
54
55
  export default RadioGroup;
@@ -1,13 +1,18 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const FieldGroup = styled.div`
3
+ export const FieldGroup = styled.div<{ inline?: boolean }>`
4
4
  width: 100%;
5
- margin-bottom: ${p => p.theme.spacing.xxs};
5
+ margin-bottom: ${(p) => p.inline ? 0 : p.theme.spacing.xxs};
6
+ display: ${(p) => p.inline ? "flex" : "block"};
6
7
  `;
7
8
 
8
- export const RadioFieldWrapper = styled.div`
9
+ export const RadioFieldWrapper = styled.div<{ inline?: boolean }>`
9
10
  display: flex;
10
11
 
12
+ &:not(:last-child) {
13
+ margin-right: ${(p) => p.inline ? p.theme.spacing.s : 0};
14
+ }
15
+
11
16
  & > :first-child {
12
17
  flex-grow: 2;
13
18
  }
@@ -1,24 +1,28 @@
1
1
  import React, { useState, useEffect, memo, useRef } from "react";
2
2
  import { Editor } from "react-draft-wysiwyg";
3
- import { EditorState, convertFromRaw, convertToRaw } from "draft-js";
3
+ import { EditorState, convertFromRaw, convertToRaw, ContentState } from "draft-js";
4
4
  import { markdownToDraft, draftToMarkdown } from "markdown-draft-js";
5
+ import draftToHtml from "draftjs-to-html";
6
+ import htmlToDraft from "html-to-draftjs";
5
7
  import { stateFromHTML } from "draft-js-import-html";
6
8
  import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
7
9
 
8
10
  import * as S from "./style";
9
11
 
10
12
  const RichText = (props: IRichTextProps): JSX.Element => {
11
- const { value, error, placeholder, onChange, disabled, editorID, handleValidation } = props;
13
+ const { value, error, placeholder, onChange, disabled, editorID, handleValidation, html = false } = props;
12
14
 
13
- const rawData = markdownToDraft(value);
14
- const contentState = convertFromRaw(rawData);
15
+ const rawData = html ? htmlToDraft(value) : markdownToDraft(value);
16
+ const { contentBlocks, entityMap } = rawData;
17
+ const contentState = html ? ContentState.createFromBlockArray(contentBlocks, entityMap) : convertFromRaw(rawData);
15
18
 
16
19
  const [editorState, setEditorState] = useState(() => EditorState.createWithContent(contentState));
17
20
  const timeOutRef = useRef<ReturnType<typeof setTimeout>>();
18
21
 
19
22
  useEffect(() => {
20
- const rawData = markdownToDraft(value);
21
- const contentState = convertFromRaw(rawData);
23
+ const rawData = html ? htmlToDraft(value) : markdownToDraft(value);
24
+ const { contentBlocks, entityMap } = rawData;
25
+ const contentState = html ? ContentState.createFromBlockArray(contentBlocks, entityMap) : convertFromRaw(rawData);
22
26
  setEditorState(EditorState.createWithContent(contentState));
23
27
  // eslint-disable-next-line react-hooks/exhaustive-deps
24
28
  }, [editorID]);
@@ -39,7 +43,7 @@ const RichText = (props: IRichTextProps): JSX.Element => {
39
43
  const content = editorState.getCurrentContent();
40
44
  const plainContent = content.getPlainText();
41
45
  const rawObject = convertToRaw(content);
42
- const markdownString = draftToMarkdown(rawObject);
46
+ const markdownString = html ? draftToHtml(rawObject) : draftToMarkdown(rawObject);
43
47
  onChange(markdownString);
44
48
  error && handleValidation && handleValidation(plainContent);
45
49
  };
@@ -48,7 +52,7 @@ const RichText = (props: IRichTextProps): JSX.Element => {
48
52
  const content = stateFromHTML(pastedValue);
49
53
  setEditorState(() => EditorState.createWithContent(content));
50
54
  const rawObject = convertToRaw(content);
51
- const markdownString = draftToMarkdown(rawObject);
55
+ const markdownString = html ? draftToHtml(rawObject) : draftToMarkdown(rawObject);
52
56
  onChange(markdownString);
53
57
  return false;
54
58
  };
@@ -110,6 +114,7 @@ interface IRichTextProps {
110
114
  disabled?: boolean;
111
115
  onChange: (value: string) => void;
112
116
  handleValidation?: (value: string) => void;
117
+ html: boolean;
113
118
  }
114
119
 
115
120
  export default memo(RichText);
@@ -33,8 +33,6 @@ const TextArea = (props: ITextAreaProps): JSX.Element => {
33
33
  handleValidation && handleValidation(e.target.value);
34
34
  };
35
35
 
36
- const errorString = error ? "true" : "false";
37
-
38
36
  return (
39
37
  <S.TextArea
40
38
  name={name}
@@ -44,7 +42,7 @@ const TextArea = (props: ITextAreaProps): JSX.Element => {
44
42
  onChange={handleOnChange}
45
43
  onBlur={handleOnBlur}
46
44
  placeholder={placeholder}
47
- error={errorString}
45
+ $error={error}
48
46
  disabled={disabled}
49
47
  />
50
48
  );
@@ -1,9 +1,9 @@
1
1
  import styled from "styled-components";
2
2
  import TextareaAutosize from "react-textarea-autosize";
3
3
 
4
- export const TextArea = styled(TextareaAutosize)<{ error: string }>`
4
+ export const TextArea = styled(TextareaAutosize) <{ $error: boolean | undefined }>`
5
5
  ${(p) => p.theme.textStyle.fieldContent};
6
- border: 1px solid ${(p) => (p.error === "true" ? p.theme.color.error : p.theme.color.uiLine)};
6
+ border: 1px solid ${p => (p.$error === true ? p.theme.color.error : p.theme.color.uiLine)};
7
7
  border-radius: 4px;
8
8
  background-color: ${(p) => p.theme.color.uiBackground02};
9
9
  color: ${(p) => p.theme.color.textHighEmphasis};
@@ -17,7 +17,7 @@ export const TextArea = styled(TextareaAutosize)<{ error: string }>`
17
17
  &:active,
18
18
  &:focus {
19
19
  outline: none;
20
- border-color: ${(p) => (p.error === "true" ? p.theme.color.error : p.theme.color.interactive01)};
20
+ border-color: ${(p) => (p.$error === true ? p.theme.color.error : p.theme.color.interactive01)};
21
21
  }
22
22
 
23
23
  &::placeholder {
@@ -10,6 +10,7 @@ const PageSelectedWrapper = styled.div`
10
10
  background-color: ${(p) => p.theme.color.overlayHoverPrimary};
11
11
  cursor: pointer;
12
12
  }
13
+ margin-bottom: ${(p) => p.theme.spacing.xxs};
13
14
  `;
14
15
 
15
16
  const PageField = styled.div`
@@ -1,3 +1,4 @@
1
+ import AnalyticsField from "./AnalyticsField";
1
2
  import ArrayFieldGroup from "./ArrayFieldGroup";
2
3
  import AsyncCheckGroup from "./AsyncCheckGroup";
3
4
  import AsyncSelect from "./AsyncSelect";
@@ -35,6 +36,7 @@ import VisualUniqueSelection from "./VisualUniqueSelection";
35
36
  import Wysiwyg from "./Wysiwyg";
36
37
 
37
38
  export {
39
+ AnalyticsField,
38
40
  ArrayFieldGroup,
39
41
  AsyncCheckGroup,
40
42
  AsyncSelect,
@@ -63,7 +63,7 @@ interface IModalProps {
63
63
  hide: any;
64
64
  children: any;
65
65
  title?: string;
66
- size?: "S" | "M" | "L";
66
+ size?: "S" | "M" | "L" | "XL";
67
67
  mainAction?: IAction;
68
68
  secondaryAction?: IAction;
69
69
  }
@@ -5,6 +5,8 @@ const getWidth = (size: string | undefined) => {
5
5
  case "M":
6
6
  return "640px";
7
7
  case "L":
8
+ return "896px";
9
+ case "XL":
8
10
  return "1088px";
9
11
  default:
10
12
  return "512px";
@@ -16,6 +18,8 @@ const getHeight = (size: string | undefined) => {
16
18
  case "M":
17
19
  return "384px";
18
20
  case "L":
21
+ return "512px";
22
+ case "XL":
19
23
  return "640px";
20
24
  default:
21
25
  return "320px";
@@ -89,7 +93,7 @@ export const ModalFooter = styled.div`
89
93
  background: ${(p) => p.theme.color.uiBackground01};
90
94
  display: flex;
91
95
  justify-content: flex-end;
92
- padding: ${(p) => `0 ${p.theme.spacing.m} ${p.theme.spacing.m} ${p.theme.spacing.m}`};
96
+ padding: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.m} ${p.theme.spacing.m} ${p.theme.spacing.m}`};
93
97
  button:not(:first-child) {
94
98
  margin-left: ${(p) => p.theme.spacing.s};
95
99
  }
@@ -26,11 +26,10 @@ const Wrapper = styled.div<{ isOpen: boolean }>`
26
26
 
27
27
  const Row = styled.div`
28
28
  display: flex;
29
- align-items: flex-start;
29
+ align-items: center;
30
30
  width: 100%;
31
31
  min-height: ${(p) => p.theme.spacing.l};
32
32
  z-index: 2;
33
- padding-top: ${(p) => p.theme.spacing.s};
34
33
 
35
34
  svg {
36
35
  width: ${(p) => p.theme.spacing.m};
@@ -46,9 +45,7 @@ const IconWrapper = styled.span`
46
45
  height: 24px;
47
46
  `;
48
47
 
49
- const Text = styled.span`
50
- padding-bottom: ${(p) => p.theme.spacing.s};
51
- `;
48
+ const Text = styled.span``;
52
49
 
53
50
  const ActionsWrapper = styled.div`
54
51
  display: flex;
@@ -26,6 +26,10 @@ const LiveFilter = (props: ILiveFilterProps): JSX.Element => {
26
26
  const [options, setOptions] = useState(filters);
27
27
  const structuredDataStatus = ["offline", "active"];
28
28
 
29
+ useEffect(() => {
30
+ setSelectedValue([value]);
31
+ }, [value]);
32
+
29
33
  const getLiveStatusValues = async () => {
30
34
  try {
31
35
  const items = await checkgroups.getLiveStatusItems();
@@ -3,6 +3,7 @@ import { Header } from "@ax/components/TableList/style";
3
3
 
4
4
  const NameHeader = styled(Header)<{ isActive: boolean }>`
5
5
  width: 100%;
6
+ min-width: 88px;
6
7
  &:hover {
7
8
  color: ${(p) => p.theme.color.interactive01};
8
9
  }
@@ -1,16 +1,20 @@
1
- import React, { useState } from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import { CheckGroup, FloatingMenu, Icon, ListTitle } from "@ax/components";
3
3
  import { areEquals } from "@ax/helpers";
4
4
 
5
5
  import * as S from "./style";
6
6
 
7
7
  const TypeFilter = (props: ITypeFilterProps): JSX.Element => {
8
- const { filterItems, filters, pointer } = props;
8
+ const { filterItems, filters, pointer, value } = props;
9
9
 
10
10
  const initialState = ["all"];
11
11
  const selectAllOption = "all";
12
12
  const [selectedValue, setSelectedValue] = useState(initialState);
13
13
 
14
+ useEffect(() => {
15
+ setSelectedValue([value]);
16
+ }, [value]);
17
+
14
18
  const setFilterQuery = (selection: any) => {
15
19
  if (!selection.length) {
16
20
  selection = initialState;
@@ -57,6 +61,7 @@ interface ITypeFilterProps {
57
61
  filterItems(pointer: string, filter: string): void;
58
62
  filters: IFilter[];
59
63
  pointer: string;
64
+ value: any;
60
65
  }
61
66
 
62
67
  export default TypeFilter;
@@ -0,0 +1,58 @@
1
+ import { analytics } from "@ax/api";
2
+ import { appActions } from "@ax/containers/App";
3
+ import { handleRequest } from "@ax/helpers";
4
+ import { IAnalytics } from "@ax/types";
5
+ import { SET_ANALYTICS } from "./constants";
6
+ import { ISetAnalytics } from "./interfaces";
7
+
8
+ function setAnalytics(analytics: IAnalytics): ISetAnalytics {
9
+ return { type: SET_ANALYTICS, payload: analytics };
10
+ }
11
+
12
+ function getAnalytics(siteId: number | string = "global"): (dispatch: any) => Promise<void> {
13
+ return async (dispatch) => {
14
+ try {
15
+ const callback = async () => analytics.getAnalytics(siteId);
16
+
17
+ const responseActions = {
18
+ handleSuccess: (response: any) => {
19
+ dispatch(setAnalytics(response));
20
+ },
21
+ handleError: (response: any) => appActions.handleError(response)(dispatch),
22
+ };
23
+
24
+ await handleRequest(callback, responseActions, [appActions.setIsLoading])(dispatch);
25
+ } catch (e) {
26
+ console.log(e);
27
+ }
28
+ };
29
+ }
30
+
31
+ function updateAnalytics(analyticsState: IAnalytics, siteId: number | string = "global"): (dispatch: any) => Promise<boolean> {
32
+ return async (dispatch) => {
33
+ try {
34
+ const { scriptCode, dimensions, groups } = analyticsState;
35
+ const callback = async () => {
36
+ const promises = [];
37
+ promises.push(analytics.updateScriptCode(siteId, { scriptCode }));
38
+ promises.push(analytics.createDimensions(siteId, { dimensions }));
39
+ promises.push(analytics.createDimensionsGroups(siteId, { groups }));
40
+ return Promise.all(promises);
41
+ }
42
+
43
+ const responseActions = {
44
+ handleSuccess: () => {
45
+ dispatch(getAnalytics());
46
+ },
47
+ handleError: (response: any) => appActions.handleError(response)(dispatch),
48
+ };
49
+
50
+ return await handleRequest(callback, responseActions, [appActions.setIsSaving])(dispatch);
51
+ } catch (e) {
52
+ console.log(e);
53
+ return false;
54
+ }
55
+ };
56
+ }
57
+
58
+ export { getAnalytics, updateAnalytics };
@@ -0,0 +1,5 @@
1
+ const NAME = "analytics";
2
+
3
+ const SET_ANALYTICS = `${NAME}/SET_ANALYTICS`;
4
+
5
+ export { NAME, SET_ANALYTICS };
@@ -0,0 +1,4 @@
1
+ import * as analyticsActions from "./actions";
2
+ import { analyticsReducer } from "./reducer";
3
+
4
+ export { analyticsActions, analyticsReducer };
@@ -0,0 +1,9 @@
1
+ import { IAnalytics } from "@ax/types";
2
+ import { SET_ANALYTICS } from "./constants";
3
+
4
+ export interface ISetAnalytics {
5
+ type: typeof SET_ANALYTICS;
6
+ payload: IAnalytics;
7
+ }
8
+
9
+ export type AnalyticsActionsCreators = ISetAnalytics;
@@ -0,0 +1,26 @@
1
+ import { IDimension, IDimensionsGroup } from "@ax/types";
2
+ import { SET_ANALYTICS } from "./constants";
3
+ import { AnalyticsActionsCreators } from "./interfaces";
4
+
5
+ export interface IAnalyticsState {
6
+ scriptCode: string;
7
+ dimensions: IDimension[];
8
+ groups: IDimensionsGroup[];
9
+ }
10
+
11
+ export const initialState = {
12
+ scriptCode: "",
13
+ dimensions: [],
14
+ groups: [],
15
+ };
16
+
17
+ export function reducer(state = initialState, action: AnalyticsActionsCreators): IAnalyticsState {
18
+ switch (action.type) {
19
+ case SET_ANALYTICS:
20
+ return { ...state, ...action.payload };
21
+ default:
22
+ return state;
23
+ }
24
+ }
25
+
26
+ export { initialState as analyticsInitialState, reducer as analyticsReducer };
@@ -269,6 +269,7 @@ function getPage(pageID?: number, global?: boolean): (dispatch: Dispatch, getSta
269
269
  dispatch(setTemplateConfig(page.templateConfig));
270
270
  dispatch(setUserEditing(page.editing));
271
271
  dispatch(setCurrentPageStatus(pageLiveStatus));
272
+ addTemplate(page.templateId)(dispatch);
272
273
  }
273
274
  } else {
274
275
  if (!isNewTranslation) {
@@ -1,8 +1,15 @@
1
1
  import { redirects } from "@ax/api";
2
2
  import { appActions } from "@ax/containers/App";
3
3
  import { handleRequest } from "@ax/helpers";
4
- import { DEFAULT_PARAMS, ERROR_CODE, SET_REDIRECTS, SET_TOTAL_ITEMS } from "./constants";
5
- import { ISetRedirects, ISetTotalItems } from "./interfaces";
4
+ import {
5
+ DEFAULT_PARAMS,
6
+ ERROR_CODE,
7
+ SET_IMPORTS,
8
+ SET_REDIRECTS,
9
+ SET_TOTAL_IMPORTS,
10
+ SET_TOTAL_ITEMS,
11
+ } from "./constants";
12
+ import { ISetImports, ISetRedirects, ISetTotalImports, ISetTotalItems } from "./interfaces";
6
13
 
7
14
  function setRedirects(redirects: any[]): ISetRedirects {
8
15
  return { type: SET_REDIRECTS, payload: { redirects } };
@@ -12,6 +19,14 @@ function setTotalItems(totalItems: number): ISetTotalItems {
12
19
  return { type: SET_TOTAL_ITEMS, payload: { totalItems } };
13
20
  }
14
21
 
22
+ function setImports(imports: any): ISetImports {
23
+ return { type: SET_IMPORTS, payload: { imports } };
24
+ }
25
+
26
+ function setTotalImports(totalImports: number): ISetTotalImports {
27
+ return { type: SET_TOTAL_IMPORTS, payload: { totalImports } };
28
+ }
29
+
15
30
  function getRedirects(params: any, filters?: string): (dispatch: any) => Promise<void> {
16
31
  return async (dispatch) => {
17
32
  try {
@@ -126,4 +141,35 @@ function deleteRedirect(
126
141
  };
127
142
  }
128
143
 
129
- export { getRedirects, addRedirect, updateRedirect, deleteRedirect };
144
+ function importRedirects(
145
+ redirect: { from: string; to: string | number }[],
146
+ check: boolean
147
+ ): (dispatch: any) => Promise<boolean> {
148
+ return async (dispatch) => {
149
+ try {
150
+ const callback = async () =>
151
+ check ? redirects.createRedirectsBulkCheck(redirect) : redirects.createRedirectsBulk(redirect);
152
+
153
+ const responseActions = {
154
+ handleSuccess: (response: any) => {
155
+ if (check) {
156
+ const { total, error, existing, ok } = response;
157
+ dispatch(setImports({ error, existing, ok }));
158
+ dispatch(setTotalImports(total));
159
+ } else {
160
+ const params = { ...DEFAULT_PARAMS };
161
+ dispatch(getRedirects(params));
162
+ }
163
+ },
164
+ handleError: (response: any) => appActions.handleError(response)(dispatch),
165
+ };
166
+
167
+ return await handleRequest(callback, responseActions, [])(dispatch);
168
+ } catch (e) {
169
+ console.log(e);
170
+ return false;
171
+ }
172
+ };
173
+ }
174
+
175
+ export { getRedirects, addRedirect, updateRedirect, deleteRedirect, importRedirects };
@@ -2,6 +2,8 @@ const NAME = "redirects";
2
2
 
3
3
  const SET_REDIRECTS = `${NAME}/SET_REDIRECTS`;
4
4
  const SET_TOTAL_ITEMS = `${NAME}/SET_TOTAL_ITEMS`;
5
+ const SET_TOTAL_IMPORTS = `${NAME}/SET_TOTAL_IMPORTS`;
6
+ const SET_IMPORTS = `${NAME}/SET_IMPORTS`;
5
7
 
6
8
  const ITEMS_PER_PAGE = 50;
7
9
 
@@ -15,4 +17,13 @@ const ERROR_CODE = {
15
17
  isBeingUsed: 409,
16
18
  };
17
19
 
18
- export { NAME, SET_REDIRECTS, SET_TOTAL_ITEMS, ERROR_CODE, DEFAULT_PARAMS, ITEMS_PER_PAGE };
20
+ export {
21
+ NAME,
22
+ SET_REDIRECTS,
23
+ SET_TOTAL_ITEMS,
24
+ ERROR_CODE,
25
+ DEFAULT_PARAMS,
26
+ ITEMS_PER_PAGE,
27
+ SET_IMPORTS,
28
+ SET_TOTAL_IMPORTS,
29
+ };
@@ -1,4 +1,4 @@
1
- import { SET_REDIRECTS, SET_TOTAL_ITEMS } from "./constants";
1
+ import { SET_IMPORTS, SET_REDIRECTS, SET_TOTAL_IMPORTS, SET_TOTAL_ITEMS } from "./constants";
2
2
 
3
3
  export interface ISetRedirects {
4
4
  type: typeof SET_REDIRECTS;
@@ -10,4 +10,14 @@ export interface ISetTotalItems {
10
10
  payload: { totalItems: number };
11
11
  }
12
12
 
13
+ export interface ISetImports {
14
+ type: typeof SET_IMPORTS;
15
+ payload: { imports: any };
16
+ }
17
+
18
+ export interface ISetTotalImports {
19
+ type: typeof SET_TOTAL_IMPORTS;
20
+ payload: { totalImports: number };
21
+ }
22
+
13
23
  export type RedirectsActionsCreators = ISetRedirects;
@@ -1,20 +1,31 @@
1
- import { SET_REDIRECTS, SET_TOTAL_ITEMS } from "./constants";
1
+ import { IRedirect } from "@ax/types";
2
+ import { SET_IMPORTS, SET_REDIRECTS, SET_TOTAL_IMPORTS, SET_TOTAL_ITEMS } from "./constants";
2
3
  import { RedirectsActionsCreators } from "./interfaces";
3
4
 
4
5
  export interface IRedirectsState {
5
6
  redirects: any[];
6
7
  totalItems: number;
8
+ totalImports: number;
9
+ imports: null | {
10
+ error: IRedirect[];
11
+ existing: IRedirect[];
12
+ ok: IRedirect[];
13
+ };
7
14
  }
8
15
 
9
16
  export const initialState = {
10
17
  redirects: [],
11
18
  totalItems: 0,
19
+ totalImports: 0,
20
+ imports: null,
12
21
  };
13
22
 
14
23
  export function reducer(state = initialState, action: RedirectsActionsCreators): IRedirectsState {
15
24
  switch (action.type) {
16
25
  case SET_REDIRECTS:
17
26
  case SET_TOTAL_ITEMS:
27
+ case SET_IMPORTS:
28
+ case SET_TOTAL_IMPORTS:
18
29
  return { ...state, ...action.payload };
19
30
  default:
20
31
  return state;