@aglyn/plugins-ai 1.0.0-beta.296 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-job-links.d.ts +2 -1
  3. package/src/lib/components/ai-job-links.js +8 -2
  4. package/src/lib/components/ai-job-links.js.map +1 -1
  5. package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
  6. package/src/lib/components/ai-site-start-card.component.js +40 -13
  7. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  8. package/src/lib/components/ai-site-start-steps.component.d.ts +17 -1
  9. package/src/lib/components/ai-site-start-steps.component.js +30 -7
  10. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  11. package/src/lib/components/assist-edit-canvas.d.ts +12 -6
  12. package/src/lib/components/assist-edit-canvas.js +86 -36
  13. package/src/lib/components/assist-edit-canvas.js.map +1 -1
  14. package/src/lib/components/assist-edit-card.component.js +9 -8
  15. package/src/lib/components/assist-edit-card.component.js.map +1 -1
  16. package/src/lib/components/assist-page-change-card.component.d.ts +1 -1
  17. package/src/lib/components/assist-page-change-card.component.js +2 -2
  18. package/src/lib/components/assist-page-change-card.component.js.map +1 -1
  19. package/src/lib/components/assist-panel.component.js +16 -9
  20. package/src/lib/components/assist-panel.component.js.map +1 -1
  21. package/src/lib/jobs/ai-job-drafts.d.ts +3 -0
  22. package/src/lib/jobs/ai-job-drafts.js +5 -0
  23. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  24. package/src/lib/jobs/ai-job-edit-step.d.ts +20 -0
  25. package/src/lib/jobs/ai-job-edit-step.js +39 -3
  26. package/src/lib/jobs/ai-job-edit-step.js.map +1 -1
  27. package/src/lib/jobs/ai-job-layout-language.d.ts +10 -0
  28. package/src/lib/jobs/ai-job-layout-language.js +38 -2
  29. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  30. package/src/lib/jobs/ai-job-layout-step.js +3 -3
  31. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  32. package/src/lib/jobs/ai-site-import-compile.js +15 -7
  33. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  34. package/src/lib/layout-language/ai-layout-compiler.js +39 -1
  35. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  36. package/src/lib/layout-language/ai-layout-frame.d.ts +6 -0
  37. package/src/lib/layout-language/ai-layout-frame.js +85 -30
  38. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  39. package/src/lib/layout-language/ai-layout-language.d.ts +5 -0
  40. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  41. package/src/lib/model/ai-edit-job.js +1 -1
  42. package/src/lib/model/ai-edit-job.js.map +1 -1
  43. package/src/lib/model/ai-job-notice.js +3 -1
  44. package/src/lib/model/ai-job-notice.js.map +1 -1
  45. package/src/lib/model/ai-site-import-fidelity.d.ts +175 -0
  46. package/src/lib/model/ai-site-import-fidelity.js +941 -0
  47. package/src/lib/model/ai-site-import-fidelity.js.map +1 -0
  48. package/src/lib/model/ai-site-start.d.ts +27 -0
  49. package/src/lib/model/ai-site-start.js +41 -0
  50. package/src/lib/model/ai-site-start.js.map +1 -1
  51. package/src/lib/model/assist-edit.d.ts +8 -7
  52. package/src/lib/model/assist-edit.js +4 -4
  53. package/src/lib/model/assist-edit.js.map +1 -1
  54. package/src/lib/model/assist-page-change.d.ts +34 -0
  55. package/src/lib/model/assist-page-change.js +43 -0
  56. package/src/lib/model/assist-page-change.js.map +1 -1
  57. package/src/lib/runtime/ai-node-tree.js +18 -2
  58. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  59. package/src/lib/server/assist-chat.d.ts +5 -0
  60. package/src/lib/server/assist-chat.js +16 -3
  61. package/src/lib/server/assist-chat.js.map +1 -1
  62. package/src/lib/server/assist-edit.d.ts +12 -7
  63. package/src/lib/server/assist-edit.js +43 -22
  64. package/src/lib/server/assist-edit.js.map +1 -1
  65. package/src/lib/server/assist-page-change.d.ts +12 -0
  66. package/src/lib/server/assist-page-change.js +24 -2
  67. package/src/lib/server/assist-page-change.js.map +1 -1
  68. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +62 -0
  69. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +374 -0
  70. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-ai",
3
- "version": "1.0.0-beta.296",
3
+ "version": "1.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,22 +25,22 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.0.0-beta.296",
29
- "@aglyn/shared-data-enums": "1.0.0-beta.296",
30
- "@aglyn/shared-data-mdi": "1.0.0-beta.296",
31
- "@aglyn/shared-data-types": "1.0.0-beta.296",
32
- "@aglyn/shared-ui-email-campaigns": "1.0.0-beta.296",
33
- "@aglyn/shared-ui-jsx": "1.0.0-beta.296",
34
- "@aglyn/shared-ui-snackstack": "1.0.0-beta.296",
35
- "@aglyn/shared-ui-theme": "1.0.0-beta.296",
36
- "@aglyn/shared-util-email": "1.0.0-beta.296",
37
- "@aglyn/shared-util-errors": "1.0.0-beta.296",
38
- "@aglyn/shared-util-http": "1.0.0-beta.296",
39
- "@aglyn/shared-util-timestamp": "1.0.0-beta.296",
40
- "@aglyn/shared-util-tools": "1.0.0-beta.296",
41
- "@aglyn/tenant-data-admin": "1.0.0-beta.296",
42
- "@aglyn/tenant-feature-instance": "1.0.0-beta.296",
43
- "@aglyn/tenant-runtime": "1.0.0-beta.296",
28
+ "@aglyn/aglyn": "1.1.0",
29
+ "@aglyn/shared-data-enums": "1.1.0",
30
+ "@aglyn/shared-data-mdi": "1.1.0",
31
+ "@aglyn/shared-data-types": "1.1.0",
32
+ "@aglyn/shared-ui-email-campaigns": "1.1.0",
33
+ "@aglyn/shared-ui-jsx": "1.1.0",
34
+ "@aglyn/shared-ui-snackstack": "1.1.0",
35
+ "@aglyn/shared-ui-theme": "1.1.0",
36
+ "@aglyn/shared-util-email": "1.1.0",
37
+ "@aglyn/shared-util-errors": "1.1.0",
38
+ "@aglyn/shared-util-http": "1.1.0",
39
+ "@aglyn/shared-util-timestamp": "1.1.0",
40
+ "@aglyn/shared-util-tools": "1.1.0",
41
+ "@aglyn/tenant-data-admin": "1.1.0",
42
+ "@aglyn/tenant-feature-instance": "1.1.0",
43
+ "@aglyn/tenant-runtime": "1.1.0",
44
44
  "@swc/helpers": "0.5.23"
