@memberjunction/ng-base-forms 6.2.0 → 6.3.0-edge.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +39 -8
  2. package/dist/lib/base-form-component.d.ts +20 -0
  3. package/dist/lib/base-form-component.d.ts.map +1 -1
  4. package/dist/lib/base-form-component.js +69 -7
  5. package/dist/lib/base-form-component.js.map +1 -1
  6. package/dist/lib/comments/comment-card-driver-host.component.d.ts +55 -0
  7. package/dist/lib/comments/comment-card-driver-host.component.d.ts.map +1 -0
  8. package/dist/lib/comments/comment-card-driver-host.component.js +134 -0
  9. package/dist/lib/comments/comment-card-driver-host.component.js.map +1 -0
  10. package/dist/lib/comments/field-suggestion-card.component.d.ts +43 -0
  11. package/dist/lib/comments/field-suggestion-card.component.d.ts.map +1 -0
  12. package/dist/lib/comments/field-suggestion-card.component.js +357 -0
  13. package/dist/lib/comments/field-suggestion-card.component.js.map +1 -0
  14. package/dist/lib/comments/form-record-comments-coordinator.service.d.ts +69 -7
  15. package/dist/lib/comments/form-record-comments-coordinator.service.d.ts.map +1 -1
  16. package/dist/lib/comments/form-record-comments-coordinator.service.js +251 -11
  17. package/dist/lib/comments/form-record-comments-coordinator.service.js.map +1 -1
  18. package/dist/lib/comments/record-comments.component.d.ts +31 -1
  19. package/dist/lib/comments/record-comments.component.d.ts.map +1 -1
  20. package/dist/lib/comments/record-comments.component.js +765 -465
  21. package/dist/lib/comments/record-comments.component.js.map +1 -1
  22. package/dist/lib/container/record-form-container.component.d.ts +6 -0
  23. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  24. package/dist/lib/container/record-form-container.component.js +286 -246
  25. package/dist/lib/container/record-form-container.component.js.map +1 -1
  26. package/dist/lib/field/form-field.component.d.ts +7 -3
  27. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  28. package/dist/lib/field/form-field.component.js +58 -22
  29. package/dist/lib/field/form-field.component.js.map +1 -1
  30. package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts.map +1 -1
  31. package/dist/lib/isa-related-panel/isa-related-panel.component.js +10 -0
  32. package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
  33. package/dist/lib/panel-slot/collect-form-contribution-registrations.js +1 -1
  34. package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -1
  35. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.d.ts +100 -0
  36. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.d.ts.map +1 -0
  37. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.js +181 -0
  38. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.js.map +1 -0
  39. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.d.ts +104 -0
  40. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.d.ts.map +1 -0
  41. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.js +487 -0
  42. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.js.map +1 -0
  43. package/dist/lib/toolbar/actions/record-comments-toolbar-action.js +2 -2
  44. package/dist/lib/toolbar/actions/record-comments-toolbar-action.js.map +1 -1
  45. package/dist/lib/toolbar/form-toolbar.component.d.ts +2 -0
  46. package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
  47. package/dist/lib/toolbar/form-toolbar.component.js +241 -290
  48. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  49. package/dist/module.d.ts +17 -14
  50. package/dist/module.d.ts.map +1 -1
  51. package/dist/module.js +25 -6
  52. package/dist/module.js.map +1 -1
  53. package/dist/public-api.d.ts +4 -0
  54. package/dist/public-api.d.ts.map +1 -1
  55. package/dist/public-api.js +4 -0
  56. package/dist/public-api.js.map +1 -1
  57. package/package.json +20 -20
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-suggestion-card.component.js","sourceRoot":"","sources":["../../../src/lib/comments/field-suggestion-card.component.ts","../../../src/lib/comments/field-suggestion-card.component.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AA5B,4BAA4B;6DAA5B,4BAA4B;YCjCzC,gGAAkB;;YAAlB,yCAwGC;;;ADvEY,4BAA4B;IATxC,aAAa,CAAC,yBAAyB,EAAE,8BAA8B,CAAC;GAS5D,4BAA4B,CAoNxC;;iFApNY,4BAA4B;cARxC,SAAS;6BACM,KAAK,YACP,0BAA0B,mBACnB,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI;;kFAI5B,4BAA4B","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ViewEncapsulation,\n inject\n} from '@angular/core';\nimport { MJCommentEntity, MJFieldSuggestionEntity } from '@memberjunction/core-entities';\nimport { RegisterClass } from '@memberjunction/global';\nimport { EntitySubtypeUIDriverBase } from '../subtype-ui-driver/entity-subtype-ui-driver';\nimport type { CommentCardDriverContext } from './comment-card-driver-host.component';\n\ntype FieldSuggestionOutcome = MJFieldSuggestionEntity['Outcome'];\ntype FieldSuggestionSource = MJFieldSuggestionEntity['Source'];\n\n/**\n * Built-in {@link EntitySubtypeUIDriverBase} card component for `MJ: Comment Types`\n * rows whose `UIDriverClass` is `'FieldSuggestionCardComponent'`.\n *\n * Displays:\n * - Provenance (`Source` + optional `Confidence` score) and disposition (`Outcome`).\n * - Current live value on `TargetRecord` vs proposed ghost value (`SuggestedValue`).\n * - Interactive **Accept**, **Reject**, and **Discuss** actions for pending suggestions.\n */\n@RegisterClass(EntitySubtypeUIDriverBase, 'FieldSuggestionCardComponent')\n@Component({\n standalone: false,\n selector: 'mj-field-suggestion-card',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: './field-suggestion-card.component.html',\n styleUrls: ['./field-suggestion-card.component.css']\n})\nexport class FieldSuggestionCardComponent extends EntitySubtypeUIDriverBase<\n MJCommentEntity,\n MJFieldSuggestionEntity\n> {\n private readonly cdr = inject(ChangeDetectorRef);\n\n public ActiveAction: 'accept' | 'reject' | null = null;\n\n public get CardContext(): CommentCardDriverContext | null {\n const ctx = this.DriverContext;\n if (!ctx || typeof ctx !== 'object') {\n return null;\n }\n return ctx as CommentCardDriverContext;\n }\n\n public get Suggestion(): MJFieldSuggestionEntity | null {\n return this.ChildRecord;\n }\n\n public get Outcome(): FieldSuggestionOutcome {\n return this.Suggestion?.Outcome ?? null;\n }\n\n public get IsPending(): boolean {\n return this.Outcome === null;\n }\n\n public get Source(): FieldSuggestionSource {\n return this.Suggestion?.Source ?? 'Agent';\n }\n\n public get SourceLabel(): string {\n switch (this.Source) {\n case 'Agent':\n return 'AI Agent';\n case 'Integration':\n return 'Integration';\n case 'LLM':\n return 'AI Model';\n case 'Person':\n return 'Person';\n default:\n return String(this.Source);\n }\n }\n\n public get SourceIcon(): string {\n switch (this.Source) {\n case 'Agent':\n return 'fa-solid fa-robot';\n case 'Integration':\n return 'fa-solid fa-plug';\n case 'LLM':\n return 'fa-solid fa-microchip';\n case 'Person':\n return 'fa-solid fa-user';\n default:\n return 'fa-solid fa-wand-magic-sparkles';\n }\n }\n\n public get FormattedConfidence(): string | null {\n const conf = this.Suggestion?.Confidence;\n if (conf === null || conf === undefined || !Number.isFinite(conf)) {\n return null;\n }\n const pct = conf <= 1 ? Math.round(conf * 100) : Math.round(conf);\n return `${Math.max(0, Math.min(100, pct))}%`;\n }\n\n public get OutcomeBadgeLabel(): string {\n switch (this.Outcome) {\n case 'Accepted':\n return 'Accepted';\n case 'Rejected':\n return 'Rejected';\n case 'Superseded':\n return 'Superseded';\n default:\n return 'Pending';\n }\n }\n\n public get OutcomeBadgeModifier(): string {\n switch (this.Outcome) {\n case 'Accepted':\n return 'accepted';\n case 'Rejected':\n return 'rejected';\n case 'Superseded':\n return 'superseded';\n default:\n return 'pending';\n }\n }\n\n public get CurrentValueDisplay(): string {\n const fromContext = this.CardContext?.CurrentLiveValue;\n if (fromContext !== null && fromContext !== undefined && fromContext.length > 0) {\n return fromContext;\n }\n const fieldName = (this.Suggestion?.AnchorKey ?? '').trim();\n if (fieldName && this.TargetRecord) {\n const field = this.TargetRecord.Fields.find(\n (f) => f.Name.toLowerCase() === fieldName.toLowerCase()\n );\n if (field) {\n const raw = field.Value;\n if (raw !== null && raw !== undefined && String(raw).trim() !== '') {\n return this.formatScalarForDisplay(raw);\n }\n }\n }\n return '(empty)';\n }\n\n public get IsClearingSuggestion(): boolean {\n const val = this.Suggestion?.SuggestedValue;\n return val === null || val === undefined || val === '';\n }\n\n public get SuggestedValueDisplay(): string {\n if (this.IsClearingSuggestion) {\n return '(clear value)';\n }\n return this.formatScalarForDisplay(this.Suggestion!.SuggestedValue);\n }\n\n public get CanUserActOnSuggestion(): boolean {\n if (!this.IsPending || !this.Suggestion?.ID) {\n return false;\n }\n if (this.CardContext) {\n return this.CardContext.CanUserUpdateTargetField;\n }\n return true;\n }\n\n public get CanUserDiscuss(): boolean {\n if (this.CardContext) {\n return this.CardContext.CanUserDiscuss;\n }\n return true;\n }\n\n public get ActionDisabledReason(): string | null {\n if (!this.IsPending) {\n return null;\n }\n if (!this.CanUserActOnSuggestion) {\n return 'You need update permission on this field to accept or reject this suggestion';\n }\n return null;\n }\n\n public async OnAccept(): Promise<void> {\n const suggestionId = this.Suggestion?.ID;\n const coordinator = this.CardContext?.Coordinator ?? null;\n if (!suggestionId || !coordinator || !this.CanUserActOnSuggestion || this.ActiveAction !== null) {\n return;\n }\n\n this.ActiveAction = 'accept';\n this.cdr.markForCheck();\n try {\n await coordinator.AcceptFieldSuggestion(suggestionId);\n this.RecordMutated.emit();\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n this.CardContext?.OnError(msg);\n } finally {\n this.ActiveAction = null;\n this.cdr.markForCheck();\n }\n }\n\n public async OnReject(): Promise<void> {\n const suggestionId = this.Suggestion?.ID;\n const coordinator = this.CardContext?.Coordinator ?? null;\n if (!suggestionId || !coordinator || !this.CanUserActOnSuggestion || this.ActiveAction !== null) {\n return;\n }\n\n this.ActiveAction = 'reject';\n this.cdr.markForCheck();\n try {\n await coordinator.RejectFieldSuggestion(suggestionId);\n this.RecordMutated.emit();\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n this.CardContext?.OnError(msg);\n } finally {\n this.ActiveAction = null;\n this.cdr.markForCheck();\n }\n }\n\n public OnDiscuss(): void {\n this.CardContext?.OnDiscuss();\n }\n\n private formatScalarForDisplay(raw: unknown): string {\n if (raw instanceof Date) {\n return isNaN(raw.getTime()) ? String(raw) : raw.toISOString().slice(0, 10);\n }\n const text = String(raw).trim();\n if (/^\\d{4}-\\d{2}-\\d{2}T00:00:00(?:\\.000)?Z?$/.test(text)) {\n return text.slice(0, 10);\n }\n return text;\n }\n}\n","@if (Suggestion) {\n <div\n class=\"mj-field-suggestion-card\"\n [class.mj-field-suggestion-card--pending]=\"IsPending\"\n [class.mj-field-suggestion-card--accepted]=\"Outcome === 'Accepted'\"\n [class.mj-field-suggestion-card--rejected]=\"Outcome === 'Rejected'\"\n [class.mj-field-suggestion-card--superseded]=\"Outcome === 'Superseded'\">\n <div class=\"mj-field-suggestion-card__meta-row\">\n <div class=\"mj-field-suggestion-card__provenance\">\n <span class=\"mj-field-suggestion-card__kind-chip\">\n <i class=\"fa-solid fa-wand-magic-sparkles\" aria-hidden=\"true\"></i>\n <span>Suggested value</span>\n </span>\n <span class=\"mj-field-suggestion-card__source-chip\" [title]=\"'Suggested by ' + SourceLabel\">\n <i [class]=\"SourceIcon\" aria-hidden=\"true\"></i>\n <span>{{ SourceLabel }}</span>\n @if (FormattedConfidence) {\n <span class=\"mj-field-suggestion-card__confidence\">{{ FormattedConfidence }}</span>\n }\n </span>\n </div>\n\n <span\n class=\"mj-field-suggestion-card__outcome-pill\"\n [class]=\"'mj-field-suggestion-card__outcome-pill mj-field-suggestion-card__outcome-pill--' + OutcomeBadgeModifier\">\n {{ OutcomeBadgeLabel }}\n </span>\n </div>\n\n <div class=\"mj-field-suggestion-card__diff\" role=\"group\" aria-label=\"Proposed field change\">\n <div class=\"mj-field-suggestion-card__value-box mj-field-suggestion-card__value-box--current\">\n <span class=\"mj-field-suggestion-card__value-label\">Current</span>\n <code class=\"mj-field-suggestion-card__value-code\">{{ CurrentValueDisplay }}</code>\n </div>\n\n <div class=\"mj-field-suggestion-card__arrow\" aria-hidden=\"true\">\n <i class=\"fa-solid fa-arrow-right\"></i>\n </div>\n\n <div\n class=\"mj-field-suggestion-card__value-box mj-field-suggestion-card__value-box--ghost\"\n [class.mj-field-suggestion-card__value-box--clearing]=\"IsClearingSuggestion\">\n <span class=\"mj-field-suggestion-card__value-label\">Proposed</span>\n <code class=\"mj-field-suggestion-card__value-code mj-field-suggestion-card__value-code--ghost\">\n {{ SuggestedValueDisplay }}\n </code>\n </div>\n </div>\n\n @if (IsPending) {\n <div class=\"mj-field-suggestion-card__actions\">\n <button\n type=\"button\"\n mjButton\n variant=\"primary\"\n size=\"sm\"\n class=\"mj-field-suggestion-card__btn--accept\"\n [disabled]=\"!CanUserActOnSuggestion || ActiveAction !== null\"\n [title]=\"ActionDisabledReason || 'Apply suggested value to this field'\"\n (click)=\"OnAccept()\">\n @if (ActiveAction === 'accept') {\n <mj-loading [showText]=\"false\" size=\"small\"></mj-loading>\n <span>Applying...</span>\n } @else {\n <i class=\"fa-solid fa-check\" aria-hidden=\"true\"></i>\n <span>Accept</span>\n }\n </button>\n\n <button\n type=\"button\"\n mjButton\n variant=\"outline\"\n size=\"sm\"\n class=\"mj-field-suggestion-card__btn--reject\"\n [disabled]=\"!CanUserActOnSuggestion || ActiveAction !== null\"\n [title]=\"ActionDisabledReason || 'Dismiss this field suggestion'\"\n (click)=\"OnReject()\">\n @if (ActiveAction === 'reject') {\n <mj-loading [showText]=\"false\" size=\"small\"></mj-loading>\n <span>Rejecting...</span>\n } @else {\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n <span>Reject</span>\n }\n </button>\n\n @if (CanUserDiscuss) {\n <button\n type=\"button\"\n mjButton\n variant=\"flat\"\n size=\"sm\"\n class=\"mj-field-suggestion-card__btn--discuss\"\n [disabled]=\"ActiveAction !== null\"\n title=\"Reply in this suggestion's conversation thread\"\n (click)=\"OnDiscuss()\">\n <i class=\"fa-regular fa-comment-dots\" aria-hidden=\"true\"></i>\n <span>Discuss</span>\n </button>\n }\n </div>\n }\n </div>\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  import { OnDestroy } from '@angular/core';
2
2
  import { BaseEntity, EntityInfo, IMetadataProvider, UserInfo } from '@memberjunction/core';
3
- import { AnchoredCommentRollup, ConversationAnchorMetadata, ConversationAnchorType, MJConversationDetailEntity, MJConversationEntity } from '@memberjunction/core-entities';
3
+ import { AnchoredCommentRollup, ConversationAnchorMetadata, ConversationAnchorType, MJCommentEntity, MJCommentTypeEntity, MJConversationDetailEntity, MJConversationEntity, MJFieldSuggestionEntity } from '@memberjunction/core-entities';
4
4
  import { Observable } from 'rxjs';
5
+ import { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';
5
6
  import * as i0 from "@angular/core";
6
7
  /**
7
8
  * Viewport rectangle used to tether the inline anchored comment popover to a field or section trigger button.
@@ -27,6 +28,8 @@ export interface FormCommentAnchorTarget {
27
28
  GroupKey?: string;
28
29
  GroupDisplayName?: string;
29
30
  AnchorRect?: CommentPopoverAnchorRect;
31
+ /** Optional comment-type code (`'all'`, `'COMMENT'`, `'FIELD_SUGGESTION'`, etc.) pre-selected when opening from a typed badge. */
32
+ PreferredTypeFilter?: string | null;
30
33
  }
31
34
  /**
32
35
  * Request emitted when the user clicks an anchor badge inside the Record Comments drawer
@@ -40,8 +43,8 @@ export interface FormCommentAnchorNavigationRequest {
40
43
  }
41
44
  /**
42
45
  * Per-form coordinator service (provided by `<mj-record-form-container>`) that manages
43
- * anchored conversations and inline comments across the record as a whole, its `<mj-form-field>`
44
- * instances, `<mj-collapsible-panel>` sections, and left-nav rail groups.
46
+ * anchored conversations, notes, and field suggestions across the record as a whole, its
47
+ * `<mj-form-field>` instances, `<mj-collapsible-panel>` sections, and left-nav rail groups.
45
48
  */
46
49
  export declare class FormRecordCommentsCoordinatorService implements OnDestroy {
47
50
  private readonly _changed$;
@@ -52,43 +55,88 @@ export declare class FormRecordCommentsCoordinatorService implements OnDestroy {
52
55
  get NavigateToAnchor$(): Observable<FormCommentAnchorNavigationRequest>;
53
56
  private _record;
54
57
  private _provider;
58
+ private _refreshCoordinator;
55
59
  private _conversations;
56
60
  private _detailsByConversationId;
61
+ private _commentsByConversationId;
62
+ private _suggestionsByConversationId;
63
+ private _commentTypeCodeByConversationId;
57
64
  private _rollup;
58
65
  private _isLoading;
59
66
  private _isLoaded;
60
67
  private _loadGeneration;
61
68
  private _isDrawerOpen;
62
69
  private _drawerStatusFilter;
70
+ private _drawerTypeFilter;
71
+ private _popoverTypeFilter;
63
72
  private _drawerTargetFilter;
64
73
  private _activePopoverTarget;
65
74
  get Record(): BaseEntity | null;
66
75
  get Provider(): IMetadataProvider | null;
67
76
  get Conversations(): readonly MJConversationEntity[];
68
77
  get DetailsByConversationId(): ReadonlyMap<string, MJConversationDetailEntity[]>;
78
+ get CommentsByConversationId(): ReadonlyMap<string, MJCommentEntity>;
79
+ get SuggestionsByConversationId(): ReadonlyMap<string, MJFieldSuggestionEntity>;
80
+ get CommentTypeCodeByConversationId(): ReadonlyMap<string, string>;
69
81
  get Rollup(): AnchoredCommentRollup;
70
82
  get IsLoading(): boolean;
71
83
  get IsLoaded(): boolean;
72
84
  get IsDrawerOpen(): boolean;
73
85
  get DrawerStatusFilter(): 'open' | 'resolved' | 'all';
86
+ get DrawerTypeFilter(): string;
87
+ get PopoverTypeFilter(): string;
74
88
  get DrawerTargetFilter(): FormCommentAnchorTarget | null;
75
89
  get ActivePopoverTarget(): FormCommentAnchorTarget | null;
76
90
  get CurrentUser(): UserInfo | null;
77
91
  get EntityInfo(): EntityInfo | null;
92
+ /**
93
+ * Connects the host container's {@link FormRecordRefreshCoordinator} so accepting a
94
+ * field suggestion broadcasts live field refreshes across open `<mj-form-field>` controls.
95
+ */
96
+ BindRefreshCoordinator(refreshCoordinator: FormRecordRefreshCoordinator | null): void;
78
97
  /**
79
98
  * Binds the coordinator to the active record and provider. Resets cached state if the
80
99
  * record identity changed.
81
100
  */
82
101
  BindRecord(record: BaseEntity | null, provider: IMetadataProvider | null): void;
83
102
  /**
84
- * Loads all anchored conversations and their detail messages for the bound record,
85
- * applying RLS and FLS filtering for the current user and recomputing rollups.
103
+ * Loads all anchored conversations, their `MJ: Comments` / `MJ: Field Suggestions` subtype rows,
104
+ * and their detail messages for the bound record, applying RLS and FLS filtering for the current user.
86
105
  */
87
106
  LoadForRecord(record?: BaseEntity | null, provider?: IMetadataProvider | null, forceRefresh?: boolean): Promise<AnchoredCommentRollup>;
88
107
  /**
89
- * Returns the number of open anchored comment threads on a specific field (`FieldName`).
108
+ * Returns the total number of open anchored threads (notes + suggestions) on a specific field (`FieldName`).
90
109
  */
91
110
  GetFieldOpenCommentCount(fieldName: string | null | undefined): number;
111
+ /**
112
+ * Returns the number of open `FIELD_SUGGESTION` threads targeting `fieldName`.
113
+ */
114
+ GetFieldOpenSuggestionCount(fieldName: string | null | undefined): number;
115
+ /**
116
+ * Returns the number of open non-suggestion note threads targeting `fieldName`.
117
+ */
118
+ GetFieldOpenNoteCount(fieldName: string | null | undefined): number;
119
+ /**
120
+ * Returns open thread counts targeting `fieldName`, keyed by uppercase `CommentType.Code`.
121
+ */
122
+ GetFieldOpenCountByType(fieldName: string | null | undefined): ReadonlyMap<string, number>;
123
+ /**
124
+ * Returns the loaded `MJ: Comments` subtype row for `conversationId`, if present.
125
+ */
126
+ GetCommentForConversation(conversationId: string): MJCommentEntity | null;
127
+ /**
128
+ * Returns the loaded `MJ: Field Suggestions` subtype row for `conversationId`, if present.
129
+ */
130
+ GetSuggestionForConversation(conversationId: string): MJFieldSuggestionEntity | null;
131
+ /**
132
+ * Returns the normalized uppercase `CommentType.Code` for `conversationId`
133
+ * (defaulting to `'COMMENT'` for plain anchored comments).
134
+ */
135
+ GetCommentTypeCodeForConversation(conversationId: string): string;
136
+ /**
137
+ * Resolves the cached `MJ: Comment Types` metadata row for `conversationId`, when available.
138
+ */
139
+ GetCommentTypeForConversation(conversationId: string): MJCommentTypeEntity | null;
92
140
  /**
93
141
  * Returns all anchored threads (open + optionally resolved) targeting a specific field.
94
142
  */
@@ -128,6 +176,18 @@ export declare class FormRecordCommentsCoordinatorService implements OnDestroy {
128
176
  * Resolves or re-opens an anchored conversation thread.
129
177
  */
130
178
  ToggleResolved(conversationId: string, isResolved: boolean): Promise<MJConversationEntity | null>;
179
+ /**
180
+ * Accepts a pending `MJ: Field Suggestions` row as the current user, reloads the open
181
+ * target record so live form fields reflect the accepted value immediately, and refreshes
182
+ * the record's anchored comments and rollups.
183
+ */
184
+ AcceptFieldSuggestion(suggestionId: string): Promise<MJFieldSuggestionEntity | null>;
185
+ /**
186
+ * Rejects a pending `MJ: Field Suggestions` row as the current user and refreshes
187
+ * the record's anchored comments and rollups.
188
+ */
189
+ RejectFieldSuggestion(suggestionId: string): Promise<MJFieldSuggestionEntity | null>;
190
+ private applyDisposedSuggestionOptimistically;
131
191
  /**
132
192
  * Opens the inline anchored comment popover tethered to a specific field or section,
133
193
  * lazy-loading the record's anchored conversations if not yet loaded.
@@ -138,10 +198,12 @@ export declare class FormRecordCommentsCoordinatorService implements OnDestroy {
138
198
  */
139
199
  ClosePopover(): void;
140
200
  /**
141
- * Opens or closes the Record Comments slide-in drawer, optionally pre-filtering to a target.
201
+ * Opens or closes the Notes & suggestions slide-in drawer, optionally pre-filtering to a target.
142
202
  */
143
203
  SetDrawerOpen(open: boolean, targetFilter?: FormCommentAnchorTarget | null): void;
144
204
  SetDrawerStatusFilter(status: 'open' | 'resolved' | 'all'): void;
205
+ SetDrawerTypeFilter(typeCode: string): void;
206
+ SetPopoverTypeFilter(typeCode: string): void;
145
207
  SetDrawerTargetFilter(target: FormCommentAnchorTarget | null): void;
146
208
  /**
147
209
  * Requests the form container to navigate to, expand, scroll into view, and pulse
@@ -1 +1 @@
1
- {"version":3,"file":"form-record-comments-coordinator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AAM,GACpB,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;IAkC7C;;OAEG;IACU,cAAc,CACvB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,OAAO,GACpB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAyBvC;;;OAGG;IACI,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;IAQlE;;OAEG;IACI,YAAY,IAAI,IAAI;IAM3B;;OAEG;IACI,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,uBAAuB,GAAG,IAAI,GAAG,IAAI;IAcjF,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,IAAI;IAKhE,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,GAAG,IAAI;IAK1E;;;OAGG;IACI,uBAAuB,CAAC,OAAO,EAAE,kCAAkC,GAAG,IAAI;IAI1E,aAAa,IAAI,IAAI;IAIrB,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,aAAa;yCAxgBZ,oCAAoC;6CAApC,oCAAoC;CA2gBhD"}
1
+ {"version":3,"file":"form-record-comments-coordinator.service.d.ts","sourceRoot":"","sources":["../../../src/lib/comments/form-record-comments-coordinator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrG,OAAO,EACH,qBAAqB,EAIrB,0BAA0B,EAC1B,sBAAsB,EAGtB,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EAE1B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,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,IAAI,CAAC;IA2BjG,OAAO,CAAC,qCAAqC;IAyC7C;;;OAGG;IACI,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;IASlE;;OAEG;IACI,YAAY,IAAI,IAAI;IAO3B;;OAEG;IACI,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,uBAAuB,GAAG,IAAI,GAAG,IAAI;IAkBjF,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,IAAI;IAKhE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAM3C,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAM5C,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,GAAG,IAAI;IAK1E;;;OAGG;IACI,uBAAuB,CAAC,OAAO,EAAE,kCAAkC,GAAG,IAAI;IAI1E,aAAa,IAAI,IAAI;IAIrB,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,aAAa;yCA9yBZ,oCAAoC;6CAApC,oCAAoC;CAizBhD"}
@@ -1,6 +1,6 @@
1
1
  import { Injectable } from '@angular/core';
2
2
  import { LogError } from '@memberjunction/core';
3
- import { ComputeAnchoredCommentCounts, ConversationEngine, IsConversationHiddenByFieldSecurity, ParseConversationAnchorMetadata } from '@memberjunction/core-entities';
3
+ import { BUILT_IN_COMMENT_TYPE_IDS, COMMENT_TYPE_CODES, ComputeAnchoredCommentCounts, ConversationEngine, IsConversationHiddenByFieldSecurity, ParseConversationAnchorMetadata } from '@memberjunction/core-entities';
4
4
  import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
5
5
  import { Subject } from 'rxjs';
6
6
  import * as i0 from "@angular/core";
@@ -11,12 +11,16 @@ const EMPTY_ROLLUP = {
11
11
  ByField: new Map(),
12
12
  BySection: new Map(),
13
13
  ByGroup: new Map(),
14
- ByContribution: new Map()
14
+ ByContribution: new Map(),
15
+ OpenNoteCount: 0,
16
+ OpenSuggestionCount: 0,
17
+ ByFieldSuggestions: new Map(),
18
+ ByFieldByType: new Map()
15
19
  };
16
20
  /**
17
21
  * Per-form coordinator service (provided by `<mj-record-form-container>`) that manages
18
- * anchored conversations and inline comments across the record as a whole, its `<mj-form-field>`
19
- * instances, `<mj-collapsible-panel>` sections, and left-nav rail groups.
22
+ * anchored conversations, notes, and field suggestions across the record as a whole, its
23
+ * `<mj-form-field>` instances, `<mj-collapsible-panel>` sections, and left-nav rail groups.
20
24
  */
21
25
  export class FormRecordCommentsCoordinatorService {
22
26
  _changed$ = new Subject();
@@ -31,14 +35,20 @@ export class FormRecordCommentsCoordinatorService {
31
35
  }
32
36
  _record = null;
33
37
  _provider = null;
38
+ _refreshCoordinator = null;
34
39
  _conversations = [];
35
40
  _detailsByConversationId = new Map();
41
+ _commentsByConversationId = new Map();
42
+ _suggestionsByConversationId = new Map();
43
+ _commentTypeCodeByConversationId = new Map();
36
44
  _rollup = EMPTY_ROLLUP;
37
45
  _isLoading = false;
38
46
  _isLoaded = false;
39
47
  _loadGeneration = 0;
40
48
  _isDrawerOpen = false;
41
49
  _drawerStatusFilter = 'open';
50
+ _drawerTypeFilter = 'all';
51
+ _popoverTypeFilter = 'all';
42
52
  _drawerTargetFilter = null;
43
53
  _activePopoverTarget = null;
44
54
  get Record() {
@@ -53,6 +63,15 @@ export class FormRecordCommentsCoordinatorService {
53
63
  get DetailsByConversationId() {
54
64
  return this._detailsByConversationId;
55
65
  }
66
+ get CommentsByConversationId() {
67
+ return this._commentsByConversationId;
68
+ }
69
+ get SuggestionsByConversationId() {
70
+ return this._suggestionsByConversationId;
71
+ }
72
+ get CommentTypeCodeByConversationId() {
73
+ return this._commentTypeCodeByConversationId;
74
+ }
56
75
  get Rollup() {
57
76
  return this._rollup;
58
77
  }
@@ -68,6 +87,12 @@ export class FormRecordCommentsCoordinatorService {
68
87
  get DrawerStatusFilter() {
69
88
  return this._drawerStatusFilter;
70
89
  }
90
+ get DrawerTypeFilter() {
91
+ return this._drawerTypeFilter;
92
+ }
93
+ get PopoverTypeFilter() {
94
+ return this._popoverTypeFilter;
95
+ }
71
96
  get DrawerTargetFilter() {
72
97
  return this._drawerTargetFilter;
73
98
  }
@@ -80,6 +105,13 @@ export class FormRecordCommentsCoordinatorService {
80
105
  get EntityInfo() {
81
106
  return this._record?.EntityInfo ?? null;
82
107
  }
108
+ /**
109
+ * Connects the host container's {@link FormRecordRefreshCoordinator} so accepting a
110
+ * field suggestion broadcasts live field refreshes across open `<mj-form-field>` controls.
111
+ */
112
+ BindRefreshCoordinator(refreshCoordinator) {
113
+ this._refreshCoordinator = refreshCoordinator;
114
+ }
83
115
  /**
84
116
  * Binds the coordinator to the active record and provider. Resets cached state if the
85
117
  * record identity changed.
@@ -94,16 +126,21 @@ export class FormRecordCommentsCoordinatorService {
94
126
  if (prevEntityId !== nextEntityId || prevRecordId !== nextRecordId) {
95
127
  this._conversations = [];
96
128
  this._detailsByConversationId.clear();
129
+ this._commentsByConversationId.clear();
130
+ this._suggestionsByConversationId.clear();
131
+ this._commentTypeCodeByConversationId.clear();
97
132
  this._rollup = EMPTY_ROLLUP;
98
133
  this._isLoaded = false;
99
134
  this._activePopoverTarget = null;
100
135
  this._drawerTargetFilter = null;
136
+ this._drawerTypeFilter = 'all';
137
+ this._popoverTypeFilter = 'all';
101
138
  this.notifyChanged();
102
139
  }
103
140
  }
104
141
  /**
105
- * Loads all anchored conversations and their detail messages for the bound record,
106
- * applying RLS and FLS filtering for the current user and recomputing rollups.
142
+ * Loads all anchored conversations, their `MJ: Comments` / `MJ: Field Suggestions` subtype rows,
143
+ * and their detail messages for the bound record, applying RLS and FLS filtering for the current user.
107
144
  */
108
145
  async LoadForRecord(record, provider, forceRefresh = false) {
109
146
  if (record !== undefined || provider !== undefined) {
@@ -117,6 +154,9 @@ export class FormRecordCommentsCoordinatorService {
117
154
  if (!activeRecord?.IsSaved || !activeProvider || !currentUser || !linkedEntityId || !linkedRecordId) {
118
155
  this._conversations = [];
119
156
  this._detailsByConversationId.clear();
157
+ this._commentsByConversationId.clear();
158
+ this._suggestionsByConversationId.clear();
159
+ this._commentTypeCodeByConversationId.clear();
120
160
  this._rollup = EMPTY_ROLLUP;
121
161
  this._isLoaded = false;
122
162
  this.notifyChanged();
@@ -138,13 +178,28 @@ export class FormRecordCommentsCoordinatorService {
138
178
  return this._rollup;
139
179
  }
140
180
  const visibleConversations = conversations.filter((c) => !IsConversationHiddenByFieldSecurity(activeRecord.EntityInfo, currentUser, c.AnchorType, c.AnchorKey, c.AnchorMetadataObject ?? c.AnchorMetadata));
141
- const detailsMap = await ConversationEngine.Instance.LoadAnchoredConversationDetails(visibleConversations.map((c) => c.ID), currentUser, activeProvider, forceRefresh);
181
+ const visibleIds = visibleConversations.map((c) => c.ID);
182
+ const emptyCommentsBundle = {
183
+ CommentsByConversationId: new Map(),
184
+ SuggestionsByConversationId: new Map(),
185
+ CommentTypeCodeByConversationId: new Map()
186
+ };
187
+ const loadCommentsPromise = typeof ConversationEngine.Instance.LoadAnchoredCommentsAndSuggestions === 'function'
188
+ ? ConversationEngine.Instance.LoadAnchoredCommentsAndSuggestions(visibleIds, currentUser, activeProvider, forceRefresh)
189
+ : Promise.resolve(emptyCommentsBundle);
190
+ const [detailsMap, commentsBundle] = await Promise.all([
191
+ ConversationEngine.Instance.LoadAnchoredConversationDetails(visibleIds, currentUser, activeProvider, forceRefresh),
192
+ loadCommentsPromise
193
+ ]);
142
194
  if (generation !== this._loadGeneration) {
143
195
  return this._rollup;
144
196
  }
145
197
  this._conversations = visibleConversations;
146
198
  this._detailsByConversationId = detailsMap;
147
- this._rollup = ComputeAnchoredCommentCounts(this._conversations, currentUser, activeRecord.EntityInfo);
199
+ this._commentsByConversationId = commentsBundle.CommentsByConversationId;
200
+ this._suggestionsByConversationId = commentsBundle.SuggestionsByConversationId;
201
+ this._commentTypeCodeByConversationId = commentsBundle.CommentTypeCodeByConversationId;
202
+ this._rollup = ComputeAnchoredCommentCounts(this._conversations, currentUser, activeRecord.EntityInfo, this._commentTypeCodeByConversationId);
148
203
  this._isLoaded = true;
149
204
  }
150
205
  catch (error) {
@@ -159,7 +214,7 @@ export class FormRecordCommentsCoordinatorService {
159
214
  return this._rollup;
160
215
  }
161
216
  /**
162
- * Returns the number of open anchored comment threads on a specific field (`FieldName`).
217
+ * Returns the total number of open anchored threads (notes + suggestions) on a specific field (`FieldName`).
163
218
  */
164
219
  GetFieldOpenCommentCount(fieldName) {
165
220
  const key = (fieldName ?? '').trim().toLowerCase();
@@ -167,6 +222,78 @@ export class FormRecordCommentsCoordinatorService {
167
222
  return 0;
168
223
  return this._rollup.ByField.get(key) ?? 0;
169
224
  }
225
+ /**
226
+ * Returns the number of open `FIELD_SUGGESTION` threads targeting `fieldName`.
227
+ */
228
+ GetFieldOpenSuggestionCount(fieldName) {
229
+ const key = (fieldName ?? '').trim().toLowerCase();
230
+ if (!key)
231
+ return 0;
232
+ return this._rollup.ByFieldSuggestions?.get(key) ?? 0;
233
+ }
234
+ /**
235
+ * Returns the number of open non-suggestion note threads targeting `fieldName`.
236
+ */
237
+ GetFieldOpenNoteCount(fieldName) {
238
+ return Math.max(0, this.GetFieldOpenCommentCount(fieldName) - this.GetFieldOpenSuggestionCount(fieldName));
239
+ }
240
+ /**
241
+ * Returns open thread counts targeting `fieldName`, keyed by uppercase `CommentType.Code`.
242
+ */
243
+ GetFieldOpenCountByType(fieldName) {
244
+ const key = (fieldName ?? '').trim().toLowerCase();
245
+ if (!key)
246
+ return new Map();
247
+ return this._rollup.ByFieldByType?.get(key) ?? new Map();
248
+ }
249
+ /**
250
+ * Returns the loaded `MJ: Comments` subtype row for `conversationId`, if present.
251
+ */
252
+ GetCommentForConversation(conversationId) {
253
+ return this._commentsByConversationId.get(NormalizeUUID(conversationId)) ?? null;
254
+ }
255
+ /**
256
+ * Returns the loaded `MJ: Field Suggestions` subtype row for `conversationId`, if present.
257
+ */
258
+ GetSuggestionForConversation(conversationId) {
259
+ return this._suggestionsByConversationId.get(NormalizeUUID(conversationId)) ?? null;
260
+ }
261
+ /**
262
+ * Returns the normalized uppercase `CommentType.Code` for `conversationId`
263
+ * (defaulting to `'COMMENT'` for plain anchored comments).
264
+ */
265
+ GetCommentTypeCodeForConversation(conversationId) {
266
+ const normId = NormalizeUUID(conversationId);
267
+ const mapped = this._commentTypeCodeByConversationId.get(normId);
268
+ if (mapped) {
269
+ return mapped.trim().toUpperCase();
270
+ }
271
+ if (this._suggestionsByConversationId.has(normId)) {
272
+ return COMMENT_TYPE_CODES.FIELD_SUGGESTION;
273
+ }
274
+ const comment = this._commentsByConversationId.get(normId);
275
+ if (comment && UUIDsEqual(comment.CommentTypeID, BUILT_IN_COMMENT_TYPE_IDS.FIELD_SUGGESTION)) {
276
+ return COMMENT_TYPE_CODES.FIELD_SUGGESTION;
277
+ }
278
+ return COMMENT_TYPE_CODES.COMMENT;
279
+ }
280
+ /**
281
+ * Resolves the cached `MJ: Comment Types` metadata row for `conversationId`, when available.
282
+ */
283
+ GetCommentTypeForConversation(conversationId) {
284
+ const comment = this.GetCommentForConversation(conversationId);
285
+ if (comment?.CommentTypeID && typeof ConversationEngine.Instance.CommentTypeByID === 'function') {
286
+ const byId = ConversationEngine.Instance.CommentTypeByID(comment.CommentTypeID);
287
+ if (byId) {
288
+ return byId;
289
+ }
290
+ }
291
+ const code = this.GetCommentTypeCodeForConversation(conversationId);
292
+ if (typeof ConversationEngine.Instance.CommentTypeByCode === 'function') {
293
+ return ConversationEngine.Instance.CommentTypeByCode(code) ?? null;
294
+ }
295
+ return null;
296
+ }
170
297
  /**
171
298
  * Returns all anchored threads (open + optionally resolved) targeting a specific field.
172
299
  */
@@ -332,12 +459,110 @@ export class FormRecordCommentsCoordinatorService {
332
459
  this.notifyChanged();
333
460
  return updated;
334
461
  }
462
+ /**
463
+ * Accepts a pending `MJ: Field Suggestions` row as the current user, reloads the open
464
+ * target record so live form fields reflect the accepted value immediately, and refreshes
465
+ * the record's anchored comments and rollups.
466
+ */
467
+ async AcceptFieldSuggestion(suggestionId) {
468
+ const provider = this._provider;
469
+ const currentUser = provider?.CurrentUser ?? null;
470
+ if (!provider || !currentUser) {
471
+ return null;
472
+ }
473
+ const updated = await ConversationEngine.Instance.AcceptFieldSuggestion(suggestionId, currentUser, provider);
474
+ this.applyDisposedSuggestionOptimistically(updated, suggestionId, 'Accepted', currentUser.ID);
475
+ const activeRecord = this._record;
476
+ if (activeRecord?.IsSaved && activeRecord.PrimaryKey && !activeRecord.Dirty) {
477
+ const changedField = (updated.AnchorKey ?? '').trim();
478
+ const changedSet = new Set();
479
+ if (changedField) {
480
+ changedSet.add(changedField);
481
+ changedSet.add(changedField.toLowerCase());
482
+ }
483
+ let reloaded = false;
484
+ if (typeof activeRecord.InnerLoad === 'function') {
485
+ try {
486
+ reloaded = await activeRecord.InnerLoad(activeRecord.PrimaryKey);
487
+ }
488
+ catch (reloadError) {
489
+ LogError(`FormRecordCommentsCoordinatorService.AcceptFieldSuggestion: target record reload failed after suggestion accept succeeded: ${reloadError instanceof Error ? reloadError.message : String(reloadError)}`);
490
+ }
491
+ }
492
+ if (reloaded && this._refreshCoordinator) {
493
+ if (changedSet.size > 0) {
494
+ this._refreshCoordinator.NotifyRemoteUpdate(activeRecord, changedSet);
495
+ }
496
+ else {
497
+ this._refreshCoordinator.Notify(activeRecord);
498
+ }
499
+ }
500
+ }
501
+ try {
502
+ await this.LoadForRecord(this._record, provider, true);
503
+ }
504
+ catch (refreshError) {
505
+ LogError(`FormRecordCommentsCoordinatorService.AcceptFieldSuggestion: comments refresh failed after suggestion accept succeeded: ${refreshError instanceof Error ? refreshError.message : String(refreshError)}`);
506
+ }
507
+ return updated;
508
+ }
509
+ /**
510
+ * Rejects a pending `MJ: Field Suggestions` row as the current user and refreshes
511
+ * the record's anchored comments and rollups.
512
+ */
513
+ async RejectFieldSuggestion(suggestionId) {
514
+ const provider = this._provider;
515
+ const currentUser = provider?.CurrentUser ?? null;
516
+ if (!provider || !currentUser) {
517
+ return null;
518
+ }
519
+ const updated = await ConversationEngine.Instance.RejectFieldSuggestion(suggestionId, currentUser, provider);
520
+ this.applyDisposedSuggestionOptimistically(updated, suggestionId, 'Rejected', currentUser.ID);
521
+ try {
522
+ await this.LoadForRecord(this._record, provider, true);
523
+ }
524
+ catch (refreshError) {
525
+ LogError(`FormRecordCommentsCoordinatorService.RejectFieldSuggestion: comments refresh failed after suggestion reject succeeded: ${refreshError instanceof Error ? refreshError.message : String(refreshError)}`);
526
+ }
527
+ return updated;
528
+ }
529
+ applyDisposedSuggestionOptimistically(updated, fallbackSuggestionId, outcome, actingUserId) {
530
+ const normId = NormalizeUUID(updated.ID || fallbackSuggestionId);
531
+ this._suggestionsByConversationId.set(normId, updated);
532
+ this._commentTypeCodeByConversationId.set(normId, COMMENT_TYPE_CODES.FIELD_SUGGESTION);
533
+ const now = updated.ResolvedAt ?? new Date();
534
+ const resolvedBy = updated.ResolvedByUserID ?? actingUserId;
535
+ const acceptedAnchorKey = outcome === 'Accepted' ? (updated.AnchorKey ?? '').trim().toLowerCase() : '';
536
+ for (const conv of this._conversations) {
537
+ const convNormId = NormalizeUUID(conv.ID);
538
+ if (convNormId === normId) {
539
+ conv.IsResolved = true;
540
+ conv.ResolvedByUserID = resolvedBy;
541
+ conv.ResolvedAt = now;
542
+ continue;
543
+ }
544
+ if (acceptedAnchorKey) {
545
+ const sibling = this._suggestionsByConversationId.get(convNormId);
546
+ if (sibling &&
547
+ sibling.Outcome === null &&
548
+ (sibling.AnchorKey ?? '').trim().toLowerCase() === acceptedAnchorKey) {
549
+ sibling.Outcome = 'Superseded';
550
+ conv.IsResolved = true;
551
+ conv.ResolvedByUserID = resolvedBy;
552
+ conv.ResolvedAt = now;
553
+ }
554
+ }
555
+ }
556
+ this.recomputeRollup();
557
+ this.notifyChanged();
558
+ }
335
559
  /**
336
560
  * Opens the inline anchored comment popover tethered to a specific field or section,
337
561
  * lazy-loading the record's anchored conversations if not yet loaded.
338
562
  */
339
563
  OpenPopoverForTarget(target) {
340
564
  this._activePopoverTarget = target;
565
+ this._popoverTypeFilter = target.PreferredTypeFilter?.trim() || 'all';
341
566
  if (!this._isLoaded && !this._isLoading) {
342
567
  void this.LoadForRecord();
343
568
  }
@@ -350,18 +575,23 @@ export class FormRecordCommentsCoordinatorService {
350
575
  if (!this._activePopoverTarget)
351
576
  return;
352
577
  this._activePopoverTarget = null;
578
+ this._popoverTypeFilter = 'all';
353
579
  this.notifyChanged();
354
580
  }
355
581
  /**
356
- * Opens or closes the Record Comments slide-in drawer, optionally pre-filtering to a target.
582
+ * Opens or closes the Notes & suggestions slide-in drawer, optionally pre-filtering to a target.
357
583
  */
358
584
  SetDrawerOpen(open, targetFilter) {
359
585
  this._isDrawerOpen = open;
360
586
  if (targetFilter !== undefined) {
361
587
  this._drawerTargetFilter = targetFilter;
588
+ if (targetFilter?.PreferredTypeFilter) {
589
+ this._drawerTypeFilter = targetFilter.PreferredTypeFilter;
590
+ }
362
591
  }
363
592
  if (open) {
364
593
  this._activePopoverTarget = null;
594
+ this._popoverTypeFilter = 'all';
365
595
  if (!this._isLoaded && !this._isLoading) {
366
596
  void this.LoadForRecord();
367
597
  }
@@ -372,6 +602,16 @@ export class FormRecordCommentsCoordinatorService {
372
602
  this._drawerStatusFilter = status;
373
603
  this.notifyChanged();
374
604
  }
605
+ SetDrawerTypeFilter(typeCode) {
606
+ const cleaned = (typeCode ?? '').trim();
607
+ this._drawerTypeFilter = !cleaned || cleaned.toLowerCase() === 'all' ? 'all' : cleaned.toUpperCase();
608
+ this.notifyChanged();
609
+ }
610
+ SetPopoverTypeFilter(typeCode) {
611
+ const cleaned = (typeCode ?? '').trim();
612
+ this._popoverTypeFilter = !cleaned || cleaned.toLowerCase() === 'all' ? 'all' : cleaned.toUpperCase();
613
+ this.notifyChanged();
614
+ }
375
615
  SetDrawerTargetFilter(target) {
376
616
  this._drawerTargetFilter = target;
377
617
  this.notifyChanged();
@@ -391,7 +631,7 @@ export class FormRecordCommentsCoordinatorService {
391
631
  this._navigateToAnchor$.complete();
392
632
  }
393
633
  recomputeRollup() {
394
- this._rollup = ComputeAnchoredCommentCounts(this._conversations, this.CurrentUser, this.EntityInfo);
634
+ this._rollup = ComputeAnchoredCommentCounts(this._conversations, this.CurrentUser, this.EntityInfo, this._commentTypeCodeByConversationId);
395
635
  }
396
636
  getSerializedRecordId(record) {
397
637
  if (!record?.IsSaved || !record.PrimaryKey) {