veo-sdk 0.3.6 → 0.3.7
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-7MBMYL26.mjs +5 -0
- package/dist/{builder-MIPJRGOD.mjs.map → builder-7MBMYL26.mjs.map} +1 -1
- package/dist/builder.cjs +249 -110
- 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-FUMGOQJR.mjs → chunk-4VJIILXF.mjs} +251 -112
- package/dist/chunk-4VJIILXF.mjs.map +1 -0
- package/dist/{chunk-A73VSAZP.mjs → chunk-734ORVMM.mjs} +3 -3
- package/dist/{chunk-A73VSAZP.mjs.map → chunk-734ORVMM.mjs.map} +1 -1
- package/dist/{chunk-B5GO6PTO.mjs → chunk-RNHOBE2D.mjs} +34 -4
- package/dist/chunk-RNHOBE2D.mjs.map +1 -0
- 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 +288 -114
- 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 +9 -9
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +4 -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
package/dist/builder.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PreviewGuideInput } from './guide-preview-
|
|
2
|
-
export { a as PreviewHandle, b as PreviewResult, c as closeGuidePreview, p as previewGuide } from './guide-preview-
|
|
1
|
+
import { P as PreviewGuideInput } from './guide-preview-DewCTa-B.cjs';
|
|
2
|
+
export { a as PreviewHandle, b as PreviewResult, c as closeGuidePreview, p as previewGuide } from './guide-preview-DewCTa-B.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Element picker — el "inspeccionar" del navegador, pero del SDK. Corre
|
package/dist/builder.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PreviewGuideInput } from './guide-preview-
|
|
2
|
-
export { a as PreviewHandle, b as PreviewResult, c as closeGuidePreview, p as previewGuide } from './guide-preview-
|
|
1
|
+
import { P as PreviewGuideInput } from './guide-preview-DewCTa-B.js';
|
|
2
|
+
export { a as PreviewHandle, b as PreviewResult, c as closeGuidePreview, p as previewGuide } from './guide-preview-DewCTa-B.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Element picker — el "inspeccionar" del navegador, pero del SDK. Corre
|
package/dist/builder.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import './chunk-
|
|
2
|
-
import { initBuilderMode } from './chunk-
|
|
3
|
-
export { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-
|
|
4
|
-
export { closeGuidePreview, previewGuide } from './chunk-
|
|
1
|
+
import './chunk-RNHOBE2D.mjs';
|
|
2
|
+
import { initBuilderMode } from './chunk-734ORVMM.mjs';
|
|
3
|
+
export { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-734ORVMM.mjs';
|
|
4
|
+
export { closeGuidePreview, previewGuide } from './chunk-4VJIILXF.mjs';
|
|
5
5
|
import './chunk-PTG3BTJE.mjs';
|
|
6
6
|
|
|
7
7
|
// src/builder.ts
|
|
@@ -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,110 @@ 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
|
+
while (i < blocks.length && blocks[i]?.type === "button") {
|
|
231
|
+
const btnBlock = blocks[i];
|
|
232
|
+
actions.appendChild(buildButtonBlock(btnBlock, doc, callbacks));
|
|
233
|
+
i++;
|
|
234
|
+
}
|
|
235
|
+
container.appendChild(actions);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const node = buildContentBlock(block, doc);
|
|
239
|
+
if (node) container.appendChild(node);
|
|
240
|
+
i++;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function buildContentBlock(block, doc) {
|
|
244
|
+
switch (block.type) {
|
|
245
|
+
case "title": {
|
|
246
|
+
const el = doc.createElement("h2");
|
|
247
|
+
el.className = "veo-guide-title";
|
|
248
|
+
el.textContent = typeof block.text === "string" ? block.text : "";
|
|
249
|
+
applyBlockStyle(el, block.style, "text");
|
|
250
|
+
return el;
|
|
251
|
+
}
|
|
252
|
+
case "text": {
|
|
253
|
+
const el = doc.createElement("p");
|
|
254
|
+
el.className = "veo-guide-text";
|
|
255
|
+
el.textContent = typeof block.text === "string" ? block.text : "";
|
|
256
|
+
applyBlockStyle(el, block.style, "text");
|
|
257
|
+
return el;
|
|
258
|
+
}
|
|
259
|
+
case "image": {
|
|
260
|
+
if (typeof block.url !== "string" || !isSafeUrl(block.url)) return null;
|
|
261
|
+
const el = doc.createElement("img");
|
|
262
|
+
el.className = "veo-guide-image";
|
|
263
|
+
el.src = block.url;
|
|
264
|
+
el.alt = "";
|
|
265
|
+
applyBlockStyle(el, block.style, "image");
|
|
266
|
+
return el;
|
|
267
|
+
}
|
|
268
|
+
default:
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function buildButtonBlock(block, doc, callbacks) {
|
|
273
|
+
const btn = doc.createElement("button");
|
|
274
|
+
btn.type = "button";
|
|
275
|
+
btn.className = "veo-guide-cta";
|
|
276
|
+
btn.textContent = typeof block.text === "string" && block.text ? block.text : "OK";
|
|
277
|
+
applyBlockStyle(btn, block.style, "button");
|
|
278
|
+
btn.addEventListener("click", () => {
|
|
279
|
+
const action = block.action ?? "dismiss";
|
|
280
|
+
const url = action === "url" && typeof block.url === "string" && isSafeUrl(block.url) ? block.url : void 0;
|
|
281
|
+
callbacks.onCtaClick(action, url);
|
|
282
|
+
});
|
|
283
|
+
return btn;
|
|
284
|
+
}
|
|
285
|
+
var BLOCK_ALIGN_SELF = {
|
|
286
|
+
left: "flex-start",
|
|
287
|
+
center: "center",
|
|
288
|
+
right: "flex-end"
|
|
289
|
+
};
|
|
290
|
+
function clampNum(n, min, max) {
|
|
291
|
+
return Math.min(max, Math.max(min, n));
|
|
292
|
+
}
|
|
293
|
+
function applyBlockStyle(el, style, kind) {
|
|
294
|
+
if (!style || typeof style !== "object") return;
|
|
295
|
+
const s = style;
|
|
296
|
+
const align = typeof s.align === "string" ? s.align : null;
|
|
297
|
+
if (align && (align === "left" || align === "center" || align === "right")) {
|
|
298
|
+
if (kind === "text") el.style.textAlign = align;
|
|
299
|
+
else el.style.alignSelf = BLOCK_ALIGN_SELF[align];
|
|
300
|
+
}
|
|
301
|
+
if (kind !== "image" && typeof s.color === "string") el.style.color = s.color;
|
|
302
|
+
if (kind === "text" && typeof s.fontSize === "number" && Number.isFinite(s.fontSize)) {
|
|
303
|
+
el.style.fontSize = `${clampNum(s.fontSize, 8, 72)}px`;
|
|
304
|
+
}
|
|
305
|
+
if (kind === "image" && typeof s.width === "number" && Number.isFinite(s.width)) {
|
|
306
|
+
el.style.width = `${clampNum(s.width, 10, 100)}%`;
|
|
307
|
+
}
|
|
308
|
+
if (kind === "image" && typeof s.radius === "number" && Number.isFinite(s.radius)) {
|
|
309
|
+
el.style.borderRadius = `${clampNum(s.radius, 0, 48)}px`;
|
|
310
|
+
}
|
|
311
|
+
if (typeof s.marginTop === "number" && Number.isFinite(s.marginTop)) {
|
|
312
|
+
el.style.marginTop = `${clampNum(s.marginTop, 0, 64)}px`;
|
|
313
|
+
}
|
|
314
|
+
if (typeof s.marginBottom === "number" && Number.isFinite(s.marginBottom)) {
|
|
315
|
+
el.style.marginBottom = `${clampNum(s.marginBottom, 0, 64)}px`;
|
|
316
|
+
}
|
|
205
317
|
}
|
|
206
318
|
function createCloseButton(doc, onClose, className = "veo-guide-close") {
|
|
207
319
|
const closeBtn = doc.createElement("button");
|
|
@@ -228,6 +340,78 @@ function readCtaUrl(step) {
|
|
|
228
340
|
return isSafeUrl(candidate) ? candidate : void 0;
|
|
229
341
|
}
|
|
230
342
|
|
|
343
|
+
// src/plugins/guides/walkthrough-block-builder.ts
|
|
344
|
+
function buildWalkthroughStepContent(step, stepIndex, totalSteps, doc, callbacks) {
|
|
345
|
+
const container = doc.createElement("div");
|
|
346
|
+
container.className = "veo-guide-content";
|
|
347
|
+
const counter = doc.createElement("div");
|
|
348
|
+
counter.className = "veo-walkthrough-counter";
|
|
349
|
+
counter.textContent = `Paso ${stepIndex + 1} de ${totalSteps}`;
|
|
350
|
+
container.appendChild(counter);
|
|
351
|
+
const progress = doc.createElement("div");
|
|
352
|
+
progress.className = "veo-walkthrough-progress";
|
|
353
|
+
for (let i = 0; i < totalSteps; i++) {
|
|
354
|
+
const dot = doc.createElement("span");
|
|
355
|
+
dot.className = "veo-walkthrough-progress-dot";
|
|
356
|
+
if (i < stepIndex) dot.classList.add("completed");
|
|
357
|
+
if (i === stepIndex) dot.classList.add("active");
|
|
358
|
+
progress.appendChild(dot);
|
|
359
|
+
}
|
|
360
|
+
container.appendChild(progress);
|
|
361
|
+
if (typeof step.imageUrl === "string" && step.imageUrl && isSafeUrl(step.imageUrl)) {
|
|
362
|
+
const img = doc.createElement("img");
|
|
363
|
+
img.className = "veo-guide-image";
|
|
364
|
+
img.src = step.imageUrl;
|
|
365
|
+
img.alt = typeof step.title === "string" ? step.title : "";
|
|
366
|
+
container.appendChild(img);
|
|
367
|
+
}
|
|
368
|
+
if (typeof step.title === "string" && step.title) {
|
|
369
|
+
const heading = doc.createElement("h2");
|
|
370
|
+
heading.className = "veo-guide-title";
|
|
371
|
+
heading.textContent = step.title;
|
|
372
|
+
container.appendChild(heading);
|
|
373
|
+
}
|
|
374
|
+
if (typeof step.content === "string" && step.content) {
|
|
375
|
+
const paragraph = doc.createElement("p");
|
|
376
|
+
paragraph.className = "veo-guide-text";
|
|
377
|
+
paragraph.textContent = step.content;
|
|
378
|
+
container.appendChild(paragraph);
|
|
379
|
+
}
|
|
380
|
+
const actions = doc.createElement("div");
|
|
381
|
+
actions.className = "veo-walkthrough-actions";
|
|
382
|
+
const skipBtn = doc.createElement("button");
|
|
383
|
+
skipBtn.type = "button";
|
|
384
|
+
skipBtn.className = "veo-walkthrough-skip";
|
|
385
|
+
skipBtn.textContent = "Omitir";
|
|
386
|
+
skipBtn.addEventListener("click", () => callbacks.onSkip());
|
|
387
|
+
actions.appendChild(skipBtn);
|
|
388
|
+
const rightGroup = doc.createElement("div");
|
|
389
|
+
rightGroup.className = "veo-walkthrough-actions-right";
|
|
390
|
+
if (stepIndex > 0) {
|
|
391
|
+
const backBtn = doc.createElement("button");
|
|
392
|
+
backBtn.type = "button";
|
|
393
|
+
backBtn.className = "veo-walkthrough-btn-secondary";
|
|
394
|
+
backBtn.textContent = "Atr\xE1s";
|
|
395
|
+
backBtn.addEventListener("click", () => callbacks.onBack());
|
|
396
|
+
rightGroup.appendChild(backBtn);
|
|
397
|
+
}
|
|
398
|
+
const isLastStep = stepIndex === totalSteps - 1;
|
|
399
|
+
const primaryBtn = doc.createElement("button");
|
|
400
|
+
primaryBtn.type = "button";
|
|
401
|
+
primaryBtn.className = "veo-guide-cta";
|
|
402
|
+
const defaultLabel = isLastStep ? "Finalizar" : "Siguiente";
|
|
403
|
+
primaryBtn.textContent = typeof step.ctaText === "string" && step.ctaText ? step.ctaText : defaultLabel;
|
|
404
|
+
primaryBtn.addEventListener("click", () => {
|
|
405
|
+
if (isLastStep) callbacks.onComplete();
|
|
406
|
+
else callbacks.onNext();
|
|
407
|
+
});
|
|
408
|
+
rightGroup.appendChild(primaryBtn);
|
|
409
|
+
actions.appendChild(rightGroup);
|
|
410
|
+
container.appendChild(actions);
|
|
411
|
+
container.appendChild(createCloseButton(doc, () => callbacks.onSkip()));
|
|
412
|
+
return container;
|
|
413
|
+
}
|
|
414
|
+
|
|
231
415
|
// src/plugins/guides/guide-design.ts
|
|
232
416
|
var DARK_THEME = {
|
|
233
417
|
"--veo-bg": "#1f2937",
|
|
@@ -277,6 +461,9 @@ function applyDesignVars(host, style) {
|
|
|
277
461
|
if (typeof s.accentColor === "string" && COLOR_RE.test(s.accentColor.trim())) {
|
|
278
462
|
host.style.setProperty("--veo-primary", s.accentColor.trim());
|
|
279
463
|
}
|
|
464
|
+
if (typeof s.fontFamily === "string" && s.fontFamily.length <= 200 && !/[<>{}]/.test(s.fontFamily)) {
|
|
465
|
+
host.style.setProperty("--veo-font", s.fontFamily.trim());
|
|
466
|
+
}
|
|
280
467
|
if (s.theme === "dark") {
|
|
281
468
|
for (const [key, value] of Object.entries(DARK_THEME)) {
|
|
282
469
|
host.style.setProperty(key, value);
|
|
@@ -370,7 +557,7 @@ var GUIDE_STYLES = `
|
|
|
370
557
|
--veo-actions-justify: flex-end;
|
|
371
558
|
all: initial;
|
|
372
559
|
}
|
|
373
|
-
* { box-sizing: border-box; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
|
|
560
|
+
* { box-sizing: border-box; font-family: var(--veo-font, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif); }
|
|
374
561
|
|
|
375
562
|
.veo-modal-overlay {
|
|
376
563
|
position: fixed; inset: 0;
|
|
@@ -701,7 +888,8 @@ var BaseRenderer = class {
|
|
|
701
888
|
// src/plugins/guides/renderers/banner-renderer.ts
|
|
702
889
|
var BannerRenderer = class extends BaseRenderer {
|
|
703
890
|
render(context) {
|
|
704
|
-
const
|
|
891
|
+
const idx = context.nav?.stepIndex ?? 0;
|
|
892
|
+
const step = context.guide.guideSteps[idx];
|
|
705
893
|
if (!step) return;
|
|
706
894
|
const { root } = this.createHost();
|
|
707
895
|
this.applyDesign(step.style);
|
|
@@ -710,27 +898,25 @@ var BannerRenderer = class extends BaseRenderer {
|
|
|
710
898
|
const banner = ownerDocument.createElement("div");
|
|
711
899
|
banner.className = `veo-banner veo-banner-${position}`;
|
|
712
900
|
const dismiss = (action, ctaUrl) => {
|
|
713
|
-
context.onInteraction({
|
|
714
|
-
guideId: context.guide.guideId,
|
|
715
|
-
stepIndex: 0,
|
|
716
|
-
action
|
|
717
|
-
});
|
|
901
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action });
|
|
718
902
|
if (ctaUrl) window.open(ctaUrl, "_blank", "noopener,noreferrer");
|
|
719
903
|
context.onClose();
|
|
720
904
|
};
|
|
721
|
-
const content =
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
905
|
+
const content = context.nav ? buildWalkthroughStepContent(
|
|
906
|
+
step,
|
|
907
|
+
context.nav.stepIndex,
|
|
908
|
+
context.nav.totalSteps,
|
|
909
|
+
ownerDocument,
|
|
910
|
+
context.nav.callbacks
|
|
911
|
+
) : buildStepContent(step, ownerDocument, {
|
|
912
|
+
onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
|
|
725
913
|
onDismiss: () => dismiss("dismissed")
|
|
726
914
|
});
|
|
727
915
|
banner.appendChild(content);
|
|
728
916
|
root.appendChild(banner);
|
|
729
|
-
context.
|
|
730
|
-
guideId: context.guide.guideId,
|
|
731
|
-
|
|
732
|
-
action: "shown"
|
|
733
|
-
});
|
|
917
|
+
if (!context.nav) {
|
|
918
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
|
|
919
|
+
}
|
|
734
920
|
}
|
|
735
921
|
};
|
|
736
922
|
|
|
@@ -1410,7 +1596,8 @@ var InlineRenderer = class extends BaseRenderer {
|
|
|
1410
1596
|
// src/plugins/guides/renderers/modal-renderer.ts
|
|
1411
1597
|
var ModalRenderer = class extends BaseRenderer {
|
|
1412
1598
|
render(context) {
|
|
1413
|
-
const
|
|
1599
|
+
const idx = context.nav?.stepIndex ?? 0;
|
|
1600
|
+
const step = context.guide.guideSteps[idx];
|
|
1414
1601
|
if (!step) return;
|
|
1415
1602
|
const { root } = this.createHost();
|
|
1416
1603
|
this.applyDesign(step.style);
|
|
@@ -1420,36 +1607,38 @@ var ModalRenderer = class extends BaseRenderer {
|
|
|
1420
1607
|
const card = ownerDocument.createElement("div");
|
|
1421
1608
|
card.className = "veo-modal-card";
|
|
1422
1609
|
const dismiss = (action, ctaUrl) => {
|
|
1423
|
-
context.onInteraction({
|
|
1424
|
-
guideId: context.guide.guideId,
|
|
1425
|
-
stepIndex: 0,
|
|
1426
|
-
action
|
|
1427
|
-
});
|
|
1610
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action });
|
|
1428
1611
|
if (ctaUrl) window.open(ctaUrl, "_blank", "noopener,noreferrer");
|
|
1429
1612
|
context.onClose();
|
|
1430
1613
|
};
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1614
|
+
const onBackdropOrEsc = () => {
|
|
1615
|
+
if (context.nav) context.nav.callbacks.onSkip();
|
|
1616
|
+
else dismiss("dismissed");
|
|
1617
|
+
};
|
|
1618
|
+
const content = context.nav ? buildWalkthroughStepContent(
|
|
1619
|
+
step,
|
|
1620
|
+
context.nav.stepIndex,
|
|
1621
|
+
context.nav.totalSteps,
|
|
1622
|
+
ownerDocument,
|
|
1623
|
+
context.nav.callbacks
|
|
1624
|
+
) : buildStepContent(step, ownerDocument, {
|
|
1625
|
+
onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
|
|
1435
1626
|
onDismiss: () => dismiss("dismissed")
|
|
1436
1627
|
});
|
|
1437
1628
|
card.appendChild(content);
|
|
1438
1629
|
overlay.appendChild(card);
|
|
1439
1630
|
root.appendChild(overlay);
|
|
1440
1631
|
overlay.addEventListener("click", (e) => {
|
|
1441
|
-
if (e.target === overlay)
|
|
1632
|
+
if (e.target === overlay) onBackdropOrEsc();
|
|
1442
1633
|
});
|
|
1443
1634
|
const onKey = (e) => {
|
|
1444
|
-
if (e.key === "Escape")
|
|
1635
|
+
if (e.key === "Escape") onBackdropOrEsc();
|
|
1445
1636
|
};
|
|
1446
1637
|
document.addEventListener("keydown", onKey);
|
|
1447
1638
|
this.registerCleanup(() => document.removeEventListener("keydown", onKey));
|
|
1448
|
-
context.
|
|
1449
|
-
guideId: context.guide.guideId,
|
|
1450
|
-
|
|
1451
|
-
action: "shown"
|
|
1452
|
-
});
|
|
1639
|
+
if (!context.nav) {
|
|
1640
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
|
|
1641
|
+
}
|
|
1453
1642
|
}
|
|
1454
1643
|
};
|
|
1455
1644
|
|
|
@@ -1530,80 +1719,6 @@ var TooltipRenderer = class extends BaseRenderer {
|
|
|
1530
1719
|
});
|
|
1531
1720
|
}
|
|
1532
1721
|
};
|
|
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
1722
|
var WalkthroughRenderer = class extends BaseRenderer {
|
|
1608
1723
|
async render(context) {
|
|
1609
1724
|
const step = context.guide.guideSteps[context.currentStepIndex];
|
|
@@ -1657,6 +1772,7 @@ var PREVIEW_GUIDE_ID = "__veo_preview__";
|
|
|
1657
1772
|
var GuidePreviewController = class {
|
|
1658
1773
|
constructor() {
|
|
1659
1774
|
this.singleStep = null;
|
|
1775
|
+
/** Renderer del paso de walkthrough activo (walkthrough tooltip o modal/banner). */
|
|
1660
1776
|
this.walkthrough = null;
|
|
1661
1777
|
this.walkthroughGuide = null;
|
|
1662
1778
|
this.walkthroughIndex = 0;
|
|
@@ -1729,7 +1845,6 @@ var GuidePreviewController = class {
|
|
|
1729
1845
|
safeDestroy(this.walkthrough);
|
|
1730
1846
|
this.walkthrough = null;
|
|
1731
1847
|
}
|
|
1732
|
-
const renderer = new WalkthroughRenderer();
|
|
1733
1848
|
const callbacks = {
|
|
1734
1849
|
onNext: () => {
|
|
1735
1850
|
const next = this.walkthroughIndex + 1;
|
|
@@ -1749,6 +1864,30 @@ var GuidePreviewController = class {
|
|
|
1749
1864
|
onSkip: () => this.close(),
|
|
1750
1865
|
onComplete: () => this.close()
|
|
1751
1866
|
};
|
|
1867
|
+
const step = guide.guideSteps[index];
|
|
1868
|
+
const render = step?.style?.render;
|
|
1869
|
+
if (render === "modal" || render === "banner") {
|
|
1870
|
+
const renderer2 = render === "modal" ? new ModalRenderer() : new BannerRenderer();
|
|
1871
|
+
try {
|
|
1872
|
+
renderer2.render({
|
|
1873
|
+
guide,
|
|
1874
|
+
onInteraction: () => {
|
|
1875
|
+
},
|
|
1876
|
+
onClose: () => this.close(),
|
|
1877
|
+
nav: { stepIndex: index, totalSteps: guide.guideSteps.length, callbacks }
|
|
1878
|
+
});
|
|
1879
|
+
} catch {
|
|
1880
|
+
safeDestroy(renderer2);
|
|
1881
|
+
return false;
|
|
1882
|
+
}
|
|
1883
|
+
if (this.walkthroughGuide !== guide) {
|
|
1884
|
+
safeDestroy(renderer2);
|
|
1885
|
+
return false;
|
|
1886
|
+
}
|
|
1887
|
+
this.walkthrough = renderer2;
|
|
1888
|
+
return true;
|
|
1889
|
+
}
|
|
1890
|
+
const renderer = new WalkthroughRenderer();
|
|
1752
1891
|
let success = false;
|
|
1753
1892
|
try {
|
|
1754
1893
|
success = await renderer.render({ guide, currentStepIndex: index, callbacks });
|
|
@@ -1955,5 +2094,5 @@ function buildSelectorPath(element, maxAncestors = 5) {
|
|
|
1955
2094
|
}
|
|
1956
2095
|
|
|
1957
2096
|
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-
|
|
2097
|
+
//# sourceMappingURL=chunk-4VJIILXF.mjs.map
|
|
2098
|
+
//# sourceMappingURL=chunk-4VJIILXF.mjs.map
|