@aglyn/plugins-ai 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/components/ai-site-import-job.component.js +2 -2
- package/src/lib/components/ai-site-import-job.component.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +35 -2
- package/src/lib/jobs/ai-job-import-step.js +124 -12
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-jobs.d.ts +6 -0
- package/src/lib/jobs/ai-jobs.js +43 -6
- package/src/lib/jobs/ai-jobs.js.map +1 -1
- package/src/lib/jobs/ai-layout-stock-photos.d.ts +13 -6
- package/src/lib/jobs/ai-layout-stock-photos.js +104 -32
- package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.js +110 -23
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +5 -0
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-forms.d.ts +83 -0
- package/src/lib/jobs/ai-site-import-forms.js +376 -0
- package/src/lib/jobs/ai-site-import-forms.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1101-recordings.d.ts +21 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1101-recordings.js +77 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1101-recordings.js.map +1 -0
- package/src/lib/layout-language/ai-layout-compiler.d.ts +2 -0
- package/src/lib/layout-language/ai-layout-compiler.js +215 -30
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +12 -0
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/model/ai-credit-estimate.d.ts +25 -22
- package/src/lib/model/ai-credit-estimate.js +24 -22
- 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 +41 -5
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-report.d.ts +60 -0
- package/src/lib/model/ai-site-import-report.js +116 -0
- package/src/lib/model/ai-site-import-report.js.map +1 -0
- package/src/lib/model/ai-site-import-view.d.ts +7 -1
- package/src/lib/model/ai-site-import-view.js +14 -2
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +49 -2
- package/src/lib/model/ai-site-import.js +81 -23
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +4 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +9 -4
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-css.d.ts +10 -1
- package/src/lib/site-import/site-import-css.js +19 -12
- package/src/lib/site-import/site-import-css.js.map +1 -1
- package/src/lib/site-import/site-import-html.d.ts +17 -4
- package/src/lib/site-import/site-import-html.js +146 -17
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.js +194 -32
- package/src/lib/site-import/site-import-layout.js.map +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* What the fidelity report says of a built site beside its scores (AGL-4109),
|
|
18
|
+
* pure so a spec reads it: the look the site wears and what its pages cost.
|
|
19
|
+
*
|
|
20
|
+
* The 11/1 report read `host.theme`, the base an import starts from, and said
|
|
21
|
+
* the site wore the starter's indigo while it rendered the source's blue. The
|
|
22
|
+
* look an import saves is `themeOverride` over that base, with `siteStyle`
|
|
23
|
+
* beside it (`aiSaveSiteTheme`). The credits line printed a mean, while the
|
|
24
|
+
* table a quote is made of (`AI_MEASURED_IMPORT_CREDITS`) is a median and a
|
|
25
|
+
* p90.
|
|
26
|
+
*/ import { readThemeOverride, resolveSiteTheme } from "@aglyn/aglyn/app-utils/site-theme";
|
|
27
|
+
const named = (value)=>typeof value === 'string' && value.trim() ? value : null;
|
|
28
|
+
/** The look a site wears: its base theme with what was saved over it, and which job saved it. */ export function siteImportLookReport(host, state) {
|
|
29
|
+
var _resolveSiteTheme, _ref, _host_siteStyle, _theme_fonts;
|
|
30
|
+
var _theme_colorSchemes, _state_look, _light_primary, _light_secondary, _light_tertiary;
|
|
31
|
+
const theme = (_resolveSiteTheme = resolveSiteTheme(host)) != null ? _resolveSiteTheme : {};
|
|
32
|
+
const light = (_ref = (_theme_colorSchemes = theme['colorSchemes']) == null ? void 0 : _theme_colorSchemes['light']) != null ? _ref : {};
|
|
33
|
+
const style = (_host_siteStyle = host['siteStyle']) != null ? _host_siteStyle : null;
|
|
34
|
+
return {
|
|
35
|
+
base: named(style == null ? void 0 : style['base']),
|
|
36
|
+
override: !!readThemeOverride(host),
|
|
37
|
+
jobId: named(style == null ? void 0 : style['jobId']),
|
|
38
|
+
brand: named(style == null ? void 0 : style['brand']),
|
|
39
|
+
pass: named(state == null ? void 0 : (_state_look = state['look']) == null ? void 0 : _state_look['theme']),
|
|
40
|
+
primary: named((_light_primary = light['primary']) == null ? void 0 : _light_primary['main']),
|
|
41
|
+
secondary: named((_light_secondary = light['secondary']) == null ? void 0 : _light_secondary['main']),
|
|
42
|
+
tertiary: named((_light_tertiary = light['tertiary']) == null ? void 0 : _light_tertiary['main']),
|
|
43
|
+
fonts: ((_theme_fonts = theme['fonts']) != null ? _theme_fonts : []).map((font)=>{
|
|
44
|
+
var _font_family;
|
|
45
|
+
return String((_font_family = font['family']) != null ? _font_family : '');
|
|
46
|
+
}).filter(Boolean)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** The look line of the report: what the site wears, and whether it is this job's. */ export function siteImportLookLine(host, state, jobId) {
|
|
50
|
+
var _look_base, _look_base1, _look_pass;
|
|
51
|
+
const look = siteImportLookReport(host, state);
|
|
52
|
+
const colors = [
|
|
53
|
+
'primary',
|
|
54
|
+
'secondary',
|
|
55
|
+
'tertiary'
|
|
56
|
+
].map((key)=>{
|
|
57
|
+
var _look_key;
|
|
58
|
+
return `${key} ${(_look_key = look[key]) != null ? _look_key : 'not set'}`;
|
|
59
|
+
}).join(', ');
|
|
60
|
+
const brand = look.brand ? `, drawn from ${look.brand}` : '';
|
|
61
|
+
const fonts = look.fonts.join(', ') || 'not set';
|
|
62
|
+
const wearing = look.override ? `an override over the ${(_look_base = look.base) != null ? _look_base : 'site'} base` : `the ${(_look_base1 = look.base) != null ? _look_base1 : 'site'} base, no override`;
|
|
63
|
+
const whose = look.jobId ? look.jobId === jobId ? 'saved by this job' : `saved by job ${look.jobId}, not this one` : 'saved by no job';
|
|
64
|
+
return `${(_look_pass = look.pass) != null ? _look_pass : 'not run'}; ${colors}${brand}; ${fonts}; ${wearing}; ${whose}`;
|
|
65
|
+
}
|
|
66
|
+
/** The middle value of what is sorted: the two middle ones' mean, for an even count. */ function median(sorted) {
|
|
67
|
+
const middle = Math.floor(sorted.length / 2);
|
|
68
|
+
return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* What each kind of page cost by the ledger, as the table a quote is read
|
|
72
|
+
* from is measured: over the items that came through and gave nothing back,
|
|
73
|
+
* grouped by how their page was built. The p90 is the nearest rank.
|
|
74
|
+
*/ export function siteImportCreditsMeasured(state, items) {
|
|
75
|
+
const buildOf = new Map(state.pages.map((page)=>{
|
|
76
|
+
var _page_build;
|
|
77
|
+
return [
|
|
78
|
+
page.slot,
|
|
79
|
+
(_page_build = page.build) != null ? _page_build : null
|
|
80
|
+
];
|
|
81
|
+
}));
|
|
82
|
+
const out = {};
|
|
83
|
+
for (const build of [
|
|
84
|
+
'arranged',
|
|
85
|
+
'copied'
|
|
86
|
+
]){
|
|
87
|
+
const each = items.filter((item)=>buildOf.get(item.slot) === build && item.status === 'succeeded' && !(Number(item.creditsRefunded) > 0)).map((item)=>{
|
|
88
|
+
var _item_creditsSpent;
|
|
89
|
+
return Number((_item_creditsSpent = item.creditsSpent) != null ? _item_creditsSpent : 0);
|
|
90
|
+
}).sort((a, b)=>a - b);
|
|
91
|
+
if (!each.length) continue;
|
|
92
|
+
const total = each.reduce((sum, value)=>sum + value, 0);
|
|
93
|
+
out[build] = {
|
|
94
|
+
count: each.length,
|
|
95
|
+
median: median(each),
|
|
96
|
+
p90: each[Math.ceil(each.length * 0.9) - 1],
|
|
97
|
+
mean: total / each.length
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
const credits = (value)=>Number.isInteger(value) ? String(value) : value.toFixed(1);
|
|
103
|
+
/** The credits line of the report: each kind of page's count, median, p90 and mean. */ export function siteImportCreditsLine(measured) {
|
|
104
|
+
const parts = [
|
|
105
|
+
'arranged',
|
|
106
|
+
'copied'
|
|
107
|
+
].flatMap((build)=>{
|
|
108
|
+
const row = measured[build];
|
|
109
|
+
return row ? [
|
|
110
|
+
`${row.count} ${build}, median ${credits(row.median)}, p90 ${credits(row.p90)}, mean ${credits(row.mean)}`
|
|
111
|
+
] : [];
|
|
112
|
+
});
|
|
113
|
+
return parts.length ? parts.join('; ') : 'no page in yet';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=ai-site-import-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-report.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 * What the fidelity report says of a built site beside its scores (AGL-4109),\n * pure so a spec reads it: the look the site wears and what its pages cost.\n *\n * The 11/1 report read `host.theme`, the base an import starts from, and said\n * the site wore the starter's indigo while it rendered the source's blue. The\n * look an import saves is `themeOverride` over that base, with `siteStyle`\n * beside it (`aiSaveSiteTheme`). The credits line printed a mean, while the\n * table a quote is made of (`AI_MEASURED_IMPORT_CREDITS`) is a median and a\n * p90.\n */\n\nimport { readThemeOverride, resolveSiteTheme } from '@aglyn/aglyn/app-utils/site-theme'\nimport type { AiJobItemLedger } from './ai-jobs.types'\n\ntype Dict = Record<string, any>\n\n/** The look line's facts, as a site stores them and an import ran them. */\nexport interface SiteImportLookReport {\n /** The base theme the site was given: `siteStyle.base`, or `null` where it holds no style. */\n base: string | null\n /** Whether a look is saved over the base. */\n override: boolean\n /** The job whose look the site wears: `siteStyle.jobId`. */\n jobId: string | null\n /** The source's brand color the look was drawn from: `siteStyle.brand`. */\n brand: string | null\n /** What the import's look pass came to: `look.theme`. */\n pass: string | null\n primary: string | null\n secondary: string | null\n tertiary: string | null\n fonts: string[]\n}\n\nconst named = (value: unknown): string | null => (typeof value === 'string' && value.trim() ? value : null)\n\n/** The look a site wears: its base theme with what was saved over it, and which job saved it. */\nexport function siteImportLookReport(host: Dict, state: Dict | null | undefined): SiteImportLookReport {\n const theme = (resolveSiteTheme(host) ?? {}) as Dict\n const light = (theme['colorSchemes']?.['light'] ?? {}) as Dict\n const style = (host['siteStyle'] ?? null) as Dict | null\n return {\n base: named(style?.['base']),\n override: !!readThemeOverride(host),\n jobId: named(style?.['jobId']),\n brand: named(style?.['brand']),\n pass: named(state?.['look']?.['theme']),\n primary: named(light['primary']?.['main']),\n secondary: named(light['secondary']?.['main']),\n tertiary: named(light['tertiary']?.['main']),\n fonts: ((theme['fonts'] ?? []) as Dict[]).map((font) => String(font['family'] ?? '')).filter(Boolean),\n }\n}\n\n/** The look line of the report: what the site wears, and whether it is this job's. */\nexport function siteImportLookLine(host: Dict, state: Dict | null | undefined, jobId: string): string {\n const look = siteImportLookReport(host, state)\n const colors = (['primary', 'secondary', 'tertiary'] as const).map((key) => `${key} ${look[key] ?? 'not set'}`).join(', ')\n const brand = look.brand ? `, drawn from ${look.brand}` : ''\n const fonts = look.fonts.join(', ') || 'not set'\n const wearing = look.override ? `an override over the ${look.base ?? 'site'} base` : `the ${look.base ?? 'site'} base, no override`\n const whose = look.jobId ? (look.jobId === jobId ? 'saved by this job' : `saved by job ${look.jobId}, not this one`) : 'saved by no job'\n return `${look.pass ?? 'not run'}; ${colors}${brand}; ${fonts}; ${wearing}; ${whose}`\n}\n\n/** One kind of page's cost, as `AI_MEASURED_IMPORT_CREDITS` holds it. */\nexport interface SiteImportCreditsMeasured {\n count: number\n median: number\n p90: number\n mean: number\n}\n\n/** The middle value of what is sorted: the two middle ones' mean, for an even count. */\nfunction median(sorted: readonly number[]): number {\n const middle = Math.floor(sorted.length / 2)\n return sorted.length % 2 ? (sorted[middle] as number) : ((sorted[middle - 1] as number) + (sorted[middle] as number)) / 2\n}\n\n/**\n * What each kind of page cost by the ledger, as the table a quote is read\n * from is measured: over the items that came through and gave nothing back,\n * grouped by how their page was built. The p90 is the nearest rank.\n */\nexport function siteImportCreditsMeasured(\n state: { pages: ReadonlyArray<{ slot: string; build?: string | null }> },\n items: ReadonlyArray<Pick<AiJobItemLedger, 'slot' | 'status' | 'creditsSpent' | 'creditsRefunded'>>,\n): Partial<Record<'arranged' | 'copied', SiteImportCreditsMeasured>> {\n const buildOf = new Map(state.pages.map((page) => [page.slot, page.build ?? null]))\n const out: Partial<Record<'arranged' | 'copied', SiteImportCreditsMeasured>> = {}\n for (const build of ['arranged', 'copied'] as const) {\n const each = items\n .filter((item) => buildOf.get(item.slot) === build && item.status === 'succeeded' && !(Number(item.creditsRefunded) > 0))\n .map((item) => Number(item.creditsSpent ?? 0))\n .sort((a, b) => a - b)\n if (!each.length) continue\n const total = each.reduce((sum, value) => sum + value, 0)\n out[build] = { count: each.length, median: median(each), p90: each[Math.ceil(each.length * 0.9) - 1] as number, mean: total / each.length }\n }\n return out\n}\n\nconst credits = (value: number) => (Number.isInteger(value) ? String(value) : value.toFixed(1))\n\n/** The credits line of the report: each kind of page's count, median, p90 and mean. */\nexport function siteImportCreditsLine(measured: ReturnType<typeof siteImportCreditsMeasured>): string {\n const parts = (['arranged', 'copied'] as const).flatMap((build) => {\n const row = measured[build]\n return row ? [`${row.count} ${build}, median ${credits(row.median)}, p90 ${credits(row.p90)}, mean ${credits(row.mean)}`] : []\n })\n return parts.length ? parts.join('; ') : 'no page in yet'\n}\n"],"names":["readThemeOverride","resolveSiteTheme","named","value","trim","siteImportLookReport","host","state","theme","light","style","base","override","jobId","brand","pass","primary","secondary","tertiary","fonts","map","font","String","filter","Boolean","siteImportLookLine","look","colors","key","join","wearing","whose","median","sorted","middle","Math","floor","length","siteImportCreditsMeasured","items","buildOf","Map","pages","page","slot","build","out","each","item","get","status","Number","creditsRefunded","creditsSpent","sort","a","b","total","reduce","sum","count","p90","ceil","mean","credits","isInteger","toFixed","siteImportCreditsLine","measured","parts","flatMap","row"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GAED,SAASA,iBAA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AAE,MAAM,EAAEgC,QAAQO,IAAIV,GAAG,EAAE,OAAO,EAAEG,QAAQO,IAAIR,IAAI,GAAG;SAAC,GAAG,EAAE;IAChI;IACA,OAAOM,MAAMhC,MAAM,GAAGgC,MAAMxC,IAAI,CAAC,QAAQ;AAC3C"}
|
|
@@ -95,6 +95,12 @@ export declare function aiSiteImportHeldCopy(job: Pick<AiJobSummary, 'review' |
|
|
|
95
95
|
message: string;
|
|
96
96
|
action: string;
|
|
97
97
|
} | null;
|
|
98
|
+
/**
|
|
99
|
+
* Why an import that had started is waiting with no wave to review (AGL-4083):
|
|
100
|
+
* the sentence its stop left, which says what is not in yet and what to start.
|
|
101
|
+
* `null` for one that has not started, and one waiting for its review.
|
|
102
|
+
*/
|
|
103
|
+
export declare function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null;
|
|
98
104
|
export type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped';
|
|
99
105
|
export interface AiSiteImportRowView {
|
|
100
106
|
slot: string;
|
|
@@ -158,7 +164,7 @@ export declare function aiSiteImportLeftOutLines(state: AiSiteImportState): Arra
|
|
|
158
164
|
paths: string[];
|
|
159
165
|
}>;
|
|
160
166
|
/** The wave a page offers to start next, and its button's words. */
|
|
161
|
-
export declare function aiSiteImportStartAction(job: Pick<AiJobSummary, 'siteImport' | 'items'>): {
|
|
167
|
+
export declare function aiSiteImportStartAction(job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>): {
|
|
162
168
|
wave: AiSiteImportWave;
|
|
163
169
|
label: string;
|
|
164
170
|
quote: string;
|
|
@@ -84,6 +84,17 @@ export function aiSiteImportPhaseOf(job) {
|
|
|
84
84
|
action: 'Check again'
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Why an import that had started is waiting with no wave to review (AGL-4083):
|
|
89
|
+
* the sentence its stop left, which says what is not in yet and what to start.
|
|
90
|
+
* `null` for one that has not started, and one waiting for its review.
|
|
91
|
+
*/ export function aiSiteImportStoppedCopy(job) {
|
|
92
|
+
var _job_siteImport;
|
|
93
|
+
var _job_review;
|
|
94
|
+
const state = (_job_siteImport = job.siteImport) != null ? _job_siteImport : null;
|
|
95
|
+
if (aiSiteImportPhaseOf(job) !== 'ready' || !(state == null ? void 0 : state.waves.some((wave)=>wave.startedAt))) return null;
|
|
96
|
+
return ((_job_review = job.review) == null ? void 0 : _job_review.message) || null;
|
|
97
|
+
}
|
|
87
98
|
function rowState(row, active) {
|
|
88
99
|
if (!row) return 'waiting';
|
|
89
100
|
if (row.status === 'succeeded' || row.status === 'degraded') return 'done';
|
|
@@ -255,9 +266,10 @@ const BUILD_COPY = {
|
|
|
255
266
|
}).filter((line)=>line.count > 0).sort((a, b)=>b.count - a.count);
|
|
256
267
|
}
|
|
257
268
|
/** The wave a page offers to start next, and its button's words. */ export function aiSiteImportStartAction(job) {
|
|
258
|
-
var _job_siteImport;
|
|
269
|
+
var _job_siteImport, _ref;
|
|
259
270
|
const state = (_job_siteImport = job.siteImport) != null ? _job_siteImport : null;
|
|
260
|
-
|
|
271
|
+
// An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).
|
|
272
|
+
const wave = (_ref = job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) != null ? _ref : aiSiteImportNextWave(state);
|
|
261
273
|
if (!state || !wave) return null;
|
|
262
274
|
return {
|
|
263
275
|
wave,
|
|
@@ -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 type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveOwed,\n type AiSiteImportLeftOutReason,\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\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 /** \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen. */\n build: string | null\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 = { copied: 'Copied as it is', arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI` } as const\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 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 photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n words: page.brought ? `${page.brought.words.toLocaleString('en-US')} of ${page.words.toLocaleString('en-US')} words` : null,\n build: page.build ? BUILD_COPY[page.build] : null,\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))\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'>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n const wave = 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"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveCreditRange","aiSiteImportWaveOwed","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","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","aiSiteImportWaveRows","wave","items","Map","map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","build","slots","page","pages","find","entry","path","slug","refused","url","toLocaleString","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","length","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","waves","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB;AAExD,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,oBAAoB,EACpBC,qBAAqB,EACrBC,qBAAqB,EACrBC,qBAAqB,EACrBC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,gCAAgC,EAChCC,sBAAsB,EACtBC,uBAAuB,EACvBC,2BAA2B,EAC3BC,oBAAoB,QAIf,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,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A,kEAAkE,GAClE,OAAO,SAASQ,wBACd3G,GAA+C;QAEjCA;IAAd,MAAML,SAAQK,kBAAAA,IAAIC,UAAU,YAAdD,kBAAkB;IAChC,MAAMgC,OAAOpD,qBAAqBe;IAClC,IAAI,CAACA,SAAS,CAACqC,MAAM,OAAO;IAC5B,OAAO;QAAEA;QAAM6C,OAAO,CAAC,MAAM,EAAE7C,KAAK6C,KAAK,EAAE;QAAE+B,OAAO7C,sBAAsB/D,KAAKgC;IAAM;AACvF;AAEA;;;CAGC,GACD,OAAO,SAAS6E,2BACd7G,GAA+C;QAEjCA,iBAMqDA;IANnE,MAAML,SAAQK,kBAAAA,IAAIC,UAAU,YAAdD,kBAAkB;IAChC,IAAI,CAACL,SAAS,CAACf,qBAAqBe,QAAQ,OAAO;IACnD,MAAMkG,QAAQlG,MAAMkG,KAAK,CAACtE,MAAM,CAAC,CAACS,OAASA,KAAK5B,MAAM,KAAK,WAAW2E,MAAM;IAC5E,IAAIc,QAAQ,GAAG,OAAO;IACtB,OAAO;QACLhB,OAAO;QACP+B,OAAOrI,kBAAkBW,iCAAiCS,QAAOK,aAAAA,IAAIiC,KAAK,YAATjC,aAAa;QAC9E6F;IACF;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 type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveOwed,\n type AiSiteImportLeftOutReason,\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 /** \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen. */\n build: string | null\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 = { copied: 'Copied as it is', arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI` } as const\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 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 photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n words: page.brought ? `${page.brought.words.toLocaleString('en-US')} of ${page.words.toLocaleString('en-US')} words` : null,\n build: page.build ? BUILD_COPY[page.build] : null,\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))\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"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveCreditRange","aiSiteImportWaveOwed","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","aiSiteImportWaveRows","items","Map","map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","build","slots","page","pages","find","entry","path","slug","refused","url","toLocaleString","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","length","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"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB;AAExD,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,oBAAoB,EACpBC,qBAAqB,EACrBC,qBAAqB,EACrBC,qBAAqB,EACrBC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,gCAAgC,EAChCC,sBAAsB,EAC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,GAAG,OAAO;IACtB,OAAO;QACLqE,OAAO;QACP8B,OAAOxI,kBAAkBW,iCAAiCS,QAAOK,aAAAA,IAAIqC,KAAK,YAATrC,aAAa;QAC9EY;IACF;AACF"}
|
|
@@ -204,8 +204,17 @@ export interface SiteImportLayoutItem {
|
|
|
204
204
|
text?: SiteImportLineRef[];
|
|
205
205
|
/** Its bullet points (a plan's features). */
|
|
206
206
|
list?: SiteImportLineRef[];
|
|
207
|
-
/** Its own call to action: a "See … →" link or a button, last in the item. */
|
|
207
|
+
/** Its own call to action: a "See … →" link or a button, last in the item, or a button wherever it sits. */
|
|
208
208
|
link?: SiteImportLineRef[];
|
|
209
|
+
/** Those of `link` the source draws as buttons, each as it draws it (AGL-4083). */
|
|
210
|
+
ctas?: Array<{
|
|
211
|
+
line: SiteImportLineRef;
|
|
212
|
+
style: SiteImportButtonStyle;
|
|
213
|
+
}>;
|
|
214
|
+
/** A tag on it, a short line in a filled pill: "Popular", "New", "Best value" (AGL-4083). */
|
|
215
|
+
badge?: SiteImportLineRef;
|
|
216
|
+
/** What its price is for, beside the price: "/mo" (AGL-4083). */
|
|
217
|
+
period?: SiteImportLineRef;
|
|
209
218
|
image?: SiteImportLineRef;
|
|
210
219
|
/** The icon that leads it, by index into `SiteImportLayout.icons`. */
|
|
211
220
|
icon?: number;
|
|
@@ -221,6 +230,11 @@ export interface SiteImportLayoutGroup {
|
|
|
221
230
|
columns: number;
|
|
222
231
|
/** Each item is drawn as a box (a border, a shadow or a fill of its own). */
|
|
223
232
|
boxed: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Each item is a row of its own, its parts side by side, one under another:
|
|
235
|
+
* a plan's name, words and button, or a label and its value (AGL-4083).
|
|
236
|
+
*/
|
|
237
|
+
inline?: true;
|
|
224
238
|
items: SiteImportLayoutItem[];
|
|
225
239
|
}
|
|
226
240
|
/** A table: rows of cells, each cell its lines (objects, not nested arrays, for Firestore). */
|
|
@@ -262,6 +276,12 @@ export interface SiteImportLayoutSection {
|
|
|
262
276
|
url: string;
|
|
263
277
|
};
|
|
264
278
|
align: 'start' | 'center';
|
|
279
|
+
/**
|
|
280
|
+
* How wide the source lets the section's content run on a wide screen, in
|
|
281
|
+
* px (AGL-4083): the narrowest cap on it and the wrappers around its
|
|
282
|
+
* content. Absent where the source sets none.
|
|
283
|
+
*/
|
|
284
|
+
width?: number;
|
|
265
285
|
/** Set on the section holding the page's first `<h1>`. */
|
|
266
286
|
hero?: {
|
|
267
287
|
picture: SiteImportHeroPicture | null;
|
|
@@ -270,6 +290,14 @@ export interface SiteImportLayoutSection {
|
|
|
270
290
|
/** Every line of the section, in order. */
|
|
271
291
|
lines: SiteImportLineRef[];
|
|
272
292
|
}
|
|
293
|
+
/** The widths a page's column is drawn at: the Container element's Max Width choices. */
|
|
294
|
+
export type SiteImportWidth = 'sm' | 'md' | 'lg' | 'xl';
|
|
295
|
+
/**
|
|
296
|
+
* The Max Width a source's cap in px reads as (AGL-4083), `null` for a source
|
|
297
|
+
* that sets none. `sm` is 600 and `md` 900: a post's 760 column is `md`, as a
|
|
298
|
+
* column held to 600 would read narrower than its source.
|
|
299
|
+
*/
|
|
300
|
+
export declare function siteImportWidthOf(px: number | null | undefined): SiteImportWidth | null;
|
|
273
301
|
/** An icon the page draws, once however often it repeats. */
|
|
274
302
|
export interface SiteImportIconShape {
|
|
275
303
|
viewBox: string;
|
|
@@ -460,6 +488,13 @@ export interface AiSiteImportPage {
|
|
|
460
488
|
skipped: number;
|
|
461
489
|
assets: AiSiteImportPhoto[];
|
|
462
490
|
} | null;
|
|
491
|
+
/** Each form of the read, by its index, and the saved form that takes its place, `null` where none does (AGL-4083). */
|
|
492
|
+
forms?: Array<{
|
|
493
|
+
index: number;
|
|
494
|
+
formId: string | null;
|
|
495
|
+
}> | null;
|
|
496
|
+
/** What the page's row says of its forms. */
|
|
497
|
+
formNote?: string | null;
|
|
463
498
|
}
|
|
464
499
|
/**
|
|
465
500
|
* A wave's place in its import: waiting to start, running, in and waiting for
|
|
@@ -732,6 +767,12 @@ export type AiSiteImportWork = {
|
|
|
732
767
|
kind: 'images';
|
|
733
768
|
wave: AiSiteImportWave;
|
|
734
769
|
page: AiSiteImportPage;
|
|
770
|
+
}
|
|
771
|
+
/** A page's forms, rebuilt as the site's own before the page places them (AGL-4083). */
|
|
772
|
+
| {
|
|
773
|
+
kind: 'forms';
|
|
774
|
+
wave: AiSiteImportWave;
|
|
775
|
+
page: AiSiteImportPage;
|
|
735
776
|
} | {
|
|
736
777
|
kind: 'page';
|
|
737
778
|
wave: AiSiteImportWave;
|
|
@@ -770,7 +811,13 @@ export declare function aiSiteImportCapBlocks(blocks: readonly SiteImportBlock[]
|
|
|
770
811
|
export declare function aiSiteImportPagesRead(state: AiSiteImportState, reads: ReadonlyMap<string, AiSiteImportPageRead | AiSiteImportLeftOutReason>): AiSiteImportState;
|
|
771
812
|
/** A page's photos are in the library. */
|
|
772
813
|
export declare function aiSiteImportPhotosIn(state: AiSiteImportState, slot: string, photos: NonNullable<AiSiteImportPage['photos']>): AiSiteImportState;
|
|
773
|
-
/** A page
|
|
814
|
+
/** A page's forms are the site's own (AGL-4083). */
|
|
815
|
+
export declare function aiSiteImportFormsIn(state: AiSiteImportState, slot: string, forms: NonNullable<AiSiteImportPage['forms']>, note: string | null): AiSiteImportState;
|
|
816
|
+
/**
|
|
817
|
+
* A page is in: nothing of its read is kept but what its row shows (AGL-4083).
|
|
818
|
+
* Every page rides one job document, and on 11/1 what 344 settled pages still
|
|
819
|
+
* held left a 400-page import too little room for the next wave's read.
|
|
820
|
+
*/
|
|
774
821
|
export declare function aiSiteImportPageSettled(state: AiSiteImportState, slot: string): AiSiteImportState;
|
|
775
822
|
/** A wave is in: waiting for its review, or done when no wave follows it. */
|
|
776
823
|
export declare function aiSiteImportWaveClosed(state: AiSiteImportState, index: number, at: string): AiSiteImportState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
2
3
|
/**
|
|
3
4
|
* @license
|
|
4
5
|
* Copyright 2026 Aglyn LLC
|
|
@@ -123,6 +124,17 @@ export const SITE_IMPORT_GROUP_KINDS = [
|
|
|
123
124
|
'list',
|
|
124
125
|
'text'
|
|
125
126
|
];
|
|
127
|
+
/**
|
|
128
|
+
* The Max Width a source's cap in px reads as (AGL-4083), `null` for a source
|
|
129
|
+
* that sets none. `sm` is 600 and `md` 900: a post's 760 column is `md`, as a
|
|
130
|
+
* column held to 600 would read narrower than its source.
|
|
131
|
+
*/ export function siteImportWidthOf(px) {
|
|
132
|
+
if (typeof px !== 'number' || !Number.isFinite(px) || px <= 0) return null;
|
|
133
|
+
if (px >= 1400) return 'xl';
|
|
134
|
+
if (px >= 1100) return 'lg';
|
|
135
|
+
if (px >= 750) return 'md';
|
|
136
|
+
return 'sm';
|
|
137
|
+
}
|
|
126
138
|
/** Every line a layout's nodes place, in order. */ export function siteImportLayoutLines(nodes) {
|
|
127
139
|
const out = [];
|
|
128
140
|
const visit = (list)=>{
|
|
@@ -236,13 +248,16 @@ export const SITE_IMPORT_GROUP_KINDS = [
|
|
|
236
248
|
return nodes(list);
|
|
237
249
|
}
|
|
238
250
|
function trimItem(item, keep) {
|
|
251
|
+
var _out_ctas;
|
|
239
252
|
const out = _extends({}, item, {
|
|
240
253
|
lines: item.lines.filter(keep)
|
|
241
254
|
});
|
|
242
255
|
for (const key of [
|
|
243
256
|
'title',
|
|
244
257
|
'figure',
|
|
245
|
-
'image'
|
|
258
|
+
'image',
|
|
259
|
+
'badge',
|
|
260
|
+
'period'
|
|
246
261
|
])if (out[key] !== undefined && !keep(out[key])) delete out[key];
|
|
247
262
|
for (const key of [
|
|
248
263
|
'text',
|
|
@@ -254,6 +269,9 @@ function trimItem(item, keep) {
|
|
|
254
269
|
if (list == null ? void 0 : list.length) out[key] = list;
|
|
255
270
|
else delete out[key];
|
|
256
271
|
}
|
|
272
|
+
const ctas = (_out_ctas = out.ctas) == null ? void 0 : _out_ctas.filter((cta)=>keep(cta.line));
|
|
273
|
+
if (ctas == null ? void 0 : ctas.length) out.ctas = ctas;
|
|
274
|
+
else delete out.ctas;
|
|
257
275
|
return out;
|
|
258
276
|
}
|
|
259
277
|
/** A layout with its icons' drawings dropped, for a page that must be lighter. */ export function siteImportLayoutWithoutDrawings(layout) {
|
|
@@ -736,6 +754,20 @@ const OPEN = new Set([
|
|
|
736
754
|
var _ref;
|
|
737
755
|
return (_ref = state == null ? void 0 : state.waves.find((wave)=>wave.status === 'review')) != null ? _ref : null;
|
|
738
756
|
}
|
|
757
|
+
/** Whether a page's read holds a form that asks something, where its layout placed one. */ function pageHoldsForm(page) {
|
|
758
|
+
var _read_forms;
|
|
759
|
+
const { read } = page;
|
|
760
|
+
if (!(read == null ? void 0 : read.layout) || !((_read_forms = read.forms) == null ? void 0 : _read_forms.some((form)=>form.fields.length))) return false;
|
|
761
|
+
const holds = (nodes)=>nodes.some((node)=>{
|
|
762
|
+
var _ref;
|
|
763
|
+
var _read_forms_node_form, _read_forms;
|
|
764
|
+
if (node.kind === 'form') return ((_ref = (_read_forms = read.forms) == null ? void 0 : (_read_forms_node_form = _read_forms[node.form]) == null ? void 0 : _read_forms_node_form.fields.length) != null ? _ref : 0) > 0;
|
|
765
|
+
if (node.kind === 'row') return node.cells.some((cell)=>holds(cell.nodes));
|
|
766
|
+
if (node.kind === 'tabs') return node.tabs.some((tab)=>holds(tab.panel));
|
|
767
|
+
return false;
|
|
768
|
+
});
|
|
769
|
+
return read.layout.sections.some((section)=>holds(section.nodes));
|
|
770
|
+
}
|
|
739
771
|
/** What the next pass of the step does. */ export function aiSiteImportNextWork(state, items) {
|
|
740
772
|
// A read that stopped at its home page reads again: the person's Check again.
|
|
741
773
|
if (!state || aiSiteImportReadStops(state.verdict)) return {
|
|
@@ -751,9 +783,13 @@ const OPEN = new Set([
|
|
|
751
783
|
kind: 'done'
|
|
752
784
|
};
|
|
753
785
|
}
|
|
754
|
-
|
|
755
|
-
const unread =
|
|
756
|
-
|
|
786
|
+
const open = running.slots.filter((slot)=>aiSiteImportItemOpen(items, slot)).map((slot)=>state.pages.find((page)=>page.slot === slot)).filter((page)=>!!page);
|
|
787
|
+
const unread = open.filter((page)=>!page.read && !page.refused);
|
|
788
|
+
const reached = open.filter((page)=>!unread.includes(page));
|
|
789
|
+
// Nothing in hand: the wave's read goes on first. Pages in hand are built
|
|
790
|
+
// first (AGL-4083): a read that stopped short, or that left pages out to keep
|
|
791
|
+
// the job within what one document holds, goes on once their words are gone.
|
|
792
|
+
if (unread.length && !reached.length) return {
|
|
757
793
|
kind: 'read',
|
|
758
794
|
wave: running,
|
|
759
795
|
pages: unread
|
|
@@ -764,24 +800,25 @@ const OPEN = new Set([
|
|
|
764
800
|
wave: running
|
|
765
801
|
};
|
|
766
802
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
const page = state.pages.find((entry)=>entry.slot === slot);
|
|
770
|
-
if (!page) continue;
|
|
771
|
-
return page.photos ? {
|
|
772
|
-
kind: 'page',
|
|
773
|
-
wave: running,
|
|
774
|
-
page
|
|
775
|
-
} : {
|
|
776
|
-
kind: 'images',
|
|
777
|
-
wave: running,
|
|
778
|
-
page
|
|
779
|
-
};
|
|
780
|
-
}
|
|
781
|
-
return {
|
|
803
|
+
const page = reached[0];
|
|
804
|
+
if (!page) return {
|
|
782
805
|
kind: 'close-wave',
|
|
783
806
|
wave: running
|
|
784
807
|
};
|
|
808
|
+
if (!page.photos) return {
|
|
809
|
+
kind: 'images',
|
|
810
|
+
wave: running,
|
|
811
|
+
page
|
|
812
|
+
};
|
|
813
|
+
return !page.forms && pageHoldsForm(page) ? {
|
|
814
|
+
kind: 'forms',
|
|
815
|
+
wave: running,
|
|
816
|
+
page
|
|
817
|
+
} : {
|
|
818
|
+
kind: 'page',
|
|
819
|
+
wave: running,
|
|
820
|
+
page
|
|
821
|
+
};
|
|
785
822
|
}
|
|
786
823
|
/*------------------------------------------
|
|
787
824
|
* The state, one pass at a time
|
|
@@ -891,16 +928,37 @@ const readChars = (read)=>{
|
|
|
891
928
|
photos
|
|
892
929
|
});
|
|
893
930
|
}
|
|
894
|
-
/** A page
|
|
931
|
+
/** A page's forms are the site's own (AGL-4083). */ export function aiSiteImportFormsIn(state, slot, forms, note) {
|
|
932
|
+
return withPage(state, slot, _extends({
|
|
933
|
+
forms
|
|
934
|
+
}, note ? {
|
|
935
|
+
formNote: note
|
|
936
|
+
} : {}));
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* A page is in: nothing of its read is kept but what its row shows (AGL-4083).
|
|
940
|
+
* Every page rides one job document, and on 11/1 what 344 settled pages still
|
|
941
|
+
* held left a 400-page import too little room for the next wave's read.
|
|
942
|
+
*/ export function aiSiteImportPageSettled(state, slot) {
|
|
895
943
|
const page = state.pages.find((entry)=>entry.slot === slot);
|
|
896
944
|
if (!(page == null ? void 0 : page.read)) return state;
|
|
897
|
-
|
|
898
|
-
|
|
945
|
+
const _page_read = page.read, { meta: _meta } = _page_read, read = _object_without_properties_loose(_page_read, [
|
|
946
|
+
"meta"
|
|
947
|
+
]);
|
|
948
|
+
return withPage(state, slot, _extends({
|
|
949
|
+
read: _extends({}, read, {
|
|
899
950
|
text: '',
|
|
951
|
+
sections: [],
|
|
952
|
+
images: [],
|
|
900
953
|
blocks: [],
|
|
954
|
+
forms: [],
|
|
901
955
|
layout: null
|
|
902
956
|
})
|
|
903
|
-
}
|
|
957
|
+
}, page.photos ? {
|
|
958
|
+
photos: _extends({}, page.photos, {
|
|
959
|
+
assets: []
|
|
960
|
+
})
|
|
961
|
+
} : {}));
|
|
904
962
|
}
|
|
905
963
|
/** A wave is in: waiting for its review, or done when no wave follows it. */ export function aiSiteImportWaveClosed(state, index, at) {
|
|
906
964
|
var _ref;
|