@aglyn/plugins-ai 1.0.0-beta.217 → 1.0.0-beta.219

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 (187) hide show
  1. package/README.md +2 -2
  2. package/package.json +17 -17
  3. package/src/index.d.ts +1 -0
  4. package/src/index.js.map +1 -1
  5. package/src/lib/activity/ai-activity-actions.js +10 -2
  6. package/src/lib/activity/ai-activity-actions.js.map +1 -1
  7. package/src/lib/components/ai-assist-provider.component.js +2 -2
  8. package/src/lib/components/ai-assist-provider.component.js.map +1 -1
  9. package/src/lib/components/ai-brief-dialog.component.js +3 -3
  10. package/src/lib/components/ai-brief-dialog.component.js.map +1 -1
  11. package/src/lib/components/ai-experiment-cards.component.js +1 -1
  12. package/src/lib/components/ai-experiment-cards.component.js.map +1 -1
  13. package/src/lib/components/ai-job-plan.component.d.ts +8 -0
  14. package/src/lib/components/ai-job-plan.component.js +21 -4
  15. package/src/lib/components/ai-job-plan.component.js.map +1 -1
  16. package/src/lib/components/ai-permissions-on-host.component.d.ts +12 -2
  17. package/src/lib/components/ai-permissions-on-host.component.js +12 -3
  18. package/src/lib/components/ai-permissions-on-host.component.js.map +1 -1
  19. package/src/lib/components/ai-product-copy-card.component.d.ts +1 -1
  20. package/src/lib/components/ai-product-copy-card.component.js.map +1 -1
  21. package/src/lib/components/ai-product-import-option.component.d.ts +1 -1
  22. package/src/lib/components/ai-product-import-option.component.js.map +1 -1
  23. package/src/lib/components/ai-product-zones.d.ts +124 -0
  24. package/src/lib/components/ai-product-zones.js +32 -0
  25. package/src/lib/components/ai-product-zones.js.map +1 -0
  26. package/src/lib/components/ai-products-hub-card.component.d.ts +1 -1
  27. package/src/lib/components/ai-products-hub-card.component.js.map +1 -1
  28. package/src/lib/components/ai-products-proposals.component.d.ts +1 -1
  29. package/src/lib/components/ai-products-proposals.component.js.map +1 -1
  30. package/src/lib/components/ai-seo-audit-card.component.js +35 -92
  31. package/src/lib/components/ai-seo-audit-card.component.js.map +1 -1
  32. package/src/lib/components/ai-seo-fields-card.component.js.map +1 -1
  33. package/src/lib/components/ai-theme-proposal-card.component.js.map +1 -1
  34. package/src/lib/components/assist-jobs-drawer.component.js +21 -15
  35. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  36. package/src/lib/components/assist-panel.component.js +2 -2
  37. package/src/lib/components/assist-panel.component.js.map +1 -1
  38. package/src/lib/components/assist-signals-page.component.js +2 -2
  39. package/src/lib/components/assist-signals-page.component.js.map +1 -1
  40. package/src/lib/jobs/ai-email-bindings.d.ts +28 -21
  41. package/src/lib/jobs/ai-email-bindings.js +75 -42
  42. package/src/lib/jobs/ai-email-bindings.js.map +1 -1
  43. package/src/lib/jobs/ai-job-campaign-step.d.ts +0 -2
  44. package/src/lib/jobs/ai-job-campaign-step.js +5 -10
  45. package/src/lib/jobs/ai-job-campaign-step.js.map +1 -1
  46. package/src/lib/jobs/ai-job-component-step.js +9 -3
  47. package/src/lib/jobs/ai-job-component-step.js.map +1 -1
  48. package/src/lib/jobs/ai-job-drafts.d.ts +9 -1
  49. package/src/lib/jobs/ai-job-drafts.js +12 -5
  50. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  51. package/src/lib/jobs/ai-job-email-step.d.ts +0 -2
  52. package/src/lib/jobs/ai-job-email-step.js +1 -3
  53. package/src/lib/jobs/ai-job-email-step.js.map +1 -1
  54. package/src/lib/jobs/ai-job-experiment-step.d.ts +1 -1
  55. package/src/lib/jobs/ai-job-experiment-step.js +1 -1
  56. package/src/lib/jobs/ai-job-experiment-step.js.map +1 -1
  57. package/src/lib/jobs/ai-job-generation.d.ts +1 -1
  58. package/src/lib/jobs/ai-job-generation.js +10 -2
  59. package/src/lib/jobs/ai-job-generation.js.map +1 -1
  60. package/src/lib/jobs/ai-job-layout-step.js +1 -1
  61. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  62. package/src/lib/jobs/ai-job-page-sections.d.ts +4 -2
  63. package/src/lib/jobs/ai-job-page-sections.js +7 -4
  64. package/src/lib/jobs/ai-job-page-sections.js.map +1 -1
  65. package/src/lib/jobs/ai-job-page-step.js +7 -2
  66. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  67. package/src/lib/jobs/ai-job-plan-conformance.js +33 -0
  68. package/src/lib/jobs/ai-job-plan-conformance.js.map +1 -1
  69. package/src/lib/jobs/ai-job-plan-step.d.ts +3 -0
  70. package/src/lib/jobs/ai-job-plan-step.js +29 -17
  71. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  72. package/src/lib/jobs/ai-job-plugin-drafts.d.ts +14 -6
  73. package/src/lib/jobs/ai-job-plugin-drafts.js +12 -4
  74. package/src/lib/jobs/ai-job-plugin-drafts.js.map +1 -1
  75. package/src/lib/jobs/ai-job-products-step.d.ts +7 -0
  76. package/src/lib/jobs/ai-job-products-step.js +54 -32
  77. package/src/lib/jobs/ai-job-products-step.js.map +1 -1
  78. package/src/lib/jobs/ai-job-seo-step.d.ts +3 -24
  79. package/src/lib/jobs/ai-job-seo-step.js +35 -108
  80. package/src/lib/jobs/ai-job-seo-step.js.map +1 -1
  81. package/src/lib/jobs/ai-job-template-step.js +1 -0
  82. package/src/lib/jobs/ai-job-template-step.js.map +1 -1
  83. package/src/lib/jobs/ai-job-theme-step.d.ts +1 -1
  84. package/src/lib/jobs/ai-job-theme-step.js +1 -1
  85. package/src/lib/jobs/ai-job-theme-step.js.map +1 -1
  86. package/src/lib/jobs/ai-job-workflow-step.js +17 -9
  87. package/src/lib/jobs/ai-job-workflow-step.js.map +1 -1
  88. package/src/lib/jobs/ai-workflow-records.d.ts +19 -11
  89. package/src/lib/jobs/ai-workflow-records.js +60 -27
  90. package/src/lib/jobs/ai-workflow-records.js.map +1 -1
  91. package/src/lib/model/ai-allotments.d.ts +11 -3
  92. package/src/lib/model/ai-allotments.js +21 -4
  93. package/src/lib/model/ai-allotments.js.map +1 -1
  94. package/src/lib/model/ai-automation-outline.d.ts +21 -2
  95. package/src/lib/model/ai-automation-outline.js.map +1 -1
  96. package/src/lib/model/ai-build-plan.d.ts +57 -0
  97. package/src/lib/model/ai-build-plan.js +116 -7
  98. package/src/lib/model/ai-build-plan.js.map +1 -1
  99. package/src/lib/model/ai-seo.d.ts +11 -51
  100. package/src/lib/model/ai-seo.js +0 -17
  101. package/src/lib/model/ai-seo.js.map +1 -1
  102. package/src/lib/model/ai-site-inventory.js +1 -1
  103. package/src/lib/model/ai-site-inventory.js.map +1 -1
  104. package/src/lib/model/ai-template-subjects.js +2 -2
  105. package/src/lib/model/ai-template-subjects.js.map +1 -1
  106. package/src/lib/model/ai-theme-proposal.d.ts +1 -1
  107. package/src/lib/model/ai-theme-proposal.js +1 -1
  108. package/src/lib/model/ai-theme-proposal.js.map +1 -1
  109. package/src/lib/model/ai-workflow-job.d.ts +1 -3
  110. package/src/lib/model/ai-workflow-job.js +1 -2
  111. package/src/lib/model/ai-workflow-job.js.map +1 -1
  112. package/src/lib/plan-entitlements.d.ts +149 -0
  113. package/src/lib/plan-entitlements.js +168 -0
  114. package/src/lib/plan-entitlements.js.map +1 -0
  115. package/src/lib/plugin.js +1 -1
  116. package/src/lib/plugin.js.map +1 -1
  117. package/src/lib/runtime/ai-doctrine-validators.d.ts +25 -4
  118. package/src/lib/runtime/ai-doctrine-validators.js +179 -23
  119. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  120. package/src/lib/runtime/ai-doctrine.js +5 -5
  121. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  122. package/src/lib/runtime/ai-eval-live.js +29 -14
  123. package/src/lib/runtime/ai-eval-live.js.map +1 -1
  124. package/src/lib/runtime/ai-eval.d.ts +8 -1
  125. package/src/lib/runtime/ai-eval.js +29 -2
  126. package/src/lib/runtime/ai-eval.js.map +1 -1
  127. package/src/lib/runtime/ai-node-tree.js +3 -3
  128. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  129. package/src/lib/runtime/ai-palette.d.ts +6 -0
  130. package/src/lib/runtime/ai-palette.generated.js +21 -255
  131. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  132. package/src/lib/runtime/ai-palette.js +7 -1
  133. package/src/lib/runtime/ai-palette.js.map +1 -1
  134. package/src/lib/runtime/seo-audit.d.ts +13 -63
  135. package/src/lib/runtime/seo-audit.js +22 -207
  136. package/src/lib/runtime/seo-audit.js.map +1 -1
  137. package/src/lib/runtime/site-inventory.js +1 -1
  138. package/src/lib/runtime/site-inventory.js.map +1 -1
  139. package/src/lib/server/ai-admin-org.js +4 -25
  140. package/src/lib/server/ai-admin-org.js.map +1 -1
  141. package/src/lib/server/ai-admin-user.js +2 -19
  142. package/src/lib/server/ai-admin-user.js.map +1 -1
  143. package/src/lib/server/ai-assist-prompts.js +3 -3
  144. package/src/lib/server/ai-assist-prompts.js.map +1 -1
  145. package/src/lib/server/ai-insight-digest-route.js +8 -1
  146. package/src/lib/server/ai-insight-digest-route.js.map +1 -1
  147. package/src/lib/server/assist-chat.js +11 -10
  148. package/src/lib/server/assist-chat.js.map +1 -1
  149. package/src/lib/server/assist-view-context.js +23 -23
  150. package/src/lib/server/assist-view-context.js.map +1 -1
  151. package/src/lib/server.d.ts +1 -0
  152. package/src/lib/server.js.map +1 -1
  153. package/src/lib/testing/stand-in-automation-index.d.ts +20 -0
  154. package/src/lib/testing/stand-in-automation-index.js +102 -0
  155. package/src/lib/testing/stand-in-automation-index.js.map +1 -0
  156. package/src/lib/testing/stand-in-list-send-time.d.ts +4 -0
  157. package/src/lib/testing/stand-in-list-send-time.js +77 -0
  158. package/src/lib/testing/stand-in-list-send-time.js.map +1 -0
  159. package/src/lib/testing/stand-in-pipeline-index.d.ts +32 -0
  160. package/src/lib/testing/stand-in-pipeline-index.js +59 -0
  161. package/src/lib/testing/stand-in-pipeline-index.js.map +1 -0
  162. package/src/lib/testing/stand-in-product-index.d.ts +20 -0
  163. package/src/lib/testing/stand-in-product-index.js +105 -0
  164. package/src/lib/testing/stand-in-product-index.js.map +1 -0
  165. package/src/lib/tools/ai-component-tool.js +2 -2
  166. package/src/lib/tools/ai-component-tool.js.map +1 -1
  167. package/src/lib/tools/ai-duplicate-resource-tool.js +1 -1
  168. package/src/lib/tools/ai-duplicate-resource-tool.js.map +1 -1
  169. package/src/lib/tools/ai-seo-tool.d.ts +6 -18
  170. package/src/lib/tools/ai-seo-tool.js +7 -38
  171. package/src/lib/tools/ai-seo-tool.js.map +1 -1
  172. package/src/lib/tools/ai-workflow-tool.d.ts +1 -1
  173. package/src/lib/tools/ai-workflow-tool.js +1 -1
  174. package/src/lib/tools/ai-workflow-tool.js.map +1 -1
  175. package/src/lib/usage/ai-allotment-alerts.d.ts +3 -0
  176. package/src/lib/usage/ai-allotment-alerts.js +20 -8
  177. package/src/lib/usage/ai-allotment-alerts.js.map +1 -1
  178. package/src/lib/usage/assist-free-taste.js +2 -1
  179. package/src/lib/usage/assist-free-taste.js.map +1 -1
  180. package/src/lib/usage/assist-signal-mining.js +1 -1
  181. package/src/lib/usage/assist-signal-mining.js.map +1 -1
  182. package/src/lib/usage-axes.d.ts +39 -0
  183. package/src/lib/usage-axes.js +70 -0
  184. package/src/lib/usage-axes.js.map +1 -0
  185. package/src/lib/runtime/seo-page-facts.d.ts +0 -61
  186. package/src/lib/runtime/seo-page-facts.js +0 -150
  187. package/src/lib/runtime/seo-page-facts.js.map +0 -1
