@phis/ui 0.4.20 → 0.4.22

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.
Files changed (102) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +1 -1
  2. package/components/controls/phi-brand-control.d.ts +4 -1
  3. package/components/controls/phi-brand-control.js +10 -6
  4. package/components/controls/phi-cascader-control.js +6 -1
  5. package/components/controls/phi-geometry-control.d.ts +33 -1
  6. package/components/controls/phi-geometry-control.js +87 -29
  7. package/components/controls/phi-series-chart-control.js +4 -2
  8. package/components/forms/form-provider-contract.d.ts +1 -0
  9. package/components/forms/form-provider-contract.js +1 -0
  10. package/components/forms/upload-form-control.js +1 -0
  11. package/components/layouts/clients/phi-flex-layout-client.js +23 -5
  12. package/components/layouts/clients/phi-grid-layout-client.js +20 -10
  13. package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
  14. package/components/layouts/clients/phi-layout-anchored-overlay.js +9 -2
  15. package/components/layouts/clients/phi-three-column-layout-client.js +7 -4
  16. package/components/layouts/layout-definitions.d.ts +16 -16
  17. package/components/layouts/layout-definitions.js +8 -8
  18. package/components/layouts/phi-base-layout.js +13 -9
  19. package/components/layouts/phi-layout-contract.d.ts +12 -2
  20. package/components/layouts/phi-layout-contract.js +30 -7
  21. package/components/layouts/phi-masonry-layout.d.ts +6 -0
  22. package/components/layouts/phi-masonry-layout.js +13 -3
  23. package/components/layouts/plugins/masonry-layout-plugin.js +2 -1
  24. package/components/media/asset-collection-runtime.d.ts +1 -6
  25. package/components/media/asset-collection-runtime.js +2 -93
  26. package/components/media/label-sets/media.js +12 -0
  27. package/components/media/media-folder-lock.d.ts +19 -0
  28. package/components/media/media-folder-lock.js +40 -0
  29. package/components/media/media-folder-options.d.ts +14 -2
  30. package/components/media/media-folder-options.js +17 -5
  31. package/components/media/media-widget-labels.d.ts +9 -0
  32. package/components/media/media-widget-labels.js +6 -0
  33. package/components/media/phi-area-upload-widget.js +1 -0
  34. package/components/media/phi-asset-folder-control.d.ts +14 -1
  35. package/components/media/phi-asset-folder-control.js +11 -4
  36. package/components/media/phi-image-preview-store.d.ts +0 -4
  37. package/components/media/phi-image-preview-store.js +0 -10
  38. package/components/media/phi-media-picker-binding.d.ts +7 -2
  39. package/components/media/phi-media-upload.d.ts +2 -0
  40. package/components/media/phi-media-upload.js +3 -0
  41. package/components/regions/clients/cms-region-container-client.d.ts +3 -1
  42. package/components/regions/clients/cms-region-container-client.js +4 -3
  43. package/components/regions/phi-cms-region-container.d.ts +3 -1
  44. package/components/regions/phi-cms-region-container.js +3 -2
  45. package/components/regions/phi-cms-region-shell.d.ts +9 -1
  46. package/components/regions/phi-cms-region-shell.js +3 -1
  47. package/components/regions/phi-cms-region-static.d.ts +3 -1
  48. package/components/regions/phi-cms-region-static.js +3 -2
  49. package/components/regions/presets/navigation-redirect.d.ts +2 -2
  50. package/components/regions/presets/navigation-redirect.js +5 -3
  51. package/components/shell/phi-antd-icon.d.ts +2 -0
  52. package/components/shell/phi-antd-icon.js +6 -0
  53. package/components/widgets/label-sets/geometry.js +10 -0
  54. package/components/widgets/label-types/geometry.d.ts +7 -0
  55. package/components/widgets/label-types/geometry.js +6 -0
  56. package/helpers/block-geometry-profiles.d.ts +67 -0
  57. package/helpers/block-geometry-profiles.js +105 -0
  58. package/helpers/cms-navigation-catalog.js +4 -2
  59. package/helpers/renderable-block-effects.js +16 -0
  60. package/package.json +1 -1
  61. package/plugins/runtime/phi-slot-child-frame-view.js +14 -4
  62. package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +42 -2
  63. package/plugins/runtime/slot-size-policy.d.ts +15 -0
  64. package/plugins/runtime/slot-size-policy.js +29 -0
  65. package/plugins/runtime-modules/asset/data-providers.js +3 -0
  66. package/plugins/runtime-modules/asset/services/collection.js +34 -0
  67. package/plugins/runtime-modules/asset/services/options.js +19 -2
  68. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +9 -0
  69. package/plugins/runtime-modules/auth/trees/phi-auth-runtime-page-tree.js +21 -17
  70. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/client.js +2 -0
  71. package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
  72. package/plugins/runtime-modules/builder/render-root-node-preview.server.js +2 -1
  73. package/plugins/runtime-modules/builder/services/navigation-table.js +3 -2
  74. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +7 -1
  75. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +8 -2
  76. package/plugins/runtime-modules/core/messaging/data-providers.js +23 -0
  77. package/plugins/runtime-modules/core/messaging/labels.d.ts +2 -0
  78. package/plugins/runtime-modules/core/messaging/labels.js +8 -0
  79. package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +32 -0
  80. package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +31 -16
  81. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +52 -6
  82. package/plugins/runtime-modules/core/widgets/quick-links/client.js +1 -1
  83. package/plugins/runtime-modules/core/widgets/thread-conversation/client.d.ts +3 -0
  84. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +8 -2
  85. package/plugins/runtime-modules/descriptor-compiler.js +45 -2
  86. package/plugins/runtime-modules/public/presets.d.ts +1 -1
  87. package/plugins/runtime-modules/public/presets.js +1 -0
  88. package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +8 -14
  89. package/plugins/runtime-modules/search/widgets/search-box/client.d.ts +2 -1
  90. package/plugins/runtime-modules/search/widgets/search-box/client.js +28 -6
  91. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +19 -2
  92. package/plugins/runtime-modules/threads/labels.d.ts +6 -0
  93. package/plugins/runtime-modules/threads/labels.js +16 -0
  94. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +24 -1
  95. package/styles/layout.css +101 -0
  96. package/styles/root.css +2 -1
  97. package/types/cms-config.d.ts +5 -1
  98. package/types/cms-config.js +1 -0
  99. package/types/cms-module-descriptors.d.ts +17 -0
  100. package/types/renderable-block.d.ts +5 -0
  101. package/types/site-theme.d.ts +9 -1
  102. package/types.d.ts +1 -1
