@griddo/ax 11.0.27-rc.0 → 11.0.28

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 (142) 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 +37 -53
  4. package/src/GlobalStore.tsx +0 -3
  5. package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +0 -6
  6. package/src/api/index.tsx +0 -2
  7. package/src/components/Browser/index.tsx +37 -42
  8. package/src/components/Browser/style.tsx +3 -3
  9. package/src/components/BrowserContent/index.tsx +1 -1
  10. package/src/components/ConfigPanel/Form/index.tsx +5 -6
  11. package/src/components/ConfigPanel/GlobalPageForm/index.tsx +1 -3
  12. package/src/components/ConfigPanel/Header/index.tsx +0 -1
  13. package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +5 -4
  14. package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +4 -4
  15. package/src/components/Fields/ComponentArray/helpers.tsx +1 -1
  16. package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +2 -1
  17. package/src/components/Fields/ReferenceField/Context/index.tsx +2 -0
  18. package/src/components/Fields/ReferenceField/ItemList/index.tsx +2 -1
  19. package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +2 -2
  20. package/src/components/Fields/ReferenceField/index.tsx +5 -1
  21. package/src/components/Fields/TextField/index.tsx +3 -3
  22. package/src/components/Fields/TranslateButton/index.tsx +10 -48
  23. package/src/components/Fields/Wysiwyg/helpers.tsx +2 -2
  24. package/src/components/Fields/Wysiwyg/index.tsx +11 -4
  25. package/src/components/Fields/index.tsx +0 -2
  26. package/src/components/FieldsBehavior/index.tsx +2 -8
  27. package/src/components/LanguageMenu/index.tsx +27 -30
  28. package/src/components/MainWrapper/AppBar/index.tsx +68 -23
  29. package/src/components/MainWrapper/index.tsx +9 -4
  30. package/src/components/MenuItem/index.tsx +2 -2
  31. package/src/components/ResizePanel/index.tsx +2 -3
  32. package/src/components/ResizePanel/style.tsx +9 -11
  33. package/src/components/SearchField/style.tsx +2 -2
  34. package/src/components/SideModal/SideModalOption/index.tsx +2 -3
  35. package/src/components/SideModal/SideModalOption/style.tsx +2 -2
  36. package/src/components/SideModal/index.tsx +4 -11
  37. package/src/components/SideModal/style.tsx +7 -9
  38. package/src/components/TableFilters/LiveFilter/index.tsx +3 -4
  39. package/src/components/index.tsx +0 -4
  40. package/src/containers/App/reducer.tsx +1 -4
  41. package/src/containers/Navigation/Menu/actions.tsx +13 -6
  42. package/src/containers/Navigation/Menu/reducer.tsx +4 -0
  43. package/src/containers/PageEditor/actions.tsx +2 -3
  44. package/src/containers/PageEditor/reducer.tsx +2 -2
  45. package/src/forms/editor.tsx +1 -3
  46. package/src/helpers/index.tsx +1 -12
  47. package/src/helpers/schemas.tsx +8 -33
  48. package/src/helpers/structuredData.tsx +1 -3
  49. package/src/helpers/themes.tsx +1 -3
  50. package/src/helpers/thumbnails.tsx +2 -20
  51. package/src/modules/Analytics/GroupPanel/utils.tsx +1 -3
  52. package/src/modules/App/Routing/NavMenu/index.tsx +6 -16
  53. package/src/modules/App/Routing/index.tsx +9 -26
  54. package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +4 -4
  55. package/src/modules/Categories/CategoriesList/index.tsx +16 -16
  56. package/src/modules/Content/BulkHeader/TableHeader/index.tsx +5 -1
  57. package/src/modules/Content/PageItem/index.tsx +33 -34
  58. package/src/modules/Content/index.tsx +36 -23
  59. package/src/modules/Content/utils.tsx +1 -3
  60. package/src/modules/FramePreview/index.tsx +12 -26
  61. package/src/modules/GlobalEditor/index.tsx +21 -52
  62. package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +15 -32
  63. package/src/modules/Navigation/Defaults/Item/atoms.tsx +5 -6
  64. package/src/modules/Navigation/Defaults/Item/index.tsx +10 -10
  65. package/src/modules/Navigation/Defaults/index.tsx +6 -7
  66. package/src/modules/Navigation/Menus/List/Nav/index.tsx +10 -2
  67. package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +11 -14
  68. package/src/modules/Navigation/Menus/List/index.tsx +16 -15
  69. package/src/modules/Navigation/Menus/index.tsx +17 -9
  70. package/src/modules/PageEditor/index.tsx +31 -54
  71. package/src/modules/Settings/Globals/index.tsx +1 -3
  72. package/src/modules/Settings/Languages/Table/Item/index.tsx +9 -11
  73. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +1 -1
  74. package/src/modules/StructuredData/Form/index.tsx +28 -41
  75. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +5 -1
  76. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +8 -6
  77. package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +7 -5
  78. package/src/modules/StructuredData/StructuredDataList/index.tsx +10 -13
  79. package/src/modules/StructuredData/StructuredDataList/utils.tsx +1 -2
  80. package/src/routes/multisite.tsx +16 -53
  81. package/src/routes/site.tsx +0 -1
  82. package/src/schemas/pages/GlobalPage.tsx +0 -1
  83. package/src/schemas/pages/Page.tsx +1 -4
  84. package/src/schemas/pages/index.tsx +1 -2
  85. package/src/types/index.tsx +7 -43
  86. package/src/api/forms.tsx +0 -191
  87. package/src/components/Fields/FormFieldArray/index.tsx +0 -13
  88. package/src/components/Icon/components/Form.js +0 -12
  89. package/src/components/Icon/svgs/Form.svg +0 -3
  90. package/src/containers/Forms/actions.tsx +0 -853
  91. package/src/containers/Forms/constants.tsx +0 -46
  92. package/src/containers/Forms/index.tsx +0 -4
  93. package/src/containers/Forms/interfaces.tsx +0 -95
  94. package/src/containers/Forms/reducer.tsx +0 -81
  95. package/src/containers/Forms/utils.tsx +0 -42
  96. package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/index.tsx +0 -42
  97. package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/style.tsx +0 -36
  98. package/src/modules/Forms/FormCategoriesList/BulkHeader/index.tsx +0 -37
  99. package/src/modules/Forms/FormCategoriesList/BulkHeader/style.tsx +0 -9
  100. package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +0 -125
  101. package/src/modules/Forms/FormCategoriesList/CategoryItem/style.tsx +0 -91
  102. package/src/modules/Forms/FormCategoriesList/CategoryPanel/Form/index.tsx +0 -50
  103. package/src/modules/Forms/FormCategoriesList/CategoryPanel/index.tsx +0 -112
  104. package/src/modules/Forms/FormCategoriesList/CategoryPanel/style.tsx +0 -31
  105. package/src/modules/Forms/FormCategoriesList/atoms.tsx +0 -33
  106. package/src/modules/Forms/FormCategoriesList/hooks.tsx +0 -61
  107. package/src/modules/Forms/FormCategoriesList/index.tsx +0 -245
  108. package/src/modules/Forms/FormCategoriesList/style.tsx +0 -82
  109. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/Field/index.tsx +0 -95
  110. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/index.tsx +0 -102
  111. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/style.tsx +0 -9
  112. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/index.tsx +0 -109
  113. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/index.tsx +0 -76
  114. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/style.tsx +0 -28
  115. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Header/index.tsx +0 -132
  116. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Header/style.tsx +0 -30
  117. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/index.tsx +0 -86
  118. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/style.tsx +0 -7
  119. package/src/modules/Forms/FormEditor/Editor/index.tsx +0 -106
  120. package/src/modules/Forms/FormEditor/PageBrowser/index.tsx +0 -96
  121. package/src/modules/Forms/FormEditor/index.tsx +0 -295
  122. package/src/modules/Forms/FormEditor/style.tsx +0 -32
  123. package/src/modules/Forms/FormList/BulkHeader/TableHeader/index.tsx +0 -61
  124. package/src/modules/Forms/FormList/BulkHeader/TableHeader/style.tsx +0 -47
  125. package/src/modules/Forms/FormList/BulkHeader/index.tsx +0 -60
  126. package/src/modules/Forms/FormList/FormItem/index.tsx +0 -218
  127. package/src/modules/Forms/FormList/FormItem/style.tsx +0 -87
  128. package/src/modules/Forms/FormList/Summary/index.tsx +0 -51
  129. package/src/modules/Forms/FormList/Summary/style.tsx +0 -46
  130. package/src/modules/Forms/FormList/TemplateModal/index.tsx +0 -67
  131. package/src/modules/Forms/FormList/TemplateModal/style.tsx +0 -54
  132. package/src/modules/Forms/FormList/index.tsx +0 -266
  133. package/src/modules/Forms/FormList/style.tsx +0 -31
  134. package/src/modules/Forms/FormsMenu/MenuGroup/index.tsx +0 -57
  135. package/src/modules/Forms/FormsMenu/MenuGroup/style.tsx +0 -55
  136. package/src/modules/Forms/FormsMenu/index.tsx +0 -78
  137. package/src/modules/Forms/FormsMenu/style.tsx +0 -9
  138. package/src/modules/Forms/atoms.tsx +0 -111
  139. package/src/modules/Forms/style.tsx +0 -11
  140. package/src/schemas/pages/FormPage.tsx +0 -49
  141. package/src/types/forms.tsx +0 -87
  142. /package/src/modules/Navigation/Menus/{List/helpers.tsx → helpers.tsx} +0 -0
