@aglyn/plugins-ai 1.15.0 → 1.15.2
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.
- package/package.json +17 -17
- package/src/lib/components/ai-site-import-start.component.js +3 -1
- package/src/lib/components/ai-site-import-start.component.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +18 -2
- package/src/lib/jobs/ai-job-import-step.js +24 -8
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
- package/src/lib/jobs/ai-job-page-language.js +72 -37
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.js +5 -3
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.js +26 -1
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-improve.d.ts +59 -6
- package/src/lib/jobs/ai-site-import-improve.js +149 -19
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
- package/src/lib/jobs/ai-site-import-plan.js +1 -1
- package/src/lib/jobs/ai-site-import-plan.js.map +1 -1
- package/src/lib/model/ai-credit-estimate.d.ts +16 -0
- package/src/lib/model/ai-credit-estimate.js +14 -0
- package/src/lib/model/ai-credit-estimate.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +2 -0
- package/src/lib/model/ai-site-import-fidelity.js +7 -1
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-view.d.ts +3 -1
- package/src/lib/model/ai-site-import-view.js +8 -3
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +27 -2
- package/src/lib/model/ai-site-import.js +63 -14
- package/src/lib/model/ai-site-import.js.map +1 -1
|
@@ -265,7 +265,9 @@ export declare function aiSiteImportRunningLede(choice: AiSiteImportChoice, opti
|
|
|
265
265
|
export declare function aiSiteImportWordingCreditsText(scope: {
|
|
266
266
|
job: Pick<AiJobSummary, 'items' | 'siteImport'>;
|
|
267
267
|
wave: AiSiteImportWave;
|
|
268
|
-
} | null
|
|
268
|
+
} | null, options?: {
|
|
269
|
+
generative?: boolean;
|
|
270
|
+
}): string;
|
|
269
271
|
/**
|
|
270
272
|
* The choice as Bring my site draws it (AGL-4152): the finish, and where the
|
|
271
273
|
* Also improve my wording switch sits, which counts only under Improve it, so
|
|
@@ -404,15 +404,20 @@ const BUILD_COPY = {
|
|
|
404
404
|
* What Also improve my wording adds (AGL-4152): for a wave, its pages'
|
|
405
405
|
* rewrites, "Adds about 162 AI credits to this wave."; before the site is
|
|
406
406
|
* read, a main page's.
|
|
407
|
-
*/ export function aiSiteImportWordingCreditsText(scope) {
|
|
407
|
+
*/ export function aiSiteImportWordingCreditsText(scope, options = {}) {
|
|
408
408
|
var _scope_job_items;
|
|
409
|
-
|
|
409
|
+
// Under a generative Improve it (AGL-4152) new copy is quoted as the redesign it is, before the read and on the job's page alike.
|
|
410
|
+
const generative = (scope == null ? void 0 : scope.job.siteImport) ? aiSiteImportWaveIsGenerative(scope.job.siteImport, scope.wave) : options.generative === true;
|
|
411
|
+
const how = generative ? {
|
|
412
|
+
generative: true
|
|
413
|
+
} : {};
|
|
414
|
+
if (!(scope == null ? void 0 : scope.job.siteImport)) return `About ${aiSiteImportWordingCredits(1, how).likely.toLocaleString('en-US')} more AI credits for each main page.`;
|
|
410
415
|
const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, {
|
|
411
416
|
finish: 'improve',
|
|
412
417
|
wording: true
|
|
413
418
|
}, (_scope_job_items = scope.job.items) != null ? _scope_job_items : null);
|
|
414
419
|
if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.';
|
|
415
|
-
return `Adds about ${aiSiteImportWordingCredits(pages).likely.toLocaleString('en-US')} AI credits to this wave.`;
|
|
420
|
+
return `Adds about ${aiSiteImportWordingCredits(pages, how).likely.toLocaleString('en-US')} AI credits to this wave.`;
|
|
416
421
|
}
|
|
417
422
|
/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */ export function aiSiteImportFinishFieldOf(state) {
|
|
418
423
|
const choice = aiSiteImportChoiceOf(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-view.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 */\n\n/*==========================================\n * BRING MY SITE, AS THE CONSOLE SHOWS IT (AGL-3976).\n *\n * Pure: what the \"Create site\" choice card says before anyone clicks, and\n * what an import job's page shows in each of its states — the site read and\n * its waves planned, a wave running, a wave in for review, a wave held for a\n * proof or the day's limit, the import done. The components draw these; the\n * specs hold them.\n *=========================================*/\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { aiCreditRangeText } from './ai-credit-estimate'\nimport { aiMediaCreditsPerPicture } from './ai-media-credits'\nimport type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE,\n AI_SITE_IMPORT_LAYOUT_KEPT,\n AI_SITE_IMPORT_PLAN_FELL_BACK,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportChoiceOf,\n aiSiteImportGeneratedPicturesOn,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportPlanAccepted,\n aiSiteImportPlanAwaits,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveChoice,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveIsGenerative,\n aiSiteImportWaveOwed,\n aiSiteImportWordingCredits,\n aiSiteImportWordingPages,\n type AiSiteImportChoice,\n type AiSiteImportFinish,\n type AiSiteImportLeftOutReason,\n type AiSiteImportPage,\n type AiSiteImportState,\n type AiSiteImportWave,\n} from './ai-site-import'\n\n/** A domain ownership claim, as the ownership door answers it. */\nexport interface AiSiteImportClaim {\n domain: string\n status: 'pending' | 'proven'\n current: boolean\n provenMethod: 'dns' | 'meta' | 'email' | null\n provenAt: number | null\n provenDetail: string | null\n lastChecks: Partial<Record<'dns' | 'meta' | 'email', 'proven' | 'not-yet' | 'unreachable'>>\n dns: { host: string; type: 'TXT'; value: string }\n meta: { name: string; content: string; tag: string }\n email: { domain: string; pendingAddress: string | null; expiresAt: number | null; attemptsLeft: number | null }\n}\n\n/** Whether \"Bring my site\" is offered here, and if not why. */\nexport type AiSiteImportAvailability =\n | { state: 'checking' }\n /** The release flag is off, or the doors cannot be reached: the card is not drawn. */\n | { state: 'hidden' }\n /** Something the workspace can change stands in the way: the card is drawn disabled, with the reason. */\n | { state: 'blocked'; reason: 'plan' | 'role'; message: string }\n | { state: 'ready'; claims: AiSiteImportClaim[] }\n\n/** What the card says to a plan that does not include it. */\nexport const AI_SITE_IMPORT_PLAN_COPY =\n 'Bring your current website in, every page and photo, on any paid plan. Upgrade to bring yours in.'\n\n/** What the card says to a member who cannot. */\nexport const AI_SITE_IMPORT_ROLE_COPY = 'Only the workspace owner or an admin can bring a site in.'\n\n/**\n * The jobs list's `siteImport` offer (AGL-3976), as the card's state: absent\n * is the flag off, and the card is not drawn; `plan` and `role` are drawn\n * disabled with the reason.\n */\nexport function aiSiteImportOfferOf(offer: unknown): AiSiteImportAvailability {\n if (offer === 'ready') return { state: 'ready', claims: [] }\n if (offer === 'plan') return { state: 'blocked', reason: 'plan', message: AI_SITE_IMPORT_PLAN_COPY }\n if (offer === 'role') return { state: 'blocked', reason: 'role', message: AI_SITE_IMPORT_ROLE_COPY }\n return { state: 'hidden' }\n}\n\n/** Where an import job's page is. */\nexport type AiSiteImportPhase =\n /** The site is being read. */\n | 'reading'\n /** Read and planned; the first wave waits to be started. */\n | 'ready'\n /** A wave was started and has not begun yet. */\n | 'starting'\n | 'running'\n /** A wave is in; the next waits to be started. */\n | 'review'\n /** Held for something the person does: verify again, wait for tomorrow, read again. */\n | 'held'\n /** Out of AI credits or at a cap: the meter's pause, carried on by Resume. */\n | 'paused'\n | 'done'\n | 'stopped'\n\nexport function aiSiteImportPhaseOf(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): AiSiteImportPhase {\n const state = job.siteImport ?? null\n // A read that stopped at its home page is held, and its Check again reads again (AGL-4083).\n const stopped = aiSiteImportReadStops(state?.verdict)\n if (job.status === 'done') return 'done'\n if (job.status === 'failed' || job.status === 'canceled') return 'stopped'\n if (job.status === 'needs_input') return 'paused'\n if (job.status === 'needs_review') {\n if (job.review?.reason !== 'wave' || !state || stopped) return 'held'\n return aiSiteImportReviewWave(state) ? 'review' : 'ready'\n }\n if (!state || stopped) return 'reading'\n return aiSiteImportRunningWave(state) ? 'running' : 'starting'\n}\n\n/**\n * How a hold that is the site's to fix reads (AGL-4083): its heading, its\n * sentence and its button. A home page bot protection turned away, or one\n * that could not be read, is checked again for free; `null` for any other\n * hold, which keeps its own words.\n */\nexport function aiSiteImportHeldCopy(\n job: Pick<AiJobSummary, 'review' | 'siteImport'>,\n): { heading: string; message: string; action: string } | null {\n const state = job.siteImport ?? null\n const fromState = aiSiteImportReadStops(state?.verdict) ? aiSiteImportReadVerdictReason(state?.verdict) : null\n const reason = job.review?.reason === 'blocked' || job.review?.reason === 'unreadable' ? job.review.reason : fromState\n if (!reason) return null\n const message =\n (fromState && state ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null) ?? job.review?.message ?? ''\n return {\n heading: reason === 'blocked' ? 'AglynBot was turned away' : 'Your home page could not be read',\n message,\n action: 'Check again',\n }\n}\n\n/**\n * Why an import that had started is waiting with no wave to review (AGL-4083):\n * the sentence its stop left, which says what is not in yet and what to start.\n * `null` for one that has not started, and one waiting for its review.\n */\nexport function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null {\n const state = job.siteImport ?? null\n if (aiSiteImportPhaseOf(job) !== 'ready' || !state?.waves.some((wave) => wave.startedAt)) return null\n return job.review?.message || null\n}\n\nexport type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped'\n\nexport interface AiSiteImportRowView {\n slot: string\n title: string\n /** Where it is on the old site. */\n from: string\n /** Where it is on the new one. */\n to: string\n state: AiSiteImportRowState\n /** Why it failed or was left out, or what the person should know. */\n note: string | null\n /** \"3 photos added, 1 already in your library\". */\n photos: string | null\n /** The draft the row wrote, by its output id. */\n outputId: string | null\n /** The page on the old site, to open beside the draft (AGL-4083). */\n oldPage: string\n /** \"1,204 of 1,310 words\", once the page is in and the step has counted them. */\n words: string | null\n /**\n * \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen;\n * \"Arranged and reworded by Aglyn AI\" once its wave improved its words, and\n * \"Arranged by Aglyn AI · Words kept\" for a policy page on such a wave (AGL-4152).\n * Under a generative Improve it: \"Redesigned by Aglyn AI · 2 new sections\",\n * or \"Layout kept: the redesign did not pass\".\n */\n build: string | null\n /** \"New: Why us, FAQ (4)\": the sections a redesign added (AGL-4152). */\n added?: string | null\n /** \"1 stock photo, 1 generated picture\": the pictures a redesign took beside its own (AGL-4152). */\n pictures?: string | null\n /** A page the site's plan proposed (AGL-4152): it has no old page to open. */\n isNew?: boolean\n}\n\nfunction rowState(row: AiJobItemLedger | undefined, active: boolean): AiSiteImportRowState {\n if (!row) return 'waiting'\n if (row.status === 'succeeded' || row.status === 'degraded') return 'done'\n if (row.status === 'failed') return 'failed'\n if (row.status === 'skipped') return 'skipped'\n return active ? 'active' : 'waiting'\n}\n\n/**\n * \"3 photos added\", \"2 photos added, 1 already in your media library\"; with\n * photos that could not come in, against all it tried: \"3 of 5 photos: 2\n * added, 1 already in your media library, 2 could not be brought in\".\n */\nexport function aiSiteImportPhotosText(\n photos: { brought: number; reused: number; skipped?: number } | null | undefined,\n): string | null {\n if (!photos) return null\n const skipped = Math.max(0, photos.skipped ?? 0)\n const into = photos.brought + photos.reused\n if (into === 0 && skipped === 0) return null\n if (!skipped) {\n const added = photos.brought ? `${photos.brought} ${photos.brought === 1 ? 'photo' : 'photos'} added` : ''\n const reused = photos.reused ? `${photos.reused} already in your media library` : ''\n return [added, reused].filter(Boolean).join(', ')\n }\n const parts = [\n photos.brought ? `${photos.brought} added` : '',\n photos.reused ? `${photos.reused} already in your media library` : '',\n `${skipped} could not be brought in`,\n ].filter(Boolean)\n const tried = into + skipped\n return `${into} of ${tried} ${tried === 1 ? 'photo' : 'photos'}: ${parts.join(', ')}`\n}\n\nconst BUILD_COPY = {\n copied: 'Copied as it is',\n arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page redesigned from its ledger (AGL-4152). */\n redesigned: `Redesigned by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page whose wording was improved (AGL-4152). */\n reworded: `Arranged and reworded by ${PLATFORM_BRAND_NAME} AI`,\n /** A policy page on a wave that improved the wording of the rest: it keeps every word. */\n wordsKept: `Arranged by ${PLATFORM_BRAND_NAME} AI · Words kept`,\n} as const\n\n/** A page's build as its row says it, with whether its words were improved where its wave improved wording (AGL-4152). */\nfunction buildCopy(page: AiSiteImportPage, choice: AiSiteImportChoice, generative = false): string | null {\n if (!page.build) return null\n // A redesign that did not pass (AGL-4152): today's compile drew the page.\n if (page.redesign === 'layout-kept') return AI_SITE_IMPORT_LAYOUT_KEPT\n if (page.redesign === 'redesigned') {\n const added = page.added?.length ?? 0\n return added ? `${BUILD_COPY.redesigned} · ${added} new ${added === 1 ? 'section' : 'sections'}` : BUILD_COPY.redesigned\n }\n if (generative && page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.redesigned\n if (page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.reworded\n if (page.build === 'arranged' && page.wording === 'kept' && choice.wording) return BUILD_COPY.wordsKept\n return BUILD_COPY[page.build]\n}\n\n/** \"New: Why us, FAQ (4)\": the sections a redesign added, as its row says (AGL-4152). */\nexport function aiSiteImportAddedText(page: Pick<AiSiteImportPage, 'added'>): string | null {\n const added = page.added ?? []\n return added.length ? `New: ${added.map((section) => (section.items ? `${section.heading} (${section.items})` : section.heading)).join(', ')}` : null\n}\n\n/** \"1 stock photo, 1 generated picture\": what a redesign's pictures came from beside the page's own (AGL-4152). */\nexport function aiSiteImportPicturesText(page: Pick<AiSiteImportPage, 'pictures'>): string | null {\n const pictures = page.pictures\n if (!pictures) return null\n const parts = [\n pictures.stock ? `${pictures.stock} stock ${pictures.stock === 1 ? 'photo' : 'photos'}` : '',\n pictures.generated ? `${pictures.generated} generated ${pictures.generated === 1 ? 'picture' : 'pictures'}` : '',\n pictures.unplaced.length ? `${pictures.unplaced.length} of your photos not placed` : '',\n ].filter(Boolean)\n return parts.length ? parts.join(', ') : null\n}\n\n/** What the row of a page whose words were improved says in place of its word count (AGL-4152). */\nexport const AI_SITE_IMPORT_REWORDED_WORDS = 'Every fact kept'\n\n/** One wave's rows, the header and footer first where the wave builds them. */\nexport function aiSiteImportWaveRows(\n job: Pick<AiJobSummary, 'items' | 'siteImport' | 'status'>,\n wave: AiSiteImportWave,\n): AiSiteImportRowView[] {\n const state = job.siteImport as AiSiteImportState\n const items = new Map((job.items ?? []).map((row) => [row.slot, row]))\n const running = wave.status === 'running' && (job.status === 'running' || job.status === 'queued')\n let activeTaken = false\n const active = (row: AiJobItemLedger | undefined) => {\n if (!running || activeTaken || !row || (row.status !== 'pending' && row.status !== 'running')) return false\n activeTaken = true\n return true\n }\n const rows: AiSiteImportRowView[] = []\n const choice = aiSiteImportWaveChoice(state, wave)\n const generative = aiSiteImportWaveIsGenerative(state, wave)\n if (wave.frame && state.frame) {\n const row = items.get(AI_SITE_IMPORT_FRAME_SLOT)\n rows.push({\n slot: AI_SITE_IMPORT_FRAME_SLOT,\n title: 'Header and footer',\n from: `Your menu on ${state.domain}`,\n to: 'Every page',\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? null,\n photos: null,\n outputId: row?.outputs[0] ?? null,\n oldPage: `https://${state.domain}/`,\n words: null,\n build: null,\n })\n }\n for (const slot of wave.slots) {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page) continue\n const row = items.get(slot)\n rows.push({\n slot,\n title: page.title,\n from: page.path,\n to: page.slug === '/' ? '/' : `/${page.slug}`,\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? (page.refused ? AI_SITE_IMPORT_LEFT_OUT_COPY[page.refused] : null),\n // What a generative Improve it says of a page beside its build (AGL-4152).\n ...(aiSiteImportAddedText(page) ? { added: aiSiteImportAddedText(page) } : {}),\n ...(aiSiteImportPicturesText(page) ? { pictures: aiSiteImportPicturesText(page) } : {}),\n ...(page.origin === 'proposed' ? { isNew: true } : {}),\n photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n // Beside the old page's own words, its main region's as the wave read them: its menu and footer are the site's (AGL-4084).\n // A page whose words were improved keeps its facts, not its count (AGL-4152).\n words: page.brought && page.origin !== 'proposed'\n ? page.wording === 'improved'\n ? AI_SITE_IMPORT_REWORDED_WORDS\n : `${page.brought.words.toLocaleString('en-US')} of ${(page.read?.words ?? page.words).toLocaleString('en-US')} words`\n : null,\n build: buildCopy(page, choice, generative),\n })\n }\n return rows\n}\n\n/**\n * \"About 189 credits (up to 650)\" for the wave, as it stands; once the step\n * has chosen how its pages are built, it names them: \"…: 7 pages arranged by\n * Aglyn AI, 3 copied as they are\" (AGL-4083).\n */\nexport function aiSiteImportWaveQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, wave: AiSiteImportWave): string {\n const state = job.siteImport as AiSiteImportState\n const range = aiSiteImportWaveCreditRange(state, wave, job.items ?? null)\n return aiSiteImportQuoteText(range, aiSiteImportWaveOwed(state, wave, job.items ?? null), aiSiteImportWaveIsGenerative(state, wave) ? { generative: true } : {})\n}\n\n/** What a wave cost, its pages' credits less what was given back. */\nexport function aiSiteImportWaveSpent(job: Pick<AiJobSummary, 'items'>, wave: AiSiteImportWave): number {\n const slots = new Set([...wave.slots, ...(wave.frame ? [AI_SITE_IMPORT_FRAME_SLOT] : [])])\n return (job.items ?? [])\n .filter((row) => slots.has(row.slot))\n .reduce((total, row) => total + Math.max(0, (row.creditsSpent ?? 0) - (row.creditsRefunded ?? 0)), 0)\n}\n\n/** Pages the site has that AglynBot could not read: turned away, unanswered, too large or never reached. */\nexport function aiSiteImportUnreadCount(state: AiSiteImportState): number {\n return AI_SITE_IMPORT_UNREAD_REASONS.reduce((total, reason) => total + (state.leftOutCount[reason] ?? 0), 0)\n}\n\n/**\n * The read site in one sentence: \"Found 21 pages on harbor-dental.com: Main\n * pages (6) and Blog (14).\" — and how many more could not be read (AGL-4083).\n */\nexport function aiSiteImportFoundText(state: AiSiteImportState): string {\n const groups = state.groups.map((group) => `${group.label} (${group.pages})`)\n const listed =\n groups.length <= 1 ? groups.join('') : `${groups.slice(0, -1).join(', ')} and ${groups[groups.length - 1]}`\n const found = `Found ${aiSiteImportPagesText(state.found)} on ${state.domain}`\n const lead = listed ? `${found}: ${listed}.` : `${found}.`\n const unread = aiSiteImportUnreadCount(state)\n return unread ? `${lead} ${unread.toLocaleString('en-US')} more could not be read; see Not brought in.` : lead\n}\n\n/** Why the read stopped short, when it did and left pages unread (AGL-4083). */\nexport function aiSiteImportStopText(state: AiSiteImportState): string | null {\n const unreached = state.leftOutCount['not-reached'] ?? 0\n if (!unreached) return null\n const first = `Only the first ${aiSiteImportPagesText(state.found)}`\n const rest = 'the rest are listed under Not brought in as not reached.'\n switch (state.stoppedBy) {\n case 'time':\n return `${first} could be read in the time allowed; ${rest}`\n case 'total-bytes':\n return `${first} could be read before the read reached its size limit; ${rest}`\n default:\n return `${first} could be read this time; ${rest}`\n }\n}\n\n/** The read's warning when most of the site was turned away though its home page came in (AGL-4083). */\nexport function aiSiteImportVerdictNote(state: AiSiteImportState): string | null {\n return state.verdict?.kind === 'mostly-blocked' ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null\n}\n\n/** The plan's page count against the site: \"Your plan includes 25 pages and this site has 0, so 20 are brought in.\" */\nexport function aiSiteImportPlanText(state: AiSiteImportState): string {\n const kept = state.pages.length\n const waves = state.waves.length\n const plan =\n state.pageLimit === null\n ? 'Your plan has no page limit'\n : `Your plan includes ${aiSiteImportPagesText(state.pageLimit)} and this site has ${state.existingPages}`\n const lead = `${plan}, so ${aiSiteImportPagesText(kept)} ${kept === 1 ? 'is' : 'are'} brought in, in ${waves === 1 ? 'one wave' : `${waves} waves`}.`\n const stop = aiSiteImportStopText(state)\n return stop ? `${lead} ${stop}` : lead\n}\n\n/** What was left out, by reason, most first. */\nexport function aiSiteImportLeftOutLines(state: AiSiteImportState): Array<{ reason: AiSiteImportLeftOutReason; count: number; text: string; paths: string[] }> {\n return AI_SITE_IMPORT_LEFT_OUT_REASONS.map((reason) => ({\n reason,\n count: state.leftOutCount[reason] ?? 0,\n text: AI_SITE_IMPORT_LEFT_OUT_COPY[reason],\n paths: state.leftOut.filter((entry) => entry.reason === reason).map((entry) => entry.path),\n }))\n .filter((line) => line.count > 0)\n .sort((a, b) => b.count - a.count)\n}\n\n/** The wave a page offers to start next, and its button's words. */\nexport function aiSiteImportStartAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n // An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).\n const wave = (job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) ?? aiSiteImportNextWave(state)\n if (!state || !wave) return null\n return { wave, label: `Start ${wave.label}`, quote: aiSiteImportWaveQuote(job, wave) }\n}\n\n/**\n * \"Start every remaining wave\" (AGL-4083), off by default: offered beside the\n * next wave's button when more than one wave waits, quoted as all of them.\n */\nexport function aiSiteImportStartAllAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'>,\n): { label: string; quote: string; waves: number } | null {\n const state = job.siteImport ?? null\n if (!state || !aiSiteImportNextWave(state)) return null\n const waves = state.waves.filter((wave) => wave.status === 'waiting').length\n if (waves < 2) return null\n return {\n label: 'Start every remaining wave',\n quote: aiCreditRangeText(aiSiteImportRemainingCreditRange(state, job.items ?? null)),\n waves,\n }\n}\n\n/*------------------------------------------\n * Keep my site, or Improve it (AGL-4152)\n *-----------------------------------------*/\n\n/** What Bring my site asks, and what each answer means, as the console draws it. */\nexport const AI_SITE_IMPORT_FINISH_COPY = {\n heading: 'How should your new site look?',\n keep: {\n label: 'Keep my site',\n description: `Your pages stay laid out as they are, in your site’s colors, buttons and fonts. ${PLATFORM_BRAND_NAME} tidies spacing, type and color so every page reads well. Every word stays as you wrote it.`,\n },\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI redesigns each page with your pictures, menus and forms, in a theme built around your brand.`,\n },\n wording: {\n label: 'Also improve my wording',\n description: `${PLATFORM_BRAND_NAME} AI rewrites the headings, paragraphs and buttons of your main pages so they read better. Every name, price, number, date, address, phone number and email stays exactly as you wrote it. Quotes, policies, tables and forms keep every word.`,\n },\n helper: 'You can change this before each wave.',\n /** The job page's line before it opens the choice: \"How your new site looks: Keep my site\". */\n current: 'How your new site looks',\n change: 'Change',\n} as const\n\n/**\n * The same choice under a generative Improve it (AGL-4152): the improve option's\n * and the switch's words; everything else stands. Only drawn under the flag.\n */\nexport const AI_SITE_IMPORT_FINISH_COPY_GENERATIVE = {\n ...AI_SITE_IMPORT_FINISH_COPY,\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI plans your menu and footer, and redesigns each page with your pictures and forms, in a theme built around your brand. It shows you the plan before anything is built.`,\n },\n wording: {\n label: 'Also write new copy',\n description: `${PLATFORM_BRAND_NAME} AI writes new headings, paragraphs and sections for your main pages from what your site says. It never makes up a name, number, price, date, testimonial, client, award, credential, address or guarantee. Off, every word stays as you wrote it, and your layout and menu are still redesigned.`,\n },\n} as const\n\n/** The choice in a few words: \"Keep my site\", \"Improve it\", or \"Improve it, and my wording\"; under a generative Improve it, \"Improve it, with new copy\". */\nexport function aiSiteImportChoiceText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (!choice.wording) return AI_SITE_IMPORT_FINISH_COPY.improve.label\n return options.generative ? `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, with new copy` : `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, and my wording`\n}\n\n/** How a wave was built, as its heading says it: \"Keep my site\", \"Improved\", or \"Improved, wording too\"; under a generative Improve it, \"Redesigned\" or \"Redesigned, new copy\". */\nexport function aiSiteImportBuiltText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (options.generative) return choice.wording ? 'Redesigned, new copy' : 'Redesigned'\n return choice.wording ? 'Improved, wording too' : 'Improved'\n}\n\n/**\n * A wave's heading (AGL-4152): once it has started, its name and how it was\n * built, \"Main pages · Keep my site\"; before, its name alone, since how it is\n * built is still the owner's to change.\n */\nexport function aiSiteImportWaveHeading(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined, wave: AiSiteImportWave): string {\n if (!wave.startedAt) return wave.label\n return `${wave.label} · ${aiSiteImportBuiltText(aiSiteImportWaveChoice(state, wave), wave.generative ? { generative: true } : {})}`\n}\n\n/** What a running wave's page says it does with each page, the way the wave is built (AGL-4152). */\nexport function aiSiteImportRunningLede(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n const review = 'You review the wave when it is in.'\n if (choice.finish === 'keep') return `Each page keeps its layout and every word as you wrote it, in your site’s own look. ${review}`\n if (options.generative && choice.wording) return `${PLATFORM_BRAND_NAME} AI redesigns each page and writes new copy from what your site says, making up no name, number, price or date. ${review}`\n return choice.wording\n ? `${PLATFORM_BRAND_NAME} AI redesigns each page and improves its wording, keeping every name, price, number, date, address, phone number and email as you wrote it. ${review}`\n : `${PLATFORM_BRAND_NAME} AI redesigns each page with its own words, pictures, menus and forms. ${review}`\n}\n\n/**\n * What Also improve my wording adds (AGL-4152): for a wave, its pages'\n * rewrites, \"Adds about 162 AI credits to this wave.\"; before the site is\n * read, a main page's.\n */\nexport function aiSiteImportWordingCreditsText(\n scope: { job: Pick<AiJobSummary, 'items' | 'siteImport'>; wave: AiSiteImportWave } | null,\n): string {\n if (!scope?.job.siteImport) return `About ${aiSiteImportWordingCredits(1).likely.toLocaleString('en-US')} more AI credits for each main page.`\n const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, { finish: 'improve', wording: true }, scope.job.items ?? null)\n if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.'\n return `Adds about ${aiSiteImportWordingCredits(pages).likely.toLocaleString('en-US')} AI credits to this wave.`\n}\n\n/**\n * The choice as Bring my site draws it (AGL-4152): the finish, and where the\n * Also improve my wording switch sits, which counts only under Improve it, so\n * a person who picks Keep my site and then Improve it finds it on.\n */\nexport interface AiSiteImportFinishField {\n finish: AiSiteImportFinish\n wording: boolean\n}\n\n/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */\nexport function aiSiteImportFinishFieldOf(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined): AiSiteImportFinishField {\n const choice = aiSiteImportChoiceOf(state)\n return choice.finish === 'improve' ? choice : { finish: 'keep', wording: AI_SITE_IMPORT_DEFAULT_CHOICE.wording }\n}\n\n/** The choice a field asks for: its wording only under Improve it. */\nexport function aiSiteImportFieldChoice(field: AiSiteImportFinishField): AiSiteImportChoice {\n return { finish: field.finish, wording: field.finish === 'improve' && field.wording }\n}\n\n/*------------------------------------------\n * Your new site (AGL-4152)\n *-----------------------------------------*/\n\n/** The \"Your new site\" panel's words: what the site is, its menu, its main button, its footer, and what its owner may switch. */\nexport interface AiSiteImportPlanView {\n what: string\n audience: string\n /** Each menu entry: its label and the pages under it; one page is a plain link. */\n menu: Array<{ label: string; pages: string[] }>\n /** \"Book a visit → Contact\". */\n cta: string | null\n footer: Array<{ label: string; pages: string[] }>\n /** The page it proposes, whether it was kept or switched off. */\n proposed: { title: string; purpose: string; address: string } | null\n /** Whether the owner still decides: the plan waits on them. */\n editable: boolean\n}\n\n/** The panel's fixed words, one place for its specs and its screen. */\nexport const AI_SITE_IMPORT_PLAN_COPY_TEXT = {\n heading: 'Your new site',\n menu: 'Menu',\n cta: 'Main button',\n footer: 'Footer',\n addPage: 'Add this new page',\n addPageHelp: 'One new page, written from what your site says. It counts toward your plan’s page limit.',\n pictures: 'Create pictures with AI where needed',\n build: 'Build my new site',\n whatsNew: 'What’s new',\n} as const\n\n/** The panel as a plan reads, or `null` with none: every import the flag is off for, and every plan that did not pass. */\nexport function aiSiteImportPlanViewOf(state: AiSiteImportState | null | undefined): AiSiteImportPlanView | null {\n const plan = state?.plan\n if (!state || !plan) return null\n const name = (id: string) => (plan.proposed?.draftId === id ? plan.proposed.title : (state.pages.find((page) => page.draftId === id)?.title ?? ''))\n const named = (groups: ReadonlyArray<{ label: string; pages: string[] }>) => groups.map((group) => ({ label: group.label, pages: group.pages.map(name).filter(Boolean) })).filter((group) => group.pages.length)\n const cta = plan.nav.primaryCta\n const where = !cta ? '' : cta.target === 'phone' ? 'your phone number' : name(cta.target === 'form' ? (cta.page ?? '') : cta.target)\n return {\n what: plan.site.what,\n audience: plan.site.audience,\n menu: named(plan.nav.groups),\n cta: cta && where ? `${cta.label} → ${where}` : null,\n footer: named(plan.nav.footer),\n proposed: plan.proposed && (aiSiteImportPlanAwaits(state) || plan.proposed.on) ? { title: plan.proposed.title, purpose: plan.proposed.purpose, address: `/${plan.proposed.slug}` } : null,\n editable: aiSiteImportPlanAwaits(state),\n }\n}\n\n/** What the plan that did not pass says, or `null`: a plan that passed, and every import with none asked. */\nexport function aiSiteImportPlanFellBackText(state: Pick<AiSiteImportState, 'plan'> | null | undefined): string | null {\n return state?.plan === null ? AI_SITE_IMPORT_PLAN_FELL_BACK : null\n}\n\n/** The credits a generated picture is quoted at, on a paid plan: an import is one. */\nexport const aiSiteImportPictureCredits = (): number => aiMediaCreditsPerPicture('photo', undefined, '1K')\n\n/** What the generated pictures switch says it adds: how many at most, and what each costs, before it is on. */\nexport function aiSiteImportPicturesSwitchText(state: AiSiteImportState): string {\n const pages = state.pages.filter((page) => page.wording === 'improved' && !page.refused).length\n const each = aiSiteImportPictureCredits()\n const most = pages * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE\n return `Only where your own photos and the stock library have nothing that fits: a page’s opening picture or a section’s lead, up to ${AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE} a page. About ${each.toLocaleString('en-US')} AI credits each${most ? `, so at most ${(most * each).toLocaleString('en-US')} for this wave` : ''}. A picture that is not made costs nothing.`\n}\n\n/** Whether generated pictures are switched on now, for the panel's first draw. */\nexport function aiSiteImportPlanFieldOf(state: AiSiteImportState | null | undefined): { addPage: boolean; pictures: boolean } {\n return { addPage: state?.plan?.proposed?.on !== false, pictures: aiSiteImportGeneratedPicturesOn(state) }\n}\n\n/** Whether a plan's generated pictures switch means anything: only pages with new copy ask for a picture. */\nexport function aiSiteImportPlanTakesPictures(state: Pick<AiSiteImportState, 'pages'>): boolean {\n return state.pages.some((page) => page.wording === 'improved' && !page.refused)\n}\n\n/** The wave's quote as the plan's switches stand now (AGL-4152), before they are saved: with or without its new page, and its pictures. */\nexport function aiSiteImportPlanQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, field: { addPage: boolean; pictures: boolean }): string | null {\n const state = job.siteImport ?? null\n const plan = state?.plan\n if (!state || !plan) return null\n const asked: AiSiteImportState = { ...state, generatedPictures: field.pictures, plan: { ...plan, proposed: plan.proposed ? { ...plan.proposed, on: field.addPage } : null } }\n const next = aiSiteImportPlanAccepted(asked, job.items ?? [])\n const wave = aiSiteImportRunningWave(next.state)\n return wave ? aiSiteImportWaveQuote({ items: next.items, siteImport: next.state }, wave) : null\n}\n\n/** One page's lines of a wave's \"What's new\" (AGL-4152): its new sections, and its pictures. */\nexport interface AiSiteImportWhatsNewLine {\n page: string\n lines: string[]\n}\n\n/** A wave's \"What's new\" (AGL-4152): what its redesigns added, page by page. Empty on every other wave. */\nexport function aiSiteImportWhatsNew(state: AiSiteImportState, wave: AiSiteImportWave): AiSiteImportWhatsNewLine[] {\n return wave.slots.flatMap((slot) => {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page || page.redesign !== 'redesigned') return []\n const lines = [page.origin === 'proposed' ? 'A new page, written from what your site says' : '', aiSiteImportAddedText(page) ?? '', aiSiteImportPicturesText(page) ?? ''].filter(Boolean)\n return lines.length ? [{ page: page.title, lines }] : []\n })\n}\n"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","aiMediaCreditsPerPicture","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE","AI_SITE_IMPORT_LAYOUT_KEPT","AI_SITE_IMPORT_PLAN_FELL_BACK","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportChoiceOf","aiSiteImportGeneratedPicturesOn","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportPlanAccepted","aiSiteImportPlanAwaits","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveChoice","aiSiteImportWaveCreditRange","aiSiteImportWaveIsGenerative","aiSiteImportWaveOwed","aiSiteImportWordingCredits","aiSiteImportWordingPages","AI_SITE_IMPORT_PLAN_COPY","AI_SITE_IMPORT_ROLE_COPY","aiSiteImportOfferOf","offer","state","claims","reason","message","aiSiteImportPhaseOf","job","siteImport","stopped","verdict","status","review","aiSiteImportHeldCopy","fromState","domain","heading","action","aiSiteImportStoppedCopy","waves","some","wave","startedAt","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","redesigned","reworded","wordsKept","buildCopy","page","choice","generative","build","redesign","length","wording","aiSiteImportAddedText","map","section","items","aiSiteImportPicturesText","pictures","stock","generated","unplaced","AI_SITE_IMPORT_REWORDED_WORDS","aiSiteImportWaveRows","Map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","slots","pages","find","entry","path","slug","refused","origin","isNew","url","toLocaleString","read","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction","AI_SITE_IMPORT_FINISH_COPY","keep","description","improve","helper","current","change","AI_SITE_IMPORT_FINISH_COPY_GENERATIVE","aiSiteImportChoiceText","options","finish","aiSiteImportBuiltText","aiSiteImportWaveHeading","aiSiteImportRunningLede","aiSiteImportWordingCreditsText","scope","likely","aiSiteImportFinishFieldOf","aiSiteImportFieldChoice","field","AI_SITE_IMPORT_PLAN_COPY_TEXT","menu","cta","footer","addPage","addPageHelp","whatsNew","aiSiteImportPlanViewOf","name","id","proposed","draftId","named","nav","primaryCta","where","target","what","site","audience","on","purpose","address","editable","aiSiteImportPlanFellBackText","aiSiteImportPictureCredits","undefined","aiSiteImportPicturesSwitchText","each","most","aiSiteImportPlanFieldOf","aiSiteImportPlanTakesPictures","aiSiteImportPlanQuote","asked","generatedPictures","next","aiSiteImportWhatsNew","flatMap","lines"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB;AACxD,SAASC,wBAAwB,QAAQ,wBAAoB;AAE7D,SACEC,yBAAyB,EACzBC,0CAA0C,EAC1CC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,6BAA6B,EAC7BC,oBAAoB,EACpBC,+BAA+B,EAC/BC,oBAAoB,EACpBC,qBAAqB,EACrBC,wBAAwB,EACxBC,sBAAsB,EACtBC,qBAAqB,EACrBC,qBAAqB,EACrBC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,gCAAgC,EAChCC,sBAAsB,EACtBC,uBAAuB,EACvBC,sBAAsB,EACtBC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,oBAAoB,EACpBC,0BAA0B,EAC1BC,wBAAwB,QAOnB,sBAAkB;AAyBzB,2DAA2D,GAC3D,OAAO,MAAMC,2BACX,oGAAmG;AAErG,+CAA+C,GAC/C,OAAO,MAAMC,2BAA2B,4DAA2D;AAEnG;;;;CAIC,GACD,OAAO,SAASC,oBAAoBC,KAAc;IAChD,IAAIA,UAAU,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7F;AAQA,yGAAyG,GACzG,OAAO,SAAS8K,qBAAqBjM,KAAwB,EAAEmB,IAAsB;IACnF,OAAOA,KAAK6D,KAAK,CAACkH,OAAO,CAAC,CAAClI;YAGwEZ,wBAAmCI;QAFpI,MAAMX,OAAO7C,MAAMiF,KAAK,CAACC,IAAI,CAAC,CAACC,QAAUA,MAAMnB,IAAI,KAAKA;QACxD,IAAI,CAACnB,QAAQA,KAAKI,QAAQ,KAAK,cAAc,OAAO,EAAE;QACtD,MAAMkJ,QAAQ;YAACtJ,KAAK0C,MAAM,KAAK,aAAa,iDAAiD;aAAInC,yBAAAA,sBAAsBP,iBAAtBO,yBAA+B;aAAII,4BAAAA,yBAAyBX,iBAAzBW,4BAAkC;SAAG,CAACvB,MAAM,CAACC;QACjL,OAAOiK,MAAMjJ,MAAM,GAAG;YAAC;gBAAEL,MAAMA,KAAK0B,KAAK;gBAAE4H;YAAM;SAAE,GAAG,EAAE;IAC1D;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-view.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 */\n\n/*==========================================\n * BRING MY SITE, AS THE CONSOLE SHOWS IT (AGL-3976).\n *\n * Pure: what the \"Create site\" choice card says before anyone clicks, and\n * what an import job's page shows in each of its states — the site read and\n * its waves planned, a wave running, a wave in for review, a wave held for a\n * proof or the day's limit, the import done. The components draw these; the\n * specs hold them.\n *=========================================*/\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { aiCreditRangeText } from './ai-credit-estimate'\nimport { aiMediaCreditsPerPicture } from './ai-media-credits'\nimport type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE,\n AI_SITE_IMPORT_LAYOUT_KEPT,\n AI_SITE_IMPORT_PLAN_FELL_BACK,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportChoiceOf,\n aiSiteImportGeneratedPicturesOn,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportPlanAccepted,\n aiSiteImportPlanAwaits,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveChoice,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveIsGenerative,\n aiSiteImportWaveOwed,\n aiSiteImportWordingCredits,\n aiSiteImportWordingPages,\n type AiSiteImportChoice,\n type AiSiteImportFinish,\n type AiSiteImportLeftOutReason,\n type AiSiteImportPage,\n type AiSiteImportState,\n type AiSiteImportWave,\n} from './ai-site-import'\n\n/** A domain ownership claim, as the ownership door answers it. */\nexport interface AiSiteImportClaim {\n domain: string\n status: 'pending' | 'proven'\n current: boolean\n provenMethod: 'dns' | 'meta' | 'email' | null\n provenAt: number | null\n provenDetail: string | null\n lastChecks: Partial<Record<'dns' | 'meta' | 'email', 'proven' | 'not-yet' | 'unreachable'>>\n dns: { host: string; type: 'TXT'; value: string }\n meta: { name: string; content: string; tag: string }\n email: { domain: string; pendingAddress: string | null; expiresAt: number | null; attemptsLeft: number | null }\n}\n\n/** Whether \"Bring my site\" is offered here, and if not why. */\nexport type AiSiteImportAvailability =\n | { state: 'checking' }\n /** The release flag is off, or the doors cannot be reached: the card is not drawn. */\n | { state: 'hidden' }\n /** Something the workspace can change stands in the way: the card is drawn disabled, with the reason. */\n | { state: 'blocked'; reason: 'plan' | 'role'; message: string }\n | { state: 'ready'; claims: AiSiteImportClaim[] }\n\n/** What the card says to a plan that does not include it. */\nexport const AI_SITE_IMPORT_PLAN_COPY =\n 'Bring your current website in, every page and photo, on any paid plan. Upgrade to bring yours in.'\n\n/** What the card says to a member who cannot. */\nexport const AI_SITE_IMPORT_ROLE_COPY = 'Only the workspace owner or an admin can bring a site in.'\n\n/**\n * The jobs list's `siteImport` offer (AGL-3976), as the card's state: absent\n * is the flag off, and the card is not drawn; `plan` and `role` are drawn\n * disabled with the reason.\n */\nexport function aiSiteImportOfferOf(offer: unknown): AiSiteImportAvailability {\n if (offer === 'ready') return { state: 'ready', claims: [] }\n if (offer === 'plan') return { state: 'blocked', reason: 'plan', message: AI_SITE_IMPORT_PLAN_COPY }\n if (offer === 'role') return { state: 'blocked', reason: 'role', message: AI_SITE_IMPORT_ROLE_COPY }\n return { state: 'hidden' }\n}\n\n/** Where an import job's page is. */\nexport type AiSiteImportPhase =\n /** The site is being read. */\n | 'reading'\n /** Read and planned; the first wave waits to be started. */\n | 'ready'\n /** A wave was started and has not begun yet. */\n | 'starting'\n | 'running'\n /** A wave is in; the next waits to be started. */\n | 'review'\n /** Held for something the person does: verify again, wait for tomorrow, read again. */\n | 'held'\n /** Out of AI credits or at a cap: the meter's pause, carried on by Resume. */\n | 'paused'\n | 'done'\n | 'stopped'\n\nexport function aiSiteImportPhaseOf(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): AiSiteImportPhase {\n const state = job.siteImport ?? null\n // A read that stopped at its home page is held, and its Check again reads again (AGL-4083).\n const stopped = aiSiteImportReadStops(state?.verdict)\n if (job.status === 'done') return 'done'\n if (job.status === 'failed' || job.status === 'canceled') return 'stopped'\n if (job.status === 'needs_input') return 'paused'\n if (job.status === 'needs_review') {\n if (job.review?.reason !== 'wave' || !state || stopped) return 'held'\n return aiSiteImportReviewWave(state) ? 'review' : 'ready'\n }\n if (!state || stopped) return 'reading'\n return aiSiteImportRunningWave(state) ? 'running' : 'starting'\n}\n\n/**\n * How a hold that is the site's to fix reads (AGL-4083): its heading, its\n * sentence and its button. A home page bot protection turned away, or one\n * that could not be read, is checked again for free; `null` for any other\n * hold, which keeps its own words.\n */\nexport function aiSiteImportHeldCopy(\n job: Pick<AiJobSummary, 'review' | 'siteImport'>,\n): { heading: string; message: string; action: string } | null {\n const state = job.siteImport ?? null\n const fromState = aiSiteImportReadStops(state?.verdict) ? aiSiteImportReadVerdictReason(state?.verdict) : null\n const reason = job.review?.reason === 'blocked' || job.review?.reason === 'unreadable' ? job.review.reason : fromState\n if (!reason) return null\n const message =\n (fromState && state ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null) ?? job.review?.message ?? ''\n return {\n heading: reason === 'blocked' ? 'AglynBot was turned away' : 'Your home page could not be read',\n message,\n action: 'Check again',\n }\n}\n\n/**\n * Why an import that had started is waiting with no wave to review (AGL-4083):\n * the sentence its stop left, which says what is not in yet and what to start.\n * `null` for one that has not started, and one waiting for its review.\n */\nexport function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null {\n const state = job.siteImport ?? null\n if (aiSiteImportPhaseOf(job) !== 'ready' || !state?.waves.some((wave) => wave.startedAt)) return null\n return job.review?.message || null\n}\n\nexport type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped'\n\nexport interface AiSiteImportRowView {\n slot: string\n title: string\n /** Where it is on the old site. */\n from: string\n /** Where it is on the new one. */\n to: string\n state: AiSiteImportRowState\n /** Why it failed or was left out, or what the person should know. */\n note: string | null\n /** \"3 photos added, 1 already in your library\". */\n photos: string | null\n /** The draft the row wrote, by its output id. */\n outputId: string | null\n /** The page on the old site, to open beside the draft (AGL-4083). */\n oldPage: string\n /** \"1,204 of 1,310 words\", once the page is in and the step has counted them. */\n words: string | null\n /**\n * \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen;\n * \"Arranged and reworded by Aglyn AI\" once its wave improved its words, and\n * \"Arranged by Aglyn AI · Words kept\" for a policy page on such a wave (AGL-4152).\n * Under a generative Improve it: \"Redesigned by Aglyn AI · 2 new sections\",\n * or \"Layout kept: the redesign did not pass\".\n */\n build: string | null\n /** \"New: Why us, FAQ (4)\": the sections a redesign added (AGL-4152). */\n added?: string | null\n /** \"1 stock photo, 1 generated picture\": the pictures a redesign took beside its own (AGL-4152). */\n pictures?: string | null\n /** A page the site's plan proposed (AGL-4152): it has no old page to open. */\n isNew?: boolean\n}\n\nfunction rowState(row: AiJobItemLedger | undefined, active: boolean): AiSiteImportRowState {\n if (!row) return 'waiting'\n if (row.status === 'succeeded' || row.status === 'degraded') return 'done'\n if (row.status === 'failed') return 'failed'\n if (row.status === 'skipped') return 'skipped'\n return active ? 'active' : 'waiting'\n}\n\n/**\n * \"3 photos added\", \"2 photos added, 1 already in your media library\"; with\n * photos that could not come in, against all it tried: \"3 of 5 photos: 2\n * added, 1 already in your media library, 2 could not be brought in\".\n */\nexport function aiSiteImportPhotosText(\n photos: { brought: number; reused: number; skipped?: number } | null | undefined,\n): string | null {\n if (!photos) return null\n const skipped = Math.max(0, photos.skipped ?? 0)\n const into = photos.brought + photos.reused\n if (into === 0 && skipped === 0) return null\n if (!skipped) {\n const added = photos.brought ? `${photos.brought} ${photos.brought === 1 ? 'photo' : 'photos'} added` : ''\n const reused = photos.reused ? `${photos.reused} already in your media library` : ''\n return [added, reused].filter(Boolean).join(', ')\n }\n const parts = [\n photos.brought ? `${photos.brought} added` : '',\n photos.reused ? `${photos.reused} already in your media library` : '',\n `${skipped} could not be brought in`,\n ].filter(Boolean)\n const tried = into + skipped\n return `${into} of ${tried} ${tried === 1 ? 'photo' : 'photos'}: ${parts.join(', ')}`\n}\n\nconst BUILD_COPY = {\n copied: 'Copied as it is',\n arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page redesigned from its ledger (AGL-4152). */\n redesigned: `Redesigned by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page whose wording was improved (AGL-4152). */\n reworded: `Arranged and reworded by ${PLATFORM_BRAND_NAME} AI`,\n /** A policy page on a wave that improved the wording of the rest: it keeps every word. */\n wordsKept: `Arranged by ${PLATFORM_BRAND_NAME} AI · Words kept`,\n} as const\n\n/** A page's build as its row says it, with whether its words were improved where its wave improved wording (AGL-4152). */\nfunction buildCopy(page: AiSiteImportPage, choice: AiSiteImportChoice, generative = false): string | null {\n if (!page.build) return null\n // A redesign that did not pass (AGL-4152): today's compile drew the page.\n if (page.redesign === 'layout-kept') return AI_SITE_IMPORT_LAYOUT_KEPT\n if (page.redesign === 'redesigned') {\n const added = page.added?.length ?? 0\n return added ? `${BUILD_COPY.redesigned} · ${added} new ${added === 1 ? 'section' : 'sections'}` : BUILD_COPY.redesigned\n }\n if (generative && page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.redesigned\n if (page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.reworded\n if (page.build === 'arranged' && page.wording === 'kept' && choice.wording) return BUILD_COPY.wordsKept\n return BUILD_COPY[page.build]\n}\n\n/** \"New: Why us, FAQ (4)\": the sections a redesign added, as its row says (AGL-4152). */\nexport function aiSiteImportAddedText(page: Pick<AiSiteImportPage, 'added'>): string | null {\n const added = page.added ?? []\n return added.length ? `New: ${added.map((section) => (section.items ? `${section.heading} (${section.items})` : section.heading)).join(', ')}` : null\n}\n\n/** \"1 stock photo, 1 generated picture\": what a redesign's pictures came from beside the page's own (AGL-4152). */\nexport function aiSiteImportPicturesText(page: Pick<AiSiteImportPage, 'pictures'>): string | null {\n const pictures = page.pictures\n if (!pictures) return null\n const parts = [\n pictures.stock ? `${pictures.stock} stock ${pictures.stock === 1 ? 'photo' : 'photos'}` : '',\n pictures.generated ? `${pictures.generated} generated ${pictures.generated === 1 ? 'picture' : 'pictures'}` : '',\n pictures.unplaced.length ? `${pictures.unplaced.length} of your photos not placed` : '',\n ].filter(Boolean)\n return parts.length ? parts.join(', ') : null\n}\n\n/** What the row of a page whose words were improved says in place of its word count (AGL-4152). */\nexport const AI_SITE_IMPORT_REWORDED_WORDS = 'Every fact kept'\n\n/** One wave's rows, the header and footer first where the wave builds them. */\nexport function aiSiteImportWaveRows(\n job: Pick<AiJobSummary, 'items' | 'siteImport' | 'status'>,\n wave: AiSiteImportWave,\n): AiSiteImportRowView[] {\n const state = job.siteImport as AiSiteImportState\n const items = new Map((job.items ?? []).map((row) => [row.slot, row]))\n const running = wave.status === 'running' && (job.status === 'running' || job.status === 'queued')\n let activeTaken = false\n const active = (row: AiJobItemLedger | undefined) => {\n if (!running || activeTaken || !row || (row.status !== 'pending' && row.status !== 'running')) return false\n activeTaken = true\n return true\n }\n const rows: AiSiteImportRowView[] = []\n const choice = aiSiteImportWaveChoice(state, wave)\n const generative = aiSiteImportWaveIsGenerative(state, wave)\n if (wave.frame && state.frame) {\n const row = items.get(AI_SITE_IMPORT_FRAME_SLOT)\n rows.push({\n slot: AI_SITE_IMPORT_FRAME_SLOT,\n title: 'Header and footer',\n from: `Your menu on ${state.domain}`,\n to: 'Every page',\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? null,\n photos: null,\n outputId: row?.outputs[0] ?? null,\n oldPage: `https://${state.domain}/`,\n words: null,\n build: null,\n })\n }\n for (const slot of wave.slots) {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page) continue\n const row = items.get(slot)\n rows.push({\n slot,\n title: page.title,\n from: page.path,\n to: page.slug === '/' ? '/' : `/${page.slug}`,\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? (page.refused ? AI_SITE_IMPORT_LEFT_OUT_COPY[page.refused] : null),\n // What a generative Improve it says of a page beside its build (AGL-4152).\n ...(aiSiteImportAddedText(page) ? { added: aiSiteImportAddedText(page) } : {}),\n ...(aiSiteImportPicturesText(page) ? { pictures: aiSiteImportPicturesText(page) } : {}),\n ...(page.origin === 'proposed' ? { isNew: true } : {}),\n photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n // Beside the old page's own words, its main region's as the wave read them: its menu and footer are the site's (AGL-4084).\n // A page whose words were improved keeps its facts, not its count (AGL-4152).\n words: page.brought && page.origin !== 'proposed'\n ? page.wording === 'improved'\n ? AI_SITE_IMPORT_REWORDED_WORDS\n : `${page.brought.words.toLocaleString('en-US')} of ${(page.read?.words ?? page.words).toLocaleString('en-US')} words`\n : null,\n build: buildCopy(page, choice, generative),\n })\n }\n return rows\n}\n\n/**\n * \"About 189 credits (up to 650)\" for the wave, as it stands; once the step\n * has chosen how its pages are built, it names them: \"…: 7 pages arranged by\n * Aglyn AI, 3 copied as they are\" (AGL-4083).\n */\nexport function aiSiteImportWaveQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, wave: AiSiteImportWave): string {\n const state = job.siteImport as AiSiteImportState\n const range = aiSiteImportWaveCreditRange(state, wave, job.items ?? null)\n return aiSiteImportQuoteText(range, aiSiteImportWaveOwed(state, wave, job.items ?? null), aiSiteImportWaveIsGenerative(state, wave) ? { generative: true } : {})\n}\n\n/** What a wave cost, its pages' credits less what was given back. */\nexport function aiSiteImportWaveSpent(job: Pick<AiJobSummary, 'items'>, wave: AiSiteImportWave): number {\n const slots = new Set([...wave.slots, ...(wave.frame ? [AI_SITE_IMPORT_FRAME_SLOT] : [])])\n return (job.items ?? [])\n .filter((row) => slots.has(row.slot))\n .reduce((total, row) => total + Math.max(0, (row.creditsSpent ?? 0) - (row.creditsRefunded ?? 0)), 0)\n}\n\n/** Pages the site has that AglynBot could not read: turned away, unanswered, too large or never reached. */\nexport function aiSiteImportUnreadCount(state: AiSiteImportState): number {\n return AI_SITE_IMPORT_UNREAD_REASONS.reduce((total, reason) => total + (state.leftOutCount[reason] ?? 0), 0)\n}\n\n/**\n * The read site in one sentence: \"Found 21 pages on harbor-dental.com: Main\n * pages (6) and Blog (14).\" — and how many more could not be read (AGL-4083).\n */\nexport function aiSiteImportFoundText(state: AiSiteImportState): string {\n const groups = state.groups.map((group) => `${group.label} (${group.pages})`)\n const listed =\n groups.length <= 1 ? groups.join('') : `${groups.slice(0, -1).join(', ')} and ${groups[groups.length - 1]}`\n const found = `Found ${aiSiteImportPagesText(state.found)} on ${state.domain}`\n const lead = listed ? `${found}: ${listed}.` : `${found}.`\n const unread = aiSiteImportUnreadCount(state)\n return unread ? `${lead} ${unread.toLocaleString('en-US')} more could not be read; see Not brought in.` : lead\n}\n\n/** Why the read stopped short, when it did and left pages unread (AGL-4083). */\nexport function aiSiteImportStopText(state: AiSiteImportState): string | null {\n const unreached = state.leftOutCount['not-reached'] ?? 0\n if (!unreached) return null\n const first = `Only the first ${aiSiteImportPagesText(state.found)}`\n const rest = 'the rest are listed under Not brought in as not reached.'\n switch (state.stoppedBy) {\n case 'time':\n return `${first} could be read in the time allowed; ${rest}`\n case 'total-bytes':\n return `${first} could be read before the read reached its size limit; ${rest}`\n default:\n return `${first} could be read this time; ${rest}`\n }\n}\n\n/** The read's warning when most of the site was turned away though its home page came in (AGL-4083). */\nexport function aiSiteImportVerdictNote(state: AiSiteImportState): string | null {\n return state.verdict?.kind === 'mostly-blocked' ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null\n}\n\n/** The plan's page count against the site: \"Your plan includes 25 pages and this site has 0, so 20 are brought in.\" */\nexport function aiSiteImportPlanText(state: AiSiteImportState): string {\n const kept = state.pages.length\n const waves = state.waves.length\n const plan =\n state.pageLimit === null\n ? 'Your plan has no page limit'\n : `Your plan includes ${aiSiteImportPagesText(state.pageLimit)} and this site has ${state.existingPages}`\n const lead = `${plan}, so ${aiSiteImportPagesText(kept)} ${kept === 1 ? 'is' : 'are'} brought in, in ${waves === 1 ? 'one wave' : `${waves} waves`}.`\n const stop = aiSiteImportStopText(state)\n return stop ? `${lead} ${stop}` : lead\n}\n\n/** What was left out, by reason, most first. */\nexport function aiSiteImportLeftOutLines(state: AiSiteImportState): Array<{ reason: AiSiteImportLeftOutReason; count: number; text: string; paths: string[] }> {\n return AI_SITE_IMPORT_LEFT_OUT_REASONS.map((reason) => ({\n reason,\n count: state.leftOutCount[reason] ?? 0,\n text: AI_SITE_IMPORT_LEFT_OUT_COPY[reason],\n paths: state.leftOut.filter((entry) => entry.reason === reason).map((entry) => entry.path),\n }))\n .filter((line) => line.count > 0)\n .sort((a, b) => b.count - a.count)\n}\n\n/** The wave a page offers to start next, and its button's words. */\nexport function aiSiteImportStartAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n // An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).\n const wave = (job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) ?? aiSiteImportNextWave(state)\n if (!state || !wave) return null\n return { wave, label: `Start ${wave.label}`, quote: aiSiteImportWaveQuote(job, wave) }\n}\n\n/**\n * \"Start every remaining wave\" (AGL-4083), off by default: offered beside the\n * next wave's button when more than one wave waits, quoted as all of them.\n */\nexport function aiSiteImportStartAllAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'>,\n): { label: string; quote: string; waves: number } | null {\n const state = job.siteImport ?? null\n if (!state || !aiSiteImportNextWave(state)) return null\n const waves = state.waves.filter((wave) => wave.status === 'waiting').length\n if (waves < 2) return null\n return {\n label: 'Start every remaining wave',\n quote: aiCreditRangeText(aiSiteImportRemainingCreditRange(state, job.items ?? null)),\n waves,\n }\n}\n\n/*------------------------------------------\n * Keep my site, or Improve it (AGL-4152)\n *-----------------------------------------*/\n\n/** What Bring my site asks, and what each answer means, as the console draws it. */\nexport const AI_SITE_IMPORT_FINISH_COPY = {\n heading: 'How should your new site look?',\n keep: {\n label: 'Keep my site',\n description: `Your pages stay laid out as they are, in your site’s colors, buttons and fonts. ${PLATFORM_BRAND_NAME} tidies spacing, type and color so every page reads well. Every word stays as you wrote it.`,\n },\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI redesigns each page with your pictures, menus and forms, in a theme built around your brand.`,\n },\n wording: {\n label: 'Also improve my wording',\n description: `${PLATFORM_BRAND_NAME} AI rewrites the headings, paragraphs and buttons of your main pages so they read better. Every name, price, number, date, address, phone number and email stays exactly as you wrote it. Quotes, policies, tables and forms keep every word.`,\n },\n helper: 'You can change this before each wave.',\n /** The job page's line before it opens the choice: \"How your new site looks: Keep my site\". */\n current: 'How your new site looks',\n change: 'Change',\n} as const\n\n/**\n * The same choice under a generative Improve it (AGL-4152): the improve option's\n * and the switch's words; everything else stands. Only drawn under the flag.\n */\nexport const AI_SITE_IMPORT_FINISH_COPY_GENERATIVE = {\n ...AI_SITE_IMPORT_FINISH_COPY,\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI plans your menu and footer, and redesigns each page with your pictures and forms, in a theme built around your brand. It shows you the plan before anything is built.`,\n },\n wording: {\n label: 'Also write new copy',\n description: `${PLATFORM_BRAND_NAME} AI writes new headings, paragraphs and sections for your main pages from what your site says. It never makes up a name, number, price, date, testimonial, client, award, credential, address or guarantee. Off, every word stays as you wrote it, and your layout and menu are still redesigned.`,\n },\n} as const\n\n/** The choice in a few words: \"Keep my site\", \"Improve it\", or \"Improve it, and my wording\"; under a generative Improve it, \"Improve it, with new copy\". */\nexport function aiSiteImportChoiceText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (!choice.wording) return AI_SITE_IMPORT_FINISH_COPY.improve.label\n return options.generative ? `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, with new copy` : `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, and my wording`\n}\n\n/** How a wave was built, as its heading says it: \"Keep my site\", \"Improved\", or \"Improved, wording too\"; under a generative Improve it, \"Redesigned\" or \"Redesigned, new copy\". */\nexport function aiSiteImportBuiltText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (options.generative) return choice.wording ? 'Redesigned, new copy' : 'Redesigned'\n return choice.wording ? 'Improved, wording too' : 'Improved'\n}\n\n/**\n * A wave's heading (AGL-4152): once it has started, its name and how it was\n * built, \"Main pages · Keep my site\"; before, its name alone, since how it is\n * built is still the owner's to change.\n */\nexport function aiSiteImportWaveHeading(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined, wave: AiSiteImportWave): string {\n if (!wave.startedAt) return wave.label\n return `${wave.label} · ${aiSiteImportBuiltText(aiSiteImportWaveChoice(state, wave), wave.generative ? { generative: true } : {})}`\n}\n\n/** What a running wave's page says it does with each page, the way the wave is built (AGL-4152). */\nexport function aiSiteImportRunningLede(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n const review = 'You review the wave when it is in.'\n if (choice.finish === 'keep') return `Each page keeps its layout and every word as you wrote it, in your site’s own look. ${review}`\n if (options.generative && choice.wording) return `${PLATFORM_BRAND_NAME} AI redesigns each page and writes new copy from what your site says, making up no name, number, price or date. ${review}`\n return choice.wording\n ? `${PLATFORM_BRAND_NAME} AI redesigns each page and improves its wording, keeping every name, price, number, date, address, phone number and email as you wrote it. ${review}`\n : `${PLATFORM_BRAND_NAME} AI redesigns each page with its own words, pictures, menus and forms. ${review}`\n}\n\n/**\n * What Also improve my wording adds (AGL-4152): for a wave, its pages'\n * rewrites, \"Adds about 162 AI credits to this wave.\"; before the site is\n * read, a main page's.\n */\nexport function aiSiteImportWordingCreditsText(\n scope: { job: Pick<AiJobSummary, 'items' | 'siteImport'>; wave: AiSiteImportWave } | null,\n options: { generative?: boolean } = {},\n): string {\n // Under a generative Improve it (AGL-4152) new copy is quoted as the redesign it is, before the read and on the job's page alike.\n const generative = scope?.job.siteImport ? aiSiteImportWaveIsGenerative(scope.job.siteImport, scope.wave) : options.generative === true\n const how = generative ? { generative: true } : {}\n if (!scope?.job.siteImport) return `About ${aiSiteImportWordingCredits(1, how).likely.toLocaleString('en-US')} more AI credits for each main page.`\n const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, { finish: 'improve', wording: true }, scope.job.items ?? null)\n if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.'\n return `Adds about ${aiSiteImportWordingCredits(pages, how).likely.toLocaleString('en-US')} AI credits to this wave.`\n}\n\n/**\n * The choice as Bring my site draws it (AGL-4152): the finish, and where the\n * Also improve my wording switch sits, which counts only under Improve it, so\n * a person who picks Keep my site and then Improve it finds it on.\n */\nexport interface AiSiteImportFinishField {\n finish: AiSiteImportFinish\n wording: boolean\n}\n\n/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */\nexport function aiSiteImportFinishFieldOf(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined): AiSiteImportFinishField {\n const choice = aiSiteImportChoiceOf(state)\n return choice.finish === 'improve' ? choice : { finish: 'keep', wording: AI_SITE_IMPORT_DEFAULT_CHOICE.wording }\n}\n\n/** The choice a field asks for: its wording only under Improve it. */\nexport function aiSiteImportFieldChoice(field: AiSiteImportFinishField): AiSiteImportChoice {\n return { finish: field.finish, wording: field.finish === 'improve' && field.wording }\n}\n\n/*------------------------------------------\n * Your new site (AGL-4152)\n *-----------------------------------------*/\n\n/** The \"Your new site\" panel's words: what the site is, its menu, its main button, its footer, and what its owner may switch. */\nexport interface AiSiteImportPlanView {\n what: string\n audience: string\n /** Each menu entry: its label and the pages under it; one page is a plain link. */\n menu: Array<{ label: string; pages: string[] }>\n /** \"Book a visit → Contact\". */\n cta: string | null\n footer: Array<{ label: string; pages: string[] }>\n /** The page it proposes, whether it was kept or switched off. */\n proposed: { title: string; purpose: string; address: string } | null\n /** Whether the owner still decides: the plan waits on them. */\n editable: boolean\n}\n\n/** The panel's fixed words, one place for its specs and its screen. */\nexport const AI_SITE_IMPORT_PLAN_COPY_TEXT = {\n heading: 'Your new site',\n menu: 'Menu',\n cta: 'Main button',\n footer: 'Footer',\n addPage: 'Add this new page',\n addPageHelp: 'One new page, written from what your site says. It counts toward your plan’s page limit.',\n pictures: 'Create pictures with AI where needed',\n build: 'Build my new site',\n whatsNew: 'What’s new',\n} as const\n\n/** The panel as a plan reads, or `null` with none: every import the flag is off for, and every plan that did not pass. */\nexport function aiSiteImportPlanViewOf(state: AiSiteImportState | null | undefined): AiSiteImportPlanView | null {\n const plan = state?.plan\n if (!state || !plan) return null\n const name = (id: string) => (plan.proposed?.draftId === id ? plan.proposed.title : (state.pages.find((page) => page.draftId === id)?.title ?? ''))\n const named = (groups: ReadonlyArray<{ label: string; pages: string[] }>) => groups.map((group) => ({ label: group.label, pages: group.pages.map(name).filter(Boolean) })).filter((group) => group.pages.length)\n const cta = plan.nav.primaryCta\n const where = !cta ? '' : cta.target === 'phone' ? 'your phone number' : name(cta.target === 'form' ? (cta.page ?? '') : cta.target)\n return {\n what: plan.site.what,\n audience: plan.site.audience,\n menu: named(plan.nav.groups),\n cta: cta && where ? `${cta.label} → ${where}` : null,\n footer: named(plan.nav.footer),\n proposed: plan.proposed && (aiSiteImportPlanAwaits(state) || plan.proposed.on) ? { title: plan.proposed.title, purpose: plan.proposed.purpose, address: `/${plan.proposed.slug}` } : null,\n editable: aiSiteImportPlanAwaits(state),\n }\n}\n\n/** What the plan that did not pass says, or `null`: a plan that passed, and every import with none asked. */\nexport function aiSiteImportPlanFellBackText(state: Pick<AiSiteImportState, 'plan'> | null | undefined): string | null {\n return state?.plan === null ? AI_SITE_IMPORT_PLAN_FELL_BACK : null\n}\n\n/** The credits a generated picture is quoted at, on a paid plan: an import is one. */\nexport const aiSiteImportPictureCredits = (): number => aiMediaCreditsPerPicture('photo', undefined, '1K')\n\n/** What the generated pictures switch says it adds: how many at most, and what each costs, before it is on. */\nexport function aiSiteImportPicturesSwitchText(state: AiSiteImportState): string {\n const pages = state.pages.filter((page) => page.wording === 'improved' && !page.refused).length\n const each = aiSiteImportPictureCredits()\n const most = pages * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE\n return `Only where your own photos and the stock library have nothing that fits: a page’s opening picture or a section’s lead, up to ${AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE} a page. About ${each.toLocaleString('en-US')} AI credits each${most ? `, so at most ${(most * each).toLocaleString('en-US')} for this wave` : ''}. A picture that is not made costs nothing.`\n}\n\n/** Whether generated pictures are switched on now, for the panel's first draw. */\nexport function aiSiteImportPlanFieldOf(state: AiSiteImportState | null | undefined): { addPage: boolean; pictures: boolean } {\n return { addPage: state?.plan?.proposed?.on !== false, pictures: aiSiteImportGeneratedPicturesOn(state) }\n}\n\n/** Whether a plan's generated pictures switch means anything: only pages with new copy ask for a picture. */\nexport function aiSiteImportPlanTakesPictures(state: Pick<AiSiteImportState, 'pages'>): boolean {\n return state.pages.some((page) => page.wording === 'improved' && !page.refused)\n}\n\n/** The wave's quote as the plan's switches stand now (AGL-4152), before they are saved: with or without its new page, and its pictures. */\nexport function aiSiteImportPlanQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, field: { addPage: boolean; pictures: boolean }): string | null {\n const state = job.siteImport ?? null\n const plan = state?.plan\n if (!state || !plan) return null\n const asked: AiSiteImportState = { ...state, generatedPictures: field.pictures, plan: { ...plan, proposed: plan.proposed ? { ...plan.proposed, on: field.addPage } : null } }\n const next = aiSiteImportPlanAccepted(asked, job.items ?? [])\n const wave = aiSiteImportRunningWave(next.state)\n return wave ? aiSiteImportWaveQuote({ items: next.items, siteImport: next.state }, wave) : null\n}\n\n/** One page's lines of a wave's \"What's new\" (AGL-4152): its new sections, and its pictures. */\nexport interface AiSiteImportWhatsNewLine {\n page: string\n lines: string[]\n}\n\n/** A wave's \"What's new\" (AGL-4152): what its redesigns added, page by page. Empty on every other wave. */\nexport function aiSiteImportWhatsNew(state: AiSiteImportState, wave: AiSiteImportWave): AiSiteImportWhatsNewLine[] {\n return wave.slots.flatMap((slot) => {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page || page.redesign !== 'redesigned') return []\n const lines = [page.origin === 'proposed' ? 'A new page, written from what your site says' : '', aiSiteImportAddedText(page) ?? '', aiSiteImportPicturesText(page) ?? ''].filter(Boolean)\n return lines.length ? [{ page: page.title, lines }] : []\n })\n}\n"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","aiMediaCreditsPerPicture","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE","AI_SITE_IMPORT_LAYOUT_KEPT","AI_SITE_IMPORT_PLAN_FELL_BACK","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportChoiceOf","aiSiteImportGeneratedPicturesOn","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportPlanAccepted","aiSiteImportPlanAwaits","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveChoice","aiSiteImportWaveCreditRange","aiSiteImportWaveIsGenerative","aiSiteImportWaveOwed","aiSiteImportWordingCredits","aiSiteImportWordingPages","AI_SITE_IMPORT_PLAN_COPY","AI_SITE_IMPORT_ROLE_COPY","aiSiteImportOfferOf","offer","state","claims","reason","message","aiSiteImportPhaseOf","job","siteImport","stopped","verdict","status","review","aiSiteImportHeldCopy","fromState","domain","heading","action","aiSiteImportStoppedCopy","waves","some","wave","startedAt","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","redesigned","reworded","wordsKept","buildCopy","page","choice","generative","build","redesign","length","wording","aiSiteImportAddedText","map","section","items","aiSiteImportPicturesText","pictures","stock","generated","unplaced","AI_SITE_IMPORT_REWORDED_WORDS","aiSiteImportWaveRows","Map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","slots","pages","find","entry","path","slug","refused","origin","isNew","url","toLocaleString","read","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction","AI_SITE_IMPORT_FINISH_COPY","keep","description","improve","helper","current","change","AI_SITE_IMPORT_FINISH_COPY_GENERATIVE","aiSiteImportChoiceText","options","finish","aiSiteImportBuiltText","aiSiteImportWaveHeading","aiSiteImportRunningLede","aiSiteImportWordingCreditsText","scope","how","likely","aiSiteImportFinishFieldOf","aiSiteImportFieldChoice","field","AI_SITE_IMPORT_PLAN_COPY_TEXT","menu","cta","footer","addPage","addPageHelp","whatsNew","aiSiteImportPlanViewOf","name","id","proposed","draftId","named","nav","primaryCta","where","target","what","site","audience","on","purpose","address","editable","aiSiteImportPlanFellBackText","aiSiteImportPictureCredits","undefined","aiSiteImportPicturesSwitchText","each","most","aiSiteImportPlanFieldOf","aiSiteImportPlanTakesPictures","aiSiteImportPlanQuote","asked","generatedPictures","next","aiSiteImportWhatsNew","flatMap","lines"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB;AACxD,SAASC,wBAAwB,QAAQ,wBAAoB;AAE7D,SACEC,yBAAyB,EACzBC,0CAA0C,EAC1CC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,+BAA+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AAA,yBAAyBX,iBAAzBW,4BAAkC;SAAG,CAACvB,MAAM,CAACC;QACjL,OAAOkK,MAAMlJ,MAAM,GAAG;YAAC;gBAAEL,MAAMA,KAAK0B,KAAK;gBAAE6H;YAAM;SAAE,GAAG,EAAE;IAC1D;AACF"}
|
|
@@ -792,6 +792,13 @@ export interface AiSiteImportPage {
|
|
|
792
792
|
* compile drew it. Absent on every other page.
|
|
793
793
|
*/
|
|
794
794
|
redesign?: AiSiteImportRedesign | null;
|
|
795
|
+
/**
|
|
796
|
+
* Why its layout was kept, or the design lines its redesign was taken
|
|
797
|
+
* missing, by internal code (AGL-4152): `improve-invented-fact`,
|
|
798
|
+
* `improve-new-sections`, `refused`. For the job's record and the import's
|
|
799
|
+
* report; its row reads in words, never these.
|
|
800
|
+
*/
|
|
801
|
+
redesignMissed?: string[] | null;
|
|
795
802
|
}
|
|
796
803
|
/** How a page's generative Improve it came out (AGL-4152). */
|
|
797
804
|
export type AiSiteImportRedesign = 'redesigned' | 'layout-kept';
|
|
@@ -906,7 +913,20 @@ export interface AiSiteImportState {
|
|
|
906
913
|
generative?: true;
|
|
907
914
|
/** The source's photos a redesigned page left off (AGL-4152), which a later page's slot takes before a stock photo. */
|
|
908
915
|
sitePhotos?: AiSiteImportPhoto[] | null;
|
|
916
|
+
/**
|
|
917
|
+
* What the site's pages say, as a generative wave read them (AGL-4152):
|
|
918
|
+
* each line once, in reading order, up to `AI_SITE_IMPORT_SAID_MAX_CHARS`.
|
|
919
|
+
* A page's read is emptied once it is in, so without these a later page's
|
|
920
|
+
* redesign was held as if no earlier page had said anything: the home
|
|
921
|
+
* page's towns, years and credentials read as invented on the next.
|
|
922
|
+
* Kept past each page, and written only by a generative wave.
|
|
923
|
+
*/
|
|
924
|
+
said?: string[] | null;
|
|
909
925
|
}
|
|
926
|
+
/** The most characters of what the site's pages say an import keeps for its redesigns' facts (AGL-4152). */
|
|
927
|
+
export declare const AI_SITE_IMPORT_SAID_MAX_CHARS = 16000;
|
|
928
|
+
/** What the site's pages say, with these reads' lines added where there is room (AGL-4152). */
|
|
929
|
+
export declare function aiSiteImportSaid(said: readonly string[] | null | undefined, reads: Iterable<AiSiteImportPageRead | AiSiteImportLeftOutReason>): string[];
|
|
910
930
|
/**
|
|
911
931
|
* The site plan (AGL-4152): what the site is, its menu, its design, and at
|
|
912
932
|
* most one proposed page. Page references are draft ids. Its words are the
|
|
@@ -1368,7 +1388,7 @@ export declare function aiSiteImportFinishUpdate(job: Pick<AiJob, 'kind' | 'stat
|
|
|
1368
1388
|
* it shows, for its row; and the source's photos it left off, which a later
|
|
1369
1389
|
* page's slot takes before a stock photo.
|
|
1370
1390
|
*/
|
|
1371
|
-
export declare function aiSiteImportRedesignOf(state: AiSiteImportState, slot: string, redesign: AiSiteImportRedesign, added?: readonly AiSiteImportAddedSection[], pictures?: AiSiteImportPagePictures | null): AiSiteImportState;
|
|
1391
|
+
export declare function aiSiteImportRedesignOf(state: AiSiteImportState, slot: string, redesign: AiSiteImportRedesign, added?: readonly AiSiteImportAddedSection[], pictures?: AiSiteImportPagePictures | null, missed?: readonly string[] | null): AiSiteImportState;
|
|
1372
1392
|
/** Whether generated pictures are on for an import: as its owner said, else the default. */
|
|
1373
1393
|
export declare function aiSiteImportGeneratedPicturesOn(state: Pick<AiSiteImportState, 'generatedPictures'> | null | undefined): boolean;
|
|
1374
1394
|
/** Whether the job waits on its owner's say-so over a plan (AGL-4152): shown, and nothing of the site built. */
|
|
@@ -1414,7 +1434,9 @@ export declare function aiSiteImportWordingPages(state: AiSiteImportState, wave:
|
|
|
1414
1434
|
* difference between the two. Its ceiling, the page's two passes, does not
|
|
1415
1435
|
* move, and no price is new.
|
|
1416
1436
|
*/
|
|
1417
|
-
export declare function aiSiteImportWordingCredits(pages: number
|
|
1437
|
+
export declare function aiSiteImportWordingCredits(pages: number, options?: {
|
|
1438
|
+
generative?: boolean;
|
|
1439
|
+
}): {
|
|
1418
1440
|
likely: number;
|
|
1419
1441
|
p90: number;
|
|
1420
1442
|
};
|
|
@@ -1445,6 +1467,8 @@ export declare function aiSiteImportCreditRange(pages: number, options?: {
|
|
|
1445
1467
|
proposed?: number;
|
|
1446
1468
|
/** Generated pictures it may take at most (AGL-4152): in its ceiling only, since each takes what nothing else fills. */
|
|
1447
1469
|
pictures?: number;
|
|
1470
|
+
/** Its reworded pages are redesigned from their ledgers (AGL-4152), quoted on that row. */
|
|
1471
|
+
generative?: boolean;
|
|
1448
1472
|
}): AiCreditRange;
|
|
1449
1473
|
/**
|
|
1450
1474
|
* What a wave still owes, by how its pages are built, and whether its header
|
|
@@ -1461,6 +1485,7 @@ export declare function aiSiteImportWaveOwed(state: AiSiteImportState, wave: AiS
|
|
|
1461
1485
|
plan?: boolean;
|
|
1462
1486
|
proposed?: number;
|
|
1463
1487
|
pictures?: number;
|
|
1488
|
+
generative?: boolean;
|
|
1464
1489
|
};
|
|
1465
1490
|
/**
|
|
1466
1491
|
* Whether a wave is a generative Improve it (AGL-4152): as stamped once it has
|
|
@@ -473,6 +473,27 @@ function trimItem(item, keep) {
|
|
|
473
473
|
];
|
|
474
474
|
/** What a page's row says where its redesign did not pass (AGL-4152). */ export const AI_SITE_IMPORT_LAYOUT_KEPT = 'Layout kept: the redesign did not pass';
|
|
475
475
|
/** What a proposed page's row says where it could not be written: it has no old page to keep, so it is left out. */ export const AI_SITE_IMPORT_PROPOSED_NOT_WRITTEN = 'This new page was left out: it could not be written without inventing facts. Its credits are given back.';
|
|
476
|
+
/** The most characters of what the site's pages say an import keeps for its redesigns' facts (AGL-4152). */ export const AI_SITE_IMPORT_SAID_MAX_CHARS = 16000;
|
|
477
|
+
/** What the site's pages say, with these reads' lines added where there is room (AGL-4152). */ export function aiSiteImportSaid(said, reads) {
|
|
478
|
+
const out = [
|
|
479
|
+
...said != null ? said : []
|
|
480
|
+
];
|
|
481
|
+
const seen = new Set(out);
|
|
482
|
+
let chars = out.reduce((sum, line)=>sum + line.length, 0);
|
|
483
|
+
for (const read of reads){
|
|
484
|
+
var _read_blocks;
|
|
485
|
+
if (typeof read === 'string') continue;
|
|
486
|
+
for (const block of (_read_blocks = read.blocks) != null ? _read_blocks : []){
|
|
487
|
+
if (block.kind === 'image') continue;
|
|
488
|
+
const line = block.text.replace(/\s+/g, ' ').trim();
|
|
489
|
+
if (!line || seen.has(line) || chars + line.length > AI_SITE_IMPORT_SAID_MAX_CHARS) continue;
|
|
490
|
+
seen.add(line);
|
|
491
|
+
out.push(line);
|
|
492
|
+
chars += line.length;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return out;
|
|
496
|
+
}
|
|
476
497
|
export const AI_SITE_IMPORT_PAGE_ROLES = [
|
|
477
498
|
'home',
|
|
478
499
|
'service',
|
|
@@ -1152,6 +1173,10 @@ const readChars = (read)=>{
|
|
|
1152
1173
|
title: clipLabel(read.title) || ((_next_pages_find = next.pages.find((page)=>page.slot === slot)) == null ? void 0 : _next_pages_find.title) || ''
|
|
1153
1174
|
});
|
|
1154
1175
|
}
|
|
1176
|
+
// A generative wave keeps what its pages say past each page (AGL-4152); any other leaves the state as it was.
|
|
1177
|
+
if (next.waves.some((wave)=>wave.status === 'running' && wave.generative)) next = _extends({}, next, {
|
|
1178
|
+
said: aiSiteImportSaid(next.said, reads.values())
|
|
1179
|
+
});
|
|
1155
1180
|
return next;
|
|
1156
1181
|
}
|
|
1157
1182
|
/** A page's photos are in the library. */ export function aiSiteImportPhotosIn(state, slot, photos) {
|
|
@@ -1228,7 +1253,11 @@ const readChars = (read)=>{
|
|
|
1228
1253
|
}
|
|
1229
1254
|
/** The state as the console reads it: every page's read text left off. */ export function aiSiteImportWire(state) {
|
|
1230
1255
|
if (!state) return null;
|
|
1231
|
-
|
|
1256
|
+
// What the site's pages say is the redesigns' (AGL-4152): the console reads none of it.
|
|
1257
|
+
const { said: _said } = state, rest = _object_without_properties_loose(state, [
|
|
1258
|
+
"said"
|
|
1259
|
+
]);
|
|
1260
|
+
return _extends({}, rest, {
|
|
1232
1261
|
pages: state.pages.map((page)=>page.read ? _extends({}, page, {
|
|
1233
1262
|
read: _extends({}, page.read, {
|
|
1234
1263
|
text: '',
|
|
@@ -1326,7 +1355,13 @@ const readChars = (read)=>{
|
|
|
1326
1355
|
pages: state.pages.map((page)=>slots.has(page.slot) ? _extends({}, page, {
|
|
1327
1356
|
wording: aiSiteImportPageWording(page, choice)
|
|
1328
1357
|
}) : page)
|
|
1329
|
-
}
|
|
1358
|
+
}, generative ? {
|
|
1359
|
+
said: aiSiteImportSaid(state.said, [
|
|
1360
|
+
...state.pages
|
|
1361
|
+
].sort((a, b)=>Number(b.slug === '/') - Number(a.slug === '/')).flatMap((page)=>slots.has(page.slot) && page.read ? [
|
|
1362
|
+
page.read
|
|
1363
|
+
] : []))
|
|
1364
|
+
} : {});
|
|
1330
1365
|
}
|
|
1331
1366
|
/**
|
|
1332
1367
|
* The owner's change between waves (AGL-4152), as the resume door writes it
|
|
@@ -1353,7 +1388,7 @@ const readChars = (read)=>{
|
|
|
1353
1388
|
* How a page's generative Improve it came out (AGL-4152), what it added and what
|
|
1354
1389
|
* it shows, for its row; and the source's photos it left off, which a later
|
|
1355
1390
|
* page's slot takes before a stock photo.
|
|
1356
|
-
*/ export function aiSiteImportRedesignOf(state, slot, redesign, added, pictures) {
|
|
1391
|
+
*/ export function aiSiteImportRedesignOf(state, slot, redesign, added, pictures, missed) {
|
|
1357
1392
|
var _ref, _ref1, _next_sitePhotos;
|
|
1358
1393
|
var _state_pages_find_photos, _state_pages_find;
|
|
1359
1394
|
const next = withPage(state, slot, _extends({
|
|
@@ -1364,6 +1399,8 @@ const readChars = (read)=>{
|
|
|
1364
1399
|
]
|
|
1365
1400
|
} : {}, pictures ? {
|
|
1366
1401
|
pictures
|
|
1402
|
+
} : {}, (missed == null ? void 0 : missed.length) ? {
|
|
1403
|
+
redesignMissed: missed.slice(0, 8).map((code)=>code.slice(0, 40))
|
|
1367
1404
|
} : {}));
|
|
1368
1405
|
const left = new Set((_ref = pictures == null ? void 0 : pictures.unplaced) != null ? _ref : []);
|
|
1369
1406
|
if (!left.size) return next;
|
|
@@ -1579,12 +1616,14 @@ const readChars = (read)=>{
|
|
|
1579
1616
|
* arranged one, its design answer and its wording together, so each adds the
|
|
1580
1617
|
* difference between the two. Its ceiling, the page's two passes, does not
|
|
1581
1618
|
* move, and no price is new.
|
|
1582
|
-
*/ export function aiSiteImportWordingCredits(pages) {
|
|
1619
|
+
*/ export function aiSiteImportWordingCredits(pages, options = {}) {
|
|
1583
1620
|
const count = whole(pages);
|
|
1584
|
-
|
|
1621
|
+
// Under a generative Improve it (AGL-4152) new copy is a redesign from the ledger, measured on its own row.
|
|
1622
|
+
const { arranged } = AI_MEASURED_IMPORT_CREDITS;
|
|
1623
|
+
const worded = options.generative ? AI_MEASURED_IMPORT_CREDITS.redesigned : AI_MEASURED_IMPORT_CREDITS.reworded;
|
|
1585
1624
|
return {
|
|
1586
|
-
likely: count * (
|
|
1587
|
-
p90: count * (
|
|
1625
|
+
likely: count * (worded.median - arranged.median),
|
|
1626
|
+
p90: count * (worded.p90 - arranged.p90)
|
|
1588
1627
|
};
|
|
1589
1628
|
}
|
|
1590
1629
|
/*------------------------------------------
|
|
@@ -1611,7 +1650,9 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1611
1650
|
const proposed = whole(options.proposed);
|
|
1612
1651
|
const arranged = whole(options.arranged) + proposed;
|
|
1613
1652
|
const copied = whole(options.copied);
|
|
1614
|
-
const wording = aiSiteImportWordingCredits(Math.min(arranged, whole(options.reworded) + proposed)
|
|
1653
|
+
const wording = aiSiteImportWordingCredits(Math.min(arranged, whole(options.reworded) + proposed), options.generative ? {
|
|
1654
|
+
generative: true
|
|
1655
|
+
} : {});
|
|
1615
1656
|
const measured = AI_MEASURED_IMPORT_CREDITS;
|
|
1616
1657
|
const plan = options.plan ? AI_MEASURED_PAID_SITE_CREDITS.plan : {
|
|
1617
1658
|
median: 0,
|
|
@@ -1660,7 +1701,9 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1660
1701
|
used: state.existingPages
|
|
1661
1702
|
}) ? 1 : 0;
|
|
1662
1703
|
const pictures = choice.wording && aiSiteImportGeneratedPicturesOn(state) ? (counts.reworded + proposed) * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE : 0;
|
|
1663
|
-
return _extends({}, counts,
|
|
1704
|
+
return _extends({}, counts, {
|
|
1705
|
+
generative: true
|
|
1706
|
+
}, first && state.plan === undefined ? {
|
|
1664
1707
|
plan: true
|
|
1665
1708
|
} : {}, proposed ? {
|
|
1666
1709
|
proposed
|
|
@@ -1677,7 +1720,7 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1677
1720
|
}
|
|
1678
1721
|
/** A wave's quote: the pages it has still to bring in, and its header and footer while they are owed. */ export function aiSiteImportWaveCreditRange(state, wave, items) {
|
|
1679
1722
|
const owed = aiSiteImportWaveOwed(state, wave, items);
|
|
1680
|
-
return aiSiteImportCreditRange(owed.pages, {
|
|
1723
|
+
return aiSiteImportCreditRange(owed.pages, _extends({
|
|
1681
1724
|
frame: owed.frame,
|
|
1682
1725
|
arranged: owed.arranged,
|
|
1683
1726
|
reworded: owed.reworded,
|
|
@@ -1685,7 +1728,9 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1685
1728
|
plan: owed.plan,
|
|
1686
1729
|
proposed: owed.proposed,
|
|
1687
1730
|
pictures: owed.pictures
|
|
1688
|
-
}
|
|
1731
|
+
}, owed.generative ? {
|
|
1732
|
+
generative: true
|
|
1733
|
+
} : {}));
|
|
1689
1734
|
}
|
|
1690
1735
|
/** Every wave still waiting, quoted at once: "Start every remaining wave" (AGL-4083). */ export function aiSiteImportRemainingCreditRange(state, items) {
|
|
1691
1736
|
const total = {
|
|
@@ -1696,7 +1741,8 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1696
1741
|
frame: false,
|
|
1697
1742
|
plan: false,
|
|
1698
1743
|
proposed: 0,
|
|
1699
|
-
pictures: 0
|
|
1744
|
+
pictures: 0,
|
|
1745
|
+
generative: false
|
|
1700
1746
|
};
|
|
1701
1747
|
for (const wave of state.waves){
|
|
1702
1748
|
var _owed_proposed, _owed_pictures;
|
|
@@ -1710,8 +1756,9 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1710
1756
|
total.plan = total.plan || owed.plan === true;
|
|
1711
1757
|
total.proposed += (_owed_proposed = owed.proposed) != null ? _owed_proposed : 0;
|
|
1712
1758
|
total.pictures += (_owed_pictures = owed.pictures) != null ? _owed_pictures : 0;
|
|
1759
|
+
total.generative = total.generative || owed.generative === true;
|
|
1713
1760
|
}
|
|
1714
|
-
return aiSiteImportCreditRange(total.pages, {
|
|
1761
|
+
return aiSiteImportCreditRange(total.pages, _extends({
|
|
1715
1762
|
frame: total.frame,
|
|
1716
1763
|
arranged: total.arranged,
|
|
1717
1764
|
reworded: total.reworded,
|
|
@@ -1719,7 +1766,9 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1719
1766
|
plan: total.plan,
|
|
1720
1767
|
proposed: total.proposed,
|
|
1721
1768
|
pictures: total.pictures
|
|
1722
|
-
}
|
|
1769
|
+
}, total.generative ? {
|
|
1770
|
+
generative: true
|
|
1771
|
+
} : {}));
|
|
1723
1772
|
}
|
|
1724
1773
|
/**
|
|
1725
1774
|
* "About 95 credits (up to 600): 7 pages arranged by Aglyn AI, 3 copied as
|