@@ -23,16 +23,20 @@ import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.compon
23
23
  import { TABLE_PAGE_SIZE_DEFAULT } from "@aglyn/shared-ui-jsx/const/table-pagination";
24
24
  import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
25
25
  import { useUser } from "@aglyn/tenant-feature-instance";
26
- import { Alert, Box, Button, Chip, CircularProgress, Collapse, Stack, TableBody, TableCell, TableHead, TableRow, TextField, Typography } from "@mui/material";
26
+ import { Alert, Box, Button, CircularProgress, Collapse, Stack, TableBody, TableCell, TableHead, TableRow, Typography } from "@mui/material";
27
27
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
28
28
  import { AI_JOB_TERMINAL_STATUSES } from "../model/ai-jobs.types.js";
29
- import { AI_SEO_FINDING_LABELS, aiSeoApplyCounts, aiSeoAuditView } from "../model/ai-seo.js";
29
+ import { aiSeoApplyCounts, aiSeoAuditView } from "../model/ai-seo.js";
30
30
  import { readEventFrames } from "./assist-jobs-drawer.component.js";
31
31
  /**
32
- * The site SEO audit (AGL-2910), on the site's SEO section through the
33
- * `hostSeo` zone. A person runs it; an `seo` job checks every published page
34
- * the sitemap lists, proposes a fix per finding, and drafts the structured
35
- * data and the agent guidance `/llms.txt` leads with.
32
+ * SEO fixes (AGL-2910), on the site's SEO section through the `hostSeo` zone,
33
+ * under the platform's SEO check. The check lists what is wrong for every
34
+ * site owner; this card adds what only a model can: a person asks, and an
35
+ * `seo` job audits the same pages through the same check, proposes a fix per
36
+ * finding, and drafts the structured data and the agent guidance
37
+ * `/llms.txt` leads with. The findings are never listed here — the check
38
+ * above draws them — so this card shows the fixes, page by page. The target
39
+ * keywords are the ones the check was last run with (`check.keywords`).
36
40
  *
37
41
  * Nothing it shows is saved. "Put in the form" stages the site-wide proposal
38
42
  * in the SEO form below as unsaved edits, and the form's Update is the write.
@@ -41,7 +45,6 @@ import { readEventFrames } from "./assist-jobs-drawer.component.js";
41
45
  * listing for its SEO card — the live site serves none of it until a person
42
46
  * saves or publishes.
43
47
  */ /** How many recent jobs the card reads to find this site's last audit. */ const RECENT_JOBS_READ = 20;
44
- const KEYWORDS_MAX_CHARS = 3000;
45
48
  const isTerminal = (job)=>AI_JOB_TERMINAL_STATUSES.includes(job.status);
