@griddo/ax 1.75.235 → 1.75.236

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "1.75.235",
4
+ "version": "1.75.236",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -230,5 +230,5 @@
230
230
  "publishConfig": {
231
231
  "access": "public"
232
232
  },
233
- "gitHead": "3ea759bf34b590c02b27b8cf2b66ab29933ceb31"
233
+ "gitHead": "2f37300231c7a06193cac411e84898c2f34d3c2f"
234
234
  }
@@ -21,6 +21,7 @@ describe("Category filter component rendering", () => {
21
21
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: string]>;
22
22
  defaultProps.filterItems = filterItemsMock;
23
23
  defaultProps.value = "all";
24
+ defaultProps.siteID = null;
24
25
  defaultProps.structuredData = {
25
26
  from: "profile",
26
27
  indexable: true,
@@ -61,6 +62,7 @@ describe("Category filter component rendering", () => {
61
62
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: string]>;
62
63
  defaultProps.filterItems = filterItemsMock;
63
64
  defaultProps.value = "all";
65
+ defaultProps.siteID = null;
64
66
  defaultProps.structuredData = {
65
67
  from: "profile",
66
68
  indexable: true,
@@ -104,6 +106,7 @@ describe("CategoryFilter events", () => {
104
106
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: string]>;
105
107
  defaultProps.filterItems = filterItemsMock;
106
108
  defaultProps.value = "all";
109
+ defaultProps.siteID = null;
107
110
  defaultProps.structuredData = {
108
111
  from: "profile",
109
112
  indexable: true,
@@ -150,6 +153,7 @@ describe("CategoryFilter events", () => {
150
153
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: string]>;
151
154
  defaultProps.filterItems = filterItemsMock;
152
155
  defaultProps.value = "all";
156
+ defaultProps.siteID = null;
153
157
  defaultProps.structuredData = {
154
158
  from: "profile",
155
159
  indexable: true,
@@ -198,6 +202,7 @@ describe("CategoryFilter events", () => {
198
202
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: string]>;
199
203
  defaultProps.filterItems = filterItemsMock;
200
204
  defaultProps.value = "all";
205
+ defaultProps.siteID = null;
201
206
  defaultProps.structuredData = {
202
207
  from: "profile",
203
208
  indexable: true,
@@ -18,7 +18,7 @@ const CategoryCell = (props: ICategoryCellProps): JSX.Element => {
18
18
  };
19
19
 
20
20
  export interface ICategoryCellProps {
21
- categories: any;
21
+ categories: string[];
22
22
  categoryColors: any;
23
23
  addCategoryColors(cats: string[]): void;
24
24
  }
@@ -8,7 +8,7 @@ import { IFilterValue } from "@ax/types";
8
8
  import * as S from "./style";
9
9
 
10
10
  const CategoryFilter = (props: ICategoryFilterProps): JSX.Element => {
11
- const { filterItems, value, structuredData } = props;
11
+ const { filterItems, value, structuredData, siteID } = props;
12
12
 
13
13
  const filters: IFilterValue[] = [
14
14
  {
@@ -27,7 +27,8 @@ const CategoryFilter = (props: ICategoryFilterProps): JSX.Element => {
27
27
 
28
28
  const getSelectCategories = async () => {
29
29
  try {
30
- const items = await checkgroups.getCheckGroupItems("global", structuredData.source);
30
+ const site = siteID ? siteID : "global";
31
+ const items = await checkgroups.getCheckGroupItems(site, structuredData.source);
31
32
  if (items && isReqOk(items.status)) {
32
33
  return items.data;
33
34
  }
@@ -87,6 +88,7 @@ export interface ICategoryFilterProps {
87
88
  filterItems(pointer: string, filter: string): void;
88
89
  value: string;
89
90
  structuredData: any;
91
+ siteID: number | null;
90
92
  }
91
93
 
92
94
  export default CategoryFilter;
@@ -30,6 +30,7 @@ const TableHeader = (props: IProps): JSX.Element => {
30
30
  setColumns,
31
31
  isGlobalPages,
32
32
  filterValues,
33
+ siteID,
33
34
  } = props;
34
35
 
35
36
  const activeColumns = Object.keys(columns).filter((col: string) => columns[col].show);
@@ -40,7 +41,12 @@ const TableHeader = (props: IProps): JSX.Element => {
40
41
  (col: any) =>
41
42
  activeColumns.includes(col.key) && (
42
43
  <S.HeaderWrapper key={col.key}>
43
- <CategoryFilter filterItems={filterItems} structuredData={col} value={filterValues.categories} />
44
+ <CategoryFilter
45
+ filterItems={filterItems}
46
+ structuredData={col}
47
+ value={filterValues.categories}
48
+ siteID={siteID}
49
+ />
44
50
  </S.HeaderWrapper>
45
51
  )
46
52
  );
@@ -138,6 +144,7 @@ interface IProps {
138
144
  setColumns: (columns: Record<string, IColumn>) => void;
139
145
  isGlobalPages: boolean;
140
146
  filterValues: any;
147
+ siteID: number;
141
148
  }
142
149
 
143
150
  export default TableHeader;
@@ -24,6 +24,7 @@ const BulkHeader = (props: IProps): JSX.Element => {
24
24
  columns,
25
25
  setColumns,
26
26
  isGlobalPages,
27
+ siteID,
27
28
  } = props;
28
29
 
29
30
  const deleteAction = {
@@ -70,6 +71,7 @@ const BulkHeader = (props: IProps): JSX.Element => {
70
71
  columns={columns}
71
72
  setColumns={setColumns}
72
73
  isGlobalPages={isGlobalPages}
74
+ siteID={siteID}
73
75
  />
74
76
  );
75
77
  };
@@ -94,6 +96,7 @@ interface IProps {
94
96
  columns: Record<string, IColumn>;
95
97
  setColumns: (columns: Record<string, IColumn>) => void;
96
98
  isGlobalPages: boolean;
99
+ siteID: number;
97
100
  }
98
101
 
99
102
  export default BulkHeader;
@@ -456,8 +456,13 @@ const PageItem = (props: IPageItemProps): JSX.Element => {
456
456
  isGlobal &&
457
457
  categoryColumns.map((col: any) => {
458
458
  const fromVal = col.from.includes(".") ? col.from.split(".")[1] : col.from;
459
- const type = structuredDataContent && (structuredDataContent[fromVal] || structuredDataContent[col.from]);
460
- const categories = Array.isArray(type) && type.map((cat: any) => cat.label || cat.title);
459
+ const type: any = structuredDataContent && (structuredDataContent[fromVal] || structuredDataContent[col.from]);
460
+ const categories: string[] = !type
461
+ ? []
462
+ : Array.isArray(type)
463
+ ? type.map((cat: any) => cat.label || cat.title)
464
+ : [type.label || type.title];
465
+
461
466
  return (
462
467
  activeColumns.includes(col.key) && (
463
468
  <CategoryCell
@@ -104,6 +104,10 @@ const Content = (props: IProps): JSX.Element => {
104
104
  checkUserSession,
105
105
  } = props;
106
106
 
107
+ if (!currentSiteInfo) {
108
+ throw new Error(`ERROR: User reached Content with null site info`);
109
+ }
110
+
107
111
  const itemsPerPage = 50;
108
112
  const firstPage = 1;
109
113
 
@@ -472,6 +476,7 @@ const Content = (props: IProps): JSX.Element => {
472
476
  columns={columnsState}
473
477
  setColumns={setColumnsState}
474
478
  isGlobalPages={isGlobalPages}
479
+ siteID={currentSiteInfo.id}
475
480
  />
476
481
  );
477
482
 
@@ -42,7 +42,7 @@ const TableHeader = (props: IProps): JSX.Element => {
42
42
  (col: any) =>
43
43
  activeColumns.includes(col.key) && (
44
44
  <S.HeaderWrapper key={col.key}>
45
- <CategoryFilter filterItems={filterItems} value={filterCategories} structuredData={col} />
45
+ <CategoryFilter filterItems={filterItems} value={filterCategories} structuredData={col} siteID={null} />
46
46
  </S.HeaderWrapper>
47
47
  )
48
48
  );
@@ -103,21 +103,21 @@ const TableHeader = (props: IProps): JSX.Element => {
103
103
  <S.NameWrapper>
104
104
  <NameFilter sortItems={sortItems} sortedState={sortedListStatus} />
105
105
  </S.NameWrapper>
106
- {activeColumns.includes("live") && (
107
- <S.HeaderWrapper>
108
- <LiveFilter filterItems={filterItems} value={filterValues.liveStatus} hasBasicStatus={true} />
109
- </S.HeaderWrapper>
110
- )}
111
- {CategoryColumns}
112
- {activeColumns.includes("status") && (
113
- <S.HeaderWrapper>
114
- <StatusFilter sortItems={sortItems} sortedState={sortedListStatus} isStructuredData={true} />
115
- </S.HeaderWrapper>
116
- )}
117
- {activeColumns.includes("translation") && (
118
- <S.HeaderWrapper>
119
- <TranslationsFilter filterItems={filterItems} value={filterValues.translated} />
120
- </S.HeaderWrapper>
106
+ {activeColumns.includes("live") && (
107
+ <S.HeaderWrapper>
108
+ <LiveFilter filterItems={filterItems} value={filterValues.liveStatus} hasBasicStatus={true} />
109
+ </S.HeaderWrapper>
110
+ )}
111
+ {CategoryColumns}
112
+ {activeColumns.includes("status") && (
113
+ <S.HeaderWrapper>
114
+ <StatusFilter sortItems={sortItems} sortedState={sortedListStatus} isStructuredData={true} />
115
+ </S.HeaderWrapper>
116
+ )}
117
+ {activeColumns.includes("translation") && (
118
+ <S.HeaderWrapper>
119
+ <TranslationsFilter filterItems={filterItems} value={filterValues.translated} />
120
+ </S.HeaderWrapper>
121
121
  )}
122
122
  </>
123
123
  )}
@@ -335,8 +335,13 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
335
335
  const mainUnpublishAction = { title: "Ok", onClick: toggleUnpublishModal };
336
336
 
337
337
  const CategoryColumns = categoryColumns.map((col: any) => {
338
- const type = structuredDataContent && structuredDataContent[col.from];
339
- const categories = Array.isArray(type) && type.map((cat: any) => cat.label || cat.title);
338
+ const type: any = structuredDataContent && structuredDataContent[col.from];
339
+ const categories: string[] = !type
340
+ ? []
341
+ : Array.isArray(type)
342
+ ? type.map((cat: any) => cat.label || cat.title)
343
+ : [type.label || type.title];
344
+
340
345
  return (
341
346
  activeColumns.includes(col.key) && (
342
347
  <CategoryCell
@@ -178,8 +178,13 @@ const StructuredDataItem = (props: IStructuredDataItemProps): JSX.Element => {
178
178
  const menuOptions = isDisabled || !isEditable ? menuOptionsNoDuplicate : [duplicateOption, ...menuOptionsNoDuplicate];
179
179
 
180
180
  const CategoryColumns = categoryColumns.map((col: any) => {
181
- const type = structuredData && structuredData.content && structuredData.content[col.from];
182
- const categories = Array.isArray(type) && type.map((cat: any) => cat.label || cat.title);
181
+ const type: any = structuredData && structuredData.content && structuredData.content[col.from];
182
+ const categories: string[] = !type
183
+ ? []
184
+ : Array.isArray(type)
185
+ ? type.map((cat: any) => cat.label || cat.title)
186
+ : [type.label || type.title];
187
+
183
188
  return (
184
189
  activeColumns.includes(col.key) && (
185
190
  <CategoryCell