@@ -1,4 +1,4 @@
1
- export { default as config } from "__componentsConfig";
1
+ export * from "__componentsConfig";
2
2
  export * from "__componentsIndex";
3
3
  export { default as builderSSR } from "__ssrConfig";
4
4
  export * as ssrHelpers from "__ssrHelpers";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "11.0.27-rc.0",
4
+ "version": "11.0.28",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -225,5 +225,5 @@
225
225
  "publishConfig": {
226
226
  "access": "public"
227
227
  },
228
- "gitHead": "15beb457f7fddc15b542afc42274a740b267da67"
228
+ "gitHead": "b1fd110a0e9185bf5708cf2cee9e733b61dd15b6"
229
229
  }
@@ -7,32 +7,36 @@ const dotenv = require("dotenv");
7
7
  const path = require("path");
8
8
  const fs = require("fs");
9
9
  const compiler = require("../config/webpackSchemas.config");
10
+
10
11
  const { resolveComponentsPath, resolveComponentsGriddoConfig } = require("../config/griddo-config");
11
12
 
12
13
  dotenv.config({ path: findUp.sync(".env") });
13
14
 
14
- const { API_URL, REACT_APP_API_ENDPOINT, GRIDDO_API_URL, developerKey } = process.env;
15
- const apiURL = API_URL || REACT_APP_API_ENDPOINT || GRIDDO_API_URL;
16
- const tempFile = "__griddo_config_parsed__.js";
15
+ const API_URL = process.env.API_URL || process.env.REACT_APP_API_ENDPOINT;
16
+ // TODO: Cambiar por /schemas al pasar a producción
17
+ const API_ENDPOINT = `${API_URL}/schemas`;
18
+ const API_METHOD = "PUT";
19
+ const API_DEV_KEY = process.env.developerKey;
17
20
 
