@griddo/cx 11.9.8-rc.1 → 11.9.8-rc.2
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/README.md +193 -78
- package/build/adapters/gatsby/index.d.ts +4 -0
- package/build/adapters/gatsby/utils.d.ts +22 -0
- package/build/artifacts/index.d.ts +6 -0
- package/build/commands/end-render.d.ts +2 -0
- package/build/commands/move-assets.d.ts +1 -0
- package/build/commands/prepare-domains-render.d.ts +1 -0
- package/build/commands/reset-render.d.ts +2 -0
- package/build/commands/start-render.d.ts +2 -0
- package/build/commands/upload-search-content.d.ts +2 -0
- package/build/constants/envs.d.ts +37 -0
- package/build/constants/index.d.ts +57 -0
- package/build/end-render.js +74 -0
- package/build/end-render.js.map +7 -0
- package/build/{shared/errors.d.ts → errors/errors-data.d.ts} +3 -5
- package/build/{core/errors.d.ts → errors/index.d.ts} +4 -5
- package/build/index.d.ts +29 -10
- package/build/index.js +73 -406
- package/build/index.js.map +7 -0
- package/build/prepare-domains-render.js +73 -0
- package/build/prepare-domains-render.js.map +7 -0
- package/build/react/Favicon/index.d.ts +5 -0
- package/build/react/Favicon/utils.d.ts +9 -0
- package/build/react/GriddoIntegrations/index.d.ts +20 -0
- package/build/react/GriddoIntegrations/utils.d.ts +26 -0
- package/build/react/index.d.ts +3 -0
- package/build/react/index.js +3 -0
- package/build/registers/api.d.ts +9 -0
- package/build/registers/gatsby.d.ts +9 -0
- package/build/registers/index.d.ts +3 -0
- package/build/reset-render.js +74 -0
- package/build/reset-render.js.map +7 -0
- package/build/services/auth.d.ts +5 -2
- package/build/services/domains.d.ts +6 -0
- package/build/services/navigation.d.ts +50 -0
- package/build/services/reference-fields.d.ts +20 -0
- package/build/services/register.d.ts +36 -0
- package/build/services/robots.d.ts +19 -0
- package/build/services/settings.d.ts +4 -0
- package/build/services/sites.d.ts +29 -0
- package/build/services/store.d.ts +6 -0
- package/build/start-render.js +100 -0
- package/build/start-render.js.map +7 -0
- package/build/{shared/types → types}/api.d.ts +18 -18
- package/build/{shared/types → types}/global.d.ts +16 -15
- package/build/{shared/types → types}/navigation.d.ts +5 -5
- package/build/{shared/types → types}/pages.d.ts +9 -9
- package/build/{shared/types → types}/sites.d.ts +19 -18
- package/build/types/templates.d.ts +8 -0
- package/build/upload-search-content.js +74 -0
- package/build/upload-search-content.js.map +7 -0
- package/build/utils/alerts.d.ts +3 -0
- package/build/utils/api.d.ts +23 -0
- package/build/utils/cache.d.ts +35 -0
- package/build/utils/core-utils.d.ts +107 -0
- package/build/utils/create-build-data.d.ts +8 -0
- package/build/utils/domains.d.ts +13 -0
- package/build/utils/folders.d.ts +53 -0
- package/build/utils/health-checks.d.ts +7 -0
- package/build/utils/images.d.ts +16 -0
- package/build/utils/loggin.d.ts +51 -0
- package/build/utils/pages.d.ts +34 -0
- package/build/utils/render.d.ts +13 -0
- package/build/utils/searches.d.ts +15 -0
- package/build/utils/sites.d.ts +31 -0
- package/build/utils/store.d.ts +81 -0
- package/cx.config.d.ts +5 -0
- package/cx.config.js +36 -0
- package/exporter/adapters/gatsby/index.ts +162 -0
- package/exporter/adapters/gatsby/utils.ts +161 -0
- package/exporter/artifacts/README.md +34 -0
- package/exporter/artifacts/index.ts +33 -0
- package/exporter/build.sh +28 -17
- package/exporter/commands/end-render.ts +86 -65
- package/exporter/commands/move-assets.ts +11 -0
- package/exporter/commands/prepare-domains-render.ts +35 -143
- package/exporter/commands/reset-render.ts +7 -12
- package/exporter/commands/start-render.ts +64 -26
- package/exporter/commands/upload-search-content.ts +26 -201
- package/exporter/{shared → constants}/endpoints.ts +11 -12
- package/exporter/constants/envs.ts +94 -0
- package/exporter/constants/index.ts +129 -0
- package/exporter/{shared/errors.ts → errors/errors-data.ts} +14 -24
- package/exporter/errors/index.ts +40 -0
- package/exporter/index.ts +56 -14
- package/{react/GriddoFavicon → exporter/react/Favicon}/index.tsx +9 -3
- package/{react → exporter/react}/GriddoIntegrations/index.tsx +23 -17
- package/{react → exporter/react}/GriddoIntegrations/utils.ts +12 -24
- package/exporter/react/index.tsx +11 -0
- package/exporter/registers/api.ts +14 -0
- package/exporter/registers/gatsby.ts +14 -0
- package/exporter/registers/index.ts +4 -0
- package/exporter/services/auth.ts +10 -8
- package/exporter/services/domains.ts +8 -23
- package/exporter/services/navigation.ts +18 -12
- package/exporter/services/reference-fields.ts +32 -14
- package/exporter/services/register.ts +113 -0
- package/exporter/services/robots.ts +61 -33
- package/exporter/services/settings.ts +17 -0
- package/exporter/services/sites.ts +28 -40
- package/exporter/services/store.ts +319 -386
- package/exporter/{shared/types → types}/api.ts +41 -40
- package/exporter/{shared/types → types}/global.ts +21 -17
- package/exporter/{shared/types → types}/navigation.ts +3 -3
- package/exporter/{shared/types → types}/pages.ts +11 -10
- package/exporter/{shared/types → types}/sites.ts +19 -18
- package/exporter/utils/alerts.ts +29 -0
- package/exporter/utils/api.ts +243 -0
- package/exporter/utils/cache.ts +142 -0
- package/exporter/utils/core-utils.ts +458 -0
- package/exporter/utils/create-build-data.ts +17 -0
- package/exporter/utils/domains.ts +39 -0
- package/exporter/utils/folders.ts +320 -0
- package/exporter/utils/health-checks.ts +64 -0
- package/exporter/{core → utils}/images.ts +6 -1
- package/exporter/{core → utils}/instance.ts +13 -9
- package/exporter/utils/loggin.ts +184 -0
- package/exporter/{services → utils}/pages.ts +92 -27
- package/exporter/utils/render.ts +71 -0
- package/exporter/utils/searches.ts +156 -0
- package/exporter/utils/sites.ts +312 -0
- package/exporter/utils/store.ts +314 -0
- package/gatsby-browser.tsx +58 -41
- package/gatsby-config.ts +17 -10
- package/gatsby-node.ts +80 -20
- package/gatsby-ssr.tsx +1 -2
- package/package.json +92 -41
- package/src/README.md +7 -0
- package/src/components/Head.tsx +73 -30
- package/src/components/template.tsx +30 -8
- package/src/gatsby-node-utils.ts +2 -76
- package/src/html.tsx +11 -2
- package/src/types.ts +5 -5
- package/start-render.js +7 -0
- package/tsconfig.json +3 -5
- package/build/commands/end-render.js +0 -31
- package/build/commands/end-render.js.map +0 -7
- package/build/commands/prepare-assets-directory.js +0 -9
- package/build/commands/prepare-assets-directory.js.map +0 -7
- package/build/commands/prepare-domains-render.js +0 -38
- package/build/commands/prepare-domains-render.js.map +0 -7
- package/build/commands/reset-render.js +0 -31
- package/build/commands/reset-render.js.map +0 -7
- package/build/commands/start-embeddings.js +0 -31
- package/build/commands/start-embeddings.js.map +0 -7
- package/build/commands/start-render.js +0 -66
- package/build/commands/start-render.js.map +0 -7
- package/build/commands/upload-search-content.js +0 -31
- package/build/commands/upload-search-content.js.map +0 -7
- package/build/core/GriddoLog.d.ts +0 -16
- package/build/core/db.d.ts +0 -4
- package/build/core/dist-rollback.d.ts +0 -2
- package/build/core/fs.d.ts +0 -69
- package/build/core/logger.d.ts +0 -18
- package/build/services/manage-store.d.ts +0 -48
- package/build/services/render.d.ts +0 -70
- package/build/shared/envs.d.ts +0 -19
- package/build/shared/npm-modules/brush.d.ts +0 -18
- package/build/shared/npm-modules/find-up-simple.d.ts +0 -34
- package/build/shared/npm-modules/pkg-dir.d.ts +0 -7
- package/build/shared/types/render.d.ts +0 -54
- package/cli.mjs +0 -239
- package/exporter/build-esbuild.noop +0 -42
- package/exporter/commands/README.md +0 -151
- package/exporter/commands/prepare-assets-directory.ts +0 -34
- package/exporter/commands/single-domain-upload-search-content.noop +0 -206
- package/exporter/commands/start-embeddings.ts +0 -29
- package/exporter/core/GriddoLog.ts +0 -45
- package/exporter/core/check-env-health.ts +0 -200
- package/exporter/core/db-class.ts +0 -54
- package/exporter/core/db.ts +0 -33
- package/exporter/core/dist-rollback.ts +0 -40
- package/exporter/core/errors.ts +0 -82
- package/exporter/core/fs.ts +0 -385
- package/exporter/core/life-cycle.ts +0 -73
- package/exporter/core/logger.ts +0 -141
- package/exporter/core/objects.ts +0 -37
- package/exporter/core/print-logos.ts +0 -21
- package/exporter/services/api.ts +0 -306
- package/exporter/services/manage-sites.ts +0 -116
- package/exporter/services/manage-store.ts +0 -235
- package/exporter/services/render-artifacts.ts +0 -44
- package/exporter/services/render.ts +0 -229
- package/exporter/services/sitemaps.ts +0 -129
- package/exporter/shared/context.ts +0 -49
- package/exporter/shared/envs.ts +0 -62
- package/exporter/shared/npm-modules/README.md +0 -36
- package/exporter/shared/npm-modules/brush.ts +0 -34
- package/exporter/shared/npm-modules/find-up-simple.ts +0 -100
- package/exporter/shared/npm-modules/pkg-dir.ts +0 -17
- package/exporter/shared/npm-modules/xml-parser.ts +0 -57
- package/exporter/shared/types/render.ts +0 -63
- package/exporter/ssg-adapters/gatsby/actions/clean.ts +0 -26
- package/exporter/ssg-adapters/gatsby/actions/close.ts +0 -17
- package/exporter/ssg-adapters/gatsby/actions/data.ts +0 -22
- package/exporter/ssg-adapters/gatsby/actions/healthCheck.ts +0 -10
- package/exporter/ssg-adapters/gatsby/actions/init.ts +0 -12
- package/exporter/ssg-adapters/gatsby/actions/logs.ts +0 -10
- package/exporter/ssg-adapters/gatsby/actions/meta.ts +0 -13
- package/exporter/ssg-adapters/gatsby/actions/prepare.ts +0 -9
- package/exporter/ssg-adapters/gatsby/actions/relocation.ts +0 -15
- package/exporter/ssg-adapters/gatsby/actions/restore.ts +0 -21
- package/exporter/ssg-adapters/gatsby/actions/ssg.ts +0 -12
- package/exporter/ssg-adapters/gatsby/actions/sync.ts +0 -65
- package/exporter/ssg-adapters/gatsby/index.ts +0 -114
- package/exporter/ssg-adapters/gatsby/shared/artifacts.ts +0 -16
- package/exporter/ssg-adapters/gatsby/shared/diff-assets.ts +0 -128
- package/exporter/ssg-adapters/gatsby/shared/extract-assets.ts +0 -75
- package/exporter/ssg-adapters/gatsby/shared/gatsby-build.ts +0 -58
- package/exporter/ssg-adapters/gatsby/shared/sync-render.ts +0 -300
- package/exporter/ssg-adapters/gatsby/shared/types.ts +0 -35
- package/exporter/ssg-adapters/gatsby/shared/utils.ts +0 -33
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +0 -55
- package/plugins/gatsby-plugin-svgr-loader/package.json +0 -8
- package/react/DynamicScript/index.tsx +0 -33
- package/react/GriddoOpenGraph/index.tsx +0 -39
- package/tsconfig.commands.json +0 -36
- package/tsconfig.exporter.json +0 -20
- /package/build/{shared → constants}/endpoints.d.ts +0 -0
- /package/build/{core → utils}/instance.d.ts +0 -0
- /package/{react/GriddoFavicon → exporter/react/Favicon}/utils.ts +0 -0
- /package/exporter/{shared/types → types}/templates.ts +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Here are all the environment variables that the CX code uses.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import dotenv from "dotenv";
|
|
6
|
+
|
|
7
|
+
import { isTruthy } from "../utils/core-utils";
|
|
8
|
+
|
|
9
|
+
dotenv.config();
|
|
10
|
+
|
|
11
|
+
//
|
|
12
|
+
// Credentials
|
|
13
|
+
//
|
|
14
|
+
/* prettier-ignore */ const GRIDDO_API_URL = process.env.GRIDDO_API_URL || process.env.API_URL;
|
|
15
|
+
/* prettier-ignore */ const GRIDDO_PUBLIC_API_URL = process.env.GRIDDO_PUBLIC_API_URL || process.env.PUBLIC_API_URL;
|
|
16
|
+
/* prettier-ignore */ const GRIDDO_BOT_USER = process.env.botEmail || process.env.GRIDDO_BOT_USER;
|
|
17
|
+
/* prettier-ignore */ const GRIDDO_BOT_PASSWORD = process.env.botPassword|| process.env.GRIDDO_BOT_PASSWORD;
|
|
18
|
+
|
|
19
|
+
//
|
|
20
|
+
// Rendering
|
|
21
|
+
//
|
|
22
|
+
/* prettier-ignore */ const GRIDDO_API_CONCURRENCY_COUNT = Number.parseInt( process.env.GRIDDO_API_CONCURRENCY_COUNT || "10");
|
|
23
|
+
/* prettier-ignore */ const GRIDDO_RENDER_ALL_SITES = isTruthy(process.env.GRIDDO_RENDER_ALL_SITES || process.env.updateAllSites);
|
|
24
|
+
/* prettier-ignore */ const GRIDDO_RENDER_SITE = Number.parseInt(process.env.GRIDDO_RENDER_SITE || "")
|
|
25
|
+
/* prettier-ignore */ const GRIDDO_RENDER_PAGES = (process.env.GRIDDO_RENDER_PAGES || "").split(",").map((item) => Number.parseInt(item)).filter(Boolean);
|
|
26
|
+
/* prettier-ignore */ const GRIDDO_SKIP_BUILD_CHECKS = isTruthy(process.env.GRIDDO_SKIP_BUILD_CHECKS)
|
|
27
|
+
/* prettier-ignore */ const GRIDDO_DEBUG_LOGS = isTruthy(process.env.GRIDDO_DEBUG_LOGS);
|
|
28
|
+
/* prettier-ignore */ const GRIDDO_BUILD_LOGS = isTruthy(process.env.GRIDDO_BUILD_LOGS);
|
|
29
|
+
/* prettier-ignore */ const GRIDDO_RENDER_BREAKPOINTS_FEATURE = isTruthy(process.env.GRIDDO_RENDER_BREAKPOINTS_FEATURE);
|
|
30
|
+
/* prettier-ignore */ const GRIDDO_SSG_VERBOSE_LOGS = isTruthy(process.env.GRIDDO_SSG_VERBOSE_LOGS)
|
|
31
|
+
/* prettier-ignore */ const GRIDDO_SEARCH_FEATURE = isTruthy(process.env.GRIDDO_SEARCH_FEATURE);
|
|
32
|
+
/* prettier-ignore */ const GRIDDO_ASSET_PREFIX = process.env.GRIDDO_ASSET_PREFIX || process.env.ASSET_PREFIX;
|
|
33
|
+
/* prettier-ignore */ const GRIDDO_REACT_APP_INSTANCE = process.env.GRIDDO_REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;
|
|
34
|
+
/* prettier-ignore */ const GRIDDO_AI_EMBEDDINGS = isTruthy(process.env.GRIDDO_AI_EMBEDDINGS);
|
|
35
|
+
/* prettier-ignore */ const GRIDDO_VERBOSE_LOGS = isTruthy(process.env.GRIDDO_VERBOSE_LOGS);
|
|
36
|
+
/* prettier-ignore */ const GRIDDO_ALERT_FEATURE = isTruthy(process.env.GRIDDO_ALERT_FEATURE);
|
|
37
|
+
/* prettier-ignore */ const GRIDDO_API_MAX_RESPONSE_SIZE = Number.parseInt(process.env.GRIDDO_API_MAX_RESPONSE_SIZE || "81920") // 80KB
|
|
38
|
+
/* prettier-ignore */ const GRIDDO_SSG_MAX_PAGE_SIZE = Number.parseInt(process.env.GRIDDO_SSG_MAX_PAGE_SIZE || "524288") // 512KB
|
|
39
|
+
|
|
40
|
+
//
|
|
41
|
+
// LifeCycle
|
|
42
|
+
//
|
|
43
|
+
/* prettier-ignore */ const GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
44
|
+
/* prettier-ignore */ const GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
45
|
+
/* prettier-ignore */ const GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
46
|
+
/* prettier-ignore */ const GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
47
|
+
/* prettier-ignore */ const GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
48
|
+
/* prettier-ignore */ const GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
49
|
+
/* prettier-ignore */ const GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS || "2");
|
|
50
|
+
/* prettier-ignore */ const GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
51
|
+
/* prettier-ignore */ const GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS || "4");
|
|
52
|
+
/* prettier-ignore */ const GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(process.env.GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS || "1");
|
|
53
|
+
|
|
54
|
+
//
|
|
55
|
+
// Testing
|
|
56
|
+
//
|
|
57
|
+
/* prettier-ignore */ const GRIDDO_FIXTURES_DOMAIN_NAMES = process.env.GRIDDO_CX_FIXTURES_DOMAIN_NAMES;
|
|
58
|
+
/* prettier-ignore */ const GRIDDO_FIXTURES_SITE_NAMES = process.env.GRIDDO_CX_FIXTURES_SITE_NAMES;
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
GRIDDO_AI_EMBEDDINGS,
|
|
62
|
+
GRIDDO_ALERT_FEATURE,
|
|
63
|
+
GRIDDO_API_CONCURRENCY_COUNT,
|
|
64
|
+
GRIDDO_API_MAX_RESPONSE_SIZE,
|
|
65
|
+
GRIDDO_API_URL,
|
|
66
|
+
GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
|
|
67
|
+
GRIDDO_ASSET_PREFIX,
|
|
68
|
+
GRIDDO_BOT_PASSWORD,
|
|
69
|
+
GRIDDO_BOT_USER,
|
|
70
|
+
GRIDDO_BUILD_LOGS,
|
|
71
|
+
GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS,
|
|
72
|
+
GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
|
|
73
|
+
GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
|
|
74
|
+
GRIDDO_DEBUG_LOGS,
|
|
75
|
+
GRIDDO_FIXTURES_DOMAIN_NAMES,
|
|
76
|
+
GRIDDO_FIXTURES_SITE_NAMES,
|
|
77
|
+
GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS,
|
|
78
|
+
GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
|
|
79
|
+
GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
|
|
80
|
+
GRIDDO_PUBLIC_API_URL,
|
|
81
|
+
GRIDDO_REACT_APP_INSTANCE,
|
|
82
|
+
GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS,
|
|
83
|
+
GRIDDO_RENDER_ALL_SITES,
|
|
84
|
+
GRIDDO_RENDER_BREAKPOINTS_FEATURE,
|
|
85
|
+
GRIDDO_RENDER_PAGES,
|
|
86
|
+
GRIDDO_RENDER_SITE,
|
|
87
|
+
GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS,
|
|
88
|
+
GRIDDO_SEARCH_FEATURE,
|
|
89
|
+
GRIDDO_SKIP_BUILD_CHECKS,
|
|
90
|
+
GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
|
|
91
|
+
GRIDDO_SSG_MAX_PAGE_SIZE,
|
|
92
|
+
GRIDDO_SSG_VERBOSE_LOGS,
|
|
93
|
+
GRIDDO_VERBOSE_LOGS,
|
|
94
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { LifeCyclesNames } from "../types/global";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AI_EMBEDDINGS,
|
|
5
|
+
ALERT,
|
|
6
|
+
BUILD_END,
|
|
7
|
+
BUILD_START,
|
|
8
|
+
DOMAINS,
|
|
9
|
+
GET_ALL,
|
|
10
|
+
GET_PAGE,
|
|
11
|
+
GET_PAGES,
|
|
12
|
+
GET_REFERENCE_FIELD_DATA,
|
|
13
|
+
GET_SITEMAP,
|
|
14
|
+
INFO,
|
|
15
|
+
LANGUAGES,
|
|
16
|
+
LOGIN,
|
|
17
|
+
RESET_RENDER,
|
|
18
|
+
ROBOTS,
|
|
19
|
+
SEARCH,
|
|
20
|
+
SETTINGS,
|
|
21
|
+
SOCIALS,
|
|
22
|
+
} from "./endpoints";
|
|
23
|
+
import {
|
|
24
|
+
GRIDDO_AI_EMBEDDINGS,
|
|
25
|
+
GRIDDO_ALERT_FEATURE,
|
|
26
|
+
GRIDDO_API_CONCURRENCY_COUNT,
|
|
27
|
+
GRIDDO_API_MAX_RESPONSE_SIZE,
|
|
28
|
+
GRIDDO_API_URL,
|
|
29
|
+
GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
|
|
30
|
+
GRIDDO_ASSET_PREFIX,
|
|
31
|
+
GRIDDO_BOT_PASSWORD,
|
|
32
|
+
GRIDDO_BOT_USER,
|
|
33
|
+
GRIDDO_BUILD_LOGS,
|
|
34
|
+
GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS,
|
|
35
|
+
GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
|
|
36
|
+
GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
|
|
37
|
+
GRIDDO_DEBUG_LOGS,
|
|
38
|
+
GRIDDO_FIXTURES_DOMAIN_NAMES,
|
|
39
|
+
GRIDDO_FIXTURES_SITE_NAMES,
|
|
40
|
+
GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
|
|
41
|
+
GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
|
|
42
|
+
GRIDDO_PUBLIC_API_URL,
|
|
43
|
+
GRIDDO_REACT_APP_INSTANCE,
|
|
44
|
+
GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS,
|
|
45
|
+
GRIDDO_RENDER_ALL_SITES,
|
|
46
|
+
GRIDDO_RENDER_BREAKPOINTS_FEATURE,
|
|
47
|
+
GRIDDO_RENDER_PAGES,
|
|
48
|
+
GRIDDO_RENDER_SITE,
|
|
49
|
+
GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS,
|
|
50
|
+
GRIDDO_SEARCH_FEATURE,
|
|
51
|
+
GRIDDO_SKIP_BUILD_CHECKS,
|
|
52
|
+
GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
|
|
53
|
+
GRIDDO_SSG_MAX_PAGE_SIZE,
|
|
54
|
+
GRIDDO_SSG_VERBOSE_LOGS,
|
|
55
|
+
GRIDDO_VERBOSE_LOGS,
|
|
56
|
+
} from "./envs";
|
|
57
|
+
|
|
58
|
+
const endpoints = {
|
|
59
|
+
ALERT,
|
|
60
|
+
AI_EMBEDDINGS,
|
|
61
|
+
BUILD_END,
|
|
62
|
+
BUILD_START,
|
|
63
|
+
DOMAINS,
|
|
64
|
+
GET_ALL,
|
|
65
|
+
GET_PAGE,
|
|
66
|
+
GET_PAGES,
|
|
67
|
+
GET_REFERENCE_FIELD_DATA,
|
|
68
|
+
GET_SITEMAP,
|
|
69
|
+
INFO,
|
|
70
|
+
LANGUAGES,
|
|
71
|
+
LOGIN,
|
|
72
|
+
RESET_RENDER,
|
|
73
|
+
ROBOTS,
|
|
74
|
+
SEARCH,
|
|
75
|
+
SETTINGS,
|
|
76
|
+
SOCIALS,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const envs = {
|
|
80
|
+
GRIDDO_AI_EMBEDDINGS,
|
|
81
|
+
GRIDDO_ALERT_FEATURE,
|
|
82
|
+
GRIDDO_API_CONCURRENCY_COUNT,
|
|
83
|
+
GRIDDO_API_MAX_RESPONSE_SIZE,
|
|
84
|
+
GRIDDO_API_URL,
|
|
85
|
+
GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
|
|
86
|
+
GRIDDO_ASSET_PREFIX,
|
|
87
|
+
GRIDDO_BOT_PASSWORD,
|
|
88
|
+
GRIDDO_BOT_USER,
|
|
89
|
+
GRIDDO_BUILD_LOGS,
|
|
90
|
+
GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS,
|
|
91
|
+
GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
|
|
92
|
+
GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
|
|
93
|
+
GRIDDO_DEBUG_LOGS,
|
|
94
|
+
GRIDDO_FIXTURES_DOMAIN_NAMES,
|
|
95
|
+
GRIDDO_FIXTURES_SITE_NAMES,
|
|
96
|
+
GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
|
|
97
|
+
GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
|
|
98
|
+
GRIDDO_PUBLIC_API_URL,
|
|
99
|
+
GRIDDO_REACT_APP_INSTANCE,
|
|
100
|
+
GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS,
|
|
101
|
+
GRIDDO_RENDER_ALL_SITES,
|
|
102
|
+
GRIDDO_RENDER_BREAKPOINTS_FEATURE,
|
|
103
|
+
GRIDDO_RENDER_PAGES,
|
|
104
|
+
GRIDDO_RENDER_SITE,
|
|
105
|
+
GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS,
|
|
106
|
+
GRIDDO_SEARCH_FEATURE,
|
|
107
|
+
GRIDDO_SKIP_BUILD_CHECKS,
|
|
108
|
+
GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
|
|
109
|
+
GRIDDO_SSG_MAX_PAGE_SIZE,
|
|
110
|
+
GRIDDO_SSG_VERBOSE_LOGS,
|
|
111
|
+
GRIDDO_VERBOSE_LOGS,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const lifeCycleNames: Record<LifeCyclesNames, LifeCyclesNames> = {
|
|
115
|
+
__DEBUG__: "__DEBUG__",
|
|
116
|
+
Archive: "Archive",
|
|
117
|
+
Clean: "Clean",
|
|
118
|
+
Close: "Close",
|
|
119
|
+
Data: "Data",
|
|
120
|
+
HealthCheck: "HealthCheck",
|
|
121
|
+
Init: "Init",
|
|
122
|
+
Meta: "Meta",
|
|
123
|
+
Prepare: "Prepare",
|
|
124
|
+
Relocation: "Relocation",
|
|
125
|
+
Restore: "Restore",
|
|
126
|
+
SSG: "SSG",
|
|
127
|
+
} as const;
|
|
128
|
+
|
|
129
|
+
export { endpoints, envs, lifeCycleNames };
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
* obligatorily.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import type { ErrorData } from ".";
|
|
10
11
|
import type { SpawnSyncReturns } from "node:child_process";
|
|
11
|
-
import type { ErrorData } from "../core/errors";
|
|
12
12
|
|
|
13
13
|
type ErrorsType =
|
|
14
14
|
| "ArtifactError"
|
|
15
|
-
| "BundlesInconsistencyError"
|
|
16
|
-
| "CheckHealthError"
|
|
17
15
|
| "ErrorInSSGBuildProcess"
|
|
18
16
|
| "LifecycleExecutionError"
|
|
19
17
|
| "LoginError"
|
|
@@ -22,7 +20,6 @@ type ErrorsType =
|
|
|
22
20
|
| "ReadFromStoreError"
|
|
23
21
|
| "ReferenceFieldSourcesNotFoundError"
|
|
24
22
|
| "RenderUUIDError"
|
|
25
|
-
| "UploadSearchError"
|
|
26
23
|
| "WriteToStoreError";
|
|
27
24
|
|
|
28
25
|
const ArtifactError: ErrorData = {
|
|
@@ -33,13 +30,19 @@ const ArtifactError: ErrorData = {
|
|
|
33
30
|
hint: "Have there been any recent deployments? These can delete directories from the current render.",
|
|
34
31
|
};
|
|
35
32
|
|
|
36
|
-
const ErrorInSSGBuildProcess = (
|
|
33
|
+
const ErrorInSSGBuildProcess = (
|
|
34
|
+
command: SpawnSyncReturns<string>,
|
|
35
|
+
): ErrorData => ({
|
|
37
36
|
error: "ErrorInSSGBuildProcess",
|
|
38
37
|
message: `Error in SSG build process: ${JSON.stringify(command)}`,
|
|
39
|
-
expected:
|
|
38
|
+
expected:
|
|
39
|
+
"This can happen if there was a problem with the SSG build process.",
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
const LifecycleExecutionError = (
|
|
42
|
+
const LifecycleExecutionError = (
|
|
43
|
+
attempts: number,
|
|
44
|
+
name: string,
|
|
45
|
+
): ErrorData => ({
|
|
43
46
|
error: "LifecycleExecutionError",
|
|
44
47
|
message: `Exceeded maximum retry attempts (${attempts}) for ${name} LifeCycle`,
|
|
45
48
|
});
|
|
@@ -47,12 +50,14 @@ const LifecycleExecutionError = (attempts: number, name: string): ErrorData => (
|
|
|
47
50
|
const LoginError: ErrorData = {
|
|
48
51
|
error: "LoginError",
|
|
49
52
|
message: "There was a problem logging in to the API",
|
|
50
|
-
expected:
|
|
53
|
+
expected:
|
|
54
|
+
"This happens if the API is currently not working or the credentials are incorrect.",
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
const NoDomainsFoundError: ErrorData = {
|
|
54
58
|
error: "NoDomainsFoundError",
|
|
55
|
-
message:
|
|
59
|
+
message:
|
|
60
|
+
"No domains were found in this instance. The process cannot continue.",
|
|
56
61
|
expected:
|
|
57
62
|
"This may happen if the API is not functioning, or the site is not properly configured, or the domains are not registered.",
|
|
58
63
|
hint: "You can contact the instance administrator.",
|
|
@@ -93,22 +98,8 @@ const WriteToStoreError: ErrorData = {
|
|
|
93
98
|
hint: "There may be an issue such as lack of space or permissions preventing the file from being written.",
|
|
94
99
|
};
|
|
95
100
|
|
|
96
|
-
const UploadSearchError: ErrorData = {
|
|
97
|
-
error: "UploadSearchError",
|
|
98
|
-
message: "There was an error uploading content to API for search",
|
|
99
|
-
hint: "This happens if the API is currently not working or the credentials are incorrect.",
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const CheckHealthError: ErrorData = {
|
|
103
|
-
error: "CheckHealthError",
|
|
104
|
-
message: "There was a problem with environment vars configuration.",
|
|
105
|
-
expected: "Some of the required environment variables are not set correctly or are missing",
|
|
106
|
-
hint: "Are the environment variables correctly set?",
|
|
107
|
-
};
|
|
108
|
-
|
|
109
101
|
export {
|
|
110
102
|
ArtifactError,
|
|
111
|
-
CheckHealthError,
|
|
112
103
|
ErrorInSSGBuildProcess,
|
|
113
104
|
LifecycleExecutionError,
|
|
114
105
|
LoginError,
|
|
@@ -117,7 +108,6 @@ export {
|
|
|
117
108
|
ReadFromStoreError,
|
|
118
109
|
ReferenceFieldSourcesNotFoundError,
|
|
119
110
|
RenderUUIDError,
|
|
120
|
-
UploadSearchError,
|
|
121
111
|
WriteToStoreError,
|
|
122
112
|
type ErrorsType,
|
|
123
113
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ErrorsType } from "./errors-data";
|
|
2
|
+
|
|
3
|
+
import kleur from "kleur";
|
|
4
|
+
|
|
5
|
+
export type ErrorData = {
|
|
6
|
+
error: ErrorsType;
|
|
7
|
+
message: string;
|
|
8
|
+
expected?: string;
|
|
9
|
+
hint?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export class RenderError extends Error {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.name = "InternalCXError";
|
|
16
|
+
this.stack = "";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Throws an error with the provided error message, expected value, and hint.
|
|
22
|
+
*/
|
|
23
|
+
function throwError(options: ErrorData, stack?: unknown) {
|
|
24
|
+
const { error, message, expected, hint } = options;
|
|
25
|
+
|
|
26
|
+
const errorColor = kleur.red("[ " + error + " ]");
|
|
27
|
+
const extraText = [expected, hint].filter(Boolean).join("\n");
|
|
28
|
+
|
|
29
|
+
console.log(`
|
|
30
|
+
${errorColor}
|
|
31
|
+
${message}
|
|
32
|
+
${extraText}
|
|
33
|
+
|
|
34
|
+
${kleur.red("stack")}
|
|
35
|
+
${JSON.stringify(stack, null, 2)}`);
|
|
36
|
+
|
|
37
|
+
throw new RenderError();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { throwError };
|
package/exporter/index.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Griddo CX library main export file.
|
|
4
|
+
*
|
|
5
|
+
* This file exports functions to use in both: adapters and SSG's frameworks.
|
|
6
|
+
* Turning CX basically in a javascript library.
|
|
7
|
+
*
|
|
8
|
+
* # React
|
|
9
|
+
* There is another export in the `/react` directory to use exclusivelly in
|
|
10
|
+
* the browser context where nodejs (path, fs, etc..) is not available.
|
|
11
|
+
*
|
|
12
|
+
* # Separate scripts.
|
|
13
|
+
* There are some separate .ts files as end-render.ts or reset-render.ts
|
|
14
|
+
* that are intended to be used by infra via npm script like `npm run
|
|
15
|
+
* end-render`
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { SocialsResponse } from "./types/api";
|
|
2
20
|
import type {
|
|
3
21
|
AdditionalInfo,
|
|
4
22
|
Dimensions,
|
|
@@ -6,29 +24,53 @@ import type {
|
|
|
6
24
|
GriddoMultiPage,
|
|
7
25
|
GriddoPageObject,
|
|
8
26
|
GriddoSinglePage,
|
|
9
|
-
} from "./
|
|
10
|
-
import type { Site } from "./
|
|
27
|
+
} from "./types/pages";
|
|
28
|
+
import type { Site } from "./types/sites";
|
|
11
29
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
30
|
+
import { endpoints, envs } from "./constants";
|
|
31
|
+
import { apiRegister } from "./registers/index";
|
|
32
|
+
import { FileRegister, MemoryRegister, Register } from "./services/register";
|
|
33
|
+
import { insertAlert } from "./utils/alerts";
|
|
34
|
+
import { getConfig, walk } from "./utils/core-utils";
|
|
14
35
|
import {
|
|
15
36
|
componentLibraryPathAlias,
|
|
16
37
|
isComponentLibrary,
|
|
17
38
|
resolveComponentsPath,
|
|
18
|
-
} from "./
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
} from "./utils/instance";
|
|
40
|
+
import {
|
|
41
|
+
buildLog,
|
|
42
|
+
debugLog,
|
|
43
|
+
infoLog,
|
|
44
|
+
pageSizeLog,
|
|
45
|
+
verboseLog,
|
|
46
|
+
} from "./utils/loggin";
|
|
47
|
+
import {
|
|
48
|
+
getBuildPagesFromCachedStore,
|
|
49
|
+
getBuildPagesFromStore,
|
|
50
|
+
getBuildPagesPath,
|
|
51
|
+
} from "./utils/store";
|
|
22
52
|
|
|
23
53
|
export {
|
|
24
|
-
|
|
54
|
+
apiRegister,
|
|
55
|
+
buildLog,
|
|
25
56
|
componentLibraryPathAlias,
|
|
26
|
-
|
|
57
|
+
debugLog,
|
|
58
|
+
endpoints,
|
|
59
|
+
envs,
|
|
60
|
+
FileRegister,
|
|
61
|
+
getBuildPagesFromCachedStore,
|
|
62
|
+
getBuildPagesFromStore,
|
|
63
|
+
getBuildPagesPath,
|
|
64
|
+
getConfig,
|
|
65
|
+
infoLog,
|
|
66
|
+
insertAlert,
|
|
27
67
|
isComponentLibrary,
|
|
28
|
-
|
|
68
|
+
MemoryRegister,
|
|
69
|
+
pageSizeLog,
|
|
70
|
+
Register,
|
|
29
71
|
resolveComponentsPath,
|
|
30
|
-
|
|
31
|
-
|
|
72
|
+
verboseLog,
|
|
73
|
+
walk,
|
|
32
74
|
type AdditionalInfo,
|
|
33
75
|
type Dimensions,
|
|
34
76
|
type GriddoListPage,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
1
3
|
import { formatImage } from "./utils";
|
|
2
4
|
|
|
3
|
-
function
|
|
5
|
+
function Favicon({ url }: { url: string | undefined }) {
|
|
4
6
|
if (!url) {
|
|
5
7
|
return null;
|
|
6
8
|
}
|
|
@@ -24,9 +26,13 @@ function GriddoFavicon({ url }: { url: string | undefined }) {
|
|
|
24
26
|
sizes="180x180"
|
|
25
27
|
href={formatImage(url, { width: 180, height: 180, format: "png" })}
|
|
26
28
|
/>
|
|
27
|
-
<link
|
|
29
|
+
<link
|
|
30
|
+
rel="icon"
|
|
31
|
+
type="image/svg+xml"
|
|
32
|
+
href={formatImage(url, { format: "svg" })}
|
|
33
|
+
/>
|
|
28
34
|
</>
|
|
29
35
|
);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
export {
|
|
38
|
+
export { Favicon };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import type { Dimensions } from "../../types/pages";
|
|
1
2
|
import type { Core } from "@griddo/core";
|
|
2
|
-
import type { Dimensions } from "../../build";
|
|
3
|
-
|
|
4
|
-
import * as React from "react";
|
|
5
3
|
|
|
6
4
|
import { generateAutomaticDimensions } from "@griddo-instance";
|
|
5
|
+
import parse from "html-react-parser";
|
|
6
|
+
import * as React from "react";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
composeAnalytics,
|
|
10
|
-
extractScriptContent,
|
|
11
10
|
filterBodyIntegrationFromPosition,
|
|
12
11
|
filterHeadIntegrations,
|
|
13
12
|
} from "./utils";
|
|
14
13
|
|
|
15
14
|
export interface GriddoIntegrationsProps {
|
|
16
|
-
integrations?: Core.PageIntegration
|
|
15
|
+
integrations?: Array<Core.PageIntegration>;
|
|
17
16
|
location: "head" | "start-body" | "end-body";
|
|
18
17
|
id?: string;
|
|
19
18
|
analyticScript?: string;
|
|
@@ -57,7 +56,12 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
57
56
|
// @shame!
|
|
58
57
|
// El fix sería llamar a `composeAnalytics()` solo si `pageInfo` existe.
|
|
59
58
|
const { analyticsScript, analyticsDimensions } = pageInfo
|
|
60
|
-
? composeAnalytics(
|
|
59
|
+
? composeAnalytics(
|
|
60
|
+
siteScript,
|
|
61
|
+
dimensions,
|
|
62
|
+
pageInfo,
|
|
63
|
+
generateAutomaticDimensions,
|
|
64
|
+
)
|
|
61
65
|
: { analyticsDimensions: null, analyticsScript: null };
|
|
62
66
|
|
|
63
67
|
// GTAG WITH UA
|
|
@@ -66,13 +70,9 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
66
70
|
`https://www.googletagmanager.com/gtag/js?id=${analyticsScript}`) ||
|
|
67
71
|
null;
|
|
68
72
|
|
|
69
|
-
const siteScriptContent = extractScriptContent(siteScript);
|
|
70
|
-
|
|
71
73
|
return (
|
|
72
74
|
<>
|
|
73
75
|
{integrationsOrdered?.map((integration, key) => {
|
|
74
|
-
const integrationScriptContent = extractScriptContent(integration.content);
|
|
75
|
-
|
|
76
76
|
/* Data Layer */
|
|
77
77
|
if (integration.type === "datalayer") {
|
|
78
78
|
return (
|
|
@@ -88,19 +88,25 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
88
88
|
if (integration.type === "analytics") {
|
|
89
89
|
// If UA- is provided
|
|
90
90
|
if (analyticsWithUA) {
|
|
91
|
-
return
|
|
91
|
+
return (
|
|
92
|
+
<script key={key} src={analyticsWithUA} data-griddo-id={id} />
|
|
93
|
+
);
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
return
|
|
95
|
-
<
|
|
96
|
-
|
|
96
|
+
return (
|
|
97
|
+
<React.Fragment key={key}>
|
|
98
|
+
{siteScript && parse(siteScript, { trim: true })}
|
|
99
|
+
</React.Fragment>
|
|
100
|
+
);
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
/* Integration integration.type === "addon" */
|
|
100
104
|
if (integration.type === "addon") {
|
|
101
|
-
return
|
|
102
|
-
<
|
|
103
|
-
|
|
105
|
+
return (
|
|
106
|
+
<React.Fragment key={key}>
|
|
107
|
+
{parse(integration.content, { trim: true })}
|
|
108
|
+
</React.Fragment>
|
|
109
|
+
);
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Dimensions } from "../../types/pages";
|
|
1
2
|
import type { Core } from "@griddo/core";
|
|
2
|
-
import type { Dimensions } from "../../build";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Return true if the argument is an object (not null)
|
|
@@ -9,7 +9,7 @@ function isObject(value: unknown) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function filterBodyIntegrationFromPosition(
|
|
12
|
-
integrations: Core.PageIntegration
|
|
12
|
+
integrations: Array<Core.PageIntegration>,
|
|
13
13
|
position: "start" | "end",
|
|
14
14
|
) {
|
|
15
15
|
return (
|
|
@@ -26,7 +26,7 @@ function filterBodyIntegrationFromPosition(
|
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function filterHeadIntegrations(integrations: Core.PageIntegration
|
|
29
|
+
function filterHeadIntegrations(integrations: Array<Core.PageIntegration>) {
|
|
30
30
|
// A la hora de filtrar las integraciones, los addons si que tienen
|
|
31
31
|
// contenido en head pero en el caso de analytics y datalayer el contenido
|
|
32
32
|
// llega a null, pero deben ir en el <head>
|
|
@@ -48,7 +48,7 @@ function filterHeadIntegrations(integrations: Core.PageIntegration[]) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const filterPositionIntegrations = (
|
|
51
|
-
integrations: Core.PageIntegration
|
|
51
|
+
integrations: Array<Core.PageIntegration>,
|
|
52
52
|
position: "head" | "start" | "end",
|
|
53
53
|
) => {
|
|
54
54
|
switch (position) {
|
|
@@ -70,13 +70,16 @@ function composeAnalytics(
|
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
|
+
generateAutomaticDimensions = (page: Record<string, unknown>) => null,
|
|
74
75
|
) {
|
|
75
76
|
const analyticsScript = siteScriptRaw ? siteScriptRaw.trim() : "";
|
|
76
77
|
|
|
77
78
|
// Las dimensiones o DataLayer
|
|
78
79
|
const dynamicValuePrefix = "__SCRIPT:";
|
|
79
|
-
const dimensionValues = isObject(dimensions?.values)
|
|
80
|
+
const dimensionValues = isObject(dimensions?.values)
|
|
81
|
+
? dimensions?.values
|
|
82
|
+
: {};
|
|
80
83
|
const automaticDimensionValues = generateAutomaticDimensions
|
|
81
84
|
? generateAutomaticDimensions(page || {})
|
|
82
85
|
: {};
|
|
@@ -101,7 +104,9 @@ function composeAnalytics(
|
|
|
101
104
|
);
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
const analyticsDimensions = allDimensions.length
|
|
107
|
+
const analyticsDimensions = allDimensions.length
|
|
108
|
+
? `{${allDimensions.join(",")}}`
|
|
109
|
+
: null;
|
|
105
110
|
|
|
106
111
|
return {
|
|
107
112
|
analyticsScript,
|
|
@@ -109,25 +114,8 @@ function composeAnalytics(
|
|
|
109
114
|
};
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
function extractScriptContent(rawInput?: unknown) {
|
|
113
|
-
if (typeof rawInput !== "string" || !rawInput) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const trimmedInput = rawInput.trim();
|
|
118
|
-
|
|
119
|
-
if (!trimmedInput.startsWith("<script>") || !trimmedInput.endsWith("</script>")) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const content = trimmedInput.replace(/<script>|<\/script>/g, "").trim();
|
|
124
|
-
|
|
125
|
-
return content || null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
117
|
export {
|
|
129
118
|
composeAnalytics,
|
|
130
|
-
extractScriptContent,
|
|
131
119
|
filterBodyIntegrationFromPosition,
|
|
132
120
|
filterHeadIntegrations,
|
|
133
121
|
filterPositionIntegrations,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Griddo CX library react export file.
|
|
3
|
+
// This file exports functions to use in the SSG's frameworks.
|
|
4
|
+
//
|
|
5
|
+
// import { ... } from "@griddo/cx/react";
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import { Favicon } from "./Favicon";
|
|
9
|
+
import { GriddoIntegrations } from "./GriddoIntegrations";
|
|
10
|
+
|
|
11
|
+
export { Favicon, GriddoIntegrations };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MemoryRegister, Register } from "../services/register";
|
|
2
|
+
|
|
3
|
+
const entries = {
|
|
4
|
+
API_RESPONSE_TOO_BIG: {
|
|
5
|
+
title: "API response size is too large",
|
|
6
|
+
description:
|
|
7
|
+
"API response size is too large and may affect rendering performance",
|
|
8
|
+
entries: [],
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const register = new Register(new MemoryRegister(entries));
|
|
13
|
+
|
|
14
|
+
export default register;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MemoryRegister, Register } from "../services/register";
|
|
2
|
+
|
|
3
|
+
const entries = {
|
|
4
|
+
GATSBY_PAGE_SIZE_TOO_BIG: {
|
|
5
|
+
title: "Gatsby JSON page size is too large",
|
|
6
|
+
description:
|
|
7
|
+
"The JSON of some Gatsby pages (page-data folder) are too large and may affect rendering performance",
|
|
8
|
+
entries: [],
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const register = new Register(new MemoryRegister(entries));
|
|
13
|
+
|
|
14
|
+
export default register;
|