@griddo/ax 1.73.28 → 1.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/config/griddo-config/index.js +24 -3
  2. package/config/webpackSchemas.config.js +3 -5
  3. package/package.json +3 -2
  4. package/scripts/griddo-sync-schemas.js +4 -3
  5. package/src/__mocks__/axios/SitesList.ts +84 -0
  6. package/src/__mocks__/store/SitesList.ts +714 -0
  7. package/src/__tests__/components/Avatar/Avatar.test.tsx +119 -0
  8. package/src/__tests__/components/Avatar/__snapshots__/Avatar.test.tsx.snap +61 -0
  9. package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +10 -10
  10. package/src/__tests__/components/LanguageMenu/LanguageMenu.test.tsx +221 -0
  11. package/src/__tests__/components/Loading/Loading.test.tsx +23 -0
  12. package/src/__tests__/components/Login/Login.test.tsx +247 -0
  13. package/src/__tests__/components/Login/RecoveryModal/RecoveryModal.test.tsx +185 -0
  14. package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +6 -6
  15. package/src/__tests__/modules/Sites/Sites.test.tsx +259 -0
  16. package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +51 -0
  17. package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +896 -0
  18. package/src/api/sites.tsx +43 -4
  19. package/src/components/ActionMenu/index.tsx +1 -1
  20. package/src/components/Avatar/index.tsx +4 -4
  21. package/src/components/Browser/index.tsx +27 -20
  22. package/src/components/BrowserContent/index.tsx +6 -0
  23. package/src/components/Fields/AsyncSelect/style.tsx +6 -3
  24. package/src/components/Fields/CheckField/index.tsx +1 -0
  25. package/src/components/Fields/DateField/style.tsx +3 -1
  26. package/src/components/Fields/HeadingField/index.tsx +14 -5
  27. package/src/components/Fields/ImageField/index.tsx +3 -0
  28. package/src/components/Fields/ImageField/style.tsx +2 -2
  29. package/src/components/Fields/Select/style.tsx +2 -0
  30. package/src/components/Fields/SliderField/index.tsx +2 -1
  31. package/src/components/Fields/TextField/index.tsx +1 -0
  32. package/src/components/Icon/components/BulletList.js +16 -0
  33. package/src/components/Icon/components/Grid2.js +16 -0
  34. package/src/components/Icon/svgs/Bullet-list.svg +3 -0
  35. package/src/components/Icon/svgs/Grid-2.svg +3 -0
  36. package/src/components/IconAction/index.tsx +4 -2
  37. package/src/components/IconAction/style.tsx +8 -2
  38. package/src/components/LanguageMenu/index.tsx +13 -6
  39. package/src/components/Login/RecoveryModal/index.tsx +5 -4
  40. package/src/components/Login/index.tsx +13 -3
  41. package/src/components/Login/style.tsx +12 -25
  42. package/src/components/Pagination/style.tsx +1 -1
  43. package/src/components/SearchField/index.tsx +9 -1
  44. package/src/components/SideModal/style.tsx +8 -8
  45. package/src/components/TableFilters/LastAccessFilter/index.tsx +52 -0
  46. package/src/components/TableFilters/LastAccessFilter/style.tsx +31 -0
  47. package/src/components/TableFilters/LiveFilter/index.tsx +7 -5
  48. package/src/components/TableFilters/NameFilter/index.tsx +4 -3
  49. package/src/components/TableFilters/index.tsx +2 -0
  50. package/src/components/TableList/index.tsx +2 -1
  51. package/src/components/TableList/style.tsx +2 -2
  52. package/src/components/index.tsx +2 -0
  53. package/src/containers/App/actions.tsx +5 -0
  54. package/src/containers/App/interfaces.tsx +1 -1
  55. package/src/containers/App/reducer.tsx +1 -1
  56. package/src/containers/Navigation/Defaults/actions.tsx +3 -1
  57. package/src/containers/PageEditor/actions.tsx +6 -3
  58. package/src/containers/Sites/actions.tsx +76 -11
  59. package/src/containers/Sites/constants.tsx +2 -0
  60. package/src/containers/Sites/interfaces.tsx +12 -0
  61. package/src/containers/Sites/reducer.tsx +8 -0
  62. package/src/helpers/schemas.tsx +27 -1
  63. package/src/hooks/iframe.ts +56 -0
  64. package/src/hooks/index.tsx +3 -0
  65. package/src/modules/Content/index.tsx +4 -3
  66. package/src/modules/FramePreview/index.tsx +25 -39
  67. package/src/modules/GlobalEditor/Editor/index.tsx +2 -2
  68. package/src/modules/GlobalEditor/PageBrowser/index.tsx +16 -4
  69. package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/DefaultsBrowser/index.tsx +11 -7
  70. package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +4 -3
  71. package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +1 -0
  72. package/src/modules/PageEditor/Editor/index.tsx +2 -2
  73. package/src/modules/PageEditor/PageBrowser/index.tsx +16 -4
  74. package/src/modules/PageEditor/index.tsx +8 -7
  75. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/Field/index.tsx +12 -11
  76. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/index.tsx +3 -17
  77. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/style.tsx +2 -10
  78. package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +72 -0
  79. package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/style.tsx +32 -0
  80. package/src/modules/Sites/SitesList/{SiteItem → GridView/GridSiteItem}/index.tsx +17 -27
  81. package/src/modules/Sites/SitesList/{SiteItem → GridView/GridSiteItem}/style.tsx +14 -25
  82. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +64 -0
  83. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/style.tsx +50 -0
  84. package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +75 -0
  85. package/src/modules/Sites/SitesList/ListView/BulkHeader/style.tsx +8 -0
  86. package/src/modules/Sites/SitesList/ListView/ListSiteItem/index.tsx +200 -0
  87. package/src/modules/Sites/SitesList/ListView/ListSiteItem/style.tsx +112 -0
  88. package/src/modules/Sites/SitesList/RecentSiteItem/index.tsx +50 -0
  89. package/src/modules/Sites/SitesList/RecentSiteItem/style.tsx +28 -0
  90. package/src/modules/Sites/SitesList/SiteModal/index.tsx +4 -3
  91. package/src/modules/Sites/SitesList/atoms.tsx +47 -0
  92. package/src/modules/Sites/SitesList/hooks.tsx +102 -0
  93. package/src/modules/Sites/SitesList/index.tsx +272 -19
  94. package/src/modules/Sites/SitesList/style.tsx +157 -4
  95. package/src/modules/Sites/SitesList/utils.tsx +33 -0
  96. package/src/modules/Sites/index.tsx +6 -11
  97. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +1 -1
  98. package/src/types/index.tsx +25 -2
