@griddo/cx 11.7.7-rc.0 → 11.7.7-rc.1
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 +226 -27
- 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/endpoints.d.ts +19 -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/errors/errors-data.d.ts +22 -0
- package/build/errors/index.d.ts +15 -0
- package/build/index.d.ts +29 -0
- package/build/index.js +73 -0
- 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/{react/index.tsx → build/react/index.d.ts} +0 -1
- 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 +10 -0
- 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/types/api.d.ts +142 -0
- package/build/types/global.d.ts +84 -0
- package/build/types/navigation.d.ts +28 -0
- package/build/types/pages.d.ts +144 -0
- package/build/types/sites.d.ts +57 -0
- 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/instance.d.ts +21 -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 +147 -67
- 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 +38 -4
- package/exporter/commands/end-render.ts +69 -73
- package/exporter/commands/move-assets.ts +11 -0
- package/exporter/commands/prepare-domains-render.ts +31 -144
- package/exporter/commands/reset-render.ts +1 -10
- package/exporter/commands/start-render.ts +44 -23
- package/exporter/commands/upload-search-content.ts +20 -194
- package/exporter/constants/envs.ts +55 -57
- package/exporter/constants/index.ts +129 -0
- package/exporter/{constants/errors.ts → errors/errors-data.ts} +14 -24
- package/exporter/{utils/errors.ts → errors/index.ts} +9 -10
- package/exporter/index.ts +82 -0
- package/{react → exporter/react}/Favicon/index.tsx +7 -1
- package/{react → exporter/react}/GriddoIntegrations/index.tsx +14 -6
- package/{react → exporter/react}/GriddoIntegrations/utils.ts +9 -4
- 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 +6 -7
- package/exporter/services/domains.ts +16 -0
- package/exporter/services/navigation.ts +10 -4
- package/exporter/services/reference-fields.ts +23 -8
- package/exporter/services/register.ts +113 -0
- package/exporter/services/robots.ts +16 -9
- package/exporter/services/settings.ts +17 -0
- package/exporter/services/sites.ts +24 -35
- package/exporter/services/store.ts +78 -120
- package/exporter/types/api.ts +27 -24
- package/exporter/types/global.ts +10 -7
- package/exporter/types/navigation.ts +1 -1
- package/exporter/types/pages.ts +3 -2
- package/exporter/types/sites.ts +2 -1
- package/exporter/utils/alerts.ts +29 -0
- package/exporter/utils/api.ts +82 -46
- package/exporter/utils/cache.ts +62 -37
- package/exporter/utils/core-utils.ts +248 -129
- package/exporter/utils/create-build-data.ts +17 -0
- package/exporter/utils/domains.ts +7 -10
- package/exporter/utils/folders.ts +95 -187
- package/exporter/utils/health-checks.ts +64 -0
- package/exporter/utils/images.ts +6 -1
- package/exporter/utils/instance.ts +12 -9
- package/exporter/utils/loggin.ts +91 -32
- package/exporter/utils/pages.ts +88 -23
- package/exporter/utils/render.ts +48 -149
- package/exporter/utils/searches.ts +156 -0
- package/exporter/utils/sites.ts +90 -81
- package/exporter/utils/store.ts +180 -87
- package/gatsby-browser.tsx +58 -41
- package/gatsby-config.ts +12 -6
- package/gatsby-node.ts +77 -15
- package/gatsby-ssr.tsx +1 -2
- package/package.json +78 -36
- package/src/README.md +7 -0
- package/src/components/Head.tsx +46 -13
- package/src/components/template.tsx +30 -8
- package/src/gatsby-node-utils.ts +2 -91
- 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/adapters/gatsby/actions/clean.js +0 -10
- package/build/adapters/gatsby/actions/clean.js.map +0 -1
- package/build/adapters/gatsby/actions/close.js +0 -12
- package/build/adapters/gatsby/actions/close.js.map +0 -1
- package/build/adapters/gatsby/actions/data.js +0 -18
- package/build/adapters/gatsby/actions/data.js.map +0 -1
- package/build/adapters/gatsby/actions/healthCheck.js +0 -10
- package/build/adapters/gatsby/actions/healthCheck.js.map +0 -1
- package/build/adapters/gatsby/actions/init.js +0 -9
- package/build/adapters/gatsby/actions/init.js.map +0 -1
- package/build/adapters/gatsby/actions/meta.js +0 -14
- package/build/adapters/gatsby/actions/meta.js.map +0 -1
- package/build/adapters/gatsby/actions/prepare.js +0 -9
- package/build/adapters/gatsby/actions/prepare.js.map +0 -1
- package/build/adapters/gatsby/actions/relocation.js +0 -15
- package/build/adapters/gatsby/actions/relocation.js.map +0 -1
- package/build/adapters/gatsby/actions/restore.js +0 -26
- package/build/adapters/gatsby/actions/restore.js.map +0 -1
- package/build/adapters/gatsby/actions/ssg.js +0 -9
- package/build/adapters/gatsby/actions/ssg.js.map +0 -1
- package/build/adapters/gatsby/actions/sync.js +0 -51
- package/build/adapters/gatsby/actions/sync.js.map +0 -1
- package/build/adapters/gatsby/index.js +0 -79
- package/build/adapters/gatsby/index.js.map +0 -1
- package/build/adapters/gatsby/shared/context.js +0 -31
- package/build/adapters/gatsby/shared/context.js.map +0 -1
- package/build/adapters/gatsby/shared/diff-assets.js +0 -101
- package/build/adapters/gatsby/shared/diff-assets.js.map +0 -1
- package/build/adapters/gatsby/shared/extract-assets.js +0 -58
- package/build/adapters/gatsby/shared/extract-assets.js.map +0 -1
- package/build/adapters/gatsby/shared/gatsby-build.js +0 -49
- package/build/adapters/gatsby/shared/gatsby-build.js.map +0 -1
- package/build/adapters/gatsby/shared/sync-render.js +0 -210
- package/build/adapters/gatsby/shared/sync-render.js.map +0 -1
- package/build/adapters/gatsby/shared/types.js +0 -3
- package/build/adapters/gatsby/shared/types.js.map +0 -1
- package/build/commands/end-render.js +0 -88
- package/build/commands/end-render.js.map +0 -1
- package/build/commands/prepare-assets-directory.js +0 -32
- package/build/commands/prepare-assets-directory.js.map +0 -1
- package/build/commands/prepare-domains-render.js +0 -133
- package/build/commands/prepare-domains-render.js.map +0 -1
- package/build/commands/reset-render.js +0 -22
- package/build/commands/reset-render.js.map +0 -1
- package/build/commands/start-render.js +0 -45
- package/build/commands/start-render.js.map +0 -1
- package/build/commands/upload-search-content.js +0 -180
- package/build/commands/upload-search-content.js.map +0 -1
- package/build/constants/endpoints.js +0 -42
- package/build/constants/endpoints.js.map +0 -1
- package/build/constants/envs.js +0 -68
- package/build/constants/envs.js.map +0 -1
- package/build/constants/errors.js +0 -81
- package/build/constants/errors.js.map +0 -1
- package/build/services/auth.js +0 -40
- package/build/services/auth.js.map +0 -1
- package/build/services/db-class.js +0 -49
- package/build/services/db-class.js.map +0 -1
- package/build/services/db.js +0 -34
- package/build/services/db.js.map +0 -1
- package/build/services/navigation.js +0 -96
- package/build/services/navigation.js.map +0 -1
- package/build/services/reference-fields.js +0 -131
- package/build/services/reference-fields.js.map +0 -1
- package/build/services/robots.js +0 -60
- package/build/services/robots.js.map +0 -1
- package/build/services/sites.js +0 -109
- package/build/services/sites.js.map +0 -1
- package/build/services/store.js +0 -282
- package/build/services/store.js.map +0 -1
- package/build/types/api.js +0 -3
- package/build/types/api.js.map +0 -1
- package/build/types/global.js +0 -3
- package/build/types/global.js.map +0 -1
- package/build/types/navigation.js +0 -3
- package/build/types/navigation.js.map +0 -1
- package/build/types/pages.js +0 -3
- package/build/types/pages.js.map +0 -1
- package/build/types/render.js +0 -10
- package/build/types/render.js.map +0 -1
- package/build/types/sites.js +0 -3
- package/build/types/sites.js.map +0 -1
- package/build/types/templates.js +0 -3
- package/build/types/templates.js.map +0 -1
- package/build/utils/api.js +0 -161
- package/build/utils/api.js.map +0 -1
- package/build/utils/artifacts.js +0 -34
- package/build/utils/artifacts.js.map +0 -1
- package/build/utils/brush.js +0 -30
- package/build/utils/brush.js.map +0 -1
- package/build/utils/cache.js +0 -106
- package/build/utils/cache.js.map +0 -1
- package/build/utils/check-health.js +0 -68
- package/build/utils/check-health.js.map +0 -1
- package/build/utils/core-utils.js +0 -283
- package/build/utils/core-utils.js.map +0 -1
- package/build/utils/domains.js +0 -37
- package/build/utils/domains.js.map +0 -1
- package/build/utils/errors.js +0 -30
- package/build/utils/errors.js.map +0 -1
- package/build/utils/folders.js +0 -362
- package/build/utils/folders.js.map +0 -1
- package/build/utils/images.js +0 -45
- package/build/utils/images.js.map +0 -1
- package/build/utils/instance.js +0 -66
- package/build/utils/instance.js.map +0 -1
- package/build/utils/loggin.js +0 -108
- package/build/utils/loggin.js.map +0 -1
- package/build/utils/pages.js +0 -359
- package/build/utils/pages.js.map +0 -1
- package/build/utils/render.js +0 -144
- package/build/utils/render.js.map +0 -1
- package/build/utils/sites.js +0 -240
- package/build/utils/sites.js.map +0 -1
- package/build/utils/store.js +0 -193
- package/build/utils/store.js.map +0 -1
- package/exporter/adapters/gatsby/actions/clean.ts +0 -14
- package/exporter/adapters/gatsby/actions/close.ts +0 -17
- package/exporter/adapters/gatsby/actions/data.ts +0 -25
- package/exporter/adapters/gatsby/actions/healthCheck.ts +0 -10
- package/exporter/adapters/gatsby/actions/init.ts +0 -12
- package/exporter/adapters/gatsby/actions/meta.ts +0 -18
- package/exporter/adapters/gatsby/actions/prepare.ts +0 -9
- package/exporter/adapters/gatsby/actions/relocation.ts +0 -15
- package/exporter/adapters/gatsby/actions/restore.ts +0 -36
- package/exporter/adapters/gatsby/actions/ssg.ts +0 -12
- package/exporter/adapters/gatsby/actions/sync.ts +0 -71
- package/exporter/adapters/gatsby/shared/context.ts +0 -50
- package/exporter/adapters/gatsby/shared/diff-assets.ts +0 -113
- package/exporter/adapters/gatsby/shared/extract-assets.ts +0 -61
- package/exporter/adapters/gatsby/shared/gatsby-build.ts +0 -54
- package/exporter/adapters/gatsby/shared/sync-render.ts +0 -276
- package/exporter/adapters/gatsby/shared/types.ts +0 -35
- package/exporter/build-esbuild.noop +0 -42
- package/exporter/commands/prepare-assets-directory.ts +0 -33
- package/exporter/services/db-class.ts +0 -54
- package/exporter/services/db.ts +0 -32
- package/exporter/types/render.ts +0 -59
- package/exporter/utils/artifacts.ts +0 -34
- package/exporter/utils/brush.ts +0 -34
- package/exporter/utils/check-health.ts +0 -79
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +0 -55
- package/plugins/gatsby-plugin-svgr-loader/package.json +0 -8
- /package/{react → exporter/react}/Favicon/utils.ts +0 -0
|
@@ -1,72 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Here are all the environment variables that the CX code uses.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import dotenv from "dotenv";
|
|
2
6
|
|
|
3
7
|
import { isTruthy } from "../utils/core-utils";
|
|
4
8
|
|
|
9
|
+
dotenv.config();
|
|
10
|
+
|
|
11
|
+
//
|
|
5
12
|
// Credentials
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
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;
|
|
10
18
|
|
|
19
|
+
//
|
|
11
20
|
// Rendering
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const GRIDDO_REACT_APP_INSTANCE =
|
|
31
|
-
process.env.GRIDDO_REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;
|
|
32
|
-
const GRIDDO_AI_EMBEDDINGS = isTruthy(process.env.GRIDDO_AI_EMBEDDINGS);
|
|
33
|
-
const GRIDDO_VERBOSE_LOGS = isTruthy(process.env.GRIDDO_VERBOSE_LOGS);
|
|
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
|
|
34
39
|
|
|
40
|
+
//
|
|
35
41
|
// LifeCycle
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
const GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
55
|
-
process.env.GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS || "2",
|
|
56
|
-
);
|
|
57
|
-
const GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
58
|
-
process.env.GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
59
|
-
);
|
|
60
|
-
const GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
61
|
-
process.env.GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS || "4",
|
|
62
|
-
);
|
|
63
|
-
const GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
64
|
-
process.env.GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
65
|
-
);
|
|
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;
|
|
66
59
|
|
|
67
60
|
export {
|
|
68
61
|
GRIDDO_AI_EMBEDDINGS,
|
|
62
|
+
GRIDDO_ALERT_FEATURE,
|
|
69
63
|
GRIDDO_API_CONCURRENCY_COUNT,
|
|
64
|
+
GRIDDO_API_MAX_RESPONSE_SIZE,
|
|
70
65
|
GRIDDO_API_URL,
|
|
71
66
|
GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
|
|
72
67
|
GRIDDO_ASSET_PREFIX,
|
|
@@ -77,6 +72,8 @@ export {
|
|
|
77
72
|
GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
|
|
78
73
|
GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
|
|
79
74
|
GRIDDO_DEBUG_LOGS,
|
|
75
|
+
GRIDDO_FIXTURES_DOMAIN_NAMES,
|
|
76
|
+
GRIDDO_FIXTURES_SITE_NAMES,
|
|
80
77
|
GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS,
|
|
81
78
|
GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
|
|
82
79
|
GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
|
|
@@ -91,6 +88,7 @@ export {
|
|
|
91
88
|
GRIDDO_SEARCH_FEATURE,
|
|
92
89
|
GRIDDO_SKIP_BUILD_CHECKS,
|
|
93
90
|
GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
|
|
91
|
+
GRIDDO_SSG_MAX_PAGE_SIZE,
|
|
94
92
|
GRIDDO_SSG_VERBOSE_LOGS,
|
|
95
93
|
GRIDDO_VERBOSE_LOGS,
|
|
96
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 "../utils/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
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ErrorsType } from "
|
|
1
|
+
import type { ErrorsType } from "./errors-data";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import kleur from "kleur";
|
|
4
4
|
|
|
5
5
|
export type ErrorData = {
|
|
6
6
|
error: ErrorsType;
|
|
@@ -10,21 +10,20 @@ export type ErrorData = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export class RenderError extends Error {
|
|
13
|
-
constructor(
|
|
14
|
-
super(
|
|
15
|
-
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
16
15
|
this.name = "InternalCXError";
|
|
17
|
-
this.stack =
|
|
16
|
+
this.stack = "";
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Throws an error with the provided error message, expected value, and hint.
|
|
23
22
|
*/
|
|
24
|
-
function throwError(options: ErrorData, stack?: unknown)
|
|
23
|
+
function throwError(options: ErrorData, stack?: unknown) {
|
|
25
24
|
const { error, message, expected, hint } = options;
|
|
26
25
|
|
|
27
|
-
const errorColor =
|
|
26
|
+
const errorColor = kleur.red("[ " + error + " ]");
|
|
28
27
|
const extraText = [expected, hint].filter(Boolean).join("\n");
|
|
29
28
|
|
|
30
29
|
console.log(`
|
|
@@ -32,10 +31,10 @@ ${errorColor}
|
|
|
32
31
|
${message}
|
|
33
32
|
${extraText}
|
|
34
33
|
|
|
35
|
-
${
|
|
34
|
+
${kleur.red("stack")}
|
|
36
35
|
${JSON.stringify(stack, null, 2)}`);
|
|
37
36
|
|
|
38
|
-
throw new RenderError(
|
|
37
|
+
throw new RenderError();
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
export { throwError };
|
|
@@ -0,0 +1,82 @@
|
|
|
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";
|
|
20
|
+
import type {
|
|
21
|
+
AdditionalInfo,
|
|
22
|
+
Dimensions,
|
|
23
|
+
GriddoListPage,
|
|
24
|
+
GriddoMultiPage,
|
|
25
|
+
GriddoPageObject,
|
|
26
|
+
GriddoSinglePage,
|
|
27
|
+
} from "./types/pages";
|
|
28
|
+
import type { Site } from "./types/sites";
|
|
29
|
+
|
|
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";
|
|
35
|
+
import {
|
|
36
|
+
componentLibraryPathAlias,
|
|
37
|
+
isComponentLibrary,
|
|
38
|
+
resolveComponentsPath,
|
|
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";
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
apiRegister,
|
|
55
|
+
buildLog,
|
|
56
|
+
componentLibraryPathAlias,
|
|
57
|
+
debugLog,
|
|
58
|
+
endpoints,
|
|
59
|
+
envs,
|
|
60
|
+
FileRegister,
|
|
61
|
+
getBuildPagesFromCachedStore,
|
|
62
|
+
getBuildPagesFromStore,
|
|
63
|
+
getBuildPagesPath,
|
|
64
|
+
getConfig,
|
|
65
|
+
infoLog,
|
|
66
|
+
insertAlert,
|
|
67
|
+
isComponentLibrary,
|
|
68
|
+
MemoryRegister,
|
|
69
|
+
pageSizeLog,
|
|
70
|
+
Register,
|
|
71
|
+
resolveComponentsPath,
|
|
72
|
+
verboseLog,
|
|
73
|
+
walk,
|
|
74
|
+
type AdditionalInfo,
|
|
75
|
+
type Dimensions,
|
|
76
|
+
type GriddoListPage,
|
|
77
|
+
type GriddoMultiPage,
|
|
78
|
+
type GriddoPageObject,
|
|
79
|
+
type GriddoSinglePage,
|
|
80
|
+
type Site,
|
|
81
|
+
type SocialsResponse,
|
|
82
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
1
3
|
import { formatImage } from "./utils";
|
|
2
4
|
|
|
3
5
|
function Favicon({ url }: { url: string | undefined }) {
|
|
@@ -24,7 +26,11 @@ function Favicon({ 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
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import type { Dimensions } from "../../types/pages";
|
|
1
2
|
import type { Core } from "@griddo/core";
|
|
2
|
-
import type { Dimensions } from "../../exporter/types/pages";
|
|
3
|
-
|
|
4
|
-
import * as React from "react";
|
|
5
3
|
|
|
6
4
|
import { generateAutomaticDimensions } from "@griddo-instance";
|
|
7
5
|
import parse from "html-react-parser";
|
|
6
|
+
import * as React from "react";
|
|
8
7
|
|
|
9
8
|
import {
|
|
10
9
|
composeAnalytics,
|
|
@@ -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
|
|
@@ -84,7 +88,9 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
84
88
|
if (integration.type === "analytics") {
|
|
85
89
|
// If UA- is provided
|
|
86
90
|
if (analyticsWithUA) {
|
|
87
|
-
return
|
|
91
|
+
return (
|
|
92
|
+
<script key={key} src={analyticsWithUA} data-griddo-id={id} />
|
|
93
|
+
);
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
return (
|
|
@@ -97,7 +103,9 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
|
|
|
97
103
|
/* Integration integration.type === "addon" */
|
|
98
104
|
if (integration.type === "addon") {
|
|
99
105
|
return (
|
|
100
|
-
<React.Fragment key={key}>
|
|
106
|
+
<React.Fragment key={key}>
|
|
107
|
+
{parse(integration.content, { trim: true })}
|
|
108
|
+
</React.Fragment>
|
|
101
109
|
);
|
|
102
110
|
}
|
|
103
111
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Dimensions } from "../../types/pages";
|
|
1
2
|
import type { Core } from "@griddo/core";
|
|
2
|
-
import type { Dimensions } from "../../exporter/types/pages";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Return true if the argument is an object (not null)
|
|
@@ -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,
|
|
@@ -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;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { AuthHeaders } from "../types/api";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { LoginError } from "../
|
|
6
|
-
import { throwError } from "../utils/errors";
|
|
3
|
+
import { endpoints, envs } from "../constants";
|
|
4
|
+
import { throwError } from "../errors";
|
|
5
|
+
import { LoginError } from "../errors/errors-data";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Service for authentication in the Griddo Private API
|
|
@@ -13,12 +12,12 @@ class AuthService {
|
|
|
13
12
|
|
|
14
13
|
async login() {
|
|
15
14
|
try {
|
|
16
|
-
const response = await fetch(LOGIN, {
|
|
15
|
+
const response = await fetch(endpoints.LOGIN, {
|
|
17
16
|
method: "POST",
|
|
18
17
|
headers: { "Content-Type": "application/json", Connection: "close" },
|
|
19
18
|
body: JSON.stringify({
|
|
20
|
-
username: GRIDDO_BOT_USER,
|
|
21
|
-
password: GRIDDO_BOT_PASSWORD,
|
|
19
|
+
username: envs.GRIDDO_BOT_USER,
|
|
20
|
+
password: envs.GRIDDO_BOT_PASSWORD,
|
|
22
21
|
}),
|
|
23
22
|
});
|
|
24
23
|
|