@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.
- package/config/griddo-config/cx-polyfills/componentsBundle.js +1 -1
- package/package.json +2 -2
- package/scripts/griddo-sync-schemas.js +37 -53
- package/src/GlobalStore.tsx +0 -3
- package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +0 -6
- package/src/api/index.tsx +0 -2
- package/src/components/Browser/index.tsx +37 -42
- package/src/components/Browser/style.tsx +3 -3
- package/src/components/BrowserContent/index.tsx +1 -1
- package/src/components/ConfigPanel/Form/index.tsx +5 -6
- package/src/components/ConfigPanel/GlobalPageForm/index.tsx +1 -3
- package/src/components/ConfigPanel/Header/index.tsx +0 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +5 -4
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +4 -4
- package/src/components/Fields/ComponentArray/helpers.tsx +1 -1
- package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +2 -1
- package/src/components/Fields/ReferenceField/Context/index.tsx +2 -0
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +2 -1
- package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +2 -2
- package/src/components/Fields/ReferenceField/index.tsx +5 -1
- package/src/components/Fields/TextField/index.tsx +3 -3
- package/src/components/Fields/TranslateButton/index.tsx +10 -48
- package/src/components/Fields/Wysiwyg/helpers.tsx +2 -2
- package/src/components/Fields/Wysiwyg/index.tsx +11 -4
- package/src/components/Fields/index.tsx +0 -2
- package/src/components/FieldsBehavior/index.tsx +2 -8
- package/src/components/LanguageMenu/index.tsx +27 -30
- package/src/components/MainWrapper/AppBar/index.tsx +68 -23
- package/src/components/MainWrapper/index.tsx +9 -4
- package/src/components/MenuItem/index.tsx +2 -2
- package/src/components/ResizePanel/index.tsx +2 -3
- package/src/components/ResizePanel/style.tsx +9 -11
- package/src/components/SearchField/style.tsx +2 -2
- package/src/components/SideModal/SideModalOption/index.tsx +2 -3
- package/src/components/SideModal/SideModalOption/style.tsx +2 -2
- package/src/components/SideModal/index.tsx +4 -11
- package/src/components/SideModal/style.tsx +7 -9
- package/src/components/TableFilters/LiveFilter/index.tsx +3 -4
- package/src/components/index.tsx +0 -4
- package/src/containers/App/reducer.tsx +1 -4
- package/src/containers/Navigation/Menu/actions.tsx +13 -6
- package/src/containers/Navigation/Menu/reducer.tsx +4 -0
- package/src/containers/PageEditor/actions.tsx +2 -3
- package/src/containers/PageEditor/reducer.tsx +2 -2
- package/src/forms/editor.tsx +1 -3
- package/src/helpers/index.tsx +1 -12
- package/src/helpers/schemas.tsx +8 -33
- package/src/helpers/structuredData.tsx +1 -3
- package/src/helpers/themes.tsx +1 -3
- package/src/helpers/thumbnails.tsx +2 -20
- package/src/modules/Analytics/GroupPanel/utils.tsx +1 -3
- package/src/modules/App/Routing/NavMenu/index.tsx +6 -16
- package/src/modules/App/Routing/index.tsx +9 -26
- package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +4 -4
- package/src/modules/Categories/CategoriesList/index.tsx +16 -16
- package/src/modules/Content/BulkHeader/TableHeader/index.tsx +5 -1
- package/src/modules/Content/PageItem/index.tsx +33 -34
- package/src/modules/Content/index.tsx +36 -23
- package/src/modules/Content/utils.tsx +1 -3
- package/src/modules/FramePreview/index.tsx +12 -26
- package/src/modules/GlobalEditor/index.tsx +21 -52
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +15 -32
- package/src/modules/Navigation/Defaults/Item/atoms.tsx +5 -6
- package/src/modules/Navigation/Defaults/Item/index.tsx +10 -10
- package/src/modules/Navigation/Defaults/index.tsx +6 -7
- package/src/modules/Navigation/Menus/List/Nav/index.tsx +10 -2
- package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +11 -14
- package/src/modules/Navigation/Menus/List/index.tsx +16 -15
- package/src/modules/Navigation/Menus/index.tsx +17 -9
- package/src/modules/PageEditor/index.tsx +31 -54
- package/src/modules/Settings/Globals/index.tsx +1 -3
- package/src/modules/Settings/Languages/Table/Item/index.tsx +9 -11
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +1 -1
- package/src/modules/StructuredData/Form/index.tsx +28 -41
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +5 -1
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +8 -6
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +7 -5
- package/src/modules/StructuredData/StructuredDataList/index.tsx +10 -13
- package/src/modules/StructuredData/StructuredDataList/utils.tsx +1 -2
- package/src/routes/multisite.tsx +16 -53
- package/src/routes/site.tsx +0 -1
- package/src/schemas/pages/GlobalPage.tsx +0 -1
- package/src/schemas/pages/Page.tsx +1 -4
- package/src/schemas/pages/index.tsx +1 -2
- package/src/types/index.tsx +7 -43
- package/src/api/forms.tsx +0 -191
- package/src/components/Fields/FormFieldArray/index.tsx +0 -13
- package/src/components/Icon/components/Form.js +0 -12
- package/src/components/Icon/svgs/Form.svg +0 -3
- package/src/containers/Forms/actions.tsx +0 -853
- package/src/containers/Forms/constants.tsx +0 -46
- package/src/containers/Forms/index.tsx +0 -4
- package/src/containers/Forms/interfaces.tsx +0 -95
- package/src/containers/Forms/reducer.tsx +0 -81
- package/src/containers/Forms/utils.tsx +0 -42
- package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/index.tsx +0 -42
- package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/style.tsx +0 -36
- package/src/modules/Forms/FormCategoriesList/BulkHeader/index.tsx +0 -37
- package/src/modules/Forms/FormCategoriesList/BulkHeader/style.tsx +0 -9
- package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +0 -125
- package/src/modules/Forms/FormCategoriesList/CategoryItem/style.tsx +0 -91
- package/src/modules/Forms/FormCategoriesList/CategoryPanel/Form/index.tsx +0 -50
- package/src/modules/Forms/FormCategoriesList/CategoryPanel/index.tsx +0 -112
- package/src/modules/Forms/FormCategoriesList/CategoryPanel/style.tsx +0 -31
- package/src/modules/Forms/FormCategoriesList/atoms.tsx +0 -33
- package/src/modules/Forms/FormCategoriesList/hooks.tsx +0 -61
- package/src/modules/Forms/FormCategoriesList/index.tsx +0 -245
- package/src/modules/Forms/FormCategoriesList/style.tsx +0 -82
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/Field/index.tsx +0 -95
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/index.tsx +0 -102
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/style.tsx +0 -9
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/index.tsx +0 -109
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/index.tsx +0 -76
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/style.tsx +0 -28
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Header/index.tsx +0 -132
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Header/style.tsx +0 -30
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/index.tsx +0 -86
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/style.tsx +0 -7
- package/src/modules/Forms/FormEditor/Editor/index.tsx +0 -106
- package/src/modules/Forms/FormEditor/PageBrowser/index.tsx +0 -96
- package/src/modules/Forms/FormEditor/index.tsx +0 -295
- package/src/modules/Forms/FormEditor/style.tsx +0 -32
- package/src/modules/Forms/FormList/BulkHeader/TableHeader/index.tsx +0 -61
- package/src/modules/Forms/FormList/BulkHeader/TableHeader/style.tsx +0 -47
- package/src/modules/Forms/FormList/BulkHeader/index.tsx +0 -60
- package/src/modules/Forms/FormList/FormItem/index.tsx +0 -218
- package/src/modules/Forms/FormList/FormItem/style.tsx +0 -87
- package/src/modules/Forms/FormList/Summary/index.tsx +0 -51
- package/src/modules/Forms/FormList/Summary/style.tsx +0 -46
- package/src/modules/Forms/FormList/TemplateModal/index.tsx +0 -67
- package/src/modules/Forms/FormList/TemplateModal/style.tsx +0 -54
- package/src/modules/Forms/FormList/index.tsx +0 -266
- package/src/modules/Forms/FormList/style.tsx +0 -31
- package/src/modules/Forms/FormsMenu/MenuGroup/index.tsx +0 -57
- package/src/modules/Forms/FormsMenu/MenuGroup/style.tsx +0 -55
- package/src/modules/Forms/FormsMenu/index.tsx +0 -78
- package/src/modules/Forms/FormsMenu/style.tsx +0 -9
- package/src/modules/Forms/atoms.tsx +0 -111
- package/src/modules/Forms/style.tsx +0 -11
- package/src/schemas/pages/FormPage.tsx +0 -49
- package/src/types/forms.tsx +0 -87
- /package/src/modules/Navigation/Menus/{List/helpers.tsx → helpers.tsx} +0 -0
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.
|
|
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": "
|
|
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
|
|
15
|
-
|
|
16
|
-
const
|
|
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
|
-
|
|
21
|
+
async function main() {
|
|
19
22
|
console.clear();
|
|
23
|
+
const tempFile = "__griddo_config_parsed__.js";
|
|
24
|
+
const componentsGriddoConfig = resolveComponentsGriddoConfig();
|
|
20
25
|
|
|
21
|
-
const
|
|
22
|
-
const inputFile = instanceGriddoConfigFile;
|
|
26
|
+
const inputFile = componentsGriddoConfig;
|
|
23
27
|
const outputFile = `${__dirname}/${tempFile}`;
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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(`
|
|
35
|
+
throw new Error(`Source schemas config not found: ${inputFile}`);
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
await compiler({
|
|
35
|
-
input:
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
90
|
-
headers: {
|
|
91
|
-
|
|
92
|
-
|
|
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(
|
|
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
|
-
|
|
103
|
-
|
|
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();
|
package/src/GlobalStore.tsx
CHANGED
|
@@ -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}
|
|
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
|
-
|
|
112
|
-
<S.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<S.
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
>
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
|
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
|
|
50
|
-
border-left: ${(p) =>
|
|
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) =>
|
|
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"
|
|
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
|
|
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
|
-
((
|
|
84
|
-
(
|
|
85
|
-
(
|
|
82
|
+
((curr.title === "content" && isAllowedToEditPageContent) ||
|
|
83
|
+
(curr.title === "config" && isAllowedToEditPageConfig) ||
|
|
84
|
+
(curr.title === "SEO & Analytics" && isAllowedToEditPageSEO)))
|
|
86
85
|
) {
|
|
87
|
-
return [...acc,
|
|
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 {
|
|
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.";
|
|
@@ -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,
|
|
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 =
|
|
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={
|
|
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"
|
|
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],
|
|
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"
|
|
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
|
|
357
|
+
By default, content is shown in the page'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
|
|
121
|
+
value: string;
|
|
122
122
|
onChange: (value: string) => void;
|
|
123
123
|
autoComplete?: string;
|
|
124
124
|
inputType?: string;
|