@griddo/ax 11.0.29-rc.0 → 11.0.30-rc.0

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 (141) hide show
  1. package/config/griddo-config/cx-polyfills/componentsBundle.js +1 -1
  2. package/package.json +2 -2
  3. package/scripts/griddo-sync-schemas.js +49 -42
  4. package/src/GlobalStore.tsx +3 -0
  5. package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +6 -0
  6. package/src/api/forms.tsx +191 -0
  7. package/src/api/index.tsx +2 -0
  8. package/src/components/Browser/index.tsx +42 -37
  9. package/src/components/Browser/style.tsx +3 -3
  10. package/src/components/BrowserContent/index.tsx +1 -1
  11. package/src/components/ConfigPanel/Form/index.tsx +6 -5
  12. package/src/components/ConfigPanel/GlobalPageForm/index.tsx +3 -1
  13. package/src/components/ConfigPanel/Header/index.tsx +1 -0
  14. package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +4 -5
  15. package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +4 -4
  16. package/src/components/Fields/ComponentArray/helpers.tsx +1 -1
  17. package/src/components/Fields/FormFieldArray/index.tsx +13 -0
  18. package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +1 -2
  19. package/src/components/Fields/ReferenceField/Context/index.tsx +0 -2
  20. package/src/components/Fields/ReferenceField/ItemList/index.tsx +1 -2
  21. package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +2 -2
  22. package/src/components/Fields/ReferenceField/index.tsx +1 -5
  23. package/src/components/Fields/TranslateButton/index.tsx +48 -10
  24. package/src/components/Fields/Wysiwyg/helpers.tsx +2 -2
  25. package/src/components/Fields/Wysiwyg/index.tsx +4 -11
  26. package/src/components/Fields/index.tsx +2 -0
  27. package/src/components/FieldsBehavior/index.tsx +8 -2
  28. package/src/components/Icon/components/Form.js +12 -0
  29. package/src/components/Icon/svgs/Form.svg +3 -0
  30. package/src/components/LanguageMenu/index.tsx +30 -27
  31. package/src/components/MainWrapper/AppBar/index.tsx +23 -68
  32. package/src/components/MainWrapper/index.tsx +4 -9
  33. package/src/components/MenuItem/index.tsx +2 -2
  34. package/src/components/ResizePanel/index.tsx +3 -2
  35. package/src/components/ResizePanel/style.tsx +11 -9
  36. package/src/components/SearchField/style.tsx +2 -2
  37. package/src/components/SideModal/SideModalOption/index.tsx +3 -2
  38. package/src/components/SideModal/SideModalOption/style.tsx +2 -2
  39. package/src/components/SideModal/index.tsx +11 -4
  40. package/src/components/SideModal/style.tsx +9 -7
  41. package/src/components/TableFilters/LiveFilter/index.tsx +4 -3
  42. package/src/components/index.tsx +4 -0
  43. package/src/containers/App/reducer.tsx +4 -1
  44. package/src/containers/Forms/actions.tsx +853 -0
  45. package/src/containers/Forms/constants.tsx +46 -0
  46. package/src/containers/Forms/index.tsx +4 -0
  47. package/src/containers/Forms/interfaces.tsx +95 -0
  48. package/src/containers/Forms/reducer.tsx +81 -0
  49. package/src/containers/Forms/utils.tsx +42 -0
  50. package/src/containers/Navigation/Menu/actions.tsx +6 -13
  51. package/src/containers/Navigation/Menu/reducer.tsx +0 -4
  52. package/src/containers/PageEditor/actions.tsx +3 -2
  53. package/src/containers/PageEditor/reducer.tsx +2 -2
  54. package/src/forms/editor.tsx +3 -1
  55. package/src/helpers/index.tsx +12 -1
  56. package/src/helpers/schemas.tsx +35 -9
  57. package/src/helpers/structuredData.tsx +3 -1
  58. package/src/helpers/themes.tsx +3 -1
  59. package/src/helpers/thumbnails.tsx +20 -2
  60. package/src/modules/Analytics/GroupPanel/utils.tsx +3 -1
  61. package/src/modules/App/Routing/NavMenu/index.tsx +16 -6
  62. package/src/modules/App/Routing/index.tsx +26 -9
  63. package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +4 -4
  64. package/src/modules/Categories/CategoriesList/index.tsx +16 -16
  65. package/src/modules/Content/BulkHeader/TableHeader/index.tsx +1 -5
  66. package/src/modules/Content/PageItem/index.tsx +34 -33
  67. package/src/modules/Content/index.tsx +23 -36
  68. package/src/modules/Content/utils.tsx +3 -1
  69. package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/index.tsx +42 -0
  70. package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/style.tsx +36 -0
  71. package/src/modules/Forms/FormCategoriesList/BulkHeader/index.tsx +37 -0
  72. package/src/modules/Forms/FormCategoriesList/BulkHeader/style.tsx +9 -0
  73. package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +125 -0
  74. package/src/modules/Forms/FormCategoriesList/CategoryItem/style.tsx +91 -0
  75. package/src/modules/Forms/FormCategoriesList/CategoryPanel/Form/index.tsx +50 -0
  76. package/src/modules/Forms/FormCategoriesList/CategoryPanel/index.tsx +112 -0
  77. package/src/modules/Forms/FormCategoriesList/CategoryPanel/style.tsx +31 -0
  78. package/src/modules/Forms/FormCategoriesList/atoms.tsx +33 -0
  79. package/src/modules/Forms/FormCategoriesList/hooks.tsx +61 -0
  80. package/src/modules/Forms/FormCategoriesList/index.tsx +245 -0
  81. package/src/modules/Forms/FormCategoriesList/style.tsx +82 -0
  82. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/Field/index.tsx +95 -0
  83. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/index.tsx +102 -0
  84. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/style.tsx +9 -0
  85. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/index.tsx +109 -0
  86. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/index.tsx +76 -0
  87. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/style.tsx +28 -0
  88. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Header/index.tsx +132 -0
  89. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Header/style.tsx +30 -0
  90. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/index.tsx +86 -0
  91. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/style.tsx +7 -0
  92. package/src/modules/Forms/FormEditor/Editor/index.tsx +106 -0
  93. package/src/modules/Forms/FormEditor/PageBrowser/index.tsx +96 -0
  94. package/src/modules/Forms/FormEditor/index.tsx +295 -0
  95. package/src/modules/Forms/FormEditor/style.tsx +32 -0
  96. package/src/modules/Forms/FormList/BulkHeader/TableHeader/index.tsx +61 -0
  97. package/src/modules/Forms/FormList/BulkHeader/TableHeader/style.tsx +47 -0
  98. package/src/modules/Forms/FormList/BulkHeader/index.tsx +60 -0
  99. package/src/modules/Forms/FormList/FormItem/index.tsx +218 -0
  100. package/src/modules/Forms/FormList/FormItem/style.tsx +87 -0
  101. package/src/modules/Forms/FormList/Summary/index.tsx +51 -0
  102. package/src/modules/Forms/FormList/Summary/style.tsx +46 -0
  103. package/src/modules/Forms/FormList/TemplateModal/index.tsx +67 -0
  104. package/src/modules/Forms/FormList/TemplateModal/style.tsx +54 -0
  105. package/src/modules/Forms/FormList/index.tsx +266 -0
  106. package/src/modules/Forms/FormList/style.tsx +31 -0
  107. package/src/modules/Forms/FormsMenu/MenuGroup/index.tsx +57 -0
  108. package/src/modules/Forms/FormsMenu/MenuGroup/style.tsx +55 -0
  109. package/src/modules/Forms/FormsMenu/index.tsx +78 -0
  110. package/src/modules/Forms/FormsMenu/style.tsx +9 -0
  111. package/src/modules/Forms/atoms.tsx +111 -0
  112. package/src/modules/Forms/style.tsx +11 -0
  113. package/src/modules/FramePreview/index.tsx +26 -12
  114. package/src/modules/GlobalEditor/index.tsx +52 -21
  115. package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +32 -15
  116. package/src/modules/Navigation/Defaults/Item/atoms.tsx +6 -5
  117. package/src/modules/Navigation/Defaults/Item/index.tsx +10 -10
  118. package/src/modules/Navigation/Defaults/index.tsx +7 -6
  119. package/src/modules/Navigation/Menus/List/Nav/index.tsx +2 -10
  120. package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +14 -11
  121. package/src/modules/Navigation/Menus/List/index.tsx +15 -16
  122. package/src/modules/Navigation/Menus/index.tsx +9 -17
  123. package/src/modules/PageEditor/index.tsx +54 -31
  124. package/src/modules/Settings/Globals/index.tsx +3 -1
  125. package/src/modules/Settings/Languages/Table/Item/index.tsx +11 -9
  126. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +1 -1
  127. package/src/modules/StructuredData/Form/index.tsx +41 -28
  128. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +1 -5
  129. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +6 -8
  130. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +5 -7
  131. package/src/modules/StructuredData/StructuredDataList/index.tsx +13 -10
  132. package/src/modules/StructuredData/StructuredDataList/utils.tsx +2 -1
  133. package/src/routes/multisite.tsx +53 -16
  134. package/src/routes/site.tsx +1 -0
  135. package/src/schemas/pages/FormPage.tsx +49 -0
  136. package/src/schemas/pages/GlobalPage.tsx +1 -0
  137. package/src/schemas/pages/Page.tsx +4 -1
  138. package/src/schemas/pages/index.tsx +2 -1
  139. package/src/types/forms.tsx +87 -0
  140. package/src/types/index.tsx +43 -7
  141. /package/src/modules/Navigation/Menus/{helpers.tsx → List/helpers.tsx} +0 -0
