@designcrowd/library.brand-page 6.1.2 → 6.1.3-ai-websitev2-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/{CreatedOnBrandCrowd-de-de-CU9qFyWP.js → CreatedOnBrandCrowd-de-de-COGurYmI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-Yjpb7jdP.js → CreatedOnBrandCrowd-en-us-rf1TRM4-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-D2WZ8nVO.js → CreatedOnBrandCrowd-es-es-C73Bu6lH.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-i3ikf-KU.js → CreatedOnBrandCrowd-fr-ca-CRvfz5w2.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-i3ikf-KU.js → CreatedOnBrandCrowd-fr-fr-CRvfz5w2.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-pjIejWpt.js → CreatedOnBrandCrowd-pt-br-9dSIQ3OJ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-pjIejWpt.js → CreatedOnBrandCrowd-pt-pt-9dSIQ3OJ.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DpKoYjkj.js → CreatedOnDcom-de-de-CQcyGlhT.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-CTGKfegI.js → CreatedOnDcom-en-us-BdU4Mx4w.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-BjeZz5zs.js → CreatedOnDcom-es-es-C3xd_9pW.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-CrtEoLCA.js → CreatedOnDcom-fr-ca-q0JZT35E.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-QFHt16jZ.js → CreatedOnDcom-fr-fr-USIfdnTw.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-D2dgmjtV.js → CreatedOnDcom-pt-br-C_qlDOP1.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-ZSCFPLEN.js → CreatedOnDcom-pt-pt-SCaBDDiA.js} +1 -1
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +7 -3
- package/lib/src/clients/ai-assistant-client.d.ts +1 -0
- package/lib/src/clients/ai-assistant-client.js +1 -0
- package/lib/src/composables/useSnapshot.js +48 -9
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-CkR-Ncgf.js → lib-tqkEs_fX.js} +17232 -17041
- package/lib/src/metadata-builder/builders/global-font-propagation.d.ts +28 -0
- package/lib/src/metadata-builder/builders/global-font-propagation.js +125 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.js +16 -0
- package/lib/src/metadata-builder/builders/section-builders/index.d.ts +1 -0
- package/lib/src/metadata-builder/builders/section-builders/index.js +1 -0
- package/lib/src/metadata-builder/builders/section-builders/support-me-builder.d.ts +8 -0
- package/lib/src/metadata-builder/builders/section-builders/support-me-builder.js +25 -0
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +5 -2
- package/lib/src/metadata-builder/builders/section-field-maps.js +15 -0
- package/lib/src/metadata-builder/builders/section-field-utils.d.ts +6 -1
- package/lib/src/metadata-builder/builders/section-field-utils.js +48 -12
- package/lib/src/metadata-builder/builders/section-rules/support-me.rules.d.ts +2 -0
- package/lib/src/metadata-builder/builders/section-rules/support-me.rules.js +17 -0
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +9 -0
- package/lib/src/metadata-builder/helpers/rte.helpers.js +60 -1
- package/lib/src/metadata-builder/metadata-executor.js +3 -1
- package/lib/src/metadata-builder/models.d.ts +2 -0
- package/lib/src/metadata-builder/models.js +2 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +1 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.js +4 -0
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +14 -2
- package/lib/src/utils/minify-brand-page-metadata.js +7 -0
- package/package.json +1 -1
- package/src/brand-page-maker/components/ai-website-builder/AiWebsiteBuilder.vue +1 -1
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +7 -3
- package/src/clients/ai-assistant-client.ts +1 -0
- package/src/composables/useSnapshot.test.ts +153 -0
- package/src/composables/useSnapshot.ts +52 -8
- package/src/metadata-builder/builders/global-font-propagation.test.ts +269 -0
- package/src/metadata-builder/builders/global-font-propagation.ts +205 -0
- package/src/metadata-builder/builders/global-styles-builder.ts +21 -0
- package/src/metadata-builder/builders/section-builders/index.ts +1 -0
- package/src/metadata-builder/builders/section-builders/support-me-builder.test.ts +177 -0
- package/src/metadata-builder/builders/section-builders/support-me-builder.ts +43 -0
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +5 -2
- package/src/metadata-builder/builders/section-field-maps.ts +18 -0
- package/src/metadata-builder/builders/section-field-utils.test.ts +83 -0
- package/src/metadata-builder/builders/section-field-utils.ts +69 -18
- package/src/metadata-builder/builders/section-rules/support-me.rules.ts +39 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +82 -1
- package/src/metadata-builder/metadata-executor.ts +3 -0
- package/src/metadata-builder/models.ts +2 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +4 -0
- package/src/metadata-builder/parsers/section-tool-arguments.ts +14 -1
- package/src/utils/minify-brand-page-metadata.test.ts +61 -0
- package/src/utils/minify-brand-page-metadata.ts +8 -0
|
@@ -348,7 +348,7 @@ export function useAiWebsiteBuilderChat() {
|
|
|
348
348
|
message,
|
|
349
349
|
websiteContext,
|
|
350
350
|
websiteSnapshot: snapshotStore.snapshotBase64 || undefined,
|
|
351
|
-
agentType: AI_ASSISTANT_AGENT_TYPES.
|
|
351
|
+
agentType: AI_ASSISTANT_AGENT_TYPES.WEBSITE_BUILDER_V2,
|
|
352
352
|
userPlan,
|
|
353
353
|
connectionId,
|
|
354
354
|
});
|
|
@@ -358,7 +358,7 @@ export function useAiWebsiteBuilderChat() {
|
|
|
358
358
|
message,
|
|
359
359
|
websiteContext,
|
|
360
360
|
websiteSnapshot: snapshotStore.snapshotBase64 || undefined,
|
|
361
|
-
agentType: AI_ASSISTANT_AGENT_TYPES.
|
|
361
|
+
agentType: AI_ASSISTANT_AGENT_TYPES.WEBSITE_BUILDER_V2,
|
|
362
362
|
userPlan,
|
|
363
363
|
connectionId,
|
|
364
364
|
});
|
|
@@ -503,9 +503,13 @@ export function useAiWebsiteBuilderChat() {
|
|
|
503
503
|
failedResults,
|
|
504
504
|
retryCount,
|
|
505
505
|
});
|
|
506
|
+
// Tool submissions must go to the SAME agent that ran the thread
|
|
507
|
+
// (AI QA 2026-07-05 T19: a mismatched agentType routes tool results
|
|
508
|
+
// to a service with no state for the thread and fails the build).
|
|
509
|
+
// brandSite AI is V2-only; every call site sends WEBSITE_BUILDER_V2.
|
|
506
510
|
const submitResult = await client.submitToolResultsBuildAsync(aiThreadStore.threadId, {
|
|
507
511
|
toolCalls: toolResults,
|
|
508
|
-
agentType: AI_ASSISTANT_AGENT_TYPES.
|
|
512
|
+
agentType: AI_ASSISTANT_AGENT_TYPES.WEBSITE_BUILDER_V2,
|
|
509
513
|
connectionId,
|
|
510
514
|
retryCount,
|
|
511
515
|
userPlan,
|
|
@@ -23,6 +23,7 @@ export interface WebsiteContext {
|
|
|
23
23
|
}
|
|
24
24
|
export declare const AI_ASSISTANT_AGENT_TYPES: {
|
|
25
25
|
readonly WEBSITE_BUILDER: "website_builder";
|
|
26
|
+
readonly WEBSITE_BUILDER_V2: "website_builder_v2";
|
|
26
27
|
};
|
|
27
28
|
export type AiAssistantAgentType = (typeof AI_ASSISTANT_AGENT_TYPES)[keyof typeof AI_ASSISTANT_AGENT_TYPES];
|
|
28
29
|
export type UserPlan = 'free' | 'premium';
|
|
@@ -3,6 +3,7 @@ import { useBrandPageContainerStore } from '../brand-page-maker/stores/brandpage
|
|
|
3
3
|
// Agent types
|
|
4
4
|
export const AI_ASSISTANT_AGENT_TYPES = {
|
|
5
5
|
WEBSITE_BUILDER: 'website_builder',
|
|
6
|
+
WEBSITE_BUILDER_V2: 'website_builder_v2',
|
|
6
7
|
};
|
|
7
8
|
// Website Endpoints
|
|
8
9
|
export const getWebsiteCreateThreadEndpoint = () => `/api/assistant/thread/website`;
|
|
@@ -17,6 +17,16 @@ const MAX_SNAPSHOT_HEIGHT_MOBILE = 2560;
|
|
|
17
17
|
// down-then-up resample blur you'd get from scaling smaller (OpenAI upscales
|
|
18
18
|
// the short side back to 768 regardless) while keeping the payload tight.
|
|
19
19
|
const SNAPSHOT_TARGET_WIDTH = 768;
|
|
20
|
+
// Upper bound on the pre-capture network waits: the fonts/images race and
|
|
21
|
+
// each YouTube thumbnail fetch. The snapshot is best-effort context for the
|
|
22
|
+
// AI request behind it — no wait may block that send indefinitely (BTS-1608).
|
|
23
|
+
const IMAGE_WAIT_TIMEOUT_MS = 5000;
|
|
24
|
+
// html2canvas's per-resource load budget (its default is 15s). Kept separate
|
|
25
|
+
// from — and looser than — IMAGE_WAIT_TIMEOUT_MS: it decides whether a
|
|
26
|
+
// legitimately slow image renders at all (lazy images skipped by the pre-wait
|
|
27
|
+
// rely entirely on html2canvas's own fetch), so it trades a longer capture
|
|
28
|
+
// for fidelity rather than gating the send outright.
|
|
29
|
+
const HTML2CANVAS_IMAGE_TIMEOUT_MS = 10000;
|
|
20
30
|
/**
|
|
21
31
|
* Extracts the YouTube video id from an embed URL, or null for non-YouTube
|
|
22
32
|
* iframes. Handles youtube.com/embed/<id> and youtube-nocookie.com variants.
|
|
@@ -33,7 +43,9 @@ function getYouTubeId(src) {
|
|
|
33
43
|
async function fetchYouTubeThumbnail(id) {
|
|
34
44
|
for (const quality of ['maxresdefault', 'hqdefault']) {
|
|
35
45
|
try {
|
|
36
|
-
|
|
46
|
+
// Bounded: a stalled thumbnail fetch must not block the capture (and
|
|
47
|
+
// the AI send behind it) — on timeout the embed renders blank instead.
|
|
48
|
+
const response = await fetch(`https://img.youtube.com/vi/${id}/${quality}.jpg`, { signal: AbortSignal.timeout(IMAGE_WAIT_TIMEOUT_MS) });
|
|
37
49
|
if (!response.ok)
|
|
38
50
|
continue;
|
|
39
51
|
const blob = await response.blob();
|
|
@@ -46,8 +58,15 @@ async function fetchYouTubeThumbnail(id) {
|
|
|
46
58
|
reader.readAsDataURL(blob);
|
|
47
59
|
});
|
|
48
60
|
}
|
|
49
|
-
catch {
|
|
50
|
-
|
|
61
|
+
catch (error) {
|
|
62
|
+
// A timeout means the network is stalled, not that this quality is
|
|
63
|
+
// missing — retrying the next quality would arm a fresh 5s budget per
|
|
64
|
+
// attempt and compound across embeds. Give up on this video instead.
|
|
65
|
+
if (error instanceof Error &&
|
|
66
|
+
(error.name === 'TimeoutError' || error.name === 'AbortError')) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/* non-abort failure (network error, CORS) — try next quality */
|
|
51
70
|
}
|
|
52
71
|
}
|
|
53
72
|
return null;
|
|
@@ -101,12 +120,29 @@ export function useSnapshot() {
|
|
|
101
120
|
// Wait for fonts and in-flight images to finish before capturing —
|
|
102
121
|
// otherwise html2canvas snapshots a half-rendered page (missing images,
|
|
103
122
|
// fallback fonts) and the measured content height is wrong.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
//
|
|
124
|
+
// Wait only on images the browser is actually fetching. `loading="lazy"`
|
|
125
|
+
// images below the fold are never fetched (neither load nor error ever
|
|
126
|
+
// fires), so awaiting them can never settle and the AI message send
|
|
127
|
+
// gated behind this capture never fires (BTS-1608). Skipping them is
|
|
128
|
+
// safe: html2canvas fetches the clone's images itself (eagerly), so
|
|
129
|
+
// they still render in the capture.
|
|
130
|
+
const pendingImages = Array.from(element.querySelectorAll('img')).filter((img) => !img.complete && img.loading !== 'lazy');
|
|
131
|
+
// Capped as a backstop: the snapshot is best-effort context — a stalled
|
|
132
|
+
// image fetch or font load must never block the send behind it.
|
|
133
|
+
let waitTimer;
|
|
134
|
+
await Promise.race([
|
|
135
|
+
Promise.all([
|
|
136
|
+
document.fonts?.ready,
|
|
137
|
+
...pendingImages.map((img) => new Promise((resolve) => {
|
|
138
|
+
img.onload = img.onerror = () => resolve();
|
|
139
|
+
})),
|
|
140
|
+
]),
|
|
141
|
+
new Promise((resolve) => {
|
|
142
|
+
waitTimer = setTimeout(resolve, IMAGE_WAIT_TIMEOUT_MS);
|
|
143
|
+
}),
|
|
144
|
+
]);
|
|
145
|
+
clearTimeout(waitTimer);
|
|
110
146
|
// The maker renders the full website inside `.c-preview-container`
|
|
111
147
|
// (position: fixed + transform: scale). The page background — solid
|
|
112
148
|
// colour, gradient, or image — lives on `.brand-page-root-background`,
|
|
@@ -195,6 +231,9 @@ export function useSnapshot() {
|
|
|
195
231
|
useCORS: true,
|
|
196
232
|
scale, // fit the full page into the vision model's image budget
|
|
197
233
|
logging: false,
|
|
234
|
+
// Bound html2canvas's own per-image resource loading so a slow asset
|
|
235
|
+
// can't stall the capture; timed-out images render blank.
|
|
236
|
+
imageTimeout: HTML2CANVAS_IMAGE_TIMEOUT_MS,
|
|
198
237
|
backgroundColor: '#ffffff',
|
|
199
238
|
// Capture the full page, not just the scroll viewport.
|
|
200
239
|
height: captureHeight,
|
package/lib/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as s, a as I, b as S, c as N, d as e, e as A, f as O, B as t, g as C, h as G, i as D, j as P, k as R, l as o, m as L, n as M, o as r, p as n, q as b, r as i, s as l, t as F, u as c, v as g, w as B, x as Y, y as U, z as d, C as u, D as H, E as p, F as y, G as m, H as K, I as k, J as V, K as X, L as v, M as h, N as x, O as f, P as W, Q as z, R as w, S as J, T as Z, U as j, V as q, W as Q, X as $, Y as aa, Z as Ta, $ as _a, a0 as Ea, a1 as sa, a2 as Ia, a3 as Sa, a4 as Na, a5 as ea, a6 as Aa, a7 as Oa, a8 as ta, a9 as Ca, aa as Ga, ab as Da, ac as Pa, ad as Ra, ae as oa, af as La, ag as Ma, ah as ra, ai as na, aj as ba, ak as ia, al as la, am as Fa, an as ca, ao as ga, ap as Ba, aq as Ya, ar as Ua, as as da, at as ua, au as Ha, av as pa, aw as ya, ax as ma, ay as Ka, az as ka, aA as Va, aB as Xa, aC as va, aD as ha, aE as xa, aF as fa, aG as Wa, aH as za, aI as wa, aJ as Ja, aK as Za, aL as ja, aM as qa, aN as Qa, aO as $a, aP as aT, aQ as TT, aR as _T, aS as ET, aT as sT, aU as IT, aV as ST, aW as NT, aX as eT, aY as AT, aZ as OT, a_ as tT, a$ as CT, b0 as GT, b1 as DT, b2 as PT, b3 as RT, b4 as oT, b5 as LT, b6 as MT, b7 as rT, b8 as nT, b9 as bT, ba as iT, bb as lT, bc as FT, bd as cT, be as gT, bf as BT, bg as YT, bh as UT, bi as dT, bj as uT, bk as HT, bl as pT, bm as yT, bn as mT, bo as KT, bp as kT, bq as VT, br as XT, bs as vT, bt as hT, bu as xT, bv as fT, bw as WT, bx as zT, by as wT, bz as JT, bA as ZT, bB as jT, bC as qT, bD as QT, bE as $T, bF as a_, bG as T_, bH as __, bI as E_, bJ as s_, bK as I_, bL as S_, bM as N_, bN as e_, bO as A_, bP as O_, bQ as t_, bR as C_, bS as G_, bT as D_, bU as P_, bV as R_, bW as o_, bX as L_, bY as M_, bZ as r_, b_ as n_, b$ as b_, c0 as i_, c1 as l_, c2 as F_, c3 as c_, c4 as g_, c5 as B_, c6 as Y_, c7 as U_, c8 as d_, c9 as u_, ca as H_, cb as p_, cc as y_, cd as m_, ce as K_, cf as k_, cg as V_, ch as X_, ci as v_, cj as h_, ck as x_, cl as f_, cm as W_, cn as z_, co as w_, cp as J_, cq as Z_, cr as j_, cs as q_, ct as Q_, cu as $_, cv as aE, cw as TE, cx as _E, cy as EE } from "./lib-
|
|
1
|
+
import { A as s, a as I, b as S, c as N, d as e, e as A, f as O, B as t, g as C, h as G, i as D, j as P, k as R, l as o, m as L, n as M, o as r, p as n, q as b, r as i, s as l, t as F, u as c, v as g, w as B, x as Y, y as U, z as d, C as u, D as H, E as p, F as y, G as m, H as K, I as k, J as V, K as X, L as v, M as h, N as x, O as f, P as W, Q as z, R as w, S as J, T as Z, U as j, V as q, W as Q, X as $, Y as aa, Z as Ta, $ as _a, a0 as Ea, a1 as sa, a2 as Ia, a3 as Sa, a4 as Na, a5 as ea, a6 as Aa, a7 as Oa, a8 as ta, a9 as Ca, aa as Ga, ab as Da, ac as Pa, ad as Ra, ae as oa, af as La, ag as Ma, ah as ra, ai as na, aj as ba, ak as ia, al as la, am as Fa, an as ca, ao as ga, ap as Ba, aq as Ya, ar as Ua, as as da, at as ua, au as Ha, av as pa, aw as ya, ax as ma, ay as Ka, az as ka, aA as Va, aB as Xa, aC as va, aD as ha, aE as xa, aF as fa, aG as Wa, aH as za, aI as wa, aJ as Ja, aK as Za, aL as ja, aM as qa, aN as Qa, aO as $a, aP as aT, aQ as TT, aR as _T, aS as ET, aT as sT, aU as IT, aV as ST, aW as NT, aX as eT, aY as AT, aZ as OT, a_ as tT, a$ as CT, b0 as GT, b1 as DT, b2 as PT, b3 as RT, b4 as oT, b5 as LT, b6 as MT, b7 as rT, b8 as nT, b9 as bT, ba as iT, bb as lT, bc as FT, bd as cT, be as gT, bf as BT, bg as YT, bh as UT, bi as dT, bj as uT, bk as HT, bl as pT, bm as yT, bn as mT, bo as KT, bp as kT, bq as VT, br as XT, bs as vT, bt as hT, bu as xT, bv as fT, bw as WT, bx as zT, by as wT, bz as JT, bA as ZT, bB as jT, bC as qT, bD as QT, bE as $T, bF as a_, bG as T_, bH as __, bI as E_, bJ as s_, bK as I_, bL as S_, bM as N_, bN as e_, bO as A_, bP as O_, bQ as t_, bR as C_, bS as G_, bT as D_, bU as P_, bV as R_, bW as o_, bX as L_, bY as M_, bZ as r_, b_ as n_, b$ as b_, c0 as i_, c1 as l_, c2 as F_, c3 as c_, c4 as g_, c5 as B_, c6 as Y_, c7 as U_, c8 as d_, c9 as u_, ca as H_, cb as p_, cc as y_, cd as m_, ce as K_, cf as k_, cg as V_, ch as X_, ci as v_, cj as h_, ck as x_, cl as f_, cm as W_, cn as z_, co as w_, cp as J_, cq as Z_, cr as j_, cs as q_, ct as Q_, cu as $_, cv as aE, cw as TE, cx as _E, cy as EE } from "./lib-tqkEs_fX.js";
|
|
2
2
|
import { U as IE, u as SE } from "./useEventTracker-DmQ6AkNn.js";
|
|
3
3
|
import "vue";
|
|
4
4
|
import "vue-cropperjs";
|