@hubspot/cms-dev-server 1.0.38 → 1.0.43
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/dist/generateJsonFromJsx.js +1 -1
- package/dist/index.js +113 -134
- package/dist/internalSsr.js +6 -185
- package/dist/island-runtime.js +1 -187
- package/dist/run.js +113 -134
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +10 -193
- package/package.json +3 -4
- package/dist/.DS_Store +0 -0
- package/types/lib/debugAuth.d.ts +0 -2
- package/types/lib/localComponentsLoader.d.ts +0 -2
- package/types/lib/viteAssetHandler.d.ts +0 -15
- package/types/plugins/hubspotStaticAssetPlugin.d.ts +0 -2
- package/types/plugins/remoteAssetsPlugin.d.ts +0 -7
- package/types/plugins/requestSigningPlugin.d.ts +0 -6
- package/types/routes/createAppServerRoutes.d.ts +0 -5
- package/types/routes/homeRouteHandler.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createServer as createViteServer } from "vite";
|
|
|
3
3
|
import { createRequire } from "module";
|
|
4
4
|
import { default as react } from "@vitejs/plugin-react";
|
|
5
5
|
|
|
6
|
-
// ../cms-js-internal/dist/types-
|
|
6
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { createHash } from "crypto";
|
|
9
9
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -240,9 +240,7 @@ function getCMSAssetConfig(webRoot) {
|
|
|
240
240
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
241
241
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
242
242
|
"cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
|
|
243
|
-
"cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules"
|
|
244
|
-
"cms:jsr:clientOnlySupplementalFieldSerialization": "CMS:JSRenderer:ClientOnlySupplementalFieldSerialization",
|
|
245
|
-
"cms:react:unifiedThemePreview": "CMS:React:UnifiedThemePreview"
|
|
243
|
+
"cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules"
|
|
246
244
|
};
|
|
247
245
|
function isUngatedFor(gates, gate) {
|
|
248
246
|
return gates.includes(gate);
|
|
@@ -382,7 +380,7 @@ import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
|
382
380
|
import * as cmsComponents from "@hubspot/cms-components";
|
|
383
381
|
import { ServerRenderContext } from "@hubspot/cms-components";
|
|
384
382
|
var { setProperty, getProperty, hasProperty } = dotProp;
|
|
385
|
-
var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint
|
|
383
|
+
var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
|
|
386
384
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
|
387
385
|
({
|
|
388
386
|
id,
|
|
@@ -428,7 +426,7 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
428
426
|
if (filteredSupplementalFieldValues) {
|
|
429
427
|
output.supplementalFieldValues = filteredSupplementalFieldValues;
|
|
430
428
|
}
|
|
431
|
-
if (
|
|
429
|
+
if (output.clientOnly) {
|
|
432
430
|
output.supplementalFieldValues = supplementalFieldValues;
|
|
433
431
|
}
|
|
434
432
|
return output;
|
|
@@ -526,7 +524,7 @@ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
|
|
|
526
524
|
});
|
|
527
525
|
return perServerRequestDataWithUrls;
|
|
528
526
|
}
|
|
529
|
-
var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint
|
|
527
|
+
var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {
|
|
530
528
|
const islands = getIslandUrls(roots, viteDevServer);
|
|
531
529
|
const perServerRequestDataWithUrls = getPerServerRequestUrls(
|
|
532
530
|
perServerRequestData,
|
|
@@ -538,8 +536,7 @@ var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevS
|
|
|
538
536
|
islands,
|
|
539
537
|
perServerRequestData,
|
|
540
538
|
indent,
|
|
541
|
-
prettyPrint
|
|
542
|
-
isUngatedForClientOnlySupplementalFieldSerialization
|
|
539
|
+
prettyPrint
|
|
543
540
|
)}${writeSharedStateToJsGlobal(
|
|
544
541
|
islands,
|
|
545
542
|
perServerRequestDataWithUrls,
|
|
@@ -1235,8 +1232,8 @@ import path7 from "path";
|
|
|
1235
1232
|
import { normalizePath as normalizePath5 } from "vite";
|
|
1236
1233
|
|
|
1237
1234
|
// src/lib/fullOriginalUrlFromRequest.ts
|
|
1238
|
-
function fullOriginalUrlFromRequest(
|
|
1239
|
-
return `${
|
|
1235
|
+
function fullOriginalUrlFromRequest(request) {
|
|
1236
|
+
return `${request.protocol}://${request.get("host")}${request.originalUrl}`;
|
|
1240
1237
|
}
|
|
1241
1238
|
|
|
1242
1239
|
// src/lib/renderPartial.ts
|
|
@@ -1468,11 +1465,6 @@ var criticalDevErrorsToServerMessages_default = criticalDevErrorsToServerMessage
|
|
|
1468
1465
|
|
|
1469
1466
|
// src/lib/templates.ts
|
|
1470
1467
|
var { readFile } = fsPromises;
|
|
1471
|
-
var getIsUngatedForClientOnlySupplementalFieldSerialization = (gates) => {
|
|
1472
|
-
return gates.includes(
|
|
1473
|
-
"CMS:JSRenderer:ClientOnlySupplementalFieldSerialization"
|
|
1474
|
-
);
|
|
1475
|
-
};
|
|
1476
1468
|
var generateIslandSetupScriptBlock = () => {
|
|
1477
1469
|
return `
|
|
1478
1470
|
<script type="module">
|
|
@@ -1536,7 +1528,6 @@ var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, tit
|
|
|
1536
1528
|
title,
|
|
1537
1529
|
`${globalScriptBlock}${serverLogScript}`
|
|
1538
1530
|
);
|
|
1539
|
-
const isUngatedForClientOnlySupplementalFieldSerialization = getIsUngatedForClientOnlySupplementalFieldSerialization(jsRenderingGates);
|
|
1540
1531
|
htmlTemplate = htmlTemplate.replace(
|
|
1541
1532
|
"<!--islandsglobal-->",
|
|
1542
1533
|
`<script>
|
|
@@ -1545,8 +1536,7 @@ var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, tit
|
|
|
1545
1536
|
renderContext.perServerRequestData,
|
|
1546
1537
|
viteServer,
|
|
1547
1538
|
6,
|
|
1548
|
-
prettyPrint
|
|
1549
|
-
isUngatedForClientOnlySupplementalFieldSerialization
|
|
1539
|
+
prettyPrint
|
|
1550
1540
|
)}
|
|
1551
1541
|
</script>
|
|
1552
1542
|
`
|
|
@@ -1574,15 +1564,13 @@ var getIslandRuntimeAndGlobalToInject = async (sortedIslandRoots, perServerReque
|
|
|
1574
1564
|
"/",
|
|
1575
1565
|
generateIslandSetupScriptBlock()
|
|
1576
1566
|
);
|
|
1577
|
-
const isUngatedForClientOnlySupplementalFieldSerialization = getIsUngatedForClientOnlySupplementalFieldSerialization(gates);
|
|
1578
1567
|
return `${islandRuntimeScript}
|
|
1579
1568
|
<script>${createIslandsGlobalJsForClientInDev2(
|
|
1580
1569
|
sortedIslandRoots,
|
|
1581
1570
|
perServerRequestData,
|
|
1582
1571
|
viteServer,
|
|
1583
1572
|
4,
|
|
1584
|
-
prettyPrint
|
|
1585
|
-
isUngatedForClientOnlySupplementalFieldSerialization
|
|
1573
|
+
prettyPrint
|
|
1586
1574
|
)}</script>
|
|
1587
1575
|
`;
|
|
1588
1576
|
};
|
|
@@ -1643,7 +1631,7 @@ function trackUsage(action) {
|
|
|
1643
1631
|
eventName: EVENT_NAME,
|
|
1644
1632
|
action,
|
|
1645
1633
|
nodeVersion: getNodeVersionData(),
|
|
1646
|
-
version: "1.0.
|
|
1634
|
+
version: "1.0.43",
|
|
1647
1635
|
os: getPlatform()
|
|
1648
1636
|
};
|
|
1649
1637
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2390,8 +2378,8 @@ function isModuleFolderChild(filePath) {
|
|
|
2390
2378
|
// src/lib/previewUtils.ts
|
|
2391
2379
|
import path4 from "path";
|
|
2392
2380
|
var removePreviewPrefix = (t2) => t2.split("/").slice(2).join("/");
|
|
2393
|
-
var getPreviewUrl = (
|
|
2394
|
-
const { authedPortalId, authedEnv, authedHublet, sslEnabled } =
|
|
2381
|
+
var getPreviewUrl = (request, queryParams) => {
|
|
2382
|
+
const { authedPortalId, authedEnv, authedHublet, sslEnabled } = request.app.locals;
|
|
2395
2383
|
const protocol = sslEnabled ? "https" : "http";
|
|
2396
2384
|
return `${protocol}://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
|
|
2397
2385
|
};
|
|
@@ -2530,11 +2518,11 @@ async function initiatePreviewSession(authedPortalId, absoluteWebRoot, themePrev
|
|
|
2530
2518
|
}
|
|
2531
2519
|
|
|
2532
2520
|
// src/proxyPage/proxyPage.ts
|
|
2533
|
-
var getEntryPointBasePathFromProxyRequest = (
|
|
2534
|
-
if (!
|
|
2521
|
+
var getEntryPointBasePathFromProxyRequest = (request) => {
|
|
2522
|
+
if (!request) {
|
|
2535
2523
|
return "";
|
|
2536
2524
|
}
|
|
2537
|
-
const { path: requestPath, pathParamDict } =
|
|
2525
|
+
const { path: requestPath, pathParamDict } = request;
|
|
2538
2526
|
if (!pathParamDict || !pathParamDict.dynamic_slug) {
|
|
2539
2527
|
return requestPath;
|
|
2540
2528
|
}
|
|
@@ -2727,7 +2715,7 @@ function renderComponentForPlaceholderModule(viteServer, resolvedPath, localModu
|
|
|
2727
2715
|
}
|
|
2728
2716
|
);
|
|
2729
2717
|
}
|
|
2730
|
-
async function proxySpecificPage(
|
|
2718
|
+
async function proxySpecificPage(request, response, portalId, hublet, contentId, webRoot, viteServer, projectName, projectComponentPath, jsRenderingGates, urlToProxy, fullOriginalUrl) {
|
|
2731
2719
|
let accountId;
|
|
2732
2720
|
let proxyEnv;
|
|
2733
2721
|
const prettyPrint = isDebugUrlString3(urlToProxy);
|
|
@@ -2767,8 +2755,8 @@ async function proxySpecificPage(request2, response, portalId, hublet, contentId
|
|
|
2767
2755
|
projectName,
|
|
2768
2756
|
environmentConfig,
|
|
2769
2757
|
jsRenderingGates,
|
|
2770
|
-
|
|
2771
|
-
|
|
2758
|
+
request.get("COOKIE"),
|
|
2759
|
+
request.app.locals.localPreviewToken
|
|
2772
2760
|
)).data;
|
|
2773
2761
|
pageHtml = addRefreshScript(pageHtml);
|
|
2774
2762
|
await infillReactModulesAndWriteResponse(
|
|
@@ -2971,7 +2959,7 @@ async function signUrl(authedPortalId, unsignedUrl, requestBody) {
|
|
|
2971
2959
|
const formData = {
|
|
2972
2960
|
module: [JSON.stringify(requestBody)]
|
|
2973
2961
|
};
|
|
2974
|
-
const
|
|
2962
|
+
const request = {
|
|
2975
2963
|
unsignedUrl,
|
|
2976
2964
|
httpMethod: "POST",
|
|
2977
2965
|
formData
|
|
@@ -2983,7 +2971,7 @@ async function signUrl(authedPortalId, unsignedUrl, requestBody) {
|
|
|
2983
2971
|
"Content-Type": "application/json",
|
|
2984
2972
|
Accept: "application/json"
|
|
2985
2973
|
},
|
|
2986
|
-
data: JSON.stringify(
|
|
2974
|
+
data: JSON.stringify(request)
|
|
2987
2975
|
});
|
|
2988
2976
|
return response.data.signedUrl;
|
|
2989
2977
|
} catch (error) {
|
|
@@ -3112,7 +3100,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3112
3100
|
|
|
3113
3101
|
// src/routes/partial.ts
|
|
3114
3102
|
import { join as joinPosix3 } from "path/posix";
|
|
3115
|
-
var partialRouteHandler = async (
|
|
3103
|
+
var partialRouteHandler = async (request, response) => {
|
|
3116
3104
|
sendTrackingRequest("view-partial-route");
|
|
3117
3105
|
const {
|
|
3118
3106
|
authedPortalId,
|
|
@@ -3123,8 +3111,8 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3123
3111
|
jsRenderingGates,
|
|
3124
3112
|
projectName,
|
|
3125
3113
|
projectComponentPath
|
|
3126
|
-
} =
|
|
3127
|
-
const partialName =
|
|
3114
|
+
} = request.app.locals;
|
|
3115
|
+
const partialName = request.params.partial;
|
|
3128
3116
|
const baseTemplatePath = packagePath(
|
|
3129
3117
|
import.meta.url,
|
|
3130
3118
|
"html/baseTemplate.html"
|
|
@@ -3159,7 +3147,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3159
3147
|
viteServer,
|
|
3160
3148
|
partialPath,
|
|
3161
3149
|
{},
|
|
3162
|
-
fullOriginalUrlFromRequest(
|
|
3150
|
+
fullOriginalUrlFromRequest(request),
|
|
3163
3151
|
basePath,
|
|
3164
3152
|
environmentConfig,
|
|
3165
3153
|
{
|
|
@@ -3201,7 +3189,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3201
3189
|
remoteModule.path,
|
|
3202
3190
|
authedPortalId,
|
|
3203
3191
|
authedEnv,
|
|
3204
|
-
|
|
3192
|
+
request.get("COOKIE")
|
|
3205
3193
|
).then((result) => ({
|
|
3206
3194
|
remoteModule,
|
|
3207
3195
|
result
|
|
@@ -3225,8 +3213,8 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3225
3213
|
jsRenderingGates,
|
|
3226
3214
|
projectName,
|
|
3227
3215
|
projectComponentPath,
|
|
3228
|
-
fullOriginalUrlFromRequest(
|
|
3229
|
-
|
|
3216
|
+
fullOriginalUrlFromRequest(request),
|
|
3217
|
+
request.get("COOKIE")
|
|
3230
3218
|
).then((result) => ({
|
|
3231
3219
|
localProjectModule,
|
|
3232
3220
|
result
|
|
@@ -3254,7 +3242,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3254
3242
|
}
|
|
3255
3243
|
const htmlShell = await createHtmlShellDependingOnRenderContext(
|
|
3256
3244
|
baseTemplatePath,
|
|
3257
|
-
|
|
3245
|
+
request.originalUrl,
|
|
3258
3246
|
`Partial: ${partialPath}`,
|
|
3259
3247
|
renderContext,
|
|
3260
3248
|
viteServer,
|
|
@@ -3304,8 +3292,8 @@ function PartialsList({ webRoot, partialNames }) {
|
|
|
3304
3292
|
|
|
3305
3293
|
// src/routes/linksToAllPartialsRouteHandler.tsx
|
|
3306
3294
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3307
|
-
var linksToAllPartialRouteHandler = async (
|
|
3308
|
-
const { webRoot } =
|
|
3295
|
+
var linksToAllPartialRouteHandler = async (request, response) => {
|
|
3296
|
+
const { webRoot } = request.app.locals;
|
|
3309
3297
|
const { partialNames } = findAllPartialsInRoot(webRoot);
|
|
3310
3298
|
const { html: responseHtml } = await renderOnServer(
|
|
3311
3299
|
/* @__PURE__ */ jsx3(PartialsList, { webRoot, partialNames })
|
|
@@ -3342,8 +3330,8 @@ var ModulesList_default = ModulesList;
|
|
|
3342
3330
|
|
|
3343
3331
|
// src/routes/linksToAllModulesRouteHandler.tsx
|
|
3344
3332
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3345
|
-
var linksToAllModuleRouteHandler = async (
|
|
3346
|
-
const { webRoot } =
|
|
3333
|
+
var linksToAllModuleRouteHandler = async (request, response) => {
|
|
3334
|
+
const { webRoot } = request.app.locals;
|
|
3347
3335
|
const { moduleNames } = findAllModulesInRoot(webRoot);
|
|
3348
3336
|
const { html: responseHtml } = await renderOnServer(
|
|
3349
3337
|
/* @__PURE__ */ jsx5(ModulesList_default, { webRoot, moduleNames })
|
|
@@ -3356,7 +3344,7 @@ var linksToAllModulesRouteHandler_default = linksToAllModuleRouteHandler;
|
|
|
3356
3344
|
import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
|
|
3357
3345
|
import path8 from "path";
|
|
3358
3346
|
import { normalizePath as normalizePath6 } from "vite";
|
|
3359
|
-
var moduleRouteHandler = async (
|
|
3347
|
+
var moduleRouteHandler = async (request, response) => {
|
|
3360
3348
|
sendTrackingRequest("view-module-route");
|
|
3361
3349
|
const {
|
|
3362
3350
|
authedPortalId,
|
|
@@ -3367,8 +3355,8 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3367
3355
|
jsRenderingGates,
|
|
3368
3356
|
projectName,
|
|
3369
3357
|
projectComponentPath
|
|
3370
|
-
} =
|
|
3371
|
-
const moduleName =
|
|
3358
|
+
} = request.app.locals;
|
|
3359
|
+
const moduleName = request.params.moduleName;
|
|
3372
3360
|
const baseTemplatePath = packagePath(
|
|
3373
3361
|
import.meta.url,
|
|
3374
3362
|
"html/baseTemplate.html"
|
|
@@ -3386,16 +3374,16 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3386
3374
|
].join("/")
|
|
3387
3375
|
);
|
|
3388
3376
|
let fieldOverrides = null;
|
|
3389
|
-
if (
|
|
3377
|
+
if (request.query.fields) {
|
|
3390
3378
|
try {
|
|
3391
|
-
if (typeof
|
|
3379
|
+
if (typeof request.query.fields === "string") {
|
|
3392
3380
|
fieldOverrides = JSON.parse(
|
|
3393
|
-
decodeURIComponent(
|
|
3381
|
+
decodeURIComponent(request.query.fields.replace(/\+/g, "%20"))
|
|
3394
3382
|
);
|
|
3395
3383
|
}
|
|
3396
3384
|
} catch (e) {
|
|
3397
3385
|
console.error(
|
|
3398
|
-
`Error parsing field param for module ${moduleName}: ${
|
|
3386
|
+
`Error parsing field param for module ${moduleName}: ${request.query.fields}`
|
|
3399
3387
|
);
|
|
3400
3388
|
}
|
|
3401
3389
|
}
|
|
@@ -3421,7 +3409,7 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3421
3409
|
hublParameters: {},
|
|
3422
3410
|
moduleName: `local-${moduleName}`
|
|
3423
3411
|
},
|
|
3424
|
-
fullOriginalUrlFromRequest(
|
|
3412
|
+
fullOriginalUrlFromRequest(request),
|
|
3425
3413
|
basePath,
|
|
3426
3414
|
environmentConfig,
|
|
3427
3415
|
{
|
|
@@ -3430,7 +3418,7 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3430
3418
|
);
|
|
3431
3419
|
const htmlShell = await createHtmlShellDependingOnRenderContext(
|
|
3432
3420
|
baseTemplatePath,
|
|
3433
|
-
|
|
3421
|
+
request.originalUrl,
|
|
3434
3422
|
`Module: ${modulePath}`,
|
|
3435
3423
|
renderContext,
|
|
3436
3424
|
viteServer,
|
|
@@ -3503,11 +3491,11 @@ async function renderModuleFieldsJson(viteServer, requestedModulePath) {
|
|
|
3503
3491
|
var renderModuleFieldsJson_default = renderModuleFieldsJson;
|
|
3504
3492
|
|
|
3505
3493
|
// src/routes/moduleFieldsJson.ts
|
|
3506
|
-
var moduleFieldsJsonRouteHandler = async (
|
|
3494
|
+
var moduleFieldsJsonRouteHandler = async (request, response) => {
|
|
3507
3495
|
try {
|
|
3508
3496
|
sendTrackingRequest("fields-json-route");
|
|
3509
|
-
const { webRoot, viteServer } =
|
|
3510
|
-
const { moduleName } =
|
|
3497
|
+
const { webRoot, viteServer } = request.app.locals;
|
|
3498
|
+
const { moduleName } = request.params;
|
|
3511
3499
|
const modulePath = normalizePath7(
|
|
3512
3500
|
path9.resolve(webRoot, "components/modules/", moduleName)
|
|
3513
3501
|
);
|
|
@@ -3618,7 +3606,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
3618
3606
|
}
|
|
3619
3607
|
|
|
3620
3608
|
// src/routes/proxyPageRouteHandler.ts
|
|
3621
|
-
async function proxyPageRouteHandler(
|
|
3609
|
+
async function proxyPageRouteHandler(request, response, next) {
|
|
3622
3610
|
sendTrackingRequest("view-proxy-page-route");
|
|
3623
3611
|
const {
|
|
3624
3612
|
viteServer,
|
|
@@ -3626,20 +3614,20 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
3626
3614
|
projectName,
|
|
3627
3615
|
projectComponentPath,
|
|
3628
3616
|
jsRenderingGates
|
|
3629
|
-
} =
|
|
3630
|
-
if (!
|
|
3617
|
+
} = request.app.locals;
|
|
3618
|
+
if (!request.accepts().includes("text/html")) {
|
|
3631
3619
|
return response.sendStatus(404);
|
|
3632
3620
|
}
|
|
3633
|
-
const fullOriginalUrl = fullOriginalUrlFromRequest(
|
|
3634
|
-
const domainToProxy = getSubDomainFromValidLocalDomain(
|
|
3635
|
-
const urlToProxy = `http://${domainToProxy}${
|
|
3621
|
+
const fullOriginalUrl = fullOriginalUrlFromRequest(request);
|
|
3622
|
+
const domainToProxy = getSubDomainFromValidLocalDomain(request.hostname);
|
|
3623
|
+
const urlToProxy = `http://${domainToProxy}${request.originalUrl}`;
|
|
3636
3624
|
if (!domainToProxy) {
|
|
3637
|
-
if (VALID_PROXY_DOMAIN_SUFFIXES.includes(
|
|
3638
|
-
const message = `Can't make a proxy request, you need to prepend the real page's domain to '${
|
|
3625
|
+
if (VALID_PROXY_DOMAIN_SUFFIXES.includes(request.hostname)) {
|
|
3626
|
+
const message = `Can't make a proxy request, you need to prepend the real page's domain to '${request.hostname}' (i.e. your.page.com.${request.hostname})`;
|
|
3639
3627
|
consoleWarn(message);
|
|
3640
3628
|
return response.status(400).send(message);
|
|
3641
3629
|
} else {
|
|
3642
|
-
const message = `Can't make a proxy request, the domain '${
|
|
3630
|
+
const message = `Can't make a proxy request, the domain '${request.hostname}' is not a valid proxy-able domain`;
|
|
3643
3631
|
consoleWarn(message);
|
|
3644
3632
|
return response.status(400).send(message);
|
|
3645
3633
|
}
|
|
@@ -3647,10 +3635,10 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
3647
3635
|
try {
|
|
3648
3636
|
const { portalId, contentId, hublet } = await fetchContentMetadata(
|
|
3649
3637
|
urlToProxy,
|
|
3650
|
-
|
|
3638
|
+
request.app.locals.authedPortalId
|
|
3651
3639
|
);
|
|
3652
3640
|
await proxySpecificPage(
|
|
3653
|
-
|
|
3641
|
+
request,
|
|
3654
3642
|
response,
|
|
3655
3643
|
portalId,
|
|
3656
3644
|
hublet,
|
|
@@ -3669,7 +3657,7 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
3669
3657
|
}
|
|
3670
3658
|
|
|
3671
3659
|
// src/routes/proxyPageResourceRedirect.ts
|
|
3672
|
-
import
|
|
3660
|
+
import fetch2 from "node-fetch";
|
|
3673
3661
|
var HCMS_PATH = "/_hcms/";
|
|
3674
3662
|
var HS_FS_PATH = "/hs-fs/";
|
|
3675
3663
|
var HUB_FS_PATH = "/hubfs/";
|
|
@@ -3684,7 +3672,7 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
3684
3672
|
const pathToProxy = req.originalUrl;
|
|
3685
3673
|
const urlToProxy = `https://${domainToProxy}${pathToProxy}`;
|
|
3686
3674
|
if (req.method === "GET") {
|
|
3687
|
-
|
|
3675
|
+
fetch2(urlToProxy).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3688
3676
|
} else {
|
|
3689
3677
|
const contentType = req.headers["content-type"];
|
|
3690
3678
|
const isSendingJSON = contentType && /\bjson\b/.test(req.headers["content-type"].toString());
|
|
@@ -3699,6 +3687,7 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
3699
3687
|
}
|
|
3700
3688
|
return true;
|
|
3701
3689
|
});
|
|
3690
|
+
const headersToPass = Object.fromEntries(headerEntries);
|
|
3702
3691
|
let body = void 0;
|
|
3703
3692
|
if (req.body) {
|
|
3704
3693
|
if (isSendingJSON) {
|
|
@@ -3707,12 +3696,11 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
3707
3696
|
body = req.body.toString();
|
|
3708
3697
|
}
|
|
3709
3698
|
}
|
|
3710
|
-
|
|
3711
|
-
url: urlToProxy,
|
|
3699
|
+
fetch2(urlToProxy, {
|
|
3712
3700
|
method: req.method,
|
|
3713
|
-
headers:
|
|
3701
|
+
headers: headersToPass,
|
|
3714
3702
|
body
|
|
3715
|
-
}).pipe(res);
|
|
3703
|
+
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3716
3704
|
}
|
|
3717
3705
|
}
|
|
3718
3706
|
|
|
@@ -3765,8 +3753,8 @@ function isCodedFile(filePath) {
|
|
|
3765
3753
|
|
|
3766
3754
|
// src/routes/legacyRouteHandler.tsx
|
|
3767
3755
|
import { Fragment, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3768
|
-
var legacyRouteHandler = async (
|
|
3769
|
-
const domainToProxy = getSubDomainFromValidLocalDomain(
|
|
3756
|
+
var legacyRouteHandler = async (request, response, next) => {
|
|
3757
|
+
const domainToProxy = getSubDomainFromValidLocalDomain(request.hostname);
|
|
3770
3758
|
if (domainToProxy) {
|
|
3771
3759
|
next();
|
|
3772
3760
|
return;
|
|
@@ -3777,12 +3765,8 @@ var legacyRouteHandler = async (request2, response, next) => {
|
|
|
3777
3765
|
webRoot,
|
|
3778
3766
|
storybookEnabled,
|
|
3779
3767
|
devServerPort,
|
|
3780
|
-
localPreviewToken
|
|
3781
|
-
|
|
3782
|
-
} = request2.app.locals;
|
|
3783
|
-
const isUngatedForUnifiedThemePreview = jsRenderingGates.includes(
|
|
3784
|
-
"CMS:React:UnifiedThemePreview"
|
|
3785
|
-
);
|
|
3768
|
+
localPreviewToken
|
|
3769
|
+
} = request.app.locals;
|
|
3786
3770
|
const { partialNames } = findAllPartialsInRoot(webRoot);
|
|
3787
3771
|
const { moduleNames } = findAllModulesInRoot(webRoot);
|
|
3788
3772
|
const hublModuleData = await fetchHubLModules(
|
|
@@ -3795,17 +3779,15 @@ var legacyRouteHandler = async (request2, response, next) => {
|
|
|
3795
3779
|
);
|
|
3796
3780
|
const { html: responseHtml } = await renderOnServer(
|
|
3797
3781
|
/* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
3798
|
-
storybookEnabled ? /* @__PURE__ */ jsx8("h2", { children: /* @__PURE__ */ jsx8("a", { href: `//storybook.${
|
|
3782
|
+
storybookEnabled ? /* @__PURE__ */ jsx8("h2", { children: /* @__PURE__ */ jsx8("a", { href: `//storybook.${request.hostname}:${devServerPort}`, children: "Storybook" }) }) : null,
|
|
3799
3783
|
/* @__PURE__ */ jsx8("h2", { children: "Partials" }),
|
|
3800
3784
|
/* @__PURE__ */ jsx8(PartialsList, { webRoot, partialNames }),
|
|
3801
3785
|
/* @__PURE__ */ jsx8("h2", { children: "React modules" }),
|
|
3802
3786
|
/* @__PURE__ */ jsx8(ModulesList_default, { webRoot, moduleNames }),
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
/* @__PURE__ */ jsx8(HubLTemplatesList, { templates: hublTemplateData.objects })
|
|
3808
|
-
] })
|
|
3787
|
+
/* @__PURE__ */ jsx8("h2", { children: "HubL modules" }),
|
|
3788
|
+
/* @__PURE__ */ jsx8(HubLModulesList, { modules: hublModuleData.objects }),
|
|
3789
|
+
/* @__PURE__ */ jsx8("h2", { children: "HubL templates" }),
|
|
3790
|
+
/* @__PURE__ */ jsx8(HubLTemplatesList, { templates: hublTemplateData.objects })
|
|
3809
3791
|
] })
|
|
3810
3792
|
);
|
|
3811
3793
|
response.status(200).set({ "Content-Type": "text/html" }).end(responseHtml);
|
|
@@ -3814,7 +3796,7 @@ var legacyRouteHandler_default = legacyRouteHandler;
|
|
|
3814
3796
|
|
|
3815
3797
|
// src/routes/proxyPathPageRouteHandler.tsx
|
|
3816
3798
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3817
|
-
async function proxyPathPageRouteHandler(
|
|
3799
|
+
async function proxyPathPageRouteHandler(request, response, next) {
|
|
3818
3800
|
sendTrackingRequest("view-proxy-path-route");
|
|
3819
3801
|
const {
|
|
3820
3802
|
viteServer,
|
|
@@ -3822,11 +3804,11 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3822
3804
|
projectName,
|
|
3823
3805
|
projectComponentPath,
|
|
3824
3806
|
jsRenderingGates
|
|
3825
|
-
} =
|
|
3826
|
-
if (!
|
|
3807
|
+
} = request.app.locals;
|
|
3808
|
+
if (!request.accepts().includes("text/html")) {
|
|
3827
3809
|
return response.sendStatus(404);
|
|
3828
3810
|
}
|
|
3829
|
-
if (!
|
|
3811
|
+
if (!request.query.page) {
|
|
3830
3812
|
const { html: responseHtml } = await renderOnServer(
|
|
3831
3813
|
/* @__PURE__ */ jsxs5("div", { children: [
|
|
3832
3814
|
/* @__PURE__ */ jsx9("h2", { children: "Local Proxy" }),
|
|
@@ -3850,7 +3832,7 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3850
3832
|
}
|
|
3851
3833
|
let proxyPageUrl;
|
|
3852
3834
|
try {
|
|
3853
|
-
proxyPageUrl = new URL(
|
|
3835
|
+
proxyPageUrl = new URL(request.query.page);
|
|
3854
3836
|
} catch (e) {
|
|
3855
3837
|
const message = "Please provide a valid page query parameter, e.g., http://localhost:3000/proxy?page=https://yourdomain.com/path";
|
|
3856
3838
|
consoleWarn(message);
|
|
@@ -3865,10 +3847,10 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3865
3847
|
try {
|
|
3866
3848
|
const { portalId, contentId, hublet } = await fetchContentMetadata(
|
|
3867
3849
|
proxyPageUrl.href,
|
|
3868
|
-
|
|
3850
|
+
request.app.locals.authedPortalId
|
|
3869
3851
|
);
|
|
3870
3852
|
await proxySpecificPage(
|
|
3871
|
-
|
|
3853
|
+
request,
|
|
3872
3854
|
response,
|
|
3873
3855
|
portalId,
|
|
3874
3856
|
hublet,
|
|
@@ -3887,7 +3869,7 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3887
3869
|
}
|
|
3888
3870
|
|
|
3889
3871
|
// src/routes/proxyPathPageResourceRedirect.ts
|
|
3890
|
-
import
|
|
3872
|
+
import fetch3 from "node-fetch";
|
|
3891
3873
|
var HCMS_PATH2 = "/_hcms/";
|
|
3892
3874
|
var HS_FS_PATH2 = "/hs-fs/";
|
|
3893
3875
|
var HUB_FS_PATH2 = "/hubfs/";
|
|
@@ -3917,11 +3899,11 @@ function proxyPathPageResourceRedirect(req, res, next) {
|
|
|
3917
3899
|
return;
|
|
3918
3900
|
}
|
|
3919
3901
|
const urlToProxy = `https://${proxyPageUrl.host}${req.url}`;
|
|
3920
|
-
|
|
3902
|
+
fetch3(urlToProxy).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3921
3903
|
}
|
|
3922
3904
|
|
|
3923
3905
|
// src/routes/proxyServerlessHandler.ts
|
|
3924
|
-
import
|
|
3906
|
+
import fetch4 from "node-fetch";
|
|
3925
3907
|
var localDomains = ["localhost", "hslocal.net"];
|
|
3926
3908
|
function proxyServerlessRequest(req, res, next) {
|
|
3927
3909
|
const { method, headers } = req;
|
|
@@ -3974,14 +3956,14 @@ function proxyServerlessRequest(req, res, next) {
|
|
|
3974
3956
|
case "POST":
|
|
3975
3957
|
case "DELETE":
|
|
3976
3958
|
case "PUT":
|
|
3977
|
-
|
|
3959
|
+
fetch4(urlToProxy, {
|
|
3978
3960
|
method,
|
|
3979
3961
|
body,
|
|
3980
3962
|
headers: headersToPass
|
|
3981
3963
|
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3982
3964
|
break;
|
|
3983
3965
|
default:
|
|
3984
|
-
|
|
3966
|
+
fetch4(urlToProxy, {
|
|
3985
3967
|
headers: headersToPass
|
|
3986
3968
|
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3987
3969
|
}
|
|
@@ -3990,7 +3972,7 @@ function proxyServerlessRequest(req, res, next) {
|
|
|
3990
3972
|
// src/routes/modulePreviewRouteHandler.ts
|
|
3991
3973
|
import path10 from "path";
|
|
3992
3974
|
import { normalizePath as normalizePath8 } from "vite";
|
|
3993
|
-
async function modulePreviewRouteHandler(
|
|
3975
|
+
async function modulePreviewRouteHandler(request, response) {
|
|
3994
3976
|
sendTrackingRequest("view-module-preview-route");
|
|
3995
3977
|
const {
|
|
3996
3978
|
authedPortalId,
|
|
@@ -4001,18 +3983,18 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4001
3983
|
jsRenderingGates,
|
|
4002
3984
|
projectName,
|
|
4003
3985
|
projectComponentPath
|
|
4004
|
-
} =
|
|
4005
|
-
const moduleName =
|
|
3986
|
+
} = request.app.locals;
|
|
3987
|
+
const moduleName = request.params.moduleName;
|
|
4006
3988
|
const modulePath = normalizePath8(
|
|
4007
3989
|
path10.resolve(webRoot, "components/modules/", moduleName)
|
|
4008
3990
|
);
|
|
4009
3991
|
const PREVIEWER_APP_PARAM = "hsPreviewerApp";
|
|
4010
3992
|
let fieldOverrides = {};
|
|
4011
|
-
if (
|
|
4012
|
-
if (
|
|
4013
|
-
fieldOverrides =
|
|
3993
|
+
if (request.method === "POST" && request.body) {
|
|
3994
|
+
if (request.query[PREVIEWER_APP_PARAM] === "module" && request.body.module_data) {
|
|
3995
|
+
fieldOverrides = request.body.module_data;
|
|
4014
3996
|
} else {
|
|
4015
|
-
fieldOverrides =
|
|
3997
|
+
fieldOverrides = request.body;
|
|
4016
3998
|
}
|
|
4017
3999
|
try {
|
|
4018
4000
|
if (typeof fieldOverrides === "string") {
|
|
@@ -4030,16 +4012,16 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4030
4012
|
fieldOverrides
|
|
4031
4013
|
);
|
|
4032
4014
|
}
|
|
4033
|
-
} else if (
|
|
4015
|
+
} else if (request.query.fields) {
|
|
4034
4016
|
try {
|
|
4035
|
-
if (typeof
|
|
4017
|
+
if (typeof request.query.fields === "string") {
|
|
4036
4018
|
fieldOverrides = JSON.parse(
|
|
4037
|
-
decodeURIComponent(
|
|
4019
|
+
decodeURIComponent(request.query.fields.replace(/\+/g, "%20"))
|
|
4038
4020
|
);
|
|
4039
4021
|
}
|
|
4040
4022
|
} catch (e) {
|
|
4041
4023
|
console.error(
|
|
4042
|
-
`Error parsing field param for module ${moduleName}: ${
|
|
4024
|
+
`Error parsing field param for module ${moduleName}: ${request.query.fields}`
|
|
4043
4025
|
);
|
|
4044
4026
|
}
|
|
4045
4027
|
}
|
|
@@ -4059,8 +4041,8 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4059
4041
|
jsRenderingGates,
|
|
4060
4042
|
projectName,
|
|
4061
4043
|
projectComponentPath,
|
|
4062
|
-
fullOriginalUrlFromRequest(
|
|
4063
|
-
|
|
4044
|
+
fullOriginalUrlFromRequest(request),
|
|
4045
|
+
request.get("COOKIE"),
|
|
4064
4046
|
fieldOverrides
|
|
4065
4047
|
);
|
|
4066
4048
|
const baseTemplatePath = packagePath(
|
|
@@ -4069,7 +4051,7 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4069
4051
|
);
|
|
4070
4052
|
const htmlShell = await createHtmlShellDependingOnRenderContext(
|
|
4071
4053
|
baseTemplatePath,
|
|
4072
|
-
|
|
4054
|
+
request.originalUrl,
|
|
4073
4055
|
`Module: ${modulePath}`,
|
|
4074
4056
|
renderContext,
|
|
4075
4057
|
viteServer,
|
|
@@ -4095,10 +4077,10 @@ var modulePreviewRouteHandler_default = modulePreviewRouteHandler;
|
|
|
4095
4077
|
|
|
4096
4078
|
// src/routes/hublModuleRouteHandler.ts
|
|
4097
4079
|
import { http as hsCliHttp9 } from "@hubspot/local-dev-lib/http";
|
|
4098
|
-
var hublModuleRouteHandler = async (
|
|
4080
|
+
var hublModuleRouteHandler = async (request, response) => {
|
|
4099
4081
|
sendTrackingRequest("view-hubl-module-route");
|
|
4100
|
-
const { authedPortalId, localPreviewToken } =
|
|
4101
|
-
const { modulePath } =
|
|
4082
|
+
const { authedPortalId, localPreviewToken } = request.app.locals;
|
|
4083
|
+
const { modulePath } = request.params;
|
|
4102
4084
|
if (!modulePath) {
|
|
4103
4085
|
response.status(200).set({ "Content-Type": "text/html" }).end(buildModuleIndex());
|
|
4104
4086
|
return;
|
|
@@ -4114,9 +4096,9 @@ var hublModuleRouteHandler = async (request2, response) => {
|
|
|
4114
4096
|
module_id: customWidgetInfo.moduleId,
|
|
4115
4097
|
hs_preview_key: customWidgetInfo.previewKey,
|
|
4116
4098
|
updated: Date.now(),
|
|
4117
|
-
...
|
|
4099
|
+
...request.query
|
|
4118
4100
|
};
|
|
4119
|
-
const previewUrl = new URL(getPreviewUrl(
|
|
4101
|
+
const previewUrl = new URL(getPreviewUrl(request, params));
|
|
4120
4102
|
try {
|
|
4121
4103
|
const result = (await hsCliHttp9.get(authedPortalId, {
|
|
4122
4104
|
baseURL: previewUrl.origin,
|
|
@@ -4148,7 +4130,7 @@ import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
|
4148
4130
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
4149
4131
|
import { getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
4150
4132
|
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
4151
|
-
var templateRouteHandler = async (
|
|
4133
|
+
var templateRouteHandler = async (request, response) => {
|
|
4152
4134
|
sendTrackingRequest("view-template-route");
|
|
4153
4135
|
const {
|
|
4154
4136
|
authedPortalId,
|
|
@@ -4158,7 +4140,7 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4158
4140
|
webRoot,
|
|
4159
4141
|
projectComponentPath,
|
|
4160
4142
|
jsRenderingGates
|
|
4161
|
-
} =
|
|
4143
|
+
} = request.app.locals;
|
|
4162
4144
|
const environmentConfig = buildStaticEnvConfig5(
|
|
4163
4145
|
authedPortalId,
|
|
4164
4146
|
"na1",
|
|
@@ -4166,7 +4148,7 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4166
4148
|
false,
|
|
4167
4149
|
jsRenderingGates
|
|
4168
4150
|
);
|
|
4169
|
-
const { templatePath } =
|
|
4151
|
+
const { templatePath } = request.params;
|
|
4170
4152
|
if (!templatePath) {
|
|
4171
4153
|
response.status(200).set({ "Content-Type": "text/html" }).end(buildTemplateIndex());
|
|
4172
4154
|
return;
|
|
@@ -4193,10 +4175,10 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4193
4175
|
localProxySchemaVersion: "2",
|
|
4194
4176
|
hsLoginVerifyDisabled: `${true}`,
|
|
4195
4177
|
hsCacheBuster: Date.now().toString(),
|
|
4196
|
-
...
|
|
4178
|
+
...request.query
|
|
4197
4179
|
};
|
|
4198
|
-
const previewUrl = new URL(getPreviewUrl(
|
|
4199
|
-
const fullOriginalUrl = `${
|
|
4180
|
+
const previewUrl = new URL(getPreviewUrl(request, params));
|
|
4181
|
+
const fullOriginalUrl = `${request.protocol}://${request.get("host")}${request.originalUrl}`;
|
|
4200
4182
|
try {
|
|
4201
4183
|
const result = (await hsCliHttp10.get(authedPortalId, {
|
|
4202
4184
|
baseURL: previewUrl.origin,
|
|
@@ -4506,8 +4488,8 @@ var STORYBOOK_DOMAINS = VALID_PROXY_DOMAIN_SUFFIXES.map(
|
|
|
4506
4488
|
var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
4507
4489
|
const devServerApp = Router2();
|
|
4508
4490
|
const { appViteServer, appWebRoot } = appLocals || {};
|
|
4509
|
-
devServerApp.use((
|
|
4510
|
-
const { method, url: url3, hostname } =
|
|
4491
|
+
devServerApp.use((request, response, next) => {
|
|
4492
|
+
const { method, url: url3, hostname } = request;
|
|
4511
4493
|
debug(`${method}:${hostname}${url3}`);
|
|
4512
4494
|
next();
|
|
4513
4495
|
});
|
|
@@ -4572,8 +4554,8 @@ import { Router as Router3 } from "express";
|
|
|
4572
4554
|
import { getAccountId as getAccountId3 } from "@hubspot/local-dev-lib/config";
|
|
4573
4555
|
import cors from "cors";
|
|
4574
4556
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4575
|
-
return async function shadowDevServerCheckHandler(
|
|
4576
|
-
const { query } =
|
|
4557
|
+
return async function shadowDevServerCheckHandler(request, response) {
|
|
4558
|
+
const { query } = request;
|
|
4577
4559
|
if (query) {
|
|
4578
4560
|
const {
|
|
4579
4561
|
hostName,
|
|
@@ -5461,12 +5443,9 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5461
5443
|
if (authedPortalId) {
|
|
5462
5444
|
await validateHSPlatform(projectConfigPath, authedPortalId);
|
|
5463
5445
|
}
|
|
5464
|
-
const isUngatedForUnifiedThemePreview = jsRenderingGates.includes(
|
|
5465
|
-
"CMS:React:UnifiedThemePreview"
|
|
5466
|
-
);
|
|
5467
5446
|
let _localPreviewToken = null;
|
|
5468
5447
|
let _tokenStatus;
|
|
5469
|
-
if (themePreviewOptions
|
|
5448
|
+
if (themePreviewOptions) {
|
|
5470
5449
|
const { localPreviewToken, tokenStatus } = await initiatePreviewSession(
|
|
5471
5450
|
authedPortalId,
|
|
5472
5451
|
absoluteWebRoot,
|