@@ -0,0 +1,46 @@
1
+ const NAME = "forms";
2
+
3
+ const SET_FORMS = `${NAME}/SET_FORMS`;
4
+ const SET_FORM_CONTENT = `${NAME}/SET_FORM_CONTENT`;
5
+ const SET_SCHEMA = `${NAME}/SET_SCHEMA`;
6
+ const SET_TAB = `${NAME}/SET_TAB`;
7
+ const SET_TEMPLATE = `${NAME}/SET_TEMPLATE`;
8
+ const SET_CURRENT_FORM_ID = `${NAME}/SET_CURRENT_FORM_ID`;
9
+ const SET_SELECTED_CONTENT = `${NAME}/SET_SELECTED_CONTENT`;
10
+ const SET_SELECTED_PARENT = `${NAME}/SET_SELECTED_PARENT`;
11
+ const SET_SELECTED_EDITOR_ID = `${NAME}/SET_SELECTED_ID`;
12
+ const SET_BREADCRUMB = `${NAME}/SET_BREADCRUMB`;
13
+ const SET_COPY_MODULE = `${NAME}/SET_COPY_MODULE`;
14
+ const SET_SUMMARY = `${NAME}/SET_SUMMARY`;
15
+ const SET_CURRENT_FORM_CATEGORIES = `${NAME}/SET_CURRENT_FORM_CATEGORIES`;
16
+ const SET_IS_NEW_TRANSLATION = `${NAME}/SET_IS_NEW_TRANSLATION`;
17
+ const SET_IS_IA_TRANSLATED = `${NAME}/SET_IS_IA_TRANSLATED`;
18
+
19
+ const ITEMS_PER_PAGE = 50;
20
+
21
+ const DEFAULT_PARAMS = {
22
+ page: 1,
23
+ itemsPerPage: ITEMS_PER_PAGE,
24
+ pagination: true,
25
+ };
26
+
27
+ export {
28
+ NAME,
29
+ SET_FORMS,
30
+ SET_FORM_CONTENT,
31
+ SET_SCHEMA,
32
+ SET_TAB,
33
+ SET_TEMPLATE,
34
+ SET_CURRENT_FORM_ID,
35
+ SET_SELECTED_CONTENT,
36
+ SET_SELECTED_EDITOR_ID,
37
+ SET_SELECTED_PARENT,
38
+ SET_BREADCRUMB,
39
+ SET_COPY_MODULE,
40
+ SET_SUMMARY,
41
+ ITEMS_PER_PAGE,
42
+ DEFAULT_PARAMS,
43
+ SET_CURRENT_FORM_CATEGORIES,
44
+ SET_IS_NEW_TRANSLATION,
45
+ SET_IS_IA_TRANSLATED,
46
+ };
@@ -0,0 +1,4 @@
1
+ import * as formsActions from "./actions";
2
+ import { formsReducer } from "./reducer";
3
+
4
+ export { formsActions, formsReducer };
@@ -0,0 +1,95 @@
1
+ import { FormCategory, FormContent, IBreadcrumbItem, IModule, ISchema } from "@ax/types";
2
+ import {
3
+ SET_BREADCRUMB,
4
+ SET_COPY_MODULE,
5
+ SET_CURRENT_FORM_ID,
6
+ SET_FORM_CONTENT,
7
+ SET_FORMS,
8
+ SET_SCHEMA,
9
+ SET_SELECTED_CONTENT,
10
+ SET_SELECTED_EDITOR_ID,
11
+ SET_SELECTED_PARENT,
12
+ SET_TAB,
13
+ SET_TEMPLATE,
14
+ SET_SUMMARY,
15
+ SET_CURRENT_FORM_CATEGORIES,
16
+ SET_IS_NEW_TRANSLATION,
17
+ SET_IS_IA_TRANSLATED,
18
+ } from "./constants";
19
+
20
+ export interface ISetForms {
21
+ type: typeof SET_FORMS;
22
+ payload: { forms: FormContent[] };
23
+ }
24
+
25
+ export interface ISetFormContent {
26
+ type: typeof SET_FORM_CONTENT;
27
+ payload: { formContent: FormContent | null };
28
+ }
29
+
30
+ export interface ISetSchema {
31
+ type: typeof SET_SCHEMA;
32
+ payload: { schema: ISchema | Record<string, never> };
33
+ }
34
+
35
+ export interface ISetTemplate {
36
+ type: typeof SET_TEMPLATE;
37
+ payload: { template: string };
38
+ }
39
+
40
+ export interface ISetTab {
41
+ type: typeof SET_TAB;
42
+ payload: { tab: string };
43
+ }
44
+
45
+ export interface ISetSelectedContent {
46
+ type: typeof SET_SELECTED_CONTENT;
47
+ payload: { selectedContent: Record<string, unknown> };
48
+ }
49
+
50
+ export interface ISetSelectedParent {
51
+ type: typeof SET_SELECTED_PARENT;
52
+ payload: { selectedParent: Record<string, unknown> | null };
53
+ }
54
+
55
+ export interface ISetSelectedEditorID {
56
+ type: typeof SET_SELECTED_EDITOR_ID;
57
+ payload: { selectedEditorID: number };
58
+ }
59
+
60
+ export interface ISetCurrentFormID {
61
+ type: typeof SET_CURRENT_FORM_ID;
62
+ payload: { currentFormID: number | null };
63
+ }
64
+
65
+ export interface ISetBreadcrumb {
66
+ type: typeof SET_BREADCRUMB;
67
+ payload: { breadcrumb: IBreadcrumbItem[] };
68
+ }
69
+
70
+ export interface ISetCopyModule {
71
+ type: typeof SET_COPY_MODULE;
72
+ payload: { moduleCopy: { date: Date; elements: IModule[] } | null };
73
+ }
74
+
75
+ export interface ISetSummary {
76
+ type: typeof SET_SUMMARY;
77
+ payload: { summary: { total: number; active: number; inactive: number } };
78
+ }
79
+
80
+ export interface ISetCurrentFormCategories {
81
+ type: typeof SET_CURRENT_FORM_CATEGORIES;
82
+ payload: { currentFormCategories: FormCategory[] };
83
+ }
84
+
85
+ export interface ISetIsNewTranslation {
86
+ type: typeof SET_IS_NEW_TRANSLATION;
87
+ payload: { isNewTranslation: boolean };
88
+ }
89
+
90
+ export interface ISetIsIATranslated {
91
+ type: typeof SET_IS_IA_TRANSLATED;
92
+ payload: { isIATranslated: boolean };
93
+ }
94
+
95
+ export type FormsActionsCreators = ISetForms;
@@ -0,0 +1,81 @@
1
+ import { FormCategory, FormContent, IBreadcrumbItem, IModule, ISchema } from "@ax/types";
2
+ import {
3
+ SET_BREADCRUMB,
4
+ SET_COPY_MODULE,
5
+ SET_CURRENT_FORM_ID,
6
+ SET_FORM_CONTENT,
7
+ SET_FORMS,
8
+ SET_SCHEMA,
9
+ SET_SELECTED_CONTENT,
10
+ SET_SELECTED_EDITOR_ID,
11
+ SET_SELECTED_PARENT,
12
+ SET_TAB,
13
+ SET_TEMPLATE,
14
+ SET_SUMMARY,
15
+ SET_CURRENT_FORM_CATEGORIES,
16
+ SET_IS_NEW_TRANSLATION,
17
+ SET_IS_IA_TRANSLATED,
18
+ } from "./constants";
19
+
20
+ export interface IFormsState {
21
+ forms: FormContent[];
22
+ formContent: FormContent | null;
23
+ schema: ISchema | Record<string, never>;
24
+ template: string;
25
+ tab: string;
26
+ currentFormID: number | null;
27
+ currentFormStatus: string | null;
28
+ selectedContent: Record<string, unknown>;
29
+ selectedEditorID: number;
30
+ selectedParent: Record<string, unknown> | null;
31
+ breadcrumb: IBreadcrumbItem[];
32
+ moduleCopy: { date: Date; elements: IModule[] } | null;
33
+ summary: { total: number; active: number; inactive: number };
34
+ currentFormCategories: FormCategory[];
35
+ isNewTranslation: boolean;
36
+ isIATranslated: boolean;
37
+ }
38
+
39
+ export const initialState = {
40
+ forms: [],
41
+ formContent: null,
42
+ schema: {},
43
+ template: "BasicForm",
44
+ tab: "content",
45
+ currentFormID: null,
46
+ currentFormStatus: null,
47
+ selectedContent: {},
48
+ selectedEditorID: 0,
49
+ selectedParent: null,
50
+ breadcrumb: [],
51
+ moduleCopy: null,
52
+ summary: { total: 0, active: 0, inactive: 0 },
53
+ currentFormCategories: [],
54
+ isNewTranslation: false,
55
+ isIATranslated: false,
56
+ };
57
+
58
+ export function reducer(state = initialState, action: any): IFormsState {
59
+ switch (action.type) {
60
+ case SET_FORMS:
61
+ case SET_FORM_CONTENT:
62
+ case SET_SCHEMA:
63
+ case SET_TEMPLATE:
64
+ case SET_TAB:
65
+ case SET_CURRENT_FORM_ID:
66
+ case SET_SELECTED_CONTENT:
67
+ case SET_SELECTED_EDITOR_ID:
68
+ case SET_SELECTED_PARENT:
69
+ case SET_BREADCRUMB:
70
+ case SET_COPY_MODULE:
71
+ case SET_SUMMARY:
72
+ case SET_CURRENT_FORM_CATEGORIES:
73
+ case SET_IS_NEW_TRANSLATION:
74
+ case SET_IS_IA_TRANSLATED:
75
+ return { ...state, ...action.payload };
76
+ default:
77
+ return state;
78
+ }
79
+ }
80
+
81
+ export { initialState as formsInitialState, reducer as formsReducer };
@@ -0,0 +1,42 @@
1
+ import { deepClone, getDefaultSchema } from "@ax/helpers";
2
+
3
+ const addElement = (element: any) => {
4
+ const defaultSchema = getDefaultSchema(element.component);
5
+ for (const key in defaultSchema) {
6
+ element[key] = defaultSchema[key];
7
+ }
8
+ };
9
+
10
+ const updateCollection = (elementType: string, prevCollection: any[]) => {
11
+ const newModule = getDefaultSchema(elementType);
12
+ return [...prevCollection, newModule];
13
+ };
14
+
15
+ const getUpdatedComponents = (editorContent: any, element: any, key: string) => {
16
+ const { editorID, type } = element;
17
+ const isCollectionItem = typeof type === "string";
18
+ const updatedDefault = isCollectionItem ? deepClone(editorContent) : editorContent;
19
+
20
+ const mapValues = (item: any) => {
21
+ if (item.editorID !== undefined && item.editorID === editorID) {
22
+ if (isCollectionItem) {
23
+ item[key] = updateCollection(type, item[key]);
24
+ } else {
25
+ addElement(type);
26
+ }
27
+ }
28
+
29
+ const itemKeys = Object.keys(item);
30
+ itemKeys.forEach((key: string) => {
31
+ const containedValue = item[key];
32
+ if (containedValue && typeof containedValue === "object") {
33
+ mapValues(containedValue);
34
+ }
35
+ });
36
+ };
37
+
38
+ mapValues(updatedDefault);
39
+ return updatedDefault;
40
+ };
41
+
42
+ export { getUpdatedComponents };
@@ -13,7 +13,6 @@ import {
13
13
  SET_MENU_FORM_DATA,
14
14
  SET_ORIGINAL_MENU,
15
15
  SET_TOTAL_ITEMS,
16
- SET_CURRENT_MENU,
17
16
  } from "./constants";
