@griddo/ax 1.66.4 → 1.66.7

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 (70) hide show
  1. package/package.json +2 -2
  2. package/src/api/pages.tsx +3 -15
  3. package/src/api/redirects.tsx +2 -4
  4. package/src/api/sites.tsx +2 -4
  5. package/src/components/Browser/index.tsx +1 -3
  6. package/src/components/Browser/style.tsx +2 -2
  7. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +1 -0
  8. package/src/components/ErrorCenter/index.tsx +5 -8
  9. package/src/components/ErrorCenter/style.tsx +8 -21
  10. package/src/components/Fields/ColorPicker/index.tsx +0 -1
  11. package/src/components/Fields/ReferenceField/ItemList/index.tsx +1 -5
  12. package/src/components/Fields/ReferenceField/index.tsx +14 -18
  13. package/src/components/Fields/UrlField/index.tsx +1 -13
  14. package/src/components/Fields/index.tsx +0 -2
  15. package/src/components/FieldsBehavior/index.tsx +1 -14
  16. package/src/components/MainWrapper/AppBar/index.tsx +10 -21
  17. package/src/components/MainWrapper/AppBar/style.tsx +3 -11
  18. package/src/components/MainWrapper/index.tsx +0 -2
  19. package/src/components/Modal/style.tsx +1 -0
  20. package/src/components/SearchField/index.tsx +4 -36
  21. package/src/components/SearchField/style.tsx +10 -23
  22. package/src/components/SideModal/style.tsx +6 -6
  23. package/src/components/TableFilters/StatusFilter/index.tsx +2 -2
  24. package/src/components/index.tsx +0 -2
  25. package/src/containers/App/actions.tsx +7 -3
  26. package/src/containers/PageEditor/actions.tsx +22 -91
  27. package/src/containers/PageEditor/constants.tsx +1 -1
  28. package/src/containers/PageEditor/interfaces.tsx +6 -6
  29. package/src/containers/PageEditor/reducer.tsx +4 -4
  30. package/src/containers/PageEditor/utils.tsx +1 -2
  31. package/src/containers/Sites/actions.tsx +23 -35
  32. package/src/containers/Sites/constants.tsx +0 -1
  33. package/src/containers/Sites/interfaces.tsx +0 -6
  34. package/src/containers/Sites/reducer.tsx +0 -4
  35. package/src/forms/editor.tsx +1 -34
  36. package/src/forms/errors.tsx +0 -1
  37. package/src/forms/index.tsx +1 -15
  38. package/src/forms/validators.tsx +9 -168
  39. package/src/guards/error/index.tsx +1 -1
  40. package/src/helpers/dataPacks.tsx +1 -8
  41. package/src/helpers/index.tsx +1 -2
  42. package/src/modules/Content/PageItem/index.tsx +4 -54
  43. package/src/modules/Content/atoms.tsx +3 -41
  44. package/src/modules/Content/index.tsx +64 -111
  45. package/src/modules/Content/style.tsx +1 -8
  46. package/src/modules/GlobalEditor/Editor/index.tsx +1 -3
  47. package/src/modules/GlobalEditor/PageBrowser/index.tsx +0 -3
  48. package/src/modules/GlobalEditor/index.tsx +6 -8
  49. package/src/modules/PageEditor/Editor/index.tsx +2 -6
  50. package/src/modules/PageEditor/PageBrowser/index.tsx +0 -3
  51. package/src/modules/PageEditor/index.tsx +15 -29
  52. package/src/modules/Redirects/index.tsx +10 -40
  53. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/index.tsx +1 -1
  54. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/index.tsx +1 -1
  55. package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +1 -1
  56. package/src/modules/Settings/ContentTypes/DataPacks/index.tsx +1 -1
  57. package/src/modules/Sites/index.tsx +3 -3
  58. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
  59. package/src/modules/StructuredData/StructuredDataList/atoms.tsx +1 -1
  60. package/src/modules/Users/Profile/index.tsx +4 -3
  61. package/src/modules/Users/UserCreate/SiteItem/index.tsx +1 -1
  62. package/src/modules/Users/UserCreate/SiteItem/style.tsx +1 -1
  63. package/src/modules/Users/UserForm/style.tsx +3 -3
  64. package/src/modules/Users/UserList/UserItem/index.tsx +1 -3
  65. package/src/modules/Users/UserList/hooks.tsx +1 -1
  66. package/src/modules/Users/UserList/index.tsx +2 -2
  67. package/src/types/index.tsx +3 -16
  68. package/src/components/Fields/LinkField/index.tsx +0 -85
  69. package/src/components/Icon/components/Copy.js +0 -14
  70. package/src/components/Icon/svgs/Copy2.svg +0 -3
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IEmptyStateProps, INavItem, IRedirect, IRootState } from "@ax/types";
4
+ import { INavItem, IRedirect, IRootState } from "@ax/types";
5
5
  import { appActions } from "@ax/containers/App";