45
45
  },
46
46
  "peerDependencies": {
@@ -4,7 +4,8 @@ import { type AiStoreFinishStep } from '../model/ai-site-store-pages';
4
4
  /**
5
5
  * Where "open draft" goes, or `null` when the output has no page of its
6
6
  * own — a `text` output carries its copy on the job and is shown inline.
7
- * A versioned resource opens in the besigner on the version the job wrote;
7
+ * A versioned resource opens in the besigner on the version the job wrote,
8
+ * on its draft when that is where the change went;
8
9
  * one the console lists without a detail page opens its list; a `theme`
9
10
  * proposal opens the site's Theme section, where it is put in the editor.
10
11
  *
@@ -15,6 +15,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */ import { buildRoute, Route } from "@aglyn/aglyn/app-utils/console-routes";
18
+ import { besignerOpenDraftHref } from "@aglyn/aglyn/app-utils/version-draft";
18
19
  import { pluginRecordHref, pluginRecordListHref } from "@aglyn/aglyn/plugin-manager/plugin-record-routes";
19
20
  import { AI_JOB_BESIGNER_SEGMENT as BESIGNER_SEGMENT, AI_SITE_BUILD_HREF } from "../model/ai-job-notice.js";
20
21
  import { AI_STORE_FINISH_STEPS } from "../model/ai-site-store-pages.js";
@@ -24,7 +25,8 @@ import { AI_BUILD_STORE_LINKS_DRAFT_STEP, AI_BUILD_STORE_LINKS_MISSING_STEP } fr
24
25
  /**
25
26
  * Where "open draft" goes, or `null` when the output has no page of its
26
27
  * own — a `text` output carries its copy on the job and is shown inline.
27
- * A versioned resource opens in the besigner on the version the job wrote;
28
+ * A versioned resource opens in the besigner on the version the job wrote,
29
+ * on its draft when that is where the change went;
28
30
  * one the console lists without a detail page opens its list; a `theme`
29
31
  * proposal opens the site's Theme section, where it is put in the editor.
30
32
  *
@@ -38,7 +40,11 @@ import { AI_BUILD_STORE_LINKS_DRAFT_STEP, AI_BUILD_STORE_LINKS_MISSING_STEP } fr
38
40
  const segment = BESIGNER_SEGMENT[output.resource];
39
41
  if (segment) {
40
42
  const base = `/${orgSlug}/hosts/${host}/${segment}/${output.id}`;
41
- return output.versionId ? `${base}/versions/${output.versionId}/besigner` : base;
43
+ if (!output.versionId) return base;
44
+ const besigner = `${base}/versions/${output.versionId}/besigner`;
45
+ // A change in the version's draft opens on that draft (AGL-4116), so the
46
+ // person lands on what they asked for rather than on the live version.
47
+ return output.inDraft ? besignerOpenDraftHref(besigner) : besigner;
42
48
  }
43
49
  if (output.resource === 'product') {
44
50
  // The catalog a drafted product lands in: the commerce plugin's address
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-job-links.ts"],"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 */\nimport { buildRoute, Route } from '@aglyn/aglyn/app-utils/console-routes'\nimport {\n pluginRecordHref,\n pluginRecordListHref,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-routes'\nimport { AI_JOB_BESIGNER_SEGMENT as BESIGNER_SEGMENT, AI_SITE_BUILD_HREF } from '../model/ai-job-notice'\nimport type { AiJobOutput, AiJobSummary } from '../model/ai-jobs.types'\nimport { AI_STORE_FINISH_STEPS, type AiStoreFinishStep } from '../model/ai-site-store-pages'\nimport { AI_BUILD_STORE_LINKS_DRAFT_STEP, AI_BUILD_STORE_LINKS_MISSING_STEP } from '../model/ai-build-store-pages'\n\n// Where a job's work opens in the console (AGL-2904), shared by the AI jobs\n// drawer and every dialog that follows the job it started (AGL-3593).\n\n/**\n * Where \"open draft\" goes, or `null` when the output has no page of its\n * own — a `text` output carries its copy on the job and is shown inline.\n * A versioned resource opens in the besigner on the version the job wrote;\n * one the console lists without a detail page opens its list; a `theme`\n * proposal opens the site's Theme section, where it is put in the editor.\n *\n * A console URL names a site by its SUBDOMAIN: the `[host]` segment resolves\n * through the member's host projection by subdomain, never by document id.\n * So an output that carries no `hostSubdomain` gets no link rather than one\n * that opens no site.\n */\nexport function aiJobOutputHref(output: AiJobOutput, orgSlug: string): string | null {\n const host = output.hostSubdomain\n if (!orgSlug || !host) return null\n const segment = BESIGNER_SEGMENT[output.resource]\n if (segment) {\n const base = `/${orgSlug}/hosts/${host}/${segment}/${output.id}`\n return output.versionId ? `${base}/versions/${output.versionId}/besigner` : base\n }\n if (output.resource === 'product') {\n // The catalog a drafted product lands in: the commerce plugin's address\n // for it (AGL-3080), or no link where commerce is not loaded.\n return pluginRecordListHref('product', { orgSlug, host })\n }\n if (output.resource === 'workflow') {\n // A drafted automation is an action (AGL-2919), listed switched off on\n // the workflows plugin's list of actions, or no link where it is not loaded.\n return pluginRecordListHref('action', { orgSlug, host })\n }\n if (output.resource === 'entry') {\n // A post a guided start wrote (AGL-3676) opens in its blog's list in Content.\n const collectionSlug = output.proposal?.['collectionSlug']\n return typeof collectionSlug === 'string' && collectionSlug\n ? buildRoute(Route.HOST_CONTENT_COLLECTION, { orgSlug, host, collectionSlug })\n : buildRoute(Route.HOST_CONTENT, { orgSlug, host })\n }\n if (output.resource === 'theme') {\n return buildRoute(Route.HOST_SETUP_THEME, { orgSlug, host })\n }\n if (output.resource === 'media') {\n // Files a build organized (AGL-3752) open in the site's media library.\n return buildRoute(Route.HOST_MEDIA, { orgSlug, host })\n }\n if (output.resource === 'settings') {\n // Settings a build saved (AGL-3748) open where most of them are edited.\n return buildRoute(Route.HOST_SETUP_SEO, { orgSlug, host })\n }\n if (output.resource === 'tracking') {\n // Tags a build saved (AGL-3751) open on the card that edits them.\n return buildRoute(Route.HOST_SETUP_TRACKING, { orgSlug, host })\n }\n if (output.resource === 'privacy') {\n // Who can see the site (AGL-4033), each change on the card that makes it.\n if (output.id === 'maintenance') return buildRoute(Route.HOST_ADMIN_ERROR_PAGES, { orgSlug, host })\n if (output.id === 'search') return buildRoute(Route.HOST_SETUP_SEO, { orgSlug, host })\n return buildRoute(Route.HOST_SCREENS, { orgSlug, host })\n }\n if (output.resource === 'draft' && output.draftResource) {\n // A draft another plugin wrote — a dataset a site start or a build made\n // (AGL-3616) — opens where its owner lists it, or nowhere it is not loaded.\n return pluginRecordListHref(output.draftResource, { orgSlug, host })\n }\n if (output.resource === 'form') {\n // A new form has no version for the besigner to open: its own page — the\n // forms plugin's address for it — mints the first one, and holds the\n // routing and consent it declares.\n return pluginRecordHref('form', { orgSlug, host }, output.id)\n }\n if (output.resource === 'campaign') {\n // A campaign's page is the marketing plugin's, under the site: its\n // address for the campaign (AGL-3080), or no link where it is not loaded.\n return pluginRecordHref('campaign', { orgSlug, host }, output.id)\n }\n return null\n}\n\n/**\n * The ONE action a finished job's row, its notification and the dialog that\n * started it lead with (AGL-3593): what the job built. Several pages from one\n * job — a site's — open the site's Pages list, where they wait as drafts; one\n * output with a page of its own opens that page; anything else has no single\n * place to go, and the row's own links stand. `null` until the job is done.\n */\nexport function aiJobPrimaryLink(\n job: Pick<AiJobSummary, 'status' | 'outputs'>,\n orgSlug: string,\n): { href: string; label: string } | null {\n if (job.status !== 'done' || !orgSlug) return null\n const screens = job.outputs.filter(\n (output) => output.resource === 'screen' && output.hostSubdomain,\n )\n if (screens.length > 1) {\n return {\n href: buildRoute(Route.HOST_SCREENS, { orgSlug, host: String(screens[0].hostSubdomain) }),\n label: 'Open your draft pages',\n }\n }\n for (const output of job.outputs) {\n const href = aiJobOutputHref(output, orgSlug)\n if (href) {\n return {\n href,\n label: output.resource === 'screen' ? 'Open the draft page' : `Open ${output.label}`,\n }\n }\n }\n return null\n}\n\nexport { AI_SITE_BUILD_HREF }\n\n/**\n * The \"Building your site\" page for one site job (AGL-3594): linkable, so the\n * guided start lands on it, a reload keeps it and a notification opens it.\n * `null` without the org slug or the site's subdomain a console URL needs.\n */\nexport function aiSiteBuildHref(\n orgSlug: string | null | undefined,\n hostSubdomain: string | null | undefined,\n jobId: string,\n): string | null {\n if (!orgSlug || !hostSubdomain || !jobId) return null\n return `/${orgSlug}/hosts/${hostSubdomain}${AI_SITE_BUILD_HREF}/${encodeURIComponent(jobId)}`\n}\n\n/** A page version's own address under a site, for the console route named by `leaf`. */\nfunction screenVersionHref(orgSlug: string, output: AiJobOutput, leaf: 'preview' | 'besigner'): string {\n return `/${orgSlug}/hosts/${String(output.hostSubdomain)}/screens/${output.id}/versions/${output.versionId}/${leaf}`\n}\n\n/**\n * A finished site's two ways in (AGL-3594): its first page's draft, opened in\n * the console's preview of that version — the page as a visitor will see it,\n * never its details — and the Pages list every draft waits in. Either is\n * `null` where the job reported nothing to open.\n */\nexport function aiSiteBuildDoneLinks(\n job: Pick<AiJobSummary, 'outputs'>,\n orgSlug: string,\n): { view: string | null; pages: string | null } {\n const screens = job.outputs.filter((output) => output.resource === 'screen' && output.hostSubdomain)\n const first = screens[0]\n if (!first || !orgSlug) return { view: null, pages: null }\n const host = String(first.hostSubdomain)\n return {\n // A change in a page's draft is not in its version's preview (AGL-4116).\n view: first.versionId && !first.inDraft ? screenVersionHref(orgSlug, first, 'preview') : null,\n pages: buildRoute(Route.HOST_SCREENS, { orgSlug, host }),\n }\n}\n\n/**\n * The two ways to look at the one page a job changed (AGL-3616): its new\n * version in the preview, where it can be published, and in the Besigner.\n * A change saved into the page's draft (AGL-4116) has no preview of its own\n * — a version's preview shows the version, not its draft — so only the\n * Besigner, where Open draft shows it. `null` where the job wrote no page\n * version, or more than one page — those wait in Pages.\n */\nexport function aiJobReviewLinks(\n job: Pick<AiJobSummary, 'outputs'>,\n orgSlug: string,\n): { preview: string | null; besigner: string } | null {\n if (!orgSlug) return null\n const pages = job.outputs.filter((output) => output.resource === 'screen' && output.hostSubdomain && output.versionId)\n if (new Set(pages.map((page) => page.id)).size !== 1) return null\n return {\n preview: pages[0].inDraft ? null : screenVersionHref(orgSlug, pages[0], 'preview'),\n besigner: screenVersionHref(orgSlug, pages[0], 'besigner'),\n }\n}\n\n/**\n * Where a person gets more AI credits (AGL-3660): the workspace's Billing\n * page at its plans, where an upgrade and the AI add-on are both sold — the\n * door the AI credits meter's own upgrade link opens.\n */\nexport function aiCreditsBillingHref(orgSlug: string): string {\n return `${buildRoute(Route.MANAGE_BILLING, { orgSlug })}#plans`\n}\n\n/** One thing left to finish an AI-built store, with where it is done. */\nexport interface AiStoreFinishLink extends AiStoreFinishStep {\n /** The console page it is done on; `null` where the owner of that page is not loaded. */\n href: string | null\n}\n\n/**\n * What is left to finish a store a site start built (AGL-3676), or `null`\n * where the start built no store's own pages: its account, cart and policy\n * pages are written, so payments, products, shipping and tax, and the\n * policies' brackets are all that remain. Each links the exact console page:\n * the store's settings and its catalog, as the commerce plugin publishes\n * them, and the site's Pages.\n */\nexport function aiStoreFinishLinks(\n job: Pick<AiJobSummary, 'kind' | 'status' | 'items' | 'outputs'> & Partial<Pick<AiJobSummary, 'sitePublish'>>,\n orgSlug: string,\n): AiStoreFinishLink[] | null {\n // A site start's store, or an Assist build that made the site a store (AGL-3676).\n if ((job.kind !== 'site' && job.kind !== 'build') || job.status !== 'done' || !orgSlug) return null\n const row = (job.items ?? []).find((one) => one.slot === 'store')\n if (!row || (row.status !== 'succeeded' && row.status !== 'degraded')) return null\n const host = job.outputs.find((output) => output.resource === 'screen' && output.hostSubdomain)?.hostSubdomain\n if (!host) return null\n const context = { orgSlug, host: String(host) }\n // A build's products are drafts with no price unless asked, and it may\n // have written none of the policies (the site had them): its list says so.\n const build = job.kind === 'build'\n const mine = job.outputs.filter((output) => row.outputs.includes(output.id))\n const written = new Set(mine.map((output) => output.proposal?.['storePage']))\n const policies = !build || ['shipping', 'privacy', 'terms'].some((key) => written.has(key))\n const steps: AiStoreFinishLink[] = AI_STORE_FINISH_STEPS.filter((step) => step.id !== 'policies' || policies).map((step) => ({\n ...step,\n ...(build && step.id === 'products' ? { text: AI_BUILD_STORE_PRODUCTS_TEXT } : {}),\n href:\n step.opens === 'pages'\n ? buildRoute(Route.HOST_SCREENS, context)\n : step.opens === 'layouts' || step.opens === 'layout'\n ? buildRoute(Route.HOST_LAYOUTS, context)\n : step.record\n ? pluginRecordHref(step.opens, context, step.record)\n : pluginRecordListHref(step.opens, context),\n }))\n if (!build) return steps\n // The site's own header and footer (AGL-3676): links it had no list for are\n // the owner's to add; links drafted into it wait for its publish.\n if (mine.some((output) => output.proposal?.['storeLinks'] === 'missing')) {\n steps.push({ ...AI_BUILD_STORE_LINKS_MISSING_STEP, href: buildRoute(Route.HOST_LAYOUTS, context) })\n }\n const draft = mine.find((output) => output.resource === 'layout' && output.proposal?.['storeLinks'] === 'draft')\n const live = draft && job.sitePublish?.published.length\n if (draft && !live) steps.push({ ...AI_BUILD_STORE_LINKS_DRAFT_STEP, href: aiJobOutputHref(draft, orgSlug) })\n return steps\n}\n\n/**\n * The site an AI-built store is on — the one {@link aiStoreFinishLinks}\n * links — so \"Finish your store\" can read whether its workspace already takes\n * payments (AGL-3982). `null` where no output names a site.\n */\nexport function aiStoreFinishHostId(job: Pick<AiJobSummary, 'outputs'>): string | null {\n return job.outputs.find((output) => output.resource === 'screen' && output.hostSubdomain)?.hostId ?? null\n}\n\n/** What a build's \"Review your products\" step says: its products are drafts, priced only where the request said. */\nexport const AI_BUILD_STORE_PRODUCTS_TEXT =\n 'Your new products are drafts. Set their prices, photos and stock, then make them active so they show in your store.'\n"],"names":["buildRoute","Route","pluginRecordHref","pluginRecordListHref","AI_JOB_BESIGNER_SEGMENT","BESIGNER_SEGMENT","AI_SITE_BUILD_HREF","AI_STORE_FINISH_STEPS","AI_BUILD_STORE_LINKS_DRAFT_STEP","AI_BUILD_STORE_LINKS_MISSING_STEP","aiJobOutputHref","output","orgSlug","host","hostSubdomain","segment","resource","base","id","versionId","collectionSlug","proposal","HOST_CONTENT_COLLECTION","HOST_CONTENT","HOST_SETUP_THEME","HOST_MEDIA","HOST_SETUP_SEO","HOST_SETUP_TRACKING","HOST_ADMIN_ERROR_PAGES","HOST_SCREENS","draftResource","aiJobPrimaryLink","job","status","screens","outputs","filter","length","href","String","label","aiSiteBuildHref","jobId","encodeURIComponent","screenVersionHref","leaf","aiSiteBuildDoneLinks","first","view","pages","inDraft","aiJobReviewLinks","Set","map","page","size","preview","besigner","aiCreditsBillingHref","MANAGE_BILLING","aiStoreFinishLinks","kind","row","items","find","one","slot","context","build","mine","includes","written","policies","some","key","has","steps","step","text","AI_BUILD_STORE_PRODUCTS_TEXT","opens","HOST_LAYOUTS","record","push","draft","live","sitePublish","published","aiStoreFinishHostId","hostId"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GACD,SAASA,UAAU,EAAEC,KAAK,QAAQ,wCAAuC;AACzE,SACEC,gBAAgB,EAChBC,oBAAoB,QACf,mDAAkD;AACzD,SAASC,2BAA2BC,gBAAgB,EAAEC,kBAAkB,QAAQ,4BAAwB;AAExG,SAASC,qBAAqB,QAAgC,kCAA8B;AAC5F,SAASC,+BAA+B,EAAEC,iCAAiC,QAAQ,mCAA+B;AAElH,4EAA4E;AAC5E,sEAAsE;AAEtE;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,gBAAgBC,MAAmB,EAAEC,OAAe;IAClE,MAAMC,OAAOF,OAAOG,aAAa;IACjC,IAAI,CAACF,WAAW,CAACC,MAAM,OAAO;IAC9B,MAAME,UAAUV,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C,CAAC9D;YAAWA;eAAAA,EAAAA,mBAAAA,OAAOU,QAAQ,qBAAfV,gBAAiB,CAAC,aAAa,MAAK;QAAY;QACxEiE,MAAMO,IAAI,CAAC,aAAK1E;YAAmC6B,MAAMtC,WAAWC,MAAMgF,YAAY,EAAEd;;IAC1F;IACA,MAAMiB,QAAQf,KAAKL,IAAI,CAAC,CAACrD;YAA2CA;eAAhCA,OAAOK,QAAQ,KAAK,YAAYL,EAAAA,mBAAAA,OAAOU,QAAQ,qBAAfV,gBAAiB,CAAC,aAAa,MAAK;;IACxG,MAAM0E,OAAOD,WAASpD,mBAAAA,IAAIsD,WAAW,qBAAftD,iBAAiBuD,SAAS,CAAClD,MAAM;IACvD,IAAI+C,SAAS,CAACC,MAAMT,MAAMO,IAAI,CAAC,aAAK3E;QAAiC8B,MAAM5B,gBAAgB0E,OAAOxE;;IAClG,OAAOgE;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASY,oBAAoBxD,GAAkC;;QAC7DA;IAAP,gBAAOA,oBAAAA,IAAIG,OAAO,CAAC6B,IAAI,CAAC,CAACrD,SAAWA,OAAOK,QAAQ,KAAK,YAAYL,OAAOG,aAAa,sBAAjFkB,kBAAoFyD,MAAM,mBAAI;AACvG;AAEA,kHAAkH,GAClH,OAAO,MAAMV,+BACX,sHAAqH"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-job-links.ts"],"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 */\nimport { buildRoute, Route } from '@aglyn/aglyn/app-utils/console-routes'\nimport { besignerOpenDraftHref } from '@aglyn/aglyn/app-utils/version-draft'\nimport {\n pluginRecordHref,\n pluginRecordListHref,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-routes'\nimport { AI_JOB_BESIGNER_SEGMENT as BESIGNER_SEGMENT, AI_SITE_BUILD_HREF } from '../model/ai-job-notice'\nimport type { AiJobOutput, AiJobSummary } from '../model/ai-jobs.types'\nimport { AI_STORE_FINISH_STEPS, type AiStoreFinishStep } from '../model/ai-site-store-pages'\nimport { AI_BUILD_STORE_LINKS_DRAFT_STEP, AI_BUILD_STORE_LINKS_MISSING_STEP } from '../model/ai-build-store-pages'\n\n// Where a job's work opens in the console (AGL-2904), shared by the AI jobs\n// drawer and every dialog that follows the job it started (AGL-3593).\n\n/**\n * Where \"open draft\" goes, or `null` when the output has no page of its\n * own — a `text` output carries its copy on the job and is shown inline.\n * A versioned resource opens in the besigner on the version the job wrote,\n * on its draft when that is where the change went;\n * one the console lists without a detail page opens its list; a `theme`\n * proposal opens the site's Theme section, where it is put in the editor.\n *\n * A console URL names a site by its SUBDOMAIN: the `[host]` segment resolves\n * through the member's host projection by subdomain, never by document id.\n * So an output that carries no `hostSubdomain` gets no link rather than one\n * that opens no site.\n */\nexport function aiJobOutputHref(output: AiJobOutput, orgSlug: string): string | null {\n const host = output.hostSubdomain\n if (!orgSlug || !host) return null\n const segment = BESIGNER_SEGMENT[output.resource]\n if (segment) {\n const base = `/${orgSlug}/hosts/${host}/${segment}/${output.id}`\n if (!output.versionId) return base\n const besigner = `${base}/versions/${output.versionId}/besigner`\n // A change in the version's draft opens on that draft (AGL-4116), so the\n // person lands on what they asked for rather than on the live version.\n return output.inDraft ? besignerOpenDraftHref(besigner) : besigner\n }\n if (output.resource === 'product') {\n // The catalog a drafted product lands in: the commerce plugin's address\n // for it (AGL-3080), or no link where commerce is not loaded.\n return pluginRecordListHref('product', { orgSlug, host })\n }\n if (output.resource === 'workflow') {\n // A drafted automation is an action (AGL-2919), listed switched off on\n // the workflows plugin's list of actions, or no link where it is not loaded.\n return pluginRecordListHref('action', { orgSlug, host })\n }\n if (output.resource === 'entry') {\n // A post a guided start wrote (AGL-3676) opens in its blog's list in Content.\n const collectionSlug = output.proposal?.['collectionSlug']\n return typeof collectionSlug === 'string' && collectionSlug\n ? buildRoute(Route.HOST_CONTENT_COLLECTION, { orgSlug, host, collectionSlug })\n : buildRoute(Route.HOST_CONTENT, { orgSlug, host })\n }\n if (output.resource === 'theme') {\n return buildRoute(Route.HOST_SETUP_THEME, { orgSlug, host })\n }\n if (output.resource === 'media') {\n // Files a build organized (AGL-3752) open in the site's media library.\n return buildRoute(Route.HOST_MEDIA, { orgSlug, host })\n }\n if (output.resource === 'settings') {\n // Settings a build saved (AGL-3748) open where most of them are edited.\n return buildRoute(Route.HOST_SETUP_SEO, { orgSlug, host })\n }\n if (output.resource === 'tracking') {\n // Tags a build saved (AGL-3751) open on the card that edits them.\n return buildRoute(Route.HOST_SETUP_TRACKING, { orgSlug, host })\n }\n if (output.resource === 'privacy') {\n // Who can see the site (AGL-4033), each change on the card that makes it.\n if (output.id === 'maintenance') return buildRoute(Route.HOST_ADMIN_ERROR_PAGES, { orgSlug, host })\n if (output.id === 'search') return buildRoute(Route.HOST_SETUP_SEO, { orgSlug, host })\n return buildRoute(Route.HOST_SCREENS, { orgSlug, host })\n }\n if (output.resource === 'draft' && output.draftResource) {\n // A draft another plugin wrote — a dataset a site start or a build made\n // (AGL-3616) — opens where its owner lists it, or nowhere it is not loaded.\n return pluginRecordListHref(output.draftResource, { orgSlug, host })\n }\n if (output.resource === 'form') {\n // A new form has no version for the besigner to open: its own page — the\n // forms plugin's address for it — mints the first one, and holds the\n // routing and consent it declares.\n return pluginRecordHref('form', { orgSlug, host }, output.id)\n }\n if (output.resource === 'campaign') {\n // A campaign's page is the marketing plugin's, under the site: its\n // address for the campaign (AGL-3080), or no link where it is not loaded.\n return pluginRecordHref('campaign', { orgSlug, host }, output.id)\n }\n return null\n}\n\n/**\n * The ONE action a finished job's row, its notification and the dialog that\n * started it lead with (AGL-3593): what the job built. Several pages from one\n * job — a site's — open the site's Pages list, where they wait as drafts; one\n * output with a page of its own opens that page; anything else has no single\n * place to go, and the row's own links stand. `null` until the job is done.\n */\nexport function aiJobPrimaryLink(\n job: Pick<AiJobSummary, 'status' | 'outputs'>,\n orgSlug: string,\n): { href: string; label: string } | null {\n if (job.status !== 'done' || !orgSlug) return null\n const screens = job.outputs.filter(\n (output) => output.resource === 'screen' && output.hostSubdomain,\n )\n if (screens.length > 1) {\n return {\n href: buildRoute(Route.HOST_SCREENS, { orgSlug, host: String(screens[0].hostSubdomain) }),\n label: 'Open your draft pages',\n }\n }\n for (const output of job.outputs) {\n const href = aiJobOutputHref(output, orgSlug)\n if (href) {\n return {\n href,\n label: output.resource === 'screen' ? 'Open the draft page' : `Open ${output.label}`,\n }\n }\n }\n return null\n}\n\nexport { AI_SITE_BUILD_HREF }\n\n/**\n * The \"Building your site\" page for one site job (AGL-3594): linkable, so the\n * guided start lands on it, a reload keeps it and a notification opens it.\n * `null` without the org slug or the site's subdomain a console URL needs.\n */\nexport function aiSiteBuildHref(\n orgSlug: string | null | undefined,\n hostSubdomain: string | null | undefined,\n jobId: string,\n): string | null {\n if (!orgSlug || !hostSubdomain || !jobId) return null\n return `/${orgSlug}/hosts/${hostSubdomain}${AI_SITE_BUILD_HREF}/${encodeURIComponent(jobId)}`\n}\n\n/** A page version's own address under a site, for the console route named by `leaf`. */\nfunction screenVersionHref(orgSlug: string, output: AiJobOutput, leaf: 'preview' | 'besigner'): string {\n return `/${orgSlug}/hosts/${String(output.hostSubdomain)}/screens/${output.id}/versions/${output.versionId}/${leaf}`\n}\n\n/**\n * A finished site's two ways in (AGL-3594): its first page's draft, opened in\n * the console's preview of that version — the page as a visitor will see it,\n * never its details — and the Pages list every draft waits in. Either is\n * `null` where the job reported nothing to open.\n */\nexport function aiSiteBuildDoneLinks(\n job: Pick<AiJobSummary, 'outputs'>,\n orgSlug: string,\n): { view: string | null; pages: string | null } {\n const screens = job.outputs.filter((output) => output.resource === 'screen' && output.hostSubdomain)\n const first = screens[0]\n if (!first || !orgSlug) return { view: null, pages: null }\n const host = String(first.hostSubdomain)\n return {\n // A change in a page's draft is not in its version's preview (AGL-4116).\n view: first.versionId && !first.inDraft ? screenVersionHref(orgSlug, first, 'preview') : null,\n pages: buildRoute(Route.HOST_SCREENS, { orgSlug, host }),\n }\n}\n\n/**\n * The two ways to look at the one page a job changed (AGL-3616): its new\n * version in the preview, where it can be published, and in the Besigner.\n * A change saved into the page's draft (AGL-4116) has no preview of its own\n * — a version's preview shows the version, not its draft — so only the\n * Besigner, where Open draft shows it. `null` where the job wrote no page\n * version, or more than one page — those wait in Pages.\n */\nexport function aiJobReviewLinks(\n job: Pick<AiJobSummary, 'outputs'>,\n orgSlug: string,\n): { preview: string | null; besigner: string } | null {\n if (!orgSlug) return null\n const pages = job.outputs.filter((output) => output.resource === 'screen' && output.hostSubdomain && output.versionId)\n if (new Set(pages.map((page) => page.id)).size !== 1) return null\n return {\n preview: pages[0].inDraft ? null : screenVersionHref(orgSlug, pages[0], 'preview'),\n besigner: screenVersionHref(orgSlug, pages[0], 'besigner'),\n }\n}\n\n/**\n * Where a person gets more AI credits (AGL-3660): the workspace's Billing\n * page at its plans, where an upgrade and the AI add-on are both sold — the\n * door the AI credits meter's own upgrade link opens.\n */\nexport function aiCreditsBillingHref(orgSlug: string): string {\n return `${buildRoute(Route.MANAGE_BILLING, { orgSlug })}#plans`\n}\n\n/** One thing left to finish an AI-built store, with where it is done. */\nexport interface AiStoreFinishLink extends AiStoreFinishStep {\n /** The console page it is done on; `null` where the owner of that page is not loaded. */\n href: string | null\n}\n\n/**\n * What is left to finish a store a site start built (AGL-3676), or `null`\n * where the start built no store's own pages: its account, cart and policy\n * pages are written, so payments, products, shipping and tax, and the\n * policies' brackets are all that remain. Each links the exact console page:\n * the store's settings and its catalog, as the commerce plugin publishes\n * them, and the site's Pages.\n */\nexport function aiStoreFinishLinks(\n job: Pick<AiJobSummary, 'kind' | 'status' | 'items' | 'outputs'> & Partial<Pick<AiJobSummary, 'sitePublish'>>,\n orgSlug: string,\n): AiStoreFinishLink[] | null {\n // A site start's store, or an Assist build that made the site a store (AGL-3676).\n if ((job.kind !== 'site' && job.kind !== 'build') || job.status !== 'done' || !orgSlug) return null\n const row = (job.items ?? []).find((one) => one.slot === 'store')\n if (!row || (row.status !== 'succeeded' && row.status !== 'degraded')) return null\n const host = job.outputs.find((output) => output.resource === 'screen' && output.hostSubdomain)?.hostSubdomain\n if (!host) return null\n const context = { orgSlug, host: String(host) }\n // A build's products are drafts with no price unless asked, and it may\n // have written none of the policies (the site had them): its list says so.\n const build = job.kind === 'build'\n const mine = job.outputs.filter((output) => row.outputs.includes(output.id))\n const written = new Set(mine.map((output) => output.proposal?.['storePage']))\n const policies = !build || ['shipping', 'privacy', 'terms'].some((key) => written.has(key))\n const steps: AiStoreFinishLink[] = AI_STORE_FINISH_STEPS.filter((step) => step.id !== 'policies' || policies).map((step) => ({\n ...step,\n ...(build && step.id === 'products' ? { text: AI_BUILD_STORE_PRODUCTS_TEXT } : {}),\n href:\n step.opens === 'pages'\n ? buildRoute(Route.HOST_SCREENS, context)\n : step.opens === 'layouts' || step.opens === 'layout'\n ? buildRoute(Route.HOST_LAYOUTS, context)\n : step.record\n ? pluginRecordHref(step.opens, context, step.record)\n : pluginRecordListHref(step.opens, context),\n }))\n if (!build) return steps\n // The site's own header and footer (AGL-3676): links it had no list for are\n // the owner's to add; links drafted into it wait for its publish.\n if (mine.some((output) => output.proposal?.['storeLinks'] === 'missing')) {\n steps.push({ ...AI_BUILD_STORE_LINKS_MISSING_STEP, href: buildRoute(Route.HOST_LAYOUTS, context) })\n }\n const draft = mine.find((output) => output.resource === 'layout' && output.proposal?.['storeLinks'] === 'draft')\n const live = draft && job.sitePublish?.published.length\n if (draft && !live) steps.push({ ...AI_BUILD_STORE_LINKS_DRAFT_STEP, href: aiJobOutputHref(draft, orgSlug) })\n return steps\n}\n\n/**\n * The site an AI-built store is on — the one {@link aiStoreFinishLinks}\n * links — so \"Finish your store\" can read whether its workspace already takes\n * payments (AGL-3982). `null` where no output names a site.\n */\nexport function aiStoreFinishHostId(job: Pick<AiJobSummary, 'outputs'>): string | null {\n return job.outputs.find((output) => output.resource === 'screen' && output.hostSubdomain)?.hostId ?? null\n}\n\n/** What a build's \"Review your products\" step says: its products are drafts, priced only where the request said. */\nexport const AI_BUILD_STORE_PRODUCTS_TEXT =\n 'Your new products are drafts. Set their prices, photos and stock, then make them active so they show in your store.'\n"],"names":["buildRoute","Route","besignerOpenDraftHref","pluginRecordHref","pluginRecordListHref","AI_JOB_BESIGNER_SEGMENT","BESIGNER_SEGMENT","AI_SITE_BUILD_HREF","AI_STORE_FINISH_STEPS","AI_BUILD_STORE_LINKS_DRAFT_STEP","AI_BUILD_STORE_LINKS_MISSING_STEP","aiJobOutputHref","output","orgSlug","host","hostSubdomain","segment","resource","base","id","versionId","besigner","inDraft","collectionSlug","proposal","HOST_CONTENT_COLLECTION","HOST_CONTENT","HOST_SETUP_THEME","HOST_MEDIA","HOST_SETUP_SEO","HOST_SETUP_TRACKING","HOST_ADMIN_ERROR_PAGES","HOST_SCREENS","draftResource","aiJobPrimaryLink","job","status","screens","outputs","filter","length","href","String","label","aiSiteBuildHref","jobId","encodeURIComponent","screenVersionHref","leaf","aiSiteBuildDoneLinks","first","view","pages","aiJobReviewLinks","Set","map","page","size","preview","aiCreditsBillingHref","MANAGE_BILLING","aiStoreFinishLinks","kind","row","items","find","one","slot","context","build","mine","includes","written","policies","some","key","has","steps","step","text","AI_BUILD_STORE_PRODUCTS_TEXT","opens","HOST_LAYOUTS","record","push","draft","live","sitePublish","published","aiStoreFinishHostId","hostId"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GACD,SAASA,UAAU,EAAEC,KAAK,QAAQ,wCAAuC;AACzE,SAASC,qBAAqB,QAAQ,uCAAsC;AAC5E,SACEC,gBAAgB,EAChBC,oBAAoB,QACf,mDAA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AAM,mBAAI;AACvG;AAEA,kHAAkH,GAClH,OAAO,MAAMV,+BACX,sHAAqH"}
@@ -44,5 +44,5 @@ export type AiSiteStartCardProps = ConsoleHostFirstRunZoneProps & {
44
44
  * `aiSiteStartBrief` and `aiSiteStartInputs`. Each step is reported as a
45
45
  * funnel, with where people struggle (`ai-site-start-tracking.ts`).
46
46
  */
47
- export declare function AiSiteStartCard({ hostId, orgId, orgSlug, host, startBlank, leave, pendingSite, chooseStarter: chooseStarterInShell, clientBuild, initialAnswers, }: AiSiteStartCardProps): import("react").JSX.Element;
47
+ export declare function AiSiteStartCard({ hostId, orgId, orgSlug, host, startBlank, leave, pendingSite, chooseStarter: chooseStarterInShell, starter, clientBuild, initialAnswers, }: AiSiteStartCardProps): import("react").JSX.Element;
48
48
  export default AiSiteStartCard;
@@ -35,7 +35,7 @@ import { AI_JOB_AUTO_CONFIRM_INPUT, AI_SITE_FREE_PAGES, aiFreeCreditsNoneLeftTex
35
35
  import { FREE_AI_TASTE_CREDITS_PER_MONTH } from "../plan-entitlements.js";
36
36
  import { AI_CREDITS_CONFIRM_CODE, aiCreditRangeText } from "../model/ai-credit-estimate.js";
37
37
  import { AiCreditsPromptNotice } from "./ai-credits-prompt.component.js";
38
- import { AI_SITE_START_ANSWERS, AI_SITE_START_STYLE_REQUIRED, aiSiteStartAnswersFromClientBuild, aiSiteStartBrief, aiSiteStartClientBrief, aiSiteStartClientInputs, aiSiteStartClientNote, aiSiteStartExtrasGiven, aiSiteStartInputs, aiSiteStartKind, aiSiteStartRefusal } from "../model/ai-site-start.js";
38
+ import { AI_SITE_START_ANSWERS, AI_SITE_START_STYLE_REQUIRED, aiSiteStartAnswersFromClientBuild, aiSiteStartAnswersFromStarter, aiSiteStartBrief, aiSiteStartClientBrief, aiSiteStartClientInputs, aiSiteStartClientNote, aiSiteStartExtrasGiven, aiSiteStartInputs, aiSiteStartKind, aiSiteStartRefusal } from "../model/ai-site-start.js";
39
39
  import { aiSiteInspirationLimit } from "../model/ai-site-inspiration.js";
40
40
  import { aiSiteStartFieldErrors, aiSiteStartFirstInvalidStep, aiSiteStartNextStep, aiSiteStartPreviousStep, aiSiteStartStepErrors, aiSiteStartStepIndex, AI_SITE_START_STEPS, AI_SITE_START_STEP_FIELDS } from "../model/ai-site-start-steps.js";
41
41
  import { aiSiteKindOfInputs } from "../model/ai-site-kinds.js";
@@ -203,8 +203,8 @@ function SectionLabel({ children, help }) {
203
203
  * held, and only the review turns them into the job, through the same
204
204
  * `aiSiteStartBrief` and `aiSiteStartInputs`. Each step is reported as a
205
205
  * funnel, with where people struggle (`ai-site-start-tracking.ts`).
206
- */ export function AiSiteStartCard({ hostId, orgId, orgSlug, host, startBlank, leave, pendingSite, chooseStarter: chooseStarterInShell, clientBuild, initialAnswers = null }) {
207
- var _ref, _ref1, _ref2, _ref3, _aiFreeSitePrompt, _aiSiteStartRefusal;
206
+ */ export function AiSiteStartCard({ hostId, orgId, orgSlug, host, startBlank, leave, pendingSite, chooseStarter: chooseStarterInShell, starter, clientBuild, initialAnswers = null }) {
207
+ var _ref, _ref1, _ref2, _ref3, _ref4, _aiFreeSitePrompt, _aiSiteStartRefusal;
208
208
  var _aiSiteKindOfInputs, _modelChoice_options_options_find, _modelChoice_options, _pendingSite_previewControl;
209
209
  const { data: user } = useUser();
210
210
  const router = useRouter();
@@ -218,7 +218,12 @@ function SectionLabel({ children, help }) {
218
218
  // Create site with that start's answers: read once, and only here, where
219
219
  // the site does not exist yet. It opens on the first question, where the
220
220
  // site's name and address are asked, with every answer after it filled in.
221
- const [handedOff] = useState(()=>pendingSite && !initialAnswers ? readAiSiteStartAnswers() : null);
221
+ const [handedOff] = useState(()=>pendingSite && !initialAnswers && !starter ? readAiSiteStartAnswers() : null);
222
+ // An AI starter picked in "Choose your starter" (AGL-4049): its answers
223
+ // fill the questions, read once, and the start opens on the first one.
224
+ // The style it names arrives chosen — the person chose it by picking the
225
+ // starter — and every answer is theirs to change.
226
+ const [starterAnswers] = useState(()=>starter && !initialAnswers && !clientBuild ? aiSiteStartAnswersFromStarter(starter.answers) : null);
222
227
  // A site staff are building for a client (AGL-3958): the intake answered
223
228
  // the questions already, so the start opens on the review with them, and
224
229
  // stays on this screen once it has started. Read once, like a reopened start.
@@ -230,10 +235,18 @@ function SectionLabel({ children, help }) {
230
235
  const clientBuildRef = useRef(clientBuild);
231
236
  clientBuildRef.current = clientBuild;
232
237
  // Read once: a start reopened on its answers stays one while it is open.
233
- const reopened = useRef(initialAnswers !== null || handedOff !== null || clientAnswers !== null);
234
- // A start reopened on its answers opens on the review, every answer there to change.
235
- const [step, setStep] = useState(initialAnswers || clientAnswers ? 'review' : 'choose');
236
- const [answers, setAnswers] = useState((_ref1 = (_ref2 = initialAnswers != null ? initialAnswers : clientAnswers) != null ? _ref2 : handedOff) != null ? _ref1 : AI_SITE_START_ANSWERS);
238
+ const reopened = useRef(initialAnswers !== null || handedOff !== null || clientAnswers !== null || starterAnswers !== null);
239
+ // A start reopened on its answers opens on the review, every answer there
240
+ // to change; one filled in from a starter, on the first question.
241
+ const [step, setStep] = useState(initialAnswers || clientAnswers ? 'review' : starterAnswers ? 'kind' : 'choose');
242
+ const [answers, setAnswers] = useState((_ref1 = (_ref2 = (_ref3 = initialAnswers != null ? initialAnswers : clientAnswers) != null ? _ref3 : starterAnswers) != null ? _ref2 : handedOff) != null ? _ref1 : AI_SITE_START_ANSWERS);
243
+ // The starter the answers came from, for the site to record (AGL-4049),
244
+ // and the style card that says so.
245
+ const starterChoice = starterAnswers && starter ? starter.choice : null;
246
+ const pickedStarterStyle = (starterAnswers == null ? void 0 : starterAnswers.kind) && starter ? {
247
+ id: starterAnswers.kind,
248
+ name: starter.displayName
249
+ } : null;
237
250
  // The steps whose reasons not to go forward are shown: the ones Next was refused on.
238
251
  const [checked, setChecked] = useState(()=>new Set());
239
252
  // A step opened from the review's Edit goes back to the review on Next.
@@ -340,7 +353,7 @@ function SectionLabel({ children, help }) {
340
353
  answers.pages
341
354
  ]);
342
355
  // A store's first products and a blog's first posts are part of the start (AGL-3676, AGL-3798).
343
- const siteKind = (_ref3 = (_aiSiteKindOfInputs = aiSiteKindOfInputs(aiSiteStartInputs(answers))) == null ? void 0 : _aiSiteKindOfInputs.id) != null ? _ref3 : null;
356
+ const siteKind = (_ref4 = (_aiSiteKindOfInputs = aiSiteKindOfInputs(aiSiteStartInputs(answers))) == null ? void 0 : _aiSiteKindOfInputs.id) != null ? _ref4 : null;
344
357
  const prompt = freeTaste ? (_aiFreeSitePrompt = aiFreeSitePrompt(freeCredits, answers.pages, {
345
358
  siteKind
346
359
  })) != null ? _aiFreeSitePrompt : serverPrompt : null;
@@ -448,10 +461,13 @@ function SectionLabel({ children, help }) {
448
461
  };
449
462
  if (!hostId && pendingSite) {
450
463
  if (!pendingSite.created && !await refused(await requestJob(null, true))) return;
451
- // The style the questions took (AGL-4049), recorded on the site.
452
- const made = await pendingSite.create(asked.style ? {
464
+ // The style the questions took (AGL-4049), recorded on the site, and
465
+ // the AI starter they were filled in from, when they were.
466
+ const made = await pendingSite.create(asked.style || starterChoice ? _extends({}, asked.style ? {
453
467
  style: asked.style
454
- } : undefined);
468
+ } : {}, starterChoice ? {
469
+ starter: starterChoice
470
+ } : {}) : undefined);
455
471
  if ('error' in made) {
456
472
  setNotice(made.error);
457
473
  if (made.address) setStep('choose');
@@ -529,7 +545,8 @@ function SectionLabel({ children, help }) {
529
545
  siteKind,
530
546
  tracker,
531
547
  clientIntake,
532
- siteInspiration
548
+ siteInspiration,
549
+ starterChoice
533
550
  ]);
534
551
  // The zone's `startBlank`, with the style chosen for the starter (AGL-4049).
535
552
  // Before the site exists it creates it with the starter, and answers
@@ -1093,9 +1110,19 @@ function SectionLabel({ children, help }) {
1093
1110
  }) : /*#__PURE__*/ _jsxs(Box, {
1094
1111
  component: "section",
1095
1112
  children: [
1113
+ step === 'kind' && starter && starterAnswers ? /*#__PURE__*/ _jsx(Alert, {
1114
+ severity: "info",
1115
+ variant: "outlined",
1116
+ "data-start-area": "starter-note",
1117
+ sx: {
1118
+ mb: 3
1119
+ },
1120
+ children: `Filled in from ${starter.displayName}. Change any answer you like.`
1121
+ }) : null,
1096
1122
  step === 'kind' && /*#__PURE__*/ _jsx(KindStep, _extends({}, stepProps)),
1097
1123
  step === 'audience' && /*#__PURE__*/ _jsx(AudienceStep, _extends({}, stepProps)),
1098
1124
  step === 'style' && /*#__PURE__*/ _jsx(StyleStep, _extends({}, stepProps, {
1125
+ starterStyle: pickedStarterStyle,
1099
1126
  inspiration: siteInspiration ? {
1100
1127
  limit: aiSiteInspirationLimit(freeTaste),
1101
1128
  upgradeHref: orgSlug ? aiCreditsBillingHref(orgSlug) : null