@aglyn/plugins-ai 1.20.1 → 1.20.3
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/jobs/ai-image-reads.d.ts +22 -5
- package/src/lib/jobs/ai-image-reads.js +1 -0
- package/src/lib/jobs/ai-image-reads.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +8 -0
- package/src/lib/jobs/ai-job-import-step.js +29 -2
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +2 -0
- package/src/lib/jobs/ai-site-import-document.js +4 -0
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-graphics.d.ts +47 -0
- package/src/lib/jobs/ai-site-import-graphics.js +151 -0
- package/src/lib/jobs/ai-site-import-graphics.js.map +1 -0
- package/src/lib/jobs/ai-site-import-honesty.d.ts +5 -0
- package/src/lib/jobs/ai-site-import-honesty.js +32 -1
- package/src/lib/jobs/ai-site-import-honesty.js.map +1 -1
- package/src/lib/jobs/ai-site-import-improve.d.ts +9 -1
- package/src/lib/jobs/ai-site-import-improve.js +26 -11
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
- package/src/lib/jobs/ai-site-import-pictures.js +1 -1
- package/src/lib/jobs/ai-site-import-pictures.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +1 -0
- package/src/lib/model/ai-site-import-fidelity.js +4 -2
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-graphic.d.ts +49 -0
- package/src/lib/model/ai-site-import-graphic.js +124 -0
- package/src/lib/model/ai-site-import-graphic.js.map +1 -0
- package/src/lib/model/ai-site-import-ledger.d.ts +8 -1
- package/src/lib/model/ai-site-import-ledger.js +7 -7
- package/src/lib/model/ai-site-import-ledger.js.map +1 -1
- package/src/lib/model/ai-site-import-marks.d.ts +24 -6
- package/src/lib/model/ai-site-import-marks.js +23 -6
- package/src/lib/model/ai-site-import-marks.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +7 -0
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/server/ai-image-reads-route.js +30 -2
- package/src/lib/server/ai-image-reads-route.js.map +1 -1
|
@@ -43,7 +43,7 @@ import { AI_LAYOUT_ALIGNS, AI_LAYOUT_BANDS, AI_LAYOUT_MAX_COLS, AI_LAYOUT_STYLES
|
|
|
43
43
|
import { AI_ICON_WORDS } from "../runtime/ai-icon-library.js";
|
|
44
44
|
import { aiSiteHomeArc } from "../model/ai-site-home-arcs.js";
|
|
45
45
|
import { SITE_IMPORT_IMPROVED_MEANING, SITE_IMPORT_MEANING_FLOOR, siteImportContentKept, siteImportContentWords } from "../model/ai-site-import-fidelity.js";
|
|
46
|
-
import {
|
|
46
|
+
import { aiSiteImportImageIsMark } from "../model/ai-site-import-marks.js";
|
|
47
47
|
import { siteImportLedger } from "../model/ai-site-import-ledger.js";
|
|
48
48
|
import { AI_SITE_IMPORT_PAGE_CEILING_CREDITS } from "../model/ai-site-import.js";
|
|
49
49
|
import { estimateAiBilledUsd } from "../providers/catalog.js";
|
|
@@ -430,9 +430,28 @@ const short = (text, most = 80)=>text.length > most ? `${text.slice(0, most - 1)
|
|
|
430
430
|
...out
|
|
431
431
|
])if (key === 'phone' || key === 'email') out.set(to, to);
|
|
432
432
|
if (input.formSection !== null && input.formSection !== undefined) out.set('form', `#${input.formSection + 1}`);
|
|
433
|
+
else {
|
|
434
|
+
// A page with no form of its own sends `form` to the site's page that holds one, as a link to that page goes (AGL-4152).
|
|
435
|
+
const formPage = aiSiteImportFormPageOf(doc);
|
|
436
|
+
if (formPage) out.set('form', formPage);
|
|
437
|
+
}
|
|
433
438
|
for(let n = 1; n <= ((_input_sections = input.sections) != null ? _input_sections : 0); n += 1)out.set(`#${n}`, `#${n}`);
|
|
434
439
|
return out;
|
|
435
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* The site's page that holds its form (AGL-4152), as `page:<id>`: the one the
|
|
443
|
+
* plan's header button sends `form` to, else the one the import read a form
|
|
444
|
+
* on. `null` where no page of the site holds one, where that page is not one a
|
|
445
|
+
* link may go to, or where it is the page itself, which holds its form in place.
|
|
446
|
+
*/ export function aiSiteImportFormPageOf(doc) {
|
|
447
|
+
var _ref;
|
|
448
|
+
var _doc_plan;
|
|
449
|
+
const cta = (_doc_plan = doc.plan) == null ? void 0 : _doc_plan.nav.primaryCta;
|
|
450
|
+
const id = (_ref = (cta == null ? void 0 : cta.target) === 'form' ? cta.page : undefined) != null ? _ref : doc.formPage;
|
|
451
|
+
if (!id || !doc.links.some((page)=>page.id === id)) return null;
|
|
452
|
+
const to = `page:${id}`;
|
|
453
|
+
return to === aiSiteImportOwnPage(doc) ? null : to;
|
|
454
|
+
}
|
|
436
455
|
/**
|
|
437
456
|
* The page's own `page:<id>` on the new site (AGL-4152), by its address: a
|
|
438
457
|
* link to it from itself goes nowhere a visitor is not already. `null` where
|
|
@@ -848,7 +867,8 @@ const WORD_KINDS = new Set([
|
|
|
848
867
|
}
|
|
849
868
|
/**
|
|
850
869
|
* The opening of a redesign without a brand's mark for its photo (AGL-4152):
|
|
851
|
-
* a picture the source names a logo, a badge or an icon
|
|
870
|
+
* a picture the source names a logo, a badge or an icon, or whose pixels make
|
|
871
|
+
* it a graphic (`aiSiteImportIsBrandMark`),
|
|
852
872
|
* that the answer keeps in its first section takes the page's widest photo no
|
|
853
873
|
* section placed instead, or, where it has none, is left out, and a row it
|
|
854
874
|
* leaves a column empty in is drawn as one column. A client's logo the source
|
|
@@ -870,10 +890,7 @@ const WORD_KINDS = new Set([
|
|
|
870
890
|
};
|
|
871
891
|
const markAt = (ref)=>{
|
|
872
892
|
const image = imageOf(ref);
|
|
873
|
-
return !!image &&
|
|
874
|
-
url: image.url,
|
|
875
|
-
alt: image.alt
|
|
876
|
-
});
|
|
893
|
+
return !!image && aiSiteImportImageIsMark(image, doc.photos);
|
|
877
894
|
};
|
|
878
895
|
const marks = new Set(first.blocks.filter((block)=>block.kind === 'keep' && markAt(block.ref)));
|
|
879
896
|
if (!marks.size) return [
|
|
@@ -1020,10 +1037,7 @@ const WORD_KINDS = new Set([
|
|
|
1020
1037
|
if (ownOpening.taken) return null;
|
|
1021
1038
|
const ratioOf = (line)=>{
|
|
1022
1039
|
const image = line === undefined || scope.used.has(line) ? undefined : doc.blocks[line];
|
|
1023
|
-
if ((image == null ? void 0 : image.kind) !== 'image' ||
|
|
1024
|
-
url: image.url,
|
|
1025
|
-
alt: image.alt
|
|
1026
|
-
})) return 0;
|
|
1040
|
+
if ((image == null ? void 0 : image.kind) !== 'image' || aiSiteImportImageIsMark(image, scope.photos)) return 0;
|
|
1027
1041
|
const photo = scope.photos.get(image.url);
|
|
1028
1042
|
return (photo == null ? void 0 : photo.width) && photo.height ? photo.width / photo.height : 0;
|
|
1029
1043
|
};
|
|
@@ -1491,7 +1505,8 @@ const plus = (a, b)=>({
|
|
|
1491
1505
|
/** A redesign's read for a page: its ledger, and everywhere a link may go. */ export function aiSiteImportImproveLedger(doc) {
|
|
1492
1506
|
return siteImportLedger({
|
|
1493
1507
|
layout: aiSiteImportLayoutOf(doc),
|
|
1494
|
-
blocks: doc.blocks
|
|
1508
|
+
blocks: doc.blocks,
|
|
1509
|
+
photos: doc.photos
|
|
1495
1510
|
});
|
|
1496
1511
|
}
|
|
1497
1512
|
/**
|