6
6
  import { redirectsActions } from "@ax/containers/Redirects";
7
7
  import { MainWrapper, ErrorToast, Nav, TableList, EmptyState, Toast } from "@ax/components";
@@ -30,7 +30,6 @@ const Redirects = (props: IProps): JSX.Element => {
30
30
  importRedirects,
31
31
  imports,
32
32
  totalImports,
33
- isLoading,
34
33
  } = props;
35
34
 
36
35
  const itemsPerPage = 50;
@@ -51,10 +50,6 @@ const Redirects = (props: IProps): JSX.Element => {
51
50
  const { isOpen: isOpenCheckImport, toggleModal: toggleCheckImportModal } = useModal();
52
51
  const [importData, setImportData] = useState<{ from: string; to: string }[]>([]);
53
52
  const [isUploading, setIsUploading] = useState(false);
54
- const [searchQuery, setSearchQuery] = useState<string>("");
55
- const [searchFilter, setSearchFilter] = useState<string>("");
56
- const [isEmpty, setIsEmpty] = useState(false);
57
- const [emptyStateProps, setEmptyStateProps] = useState<IEmptyStateProps>({});
58
53
 
59
54
  const initState = {
60
55
  from: "",
@@ -67,18 +62,17 @@ const Redirects = (props: IProps): JSX.Element => {
67
62
  const [formValues, setFormValues] = useState<IRedirect>(initState);
68
63
 
69
64
  const redIds = redirects && redirects.map((red: any) => red.id);
65
+ const isEmpty = redirects && redirects.length === 0;
70
66
 
71
67
  const getParams = useCallback(() => {
72
68
  const params = {
73
69
  page,
74
70
  itemsPerPage,
75
71
  pagination: true,
76
- query: searchQuery,
77
- filterBy: searchFilter === "filterby" ? "" : searchFilter,
78
72
  };
79
73
 
80
74
  return params;
81
- }, [page, searchQuery, searchFilter]);
75
+ }, [page]);
82
76
 
83
77
  useEffect(() => {
84
78
  const params = getParams();
@@ -87,26 +81,7 @@ const Redirects = (props: IProps): JSX.Element => {
87
81
  tableRef.current.scrollTo(0, 0);
88
82
  }
89
83
  // eslint-disable-next-line react-hooks/exhaustive-deps
90
- }, [page, currentFilterQuery, searchQuery, searchFilter]);
91
-
92
- useEffect(() => {
93
- if (!isLoading) {
94
- const emptyState: IEmptyStateProps = {};
95
- const isSearching = searchQuery.length > 0;
96
- if (isSearching) {
97
- emptyState.icon = "search";
98
- emptyState.title = "Oh! No Results Found";
99
- emptyState.message = "We couldn’t find what you are looking for. Please, try another search.";
100
- } else {
101
- emptyState.message = "To have a redirects on your site, create as many redirects as you want.";
102
- emptyState.button = "Create New redirect";
103
- emptyState.action = handleModal;
104
- }
105
- setIsEmpty(!redirects.length);
106
- setEmptyStateProps(emptyState);
107
- }
108
- // eslint-disable-next-line react-hooks/exhaustive-deps
109
- }, [isLoading]);
84
+ }, [page, currentFilterQuery]);
110
85
 
