@aglyn/plugins-ai 1.6.0 → 1.8.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/README.md +2 -2
- package/package.json +17 -17
- package/src/lib/components/ai-insight-dialog.component.js +14 -0
- package/src/lib/components/ai-insight-dialog.component.js.map +1 -1
- package/src/lib/insights/ai-figure-readers.d.ts +13 -0
- package/src/lib/insights/ai-figure-readers.js +158 -11
- package/src/lib/insights/ai-figure-readers.js.map +1 -1
- package/src/lib/insights/ai-figure-summaries.js +4 -2
- package/src/lib/insights/ai-figure-summaries.js.map +1 -1
- package/src/lib/insights/ai-insight-digest.d.ts +27 -17
- package/src/lib/insights/ai-insight-digest.js +96 -107
- package/src/lib/insights/ai-insight-digest.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +28 -2
- package/src/lib/jobs/ai-job-import-step.js +170 -14
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-insight-budget.d.ts +19 -3
- package/src/lib/jobs/ai-job-insight-budget.js +18 -4
- package/src/lib/jobs/ai-job-insight-budget.js.map +1 -1
- package/src/lib/jobs/ai-job-insight-step.d.ts +2 -2
- package/src/lib/jobs/ai-job-insight-step.js +17 -7
- package/src/lib/jobs/ai-job-insight-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.js +2 -0
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.js +6 -2
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +13 -3
- package/src/lib/jobs/ai-site-import-compile.js +336 -27
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +3 -1
- package/src/lib/jobs/ai-site-import-document.js +36 -0
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-look.d.ts +9 -0
- package/src/lib/jobs/ai-site-import-look.js +89 -6
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +16 -0
- package/src/lib/layout-language/ai-layout-compiler.js +351 -54
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-source.d.ts +88 -2
- package/src/lib/layout-language/ai-layout-frame-source.js +591 -30
- package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.js +30 -18
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +72 -3
- package/src/lib/layout-language/ai-layout-language.js +5 -3
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/layout-language/ai-layout-store.d.ts +8 -0
- package/src/lib/layout-language/ai-layout-store.js +32 -6
- package/src/lib/layout-language/ai-layout-store.js.map +1 -1
- package/src/lib/model/ai-insight.d.ts +23 -3
- package/src/lib/model/ai-insight.js +17 -3
- package/src/lib/model/ai-insight.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +31 -1
- package/src/lib/model/ai-site-import-fidelity.js +347 -25
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +203 -6
- package/src/lib/model/ai-site-import.js +161 -5
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +8 -1
- package/src/lib/model/ai-site-look.js +8 -5
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/providers/routing.js +3 -1
- package/src/lib/providers/routing.js.map +1 -1
- package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -1
- package/src/lib/runtime/ai-doctrine-validators.js +25 -2
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-insight-check.d.ts +7 -0
- package/src/lib/runtime/ai-insight-check.js +111 -27
- package/src/lib/runtime/ai-insight-check.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.js +19 -2
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/ai-page-links.d.ts +15 -0
- package/src/lib/runtime/ai-page-links.js +48 -0
- package/src/lib/runtime/ai-page-links.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +30 -5
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +9 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +24 -5
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-crawl.d.ts +3 -1
- package/src/lib/site-import/site-import-crawl.js +8 -3
- package/src/lib/site-import/site-import-crawl.js.map +1 -1
- package/src/lib/site-import/site-import-css.d.ts +20 -0
- package/src/lib/site-import/site-import-css.js +106 -0
- package/src/lib/site-import/site-import-css.js.map +1 -1
- package/src/lib/site-import/site-import-html.d.ts +39 -0
- package/src/lib/site-import/site-import-html.js +515 -5
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.d.ts +16 -6
- package/src/lib/site-import/site-import-layout.js +524 -52
- package/src/lib/site-import/site-import-layout.js.map +1 -1
- package/src/lib/site-import/site-import-nav.js +286 -24
- package/src/lib/site-import/site-import-nav.js.map +1 -1
- package/src/lib/site-import/site-import-page.js +3 -0
- package/src/lib/site-import/site-import-page.js.map +1 -1
- package/src/lib/tools/ai-insight-tool.js +45 -2
- package/src/lib/tools/ai-insight-tool.js.map +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import type { SiteImportBlock, SiteImportForm } from '../site-import/site-import-html';
|
|
17
|
+
import type { SiteImportBlock, SiteImportForm, SiteImportVideo } from '../site-import/site-import-html';
|
|
18
18
|
import { type AiCreditRange } from './ai-credit-estimate';
|
|
19
19
|
import type { AiJobItemLedger } from './ai-jobs.types';
|
|
20
20
|
/** The job kind. */
|
|
@@ -152,13 +152,39 @@ export type SiteImportButtonStyle = 'primary' | 'secondary' | 'quiet';
|
|
|
152
152
|
/** What a repeated group of the source is. */
|
|
153
153
|
export type SiteImportGroupKind = 'cards' | 'steps' | 'stats' | 'faq' | 'quotes' | 'logos' | 'pricing' | 'list' | 'text';
|
|
154
154
|
export declare const SITE_IMPORT_GROUP_KINDS: readonly SiteImportGroupKind[];
|
|
155
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* One line in place. `role` only where the source's own styling says it (an
|
|
157
|
+
* uppercase eyebrow, a large lede, a large bold statement, a small note).
|
|
158
|
+
*/
|
|
156
159
|
export interface SiteImportLayoutLine {
|
|
157
160
|
kind: 'line';
|
|
158
161
|
line: SiteImportLineRef;
|
|
159
|
-
role?: 'eyebrow' | 'lede' | 'note';
|
|
162
|
+
role?: 'eyebrow' | 'lede' | 'statement' | 'note';
|
|
160
163
|
/** The source draws this line (a link, or a `<button>`'s words) as a button. Its destination is the link block's `href`. */
|
|
161
164
|
button?: SiteImportButtonStyle;
|
|
165
|
+
/** An eyebrow the source sets in a pill of its own: a fill or a border, its corners rounded (AGL-4138). */
|
|
166
|
+
chip?: true;
|
|
167
|
+
/** An eyebrow's color as the source shows it, `#rrggbb` over the ground it sits on (AGL-4138). */
|
|
168
|
+
color?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* How the source frames a picture (AGL-4138): the shape its own `width` and
|
|
172
|
+
* `height` give it, the box it crops it to, its fit in that box, its corners
|
|
173
|
+
* and its shadow. A source that draws a picture at `width: 100%; height:
|
|
174
|
+
* auto` crops nothing, and a page brought in shows it whole.
|
|
175
|
+
*/
|
|
176
|
+
export interface SiteImportPictureFit {
|
|
177
|
+
/** The picture's own shape, width over height, from its `width` and `height` attributes. */
|
|
178
|
+
ratio?: number;
|
|
179
|
+
/** A shape the source crops it to, width over height: an `aspect-ratio` on it or its box. */
|
|
180
|
+
box?: number;
|
|
181
|
+
/** A height in px the source crops it to, at whatever width its column gives it. */
|
|
182
|
+
height?: number;
|
|
183
|
+
objectFit?: 'cover' | 'contain';
|
|
184
|
+
/** Its corners' radius in px, on it or its box; 999 for a round one. */
|
|
185
|
+
radius?: number;
|
|
186
|
+
/** It, or its box, is set on a shadow. */
|
|
187
|
+
shadow?: true;
|
|
162
188
|
}
|
|
163
189
|
/** A picture in place: an image block. */
|
|
164
190
|
export interface SiteImportLayoutPicture {
|
|
@@ -168,6 +194,25 @@ export interface SiteImportLayoutPicture {
|
|
|
168
194
|
href?: string;
|
|
169
195
|
/** It sits in a `<button>` (a video's poster, a lightbox): the picture is kept, the button is not a destination. */
|
|
170
196
|
button?: true;
|
|
197
|
+
/** How the source frames it (AGL-4138). */
|
|
198
|
+
fit?: SiteImportPictureFit;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* A filled square an icon sits in (AGL-4138): its fill and corners, and the
|
|
202
|
+
* icon's own color in it, as the source draws them, `#rrggbb`.
|
|
203
|
+
*/
|
|
204
|
+
export interface SiteImportIconTile {
|
|
205
|
+
fill: string;
|
|
206
|
+
radius: number;
|
|
207
|
+
color: string | null;
|
|
208
|
+
}
|
|
209
|
+
/** A line the source draws along one side of each item of a group, in place of a box (AGL-4138): a step's rule. */
|
|
210
|
+
export interface SiteImportRule {
|
|
211
|
+
side: 'top' | 'right' | 'bottom' | 'left';
|
|
212
|
+
/** Its width in px. */
|
|
213
|
+
width: number;
|
|
214
|
+
/** Its color, `#rrggbb`; `null` where the source draws it in the words' own. */
|
|
215
|
+
color: string | null;
|
|
171
216
|
}
|
|
172
217
|
/** An icon standing on its own, by index into `SiteImportLayout.icons`. */
|
|
173
218
|
export interface SiteImportLayoutIcon {
|
|
@@ -179,6 +224,20 @@ export interface SiteImportLayoutForm {
|
|
|
179
224
|
kind: 'form';
|
|
180
225
|
form: number;
|
|
181
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Where one of the page's videos sat (AGL-4140), by index into
|
|
229
|
+
* `AiSiteImportPageRead.videos`. Its poster, when the source shows one, is an
|
|
230
|
+
* image line: the film's first paint, copied into the library as any picture.
|
|
231
|
+
*/
|
|
232
|
+
export interface SiteImportLayoutVideo {
|
|
233
|
+
kind: 'video';
|
|
234
|
+
video: number;
|
|
235
|
+
poster?: SiteImportLineRef;
|
|
236
|
+
/** How the source frames its poster (AGL-4138), as it frames any picture. */
|
|
237
|
+
fit?: SiteImportPictureFit;
|
|
238
|
+
/** The box the source plays it in casts a shadow. */
|
|
239
|
+
shadow?: true;
|
|
240
|
+
}
|
|
182
241
|
/**
|
|
183
242
|
* A row of columns side by side; `cols` are relative widths in twelfths
|
|
184
243
|
* (`[4, 8]`, `[1, 1, 1]`). Every list of lists is a list of objects: the
|
|
@@ -216,20 +275,36 @@ export interface SiteImportLayoutItem {
|
|
|
216
275
|
/** What its price is for, beside the price: "/mo" (AGL-4083). */
|
|
217
276
|
period?: SiteImportLineRef;
|
|
218
277
|
image?: SiteImportLineRef;
|
|
278
|
+
/** How the source frames its picture (AGL-4138). */
|
|
279
|
+
imageFit?: SiteImportPictureFit;
|
|
219
280
|
/** The icon that leads it, by index into `SiteImportLayout.icons`. */
|
|
220
281
|
icon?: number;
|
|
282
|
+
/** The filled square its lead icon sits in (AGL-4138). */
|
|
283
|
+
tile?: SiteImportIconTile;
|
|
284
|
+
/** A second icon at the end of its first row, as an arrow that it is a link (AGL-4138), by index into `SiteImportLayout.icons`. */
|
|
285
|
+
mark?: number;
|
|
286
|
+
/** Its figure is drawn in the muted words' color, not the brand's (AGL-4138). */
|
|
287
|
+
figureMuted?: true;
|
|
221
288
|
/** The icon each of its bullet points carries (a check mark), when they share one. */
|
|
222
289
|
listIcon?: number;
|
|
223
290
|
/** Where the item goes as a whole: its title link's address. */
|
|
224
291
|
to?: string;
|
|
292
|
+
/** The video it holds (AGL-4140), by index into the read's videos; its poster is its `image`. */
|
|
293
|
+
video?: number;
|
|
225
294
|
}
|
|
226
295
|
export interface SiteImportLayoutGroup {
|
|
227
296
|
kind: 'group';
|
|
228
297
|
group: SiteImportGroupKind;
|
|
229
298
|
/** Columns the source lays the items out in on a wide screen. */
|
|
230
299
|
columns: number;
|
|
231
|
-
/**
|
|
300
|
+
/** Columns on a tablet, where the source sets fewer there than on a wide screen (AGL-4138). */
|
|
301
|
+
columnsSm?: number;
|
|
302
|
+
/** Each item is drawn as a box: a shadow, a fill of its own, or a border on two sides or more. */
|
|
232
303
|
boxed: boolean;
|
|
304
|
+
/** Each item is drawn with a line along one side and no box (AGL-4138). */
|
|
305
|
+
rule?: SiteImportRule;
|
|
306
|
+
/** How the items' words are set, where it is not the section's alignment (AGL-4138). */
|
|
307
|
+
align?: 'start' | 'center';
|
|
233
308
|
/**
|
|
234
309
|
* Each item is a row of its own, its parts side by side, one under another:
|
|
235
310
|
* a plan's name, words and button, or a label and its value (AGL-4083).
|
|
@@ -257,7 +332,7 @@ export interface SiteImportLayoutTabs {
|
|
|
257
332
|
panel: SiteImportLayoutNode[];
|
|
258
333
|
}>;
|
|
259
334
|
}
|
|
260
|
-
export type SiteImportLayoutNode = SiteImportLayoutLine | SiteImportLayoutPicture | SiteImportLayoutIcon | SiteImportLayoutForm | SiteImportLayoutRow | SiteImportLayoutGroup | SiteImportLayoutTable | SiteImportLayoutTabs;
|
|
335
|
+
export type SiteImportLayoutNode = SiteImportLayoutLine | SiteImportLayoutPicture | SiteImportLayoutIcon | SiteImportLayoutForm | SiteImportLayoutVideo | SiteImportLayoutRow | SiteImportLayoutGroup | SiteImportLayoutTable | SiteImportLayoutTabs;
|
|
261
336
|
/** Where the hero's picture sits against its words. */
|
|
262
337
|
export type SiteImportHeroPicture = 'beside' | 'behind' | 'below' | 'above';
|
|
263
338
|
export interface SiteImportLayoutSection {
|
|
@@ -268,12 +343,16 @@ export interface SiteImportLayoutSection {
|
|
|
268
343
|
band: SiteImportBand;
|
|
269
344
|
/** Its background color as `#rrggbb`, when it has one. */
|
|
270
345
|
background: string | null;
|
|
271
|
-
/** A gradient or a
|
|
346
|
+
/** A gradient, a photo, or a film playing on its own behind it (AGL-4140), its poster an image line. */
|
|
272
347
|
backdrop?: {
|
|
273
348
|
kind: 'gradient';
|
|
274
349
|
} | {
|
|
275
350
|
kind: 'picture';
|
|
276
351
|
url: string;
|
|
352
|
+
} | {
|
|
353
|
+
kind: 'video';
|
|
354
|
+
video: number;
|
|
355
|
+
poster?: SiteImportLineRef;
|
|
277
356
|
};
|
|
278
357
|
align: 'start' | 'center';
|
|
279
358
|
/**
|
|
@@ -330,6 +409,12 @@ export interface SiteImportLookFacts {
|
|
|
330
409
|
link: string | null;
|
|
331
410
|
/** Its header bar's background. */
|
|
332
411
|
header: string | null;
|
|
412
|
+
/**
|
|
413
|
+
* The color most of its eyebrows are drawn in, where that is a color of its
|
|
414
|
+
* own: none of its text's, its buttons' or white (AGL-4138). The look pass
|
|
415
|
+
* pins it as the theme's third color. Absent on a read made before.
|
|
416
|
+
*/
|
|
417
|
+
eyebrow?: string | null;
|
|
333
418
|
}
|
|
334
419
|
/** A page's layout, as the source lays it out (AGL-4106). */
|
|
335
420
|
export interface SiteImportLayout {
|
|
@@ -350,6 +435,37 @@ export interface SiteImportNavEntry {
|
|
|
350
435
|
viewBox?: string;
|
|
351
436
|
/** The heading of the menu's column it sits in ("By team"). */
|
|
352
437
|
column?: string;
|
|
438
|
+
/** The column of its panel it sits in, by index into its group's `columns` (AGL-4139). */
|
|
439
|
+
at?: number;
|
|
440
|
+
/** The filled box its icon sits in, as the source draws it (AGL-4139): its fill, corners and the icon's own color. */
|
|
441
|
+
tile?: {
|
|
442
|
+
fill: string;
|
|
443
|
+
radius: number;
|
|
444
|
+
color: string | null;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* One column of a menu's panel as the source sets it (AGL-4139): its heading,
|
|
449
|
+
* its other lines of words, the fill it sits on, the picture it shows, and
|
|
450
|
+
* its own width. A footer's filled box is read the same way, with its links.
|
|
451
|
+
*/
|
|
452
|
+
export interface SiteImportNavColumn {
|
|
453
|
+
heading: string | null;
|
|
454
|
+
/** Its words outside its links, after its heading, as written. */
|
|
455
|
+
lines: string[];
|
|
456
|
+
/** The fill it sits on against its panel's: none, a light one, the brand's, or a dark one. */
|
|
457
|
+
band: SiteImportBand;
|
|
458
|
+
/** The picture it shows outside its links (a featured card's), with `src` once the look pass brings it into the library. */
|
|
459
|
+
image?: {
|
|
460
|
+
url: string;
|
|
461
|
+
alt: string;
|
|
462
|
+
};
|
|
463
|
+
/** Its own width in CSS pixels, where the source sets one. */
|
|
464
|
+
width?: number;
|
|
465
|
+
/** A footer box's links, as written (AGL-4139). */
|
|
466
|
+
links?: SiteImportFooterLink[];
|
|
467
|
+
/** The icon beside its heading, one path on a 24-unit square. */
|
|
468
|
+
iconPath?: string;
|
|
353
469
|
}
|
|
354
470
|
/** A top-level item of the source's menu: a link, or a menu of entries under a name. */
|
|
355
471
|
export interface SiteImportNavGroup {
|
|
@@ -358,6 +474,16 @@ export interface SiteImportNavGroup {
|
|
|
358
474
|
href: string | null;
|
|
359
475
|
/** Empty for a plain link. */
|
|
360
476
|
items: SiteImportNavEntry[];
|
|
477
|
+
/** Its panel's columns side by side, in the source's order (AGL-4139); absent on a read made before. */
|
|
478
|
+
columns?: SiteImportNavColumn[];
|
|
479
|
+
/**
|
|
480
|
+
* Its panel (AGL-4139): how wide the source caps it, and whether it opens
|
|
481
|
+
* on hover — hidden until shown, under a name that is not a button.
|
|
482
|
+
*/
|
|
483
|
+
panel?: {
|
|
484
|
+
width: number | null;
|
|
485
|
+
hover: boolean;
|
|
486
|
+
};
|
|
361
487
|
}
|
|
362
488
|
/** A button in the source's header outside its menu ("Sign in", "Start free"). */
|
|
363
489
|
export interface SiteImportNavCta {
|
|
@@ -397,6 +523,10 @@ export interface SiteImportFooter {
|
|
|
397
523
|
email: string | null;
|
|
398
524
|
/** Its © line, word for word. */
|
|
399
525
|
copyright: string | null;
|
|
526
|
+
/** It opens with the site's logo (AGL-4139). */
|
|
527
|
+
logo?: boolean;
|
|
528
|
+
/** Its filled boxes, each with its heading, words and links (AGL-4139), which `text` and `links` then leave out. */
|
|
529
|
+
panels?: SiteImportNavColumn[];
|
|
400
530
|
}
|
|
401
531
|
/** Every line a layout's nodes place, in order. */
|
|
402
532
|
export declare function siteImportLayoutLines(nodes: readonly SiteImportLayoutNode[]): SiteImportLineRef[];
|
|
@@ -409,6 +539,62 @@ export declare function siteImportLayoutChars(layout: SiteImportLayout | null |
|
|
|
409
539
|
export declare function siteImportLayoutWithin(layout: SiteImportLayout, count: number): SiteImportLayout;
|
|
410
540
|
/** Nodes with only the lines `keep` keeps; what is left empty goes. */
|
|
411
541
|
export declare function siteImportFilterNodes(list: readonly SiteImportLayoutNode[], keep: (ref: SiteImportLineRef) => boolean): SiteImportLayoutNode[];
|
|
542
|
+
/** The words that name a control as one that plays a film: a facade's label, a "Watch the film" button. */
|
|
543
|
+
export declare const SITE_IMPORT_PLAY_WORDS: RegExp;
|
|
544
|
+
/**
|
|
545
|
+
* Where a video of a page brought in plays from on the new page, or `null`
|
|
546
|
+
* where the Video element cannot play it: a link to a video host whose
|
|
547
|
+
* player the element frames (`hosted`), else the file the old site serves at
|
|
548
|
+
* an https address, which the new page plays from that address. A video on
|
|
549
|
+
* any other host is shown as its poster, linking to it.
|
|
550
|
+
*/
|
|
551
|
+
export declare function siteImportFilmSource(video: Pick<SiteImportVideo, 'src' | 'embed'> | null | undefined): {
|
|
552
|
+
src: string;
|
|
553
|
+
hosted: boolean;
|
|
554
|
+
} | null;
|
|
555
|
+
/**
|
|
556
|
+
* The films a page brought in plays from the old site's own address
|
|
557
|
+
* (AGL-4140): the https file of each video its layout places where it sits or
|
|
558
|
+
* in an item, which the Video element plays because its poster is in the
|
|
559
|
+
* library. A film on a host's player, one behind a section's words (drawn as
|
|
560
|
+
* its poster), and one with no poster the library holds play nothing from
|
|
561
|
+
* the old site. The rule the compile places a film by (`filmPlaces`).
|
|
562
|
+
*/
|
|
563
|
+
export declare function aiSiteImportOwnFilms(read: Pick<AiSiteImportPageRead, 'videos' | 'layout' | 'blocks'> | null | undefined, photos: ReadonlyArray<{
|
|
564
|
+
from?: string;
|
|
565
|
+
}>): string[];
|
|
566
|
+
/**
|
|
567
|
+
* The most hosts a site approves of one kind: `APPROVED_IMAGE_HOSTS_MAX` in
|
|
568
|
+
* `security-origins.js`, the tenant policy's own ceiling, which a spec holds
|
|
569
|
+
* this to.
|
|
570
|
+
*/
|
|
571
|
+
export declare const SITE_IMPORT_APPROVED_HOSTS_MAX = 50;
|
|
572
|
+
/**
|
|
573
|
+
* A host as the Security tab keeps one and the tenant's policy reads it
|
|
574
|
+
* (`normalizeApprovedImageHost` in `security-origins.js`, which a spec holds
|
|
575
|
+
* this to): lowercase, a hostname with at least one dot and a letter-only
|
|
576
|
+
* last label, an optional leading `*.`, and no scheme, path, port or
|
|
577
|
+
* separator; `null` for anything else.
|
|
578
|
+
*/
|
|
579
|
+
export declare function siteImportApprovedHost(value: unknown): string | null;
|
|
580
|
+
/**
|
|
581
|
+
* A site's approved media hosts with the old site's film hosts added
|
|
582
|
+
* (AGL-4140): every entry the owner has kept as it is and where it is, each
|
|
583
|
+
* new host once, after them, within `SITE_IMPORT_APPROVED_HOSTS_MAX`; `null`
|
|
584
|
+
* when nothing is added.
|
|
585
|
+
*/
|
|
586
|
+
export declare function siteImportApprovedHostsWith(current: unknown, addresses: readonly string[]): string[] | null;
|
|
587
|
+
/**
|
|
588
|
+
* What a page's row says of its videos (AGL-4140), or `null`: a film the old
|
|
589
|
+
* site serves itself plays from there, the owner may move it, and its address
|
|
590
|
+
* was approved for the site to play (`approved`, once the host write is in);
|
|
591
|
+
* a film the source showed no poster for is left out, since its poster is the
|
|
592
|
+
* button a visitor presses, and the owner may add it with one.
|
|
593
|
+
*/
|
|
594
|
+
export declare function aiSiteImportVideoNote(videos: readonly SiteImportVideo[] | null | undefined, own?: {
|
|
595
|
+
films: number;
|
|
596
|
+
approved: boolean;
|
|
597
|
+
}): string | null;
|
|
412
598
|
/** A layout with its icons' drawings dropped, for a page that must be lighter. */
|
|
413
599
|
export declare function siteImportLayoutWithoutDrawings(layout: SiteImportLayout): SiteImportLayout;
|
|
414
600
|
/** What a wave's read found on one page, for its model answer. Never on the wire. */
|
|
@@ -453,6 +639,13 @@ export interface AiSiteImportPageRead {
|
|
|
453
639
|
title: string;
|
|
454
640
|
description: string;
|
|
455
641
|
};
|
|
642
|
+
/**
|
|
643
|
+
* The videos the page shows (AGL-4140), which its layout places by index:
|
|
644
|
+
* where each plays from, its poster's address and what a search engine
|
|
645
|
+
* reads of it. Untrusted data. Absent on a page that shows none, or a read
|
|
646
|
+
* made before they were kept; emptied with `blocks` once the page is in.
|
|
647
|
+
*/
|
|
648
|
+
videos?: SiteImportVideo[];
|
|
456
649
|
}
|
|
457
650
|
/** How a page is built from its old page, as the step chose: its words copied as they are, or arranged by Aglyn AI. */
|
|
458
651
|
export type AiSiteImportBuild = 'copied' | 'arranged';
|
|
@@ -573,6 +766,8 @@ export interface AiSiteImportHome {
|
|
|
573
766
|
title: string;
|
|
574
767
|
description: string;
|
|
575
768
|
ogImage: string | null;
|
|
769
|
+
/** The site's icon its head names (AGL-4139): its largest touch icon, else its largest picture icon. Absent on a read made before. */
|
|
770
|
+
favicon?: string | null;
|
|
576
771
|
siteName: string;
|
|
577
772
|
brand: {
|
|
578
773
|
kind: 'logo-only' | 'logo-and-name' | 'name-only';
|
|
@@ -619,6 +814,8 @@ export interface AiSiteImportLook {
|
|
|
619
814
|
colors: string[];
|
|
620
815
|
/** The source's logo, as the library holds it, for the header's brand. */
|
|
621
816
|
logo: AiSiteImportPhoto | null;
|
|
817
|
+
/** The pictures the home page's menus show (AGL-4139), as the library holds them, each by the address it came `from`. */
|
|
818
|
+
pictures?: AiSiteImportPhoto[];
|
|
622
819
|
/** Whether the site's listing was taken from the home page's own words. */
|
|
623
820
|
seo: boolean;
|
|
624
821
|
/** The look's seed, which every page of the import is drawn with. */
|
|
@@ -48,6 +48,7 @@ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_wi
|
|
|
48
48
|
* planned, quoted or spent: a site seen without its home page is not the
|
|
49
49
|
* site. The person is told why and checks again.
|
|
50
50
|
*=========================================*/ import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn/app-utils/platform-brand";
|
|
51
|
+
import { videoEmbedOf } from "@aglyn/aglyn/plugin-manager/video-embed-provider";
|
|
51
52
|
import { aiCreditRangeOrdered, aiCreditRangeText, AI_MEASURED_IMPORT_CREDITS } from "./ai-credit-estimate.js";
|
|
52
53
|
/** The job kind. */ export const AI_SITE_IMPORT_KIND = 'import';
|
|
53
54
|
/** The input naming the proved domain the job brings in. */ export const AI_SITE_IMPORT_DOMAIN_INPUT = 'domain';
|
|
@@ -144,6 +145,9 @@ export const SITE_IMPORT_GROUP_KINDS = [
|
|
|
144
145
|
case 'picture':
|
|
145
146
|
out.push(node.line);
|
|
146
147
|
break;
|
|
148
|
+
case 'video':
|
|
149
|
+
if (node.poster !== undefined) out.push(node.poster);
|
|
150
|
+
break;
|
|
147
151
|
case 'row':
|
|
148
152
|
for (const cell of node.cells)visit(cell.nodes);
|
|
149
153
|
break;
|
|
@@ -175,10 +179,20 @@ export const SITE_IMPORT_GROUP_KINDS = [
|
|
|
175
179
|
* short): references past the cut are dropped, and what is left empty goes.
|
|
176
180
|
*/ export function siteImportLayoutWithin(layout, count) {
|
|
177
181
|
const keep = (ref)=>ref >= 0 && ref < count;
|
|
178
|
-
const sections = layout.sections.map((section)=>
|
|
182
|
+
const sections = layout.sections.map((section)=>{
|
|
183
|
+
const { backdrop } = section;
|
|
184
|
+
// A film behind the words keeps its place; a poster past the cut goes (AGL-4140).
|
|
185
|
+
const behind = (backdrop == null ? void 0 : backdrop.kind) === 'video' && backdrop.poster !== undefined && !keep(backdrop.poster) ? {
|
|
186
|
+
backdrop: {
|
|
187
|
+
kind: 'video',
|
|
188
|
+
video: backdrop.video
|
|
189
|
+
}
|
|
190
|
+
} : {};
|
|
191
|
+
return _extends({}, section, behind, {
|
|
179
192
|
nodes: siteImportFilterNodes(section.nodes, keep),
|
|
180
193
|
lines: section.lines.filter(keep)
|
|
181
|
-
})
|
|
194
|
+
});
|
|
195
|
+
}).filter((section)=>section.lines.length);
|
|
182
196
|
return _extends({}, layout, {
|
|
183
197
|
sections
|
|
184
198
|
});
|
|
@@ -196,6 +210,19 @@ export const SITE_IMPORT_GROUP_KINDS = [
|
|
|
196
210
|
return [
|
|
197
211
|
node
|
|
198
212
|
];
|
|
213
|
+
case 'video':
|
|
214
|
+
{
|
|
215
|
+
// The film stays where it sat; a poster past the cut goes.
|
|
216
|
+
if (node.poster === undefined || keep(node.poster)) return [
|
|
217
|
+
node
|
|
218
|
+
];
|
|
219
|
+
const { poster: _poster } = node, rest = _object_without_properties_loose(node, [
|
|
220
|
+
"poster"
|
|
221
|
+
]);
|
|
222
|
+
return [
|
|
223
|
+
rest
|
|
224
|
+
];
|
|
225
|
+
}
|
|
199
226
|
case 'row':
|
|
200
227
|
{
|
|
201
228
|
const cells = node.cells.map((cell)=>({
|
|
@@ -209,7 +236,7 @@ export const SITE_IMPORT_GROUP_KINDS = [
|
|
|
209
236
|
}
|
|
210
237
|
case 'group':
|
|
211
238
|
{
|
|
212
|
-
const items = node.items.map((item)=>trimItem(item, keep)).filter((item)=>item.lines.length || item.icon !== undefined);
|
|
239
|
+
const items = node.items.map((item)=>trimItem(item, keep)).filter((item)=>item.lines.length || item.icon !== undefined || item.video !== undefined);
|
|
213
240
|
return items.length ? [
|
|
214
241
|
_extends({}, node, {
|
|
215
242
|
items
|
|
@@ -259,6 +286,8 @@ function trimItem(item, keep) {
|
|
|
259
286
|
'badge',
|
|
260
287
|
'period'
|
|
261
288
|
])if (out[key] !== undefined && !keep(out[key])) delete out[key];
|
|
289
|
+
if (out.image === undefined) delete out.imageFit;
|
|
290
|
+
if (out.figure === undefined) delete out.figureMuted;
|
|
262
291
|
for (const key of [
|
|
263
292
|
'text',
|
|
264
293
|
'list',
|
|
@@ -274,6 +303,129 @@ function trimItem(item, keep) {
|
|
|
274
303
|
else delete out.ctas;
|
|
275
304
|
return out;
|
|
276
305
|
}
|
|
306
|
+
/*------------------------------------------
|
|
307
|
+
* A page's videos (AGL-4140)
|
|
308
|
+
*-----------------------------------------*/ /** The words that name a control as one that plays a film: a facade's label, a "Watch the film" button. */ export const SITE_IMPORT_PLAY_WORDS = /\b(?:play|watch|video|film)\b/i;
|
|
309
|
+
/**
|
|
310
|
+
* Where a video of a page brought in plays from on the new page, or `null`
|
|
311
|
+
* where the Video element cannot play it: a link to a video host whose
|
|
312
|
+
* player the element frames (`hosted`), else the file the old site serves at
|
|
313
|
+
* an https address, which the new page plays from that address. A video on
|
|
314
|
+
* any other host is shown as its poster, linking to it.
|
|
315
|
+
*/ export function siteImportFilmSource(video) {
|
|
316
|
+
var _video_embed, _video_src;
|
|
317
|
+
if (!video) return null;
|
|
318
|
+
const embed = (_video_embed = video.embed) == null ? void 0 : _video_embed.trim();
|
|
319
|
+
if (embed && videoEmbedOf(embed)) return {
|
|
320
|
+
src: embed,
|
|
321
|
+
hosted: true
|
|
322
|
+
};
|
|
323
|
+
const file = (_video_src = video.src) == null ? void 0 : _video_src.trim();
|
|
324
|
+
return file && /^https:\/\//i.test(file) ? {
|
|
325
|
+
src: file,
|
|
326
|
+
hosted: false
|
|
327
|
+
} : null;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The films a page brought in plays from the old site's own address
|
|
331
|
+
* (AGL-4140): the https file of each video its layout places where it sits or
|
|
332
|
+
* in an item, which the Video element plays because its poster is in the
|
|
333
|
+
* library. A film on a host's player, one behind a section's words (drawn as
|
|
334
|
+
* its poster), and one with no poster the library holds play nothing from
|
|
335
|
+
* the old site. The rule the compile places a film by (`filmPlaces`).
|
|
336
|
+
*/ export function aiSiteImportOwnFilms(read, photos) {
|
|
337
|
+
var _ref;
|
|
338
|
+
const videos = (_ref = read == null ? void 0 : read.videos) != null ? _ref : [];
|
|
339
|
+
if (!videos.length || !(read == null ? void 0 : read.layout)) return [];
|
|
340
|
+
const held = new Set(photos.flatMap((photo)=>photo.from ? [
|
|
341
|
+
photo.from
|
|
342
|
+
] : []));
|
|
343
|
+
const out = [];
|
|
344
|
+
const place = (video, poster)=>{
|
|
345
|
+
var _read_blocks;
|
|
346
|
+
const source = siteImportFilmSource(videos[video]);
|
|
347
|
+
const block = poster === undefined ? undefined : (_read_blocks = read.blocks) == null ? void 0 : _read_blocks[poster];
|
|
348
|
+
if (source && !source.hosted && (block == null ? void 0 : block.kind) === 'image' && held.has(block.url) && !out.includes(source.src)) out.push(source.src);
|
|
349
|
+
};
|
|
350
|
+
const visit = (nodes)=>{
|
|
351
|
+
for (const node of nodes){
|
|
352
|
+
if (node.kind === 'video') place(node.video, node.poster);
|
|
353
|
+
else if (node.kind === 'row') for (const cell of node.cells)visit(cell.nodes);
|
|
354
|
+
else if (node.kind === 'tabs') for (const tab of node.tabs)visit(tab.panel);
|
|
355
|
+
else if (node.kind === 'group') {
|
|
356
|
+
for (const item of node.items)if (item.video !== undefined) place(item.video, item.image);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
for (const section of read.layout.sections)visit(section.nodes);
|
|
361
|
+
return out;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* The most hosts a site approves of one kind: `APPROVED_IMAGE_HOSTS_MAX` in
|
|
365
|
+
* `security-origins.js`, the tenant policy's own ceiling, which a spec holds
|
|
366
|
+
* this to.
|
|
367
|
+
*/ export const SITE_IMPORT_APPROVED_HOSTS_MAX = 50;
|
|
368
|
+
/**
|
|
369
|
+
* A host as the Security tab keeps one and the tenant's policy reads it
|
|
370
|
+
* (`normalizeApprovedImageHost` in `security-origins.js`, which a spec holds
|
|
371
|
+
* this to): lowercase, a hostname with at least one dot and a letter-only
|
|
372
|
+
* last label, an optional leading `*.`, and no scheme, path, port or
|
|
373
|
+
* separator; `null` for anything else.
|
|
374
|
+
*/ export function siteImportApprovedHost(value) {
|
|
375
|
+
if (typeof value !== 'string') return null;
|
|
376
|
+
const host = value.trim().toLowerCase();
|
|
377
|
+
if (!host || host.length > 253) return null;
|
|
378
|
+
if (/[\s;,/\\?#@:]/.test(host)) return null;
|
|
379
|
+
const bare = host.startsWith('*.') ? host.slice(2) : host;
|
|
380
|
+
if (!bare || bare === '*') return null;
|
|
381
|
+
return /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/.test(bare) ? host : null;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* A site's approved media hosts with the old site's film hosts added
|
|
385
|
+
* (AGL-4140): every entry the owner has kept as it is and where it is, each
|
|
386
|
+
* new host once, after them, within `SITE_IMPORT_APPROVED_HOSTS_MAX`; `null`
|
|
387
|
+
* when nothing is added.
|
|
388
|
+
*/ export function siteImportApprovedHostsWith(current, addresses) {
|
|
389
|
+
const owner = Array.isArray(current) ? current.filter((entry)=>typeof entry === 'string') : [];
|
|
390
|
+
const have = new Set(owner.map((entry)=>entry.trim().toLowerCase()));
|
|
391
|
+
const out = [
|
|
392
|
+
...owner
|
|
393
|
+
];
|
|
394
|
+
const hostnameOf = (address)=>{
|
|
395
|
+
try {
|
|
396
|
+
return new URL(address).hostname;
|
|
397
|
+
} catch (unused) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
for (const address of addresses){
|
|
402
|
+
const host = siteImportApprovedHost(hostnameOf(address));
|
|
403
|
+
if (!host || have.has(host) || out.length >= SITE_IMPORT_APPROVED_HOSTS_MAX) continue;
|
|
404
|
+
have.add(host);
|
|
405
|
+
out.push(host);
|
|
406
|
+
}
|
|
407
|
+
return out.length > owner.length ? out : null;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* What a page's row says of its videos (AGL-4140), or `null`: a film the old
|
|
411
|
+
* site serves itself plays from there, the owner may move it, and its address
|
|
412
|
+
* was approved for the site to play (`approved`, once the host write is in);
|
|
413
|
+
* a film the source showed no poster for is left out, since its poster is the
|
|
414
|
+
* button a visitor presses, and the owner may add it with one.
|
|
415
|
+
*/ export function aiSiteImportVideoNote(videos, own = {
|
|
416
|
+
films: 0,
|
|
417
|
+
approved: false
|
|
418
|
+
}) {
|
|
419
|
+
const posterless = (videos != null ? videos : []).filter((video)=>siteImportFilmSource(video) && !video.poster).length;
|
|
420
|
+
const approved = own.approved ? ' Its address was added to Approved media hosts in Admin → Security, so it plays on your new site.' : '';
|
|
421
|
+
const notes = [
|
|
422
|
+
own.films === 1 ? `A video on this page plays from your old site's address; pick it from your media library to move it.${approved}` : '',
|
|
423
|
+
own.films > 1 ? `Videos on this page play from your old site's address; pick each from your media library to move it.${approved ? ' Their addresses were added to Approved media hosts in Admin → Security, so they play on your new site.' : ''}` : '',
|
|
424
|
+
posterless === 1 ? 'A video on this page had no poster picture, so it was left out: add it with the Video element and pick a poster for it.' : '',
|
|
425
|
+
posterless > 1 ? 'Videos on this page had no poster picture, so they were left out: add each with the Video element and pick a poster for it.' : ''
|
|
426
|
+
].filter(Boolean);
|
|
427
|
+
return notes.length ? notes.join(' ') : null;
|
|
428
|
+
}
|
|
277
429
|
/** A layout with its icons' drawings dropped, for a page that must be lighter. */ export function siteImportLayoutWithoutDrawings(layout) {
|
|
278
430
|
return _extends({}, layout, {
|
|
279
431
|
icons: layout.icons.map((icon)=>icon.svg ? {
|
|
@@ -953,7 +1105,9 @@ const readChars = (read)=>{
|
|
|
953
1105
|
blocks: [],
|
|
954
1106
|
forms: [],
|
|
955
1107
|
layout: null
|
|
956
|
-
}
|
|
1108
|
+
}, read.videos ? {
|
|
1109
|
+
videos: []
|
|
1110
|
+
} : {})
|
|
957
1111
|
}, page.photos ? {
|
|
958
1112
|
photos: _extends({}, page.photos, {
|
|
959
1113
|
assets: []
|
|
@@ -1003,7 +1157,9 @@ const readChars = (read)=>{
|
|
|
1003
1157
|
blocks: [],
|
|
1004
1158
|
forms: [],
|
|
1005
1159
|
layout: null
|
|
1006
|
-
}
|
|
1160
|
+
}, page.read.videos ? {
|
|
1161
|
+
videos: []
|
|
1162
|
+
} : {})
|
|
1007
1163
|
}) : page)
|
|
1008
1164
|
});
|
|
1009
1165
|
}
|