@griddo/ax 1.57.21 → 1.58.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 (137) hide show
  1. package/package.json +3 -3
  2. package/public/fonts/fonts.css +276 -1134
  3. package/src/Style/fonts.tsx +28 -1522
  4. package/src/Style/index.tsx +1 -2
  5. package/src/api/sites.tsx +7 -4
  6. package/src/api/structuredData.tsx +19 -0
  7. package/src/components/Browser/index.tsx +2 -2
  8. package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +11 -12
  9. package/src/components/Fields/ReferenceField/Context/index.tsx +46 -27
  10. package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +1 -1
  11. package/src/components/Fields/ReferenceField/ItemList/index.tsx +6 -6
  12. package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +9 -9
  13. package/src/components/Fields/ReferenceField/index.tsx +33 -36
  14. package/src/components/Fields/Select/style.tsx +0 -1
  15. package/src/components/Fields/UrlField/PageFinder/SelectionListItem/index.tsx +3 -1
  16. package/src/components/Fields/UrlField/PageFinder/index.tsx +73 -13
  17. package/src/components/Fields/UrlField/PageFinder/style.tsx +33 -1
  18. package/src/components/Fields/UrlField/index.tsx +6 -1
  19. package/src/components/MainWrapper/AppBar/style.tsx +1 -0
  20. package/src/components/SubNav/style.tsx +1 -1
  21. package/src/containers/StructuredData/actions.tsx +5 -2
  22. package/src/forms/validators.tsx +9 -10
  23. package/src/global.d.ts +2 -0
  24. package/src/hooks/forms.tsx +7 -0
  25. package/src/modules/App/Routing/NavMenu/style.tsx +0 -1
  26. package/src/modules/Content/ContentFilters/style.tsx +2 -2
  27. package/src/modules/Navigation/Defaults/Nav/style.tsx +2 -2
  28. package/src/modules/PageEditor/index.tsx +2 -5
  29. package/src/modules/Settings/ContentTypes/DataPacks/Nav/style.tsx +2 -2
  30. package/src/modules/StructuredData/StructuredDataList/ContentFilters/style.tsx +2 -2
  31. package/src/types/index.tsx +24 -0
  32. package/public/fonts/Montserrat-100-cyrillic-ext1.woff2 +0 -0
  33. package/public/fonts/Montserrat-100-cyrillic-ext46.woff2 +0 -0
  34. package/public/fonts/Montserrat-100-cyrillic2.woff2 +0 -0
  35. package/public/fonts/Montserrat-100-cyrillic47.woff2 +0 -0
  36. package/public/fonts/Montserrat-100-latin-ext4.woff2 +0 -0
  37. package/public/fonts/Montserrat-100-latin-ext49.woff2 +0 -0
  38. package/public/fonts/Montserrat-100-latin5.woff2 +0 -0
  39. package/public/fonts/Montserrat-100-latin50.woff2 +0 -0
  40. package/public/fonts/Montserrat-100-vietnamese3.woff2 +0 -0
  41. package/public/fonts/Montserrat-100-vietnamese48.woff2 +0 -0
  42. package/public/fonts/Montserrat-200-cyrillic-ext51.woff2 +0 -0
  43. package/public/fonts/Montserrat-200-cyrillic-ext6.woff2 +0 -0
  44. package/public/fonts/Montserrat-200-cyrillic52.woff2 +0 -0
  45. package/public/fonts/Montserrat-200-cyrillic7.woff2 +0 -0
  46. package/public/fonts/Montserrat-200-latin-ext54.woff2 +0 -0
  47. package/public/fonts/Montserrat-200-latin-ext9.woff2 +0 -0
  48. package/public/fonts/Montserrat-200-latin10.woff2 +0 -0
  49. package/public/fonts/Montserrat-200-latin55.woff2 +0 -0
  50. package/public/fonts/Montserrat-200-vietnamese53.woff2 +0 -0
  51. package/public/fonts/Montserrat-200-vietnamese8.woff2 +0 -0
  52. package/public/fonts/Montserrat-300-cyrillic-ext11.woff2 +0 -0
  53. package/public/fonts/Montserrat-300-cyrillic-ext56.woff2 +0 -0
  54. package/public/fonts/Montserrat-300-cyrillic12.woff2 +0 -0
  55. package/public/fonts/Montserrat-300-cyrillic57.woff2 +0 -0
  56. package/public/fonts/Montserrat-300-latin-ext14.woff2 +0 -0
  57. package/public/fonts/Montserrat-300-latin-ext59.woff2 +0 -0
  58. package/public/fonts/Montserrat-300-latin15.woff2 +0 -0
  59. package/public/fonts/Montserrat-300-latin60.woff2 +0 -0
  60. package/public/fonts/Montserrat-300-vietnamese13.woff2 +0 -0
  61. package/public/fonts/Montserrat-300-vietnamese58.woff2 +0 -0
  62. package/public/fonts/Montserrat-400-cyrillic-ext16.woff2 +0 -0
  63. package/public/fonts/Montserrat-400-cyrillic-ext61.woff2 +0 -0
  64. package/public/fonts/Montserrat-400-cyrillic17.woff2 +0 -0
  65. package/public/fonts/Montserrat-400-cyrillic62.woff2 +0 -0
  66. package/public/fonts/Montserrat-400-latin-ext19.woff2 +0 -0
  67. package/public/fonts/Montserrat-400-latin-ext64.woff2 +0 -0
  68. package/public/fonts/Montserrat-400-latin20.woff2 +0 -0
  69. package/public/fonts/Montserrat-400-latin65.woff2 +0 -0
  70. package/public/fonts/Montserrat-400-vietnamese18.woff2 +0 -0
  71. package/public/fonts/Montserrat-400-vietnamese63.woff2 +0 -0
  72. package/public/fonts/Montserrat-500-cyrillic-ext21.woff2 +0 -0
  73. package/public/fonts/Montserrat-500-cyrillic-ext66.woff2 +0 -0
  74. package/public/fonts/Montserrat-500-cyrillic22.woff2 +0 -0
  75. package/public/fonts/Montserrat-500-cyrillic67.woff2 +0 -0
  76. package/public/fonts/Montserrat-500-latin-ext24.woff2 +0 -0
  77. package/public/fonts/Montserrat-500-latin-ext69.woff2 +0 -0
  78. package/public/fonts/Montserrat-500-latin25.woff2 +0 -0
  79. package/public/fonts/Montserrat-500-latin70.woff2 +0 -0
  80. package/public/fonts/Montserrat-500-vietnamese23.woff2 +0 -0
  81. package/public/fonts/Montserrat-500-vietnamese68.woff2 +0 -0
  82. package/public/fonts/Montserrat-600-cyrillic-ext26.woff2 +0 -0
  83. package/public/fonts/Montserrat-600-cyrillic-ext71.woff2 +0 -0
  84. package/public/fonts/Montserrat-600-cyrillic27.woff2 +0 -0
  85. package/public/fonts/Montserrat-600-cyrillic72.woff2 +0 -0
  86. package/public/fonts/Montserrat-600-latin-ext29.woff2 +0 -0
  87. package/public/fonts/Montserrat-600-latin-ext74.woff2 +0 -0
  88. package/public/fonts/Montserrat-600-latin30.woff2 +0 -0
  89. package/public/fonts/Montserrat-600-latin75.woff2 +0 -0
  90. package/public/fonts/Montserrat-600-vietnamese28.woff2 +0 -0
  91. package/public/fonts/Montserrat-600-vietnamese73.woff2 +0 -0
  92. package/public/fonts/Montserrat-700-cyrillic-ext31.woff2 +0 -0
  93. package/public/fonts/Montserrat-700-cyrillic-ext76.woff2 +0 -0
  94. package/public/fonts/Montserrat-700-cyrillic32.woff2 +0 -0
  95. package/public/fonts/Montserrat-700-cyrillic77.woff2 +0 -0
  96. package/public/fonts/Montserrat-700-latin-ext34.woff2 +0 -0
  97. package/public/fonts/Montserrat-700-latin-ext79.woff2 +0 -0
  98. package/public/fonts/Montserrat-700-latin35.woff2 +0 -0
  99. package/public/fonts/Montserrat-700-latin80.woff2 +0 -0
  100. package/public/fonts/Montserrat-700-vietnamese33.woff2 +0 -0
  101. package/public/fonts/Montserrat-700-vietnamese78.woff2 +0 -0
  102. package/public/fonts/Montserrat-800-cyrillic-ext36.woff2 +0 -0
  103. package/public/fonts/Montserrat-800-cyrillic-ext81.woff2 +0 -0
  104. package/public/fonts/Montserrat-800-cyrillic37.woff2 +0 -0
  105. package/public/fonts/Montserrat-800-cyrillic82.woff2 +0 -0
  106. package/public/fonts/Montserrat-800-latin-ext39.woff2 +0 -0
  107. package/public/fonts/Montserrat-800-latin-ext84.woff2 +0 -0
  108. package/public/fonts/Montserrat-800-latin40.woff2 +0 -0
  109. package/public/fonts/Montserrat-800-latin85.woff2 +0 -0
  110. package/public/fonts/Montserrat-800-vietnamese38.woff2 +0 -0
  111. package/public/fonts/Montserrat-800-vietnamese83.woff2 +0 -0
  112. package/public/fonts/Montserrat-900-cyrillic-ext41.woff2 +0 -0
  113. package/public/fonts/Montserrat-900-cyrillic-ext86.woff2 +0 -0
  114. package/public/fonts/Montserrat-900-cyrillic42.woff2 +0 -0
  115. package/public/fonts/Montserrat-900-cyrillic87.woff2 +0 -0
  116. package/public/fonts/Montserrat-900-latin-ext44.woff2 +0 -0
  117. package/public/fonts/Montserrat-900-latin-ext89.woff2 +0 -0
  118. package/public/fonts/Montserrat-900-latin45.woff2 +0 -0
  119. package/public/fonts/Montserrat-900-latin90.woff2 +0 -0
  120. package/public/fonts/Montserrat-900-vietnamese43.woff2 +0 -0
  121. package/public/fonts/Montserrat-900-vietnamese88.woff2 +0 -0
  122. package/public/fonts/PT_Serif-400-cyrillic-ext91.woff2 +0 -0
  123. package/public/fonts/PT_Serif-400-cyrillic-ext99.woff2 +0 -0
  124. package/public/fonts/PT_Serif-400-cyrillic100.woff2 +0 -0
  125. package/public/fonts/PT_Serif-400-cyrillic92.woff2 +0 -0
  126. package/public/fonts/PT_Serif-400-latin-ext101.woff2 +0 -0
  127. package/public/fonts/PT_Serif-400-latin-ext93.woff2 +0 -0
  128. package/public/fonts/PT_Serif-400-latin102.woff2 +0 -0
  129. package/public/fonts/PT_Serif-400-latin94.woff2 +0 -0
  130. package/public/fonts/PT_Serif-700-cyrillic-ext103.woff2 +0 -0
  131. package/public/fonts/PT_Serif-700-cyrillic-ext95.woff2 +0 -0
  132. package/public/fonts/PT_Serif-700-cyrillic104.woff2 +0 -0
  133. package/public/fonts/PT_Serif-700-cyrillic96.woff2 +0 -0
  134. package/public/fonts/PT_Serif-700-latin-ext105.woff2 +0 -0
  135. package/public/fonts/PT_Serif-700-latin-ext97.woff2 +0 -0
  136. package/public/fonts/PT_Serif-700-latin106.woff2 +0 -0
  137. package/public/fonts/PT_Serif-700-latin98.woff2 +0 -0