18
- (async () => {
21
+ async function main() {
19
22
  console.clear();
23
+ const tempFile = "__griddo_config_parsed__.js";
24
+ const componentsGriddoConfig = resolveComponentsGriddoConfig();
20
25
 
21
- const instanceGriddoConfigFile = resolveComponentsGriddoConfig();
22
- const inputFile = instanceGriddoConfigFile;
26
+ const inputFile = componentsGriddoConfig;
23
27
  const outputFile = `${__dirname}/${tempFile}`;
24
28
 
25
- try {
26
- if (fs.existsSync(outputFile)) {
27
- fs.unlinkSync(outputFile);
28
- }
29
+ if (fs.existsSync(outputFile)) {
30
+ fs.unlinkSync(outputFile);
31
+ }
29
32
 
33
+ try {
30
34
  if (!fs.existsSync(inputFile)) {
31
- throw new Error(`Griddo config file not found: ${inputFile}`);
35
+ throw new Error(`Source schemas config not found: ${inputFile}`);
32
36
  }
33
37
 
34
38
  await compiler({
35
- input: instanceGriddoConfigFile,
39
+ input: componentsGriddoConfig,
36
40
  output: { filename: tempFile, path: __dirname },
37
41
  });
38
42
 
@@ -45,30 +49,10 @@ const tempFile = "__griddo_config_parsed__.js";
45
49
  }
46
50
 
47
51
  const _griddoConfig = require(path.resolve(__dirname, `./${tempFile}`));
48
- const griddoConfig = _griddoConfig.default;
49
-
50
- const gcs = griddoConfig.schemas;
51
-
52
- const _schemas = {
53
- all: {
54
- ...gcs.ui.modules,
55
- ...gcs.ui.components,
56
- },
57
- modules: gcs.ui.modules,
58
- templates: gcs.ui.templates,
59
- structuredData: gcs.contentTypes.structuredData,
60
- dataPacks: gcs.contentTypes.dataPacks,
61
- dataPacksCategories: gcs.contentTypes.dataPacksCategories,
62
- languages: gcs.config.languages,
63
- menus: gcs.config.menus,
64
- menuItems: gcs.config.menuItems,
65
- richTextConfig: gcs.config.richTextConfig,
66
- forms: gcs.forms,
67
- };
52
+ const griddoConfig = _griddoConfig.default || _griddoConfig;
68
53
 
69
- // La propiedad computed en los schemas de datos estructurados se perderá si
70
- // no la stringificamos primero.
71
- parseComputedPropInStructuredDataSchemas(_schemas.structuredData);
54
+ // La propiedad computed en los schemas de datos estructurados se perderá si no la stringificamos primero
55
+ checkComputedSchemas(griddoConfig.schemas);
72
56
 
73
57
  const { version } = require(resolveComponentsPath("package.json"));
74
58
 
@@ -80,31 +64,29 @@ const tempFile = "__griddo_config_parsed__.js";
80
64
  dataPacksCategories: {},
81
65
  languages: [],
82
66
  };
83
- const data = { version, ...emptySchemas, ..._schemas };
84
- console.log("En sync schemas mandamos este data: \n");
85
- console.log(data);
86
- console.log("----------");
67
+
87
68
  try {
88
69
  await axios({
89
- url: `${apiURL}/schemas`,
90
- headers: { authorization: developerKey },
91
- method: "PUT",
92
- data,
70
+ url: API_ENDPOINT,
71
+ headers: {
72
+ authorization: API_DEV_KEY,
73
+ },
74
+ method: API_METHOD,
75
+ data: { version, ...emptySchemas, ...griddoConfig.schemas },
93
76
  });
94
- console.log(`${chalk.green(" ")} Schemas`);
77
+ console.log("📦 Schemas ✓");
95
78
  } catch (e) {
96
79
  console.log(chalk.red("ERROR:"), e.response?.data?.message || e.response || e.message);
97
80
  process.exit(1);
98
81
  }
99
- })();
82
+ }
83
+
84
+ const checkComputedSchemas = (schemas) => {
85
+ const structuredDataSchemas = schemas.structuredData;
100
86
 
101
- /**
102
- * Parse the computed property of structured data schemas to string.
103
- * @mutates
104
- */
105
- function parseComputedPropInStructuredDataSchemas(schemas) {
106
- for (const schema in schemas) {
107
- const fields = schemas[schema].schema?.fields;
87
+ for (const structuredData in structuredDataSchemas) {
88
+ const value = structuredDataSchemas[structuredData];
89
+ const fields = value.schema?.fields;
108
90
 
109
91
  if (!fields) continue;
110
92
 
@@ -114,4 +96,6 @@ function parseComputedPropInStructuredDataSchemas(schemas) {
114
96
  if (computed) field.computed = computed.toString();
115
97
  }
116
98
  }
117
- }
99
+ };
100
+
101
+ main();
@@ -21,7 +21,6 @@ import { redirectsReducer, redirectsInitialState } from "./containers/Redirects/
21
21
  import { analyticsReducer, analyticsInitialState } from "./containers/Analytics/reducer";
22
22
  import { integrationsReducer, integrationsInitialState } from "./containers/Integrations/reducer";
23
23
  import { fileDriveReducer, fileDriveInitialState } from "./containers/FileDrive/reducer";
24
- import { formsReducer, formsInitialState } from "./containers/Forms/reducer";
25
24
  import { LOGOUT } from "./containers/App/constants";
26
25
 
27
26
  import { IRootState } from "@ax/types";
@@ -57,7 +56,6 @@ export class GlobalStore {
57
56
  analytics: analyticsReducer as Reducer<any, Action<any>>,
58
57
  integrations: integrationsReducer as Reducer<any, Action<any>>,
59
58
  fileDrive: fileDriveReducer as Reducer<any, Action<any>>,
60
- forms: formsReducer as Reducer<any, Action<any>>,
61
59
  });