@@ -8,11 +8,23 @@ const isComponentLibraryEnv = __dirname.includes("node_modules");
8
8
 
9
9
  const componentsBundlePolyfillPath = path.resolve(__dirname, "./cx-polyfills/componentsBundle.js");
10
10
 
11
- const resolveComponentsPath = (customPath = "") =>
12
- isComponentLibraryEnv
11
+ /**
12
+ * Devuelve la ruta completa del path común entre instancia-components y Griddo monorepo.
13
+ * @param {string} customPath slug del path común entre instancia y monorepo del que se quiere obtener la ruta.
14
+ * @returns {string | undefined} la ruta completa si el path existe o de lo contrario undefined.
15
+ */
16
+ const resolveComponentsPath = (customPath = "") => {
17
+ const filePath = isComponentLibraryEnv
13
18
  ? path.resolve(pkgDir.sync(process.cwd()), customPath)
14
19
  : path.resolve(pkgDir.sync(__dirname), "../griddo-components", customPath);
15
20
 
21
+ if (fs.existsSync(filePath)) {
22
+ return filePath;
23
+ }
24
+
25
+ return undefined;
26
+ };
27
+
16
28
  const resolveBuilderSSRPath = () => {
17
29
  const builderSSRPolyfillPath = path.resolve(__dirname, "./cx-polyfills/builder.ssr.js");
18
30
  const builderSSRPath = resolveComponentsPath("builder.ssr.js");
@@ -28,6 +40,14 @@ const getComponentsJSConfig = () => {
28
40
  return tsConfigPath || jsConfigPath || false;
29
41
  };
30
42
 
43
+ /**
44
+ * Devuelve la ruta completa de archivo de configuración de Griddo en la instancia: `griddo.config.js|ts`
45
+ * @returns {string | undefined} la ruta completa del archivo de configuración
46
+ */
47
+ const resolveComponentsGriddoConfig = () => {
48
+ return resolveComponentsPath("griddo.config.js") || resolveComponentsPath("griddo.config.ts");
49
+ };
50
+
31
51
  const getComponentsLibAliases = () => {
32
52
  const xsConfig = require(getComponentsJSConfig());
33
53
 
@@ -48,7 +68,7 @@ const getComponentsLibAliases = () => {
48
68
  {
49
69
  components: componentsBundlePolyfillPath,
50
70
  __componentsIndex: resolveComponentsPath("src/index.js"),
51
- __componentsConfig: resolveComponentsPath("griddo.config.js"),
71
+ __componentsConfig: resolveComponentsGriddoConfig(),
52
72
  __ssrConfig: resolveBuilderSSRPath(),
53
73
  __ssrHelpers: path.resolve(__dirname, "./ssrHelpers"),
54
74
  }
@@ -103,4 +123,5 @@ module.exports = {
103
123
  // projectAliases: mergeComponentsAliases(griddoComponentsLibAliases, griddoAxAliases),
104
124
  componentsStaticPath,
105
125
  componentsStaticPathExists,
126
+ resolveComponentsGriddoConfig,
106
127
  };
@@ -18,15 +18,13 @@ const createConfig = ({ input, output }) => ({
18
18
  module: {
19
19
  rules: [
20
20
  {
21
- test: /\.m?js$/,
21
+ test: /\.m?[tj]s$/,
22
+ resolve: { extensions: [".ts", ".js"] },
22
23
  exclude: /(node_modules|bower_components)/,
23
24
  use: {
24
25
  loader: "babel-loader",
25
26
  options: {
26
- presets: [
27
- ['@babel/preset-env', {targets: {node: 'current'}}],
28
- '@babel/preset-typescript'
29
- ]
27
+ presets: [["@babel/preset-env", { targets: { node: "current" } }], "@babel/preset-typescript"],
30
28
  },
31
29
  },
32
30
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "1.73.28",
4
+ "version": "1.74.0",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -181,6 +181,7 @@
181
181
  "jest-styled-components": "^7.0.8",
182
182
  "prettier": "^2.3.0",
183
183
  "react-test-render": "1.1.2",
184
+ "react-test-renderer": "^18.2.0",
184
185
  "redux-mock-store": "^1.5.4",
185
186
  "ts-jest": "^27.1.4"
186
187
  },
@@ -228,5 +229,5 @@
228
229
  "publishConfig": {
229
230
  "access": "public"
230
231
  },
231
- "gitHead": "26ba8a0083248cbf8ee953aca8a2a3888ab60dfc"
232
+ "gitHead": "e88b4badd147dea446fe3d489b623837ab0e6f51"
232
233
  }
@@ -8,7 +8,7 @@ const path = require("path");
8
8
  const fs = require("fs");
9
9
  const compiler = require("../config/webpackSchemas.config");
10
10
 
11
- const { resolveComponentsPath } = require("../config/griddo-config");
11
+ const { resolveComponentsPath, resolveComponentsGriddoConfig } = require("../config/griddo-config");
12
12
 
13
13
  dotenv.config({ path: findUp.sync(".env") });
14
14
 
@@ -21,8 +21,9 @@ const API_DEV_KEY = process.env.developerKey;
21
21
  async function main() {
22
22
  console.clear();
23
23
  const tempFile = "__griddo_config_parsed__.js";
24
+ const componentsGriddoConfig = resolveComponentsGriddoConfig();
24
25
 
25
- const inputFile = resolveComponentsPath("griddo.config.js");
26
+ const inputFile = componentsGriddoConfig;
26
27
  const outputFile = `${__dirname}/${tempFile}`;
27
28
 
28
29
  if (fs.existsSync(outputFile)) {
@@ -35,7 +36,7 @@ async function main() {
35
36
  }
36
37
 
37
38
  await compiler({
38
- input: resolveComponentsPath("griddo.config.js"),
39
+ input: componentsGriddoConfig,
39
40
  output: { filename: tempFile, path: __dirname },
40
41
  });
41
42
 
@@ -0,0 +1,84 @@
1
+ import { structuredDataMock } from "./../store/SitesList";
2
+
3
+ export const sitesResponse = {
4
+ data: {
5
+ totalItems: 22,
6
+ page: "1",
7
+ recentSites: [
8
+ { siteId: 1, lastAccess: "2022-09-12T13:28:31.000Z" },
9
+ { siteId: 2, lastAccess: "2022-09-09T09:40:49.000Z" },
10
+ ],
11
+ allSites: [
12
+ {
13
+ id: 1,
14
+ name: "Site 1",
15
+ theme: "default-theme",
16
+ author: 2,
17
+ pages: [
18
+ 3573, 3619, 3691, 3692, 3693, 3694, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3709, 3710, 3711,
19
+ 3712, 3834, 3835, 3925, 3926, 3954, 3955, 3956, 3958, 3960, 4007, 4008, 4010, 4018, 4073, 4078, 4084, 4109,
20
+ 4125, 4126, 4275,
21
+ ],
22
+ published: "2022-02-21T11:00:14.000Z",
23
+ modified: "2022-08-24T10:53:12.000Z",
24
+ languageSites: [181, 185],
25
+ deleted: 0,
26
+ thumbnail: null,
27
+ timezone: "Europe/Madrid",
28
+ favicon: null,
29
+ hash: null,
30
+ bigAvatar: "http://images.dev.griddo.io/panorama-8c94a8f3-2dd8-4eb0-a181-97c26cdca93d",
31
+ smallAvatar: "http://images.dev.griddo.io/rotenmeier-174e689c-8374-4037-8057-096c79f1c54c_1",
32
+ socials: null,
33
+ rendering: false,
34
+ slug: "/clara-site",
35
+ isPublished: false,
36
+ renderingHours: 0,
37
+ shouldBeUpdated: false,
38
+ updated: true,
39
+ navigationModules: null,
40
+ lastAccess: "2022-09-12T13:28:31.000Z",
41
+ home: "//cx.dev.griddo.io/pre-griddo/clara-site",
42
+ },
43
+ {
44
+ id: 2,
45
+ name: "Site 2",
46
+ theme: "default-theme",
47
+ author: 2,
48
+ pages: [3654, 3729, 3997, 4014, 4074, 4304],
49
+ published: "2021-11-03T10:10:17.000Z",
50
+ modified: "2022-05-23T11:49:42.000Z",
51
+ languageSites: [144],
52
+ deleted: 0,
53
+ thumbnail: "http://images.dev.griddo.io/macbeth-palau-de-les-arts-opera-valencia-5x2-1_1",
54
+ timezone: "Pacific/Pago_Pago",
55
+ favicon: "http://images.dev.griddo.io/griddo-site-thumbnail-ec2ab0ba-9424-4424-8f60-222ec746902d_4",
56
+ hash: "6c301f95-a1e7-412b-823d-2958fd1fbe01",
57
+ bigAvatar: "http://images.dev.griddo.io/griddo-site-thumbnail-ec2ab0ba-9424-4424-8f60-222ec746902d_6",
58
+ smallAvatar: "http://images.dev.griddo.io/griddo-site-thumbnail-ec2ab0ba-9424-4424-8f60-222ec746902d_5",
59
+ socials: { instagram: "instagram demo" },
60
+ rendering: false,
61
+ slug: "/demo-site",
62
+ isPublished: true,
63
+ renderingHours: 0,
64
+ shouldBeUpdated: true,
65
+ updated: false,
66
+ navigationModules: null,
67
+ lastAccess: "2022-09-09T09:40:49.000Z",
68
+ home: "//cx.dev.griddo.io/pre-griddo/demo",
69
+ },
70
+ ],
71
+ },
72
+ status: 200,
73
+ statusText: "Ok",
74
+ headers: {},
75
+ config: {},
76
+ };
77
+
78
+ export const structuredDataResponse = {
79
+ data: structuredDataMock,
80
+ status: 200,
81
+ statusText: "Ok",
82
+ headers: {},
83
+ config: {},
84
+ };