veo-sdk 0.3.6 → 0.3.8
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/dist/builder-YYMD7MNK.mjs +5 -0
- package/dist/{builder-MIPJRGOD.mjs.map → builder-YYMD7MNK.mjs.map} +1 -1
- package/dist/builder.cjs +267 -112
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.d.cts +2 -2
- package/dist/builder.d.ts +2 -2
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-B5GO6PTO.mjs → chunk-7OMKQH5J.mjs} +34 -4
- package/dist/chunk-7OMKQH5J.mjs.map +1 -0
- package/dist/{chunk-FUMGOQJR.mjs → chunk-E2KQJBUT.mjs} +269 -114
- package/dist/chunk-E2KQJBUT.mjs.map +1 -0
- package/dist/{chunk-A73VSAZP.mjs → chunk-T4BZ53QV.mjs} +3 -3
- package/dist/{chunk-A73VSAZP.mjs.map → chunk-T4BZ53QV.mjs.map} +1 -1
- package/dist/{guide-preview-CO5ShtNf.d.cts → guide-preview-DewCTa-B.d.cts} +26 -1
- package/dist/{guide-preview-CO5ShtNf.d.ts → guide-preview-DewCTa-B.d.ts} +26 -1
- package/dist/index.cjs +306 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -5
- package/dist/veo-builder.js +15 -9
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +10 -4
- package/dist/veo-guides.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-MIPJRGOD.mjs +0 -5
- package/dist/chunk-B5GO6PTO.mjs.map +0 -1
- package/dist/chunk-FUMGOQJR.mjs.map +0 -1
|
@@ -166,6 +166,16 @@ var WALKTHROUGH_STEP_SELECTOR_TIMEOUT_MS = 5e3;
|
|
|
166
166
|
function buildStepContent(step, doc, callbacks) {
|
|
167
167
|
const container = doc.createElement("div");
|
|
168
168
|
container.className = "veo-guide-content";
|
|
169
|
+
const blocks = normalizeBlocks(step);
|
|
170
|
+
if (blocks) {
|
|
171
|
+
renderBlocks(container, blocks, doc, callbacks);
|
|
172
|
+
} else {
|
|
173
|
+
renderLegacyStep(container, step, doc, callbacks);
|
|
174
|
+
}
|
|
175
|
+
container.appendChild(createCloseButton(doc, () => callbacks.onDismiss()));
|
|
176
|
+
return container;
|
|
177
|
+
}
|
|
178
|
+
function renderLegacyStep(container, step, doc, callbacks) {
|
|
169
179
|
if (typeof step.imageUrl === "string" && step.imageUrl && isSafeUrl(step.imageUrl)) {
|
|
170
180
|
const img = doc.createElement("img");
|
|
171
181
|
img.className = "veo-guide-image";
|
|
@@ -200,8 +210,116 @@ function buildStepContent(step, doc, callbacks) {
|
|
|
200
210
|
actions.appendChild(cta);
|
|
201
211
|
}
|
|
202
212
|
container.appendChild(actions);
|
|
203
|
-
|
|
204
|
-
|
|
213
|
+
}
|
|
214
|
+
function normalizeBlocks(step) {
|
|
215
|
+
if (!Array.isArray(step.blocks) || step.blocks.length === 0) return null;
|
|
216
|
+
const valid = step.blocks.filter((b) => {
|
|
217
|
+
if (!b || typeof b !== "object") return false;
|
|
218
|
+
if (b.type === "image") return typeof b.url === "string" && isSafeUrl(b.url);
|
|
219
|
+
return b.type === "title" || b.type === "text" || b.type === "button";
|
|
220
|
+
});
|
|
221
|
+
return valid.length > 0 ? valid : null;
|
|
222
|
+
}
|
|
223
|
+
function renderBlocks(container, blocks, doc, callbacks) {
|
|
224
|
+
let i = 0;
|
|
225
|
+
while (i < blocks.length) {
|
|
226
|
+
const block = blocks[i];
|
|
227
|
+
if (block?.type === "button") {
|
|
228
|
+
const actions = doc.createElement("div");
|
|
229
|
+
actions.className = "veo-guide-actions";
|
|
230
|
+
let rowAlign;
|
|
231
|
+
while (i < blocks.length && blocks[i]?.type === "button") {
|
|
232
|
+
const btnBlock = blocks[i];
|
|
233
|
+
if (!rowAlign) {
|
|
234
|
+
const a = btnBlock.style?.align;
|
|
235
|
+
if (a === "left" || a === "center" || a === "right") rowAlign = a;
|
|
236
|
+
}
|
|
237
|
+
actions.appendChild(buildButtonBlock(btnBlock, doc, callbacks));
|
|
238
|
+
i++;
|
|
239
|
+
}
|
|
240
|
+
if (rowAlign) actions.style.justifyContent = BLOCK_ALIGN_SELF[rowAlign];
|
|
241
|
+
container.appendChild(actions);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const node = buildContentBlock(block, doc);
|
|
245
|
+
if (node) container.appendChild(node);
|
|
246
|
+
i++;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function buildContentBlock(block, doc) {
|
|
250
|
+
switch (block.type) {
|
|
251
|
+
case "title": {
|
|
252
|
+
const el = doc.createElement("h2");
|
|
253
|
+
el.className = "veo-guide-title";
|
|
254
|
+
el.textContent = typeof block.text === "string" ? block.text : "";
|
|
255
|
+
applyBlockStyle(el, block.style, "text");
|
|
256
|
+
return el;
|
|
257
|
+
}
|
|
258
|
+
case "text": {
|
|
259
|
+
const el = doc.createElement("p");
|
|
260
|
+
el.className = "veo-guide-text";
|
|
261
|
+
el.textContent = typeof block.text === "string" ? block.text : "";
|
|
262
|
+
applyBlockStyle(el, block.style, "text");
|
|
263
|
+
return el;
|
|
264
|
+
}
|
|
265
|
+
case "image": {
|
|
266
|
+
if (typeof block.url !== "string" || !isSafeUrl(block.url)) return null;
|
|
267
|
+
const el = doc.createElement("img");
|
|
268
|
+
el.className = "veo-guide-image";
|
|
269
|
+
el.src = block.url;
|
|
270
|
+
el.alt = "";
|
|
271
|
+
applyBlockStyle(el, block.style, "image");
|
|
272
|
+
return el;
|
|
273
|
+
}
|
|
274
|
+
default:
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function buildButtonBlock(block, doc, callbacks) {
|
|
279
|
+
const btn = doc.createElement("button");
|
|
280
|
+
btn.type = "button";
|
|
281
|
+
btn.className = "veo-guide-cta";
|
|
282
|
+
btn.textContent = typeof block.text === "string" && block.text ? block.text : "OK";
|
|
283
|
+
applyBlockStyle(btn, block.style, "button");
|
|
284
|
+
btn.addEventListener("click", () => {
|
|
285
|
+
const action = block.action ?? "dismiss";
|
|
286
|
+
const url = action === "url" && typeof block.url === "string" && isSafeUrl(block.url) ? block.url : void 0;
|
|
287
|
+
callbacks.onCtaClick(action, url);
|
|
288
|
+
});
|
|
289
|
+
return btn;
|
|
290
|
+
}
|
|
291
|
+
var BLOCK_ALIGN_SELF = {
|
|
292
|
+
left: "flex-start",
|
|
293
|
+
center: "center",
|
|
294
|
+
right: "flex-end"
|
|
295
|
+
};
|
|
296
|
+
function clampNum(n, min, max) {
|
|
297
|
+
return Math.min(max, Math.max(min, n));
|
|
298
|
+
}
|
|
299
|
+
function applyBlockStyle(el, style, kind) {
|
|
300
|
+
if (!style || typeof style !== "object") return;
|
|
301
|
+
const s = style;
|
|
302
|
+
const align = typeof s.align === "string" ? s.align : null;
|
|
303
|
+
if (align && (align === "left" || align === "center" || align === "right")) {
|
|
304
|
+
if (kind === "text") el.style.textAlign = align;
|
|
305
|
+
else if (kind === "image") el.style.alignSelf = BLOCK_ALIGN_SELF[align];
|
|
306
|
+
}
|
|
307
|
+
if (kind !== "image" && typeof s.color === "string") el.style.color = s.color;
|
|
308
|
+
if (kind === "text" && typeof s.fontSize === "number" && Number.isFinite(s.fontSize)) {
|
|
309
|
+
el.style.fontSize = `${clampNum(s.fontSize, 8, 72)}px`;
|
|
310
|
+
}
|
|
311
|
+
if (kind === "image" && typeof s.width === "number" && Number.isFinite(s.width)) {
|
|
312
|
+
el.style.width = `${clampNum(s.width, 10, 100)}%`;
|
|
313
|
+
}
|
|
314
|
+
if (kind === "image" && typeof s.radius === "number" && Number.isFinite(s.radius)) {
|
|
315
|
+
el.style.borderRadius = `${clampNum(s.radius, 0, 48)}px`;
|
|
316
|
+
}
|
|
317
|
+
if (typeof s.marginTop === "number" && Number.isFinite(s.marginTop)) {
|
|
318
|
+
el.style.marginTop = `${clampNum(s.marginTop, 0, 64)}px`;
|
|
319
|
+
}
|
|
320
|
+
if (typeof s.marginBottom === "number" && Number.isFinite(s.marginBottom)) {
|
|
321
|
+
el.style.marginBottom = `${clampNum(s.marginBottom, 0, 64)}px`;
|
|
322
|
+
}
|
|
205
323
|
}
|
|
206
324
|
function createCloseButton(doc, onClose, className = "veo-guide-close") {
|
|
207
325
|
const closeBtn = doc.createElement("button");
|
|
@@ -228,6 +346,78 @@ function readCtaUrl(step) {
|
|
|
228
346
|
return isSafeUrl(candidate) ? candidate : void 0;
|
|
229
347
|
}
|
|
230
348
|
|
|
349
|
+
// src/plugins/guides/walkthrough-block-builder.ts
|
|
350
|
+
function buildWalkthroughStepContent(step, stepIndex, totalSteps, doc, callbacks) {
|
|
351
|
+
const container = doc.createElement("div");
|
|
352
|
+
container.className = "veo-guide-content";
|
|
353
|
+
const counter = doc.createElement("div");
|
|
354
|
+
counter.className = "veo-walkthrough-counter";
|
|
355
|
+
counter.textContent = `Paso ${stepIndex + 1} de ${totalSteps}`;
|
|
356
|
+
container.appendChild(counter);
|
|
357
|
+
const progress = doc.createElement("div");
|
|
358
|
+
progress.className = "veo-walkthrough-progress";
|
|
359
|
+
for (let i = 0; i < totalSteps; i++) {
|
|
360
|
+
const dot = doc.createElement("span");
|
|
361
|
+
dot.className = "veo-walkthrough-progress-dot";
|
|
362
|
+
if (i < stepIndex) dot.classList.add("completed");
|
|
363
|
+
if (i === stepIndex) dot.classList.add("active");
|
|
364
|
+
progress.appendChild(dot);
|
|
365
|
+
}
|
|
366
|
+
container.appendChild(progress);
|
|
367
|
+
if (typeof step.imageUrl === "string" && step.imageUrl && isSafeUrl(step.imageUrl)) {
|
|
368
|
+
const img = doc.createElement("img");
|
|
369
|
+
img.className = "veo-guide-image";
|
|
370
|
+
img.src = step.imageUrl;
|
|
371
|
+
img.alt = typeof step.title === "string" ? step.title : "";
|
|
372
|
+
container.appendChild(img);
|
|
373
|
+
}
|
|
374
|
+
if (typeof step.title === "string" && step.title) {
|
|
375
|
+
const heading = doc.createElement("h2");
|
|
376
|
+
heading.className = "veo-guide-title";
|
|
377
|
+
heading.textContent = step.title;
|
|
378
|
+
container.appendChild(heading);
|
|
379
|
+
}
|
|
380
|
+
if (typeof step.content === "string" && step.content) {
|
|
381
|
+
const paragraph = doc.createElement("p");
|
|
382
|
+
paragraph.className = "veo-guide-text";
|
|
383
|
+
paragraph.textContent = step.content;
|
|
384
|
+
container.appendChild(paragraph);
|
|
385
|
+
}
|
|
386
|
+
const actions = doc.createElement("div");
|
|
387
|
+
actions.className = "veo-walkthrough-actions";
|
|
388
|
+
const skipBtn = doc.createElement("button");
|
|
389
|
+
skipBtn.type = "button";
|
|
390
|
+
skipBtn.className = "veo-walkthrough-skip";
|
|
391
|
+
skipBtn.textContent = "Omitir";
|
|
392
|
+
skipBtn.addEventListener("click", () => callbacks.onSkip());
|
|
393
|
+
actions.appendChild(skipBtn);
|
|
394
|
+
const rightGroup = doc.createElement("div");
|
|
395
|
+
rightGroup.className = "veo-walkthrough-actions-right";
|
|
396
|
+
if (stepIndex > 0) {
|
|
397
|
+
const backBtn = doc.createElement("button");
|
|
398
|
+
backBtn.type = "button";
|
|
399
|
+
backBtn.className = "veo-walkthrough-btn-secondary";
|
|
400
|
+
backBtn.textContent = "Atr\xE1s";
|
|
401
|
+
backBtn.addEventListener("click", () => callbacks.onBack());
|
|
402
|
+
rightGroup.appendChild(backBtn);
|
|
403
|
+
}
|
|
404
|
+
const isLastStep = stepIndex === totalSteps - 1;
|
|
405
|
+
const primaryBtn = doc.createElement("button");
|
|
406
|
+
primaryBtn.type = "button";
|
|
407
|
+
primaryBtn.className = "veo-guide-cta";
|
|
408
|
+
const defaultLabel = isLastStep ? "Finalizar" : "Siguiente";
|
|
409
|
+
primaryBtn.textContent = typeof step.ctaText === "string" && step.ctaText ? step.ctaText : defaultLabel;
|
|
410
|
+
primaryBtn.addEventListener("click", () => {
|
|
411
|
+
if (isLastStep) callbacks.onComplete();
|
|
412
|
+
else callbacks.onNext();
|
|
413
|
+
});
|
|
414
|
+
rightGroup.appendChild(primaryBtn);
|
|
415
|
+
actions.appendChild(rightGroup);
|
|
416
|
+
container.appendChild(actions);
|
|
417
|
+
container.appendChild(createCloseButton(doc, () => callbacks.onSkip()));
|
|
418
|
+
return container;
|
|
419
|
+
}
|
|
420
|
+
|
|
231
421
|
// src/plugins/guides/guide-design.ts
|
|
232
422
|
var DARK_THEME = {
|
|
233
423
|
"--veo-bg": "#1f2937",
|
|
@@ -277,6 +467,9 @@ function applyDesignVars(host, style) {
|
|
|
277
467
|
if (typeof s.accentColor === "string" && COLOR_RE.test(s.accentColor.trim())) {
|
|
278
468
|
host.style.setProperty("--veo-primary", s.accentColor.trim());
|
|
279
469
|
}
|
|
470
|
+
if (typeof s.fontFamily === "string" && s.fontFamily.length <= 200 && !/[<>{}]/.test(s.fontFamily)) {
|
|
471
|
+
host.style.setProperty("--veo-font", s.fontFamily.trim());
|
|
472
|
+
}
|
|
280
473
|
if (s.theme === "dark") {
|
|
281
474
|
for (const [key, value] of Object.entries(DARK_THEME)) {
|
|
282
475
|
host.style.setProperty(key, value);
|
|
@@ -370,7 +563,7 @@ var GUIDE_STYLES = `
|
|
|
370
563
|
--veo-actions-justify: flex-end;
|
|
371
564
|
all: initial;
|
|
372
565
|
}
|
|
373
|
-
* { box-sizing: border-box; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
|
|
566
|
+
* { box-sizing: border-box; font-family: var(--veo-font, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif); }
|
|
374
567
|
|
|
375
568
|
.veo-modal-overlay {
|
|
376
569
|
position: fixed; inset: 0;
|
|
@@ -447,6 +640,12 @@ var GUIDE_STYLES = `
|
|
|
447
640
|
position: relative;
|
|
448
641
|
display: flex; flex-direction: column;
|
|
449
642
|
}
|
|
643
|
+
/* Reserva espacio para la \u2715 (esquina sup. derecha) SOLO en el primer bloque:
|
|
644
|
+
as\xED el texto alineado a la derecha no queda tapado por el bot\xF3n de cerrar. */
|
|
645
|
+
.veo-guide-content > .veo-guide-title:first-child,
|
|
646
|
+
.veo-guide-content > .veo-guide-text:first-child {
|
|
647
|
+
padding-right: 20px;
|
|
648
|
+
}
|
|
450
649
|
.veo-guide-image {
|
|
451
650
|
display: block;
|
|
452
651
|
width: var(--veo-image-width, 100%);
|
|
@@ -701,7 +900,8 @@ var BaseRenderer = class {
|
|
|
701
900
|
// src/plugins/guides/renderers/banner-renderer.ts
|
|
702
901
|
var BannerRenderer = class extends BaseRenderer {
|
|
703
902
|
render(context) {
|
|
704
|
-
const
|
|
903
|
+
const idx = context.nav?.stepIndex ?? 0;
|
|
904
|
+
const step = context.guide.guideSteps[idx];
|
|
705
905
|
if (!step) return;
|
|
706
906
|
const { root } = this.createHost();
|
|
707
907
|
this.applyDesign(step.style);
|
|
@@ -710,27 +910,25 @@ var BannerRenderer = class extends BaseRenderer {
|
|
|
710
910
|
const banner = ownerDocument.createElement("div");
|
|
711
911
|
banner.className = `veo-banner veo-banner-${position}`;
|
|
712
912
|
const dismiss = (action, ctaUrl) => {
|
|
713
|
-
context.onInteraction({
|
|
714
|
-
guideId: context.guide.guideId,
|
|
715
|
-
stepIndex: 0,
|
|
716
|
-
action
|
|
717
|
-
});
|
|
913
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action });
|
|
718
914
|
if (ctaUrl) window.open(ctaUrl, "_blank", "noopener,noreferrer");
|
|
719
915
|
context.onClose();
|
|
720
916
|
};
|
|
721
|
-
const content =
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
917
|
+
const content = context.nav ? buildWalkthroughStepContent(
|
|
918
|
+
step,
|
|
919
|
+
context.nav.stepIndex,
|
|
920
|
+
context.nav.totalSteps,
|
|
921
|
+
ownerDocument,
|
|
922
|
+
context.nav.callbacks
|
|
923
|
+
) : buildStepContent(step, ownerDocument, {
|
|
924
|
+
onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
|
|
725
925
|
onDismiss: () => dismiss("dismissed")
|
|
726
926
|
});
|
|
727
927
|
banner.appendChild(content);
|
|
728
928
|
root.appendChild(banner);
|
|
729
|
-
context.
|
|
730
|
-
guideId: context.guide.guideId,
|
|
731
|
-
|
|
732
|
-
action: "shown"
|
|
733
|
-
});
|
|
929
|
+
if (!context.nav) {
|
|
930
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
|
|
931
|
+
}
|
|
734
932
|
}
|
|
735
933
|
};
|
|
736
934
|
|
|
@@ -1410,7 +1608,8 @@ var InlineRenderer = class extends BaseRenderer {
|
|
|
1410
1608
|
// src/plugins/guides/renderers/modal-renderer.ts
|
|
1411
1609
|
var ModalRenderer = class extends BaseRenderer {
|
|
1412
1610
|
render(context) {
|
|
1413
|
-
const
|
|
1611
|
+
const idx = context.nav?.stepIndex ?? 0;
|
|
1612
|
+
const step = context.guide.guideSteps[idx];
|
|
1414
1613
|
if (!step) return;
|
|
1415
1614
|
const { root } = this.createHost();
|
|
1416
1615
|
this.applyDesign(step.style);
|
|
@@ -1420,36 +1619,38 @@ var ModalRenderer = class extends BaseRenderer {
|
|
|
1420
1619
|
const card = ownerDocument.createElement("div");
|
|
1421
1620
|
card.className = "veo-modal-card";
|
|
1422
1621
|
const dismiss = (action, ctaUrl) => {
|
|
1423
|
-
context.onInteraction({
|
|
1424
|
-
guideId: context.guide.guideId,
|
|
1425
|
-
stepIndex: 0,
|
|
1426
|
-
action
|
|
1427
|
-
});
|
|
1622
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action });
|
|
1428
1623
|
if (ctaUrl) window.open(ctaUrl, "_blank", "noopener,noreferrer");
|
|
1429
1624
|
context.onClose();
|
|
1430
1625
|
};
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1626
|
+
const onBackdropOrEsc = () => {
|
|
1627
|
+
if (context.nav) context.nav.callbacks.onSkip();
|
|
1628
|
+
else dismiss("dismissed");
|
|
1629
|
+
};
|
|
1630
|
+
const content = context.nav ? buildWalkthroughStepContent(
|
|
1631
|
+
step,
|
|
1632
|
+
context.nav.stepIndex,
|
|
1633
|
+
context.nav.totalSteps,
|
|
1634
|
+
ownerDocument,
|
|
1635
|
+
context.nav.callbacks
|
|
1636
|
+
) : buildStepContent(step, ownerDocument, {
|
|
1637
|
+
onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
|
|
1435
1638
|
onDismiss: () => dismiss("dismissed")
|
|
1436
1639
|
});
|
|
1437
1640
|
card.appendChild(content);
|
|
1438
1641
|
overlay.appendChild(card);
|
|
1439
1642
|
root.appendChild(overlay);
|
|
1440
1643
|
overlay.addEventListener("click", (e) => {
|
|
1441
|
-
if (e.target === overlay)
|
|
1644
|
+
if (e.target === overlay) onBackdropOrEsc();
|
|
1442
1645
|
});
|
|
1443
1646
|
const onKey = (e) => {
|
|
1444
|
-
if (e.key === "Escape")
|
|
1647
|
+
if (e.key === "Escape") onBackdropOrEsc();
|
|
1445
1648
|
};
|
|
1446
1649
|
document.addEventListener("keydown", onKey);
|
|
1447
1650
|
this.registerCleanup(() => document.removeEventListener("keydown", onKey));
|
|
1448
|
-
context.
|
|
1449
|
-
guideId: context.guide.guideId,
|
|
1450
|
-
|
|
1451
|
-
action: "shown"
|
|
1452
|
-
});
|
|
1651
|
+
if (!context.nav) {
|
|
1652
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
|
|
1653
|
+
}
|
|
1453
1654
|
}
|
|
1454
1655
|
};
|
|
1455
1656
|
|
|
@@ -1479,6 +1680,8 @@ var TooltipRenderer = class extends BaseRenderer {
|
|
|
1479
1680
|
if (typeof selector !== "string" || selector.length === 0) return;
|
|
1480
1681
|
const anchor = await waitForElement(selector);
|
|
1481
1682
|
if (!anchor) return;
|
|
1683
|
+
const rawSide = step.style?.tooltipPlacement;
|
|
1684
|
+
const side = rawSide === "top" || rawSide === "left" || rawSide === "right" ? rawSide : "bottom";
|
|
1482
1685
|
const { root } = this.createHost();
|
|
1483
1686
|
this.applyDesign(step.style);
|
|
1484
1687
|
const ownerDocument = root.ownerDocument ?? document;
|
|
@@ -1506,7 +1709,7 @@ var TooltipRenderer = class extends BaseRenderer {
|
|
|
1506
1709
|
root.appendChild(tooltip);
|
|
1507
1710
|
const updatePosition = async () => {
|
|
1508
1711
|
const { x, y, placement, middlewareData } = await computePosition(anchor, tooltip, {
|
|
1509
|
-
placement:
|
|
1712
|
+
placement: side,
|
|
1510
1713
|
middleware: [offset(10), flip(), shift({ padding: 8 }), arrow({ element: arrowEl })]
|
|
1511
1714
|
});
|
|
1512
1715
|
tooltip.style.left = `${x}px`;
|
|
@@ -1530,80 +1733,6 @@ var TooltipRenderer = class extends BaseRenderer {
|
|
|
1530
1733
|
});
|
|
1531
1734
|
}
|
|
1532
1735
|
};
|
|
1533
|
-
|
|
1534
|
-
// src/plugins/guides/walkthrough-block-builder.ts
|
|
1535
|
-
function buildWalkthroughStepContent(step, stepIndex, totalSteps, doc, callbacks) {
|
|
1536
|
-
const container = doc.createElement("div");
|
|
1537
|
-
container.className = "veo-guide-content";
|
|
1538
|
-
const counter = doc.createElement("div");
|
|
1539
|
-
counter.className = "veo-walkthrough-counter";
|
|
1540
|
-
counter.textContent = `Paso ${stepIndex + 1} de ${totalSteps}`;
|
|
1541
|
-
container.appendChild(counter);
|
|
1542
|
-
const progress = doc.createElement("div");
|
|
1543
|
-
progress.className = "veo-walkthrough-progress";
|
|
1544
|
-
for (let i = 0; i < totalSteps; i++) {
|
|
1545
|
-
const dot = doc.createElement("span");
|
|
1546
|
-
dot.className = "veo-walkthrough-progress-dot";
|
|
1547
|
-
if (i < stepIndex) dot.classList.add("completed");
|
|
1548
|
-
if (i === stepIndex) dot.classList.add("active");
|
|
1549
|
-
progress.appendChild(dot);
|
|
1550
|
-
}
|
|
1551
|
-
container.appendChild(progress);
|
|
1552
|
-
if (typeof step.imageUrl === "string" && step.imageUrl && isSafeUrl(step.imageUrl)) {
|
|
1553
|
-
const img = doc.createElement("img");
|
|
1554
|
-
img.className = "veo-guide-image";
|
|
1555
|
-
img.src = step.imageUrl;
|
|
1556
|
-
img.alt = typeof step.title === "string" ? step.title : "";
|
|
1557
|
-
container.appendChild(img);
|
|
1558
|
-
}
|
|
1559
|
-
if (typeof step.title === "string" && step.title) {
|
|
1560
|
-
const heading = doc.createElement("h2");
|
|
1561
|
-
heading.className = "veo-guide-title";
|
|
1562
|
-
heading.textContent = step.title;
|
|
1563
|
-
container.appendChild(heading);
|
|
1564
|
-
}
|
|
1565
|
-
if (typeof step.content === "string" && step.content) {
|
|
1566
|
-
const paragraph = doc.createElement("p");
|
|
1567
|
-
paragraph.className = "veo-guide-text";
|
|
1568
|
-
paragraph.textContent = step.content;
|
|
1569
|
-
container.appendChild(paragraph);
|
|
1570
|
-
}
|
|
1571
|
-
const actions = doc.createElement("div");
|
|
1572
|
-
actions.className = "veo-walkthrough-actions";
|
|
1573
|
-
const skipBtn = doc.createElement("button");
|
|
1574
|
-
skipBtn.type = "button";
|
|
1575
|
-
skipBtn.className = "veo-walkthrough-skip";
|
|
1576
|
-
skipBtn.textContent = "Omitir";
|
|
1577
|
-
skipBtn.addEventListener("click", () => callbacks.onSkip());
|
|
1578
|
-
actions.appendChild(skipBtn);
|
|
1579
|
-
const rightGroup = doc.createElement("div");
|
|
1580
|
-
rightGroup.className = "veo-walkthrough-actions-right";
|
|
1581
|
-
if (stepIndex > 0) {
|
|
1582
|
-
const backBtn = doc.createElement("button");
|
|
1583
|
-
backBtn.type = "button";
|
|
1584
|
-
backBtn.className = "veo-walkthrough-btn-secondary";
|
|
1585
|
-
backBtn.textContent = "Atr\xE1s";
|
|
1586
|
-
backBtn.addEventListener("click", () => callbacks.onBack());
|
|
1587
|
-
rightGroup.appendChild(backBtn);
|
|
1588
|
-
}
|
|
1589
|
-
const isLastStep = stepIndex === totalSteps - 1;
|
|
1590
|
-
const primaryBtn = doc.createElement("button");
|
|
1591
|
-
primaryBtn.type = "button";
|
|
1592
|
-
primaryBtn.className = "veo-guide-cta";
|
|
1593
|
-
const defaultLabel = isLastStep ? "Finalizar" : "Siguiente";
|
|
1594
|
-
primaryBtn.textContent = typeof step.ctaText === "string" && step.ctaText ? step.ctaText : defaultLabel;
|
|
1595
|
-
primaryBtn.addEventListener("click", () => {
|
|
1596
|
-
if (isLastStep) callbacks.onComplete();
|
|
1597
|
-
else callbacks.onNext();
|
|
1598
|
-
});
|
|
1599
|
-
rightGroup.appendChild(primaryBtn);
|
|
1600
|
-
actions.appendChild(rightGroup);
|
|
1601
|
-
container.appendChild(actions);
|
|
1602
|
-
container.appendChild(createCloseButton(doc, () => callbacks.onSkip()));
|
|
1603
|
-
return container;
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
// src/plugins/guides/renderers/walkthrough-renderer.ts
|
|
1607
1736
|
var WalkthroughRenderer = class extends BaseRenderer {
|
|
1608
1737
|
async render(context) {
|
|
1609
1738
|
const step = context.guide.guideSteps[context.currentStepIndex];
|
|
@@ -1612,6 +1741,8 @@ var WalkthroughRenderer = class extends BaseRenderer {
|
|
|
1612
1741
|
if (typeof selector !== "string" || selector.length === 0) return false;
|
|
1613
1742
|
const anchor = await waitForElement(selector, WALKTHROUGH_STEP_SELECTOR_TIMEOUT_MS);
|
|
1614
1743
|
if (!anchor) return false;
|
|
1744
|
+
const rawSide = step.style?.tooltipPlacement;
|
|
1745
|
+
const side = rawSide === "top" || rawSide === "left" || rawSide === "right" ? rawSide : "bottom";
|
|
1615
1746
|
const { root } = this.createHost();
|
|
1616
1747
|
this.applyDesign(step.style);
|
|
1617
1748
|
const ownerDocument = root.ownerDocument ?? document;
|
|
@@ -1631,7 +1762,7 @@ var WalkthroughRenderer = class extends BaseRenderer {
|
|
|
1631
1762
|
root.appendChild(tooltip);
|
|
1632
1763
|
const updatePosition = async () => {
|
|
1633
1764
|
const { x, y, placement, middlewareData } = await computePosition(anchor, tooltip, {
|
|
1634
|
-
placement:
|
|
1765
|
+
placement: side,
|
|
1635
1766
|
middleware: [offset(10), flip(), shift({ padding: 8 }), arrow({ element: arrowEl })]
|
|
1636
1767
|
});
|
|
1637
1768
|
tooltip.style.left = `${x}px`;
|
|
@@ -1657,6 +1788,7 @@ var PREVIEW_GUIDE_ID = "__veo_preview__";
|
|
|
1657
1788
|
var GuidePreviewController = class {
|
|
1658
1789
|
constructor() {
|
|
1659
1790
|
this.singleStep = null;
|
|
1791
|
+
/** Renderer del paso de walkthrough activo (walkthrough tooltip o modal/banner). */
|
|
1660
1792
|
this.walkthrough = null;
|
|
1661
1793
|
this.walkthroughGuide = null;
|
|
1662
1794
|
this.walkthroughIndex = 0;
|
|
@@ -1729,7 +1861,6 @@ var GuidePreviewController = class {
|
|
|
1729
1861
|
safeDestroy(this.walkthrough);
|
|
1730
1862
|
this.walkthrough = null;
|
|
1731
1863
|
}
|
|
1732
|
-
const renderer = new WalkthroughRenderer();
|
|
1733
1864
|
const callbacks = {
|
|
1734
1865
|
onNext: () => {
|
|
1735
1866
|
const next = this.walkthroughIndex + 1;
|
|
@@ -1749,6 +1880,30 @@ var GuidePreviewController = class {
|
|
|
1749
1880
|
onSkip: () => this.close(),
|
|
1750
1881
|
onComplete: () => this.close()
|
|
1751
1882
|
};
|
|
1883
|
+
const step = guide.guideSteps[index];
|
|
1884
|
+
const render = step?.style?.render;
|
|
1885
|
+
if (render === "modal" || render === "banner") {
|
|
1886
|
+
const renderer2 = render === "modal" ? new ModalRenderer() : new BannerRenderer();
|
|
1887
|
+
try {
|
|
1888
|
+
renderer2.render({
|
|
1889
|
+
guide,
|
|
1890
|
+
onInteraction: () => {
|
|
1891
|
+
},
|
|
1892
|
+
onClose: () => this.close(),
|
|
1893
|
+
nav: { stepIndex: index, totalSteps: guide.guideSteps.length, callbacks }
|
|
1894
|
+
});
|
|
1895
|
+
} catch {
|
|
1896
|
+
safeDestroy(renderer2);
|
|
1897
|
+
return false;
|
|
1898
|
+
}
|
|
1899
|
+
if (this.walkthroughGuide !== guide) {
|
|
1900
|
+
safeDestroy(renderer2);
|
|
1901
|
+
return false;
|
|
1902
|
+
}
|
|
1903
|
+
this.walkthrough = renderer2;
|
|
1904
|
+
return true;
|
|
1905
|
+
}
|
|
1906
|
+
const renderer = new WalkthroughRenderer();
|
|
1752
1907
|
let success = false;
|
|
1753
1908
|
try {
|
|
1754
1909
|
success = await renderer.render({ guide, currentStepIndex: index, callbacks });
|
|
@@ -1955,5 +2110,5 @@ function buildSelectorPath(element, maxAncestors = 5) {
|
|
|
1955
2110
|
}
|
|
1956
2111
|
|
|
1957
2112
|
export { ALWAYS_BLOCK_SELECTORS, BannerRenderer, CustomRenderer, DEFAULT_AUTOCAPTURE_CONFIG, DEFAULT_TRACKER_BATCH_SIZE, DEFAULT_TRACKER_FLUSH_INTERVAL_MS, DEFAULT_TRACKER_MAX_RETRIES, FREQUENCY_CACHE_KEY_PREFIX, FREQUENCY_CACHE_MAX_ENTRIES, FREQUENCY_CACHE_TTL_MS, FormRenderer, InlineCustomRenderer, InlineFormRenderer, InlineRenderer, MAX_ANCESTORS, ModalRenderer, PRIORITY_ATTRIBUTES, SENSITIVE_ATTRIBUTES, TooltipRenderer, WALKTHROUGH_ABANDONMENT_TIMEOUT_MS, WALKTHROUGH_STATE_KEY_PREFIX, WalkthroughRenderer, buildSelectorPath, clearBuilderToken, closeGuidePreview, filterHumanClasses, hasDocument, hasLocalStorage, hasNavigatorSendBeacon, hasWindow, isBuilderMode, previewGuide, resolveBuilderContext, resolveBuilderToken, uuidv7 };
|
|
1958
|
-
//# sourceMappingURL=chunk-
|
|
1959
|
-
//# sourceMappingURL=chunk-
|
|
2113
|
+
//# sourceMappingURL=chunk-E2KQJBUT.mjs.map
|
|
2114
|
+
//# sourceMappingURL=chunk-E2KQJBUT.mjs.map
|