@phis/ui 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +23 -8
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +4 -3
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +19 -15
- package/helpers/preset-table-check.js +33 -39
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/next/root-route.js +2 -1
- package/package.json +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +30 -48
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +74 -50
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +15 -1
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import { type PhiRuntimeDataProviderKey } from "../../../../types/runtime-data-provider";
|
|
3
|
-
import type { PhiCollectionProviderActionRequest, PhiCollectionProviderData, PhiCollectionProviderQueryRequest } from "../../../../types/collection-provider";
|
|
3
|
+
import type { PhiCollectionProviderActionRequest, PhiCollectionProviderData, PhiCollectionProviderQueryRequest, PhiCollectionProviderRecordRequest } from "../../../../types/collection-provider";
|
|
4
4
|
import type { PhiProviderResourceSource } from "../../../../types/runtime-data-provider";
|
|
5
5
|
export type PhiCollectionProviderRegistration = {
|
|
6
6
|
key: PhiRuntimeDataProviderKey;
|
|
7
7
|
query: (request: PhiCollectionProviderQueryRequest) => Promise<PhiCollectionProviderData>;
|
|
8
8
|
action?: (request: PhiCollectionProviderActionRequest) => Promise<PhiCollectionProviderData>;
|
|
9
|
+
/**
|
|
10
|
+
* One item by its key, for a record-bound Form opened from one of the View's items (FORMS.md, "A
|
|
11
|
+
* record opened from a Collection View"): the Table Provider's `readRecord`, in its request shape. Only
|
|
12
|
+
* for a resource that declares `recordRead: true`, and required by one.
|
|
13
|
+
*/
|
|
14
|
+
readRecord?: (request: PhiCollectionProviderRecordRequest) => Promise<Record<string, unknown>>;
|
|
9
15
|
resources: readonly {
|
|
10
16
|
resourceKey: string;
|
|
11
17
|
/**
|
|
@@ -17,6 +23,8 @@ export type PhiCollectionProviderRegistration = {
|
|
|
17
23
|
* ships; `PhiCmsCollectionViewWidgetConfig.itemRendererKey` names a different one.
|
|
18
24
|
*/
|
|
19
25
|
itemRendererKey: `${string}/${string}`;
|
|
26
|
+
/** As the resource's declaration says it (`PhiCollectionProviderResourceDescriptor.recordRead`). */
|
|
27
|
+
recordRead?: boolean;
|
|
20
28
|
}[];
|
|
21
29
|
};
|
|
22
30
|
export declare function createPhiCollectionProviderClient(registration: PhiCollectionProviderRegistration): ComponentType<{
|
|
@@ -42,6 +50,8 @@ export declare function usePhiCollectionProvider(source: PhiProviderResourceSour
|
|
|
42
50
|
* ships; `PhiCmsCollectionViewWidgetConfig.itemRendererKey` names a different one.
|
|
43
51
|
*/
|
|
44
52
|
itemRendererKey: `${string}/${string}`;
|
|
53
|
+
/** As the resource's declaration says it (`PhiCollectionProviderResourceDescriptor.recordRead`). */
|
|
54
|
+
recordRead?: boolean;
|
|
45
55
|
} | null;
|
|
46
56
|
bindingError: string | null;
|
|
47
57
|
};
|
|
@@ -14,6 +14,11 @@ export function createPhiCollectionProviderClient(registration) {
|
|
|
14
14
|
registration.resources.some((resource) => !resource.resourceKey.trim() || !isPhiNamespacedRuntimeKey(resource.itemRendererKey))) {
|
|
15
15
|
throw new Error(`Collection provider "${registration.key}" has invalid Client resources.`);
|
|
16
16
|
}
|
|
17
|
+
// As a Table Provider's: a record read declared and not served is worse than one never offered.
|
|
18
|
+
const unserved = registration.resources.find((resource) => resource.recordRead === true);
|
|
19
|
+
if (unserved && !registration.readRecord) {
|
|
20
|
+
throw new Error(`Collection provider "${registration.key}" declares recordRead on resource "${unserved.resourceKey}" but has no readRecord.`);
|
|
21
|
+
}
|
|
17
22
|
return function PhiBoundCollectionProviderClient({ children }) {
|
|
18
23
|
return (_jsx(PhiCollectionProviderClient, { registration: registration, children: children }));
|
|
19
24
|
};
|
|
@@ -4,6 +4,15 @@ import { type PhiSignalRouteSet } from "../../../../types/signals";
|
|
|
4
4
|
import type { PhiToolbarControlItem } from "../../../controls/phi-toolbar-control";
|
|
5
5
|
import { type PhiButtonVariant } from "../../config/button-variant";
|
|
6
6
|
import type { PhiCommonControlLabels } from "../../label-types/common-controls";
|
|
7
|
+
type PhiCommandButtonRuntimeState = {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
badge?: string | number | null;
|
|
12
|
+
icon?: string | null;
|
|
13
|
+
label?: string | null;
|
|
14
|
+
tooltip?: string | null;
|
|
15
|
+
};
|
|
7
16
|
export type PhiCommandButtonsOptions = {
|
|
8
17
|
buttons: readonly PhiCommandButtonConfig[];
|
|
9
18
|
/** The Widget's control key, as every Control states one (`parsePhiControlConfig`). */
|
|
@@ -40,4 +49,11 @@ export type PhiCommandButtonsResult = {
|
|
|
40
49
|
export declare function resolvePhiCommandButtonVariant(button: Pick<PhiCommandButtonConfig, "variant">, action: {
|
|
41
50
|
variant?: PhiButtonVariant;
|
|
42
51
|
} | null | undefined): PhiButtonVariant | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Whether a button is greyed out: its stated Disabled until `enabled/change` says otherwise, as the
|
|
54
|
+
* toolbar's own Disabled is (`resolvedDisabled`). A confirm button placed greyed out and woken by a
|
|
55
|
+
* Controller stayed grey, since the signal could only ever switch a button off.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolvePhiCommandButtonDisabled(button: Pick<PhiCommandButtonConfig, "disabled">, state: Pick<PhiCommandButtonRuntimeState, "enabled">): boolean;
|
|
43
58
|
export declare function usePhiCommandButtons({ buttons, key, signalRoutes, blockId, labels, disabled, initialDisabled, initialReadOnly, signalsEnabled, }: PhiCommandButtonsOptions): PhiCommandButtonsResult;
|
|
59
|
+
export {};
|
|
@@ -74,6 +74,14 @@ function colorPhiCommandButtonIcon(icon, color) {
|
|
|
74
74
|
return icon;
|
|
75
75
|
return createElement("span", { style: { display: "inline-flex", color } }, icon);
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether a button is greyed out: its stated Disabled until `enabled/change` says otherwise, as the
|
|
79
|
+
* toolbar's own Disabled is (`resolvedDisabled`). A confirm button placed greyed out and woken by a
|
|
80
|
+
* Controller stayed grey, since the signal could only ever switch a button off.
|
|
81
|
+
*/
|
|
82
|
+
export function resolvePhiCommandButtonDisabled(button, state) {
|
|
83
|
+
return state.enabled === undefined ? button.disabled === true : !state.enabled;
|
|
84
|
+
}
|
|
77
85
|
export function usePhiCommandButtons({ buttons, key, signalRoutes, blockId, labels, disabled, initialDisabled = false, initialReadOnly = false, signalsEnabled = true, }) {
|
|
78
86
|
const resolvedKey = key?.trim() || "command";
|
|
79
87
|
const signalIdentity = usePhiSignalIdentity();
|
|
@@ -304,7 +312,7 @@ export function usePhiCommandButtons({ buttons, key, signalRoutes, blockId, labe
|
|
|
304
312
|
*/
|
|
305
313
|
type: resolvePhiButtonVariantPresentation(resolvePhiCommandButtonVariant(button, action)).type ?? "default",
|
|
306
314
|
danger: action ? action.danger === true : button.danger === true,
|
|
307
|
-
disabled: button
|
|
315
|
+
disabled: resolvePhiCommandButtonDisabled(button, buttonState),
|
|
308
316
|
readOnly: button.readOnly === true,
|
|
309
317
|
loading: buttonState.loading,
|
|
310
318
|
icon: button.display === "label" ? null : colorPhiCommandButtonIcon(resolvedIcon, button.iconColor),
|
|
@@ -80,6 +80,7 @@ const PHI_ADMIN_USERS_TABLE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
80
80
|
history_title_with_name: "Login history for %1",
|
|
81
81
|
history_loading: "Loading login history...",
|
|
82
82
|
history_empty: definePhiMessageLabel("No logins found."),
|
|
83
|
+
history_footer: "%1 logins",
|
|
83
84
|
history_error_title: "Login history failed",
|
|
84
85
|
delete_confirm_title: definePhiMessageLabel("Delete user?"),
|
|
85
86
|
delete_confirm_self: definePhiMessageLabel("You cannot delete your own account here."),
|
|
@@ -203,6 +204,7 @@ export async function getPhiAdminUsersTableWidgetLabels(options) {
|
|
|
203
204
|
loading: labels.history_loading,
|
|
204
205
|
empty: labels.history_empty,
|
|
205
206
|
errorTitle: labels.history_error_title,
|
|
207
|
+
footer: labels.history_footer,
|
|
206
208
|
},
|
|
207
209
|
actions: {
|
|
208
210
|
edit: labels.action_edit_label,
|
|
@@ -55,6 +55,7 @@ const PHI_BUILDER_MODULES_PAGE_LABEL_SET = definePhiLabelSet({
|
|
|
55
55
|
usage_sign_in: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.usage.signIn,
|
|
56
56
|
usage_confirm: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.usage.confirm,
|
|
57
57
|
usage_cancel: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.usage.cancel,
|
|
58
|
+
usage_footer: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.usage.footer,
|
|
58
59
|
public_routes_title: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.title,
|
|
59
60
|
public_routes_intro: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.intro,
|
|
60
61
|
public_routes_page: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.page,
|
|
@@ -66,6 +67,7 @@ const PHI_BUILDER_MODULES_PAGE_LABEL_SET = definePhiLabelSet({
|
|
|
66
67
|
public_routes_address: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.address,
|
|
67
68
|
public_routes_assign: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.assign,
|
|
68
69
|
public_routes_cancel: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.cancel,
|
|
70
|
+
public_routes_footer: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.footer,
|
|
69
71
|
},
|
|
70
72
|
});
|
|
71
73
|
export async function getPhiBuilderModulesPageLabels(options) {
|
|
@@ -139,6 +141,7 @@ export async function getPhiBuilderModulesPageLabels(options) {
|
|
|
139
141
|
signIn: labels.usage_sign_in,
|
|
140
142
|
confirm: labels.usage_confirm,
|
|
141
143
|
cancel: labels.usage_cancel,
|
|
144
|
+
footer: labels.usage_footer,
|
|
142
145
|
},
|
|
143
146
|
publicRoutes: {
|
|
144
147
|
title: labels.public_routes_title,
|
|
@@ -152,6 +155,7 @@ export async function getPhiBuilderModulesPageLabels(options) {
|
|
|
152
155
|
address: labels.public_routes_address,
|
|
153
156
|
assign: labels.public_routes_assign,
|
|
154
157
|
cancel: labels.public_routes_cancel,
|
|
158
|
+
footer: labels.public_routes_footer,
|
|
155
159
|
},
|
|
156
160
|
};
|
|
157
161
|
}
|
|
@@ -32,22 +32,6 @@ export declare function getPhiProfileNameWidgetLabels(options: PhiGlobalTranslat
|
|
|
32
32
|
successText: string;
|
|
33
33
|
};
|
|
34
34
|
}>;
|
|
35
|
-
export declare function getPhiProfileOverviewWidgetLabels(options: PhiGlobalTranslatorOptions): Promise<{
|
|
36
|
-
title: string;
|
|
37
|
-
description: string;
|
|
38
|
-
accountLabel: string;
|
|
39
|
-
newsletterLabel: string;
|
|
40
|
-
newsletterDescription: string;
|
|
41
|
-
newsletterOn: string;
|
|
42
|
-
newsletterOff: string;
|
|
43
|
-
feedback: {
|
|
44
|
-
errorTitle: string;
|
|
45
|
-
errorNetwork: string;
|
|
46
|
-
errorGeneric: string;
|
|
47
|
-
successTitle: string;
|
|
48
|
-
successText: string;
|
|
49
|
-
};
|
|
50
|
-
}>;
|
|
51
35
|
export declare function getPhiProfileEmailWidgetLabels(options: PhiGlobalTranslatorOptions): Promise<{
|
|
52
36
|
description: string;
|
|
53
37
|
currentLabel: string;
|
|
@@ -62,24 +62,6 @@ const PHI_PROFILE_PHONE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
62
62
|
success_text: definePhiMessageLabel("Your telephone numbers have been saved."),
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
|
-
const PHI_PROFILE_OVERVIEW_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
66
|
-
key: "widget:profile-overview",
|
|
67
|
-
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
68
|
-
labels: {
|
|
69
|
-
title: "Overview",
|
|
70
|
-
description: definePhiMessageLabel("Manage your account details and site preferences from one place."),
|
|
71
|
-
account_label: "Account",
|
|
72
|
-
newsletter_label: "Newsletter",
|
|
73
|
-
newsletter_description: definePhiMessageLabel("Receive product and platform updates for this site."),
|
|
74
|
-
newsletter_on: "Enabled",
|
|
75
|
-
newsletter_off: "Disabled",
|
|
76
|
-
error_title: "Newsletter update failed",
|
|
77
|
-
error_network: definePhiMessageLabel("Network error while updating your newsletter preference."),
|
|
78
|
-
error_generic: definePhiMessageLabel("The newsletter preference could not be updated."),
|
|
79
|
-
success_title: "Newsletter updated",
|
|
80
|
-
success_text: definePhiMessageLabel("Your newsletter preference has been saved."),
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
65
|
export async function getPhiProfileLocaleWidgetLabels(options) {
|
|
84
66
|
const labels = await getPhiLabelSet(options, PHI_PROFILE_LOCALE_WIDGET_LABEL_SET);
|
|
85
67
|
return {
|
|
@@ -121,25 +103,6 @@ export async function getPhiProfileNameWidgetLabels(options) {
|
|
|
121
103
|
},
|
|
122
104
|
};
|
|
123
105
|
}
|
|
124
|
-
export async function getPhiProfileOverviewWidgetLabels(options) {
|
|
125
|
-
const labels = await getPhiLabelSet(options, PHI_PROFILE_OVERVIEW_WIDGET_LABEL_SET);
|
|
126
|
-
return {
|
|
127
|
-
title: labels.title,
|
|
128
|
-
description: labels.description,
|
|
129
|
-
accountLabel: labels.account_label,
|
|
130
|
-
newsletterLabel: labels.newsletter_label,
|
|
131
|
-
newsletterDescription: labels.newsletter_description,
|
|
132
|
-
newsletterOn: labels.newsletter_on,
|
|
133
|
-
newsletterOff: labels.newsletter_off,
|
|
134
|
-
feedback: {
|
|
135
|
-
errorTitle: labels.error_title,
|
|
136
|
-
errorNetwork: labels.error_network,
|
|
137
|
-
errorGeneric: labels.error_generic,
|
|
138
|
-
successTitle: labels.success_title,
|
|
139
|
-
successText: labels.success_text,
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
106
|
const PHI_PROFILE_EMAIL_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
144
107
|
key: "widget:profile-email",
|
|
145
108
|
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
@@ -30,7 +30,6 @@ const PHI_REGISTRATION_FORM_LABEL_SET = definePhiLabelSet({
|
|
|
30
30
|
terms_text: "I agree to the %1",
|
|
31
31
|
terms_link_label: "Terms & Conditions",
|
|
32
32
|
terms_required: definePhiMessageLabel("You must accept the terms to continue."),
|
|
33
|
-
newsletter: definePhiMessageLabel("Send me product and platform updates."),
|
|
34
33
|
notice: definePhiMessageLabel("This form sends a verification email first. The live customer account is created only after confirmation."),
|
|
35
34
|
generic_error: definePhiMessageLabel("The registration request could not be completed."),
|
|
36
35
|
account_exists_error: definePhiMessageLabel("Account already exists."),
|
|
@@ -86,7 +85,6 @@ export async function getPhiRegistrationFormLabels(options) {
|
|
|
86
85
|
termsLinkLabel: labels.terms_link_label,
|
|
87
86
|
terms: labels.terms_text,
|
|
88
87
|
termsRequired: labels.terms_required,
|
|
89
|
-
newsletter: labels.newsletter,
|
|
90
88
|
},
|
|
91
89
|
actions: {
|
|
92
90
|
submitLabel: labels.submit_label,
|
|
@@ -58,6 +58,7 @@ const PHI_BUILDER_REVISIONS_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
58
58
|
delete_area_title: PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.title,
|
|
59
59
|
delete_area_warning: definePhiMessageLabel(PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.warning),
|
|
60
60
|
delete_area_survives: definePhiMessageLabel(PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.survives),
|
|
61
|
+
delete_area_type_to_confirm: PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.typeToConfirm,
|
|
61
62
|
delete_area_field: PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.field,
|
|
62
63
|
delete_area_field_required: definePhiMessageLabel(PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.fieldRequired),
|
|
63
64
|
delete_area_confirm: PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS.deleteArea.confirm,
|
|
@@ -136,6 +137,7 @@ export async function getPhiBuilderRevisionsWidgetLabels(options) {
|
|
|
136
137
|
title: labels.delete_area_title,
|
|
137
138
|
warning: labels.delete_area_warning,
|
|
138
139
|
survives: labels.delete_area_survives,
|
|
140
|
+
typeToConfirm: labels.delete_area_type_to_confirm,
|
|
139
141
|
field: labels.delete_area_field,
|
|
140
142
|
fieldRequired: labels.delete_area_field_required,
|
|
141
143
|
confirm: labels.delete_area_confirm,
|
|
@@ -41,6 +41,7 @@ const PHI_SIGNALS_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
41
41
|
routes_update: PHI_SIGNALS_WIDGET_DEFAULT_LABELS.routes.update,
|
|
42
42
|
routes_edit: PHI_SIGNALS_WIDGET_DEFAULT_LABELS.routes.edit,
|
|
43
43
|
routes_delete: PHI_SIGNALS_WIDGET_DEFAULT_LABELS.routes.delete,
|
|
44
|
+
routes_footer: PHI_SIGNALS_WIDGET_DEFAULT_LABELS.routes.footer,
|
|
44
45
|
},
|
|
45
46
|
});
|
|
46
47
|
export async function getPhiSignalsWidgetLabels(options) {
|
|
@@ -84,6 +85,7 @@ export async function getPhiSignalsWidgetLabels(options) {
|
|
|
84
85
|
update: labels.routes_update,
|
|
85
86
|
edit: labels.routes_edit,
|
|
86
87
|
delete: labels.routes_delete,
|
|
88
|
+
footer: labels.routes_footer,
|
|
87
89
|
},
|
|
88
90
|
};
|
|
89
91
|
}
|
|
@@ -59,6 +59,8 @@ export type PhiBuilderModulesPageLabels = {
|
|
|
59
59
|
signIn: string;
|
|
60
60
|
confirm: string;
|
|
61
61
|
cancel: string;
|
|
62
|
+
/** The Table's footer; %1 the places listed. */
|
|
63
|
+
footer: string;
|
|
62
64
|
};
|
|
63
65
|
/** The one question enabling a Module can ask: a Public address it wants is taken. */
|
|
64
66
|
publicRoutes: {
|
|
@@ -74,6 +76,8 @@ export type PhiBuilderModulesPageLabels = {
|
|
|
74
76
|
address: string;
|
|
75
77
|
assign: string;
|
|
76
78
|
cancel: string;
|
|
79
|
+
/** The Table's footer; %1 the addresses listed. */
|
|
80
|
+
footer: string;
|
|
77
81
|
};
|
|
78
82
|
};
|
|
79
83
|
export declare const PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS: PhiBuilderModulesPageLabels;
|
|
@@ -68,6 +68,7 @@ export const PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS = {
|
|
|
68
68
|
"Run phis auth restore-preset --site <site key> on the server to bring it back.",
|
|
69
69
|
confirm: "Switch off anyway",
|
|
70
70
|
cancel: "Keep it on",
|
|
71
|
+
footer: "%1 places draw it",
|
|
71
72
|
},
|
|
72
73
|
publicRoutes: {
|
|
73
74
|
title: "Public addresses are taken",
|
|
@@ -81,5 +82,6 @@ export const PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS = {
|
|
|
81
82
|
address: "Address",
|
|
82
83
|
assign: "Enable with these addresses",
|
|
83
84
|
cancel: "Cancel",
|
|
85
|
+
footer: "%1 addresses taken",
|
|
84
86
|
},
|
|
85
87
|
};
|
|
@@ -68,6 +68,8 @@ export type PhiBuilderRevisionsWidgetLabels = {
|
|
|
68
68
|
/** What is lost, until the Controller names the Area in it when the dialog opens. */
|
|
69
69
|
warning: string;
|
|
70
70
|
survives: string;
|
|
71
|
+
/** Above the Area key the dialog shows to be typed, which the Controller writes in as it opens. */
|
|
72
|
+
typeToConfirm: string;
|
|
71
73
|
field: string;
|
|
72
74
|
fieldRequired: string;
|
|
73
75
|
confirm: string;
|
|
@@ -60,7 +60,8 @@ export const PHI_BUILDER_REVISIONS_WIDGET_DEFAULT_LABELS = {
|
|
|
60
60
|
title: "Clear this Area back to its preset?",
|
|
61
61
|
warning: "The structure this Site stored for the Area is cleared -- its Shell, drafts and published alike. What is live changes at once, the shell's preset takes the Area back, and no revision is left to restore it from. It cannot be undone. The Module selection is kept.",
|
|
62
62
|
survives: "The Area keeps its Module selection, its Pages, its Navigation and its Theme. Only its Shell goes back to the preset.",
|
|
63
|
-
|
|
63
|
+
typeToConfirm: "Type this Area key to confirm:",
|
|
64
|
+
field: "Area key",
|
|
64
65
|
fieldRequired: "Write the Area key out to confirm.",
|
|
65
66
|
confirm: "Clear Area",
|
|
66
67
|
cancel: "Cancel",
|
|
@@ -37,6 +37,8 @@ export type PhiSignalsWidgetLabels = {
|
|
|
37
37
|
update: string;
|
|
38
38
|
edit: string;
|
|
39
39
|
delete: string;
|
|
40
|
+
/** The routes Table's footer; %1 the routes listed. */
|
|
41
|
+
footer: string;
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
export declare const PHI_SIGNALS_WIDGET_DEFAULT_LABELS: PhiSignalsWidgetLabels;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function PhiWidgetFailureAudienceProvider({ staff, children }: {
|
|
3
|
+
staff: boolean;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
/** That the viewer is Staff, who read a Widget's failure on a live page too. */
|
|
7
|
+
export declare function usePhiWidgetFailureStaff(): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
/*
|
|
5
|
+
* Whether the person looking at a live page is Staff, for the one question a live page asks it: does a
|
|
6
|
+
* Widget that failed say so (`widget-failure.tsx`)?
|
|
7
|
+
*
|
|
8
|
+
* Decided once, on the server, by the Area's boundary from the viewer it already resolved
|
|
9
|
+
* (`canPhiViewerReadWidgetFailures`), and handed down here: no request asks for it, and a Widget does
|
|
10
|
+
* not have to carry the viewer to know. Absent -- a page outside an Area boundary, a test -- it is a
|
|
11
|
+
* visitor, who is shown nothing. A Public page rendered once for everybody is rendered for a visitor; a
|
|
12
|
+
* signed-in viewer is never served that render (STATIC_RENDERING.md), so Staff get theirs.
|
|
13
|
+
*/
|
|
14
|
+
const PhiWidgetFailureStaffContext = createContext(false);
|
|
15
|
+
export function PhiWidgetFailureAudienceProvider({ staff, children }) {
|
|
16
|
+
return _jsx(PhiWidgetFailureStaffContext.Provider, { value: staff, children: children });
|
|
17
|
+
}
|
|
18
|
+
/** That the viewer is Staff, who read a Widget's failure on a live page too. */
|
|
19
|
+
export function usePhiWidgetFailureStaff() {
|
|
20
|
+
return useContext(PhiWidgetFailureStaffContext);
|
|
21
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useEffectEvent } from "react";
|
|
3
|
-
import { logPhiWidgetFailure
|
|
3
|
+
import { logPhiWidgetFailure } from "./widget-failure";
|
|
4
|
+
import { usePhiWidgetFailureStaff } from "./widget-failure-audience";
|
|
5
|
+
import { renderPhiWidgetFailureNotice } from "./widget-failure-notice";
|
|
4
6
|
/**
|
|
5
7
|
* A Widget's data or configuration failure, found in the browser -- a Provider the Area does not offer,
|
|
6
8
|
* a read that failed after hydration.
|
|
@@ -11,10 +13,11 @@ import { logPhiWidgetFailure, renderPhiWidgetFailureNotice } from "./widget-fail
|
|
|
11
13
|
*/
|
|
12
14
|
export function PhiWidgetFailure(props) {
|
|
13
15
|
const { renderMode, widgetType, widgetId, title, description } = props;
|
|
16
|
+
const staff = usePhiWidgetFailureStaff();
|
|
14
17
|
// `error` is read, not watched: it is a new object whenever the same failure is raised again.
|
|
15
18
|
const log = useEffectEvent(() => logPhiWidgetFailure(props));
|
|
16
19
|
useEffect(() => {
|
|
17
20
|
log();
|
|
18
21
|
}, [description, renderMode, title, widgetId, widgetType]);
|
|
19
|
-
return renderPhiWidgetFailureNotice(props);
|
|
22
|
+
return renderPhiWidgetFailureNotice(props, staff);
|
|
20
23
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PhiWidgetFailureProps } from "./widget-failure";
|
|
2
|
+
/**
|
|
3
|
+
* The card for a failure the server decided and has already written down (`PhiWidgetFailureServer`):
|
|
4
|
+
* drawn here because only the browser's side of the page knows whether the viewer is Staff.
|
|
5
|
+
*/
|
|
6
|
+
export declare function PhiWidgetFailureNotice(props: Omit<PhiWidgetFailureProps, "error">): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePhiWidgetFailureStaff } from "./widget-failure-audience";
|
|
3
|
+
import { renderPhiWidgetFailureNotice } from "./widget-failure-notice";
|
|
4
|
+
/**
|
|
5
|
+
* The card for a failure the server decided and has already written down (`PhiWidgetFailureServer`):
|
|
6
|
+
* drawn here because only the browser's side of the page knows whether the viewer is Staff.
|
|
7
|
+
*/
|
|
8
|
+
export function PhiWidgetFailureNotice(props) {
|
|
9
|
+
return renderPhiWidgetFailureNotice(props, usePhiWidgetFailureStaff());
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PhiWidgetFailureProps } from "./widget-failure";
|
|
2
|
+
/**
|
|
3
|
+
* The card itself, or nothing on a live page for anyone but Staff (`staff`, read from
|
|
4
|
+
* `usePhiWidgetFailureStaff`). Both variants draw through this, so they cannot drift.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderPhiWidgetFailureNotice({ renderMode, widgetType, widgetId, title, description }: PhiWidgetFailureProps, staff: boolean): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PhiAlertControl } from "../../controls/phi-alert-control";
|
|
3
|
+
/*
|
|
4
|
+
* Apart from `widget-failure.tsx`, which writes the warning: the card is drawn in the browser for a
|
|
5
|
+
* failure the server decided too (`PhiWidgetFailureNotice`), and that Client needs the card and not the
|
|
6
|
+
* log writer.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The card itself, or nothing on a live page for anyone but Staff (`staff`, read from
|
|
10
|
+
* `usePhiWidgetFailureStaff`). Both variants draw through this, so they cannot drift.
|
|
11
|
+
*/
|
|
12
|
+
export function renderPhiWidgetFailureNotice({ renderMode, widgetType, widgetId, title, description }, staff) {
|
|
13
|
+
if (renderMode === "live" && !staff) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return (_jsx("div", { "data-phi-widget-failure": widgetType, "data-phi-widget-failure-id": widgetId == null ? undefined : String(widgetId), children: _jsx(PhiAlertControl, { level: "error", showIcon: true, title: title, description: description ?? undefined }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PhiBaseRole } from "@phis/contracts/access";
|
|
2
|
+
import { canPhiViewerAccess, PHI_CORE_ROLE_PROVIDER_ID } from "../../../types/access";
|
|
3
|
+
/*
|
|
4
|
+
* Who reads a Widget's failure on a live page: Staff, who is whoever holds any Core role
|
|
5
|
+
* (`PhiBaseRole.Staff` in @phis/contracts/access). They can have it fixed -- an author, a maintainer,
|
|
6
|
+
* a colleague who tells one -- and a Widget that is simply absent for them was a failure nobody saw
|
|
7
|
+
* (@phis/support's Linked work Table until f5bbd545). A visitor is shown nothing, as before. Admin is
|
|
8
|
+
* Staff by the Site-superuser rule of `canPhiViewerAccess`.
|
|
9
|
+
*/
|
|
10
|
+
const PHI_WIDGET_FAILURE_READERS = {
|
|
11
|
+
access: "roles",
|
|
12
|
+
providerId: PHI_CORE_ROLE_PROVIDER_ID,
|
|
13
|
+
allowedRoleFlags: Object.values(PhiBaseRole).reduce((mask, flag) => mask | flag, 0),
|
|
14
|
+
};
|
|
15
|
+
/** That `viewer` is Staff and reads a failed Widget's card on a live page (`PhiWidgetFailureAudienceProvider`). */
|
|
16
|
+
export function canPhiViewerReadWidgetFailures(viewer) {
|
|
17
|
+
return canPhiViewerAccess(viewer, PHI_WIDGET_FAILURE_READERS);
|
|
18
|
+
}
|
|
@@ -7,10 +7,15 @@ import type { PhiRenderableBlockRenderMode } from "../../../types/renderable-blo
|
|
|
7
7
|
*
|
|
8
8
|
* Said to the person who can do something about it, as the renderer says an unrenderable block
|
|
9
9
|
* (`renderCmsDiagnostic`). In the Builder that is the author, and the card stands in the Widget's own
|
|
10
|
-
* place with the cause. On a live page -- a revision preview is one -- it is
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* place with the cause. On a live page -- a revision preview is one -- it is Staff (whoever holds a
|
|
11
|
+
* Core role, `canPhiViewerReadWidgetFailures`), who see the same card in the same place: a config is
|
|
12
|
+
* checked where it is made and the browser trusts it (owner, 2026-11-24), so what still fails here is
|
|
13
|
+
* runtime state or a config stored before the checks, and a Widget that is simply absent for the people
|
|
14
|
+
* who could have it fixed is a failure nobody sees. A visitor sees nothing: they cannot rebind a
|
|
15
|
+
* Provider, and a heading over an error, or over an empty frame, reads as a broken Site or as one that
|
|
16
|
+
* published nothing. So for them the Widget is absent and the rest of the page stands. The warning is
|
|
17
|
+
* written either way, which is where an operator finds it -- on the server for a failure the server
|
|
18
|
+
* decided, in the browser console for one found in the browser, which has no way to the Site's log.
|
|
14
19
|
*
|
|
15
20
|
* What a visitor is meant to read -- a form's own answer, an empty state, a refusal addressed to them --
|
|
16
21
|
* is content, not a failure, and does not come here.
|
|
@@ -27,5 +32,3 @@ export type PhiWidgetFailureProps = {
|
|
|
27
32
|
};
|
|
28
33
|
export declare const PHI_WIDGET_FAILURE_LOG_EVENT = "cms.widget.unavailable";
|
|
29
34
|
export declare function logPhiWidgetFailure({ renderMode, widgetType, widgetId, title, description, error, }: PhiWidgetFailureProps): void;
|
|
30
|
-
/** The card itself, or nothing on a live page. Both variants draw through this, so they cannot drift. */
|
|
31
|
-
export declare function renderPhiWidgetFailureNotice({ renderMode, widgetType, widgetId, title, description, }: PhiWidgetFailureProps): import("react").JSX.Element | null;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { logRuntimeEvent } from "../../../net/log";
|
|
3
|
-
import { PhiAlertControl } from "../../controls/phi-alert-control";
|
|
4
2
|
export const PHI_WIDGET_FAILURE_LOG_EVENT = "cms.widget.unavailable";
|
|
5
3
|
export function logPhiWidgetFailure({ renderMode, widgetType, widgetId, title, description, error, }) {
|
|
6
4
|
logRuntimeEvent("warn", PHI_WIDGET_FAILURE_LOG_EVENT, {
|
|
@@ -11,10 +9,3 @@ export function logPhiWidgetFailure({ renderMode, widgetType, widgetId, title, d
|
|
|
11
9
|
meta: { widgetType, title, description: description ?? null, renderMode },
|
|
12
10
|
});
|
|
13
11
|
}
|
|
14
|
-
/** The card itself, or nothing on a live page. Both variants draw through this, so they cannot drift. */
|
|
15
|
-
export function renderPhiWidgetFailureNotice({ renderMode, widgetType, widgetId, title, description, }) {
|
|
16
|
-
if (renderMode === "live") {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return (_jsx("div", { "data-phi-widget-failure": widgetType, "data-phi-widget-failure-id": widgetId == null ? undefined : String(widgetId), children: _jsx(PhiAlertControl, { level: "error", showIcon: true, title: title, description: description ?? undefined }) }));
|
|
20
|
-
}
|
|
@@ -4,6 +4,8 @@ import { type PhiWidgetFailureProps } from "./widget-failure";
|
|
|
4
4
|
* A Widget's data or configuration failure, decided while the page is drawn on the server.
|
|
5
5
|
*
|
|
6
6
|
* The warning is written here, during the render, because this render happens once per request and on
|
|
7
|
-
* the machine whose log an operator reads.
|
|
7
|
+
* the machine whose log an operator reads. The card is the browser's to draw or leave out, which knows
|
|
8
|
+
* whether the viewer is Staff (`PhiWidgetFailureNotice`). See `PhiWidgetFailureProps` for what counts and
|
|
9
|
+
* who sees it.
|
|
8
10
|
*/
|
|
9
|
-
export declare function PhiWidgetFailureServer(props: PhiWidgetFailureProps): import("react").JSX.Element
|
|
11
|
+
export declare function PhiWidgetFailureServer(props: PhiWidgetFailureProps): import("react").JSX.Element;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import "server-only";
|
|
2
|
-
import { logPhiWidgetFailure
|
|
3
|
+
import { logPhiWidgetFailure } from "./widget-failure";
|
|
4
|
+
import { PhiWidgetFailureNotice } from "./widget-failure-notice-client";
|
|
3
5
|
/**
|
|
4
6
|
* A Widget's data or configuration failure, decided while the page is drawn on the server.
|
|
5
7
|
*
|
|
6
8
|
* The warning is written here, during the render, because this render happens once per request and on
|
|
7
|
-
* the machine whose log an operator reads.
|
|
9
|
+
* the machine whose log an operator reads. The card is the browser's to draw or leave out, which knows
|
|
10
|
+
* whether the viewer is Staff (`PhiWidgetFailureNotice`). See `PhiWidgetFailureProps` for what counts and
|
|
11
|
+
* who sees it.
|
|
8
12
|
*/
|
|
9
13
|
export function PhiWidgetFailureServer(props) {
|
|
10
14
|
logPhiWidgetFailure(props);
|
|
11
|
-
|
|
15
|
+
const { error: _logged, ...notice } = props;
|
|
16
|
+
return _jsx(PhiWidgetFailureNotice, { ...notice });
|
|
12
17
|
}
|
|
@@ -9,15 +9,24 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS: {
|
|
11
11
|
readonly table: `${string}/${string}`;
|
|
12
|
+
/**
|
|
13
|
+
* The member's addresses as tiles (a Collection drawn by `PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`), read-only,
|
|
14
|
+
* from the same read: the member arrives as the binding param `userId` (`PHI_CUSTOMER_FILE_MEMBER_PARAM`),
|
|
15
|
+
* which the Conversations Controller forwards from the person Table's choice.
|
|
16
|
+
*/
|
|
17
|
+
readonly addresses: `${string}/${string}`;
|
|
12
18
|
};
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The resources, each one answer of the same route read for one member: the Table Provider's person and
|
|
21
|
+
* threads, and the addresses Collection's addresses.
|
|
22
|
+
*/
|
|
14
23
|
export declare const PHI_CUSTOMER_FILE_RESOURCE_KEYS: {
|
|
15
24
|
readonly person: "person";
|
|
16
25
|
readonly addresses: "addresses";
|
|
17
26
|
readonly threads: "threads";
|
|
18
27
|
};
|
|
19
|
-
/** The binding param
|
|
20
|
-
export declare const
|
|
28
|
+
/** The binding param the addresses Collection reads its member from: `{ params: { userId } }`. */
|
|
29
|
+
export declare const PHI_CUSTOMER_FILE_MEMBER_PARAM = "userId";
|
|
21
30
|
/**
|
|
22
31
|
* The binding param a customer file Page writes its sentence for the reader's own file into, already in the
|
|
23
32
|
* reader's language: Core refuses that file (`403`), and each Table says this where its rows would be.
|