@@ -1,20 +1,22 @@
1
1
  import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
2
2
  import { PHI_AUTH_RUNTIME_MODULE_ID } from "../ids";
3
3
  import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../../constants/cms-layout-types";
4
- import { PhiCmsFlags, PhiCmsPageType, PhiCmsRegionType } from "../../../../constants/phi-cms";
4
+ import { PhiCmsFlags, PhiCmsPageType } from "../../../../constants/phi-cms";
5
+ import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID, } from "../../../../components/regions/presets/phi-base-page-layout";
5
6
  import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
6
7
  export function buildPhiAuthRuntimePageTree({ page, presetKey, widgetTypeKey, label, }) {
7
8
  const layouts = createPhiPresetCmsInstanceIdMap({
8
9
  domain: "page",
9
10
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
10
11
  presetKey,
11
- }, ["layoutRoot"]);
12
+ }, ["layoutCentre"]);
12
13
  const widgets = createPhiPresetCmsInstanceIdMap({
13
14
  domain: "page",
14
15
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
15
16
  presetKey,
16
17
  }, ["widgetMain"]);
17
18
  const nodes = createPhiCmsPresetNodes(page);
19
+ const scaffold = buildPhiBasePageContentScaffold({ page, regionId: -483 });
18
20
  return {
19
21
  page: nodes.page({ pageType: PhiCmsPageType.Standard }),
20
22
  pageMeta: {
@@ -22,27 +24,29 @@ export function buildPhiAuthRuntimePageTree({ page, presetKey, widgetTypeKey, la
22
24
  description: null,
23
25
  },
24
26
  overlays: [],
25
- regions: [nodes.region({
26
- id: -483,
27
- regionType: PhiCmsRegionType.Content,
28
- rootLayoutNodeId: layouts.layoutRoot,
29
- sortOrder: 30,
30
- config: {},
31
- })],
32
- layoutNodes: [nodes.layout({
33
- id: layouts.layoutRoot,
34
- parentLayoutNodeId: null,
35
- creationPreset: { layoutKind: "content", preset: "panel" },
36
- typeKey: "content",
27
+ regions: [scaffold.region],
28
+ layoutNodes: [
29
+ // The base scaffold every module Page stands on.
30
+ scaffold.layoutNode,
31
+ /*
32
+ * The sign-out stands in the middle of the screen, where the scaffold alone would put it at the
33
+ * top: a vertical Flex that fills the scaffold and centres its one Widget both ways. No panel preset,
34
+ * so it adds no padding to the scaffold's.
35
+ */
36
+ nodes.layout({
37
+ typeKey: "flex-vertical",
38
+ id: layouts.layoutCentre,
39
+ parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
37
40
  slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
38
41
  sortOrder: 0,
39
42
  label,
40
- config: {},
41
- })],
43
+ config: { anchor: { horizontal: "center", vertical: "middle" } },
44
+ }),
45
+ ],
42
46
  contentWidgets: [nodes.widget({
43
47
  typeKey: widgetTypeKey,
44
48
  id: widgets.widgetMain,
45
- parentLayoutNodeId: layouts.layoutRoot,
49
+ parentLayoutNodeId: layouts.layoutCentre,
46
50
  slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
47
51
  sortOrder: 0,
48
52
  label,
@@ -46,6 +46,8 @@ export function PhiAccountAvatarPickerWidgetClient({ labels, config, }) {
46
46
  errorQuotaExceeded: labels.feedback.errorQuotaExceeded,
47
47
  errorSpaceUnavailable: labels.feedback.errorSpaceUnavailable,
48
48
  errorStorageUnreachable: labels.feedback.errorStorageUnreachable,
49
+ // An avatar is written into the person's own Space and names no Folder, so no lock can refuse it.
50
+ errorFolderLocked: labels.feedback.errorGeneric,
49
51
  }), [labels]);
50
52
  const { accept, items, upload } = usePhiMediaUpload({
51
53
  labels: uploadLabels,
@@ -58,7 +58,7 @@ export function PhiDeveloperBuilderRegionInspectorWidgetClient({ section, builde
58
58
  {
59
59
  key: "geometry",
60
60
  title: "Geometry",
61
- children: (_jsxs("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: [_jsx(PhiGeometryControl, { mode: "control", disabled: isPreviewMode, showViewport: false, showSticky: stickyEdge !== null, showOffsetTop: stickyEdge === "top", value: effectiveDraft, onChange: (geometry) => updateDraft(geometry), labels: geometryLabels }), stickyEdge === "bottom" ? renderPhiInspectorConfigField({
61
+ children: (_jsxs("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: [_jsx(PhiGeometryControl, { mode: "control", disabled: isPreviewMode, showViewport: false, showProfiles: false, showSticky: stickyEdge !== null, showOffsetTop: stickyEdge === "top", value: effectiveDraft, onChange: (geometry) => updateDraft(geometry), labels: geometryLabels }), stickyEdge === "bottom" ? renderPhiInspectorConfigField({
62
62
  field: { key: "offsetBottom", type: "length", label: geometryLabels?.fields.offsetBottom ?? "Offset bottom", min: 0 },
63
63
  value: effectiveDraft.regionConfig?.offsetBottom,
64
64
  defaultValue: undefined,
@@ -8,6 +8,7 @@ import { getPhiBuilderRegionDraftKey } from "./region-keys";
8
8
  import { normalizePhiBuilderRootNodeDraft, readPhiBuilderRootNodeDraft, } from "./root-node-normalization";
9
9
  import { resolvePhiRenderableBlockGeometry } from "../../../types/renderable-block-geometry";
10
10
  import { resolvePhiRootScaffoldProperties } from "./builder-geometry";
11
+ import { phiBlockGeometryQueriesRoom, phiSlotContainerAttributes, } from "../../../helpers/block-geometry-profiles";
11
12
  import { buildPhiBuilderRootNodeRenderableTree } from "./root-node-renderable-tree";
12
13
  import { normalizePhiPaddingWidgetConfig } from "../../../types/cms-config";
13
14
  import { resolvePhiPaddingStyle } from "../../../components/layouts/phi-layout-contract";
@@ -150,7 +151,7 @@ async function PhiBuilderRootNodeServerPreview({ rootNode, runtime, regionType =
150
151
  : undefined, className: "phi-cms-region-shell phi-cms-region-shell--fill", style: {
151
152
  width: "100%",
152
153
  height: "100%",
153
- }, children: _jsx("div", { className: "phi-cms-region-shell__content", style: regionPaddingStyle, children: _jsx(PhiSlotChildFrame, { className: "phi-builder-root-scaffold__slot", kind: rootSlotChildKind, blockId: rootNode.id ?? null, explicitInlineSize: rootGeometry.explicitInline, explicitBlockSize: rootGeometry.explicitBlock, style: resolvePhiRootScaffoldProperties(rootGeometry), children: _jsx(PhiCmsLayoutRenderer, { tree: {
154
+ }, children: _jsx("div", { className: "phi-cms-region-shell__content", ...phiSlotContainerAttributes(phiBlockGeometryQueriesRoom(rootGeometry)), style: regionPaddingStyle, children: _jsx(PhiSlotChildFrame, { className: "phi-builder-root-scaffold__slot", kind: rootSlotChildKind, blockId: rootNode.id ?? null, explicitInlineSize: rootGeometry.explicitInline, explicitBlockSize: rootGeometry.explicitBlock, style: resolvePhiRootScaffoldProperties(rootGeometry), children: _jsx(PhiCmsLayoutRenderer, { tree: {
154
155
  ...previewTree,
155
156
  regions: previewTree.regions.map((region) => ({
156
157
  ...region,
@@ -81,7 +81,8 @@ function flattenNavigationRows(items, moduleTitles, paths, parentId = null, hidd
81
81
  hidden: item.hidden,
82
82
  hiddenByAncestor,
83
83
  external: item.external === true,
84
- newTabEditable: item.kind === "link",
84
+ // A Module entry's new-tab choice is the Module's: an item override carries no `newTab`.
85
+ newTabEditable: item.kind === "link" && item.source === "custom",
85
86
  newTab: item.newTab === true,
86
87
  }, ...flattenNavigationRows(item.children, moduleTitles, paths, item.id, hiddenByAncestor || item.hidden)];
87
88
  });
@@ -415,7 +416,7 @@ export function PhiBuilderNavigationTableProviderClient({ children }) {
415
416
  patch.icon = request.proposedValue || null;
416
417
  }
417
418
  else if (request.fieldKey === "newTab" && typeof request.proposedValue === "boolean" &&
418
- item.kind === "link")
419
+ item.kind === "link" && item.source === "custom")
419
420
  patch.newTab = request.proposedValue;
420
421
  else
421
422
  return { status: "rejected", invalidation: "none", errorCode: "field-readonly", message: "Navigation field cannot be changed." };
@@ -469,6 +469,11 @@ export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
469
469
  paddingTop: 0,
470
470
  },
471
471
  }),
472
+ /*
473
+ * A Shell Region's root, not a Page column: the Page-column rule (THIRD_PARTY_MODULES.md, 6b) and
474
+ * the base scaffold govern the `content` Region only. The Builder's footer ships empty, and the
475
+ * Content Layout is the neutral one-slot frame an author fills from the Shells canvas.
476
+ */
472
477
  nodes.layout({
473
478
  typeKey: "content",
474
479
  id: SYNTHETIC_DEV_LAYOUT_IDS.layoutFooterMain,
@@ -951,7 +956,8 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
951
956
  },
952
957
  }
953
958
  : {
954
- typeKey: "content",
959
+ creationPreset: { layoutKind: "verticalflex", preset: "panel" },
960
+ typeKey: "flex-vertical",
955
961
  id: SYNTHETIC_DEV_LAYOUT_IDS.layoutContent,
956
962
  siteId: page.siteId,
957
963
  parentLayoutNodeId: null,
@@ -13,6 +13,7 @@ import { combinePhiBoxShadows, resolvePhiShadow } from "../../../../../helpers/l
13
13
  import { readPhiCmsInstanceId } from "../../../../../types/cms-instance-id";
14
14
  import { normalizePhiPaddingWidgetConfig } from "../../../../../types/cms-config";
15
15
  import { readPhiRenderableBlockLength, resolvePhiRenderableBlockGeometry, } from "../../../../../types/renderable-block-geometry";
16
+ import { phiBlockGeometryQueriesRoom, phiSlotContainerAttributes, } from "../../../../../helpers/block-geometry-profiles";
16
17
  import { extractPhiStructureNode as extractStructureNode, swapPhiStructureWidgetsAcrossTrees, swapPhiStructureWidgetsInTree, } from "../../../../../helpers/structure-widget-swap";
17
18
  import { createPhiSignalAddress, } from "../../../../../types/signals";
18
19
  import { resolvePhiShellRegionTypography, resolvePhiShellRegionZIndex } from "../../../../../helpers/shell-region-style";
@@ -423,6 +424,11 @@ export function PhiStructureRegionScaffold({ config, serverPreview, structureDra
423
424
  : undefined;
424
425
  const rootNode = effectiveDraft?.rootNode ?? null;
425
426
  const rootNodeId = rootNode?.id ?? null;
427
+ /*
428
+ * The Region slot is the room a profiled root Layout is offered on the Canvas, as the Region's content
429
+ * wrapper is on the page (LAYOUTING.md, "Block geometry per profile").
430
+ */
431
+ const rootSlotContainerAttributes = phiSlotContainerAttributes(phiBlockGeometryQueriesRoom(resolvePhiRenderableBlockGeometry(rootNode?.config)));
426
432
  const rootNodeKind = rootNode ? "layout" : null;
427
433
  const rootNodeTypeKey = rootNode?.widgetType ?? "";
428
434
  const rootNodeChildLayouts = readPhiBuilderRegionRootChildLayouts(effectiveDraft);
@@ -1200,7 +1206,7 @@ export function PhiStructureRegionScaffold({ config, serverPreview, structureDra
1200
1206
  : shouldStretchAvailableHeight
1201
1207
  ? "100%"
1202
1208
  : undefined;
1203
- return (_jsx("div", { "data-phi-region-slot": config.regionKey, [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: config.regionKey, className: joinPhiClassNames("phi-builder-structure-region__slot", regionToneClassName), "data-phi-builder-region-mode": "preview", "data-phi-builder-region-has-root-node": hasRootNode ? "true" : "false", "data-phi-builder-region-selected": "false", "data-phi-builder-region-picking": "false", style: {
1209
+ return (_jsx("div", { "data-phi-region-slot": config.regionKey, [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: config.regionKey, className: joinPhiClassNames("phi-builder-structure-region__slot", regionToneClassName), ...rootSlotContainerAttributes, "data-phi-builder-region-mode": "preview", "data-phi-builder-region-has-root-node": hasRootNode ? "true" : "false", "data-phi-builder-region-selected": "false", "data-phi-builder-region-picking": "false", style: {
1204
1210
  width: slotWidth,
1205
1211
  minWidth: slotMinWidth,
1206
1212
  maxWidth: slotMaxWidth,
@@ -1264,7 +1270,7 @@ export function PhiStructureRegionScaffold({ config, serverPreview, structureDra
1264
1270
  event.preventDefault();
1265
1271
  selectRegion();
1266
1272
  }
1267
- }, children: [isPreviewMode ? null : (_jsxs(PhiFlexControl, { vertical: true, gap: 0, style: { minWidth: 0, width: "100%" }, children: [_jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: false, style: { minWidth: 0, width: "100%", whiteSpace: "nowrap" }, children: [_jsx(PhiTypographyControl, { strong: true, style: { minWidth: 0, whiteSpace: "nowrap" }, children: config.title }), _jsxs(PhiTypographyControl, { type: "secondary", style: { minWidth: 0, whiteSpace: "nowrap" }, children: ["\u00B7 ", config.regionKey] })] }), config.subtitle ? (_jsx(PhiTypographyControl, { type: "secondary", style: { display: "block", whiteSpace: "normal", overflowWrap: "anywhere" }, children: config.subtitle })) : null] })), renderRegionPicker(_jsx("div", { ref: setRootDropNodeRef, "data-phi-region-slot": config.regionKey, className: joinPhiClassNames("phi-builder-structure-region__slot", regionToneClassName), "data-phi-builder-region-mode": "editor", "data-phi-structure-drop-state": rootDropAccepted
1273
+ }, children: [isPreviewMode ? null : (_jsxs(PhiFlexControl, { vertical: true, gap: 0, style: { minWidth: 0, width: "100%" }, children: [_jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: false, style: { minWidth: 0, width: "100%", whiteSpace: "nowrap" }, children: [_jsx(PhiTypographyControl, { strong: true, style: { minWidth: 0, whiteSpace: "nowrap" }, children: config.title }), _jsxs(PhiTypographyControl, { type: "secondary", style: { minWidth: 0, whiteSpace: "nowrap" }, children: ["\u00B7 ", config.regionKey] })] }), config.subtitle ? (_jsx(PhiTypographyControl, { type: "secondary", style: { display: "block", whiteSpace: "normal", overflowWrap: "anywhere" }, children: config.subtitle })) : null] })), renderRegionPicker(_jsx("div", { ref: setRootDropNodeRef, "data-phi-region-slot": config.regionKey, className: joinPhiClassNames("phi-builder-structure-region__slot", regionToneClassName), ...rootSlotContainerAttributes, "data-phi-builder-region-mode": "editor", "data-phi-structure-drop-state": rootDropAccepted
1268
1274
  ? "accepted"
1269
1275
  : rootDropIsOver
1270
1276
  ? "rejected"
@@ -70,8 +70,11 @@ export const PHI_CORE_MESSAGING_DATA_PROVIDER_DESCRIPTORS = [
70
70
  { value: "unread", label: "New" },
71
71
  { value: "open", label: "Open" },
72
72
  { value: "archived", label: "Archived" },
73
+ { value: "locked", label: "Locked" },
73
74
  ] },
74
75
  { key: "archived", title: "Archived", type: "boolean" },
76
+ // `PhisThreadFlag.Locked`, read off the row's flags: Core takes no new message into it.
77
+ { key: "locked", title: "Locked", type: "boolean" },
75
78
  { key: "unread", title: "Unread", type: "boolean" },
76
79
  { key: "latestMessageAt", title: "Last activity", type: "datetime" },
77
80
  { key: "updatedAt", title: "Changed", type: "datetime" },
@@ -113,6 +116,26 @@ export const PHI_CORE_MESSAGING_DATA_PROVIDER_DESCRIPTORS = [
113
116
  intent: "write",
114
117
  visibleWhen: { source: "row", valuePath: "archived", operator: "truthy" },
115
118
  },
119
+ /*
120
+ * The lock is not the archive: a locked conversation stays where it is and stays readable, it
121
+ * only takes nothing new. It asks first for the same reason archiving does -- it reaches
122
+ * everybody in it -- and unlocking, the way back, asks nothing.
123
+ */
124
+ {
125
+ key: "lock",
126
+ title: "Lock",
127
+ scope: "row",
128
+ intent: "write",
129
+ confirmation: "required",
130
+ visibleWhen: { source: "row", valuePath: "locked", operator: "falsy" },
131
+ },
132
+ {
133
+ key: "unlock",
134
+ title: "Unlock",
135
+ scope: "row",
136
+ intent: "write",
137
+ visibleWhen: { source: "row", valuePath: "locked", operator: "truthy" },
138
+ },
116
139
  ],
117
140
  },
118
141
  ],
@@ -28,6 +28,8 @@ export declare function getPhiThreadConversationLabels(options: PhiGlobalTransla
28
28
  subjectFallback: string;
29
29
  olderLabel: string;
30
30
  archivedLabel: string;
31
+ lockedLabel: string;
32
+ lockedText: string;
31
33
  replyLabel: string;
32
34
  participantsLabel: string;
33
35
  internalLabel: string;
@@ -19,6 +19,12 @@ const PHI_THREAD_CONVERSATION_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_COR
19
19
  subject_fallback: "Conversation",
20
20
  older_label: "Show earlier messages",
21
21
  archived_label: "Archived",
22
+ locked_label: "Locked",
23
+ /*
24
+ * Where the Reply would have been. A locked conversation takes no new message from anybody, so the
25
+ * way to write one is not offered at all rather than offered and then refused.
26
+ */
27
+ locked_text: definePhiMessageLabel("This conversation is locked. Nobody can write in it until it is unlocked."),
22
28
  /* The action in the conversation's heading that opens a reply. */
23
29
  reply_label: "Reply",
24
30
  /* Before the names of who is in it, beneath a heading that is the subject. */
@@ -128,6 +134,8 @@ export async function getPhiThreadConversationLabels(options) {
128
134
  subjectFallback: labels.subject_fallback,
129
135
  olderLabel: labels.older_label,
130
136
  archivedLabel: labels.archived_label,
137
+ lockedLabel: labels.locked_label,
138
+ lockedText: labels.locked_text,
131
139
  replyLabel: labels.reply_label,
132
140
  participantsLabel: labels.participants_label,
133
141
  internalLabel: labels.internal_label,
@@ -1,3 +1,35 @@
1
+ /**
2
+ * What a cell shows and what a condition reads, neither of which is a flag.
3
+ *
4
+ * `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
5
+ * enum values are strings because that is what an enum column and a condition compare against. The
6
+ * status itself stays on the row, because the filter above is written against what the route takes.
7
+ *
8
+ * One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
9
+ * what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
10
+ */
11
+ export declare function readPhiThreadInboxRow(row: Record<string, unknown>): {
12
+ kind: string;
13
+ status: string;
14
+ archived: boolean;
15
+ locked: boolean;
16
+ state: string;
17
+ };
18
+ /**
19
+ * What a row action writes, in the shape `PATCH /api/site/threads/{id}` takes it: archiving and reopening
20
+ * change the status, locking and unlocking the lock. Both are one row everybody in the conversation
21
+ * shares, and Core decides who may change them.
22
+ */
23
+ export declare function readPhiThreadInboxActionBody(actionKey: string): {
24
+ status: 1;
25
+ locked?: undefined;
26
+ } | {
27
+ status: 0;
28
+ locked?: undefined;
29
+ } | {
30
+ locked: boolean;
31
+ status?: undefined;
32
+ } | null;
1
33
  export declare const PhiThreadTableProviderClient: import("react").ComponentType<{
2
34
  children: import("react").ReactNode;
3
35
  }>;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { PhisThreadStatus } from "../../../../constants/threads";
2
+ import { PhisThreadFlag, PhisThreadStatus } from "../../../../constants/threads";
3
3
  import { buildPhiTablePageParams, createPhiTableProviderRequestInit, readPhiTableRows, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
4
4
  import { PhiTableProviderError, } from "../../../../types/table-widget";
5
5
  import { createPhiTableProviderClient } from "../../../../components/widgets/client/shared/phi-table-provider";
@@ -39,18 +39,23 @@ function buildThreadQuery(query) {
39
39
  /**
40
40
  * What a cell shows and what a condition reads, neither of which is a flag.
41
41
  *
42
- * `state` is the name a badge draws and `archived` the answer a row action asks for; the enum values
43
- * are strings because that is what an enum column and a condition compare against. The status itself
44
- * stays on the row, because the filter above is written against what the route takes.
42
+ * `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
43
+ * enum values are strings because that is what an enum column and a condition compare against. The
44
+ * status itself stays on the row, because the filter above is written against what the route takes.
45
+ *
46
+ * One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
47
+ * what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
45
48
  */
46
- function readThreadRow(row) {
49
+ export function readPhiThreadInboxRow(row) {
47
50
  const archived = row.status === PhisThreadStatus.Archived;
51
+ const locked = typeof row.flags === "number" && (row.flags & PhisThreadFlag.Locked) !== 0;
48
52
  return {
49
53
  ...row,
50
54
  kind: String(row.kind),
51
55
  status: String(row.status),
52
56
  archived,
53
- state: archived ? "archived" : row.unread === true ? "unread" : "open",
57
+ locked,
58
+ state: archived ? "archived" : row.unread === true ? "unread" : locked ? "locked" : "open",
54
59
  };
55
60
  }
56
61
  async function queryThreadTable({ resourceKey, query, signal, }) {
@@ -58,7 +63,7 @@ async function queryThreadTable({ resourceKey, query, signal, }) {
58
63
  throw new PhiTableProviderError("resource-not-found", `Unknown conversation resource "${resourceKey}".`);
59
64
  }
60
65
  const payload = await readPhiTableProviderResponse(await fetch(`${API_PATH}?${buildThreadQuery(query).toString()}`, createPhiTableProviderRequestInit(signal)), RESPONSE_OPTIONS);
61
- const rows = readPhiTableRows(payload?.rows).map(readThreadRow);
66
+ const rows = readPhiTableRows(payload?.rows).map(readPhiThreadInboxRow);
62
67
  return {
63
68
  rows,
64
69
  total: typeof payload?.total === "number" ? payload.total : undefined,
@@ -76,7 +81,21 @@ function readThreadId(value) {
76
81
  return threadId;
77
82
  }
78
83
  /**
79
- * A status change, and then the listing again.
84
+ * What a row action writes, in the shape `PATCH /api/site/threads/{id}` takes it: archiving and reopening
85
+ * change the status, locking and unlocking the lock. Both are one row everybody in the conversation
86
+ * shares, and Core decides who may change them.
87
+ */
88
+ export function readPhiThreadInboxActionBody(actionKey) {
89
+ switch (actionKey) {
90
+ case "archive": return { status: PhisThreadStatus.Archived };
91
+ case "reopen": return { status: PhisThreadStatus.Open };
92
+ case "lock": return { locked: true };
93
+ case "unlock": return { locked: false };
94
+ default: return null;
95
+ }
96
+ }
97
+ /**
98
+ * A status or lock change, and then the listing again.
80
99
  *
81
100
  * The answer to a PATCH is the new status and nothing else, but what changed on screen is the row's
82
101
  * place in an order kept by last activity -- so the view is reloaded rather than the cell patched. A
@@ -87,14 +106,10 @@ async function mutateThreadTable(request) {
87
106
  throw new PhiTableProviderError("invalid-resource", `Unknown conversation resource "${request.resourceKey}".`);
88
107
  }
89
108
  if (request.kind !== "action") {
90
- throw new PhiTableProviderError("mutation-not-supported", "A conversation is not edited in a cell; archiving and reopening are actions.");
109
+ throw new PhiTableProviderError("mutation-not-supported", "A conversation is not edited in a cell; archiving, reopening, locking and unlocking are actions.");
91
110
  }
92
- const status = request.actionKey === "archive"
93
- ? PhisThreadStatus.Archived
94
- : request.actionKey === "reopen"
95
- ? PhisThreadStatus.Open
96
- : null;
97
- if (status == null) {
111
+ const body = readPhiThreadInboxActionBody(request.actionKey);
112
+ if (body == null) {
98
113
  throw new PhiTableProviderError("action-not-supported", `Unsupported conversation action "${request.actionKey}".`);
99
114
  }
100
115
  const init = createPhiTableProviderRequestInit(request.signal);
@@ -102,7 +117,7 @@ async function mutateThreadTable(request) {
102
117
  ...init,
103
118
  method: "PATCH",
104
119
  headers: { ...init.headers, "content-type": "application/json" },
105
- body: JSON.stringify({ status }),
120
+ body: JSON.stringify(body),
106
121
  }), RESPONSE_OPTIONS);
107
122
  return { status: "accepted", invalidation: "view" };
108
123
  }
@@ -27,6 +27,7 @@ import { PHI_ASSET_CONTROLLER_STORE_KEY } from "../../../../../components/media/
27
27
  import { applyPhiAssetCollectionData } from "../../../../../components/media/asset-collection-runtime";
28
28
  import { readPhiMediaAssetTiles, readPhiMediaFolders } from "../../../../../components/media/phi-image-preview-data";
29
29
  import { PhiAssetFolderControl } from "../../../../../components/media/phi-asset-folder-control";
30
+ import { isPhiMediaFolderIdLocked, isPhiMediaFolderLockedError, } from "../../../../../components/media/media-folder-lock";
30
31
  import { PhiAreaUploadBinding } from "../../../../../components/media/phi-area-upload-widget";
31
32
  import { PHI_MEDIA_WIDGET_DEFAULT_LABELS } from "../../../../../components/media/media-widget-labels";
32
33
  import { setPhiImagePreviewSelection, usePhiImagePreviewStore } from "../../../../../components/media/phi-image-preview-store";
@@ -109,6 +110,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
109
110
  * dropped in a `finally`, so a refusal clears it as surely as a success does.
110
111
  */
111
112
  const [deletingAssetIds, setDeletingAssetIds] = useState([]);
113
+ const [folderLockPending, setFolderLockPending] = useState(false);
112
114
  const spaceSelectionAllowed = usePhiMediaSpaceSelectionAllowed();
113
115
  const activeSpaceAddress = typeof query.filters?.spaceId === "string" && query.filters.spaceId
114
116
  ? query.filters.spaceId
@@ -126,8 +128,15 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
126
128
  ...(features.actions?.toolbar ?? []),
127
129
  ...(features.filters ?? []).flatMap((filter) => filter.actions ?? []),
128
130
  ];
129
- const unsupportedAction = configuredActions.find((action) => action.key !== "upload" && action.key !== "createFolder");
130
- const folderOptions = useMemo(() => buildPhiMediaFolderCascaderOptions(state.folders), [state.folders]);
131
+ const unsupportedAction = configuredActions.find((action) => action.key !== "upload" && action.key !== "createFolder" && action.key !== "lockFolder");
132
+ const folderOptions = useMemo(() => buildPhiMediaFolderCascaderOptions(state.folders, { lockedLabel: labels.tool.folderLockedLabel }), [labels.tool.folderLockedLabel, state.folders]);
133
+ /*
134
+ * The Folder the listing is filtered to, locked: Core refuses a new Folder in it, an upload into it and
135
+ * a delete from it, so none of the three is offered while it is chosen. An Asset's own delete reads its
136
+ * own Folder, because a listing without a Folder filter shows Assets from many.
137
+ */
138
+ const currentFolder = state.folderId == null ? null : state.folders.find((folder) => folder.id === state.folderId) ?? null;
139
+ const currentFolderLocked = isPhiMediaFolderIdLocked(state.folders, state.folderId);
131
140
  const folderValue = useMemo(() => buildPhiMediaFolderValueById(state.folders, state.folderId), [state.folderId, state.folders]);
132
141
  const selectionSignals = usePhiControlSignalController({
133
142
  key: "assetSelection",
@@ -151,6 +160,36 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
151
160
  ? `Asset collection filter "${unsupportedFilter.key}" is not supported.`
152
161
  : `Asset collection action "${unsupportedAction?.key ?? "unknown"}" is not supported.` }));
153
162
  }
163
+ function readActionFailure(error, fallback) {
164
+ if (isPhiMediaFolderLockedError(error))
165
+ return labels.tool.folderLockedText;
166
+ return error instanceof Error ? error.message : fallback;
167
+ }
168
+ async function toggleFolderLock() {
169
+ if (!currentFolder || folderLockPending)
170
+ return;
171
+ setFolderLockPending(true);
172
+ try {
173
+ const data = await binding.activate({
174
+ actionKey: currentFolderLocked ? "unlockFolder" : "lockFolder",
175
+ itemKey: currentFolder.id,
176
+ item: { flags: currentFolder.flags },
177
+ query,
178
+ });
179
+ if (data.error)
180
+ throw new Error(data.error);
181
+ }
182
+ catch (error) {
183
+ showMessage({
184
+ level: "error",
185
+ content: isPhiMediaFolderLockedError(error) ? labels.tool.folderLockedText : labels.tool.folderLockFailedText,
186
+ durationSeconds: 2.8,
187
+ });
188
+ }
189
+ finally {
190
+ setFolderLockPending(false);
191
+ }
192
+ }
154
193
  async function deleteAsset(asset) {
155
194
  setDeletingAssetIds((current) => current.includes(asset.id) ? current : [...current, asset.id]);
156
195
  try {
@@ -166,7 +205,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
166
205
  catch (error) {
167
206
  showMessage({
168
207
  level: "error",
169
- content: error instanceof Error ? error.message : labels.grid.deleteFailedText,
208
+ content: readActionFailure(error, labels.grid.deleteFailedText),
170
209
  durationSeconds: 2.8,
171
210
  });
172
211
  }
@@ -227,7 +266,14 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
227
266
  }
228
267
  if (filter.key === "folderId" && filter.control === "cascader") {
229
268
  const createAction = filter.actions?.find((action) => action.key === "createFolder");
230
- return (_jsx(PhiAssetFolderControl, { value: folderValue, options: folderOptions, placeholder: filter.placeholder ?? labels.tool.folderLabel, allowClear: true, showCreate: Boolean(createAction), createLabel: createAction?.label ?? labels.tool.createFolderLabel, size: controlSize, style: { ...style, minWidth: style.minWidth ?? 140 }, onCreate: () => actionSignals.emitCapability("actionActivate", {
269
+ const lockAction = filter.actions?.find((action) => action.key === "lockFolder");
270
+ return (_jsx(PhiAssetFolderControl, { value: folderValue, options: folderOptions, placeholder: filter.placeholder ?? labels.tool.folderLabel, allowClear: true, showCreate: Boolean(createAction), createLabel: createAction?.label ?? labels.tool.createFolderLabel, createDisabled: currentFolderLocked, lock: lockAction && currentFolder ? {
271
+ locked: currentFolderLocked,
272
+ lockLabel: labels.tool.lockFolderLabel,
273
+ unlockLabel: labels.tool.unlockFolderLabel,
274
+ pending: folderLockPending,
275
+ onToggle: () => { void toggleFolderLock(); },
276
+ } : null, size: controlSize, style: { ...style, minWidth: style.minWidth ?? 140 }, onCreate: () => actionSignals.emitCapability("actionActivate", {
231
277
  actionKey: "createFolder",
232
278
  query,
233
279
  }), onChange: (value) => binding.setQuery((current) => ({
@@ -244,7 +290,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
244
290
  const toolbar = selfContained && ((features.actions?.toolbar?.length ?? 0) > 0 || features.tools.reset || features.tools.reload) ? (_jsxs(PhiToolbarControl, { compact: true, size: controlSize, children: [(features.actions?.toolbar ?? []).map((action) => {
245
291
  const display = action.display ?? "icon";
246
292
  const label = action.label ?? (action.key === "upload" ? labels.tool.uploadToggleLabel : action.key);
247
- return (_jsx(PhiButtonControl, { label: display === "icon" ? undefined : label, ariaLabel: label, tooltip: action.description, icon: display === "label" || !action.icon ? undefined : resolvePhiButtonIcon(action.icon), type: action.mode === "primary" ? "primary" : "default", danger: action.mode === "danger", size: controlSize, onClick: action.key === "upload" ? () => binding.setOpenPanelKey(state.uploadPanelOpen ? null : "upload") : undefined }, action.key));
293
+ return (_jsx(PhiButtonControl, { label: display === "icon" ? undefined : label, ariaLabel: label, tooltip: action.description, icon: display === "label" || !action.icon ? undefined : resolvePhiButtonIcon(action.icon), type: action.mode === "primary" ? "primary" : "default", danger: action.mode === "danger", size: controlSize, disabled: action.key === "upload" && currentFolderLocked, onClick: action.key === "upload" ? () => binding.setOpenPanelKey(state.uploadPanelOpen ? null : "upload") : undefined }, action.key));
248
294
  }), features.tools.reset ? (_jsx(PhiButtonControl, { ariaLabel: labels.tool.resetLabel, tooltip: labels.tool.resetLabel, icon: resolvePhiButtonIcon("antd:rollback-outlined"), size: controlSize, onClick: () => binding.setQuery({
249
295
  ...(config.initialQuery ?? {}),
250
296
  page: config.initialQuery?.page ?? 1,
@@ -264,7 +310,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
264
310
  * Only what an action left behind reaches this: a failed read of the source ends the Collection
265
311
  * View before this renderer is drawn. A refusal is the acting person's to read, live or not.
266
312
  */
267
- diagnostics: state.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: state.error }) : null, body: body, items: state.assets.map((asset) => (_jsx(PhiMediaAssetTileControl, { asset: asset, minColumnWidth: minColumnWidth, selected: state.selectedAssetId === asset.id, mode: mode, deleting: deletingAssetIds.includes(asset.id), onSelect: selectAsset, onDelete: (nextAsset) => { void deleteAsset(nextAsset); }, deleteLabel: labels.grid.deleteLabel, showTypeLabel: true, showDeleteAction: true, showDimensions: true, showIdLabel: true }, asset.id))), mode: mode, gap: gap, minColumnWidth: minColumnWidth, pagination: features.pagination?.enabled === false ? null : {
313
+ diagnostics: state.error ? (_jsx(PhiAlertControl, { level: "error", showIcon: true, title: state.error })) : currentFolderLocked ? (_jsx(PhiAlertControl, { level: "info", showIcon: true, title: labels.tool.folderLockedText })) : null, body: body, items: state.assets.map((asset) => (_jsx(PhiMediaAssetTileControl, { asset: asset, minColumnWidth: minColumnWidth, selected: state.selectedAssetId === asset.id, mode: mode, deleting: deletingAssetIds.includes(asset.id), onSelect: selectAsset, onDelete: (nextAsset) => { void deleteAsset(nextAsset); }, deleteLabel: labels.grid.deleteLabel, showTypeLabel: true, showDeleteAction: !isPhiMediaFolderIdLocked(state.folders, asset.folderId), showDimensions: true, showIdLabel: true }, asset.id))), mode: mode, gap: gap, minColumnWidth: minColumnWidth, pagination: features.pagination?.enabled === false ? null : {
268
314
  page: state.page,
269
315
  pageSize: state.pageSize,
270
316
  total: state.pagination?.total ?? 0,
@@ -74,7 +74,7 @@ export function PhiQuickLinksWidgetClient({ labels, config, }) {
74
74
  if (items.length === 0) {
75
75
  return null;
76
76
  }
77
- return (_jsx("div", { ref: ref, style: { width: "100%", minWidth: 0 }, children: _jsxs(PhiFlexControl, { vertical: true, style: { width: "100%", minWidth: 0, gap: token.paddingLG }, children: [labels.title ? (_jsx(PhiTypographyControl, { strong: true, style: {
77
+ return (_jsx("div", { ref: ref, style: { width: "100%", minWidth: 0 }, children: _jsxs(PhiFlexControl, { vertical: true, style: { width: "100%", minWidth: 0, gap: token.padding }, children: [labels.title ? (_jsx(PhiTypographyControl, { strong: true, style: {
78
78
  display: "block",
79
79
  width: "100%",
80
80
  minWidth: 0,
@@ -1,7 +1,10 @@
1
1
  import type { PhiBlockRuntime, PhiClientBlockBaseProps } from "../../../../../types";
2
+ import type { PhisThreadDetail } from "../../../../../types/threads";
2
3
  import { type PhiThreadWidgetConfig } from "../thread-widget-config";
3
4
  import type { PhiThreadConversationLabels } from "../../messaging/labels";
4
5
  export type PhiThreadConversationWidgetClientProps = PhiClientBlockBaseProps<PhiThreadConversationLabels, PhiThreadWidgetConfig, Pick<PhiBlockRuntime, "site" | "locale" | "viewer">> & {
5
6
  runtime: Pick<PhiBlockRuntime, "site" | "locale" | "viewer">;
6
7
  };
7
8
  export declare function PhiThreadConversationWidgetClient({ runtime, labels, config, }: PhiThreadConversationWidgetClientProps): import("react").JSX.Element;
9
+ /** Whether Core takes new messages into this conversation; `PhisThreadFlag.Locked` says it does not. */
10
+ export declare function isPhiThreadLocked(detail: Pick<PhisThreadDetail, "thread">): boolean;
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { useSearchParams } from "next/navigation";
5
- import { PhisThreadMessageFlag, PhisThreadStatus } from "../../../../../constants/threads";
5
+ import { PhisThreadFlag, PhisThreadMessageFlag, PhisThreadStatus } from "../../../../../constants/threads";
6
6
  import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
7
7
  import { PhiButtonControl } from "../../../../../components/controls/phi-button-control";
8
8
  import { PhiCardControl } from "../../../../../components/controls/phi-card-control";
@@ -458,7 +458,13 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
458
458
  if (!detail) {
459
459
  return (_jsx(PhiCardControl, { padding: config?.padding, children: _jsx(PhiTypographyControl, { type: "secondary", children: labels.loadingText }) }));
460
460
  }
461
- return (_jsx(_Fragment, { children: _jsx(PhiCardControl, { padding: config?.padding, toolbar: config?.reply && detail.thread.status !== PhisThreadStatus.Archived ? (_jsx(PhiButtonControl, { label: labels.replyLabel, icon: _jsx(PhiIcon, { name: "antd:message-outlined", size: "inherit" }), size: "small", onClick: reply })) : undefined, title: _jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [readThreadTitle(detail, labels), detail.thread.status === PhisThreadStatus.Archived ? (_jsx(PhiTagControl, { children: labels.archivedLabel })) : null] }), children: _jsxs(PhiFlexControl, { vertical: true, gap: "middle", children: [detail.thread.subject?.trim() && detail.participants.length > 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: `${labels.participantsLabel}: ${readParticipantNames(detail, labels).join(", ")}` })) : null, error ? (_jsx(PhiAlertControl, { level: "error", title: labels.feedback.errorTitle, description: error })) : null, detail.hasMoreMessages ? (_jsx(PhiButtonControl, { label: labels.olderLabel, type: "link", loading: loadingOlder, onClick: () => void loadOlder() })) : null, detail.messages.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.emptyText })) : (detail.messages.map((message, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(PhiDividerControl, { style: { margin: 0 } }) : null, _jsx(PhiThreadMessageRow, { message: message, labels: labels, formatTime: formatTime, formatLanguage: formatLanguage, translation: translations[message.id] ?? null, canTranslate: translationTarget != null, onTranslate: translate })] }, message.id))))] }) }) }));
461
+ const archived = detail.thread.status === PhisThreadStatus.Archived;
462
+ const locked = isPhiThreadLocked(detail);
463
+ return (_jsx(_Fragment, { children: _jsx(PhiCardControl, { padding: config?.padding, toolbar: config?.reply && !archived && !locked ? (_jsx(PhiButtonControl, { label: labels.replyLabel, icon: _jsx(PhiIcon, { name: "antd:message-outlined", size: "inherit" }), size: "small", onClick: reply })) : undefined, title: _jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [readThreadTitle(detail, labels), archived ? (_jsx(PhiTagControl, { children: labels.archivedLabel })) : null, locked ? (_jsxs(PhiTagControl, { color: "warning", children: [_jsx(PhiIcon, { name: "antd:lock", size: "inherit" }), " ", labels.lockedLabel] })) : null] }), children: _jsxs(PhiFlexControl, { vertical: true, gap: "middle", children: [detail.thread.subject?.trim() && detail.participants.length > 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: `${labels.participantsLabel}: ${readParticipantNames(detail, labels).join(", ")}` })) : null, config?.reply && locked && !archived ? (_jsx(PhiAlertControl, { level: "info", showIcon: true, title: labels.lockedText })) : null, error ? (_jsx(PhiAlertControl, { level: "error", title: labels.feedback.errorTitle, description: error })) : null, detail.hasMoreMessages ? (_jsx(PhiButtonControl, { label: labels.olderLabel, type: "link", loading: loadingOlder, onClick: () => void loadOlder() })) : null, detail.messages.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.emptyText })) : (detail.messages.map((message, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(PhiDividerControl, { style: { margin: 0 } }) : null, _jsx(PhiThreadMessageRow, { message: message, labels: labels, formatTime: formatTime, formatLanguage: formatLanguage, translation: translations[message.id] ?? null, canTranslate: translationTarget != null, onTranslate: translate })] }, message.id))))] }) }) }));
464
+ }
465
+ /** Whether Core takes new messages into this conversation; `PhisThreadFlag.Locked` says it does not. */
466
+ export function isPhiThreadLocked(detail) {
467
+ return (detail.thread.flags & PhisThreadFlag.Locked) !== 0;
462
468
  }
463
469
  /**
464
470
  * What to call this conversation.