111
86
  const {
112
87
  resetBulkSelection,
@@ -201,6 +176,12 @@ const Redirects = (props: IProps): JSX.Element => {
201
176
  toggleOverwriteModal();
202
177
  };
203
178
 
179
+ const emptyStateProps = {
180
+ message: "To have a redirects on your site, create as many redirects as you want.",
181
+ button: "Create New redirect",
182
+ action: handleModal,
183
+ };
184
+
204
185
  const pagination = {
205
186
  setPage,
206
187
  itemsPerPage,
@@ -255,12 +236,6 @@ const Redirects = (props: IProps): JSX.Element => {
255
236
 
256
237
  const secondaryImportModalAction = { title: "Cancel", onClick: toggleCheckImportModal };
257
238
 
258
- const searchFilters = [
259
- { value: "filterby", label: "Filter by" },
260
- { value: "from", label: "Old URL" },
261
- { value: "to", label: "New URL" },
262
- ];
263
-
264
239
  return (
265
240
  <>
266
241
  <MainWrapper
@@ -268,9 +243,6 @@ const Redirects = (props: IProps): JSX.Element => {
268
243
  title="SEO Settings"
269
244
  rightButton={rightButtonProps}
270
245
  rightLineButton={rightLineButtonProps}
271
- searchAction={setSearchQuery}
272
- filterSearchAction={setSearchFilter}
273
- searchFilters={searchFilters}
274
246
  >
275
247
  <S.Wrapper>
276
248
  <Nav current={currentNavItem} items={navItems} onClick={handleMenuClick} />
@@ -369,7 +341,6 @@ const mapStateToProps = (state: IRootState) => ({
369
341
  currentSiteID: state.sites.currentSiteInfo && state.sites.currentSiteInfo.id,
370
342
  totalImports: state.redirects.totalImports,
371
343
  imports: state.redirects.imports,
372
- isLoading: state.app.isLoading,
373
344
  });
374
345
 
375
346
  const mapDispatchToProps = {
@@ -386,7 +357,6 @@ interface IRedirectsProps {
386
357
  totalItems: number;
387
358
  currentSiteID: number | null;
388
359
  totalImports: number;
389
- isLoading: boolean;
390
360
  imports: null | {
391
361
  error: IRedirect[];
392
362
  existing: IRedirect[];
@@ -30,7 +30,7 @@ const Editor = (props: IProps) => {
30
30
  type IProps = {
31
31
  isLoading: boolean;
32
32
  template: string;
33
- };
33
+ }
34
34
 
35
35
  const mapStateToProps = (state: IRootState): IProps => ({
36
36
  isLoading: state.app.isLoading,
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
4
  import { IRootState } from "@ax/types";
@@ -68,7 +68,7 @@ const ConfigPack = (props: IProps): JSX.Element => {
68
68
  };
69
69
 
70
70
  interface IProps {
71
- selected?: any;
71
+ selected: any;
72
72
  currentSiteInfo: ISite;
73
73
  }
74
74
 
@@ -181,7 +181,7 @@ const DataPacks = (props: IProps): JSX.Element => {
181
181
  action: addNewAction,
182
182
  };
183
183
 
184
- const Content = () => (selected || !isEmpty ? <Section /> : <EmptyState {...emptyStateProps} />);
184
+ const Content = () => (!isEmpty ? <Section /> : <EmptyState {...emptyStateProps} />);
185
185
 
186
186
  return (
187
187
  <MainWrapper {...mainWrapperProps}>
@@ -15,6 +15,7 @@ const Sites = (props: IProps): JSX.Element => {
15
15
  const {
16
16
  isLoading,
17
17
  sites,
18
+ token,
18
19
  setCurrentSiteInfo,
19
20
  getSites,
20
21
  getStructuredData,
@@ -22,13 +23,12 @@ const Sites = (props: IProps): JSX.Element => {
22
23
  getAllDataPacks,
23
24
  getUser,
24
25
  globalLangs,
25
- token
26
26
  } = props;
27
27
 
28
28
  const fetchInitialData = async () => {
29
29
  setCurrentSiteInfo(null);
30
30
  await getStructuredData(token);
31
- await getSites();
31
+ await getSites(token);
32
32
  await getAllDataPacks();
33
33
  await getUser("me");
34
34
 
@@ -68,7 +68,7 @@ interface IStateProps {
68
68
 
69
69
  interface IDispatchProps {
70
70
  setCurrentSiteInfo(currentSiteInfo: any): void;
71
- getSites(language?: number): Promise<void>;
71
+ getSites(token: string): Promise<void>;
72
72
  getStructuredData(token: string, siteId?: number): Promise<void>;
73
73
  setLanguage(lang: { locale: string; id: number | null }): void;
74
74
  getAllDataPacks: () => Promise<void>;
@@ -405,7 +405,7 @@ interface IGlobalPageItemProps {
405
405
  isAllPages?: boolean;
406
406
  globalPage: IPage;
407
407
  updatePageStatus(ids: number[], status: string, updatedFromList: boolean): Promise<boolean>;
408
- duplicatePage(pageID: number, data: { title: string; slug: string }, siteID?: number): Promise<boolean>;
408
+ duplicatePage(pageID: number, data: { title: string; slug: string }): Promise<void>;
409
409
  setHistoryPush(path: string, isEditor: boolean): void;
410
410
  deletePage(params?: ISavePageParams, currentLanguage?: string): Promise<boolean>;
411
411
  getGlobalPages(): void;
@@ -87,4 +87,4 @@ interface IActionButton {
87
87
  title: string;
88
88
  }
89
89
 
90
- export { DeleteModal, MainActionButton, SecondaryActionButton };
90
+ export { DeleteModal, MainActionButton, SecondaryActionButton };
@@ -11,14 +11,14 @@ import { useURLSearchParam } from "@ax/hooks";
11
11
  import UserForm from "../UserForm";
12
12
 
13
13
  const Profile = (props: IProps) => {
14
- const { user, getUser, updateUser, isSaving, isLoading, getSites } = props;
14
+ const { user, getUser, updateUser, isSaving, isLoading, getSites, token } = props;
15
15
 
16
16
  const isUserInit = useURLSearchParam("init");
17
17
 
18
18
  const [form, setForm] = useState<IUser>({ ...user });
19
19
 
20
20
  useEffect(() => {
21
- isUserInit ? getSites() : getUser("me");
21
+ isUserInit ? getSites(token) : getUser("me");
22
22
  // eslint-disable-next-line react-hooks/exhaustive-deps
23
23
  }, []);
24
24
 
@@ -58,7 +58,7 @@ const mapStateToProps = (state: IRootState) => ({
58
58
  interface IDispatchProps {
59
59
  setHistoryPush(path: string): any;
60
60
  getUser(id: string): any;
61
- getSites(): Promise<void>;
61
+ getSites(token: string): Promise<void>;
62
62
  updateUser(id: number, data: any, isProfile: boolean, isList: boolean): any;
63
63
  }
64
64
 
@@ -73,6 +73,7 @@ interface IProfileProps {
73
73
  user: IUser;
74
74
  isSaving: boolean;
75
75
  isLoading: boolean;
76
+ token: string;
76
77
  }
77
78
 
78
79
  type IProps = IProfileProps & IDispatchProps;
@@ -41,4 +41,4 @@ interface IProps {
41
41
  readOnly?: boolean;
42
42
  }
43
43
 
44
- export default SiteItem;
44
+ export default SiteItem;
@@ -27,4 +27,4 @@ const SiteItem = styled(Row)<{ disabled?: boolean; readOnly?: boolean }>`
27
27
  }
28
28
  `;
29
29
 
30
- export { CheckCell, NameCell, SiteItem };
30
+ export { CheckCell, NameCell, SiteItem };
@@ -19,7 +19,7 @@ const SubTitle = styled.div`
19
19
  `;
20
20
 
21
21
  const ModalContent = styled.div`
22
- padding: ${(p) => p.theme.spacing.m};
22
+ padding: ${p => p.theme.spacing.m};
23
23
  `;
24
24
 
25
25
  const SettingsWrapper = styled.div`
@@ -64,5 +64,5 @@ export {
64
64
  SettingContent,
65
65
  Heading,
66
66
  SearchFieldWrapper,
67
- SelectAllSitesFieldWrapper,
68
- };
67
+ SelectAllSitesFieldWrapper
68
+ };
@@ -115,9 +115,7 @@ const UserItem = (props: IProps): JSX.Element => {
115
115
  </S.UserCell>
116
116
  {isSiteView ? null : (
117
117
  <S.UserCell role="cell" onClick={handleClick}>
118
- {user?.sites?.length > 0 && (
119
- <ElementsTooltip elements={getElementsNames()} elementsPerRow={3} defaultElements={3} />
120
- )}
118
+ {user?.sites?.length > 0 && <ElementsTooltip elements={getElementsNames()} elementsPerRow={3} defaultElements={3} />}
121
119
  </S.UserCell>
122
120
  )}
123
121
  {isSiteView ? null : (
@@ -72,4 +72,4 @@ interface IUseFilterQuery {
72
72
  filterValues: IUsersQueryValues;
73
73
  }
74
74
 
75
- export { useSortedListStatus, useFilterQuery };
75
+ export { useSortedListStatus, useFilterQuery };
@@ -18,16 +18,16 @@ import * as S from "./style";
18
18
 
19
19
  const UserList = (props: IProps): JSX.Element => {
20
20
  const {
21
+ currentSiteInfo,
21
22
  users,
22
- sites,
23
23
  getUsers,
24
24
  navItems,
25
25
  currentNavItem,
26
26
  setHistoryPush,
27
27
  getUser,
28
28
  resetUserData,
29
+ sites,
29
30
  deleteUser,
30
- currentSiteInfo,
31
31
  removeUsersBulk,
32
32
  } = props;
33
33
 
@@ -151,8 +151,8 @@ export interface IImage {
151
151
  published: Date;
152
152
  description: string;
153
153
  thumb: string;
154
- file: File;
155
154
  tags: string[];
155
+ file: File;
156
156
  orientation: string;
157
157
  }
158
158
 
@@ -573,8 +573,8 @@ export interface IErrorItem {
573
573
  type: string;
574
574
  message: string;
575
575
  validator: Record<string, unknown>;
576
- editorID: number | null;
577
- component: string | null;
576
+ editorID: number;
577
+ component: string;
578
578
  name: string;
579
579
  key: string;
580
580
  tab: string;
@@ -622,11 +622,6 @@ export interface IUsersQueryValues {
622
622
  filterSites: string;
623
623
  }
624
624
 
625
- export interface IUsersQueryValues {
626
- order: string;
627
- filterSites: string;
628
- }
629
-
630
625
  export interface IDataPackConfigImportCategory {
631
626
  id: number;
632
627
  title: string;
@@ -745,13 +740,6 @@ export interface INotification {
745
740
  onClick?: () => void;
746
741
  }
747
742
 
748
- export interface ILinkField {
749
- text: string;
750
- linkType: string;
751
- url: IUrlField;
752
- modal: any;
753
- }
754
-
755
743
  export type Field =
756
744
  | "AsyncCheckGroup"
757
745
  | "AsyncSelect"
@@ -765,7 +753,6 @@ export type Field =
765
753
  | "HeadingField"
766
754
  | "HiddenField"
767
755
  | "ImageField"
768
- | "LinkField"
769
756
  | "NumberField"
770
757
  | "RadioField"
771
758
  | "RadioGroup"
@@ -1,85 +0,0 @@
1
- import React, { memo } from "react";
2
-
3
- import { FieldsBehavior } from "@ax/components";
4
- import { ILinkField, IUrlField } from "@ax/types";
5
-
6
- const LinkField = (props: ILinkFieldProps): JSX.Element => {
7
- const { value, onChange, disabled, whiteList, goTo, theme, actions } = props;
8
-
9
- const handleTextChange = (newValue: string) => onChange({ ...value, text: newValue });
10
- const handleLinkTypeChange = (newValue: string) => onChange({ ...value, linkType: newValue });
11
- const handleUrlChange = (newValue: IUrlField) => onChange({ ...value, url: newValue });
12
- const handleModalChange = (newValue: any) => onChange({ ...value, modal: newValue });
13
-
14
- const isModal = value?.linkType === "modal";
15
-
16
- return (
17
- <>
18
- <FieldsBehavior
19
- title="Text"
20
- name="text"
21
- fieldType="TextField"
22
- value={value.text}
23
- onChange={handleTextChange}
24
- disabled={disabled}
25
- />
26
- <FieldsBehavior
27
- title="Type of link"
28
- name="linkType"
29
- fieldType="ConditionalField"
30
- value={value.linkType}
31
- onChange={handleLinkTypeChange}
32
- disabled={disabled}
33
- options={[
34
- {
35
- value: "url",
36
- title: "Link to Page",
37
- name: "url",
38
- },
39
- {
40
- value: "modal",
41
- title: "Open Modal",
42
- name: "modal",
43
- },
44
- ]}
45
- />
46
- {isModal ? (
47
- <FieldsBehavior
48
- title="Modal"
49
- name="modal"
50
- fieldType="ComponentContainer"
51
- value={value.modal}
52
- onChange={handleModalChange}
53
- disabled={disabled}
54
- whiteList={whiteList}
55
- selectedContent={value}
56
- objKey="modal"
57
- goTo={goTo}
58
- theme={theme}
59
- actions={actions}
60
- />
61
- ) : (
62
- <FieldsBehavior
63
- title="URL"
64
- name="url"
65
- fieldType="UrlField"
66
- value={value.url}
67
- onChange={handleUrlChange}
68
- disabled={disabled}
69
- />
70
- )}
71
- </>
72
- );
73
- };
74
-
75
- interface ILinkFieldProps {
76
- value: ILinkField;
77
- onChange: (value: ILinkField | null) => void;
78
- disabled?: boolean;
79
- whiteList: string[];
80
- actions: any;
81
- theme: string;
82
- goTo: any;
83
- }
84
-
85
- export default memo(LinkField);
@@ -1,14 +0,0 @@
1
- import React from "react";
2
-
3
- const SvgCopy = (props) => (
4
- <svg width={24} height={24} fill="none" {...props}>
5
- <path
6
- fillRule="evenodd"
7
- clipRule="evenodd"
8
- d="M12.5263 2.3158H3.78947C2.80526 2.3158 2 3.12106 2 4.10527V16.6316H3.78947V4.10527H12.5263V2.3158ZM15.2105 5.89475H7.36842C6.38421 5.89475 5.57894 6.70001 5.57894 7.68422V20.2105C5.57894 21.1947 6.38421 22 7.36842 22H15.2105C16.1947 22 17 21.1947 17 20.2105V18H15.2105V20.2105H7.36843V7.68422H15.2105V10H17V7.68422C17 6.70001 16.1947 5.89475 15.2105 5.89475ZM22 14L18 10V13H13V15H18V18L22 14Z"
9
- fill="#5057FF"
10
- />
11
- </svg>
12
- );
13
-
14
- export default SvgCopy;
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M12.5263 2.3158H3.78947C2.80526 2.3158 2 3.12106 2 4.10527V16.6316H3.78947V4.10527H12.5263V2.3158ZM15.2105 5.89475H7.36842C6.38421 5.89475 5.57894 6.70001 5.57894 7.68422V20.2105C5.57894 21.1947 6.38421 22 7.36842 22H15.2105C16.1947 22 17 21.1947 17 20.2105V18H15.2105V20.2105H7.36843V7.68422H15.2105V10H17V7.68422C17 6.70001 16.1947 5.89475 15.2105 5.89475ZM22 14L18 10V13H13V15H18V18L22 14Z" fill="#5057FF"/>
3
- </svg>