@griddo/cx 1.75.249 → 1.75.251

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/build/index.js CHANGED
@@ -25,7 +25,7 @@ GFS4: `),console.error(e)});z[Z]||(ws=global[Z]||[],xs(z,ws),z.close=function(e)
25
25
  \u2502 Access credentials failure \u2502
26
26
  \u2502 Check that the login details are correct in your .env file \u2502
27
27
  \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
28
- `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="1.75.249";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
28
+ `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="1.75.251";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
29
29
  `,s=`
30
30
  \u2570${"\u2500".repeat(r)}\u256F`,o=`\u2502${n}${e}${n}\u2502`;console.log(`${i}${o}${s}`)}function fi(e){vp&&console.info(e.replace(/(\s)\s+/g,"$1"))}function Xu(e){return new Promise(t=>setTimeout(t,e))}function Dr(e,t=3){return(e/1e3).toFixed(t)}function hi(e){return"site"in e&&e.site?e?.site:void 0}function di(...e){let t=performance.now();return e.forEach(r=>r()),Dr(performance.now()-t)}function Qu(){let e=`
31
31
  \xB7\xB7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/cx",
3
3
  "description": "Griddo SSG based on Gatsby",
4
- "version": "1.75.249",
4
+ "version": "1.75.251",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -68,7 +68,7 @@
68
68
  "react-helmet": "^6.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@griddo/eslint-config-back": "^1.75.249",
71
+ "@griddo/eslint-config-back": "^1.75.251",
72
72
  "@types/babel__core": "^7.20.0",
73
73
  "@types/babel__preset-env": "^7.9.2",
74
74
  "@types/csvtojson": "^2.0.0",
@@ -116,5 +116,5 @@
116
116
  "publishConfig": {
117
117
  "access": "public"
118
118
  },
119
- "gitHead": "eb9aac88a24fb9f2a38c305c175adb7dc76d04d0"
119
+ "gitHead": "1f3a11d826a73aa9eb045a272caf9967feec0348"
120
120
  }
@@ -6,7 +6,7 @@ export interface CustomHeadProps extends HeadProps {
6
6
  pageContext: GatsbyPageObject["context"] & {
7
7
  page: Core.Page & {
8
8
  defaultLang: { id: number };
9
- dimensions: { values: Record<string, unknown> };
9
+ dimensions: Dimensions;
10
10
  disableHrefLangs: Array<number>;
11
11
  };
12
12
  };
@@ -31,3 +31,10 @@ export interface HtmlProps {
31
31
  postBodyComponents: React.ReactNode;
32
32
  preBodyComponents: React.ReactNode;
33
33
  }
34
+
35
+ export interface Dimensions {
36
+ values: Record<string, string> | null;
37
+ contentSelect?: "group" | "individual" | null;
38
+ groupSelect?: string;
39
+ dimensionsSelect?: Array<string>;
40
+ }
@@ -6,12 +6,14 @@
6
6
  //
7
7
  // Browserify doesn't work with the mixture of typescript + webpack 5 + SSR
8
8
 
9
+ import type { Dimensions } from "./types";
9
10
  import type { Fields } from "@griddo/core";
10
11
 
11
12
  /**
13
+ *
12
14
  * Sanitize a string separated by commas.
13
15
  */
14
- function cleanCommaSeparated(str: string) {
16
+ export function cleanCommaSeparated(str: string) {
15
17
  return str
16
18
  .split(",")
17
19
  .map((item) => item.trim())
@@ -28,7 +30,7 @@ function cleanCommaSeparated(str: string) {
28
30
  * @param format Format of the image
29
31
  * @returns A composed URL for the Cloudinary or DAM service
30
32
  */
31
- function formatImage(
33
+ export function formatImage(
32
34
  image: Fields.Image | string,
33
35
  width: number,
34
36
  height: number,
@@ -72,14 +74,12 @@ function addCloudinaryParams(image: string, params: string) {
72
74
  /**
73
75
  * TODO: JSDoc
74
76
  */
75
- function composeAnalytics(
77
+ export function composeAnalytics(
76
78
  page: {
77
79
  pageContext: {
78
80
  siteScript: string;
79
81
  page: {
80
- dimensions: {
81
- values: Record<string, unknown>;
82
- };
82
+ dimensions: Dimensions;
83
83
  };
84
84
  };
85
85
  },
@@ -97,15 +97,16 @@ function composeAnalytics(
97
97
 
98
98
  // Las dimensiones o DataLayer
99
99
  const dynamicValuePrefix = "__SCRIPT:";
100
- const dimensionValues = dimensions?.values || {};
100
+ const dimensionValues = isObject(dimensions?.values)
101
+ ? dimensions?.values
102
+ : {};
101
103
  const automaticDimensionValues = generateAutomaticDimensions
102
104
  ? generateAutomaticDimensions(page)
103
105
  : {};
104
106
  const allDimensionsValues = {
105
107
  ...dimensionValues,
106
108
  ...automaticDimensionValues,
107
- // TODO: remove any
108
- } as Record<string, any>;
109
+ } as Record<string, string>;
109
110
 
110
111
  const allDimensions = [];
111
112
 
@@ -133,4 +134,11 @@ function composeAnalytics(
133
134
  };
134
135
  }
135
136
 
136
- export { cleanCommaSeparated, composeAnalytics, formatImage };
137
+ /**
138
+ * Return true if the argument is an object (not null)
139
+ *
140
+ * @param any value
141
+ */
142
+ export function isObject(value: unknown) {
143
+ return typeof value === "object" && value !== null && !Array.isArray(value);
144
+ }