@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
|
@@ -42,7 +42,12 @@ import { normalizePhiBackgroundWidgetConfig } from "../../../../../components/wi
|
|
|
42
42
|
import { PhiMediaPickerBinding } from "../../../../../components/media/phi-media-picker-binding";
|
|
43
43
|
import { usePhiMediaPickerLabels } from "../../../../../components/media/phi-media-picker-labels";
|
|
44
44
|
import { PHI_SEARCH_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/search";
|
|
45
|
-
import { buildPhiMediaAssetContentDeliveryUrl, isPhiMediaAssetPublic, PhiMediaAssetFlags, PhiMediaKind, } from "../../../../../constants/media";
|
|
45
|
+
import { buildPhiMediaAssetContentDeliveryUrl, isPhiMediaAssetPublic, PhiImageAssetVariantKey, PhiMediaAssetFlags, PhiMediaKind, } from "../../../../../constants/media";
|
|
46
|
+
import { resolvePhiImagePresentation } from "../../../../../components/media/image-presentation";
|
|
47
|
+
import { usePhiAuthoringAssetDetails } from "../../../../../components/media/use-authoring-asset-details";
|
|
48
|
+
import { PhiImageControl } from "../../../../../components/controls/phi-image-control";
|
|
49
|
+
import { resolvePhiSiteDescription } from "../../../../../helpers/phi-site-description";
|
|
50
|
+
import { omitPhiThemePaletteDefaults } from "../../../../../theme/phi-theme-palette-defaults";
|
|
46
51
|
import { readPhiXAccount } from "../../../../../types/link-preview";
|
|
47
52
|
import { PhiPresetSizeControl } from "../../../../../components/controls/phi-preset-size-control";
|
|
48
53
|
import { PhiButtonControl } from "../../../../../components/controls/phi-button-control";
|
|
@@ -1042,11 +1047,17 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1042
1047
|
const selectedPreset = resolveThemePayloadPreset(state.draft, themePresets);
|
|
1043
1048
|
/*
|
|
1044
1049
|
* What the tab shows is what the Site renders: the palette block with the draft's palette on top,
|
|
1045
|
-
* resolved for the mode being edited. The seeds the author owns are the ones
|
|
1046
|
-
*
|
|
1050
|
+
* resolved for the mode being edited. The seeds the author owns are the ones the draft's palette
|
|
1051
|
+
* states, shared or under this mode, other than the Theme gives them; the derived overrides live
|
|
1052
|
+
* under this mode alone.
|
|
1047
1053
|
*/
|
|
1048
1054
|
const colorToken = resolvePhiThemeColorTokens(selectedPreset, state.draft.palette, previewMode);
|
|
1049
|
-
|
|
1055
|
+
/*
|
|
1056
|
+
* What the author owns is what changes something: a colour the draft states exactly as the Theme
|
|
1057
|
+
* gives it -- a Module palette taken over on save, a picker put back on the Theme's value -- is no
|
|
1058
|
+
* decision of theirs, offers no reset, and is not stored on the next save.
|
|
1059
|
+
*/
|
|
1060
|
+
const ownPalette = omitPhiThemePaletteDefaults(selectedPreset, state.draft.palette, buildPhiEffectiveNonColorThemeTokens(state.draft));
|
|
1050
1061
|
const ownOverrides = ownPalette.modes?.[previewMode]?.overrides ?? {};
|
|
1051
1062
|
/*
|
|
1052
1063
|
* The same colour without the author's derived overrides: what a derived control falls back to, and
|
|
@@ -1605,6 +1616,21 @@ export function PhiBuilderBrandIdentityControlsWidgetClient({ runtime, config, }
|
|
|
1605
1616
|
});
|
|
1606
1617
|
const [activeIdentitySection, changeActiveIdentitySection] = usePhiBrandAccordionSection(BRAND_THEME_IDENTITY_COLLAPSE_STORAGE_KEY, BRAND_THEME_IDENTITY_SECTION_KEYS);
|
|
1607
1618
|
const brand = state.draft.brand ?? {};
|
|
1619
|
+
/*
|
|
1620
|
+
* The link preview's picture as a shared link shows it: the Asset's share variant (1200 x 630, cut
|
|
1621
|
+
* around its focus), drawn the way every picture of the house is drawn. The Asset's facts give the
|
|
1622
|
+
* variant's version and the alt text the head falls back to.
|
|
1623
|
+
*/
|
|
1624
|
+
const shareImageId = brand.shareImage?.assetId ?? null;
|
|
1625
|
+
const shareAsset = usePhiAuthoringAssetDetails(shareImageId);
|
|
1626
|
+
const shareImagePresentation = shareImageId == null ? null : resolvePhiImagePresentation({
|
|
1627
|
+
sourceKind: "asset",
|
|
1628
|
+
assetId: shareImageId,
|
|
1629
|
+
variantKey: PhiImageAssetVariantKey.Share,
|
|
1630
|
+
variantVersion: shareAsset?.variantVersion ?? null,
|
|
1631
|
+
deliveryRevision: shareAsset?.deliveryRevision ?? null,
|
|
1632
|
+
originalUrl: shareAsset?.deliveryUrl?.trim() || buildPhiMediaAssetContentDeliveryUrl(shareImageId),
|
|
1633
|
+
});
|
|
1608
1634
|
/*
|
|
1609
1635
|
* The Logo shows what the Site draws, which is the Set's wherever the record says nothing about the
|
|
1610
1636
|
* mode. Picking one takes the mode over; the reset hands it back to the Set.
|
|
@@ -1774,15 +1800,15 @@ export function PhiBuilderBrandIdentityControlsWidgetClient({ runtime, config, }
|
|
|
1774
1800
|
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, style: {
|
|
1775
1801
|
"--phi-labeled-control-label-width": "33.333333%",
|
|
1776
1802
|
"--phi-labeled-control-width": "100%",
|
|
1777
|
-
}, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "The picture a shared link shows where its Page states none, cut to 1200 x 630 around its focus. Only a publicly delivered picture can be chosen." }), _jsx(PhiMediaPickerBinding, { config: {
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1803
|
+
}, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "The picture a shared link shows where its Page states none, cut to 1200 x 630 around its focus. Only a publicly delivered picture can be chosen." }), shareImagePresentation?.url ? (_jsx(PhiCardControl, { size: "small", padding: clientToken.paddingXS, cover: (_jsx(PhiImageControl, { presentation: shareImagePresentation, source: "asset", alt: brand.shareImage?.alt || shareAsset?.altText || "Link preview picture", width: 1200, height: 630, blurDataUrl: shareAsset?.blurDataUrl ?? null, sizes: "400px" })), children: _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXXS, style: { minWidth: 0 }, children: [runtime.site.hostname ? (_jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: clientToken.fontSizeSM }, children: runtime.site.hostname })) : null, _jsx(PhiTypographyControl, { strong: true, children: runtime.site.name || "Page title" }), _jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: clientToken.fontSizeSM }, children: resolvePhiSiteDescription(brand.slogan?.label) })] }) })) : null, _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingXS, style: { minWidth: 0 }, children: [_jsx("div", { style: { flex: "1 1 auto", minWidth: 0 }, children: _jsx(PhiMediaPickerBinding, { config: {
|
|
1804
|
+
mediaType: PhiMediaKind.Image,
|
|
1805
|
+
pageSize: 12,
|
|
1806
|
+
showPagination: true,
|
|
1807
|
+
showGroupFilter: true,
|
|
1808
|
+
showSearchBar: true,
|
|
1809
|
+
}, labels: mediaPickerLabels, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, siteSpaceOnly: true, isAssetSelectable: (asset) => isPhiMediaAssetPublic(asset.deliveryPolicy, asset.lifecycleStatus), value: brand.shareImage?.assetId ?? null, onAssetSelect: (asset) => publishDraft(mergeThemeBrand(state.draft, {
|
|
1810
|
+
shareImage: { assetId: asset.id, ...(brand.shareImage?.alt ? { alt: brand.shareImage.alt } : {}) },
|
|
1811
|
+
})), onAssetClear: () => publishDraft(mergeThemeBrand(state.draft, { shareImage: null })) }) }), brand.shareImage ? (_jsx(PhiButtonControl, { size: "small", type: "link", style: { flexShrink: 0, paddingInline: 0 }, onClick: () => publishDraft(mergeThemeBrand(state.draft, { shareImage: null })), label: "Remove" })) : null] }), _jsx(PhiLabeledControl, { label: "Alt", fill: true, children: _jsx(PhiTextControl, { value: brand.shareImage?.alt ?? "", placeholder: shareAsset?.altText || "Alt text", ariaLabel: "Link preview alt text", allowClear: false, disabled: !brand.shareImage, onChange: (next) => brand.shareImage && publishDraft(mergeThemeBrand(state.draft, {
|
|
1786
1812
|
shareImage: next?.trim()
|
|
1787
1813
|
? { assetId: brand.shareImage.assetId, alt: next }
|
|
1788
1814
|
: { assetId: brand.shareImage.assetId },
|
|
@@ -11,4 +11,9 @@ export const PHI_THREADS_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS = [
|
|
|
11
11
|
ownerModuleId: PHI_THREADS_RUNTIME_MODULE_ID,
|
|
12
12
|
loadLive: async () => (await import("./services/customer-file-table")).PhiThreadsCustomerFileTableProviderClient,
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
key: PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFileAddresses,
|
|
16
|
+
ownerModuleId: PHI_THREADS_RUNTIME_MODULE_ID,
|
|
17
|
+
loadLive: async () => (await import("./services/customer-file-addresses")).PhiThreadsCustomerFileAddressesProviderClient,
|
|
18
|
+
},
|
|
14
19
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { findPhiSignalRoutesByCapabilityId, } from "../../../../types/signals";
|
|
5
5
|
import { readPhiTableActionSignalValue, readPhiTableSelectionSignalValue, } from "../../../../types/table-signal-values";
|
|
6
6
|
import { readPhiOverlayCloseRequest } from "../../../../types/cms-overlay";
|
|
@@ -10,6 +10,10 @@ import { usePhiRuntimeConditionStateResponder } from "../../../../components/run
|
|
|
10
10
|
import { usePhiSignalDispatcher, usePhiSignalListener } from "../../../../components/runtime/runtime-signal-bus";
|
|
11
11
|
import { dispatchPhiSignalCapability } from "../../../../components/runtime/runtime-signal-identity";
|
|
12
12
|
import { PHI_THREADS_RUNTIME_CONTROLLER_DEFINITION, } from "./definition";
|
|
13
|
+
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
14
|
+
import { readPhiPositiveInteger } from "../../../../components/widgets/client/shared/phi-table-provider-request";
|
|
15
|
+
import { readPhiCustomerFileThreadId } from "../services/customer-file-read";
|
|
16
|
+
import { PHI_CUSTOMER_FILE_MEMBER_PARAM } from "../../../../constants/customer-file";
|
|
13
17
|
/**
|
|
14
18
|
* A row key is a conversation id, and this is the only code allowed to know it.
|
|
15
19
|
*
|
|
@@ -31,6 +35,11 @@ function readSelectedThreadId(value) {
|
|
|
31
35
|
* what came back. Reading `{ thread: { thread: { id } } }` out of it is a statement about the Core
|
|
32
36
|
* route's answer, which is exactly the kind of knowledge that belongs in the Module and nowhere else.
|
|
33
37
|
*/
|
|
38
|
+
/** The member a customer file Page's person Table chose, from its query (`filters.userId`). */
|
|
39
|
+
function readChosenMemberId(value) {
|
|
40
|
+
const filters = isPhiRecord(value) && isPhiRecord(value.filters) ? value.filters : null;
|
|
41
|
+
return filters ? readPhiPositiveInteger(filters.userId) : null;
|
|
42
|
+
}
|
|
34
43
|
function readCreatedThreadId(value) {
|
|
35
44
|
const payload = value?.payload;
|
|
36
45
|
const threadId = payload?.thread?.thread?.id;
|
|
@@ -48,6 +57,14 @@ function PhiThreadsControllerView({ address, config, }) {
|
|
|
48
57
|
* it cannot merely pass through.
|
|
49
58
|
*/
|
|
50
59
|
const [openThreadId, setOpenThreadId] = useState(null);
|
|
60
|
+
/*
|
|
61
|
+
* A customer file Page's two readers apart: the member's file, and the conversation a Reply was last
|
|
62
|
+
* pressed in -- the file's or the listing's -- so the note that lands is read again where it was written.
|
|
63
|
+
*/
|
|
64
|
+
const [fileThreadId, setFileThreadId] = useState(null);
|
|
65
|
+
const [replyThreadId, setReplyThreadId] = useState(null);
|
|
66
|
+
const memberRead = useRef({ userId: null, controller: null });
|
|
67
|
+
useEffect(() => () => memberRead.current.controller?.abort(), []);
|
|
51
68
|
const emitRoutes = useMemo(() => config.signalRoutes?.emits ?? [], [config.signalRoutes?.emits]);
|
|
52
69
|
/*
|
|
53
70
|
* One declared output, delivered through every route that names it.
|
|
@@ -87,6 +104,32 @@ function PhiThreadsControllerView({ address, config, }) {
|
|
|
87
104
|
*/
|
|
88
105
|
emitCapability("conditionStateChange", { state: { ready: true, threadOpen: threadId != null } }, correlationId);
|
|
89
106
|
}, [emitCapability]);
|
|
107
|
+
/*
|
|
108
|
+
* Another member chosen: their file, read from the request the Page's Tables make for the same choice
|
|
109
|
+
* (it joins that one, so a choice stays one entry in the access log), handed to the file panel. Nobody
|
|
110
|
+
* chosen, the reader's own file and a failed read all close the panel; the Tables say why. The member
|
|
111
|
+
* also goes to whatever shows something of theirs by binding params -- the addresses tiles.
|
|
112
|
+
*/
|
|
113
|
+
const openMemberFile = useCallback((userId, correlationId) => {
|
|
114
|
+
if (memberRead.current.userId === userId)
|
|
115
|
+
return;
|
|
116
|
+
memberRead.current.controller?.abort();
|
|
117
|
+
const controller = userId == null ? null : new AbortController();
|
|
118
|
+
memberRead.current = { userId, controller };
|
|
119
|
+
setFileThreadId(null);
|
|
120
|
+
// The addresses ask in their next render, while the read below is under way, and join it.
|
|
121
|
+
emitCapability("memberParamsChange", { params: { [PHI_CUSTOMER_FILE_MEMBER_PARAM]: userId } }, correlationId);
|
|
122
|
+
emitCapability("fileThreadChange", { threadId: null }, correlationId);
|
|
123
|
+
if (userId == null || !controller)
|
|
124
|
+
return;
|
|
125
|
+
readPhiCustomerFileThreadId(userId, controller.signal).then((threadId) => {
|
|
126
|
+
if (controller.signal.aborted)
|
|
127
|
+
return;
|
|
128
|
+
setFileThreadId(threadId);
|
|
129
|
+
if (threadId != null)
|
|
130
|
+
emitCapability("fileThreadChange", { threadId }, correlationId);
|
|
131
|
+
}, () => undefined);
|
|
132
|
+
}, [emitCapability]);
|
|
90
133
|
const reloadInbox = useCallback((correlationId) => emitCapability("reload", null, correlationId), [emitCapability]);
|
|
91
134
|
const closeDialog = useCallback((correlationId) => emitCapability("dialogClose", null, correlationId), [emitCapability]);
|
|
92
135
|
const resetForm = useCallback((correlationId) => emitCapability("formReset", null, correlationId), [emitCapability]);
|
|
@@ -106,7 +149,12 @@ function PhiThreadsControllerView({ address, config, }) {
|
|
|
106
149
|
return;
|
|
107
150
|
// The toolbar's `+`. A Table says which action was run and on which row; what that means is here.
|
|
108
151
|
if (signal.channel === "action" && signal.action === "activate") {
|
|
109
|
-
|
|
152
|
+
const tableAction = readPhiTableActionSignalValue(signal.value);
|
|
153
|
+
if (tableAction?.actionKey === "reply") {
|
|
154
|
+
setReplyThreadId(readPhiPositiveInteger(tableAction.rowIdentity));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (tableAction?.actionKey !== "newConversation")
|
|
110
158
|
return;
|
|
111
159
|
setSubmitting(false);
|
|
112
160
|
emitCapability("dialogOpen", null, signal.correlationId);
|
|
@@ -157,6 +205,11 @@ function PhiThreadsControllerView({ address, config, }) {
|
|
|
157
205
|
* A message landed in the open conversation, from the Reply dialog. The reader is asked to catch
|
|
158
206
|
* up rather than to switch, and the listing is stale because its order is by last activity.
|
|
159
207
|
*/
|
|
208
|
+
// A note in the member's file: the file panel catches up, and the listing, which leaves it out, is as it was.
|
|
209
|
+
if (fileThreadId != null && replyThreadId === fileThreadId) {
|
|
210
|
+
emitCapability("fileThreadReload", { threadId: fileThreadId }, signal.correlationId);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
160
213
|
reloadInbox(signal.correlationId);
|
|
161
214
|
emitCapability("threadReload", { threadId: openThreadId }, signal.correlationId);
|
|
162
215
|
return;
|
|
@@ -174,6 +227,10 @@ function PhiThreadsControllerView({ address, config, }) {
|
|
|
174
227
|
sendThread(readSelectedThreadId(signal.value), signal.correlationId);
|
|
175
228
|
return;
|
|
176
229
|
}
|
|
230
|
+
if (signal.channel === "member" && signal.action === "change") {
|
|
231
|
+
openMemberFile(readChosenMemberId(signal.value), signal.correlationId);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
177
234
|
if (signal.channel === "opened" && signal.action === "change") {
|
|
178
235
|
const opened = readPhiThreadSignalValue(signal.value)?.threadId ?? null;
|
|
179
236
|
if (opened != null)
|
|
@@ -184,8 +241,11 @@ function PhiThreadsControllerView({ address, config, }) {
|
|
|
184
241
|
closeDialog,
|
|
185
242
|
dialogFormAddresses,
|
|
186
243
|
emitCapability,
|
|
244
|
+
fileThreadId,
|
|
245
|
+
openMemberFile,
|
|
187
246
|
openThreadId,
|
|
188
247
|
reloadInbox,
|
|
248
|
+
replyThreadId,
|
|
189
249
|
resetForm,
|
|
190
250
|
sendThread,
|
|
191
251
|
submitting,
|
|
@@ -53,6 +53,36 @@ export const PHI_THREADS_RUNTIME_CONTROLLER_DEFINITION = {
|
|
|
53
53
|
valueType: "json",
|
|
54
54
|
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.threadSelection,
|
|
55
55
|
},
|
|
56
|
+
/*
|
|
57
|
+
* The member's file, on a customer file Page (THREADS.md, section 10): the file panel's conversation,
|
|
58
|
+
* apart from the one chosen in the listing, so the two readers never show each other's. Change when
|
|
59
|
+
* another member is chosen -- `{ threadId: null }` for nobody, or for the reader's own file, which
|
|
60
|
+
* Core refuses -- and reload after a note landed in it.
|
|
61
|
+
*/
|
|
62
|
+
{
|
|
63
|
+
id: "fileThreadChange",
|
|
64
|
+
action: "change",
|
|
65
|
+
valueType: "json",
|
|
66
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.threadSelection,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "fileThreadReload",
|
|
70
|
+
action: "reload",
|
|
71
|
+
valueType: "json",
|
|
72
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.threadSelection,
|
|
73
|
+
},
|
|
74
|
+
/*
|
|
75
|
+
* The member a customer file Page chose, as binding params (`{ params: { userId } }`, `null` for
|
|
76
|
+
* nobody), for a Collection View that shows something of theirs -- the addresses tiles: the choice
|
|
77
|
+
* forwarded to the View's `bindingParamsChange` (COLLECTIONS.md, "Filtered by another Widget's
|
|
78
|
+
* choice"), once per member chosen.
|
|
79
|
+
*/
|
|
80
|
+
{
|
|
81
|
+
id: "memberParamsChange",
|
|
82
|
+
action: "change",
|
|
83
|
+
valueType: "json",
|
|
84
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableBindingParams,
|
|
85
|
+
},
|
|
56
86
|
{ id: "dialogOpen", action: "activate", valueType: "none" },
|
|
57
87
|
{ id: "dialogClose", action: "close", valueType: "none" },
|
|
58
88
|
{ id: "formSubmit", action: "activate", valueType: "none" },
|
|
@@ -84,6 +114,24 @@ export const PHI_THREADS_RUNTIME_CONTROLLER_DEFINITION = {
|
|
|
84
114
|
valueType: "json",
|
|
85
115
|
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableSelection,
|
|
86
116
|
},
|
|
117
|
+
/*
|
|
118
|
+
* The member a customer file Page chose: its person Table's query, `filters.userId`. The file's id
|
|
119
|
+
* comes from the same read the Page's Tables make for that choice, joined rather than asked again
|
|
120
|
+
* (`readPhiCustomerFileThreadId`), and goes out as `fileThreadChange`; the member goes out as
|
|
121
|
+
* `memberParamsChange`.
|
|
122
|
+
*/
|
|
123
|
+
{
|
|
124
|
+
id: "memberChange",
|
|
125
|
+
channel: "member",
|
|
126
|
+
action: "change",
|
|
127
|
+
valueType: "json",
|
|
128
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableQuery,
|
|
129
|
+
},
|
|
130
|
+
/*
|
|
131
|
+
* A Table's action, and a conversation's Reply, which a conversation says as a row action with the
|
|
132
|
+
* thread as its row: routed here too, the reply that lands is known to be the file's or the open
|
|
133
|
+
* conversation's, and only that one is read again.
|
|
134
|
+
*/
|
|
87
135
|
{
|
|
88
136
|
id: "actionActivate",
|
|
89
137
|
channel: "action",
|
|
@@ -31,46 +31,11 @@ export declare const PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
31
31
|
type: "string";
|
|
32
32
|
required?: undefined;
|
|
33
33
|
})[];
|
|
34
|
-
|
|
35
|
-
search: false;
|
|
36
|
-
filterFields: string[];
|
|
37
|
-
sorting: "none";
|
|
38
|
-
pagination: "none";
|
|
39
|
-
total?: undefined;
|
|
40
|
-
};
|
|
41
|
-
rowActivation?: undefined;
|
|
42
|
-
} | {
|
|
43
|
-
resourceKey: "addresses";
|
|
44
|
-
title: string;
|
|
45
|
-
rowIdentityPath: string;
|
|
46
|
-
fields: ({
|
|
34
|
+
summaryFields: {
|
|
47
35
|
key: string;
|
|
48
36
|
title: string;
|
|
49
37
|
type: "number";
|
|
50
|
-
|
|
51
|
-
options?: undefined;
|
|
52
|
-
} | {
|
|
53
|
-
key: string;
|
|
54
|
-
title: string;
|
|
55
|
-
type: "string";
|
|
56
|
-
required?: undefined;
|
|
57
|
-
options?: undefined;
|
|
58
|
-
} | {
|
|
59
|
-
key: string;
|
|
60
|
-
title: string;
|
|
61
|
-
type: "enum[]";
|
|
62
|
-
options: {
|
|
63
|
-
value: string;
|
|
64
|
-
label: string;
|
|
65
|
-
}[];
|
|
66
|
-
required?: undefined;
|
|
67
|
-
} | {
|
|
68
|
-
key: string;
|
|
69
|
-
title: string;
|
|
70
|
-
type: "datetime";
|
|
71
|
-
required?: undefined;
|
|
72
|
-
options?: undefined;
|
|
73
|
-
})[];
|
|
38
|
+
}[];
|
|
74
39
|
query: {
|
|
75
40
|
search: false;
|
|
76
41
|
filterFields: string[];
|
|
@@ -119,5 +84,25 @@ export declare const PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
119
84
|
pagination: "offset";
|
|
120
85
|
total: false;
|
|
121
86
|
};
|
|
87
|
+
summaryFields?: undefined;
|
|
122
88
|
})[];
|
|
89
|
+
} | {
|
|
90
|
+
key: `${string}/${string}`;
|
|
91
|
+
ownerModuleId: "@phis/ui/modules/threads";
|
|
92
|
+
kind: "collection";
|
|
93
|
+
executionMode: "live";
|
|
94
|
+
authoringMode: "none";
|
|
95
|
+
title: string;
|
|
96
|
+
description: string;
|
|
97
|
+
resources: {
|
|
98
|
+
resourceKey: "addresses";
|
|
99
|
+
title: string;
|
|
100
|
+
itemIdentityPath: string;
|
|
101
|
+
itemRendererKey: `${string}/${string}`;
|
|
102
|
+
defaultForWidget: true;
|
|
103
|
+
query: {
|
|
104
|
+
search: false;
|
|
105
|
+
pagination: false;
|
|
106
|
+
};
|
|
107
|
+
}[];
|
|
123
108
|
})[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS, PHI_THREADS_RUNTIME_MODULE_ID, } from "./ids";
|
|
2
2
|
import { PhisThreadKind, PhisThreadStatus } from "../../../constants/threads";
|
|
3
3
|
import { PHI_CUSTOMER_FILE_RESOURCE_KEYS } from "../../../constants/customer-file";
|
|
4
|
+
import { PHI_SITE_ADDRESS_ITEM_RENDERER_KEY } from "../../../constants/site-address";
|
|
4
5
|
/** Who this viewer may write to, for this Module's own Form that opens a conversation. */
|
|
5
6
|
export const PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
6
7
|
{
|
|
@@ -14,11 +15,11 @@ export const PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
14
15
|
},
|
|
15
16
|
/*
|
|
16
17
|
* Staff's customer file on one member of the Site (`GET /api/site/members/{userId}/file`, for the
|
|
17
|
-
* holders of `accounting` or `support`): the person as the staff road of `users:v1` answers them,
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* holders of `accounting` or `support`): the person as the staff road of `users:v1` answers them, and
|
|
19
|
+
* the threads -- the person's file first, then every conversation they take part in that the actor
|
|
20
|
+
* sees. Two resources because a Table lists one kind of row; each reads the same route for the member
|
|
21
|
+
* its `userId` filter names, and none reads anything without one. Core writes every read to the Site's
|
|
22
|
+
* access log. Their addresses are the Collection below, from the same read.
|
|
22
23
|
*/
|
|
23
24
|
{
|
|
24
25
|
key: PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFile,
|
|
@@ -42,29 +43,13 @@ export const PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
42
43
|
{ key: "phone", title: "Business phone", type: "string" },
|
|
43
44
|
{ key: "mobile", title: "Mobile", type: "string" },
|
|
44
45
|
],
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
resourceKey: PHI_CUSTOMER_FILE_RESOURCE_KEYS.addresses,
|
|
49
|
-
title: "Addresses",
|
|
50
|
-
rowIdentityPath: "id",
|
|
51
|
-
fields: [
|
|
52
|
-
{ key: "id", title: "ID", type: "number", required: true },
|
|
53
|
-
{ key: "name", title: "Name", type: "string" },
|
|
54
|
-
{ key: "lines", title: "Address", type: "string" },
|
|
55
|
-
{
|
|
56
|
-
key: "purposes",
|
|
57
|
-
title: "Purposes",
|
|
58
|
-
type: "enum[]",
|
|
59
|
-
options: ["billing", "shipping", "defaultBilling", "defaultShipping"].map((value) => ({ value, label: value })),
|
|
60
|
-
},
|
|
61
|
-
{ key: "createdAt", title: "Added", type: "datetime" },
|
|
62
|
-
],
|
|
46
|
+
// The member's number, for the line under the person: the one Core, the access log and support name.
|
|
47
|
+
summaryFields: [{ key: "userId", title: "Member number", type: "number" }],
|
|
63
48
|
query: { search: false, filterFields: ["userId"], sorting: "none", pagination: "none" },
|
|
64
49
|
},
|
|
65
50
|
{
|
|
66
51
|
resourceKey: PHI_CUSTOMER_FILE_RESOURCE_KEYS.threads,
|
|
67
|
-
title: "
|
|
52
|
+
title: "Conversations",
|
|
68
53
|
rowIdentityPath: "id",
|
|
69
54
|
// Choosing one opens it in the conversation beside the list, as the inbox does.
|
|
70
55
|
rowActivation: true,
|
|
@@ -95,4 +80,30 @@ export const PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
95
80
|
},
|
|
96
81
|
],
|
|
97
82
|
},
|
|
83
|
+
/*
|
|
84
|
+
* The member's current addresses, where the actor may read them, as Core's address tiles draw them
|
|
85
|
+
* (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`): read-only, so the resource declares no action and the tiles
|
|
86
|
+
* offer none. The member is the binding param `userId`, which the Conversations Controller forwards from
|
|
87
|
+
* the person Table's choice (COLLECTIONS.md, "Filtered by another Widget's choice"), and the answer is the
|
|
88
|
+
* same request the Tables and the Controller make for that choice, joined (`readPhiCustomerFile`).
|
|
89
|
+
*/
|
|
90
|
+
{
|
|
91
|
+
key: PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFileAddresses,
|
|
92
|
+
ownerModuleId: PHI_THREADS_RUNTIME_MODULE_ID,
|
|
93
|
+
kind: "collection",
|
|
94
|
+
executionMode: "live",
|
|
95
|
+
authoringMode: "none",
|
|
96
|
+
title: "Customer file addresses",
|
|
97
|
+
description: "The chosen member's current billing and shipping addresses, as staff may read them.",
|
|
98
|
+
resources: [
|
|
99
|
+
{
|
|
100
|
+
resourceKey: PHI_CUSTOMER_FILE_RESOURCE_KEYS.addresses,
|
|
101
|
+
title: "Addresses",
|
|
102
|
+
itemIdentityPath: "id",
|
|
103
|
+
itemRendererKey: PHI_SITE_ADDRESS_ITEM_RENDERER_KEY,
|
|
104
|
+
defaultForWidget: true,
|
|
105
|
+
query: { search: false, pagination: false },
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
98
109
|
];
|
|
@@ -53,46 +53,11 @@ export declare const PHI_THREADS_RUNTIME_MODULE_DEFINITION: {
|
|
|
53
53
|
type: "string";
|
|
54
54
|
required?: undefined;
|
|
55
55
|
})[];
|
|
56
|
-
|
|
57
|
-
search: false;
|
|
58
|
-
filterFields: string[];
|
|
59
|
-
sorting: "none";
|
|
60
|
-
pagination: "none";
|
|
61
|
-
total?: undefined;
|
|
62
|
-
};
|
|
63
|
-
rowActivation?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
resourceKey: "addresses";
|
|
66
|
-
title: string;
|
|
67
|
-
rowIdentityPath: string;
|
|
68
|
-
fields: ({
|
|
56
|
+
summaryFields: {
|
|
69
57
|
key: string;
|
|
70
58
|
title: string;
|
|
71
59
|
type: "number";
|
|
72
|
-
|
|
73
|
-
options?: undefined;
|
|
74
|
-
} | {
|
|
75
|
-
key: string;
|
|
76
|
-
title: string;
|
|
77
|
-
type: "string";
|
|
78
|
-
required?: undefined;
|
|
79
|
-
options?: undefined;
|
|
80
|
-
} | {
|
|
81
|
-
key: string;
|
|
82
|
-
title: string;
|
|
83
|
-
type: "enum[]";
|
|
84
|
-
options: {
|
|
85
|
-
value: string;
|
|
86
|
-
label: string;
|
|
87
|
-
}[];
|
|
88
|
-
required?: undefined;
|
|
89
|
-
} | {
|
|
90
|
-
key: string;
|
|
91
|
-
title: string;
|
|
92
|
-
type: "datetime";
|
|
93
|
-
required?: undefined;
|
|
94
|
-
options?: undefined;
|
|
95
|
-
})[];
|
|
60
|
+
}[];
|
|
96
61
|
query: {
|
|
97
62
|
search: false;
|
|
98
63
|
filterFields: string[];
|
|
@@ -141,7 +106,27 @@ export declare const PHI_THREADS_RUNTIME_MODULE_DEFINITION: {
|
|
|
141
106
|
pagination: "offset";
|
|
142
107
|
total: false;
|
|
143
108
|
};
|
|
109
|
+
summaryFields?: undefined;
|
|
144
110
|
})[];
|
|
111
|
+
} | {
|
|
112
|
+
key: `${string}/${string}`;
|
|
113
|
+
ownerModuleId: "@phis/ui/modules/threads";
|
|
114
|
+
kind: "collection";
|
|
115
|
+
executionMode: "live";
|
|
116
|
+
authoringMode: "none";
|
|
117
|
+
title: string;
|
|
118
|
+
description: string;
|
|
119
|
+
resources: {
|
|
120
|
+
resourceKey: "addresses";
|
|
121
|
+
title: string;
|
|
122
|
+
itemIdentityPath: string;
|
|
123
|
+
itemRendererKey: `${string}/${string}`;
|
|
124
|
+
defaultForWidget: true;
|
|
125
|
+
query: {
|
|
126
|
+
search: false;
|
|
127
|
+
pagination: false;
|
|
128
|
+
};
|
|
129
|
+
}[];
|
|
145
130
|
})[];
|
|
146
131
|
formProviders: {
|
|
147
132
|
handlers: {
|
|
@@ -17,4 +17,6 @@ export declare const PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS: {
|
|
|
17
17
|
readonly candidates: `${string}/${string}`;
|
|
18
18
|
/** Staff's customer file on one member, the Foundation name (`constants/customer-file.ts`). */
|
|
19
19
|
readonly customerFile: `${string}/${string}`;
|
|
20
|
+
/** The member's addresses as tiles, the Foundation name too. */
|
|
21
|
+
readonly customerFileAddresses: `${string}/${string}`;
|
|
20
22
|
};
|
|
@@ -22,4 +22,6 @@ export const PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS = {
|
|
|
22
22
|
candidates: createPhiSharedRuntimeDataProviderKey("options", "thread-candidates"),
|
|
23
23
|
/** Staff's customer file on one member, the Foundation name (`constants/customer-file.ts`). */
|
|
24
24
|
customerFile: PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS.table,
|
|
25
|
+
/** The member's addresses as tiles, the Foundation name too. */
|
|
26
|
+
customerFileAddresses: PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS.addresses,
|
|
25
27
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PhiCollectionProviderData, PhiCollectionProviderQueryRequest } from "../../../../types/collection-provider";
|
|
2
|
+
/**
|
|
3
|
+
* The chosen member's addresses, read-only, as tiles (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`): from the first
|
|
4
|
+
* page of their file, the request the person Table, the conversations Table and the Conversations Controller
|
|
5
|
+
* make for the same choice -- joined, never asked again (`readPhiCustomerFile`), so one choice is still one
|
|
6
|
+
* entry in the access log. The member is the binding param `userId` the Controller forwards.
|
|
7
|
+
*
|
|
8
|
+
* Nobody chosen reads nothing. The reader's own file, which Core refuses, answers no addresses with the
|
|
9
|
+
* Page's own-file sentence as the tiles' empty sentence (`meta.emptyDescription`), as each Table says it
|
|
10
|
+
* where its rows would be; any other failure is the source's.
|
|
11
|
+
*/
|
|
12
|
+
export declare function queryPhiCustomerFileAddresses({ resourceKey, params, signal }: PhiCollectionProviderQueryRequest): Promise<PhiCollectionProviderData>;
|
|
13
|
+
export declare const PHI_THREADS_CUSTOMER_FILE_ADDRESSES_PROVIDER_REGISTRATION: {
|
|
14
|
+
key: `${string}/${string}`;
|
|
15
|
+
resources: {
|
|
16
|
+
resourceKey: "addresses";
|
|
17
|
+
title: string;
|
|
18
|
+
itemIdentityPath: string;
|
|
19
|
+
itemRendererKey: `${string}/${string}`;
|
|
20
|
+
defaultForWidget: true;
|
|
21
|
+
query: {
|
|
22
|
+
search: false;
|
|
23
|
+
pagination: false;
|
|
24
|
+
};
|
|
25
|
+
}[];
|
|
26
|
+
query: typeof queryPhiCustomerFileAddresses;
|
|
27
|
+
};
|
|
28
|
+
export declare const PhiThreadsCustomerFileAddressesProviderClient: import("react").ComponentType<{
|
|
29
|
+
children: import("react").ReactNode;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
3
|
+
import { readPhiPositiveInteger, readPhiTableRows, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
|
|
4
|
+
import { createPhiCollectionProviderClient, } from "../../../../components/widgets/client/shared/phi-collection-provider";
|
|
5
|
+
import { toPhiSiteAddressRow } from "../../../../helpers/site-address-row";
|
|
6
|
+
import { PHI_CUSTOMER_FILE_MEMBER_PARAM, PHI_CUSTOMER_FILE_OWN_FILE_PARAM, PHI_CUSTOMER_FILE_RESOURCE_KEYS as RESOURCES, } from "../../../../constants/customer-file";
|
|
7
|
+
import { PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "../data-providers";
|
|
8
|
+
import { PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
|
|
9
|
+
import { buildPhiCustomerFileFirstPagePath, PhiCustomerFileOwnFileRefusal, readPhiCustomerFile, } from "./customer-file-read";
|
|
10
|
+
function answer(items, emptyDescription) {
|
|
11
|
+
return {
|
|
12
|
+
resourceKey: RESOURCES.addresses,
|
|
13
|
+
items,
|
|
14
|
+
total: items.length,
|
|
15
|
+
loading: false,
|
|
16
|
+
error: null,
|
|
17
|
+
...(emptyDescription ? { meta: { emptyDescription } } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The chosen member's addresses, read-only, as tiles (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`): from the first
|
|
22
|
+
* page of their file, the request the person Table, the conversations Table and the Conversations Controller
|
|
23
|
+
* make for the same choice -- joined, never asked again (`readPhiCustomerFile`), so one choice is still one
|
|
24
|
+
* entry in the access log. The member is the binding param `userId` the Controller forwards.
|
|
25
|
+
*
|
|
26
|
+
* Nobody chosen reads nothing. The reader's own file, which Core refuses, answers no addresses with the
|
|
27
|
+
* Page's own-file sentence as the tiles' empty sentence (`meta.emptyDescription`), as each Table says it
|
|
28
|
+
* where its rows would be; any other failure is the source's.
|
|
29
|
+
*/
|
|
30
|
+
export async function queryPhiCustomerFileAddresses({ resourceKey, params, signal }) {
|
|
31
|
+
if (resourceKey !== RESOURCES.addresses) {
|
|
32
|
+
throw new Error(`Unknown customer file addresses resource "${resourceKey}".`);
|
|
33
|
+
}
|
|
34
|
+
const userId = readPhiPositiveInteger(params?.[PHI_CUSTOMER_FILE_MEMBER_PARAM]);
|
|
35
|
+
if (!userId)
|
|
36
|
+
return answer([]);
|
|
37
|
+
try {
|
|
38
|
+
const result = await readPhiCustomerFile(buildPhiCustomerFileFirstPagePath(userId), signal);
|
|
39
|
+
if (!isPhiRecord(result) || !isPhiRecord(result.person)) {
|
|
40
|
+
throw new Error("The customer file answer is invalid.");
|
|
41
|
+
}
|
|
42
|
+
return answer(readPhiTableRows(result.person.addresses).map(toPhiSiteAddressRow));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (!(error instanceof PhiCustomerFileOwnFileRefusal))
|
|
46
|
+
throw error;
|
|
47
|
+
const notice = params?.[PHI_CUSTOMER_FILE_OWN_FILE_PARAM];
|
|
48
|
+
return answer([], typeof notice === "string" && notice.trim() ? notice : error.message);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const descriptor = PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS
|
|
52
|
+
.find((candidate) => candidate.key === PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFileAddresses);
|
|
53
|
+
const resources = descriptor?.kind === "collection" ? descriptor.resources : [];
|
|
54
|
+
export const PHI_THREADS_CUSTOMER_FILE_ADDRESSES_PROVIDER_REGISTRATION = {
|
|
55
|
+
key: PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFileAddresses,
|
|
56
|
+
resources,
|
|
57
|
+
query: queryPhiCustomerFileAddresses,
|
|
58
|
+
};
|
|
59
|
+
export const PhiThreadsCustomerFileAddressesProviderClient = createPhiCollectionProviderClient(PHI_THREADS_CUSTOMER_FILE_ADDRESSES_PROVIDER_REGISTRATION);
|