18
17
  import {
19
18
  ISetSavedMenus,
@@ -23,7 +22,6 @@ import {
23
22
  ISetMenuForm,
24
23
  ISetSavedMenu,
25
24
  ISetTotalItems,
26
- ISetCurrentMenu,
27
25
  } from "./interfaces";
28
26
  import { menuInitialState } from "./reducer";
29
27
 
@@ -72,12 +70,8 @@ function setTotalItems(totalItems: number): ISetTotalItems {
72
70
  return { type: SET_TOTAL_ITEMS, payload: { totalItems } };
73
71
  }
74
72
 
75
- function setCurrentMenu(currentMenu: string): ISetCurrentMenu {
76
- return { type: SET_CURRENT_MENU, payload: { currentMenu } };
77
- }
78
-
79
73
  const getStateValues = (getState: any) => {
80
- const { savedMenus, savedMenu, editorMenu, id, currentMenu } = getState().menu;
74
+ const { savedMenus, savedMenu, editorMenu, id, type } = getState().menu;
81
75
  const { currentSiteInfo } = getState().sites;
82
76
  const { isSaving, isLoading, lang } = getState().app;
83
77
 
@@ -86,7 +80,7 @@ const getStateValues = (getState: any) => {
86
80
  savedMenu,
87
81
  editorMenu,
88
82
  id,
89
- currentMenu,
83
+ type,
90
84
  currentSiteInfo,
91
85
  isLoading,
92
86
  isSaving,
@@ -108,13 +102,13 @@ function setEditorMenuContent(menus: IMenu[], menuType: string, dispatch: Dispat
108
102
  function getMenus(): (dispatch: Dispatch, getState: any) => Promise<void> {
109
103
  return async (dispatch, getState) => {
110
104
  try {
111
- const { currentSiteInfo, currentMenu } = getStateValues(getState);
105
+ const { currentSiteInfo, type } = getStateValues(getState);
112
106
  const id = currentSiteInfo && currentSiteInfo.id;
113
107
 
114
108
  const responseActions = {
115
109
  handleSuccess: (menus: IMenu[]) => {
116
110
  dispatch(setSavedMenus(menus));
117
- setEditorMenuContent(menus, currentMenu, dispatch);
111
+ setEditorMenuContent(menus, type, dispatch);
118
112
  updateTotalItems(dispatch, getState);
119
113
  },
120
114
  handleError: () => console.log("Error en getMenus"),
@@ -234,7 +228,7 @@ function deleteMenuItem(
234
228
  function updateMenu(): (dispatch: Dispatch, getState: any) => Promise<void> {
235
229
  return async (dispatch, getState) => {
236
230
  try {
237
- const { savedMenu, editorMenu, currentMenu, id, currentSiteInfo } = getStateValues(getState);
231
+ const { savedMenu, editorMenu, type, id, currentSiteInfo } = getStateValues(getState);
238
232
  const editorMenuClean = removeMenuEditorIds(editorMenu.elements);
239
233
  savedMenu.elements = editorMenuClean;
240
234
 
@@ -244,7 +238,7 @@ function updateMenu(): (dispatch: Dispatch, getState: any) => Promise<void> {
244
238
  const updatedMenusResponse = await menus.getMenus(currentSiteId);
245
239
  const updatedMenus = updatedMenusResponse.data;
246
240
  dispatch(setSavedMenus(updatedMenus));
247
- setEditorMenuContent(updatedMenus, currentMenu, dispatch);
241
+ setEditorMenuContent(updatedMenus, type, dispatch);
248
242
  },
249
243
  handleError: () => console.log("Error en updateMenu"),
250
244
  };
@@ -334,5 +328,4 @@ export {
334
328
  resetMenuValues,
335
329
  reorderMenu,
336
330
  updateFormValue,
337
- setCurrentMenu,
338
331
  };
@@ -6,7 +6,6 @@ import {
6
6
  SET_ITEM,
7
7
  SET_MENU_FORM_DATA,
8
8
  SET_TOTAL_ITEMS,
9
- SET_CURRENT_MENU,
10
9
  } from "./constants";
11
10
 
12
11
  import { MenuActionsCreators } from "./interfaces";
@@ -20,7 +19,6 @@ export interface IMenuState {
20
19
  item: IMenuItem | null;
21
20
  form: IMenuForm;
22
21
  totalItems: number;
23
- currentMenu: string;
24
22
  }
25
23
 
26
24
  const initialState = {
@@ -39,7 +37,6 @@ const initialState = {
39
37
  footerStyle: "",
40
38
  },
41
39
  totalItems: 0,
42
- currentMenu: "",
43
40
  };
44
41
 
45
42
  function reducer(state = initialState, action: MenuActionsCreators): IMenuState {
@@ -51,7 +48,6 @@ function reducer(state = initialState, action: MenuActionsCreators): IMenuState
51
48
  case SET_ITEM:
52
49
  case SET_MENU_FORM_DATA:
53
50
  case SET_TOTAL_ITEMS:
54
- case SET_CURRENT_MENU:
55
51
  return { ...state, ...action.payload };
56
52
  default:
57
53
  return state;
@@ -360,8 +360,8 @@ function getPage(pageID?: number, global?: boolean): (dispatch: Dispatch, getSta
360
360
  page.draftFromPage && !page.publicationScheduled
361
361
  ? pageStatus.MODIFIED
362
362
  : isNewTranslation
363
- ? pageStatus.OFFLINE
364
- : page.liveStatus.status;
363
+ ? pageStatus.OFFLINE
364
+ : page.liveStatus.status;
365
365
 
366
366
  if (isReqOk(response.status)) {
367
367
  addTemplate(page.templateId)(dispatch);
@@ -899,6 +899,7 @@ function copyModule(editorID: number[]): (dispatch: Dispatch, getState: any) =>
899
899
  editorID.forEach((id) => {
900
900
  const { element: originalElement } = findByEditorID(sections, id);
901
901
  if (originalElement) {
902
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
902
903
  const { editorID, parentEditorID, ...element } = originalElement;
903
904
  modulesToCopy.push(element);
904
905
  }
@@ -1,4 +1,4 @@
1
- import { IPage, IBreadcrumbItem, ISchema, IErrorItem, IUserEditing, IModule } from "@ax/types";
1
+ import { IPage, IBreadcrumbItem, ISchema, IErrorItem, IUserEditing, IModule, IPageLanguage } from "@ax/types";
2
2
 
3
3
  import {
4
4
  SET_EDITOR_CONTENT,
@@ -39,7 +39,7 @@ export interface IPageEditorState {
39
39
  currentPageID: number | null;
40
40
  currentPageStatus: string | null;
41
41
  currentPageName: string;
42
- currentPageLanguages: any[];
42
+ currentPageLanguages: IPageLanguage[];
43
43
  isNewTranslation: boolean;
44
44
  templateConfig: any;
45
45
  selectedParent: Record<string, unknown> | null;
@@ -56,7 +56,9 @@ const generateEditorIDs = (originalPageContent: any) => {
56
56
  const setEditorID = (component: any, parentID: number | null) => {
57
57
  if (!component || typeof component !== "object") return component;
58
58
 
59
- if ("component" in component || ("type" in component && component.type === "template")) {
59
+ const isTemplate = "type" in component && (component.type === "template" || component.type === "formTemplate");
60
+
61
+ if ("component" in component || isTemplate) {
60
62
  component.editorID = lastGeneratedID++;
61
63
  component.parentEditorID = parentID;
62
64
  }
@@ -59,6 +59,11 @@ import {
59
59
  getNavigationModules,
60
60
  getDefaultNavigationModules,
61
61
  isMultipleNavigationModules,
62
+ getFormTemplate,
63
+ getDefaultFormTemplate,
64
+ getFormTemplates,
65
+ getFormTemplateThumbnails,
66
+ getSchemaFormCategories,
62
67
  } from "./schemas";
63
68
 
64
69
  import {
@@ -70,7 +75,7 @@ import {
70
75
  getGlobalPageTypes,
71
76
  } from "./structuredData";
72
77
 
73
- import { getThumbnailProps } from "./thumbnails";
78
+ import { getThumbnailProps, getFormTemplateThumbnailProps } from "./thumbnails";
74
79
 
75
80
  import { getFieldByPath } from "./fields";
76
81
 
@@ -152,6 +157,7 @@ export {
152
157
  getStructuredDataFromPage,
153
158
  getCurrentPageStructuredData,
154
159
  getThumbnailProps,
160
+ getFormTemplateThumbnailProps,
155
161
  slugify,
156
162
  getFieldByPath,
157
163
  isReqOk,
@@ -203,6 +209,11 @@ export {
203
209
  getNavigationModules,
204
210
  getDefaultNavigationModules,
205
211
  isMultipleNavigationModules,
212
+ getFormTemplate,
213
+ getDefaultFormTemplate,
214
+ getFormTemplates,
215
+ getFormTemplateThumbnails,
216
+ getSchemaFormCategories,
206
217
  areEqual,
207
218
  parseTheme,
208
219
  stripHtml,
@@ -1,9 +1,19 @@
1
- import { schemas, moduleCategories } from "components";
2
1
  import { sortBy } from "@ax/helpers";
3
- import { ISchema, ModuleCategoryInfo } from "@ax/types";
4
2
  import { pageSchemas } from "@ax/schemas";
5
-
6
- const allSchemas = { ...schemas.all, ...pageSchemas };
3
+ import { ISchema, ModuleCategoryInfo } from "@ax/types";
4
+ import { config } from "components";
5
+
6
+ const schemas = config.schemas.ui;
7
+ const schemasConfig = config.schemas.config;
8
+ const formSchemas = config.schemas.forms;
9
+ const contentTypesSchemas = config.schemas.contentTypes;
10
+ const moduleCategories = config.schemas.config.moduleCategories;
11
+ const allSchemas = {
12
+ ...schemas.modules,
13
+ ...schemas.components,
14
+ ...formSchemas.fields,
15
+ ...pageSchemas,
16
+ };
7
17
 
8
18
  const getSchema = (name: string) => allSchemas[name];
9
19
 
@@ -44,6 +54,14 @@ const getTemplate = (name: string) => schemas.templates[name];
44
54
 
45
55
  const getDefaultTemplate = (name: string) => schemas.templates[name].default;
46
56
 
57
+ const getFormTemplates = (): Record<string, ISchema> => formSchemas.templates;
58
+
59
+ const getFormTemplate = (name: string) => formSchemas.templates[name];
60
+
61
+ const getDefaultFormTemplate = (name: string) => formSchemas.templates[name].default;
62
+
63
+ const getSchemaFormCategories = (): { label: string; value: string }[] => formSchemas.categories;
64
+
47
65
  const getTemplateThumbnails = (name: string, theme?: string) => {
48
66
  if (!schemas.templates[name]?.thumbnails) return null;
49
67
 
@@ -52,11 +70,14 @@ const getTemplateThumbnails = (name: string, theme?: string) => {
52
70
  : schemas.templates[name] && schemas.templates[name].thumbnails;
53
71
  };
54
72
 
55
- const getDataPackSchema = (name: string) => schemas.dataPacks[name];
73
+ const getFormTemplateThumbnails = (name: string): Record<string, string> | null =>
74
+ formSchemas.templates[name]?.thumbnails ? formSchemas.templates[name].thumbnails : null;
75
+
76
+ const getDataPackSchema = (name: string) => contentTypesSchemas.dataPacks[name];
56
77
 
57
- const getDisplayName = (component: string): string => {
58
- const schema: ISchema = getSchema(component);
59
- return schema?.displayName || "";
78
+ const getDisplayName = (component: string) => {
79
+ const schema = getSchema(component);
80
+ return schema?.displayName;
60
81
  };
61
82
 
62
83
  const getSchemaType = (component: string) => {
@@ -74,7 +95,7 @@ const getTemplateDisplayName = (template: string) => {
74
95
  return schema ? schema.displayName : undefined;
75
96
  };
76
97
 
77
- const getMenuItems = (type: string): { fields: any[] } | undefined => schemas.menuItems[type];
98
+ const getMenuItems = (type: string): { fields: any[] } | undefined => schemasConfig.menuItems[type];
78
99
 
79
100
  const filterByCategory = (options: any, category: string) =>
80
101
  options.filter((option: any) => allSchemas[option]?.category === category);
@@ -164,4 +185,9 @@ export {
164
185
  getNavigationModules,
165
186
  getDefaultNavigationModules,
166
187
  isMultipleNavigationModules,
188
+ getFormTemplate,
189
+ getDefaultFormTemplate,
190
+ getFormTemplates,
191
+ getFormTemplateThumbnails,
192
+ getSchemaFormCategories,
167
193
  };
@@ -1,4 +1,6 @@
1
- import { schemas } from "components";
1
+ import { config } from "components";
2
+
3
+ const schemas = config.schemas.contentTypes;
2
4
 
3
5
  const getStructuredDataFromPage = (site: any) => site.filter((data: any) => data.fromPage);
4
6
 
@@ -1,7 +1,9 @@
1
1
  import { IDataPack, IGriddoTheme, ISchema, ITemplateOption, IThemeElements } from "@ax/types";
2
- import { themes } from "components";
2
+ import { config } from "components";
3
3
  import { getSchema } from "@ax/helpers";
4
4
 
5
+ const themes = config.schemas.config.themes;
6
+
5
7
  const getDefaultTheme = (): string => {
6
8
  const defaultTheme = (themes as IGriddoTheme[]).find((theme) => theme.default);
7
9
  const theme = defaultTheme ? defaultTheme.value : themes[0].value;
@@ -1,4 +1,4 @@
1
- import { getSchemaThumbnails, getTemplateThumbnails } from "./schemas";
1
+ import { getFormTemplateThumbnails, getSchemaThumbnails, getTemplateThumbnails } from "./schemas";
2
2
 
3
3
  const imageExists = (src: string) => {
4
4
  const req = new XMLHttpRequest();
@@ -41,4 +41,22 @@ const getThumbnailProps = (option: any, template: boolean, theme: string, path?:
41
41
  };
42
42
  };
43
43
 
44
- export { getThumbnailProps };
44
+ const getFormTemplateThumbnailProps = (template: string) => {
45
+ const thumbnails = getFormTemplateThumbnails(template);
46
+
47
+ if (!thumbnails) {
48
+ return false;
49
+ }
50
+
51
+ const fallback = thumbnails["2x"];
52
+ const imgDensity1x = thumbnails["1x"];
53
+ const srcSet = `${imgDensity1x} 1x, ${fallback} 2x`;
54
+
55
+ return {
56
+ srcSet,
57
+ src: fallback,
58
+ alt: template,
59
+ };
60
+ };
61
+
62
+ export { getThumbnailProps, getFormTemplateThumbnailProps };
@@ -1,4 +1,6 @@
1
- import { schemas } from "components";
1
+ import { config } from "components";
2
+
3
+ const schemas = config.schemas.ui;
2
4
 
3
5
  const getTemplateOptions = (): ITemplateOption[] => {
4
6
  const { templates } = schemas;
@@ -5,7 +5,8 @@ import { version } from "./../../../../../package.json";
5
5
 
6
6
  import { IRouter, multisite, site } from "@ax/routes";
7
7
 
8
- import { IRootState, ISite } from "@ax/types";
8
+ import { ILanguage, IRootState, ISite } from "@ax/types";
9
+ import { IGlobalSettings } from "@ax/containers/App/reducer";
9
10
  import { appActions } from "@ax/containers/App";
10
11
  import { Icon, Tag } from "@ax/components";
11
12
  import { Restricted } from "@ax/guards";
@@ -16,7 +17,9 @@ import { NavProvider } from "./context";
16
17
  import * as S from "./style";
17
18
 
18
19
  const NavMenu = (props: IProps) => {
19
- const { location, setHistoryPush, logout, currentSiteInfo, siteLanguages, lang, categories } = props;
20
+ const { location, setHistoryPush, logout, currentSiteInfo, siteLanguages, lang, categories, globalSettings } = props;
21
+
22
+ const { useForms } = globalSettings;
20
23
 
21
24
  const [isOpened, setIsOpened] = useState(false);
22
25
 
@@ -60,10 +63,15 @@ const NavMenu = (props: IProps) => {
60
63
  setHistoryPush(profileRoute);
61
64
  };
62
65
 
66
+ const filteredSiteRoutes = site.filter((route: IRouter) => useForms || (!useForms && !route.path.includes("/forms")));
67
+ const filteredMultisiteRoutes = multisite.filter(
68
+ (route: IRouter) => useForms || (!useForms && !route.path.includes("/forms"))
69
+ );
70
+
63
71
  const config: IConfig = isSite
64
72
  ? {
65
73
  type: "site",
66
- routes: [...site],
74
+ routes: [...filteredSiteRoutes],
67
75
  logo: (
68
76
  <>
69
77
  <S.LogoSite src={siteLogo} alt="Logo" />
@@ -73,7 +81,7 @@ const NavMenu = (props: IProps) => {
73
81
  }
74
82
  : {
75
83
  type: "multisite",
76
- routes: [...multisite],
84
+ routes: [...filteredMultisiteRoutes],
77
85
  logo: (
78
86
  <>
79
87
  <S.Logo src={logoPlaceholder} alt="Logo Griddo" />
@@ -201,8 +209,9 @@ interface IConfig {
201
209
  interface INavMenuProps {
202
210
  categories: any;
203
211
  currentSiteInfo: ISite | null;
204
- siteLanguages: any[];
205
- lang: any;
212
+ siteLanguages: ILanguage[];
213
+ lang: { locale: string; id: number };
214
+ globalSettings: IGlobalSettings;
206
215
  }
207
216
 
208
217
  const mapStateToProps = (state: IRootState) => ({
@@ -210,6 +219,7 @@ const mapStateToProps = (state: IRootState) => ({
210
219
  currentSiteInfo: state.sites.currentSiteInfo,
211
220
  siteLanguages: state.sites.currentSiteLanguages,
212
221
  lang: state.app.lang,
222
+ globalSettings: state.app.globalSettings,
213
223
  });
214
224
 
215
225
  type IProps = INavMenuProps & IDispatchProps & RouteComponentProps;