@phis/ui 0.7.8 → 0.8.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/controls/phi-address-control.d.ts +23 -0
- package/components/controls/phi-address-control.js +43 -0
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-country-select-control.d.ts +22 -0
- package/components/controls/phi-country-select-control.js +16 -0
- package/components/controls/phi-dialog-control.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.js +5 -3
- package/components/controls/phi-drawer-control.d.ts +7 -5
- package/components/controls/phi-float-button-control.d.ts +8 -1
- package/components/controls/phi-float-button-control.js +19 -3
- package/components/controls/phi-form-control.js +52 -8
- package/components/controls/phi-modal-control-adapter.d.ts +1 -1
- package/components/controls/phi-modal-control-adapter.js +14 -37
- package/components/controls/phi-modal-control.d.ts +5 -5
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-overlay-control-contract.d.ts +52 -17
- package/components/controls/phi-overlay-control-contract.js +55 -30
- package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
- package/components/controls/phi-reveal-once-dialog-control.js +52 -0
- package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
- package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-option-flags.d.ts +20 -0
- package/components/forms/form-option-flags.js +38 -0
- package/components/forms/form-provider-contract.d.ts +23 -0
- package/components/forms/form-provider-contract.js +36 -0
- package/components/forms/form-provider-registry.d.ts +5 -1
- package/components/forms/shared-form-provider-registry.js +13 -0
- package/components/forms/structured-field-labels.d.ts +24 -0
- package/components/forms/structured-field-labels.js +43 -0
- package/components/forms/structured-form-field-controls.d.ts +12 -0
- package/components/forms/structured-form-field-controls.js +65 -0
- package/components/overlays/phi-overlay-container-client.js +2 -2
- package/components/regions/phi-cms-region-shell.js +2 -2
- package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/root/phi-root-theme-resolver.js +3 -0
- package/components/shell/phi-antd-icon.d.ts +1 -8
- package/components/shell/phi-antd-icon.js +1 -227
- package/components/shell/phi-icon-names.d.ts +19 -0
- package/components/shell/phi-icon-names.js +264 -0
- package/components/shell/phi-icon.d.ts +2 -11
- package/components/shell/phi-icon.js +4 -32
- package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
- package/components/widgets/client/shared/phi-command-buttons.js +10 -4
- package/components/widgets/client/shared/phi-rendered-value.js +27 -3
- package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
- package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
- package/components/widgets/config/background.d.ts +3 -2
- package/components/widgets/config/choice-shared.d.ts +10 -1
- package/components/widgets/config/choice-shared.js +8 -2
- package/components/widgets/label-sets/admin-locales.js +1 -1
- package/components/widgets/label-sets/admin-users.d.ts +2 -5
- package/components/widgets/label-sets/admin-users.js +4 -10
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -0
- package/components/widgets/label-sets/profile.js +28 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/effects.d.ts +3 -2
- package/components/widgets/label-types/effects.js +1 -2
- package/components/widgets/label-types/search-results.d.ts +2 -2
- package/components/widgets/label-types/search-results.js +1 -2
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/components/widgets/server/builder-chrome.d.ts +4 -1
- package/components/widgets/server/builder-chrome.js +2 -2
- package/components/widgets/shared/markdown-body-client.d.ts +26 -0
- package/components/widgets/shared/markdown-body-client.js +31 -1
- package/components/widgets/shared/markdown-render.d.ts +10 -2
- package/components/widgets/shared/markdown-render.js +35 -13
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +25 -0
- package/constants/customer-file.js +26 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +12 -0
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -0
- package/gateway/form-handler-request.d.ts +22 -0
- package/gateway/form-handler-request.js +40 -0
- package/gateway/label-set.d.ts +15 -2
- package/gateway/label-set.js +60 -22
- package/gateway/site-form-route.js +11 -2
- package/helpers/address-field.d.ts +43 -0
- package/helpers/address-field.js +68 -0
- package/helpers/cms-dialog.d.ts +5 -20
- package/helpers/cms-dialog.js +8 -13
- package/helpers/cms-page-catalog.d.ts +10 -0
- package/helpers/cms-page-catalog.js +19 -0
- package/helpers/cms-preset-nodes.d.ts +4 -4
- package/helpers/cms-preset-nodes.js +1 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/country-names.d.ts +12 -0
- package/helpers/country-names.js +14 -0
- package/helpers/phi-metadata.d.ts +33 -1
- package/helpers/phi-metadata.js +62 -1
- package/helpers/preset-table-check.d.ts +34 -0
- package/helpers/preset-table-check.js +124 -0
- package/helpers/preset-text-source-check.d.ts +4 -1
- package/helpers/preset-text-source-check.js +6 -1
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +30 -5
- package/helpers/public-route-claims.d.ts +9 -1
- package/helpers/public-route-claims.js +23 -3
- package/helpers/record-fields.d.ts +1 -5
- package/helpers/record-fields.js +15 -6
- package/helpers/route-address-check.d.ts +22 -2
- package/helpers/route-address-check.js +29 -8
- package/helpers/site-address-row.d.ts +23 -0
- package/helpers/site-address-row.js +36 -0
- package/helpers/surface-style.d.ts +8 -1
- package/helpers/surface-style.js +12 -2
- package/helpers/thread-inbox-row.d.ts +20 -0
- package/helpers/thread-inbox-row.js +26 -0
- package/helpers/translation-format.d.ts +26 -0
- package/helpers/translation-format.js +31 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +2 -2
- package/module-records.js +1 -0
- package/next/area-route.js +34 -1
- package/next/root-route.js +4 -5
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
- package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
- package/plugins/runtime-modules/accounting/data-providers.js +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
- package/plugins/runtime-modules/accounting/ids.js +23 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
- package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/app/client-data-providers.js +9 -0
- package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
- package/plugins/runtime-modules/app/data-providers.js +80 -0
- package/plugins/runtime-modules/app/definition.d.ts +131 -0
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +46 -1
- package/plugins/runtime-modules/app/forms.js +195 -1
- package/plugins/runtime-modules/app/ids.d.ts +7 -0
- package/plugins/runtime-modules/app/ids.js +8 -0
- package/plugins/runtime-modules/app/module.d.ts +131 -0
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
- package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
- package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
- package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
- package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
- package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
- package/plugins/runtime-modules/blog/presets.d.ts +4 -0
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
- package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +28 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
- package/plugins/runtime-modules/builder/persistence.js +4 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
- package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
- package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
- package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
- package/plugins/runtime-modules/client-manifests/app.js +3 -0
- package/plugins/runtime-modules/client-manifests/builder.js +10 -0
- package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
- package/plugins/runtime-modules/contracts.js +31 -1
- package/plugins/runtime-modules/core/definition.d.ts +23 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +23 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
- package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
- package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
- package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
- package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
- package/plugins/runtime-modules/descriptor-compiler.js +44 -16
- package/plugins/runtime-modules/editor/presets.d.ts +4 -0
- package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/localization/presets.d.ts +4 -0
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
- package/plugins/runtime-modules/news/presets.d.ts +4 -0
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/client.js +13 -11
- package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/table.js +13 -4
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/definition.js +1 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
- package/plugins/runtime-modules/threads/data-providers.js +85 -0
- package/plugins/runtime-modules/threads/definition.d.ts +115 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +3 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
- package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
- package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
- package/plugins/runtime-modules/user-management/data-providers.js +101 -3
- package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
- package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
- package/plugins/runtime-modules/user-management/ids.js +9 -0
- package/plugins/runtime-modules/user-management/presets.js +17 -1
- package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
- package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
- package/server-helpers/cms-page-record.d.ts +9 -1
- package/server-helpers/cms-page-record.js +11 -1
- package/server-helpers/cms-request.js +8 -5
- package/server-helpers/link-preview-image.d.ts +30 -0
- package/server-helpers/link-preview-image.js +57 -0
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/shell.css +30 -6
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-tokens.d.ts +2 -1
- package/theme/phi-theme-tokens.js +2 -0
- package/types/cms-module-descriptors.d.ts +14 -0
- package/types/cms-overlay.d.ts +13 -6
- package/types/cms-overlay.js +6 -22
- package/types/cms-plugins.d.ts +14 -2
- package/types/cms.d.ts +10 -0
- package/types/core-widget-placements.d.ts +3 -3
- package/types/link-preview.d.ts +19 -0
- package/types/link-preview.js +19 -0
- package/types/record-provider.d.ts +22 -1
- package/types/site-theme.d.ts +27 -0
- package/types/table-embed.d.ts +48 -0
- package/types/table-embed.js +1 -0
- package/types/table-widget.d.ts +14 -0
- package/types/widget-runtime.d.ts +3 -0
- package/types.d.ts +1 -0
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
function segments(path) {
|
|
2
2
|
return path.split("/").filter(Boolean);
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Whether `lowerPath` lies beneath `upperPath` so that the upper one would be a Page and a folder at once:
|
|
6
|
+
* by segment, `/` never above anything, a list's entries -- one parameter directly beneath -- excepted.
|
|
7
|
+
*/
|
|
8
|
+
export function isPhiRouteAddressBeneath(upperPath, lowerPath) {
|
|
9
|
+
const upper = segments(upperPath);
|
|
10
|
+
const own = segments(lowerPath);
|
|
11
|
+
if (upper.length === 0 || upper.length >= own.length)
|
|
12
|
+
return false;
|
|
13
|
+
if (!upper.every((segment, index) => segment === own[index]))
|
|
14
|
+
return false;
|
|
15
|
+
// A list's entries, one parameter directly beneath it.
|
|
16
|
+
return !(own.length === upper.length + 1 && own[own.length - 1].startsWith(":"));
|
|
17
|
+
}
|
|
4
18
|
export function checkPhiRouteAddresses(routes) {
|
|
5
19
|
const findings = [];
|
|
6
20
|
for (const route of routes) {
|
|
7
|
-
const own = segments(route.path);
|
|
8
21
|
for (const other of routes) {
|
|
9
22
|
if (other === route || other.area !== route.area)
|
|
10
23
|
continue;
|
|
11
|
-
|
|
12
|
-
if (upper.length === 0 || upper.length >= own.length)
|
|
13
|
-
continue;
|
|
14
|
-
if (!upper.every((segment, index) => segment === own[index]))
|
|
15
|
-
continue;
|
|
16
|
-
// A list's entries, one parameter directly beneath it.
|
|
17
|
-
if (own.length === upper.length + 1 && own[own.length - 1].startsWith(":"))
|
|
24
|
+
if (!isPhiRouteAddressBeneath(other.path, route.path))
|
|
18
25
|
continue;
|
|
19
26
|
findings.push({
|
|
20
27
|
route: route.presetKey,
|
|
@@ -26,3 +33,17 @@ export function checkPhiRouteAddresses(routes) {
|
|
|
26
33
|
}
|
|
27
34
|
return findings;
|
|
28
35
|
}
|
|
36
|
+
/** Every route of a compiled catalog as the rule reads it, Area by Area. */
|
|
37
|
+
export function listPhiCatalogRouteAddressSubjects(routesByArea) {
|
|
38
|
+
return [...routesByArea.values()].flatMap((routes) => routes.map(({ descriptor }) => ({ area: descriptor.area, path: descriptor.path, presetKey: descriptor.presetKey })));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The rule over a compiled catalog, as compiling it would refuse it: throws naming every route that lies
|
|
42
|
+
* beneath another of its Area, whichever packages the two come from.
|
|
43
|
+
*/
|
|
44
|
+
export function refusePhiCatalogRouteAddresses(routesByArea) {
|
|
45
|
+
const findings = checkPhiRouteAddresses(listPhiCatalogRouteAddressSubjects(routesByArea));
|
|
46
|
+
if (findings.length > 0) {
|
|
47
|
+
throw new Error(`Module routes break the address rule:\n- ${findings.map((finding) => finding.message).join("\n- ")}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The parts of an address a person writes (`PhisSiteAddressInput`), in the order a form asks them. */
|
|
2
|
+
export declare const PHI_SITE_ADDRESS_TEXT_KEYS: readonly ["companyName", "name", "line1", "line2", "postalCode", "city", "region", "country"];
|
|
3
|
+
/**
|
|
4
|
+
* One address of a Site's book (`PhisSiteAddress`) as a Table and an edit Form read it: its parts, one by
|
|
5
|
+
* one and as the `address` field's value, the flags as four marks, as tags and as the number, and the parts
|
|
6
|
+
* after the name on one line. Only the purposes and
|
|
7
|
+
* defaults are read off the flags; Core lists no `Superseded` or `Removed` address to an account or a
|
|
8
|
+
* customer file. Shared by the account's own addresses and staff's customer file.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toPhiSiteAddressRow(address: Record<string, unknown>): {
|
|
11
|
+
createdAt: {} | null;
|
|
12
|
+
flags: number;
|
|
13
|
+
billing: boolean;
|
|
14
|
+
shipping: boolean;
|
|
15
|
+
defaultBilling: boolean;
|
|
16
|
+
defaultShipping: boolean;
|
|
17
|
+
address: {
|
|
18
|
+
[k: string]: string | null;
|
|
19
|
+
};
|
|
20
|
+
lines: string;
|
|
21
|
+
purposes: ("billing" | "shipping" | "defaultBilling" | "defaultShipping")[];
|
|
22
|
+
id: unknown;
|
|
23
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PhisSiteAddressFlags } from "@phis/contracts/users";
|
|
2
|
+
/** The parts of an address a person writes (`PhisSiteAddressInput`), in the order a form asks them. */
|
|
3
|
+
export const PHI_SITE_ADDRESS_TEXT_KEYS = ["companyName", "name", "line1", "line2", "postalCode", "city", "region", "country"];
|
|
4
|
+
function text(value) {
|
|
5
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* One address of a Site's book (`PhisSiteAddress`) as a Table and an edit Form read it: its parts, one by
|
|
9
|
+
* one and as the `address` field's value, the flags as four marks, as tags and as the number, and the parts
|
|
10
|
+
* after the name on one line. Only the purposes and
|
|
11
|
+
* defaults are read off the flags; Core lists no `Superseded` or `Removed` address to an account or a
|
|
12
|
+
* customer file. Shared by the account's own addresses and staff's customer file.
|
|
13
|
+
*/
|
|
14
|
+
export function toPhiSiteAddressRow(address) {
|
|
15
|
+
const flags = typeof address.flags === "number" ? address.flags : 0;
|
|
16
|
+
const has = (bit) => (flags & bit) !== 0;
|
|
17
|
+
const marks = {
|
|
18
|
+
billing: has(PhisSiteAddressFlags.Billing),
|
|
19
|
+
shipping: has(PhisSiteAddressFlags.Shipping),
|
|
20
|
+
defaultBilling: has(PhisSiteAddressFlags.DefaultBilling),
|
|
21
|
+
defaultShipping: has(PhisSiteAddressFlags.DefaultShipping),
|
|
22
|
+
};
|
|
23
|
+
const place = [text(address.postalCode), text(address.city)].filter(Boolean).join(" ");
|
|
24
|
+
return {
|
|
25
|
+
id: address.id,
|
|
26
|
+
...Object.fromEntries(PHI_SITE_ADDRESS_TEXT_KEYS.map((key) => [key, text(address[key]) ?? ""])),
|
|
27
|
+
// The parts as one value, as the `address` Form field holds them: an edit Form opens on it.
|
|
28
|
+
address: Object.fromEntries(PHI_SITE_ADDRESS_TEXT_KEYS.map((key) => [key, text(address[key])])),
|
|
29
|
+
lines: [text(address.companyName), text(address.line1), text(address.line2), place || null, text(address.region), text(address.country)]
|
|
30
|
+
.filter(Boolean).join(", "),
|
|
31
|
+
purposes: Object.keys(marks).filter((key) => marks[key]),
|
|
32
|
+
...marks,
|
|
33
|
+
createdAt: address.createdAt ?? null,
|
|
34
|
+
flags,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -50,8 +50,15 @@ export type PhiSurfaceStyleOptions = {
|
|
|
50
50
|
*/
|
|
51
51
|
groundLayer?: boolean;
|
|
52
52
|
};
|
|
53
|
-
/** The ground a
|
|
53
|
+
/** The ground a `light` or `dark` Surface paints where it states none: the container ground of the tone's mode. */
|
|
54
54
|
export declare const PHI_SURFACE_TONE_GROUND = "var(--phi-color-bg-container)";
|
|
55
|
+
/**
|
|
56
|
+
* The ground a toned Surface paints where it states none (`phiSurfaceTakesToneGround`): an `inverse` one
|
|
57
|
+
* stands on the Theme's Inverse Ground (THEME.md "Ground"), which is that mode's container ground unless
|
|
58
|
+
* the Theme states another; `light` and `dark` on their mode's container ground. Both resolve under the
|
|
59
|
+
* tone's class the box carries.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolvePhiSurfaceToneGround(tone: PhiSurface["tone"] | null | undefined): string;
|
|
55
62
|
/**
|
|
56
63
|
* Whether a Surface takes its tone's ground (`PHI_SURFACE_TONE_GROUND`): it asks for a mode of its own and
|
|
57
64
|
* its Background paints nothing. A stated ground wins, and the Theme's Overlay (`base.kind: "theme"`) is
|
package/helpers/surface-style.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { PHI_BACKGROUND_CONTAINER_GROUND, normalizePhiBackgroundWidgetConfig, phiBackgroundWidgetConfigPaintsGround, resolvePhiBackgroundGroundFilter, resolvePhiBackgroundMotion, resolvePhiBackgroundMotionHostStyle, resolvePhiBackgroundWidgetStyle, } from "../components/widgets/config/background";
|
|
2
|
+
import { PHI_INVERSE_GROUND } from "../theme/phi-theme-inverse-ground";
|
|
2
3
|
import { resolvePhiCmsBorderSource } from "../types/cms-border-source";
|
|
3
4
|
import { resolvePhiSurfaceToneClassName } from "../types/surface";
|
|
4
5
|
import { resolvePhiSourcedBorderStyle } from "./border-widget-style";
|
|
5
6
|
import { composePhiModePaint, resolvePhiModeValue } from "./mode-paint";
|
|
6
7
|
import { combinePhiBoxShadows, resolvePhiShadow } from "./layout-style";
|
|
7
|
-
/** The ground a
|
|
8
|
+
/** The ground a `light` or `dark` Surface paints where it states none: the container ground of the tone's mode. */
|
|
8
9
|
export const PHI_SURFACE_TONE_GROUND = PHI_BACKGROUND_CONTAINER_GROUND;
|
|
10
|
+
/**
|
|
11
|
+
* The ground a toned Surface paints where it states none (`phiSurfaceTakesToneGround`): an `inverse` one
|
|
12
|
+
* stands on the Theme's Inverse Ground (THEME.md "Ground"), which is that mode's container ground unless
|
|
13
|
+
* the Theme states another; `light` and `dark` on their mode's container ground. Both resolve under the
|
|
14
|
+
* tone's class the box carries.
|
|
15
|
+
*/
|
|
16
|
+
export function resolvePhiSurfaceToneGround(tone) {
|
|
17
|
+
return tone === "inverse" ? PHI_INVERSE_GROUND : PHI_SURFACE_TONE_GROUND;
|
|
18
|
+
}
|
|
9
19
|
/**
|
|
10
20
|
* Whether a Surface takes its tone's ground (`PHI_SURFACE_TONE_GROUND`): it asks for a mode of its own and
|
|
11
21
|
* its Background paints nothing. A stated ground wins, and the Theme's Overlay (`base.kind: "theme"`) is
|
|
@@ -93,7 +103,7 @@ export function resolvePhiSurfaceStyle(surface, options = {}) {
|
|
|
93
103
|
return {
|
|
94
104
|
style: {
|
|
95
105
|
...hostPaint,
|
|
96
|
-
...(toneGround ? { backgroundColor:
|
|
106
|
+
...(toneGround ? { backgroundColor: resolvePhiSurfaceToneGround(surface.tone) } : {}),
|
|
97
107
|
...(line == null ? {} : { border: line }),
|
|
98
108
|
...resolvePhiSurfaceCorners(options.cornerFallback, configuredCorners),
|
|
99
109
|
...(boxShadow == null ? {} : { boxShadow }),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a cell shows and what a condition reads, neither of which is a flag.
|
|
3
|
+
*
|
|
4
|
+
* `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
|
|
5
|
+
* enum values are strings because that is what an enum column and a condition compare against. The
|
|
6
|
+
* status itself stays on the row, because the filter above is written against what the route takes.
|
|
7
|
+
*
|
|
8
|
+
* One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
|
|
9
|
+
* what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
|
|
10
|
+
*
|
|
11
|
+
* Foundation, because two listings read Core's inbox rows: Core's thread inbox and the threads Module's
|
|
12
|
+
* customer file.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readPhiThreadInboxRow(row: Record<string, unknown>): {
|
|
15
|
+
kind: string;
|
|
16
|
+
status: string;
|
|
17
|
+
archived: boolean;
|
|
18
|
+
locked: boolean;
|
|
19
|
+
state: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PhisThreadFlag, PhisThreadStatus } from "../constants/threads";
|
|
2
|
+
/**
|
|
3
|
+
* What a cell shows and what a condition reads, neither of which is a flag.
|
|
4
|
+
*
|
|
5
|
+
* `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
|
|
6
|
+
* enum values are strings because that is what an enum column and a condition compare against. The
|
|
7
|
+
* status itself stays on the row, because the filter above is written against what the route takes.
|
|
8
|
+
*
|
|
9
|
+
* One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
|
|
10
|
+
* what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
|
|
11
|
+
*
|
|
12
|
+
* Foundation, because two listings read Core's inbox rows: Core's thread inbox and the threads Module's
|
|
13
|
+
* customer file.
|
|
14
|
+
*/
|
|
15
|
+
export function readPhiThreadInboxRow(row) {
|
|
16
|
+
const archived = row.status === PhisThreadStatus.Archived;
|
|
17
|
+
const locked = typeof row.flags === "number" && (row.flags & PhisThreadFlag.Locked) !== 0;
|
|
18
|
+
return {
|
|
19
|
+
...row,
|
|
20
|
+
kind: String(row.kind),
|
|
21
|
+
status: String(row.status),
|
|
22
|
+
archived,
|
|
23
|
+
locked,
|
|
24
|
+
state: archived ? "archived" : row.unread === true ? "unread" : locked ? "locked" : "open",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -7,3 +7,29 @@ export type PhiTranslationParams = Record<string, PhiTranslationParamValue> | Ph
|
|
|
7
7
|
* as it is.
|
|
8
8
|
*/
|
|
9
9
|
export declare function formatPhiTranslation(input: string, params?: PhiTranslationParams): string;
|
|
10
|
+
/** A plural category as CLDR names it and `Intl.PluralRules` answers it. */
|
|
11
|
+
export type PhiPluralCategory = "zero" | "one" | "two" | "few" | "many" | "other";
|
|
12
|
+
/**
|
|
13
|
+
* A text that says a count, one template per plural category (TRANSLATIONS.md, "Count labels").
|
|
14
|
+
*
|
|
15
|
+
* `other` is required and is what every category the label does not state reads. The source language is
|
|
16
|
+
* English, which states `one` and `other`; a locale with more categories -- Polish `few` and `many`, Arabic
|
|
17
|
+
* `zero` and `two` -- reads `other` for those until a label states them. Every template carries the count
|
|
18
|
+
* as `%1`, the `one` template too: `one` is not the number 1 everywhere (French reads 0 as `one`, Russian
|
|
19
|
+
* 21), so "1 page" written out would be wrong in the very locales the category exists for.
|
|
20
|
+
*/
|
|
21
|
+
export type PhiCountLabel = {
|
|
22
|
+
readonly [C in Exclude<PhiPluralCategory, "other">]?: string;
|
|
23
|
+
} & {
|
|
24
|
+
readonly other: string;
|
|
25
|
+
};
|
|
26
|
+
/** The categories in CLDR order, the order a count label's templates are read and translated in. */
|
|
27
|
+
export declare const PHI_PLURAL_CATEGORIES: readonly PhiPluralCategory[];
|
|
28
|
+
/**
|
|
29
|
+
* The count in words: the template of the category `count` falls in for `locale`, with the count as `%1`,
|
|
30
|
+
* written as `locale` writes numbers. `locale` is the reader's -- the page's Intl locale
|
|
31
|
+
* (`usePhiIntlLocale()` in a Client, the request locale on the server) -- never the browser's, so the
|
|
32
|
+
* server's render and the hydrated page say the same words. A Provider answers the scalar count; which
|
|
33
|
+
* words it takes is decided here and nowhere else.
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatPhiCountLabel(label: PhiCountLabel, count: number, locale: string): string;
|
|
@@ -23,3 +23,34 @@ export function formatPhiTranslation(input, params = 0) {
|
|
|
23
23
|
}
|
|
24
24
|
return text.replace(INDEXED_TOKEN_PATTERN, (token, position, index) => position === "1" || index === "0" ? String(params) : token);
|
|
25
25
|
}
|
|
26
|
+
/** The categories in CLDR order, the order a count label's templates are read and translated in. */
|
|
27
|
+
export const PHI_PLURAL_CATEGORIES = ["zero", "one", "two", "few", "many", "other"];
|
|
28
|
+
const pluralRulesByLocale = new Map();
|
|
29
|
+
const countFormatByLocale = new Map();
|
|
30
|
+
function readPluralRules(locale) {
|
|
31
|
+
let rules = pluralRulesByLocale.get(locale);
|
|
32
|
+
if (!rules) {
|
|
33
|
+
rules = new Intl.PluralRules(locale);
|
|
34
|
+
pluralRulesByLocale.set(locale, rules);
|
|
35
|
+
}
|
|
36
|
+
return rules;
|
|
37
|
+
}
|
|
38
|
+
function readCountFormat(locale) {
|
|
39
|
+
let format = countFormatByLocale.get(locale);
|
|
40
|
+
if (!format) {
|
|
41
|
+
format = new Intl.NumberFormat(locale);
|
|
42
|
+
countFormatByLocale.set(locale, format);
|
|
43
|
+
}
|
|
44
|
+
return format;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The count in words: the template of the category `count` falls in for `locale`, with the count as `%1`,
|
|
48
|
+
* written as `locale` writes numbers. `locale` is the reader's -- the page's Intl locale
|
|
49
|
+
* (`usePhiIntlLocale()` in a Client, the request locale on the server) -- never the browser's, so the
|
|
50
|
+
* server's render and the hydrated page say the same words. A Provider answers the scalar count; which
|
|
51
|
+
* words it takes is decided here and nowhere else.
|
|
52
|
+
*/
|
|
53
|
+
export function formatPhiCountLabel(label, count, locale) {
|
|
54
|
+
const template = label[readPluralRules(locale).select(count)] ?? label.other;
|
|
55
|
+
return formatPhiTranslation(template, [readCountFormat(locale).format(count)]);
|
|
56
|
+
}
|
package/module-labels.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `../../gateway/label-set` directly. That is the whole reason this file exists: the boundary a Module
|
|
11
11
|
* outside must use should be as narrow as the relative path a Module inside gets for free.
|
|
12
12
|
*/
|
|
13
|
-
export { definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, type PhiLabelSetDefinition, type PhiLabelSetEntry, type PhiLabelSetLabels, type PhiLabelSetTexts, } from "./gateway/label-set";
|
|
13
|
+
export { definePhiCountLabel, definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, type PhiLabelSetCountEntry, type PhiLabelSetDefinition, type PhiLabelSetEntry, type PhiLabelSetLabels, type PhiLabelSetTexts, } from "./gateway/label-set";
|
|
14
14
|
export { PHI_TR_CTX_WEB_UI_LABEL, PHI_TR_CTX_WEB_UI_MESSAGE } from "./gateway/tr";
|
|
15
15
|
export type { PhiGlobalTranslatorOptions } from "./gateway/tr";
|
|
16
16
|
/** Where a Site's own address for this server comes from, for code that runs outside a request. */
|
package/module-labels.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `../../gateway/label-set` directly. That is the whole reason this file exists: the boundary a Module
|
|
11
11
|
* outside must use should be as narrow as the relative path a Module inside gets for free.
|
|
12
12
|
*/
|
|
13
|
-
export { definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, } from "./gateway/label-set";
|
|
13
|
+
export { definePhiCountLabel, definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, } from "./gateway/label-set";
|
|
14
14
|
export { PHI_TR_CTX_WEB_UI_LABEL, PHI_TR_CTX_WEB_UI_MESSAGE } from "./gateway/tr";
|
|
15
15
|
/** Where a Site's own address for this server comes from, for code that runs outside a request. */
|
|
16
16
|
export { readPhiServerApiCredentials } from "./helpers/phis-server-credentials";
|
package/module-page-check.d.ts
CHANGED
|
@@ -17,5 +17,6 @@
|
|
|
17
17
|
export { createPhiDeclaredMediaResolver, type PhiModuleMediaFinding } from "./helpers/module-media-check";
|
|
18
18
|
export { checkPhiPagePresetLayout, type PhiPageLayoutFinding } from "./helpers/page-layout-check";
|
|
19
19
|
export { checkPhiPresetTextSources, type PhiPresetTextSourceFinding } from "./helpers/preset-text-source-check";
|
|
20
|
+
export { checkPhiEmbeddableTables, checkPhiPresetTables } from "./helpers/preset-table-check";
|
|
20
21
|
export { checkPhiPresetTreeContract, type PhiPresetTreeContractFinding } from "./helpers/preset-tree-contract-check";
|
|
21
22
|
export { checkPhiRouteAddresses, type PhiRouteAddressFinding, type PhiRouteAddressSubject } from "./helpers/route-address-check";
|
package/module-page-check.js
CHANGED
|
@@ -17,5 +17,6 @@
|
|
|
17
17
|
export { createPhiDeclaredMediaResolver } from "./helpers/module-media-check";
|
|
18
18
|
export { checkPhiPagePresetLayout } from "./helpers/page-layout-check";
|
|
19
19
|
export { checkPhiPresetTextSources } from "./helpers/preset-text-source-check";
|
|
20
|
+
export { checkPhiEmbeddableTables, checkPhiPresetTables } from "./helpers/preset-table-check";
|
|
20
21
|
export { checkPhiPresetTreeContract } from "./helpers/preset-tree-contract-check";
|
|
21
22
|
export { checkPhiRouteAddresses } from "./helpers/route-address-check";
|
package/module-records.d.ts
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* in `@phis/ui/runtime/data-provider-client`.
|
|
18
18
|
*/
|
|
19
19
|
import "server-only";
|
|
20
|
-
export type
|
|
21
|
-
export type { PhiRecordField, PhiRecordFieldValueByKind, PhiRecordLink, PhiRecordPicture, PhiRecordSample, PhiRecordTag, PhiRuntimeModuleRecordProviderServerDefinition, PhiRuntimeRecordFieldsReader, PhiRuntimeRecordProviderContext, PhiRuntimeRecordProviderResolver, PhiRuntimeRecordSamplesReader, } from "./types/record-provider";
|
|
20
|
+
export { PhiRecordMarkdownFlag, type PhiRecordFieldKind } from "./constants/record-field-kinds";
|
|
21
|
+
export type { PhiRecordField, PhiRecordFieldValueByKind, PhiRecordLink, PhiRecordMarkdown, PhiRecordPicture, PhiRecordSample, PhiRecordTag, PhiRuntimeModuleRecordProviderServerDefinition, PhiRuntimeRecordFieldsReader, PhiRuntimeRecordProviderContext, PhiRuntimeRecordProviderResolver, PhiRuntimeRecordSamplesReader, } from "./types/record-provider";
|
|
22
22
|
export { resolvePhiRecordSource, type PhiRecordSourceResult } from "./server-helpers/record-source";
|
|
23
23
|
export { readPhiPageRecordField, resolvePhiPageRecordFields, resolvePhiWidgetRecordField, type PhiPageRecordFieldsResult, type PhiWidgetRecordField, } from "./server-helpers/record-fields";
|
|
24
24
|
export { fetchPhiSiteApi, type PhiSiteApiRequest } from "./gateway/site-api-request";
|
package/module-records.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* in `@phis/ui/runtime/data-provider-client`.
|
|
18
18
|
*/
|
|
19
19
|
import "server-only";
|
|
20
|
+
export { PhiRecordMarkdownFlag } from "./constants/record-field-kinds";
|
|
20
21
|
export { resolvePhiRecordSource } from "./server-helpers/record-source";
|
|
21
22
|
export { readPhiPageRecordField, resolvePhiPageRecordFields, resolvePhiWidgetRecordField, } from "./server-helpers/record-fields";
|
|
22
23
|
export { fetchPhiSiteApi } from "./gateway/site-api-request";
|
package/next/area-route.js
CHANGED
|
@@ -4,6 +4,9 @@ import { readPhiAreaMeta } from "../helpers/cms-area-config";
|
|
|
4
4
|
import { buildPhiAreaPageMetadata } from "../helpers/phi-metadata";
|
|
5
5
|
import { resolvePhiSitePublicBase } from "../helpers/phi-seo";
|
|
6
6
|
import { readPhiSiteRuntimeConfigSync } from "../helpers/site-runtime";
|
|
7
|
+
import { readPhiServerApiCredentials } from "../helpers/phis-server-credentials";
|
|
8
|
+
import { readPhiMediaDeliveryAssetId, resolvePhiLinkPreviewImage } from "../server-helpers/link-preview-image";
|
|
9
|
+
import { PHI_PAGE_SHARE_IMAGE_CONFIG_KEY, readPhiShareImage } from "../types/link-preview";
|
|
7
10
|
import { PhiCmsErrorPage } from "../components/cms/phi-cms-error-page";
|
|
8
11
|
import { PhiCmsDeferredErrorPage, } from "../components/cms/phi-cms-deferred-error-page";
|
|
9
12
|
import { PhiCmsAreaBoundary, PhiCmsAreaShell, } from "../components/cms/phi-cms-root-layout";
|
|
@@ -170,6 +173,29 @@ export function createPhiNextDynamicRootPage(cmsBridge) {
|
|
|
170
173
|
if (resolvedRoute.canonicalHref || !resolvedRequest) {
|
|
171
174
|
return {};
|
|
172
175
|
}
|
|
176
|
+
const { runtime, page } = resolvedRequest;
|
|
177
|
+
const publicBase = resolvePhiSitePublicBase(runtime.site.publicUrl, readPhiSiteRuntimeConfigSync().site.publicUrl);
|
|
178
|
+
const brand = runtime.site.theme?.brand;
|
|
179
|
+
const preview = page.pageMeta?.preview ?? null;
|
|
180
|
+
const recordImageAssetId = preview?.image ? readPhiMediaDeliveryAssetId(preview.image.src, publicBase) : null;
|
|
181
|
+
const credentials = readPhiServerApiCredentials();
|
|
182
|
+
/*
|
|
183
|
+
* The preview's picture, in the order the Page answers: the record's, the Page's own, the Theme's
|
|
184
|
+
* (NEXT_INTEGRATION.md, "Link previews"). Only Public is shared; another Area states no preview.
|
|
185
|
+
*/
|
|
186
|
+
const image = resolvedRoute.area === "public"
|
|
187
|
+
? await resolvePhiLinkPreviewImage({
|
|
188
|
+
...credentials,
|
|
189
|
+
siteKey: runtime.site.key,
|
|
190
|
+
publicBase,
|
|
191
|
+
candidates: [
|
|
192
|
+
recordImageAssetId ? { assetId: recordImageAssetId, alt: preview?.image?.alt ?? null } : null,
|
|
193
|
+
readPhiShareImage(page.page.layoutConfig?.[PHI_PAGE_SHARE_IMAGE_CONFIG_KEY]),
|
|
194
|
+
readPhiShareImage(brand?.shareImage),
|
|
195
|
+
],
|
|
196
|
+
fallbackAlt: preview?.title ?? page.pageMeta?.title?.value ?? runtime.site.name ?? "",
|
|
197
|
+
})
|
|
198
|
+
: null;
|
|
173
199
|
return buildPhiAreaPageMetadata({
|
|
174
200
|
area: resolvedRoute.area,
|
|
175
201
|
meta: readPhiAreaMeta(rootRequest.resolvedAreaPreset?.preset.config),
|
|
@@ -177,8 +203,15 @@ export function createPhiNextDynamicRootPage(cmsBridge) {
|
|
|
177
203
|
pageTitle: resolvedRequest.page.pageMeta?.title?.value,
|
|
178
204
|
pageDescription: resolvedRequest.page.pageMeta?.description?.value,
|
|
179
205
|
pageNoindex: resolvedRequest.runtime.page?.noindex,
|
|
206
|
+
linkPreview: {
|
|
207
|
+
recordTitle: preview?.title,
|
|
208
|
+
recordDescription: preview?.description,
|
|
209
|
+
slogan: brand?.slogan?.label,
|
|
210
|
+
image,
|
|
211
|
+
xAccount: brand?.xAccount,
|
|
212
|
+
},
|
|
180
213
|
publicAddress: {
|
|
181
|
-
publicBase
|
|
214
|
+
publicBase,
|
|
182
215
|
path: resolvedRoute.cmsPath,
|
|
183
216
|
locale: resolvedRoute.locale,
|
|
184
217
|
availableLocales: resolvedRequest.runtime.site.availableLocales.map((option) => option.code),
|
package/next/root-route.js
CHANGED
|
@@ -9,7 +9,7 @@ import { collectPhiThemeDescriptorContributions } from "../plugins/runtime-modul
|
|
|
9
9
|
import { resolvePhiThemeComposition } from "../theme/phi-theme-composition";
|
|
10
10
|
import { composePhiFontCatalogue } from "../theme/phi-font-catalogue";
|
|
11
11
|
import { PHI_REM_ROOT_PX } from "../theme/phi-css-vars";
|
|
12
|
-
import { buildPhiRootMetadata } from "../helpers/phi-metadata";
|
|
12
|
+
import { buildPhiRootMetadata, resolvePhiSiteDescription } from "../helpers/phi-metadata";
|
|
13
13
|
import { describePhiSignetHead } from "../helpers/phi-signet-head";
|
|
14
14
|
import { localizePath } from "../helpers/locale";
|
|
15
15
|
import { readPhiSiteRuntimeConfigSync, } from "../helpers/site-runtime";
|
|
@@ -78,12 +78,11 @@ function buildPhiNextRootMetadata(runtimeConfig, site, themeBlocks) {
|
|
|
78
78
|
applicationName: site.name,
|
|
79
79
|
titleTemplate: `%s | ${site.name}`,
|
|
80
80
|
defaultTitle: site.name,
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
// The Page's own description wins where it states one (`buildPhiAreaPageMetadata`).
|
|
82
|
+
defaultDescription: resolvePhiSiteDescription(site.theme?.brand?.slogan?.label),
|
|
83
83
|
site: {
|
|
84
84
|
title: site.name,
|
|
85
|
-
description: site.theme?.brand?.slogan?.label
|
|
86
|
-
"Canonical starter structure for PHIS-powered sites.",
|
|
85
|
+
description: resolvePhiSiteDescription(site.theme?.brand?.slogan?.label),
|
|
87
86
|
},
|
|
88
87
|
/*
|
|
89
88
|
* The Signet the Site wears, resolved the way the Brand Widget resolves the Logo -- the Site's own,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phis/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -521,7 +521,7 @@
|
|
|
521
521
|
"@lexical/rich-text": "0.50.0",
|
|
522
522
|
"@lexical/selection": "0.50.0",
|
|
523
523
|
"@lexical/utils": "0.50.0",
|
|
524
|
-
"@phis/contracts": "^0.8.
|
|
524
|
+
"@phis/contracts": "^0.8.11",
|
|
525
525
|
"dayjs": "^1.11.23",
|
|
526
526
|
"dom-serializer": "^2.0.0",
|
|
527
527
|
"htmlparser2": "^10.1.0",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who works with the customer file: the holders of the Site access `accounting` (Maintainer, Accountant;
|
|
3
|
+
* an Admin through the Site-superuser rule). phis-server's `GET /api/site/members/{userId}/file` answers
|
|
4
|
+
* `support` as well, without addresses; a Supporter's file is the Support Module's own Page over the same
|
|
5
|
+
* route, not this one. Said for the Page's entry and its tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PHI_ACCOUNTING_CUSTOMER_FILE_ACCESS: {
|
|
8
|
+
readonly access: "roles";
|
|
9
|
+
readonly providerId: "@phis/server/core";
|
|
10
|
+
readonly allowedRoleFlags: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PHI_CORE_ROLE_PROVIDER_ID, PhiBaseRole } from "@phis/contracts/access";
|
|
2
|
+
/**
|
|
3
|
+
* Who works with the customer file: the holders of the Site access `accounting` (Maintainer, Accountant;
|
|
4
|
+
* an Admin through the Site-superuser rule). phis-server's `GET /api/site/members/{userId}/file` answers
|
|
5
|
+
* `support` as well, without addresses; a Supporter's file is the Support Module's own Page over the same
|
|
6
|
+
* route, not this one. Said for the Page's entry and its tree.
|
|
7
|
+
*/
|
|
8
|
+
export const PHI_ACCOUNTING_CUSTOMER_FILE_ACCESS = {
|
|
9
|
+
access: "roles",
|
|
10
|
+
providerId: PHI_CORE_ROLE_PROVIDER_ID,
|
|
11
|
+
allowedRoleFlags: PhiBaseRole.Maintainer | PhiBaseRole.Accountant,
|
|
12
|
+
};
|
|
@@ -35,7 +35,7 @@ export const PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
35
35
|
kind: "table",
|
|
36
36
|
executionMode: "live",
|
|
37
37
|
authoringMode: "none",
|
|
38
|
-
title: "
|
|
38
|
+
title: "Product directory",
|
|
39
39
|
description: "The Site's product directory: every supplier's products, their terms and their state.",
|
|
40
40
|
resources: [
|
|
41
41
|
{
|
|
@@ -19,3 +19,14 @@ export declare const PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET_KEY = "accounting-produ
|
|
|
19
19
|
export declare const PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS: Readonly<Record<"layoutTerms" | "layoutTermsFooter", import("@phis/contracts/cms").PhiCmsInstanceId>>;
|
|
20
20
|
export declare const PHI_ACCOUNTING_PRODUCTS_PAGE_OVERLAY_IDS: Readonly<Record<"overlayTerms", import("@phis/contracts/cms").PhiCmsInstanceId>>;
|
|
21
21
|
export declare const PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS: Readonly<Record<"widgetTable" | "widgetTerms" | "widgetTermsNote" | "widgetTermsCommands", import("@phis/contracts/cms").PhiCmsInstanceId>>;
|
|
22
|
+
/**
|
|
23
|
+
* Staff's customer file on one member (phis-server `GET /api/site/members/{userId}/file`), a Page of the
|
|
24
|
+
* Accounting Area beside the product directory.
|
|
25
|
+
*/
|
|
26
|
+
export declare const PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET_KEY = "accounting-customer-file-page";
|
|
27
|
+
/** The three Tables, the conversation, and the Reply dialog with its Form -- every one named in a route by another. */
|
|
28
|
+
export declare const PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_IDS: {
|
|
29
|
+
widgets: Readonly<Record<"widgetConversation" | "widgetReplyForm" | "widgetReplyCommands" | "widgetPerson" | "widgetAddresses" | "widgetThreads", import("@phis/contracts/cms").PhiCmsInstanceId>>;
|
|
30
|
+
overlays: Readonly<Record<"overlayReply", import("@phis/contracts/cms").PhiCmsInstanceId>>;
|
|
31
|
+
layouts: Readonly<Record<"layoutReply" | "layoutReplyFooter", import("@phis/contracts/cms").PhiCmsInstanceId>>;
|
|
32
|
+
};
|
|
@@ -27,3 +27,26 @@ const PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET = {
|
|
|
27
27
|
export const PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS = createPhiPresetCmsInstanceIdMap(PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET, ["layoutTerms", "layoutTermsFooter"]);
|
|
28
28
|
export const PHI_ACCOUNTING_PRODUCTS_PAGE_OVERLAY_IDS = createPhiPresetCmsInstanceIdMap(PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET, ["overlayTerms"]);
|
|
29
29
|
export const PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS = createPhiPresetCmsInstanceIdMap(PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET, ["widgetTable", "widgetTerms", "widgetTermsNote", "widgetTermsCommands"]);
|
|
30
|
+
/**
|
|
31
|
+
* Staff's customer file on one member (phis-server `GET /api/site/members/{userId}/file`), a Page of the
|
|
32
|
+
* Accounting Area beside the product directory.
|
|
33
|
+
*/
|
|
34
|
+
export const PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET_KEY = "accounting-customer-file-page";
|
|
35
|
+
const PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET = {
|
|
36
|
+
domain: "page",
|
|
37
|
+
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
38
|
+
presetKey: PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET_KEY,
|
|
39
|
+
};
|
|
40
|
+
/** The three Tables, the conversation, and the Reply dialog with its Form -- every one named in a route by another. */
|
|
41
|
+
export const PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_IDS = {
|
|
42
|
+
widgets: createPhiPresetCmsInstanceIdMap(PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET, [
|
|
43
|
+
"widgetPerson",
|
|
44
|
+
"widgetAddresses",
|
|
45
|
+
"widgetThreads",
|
|
46
|
+
"widgetConversation",
|
|
47
|
+
"widgetReplyForm",
|
|
48
|
+
"widgetReplyCommands",
|
|
49
|
+
]),
|
|
50
|
+
overlays: createPhiPresetCmsInstanceIdMap(PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET, ["overlayReply"]),
|
|
51
|
+
layouts: createPhiPresetCmsInstanceIdMap(PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET, ["layoutReply", "layoutReplyFooter"]),
|
|
52
|
+
};
|
|
@@ -2,11 +2,12 @@ import { buildPhiAreaRootRoutePresetDescriptor } from "../area-root-route";
|
|
|
2
2
|
import { buildPhiSidebarRoutePresetDescriptor } from "../sidebar-route";
|
|
3
3
|
import { PhiCmsRegionType } from "../../../constants/phi-cms";
|
|
4
4
|
import { PHI_DEFAULT_PUB_AREA_COMPOSITION_NODE_KEYS } from "../preset-contracts/pub-area";
|
|
5
|
-
import { PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET_KEY, PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "./ids";
|
|
5
|
+
import { PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET_KEY, PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET_KEY, PHI_ACCOUNTING_RUNTIME_MODULE_ID, } from "./ids";
|
|
6
|
+
import { PHI_ACCOUNTING_CUSTOMER_FILE_ACCESS } from "./customer-file-access";
|
|
6
7
|
/*
|
|
7
|
-
* What the Accounting base Module brings: the Site shell for its Area, the Area root,
|
|
8
|
-
* product directory. The root lands on the first sidebar entry a viewer can see -- the Dashboard
|
|
9
|
-
* Module's where it is on, the
|
|
8
|
+
* What the Accounting base Module brings: the Site shell for its Area, the Area root, the Site's
|
|
9
|
+
* product directory and staff's customer file. The root lands on the first sidebar entry a viewer can see -- the Dashboard
|
|
10
|
+
* Module's where it is on, the customer file where it is not (the Module's entries stand in preset-key order).
|
|
10
11
|
*/
|
|
11
12
|
export const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS = [
|
|
12
13
|
{
|
|
@@ -56,11 +57,37 @@ export const PHI_ACCOUNTING_RUNTIME_MODULE_ROUTES = [
|
|
|
56
57
|
anchor: "main",
|
|
57
58
|
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
58
59
|
presetKey: PHI_ACCOUNTING_PRODUCTS_PAGE_PRESET_KEY,
|
|
59
|
-
title: "
|
|
60
|
+
title: "Product directory",
|
|
60
61
|
path: "/products",
|
|
61
62
|
itemKey: "@phis/ui/modules/accounting/nav/accounting/products",
|
|
62
63
|
icon: "antd:appstore",
|
|
63
64
|
loadTree: ({ page, runtime }) => import("./trees/phi-default-accounting-products-page-tree")
|
|
64
65
|
.then((module) => module.buildPhiDefaultAccountingProductsPageTree({ page, runtime })),
|
|
65
66
|
}),
|
|
67
|
+
/*
|
|
68
|
+
* Staff's customer file on one member, for the holders of `accounting`, whom the Area admits anyway:
|
|
69
|
+
* the entry states the access as the Page and Core's route do. A Supporter's file is the Support
|
|
70
|
+
* Module's own Page over the same Core route, not this one.
|
|
71
|
+
*/
|
|
72
|
+
withPhiNavigationAccess(buildPhiSidebarRoutePresetDescriptor({
|
|
73
|
+
area: "accounting",
|
|
74
|
+
anchor: "main",
|
|
75
|
+
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
76
|
+
presetKey: PHI_ACCOUNTING_CUSTOMER_FILE_PAGE_PRESET_KEY,
|
|
77
|
+
title: "Customer file",
|
|
78
|
+
path: "/customer-file",
|
|
79
|
+
itemKey: "@phis/ui/modules/accounting/nav/accounting/customer-file",
|
|
80
|
+
icon: "antd:idcard",
|
|
81
|
+
loadTree: ({ page, runtime }) => import("./trees/phi-default-accounting-customer-file-page-tree")
|
|
82
|
+
.then((module) => module.buildPhiDefaultAccountingCustomerFilePageTree({ page, runtime })),
|
|
83
|
+
}), PHI_ACCOUNTING_CUSTOMER_FILE_ACCESS),
|
|
66
84
|
];
|
|
85
|
+
function withPhiNavigationAccess(descriptor, accessPolicy) {
|
|
86
|
+
return {
|
|
87
|
+
...descriptor,
|
|
88
|
+
navigation: descriptor.navigation?.map((injection) => ({
|
|
89
|
+
...injection,
|
|
90
|
+
item: { ...injection.item, accessPolicy },
|
|
91
|
+
})),
|
|
92
|
+
};
|
|
93
|
+
}
|