@phis/ui 0.6.10 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-area-render-scope.d.ts +2 -0
- package/components/cms/phi-cms-area-render-scope.js +1 -1
- package/components/cms/phi-cms-error-page.js +1 -1
- package/components/cms/phi-cms-page-render-scope.d.ts +0 -1
- package/components/cms/phi-cms-page-render-scope.js +1 -1
- package/components/cms/phi-cms-root-layout.js +1 -0
- package/components/cms/phi-cms-runtime-registry.d.ts +4 -4
- package/components/cms/phi-cms-runtime-registry.js +4 -4
- package/components/controls/phi-padding-control.js +18 -5
- package/components/layouts/layout-definitions.d.ts +8 -0
- package/components/regions/presets/phi-base-page-column.js +1 -2
- package/components/regions/presets/phi-header-top-actions-layout.d.ts +2 -2
- package/components/regions/presets/phi-header-top-actions-layout.js +2 -4
- package/components/regions/presets/phi-settings-page-shell-tree.js +0 -2
- package/components/widgets/label-sets/padding.js +2 -0
- package/components/widgets/label-sets/region.js +2 -0
- package/components/widgets/label-types/padding.d.ts +2 -0
- package/components/widgets/label-types/padding.js +1 -0
- package/components/widgets/label-types/region.d.ts +2 -0
- package/components/widgets/label-types/region.js +1 -0
- package/components/widgets/label-types/revisions.js +2 -2
- package/components/workspace/catalog-state.d.ts +17 -1
- package/components/workspace/catalog-store.js +1 -0
- package/gateway/dashboard-cards-route.js +4 -9
- package/gateway/form-handler-resolution.js +10 -34
- package/gateway/navigation-target-route.js +4 -10
- package/gateway/page-references-route.js +3 -8
- package/gateway/site-area.d.ts +43 -6
- package/gateway/site-area.js +70 -17
- package/helpers/cms-area-config.d.ts +36 -14
- package/helpers/cms-area-config.js +72 -26
- package/helpers/cms-dialog.d.ts +0 -1
- package/helpers/cms-dialog.js +0 -1
- package/helpers/cms-layout-defaults.d.ts +4 -0
- package/helpers/cms-layout-defaults.js +14 -17
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/page-layout-check.js +4 -1
- package/next/seo-routes.js +24 -28
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/presets.d.ts +0 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/admin/presets.d.ts +0 -1
- package/plugins/runtime-modules/admin/trees/phi-default-admin-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/app/presets.d.ts +0 -1
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/area-definitions.d.ts +17 -0
- package/plugins/runtime-modules/area-definitions.js +6 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +0 -2
- package/plugins/runtime-modules/builder/area-shell-presets.server.d.ts +21 -5
- package/plugins/runtime-modules/builder/area-shell-presets.server.js +171 -63
- package/plugins/runtime-modules/builder/clients/shells-workspace.js +12 -1
- package/plugins/runtime-modules/builder/controller/client.js +2 -0
- package/plugins/runtime-modules/builder/controller/definition.d.ts +1 -0
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +2 -3
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +56 -25
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +13 -7
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +1 -0
- package/plugins/runtime-modules/builder/controller/server-definition.js +7 -4
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +2 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +9 -3
- package/plugins/runtime-modules/builder/data-providers.d.ts +1 -1
- package/plugins/runtime-modules/builder/definition.d.ts +1 -1
- package/plugins/runtime-modules/builder/developer-workspace-store.js +1 -0
- package/plugins/runtime-modules/builder/page-preset-catalog.server.d.ts +0 -2
- package/plugins/runtime-modules/builder/page-preset-catalog.server.js +0 -16
- package/plugins/runtime-modules/builder/persistence.d.ts +20 -25
- package/plugins/runtime-modules/builder/persistence.js +67 -75
- package/plugins/runtime-modules/builder/services/runtime-modules-table.d.ts +17 -0
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +79 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +0 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.d.ts +0 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +1 -10
- package/plugins/runtime-modules/builder/workspace-catalog-actions.d.ts +2 -1
- package/plugins/runtime-modules/builder/workspace-catalog-actions.js +3 -1
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +16 -2
- package/plugins/runtime-modules/descriptor-compiler.js +69 -13
- package/plugins/runtime-modules/editor/services/releases-table.js +26 -14
- package/plugins/runtime-modules/editor/trees/phi-default-editor-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +0 -2
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +0 -4
- package/plugins/runtime-modules/revisions/controller/client.js +13 -7
- package/plugins/runtime-modules/revisions/services/table.js +10 -3
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +0 -1
- package/plugins/runtime-modules/shell-tree-composition.d.ts +0 -2
- package/plugins/runtime-modules/shell-tree-composition.js +0 -3
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +0 -6
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -1
- package/server-helpers/area-root-door-warmup.d.ts +5 -2
- package/server-helpers/area-root-door-warmup.js +2 -10
- package/server-helpers/cms-area.d.ts +9 -1
- package/server-helpers/cms-area.js +16 -11
- package/server-helpers/cms-lookup.js +1 -1
- package/server-helpers/cms-request.d.ts +58 -13
- package/server-helpers/cms-request.js +103 -33
- package/server-helpers/cms-root.d.ts +4 -0
- package/server-helpers/cms-root.js +48 -35
- package/server-helpers/cms.d.ts +5 -5
- package/server-helpers/public-login-route.js +4 -9
- package/server-helpers/search-index.js +9 -14
- package/styles/shell.css +12 -0
- package/theme/antd-css-var-contract.d.ts +6 -0
- package/theme/antd-css-var-contract.js +6 -0
- package/theme/phi-theme-tokens.d.ts +3 -2
- package/theme/phi-theme-tokens.js +11 -1
- package/theme/phi-theme.d.ts +2 -0
- package/theme/phi-theme.js +2 -0
- package/theme/phi-tokens.d.ts +1 -0
- package/theme/phi-tokens.js +7 -0
- package/theme.d.ts +1 -1
- package/theme.js +1 -1
- package/types/cms-module-descriptors.d.ts +26 -1
- package/types/cms-plugins.d.ts +3 -0
- package/types/cms.d.ts +10 -3
|
@@ -346,10 +346,17 @@ function buildRevisionReviewHref(params, row) {
|
|
|
346
346
|
}
|
|
347
347
|
function buildTableData(params, result) {
|
|
348
348
|
const rows = result.rows.map((row, index) => {
|
|
349
|
-
|
|
349
|
+
/*
|
|
350
|
+
* An Area's history holds its structure revisions and its Modules revisions side by side. A Modules
|
|
351
|
+
* revision names no preset (`sourcePreset` null) and is published or drafted by its own pointers,
|
|
352
|
+
* which the row states; `current` speaks of the structure only, so it says nothing about such a row.
|
|
353
|
+
*/
|
|
354
|
+
const isAreaModulesRevision = params.scope.kind === "area" && !row.sourcePreset;
|
|
355
|
+
const isPublished = row.isPublished || (!isAreaModulesRevision && result.current.publishedRevisionId === row.revisionId);
|
|
350
356
|
const isWorkingDraft = row.isWorkingDraft ||
|
|
351
|
-
result.current.workingDraftRevisionId === row.revisionId ||
|
|
352
|
-
(
|
|
357
|
+
(!isAreaModulesRevision && result.current.workingDraftRevisionId === row.revisionId) ||
|
|
358
|
+
(!isAreaModulesRevision &&
|
|
359
|
+
result.current.workingDraftRevisionId == null &&
|
|
353
360
|
index === 0 &&
|
|
354
361
|
!isPublished);
|
|
355
362
|
const revisionTags = [
|
|
@@ -92,12 +92,10 @@ export declare function omitPhiCmsShellCompositionNodes(tree: PhiResolvedCmsPage
|
|
|
92
92
|
resolvedContent?: import("../../types").PhiCmsResolvedContent | null;
|
|
93
93
|
}[];
|
|
94
94
|
pageMeta?: import("../../types").PhiCmsResolvedPageMeta | null;
|
|
95
|
-
runtimeModuleIds?: import("./contracts").PhiRuntimeModuleId[] | null;
|
|
96
95
|
controllerSettings?: import("../../types/cms").PhiCmsTreeControllerSettings | null;
|
|
97
96
|
};
|
|
98
97
|
export declare function mergePhiCmsShellTrees(base: PhiResolvedCmsPageTree, overlay: PhiResolvedCmsPageTree): {
|
|
99
98
|
pageMeta: import("../../types").PhiCmsResolvedPageMeta | null | undefined;
|
|
100
|
-
runtimeModuleIds: `${string}/${string}`[] | null | undefined;
|
|
101
99
|
regions: import("../../types").PhiCmsRegionNode[];
|
|
102
100
|
overlays: import("../../types").PhiCmsOverlayNode[];
|
|
103
101
|
layoutNodes: import("../../types").PhiCmsLayoutNode[];
|
|
@@ -93,9 +93,6 @@ export function mergePhiCmsShellTrees(base, overlay) {
|
|
|
93
93
|
...base,
|
|
94
94
|
...overlay,
|
|
95
95
|
pageMeta: Object.prototype.hasOwnProperty.call(overlay, "pageMeta") ? overlay.pageMeta : base.pageMeta,
|
|
96
|
-
runtimeModuleIds: Object.prototype.hasOwnProperty.call(overlay, "runtimeModuleIds")
|
|
97
|
-
? overlay.runtimeModuleIds
|
|
98
|
-
: base.runtimeModuleIds,
|
|
99
96
|
regions: [...base.regions, ...overlay.regions],
|
|
100
97
|
overlays: [...base.overlays, ...overlay.overlays],
|
|
101
98
|
layoutNodes: [...base.layoutNodes, ...overlay.layoutNodes],
|
|
@@ -212,7 +212,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
|
|
|
212
212
|
horizontal: "left",
|
|
213
213
|
vertical: "top",
|
|
214
214
|
},
|
|
215
|
-
gap: PHI_SPACE.sm,
|
|
216
215
|
margin: 0,
|
|
217
216
|
padding: PHI_SPACE.base,
|
|
218
217
|
},
|
|
@@ -227,7 +226,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
|
|
|
227
226
|
config: {
|
|
228
227
|
balancedSides: true,
|
|
229
228
|
contentAlign: "center",
|
|
230
|
-
gap: PHI_SPACE.sm,
|
|
231
229
|
padding: 0,
|
|
232
230
|
paddingLeft: 0,
|
|
233
231
|
paddingRight: 0,
|
|
@@ -259,7 +257,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
|
|
|
259
257
|
sortOrder: 0,
|
|
260
258
|
label: "Color",
|
|
261
259
|
config: {
|
|
262
|
-
gap: PHI_SPACE.sm,
|
|
263
260
|
anchor: {
|
|
264
261
|
horizontal: "left",
|
|
265
262
|
vertical: "top",
|
|
@@ -279,7 +276,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
|
|
|
279
276
|
sortOrder: 1,
|
|
280
277
|
label: "Style",
|
|
281
278
|
config: {
|
|
282
|
-
gap: PHI_SPACE.sm,
|
|
283
279
|
anchor: {
|
|
284
280
|
horizontal: "left",
|
|
285
281
|
vertical: "top",
|
|
@@ -303,7 +299,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
|
|
|
303
299
|
sortOrder: 2,
|
|
304
300
|
label: "Background",
|
|
305
301
|
config: {
|
|
306
|
-
gap: PHI_SPACE.sm,
|
|
307
302
|
anchor: {
|
|
308
303
|
horizontal: "left",
|
|
309
304
|
vertical: "top",
|
|
@@ -323,7 +318,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
|
|
|
323
318
|
sortOrder: 3,
|
|
324
319
|
label: "Brand",
|
|
325
320
|
config: {
|
|
326
|
-
gap: PHI_SPACE.sm,
|
|
327
321
|
anchor: {
|
|
328
322
|
horizontal: "left",
|
|
329
323
|
vertical: "top",
|
|
@@ -29,7 +29,8 @@ import { PHI_CONTAINER_BREAKPOINT_REGION } from "../../../../../theme/phi-contai
|
|
|
29
29
|
import { PHI_SPACE } from "../../../../../theme/antd-css-var-contract";
|
|
30
30
|
import { PHI_THEME_PAGE_PADDING_BANDS, PHI_THEME_PAGE_PADDING_SCOPES, PHI_THEME_PAGE_PADDING_SIDES, } from "../../../../../theme/phi-theme-tokens";
|
|
31
31
|
import { PHI_COLOR_PICKER_NEUTRAL_PRESETS, PHI_COLOR_PICKER_PRESETS } from "../../../../../components/widgets/config/color-picker-presets";
|
|
32
|
-
import { PHI_SPACING_TOKEN_KEYS } from "../../../../../components/widgets/config/spacing-options";
|
|
32
|
+
import { PHI_SPACING_SCALE_KEYS, PHI_SPACING_TOKEN_KEYS, resolvePhiSpacingScaleKey, resolvePhiSpacingScaleValue, } from "../../../../../components/widgets/config/spacing-options";
|
|
33
|
+
import { PHI_SPACING_SCALE_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/spacing-scale";
|
|
33
34
|
import { PhiColorFieldControl } from "../../../../../components/controls/phi-color-field-control";
|
|
34
35
|
import { usePhiColorControlPresets } from "../../../../../components/controls/use-phi-color-control-presets";
|
|
35
36
|
import { PhiBrandControl, resolvePhiBrandLogoUrl } from "../../../../../components/controls/phi-brand-control";
|
|
@@ -91,6 +92,7 @@ const BRAND_THEME_STYLE_SECTION_KEYS = [
|
|
|
91
92
|
"wireframe",
|
|
92
93
|
"pageWidth",
|
|
93
94
|
"pagePadding",
|
|
95
|
+
"layoutGap",
|
|
94
96
|
];
|
|
95
97
|
/*
|
|
96
98
|
* The shadow under each kind of Button (theme/phi-button-shadow.ts). "Theme" is no step at all -- the
|
|
@@ -1258,6 +1260,8 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1258
1260
|
`padding${side}`,
|
|
1259
1261
|
readEffectiveTokenString(styleTokenInput, `${pagePaddingScope}${side}${pagePaddingBand}`, pagePaddingDefault),
|
|
1260
1262
|
]));
|
|
1263
|
+
// The gap of a Layout that states none (`PHI_LAYOUT_GAP`), as a step of the spacing scale.
|
|
1264
|
+
const layoutGap = resolvePhiSpacingScaleKey(readEffectiveTokenString(styleTokenInput, "layoutGap", PHI_SPACE[PHI_LAYOUT.layoutGap])) ?? PHI_LAYOUT.layoutGap;
|
|
1261
1265
|
const baseFontSize = readEffectiveTokenNumber(styleTokenInput, "fontSize", 12);
|
|
1262
1266
|
function updateToken(tokenPatch) {
|
|
1263
1267
|
publishDraft(mergeThemeToken(state.draft, tokenPatch));
|
|
@@ -1404,6 +1408,18 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1404
1408
|
return [`${pagePaddingScope}${side}${pagePaddingBand}`, value == null ? undefined : value];
|
|
1405
1409
|
}))) }), _jsx(PhiTypographyControl, { type: "secondary", children: "The default of a Page that does not set its own, in Public or in App and the staff Areas: a phone below 768px, a tablet below 1200px." })] })),
|
|
1406
1410
|
},
|
|
1411
|
+
{
|
|
1412
|
+
/*
|
|
1413
|
+
* The distance between a Layout's children, rows and columns alike, where the Layout states
|
|
1414
|
+
* none (`PHI_LAYOUT_GAP`): a Flex, a vertical Flex, a Grid, a Masonry, a Three-column row, a
|
|
1415
|
+
* Split Card. A Layout that states its own gap keeps it.
|
|
1416
|
+
*/
|
|
1417
|
+
key: "layoutGap",
|
|
1418
|
+
label: _jsx(PhiTypographyControl, { strong: true, children: "Layout Gap" }),
|
|
1419
|
+
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: "Gap" }), _jsx(PhiSelectControl, { ariaLabel: "Layout gap", size: "medium", value: layoutGap, options: PHI_SPACING_SCALE_KEYS.map((key) => ({ value: key, label: PHI_SPACING_SCALE_DEFAULT_LABELS[key] })), style: { minWidth: 0, flex: "1 1 auto" }, onChange: (key) => updateToken({
|
|
1420
|
+
layoutGap: key === PHI_LAYOUT.layoutGap ? undefined : resolvePhiSpacingScaleValue(key),
|
|
1421
|
+
}) })] }), _jsx(PhiTypographyControl, { type: "secondary", children: "Between the rows and columns of a Layout that does not set its own gap." })] })),
|
|
1422
|
+
},
|
|
1407
1423
|
] }) })] }));
|
|
1408
1424
|
}
|
|
1409
1425
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiCmsAreaKey } from "../constants/cms-areas";
|
|
3
3
|
import type { PhiBlockRuntime } from "../types";
|
|
4
|
-
import type { PhiCmsCompiledDescriptorCatalog, PhiRuntimeModuleId } from "../types/cms-module-descriptors";
|
|
4
|
+
import type { PhiCmsActiveRouteTable, PhiCmsCompiledDescriptorCatalog, PhiRuntimeModuleId } from "../types/cms-module-descriptors";
|
|
5
5
|
/**
|
|
6
6
|
* Where this Area's root leads, worked out without waiting for somebody to ask for it.
|
|
7
7
|
*
|
|
@@ -26,9 +26,12 @@ import type { PhiCmsCompiledDescriptorCatalog, PhiRuntimeModuleId } from "../typ
|
|
|
26
26
|
* Public is left out. Its root is a locale segment and a landing Page rather than a forward, and the
|
|
27
27
|
* proxy's Area-root branch never sees it.
|
|
28
28
|
*/
|
|
29
|
-
export declare function warmPhiAreaRootDoor({ area, config, runtime, catalog, activeModuleIds, }: {
|
|
29
|
+
export declare function warmPhiAreaRootDoor({ area, config, routeTable, runtime, catalog, activeModuleIds, }: {
|
|
30
30
|
area: PhiCmsAreaKey;
|
|
31
|
+
/** The Area structure's config, where the root route is stated. */
|
|
31
32
|
config: Record<string, unknown> | null | undefined;
|
|
33
|
+
/** The table the root render compiled, from the Module selection and that structure. */
|
|
34
|
+
routeTable: PhiCmsActiveRouteTable;
|
|
32
35
|
runtime: PhiBlockRuntime;
|
|
33
36
|
catalog: PhiCmsCompiledDescriptorCatalog;
|
|
34
37
|
activeModuleIds: ReadonlySet<PhiRuntimeModuleId>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { peekPhiAreaRootDoor, rememberPhiAreaRootDoor } from "../gateway/area-root-door";
|
|
3
3
|
import { findFirstPhiCmsNavigationLinkPath } from "../components/regions/presets/navigation-redirect";
|
|
4
|
-
import {
|
|
4
|
+
import { resolvePhiCmsActiveNavigationSurfaces } from "../plugins/runtime-modules/descriptor-compiler";
|
|
5
5
|
import { resolvePhiAreaRootRouteNavKey } from "../plugins/runtime-modules/area-root-route";
|
|
6
6
|
import { resolvePhiAreaRootRouteDecision } from "./area-root-route";
|
|
7
|
-
import { readPhiAreaLandingSelection, readPhiAreaPublicRoutePaths, } from "../helpers/cms-area-config";
|
|
8
7
|
import { localizeAreaPath } from "../helpers/locale";
|
|
9
8
|
/**
|
|
10
9
|
* Where this Area's root leads, worked out without waiting for somebody to ask for it.
|
|
@@ -30,7 +29,7 @@ import { localizeAreaPath } from "../helpers/locale";
|
|
|
30
29
|
* Public is left out. Its root is a locale segment and a landing Page rather than a forward, and the
|
|
31
30
|
* proxy's Area-root branch never sees it.
|
|
32
31
|
*/
|
|
33
|
-
export async function warmPhiAreaRootDoor({ area, config, runtime, catalog, activeModuleIds, }) {
|
|
32
|
+
export async function warmPhiAreaRootDoor({ area, config, routeTable, runtime, catalog, activeModuleIds, }) {
|
|
34
33
|
if (area === "public") {
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
@@ -43,13 +42,6 @@ export async function warmPhiAreaRootDoor({ area, config, runtime, catalog, acti
|
|
|
43
42
|
* nothing to remember: the proxy stays cold for this Area and the render answers, which is correct
|
|
44
43
|
* because the render does not forward either.
|
|
45
44
|
*/
|
|
46
|
-
const routeTable = compilePhiCmsActiveRouteTable({
|
|
47
|
-
catalog,
|
|
48
|
-
area,
|
|
49
|
-
activeModuleIds,
|
|
50
|
-
publicRoutePaths: readPhiAreaPublicRoutePaths(config),
|
|
51
|
-
landingSelection: readPhiAreaLandingSelection(config),
|
|
52
|
-
});
|
|
53
45
|
const decision = await resolvePhiAreaRootRouteDecision({
|
|
54
46
|
config,
|
|
55
47
|
requestedStoragePath: "/",
|
|
@@ -2,7 +2,15 @@ import "server-only";
|
|
|
2
2
|
import type { PhiResolvedCmsAreaPresetPayload } from "../types/cms";
|
|
3
3
|
import type { PhiBlockRuntime } from "../types";
|
|
4
4
|
import type { PhiRuntimeModuleCatalog } from "../types/cms-plugins";
|
|
5
|
-
|
|
5
|
+
import type { PhiCmsAreaShellPresetBinding } from "../types/cms-module-descriptors";
|
|
6
|
+
/**
|
|
7
|
+
* The Area's shell as its preset builds it, for an Area that stores no structure on that shell.
|
|
8
|
+
*
|
|
9
|
+
* `binding` is the Area's effective shell (`resolvePhiAreaRouteScope`): the base Module's, or the one
|
|
10
|
+
* an active Module brings. A stored structure of another shell is not this Area's answer and is not read.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildPhiLocalCmsAreaPayload({ binding, areaMask, siteId, path, runtime, runtimeModuleCatalog, }: {
|
|
13
|
+
binding: PhiCmsAreaShellPresetBinding;
|
|
6
14
|
areaMask: number;
|
|
7
15
|
siteId: number;
|
|
8
16
|
path: string;
|
|
@@ -3,8 +3,10 @@ import { resolvePhiCmsAreaKey, resolvePhiCmsAreaMask } from "../constants/cms-ar
|
|
|
3
3
|
import { PhiCmsStatus } from "../constants/phi-cms";
|
|
4
4
|
import { applyPhiPresetTreePublishedContent } from "./cms-bound-content";
|
|
5
5
|
import { createPhiModuleMediaLoader } from "../gateway/server-module-media";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { buildPhiAreaShellPresetConfig } from "../helpers/cms-area-config";
|
|
7
|
+
import { instantiatePhiCmsAreaShellPreset, resolvePhiCmsDescriptorCatalog, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
8
|
+
/** The Area row a shell preset stands for: no stored id, and the config the shell proposes. */
|
|
9
|
+
function createSyntheticAreaPreset({ siteId, areaMask, config, }) {
|
|
8
10
|
return {
|
|
9
11
|
id: -(9000 + areaMask),
|
|
10
12
|
siteId,
|
|
@@ -12,10 +14,10 @@ function createSyntheticAreaPreset({ siteId, areaMask, }) {
|
|
|
12
14
|
status: PhiCmsStatus.Published,
|
|
13
15
|
flags: 0,
|
|
14
16
|
visibilityMask: areaMask,
|
|
15
|
-
config
|
|
17
|
+
config,
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
|
-
function buildAreaPresetPayloadFromTree({ areaMask, siteId, tree, sourcePreset, }) {
|
|
20
|
+
function buildAreaPresetPayloadFromTree({ areaMask, siteId, tree, sourcePreset, config, }) {
|
|
19
21
|
return {
|
|
20
22
|
areaMask,
|
|
21
23
|
sourcePreset,
|
|
@@ -23,27 +25,29 @@ function buildAreaPresetPayloadFromTree({ areaMask, siteId, tree, sourcePreset,
|
|
|
23
25
|
preset: createSyntheticAreaPreset({
|
|
24
26
|
siteId,
|
|
25
27
|
areaMask,
|
|
28
|
+
config,
|
|
26
29
|
}),
|
|
27
30
|
regions: tree.regions,
|
|
28
31
|
overlays: tree.overlays,
|
|
29
32
|
layoutNodes: tree.layoutNodes,
|
|
30
33
|
contentWidgets: tree.contentWidgets,
|
|
31
34
|
controllerSettings: tree.controllerSettings ?? [],
|
|
32
|
-
runtimeModuleIds: tree.runtimeModuleIds ?? null,
|
|
33
35
|
},
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The Area's shell as its preset builds it, for an Area that stores no structure on that shell.
|
|
40
|
+
*
|
|
41
|
+
* `binding` is the Area's effective shell (`resolvePhiAreaRouteScope`): the base Module's, or the one
|
|
42
|
+
* an active Module brings. A stored structure of another shell is not this Area's answer and is not read.
|
|
43
|
+
*/
|
|
44
|
+
export async function buildPhiLocalCmsAreaPayload({ binding, areaMask, siteId, path, runtime, runtimeModuleCatalog, }) {
|
|
37
45
|
const areaKey = resolvePhiCmsAreaKey(areaMask);
|
|
38
46
|
const resolvedAreaMask = resolvePhiCmsAreaMask(areaKey);
|
|
39
|
-
if (resolvedAreaMask !== areaMask) {
|
|
47
|
+
if (resolvedAreaMask !== areaMask || binding.descriptor.area !== areaKey) {
|
|
40
48
|
return null;
|
|
41
49
|
}
|
|
42
50
|
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
43
|
-
const binding = resolvePhiCmsAreaShellPresetBinding(catalog, areaKey);
|
|
44
|
-
if (!binding) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
51
|
const tree = await applyPhiPresetTreePublishedContent(await instantiatePhiCmsAreaShellPreset({
|
|
48
52
|
binding,
|
|
49
53
|
catalog,
|
|
@@ -61,5 +65,6 @@ export async function buildPhiLocalCmsAreaPayload({ areaMask, siteId, path, runt
|
|
|
61
65
|
presetKey: binding.descriptor.presetKey,
|
|
62
66
|
sourcePresetVersion: binding.descriptor.shellPresetVersion,
|
|
63
67
|
},
|
|
68
|
+
config: buildPhiAreaShellPresetConfig(binding.descriptor.settings),
|
|
64
69
|
});
|
|
65
70
|
}
|
|
@@ -34,7 +34,7 @@ export async function resolvePhiCmsLookup({ bridge, area, locale, path, cookieHe
|
|
|
34
34
|
requestContext,
|
|
35
35
|
runtimeModuleCatalog: bridge.runtimeModuleCatalog,
|
|
36
36
|
purpose: "lookup",
|
|
37
|
-
|
|
37
|
+
loadCmsArea: (requestPath, { sourcePreset }) => getPhiExactSiteArea({
|
|
38
38
|
path: requestPath,
|
|
39
39
|
siteKey,
|
|
40
40
|
apiBaseUrl,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { type PhiCmsAreaKey } from "../constants/cms-areas";
|
|
3
|
-
import type { PhiResolvedCmsAreaPresetPayload, PhiResolvedCmsPagePayload } from "../types/cms";
|
|
3
|
+
import type { PhiCmsAreaModulesSelection, PhiResolvedCmsAreaPresetPayload, PhiResolvedCmsPagePayload } from "../types/cms";
|
|
4
|
+
import type { PhiCmsAreaShellPresetBinding, PhiCmsPresetIdentity } from "../types/cms-module-descriptors";
|
|
5
|
+
import type { PhiSiteAreaRead } from "../gateway/site-area";
|
|
4
6
|
import type { PhiResolvedCmsRequest, PhiRuntimeModuleCatalog, PhiRuntimeModuleId } from "../types/cms-plugins";
|
|
5
7
|
import { resolvePhiCmsDescriptorCatalog } from "../plugins/runtime-modules/descriptor-compiler";
|
|
6
8
|
import type { PhiCapabilitySnapshot } from "../types/server-capabilities";
|
|
@@ -9,10 +11,15 @@ type LoadPhiResolvedCmsPage = (path: string, sourcePreset?: {
|
|
|
9
11
|
ownerModuleId: PhiRuntimeModuleId;
|
|
10
12
|
presetKey: string;
|
|
11
13
|
} | null) => Promise<PhiResolvedCmsPagePayload | null>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The Area read a resolution makes: `"live"` is what a visitor is served, `"requested"` the revision or
|
|
16
|
+
* review the request names, if it names one of the Area. Without `sourcePreset` the live read answers the
|
|
17
|
+
* selection and the one stored structure together (`PhiSiteAreaRead`).
|
|
18
|
+
*/
|
|
19
|
+
type LoadPhiCmsArea = (path: string, request: {
|
|
20
|
+
sourcePreset: PhiCmsPresetIdentity | null;
|
|
21
|
+
stage: "live" | "requested";
|
|
22
|
+
}) => Promise<PhiSiteAreaRead | null>;
|
|
16
23
|
export type ResolvePhiCmsRequestArgs = {
|
|
17
24
|
siteKey: string;
|
|
18
25
|
locale: string;
|
|
@@ -24,7 +31,9 @@ export type ResolvePhiCmsRequestArgs = {
|
|
|
24
31
|
requestContext?: PhiSiteRequestContext;
|
|
25
32
|
searchParams?: Record<string, string | undefined>;
|
|
26
33
|
loadResolvedCmsPage: LoadPhiResolvedCmsPage;
|
|
27
|
-
|
|
34
|
+
loadCmsArea: LoadPhiCmsArea;
|
|
35
|
+
/** Whether the request names a revision or a review of the Area, which the `"requested"` read answers. */
|
|
36
|
+
previewsArea?: boolean;
|
|
28
37
|
runtimeModuleCatalog: PhiRuntimeModuleCatalog;
|
|
29
38
|
/**
|
|
30
39
|
* `"render"` resolves the request being answered: it binds the request-scoped runtime and
|
|
@@ -42,25 +51,61 @@ export type ResolvePhiCmsRequestArgs = {
|
|
|
42
51
|
*/
|
|
43
52
|
purpose?: "render" | "lookup" | "refusal";
|
|
44
53
|
};
|
|
54
|
+
/** What an Area stores, as far as answering a request goes: its Module selection and its structure. */
|
|
55
|
+
export type PhiCmsAreaStoredRead = Pick<PhiSiteAreaRead, "modules" | "structure">;
|
|
45
56
|
/**
|
|
46
|
-
* What an Area answers
|
|
57
|
+
* What an Area answers: the active Module ids, the effective shell, the stored structure where it
|
|
58
|
+
* stands on that shell, and the route table compiled from them.
|
|
59
|
+
*
|
|
60
|
+
* In that order, because each step needs the one before. The selection decides the active Modules; the
|
|
61
|
+
* active Modules decide the shell (`resolvePhiCmsAreaShellPresetBinding`: the one active Module that
|
|
62
|
+
* brings one, otherwise the base); and a stored structure applies only when its identity is that
|
|
63
|
+
* shell's -- a Site that stored a base structure and then switched a shell provider on sees the
|
|
64
|
+
* provider's shell, and its own structure again once the provider is off. `structure` is null where
|
|
65
|
+
* the shell's preset answers; the caller builds it (`buildPhiLocalCmsAreaPayload`) only if it needs it.
|
|
47
66
|
*
|
|
48
67
|
* Nine readers -- the page request, the root shell, the dashboard cards, the navigation targets, the
|
|
49
|
-
* page references, the public login, the search index and two more -- each wrote these
|
|
50
|
-
*
|
|
51
|
-
* config they compile from.
|
|
68
|
+
* page references, the public login, the search index and two more -- each wrote these steps out.
|
|
69
|
+
* Stated once, the readers cannot drift in which shell and which config they compile from.
|
|
52
70
|
*/
|
|
53
71
|
export declare function resolvePhiAreaRouteScope(input: {
|
|
54
72
|
runtimeModuleCatalog: PhiRuntimeModuleCatalog;
|
|
55
73
|
catalog: ReturnType<typeof resolvePhiCmsDescriptorCatalog>;
|
|
56
74
|
area: PhiCmsAreaKey;
|
|
57
|
-
|
|
75
|
+
read: PhiCmsAreaStoredRead | null;
|
|
58
76
|
serverCapabilities: PhiCapabilitySnapshot | null;
|
|
59
77
|
}): {
|
|
60
78
|
activeModuleIds: Set<`${string}/${string}`>;
|
|
61
79
|
routeTable: import("../types/cms-module-descriptors").PhiCmsActiveRouteTable;
|
|
80
|
+
shellBinding: PhiCmsAreaShellPresetBinding;
|
|
81
|
+
structure: PhiResolvedCmsAreaPresetPayload | null;
|
|
62
82
|
};
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
/**
|
|
84
|
+
* What the Area stores for a request that may preview or review one of its revisions.
|
|
85
|
+
*
|
|
86
|
+
* A live request is one read without an identity: the selection and the one stored structure come
|
|
87
|
+
* together, and `resolvePhiAreaRouteScope` drops the structure if it stands on another shell. A
|
|
88
|
+
* revision or a review of the Area answers a structure only under the identity it names, and the shell
|
|
89
|
+
* that identity has to be depends on the selection -- which the reviewed revision may itself be. So it
|
|
90
|
+
* reads the live Area first, asks the reviewed revision under the shell the live selection chooses, and
|
|
91
|
+
* takes, under the shell the reviewed selection chooses, the reviewed structure or else the live one.
|
|
92
|
+
* Only previews pay the second read.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readPhiCmsAreaForRequest({ loadArea, previewsArea, resolveShellSource, }: {
|
|
95
|
+
loadArea: (request: {
|
|
96
|
+
sourcePreset: PhiCmsPresetIdentity | null;
|
|
97
|
+
stage: "live" | "requested";
|
|
98
|
+
}) => Promise<PhiSiteAreaRead | null>;
|
|
99
|
+
previewsArea: boolean;
|
|
100
|
+
resolveShellSource: (modules: PhiCmsAreaModulesSelection | null) => PhiCmsPresetIdentity | Promise<PhiCmsPresetIdentity>;
|
|
101
|
+
}): Promise<PhiCmsAreaStoredRead>;
|
|
102
|
+
/** The identity of the shell an Area takes under a selection, for `readPhiCmsAreaForRequest`. */
|
|
103
|
+
export declare function resolvePhiCmsAreaShellSource(input: {
|
|
104
|
+
runtimeModuleCatalog: PhiRuntimeModuleCatalog;
|
|
105
|
+
area: PhiCmsAreaKey;
|
|
106
|
+
modules: PhiCmsAreaModulesSelection | null;
|
|
107
|
+
serverCapabilities: PhiCapabilitySnapshot | null;
|
|
108
|
+
}): PhiCmsPresetIdentity;
|
|
109
|
+
export declare function resolvePhiCmsRequest({ siteKey, locale, area, path, cookieHeader, apiBaseUrl, internalToken, requestContext, searchParams, loadResolvedCmsPage, loadCmsArea, previewsArea, runtimeModuleCatalog, purpose, }: ResolvePhiCmsRequestArgs): Promise<PhiResolvedCmsRequest | null>;
|
|
65
110
|
export declare const loadPhiResolvedCmsRequest: (siteKey: string, locale: string, area: PhiCmsAreaKey, path: string, cookieHeader: string, apiBaseUrl: string | undefined, internalToken: string | undefined, requestContext: PhiSiteRequestContext | undefined, searchParams: Record<string, string | undefined> | undefined, runtimeModuleCatalog: PhiRuntimeModuleCatalog, purpose?: ResolvePhiCmsRequestArgs["purpose"]) => Promise<PhiResolvedCmsRequest | null>;
|
|
66
111
|
export {};
|
|
@@ -24,7 +24,7 @@ import { resolvePhiCmsReviewParams, resolvePhiCmsRevisionFromSearchParams, resol
|
|
|
24
24
|
import { maybeGetPhiRequestRuntime, setPhiRequestNavigationContext, setPhiRequestRuntime, } from "./request-runtime";
|
|
25
25
|
import { buildPhiBlockRuntime, loadPhiSiteRequestContext, } from "./runtime";
|
|
26
26
|
import { trForLocale } from "./translate";
|
|
27
|
-
import {
|
|
27
|
+
import { buildPhiAreaShellPresetConfig, readPhiAreaLandingSelection, readPhiAreaPublicRoutePaths, readPhiAreaSelectionRuntimeModuleIds, } from "../helpers/cms-area-config";
|
|
28
28
|
import { readPhiServerApiCredentials } from "../helpers/phis-server-credentials";
|
|
29
29
|
import { createPhiModuleMediaLoader } from "../gateway/server-module-media";
|
|
30
30
|
async function instantiatePhiRoutePresetPage({ binding, requestedPath, areaMask, siteId, runtime, runtimeModuleCatalog, activeModuleKeys, }) {
|
|
@@ -64,26 +64,88 @@ function resolveAreaOwnedStoragePath(path, areaMask) {
|
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
+
function isPhiCmsAreaShellStructure(structure, binding) {
|
|
68
|
+
return structure != null
|
|
69
|
+
&& structure.sourcePreset?.ownerModuleId === binding.descriptor.ownerModuleId
|
|
70
|
+
&& structure.sourcePreset?.presetKey === binding.descriptor.presetKey;
|
|
71
|
+
}
|
|
67
72
|
/**
|
|
68
|
-
* What an Area answers
|
|
73
|
+
* What an Area answers: the active Module ids, the effective shell, the stored structure where it
|
|
74
|
+
* stands on that shell, and the route table compiled from them.
|
|
75
|
+
*
|
|
76
|
+
* In that order, because each step needs the one before. The selection decides the active Modules; the
|
|
77
|
+
* active Modules decide the shell (`resolvePhiCmsAreaShellPresetBinding`: the one active Module that
|
|
78
|
+
* brings one, otherwise the base); and a stored structure applies only when its identity is that
|
|
79
|
+
* shell's -- a Site that stored a base structure and then switched a shell provider on sees the
|
|
80
|
+
* provider's shell, and its own structure again once the provider is off. `structure` is null where
|
|
81
|
+
* the shell's preset answers; the caller builds it (`buildPhiLocalCmsAreaPayload`) only if it needs it.
|
|
69
82
|
*
|
|
70
83
|
* Nine readers -- the page request, the root shell, the dashboard cards, the navigation targets, the
|
|
71
|
-
* page references, the public login, the search index and two more -- each wrote these
|
|
72
|
-
*
|
|
73
|
-
* config they compile from.
|
|
84
|
+
* page references, the public login, the search index and two more -- each wrote these steps out.
|
|
85
|
+
* Stated once, the readers cannot drift in which shell and which config they compile from.
|
|
74
86
|
*/
|
|
75
87
|
export function resolvePhiAreaRouteScope(input) {
|
|
76
|
-
const activeModuleIds = resolveActivePresetModuleKeys(input.runtimeModuleCatalog, input.area, input.
|
|
88
|
+
const activeModuleIds = resolveActivePresetModuleKeys(input.runtimeModuleCatalog, input.area, input.read?.modules ?? null, input.serverCapabilities);
|
|
89
|
+
const shellBinding = resolvePhiCmsAreaShellPresetBinding(input.catalog, input.area, activeModuleIds);
|
|
90
|
+
if (!shellBinding) {
|
|
91
|
+
throw new Error(`Area "${input.area}" has no shell preset binding.`);
|
|
92
|
+
}
|
|
93
|
+
const structure = isPhiCmsAreaShellStructure(input.read?.structure, shellBinding)
|
|
94
|
+
? input.read.structure
|
|
95
|
+
: null;
|
|
77
96
|
const routeTable = compilePhiCmsActiveRouteTable({
|
|
78
97
|
catalog: input.catalog,
|
|
79
98
|
area: input.area,
|
|
80
99
|
activeModuleIds,
|
|
81
|
-
publicRoutePaths: readPhiAreaPublicRoutePaths(input.
|
|
82
|
-
|
|
100
|
+
publicRoutePaths: readPhiAreaPublicRoutePaths(input.read?.modules?.config),
|
|
101
|
+
// The stored answer, else what the shell proposes (`settings`): the same config the root route reads.
|
|
102
|
+
landingSelection: readPhiAreaLandingSelection(structure ? structure.preset.preset.config : buildPhiAreaShellPresetConfig(shellBinding.descriptor.settings)),
|
|
83
103
|
});
|
|
84
|
-
return { activeModuleIds, routeTable };
|
|
104
|
+
return { activeModuleIds, routeTable, shellBinding, structure };
|
|
85
105
|
}
|
|
86
|
-
|
|
106
|
+
/**
|
|
107
|
+
* What the Area stores for a request that may preview or review one of its revisions.
|
|
108
|
+
*
|
|
109
|
+
* A live request is one read without an identity: the selection and the one stored structure come
|
|
110
|
+
* together, and `resolvePhiAreaRouteScope` drops the structure if it stands on another shell. A
|
|
111
|
+
* revision or a review of the Area answers a structure only under the identity it names, and the shell
|
|
112
|
+
* that identity has to be depends on the selection -- which the reviewed revision may itself be. So it
|
|
113
|
+
* reads the live Area first, asks the reviewed revision under the shell the live selection chooses, and
|
|
114
|
+
* takes, under the shell the reviewed selection chooses, the reviewed structure or else the live one.
|
|
115
|
+
* Only previews pay the second read.
|
|
116
|
+
*/
|
|
117
|
+
export async function readPhiCmsAreaForRequest({ loadArea, previewsArea, resolveShellSource, }) {
|
|
118
|
+
const live = await loadArea({ sourcePreset: null, stage: "live" });
|
|
119
|
+
const liveRead = { modules: live?.modules ?? null, structure: live?.structure ?? null };
|
|
120
|
+
if (!previewsArea) {
|
|
121
|
+
return liveRead;
|
|
122
|
+
}
|
|
123
|
+
const reviewed = await loadArea({
|
|
124
|
+
sourcePreset: await resolveShellSource(liveRead.modules),
|
|
125
|
+
stage: "requested",
|
|
126
|
+
});
|
|
127
|
+
// Not there, or a structure revision of a shell the Area does not take: what is live answers.
|
|
128
|
+
if (!reviewed) {
|
|
129
|
+
return liveRead;
|
|
130
|
+
}
|
|
131
|
+
const shellSource = await resolveShellSource(reviewed.modules);
|
|
132
|
+
const standsOnShell = (structure) => structure?.sourcePreset.ownerModuleId === shellSource.ownerModuleId
|
|
133
|
+
&& structure.sourcePreset.presetKey === shellSource.presetKey;
|
|
134
|
+
return {
|
|
135
|
+
modules: reviewed.modules,
|
|
136
|
+
structure: [reviewed.structure, liveRead.structure].find(standsOnShell) ?? null,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/** The identity of the shell an Area takes under a selection, for `readPhiCmsAreaForRequest`. */
|
|
140
|
+
export function resolvePhiCmsAreaShellSource(input) {
|
|
141
|
+
const catalog = resolvePhiCmsDescriptorCatalog(input.runtimeModuleCatalog);
|
|
142
|
+
const binding = resolvePhiCmsAreaShellPresetBinding(catalog, input.area, resolveActivePresetModuleKeys(input.runtimeModuleCatalog, input.area, input.modules, input.serverCapabilities));
|
|
143
|
+
if (!binding) {
|
|
144
|
+
throw new Error(`Area "${input.area}" has no shell preset binding.`);
|
|
145
|
+
}
|
|
146
|
+
return { ownerModuleId: binding.descriptor.ownerModuleId, presetKey: binding.descriptor.presetKey };
|
|
147
|
+
}
|
|
148
|
+
function resolveActivePresetModuleKeys(runtimeModuleCatalog, area, modules, serverCapabilities) {
|
|
87
149
|
const platformModuleId = runtimeModuleCatalog.platformModuleId;
|
|
88
150
|
if (!platformModuleId) {
|
|
89
151
|
throw new Error("Runtime module catalog has no Platform contribution.");
|
|
@@ -95,7 +157,7 @@ export function resolveActivePresetModuleKeys(runtimeModuleCatalog, area, areaPr
|
|
|
95
157
|
throw new Error(`Area "${area}" is not declared in the runtime module catalog.`);
|
|
96
158
|
}
|
|
97
159
|
activeModuleKeys.add(areaDefinition.baseModuleId);
|
|
98
|
-
const configuredModuleKeys =
|
|
160
|
+
const configuredModuleKeys = readPhiAreaSelectionRuntimeModuleIds(modules, area);
|
|
99
161
|
const moduleDefinitions = [...runtimeModuleCatalog.values()].map((entry) => entry.definition);
|
|
100
162
|
// The Modules declared `activation: "always"` come first and on the same terms as the selected ones:
|
|
101
163
|
// the active set here has to be the one `resolvePhiRuntimeModuleSet` builds for the render.
|
|
@@ -176,7 +238,7 @@ function buildPhiRuntimePage(pagePayload, record) {
|
|
|
176
238
|
...(record ? { record } : {}),
|
|
177
239
|
};
|
|
178
240
|
}
|
|
179
|
-
export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookieHeader, apiBaseUrl, internalToken, requestContext, searchParams, loadResolvedCmsPage,
|
|
241
|
+
export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookieHeader, apiBaseUrl, internalToken, requestContext, searchParams, loadResolvedCmsPage, loadCmsArea, previewsArea = false, runtimeModuleCatalog, purpose = "render", }) {
|
|
180
242
|
const areaMask = resolvePhiCmsAreaMask(area);
|
|
181
243
|
/*
|
|
182
244
|
* Whether this resolution speaks for the request.
|
|
@@ -205,19 +267,33 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
205
267
|
}
|
|
206
268
|
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
207
269
|
const requestedAreaKey = resolvePhiCmsAreaKey(areaMask);
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
270
|
+
const areaOwnedStoragePath = resolveAreaOwnedStoragePath(path, areaMask);
|
|
271
|
+
/*
|
|
272
|
+
* The selection first, then the shell it chooses, then the stored structure if it stands on that
|
|
273
|
+
* shell -- one read for a page view (`readPhiCmsAreaForRequest`).
|
|
274
|
+
*/
|
|
275
|
+
const storedArea = await readPhiCmsAreaForRequest({
|
|
276
|
+
loadArea: (request) => loadCmsArea(path, request),
|
|
277
|
+
previewsArea,
|
|
278
|
+
resolveShellSource: (modules) => resolvePhiCmsAreaShellSource({
|
|
279
|
+
runtimeModuleCatalog,
|
|
280
|
+
area: requestedAreaKey,
|
|
281
|
+
modules,
|
|
282
|
+
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
283
|
+
}),
|
|
284
|
+
});
|
|
285
|
+
const { activeModuleIds: activeModuleKeys, routeTable, shellBinding: areaShellBinding, structure: exactAreaPreset, } = resolvePhiAreaRouteScope({
|
|
286
|
+
runtimeModuleCatalog,
|
|
287
|
+
catalog,
|
|
288
|
+
area: requestedAreaKey,
|
|
289
|
+
read: storedArea,
|
|
290
|
+
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
291
|
+
});
|
|
292
|
+
// Only where nothing is stored on this shell; see the same step in `cms-root.ts`.
|
|
218
293
|
const localAreaPreset = exactAreaPreset
|
|
219
294
|
? null
|
|
220
295
|
: await buildPhiLocalCmsAreaPayload({
|
|
296
|
+
binding: areaShellBinding,
|
|
221
297
|
areaMask,
|
|
222
298
|
siteId: resolvedRequestContext.site.id,
|
|
223
299
|
path,
|
|
@@ -226,14 +302,6 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
226
302
|
});
|
|
227
303
|
const effectiveAreaPreset = exactAreaPreset ?? localAreaPreset;
|
|
228
304
|
const siteId = localAreaPreset?.preset.preset.siteId ?? resolvedRequestContext.site.id;
|
|
229
|
-
const areaOwnedStoragePath = resolveAreaOwnedStoragePath(path, areaMask);
|
|
230
|
-
const { activeModuleIds: activeModuleKeys, routeTable } = resolvePhiAreaRouteScope({
|
|
231
|
-
runtimeModuleCatalog,
|
|
232
|
-
catalog,
|
|
233
|
-
area: requestedAreaKey,
|
|
234
|
-
preset: effectiveAreaPreset?.preset ?? null,
|
|
235
|
-
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
236
|
-
});
|
|
237
305
|
const runtimeWithAuthProvider = {
|
|
238
306
|
...runtime,
|
|
239
307
|
authUiProvider: resolvePhiAuthUiRuntimeProjection(runtimeModuleCatalog, activeModuleKeys, requestedAreaKey),
|
|
@@ -390,6 +458,7 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
390
458
|
if (purpose === "lookup") {
|
|
391
459
|
return {
|
|
392
460
|
areaPreset: effectiveAreaPreset?.preset ?? null,
|
|
461
|
+
areaModules: storedArea.modules,
|
|
393
462
|
page: resolvedContent.page,
|
|
394
463
|
runtime: resolvedRuntime,
|
|
395
464
|
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
@@ -417,6 +486,7 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
417
486
|
: null;
|
|
418
487
|
return {
|
|
419
488
|
areaPreset: areaPresetTree && applyPhiBackgroundAssetProjection(areaPresetTree, backgroundAssets),
|
|
489
|
+
areaModules: storedArea.modules,
|
|
420
490
|
page: applyPhiBackgroundAssetProjection(resolvedContent.page, backgroundAssets),
|
|
421
491
|
runtime: resolvedRuntime,
|
|
422
492
|
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
@@ -444,13 +514,13 @@ export const loadPhiResolvedCmsRequest = cache(async function loadPhiResolvedCms
|
|
|
444
514
|
searchParams,
|
|
445
515
|
purpose,
|
|
446
516
|
runtimeModuleCatalog,
|
|
447
|
-
|
|
517
|
+
previewsArea: revision != null || review?.kind === "area",
|
|
518
|
+
loadCmsArea: (requestPath, { sourcePreset, stage }) => getPhiExactSiteArea({
|
|
448
519
|
path: requestPath,
|
|
449
520
|
siteKey,
|
|
450
521
|
apiBaseUrl,
|
|
451
522
|
internalToken,
|
|
452
|
-
revision,
|
|
453
|
-
review,
|
|
523
|
+
...(stage === "requested" ? { revision, review } : {}),
|
|
454
524
|
cookieHeader,
|
|
455
525
|
sourcePreset,
|
|
456
526
|
}),
|