@phis/ui 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.d.ts +1 -0
- package/components/cms/phi-cms-layout-renderer.js +35 -6
- package/components/controls/use-phi-color-control-presets.d.ts +2 -2
- package/components/controls/use-phi-color-control-presets.js +16 -2
- package/components/layouts/clients/phi-flex-layout-client.js +12 -2
- package/components/media/media-folder-name-path.d.ts +17 -0
- package/components/media/media-folder-name-path.js +36 -0
- package/components/media/media-upload-flow.d.ts +30 -0
- package/components/media/media-upload-flow.js +104 -4
- package/components/media/media-upload-refusals.js +5 -2
- package/components/media/phi-area-upload-widget.js +4 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +12 -0
- package/components/widgets/client/shared/phi-command-buttons.js +23 -3
- package/components/widgets/config/command-buttons.js +3 -0
- package/components/widgets/label-sets/color-picker.js +2 -0
- package/components/widgets/label-types/color-picker.d.ts +1 -0
- package/components/widgets/label-types/color-picker.js +1 -0
- package/controls.d.ts +45 -1
- package/controls.js +30 -1
- package/helpers/cms-content-binding.d.ts +7 -1
- package/helpers/cms-content-binding.js +10 -2
- package/helpers/cms-node-visibility.d.ts +25 -0
- package/helpers/cms-node-visibility.js +35 -1
- package/media.d.ts +2 -0
- package/media.js +2 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/definition.js +1 -1
- package/plugins/runtime-modules/accounting/presets.js +5 -12
- package/plugins/runtime-modules/area-definitions.d.ts +9 -39
- package/plugins/runtime-modules/area-definitions.js +8 -8
- package/plugins/runtime-modules/asset/controller/runtime.js +1 -6
- package/plugins/runtime-modules/asset/definition.d.ts +1 -1
- package/plugins/runtime-modules/asset/definition.js +2 -1
- package/plugins/runtime-modules/asset/widgets/area-upload/config.js +7 -1
- package/plugins/runtime-modules/builder/data-providers.js +1 -0
- package/plugins/runtime-modules/builder/services/runtime-modules-table.d.ts +1 -0
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +4 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -5
- package/plugins/runtime-modules/core/widgets/image/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/image/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +0 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/table/client.js +8 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +2 -1
- package/server-helpers/cms-node-record.d.ts +18 -0
- package/server-helpers/cms-node-record.js +28 -0
- package/server-helpers/search-index.js +7 -1
- package/types/cms-plugins.d.ts +6 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.d.ts +0 -6
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +0 -49
|
@@ -54,6 +54,7 @@ import { isPhiRecord } from "../../../../../helpers/is-record";
|
|
|
54
54
|
*/
|
|
55
55
|
const PHI_TABLE_VISUAL_ANCHOR_PARTS = ["filters", "toolbar", "header", "row-actions", "footer", "pagination"];
|
|
56
56
|
const PHI_TABLE_ACTION_BUTTON_STYLE = { whiteSpace: "nowrap" };
|
|
57
|
+
const PHI_TABLE_ACTION_CLICK_GUARD_STYLE = { display: "inline-flex" };
|
|
57
58
|
function formatTableActionTemplate(value, templateValue) {
|
|
58
59
|
return value && templateValue != null ? formatPhiTableWidgetLabel(value, templateValue) : value;
|
|
59
60
|
}
|
|
@@ -945,8 +946,14 @@ function TableAction({ action, disabled = false, disabledReason, templateValue,
|
|
|
945
946
|
* A row is clickable, and an action inside it must not also activate the row, so the click stops at
|
|
946
947
|
* the element around the button. A confirmed action still gets a handler of its own: the button is
|
|
947
948
|
* what opens the confirmation, and a button with nothing to call renders disabled.
|
|
949
|
+
*
|
|
950
|
+
* The element around it is exactly the button's box (`inline-flex`). As a block it was a line of the
|
|
951
|
+
* surrounding text tall, and the button sat on that line's baseline: where the line was taller than
|
|
952
|
+
* the button -- a Table in a Collapsible, whose panel sets a line height of 1.5 -- a toolbar action
|
|
953
|
+
* stood lower than the Reload beside it, which has no such element. It keeps a box of its own because
|
|
954
|
+
* a confirmation opens against it.
|
|
948
955
|
*/
|
|
949
|
-
const content = (_jsx("span", { onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { size: size, type: buttonType, danger: danger, disabled: disabled, style: PHI_TABLE_ACTION_BUTTON_STYLE, icon: showIcon ? icon ?? undefined : undefined, ariaLabel: action.label, label: showLabel ? action.label : null, tooltip: disabledReason ?? (display === "icon" ? action.label : undefined), onClick: () => {
|
|
956
|
+
const content = (_jsx("span", { style: PHI_TABLE_ACTION_CLICK_GUARD_STYLE, onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { size: size, type: buttonType, danger: danger, disabled: disabled, style: PHI_TABLE_ACTION_BUTTON_STYLE, icon: showIcon ? icon ?? undefined : undefined, ariaLabel: action.label, label: showLabel ? action.label : null, tooltip: disabledReason ?? (display === "icon" ? action.label : undefined), onClick: () => {
|
|
950
957
|
if (!action.confirm)
|
|
951
958
|
onActivate();
|
|
952
959
|
} }) }));
|
|
@@ -1946,6 +1946,7 @@ export function PhiBuilderBrandThemePreviewWidgetClient({ runtime, config, }) {
|
|
|
1946
1946
|
*/
|
|
1947
1947
|
const previewPaneShadows = resolvePhiShellChromePaneShadows(previewThemeResolved.root);
|
|
1948
1948
|
const previewTextColor = readAliasTokenString(previewEffectiveToken, "colorText");
|
|
1949
|
+
const previewTextHeadingColor = readAliasTokenString(previewEffectiveToken, "colorTextHeading");
|
|
1949
1950
|
const previewTextSecondaryColor = readAliasTokenString(previewEffectiveToken, "colorTextSecondary");
|
|
1950
1951
|
const previewTextTertiaryColor = readAliasTokenString(previewEffectiveToken, "colorTextTertiary");
|
|
1951
1952
|
const previewLinkColor = readAliasTokenString(previewEffectiveToken, "colorLink");
|
|
@@ -2068,7 +2069,7 @@ export function PhiBuilderBrandThemePreviewWidgetClient({ runtime, config, }) {
|
|
|
2068
2069
|
...{
|
|
2069
2070
|
[PHI_SURFACE_SHAPE_CSS_VAR]: `${resolvePhiSurfaceShapeRadius(previewControlShape, previewEffectiveToken)}px`,
|
|
2070
2071
|
},
|
|
2071
|
-
}, children: _jsxs(PhiBrandChromePreviewShell, { overlayStyle: previewChromeOverlay, paneShadows: previewPaneShadows, rootBackgroundStyle: previewRootBackground, surfaceBackground: previewSurfaceBackground, textColor: previewTextColor, labelColor: previewTextSecondaryColor, radius: clientToken.paddingXS, padding: clientToken.padding, brand: (_jsx(PhiBrandControl, { brand: previewThemeResolved.brand ?? null, fallbackTitle: runtime.site.name ?? runtime.site.key, mode: mode })), children: [_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.padding, wrap: "wrap", children: [_jsxs(PhiFlexControl, { vertical: true, gap: 0, children: [_jsx(PhiTypographyControl, { presentation: "title", level: 4, style: { margin: 0 }, children: "Theme Preview" }), _jsx(PhiTypographyControl, { type: "secondary", children: "Buttons, form fields, tables and status colors use the current draft tokens." })] }), _jsxs(PhiFlexControl, { align: "center", gap: "middle", wrap: true, children: [_jsx(PhiButtonControl, { type: "primary", label: "Primary", onClick: previewNoop }), _jsx(PhiButtonControl, { label: "Default", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "dashed", label: "Dashed", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "text", label: "Text", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "link", label: "Link", onClick: previewNoop }), _jsx(PhiButtonControl, { danger: true, label: "Danger", onClick: previewNoop }), _jsx(PhiButtonControl, { ghost: true, label: "Ghost", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "primary", disabled: true, label: "Primary disabled" }), _jsx(PhiButtonControl, { disabled: true, label: "Default disabled" })] })] }), _jsx(PhiDividerControl, { style: { margin: 0 } }), _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, style: { minWidth: 0 }, children: [_jsx(PhiTypographyControl, { presentation: "title", level: 5, style: { margin: 0, color: previewTextColor }, children: "Control Height" }), _jsx(PhiFlexControl, { gap: clientToken.paddingXS, wrap: "wrap", align: "end", children: controlHeightPreviewItems.map((item) => (_jsx(PhiButtonControl, { style: { height: item.value }, label: item.label, onClick: previewNoop }, item.key))) }), _jsxs(PhiTypographyControl, { type: "secondary", children: ["Wireframe ", wireframeEnabled ? "on" : "off"] })] }), _jsx(PhiTextControl, { label: "Campaign", placeholder: "Preview input", value: previewInput, onChange: (next) => setPreviewInput(next ?? "") }), _jsx(PhiColorControl, { value: previewSwatchColor, open: false, showText: true }), _jsx(PhiDividerControl, { style: { margin: 0 } }), _jsxs(PhiFlexControl, { gap: clientToken.padding, wrap: "wrap", children: [_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, style: { flex: "1 1 260px", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { presentation: "title", level: 3, style: { margin: 0, color:
|
|
2072
|
+
}, children: _jsxs(PhiBrandChromePreviewShell, { overlayStyle: previewChromeOverlay, paneShadows: previewPaneShadows, rootBackgroundStyle: previewRootBackground, surfaceBackground: previewSurfaceBackground, textColor: previewTextColor, labelColor: previewTextSecondaryColor, radius: clientToken.paddingXS, padding: clientToken.padding, brand: (_jsx(PhiBrandControl, { brand: previewThemeResolved.brand ?? null, fallbackTitle: runtime.site.name ?? runtime.site.key, mode: mode })), children: [_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.padding, wrap: "wrap", children: [_jsxs(PhiFlexControl, { vertical: true, gap: 0, children: [_jsx(PhiTypographyControl, { presentation: "title", level: 4, style: { margin: 0 }, children: "Theme Preview" }), _jsx(PhiTypographyControl, { type: "secondary", children: "Buttons, form fields, tables and status colors use the current draft tokens." })] }), _jsxs(PhiFlexControl, { align: "center", gap: "middle", wrap: true, children: [_jsx(PhiButtonControl, { type: "primary", label: "Primary", onClick: previewNoop }), _jsx(PhiButtonControl, { label: "Default", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "dashed", label: "Dashed", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "text", label: "Text", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "link", label: "Link", onClick: previewNoop }), _jsx(PhiButtonControl, { danger: true, label: "Danger", onClick: previewNoop }), _jsx(PhiButtonControl, { ghost: true, label: "Ghost", onClick: previewNoop }), _jsx(PhiButtonControl, { type: "primary", disabled: true, label: "Primary disabled" }), _jsx(PhiButtonControl, { disabled: true, label: "Default disabled" })] })] }), _jsx(PhiDividerControl, { style: { margin: 0 } }), _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, style: { minWidth: 0 }, children: [_jsx(PhiTypographyControl, { presentation: "title", level: 5, style: { margin: 0, color: previewTextColor }, children: "Control Height" }), _jsx(PhiFlexControl, { gap: clientToken.paddingXS, wrap: "wrap", align: "end", children: controlHeightPreviewItems.map((item) => (_jsx(PhiButtonControl, { style: { height: item.value }, label: item.label, onClick: previewNoop }, item.key))) }), _jsxs(PhiTypographyControl, { type: "secondary", children: ["Wireframe ", wireframeEnabled ? "on" : "off"] })] }), _jsx(PhiTextControl, { label: "Campaign", placeholder: "Preview input", value: previewInput, onChange: (next) => setPreviewInput(next ?? "") }), _jsx(PhiColorControl, { value: previewSwatchColor, open: false, showText: true }), _jsx(PhiDividerControl, { style: { margin: 0 } }), _jsxs(PhiFlexControl, { gap: clientToken.padding, wrap: "wrap", children: [_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, style: { flex: "1 1 260px", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { presentation: "title", level: 3, style: { margin: 0, color: previewTextHeadingColor }, children: "Heading" }), _jsx(PhiTypographyControl, { presentation: "title", level: 5, style: { margin: 0, color: previewTextHeadingColor }, children: "Header" }), _jsx(PhiTypographyControl, { style: { color: previewTextColor }, children: "Text" }), _jsx(PhiTypographyControl, { style: { color: previewTextSecondaryColor }, children: "Text secondary" }), _jsx(PhiTypographyControl, { style: { color: previewTextTertiaryColor }, children: "Text tertiary" }), _jsxs("span", { style: { display: "inline-flex", flexWrap: "wrap", gap: clientToken.paddingSM }, children: [_jsx(PhiTypographyControl, { presentation: "link", style: { color: previewLinkColor }, children: "Link" }), _jsx(PhiTypographyControl, { presentation: "link", style: { color: previewLinkHoverColor }, children: "Link Hover" }), _jsx(PhiTypographyControl, { presentation: "link", style: { color: previewLinkActiveColor }, children: "Link Active" })] })] }), _jsx("div", { style: {
|
|
2072
2073
|
display: "grid",
|
|
2073
2074
|
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
2074
2075
|
gap: clientToken.paddingXS,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import type { PhiBlockRuntime } from "../types";
|
|
3
|
+
import type { PhiCmsRuntimeRenderRegistry } from "../types/cms-plugins";
|
|
4
|
+
import type { PhiResolvedCmsRenderableTree } from "../types/cms";
|
|
5
|
+
/**
|
|
6
|
+
* The fields of the record this Page is about, as a `record` condition reads them, or null where it reads
|
|
7
|
+
* none.
|
|
8
|
+
*
|
|
9
|
+
* Read only for a tree that carries such a condition, and through the same request-memoised read the
|
|
10
|
+
* Widgets bound to the record use (`resolvePhiPageRecordFields`), so a page whose Widgets read the fields
|
|
11
|
+
* already pays nothing more for its conditions. Each field is its value, under its key: `icon` is the
|
|
12
|
+
* picture a Widget with `recordField: "icon"` draws, and a field the record lacks is not there.
|
|
13
|
+
*
|
|
14
|
+
* `null` is a Page that is about no record (`none`). A record whose fields could not be read is a record
|
|
15
|
+
* without any of them -- the bound Widgets draw nothing for it either -- so its conditions are answered
|
|
16
|
+
* against no fields rather than taken for a Page about nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolvePhiCmsTreeRecordConditionFields(tree: Pick<PhiResolvedCmsRenderableTree, "layoutNodes" | "contentWidgets" | "overlays">, registry: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "recordDeclarationsByKey">, runtime: PhiBlockRuntime): Promise<Readonly<Record<string, unknown>> | null>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { readPhiCmsNodeVisibleWhen, readsPhiCmsNodeRecord } from "../helpers/cms-node-visibility";
|
|
3
|
+
import { resolvePhiPageRecordFields } from "./record-fields";
|
|
4
|
+
/**
|
|
5
|
+
* The fields of the record this Page is about, as a `record` condition reads them, or null where it reads
|
|
6
|
+
* none.
|
|
7
|
+
*
|
|
8
|
+
* Read only for a tree that carries such a condition, and through the same request-memoised read the
|
|
9
|
+
* Widgets bound to the record use (`resolvePhiPageRecordFields`), so a page whose Widgets read the fields
|
|
10
|
+
* already pays nothing more for its conditions. Each field is its value, under its key: `icon` is the
|
|
11
|
+
* picture a Widget with `recordField: "icon"` draws, and a field the record lacks is not there.
|
|
12
|
+
*
|
|
13
|
+
* `null` is a Page that is about no record (`none`). A record whose fields could not be read is a record
|
|
14
|
+
* without any of them -- the bound Widgets draw nothing for it either -- so its conditions are answered
|
|
15
|
+
* against no fields rather than taken for a Page about nothing.
|
|
16
|
+
*/
|
|
17
|
+
export async function resolvePhiCmsTreeRecordConditionFields(tree, registry, runtime) {
|
|
18
|
+
const asks = [...tree.overlays, ...tree.layoutNodes, ...tree.contentWidgets]
|
|
19
|
+
.some((node) => readsPhiCmsNodeRecord(readPhiCmsNodeVisibleWhen(node.config)));
|
|
20
|
+
if (!asks)
|
|
21
|
+
return null;
|
|
22
|
+
const result = await resolvePhiPageRecordFields({ registry, runtime });
|
|
23
|
+
if (result.status === "none")
|
|
24
|
+
return null;
|
|
25
|
+
if (result.status !== "ok")
|
|
26
|
+
return {};
|
|
27
|
+
return Object.fromEntries([...result.fields].map(([key, field]) => [key, field.value]));
|
|
28
|
+
}
|
|
@@ -11,6 +11,7 @@ import { onPhiSiteReadMarker } from "../gateway/site-read-marker-listeners";
|
|
|
11
11
|
import { fetchPhiSiteSearchIndexStates, putPhiSiteSearchIndexSet } from "../gateway/site-search";
|
|
12
12
|
import { buildPhiRuntimeModuleAccessRegistry, filterPhiCmsRenderableTreeForViewer, } from "../helpers/cms-access-policy";
|
|
13
13
|
import { collectPhiSitemapCandidates } from "../helpers/phi-seo";
|
|
14
|
+
import { phiAreaPath } from "../helpers/locale";
|
|
14
15
|
import { resolvePhiCmsAreaBaseShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
15
16
|
import { resolvePhiCmsAreaRuntimeModuleScope } from "../components/cms/phi-cms-runtime-registry";
|
|
16
17
|
import { canPhiViewerAccess } from "../types/access";
|
|
@@ -285,11 +286,16 @@ async function readDocuments({ bridge, area, locale, context, candidates, loadPl
|
|
|
285
286
|
* left out here as the live render leaves it out, so its words never reach a reader it is hidden from.
|
|
286
287
|
*/
|
|
287
288
|
async function readDocument({ bridge, area, locale, context, path, loadPlugin, accessRegistry, failures, }) {
|
|
289
|
+
/*
|
|
290
|
+
* The candidates are Area-local (`/phis/ui/dashboard`), and a request names its Area by the path's
|
|
291
|
+
* first segment outside Public. Resolving the local path read Public's Area for every App Page -- its
|
|
292
|
+
* selection under App's catalog, and no Page -- so the App index stayed empty.
|
|
293
|
+
*/
|
|
288
294
|
const resolved = await resolvePhiCmsLookup({
|
|
289
295
|
bridge,
|
|
290
296
|
area,
|
|
291
297
|
locale,
|
|
292
|
-
path,
|
|
298
|
+
path: area === "public" ? path : phiAreaPath(area, path),
|
|
293
299
|
cookieHeader: "",
|
|
294
300
|
requestContext: context,
|
|
295
301
|
});
|
package/types/cms-plugins.d.ts
CHANGED
|
@@ -368,6 +368,12 @@ export type PhiCmsWidgetContentBinding = {
|
|
|
368
368
|
field: string;
|
|
369
369
|
value: string | number | boolean | null;
|
|
370
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* The config field (a `record-field` field) that names a field of the page record in the content's
|
|
373
|
+
* place. On a Page about a record a Widget that names one shows that field, or nothing where the record
|
|
374
|
+
* lacks it, so it keeps no content of its own there and is never left out as unpublished.
|
|
375
|
+
*/
|
|
376
|
+
recordField?: string;
|
|
371
377
|
};
|
|
372
378
|
export type PhiCmsWidgetPluginRenderArgs<TConfig> = {
|
|
373
379
|
widget: PhiCmsContentWidgetNode;
|
|
@@ -414,6 +414,12 @@ export type PhiCommandButtonConfig = PhiControlBadgeConfig & {
|
|
|
414
414
|
label?: string;
|
|
415
415
|
tooltip?: string;
|
|
416
416
|
icon?: string;
|
|
417
|
+
/**
|
|
418
|
+
* The icon's colour, as the colour field stores it -- a Theme role (primary, success, warning, error,
|
|
419
|
+
* info, the text colours) or a colour of the Site's. Absent, the button's own. The button around it
|
|
420
|
+
* keeps its look: Danger and the variant still answer for the frame and the words.
|
|
421
|
+
*/
|
|
422
|
+
iconColor?: string;
|
|
417
423
|
display?: "icon" | "label" | "icon-label";
|
|
418
424
|
danger?: boolean;
|
|
419
425
|
disabled?: boolean;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PhiResolvedCmsPageTree, PhiCmsPageNode } from "../../../../types/cms";
|
|
2
|
-
import type { PhiBlockRuntime } from "../../../../types";
|
|
3
|
-
export declare function buildPhiDefaultAccountingPageTree({ page, }: {
|
|
4
|
-
page: PhiCmsPageNode;
|
|
5
|
-
runtime: PhiBlockRuntime;
|
|
6
|
-
}): Promise<PhiResolvedCmsPageTree>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { PHI_TEXT_SOURCE_PRESET } from "../../../../helpers/text-source";
|
|
2
|
-
import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
|
|
3
|
-
import { PHI_SURFACE_CARD } from "../../../../helpers/surface-presets";
|
|
4
|
-
import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "../ids";
|
|
5
|
-
import { PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS } from "../../../../constants/cms-layout-types";
|
|
6
|
-
import { PhiCmsPageType } from "../../../../constants/phi-cms";
|
|
7
|
-
import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
|
|
8
|
-
import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
|
|
9
|
-
const SYNTHETIC_ACCOUNTING_REGION_IDS = {
|
|
10
|
-
regionContent: -451,
|
|
11
|
-
};
|
|
12
|
-
const SYNTHETIC_ACCOUNTING_WIDGET_IDS = createPhiPresetCmsInstanceIdMap({
|
|
13
|
-
domain: "page",
|
|
14
|
-
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
15
|
-
presetKey: "accounting-overview-page",
|
|
16
|
-
}, [
|
|
17
|
-
"widgetOverview",
|
|
18
|
-
]);
|
|
19
|
-
export async function buildPhiDefaultAccountingPageTree({ page, }) {
|
|
20
|
-
const scaffold = buildPhiBasePageContentScaffold({
|
|
21
|
-
page,
|
|
22
|
-
regionId: SYNTHETIC_ACCOUNTING_REGION_IDS.regionContent,
|
|
23
|
-
});
|
|
24
|
-
const nodes = createPhiCmsPresetNodes(page);
|
|
25
|
-
return {
|
|
26
|
-
page: nodes.page({ pageType: PhiCmsPageType.Standard }),
|
|
27
|
-
overlays: [],
|
|
28
|
-
regions: [scaffold.region],
|
|
29
|
-
layoutNodes: [scaffold.layoutNode],
|
|
30
|
-
contentWidgets: [
|
|
31
|
-
nodes.widget({
|
|
32
|
-
id: SYNTHETIC_ACCOUNTING_WIDGET_IDS.widgetOverview,
|
|
33
|
-
parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
|
|
34
|
-
typeKey: "card",
|
|
35
|
-
slotIndex: PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS[0].slotIndex,
|
|
36
|
-
sortOrder: 0,
|
|
37
|
-
label: "Accounting",
|
|
38
|
-
config: {
|
|
39
|
-
eyebrow: "Accounting",
|
|
40
|
-
textSource: PHI_TEXT_SOURCE_PRESET,
|
|
41
|
-
title: "Accounting",
|
|
42
|
-
description: "Invoices and billing workflows for this site.",
|
|
43
|
-
variant: "compact",
|
|
44
|
-
surface: PHI_SURFACE_CARD,
|
|
45
|
-
},
|
|
46
|
-
}),
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
}
|