@@ -1,18 +1,25 @@
1
1
  import React, { useState, useEffect } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IPage, IRootState } from "@ax/types";
4
+ import { IContentType, IGlobalLanguage, IPage, IRootState, ISite } from "@ax/types";
5
5
  import { useDebounce } from "@ax/hooks";
6
- import { isReqOk } from "@ax/helpers";
7
- import { sites } from "@ax/api";
8
- import { Loader, Pagination, TextField } from "@ax/components";
6
+ import { getStructuredDataTitle, isReqOk } from "@ax/helpers";
7
+ import { sites, structuredData } from "@ax/api";
8
+ import { Loader, Pagination, TextField, Select } from "@ax/components";
9
9
  import SelectionListItem from "./SelectionListItem";
10
10
 
11
11
  import * as S from "./style";
12
12
 
13
13
  const PageFinder = (props: IPageFinderProps): JSX.Element => {
14
- const { onClick, currentSiteID, isOpen } = props;
14
+ const { onClick, currentSiteID, isOpen, allSites, lang, globalLangs } = props;
15
+
16
+ const siteOptions = allSites.map((site) => ({ label: site.name, value: site.id.toString() }));
17
+ const langOptions = globalLangs.map((lang) => ({ label: lang.label, value: lang.id.toString() }));
18
+
15
19
  const initialState = {
20
+ site: currentSiteID || Number(siteOptions[0].value),
21
+ lang: lang.id,
22
+ type: "all",
16
23
  query: "",
17
24
  items: [],
18
25
  page: 1,
@@ -22,10 +29,16 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
22
29
  const [isLoading, setIsLoading] = useState(false);
23
30
  const debouncedSearch = useDebounce(state.query);
24
31
 
32
+ const allTypesOption = { label: "All content", value: "all" };
33
+ const [contentTypeOptions, setContentTypeOptions] = useState<{ label: string, value: string }[]>([{ ...allTypesOption }]);
34
+ const changeContentTypeOptions = (types: { label: string, value: string }[]) => setContentTypeOptions([allTypesOption, ...types]);
35
+
25
36
  const itemsPerPage = 50;
26
37
 
27
38
  const resetQuery = () => setState((state) => ({ ...state, query: "" }));
28
39
 
40
+ const changeState = (key: string, value: string | number) => setState((state) => ({ ...state, [key]: value }));
41
+
29
42
  useEffect(() => {
30
43
  if (!isOpen) resetQuery();
31
44
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -34,22 +47,24 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
34
47
  useEffect(() => {
35
48
  let isMounted = true;
36
49
  const params = {
37
- siteID: currentSiteID,
50
+ siteID: state.site,
38
51
  deleted: false,
39
52
  page: state.page,
40
53
  itemsPerPage,
41
54
  query: debouncedSearch,
55
+ lang: state.lang,
56
+ filterStructuredData: state.type,
42
57
  };
43
58
 
44
59
  const getAndSetItems = async () => {
45
60
  if (!isMounted) return;
46
61
 
47
62
  setIsLoading(true);
48
- const response: { status: number; data: { totalItems: number; items: any } } = await sites.getSitePagesLight(
63
+ const response: { status: number; data: { totalItems: number; items: any } } = await sites.getSitePages(
49
64
  params
50
65
  );
51
66
  if (isReqOk(response.status)) {
52
- setState({ ...state, items: response.data.items, totalItems: response.data.totalItems });
67
+ setState((state) => ({ ...state, items: response.data.items, totalItems: response.data.totalItems }));
53
68
  } else {
54
69
  console.log("Error en getAndSetItems");
55
70
  }
@@ -61,17 +76,30 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
61
76
  isMounted = false;
62
77
  };
63
78
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
- }, [currentSiteID, debouncedSearch, state.page]);
79
+ }, [currentSiteID, debouncedSearch, state.page, state.lang, state.site, state.type]);
80
+
81
+ const getAndSetContentTypes = async () => {
82
+ const { site, lang } = state;
83
+ const { data } = await structuredData.getContentTypes(site, lang);
84
+ const contentTypes = data.items.map((type: IContentType) => ({ label: type.title, value: type.id }));
85
+ changeContentTypeOptions(contentTypes);
86
+ changeState("type", "all");
87
+ }
88
+
89
+ useEffect(() => {
90
+ getAndSetContentTypes();
91
+ // eslint-disable-next-line react-hooks/exhaustive-deps
92
+ }, [state.site]);
65
93
 
66
94
  const textFieldProps = {
67
95
  value: state.query,
68
- onChange: (search: string) => setState({ ...state, query: search }),
96
+ onChange: (search: string) => changeState("query", search),
69
97
  placeholder: "Search",
70
98
  icon: "search",
71
99
  iconPosition: "in",
72
100
  };
73
101
 
74
- const setPage = (newPage: number) => setState({ ...state, page: newPage });
102
+ const setPage = (newPage: number) => changeState("page", newPage);
75
103
 
76
104
  const PageList =
77
105
  state.items &&
@@ -80,7 +108,7 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
80
108
  option={page}
81
109
  key={page.id}
82
110
  title={page.title}
83
- type="Page"
111
+ type={getStructuredDataTitle(page.structuredData)}
84
112
  date={page.modified}
85
113
  onClick={onClick}
86
114
  />
@@ -92,6 +120,32 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
92
120
 
93
121
  return (
94
122
  <S.Wrapper>
123
+ <S.LanguageSiteFilters>
124
+ <Select
125
+ name="select"
126
+ options={langOptions}
127
+ onChange={(value) => changeState("lang", value)}
128
+ value={state.lang.toString()}
129
+ type="inline"
130
+ />
131
+ <Select
132
+ name="select"
133
+ options={siteOptions}
134
+ onChange={(value) => changeState("site", value)}
135
+ value={state.site.toString()}
136
+ type="inline"
137
+ />
138
+ </S.LanguageSiteFilters>
139
+ <S.ContentTypeFilter>
140
+ <S.Text>Content type</S.Text>
141
+ <Select
142
+ name="select"
143
+ options={contentTypeOptions}
144
+ onChange={(value) => changeState("type", value)}
145
+ value={state.type}
146
+ mandatory
147
+ />
148
+ </ S.ContentTypeFilter>
95
149
  <S.SearchWrapper>
96
150
  {hasQuery ? (
97
151
  <TextField {...textFieldProps} onClickIcon={resetQuery} icon="close" />
@@ -99,7 +153,7 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
99
153
  <TextField {...textFieldProps} />
100
154
  )}
101
155
  </S.SearchWrapper>
102
- <S.Text>Most recent content</S.Text>
156
+ <S.LowText>Most recent content</S.LowText>
103
157
  {isLoading ? (
104
158
  <S.LoadingWrapper>
105
159
  <Loader name="circle" />
@@ -128,10 +182,16 @@ interface IPageFinderProps {
128
182
  onClick: (value: IPage) => void;
129
183
  currentSiteID: number;
130
184
  isOpen: boolean;
185
+ allSites: ISite[];
186
+ lang: { locale: string; id: number };
187
+ globalLangs: IGlobalLanguage[];
131
188
  }
132
189
 
133
190
  const mapStateToProps = (state: IRootState) => ({
134
191
  currentSiteID: state.sites.currentSiteInfo && state.sites.currentSiteInfo.id,
192
+ allSites: state.sites.sites,
193
+ lang: state.app.lang,
194
+ globalLangs: state.app.globalLangs,
135
195
  });
136
196
 
137
197
  export default connect(mapStateToProps)(PageFinder);
@@ -35,6 +35,12 @@ const LoadingWrapper = styled.div`
35
35
  `;
36
36
 
37
37
  const Text = styled.div`
38
+ ${(p) => p.theme.textStyle.uiS};
39
+ color: ${(p) => p.theme.color.textMediumEmphasis};
40
+ margin-bottom: ${(p) => p.theme.spacing.s};
41
+ `;
42
+
43
+ const LowText = styled.div`
38
44
  ${(p) => p.theme.textStyle.uiXS};
39
45
  color: ${(p) => p.theme.color.textLowEmphasis};
40
46
  margin-bottom: ${(p) => p.theme.spacing.s};
@@ -46,4 +52,30 @@ const PaginationWrapper = styled.div`
46
52
  margin-top: ${(p) => p.theme.spacing.s};
47
53
  `;
48
54
 
49
- export { Wrapper, ListWrapper, PageList, SearchWrapper, LoadingWrapper, Text, PaginationWrapper };
55
+ const LanguageSiteFilters = styled.div`
56
+ display: flex;
57
+ & > *:first-child {
58
+ margin-right: ${(p) => p.theme.spacing.s};
59
+ }
60
+ & > *:last-child {
61
+ flex-grow: 1;
62
+ }
63
+ `;
64
+
65
+ const ContentTypeFilter = styled.div`
66
+ margin-top: ${(p) => p.theme.spacing.xs};
67
+ margin-bottom: ${(p) => p.theme.spacing.s};
68
+ `;
69
+
70
+ export {
71
+ Wrapper,
72
+ ListWrapper,
73
+ PageList,
74
+ SearchWrapper,
75
+ LoadingWrapper,
76
+ Text,
77
+ LowText,
78
+ PaginationWrapper,
79
+ LanguageSiteFilters,
80
+ ContentTypeFilter,
81
+ };
@@ -25,7 +25,12 @@ const UrlField = (props: IUrlFieldProps): JSX.Element => {
25
25
  if (isReqOk(response.status)) {
26
26
  const { data } = response;
27
27
  setInternalPageName(data.title);
28
- if (!value?.title) handleTitleChange(data.title);
28
+
29
+ onChange({
30
+ ...value,
31
+ ...(!data.follow && { noFollow: true }),
32
+ ...(!value?.title && { title: data.title })
33
+ });
29
34
 
30
35
  const anchors: ISelectOption[] = findAnchorsFromPage(data);
31
36
  setAnchorOptions(anchors);
@@ -99,6 +99,7 @@ const Header = styled.section<{ inversed?: boolean }>`
99
99
  justify-content: space-between;
100
100
  padding-right: ${(p) => p.theme.spacing.s};
101
101
  border-bottom: ${(p) => `1px solid ${p.theme.color.uiLine}`};
102
+ border-left: 1px solid ${(p) => p.theme.color.uiLine};
102
103
 
103
104
  button:first-child {
104
105
  margin-left: ${(p) => p.theme.spacing.m};
@@ -4,7 +4,7 @@ const Wrapper = styled.div`
4
4
  height: calc(100vh - ${(p) => p.theme.spacing.xl});
5
5
  `;
6
6
 
7
- const SubNav = styled.ul`
7
+ const SubNav = styled.div`
8
8
  position: relative;
9
9
  width: calc(${(p) => p.theme.spacing.s} * 17);
10
10
  padding: ${(p) => p.theme.spacing.m};
@@ -96,12 +96,15 @@ function updateFormValue(valueObj: any): (dispatch: Dispatch, getState: any) =>
96
96
  function resetForm(): (dispatch: Dispatch, getState: any) => void {
97
97
  return (dispatch, getState) => {
98
98
  const {
99
- structuredData: { form },
99
+ structuredData: {
100
+ form,
101
+ currentStructuredData: { defaultValues },
102
+ },
100
103
  } = getState();
101
104
 
102
105
  form.content &&
103
106
  Object.keys(form.content).forEach((key: string) => {
104
- form.content[key] = "";
107
+ defaultValues && defaultValues[key] ? (form.content[key] = defaultValues[key]) : (form.content[key] = "");
105
108
  });
106
109
  const updatedForm = { content: form.content };
107
110
  dispatch(setEntity(null));
@@ -152,13 +152,12 @@ const getMandatoryFields = (fields: any[]): any[] => {
152
152
  if (field.mandatory) {
153
153
  mandatory.push(field);
154
154
  }
155
- const innerMandatories =
156
- field.fields &&
157
- field.fields.filter((innerField: any) => {
158
- return innerField.mandatory;
159
- });
160
- if (innerMandatories) {
161
- mandatory = [...mandatory, ...innerMandatories];
155
+
156
+ if (field.fields) {
157
+ const innerMandatories = getMandatoryFields(field.fields);
158
+ if (innerMandatories) {
159
+ mandatory = [...mandatory, ...innerMandatories];
160
+ }
162
161
  }
163
162
  });
164
163
  return mandatory;
@@ -170,9 +169,9 @@ const getMandatoryFieldsErrors = (content: any, current: any, name: string, tab:
170
169
 
171
170
  const conditionalKey = content.find((field: { type: string }) => field.type === "ConditionalField")?.key;
172
171
  if (conditionalKey) {
173
- mandatoryFields = getMandatoryFields(content).filter(
174
- (field) => field.condition === undefined || current[conditionalKey]
175
- );
172
+ mandatoryFields = getMandatoryFields(content).filter((field) => {
173
+ return field.condition === undefined || field.condition === current[conditionalKey];
174
+ });
176
175
  } else {
177
176
  mandatoryFields = getMandatoryFields(content);
178
177
  }
package/src/global.d.ts CHANGED
@@ -5,3 +5,5 @@ declare module "react-froala-wysiwyg";
5
5
  declare module "lodash.isequal";
6
6
  declare module "is-wsl";
7
7
  declare module "react-draft-wysiwyg";
8
+ declare module "history";
9
+ declare module "@griddo/core";
@@ -86,6 +86,7 @@ const useIsDirty = (
86
86
  ): { isDirty: boolean; setIsDirty(state: boolean): void; resetDirty: any } => {
87
87
  const [isDirty, setIsDirty] = useState(false);
88
88
  const [isSaved, setIsSaved] = useState(false);
89
+ const [isResetting, setIsResetting] = useState(false);
89
90
 
90
91
  const prevContent = usePrevious(updatedValues, isSaved);
91
92
 
@@ -105,9 +106,15 @@ const useIsDirty = (
105
106
  const resetDirty = () => {
106
107
  setIsDirty(false);
107
108
  setIsSaved(true);
109
+ setIsResetting(true);
108
110
  };
109
111
 
110
112
  useEffect(() => {
113
+ if (isResetting) {
114
+ setIsResetting(false);
115
+ return;
116
+ }
117
+
111
118
  if (isNew) {
112
119
  setIsDirty(true);
113
120
  } else if (prevContent && updatedValues) {
@@ -26,7 +26,6 @@ export const Home = styled.div<{ type: string; isSite: boolean; isOpened: boolea
26
26
  & + ul {
27
27
  margin-top: ${(p) => p.theme.spacing.s};
28
28
  }
29
- border-right: 1px solid ${(p) => p.theme.color.uiLine};
30
29
  cursor: ${(p) => (p.isSite ? "pointer" : "default")};
31
30
 
32
31
  &:hover {
@@ -1,6 +1,6 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const Heading = styled.li`
3
+ export const Heading = styled.div`
4
4
  ${p => p.theme.textStyle.headingXXS};
5
5
  color: ${p => p.theme.color.textLowEmphasis};
6
6
  margin-bottom: ${p => p.theme.spacing.xs};
@@ -11,7 +11,7 @@ export const Heading = styled.li`
11
11
  }
12
12
  `;
13
13
 
14
- export const SubItem = styled.li`
14
+ export const SubItem = styled.div`
15
15
  display: block;
16
16
  ${p => p.theme.textStyle.uiM};
17
17
  color: ${p => p.theme.color.textHighEmphasis};
@@ -1,6 +1,6 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const Heading = styled.li`
3
+ export const Heading = styled.div`
4
4
  ${p => p.theme.textStyle.headingXXS};
5
5
  margin-top: ${p => p.theme.spacing.m};
6
6
  margin-bottom: ${p => p.theme.spacing.xs};
@@ -11,7 +11,7 @@ export const Heading = styled.li`
11
11
  }
12
12
  `;
13
13
 
14
- export const SubItem = styled.li`
14
+ export const SubItem = styled.div`
15
15
  display: block;
16
16
  ${p => p.theme.textStyle.uiM};
17
17
  color: ${p => p.theme.color.textHighEmphasis};
@@ -264,11 +264,8 @@ const PageEditor = (props: IProps) => {
264
264
  const createDraft = isPublished && !hasDraft && !isGlobal;
265
265
  const status = props.pageStatus === pageStatus.PUBLISHED && !createDraft ? publishPage : undefined;
266
266
 
267
- await savePage(createDraft, status).then((isSaved: boolean) => {
268
- if (isSaved) {
269
- resetDirty();
270
- }
271
- });
267
+ const isSaved = await savePage(createDraft, status);
268
+ if (isSaved) resetDirty();
272
269
  };
273
270
 
274
271
  const goToPages = (path: string) => setRoute(path);
@@ -1,6 +1,6 @@
1
1
  import styled from "styled-components";
2
2
 
3
- const Heading = styled.li`
3
+ const Heading = styled.div`
4
4
  ${p => p.theme.textStyle.headingXXS};
5
5
  color: ${p => p.theme.color.textLowEmphasis};
6
6
  margin-bottom: ${p => p.theme.spacing.xs};
@@ -11,7 +11,7 @@ const Heading = styled.li`
11
11
  }
12
12
  `;
13
13
 
14
- const SubItem = styled.li`
14
+ const SubItem = styled.div`
15
15
  display: block;
16
16
  ${p => p.theme.textStyle.uiM};
17
17
  color: ${p => p.theme.color.textHighEmphasis};
@@ -1,6 +1,6 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const Heading = styled.li`
3
+ export const Heading = styled.div`
4
4
  ${p => p.theme.textStyle.headingXXS};
5
5
  color: ${p => p.theme.color.textLowEmphasis};
6
6
  margin-bottom: ${p => p.theme.spacing.xs};
@@ -11,7 +11,7 @@ export const Heading = styled.li`
11
11
  }
12
12
  `;
13
13
 
14
- export const SubItem = styled.li`
14
+ export const SubItem = styled.div`
15
15
  display: block;
16
16
  ${p => p.theme.textStyle.uiM};
17
17
  color: ${p => p.theme.color.textHighEmphasis};
@@ -263,6 +263,8 @@ export interface IGetSitePagesParams {
263
263
  itemsPerPage: number;
264
264
  langID?: number;
265
265
  query?: string;
266
+ lang?: number;
267
+ filterStructuredData?: string;
266
268
  }
267
269
 
268
270
  export interface IGetGlobalPagesParams {
@@ -632,6 +634,28 @@ export interface IImageForm {
632
634
  tags: string[];
633
635
  }
634
636
 
637
+ export interface IGlobalLanguage {
638
+ id: number;
639
+ locale: string;
640
+ language: string;
641
+ label: string;
642
+ isDefault: boolean;
643
+ }
644
+
645
+ export interface IContentType {
646
+ clone: any,
647
+ dataPacks: string[],
648
+ defaultValues: any,
649
+ editable: boolean,
650
+ fromPage: boolean,
651
+ id: string,
652
+ local: false
653
+ schema: any,
654
+ taxonomy: boolean,
655
+ title: string,
656
+ translate: boolean,
657
+ }
658
+
635
659
  export type Field =
636
660
  | "AsyncCheckGroup"
637
661
  | "AsyncSelect"