@parhelia/core 0.3.12831 → 0.3.12832

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 (167) hide show
  1. package/dist/editor/agent-changes/agentChangeTargets.d.ts +58 -0
  2. package/dist/editor/agent-changes/agentChangeTargets.js +174 -0
  3. package/dist/editor/agent-changes/agentChangeTargets.js.map +1 -0
  4. package/dist/editor/agent-changes/agentChangeTextHighlight.d.ts +57 -0
  5. package/dist/editor/agent-changes/agentChangeTextHighlight.js +109 -0
  6. package/dist/editor/agent-changes/agentChangeTextHighlight.js.map +1 -0
  7. package/dist/editor/ai/activityRowNavigation.d.ts +28 -0
  8. package/dist/editor/ai/activityRowNavigation.js +53 -0
  9. package/dist/editor/ai/activityRowNavigation.js.map +1 -0
  10. package/dist/editor/ai/terminal/activeReasoningModel.d.ts +9 -0
  11. package/dist/editor/ai/terminal/activeReasoningModel.js +20 -0
  12. package/dist/editor/ai/terminal/activeReasoningModel.js.map +1 -0
  13. package/dist/editor/ai/terminal/agentDurations.d.ts +27 -0
  14. package/dist/editor/ai/terminal/agentDurations.js +89 -0
  15. package/dist/editor/ai/terminal/agentDurations.js.map +1 -0
  16. package/dist/editor/ai/terminal/agentTurnTiming.d.ts +35 -0
  17. package/dist/editor/ai/terminal/agentTurnTiming.js +128 -0
  18. package/dist/editor/ai/terminal/agentTurnTiming.js.map +1 -0
  19. package/dist/editor/ai/terminal/components/AgentMemorySettingsSection.d.ts +9 -0
  20. package/dist/editor/ai/terminal/components/AgentMemorySettingsSection.js +75 -0
  21. package/dist/editor/ai/terminal/components/AgentMemorySettingsSection.js.map +1 -0
  22. package/dist/editor/ai/terminal/components/AgentProfileRecovery.d.ts +10 -0
  23. package/dist/editor/ai/terminal/components/AgentProfileRecovery.js +12 -0
  24. package/dist/editor/ai/terminal/components/AgentProfileRecovery.js.map +1 -0
  25. package/dist/editor/ai/terminal/components/CreateItemToolCallContent.d.ts +3 -0
  26. package/dist/editor/ai/terminal/components/CreateItemToolCallContent.js +47 -0
  27. package/dist/editor/ai/terminal/components/CreateItemToolCallContent.js.map +1 -0
  28. package/dist/editor/ai/terminal/components/ResponseTurnDuration.d.ts +15 -0
  29. package/dist/editor/ai/terminal/components/ResponseTurnDuration.js +63 -0
  30. package/dist/editor/ai/terminal/components/ResponseTurnDuration.js.map +1 -0
  31. package/dist/editor/ai/terminal/components/toolCallResultJson.d.ts +1 -0
  32. package/dist/editor/ai/terminal/components/toolCallResultJson.js +46 -0
  33. package/dist/editor/ai/terminal/components/toolCallResultJson.js.map +1 -0
  34. package/dist/editor/ai/terminal/reasoningEffortLevels.d.ts +8 -0
  35. package/dist/editor/ai/terminal/reasoningEffortLevels.js +54 -0
  36. package/dist/editor/ai/terminal/reasoningEffortLevels.js.map +1 -0
  37. package/dist/editor/ai/terminal/requestUsage.d.ts +3 -0
  38. package/dist/editor/ai/terminal/requestUsage.js +22 -0
  39. package/dist/editor/ai/terminal/requestUsage.js.map +1 -0
  40. package/dist/editor/ai/terminal/useAgentProviderWait.d.ts +18 -0
  41. package/dist/editor/ai/terminal/useAgentProviderWait.js +23 -0
  42. package/dist/editor/ai/terminal/useAgentProviderWait.js.map +1 -0
  43. package/dist/editor/ai/terminal/useAgentReasoningEffortState.d.ts +5 -0
  44. package/dist/editor/ai/terminal/useAgentReasoningEffortState.js +10 -0
  45. package/dist/editor/ai/terminal/useAgentReasoningEffortState.js.map +1 -0
  46. package/dist/editor/bridge/bridgeKeys.d.ts +5 -0
  47. package/dist/editor/bridge/bridgeKeys.js +8 -0
  48. package/dist/editor/bridge/bridgeKeys.js.map +1 -0
  49. package/dist/editor/client/SessionsDialog.d.ts +2 -0
  50. package/dist/editor/client/SessionsDialog.js +27 -0
  51. package/dist/editor/client/SessionsDialog.js.map +1 -0
  52. package/dist/editor/client/agentLoadItemPolicy.d.ts +22 -0
  53. package/dist/editor/client/agentLoadItemPolicy.js +60 -0
  54. package/dist/editor/client/agentLoadItemPolicy.js.map +1 -0
  55. package/dist/editor/client/localUserEditActivity.d.ts +3 -0
  56. package/dist/editor/client/localUserEditActivity.js +12 -0
  57. package/dist/editor/client/localUserEditActivity.js.map +1 -0
  58. package/dist/editor/commands/mediaCommands.d.ts +5 -0
  59. package/dist/editor/commands/mediaCommands.js +59 -0
  60. package/dist/editor/commands/mediaCommands.js.map +1 -0
  61. package/dist/editor/componentVisualMode.d.ts +14 -0
  62. package/dist/editor/componentVisualMode.js +43 -0
  63. package/dist/editor/componentVisualMode.js.map +1 -0
  64. package/dist/editor/field-types/FieldHistoryBoundary.d.ts +7 -0
  65. package/dist/editor/field-types/FieldHistoryBoundary.js +19 -0
  66. package/dist/editor/field-types/FieldHistoryBoundary.js.map +1 -0
  67. package/dist/editor/field-types/richtext/utils/changeHighlight.d.ts +18 -0
  68. package/dist/editor/field-types/richtext/utils/changeHighlight.js +57 -0
  69. package/dist/editor/field-types/richtext/utils/changeHighlight.js.map +1 -0
  70. package/dist/editor/itemContextMenuGroups.d.ts +16 -0
  71. package/dist/editor/itemContextMenuGroups.js +48 -0
  72. package/dist/editor/itemContextMenuGroups.js.map +1 -0
  73. package/dist/editor/media-selector/UploadMediaFileDialog.d.ts +5 -0
  74. package/dist/editor/media-selector/UploadMediaFileDialog.js +14 -0
  75. package/dist/editor/media-selector/UploadMediaFileDialog.js.map +1 -0
  76. package/dist/editor/menubar/OpenPublishedPageButton.d.ts +1 -0
  77. package/dist/editor/menubar/OpenPublishedPageButton.js +22 -0
  78. package/dist/editor/menubar/OpenPublishedPageButton.js.map +1 -0
  79. package/dist/editor/page-editor-chrome/AgentChangeHighlightings.d.ts +20 -0
  80. package/dist/editor/page-editor-chrome/AgentChangeHighlightings.js +31 -0
  81. package/dist/editor/page-editor-chrome/AgentChangeHighlightings.js.map +1 -0
  82. package/dist/editor/page-editor-chrome/DiffHighlightOverlay.d.ts +33 -0
  83. package/dist/editor/page-editor-chrome/DiffHighlightOverlay.js +290 -0
  84. package/dist/editor/page-editor-chrome/DiffHighlightOverlay.js.map +1 -0
  85. package/dist/editor/page-editor-chrome/diffRulerSegments.d.ts +18 -0
  86. package/dist/editor/page-editor-chrome/diffRulerSegments.js +37 -0
  87. package/dist/editor/page-editor-chrome/diffRulerSegments.js.map +1 -0
  88. package/dist/editor/page-viewer/PreviewModeNotice.d.ts +7 -0
  89. package/dist/editor/page-viewer/PreviewModeNotice.js +19 -0
  90. package/dist/editor/page-viewer/PreviewModeNotice.js.map +1 -0
  91. package/dist/editor/page-viewer/previewEditAttempt.d.ts +31 -0
  92. package/dist/editor/page-viewer/previewEditAttempt.js +68 -0
  93. package/dist/editor/page-viewer/previewEditAttempt.js.map +1 -0
  94. package/dist/editor/services/migrationService.d.ts +31 -0
  95. package/dist/editor/services/migrationService.js +22 -0
  96. package/dist/editor/services/migrationService.js.map +1 -0
  97. package/dist/editor/services/publicSiteService.d.ts +40 -0
  98. package/dist/editor/services/publicSiteService.js +5 -0
  99. package/dist/editor/services/publicSiteService.js.map +1 -0
  100. package/dist/editor/settings/MigrationJournalCard.d.ts +12 -0
  101. package/dist/editor/settings/MigrationJournalCard.js +114 -0
  102. package/dist/editor/settings/MigrationJournalCard.js.map +1 -0
  103. package/dist/editor/settings/panels/PublicSiteEntryDialog.d.ts +8 -0
  104. package/dist/editor/settings/panels/PublicSiteEntryDialog.js +113 -0
  105. package/dist/editor/settings/panels/PublicSiteEntryDialog.js.map +1 -0
  106. package/dist/editor/settings/panels/PublicSitesPanel.d.ts +1 -0
  107. package/dist/editor/settings/panels/PublicSitesPanel.js +153 -0
  108. package/dist/editor/settings/panels/PublicSitesPanel.js.map +1 -0
  109. package/dist/editor/settings/panels/publicSiteHelpers.d.ts +6 -0
  110. package/dist/editor/settings/panels/publicSiteHelpers.js +30 -0
  111. package/dist/editor/settings/panels/publicSiteHelpers.js.map +1 -0
  112. package/dist/editor/sidebar/OperationDetailsContent.d.ts +14 -0
  113. package/dist/editor/sidebar/OperationDetailsContent.js +521 -0
  114. package/dist/editor/sidebar/OperationDetailsContent.js.map +1 -0
  115. package/dist/editor/sidebar/liveComponentThumbnails.d.ts +53 -0
  116. package/dist/editor/sidebar/liveComponentThumbnails.js +204 -0
  117. package/dist/editor/sidebar/liveComponentThumbnails.js.map +1 -0
  118. package/dist/editor/ui/PublishReadinessSummary.d.ts +12 -0
  119. package/dist/editor/ui/PublishReadinessSummary.js +34 -0
  120. package/dist/editor/ui/PublishReadinessSummary.js.map +1 -0
  121. package/dist/editor/ui/publishReadiness.d.ts +98 -0
  122. package/dist/editor/ui/publishReadiness.js +307 -0
  123. package/dist/editor/ui/publishReadiness.js.map +1 -0
  124. package/dist/editor/ui/usePublishingItem.d.ts +8 -0
  125. package/dist/editor/ui/usePublishingItem.js +47 -0
  126. package/dist/editor/ui/usePublishingItem.js.map +1 -0
  127. package/dist/editor/utils/linkDisplay.d.ts +12 -0
  128. package/dist/editor/utils/linkDisplay.js +23 -0
  129. package/dist/editor/utils/linkDisplay.js.map +1 -0
  130. package/dist/editor/validation/ValidationIssuesPopover.d.ts +39 -0
  131. package/dist/editor/validation/ValidationIssuesPopover.js +51 -0
  132. package/dist/editor/validation/ValidationIssuesPopover.js.map +1 -0
  133. package/dist/editor/validation/navigateToValidationIssue.d.ts +13 -0
  134. package/dist/editor/validation/navigateToValidationIssue.js +43 -0
  135. package/dist/editor/validation/navigateToValidationIssue.js.map +1 -0
  136. package/dist/editor/validation/validationFixAgent.d.ts +26 -0
  137. package/dist/editor/validation/validationFixAgent.js +124 -0
  138. package/dist/editor/validation/validationFixAgent.js.map +1 -0
  139. package/dist/editor/validation/validationSeverity.d.ts +15 -0
  140. package/dist/editor/validation/validationSeverity.js +47 -0
  141. package/dist/editor/validation/validationSeverity.js.map +1 -0
  142. package/dist/lib/viewportClip.d.ts +18 -0
  143. package/dist/lib/viewportClip.js +22 -0
  144. package/dist/lib/viewportClip.js.map +1 -0
  145. package/dist/revision.d.ts +2 -2
  146. package/dist/revision.js +2 -2
  147. package/dist/task-board/components/ProjectProgressIndicator.d.ts +8 -0
  148. package/dist/task-board/components/ProjectProgressIndicator.js +17 -0
  149. package/dist/task-board/components/ProjectProgressIndicator.js.map +1 -0
  150. package/dist/task-board/components/commentAuthor.d.ts +14 -0
  151. package/dist/task-board/components/commentAuthor.js +25 -0
  152. package/dist/task-board/components/commentAuthor.js.map +1 -0
  153. package/dist/task-board/utils/projectDashboardModel.d.ts +68 -0
  154. package/dist/task-board/utils/projectDashboardModel.js +355 -0
  155. package/dist/task-board/utils/projectDashboardModel.js.map +1 -0
  156. package/dist/task-board/views/ProjectDashboardView.d.ts +28 -0
  157. package/dist/task-board/views/ProjectDashboardView.js +316 -0
  158. package/dist/task-board/views/ProjectDashboardView.js.map +1 -0
  159. package/dist/tour/TourInputBoundary.d.ts +6 -0
  160. package/dist/tour/TourInputBoundary.js +82 -0
  161. package/dist/tour/TourInputBoundary.js.map +1 -0
  162. package/dist/tour/sandbox-tour.js +5 -3
  163. package/dist/tour/sandbox-tour.js.map +1 -1
  164. package/dist/tour/tour-utils.d.ts +6 -0
  165. package/dist/tour/tour-utils.js +10 -0
  166. package/dist/tour/tour-utils.js.map +1 -1
  167. package/package.json +1 -1