46
49
  /** What each site SEO form field is called where the proposal lists it. */ export const AI_SEO_SITE_FIELD_LABELS = {
47
50
  'seo.entity.type': 'Published by',
@@ -69,16 +72,16 @@ const ENTITY_TYPE_WORDS = {
69
72
  return parts.join(' · ');
70
73
  }
71
74
  export function AiSeoAuditCard(props) {
72
- var _ref, _ref1, _ref2, _ref3, _ref4;
75
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
73
76
  var _view_site;
74
- const { hostId, orgId, orgSlug, host, proposeDraft } = props;
77
+ const { hostId, orgId, orgSlug, host, proposeDraft, check } = props;
78
+ const keywords = (_ref = check == null ? void 0 : check.keywords) != null ? _ref : '';
75
79
  const { data: user } = useUser();
76
80
  const userRef = useRef(user);
77
81
  userRef.current = user;
78
- const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : null;
82
+ const uid = (_ref1 = user == null ? void 0 : user.uid) != null ? _ref1 : null;
79
83
  const [verdict, setVerdict] = useState('checking');
80
84
  const [notice, setNotice] = useState(null);
81
- const [keywords, setKeywords] = useState('');
82
85
  const [busy, setBusy] = useState(false);
83
86
  const [job, setJob] = useState(null);
84
87
  const [siteStaged, setSiteStaged] = useState(null);
@@ -180,7 +183,7 @@ export function AiSeoAuditCard(props) {
180
183
  orgId,
181
184
  hostId,
182
185
  kind: 'seo',
183
- brief: 'Audit the SEO of this site',
186
+ brief: 'Propose fixes for the SEO of this site',
184
187
  inputs: {
185
188
  target: 'site',
186
189
  keywords: keywords.trim()
@@ -212,7 +215,7 @@ export function AiSeoAuditCard(props) {
212
215
  const view = useMemo(()=>job ? aiSeoAuditView(job.outputs) : null, [
213
216
  job
214
217
  ]);
215
- const siteValues = (_ref1 = view == null ? void 0 : (_view_site = view.site) == null ? void 0 : _view_site.values) != null ? _ref1 : {};
218
+ const siteValues = (_ref2 = view == null ? void 0 : (_view_site = view.site) == null ? void 0 : _view_site.values) != null ? _ref2 : {};
216
219
  const siteFields = Object.keys(siteValues);
217
220
  const stageSite = useCallback(()=>{
218
221
  if (!job || !siteFields.length) return;
@@ -268,16 +271,17 @@ export function AiSeoAuditCard(props) {
268
271
  ]);
269
272
  if (verdict !== 'ready') return null;
270
273
  const running = Boolean(job && !isTerminal(job));
271
- const report = (_ref2 = view == null ? void 0 : view.report) != null ? _ref2 : null;
272
- const findings = report ? report.pages.reduce((sum, entry)=>sum + entry.findings.length, report.site.length) : 0;
274
+ const report = (_ref3 = view == null ? void 0 : view.report) != null ? _ref3 : null;
273
275
  const owedBatches = report ? Math.ceil(report.queue.length / Math.max(1, report.batchSize)) : 0;
274
276
  const counts = view ? aiSeoApplyCounts(view) : {
275
277
  pagesWithContent: 0,
276
278
  pagesWithValues: 0
277
279
  };
278
280
  const somethingToApply = counts.pagesWithContent + counts.pagesWithValues + siteFields.length > 0;
279
- const pageRows = report ? report.pages.slice(page * pageSize, (page + 1) * pageSize) : [];
280
- const names = new Map(((_ref3 = report == null ? void 0 : report.pages) != null ? _ref3 : []).map((entry)=>[
281
+ // The pages a fix was proposed for, or is still owed to; the check above lists the rest.
282
+ const fixRows = report ? report.pages.filter((entry)=>(view == null ? void 0 : view.fixes[entry.screenId]) || report.queue.includes(entry.screenId)) : [];
283
+ const pageRows = fixRows.slice(page * pageSize, (page + 1) * pageSize);
284
+ const names = new Map(((_ref4 = report == null ? void 0 : report.pages) != null ? _ref4 : []).map((entry)=>[
281
285
  entry.screenId,
282
286
  entry
283
287
  ]));
@@ -285,10 +289,10 @@ export function AiSeoAuditCard(props) {
285
289
  return /*#__PURE__*/ _jsx(CardDisplay, {
286
290
  contentGutterX: true,
287
291
  contentGutterY: true,
288
- header: "SEO audit",
292
+ header: "SEO fixes",
289
293
  help: pluginDocsHelp('aiSeo', {
290
- anchor: '#audit-the-whole-site',
291
- excerpt: 'Check every published page and get a proposed fix for each finding. Nothing changes on your live site until you save or publish.'
294
+ anchor: '#fix-what-the-seo-check-finds',
295
+ excerpt: 'Get a proposed fix for each finding of the SEO check. Nothing changes on your live site until you save or publish.'
292
296
  }),
293
297
  children: /*#__PURE__*/ _jsxs(Stack, {
294
298
  spacing: 2,
@@ -296,18 +300,7 @@ export function AiSeoAuditCard(props) {
296
300
  /*#__PURE__*/ _jsx(Typography, {
297
301
  variant: "body2",
298
302
  color: "text.secondary",
299
- children: 'Checks every published page for what search results and AI agents need, and proposes a fix for each finding. Nothing changes on your live site until you save or publish it.'
300
- }),
301
- /*#__PURE__*/ _jsx(TextField, {
302
- multiline: true,
303
- minRows: 2,
304
- fullWidth: true,
305
- label: "Target keywords by page (optional)",
306
- placeholder: '/pricing: pricing, plans\n/lamps: brass desk lamps',
307
- helperText: "One line per page. A keyword is used only where the page is about it.",
308
- value: keywords,
309
- onChange: (event)=>setKeywords(event.target.value.slice(0, KEYWORDS_MAX_CHARS)),
310
- disabled: busy || running
303
+ children: keywords ? 'Proposes a fix for each finding of the SEO check above, using the target keywords it was run with. Nothing changes on your live site until you save or publish it.' : 'Proposes a fix for each finding of the SEO check above. Nothing changes on your live site until you save or publish it.'
311
304
  }),
312
305
  /*#__PURE__*/ _jsxs(Stack, {
313
306
  direction: "row",
@@ -320,16 +313,16 @@ export function AiSeoAuditCard(props) {
320
313
  variant: "contained",
321
314
  disabled: busy || running || !orgId,
322
315
  onClick: ()=>void run(),
323
- children: report ? 'Run the audit again' : 'Run audit'
316
+ children: report ? 'Propose fixes again' : 'Propose fixes'
324
317
  }),
325
318
  running ? /*#__PURE__*/ _jsx(CircularProgress, {
326
319
  size: 18,
327
- "aria-label": "Auditing the site"
320
+ "aria-label": "Proposing fixes"
328
321
  }) : null,
329
322
  running && report ? /*#__PURE__*/ _jsx(Typography, {
330
323
  variant: "caption",
331
324
  color: "text.secondary",
332
- children: `Proposing fixes: ${(_ref4 = view == null ? void 0 : view.batches) != null ? _ref4 : 0} of ${owedBatches} batches`
325
+ children: `Proposing fixes: ${(_ref5 = view == null ? void 0 : view.batches) != null ? _ref5 : 0} of ${owedBatches} batches`
333
326
  }) : null
334
327
  ]
335
328
  }),
@@ -343,28 +336,13 @@ export function AiSeoAuditCard(props) {
343
336
  }) : null,
344
337
  report && job ? /*#__PURE__*/ _jsxs(Stack, {
345
338
  spacing: 2,
346
- "aria-label": "SEO audit results",
339
+ "aria-label": "SEO fixes",
347
340
  children: [
348
- /*#__PURE__*/ _jsx(Typography, {
349
- variant: "subtitle1",
350
- children: `Score ${report.score} of 100 · ${report.pages.length} ${report.pages.length === 1 ? 'page' : 'pages'} · ${findings} ${findings === 1 ? 'finding' : 'findings'}`
351
- }),
352
341
  job.creditsSpent > 0 ? /*#__PURE__*/ _jsx(Typography, {
353
342
  variant: "caption",
354
343
  color: "text.secondary",
355
- children: `This audit used ${job.creditsSpent} ${job.creditsSpent === 1 ? 'credit' : 'credits'}.`
356
- }) : null,
357
- report.skipped > 0 ? /*#__PURE__*/ _jsx(Alert, {
358
- severity: "info",
359
- children: `${report.skipped} more published ${report.skipped === 1 ? 'page was' : 'pages were'} not audited this time.`
344
+ children: `These fixes used ${job.creditsSpent} ${job.creditsSpent === 1 ? 'credit' : 'credits'}.`
360
345
  }) : null,
361
- [
362
- ...report.site.map((entry)=>entry.message),
363
- ...report.notes
364
- ].map((line)=>/*#__PURE__*/ _jsx(Typography, {
365
- variant: "body2",
366
- children: line
367
- }, line)),
368
346
  (view == null ? void 0 : view.site) ? /*#__PURE__*/ _jsxs(Stack, {
369
347
  spacing: 1,
370
348
  "aria-label": "Structured data and agent guidance",
@@ -441,11 +419,11 @@ export function AiSeoAuditCard(props) {
441
419
  }) : null
442
420
  ]
443
421
  }) : null,
444
- report.pages.length ? /*#__PURE__*/ _jsxs(Box, {
422
+ fixRows.length ? /*#__PURE__*/ _jsxs(Box, {
445
423
  children: [
446
424
  /*#__PURE__*/ _jsxs(ScrollTable, {
447
425
  size: "small",
448
- "aria-label": "Audited pages",
426
+ "aria-label": "Proposed fixes",
449
427
  children: [
450
428
  /*#__PURE__*/ _jsx(TableHead, {
451
429
  children: /*#__PURE__*/ _jsxs(TableRow, {
@@ -453,13 +431,6 @@ export function AiSeoAuditCard(props) {
453
431
  /*#__PURE__*/ _jsx(TableCell, {
454
432
  children: 'Page'
455
433
  }),
456
- /*#__PURE__*/ _jsx(TableCell, {
457
- align: "right",
458
- children: 'Score'
459
- }),
460
- /*#__PURE__*/ _jsx(TableCell, {
461
- children: 'Found'
462
- }),
463
434
  /*#__PURE__*/ _jsx(TableCell, {
464
435
  children: 'Proposed'
465
436
  })
@@ -482,41 +453,13 @@ export function AiSeoAuditCard(props) {
482
453
  })
483
454
  ]
484
455
  }),
485
- /*#__PURE__*/ _jsx(TableCell, {
486
- align: "right",
487
- children: row.score
488
- }),
489
- /*#__PURE__*/ _jsx(TableCell, {
490
- children: /*#__PURE__*/ _jsx(Stack, {
491
- direction: "row",
492
- spacing: 0.5,
493
- sx: {
494
- flexWrap: 'wrap',
495
- rowGap: 0.5
496
- },
497
- children: row.findings.length ? row.findings.map((entry)=>{
498
- var _entry_keyword;
499
- return /*#__PURE__*/ _jsx(Chip, {
500
- size: "small",
501
- variant: "outlined",
502
- color: entry.severity === 'high' ? 'error' : entry.severity === 'medium' ? 'warning' : 'default',
503
- label: entry.keyword ? `${AI_SEO_FINDING_LABELS[entry.code]}: ${entry.keyword}` : AI_SEO_FINDING_LABELS[entry.code],
504
- title: entry.message
505
- }, `${entry.code}:${(_entry_keyword = entry.keyword) != null ? _entry_keyword : ''}`);
506
- }) : /*#__PURE__*/ _jsx(Typography, {
507
- variant: "caption",
508
- color: "text.secondary",
509
- children: 'Nothing found'
510
- })
511
- })
512
- }),
513
456
  /*#__PURE__*/ _jsx(TableCell, {
514
457
  children: /*#__PURE__*/ _jsx(Typography, {
515
458
  variant: "body2",
516
459
  sx: {
517
460
  wordBreak: 'break-word'
518
461
  },
519
- children: fixSummary(view == null ? void 0 : view.fixes[row.screenId]) || (row.findings.length && running ? 'Being proposed…' : '')
462
+ children: fixSummary(view == null ? void 0 : view.fixes[row.screenId]) || (running ? 'Being proposed…' : '')
520
463
  })
521
464
  })
522
465
  ]
@@ -528,7 +471,7 @@ export function AiSeoAuditCard(props) {
528
471
  page: page,
529
472
  pageSize: pageSize,
530
473
  rowCount: pageRows.length,
531
- count: report.pages.length,
474
+ count: fixRows.length,
532
475
  onPageChange: setPage,
533
476
  onPageSizeChange: (size)=>{
534
477
  setPageSize(size);
@@ -538,7 +481,7 @@ export function AiSeoAuditCard(props) {
538
481
  ]
539
482
  }) : /*#__PURE__*/ _jsx(Typography, {
540
483
  variant: "body2",
541
- children: 'This site has no published public pages to audit.'
484
+ children: report.pages.length ? 'No page needs a written fix.' : 'This site has no published public pages to fix.'
542
485
  }),
543
486
  /*#__PURE__*/ _jsxs(Stack, {
544
487
  spacing: 1,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-seo-audit-card.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { lockdownRefusalText, parseLockdownRefusal } from '@aglyn/aglyn'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport type { ConsoleHostSeoZoneProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { AppLink, CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Box,\n Button,\n Chip,\n CircularProgress,\n Collapse,\n Stack,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n TextField,\n Typography,\n} from '@mui/material'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { AI_JOB_TERMINAL_STATUSES, type AiJobSummary } from '../model/ai-jobs.types'\nimport {\n AI_SEO_FINDING_LABELS,\n aiSeoApplyCounts,\n aiSeoAuditView,\n type AiSeoPageFix,\n type AiSeoSiteFormField,\n} from '../model/ai-seo'\nimport { readEventFrames } from './assist-jobs-drawer.component'\n\n/**\n * The site SEO audit (AGL-2910), on the site's SEO section through the\n * `hostSeo` zone. A person runs it; an `seo` job checks every published page\n * the sitemap lists, proposes a fix per finding, and drafts the structured\n * data and the agent guidance `/llms.txt` leads with.\n *\n * Nothing it shows is saved. \"Put in the form\" stages the site-wide proposal\n * in the SEO form below as unsaved edits, and the form's Update is the write.\n * \"Apply all\" does that too, and asks the apply door to open a new\n * unpublished version for each page's content fixes and to stage each page's\n * listing for its SEO card — the live site serves none of it until a person\n * saves or publishes.\n */\n\n/** How many recent jobs the card reads to find this site's last audit. */\nconst RECENT_JOBS_READ = 20\n\nconst KEYWORDS_MAX_CHARS = 3_000\n\ntype Verdict = 'checking' | 'ready' | 'hidden'\n\ninterface ApplyResult {\n versions: Array<{ screenId: string; versionId: string; name: string; fixes: number }>\n staged: string[]\n skipped: Array<{ screenId: string; reason: string }>\n}\n\nconst isTerminal = (job: AiJobSummary) => AI_JOB_TERMINAL_STATUSES.includes(job.status)\n\n/** What each site SEO form field is called where the proposal lists it. */\nexport const AI_SEO_SITE_FIELD_LABELS: Record<AiSeoSiteFormField, string> = {\n 'seo.entity.type': 'Published by',\n 'seo.entity.name': 'Name',\n 'seo.entity.description': 'Description',\n 'seo.entity.email': 'Contact email',\n 'seo.entity.telephone': 'Contact phone',\n 'seo.entity.contactType': 'Contact is for',\n 'seo.agent.whenToUse': 'When to use this site',\n 'seo.agent.howToUse': 'How an agent should call you',\n}\n\nconst ENTITY_TYPE_WORDS: Record<string, string> = { '1': 'An organization', '2': 'A person' }\n\n/** One page's proposed fix, in a sentence a table cell can hold. */\nfunction fixSummary(fix: AiSeoPageFix | undefined): string {\n if (!fix) return ''\n const parts: string[] = []\n if (fix.values.title) parts.push(`Title: ${fix.values.title}`)\n if (fix.values.description) parts.push(`Description: ${fix.values.description}`)\n const alts = fix.content.filter((entry) => entry.kind === 'image-alt').length\n if (alts) parts.push(`${alts} image ${alts === 1 ? 'description' : 'descriptions'}`)\n if (fix.content.some((entry) => entry.kind !== 'image-alt')) parts.push('One main heading')\n parts.push(...fix.guidance)\n return parts.join(' · ')\n}\n\nexport function AiSeoAuditCard(props: ConsoleHostSeoZoneProps) {\n const { hostId, orgId, orgSlug, host, proposeDraft } = props\n const { data: user } = useUser()\n const userRef = useRef(user)\n userRef.current = user\n const uid = user?.uid ?? null\n\n const [verdict, setVerdict] = useState<Verdict>('checking')\n const [notice, setNotice] = useState<string | null>(null)\n const [keywords, setKeywords] = useState('')\n const [busy, setBusy] = useState(false)\n const [job, setJob] = useState<AiJobSummary | null>(null)\n const [siteStaged, setSiteStaged] = useState<string | null>(null)\n const [applying, setApplying] = useState(false)\n const [applied, setApplied] = useState<ApplyResult | null>(null)\n const [previewOpen, setPreviewOpen] = useState(false)\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n const watchRef = useRef<AbortController | null>(null)\n\n useEffect(() => () => watchRef.current?.abort(), [])\n\n useEffect(() => {\n if (!orgId || !hostId || !uid) return\n let active = true\n setVerdict('checking')\n void (async () => {\n try {\n const response = await authorizedFetch(\n userRef.current,\n `/api/ai/jobs?orgId=${encodeURIComponent(orgId)}&limit=${RECENT_JOBS_READ}`,\n )\n if (!active) return\n if (response.status === 404 || response.status === 403) {\n setVerdict('hidden')\n return\n }\n const payload = await response.json().catch(() => null)\n if (!active) return\n if (!response.ok) {\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked\n ? lockdownRefusalText(locked)\n : String(payload?.error ?? 'The last SEO audit could not be loaded.'),\n )\n } else {\n // An audit is the SEO job whose outputs carry a report; the summary\n // does not carry a job's inputs.\n const latest = ((payload?.jobs ?? []) as AiJobSummary[]).find(\n (entry) => entry.kind === 'seo' && entry.hostId === hostId && aiSeoAuditView(entry.outputs) !== null,\n )\n if (latest) setJob(latest)\n }\n setVerdict('ready')\n } catch {\n if (!active) return\n setNotice('The last SEO audit could not be loaded.')\n setVerdict('ready')\n }\n })()\n return () => {\n active = false\n }\n }, [orgId, hostId, uid])\n\n /** Follows a job through the events route until it settles. */\n const watch = useCallback(async (jobId: string, org: string) => {\n watchRef.current?.abort()\n const controller = new AbortController()\n watchRef.current = controller\n let again = true\n while (again && !controller.signal.aborted) {\n again = false\n try {\n const response = await authorizedFetch(\n userRef.current,\n `/api/ai/jobs/${encodeURIComponent(jobId)}/events?orgId=${encodeURIComponent(org)}`,\n { signal: controller.signal },\n )\n if (!response.ok || !response.body) return\n await readEventFrames(response.body, (event) => {\n if (event['type'] === 'state') setJob(event['job'] as AiJobSummary)\n else if (event['type'] === 'reconnect') again = true\n })\n } catch {\n return\n }\n }\n }, [])\n\n // A job the card did not start, still moving, is followed too.\n const followId = job && !isTerminal(job) && !busy ? job.id : null\n useEffect(() => {\n if (followId && orgId) void watch(followId, orgId)\n }, [followId, orgId, watch])\n\n const run = useCallback(async () => {\n if (!orgId) return\n setBusy(true)\n setNotice(null)\n setApplied(null)\n setSiteStaged(null)\n setPage(0)\n try {\n const response = await authorizedFetch(userRef.current, '/api/ai/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n orgId,\n hostId,\n kind: 'seo',\n brief: 'Audit the SEO of this site',\n inputs: { target: 'site', keywords: keywords.trim() },\n }),\n })\n const payload = await response.json().catch(() => null)\n if (!response.ok) {\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked\n ? lockdownRefusalText(locked)\n : String(payload?.error ?? 'The SEO audit could not be started — try again.'),\n )\n return\n }\n const next = payload?.job as AiJobSummary | undefined\n if (!next) return\n setJob(next)\n if (!isTerminal(next)) await watch(next.id, orgId)\n } catch {\n setNotice('The SEO audit could not be started — try again.')\n } finally {\n setBusy(false)\n }\n }, [orgId, hostId, keywords, watch])\n\n const view = useMemo(() => (job ? aiSeoAuditView(job.outputs) : null), [job])\n const siteValues = view?.site?.values ?? {}\n const siteFields = Object.keys(siteValues) as AiSeoSiteFormField[]\n\n const stageSite = useCallback(() => {\n if (!job || !siteFields.length) return\n proposeDraft(siteValues as Record<string, string>, `${job.id}:site`)\n setSiteStaged(job.id)\n }, [job, siteFields.length, siteValues, proposeDraft])\n\n const applyAll = useCallback(async () => {\n if (!job || !orgId) return\n setApplying(true)\n setNotice(null)\n stageSite()\n try {\n const response = await authorizedFetch(userRef.current, '/api/ai/seo/apply', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ orgId, hostId, jobId: job.id }),\n })\n const payload = await response.json().catch(() => null)\n if (!response.ok) {\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked ? lockdownRefusalText(locked) : String(payload?.error ?? 'The fixes could not be applied — try again.'),\n )\n return\n }\n if (payload?.job) setJob(payload.job as AiJobSummary)\n setApplied({\n versions: payload?.versions ?? [],\n staged: payload?.staged ?? [],\n skipped: payload?.skipped ?? [],\n })\n } catch {\n setNotice('The fixes could not be applied — try again.')\n } finally {\n setApplying(false)\n }\n }, [job, orgId, hostId, stageSite])\n\n if (verdict !== 'ready') return null\n\n const running = Boolean(job && !isTerminal(job))\n const report = view?.report ?? null\n const findings = report ? report.pages.reduce((sum, entry) => sum + entry.findings.length, report.site.length) : 0\n const owedBatches = report ? Math.ceil(report.queue.length / Math.max(1, report.batchSize)) : 0\n const counts = view ? aiSeoApplyCounts(view) : { pagesWithContent: 0, pagesWithValues: 0 }\n const somethingToApply = counts.pagesWithContent + counts.pagesWithValues + siteFields.length > 0\n const pageRows = report ? report.pages.slice(page * pageSize, (page + 1) * pageSize) : []\n const names = new Map((report?.pages ?? []).map((entry) => [entry.screenId, entry]))\n const pageLink = (screenId: string, versionId: string | null, surface: 'view' | 'besigner') =>\n host && versionId\n ? `/${orgSlug}/hosts/${host}/screens/${screenId}/versions/${versionId}/${surface}`\n : null\n\n return (\n <CardDisplay\n contentGutterX\n contentGutterY\n header=\"SEO audit\"\n help={pluginDocsHelp('aiSeo', {\n anchor: '#audit-the-whole-site',\n excerpt:\n 'Check every published page and get a proposed fix for each finding. Nothing changes on your live site until you save or publish.',\n })}\n >\n <Stack spacing={2}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Checks every published page for what search results and AI agents need, and proposes a fix for each finding. Nothing changes on your live site until you save or publish it.'}\n </Typography>\n <TextField\n multiline\n minRows={2}\n fullWidth\n label=\"Target keywords by page (optional)\"\n placeholder={'/pricing: pricing, plans\\n/lamps: brass desk lamps'}\n helperText=\"One line per page. A keyword is used only where the page is about it.\"\n value={keywords}\n onChange={(event) => setKeywords(event.target.value.slice(0, KEYWORDS_MAX_CHARS))}\n disabled={busy || running}\n />\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Button variant=\"contained\" disabled={busy || running || !orgId} onClick={() => void run()}>\n {report ? 'Run the audit again' : 'Run audit'}\n </Button>\n {running ? <CircularProgress size={18} aria-label=\"Auditing the site\" /> : null}\n {running && report ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`Proposing fixes: ${view?.batches ?? 0} of ${owedBatches} batches`}\n </Typography>\n ) : null}\n </Stack>\n {notice ? <Alert severity=\"warning\">{notice}</Alert> : null}\n {job?.error ? <Alert severity={job.status === 'failed' ? 'error' : 'warning'}>{job.error}</Alert> : null}\n\n {report && job ? (\n <Stack spacing={2} aria-label=\"SEO audit results\">\n <Typography variant=\"subtitle1\">\n {`Score ${report.score} of 100 · ${report.pages.length} ${report.pages.length === 1 ? 'page' : 'pages'} · ${findings} ${findings === 1 ? 'finding' : 'findings'}`}\n </Typography>\n {job.creditsSpent > 0 ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`This audit used ${job.creditsSpent} ${job.creditsSpent === 1 ? 'credit' : 'credits'}.`}\n </Typography>\n ) : null}\n {report.skipped > 0 ? (\n <Alert severity=\"info\">\n {`${report.skipped} more published ${report.skipped === 1 ? 'page was' : 'pages were'} not audited this time.`}\n </Alert>\n ) : null}\n {[...report.site.map((entry) => entry.message), ...report.notes].map((line) => (\n <Typography key={line} variant=\"body2\">\n {line}\n </Typography>\n ))}\n\n {view?.site ? (\n <Stack spacing={1} aria-label=\"Structured data and agent guidance\">\n <Typography variant=\"subtitle2\">{'Structured data and AI agent guidance'}</Typography>\n {siteFields.length ? (\n siteFields.map((field) => (\n <Stack key={field} spacing={0.25}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {AI_SEO_SITE_FIELD_LABELS[field]}\n </Typography>\n <Typography variant=\"body2\" sx={{ wordBreak: 'break-word' }}>\n {field === 'seo.entity.type' ? (ENTITY_TYPE_WORDS[siteValues[field] ?? ''] ?? siteValues[field]) : siteValues[field]}\n </Typography>\n </Stack>\n ))\n ) : (\n <Typography variant=\"body2\">{'Nothing to add: the site’s structured data and guidance are already filled in.'}</Typography>\n )}\n {view.site.notes.map((note) => (\n <Typography key={note} variant=\"caption\" color=\"text.secondary\">\n {note}\n </Typography>\n ))}\n <Button size=\"small\" sx={{ alignSelf: 'flex-start' }} onClick={() => setPreviewOpen((open) => !open)}>\n {previewOpen ? 'Hide the /llms.txt preview' : 'Preview /llms.txt'}\n </Button>\n <Collapse in={previewOpen} unmountOnExit>\n <Box\n component=\"pre\"\n sx={{ m: 0, p: 1.5, bgcolor: 'action.hover', borderRadius: 1, whiteSpace: 'pre-wrap', fontSize: 12 }}\n >\n {view.site.llmsPreview}\n </Box>\n </Collapse>\n <Button\n size=\"small\"\n variant=\"outlined\"\n sx={{ alignSelf: 'flex-start' }}\n disabled={!siteFields.length || siteStaged === job.id}\n onClick={stageSite}\n >\n {'Put in the form'}\n </Button>\n {siteStaged === job.id ? (\n <Alert severity=\"success\">{'In the SEO form below as unsaved changes. Review them, then press Update.'}</Alert>\n ) : null}\n </Stack>\n ) : null}\n\n {report.pages.length ? (\n <Box>\n <ScrollTable size=\"small\" aria-label=\"Audited pages\">\n <TableHead>\n <TableRow>\n <TableCell>{'Page'}</TableCell>\n <TableCell align=\"right\">{'Score'}</TableCell>\n <TableCell>{'Found'}</TableCell>\n <TableCell>{'Proposed'}</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {pageRows.map((row) => (\n <TableRow key={row.screenId}>\n <TableCell>\n <Typography variant=\"body2\">{row.name}</Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {row.path}\n </Typography>\n </TableCell>\n <TableCell align=\"right\">{row.score}</TableCell>\n <TableCell>\n <Stack direction=\"row\" spacing={0.5} sx={{ flexWrap: 'wrap', rowGap: 0.5 }}>\n {row.findings.length ? (\n row.findings.map((entry) => (\n <Chip\n key={`${entry.code}:${entry.keyword ?? ''}`}\n size=\"small\"\n variant=\"outlined\"\n color={entry.severity === 'high' ? 'error' : entry.severity === 'medium' ? 'warning' : 'default'}\n label={entry.keyword ? `${AI_SEO_FINDING_LABELS[entry.code]}: ${entry.keyword}` : AI_SEO_FINDING_LABELS[entry.code]}\n title={entry.message}\n />\n ))\n ) : (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'Nothing found'}\n </Typography>\n )}\n </Stack>\n </TableCell>\n <TableCell>\n <Typography variant=\"body2\" sx={{ wordBreak: 'break-word' }}>\n {fixSummary(view?.fixes[row.screenId]) ||\n (row.findings.length && running ? 'Being proposed…' : '')}\n </Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </ScrollTable>\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={pageRows.length}\n count={report.pages.length}\n onPageChange={setPage}\n onPageSizeChange={(size) => {\n setPageSize(size)\n setPage(0)\n }}\n />\n </Box>\n ) : (\n <Typography variant=\"body2\">{'This site has no published public pages to audit.'}</Typography>\n )}\n\n <Stack spacing={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Apply all opens a new draft version of each page with content fixes, puts proposed titles and descriptions in each page’s SEO card, and puts the structured data and guidance in the form below. You review and save or publish each of them.'}\n </Typography>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Button\n variant=\"contained\"\n disabled={applying || running || job.status !== 'done' || !view?.complete || !somethingToApply}\n onClick={() => void applyAll()}\n >\n {'Apply all as drafts'}\n </Button>\n {applying ? <CircularProgress size={18} aria-label=\"Applying the fixes\" /> : null}\n </Stack>\n </Stack>\n\n {applied ? (\n <Stack spacing={1} aria-label=\"Applied fixes\">\n {applied.versions.map((entry) => {\n const href = pageLink(entry.screenId, entry.versionId, 'besigner')\n return (\n <Typography key={entry.screenId} variant=\"body2\">\n {href ? (\n <AppLink componentVariant=\"naked\" href={href}>\n {`Open the draft of ${entry.name}`}\n </AppLink>\n ) : (\n `A draft of ${entry.name} is ready`\n )}\n </Typography>\n )\n })}\n {applied.staged.map((screenId) => {\n const audited = names.get(screenId)\n const href = pageLink(screenId, audited?.versionId ?? null, 'view')\n return (\n <Typography key={`staged:${screenId}`} variant=\"body2\">\n {href ? (\n <AppLink componentVariant=\"naked\" href={href}>\n {`Review the listing for ${audited?.name ?? screenId}`}\n </AppLink>\n ) : (\n `A listing for ${audited?.name ?? screenId} waits in its SEO card`\n )}\n </Typography>\n )\n })}\n {applied.skipped.map((entry) => (\n <Typography key={`skipped:${entry.screenId}`} variant=\"caption\" color=\"text.secondary\">\n {`${names.get(entry.screenId)?.name ?? entry.screenId}: ${entry.reason}`}\n </Typography>\n ))}\n </Stack>\n ) : null}\n </Stack>\n ) : null}\n </Stack>\n </CardDisplay>\n )\n}\nAiSeoAuditCard.displayName = 'AiSeoAuditCard'\n\nexport default AiSeoAuditCard\n"],"names":["lockdownRefusalText","parseLockdownRefusal","pluginDocsHelp","AppLink","CardDisplay","ListPagination","ScrollTable","TABLE_PAGE_SIZE_DEFAULT","authorizedFetch","useUser","Alert","Box","Button","Chip","CircularProgress","Collapse","Stack","TableBody","TableCell","TableHead","TableRow","TextField","Typography","useCallback","useEffect","useMemo","useRef","useState","AI_JOB_TERMINAL_STATUSES","AI_SEO_FINDING_LABELS","aiSeoApplyCounts","aiSeoAuditView","readEventFrames","RECENT_JOBS_READ","KEYWORDS_MAX_CHARS","isTerminal","job","includes","status","AI_SEO_SITE_FIELD_LABELS","ENTITY_TYPE_WORDS","fixSummary","fix","parts","values","title","push","description","alts","content","filter","entry","kind","length","some","guidance","join","AiSeoAuditCard","props","view","hostId","orgId","orgSlug","host","proposeDraft","data","user","userRef","current","uid","verdict","setVerdict","notice","setNotice","keywords","setKeywords","busy","setBusy","setJob","siteStaged","setSiteStaged","applying","setApplying","applied","setApplied","previewOpen","setPreviewOpen","page","setPage","pageSize","setPageSize","watchRef","abort","active","response","encodeURIComponent","payload","json","catch","ok","locked","String","error","latest","jobs","find","outputs","watch","jobId","org","controller","AbortController","again","signal","aborted","body","event","followId","id","run","method","headers","JSON","stringify","brief","inputs","target","trim","next","siteValues","site","siteFields","Object","keys","stageSite","applyAll","versions","staged","skipped","running","Boolean","report","findings","pages","reduce","sum","owedBatches","Math","ceil","queue","max","batchSize","counts","pagesWithContent","pagesWithValues","somethingToApply","pageRows","slice","names","Map","map","screenId","pageLink","versionId","surface","contentGutterX","contentGutterY","header","help","anchor","excerpt","spacing","variant","color","multiline","minRows","fullWidth","label","placeholder","helperText","value","onChange","disabled","direction","sx","alignItems","onClick","size","aria-label","batches","severity","score","creditsSpent","message","notes","line","field","wordBreak","note","alignSelf","open","in","unmountOnExit","component","m","p","bgcolor","borderRadius","whiteSpace","fontSize","llmsPreview","align","row","name","path","flexWrap","rowGap","keyword","code","fixes","rowCount","count","onPageChange","onPageSizeChange","complete","href","componentVariant","audited","get","reason","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,eAAc;AACxE,SAASC,cAAc,QAAQ,mCAAkC;AAEjE,SAASC,OAAO,EAAEC,WAAW,QAAQ,uBAAsB;AAC3D,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,WAAW,QAAQ,yDAAwD;AACpF,SAASC,uBAAuB,QAAQ,8CAA6C;AACrF,SA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n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { lockdownRefusalText, parseLockdownRefusal } from '@aglyn/aglyn'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport type { ConsoleHostSeoZoneProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { AppLink, CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Box,\n Button,\n CircularProgress,\n Collapse,\n Stack,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Typography,\n} from '@mui/material'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { AI_JOB_TERMINAL_STATUSES, type AiJobSummary } from '../model/ai-jobs.types'\nimport {\n aiSeoApplyCounts,\n aiSeoAuditView,\n type AiSeoPageFix,\n type AiSeoSiteFormField,\n} from '../model/ai-seo'\nimport { readEventFrames } from './assist-jobs-drawer.component'\n\n/**\n * SEO fixes (AGL-2910), on the site's SEO section through the `hostSeo` zone,\n * under the platform's SEO check. The check lists what is wrong for every\n * site owner; this card adds what only a model can: a person asks, and an\n * `seo` job audits the same pages through the same check, proposes a fix per\n * finding, and drafts the structured data and the agent guidance\n * `/llms.txt` leads with. The findings are never listed here — the check\n * above draws them — so this card shows the fixes, page by page. The target\n * keywords are the ones the check was last run with (`check.keywords`).\n *\n * Nothing it shows is saved. \"Put in the form\" stages the site-wide proposal\n * in the SEO form below as unsaved edits, and the form's Update is the write.\n * \"Apply all\" does that too, and asks the apply door to open a new\n * unpublished version for each page's content fixes and to stage each page's\n * listing for its SEO card — the live site serves none of it until a person\n * saves or publishes.\n */\n\n/** How many recent jobs the card reads to find this site's last audit. */\nconst RECENT_JOBS_READ = 20\n\ntype Verdict = 'checking' | 'ready' | 'hidden'\n\ninterface ApplyResult {\n versions: Array<{ screenId: string; versionId: string; name: string; fixes: number }>\n staged: string[]\n skipped: Array<{ screenId: string; reason: string }>\n}\n\nconst isTerminal = (job: AiJobSummary) => AI_JOB_TERMINAL_STATUSES.includes(job.status)\n\n/** What each site SEO form field is called where the proposal lists it. */\nexport const AI_SEO_SITE_FIELD_LABELS: Record<AiSeoSiteFormField, string> = {\n 'seo.entity.type': 'Published by',\n 'seo.entity.name': 'Name',\n 'seo.entity.description': 'Description',\n 'seo.entity.email': 'Contact email',\n 'seo.entity.telephone': 'Contact phone',\n 'seo.entity.contactType': 'Contact is for',\n 'seo.agent.whenToUse': 'When to use this site',\n 'seo.agent.howToUse': 'How an agent should call you',\n}\n\nconst ENTITY_TYPE_WORDS: Record<string, string> = { '1': 'An organization', '2': 'A person' }\n\n/** One page's proposed fix, in a sentence a table cell can hold. */\nfunction fixSummary(fix: AiSeoPageFix | undefined): string {\n if (!fix) return ''\n const parts: string[] = []\n if (fix.values.title) parts.push(`Title: ${fix.values.title}`)\n if (fix.values.description) parts.push(`Description: ${fix.values.description}`)\n const alts = fix.content.filter((entry) => entry.kind === 'image-alt').length\n if (alts) parts.push(`${alts} image ${alts === 1 ? 'description' : 'descriptions'}`)\n if (fix.content.some((entry) => entry.kind !== 'image-alt')) parts.push('One main heading')\n parts.push(...fix.guidance)\n return parts.join(' · ')\n}\n\nexport function AiSeoAuditCard(props: ConsoleHostSeoZoneProps) {\n const { hostId, orgId, orgSlug, host, proposeDraft, check } = props\n const keywords = check?.keywords ?? ''\n const { data: user } = useUser()\n const userRef = useRef(user)\n userRef.current = user\n const uid = user?.uid ?? null\n\n const [verdict, setVerdict] = useState<Verdict>('checking')\n const [notice, setNotice] = useState<string | null>(null)\n const [busy, setBusy] = useState(false)\n const [job, setJob] = useState<AiJobSummary | null>(null)\n const [siteStaged, setSiteStaged] = useState<string | null>(null)\n const [applying, setApplying] = useState(false)\n const [applied, setApplied] = useState<ApplyResult | null>(null)\n const [previewOpen, setPreviewOpen] = useState(false)\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n const watchRef = useRef<AbortController | null>(null)\n\n useEffect(() => () => watchRef.current?.abort(), [])\n\n useEffect(() => {\n if (!orgId || !hostId || !uid) return\n let active = true\n setVerdict('checking')\n void (async () => {\n try {\n const response = await authorizedFetch(\n userRef.current,\n `/api/ai/jobs?orgId=${encodeURIComponent(orgId)}&limit=${RECENT_JOBS_READ}`,\n )\n if (!active) return\n if (response.status === 404 || response.status === 403) {\n setVerdict('hidden')\n return\n }\n const payload = await response.json().catch(() => null)\n if (!active) return\n if (!response.ok) {\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked\n ? lockdownRefusalText(locked)\n : String(payload?.error ?? 'The last SEO audit could not be loaded.'),\n )\n } else {\n // An audit is the SEO job whose outputs carry a report; the summary\n // does not carry a job's inputs.\n const latest = ((payload?.jobs ?? []) as AiJobSummary[]).find(\n (entry) => entry.kind === 'seo' && entry.hostId === hostId && aiSeoAuditView(entry.outputs) !== null,\n )\n if (latest) setJob(latest)\n }\n setVerdict('ready')\n } catch {\n if (!active) return\n setNotice('The last SEO audit could not be loaded.')\n setVerdict('ready')\n }\n })()\n return () => {\n active = false\n }\n }, [orgId, hostId, uid])\n\n /** Follows a job through the events route until it settles. */\n const watch = useCallback(async (jobId: string, org: string) => {\n watchRef.current?.abort()\n const controller = new AbortController()\n watchRef.current = controller\n let again = true\n while (again && !controller.signal.aborted) {\n again = false\n try {\n const response = await authorizedFetch(\n userRef.current,\n `/api/ai/jobs/${encodeURIComponent(jobId)}/events?orgId=${encodeURIComponent(org)}`,\n { signal: controller.signal },\n )\n if (!response.ok || !response.body) return\n await readEventFrames(response.body, (event) => {\n if (event['type'] === 'state') setJob(event['job'] as AiJobSummary)\n else if (event['type'] === 'reconnect') again = true\n })\n } catch {\n return\n }\n }\n }, [])\n\n // A job the card did not start, still moving, is followed too.\n const followId = job && !isTerminal(job) && !busy ? job.id : null\n useEffect(() => {\n if (followId && orgId) void watch(followId, orgId)\n }, [followId, orgId, watch])\n\n const run = useCallback(async () => {\n if (!orgId) return\n setBusy(true)\n setNotice(null)\n setApplied(null)\n setSiteStaged(null)\n setPage(0)\n try {\n const response = await authorizedFetch(userRef.current, '/api/ai/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n orgId,\n hostId,\n kind: 'seo',\n brief: 'Propose fixes for the SEO of this site',\n inputs: { target: 'site', keywords: keywords.trim() },\n }),\n })\n const payload = await response.json().catch(() => null)\n if (!response.ok) {\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked\n ? lockdownRefusalText(locked)\n : String(payload?.error ?? 'The SEO audit could not be started — try again.'),\n )\n return\n }\n const next = payload?.job as AiJobSummary | undefined\n if (!next) return\n setJob(next)\n if (!isTerminal(next)) await watch(next.id, orgId)\n } catch {\n setNotice('The SEO audit could not be started — try again.')\n } finally {\n setBusy(false)\n }\n }, [orgId, hostId, keywords, watch])\n\n const view = useMemo(() => (job ? aiSeoAuditView(job.outputs) : null), [job])\n const siteValues = view?.site?.values ?? {}\n const siteFields = Object.keys(siteValues) as AiSeoSiteFormField[]\n\n const stageSite = useCallback(() => {\n if (!job || !siteFields.length) return\n proposeDraft(siteValues as Record<string, string>, `${job.id}:site`)\n setSiteStaged(job.id)\n }, [job, siteFields.length, siteValues, proposeDraft])\n\n const applyAll = useCallback(async () => {\n if (!job || !orgId) return\n setApplying(true)\n setNotice(null)\n stageSite()\n try {\n const response = await authorizedFetch(userRef.current, '/api/ai/seo/apply', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ orgId, hostId, jobId: job.id }),\n })\n const payload = await response.json().catch(() => null)\n if (!response.ok) {\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked ? lockdownRefusalText(locked) : String(payload?.error ?? 'The fixes could not be applied — try again.'),\n )\n return\n }\n if (payload?.job) setJob(payload.job as AiJobSummary)\n setApplied({\n versions: payload?.versions ?? [],\n staged: payload?.staged ?? [],\n skipped: payload?.skipped ?? [],\n })\n } catch {\n setNotice('The fixes could not be applied — try again.')\n } finally {\n setApplying(false)\n }\n }, [job, orgId, hostId, stageSite])\n\n if (verdict !== 'ready') return null\n\n const running = Boolean(job && !isTerminal(job))\n const report = view?.report ?? null\n const owedBatches = report ? Math.ceil(report.queue.length / Math.max(1, report.batchSize)) : 0\n const counts = view ? aiSeoApplyCounts(view) : { pagesWithContent: 0, pagesWithValues: 0 }\n const somethingToApply = counts.pagesWithContent + counts.pagesWithValues + siteFields.length > 0\n // The pages a fix was proposed for, or is still owed to; the check above lists the rest.\n const fixRows = report\n ? report.pages.filter((entry) => view?.fixes[entry.screenId] || report.queue.includes(entry.screenId))\n : []\n const pageRows = fixRows.slice(page * pageSize, (page + 1) * pageSize)\n const names = new Map((report?.pages ?? []).map((entry) => [entry.screenId, entry]))\n const pageLink = (screenId: string, versionId: string | null, surface: 'view' | 'besigner') =>\n host && versionId\n ? `/${orgSlug}/hosts/${host}/screens/${screenId}/versions/${versionId}/${surface}`\n : null\n\n return (\n <CardDisplay\n contentGutterX\n contentGutterY\n header=\"SEO fixes\"\n help={pluginDocsHelp('aiSeo', {\n anchor: '#fix-what-the-seo-check-finds',\n excerpt:\n 'Get a proposed fix for each finding of the SEO check. Nothing changes on your live site until you save or publish.',\n })}\n >\n <Stack spacing={2}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {keywords\n ? 'Proposes a fix for each finding of the SEO check above, using the target keywords it was run with. Nothing changes on your live site until you save or publish it.'\n : 'Proposes a fix for each finding of the SEO check above. Nothing changes on your live site until you save or publish it.'}\n </Typography>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Button variant=\"contained\" disabled={busy || running || !orgId} onClick={() => void run()}>\n {report ? 'Propose fixes again' : 'Propose fixes'}\n </Button>\n {running ? <CircularProgress size={18} aria-label=\"Proposing fixes\" /> : null}\n {running && report ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`Proposing fixes: ${view?.batches ?? 0} of ${owedBatches} batches`}\n </Typography>\n ) : null}\n </Stack>\n {notice ? <Alert severity=\"warning\">{notice}</Alert> : null}\n {job?.error ? <Alert severity={job.status === 'failed' ? 'error' : 'warning'}>{job.error}</Alert> : null}\n\n {report && job ? (\n <Stack spacing={2} aria-label=\"SEO fixes\">\n {job.creditsSpent > 0 ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`These fixes used ${job.creditsSpent} ${job.creditsSpent === 1 ? 'credit' : 'credits'}.`}\n </Typography>\n ) : null}\n\n {view?.site ? (\n <Stack spacing={1} aria-label=\"Structured data and agent guidance\">\n <Typography variant=\"subtitle2\">{'Structured data and AI agent guidance'}</Typography>\n {siteFields.length ? (\n siteFields.map((field) => (\n <Stack key={field} spacing={0.25}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {AI_SEO_SITE_FIELD_LABELS[field]}\n </Typography>\n <Typography variant=\"body2\" sx={{ wordBreak: 'break-word' }}>\n {field === 'seo.entity.type' ? (ENTITY_TYPE_WORDS[siteValues[field] ?? ''] ?? siteValues[field]) : siteValues[field]}\n </Typography>\n </Stack>\n ))\n ) : (\n <Typography variant=\"body2\">{'Nothing to add: the site’s structured data and guidance are already filled in.'}</Typography>\n )}\n {view.site.notes.map((note) => (\n <Typography key={note} variant=\"caption\" color=\"text.secondary\">\n {note}\n </Typography>\n ))}\n <Button size=\"small\" sx={{ alignSelf: 'flex-start' }} onClick={() => setPreviewOpen((open) => !open)}>\n {previewOpen ? 'Hide the /llms.txt preview' : 'Preview /llms.txt'}\n </Button>\n <Collapse in={previewOpen} unmountOnExit>\n <Box\n component=\"pre\"\n sx={{ m: 0, p: 1.5, bgcolor: 'action.hover', borderRadius: 1, whiteSpace: 'pre-wrap', fontSize: 12 }}\n >\n {view.site.llmsPreview}\n </Box>\n </Collapse>\n <Button\n size=\"small\"\n variant=\"outlined\"\n sx={{ alignSelf: 'flex-start' }}\n disabled={!siteFields.length || siteStaged === job.id}\n onClick={stageSite}\n >\n {'Put in the form'}\n </Button>\n {siteStaged === job.id ? (\n <Alert severity=\"success\">{'In the SEO form below as unsaved changes. Review them, then press Update.'}</Alert>\n ) : null}\n </Stack>\n ) : null}\n\n {fixRows.length ? (\n <Box>\n <ScrollTable size=\"small\" aria-label=\"Proposed fixes\">\n <TableHead>\n <TableRow>\n <TableCell>{'Page'}</TableCell>\n <TableCell>{'Proposed'}</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {pageRows.map((row) => (\n <TableRow key={row.screenId}>\n <TableCell>\n <Typography variant=\"body2\">{row.name}</Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {row.path}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body2\" sx={{ wordBreak: 'break-word' }}>\n {fixSummary(view?.fixes[row.screenId]) || (running ? 'Being proposed…' : '')}\n </Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </ScrollTable>\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={pageRows.length}\n count={fixRows.length}\n onPageChange={setPage}\n onPageSizeChange={(size) => {\n setPageSize(size)\n setPage(0)\n }}\n />\n </Box>\n ) : (\n <Typography variant=\"body2\">\n {report.pages.length\n ? 'No page needs a written fix.'\n : 'This site has no published public pages to fix.'}\n </Typography>\n )}\n\n <Stack spacing={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Apply all opens a new draft version of each page with content fixes, puts proposed titles and descriptions in each page’s SEO card, and puts the structured data and guidance in the form below. You review and save or publish each of them.'}\n </Typography>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Button\n variant=\"contained\"\n disabled={applying || running || job.status !== 'done' || !view?.complete || !somethingToApply}\n onClick={() => void applyAll()}\n >\n {'Apply all as drafts'}\n </Button>\n {applying ? <CircularProgress size={18} aria-label=\"Applying the fixes\" /> : null}\n </Stack>\n </Stack>\n\n {applied ? (\n <Stack spacing={1} aria-label=\"Applied fixes\">\n {applied.versions.map((entry) => {\n const href = pageLink(entry.screenId, entry.versionId, 'besigner')\n return (\n <Typography key={entry.screenId} variant=\"body2\">\n {href ? (\n <AppLink componentVariant=\"naked\" href={href}>\n {`Open the draft of ${entry.name}`}\n </AppLink>\n ) : (\n `A draft of ${entry.name} is ready`\n )}\n </Typography>\n )\n })}\n {applied.staged.map((screenId) => {\n const audited = names.get(screenId)\n const href = pageLink(screenId, audited?.versionId ?? null, 'view')\n return (\n <Typography key={`staged:${screenId}`} variant=\"body2\">\n {href ? (\n <AppLink componentVariant=\"naked\" href={href}>\n {`Review the listing for ${audited?.name ?? screenId}`}\n </AppLink>\n ) : (\n `A listing for ${audited?.name ?? screenId} waits in its SEO card`\n )}\n </Typography>\n )\n })}\n {applied.skipped.map((entry) => (\n <Typography key={`skipped:${entry.screenId}`} variant=\"caption\" color=\"text.secondary\">\n {`${names.get(entry.screenId)?.name ?? entry.screenId}: ${entry.reason}`}\n </Typography>\n ))}\n </Stack>\n ) : null}\n </Stack>\n ) : null}\n </Stack>\n </CardDisplay>\n )\n}\nAiSeoAuditCard.displayName = 'AiSeoAuditCard'\n\nexport default AiSeoAuditCard\n"],"names":["lockdownRefusalText","parseLockdownRefusal","pluginDocsHelp","AppLink","CardDisplay","ListPagination","ScrollTable","TABLE_PAGE_SIZE_DEFAULT","authorizedFetch","useUser","Alert","Box","Button","CircularProgress","Collapse","Stack","TableBody","TableCell","TableHead","TableRow","Typography","useCallback","useEffect","useMemo","useRef","useState","AI_JOB_TERMINAL_STATUSES","aiSeoApplyCounts","aiSeoAuditView","readEventFrames","RECENT_JOBS_READ","isTerminal","job","includes","status","AI_SEO_SITE_FIELD_LABELS","ENTITY_TYPE_WORDS","fixSummary","fix","parts","values","title","push","description","alts","content","filter","entry","kind","length","some","guidance","join","AiSeoAuditCard","props","view","hostId","orgId","orgSlug","host","proposeDraft","check","keywords","data","user","userRef","current","uid","verdict","setVerdict","notice","setNotice","busy","setBusy","setJob","siteStaged","setSiteStaged","applying","setApplying","applied","setApplied","previewOpen","setPreviewOpen","page","setPage","pageSize","setPageSize","watchRef","abort","active","response","encodeURIComponent","payload","json","catch","ok","locked","String","error","latest","jobs","find","outputs","watch","jobId","org","controller","AbortController","again","signal","aborted","body","event","followId","id","run","method","headers","JSON","stringify","brief","inputs","target","trim","next","siteValues","site","siteFields","Object","keys","stageSite","applyAll","versions","staged","skipped","running","Boolean","report","owedBatches","Math","ceil","queue","max","batchSize","counts","pagesWithContent","pagesWithValues","somethingToApply","fixRows","pages","fixes","screenId","pageRows","slice","names","Map","map","pageLink","versionId","surface","contentGutterX","contentGutterY","header","help","anchor","excerpt","spacing","variant","color","direction","sx","alignItems","disabled","onClick","size","aria-label","batches","severity","creditsSpent","field","wordBreak","notes","note","alignSelf","open","in","unmountOnExit","component","m","p","bgcolor","borderRadius","whiteSpace","fontSize","llmsPreview","row","name","path","rowCount","count","onPageChange","onPageSizeChange","complete","href","componentVariant","audited","get","reason","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,eAAc;AACxE,SAASC,cAAc,QAAQ,mCAAkC;AAEjE,SAASC,OAAO,EAAEC,WAAW,QAAQ,uBAAsB;AAC3D,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,WAAW,QAAQ,yDAAwD;AACpF,SAASC,uBAAuB,QAAQ,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