@griddo/ax 1.63.3 → 1.64.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.
- package/config/griddo-config/cx-polyfills/builder.ssr.js +6 -0
- package/config/griddo-config/cx-polyfills/componentsBundle.js +4 -0
- package/config/{griddo-config.js → griddo-config/index.js} +36 -15
- package/config/griddo-config/ssrHelpers.js +47 -0
- package/config/jest/componentsMock.js +29 -0
- package/config/jest/fileMock.js +1 -0
- package/config/jest/setup.js +5 -0
- package/config/jest/styleMock.js +1 -0
- package/config/jest/test-utils.js +17 -0
- package/config/paths.js +36 -5
- package/config/webpack.config.js +1 -1
- package/config/webpackDevServer.config.js +4 -1
- package/config/webpackSchemas.config.js +4 -1
- package/package.json +35 -64
- package/scripts/build.js +9 -2
- package/src/__mocks__/reducers/analyticsState.tsx +14 -0
- package/src/__mocks__/reducers/pageEditor.tsx +30 -0
- package/src/api/sites.tsx +28 -6
- package/src/api/structuredData.tsx +1 -1
- package/src/api/users.tsx +5 -4
- package/src/components/ActionMenu/style.tsx +2 -0
- package/src/components/Browser/index.tsx +9 -5
- package/src/{modules/Content/PageItem/atoms.tsx → components/CategoryCell/index.tsx} +4 -6
- package/src/components/CategoryCell/style.tsx +11 -0
- package/src/components/Fields/AnalyticsField/PageAnalytics/index.tsx +19 -19
- package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/atoms.tsx +26 -16
- package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/index.tsx +8 -13
- package/src/components/Fields/AnalyticsField/index.test.tsx +100 -0
- package/src/components/Fields/AnalyticsField/index.tsx +9 -2
- package/src/components/Fields/AnalyticsField/utils.tsx +2 -2
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/style.tsx +2 -1
- package/src/components/Fields/CheckField/index.test.tsx +95 -0
- package/src/components/Fields/CheckField/index.tsx +9 -3
- package/src/components/Fields/CheckField/style.tsx +32 -24
- package/src/components/Fields/CheckGroup/index.test.tsx +274 -0
- package/src/components/Fields/CheckGroup/index.tsx +2 -1
- package/src/components/Fields/FileField/FileDragAndDrop/style.tsx +3 -2
- package/src/components/Fields/FileField/style.tsx +2 -1
- package/src/components/Fields/MultiCheckSelect/style.tsx +18 -18
- package/src/components/Fields/NoteField/style.tsx +9 -9
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +1 -1
- package/src/components/Fields/Select/style.tsx +41 -37
- package/src/components/Fields/TagField/index.test.tsx +136 -0
- package/src/components/Fields/TagField/index.tsx +8 -12
- package/src/components/Fields/TextArea/index.test.tsx +69 -0
- package/src/components/Fields/TextArea/index.tsx +4 -13
- package/src/components/Fields/TextArea/style.tsx +2 -2
- package/src/components/Fields/TextField/index.test.tsx +144 -0
- package/src/components/Fields/TextField/index.tsx +23 -19
- package/src/components/Fields/TextField/style.tsx +16 -7
- package/src/components/Fields/UniqueCheck/index.test.tsx +43 -0
- package/src/components/Fields/UrlField/utils.tsx +8 -6
- package/src/components/FieldsBehavior/index.tsx +0 -2
- package/src/components/FieldsBehavior/style.tsx +21 -21
- package/src/components/Gallery/GalleryFilters/Orientation/style.tsx +2 -1
- package/src/components/Gallery/GalleryFilters/SortBy/style.tsx +2 -1
- package/src/components/Icon/index.tsx +12 -10
- package/src/components/IconAction/index.tsx +7 -1
- package/src/components/IconAction/style.tsx +10 -10
- package/src/components/SearchField/index.tsx +11 -8
- package/src/components/SearchField/style.tsx +21 -12
- package/src/components/TableFilters/CategoryFilter/index.tsx +1 -1
- package/src/components/TableFilters/CategoryFilter/style.tsx +2 -1
- package/src/components/TableFilters/DateFilter/style.tsx +2 -1
- package/src/components/TableFilters/LiveFilter/index.tsx +2 -2
- package/src/components/TableFilters/LiveFilter/style.tsx +2 -1
- package/src/components/TableFilters/NameFilter/style.tsx +2 -1
- package/src/components/TableFilters/SiteFilter/index.tsx +38 -24
- package/src/components/TableFilters/SiteFilter/style.tsx +2 -1
- package/src/components/TableFilters/StatusFilter/style.tsx +2 -1
- package/src/components/TableFilters/TranslationsFilter/style.tsx +2 -1
- package/src/components/TableFilters/TypeFilter/style.tsx +2 -1
- package/src/components/Tag/index.tsx +9 -7
- package/src/components/Tag/style.tsx +20 -8
- package/src/components/index.tsx +4 -2
- package/src/containers/App/reducer.tsx +0 -2
- package/src/containers/PageEditor/actions.tsx +2 -2
- package/src/containers/Sites/actions.tsx +30 -19
- package/src/containers/Users/actions.tsx +10 -2
- package/src/containers/Users/reducer.tsx +3 -1
- package/src/helpers/fields.tsx +2 -4
- package/src/helpers/index.tsx +3 -0
- package/src/helpers/themes.tsx +9 -0
- package/src/index.tsx +3 -0
- package/src/modules/Analytics/GroupPanel/utils.tsx +3 -3
- package/src/modules/App/Routing/NavMenu/index.tsx +13 -12
- package/src/modules/Content/PageItem/index.tsx +31 -9
- package/src/modules/Content/PageItem/style.tsx +0 -7
- package/src/modules/Content/atoms.tsx +78 -0
- package/src/modules/Content/index.tsx +104 -33
- package/src/modules/Content/style.tsx +10 -7
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +0 -4
- package/src/modules/GlobalEditor/index.tsx +3 -3
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/DefaultsBrowser/index.tsx +0 -4
- package/src/modules/PageEditor/PageBrowser/index.tsx +0 -4
- package/src/modules/PageEditor/atoms.tsx +74 -0
- package/src/modules/PageEditor/index.tsx +30 -9
- package/src/modules/PageEditor/style.tsx +4 -0
- package/src/modules/PublicPreview/index.tsx +3 -5
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/TemplateBrowser/index.tsx +0 -4
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/index.tsx +2 -3
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/index.tsx +1 -1
- package/src/modules/Settings/Globals/index.tsx +3 -3
- package/src/modules/StructuredData/Form/index.tsx +2 -4
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +22 -18
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/atoms.tsx +3 -24
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +2 -2
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +0 -7
- package/src/modules/StructuredData/StructuredDataList/OptionTable/index.tsx +2 -4
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +46 -14
- package/src/modules/StructuredData/StructuredDataList/hooks.tsx +21 -9
- package/src/modules/StructuredData/StructuredDataList/index.tsx +48 -20
- package/src/modules/Users/Profile/index.tsx +12 -7
- package/src/modules/Users/UserCreate/SiteItem/index.tsx +44 -0
- package/src/modules/Users/UserCreate/SiteItem/style.tsx +30 -0
- package/src/modules/Users/UserCreate/index.tsx +120 -10
- package/src/modules/Users/UserCreate/style.tsx +54 -1
- package/src/modules/Users/UserEdit/index.tsx +53 -15
- package/src/modules/Users/UserForm/index.tsx +152 -5
- package/src/modules/Users/UserForm/style.tsx +40 -2
- package/src/modules/Users/UserList/BulkHeader/TableHeader/index.tsx +40 -2
- package/src/modules/Users/UserList/BulkHeader/TableHeader/style.tsx +0 -1
- package/src/modules/Users/UserList/BulkHeader/index.tsx +10 -1
- package/src/modules/Users/UserList/UserItem/index.tsx +70 -15
- package/src/modules/Users/UserList/hooks.tsx +58 -1
- package/src/modules/Users/UserList/index.tsx +80 -34
- package/src/modules/Users/index.tsx +18 -11
- package/src/routes/site.tsx +8 -0
- package/src/types/index.tsx +7 -0
- package/tsconfig.json +2 -0
- package/patches/connected-react-router+6.9.2.patch +0 -12
- package/scripts/test.js +0 -45
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
1
2
|
const path = require("path");
|
|
2
3
|
const findUp = require("find-up");
|
|
3
4
|
|
|
@@ -5,11 +6,21 @@ const pkgDir = require("pkg-dir");
|
|
|
5
6
|
|
|
6
7
|
const isComponentLibraryEnv = __dirname.includes("node_modules");
|
|
7
8
|
|
|
9
|
+
const componentsBundlePolyfillPath = path.resolve(__dirname, "./cx-polyfills/componentsBundle.js");
|
|
10
|
+
|
|
8
11
|
const resolveComponentsPath = (customPath = "") =>
|
|
9
12
|
isComponentLibraryEnv
|
|
10
13
|
? path.resolve(pkgDir.sync(process.cwd()), customPath)
|
|
11
14
|
: path.resolve(pkgDir.sync(__dirname), "../griddo-components", customPath);
|
|
12
15
|
|
|
16
|
+
const resolveBuilderSSRPath = () => {
|
|
17
|
+
const builderSSRPolyfillPath = path.resolve(__dirname, "./cx-polyfills/builder.ssr.js");
|
|
18
|
+
const builderSSRPath = resolveComponentsPath("builder.ssr.js");
|
|
19
|
+
const builderSSRPathExists = fs.existsSync(builderSSRPath);
|
|
20
|
+
|
|
21
|
+
return builderSSRPathExists ? builderSSRPath : builderSSRPolyfillPath;
|
|
22
|
+
};
|
|
23
|
+
|
|
13
24
|
const getComponentsJSConfig = () => {
|
|
14
25
|
const jsConfigPath = findUp.sync("jsconfig.json", { cwd: resolveComponentsPath() });
|
|
15
26
|
const tsConfigPath = findUp.sync("tsconfig.json", { cwd: resolveComponentsPath() });
|
|
@@ -34,24 +45,28 @@ const getComponentsLibAliases = () => {
|
|
|
34
45
|
[aliasKey]: absolutePath,
|
|
35
46
|
};
|
|
36
47
|
},
|
|
37
|
-
{
|
|
48
|
+
{
|
|
49
|
+
components: componentsBundlePolyfillPath,
|
|
50
|
+
__componentsIndex: resolveComponentsPath("src/index.js"),
|
|
51
|
+
__componentsConfig: resolveComponentsPath("griddo.config.js"),
|
|
52
|
+
__ssrConfig: resolveBuilderSSRPath(),
|
|
53
|
+
__ssrHelpers: path.resolve(__dirname, "./ssrHelpers"),
|
|
54
|
+
}
|
|
38
55
|
);
|
|
39
56
|
};
|
|
40
57
|
|
|
41
|
-
// TODO: Separar los imports de components de los de AX
|
|
42
58
|
const griddoAxAliases = {
|
|
43
|
-
"@ax/api": path.resolve(__dirname, "
|
|
44
|
-
"@ax/components": path.resolve(__dirname, "
|
|
45
|
-
"@ax/containers": path.resolve(__dirname, "
|
|
46
|
-
"@ax/forms": path.resolve(__dirname, "
|
|
47
|
-
"@ax/guards": path.resolve(__dirname, "
|
|
48
|
-
"@ax/helpers": path.resolve(__dirname, "
|
|
49
|
-
"@ax/hooks": path.resolve(__dirname, "
|
|
50
|
-
"@ax/modules": path.resolve(__dirname, "
|
|
51
|
-
"@ax/routes": path.resolve(__dirname, "
|
|
52
|
-
"@ax/types": path.resolve(__dirname, "
|
|
53
|
-
"@ax/schemas": path.resolve(__dirname, "
|
|
54
|
-
...getComponentsLibAliases(),
|
|
59
|
+
"@ax/api": path.resolve(__dirname, "../../src/api/"),
|
|
60
|
+
"@ax/components": path.resolve(__dirname, "../../src/components"),
|
|
61
|
+
"@ax/containers": path.resolve(__dirname, "../../src/containers"),
|
|
62
|
+
"@ax/forms": path.resolve(__dirname, "../../src/forms"),
|
|
63
|
+
"@ax/guards": path.resolve(__dirname, "../../src/guards"),
|
|
64
|
+
"@ax/helpers": path.resolve(__dirname, "../../src/helpers/"),
|
|
65
|
+
"@ax/hooks": path.resolve(__dirname, "../../src/hooks/"),
|
|
66
|
+
"@ax/modules": path.resolve(__dirname, "../../src/modules"),
|
|
67
|
+
"@ax/routes": path.resolve(__dirname, "../../src/routes"),
|
|
68
|
+
"@ax/types": path.resolve(__dirname, "../../src/types"),
|
|
69
|
+
"@ax/schemas": path.resolve(__dirname, "../../src/schemas"),
|
|
55
70
|
};
|
|
56
71
|
|
|
57
72
|
const griddoComponentsLibAliases = getComponentsLibAliases();
|
|
@@ -70,6 +85,10 @@ const mergeComponentsAliases = (...arrs) => {
|
|
|
70
85
|
return merged;
|
|
71
86
|
};
|
|
72
87
|
|
|
88
|
+
/* Components Static Paths */
|
|
89
|
+
const componentsStaticPath = resolveComponentsPath("static");
|
|
90
|
+
const componentsStaticPathExists = fs.existsSync(componentsStaticPath);
|
|
91
|
+
|
|
73
92
|
module.exports = {
|
|
74
93
|
isComponentLibraryEnv,
|
|
75
94
|
componentsPath: resolveComponentsPath(),
|
|
@@ -80,6 +99,8 @@ module.exports = {
|
|
|
80
99
|
griddoAxAliases,
|
|
81
100
|
thereAreAliasConflicts,
|
|
82
101
|
mergeComponentsAliases,
|
|
83
|
-
projectAliases: griddoAxAliases,
|
|
102
|
+
projectAliases: { ...griddoAxAliases, ...griddoComponentsLibAliases },
|
|
84
103
|
// projectAliases: mergeComponentsAliases(griddoComponentsLibAliases, griddoAxAliases),
|
|
104
|
+
componentsStaticPath,
|
|
105
|
+
componentsStaticPathExists,
|
|
85
106
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
+
|
|
3
|
+
export const setHeadComponents = (props) => {
|
|
4
|
+
const headKeyIdentifier = "data-head-component";
|
|
5
|
+
const headValueIdentifier = "griddo-instance-head-component";
|
|
6
|
+
const headElementsIdentifier = `[${headKeyIdentifier}="${headValueIdentifier}"]`;
|
|
7
|
+
|
|
8
|
+
[...document.querySelectorAll(headElementsIdentifier)].map((e) => e.remove());
|
|
9
|
+
|
|
10
|
+
props.map((tag) => {
|
|
11
|
+
const element = document.createElement(tag.type);
|
|
12
|
+
element.setAttribute(headKeyIdentifier, headValueIdentifier);
|
|
13
|
+
|
|
14
|
+
Object.keys(tag.props).map((attKey) => {
|
|
15
|
+
if (attKey === "dangerouslySetInnerHTML") {
|
|
16
|
+
return (element.innerHTML = tag.props.dangerouslySetInnerHTML.__html);
|
|
17
|
+
}
|
|
18
|
+
return element.setAttribute(attKey, tag.props[attKey]);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
document.head.appendChild(element);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return props;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const setHtmlAttributes = (props) => {
|
|
28
|
+
return props;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const setBodyAttributes = (props) => {
|
|
32
|
+
return props;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const setPreBodyComponents = (props) => {
|
|
36
|
+
return props;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const setPostBodyComponents = (props) => {
|
|
40
|
+
return props;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const setBodyProps = (props) => {
|
|
44
|
+
return props;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const pathname = "ax-editor";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
schemas: {key: 'schema definition'},
|
|
3
|
+
parseTheme: theme => {
|
|
4
|
+
const color = "#000";
|
|
5
|
+
const gradient = "#000";
|
|
6
|
+
const shadow = "#000";
|
|
7
|
+
const mq = "#000";
|
|
8
|
+
const textStyle = "#000";
|
|
9
|
+
const breakpoints = "#000";
|
|
10
|
+
const fontFamily = "#000";
|
|
11
|
+
|
|
12
|
+
const returnObject = {
|
|
13
|
+
...theme,
|
|
14
|
+
fontFamily,
|
|
15
|
+
color,
|
|
16
|
+
colors: color,
|
|
17
|
+
gradient,
|
|
18
|
+
shadow,
|
|
19
|
+
mq,
|
|
20
|
+
textStyle,
|
|
21
|
+
breakpoints,
|
|
22
|
+
fontSizes: "#000",
|
|
23
|
+
negateSpacing: "#000",
|
|
24
|
+
halfSpacing: "#000",
|
|
25
|
+
negateHalfSpacing: "#000",
|
|
26
|
+
};
|
|
27
|
+
return returnObject;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'test-file-stub'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { Provider } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
// custom render that includes redux provider
|
|
6
|
+
const customRender = (ui, {store, ...renderOptions} = {}) => {
|
|
7
|
+
const wrapper = ({children}) => {
|
|
8
|
+
return <Provider store={store}>{children}</Provider>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return render(ui, { wrapper: wrapper, ...renderOptions})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// re-export everything
|
|
15
|
+
export * from '@testing-library/react';
|
|
16
|
+
// override render method
|
|
17
|
+
export { customRender as render }
|
package/config/paths.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
|
-
const fs = require("fs");
|
|
2
|
+
const fs = require("fs-extra");
|
|
3
3
|
const getPublicUrlOrPath = require("react-dev-utils/getPublicUrlOrPath");
|
|
4
|
+
const chalk = require("react-dev-utils/chalk");
|
|
4
5
|
|
|
5
|
-
const { resolveComponentsPath } = require("./griddo-config");
|
|
6
|
+
const { resolveComponentsPath, componentsStaticPath, componentsStaticPathExists } = require("./griddo-config");
|
|
6
7
|
|
|
7
8
|
// Make sure any symlinks in the project folder are resolved:
|
|
8
9
|
// https://github.com/facebook/create-react-app/issues/637
|
|
@@ -48,12 +49,38 @@ const resolveModule = (resolveFn, filePath) => {
|
|
|
48
49
|
return resolveFn(`${filePath}.js`);
|
|
49
50
|
};
|
|
50
51
|
|
|
52
|
+
/* Static & Public Folder */
|
|
53
|
+
const appPublic = resolveApp("public");
|
|
54
|
+
const appHtml = resolveApp("public/index.html");
|
|
55
|
+
const appWebpackCache = resolveApp("node_modules/.cache");
|
|
56
|
+
const appStaticAssetsCache = componentsStaticPathExists ? path.resolve(appWebpackCache, "axStatic") : appPublic;
|
|
57
|
+
|
|
58
|
+
function prepareAssetsFolders() {
|
|
59
|
+
if (!componentsStaticPathExists) return;
|
|
60
|
+
|
|
61
|
+
console.log();
|
|
62
|
+
console.log(chalk.yellow(`Building Static Assets cache`));
|
|
63
|
+
console.log(componentsStaticPath);
|
|
64
|
+
console.log(appStaticAssetsCache);
|
|
65
|
+
console.log();
|
|
66
|
+
|
|
67
|
+
fs.mkdirpSync(appStaticAssetsCache);
|
|
68
|
+
|
|
69
|
+
fs.copySync(componentsStaticPath, appStaticAssetsCache, {
|
|
70
|
+
dereference: true,
|
|
71
|
+
});
|
|
72
|
+
fs.copySync(appPublic, appStaticAssetsCache, {
|
|
73
|
+
dereference: true,
|
|
74
|
+
filter: (file) => file !== appHtml,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
51
78
|
module.exports = {
|
|
52
79
|
dotenv: resolveApp(".env"),
|
|
53
80
|
appPath: resolveApp("."),
|
|
54
81
|
appBuild: path.resolve(process.cwd(), buildPath),
|
|
55
|
-
appPublic
|
|
56
|
-
appHtml
|
|
82
|
+
appPublic,
|
|
83
|
+
appHtml,
|
|
57
84
|
appIndexJs: resolveModule(resolveApp, "src/index"),
|
|
58
85
|
appPackageJson: resolveApp("package.json"),
|
|
59
86
|
appSrc: resolveApp("src"),
|
|
@@ -64,10 +91,14 @@ module.exports = {
|
|
|
64
91
|
testsSetup: resolveModule(resolveApp, "src/setupTests"),
|
|
65
92
|
proxySetup: resolveApp("src/setupProxy.js"),
|
|
66
93
|
appNodeModules: resolveApp("node_modules"),
|
|
67
|
-
appWebpackCache
|
|
94
|
+
appWebpackCache,
|
|
68
95
|
appTsBuildInfoFile: resolveApp("node_modules/.cache/tsconfig.tsbuildinfo"),
|
|
69
96
|
swSrc: resolveModule(resolveApp, "src/service-worker"),
|
|
70
97
|
publicUrlOrPath,
|
|
98
|
+
componentsStaticPath,
|
|
99
|
+
componentsStaticPathExists,
|
|
100
|
+
appStaticAssetsCache,
|
|
101
|
+
prepareAssetsFolders,
|
|
71
102
|
};
|
|
72
103
|
|
|
73
104
|
module.exports.moduleFileExtensions = moduleFileExtensions;
|
package/config/webpack.config.js
CHANGED
|
@@ -407,7 +407,7 @@ module.exports = function (webpackEnv) {
|
|
|
407
407
|
exclude: /@babel(?:\/|\\{1,2})runtime/,
|
|
408
408
|
loader: require.resolve("babel-loader"),
|
|
409
409
|
options: {
|
|
410
|
-
babelrc:
|
|
410
|
+
babelrc: true,
|
|
411
411
|
configFile: false,
|
|
412
412
|
compact: false,
|
|
413
413
|
presets: [[require.resolve("babel-preset-react-app/dependencies"), { helpers: true }]],
|
|
@@ -13,6 +13,9 @@ const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node'
|
|
|
13
13
|
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
14
14
|
|
|
15
15
|
module.exports = function (proxy, allowedHost) {
|
|
16
|
+
// Merge `public` and `static` paths for development
|
|
17
|
+
paths.prepareAssetsFolders();
|
|
18
|
+
|
|
16
19
|
return {
|
|
17
20
|
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
|
|
18
21
|
// websites from potentially accessing local content through DNS rebinding:
|
|
@@ -50,7 +53,7 @@ module.exports = function (proxy, allowedHost) {
|
|
|
50
53
|
// for files like `favicon.ico`, `manifest.json`, and libraries that are
|
|
51
54
|
// for some reason broken when imported through webpack. If you just want to
|
|
52
55
|
// use an image, put it in `src` and `import` it from JavaScript instead.
|
|
53
|
-
contentBase: paths.
|
|
56
|
+
contentBase: paths.appStaticAssetsCache,
|
|
54
57
|
contentBasePublicPath: paths.publicUrlOrPath,
|
|
55
58
|
// By default files from `contentBase` will not trigger a page reload.
|
|
56
59
|
watchContentBase: true,
|
|
@@ -23,7 +23,10 @@ const createConfig = ({ input, output }) => ({
|
|
|
23
23
|
use: {
|
|
24
24
|
loader: "babel-loader",
|
|
25
25
|
options: {
|
|
26
|
-
presets: [
|
|
26
|
+
presets: [
|
|
27
|
+
['@babel/preset-env', {targets: {node: 'current'}}],
|
|
28
|
+
'@babel/preset-typescript'
|
|
29
|
+
]
|
|
27
30
|
},
|
|
28
31
|
},
|
|
29
32
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.64.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -28,24 +28,28 @@
|
|
|
28
28
|
"build": "node scripts/build.js",
|
|
29
29
|
"build:dev": "env-cmd -f env/.env.development node scripts/build.js",
|
|
30
30
|
"build:bitbucket": "env-cmd -f env/.env npm run build",
|
|
31
|
-
"test": "
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"test:watch": "jest --watch",
|
|
33
|
+
"test:ci": "jest --runInBand",
|
|
34
|
+
"test:coverage": "jest --coverage ",
|
|
35
|
+
"test:dev": "npm run test -- --watch",
|
|
36
|
+
"test:dev:coverage": "npm run test:coverage -- --watch",
|
|
32
37
|
"lint": "eslint .",
|
|
33
38
|
"format": "prettier -w .",
|
|
34
|
-
"start:test": "env-cmd -f env/.env.development node scripts/dev.js"
|
|
35
|
-
"postinstall": "patch-package"
|
|
39
|
+
"start:test": "env-cmd -f env/.env.development node scripts/dev.js"
|
|
36
40
|
},
|
|
37
41
|
"dependencies": {
|
|
38
42
|
"@atlaskit/tree": "^8.2.0",
|
|
39
|
-
"@babel/core": "7.14.2",
|
|
40
|
-
"@babel/preset-env": "^7.14.5",
|
|
41
43
|
"@babel/preset-react": "^7.14.5",
|
|
42
44
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.0-rc.0",
|
|
43
45
|
"@styled-system/prop-types": "5.1.2",
|
|
44
46
|
"@styled-system/theme-get": "^5.1.2",
|
|
45
47
|
"@svgr/webpack": "^5.5.0",
|
|
48
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
49
|
+
"@testing-library/react": "^13.0.0",
|
|
50
|
+
"@testing-library/user-event": "^14.0.4",
|
|
46
51
|
"@types/compress.js": "^1.1.0",
|
|
47
52
|
"@types/draft-js": "^0.10.44",
|
|
48
|
-
"@types/jest": "24.0.19",
|
|
49
53
|
"@types/lodash.isequal": "^4.5.5",
|
|
50
54
|
"@types/markdown-draft-js": "^2.2.2",
|
|
51
55
|
"@types/node": "12.11.1",
|
|
@@ -56,7 +60,7 @@
|
|
|
56
60
|
"@types/react-redux": "^7.1.23",
|
|
57
61
|
"@types/react-router-dom": "5.3.3",
|
|
58
62
|
"@types/react-select": "^3.0.8",
|
|
59
|
-
"@types/react-test-renderer": "
|
|
63
|
+
"@types/react-test-renderer": "17.0.1",
|
|
60
64
|
"@types/react-textarea-autosize": "^4.3.5",
|
|
61
65
|
"@types/styled-components": "^5.1.25",
|
|
62
66
|
"@types/uuid": "^8.3.1",
|
|
@@ -66,15 +70,15 @@
|
|
|
66
70
|
"add": "^2.0.6",
|
|
67
71
|
"axios": "0.19.0",
|
|
68
72
|
"babel-eslint": "10.0.3",
|
|
69
|
-
"babel-jest": "^26.6.0",
|
|
70
73
|
"babel-loader": "8.2.2",
|
|
71
74
|
"babel-plugin-named-asset-import": "^0.3.7",
|
|
75
|
+
"babel-plugin-require-context-hook": "^1.0.0",
|
|
72
76
|
"babel-plugin-root-import": "^6.4.1",
|
|
73
77
|
"babel-plugin-styled-components": "^1.13.2",
|
|
74
78
|
"babel-preset-react-app": "^10.0.0",
|
|
75
79
|
"case-sensitive-paths-webpack-plugin": "2.4.0",
|
|
76
80
|
"compress.js": "^1.1.2",
|
|
77
|
-
"connected-react-router": "6.9.2",
|
|
81
|
+
"connected-react-router": "^6.9.2",
|
|
78
82
|
"css-loader": "^4.3.0",
|
|
79
83
|
"css-minimizer-webpack-plugin": "3.0.2",
|
|
80
84
|
"date-fns": "^2.21.3",
|
|
@@ -93,15 +97,16 @@
|
|
|
93
97
|
"identity-obj-proxy": "3.0.0",
|
|
94
98
|
"ignore-loader": "^0.1.2",
|
|
95
99
|
"is-wsl": "^1.1.0",
|
|
96
|
-
"jest": "
|
|
100
|
+
"jest-environment-jsdom": "^27.5.1",
|
|
97
101
|
"jest-environment-jsdom-fourteen": "0.1.0",
|
|
98
102
|
"jest-resolve": "24.9.0",
|
|
99
103
|
"jest-watch-typeahead": "0.4.0",
|
|
104
|
+
"jsdom": "^19.0.0",
|
|
105
|
+
"jsdom-global": "^3.0.2",
|
|
100
106
|
"lodash.isequal": "4.5.0",
|
|
101
107
|
"markdown-draft-js": "^2.2.1",
|
|
102
108
|
"mini-css-extract-plugin": "0.11.3",
|
|
103
109
|
"optimize-css-assets-webpack-plugin": "^6.0.1",
|
|
104
|
-
"patch-package": "^6.4.7",
|
|
105
110
|
"pkg-dir": "^5.0.0",
|
|
106
111
|
"polished": "3.4.1",
|
|
107
112
|
"postcss": "^8.4.5",
|
|
@@ -110,7 +115,6 @@
|
|
|
110
115
|
"postcss-normalize": "7.0.1",
|
|
111
116
|
"postcss-preset-env": "6.7.0",
|
|
112
117
|
"postcss-safe-parser": "^6.0.0",
|
|
113
|
-
"postinstall-postinstall": "^2.1.0",
|
|
114
118
|
"react": "^18.0.0",
|
|
115
119
|
"react-app-polyfill": "^1.0.4",
|
|
116
120
|
"react-datepicker": "^3.2.2",
|
|
@@ -151,6 +155,11 @@
|
|
|
151
155
|
"yarn": "^1.22.11"
|
|
152
156
|
},
|
|
153
157
|
"devDependencies": {
|
|
158
|
+
"@babel/core": "^7.17.7",
|
|
159
|
+
"@babel/preset-env": "^7.16.11",
|
|
160
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
161
|
+
"@types/jest": "^27.4.1",
|
|
162
|
+
"babel-jest": "^27.5.1",
|
|
154
163
|
"eslint": "^6.1.0",
|
|
155
164
|
"eslint-config-prettier": "^8.3.0",
|
|
156
165
|
"eslint-config-react-app": "^5.0.2",
|
|
@@ -161,8 +170,11 @@
|
|
|
161
170
|
"eslint-plugin-prettier": "^3.4.0",
|
|
162
171
|
"eslint-plugin-react": "7.14.3",
|
|
163
172
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
173
|
+
"jest": "^27.5.1",
|
|
174
|
+
"jest-styled-components": "^7.0.8",
|
|
164
175
|
"prettier": "^2.3.0",
|
|
165
|
-
"react-test-render": "1.1.2"
|
|
176
|
+
"react-test-render": "1.1.2",
|
|
177
|
+
"ts-jest": "^27.1.4"
|
|
166
178
|
},
|
|
167
179
|
"resolutions": {
|
|
168
180
|
"react-error-overlay": "6.0.9"
|
|
@@ -171,7 +183,14 @@
|
|
|
171
183
|
"presets": [
|
|
172
184
|
"react-app",
|
|
173
185
|
"@babel/preset-react"
|
|
174
|
-
]
|
|
186
|
+
],
|
|
187
|
+
"env": {
|
|
188
|
+
"test": {
|
|
189
|
+
"plugins": [
|
|
190
|
+
"require-context-hook"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
175
194
|
},
|
|
176
195
|
"browserslist": {
|
|
177
196
|
"production": [
|
|
@@ -194,54 +213,6 @@
|
|
|
194
213
|
"tsconfig.json",
|
|
195
214
|
"tsconfig.paths.json"
|
|
196
215
|
],
|
|
197
|
-
"jest": {
|
|
198
|
-
"roots": [
|
|
199
|
-
"<rootDir>/src"
|
|
200
|
-
],
|
|
201
|
-
"collectCoverageFrom": [
|
|
202
|
-
"src/**/*.{js,jsx,ts,tsx}",
|
|
203
|
-
"!src/**/*.d.ts"
|
|
204
|
-
],
|
|
205
|
-
"setupFiles": [
|
|
206
|
-
"react-app-polyfill/jsdom"
|
|
207
|
-
],
|
|
208
|
-
"setupFilesAfterEnv": [],
|
|
209
|
-
"testMatch": [
|
|
210
|
-
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
|
|
211
|
-
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
|
|
212
|
-
],
|
|
213
|
-
"testEnvironment": "jest-environment-jsdom-fourteen",
|
|
214
|
-
"transform": {
|
|
215
|
-
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
|
|
216
|
-
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
|
217
|
-
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
|
|
218
|
-
},
|
|
219
|
-
"transformIgnorePatterns": [
|
|
220
|
-
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
|
|
221
|
-
"^.+\\.module\\.(css|sass|scss)$"
|
|
222
|
-
],
|
|
223
|
-
"modulePaths": [],
|
|
224
|
-
"moduleNameMapper": {
|
|
225
|
-
"^react-native$": "react-native-web",
|
|
226
|
-
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
|
|
227
|
-
},
|
|
228
|
-
"moduleFileExtensions": [
|
|
229
|
-
"web.js",
|
|
230
|
-
"js",
|
|
231
|
-
"web.ts",
|
|
232
|
-
"ts",
|
|
233
|
-
"web.tsx",
|
|
234
|
-
"tsx",
|
|
235
|
-
"json",
|
|
236
|
-
"web.jsx",
|
|
237
|
-
"jsx",
|
|
238
|
-
"node"
|
|
239
|
-
],
|
|
240
|
-
"watchPlugins": [
|
|
241
|
-
"jest-watch-typeahead/filename",
|
|
242
|
-
"jest-watch-typeahead/testname"
|
|
243
|
-
]
|
|
244
|
-
},
|
|
245
216
|
"peerDependencies": {
|
|
246
217
|
"react": "*",
|
|
247
218
|
"react-dom": "*"
|
|
@@ -249,5 +220,5 @@
|
|
|
249
220
|
"publishConfig": {
|
|
250
221
|
"access": "public"
|
|
251
222
|
},
|
|
252
|
-
"gitHead": "
|
|
223
|
+
"gitHead": "b2c93c5e58cd328cdeb86ed13744cec37f591d94"
|
|
253
224
|
}
|
package/scripts/build.js
CHANGED
|
@@ -47,6 +47,8 @@ const config = configFactory("production");
|
|
|
47
47
|
// browserslist defaults.
|
|
48
48
|
const { checkBrowsers } = require("react-dev-utils/browsersHelper");
|
|
49
49
|
const pkgDir = require("pkg-dir");
|
|
50
|
+
const { prepareAssetsFolders } = require("../config/paths");
|
|
51
|
+
|
|
50
52
|
checkBrowsers(paths.appPath, isInteractive)
|
|
51
53
|
.then(() => {
|
|
52
54
|
// First, read the current file sizes in build directory.
|
|
@@ -58,7 +60,7 @@ checkBrowsers(paths.appPath, isInteractive)
|
|
|
58
60
|
// if you're in it, you don't end up in Trash
|
|
59
61
|
fs.emptyDirSync(paths.appBuild);
|
|
60
62
|
// Merge with the public folder
|
|
61
|
-
|
|
63
|
+
copyStaticAssets();
|
|
62
64
|
// Start the webpack build
|
|
63
65
|
return build(previousFileSizes);
|
|
64
66
|
})
|
|
@@ -159,8 +161,13 @@ function build(previousFileSizes) {
|
|
|
159
161
|
});
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
function copyStaticAssets() {
|
|
165
|
+
prepareAssetsFolders();
|
|
166
|
+
copyPublicFolder();
|
|
167
|
+
}
|
|
168
|
+
|
|
162
169
|
function copyPublicFolder() {
|
|
163
|
-
fs.copySync(paths.
|
|
170
|
+
fs.copySync(paths.appStaticAssetsCache, paths.appBuild, {
|
|
164
171
|
dereference: true,
|
|
165
172
|
filter: (file) => file !== paths.appHtml,
|
|
166
173
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const initialState = {
|
|
2
|
+
scriptCode: "",
|
|
3
|
+
siteScriptCodeExists: false,
|
|
4
|
+
dimensions: [{ name: "", values: "" }],
|
|
5
|
+
groups: [{ templates: "", name: "", dimensions: "" }],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
9
|
+
export default (state = initialState, action: { type: unknown }) => {
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
default:
|
|
12
|
+
return state;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PageEditorActionsCreators } from "../../containers/PageEditor/interfaces";
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
editorContent: {},
|
|
5
|
+
template: "BasicTemplate",
|
|
6
|
+
breadcrumb: [],
|
|
7
|
+
schema: {},
|
|
8
|
+
selectedContent: {},
|
|
9
|
+
tab: "content",
|
|
10
|
+
selectedEditorID: 0,
|
|
11
|
+
currentPageID: null,
|
|
12
|
+
currentPageStatus: null,
|
|
13
|
+
currentPageName: "",
|
|
14
|
+
currentPageLanguages: [],
|
|
15
|
+
isNewTranslation: false,
|
|
16
|
+
templateConfig: {},
|
|
17
|
+
selectedParent: null,
|
|
18
|
+
errors: [],
|
|
19
|
+
validated: false,
|
|
20
|
+
sitePageID: null,
|
|
21
|
+
userEditing: null,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
25
|
+
export default (state = initialState, action: { type: PageEditorActionsCreators }) => {
|
|
26
|
+
switch (action.type) {
|
|
27
|
+
default:
|
|
28
|
+
return state;
|
|
29
|
+
}
|
|
30
|
+
};
|
package/src/api/sites.tsx
CHANGED
|
@@ -84,6 +84,11 @@ const SERVICES: { [key: string]: IServiceConfig } = {
|
|
|
84
84
|
endpoint: ["/site/", "/pages/global/imports/bulk"],
|
|
85
85
|
method: "POST",
|
|
86
86
|
},
|
|
87
|
+
REMOVE_USERS_BULK: {
|
|
88
|
+
...template,
|
|
89
|
+
endpoint: ["/site/", "/restrict"],
|
|
90
|
+
method: "PUT",
|
|
91
|
+
},
|
|
87
92
|
REMOVE_PAGE: {
|
|
88
93
|
...template,
|
|
89
94
|
endpoint: ["/site/", "/pages/global/imports/"],
|
|
@@ -119,8 +124,10 @@ const getStructuredSitePages = async (params: IGetSitePagesParams, structuredDat
|
|
|
119
124
|
|
|
120
125
|
SERVICES.GET_SITE_STRUCTURED_PAGES.dynamicUrl = `${host}${prefix}${siteID}${suffix}${structuredData}${filters}deleted=${deleted}&page=${page}&itemsPerPage=${itemsPerPage}`;
|
|
121
126
|
|
|
122
|
-
if (query && query.trim() !== "")
|
|
123
|
-
|
|
127
|
+
if (query && query.trim() !== "")
|
|
128
|
+
SERVICES.GET_SITE_STRUCTURED_PAGES.dynamicUrl = SERVICES.GET_SITE_STRUCTURED_PAGES.dynamicUrl + `&query=${query}`;
|
|
129
|
+
if (format)
|
|
130
|
+
SERVICES.GET_SITE_STRUCTURED_PAGES.dynamicUrl = SERVICES.GET_SITE_STRUCTURED_PAGES.dynamicUrl + `&format=${format}`;
|
|
124
131
|
|
|
125
132
|
return sendRequest(SERVICES.GET_SITE_STRUCTURED_PAGES);
|
|
126
133
|
};
|
|
@@ -136,13 +143,16 @@ const getSitePages = async (params: IGetSitePagesParams, filterQuery?: string):
|
|
|
136
143
|
const filters = filterQuery ? `${filterQuery}&` : "?";
|
|
137
144
|
|
|
138
145
|
SERVICES.GET_SITE_PAGES.dynamicUrl = `${host}${prefix}${siteID}${suffix}${filters}deleted=${deleted}&page=${page}&itemsPerPage=${itemsPerPage}`;
|
|
139
|
-
if (query && query.trim() !== "")
|
|
140
|
-
|
|
146
|
+
if (query && query.trim() !== "")
|
|
147
|
+
SERVICES.GET_SITE_PAGES.dynamicUrl = SERVICES.GET_SITE_PAGES.dynamicUrl + `&query=${query}`;
|
|
148
|
+
if (filterStructuredData)
|
|
149
|
+
SERVICES.GET_SITE_PAGES.dynamicUrl =
|
|
150
|
+
SERVICES.GET_SITE_PAGES.dynamicUrl + `&filterStructuredData=${filterStructuredData}`;
|
|
141
151
|
if (format) SERVICES.GET_SITE_PAGES.dynamicUrl = SERVICES.GET_SITE_PAGES.dynamicUrl + `&format=${format}`;
|
|
142
152
|
|
|
143
153
|
const dataHeader = {
|
|
144
|
-
...(lang && { lang })
|
|
145
|
-
}
|
|
154
|
+
...(lang && { lang }),
|
|
155
|
+
};
|
|
146
156
|
|
|
147
157
|
return sendRequest(SERVICES.GET_SITE_PAGES, null, dataHeader);
|
|
148
158
|
};
|
|
@@ -208,6 +218,17 @@ const removePage = async (siteId: number, pageId: number): Promise<AxiosResponse
|
|
|
208
218
|
return sendRequest(SERVICES.REMOVE_PAGE);
|
|
209
219
|
};
|
|
210
220
|
|
|
221
|
+
const removeUsersBulk = async (siteId: number, users: number[]): Promise<AxiosResponse> => {
|
|
222
|
+
const {
|
|
223
|
+
host,
|
|
224
|
+
endpoint: [prefix, suffix],
|
|
225
|
+
} = SERVICES.REMOVE_USERS_BULK;
|
|
226
|
+
|
|
227
|
+
SERVICES.REMOVE_USERS_BULK.dynamicUrl = `${host}${prefix}${siteId}${suffix}`;
|
|
228
|
+
|
|
229
|
+
return sendRequest(SERVICES.REMOVE_USERS_BULK, { users });
|
|
230
|
+
};
|
|
231
|
+
|
|
211
232
|
const removePageBulk = async (siteID: number, ids: number[]): Promise<AxiosResponse> => {
|
|
212
233
|
const {
|
|
213
234
|
host,
|
|
@@ -317,4 +338,5 @@ export default {
|
|
|
317
338
|
importPageBulk,
|
|
318
339
|
removePage,
|
|
319
340
|
removePageBulk,
|
|
341
|
+
removeUsersBulk,
|
|
320
342
|
};
|