@@ -0,0 +1,307 @@
1
+ export function isReadyToPublish(item) {
2
+ return item.isPublishable && !item.isPublished;
3
+ }
4
+ export function classifyPublishStatus(status) {
5
+ const normalized = status.trim().toLowerCase();
6
+ if (normalized === "published")
7
+ return { outcome: "published", impact: "none" };
8
+ if (normalized.startsWith("item is not yet published") ||
9
+ normalized.startsWith("language version is not yet published.")) {
10
+ return { outcome: "pending", impact: "never-published" };
11
+ }
12
+ if (normalized.startsWith("version is not yet published: currently published version:") ||
13
+ normalized.startsWith("version is not yet published. published revision:") ||
14
+ normalized.startsWith("published item has a different name:")) {
15
+ return { outcome: "pending", impact: "stale" };
16
+ }
17
+ if (normalized.startsWith("item has no valid version, but version")) {
18
+ return { outcome: "will-not-publish", impact: "stale" };
19
+ }
20
+ if (normalized.startsWith("this item has no valid version and will not be published.")) {
21
+ return { outcome: "will-not-publish", impact: "never-published" };
22
+ }
23
+ if (normalized.startsWith("this version is still published even though it is not the valid version.") ||
24
+ normalized.startsWith("this version will not be published. valid version is")) {
25
+ const match = status.match(/valid version is (\d+)/i);
26
+ return {
27
+ outcome: "will-not-publish",
28
+ impact: "other-version",
29
+ ...(match ? { validVersion: Number(match[1]) } : {}),
30
+ };
31
+ }
32
+ return { outcome: "unknown", impact: "unknown" };
33
+ }
34
+ const matchStatus = (status, pattern) => status.trim().match(pattern);
35
+ /**
36
+ * Turns a canonical Sitecore publish status into a short badge label plus an
37
+ * optional detail line, so the table stays scannable and the specifics
38
+ * (published revision, currently published version, valid version, published
39
+ * name) move into a tooltip. Unknown statuses are shown verbatim.
40
+ */
41
+ export function describePublishStatus(status) {
42
+ const normalized = status.trim().toLowerCase();
43
+ let match;
44
+ if (normalized === "published")
45
+ return { label: "Published" };
46
+ if (normalized === "item is not yet published")
47
+ return { label: "Not yet published" };
48
+ if (normalized === "language version is not yet published.")
49
+ return {
50
+ label: "Not yet published",
51
+ detail: "This language version has never been published.",
52
+ };
53
+ if ((match = matchStatus(status, /^version is not yet published: currently published version: (\d+)/i)))
54
+ return {
55
+ label: "Not yet published",
56
+ detail: `Version ${match[1]} is currently published.`,
57
+ };
58
+ if ((match = matchStatus(status, /^version is not yet published\. published revision: (\S+)/i)))
59
+ return {
60
+ label: "Changes not published",
61
+ detail: `An earlier revision of this version is live. Published revision: ${match[1]}`,
62
+ };
63
+ if ((match = matchStatus(status, /^published item has a different name: (.+)$/i)))
64
+ return {
65
+ label: "Name changed",
66
+ detail: `The published item is still named "${(match[1] ?? "").trim()}".`,
67
+ };
68
+ if ((match = matchStatus(status, /^item has no valid version, but version (\d+) is still published/i)))
69
+ return {
70
+ label: "No valid version",
71
+ detail: `Version ${match[1]} is still published. Check the publish restrictions.`,
72
+ };
73
+ if (normalized.startsWith("this item has no valid version and will not be published"))
74
+ return {
75
+ label: "Will not publish",
76
+ detail: "No valid version. Check the publish restrictions.",
77
+ };
78
+ if ((match = matchStatus(status, /^this version is still published even though it is not the valid version\. valid version is (\d+)/i)))
79
+ return {
80
+ label: "Not the valid version",
81
+ detail: `This version is still published, but version ${match[1]} is the valid version.`,
82
+ };
83
+ if ((match = matchStatus(status, /^this version will not be published\. valid version is (\d+)/i)))
84
+ return {
85
+ label: "Will not publish",
86
+ detail: `Version ${match[1]} is the valid version, not this one.`,
87
+ };
88
+ return { label: status.trim() };
89
+ }
90
+ function normalizeDescriptorId(id) {
91
+ return (id ?? "").replace(/[{}]/g, "").toLowerCase();
92
+ }
93
+ /**
94
+ * Compares descriptors the way the workbox does: ids without braces and
95
+ * case-insensitive, languages case-insensitive. A version of 0/undefined means
96
+ * "latest" (the editor keeps the *requested* descriptor when an item is opened
97
+ * from the tree) and matches any concrete version of that item.
98
+ */
99
+ export function isSameDescriptor(a, b) {
100
+ return (normalizeDescriptorId(a.id) === normalizeDescriptorId(b.id) &&
101
+ (a.language ?? "").toLowerCase() === (b.language ?? "").toLowerCase() &&
102
+ (!a.version || !b.version || a.version === b.version));
103
+ }
104
+ /** The workbox row for the item currently open in the editor, if listed. */
105
+ export function findCurrentWorkboxItem(workboxItems, currentItem) {
106
+ return currentItem
107
+ ? workboxItems.find((item) => isSameDescriptor(item.item, currentItem))
108
+ : undefined;
109
+ }
110
+ const compareText = (left, right) => (left ?? "").localeCompare(right ?? "", undefined, {
111
+ sensitivity: "base",
112
+ numeric: true,
113
+ });
114
+ /**
115
+ * Display order for the Publish dialog: the current item stays first, then the
116
+ * related items grouped by template name and ordered by item path, so media,
117
+ * layouts and datasources cluster together instead of following the link
118
+ * database's order. Returns a new array; the input is left untouched.
119
+ */
120
+ export function sortWorkboxItemsForPublish(workboxItems, currentItem) {
121
+ const isCurrent = (item) => !!currentItem && isSameDescriptor(item.item, currentItem);
122
+ return [...workboxItems].sort((left, right) => Number(isCurrent(right)) - Number(isCurrent(left)) ||
123
+ compareText(left.templateName, right.templateName) ||
124
+ compareText(left.path, right.path) ||
125
+ compareText(left.name, right.name) ||
126
+ compareText(left.item.language, right.item.language) ||
127
+ (left.item.version ?? 0) - (right.item.version ?? 0));
128
+ }
129
+ /**
130
+ * Counts the validation issues that affect the listed workbox items. The
131
+ * server only reports failing validators, so every result is an issue; a
132
+ * page's entry also carries results for its embedded components, which are
133
+ * counted with the page.
134
+ */
135
+ export function getPublishValidationSummary(workboxItems, validationResults) {
136
+ if (!validationResults?.length)
137
+ return { itemCount: 0, issueCount: 0 };
138
+ return workboxItems.reduce((summary, item) => {
139
+ const issueCount = validationResults
140
+ .filter((result) => isSameDescriptor(result.item, item.item))
141
+ .reduce((count, result) => count + result.results.length, 0);
142
+ return issueCount
143
+ ? {
144
+ itemCount: summary.itemCount + 1,
145
+ issueCount: summary.issueCount + issueCount,
146
+ }
147
+ : summary;
148
+ }, { itemCount: 0, issueCount: 0 });
149
+ }
150
+ /** True when `path` lies strictly below `rootPath` (Sitecore paths are case-insensitive). */
151
+ export function isDescendantPath(path, rootPath) {
152
+ if (!path || !rootPath)
153
+ return false;
154
+ const root = rootPath.toLowerCase();
155
+ const prefix = root.endsWith("/") ? root : `${root}/`;
156
+ return path.toLowerCase() !== root && path.toLowerCase().startsWith(prefix);
157
+ }
158
+ const impactSeverity = {
159
+ none: 0,
160
+ unknown: 1,
161
+ "other-version": 2,
162
+ stale: 3,
163
+ "never-published": 4,
164
+ };
165
+ function getItemReadiness(item, blockedByWorkflow) {
166
+ const targets = Object.entries(item.publishStatus).map(([target, status]) => ({
167
+ target,
168
+ ...classifyPublishStatus(status),
169
+ }));
170
+ const unpublished = targets.filter((target) => target.outcome !== "published");
171
+ const restricted = targets.filter((target) => target.outcome === "will-not-publish");
172
+ const worst = unpublished.reduce((result, target) => !result || impactSeverity[target.impact] > impactSeverity[result.impact]
173
+ ? target
174
+ : result, undefined);
175
+ const restriction = restricted.reduce((result, target) => !result || impactSeverity[target.impact] > impactSeverity[result.impact]
176
+ ? target
177
+ : result, undefined);
178
+ const reason = blockedByWorkflow
179
+ ? { kind: "workflow", workflowState: item.workflowState }
180
+ : restriction
181
+ ? restriction.impact === "other-version"
182
+ ? { kind: "not-valid-version", validVersion: restriction.validVersion }
183
+ : { kind: "no-valid-version" }
184
+ : undefined;
185
+ return {
186
+ reason,
187
+ impact: worst?.impact ?? (targets.length ? "none" : "unknown"),
188
+ validVersion: worst?.validVersion,
189
+ affectedTargets: (blockedByWorkflow ? unpublished : restricted).map(({ target }) => target),
190
+ targetCount: targets.length,
191
+ };
192
+ }
193
+ export function getPublishReadiness({ workboxItems, currentItem, pagePath, includeSubitems, }) {
194
+ const coveredBySubitems = (item) => includeSubitems &&
195
+ (item.item.language || currentItem?.language) === currentItem?.language &&
196
+ isDescendantPath(item.path, pagePath);
197
+ // Preserve the existing batch even when a target warns: other targets may
198
+ // still need publishing, or Sitecore may publish the valid version instead.
199
+ const batchDescriptors = workboxItems
200
+ .filter(isReadyToPublish)
201
+ .filter((item) => !coveredBySubitems(item))
202
+ .map((item) => ({
203
+ ...item.item,
204
+ language: item.item.language || currentItem?.language,
205
+ }))
206
+ .filter((descriptor) => !!descriptor.language &&
207
+ (!currentItem ||
208
+ !isSameDescriptor(descriptor, currentItem)));
209
+ const page = findCurrentWorkboxItem(workboxItems, currentItem);
210
+ const blockedByWorkflow = !!page?.workflowState && !page.isPublishable;
211
+ const currentPage = page
212
+ ? {
213
+ item: page,
214
+ blockedByWorkflow,
215
+ ...getItemReadiness(page, blockedByWorkflow),
216
+ }
217
+ : undefined;
218
+ const entries = workboxItems
219
+ .filter((item) => !currentItem || !isSameDescriptor(item.item, currentItem))
220
+ .map((item) => {
221
+ const details = getItemReadiness(item, !item.isPublishable);
222
+ const category = item.isPublished
223
+ ? "already-published"
224
+ : !item.isPublishable
225
+ ? "blocked-by-workflow"
226
+ : details.reason
227
+ ? "will-not-publish"
228
+ : coveredBySubitems(item)
229
+ ? "covered-by-subitems"
230
+ : "will-publish";
231
+ const descriptor = {
232
+ ...item.item,
233
+ language: item.item.language || currentItem?.language,
234
+ };
235
+ return {
236
+ item,
237
+ // Matches WorkboxItemsTable's row key; a future Show action can use it.
238
+ key: [
239
+ item.item.id?.toLowerCase(),
240
+ item.item.language?.toLowerCase(),
241
+ item.item.version ?? 0,
242
+ item.item.database?.toLowerCase() ?? "",
243
+ ].join("|"),
244
+ category,
245
+ inBatch: isReadyToPublish(item) &&
246
+ !coveredBySubitems(item) &&
247
+ !!descriptor.language &&
248
+ (!currentItem ||
249
+ !isSameDescriptor(descriptor, currentItem)),
250
+ ...details,
251
+ };
252
+ });
253
+ return {
254
+ currentPage,
255
+ entries,
256
+ batchDescriptors,
257
+ leftBehind: entries.filter((entry) => entry.category === "blocked-by-workflow" ||
258
+ entry.category === "will-not-publish"),
259
+ };
260
+ }
261
+ export function getPublishReasonText(reason, affectedTargets, targetCount) {
262
+ const prefix = targetCount > 1 && affectedTargets.length
263
+ ? `On ${affectedTargets.join(", ")}: `
264
+ : "";
265
+ switch (reason.kind) {
266
+ case "workflow":
267
+ return (prefix +
268
+ (reason.workflowState
269
+ ? `In workflow state "${reason.workflowState}".`
270
+ : "Not in a final workflow state."));
271
+ case "no-valid-version":
272
+ return prefix + "No valid version. Check its publish restrictions.";
273
+ case "not-valid-version":
274
+ return (prefix +
275
+ (reason.validVersion !== undefined
276
+ ? `Version ${reason.validVersion} is the valid version, not this one.`
277
+ : "Not the valid version."));
278
+ }
279
+ }
280
+ export function getPublishImpactText(impact, validVersion) {
281
+ switch (impact) {
282
+ case "never-published":
283
+ return "Visitors will see nothing for this item until it is published.";
284
+ case "stale":
285
+ return "Visitors will still see the previous version.";
286
+ case "other-version":
287
+ return validVersion !== undefined
288
+ ? `Visitors will see version ${validVersion} instead.`
289
+ : "Visitors will see a different version.";
290
+ default:
291
+ return undefined;
292
+ }
293
+ }
294
+ export function getPublishReadinessHeadline(readiness) {
295
+ const count = readiness.leftBehind.length;
296
+ const related = `${count} related item${count === 1 ? "" : "s"}`;
297
+ if (readiness.currentPage?.blockedByWorkflow)
298
+ return count
299
+ ? `This page cannot be published yet, and ${related} cannot either.`
300
+ : "This page cannot be published yet.";
301
+ if (readiness.currentPage?.reason)
302
+ return count
303
+ ? `This page will not go live as it is, and ${related} cannot publish.`
304
+ : "This page will not go live as it is.";
305
+ return count ? `This page can publish, but ${related} cannot.` : undefined;
306
+ }
307
+ //# sourceMappingURL=publishReadiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishReadiness.js","sourceRoot":"","sources":["../../../src/editor/ui/publishReadiness.ts"],"names":[],"mappings":"AAiDA,MAAM,UAAU,gBAAgB,CAAC,IAAiB;IAChD,OAAO,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAKlD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/C,IAAI,UAAU,KAAK,WAAW;QAC5B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAClD,IACE,UAAU,CAAC,UAAU,CAAC,2BAA2B,CAAC;QAClD,UAAU,CAAC,UAAU,CAAC,wCAAwC,CAAC,EAC/D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC3D,CAAC;IACD,IACE,UAAU,CAAC,UAAU,CACnB,4DAA4D,CAC7D;QACD,UAAU,CAAC,UAAU,CACnB,mDAAmD,CACpD;QACD,UAAU,CAAC,UAAU,CAAC,sCAAsC,CAAC,EAC7D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,wCAAwC,CAAC,EAAE,CAAC;QACpE,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC1D,CAAC;IACD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M,EAAE,CAAC;QACf,KAAK,iBAAiB;YACpB,OAAO,gEAAgE,CAAC;QAC1E,KAAK,OAAO;YACV,OAAO,+CAA+C,CAAC;QACzD,KAAK,eAAe;YAClB,OAAO,YAAY,KAAK,SAAS;gBAC/B,CAAC,CAAC,6BAA6B,YAAY,WAAW;gBACtD,CAAC,CAAC,wCAAwC,CAAC;QAC/C;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,SAA2B;IAE3B,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;IAC1C,MAAM,OAAO,GAAG,GAAG,KAAK,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACjE,IAAI,SAAS,CAAC,WAAW,EAAE,iBAAiB;QAC1C,OAAO,KAAK;YACV,CAAC,CAAC,0CAA0C,OAAO,iBAAiB;YACpE,CAAC,CAAC,oCAAoC,CAAC;IAC3C,IAAI,SAAS,CAAC,WAAW,EAAE,MAAM;QAC/B,OAAO,KAAK;YACV,CAAC,CAAC,4CAA4C,OAAO,kBAAkB;YACvE,CAAC,CAAC,sCAAsC,CAAC;IAC7C,OAAO,KAAK,CAAC,CAAC,CAAC,8BAA8B,OAAO,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { FullItem } from "../pageModel";
2
+ /** Resolve the owner before showing publish options or allowing a publish. */
3
+ export declare function usePublishingItem(source: FullItem | undefined): {
4
+ item: FullItem | undefined;
5
+ isLoading: boolean;
6
+ error: string | undefined;
7
+ isEmbedded: boolean;
8
+ };
@@ -0,0 +1,47 @@
1
+ import { useEffect, useState } from "react";
2
+ import { useEditContext } from "../client/editContext";
3
+ /** Resolve the owner before showing publish options or allowing a publish. */
4
+ export function usePublishingItem(source) {
5
+ const editContext = useEditContext();
6
+ const repository = editContext?.itemsRepository;
7
+ const mainItemId = source?.mainItemId;
8
+ const isEmbedded = !!mainItemId &&
9
+ mainItemId.replace(/[{}]/g, "").toLowerCase() !==
10
+ source?.id.replace(/[{}]/g, "").toLowerCase();
11
+ const [resolved, setResolved] = useState();
12
+ useEffect(() => {
13
+ if (!isEmbedded || !source || !repository)
14
+ return;
15
+ let cancelled = false;
16
+ repository
17
+ .getItem({ ...source.descriptor, id: mainItemId })
18
+ .then((item) => {
19
+ if (!cancelled)
20
+ setResolved({
21
+ source,
22
+ item,
23
+ error: item
24
+ ? undefined
25
+ : "Failed to load the main item for publishing.",
26
+ });
27
+ })
28
+ .catch(() => {
29
+ if (!cancelled)
30
+ setResolved({
31
+ source,
32
+ error: "Failed to load the main item for publishing.",
33
+ });
34
+ });
35
+ return () => {
36
+ cancelled = true;
37
+ };
38
+ }, [isEmbedded, source, mainItemId, repository]);
39
+ const current = resolved?.source === source ? resolved : undefined;
40
+ return {
41
+ item: isEmbedded ? current?.item : source,
42
+ isLoading: isEmbedded && !current,
43
+ error: isEmbedded ? current?.error : undefined,
44
+ isEmbedded,
45
+ };
46
+ }
47
+ //# sourceMappingURL=usePublishingItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePublishingItem.js","sourceRoot":"","sources":["../../../src/editor/ui/usePublishingItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,MAA4B;IAC5D,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,WAAW,EAAE,eAAe,CAAC;IAChD,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,CAAC;IACtC,MAAM,UAAU,GACd,CAAC,CAAC,UAAU;QACZ,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,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O,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS;QAC9C,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Builds the URL shown for a general link field: the resolved target URL with
3
+ * the configured anchor appended as a fragment.
4
+ *
5
+ * The backend keeps `url` and `anchor` separate so the link dialog can edit
6
+ * them independently; this is the read-only composition of the two.
7
+ */
8
+ export declare function formatLinkDisplayUrl(value: {
9
+ url?: string | null;
10
+ anchor?: string | null;
11
+ type?: string;
12
+ }): string;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Builds the URL shown for a general link field: the resolved target URL with
3
+ * the configured anchor appended as a fragment.
4
+ *
5
+ * The backend keeps `url` and `anchor` separate so the link dialog can edit
6
+ * them independently; this is the read-only composition of the two.
7
+ */
8
+ export function formatLinkDisplayUrl(value) {
9
+ const url = value.url ?? "";
10
+ const anchor = (value.anchor ?? "").trim().replace(/^#/, "");
11
+ // Sitecore's own "anchor" link type stores the fragment name as the url.
12
+ if (value.type === "anchor") {
13
+ const name = anchor || url.replace(/^#/, "");
14
+ return name ? `#${name}` : "";
15
+ }
16
+ if (!anchor)
17
+ return url;
18
+ // Anchor-only links (url="#section") already carry their fragment.
19
+ if (url.includes("#"))
20
+ return url;
21
+ return `${url}#${anchor}`;
22
+ }
23
+ //# sourceMappingURL=linkDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkDisplay.js","sourceRoot":"","sources":["../../../src/editor/utils/linkDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAIpC;IACC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE7D,yEAAyE;IACzE,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC;IACxB,mEAAmE;IACnE,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAClC,OAAO,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ import { PopoverContent } from "../../components/ui/popover";
3
+ import { SingleValidatorResult } from "../../types";
4
+ import { ItemDescriptor } from "../pageModel";
5
+ import { ValidationSeverity } from "./validationSeverity";
6
+ /** The coloured pill used as popover trigger on every surface. */
7
+ export declare const ValidationSeverityBadge: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children"> & {
8
+ severity: ValidationSeverity;
9
+ label: ReactNode;
10
+ }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
11
+ export type ValidationIssuesPopoverProps = {
12
+ /** Issues to list; pass them pre-filtered (filterValidationIssues). */
13
+ issues: readonly SingleValidatorResult[];
14
+ /** The item the issues belong to. */
15
+ item: ItemDescriptor;
16
+ /** Scope of the list when it was opened from a single field. */
17
+ field?: {
18
+ fieldId: string;
19
+ fieldName?: string;
20
+ };
21
+ trigger: ReactNode;
22
+ open?: boolean;
23
+ onOpenChange?: (open: boolean) => void;
24
+ /** Show each issue's field name (item-scoped lists). */
25
+ showFieldName?: boolean;
26
+ /** Row click; when set, rows render as buttons. */
27
+ onSelectIssue?: (issue: SingleValidatorResult) => void | Promise<void>;
28
+ /** Footer "Show all validation results". Default: opens the sidebar. */
29
+ showAllAction?: boolean;
30
+ onShowAll?: () => void;
31
+ /** Called after any footer or row action fired (e.g. to close a dialog). */
32
+ onAction?: () => void;
33
+ side?: ComponentProps<typeof PopoverContent>["side"];
34
+ align?: ComponentProps<typeof PopoverContent>["align"];
35
+ sideOffset?: number;
36
+ collisionPadding?: number;
37
+ contentClassName?: string;
38
+ };
39
+ export declare function ValidationIssuesPopover({ issues, item, field, trigger, open, onOpenChange, showFieldName, onSelectIssue, showAllAction, onShowAll, onAction, side, align, sideOffset, collisionPadding, contentClassName, }: ValidationIssuesPopoverProps): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { ListChecks, WandSparkles } from "lucide-react";
4
+ import { Popover, PopoverContent, PopoverTrigger, } from "../../components/ui/popover";
5
+ import { cn } from "../../lib/utils";
6
+ import { useEditContext } from "../client/editContext";
7
+ import { hasAgentsPanel, openAiAgentForValidationIssues, } from "./validationFixAgent";
8
+ import { formatValidationIssueCount, getValidationSeverity, validationSeverityStyles, } from "./validationSeverity";
9
+ const footerButtonClassName = "hover:bg-neutral-grey-5 flex w-full items-center gap-2 rounded px-3 py-2 text-xs transition-colors";
10
+ /** The coloured pill used as popover trigger on every surface. */
11
+ export const ValidationSeverityBadge = forwardRef(function ValidationSeverityBadge({ severity, label, className, ...props }, ref) {
12
+ const style = validationSeverityStyles[severity];
13
+ const Icon = style.icon;
14
+ return (_jsxs("button", { ref: ref, type: "button", className: cn(style.badge, "inline-flex cursor-pointer items-center gap-1 rounded px-1 py-0.5 text-[10px] leading-none whitespace-nowrap transition-opacity hover:opacity-80", className), ...props, children: [_jsx(Icon, { className: "h-3 w-3 shrink-0", strokeWidth: 1.5 }), label] }));
15
+ });
16
+ export function ValidationIssuesPopover({ issues, item, field, trigger, open, onOpenChange, showFieldName, onSelectIssue, showAllAction = true, onShowAll, onAction, side = "bottom", align = "start", sideOffset, collisionPadding, contentClassName, }) {
17
+ const editContext = useEditContext();
18
+ const canFix = hasAgentsPanel(editContext) && issues.length > 0;
19
+ const close = () => onOpenChange?.(false);
20
+ const handleFix = () => {
21
+ const started = openAiAgentForValidationIssues({ item, issues, field }, editContext);
22
+ close();
23
+ if (started)
24
+ onAction?.();
25
+ };
26
+ const handleShowAll = () => {
27
+ if (onShowAll)
28
+ onShowAll();
29
+ else
30
+ editContext?.openSidebar("validation");
31
+ close();
32
+ onAction?.();
33
+ };
34
+ const handleSelect = (issue) => {
35
+ close();
36
+ onAction?.();
37
+ void onSelectIssue?.(issue);
38
+ };
39
+ return (_jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: trigger }), _jsxs(PopoverContent, { className: cn("w-80 max-w-[calc(100vw-2rem)] p-0", contentClassName), side: side, align: align, sideOffset: sideOffset, collisionPadding: collisionPadding, "data-testid": "validation-issues-popover",
40
+ // The content is portaled, but React still bubbles its clicks to the
41
+ // React parent (e.g. a clickable table row). Keep them here.
42
+ onClick: (event) => event.stopPropagation(), children: [_jsxs("div", { className: "border-neutral-grey-10 flex items-center justify-between border-b px-3 py-2", children: [_jsx("span", { className: "text-xs font-medium", children: "Validation" }), _jsx("span", { className: "text-neutral-grey-50 text-[10px]", children: formatValidationIssueCount(issues.length) })] }), _jsx("ul", { className: "max-h-72 overflow-y-auto p-1", children: issues.map((issue) => {
43
+ const severity = getValidationSeverity(issue.result);
44
+ const style = validationSeverityStyles[severity];
45
+ const Icon = style.icon;
46
+ const body = (_jsxs(_Fragment, { children: [_jsx(Icon, { className: `${style.text} mt-0.5 h-3.5 w-3.5 shrink-0`, strokeWidth: 1.5 }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "text-neutral-grey-50 flex flex-wrap items-baseline gap-x-1.5 text-[10px] leading-tight", children: [showFieldName && issue.fieldName && (_jsx("span", { className: "text-neutral-grey-100 font-medium", children: issue.fieldName })), _jsx("span", { children: issue.validator })] }), _jsx("div", { className: "break-words select-text", children: issue.message })] })] }));
47
+ const key = `${issue.itemId}|${issue.fieldId}|${issue.validator}`;
48
+ return (_jsx("li", { "data-testid": "validation-issue-row", children: onSelectIssue ? (_jsx("button", { type: "button", className: "hover:bg-neutral-grey-5 flex w-full items-start gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors", onClick: () => handleSelect(issue), children: body })) : (_jsx("div", { className: "flex items-start gap-2 rounded px-2 py-1.5 text-xs", children: body })) }, key));
49
+ }) }), (canFix || showAllAction) && (_jsxs("div", { className: "border-neutral-grey-10 border-t p-1", children: [canFix && (_jsxs("button", { type: "button", className: footerButtonClassName, onClick: handleFix, "data-testid": "validation-fix-with-agent", children: [_jsx(WandSparkles, { strokeWidth: 1, className: "h-4 w-4" }), "Fix with agent"] })), showAllAction && (_jsxs("button", { type: "button", className: footerButtonClassName, onClick: handleShowAll, "data-testid": "validation-show-all", children: [_jsx(ListChecks, { strokeWidth: 1, className: "h-4 w-4" }), "Show all validation results"] }))] }))] })] }));
50
+ }
51
+ //# sourceMappingURL=ValidationIssuesPopover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationIssuesPopover.js","sourceRoot":"","sources":["../../../src/editor/validation/ValidationIssuesPopover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA6B,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,cAAc,EACd,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EAErB,wBAAwB,GACzB,MA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I,CAChB,kBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,qBAAqB,EAChC,OAAO,EAAE,aAAa,iBACV,qBAAqB,aAEjC,KAAC,UAAU,IAAC,WAAW,EAAE,CAAC,EAAE,SAAS,EAAC,SAAS,GAAG,mCAE3C,CACV,IACG,CACP,IACc,IACT,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { EditContextType } from "../client/editContext";
2
+ export declare const VALIDATION_SLOT_TAG = "validation";
3
+ export type ValidationIssueTarget = {
4
+ itemId: string;
5
+ language: string;
6
+ version: number;
7
+ fieldId?: string;
8
+ };
9
+ /**
10
+ * Opens the item a validation issue belongs to and focuses the field.
11
+ * Shared by the Validation sidebar rows and the issue popovers.
12
+ */
13
+ export declare function navigateToValidationIssue(editContext: EditContextType, target: ValidationIssueTarget, setFocusedField?: EditContextType["setFocusedField"] | undefined): Promise<void>;
@@ -0,0 +1,43 @@
1
+ import { stripGuid } from "../utils";
2
+ // All validation click-throughs open in this one shared slot (EditorSlot.tag).
3
+ export const VALIDATION_SLOT_TAG = "validation";
4
+ /**
5
+ * Opens the item a validation issue belongs to and focuses the field.
6
+ * Shared by the Validation sidebar rows and the issue popovers.
7
+ */
8
+ export async function navigateToValidationIssue(editContext, target, setFocusedField = editContext.setFocusedField) {
9
+ const itemDescriptor = {
10
+ id: target.itemId,
11
+ language: target.language,
12
+ version: target.version,
13
+ };
14
+ const slots = editContext.editorSlots ?? [];
15
+ const openSlot = slots.find((slot) => stripGuid(slot.itemDescriptor?.id ?? "") === stripGuid(itemDescriptor.id) &&
16
+ slot.itemDescriptor?.language?.toLowerCase() ===
17
+ itemDescriptor.language?.toLowerCase() &&
18
+ slot.itemDescriptor?.version === itemDescriptor.version);
19
+ if (openSlot) {
20
+ editContext.setActiveSlot(openSlot.slotId);
21
+ }
22
+ else {
23
+ // Open the result in the shared validation slot instead of replacing the
24
+ // reviewed page: replacing the page collapses the workbox scope and
25
+ // re-scopes the validation list to the single clicked item. Every click
26
+ // routes into the same tagged slot, so stepping through results never
27
+ // accumulates panes.
28
+ const validationSlot = slots.find((slot) => slot.tag === VALIDATION_SLOT_TAG);
29
+ const loadedItem = await editContext.loadItem(itemDescriptor, validationSlot
30
+ ? { targetSlotId: validationSlot.slotId }
31
+ : { openInNewSlot: true, newSlotTag: VALIDATION_SLOT_TAG });
32
+ if (!loadedItem)
33
+ return;
34
+ }
35
+ // Selection first: it keeps the component highlighted on its page canvas,
36
+ // and the focus-clearing effect only retains focusedField while
37
+ // selection[0] matches its item id.
38
+ editContext.select?.([target.itemId]);
39
+ if (target.fieldId) {
40
+ await setFocusedField?.({ item: itemDescriptor, fieldId: target.fieldId }, false);
41
+ }
42
+ }
43
+ //# sourceMappingURL=navigateToValidationIssue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigateToValidationIssue.js","sourceRoot":"","sources":["../../../src/editor/validation/navigateToValidationIssue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAShD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,WAA4B,EAC5B,MAA6B,EAC7B,eAAe,GAAmD,WAAW,CAAC,eAAe;IAE7F,MAAM,cAAc,GAAG;QACrB,EAAE,EAAE,MAAM,CAAC,MAAM;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,IAAI,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CACzB,CAAC,IAAI,EAAE,EAAE,CACP,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QACzE,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE;YAC1C,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE;QACxC,IAAI,CAAC,cAAc,EAAE,OAAO,KAAK,cAAc,CAAC,OAAO,CAC1D,CAAC;IAEF,IAAI,QAAQ,EAAE,CAAC;QACb,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,yEAAyE;QACzE,oEAAoE;QACpE,wEAAwE;QACxE,sEAAsE;QACtE,qBAAqB;QACrB,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAC/B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,mBAAmB,CAC3C,CAAC;QACF,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,QAAQ,CAC3C,cAAc,EACd,cAAc;YACZ,CAAC,CAAC,EAAE,YAAY,EAAE,cAAc,CAAC,MAAM,EAAE;YACzC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAC7D,CAAC;QACF,IAAI,CAAC,UAAU;YAAE,OAAO;IAC1B,CAAC;IAED,0EAA0E;IAC1E,gEAAgE;IAChE,oCAAoC;IACpC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,eAAe,EAAE,CACrB,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,EACjD,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { SingleValidatorResult } from "../../types";
2
+ import { EditContextType } from "../client/editContext";
3
+ import { ItemDescriptor } from "../pageModel";
4
+ export type ValidationFixTarget = {
5
+ /** The item the issues belong to (a page or an embedded component item). */
6
+ item: ItemDescriptor;
7
+ issues: readonly SingleValidatorResult[];
8
+ /** Set when the button was clicked on a single field of the item. */
9
+ field?: {
10
+ fieldId: string;
11
+ fieldName?: string;
12
+ };
13
+ };
14
+ export declare function hasAgentsPanel(editContext?: EditContextType): boolean;
15
+ /**
16
+ * Prompt for the agent. The vocabulary (field, validator, level, message)
17
+ * mirrors the validate-items tool's findings so the agent can match them
18
+ * after re-running the validation.
19
+ */
20
+ export declare function buildValidationFixPrompt(target: ValidationFixTarget): string;
21
+ /**
22
+ * Opens the Agents panel and starts a new agent that fixes the given
23
+ * validation issues. Mirrors openAiAgentForComment (reviews/commentAi.ts).
24
+ * Returns false when nothing was started (no panel, quota exceeded, error).
25
+ */
26
+ export declare function openAiAgentForValidationIssues(target: ValidationFixTarget, editContext?: EditContextType): boolean;