62
60
 
63
61
  const rootReducer = (state: IRootState | undefined, action: any) => {
@@ -80,7 +78,6 @@ export class GlobalStore {
80
78
  analytics: analyticsInitialState,
81
79
  integrations: integrationsInitialState,
82
80
  fileDrive: fileDriveInitialState,
83
- forms: formsInitialState,
84
81
  };
85
82
  }
86
83
 
@@ -17,7 +17,6 @@ const defaultProps = mock<ILiveFilterProps>();
17
17
 
18
18
  describe("LiveFilter component rendering", () => {
19
19
  it("should render live filter", async () => {
20
- defaultProps.hasBasicStatus = false;
21
20
  defaultProps.value = [{ value: "all", label: "All" }];
22
21
  const filterItems = jest.fn() as CalledWithMock<void, [pointer: string, filter: IQueryValue[]]>;
23
22
 
@@ -53,7 +52,6 @@ describe("LiveFilter component rendering", () => {
53
52
  });
54
53
 
55
54
  it("should render the component with no options", async () => {
56
- defaultProps.hasBasicStatus = false;
57
55
  defaultProps.value = [{ value: "all", label: "All" }];
58
56
  const filterItems = jest.fn() as CalledWithMock<void, [pointer: string, filter: IQueryValue[]]>;
59
57
 
@@ -91,7 +89,6 @@ describe("LiveFilter component rendering", () => {
91
89
 
92
90
  describe("LiveFilter events", () => {
93
91
  it("should render check group on click", async () => {
94
- defaultProps.hasBasicStatus = false;
95
92
  defaultProps.value = [{ value: "all", label: "All" }];
96
93
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: IQueryValue[]]>;
97
94
 
@@ -132,7 +129,6 @@ describe("LiveFilter events", () => {
132
129
  });
133
130
 
134
131
  it("should check option on click", async () => {
135
- defaultProps.hasBasicStatus = false;
136
132
  defaultProps.value = [{ value: "all", label: "All" }];
137
133
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: IQueryValue[]]>;
138
134
 
@@ -176,7 +172,6 @@ describe("LiveFilter events", () => {
176
172
  });
177
173
 
178
174
  it("should uncheck selected option on click and select 'All' option", async () => {
179
- defaultProps.hasBasicStatus = false;
180
175
  defaultProps.value = [{ value: "all", label: "All" }];
181
176
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: IQueryValue[]]>;
182
177
 
@@ -225,7 +220,6 @@ describe("LiveFilter events", () => {
225
220
  });
226
221
 
227
222
  it("should call filterItems action on change", async () => {
228
- defaultProps.hasBasicStatus = false;
229
223
  defaultProps.value = [{ value: "all", label: "All" }];
230
224
  const filterItemsMock = jest.fn() as CalledWithMock<void, [pointer: string, filter: IQueryValue[]]>;
231
225
 
package/src/api/index.tsx CHANGED
@@ -18,7 +18,6 @@ import redirects from "./redirects";
18
18
  import analytics from "./analytics";
19
19
  import roles from "./roles";
20
20
  import integrations from "./integrations";
21
- import forms from "./forms";
22
21
 
23
22
  export {
24
23
  sites,
@@ -41,5 +40,4 @@ export {
41
40
  analytics,
42
41
  roles,
43
42
  integrations,
44
- forms,
45
43
  };
@@ -28,13 +28,11 @@ const Browser = (props: IBrowserProps): JSX.Element => {
28
28
  showIframe,
29
29
  browserRef,
30
30
  actions,
31
- editorType = "page",
32
31
  } = props;
33
32
 
34
33
  const { id, entity } = content;
35
34
  const domain = window.location.origin;
36
- const urlPreview = `${domain}/editor/page-preview?preview=${!!isPreview}&disabled=${!!disabled}&type=${editorType}`;
37
- const isPageEditor = editorType === "page";
35
+ const urlPreview = `${domain}/editor/page-preview?preview=${!!isPreview}&disabled=${!!disabled}`;
38
36
 
39
37
  const [resolution, setResolution] = useState("desktop");
40
38
  const { isVisible, toggleToast, setIsVisible } = useToast();
@@ -108,45 +106,43 @@ const Browser = (props: IBrowserProps): JSX.Element => {
108
106
 
109
107
  return (
110
108
  <S.BrowserWrapper data-testid="browser-wrapper" ref={browserRef}>
111
- {isPageEditor && (
112
- <S.NavBar>
113
- <S.NavUrl>{url}</S.NavUrl>
114
- {isPreview && (
115
- <S.NavActions data-testid="nav-actions-wrapper">
116
- <S.IconWrapper data-testid="icon-wrapper-browser" onClick={copyUrl}>
117
- <Tooltip content="Copy url to share draft" bottom>
118
- <Icon name="share" size="24" />
119
- </Tooltip>
120
- </S.IconWrapper>
121
- <S.IconWrapper active={resolution === "desktop"} onClick={() => setResolution("desktop")}>
122
- <Tooltip content="Desktop" bottom>
123
- <Icon name="desktop" size="24" />
124
- </Tooltip>
125
- </S.IconWrapper>
126
- <S.IconWrapper
127
- data-testid="icon-res-tablet"
128
- active={resolution === "tablet"}
129
- onClick={() => setResolution("tablet")}
130
- >
131
- <Tooltip content="Tablet" bottom>
132
- <Icon name="tablet" size="24" />
133
- </Tooltip>
134
- </S.IconWrapper>
135
- <S.IconWrapper
136
- data-testid="icon-res-phone"
137
- active={resolution === "phone"}
138
- onClick={() => setResolution("phone")}
139
- >
140
- <Tooltip content="Mobile" bottom>
141
- <Icon name="phone" size="24" />
142
- </Tooltip>
143
- </S.IconWrapper>
144
- </S.NavActions>
145
- )}
146
- </S.NavBar>
147
- )}
109
+ <S.NavBar>
110
+ <S.NavUrl>{url}</S.NavUrl>
111
+ {isPreview && (
112
+ <S.NavActions data-testid="nav-actions-wrapper">
113
+ <S.IconWrapper data-testid="icon-wrapper-browser" onClick={copyUrl}>
114
+ <Tooltip content="Copy url to share draft" bottom>
115
+ <Icon name="share" size="24" />
116
+ </Tooltip>
117
+ </S.IconWrapper>
118
+ <S.IconWrapper active={resolution === "desktop"} onClick={() => setResolution("desktop")}>
119
+ <Tooltip content="Desktop" bottom>
120
+ <Icon name="desktop" size="24" />
121
+ </Tooltip>
122
+ </S.IconWrapper>
123
+ <S.IconWrapper
124
+ data-testid="icon-res-tablet"
125
+ active={resolution === "tablet"}
126
+ onClick={() => setResolution("tablet")}
127
+ >
128
+ <Tooltip content="Tablet" bottom>
129
+ <Icon name="tablet" size="24" />
130
+ </Tooltip>
131
+ </S.IconWrapper>
132
+ <S.IconWrapper
133
+ data-testid="icon-res-phone"
134
+ active={resolution === "phone"}
135
+ onClick={() => setResolution("phone")}
136
+ >
137
+ <Tooltip content="Mobile" bottom>
138
+ <Icon name="phone" size="24" />
139
+ </Tooltip>
140
+ </S.IconWrapper>
141
+ </S.NavActions>
142
+ )}
143
+ </S.NavBar>
148
144
  {showIframe ? (
149
- <S.FrameWrapper hasBorder={isPageEditor} data-testid="navbar-iframe-wrapper">
145
+ <S.FrameWrapper data-testid="navbar-iframe-wrapper">
150
146
  <iframe title="Preview" width={getWidth(resolution)} height="100%" src={urlPreview} loading="lazy" />
151
147
  </S.FrameWrapper>
152
148
  ) : (
@@ -193,7 +189,6 @@ export interface IBrowserProps {
193
189
  isPreview?: boolean;
194
190
  showIframe?: boolean;
195
191
  browserRef?: React.RefObject<HTMLDivElement>;
196
- editorType?: "form" | "page";
197
192
  actions?: {
198
193
  setSelectedContentAction: any;
199
194
  deleteModuleAction(editorID: number[]): void;
@@ -46,10 +46,10 @@ const IconWrapper = styled.div<{ active?: boolean }>`
46
46
  }
47
47
  `;
48
48
 
49
- const FrameWrapper = styled.div<{ hasBorder: boolean }>`
50
- border-left: ${(p) => (p.hasBorder ? `1px solid ${p.theme.color.uiLine}` : "none")};
49
+ const FrameWrapper = styled.div`
50
+ border-left: 1px solid ${(p) => p.theme.color.uiLine};
51
51
  border-right: 1px solid ${(p) => p.theme.color.uiLine};
52
- border-bottom: ${(p) => (p.hasBorder ? `1px solid ${p.theme.color.uiLine}` : "none")};
52
+ border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
53
53
  display: flex;
54
54
  justify-content: center;
55
55
  height: 100%;
@@ -76,7 +76,7 @@ interface IProps {
76
76
  footer?: any;
77
77
  languageID: number;
78
78
  pageLanguages: Core.Page["pageLanguages"];
79
- renderer: "editor" | "preview" | "forms";
79
+ renderer: "editor" | "preview";
80
80
  selectEditorID?(
81
81
  selectedComponent: { editorID: number; component: any; type: string; parentEditorID: number },
82
82
  parentComponent: string | undefined | null,
@@ -35,7 +35,7 @@ export const Form = (props: IFormProps): JSX.Element => {
35
35
  (!isGlobal && isAllowedToEditConfigPages) || (isGlobal && isAllowedToEditGlobalData);
36
36
  const isAllowedToEditPageSEO = (!isGlobal && isAllowedToEditSiteSeo) || (isGlobal && isAllowedToEditGlobalSeo);
37
37
 
38
- const tabContent = schema.configTabs.find((tab: ISchemaTab) => tab.title.toLowerCase() === selectedTab);
38
+ const tabContent = schema.configTabs.find((tab: ISchemaTab) => tab.title === selectedTab);
39
39
  const setTab = (tab: string) => setSelectedTab(tab);
40
40
 
41
41
  const generateFields = (field: ISchemaField) => {
@@ -76,15 +76,14 @@ export const Form = (props: IFormProps): JSX.Element => {
76
76
  .filter((value: string | boolean) => !!value);
77
77
  } else {
78
78
  mappedTabs = schema.configTabs.reduce((acc: string[], curr: ISchemaTab) => {
79
- const currTitle = curr.title.toLowerCase();
80
79
  if (
81
80
  !isPageSchema ||
82
81
  (isPageSchema &&
83
- ((currTitle === "content" && isAllowedToEditPageContent) ||
84
- (currTitle === "config" && isAllowedToEditPageConfig) ||
85
- (currTitle === "seo & analytics" && isAllowedToEditPageSEO)))
82
+ ((curr.title === "content" && isAllowedToEditPageContent) ||
83
+ (curr.title === "config" && isAllowedToEditPageConfig) ||
84
+ (curr.title === "SEO & Analytics" && isAllowedToEditPageSEO)))
86
85
  ) {
87
- return [...acc, currTitle];
86
+ return [...acc, curr.title];
88
87
  }
89
88
  return acc;
90
89
  }, []);
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { config } from "components";
2
+ import { themes } from "components";
3
3
 
4
4
  import { Icon, NoteField, Tabs } from "@ax/components";
5
5
  import { INotification, ISchema } from "@ax/types";
@@ -9,8 +9,6 @@ import ConnectedField from "../Form/ConnectedField";
9
9
 
10
10
  import * as S from "./style";
11
11
 
12
- const themes = config.schemas.config.themes;
13
-
14
12
  const noteText = "This is Global content and you cannot edit it here. To do so, you must go to the Global page";
15
13
  const noteTitle = "Global content";
16
14
  const errorText = "You don't have the permissions to edit the original content.";
@@ -66,7 +66,6 @@ const Header = (props: IHeaderProps) => {
66
66
  setBreadcrumbOld(breadcrumb);
67
67
  }
68
68
  }
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
69
  }, [headerRef, breadcrumb, setHeaderHeight]);
71
70
 
72
71
  const removeItem = () => {
@@ -2,10 +2,11 @@ import React, { memo } from "react";
2
2
  import { IconAction, SideModal, Tooltip } from "@ax/components";
3
3
 
4
4
  const AddItemButton = (props: IProps) => {
5
- const { handleClick, whiteList, categories, theme, isOpen, contentType, toggleModal } = props;
5
+ const { handleClick, whiteList, isModuleArr, categories, theme, isOpen, toggleModal } = props;
6
+ const optionsType = isModuleArr ? "modules" : "components";
6
7
  const addAction = whiteList.length <= 1 ? () => handleClick(whiteList[0]) : toggleModal;
7
8
 
8
- const tooltip = contentType === "fields" ? "Add field" : contentType === "module" ? "Add module" : "Add component";
9
+ const tooltip = isModuleArr ? "Add module" : "Add component";
9
10
 
10
11
  return (
11
12
  <>
@@ -13,7 +14,7 @@ const AddItemButton = (props: IProps) => {
13
14
  <IconAction icon="add" onClick={addAction} />
14
15
  </Tooltip>
15
16
  <SideModal
16
- optionsType={contentType}
17
+ optionsType={optionsType}
17
18
  whiteList={whiteList}
18
19
  categories={categories}
19
20
  toggleModal={toggleModal}
@@ -29,11 +30,11 @@ const AddItemButton = (props: IProps) => {
29
30
  interface IProps {
30
31
  handleClick: any;
31
32
  whiteList: any[];
33
+ isModuleArr: boolean;
32
34
  categories?: any;
33
35
  theme: string;
34
36
  toggleModal: () => void;
35
37
  isOpen: boolean;
36
- contentType: string;
37
38
  }
38
39
 
39
40
  export default memo(AddItemButton);
@@ -84,7 +84,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
84
84
  };
85
85
 
86
86
  const isComponentModule = contentType === "components";
87
- const isModuleArr = contentType === "modules" || contentType === "fields";
87
+ const isModuleArr = contentType === "modules";
88
88
 
89
89
  const handleAddModule = (moduleType: string) =>
90
90
  addModuleAction && addModuleAction(moduleType, objKey, editorID, isComponentModule);
@@ -97,7 +97,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
97
97
  const { modules } = selectedContent;
98
98
  if (isModuleArr && deleteModuleAction && modules?.length > 0) {
99
99
  const currentModule: IModule = modules[0];
100
- deleteModuleAction([currentModule.editorID], objKey);
100
+ deleteModuleAction([currentModule.editorID], contentType);
101
101
  handleAddModule(moduleType);
102
102
  } else {
103
103
  replaceElementsInCollectionAction && replaceElementsInCollectionAction(moduleType);
@@ -278,8 +278,8 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
278
278
  whiteList={whiteList}
279
279
  categories={categories}
280
280
  handleClick={handleAdd}
281
+ isModuleArr={isModuleArr}
281
282
  theme={theme}
282
- contentType={contentType}
283
283
  />
284
284
  )}
285
285
  </S.ActionsWrapper>
@@ -333,7 +333,7 @@ export interface IMixableComponentArrayProps {
333
333
  setNotificationAction: (notification: INotification) => void;
334
334
  replaceModuleAction: (module: any, parent: any, objKey: string) => void;
335
335
  };
336
- categories?: any[];
336
+ categories?: any;
337
337
  disabled?: boolean;
338
338
  activatedModules: string[];
339
339
  objKey: string;
@@ -19,7 +19,7 @@ const getComponentProps = (element: IModule, activatedModules: string[], isModul
19
19
  const schemaType = getSchemaType(component);
20
20
  const displayName = getDisplayName(component);
21
21
  const title = getComponentTitle(component, element.title);
22
- const isModule = schemaType === "module" || schemaType === "formComponent";
22
+ const isModule = schemaType === "module";
23
23
  const moduleTitle = isModule && displayName !== title && title;
24
24
  const componentTitle = !isModule && displayName !== title && title;
25
25
  const isModuleDeactivated = isModuleArr && activatedModules && !activatedModules.includes(component);
@@ -158,6 +158,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
158
158
  preferenceLanguage: state.preferenceLanguage,
159
159
  lang: state.lang,
160
160
  site: state.site,
161
+ fields: state.fields,
161
162
  };
162
163
 
163
164
  onChange(newValue);
@@ -353,7 +354,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
353
354
  <S.ConfigWrapper>
354
355
  <S.SubConfigContent hasMargin={true}>
355
356
  <S.OptionDescription isOpen={configState.isCustomLangOpen}>
356
- By default, content is shown in the page's language. Activate this option to{" "}
357
+ By default, content is shown in the page&apos;s language. Activate this option to{" "}
357
358
  <strong>specifically set a different language</strong> for the content shown in this
358
359
  distributor.
359
360
  </S.OptionDescription>
@@ -96,6 +96,7 @@ export interface IReferenceState {
96
96
  preferenceLanguage: boolean;
97
97
  lang?: number;
98
98
  site?: number;
99
+ fields?: string[];
99
100
  }
100
101
 
101
102
  export interface IRefField {
@@ -109,6 +110,7 @@ export interface IRefField {
109
110
  preferenceLanguage?: boolean;
110
111
  lang?: number;
111
112
  site?: number;
113
+ fields?: string[];
112
114
  }
113
115
 
114
116
  export interface IFilter {
@@ -14,7 +14,7 @@ const ItemList = (props: IProps) => {
14
14
  const { items, currentSite, handleListDelete, handleListMove, site } = props;
15
15
 
16
16
  const { state, setState, setReorderElements } = useReference();
17
- const { fixed, selectedItems, sourceTitles, fullRelations } = state;
17
+ const { fixed, selectedItems, sourceTitles, fullRelations, fields } = state;
18
18
 
19
19
  const getParams = useCallback(() => {
20
20
  const params = {
@@ -22,6 +22,7 @@ const ItemList = (props: IProps) => {
22
22
  fixed: items,
23
23
  fullRelations,
24
24
  site,
25
+ fields,
25
26
  };
26
27
 
27
28
  return params;
@@ -94,8 +94,8 @@ const ManualPanel = (props: IProps) => {
94
94
  setState((state: IReferenceState) => ({ ...state, showSelected: !state.showSelected }));
95
95
 
96
96
  const handleAdd = () => {
97
- const { mode, fixed, fullRelations, site, lang } = state;
98
- const newValue = { mode, fixed, fullRelations, site, lang };
97
+ const { mode, fixed, fullRelations, site, lang, fields } = state;
98
+ const newValue = { mode, fixed, fullRelations, site, lang, fields };
99
99
  onChange(newValue);
100
100
  handleValidation && handleValidation(state.fixed, validators);
101
101
  };
@@ -45,7 +45,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
45
45
  const isAuto = mode === "auto";
46
46
  const hasMaxItems = !!(value && value.fixed && maxItems && !isAuto && value.fixed.length >= maxItems);
47
47
  const sourcesIDs = sources.map((source: ISource) => source.structuredData);
48
- const { fixed, order, quantity, allLanguages, preferenceLanguage, fullRelations = false } = state;
48
+ const { fixed, order, quantity, allLanguages, preferenceLanguage, fullRelations = false, fields } = state;
49
49
 
50
50
  const handleMode = (mode: string) => {
51
51
  const manualSources: string[] = state.selectedItems.reduce(
@@ -69,12 +69,14 @@ const ReferenceField = (props: IReferenceFieldProps) => {
69
69
  fullRelations,
70
70
  allLanguages,
71
71
  preferenceLanguage,
72
+ fields,
72
73
  }
73
74
  : {
74
75
  mode,
75
76
  sources,
76
77
  fixed,
77
78
  fullRelations,
79
+ fields,
78
80
  };
79
81
  onChange(newValue);
80
82
  setModeAndSource(mode, mappedSources);
@@ -134,6 +136,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
134
136
  mode,
135
137
  fixed,
136
138
  fullRelations,
139
+ fields,
137
140
  };
138
141
  onChange(newValue);
139
142
  resetValidation && resetValidation();
@@ -144,6 +147,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
144
147
  mode,
145
148
  fixed,
146
149
  fullRelations,
150
+ fields,
147
151
  };
148
152
  onChange(newValue);
149
153
  };
@@ -29,7 +29,7 @@ const TextField = (props: ITextFieldProps): JSX.Element => {
29
29
  } = props;
30
30
 
31
31
  const [width, setWidth] = useState(0);
32
- const [state, setState] = useState<string>(value || "");
32
+ const [state, setState] = useState<string>(value);
33
33
  const prefixRef = useRef<HTMLDivElement>(null);
34
34
  const timeOutRef = useRef<ReturnType<typeof setTimeout>>();
35
35
 
@@ -50,7 +50,7 @@ const TextField = (props: ITextFieldProps): JSX.Element => {
50
50
  }, [state]);
51
51
 
52
52
  useEffect(() => {
53
- !autoComplete && setState(value || "");
53
+ !autoComplete && setState(value);
54
54
  // eslint-disable-next-line react-hooks/exhaustive-deps
55
55
  }, [editorID, value]);
56
56
 
@@ -118,7 +118,7 @@ const TextField = (props: ITextFieldProps): JSX.Element => {
118
118
  };
119
119
 
120
120
  interface ITextFieldProps {
121
- value?: string;
121
+ value: string;
122
122
  onChange: (value: string) => void;
123
123
  autoComplete?: string;
124
124
  inputType?: string;