veo-sdk 0.3.4 → 0.3.6
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-MIPJRGOD.mjs +5 -0
- package/dist/{builder-LXIR3WMJ.mjs.map → builder-MIPJRGOD.mjs.map} +1 -1
- package/dist/builder.cjs +257 -45
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-IKFTO7MX.mjs → chunk-A73VSAZP.mjs} +4 -4
- package/dist/chunk-A73VSAZP.mjs.map +1 -0
- package/dist/{chunk-R4E3LIDB.mjs → chunk-B5GO6PTO.mjs} +3 -3
- package/dist/{chunk-R4E3LIDB.mjs.map → chunk-B5GO6PTO.mjs.map} +1 -1
- package/dist/{chunk-GHP7ZJCW.mjs → chunk-FUMGOQJR.mjs} +258 -46
- package/dist/chunk-FUMGOQJR.mjs.map +1 -0
- package/dist/index.cjs +268 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/veo-builder.js +48 -15
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +43 -10
- package/dist/veo-guides.js.map +1 -1
- package/dist/veo.js +2 -2
- package/dist/veo.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-LXIR3WMJ.mjs +0 -5
- package/dist/chunk-GHP7ZJCW.mjs.map +0 -1
- package/dist/chunk-IKFTO7MX.mjs.map +0 -1
|
@@ -25,6 +25,8 @@ function hasNavigatorSendBeacon() {
|
|
|
25
25
|
|
|
26
26
|
// src/core/builder-token.ts
|
|
27
27
|
var CTX_KEY = "veo:builder_ctx";
|
|
28
|
+
var LS_PREFIX = "veo:builder_ctx:";
|
|
29
|
+
var PERSIST_TTL_MS = 12 * 60 * 60 * 1e3;
|
|
28
30
|
function session() {
|
|
29
31
|
try {
|
|
30
32
|
return window.sessionStorage;
|
|
@@ -32,6 +34,59 @@ function session() {
|
|
|
32
34
|
return null;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
function local() {
|
|
38
|
+
try {
|
|
39
|
+
return window.localStorage;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function lsKey(guide) {
|
|
45
|
+
return LS_PREFIX + (guide || "default");
|
|
46
|
+
}
|
|
47
|
+
function persist(ctx) {
|
|
48
|
+
try {
|
|
49
|
+
session()?.setItem(CTX_KEY, JSON.stringify(ctx));
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const stored = { ...ctx, savedAt: Date.now() };
|
|
54
|
+
local()?.setItem(lsKey(ctx.guide), JSON.stringify(stored));
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function readFreshFromLocal() {
|
|
59
|
+
const store = local();
|
|
60
|
+
if (!store) return null;
|
|
61
|
+
let best = null;
|
|
62
|
+
try {
|
|
63
|
+
for (let i = 0; i < store.length; i++) {
|
|
64
|
+
const key = store.key(i);
|
|
65
|
+
if (!key?.startsWith(LS_PREFIX)) continue;
|
|
66
|
+
const raw = store.getItem(key);
|
|
67
|
+
if (!raw) continue;
|
|
68
|
+
let parsed = null;
|
|
69
|
+
try {
|
|
70
|
+
parsed = JSON.parse(raw);
|
|
71
|
+
} catch {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (typeof parsed?.savedAt !== "number" || Date.now() - parsed.savedAt > PERSIST_TTL_MS) {
|
|
75
|
+
try {
|
|
76
|
+
store.removeItem(key);
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (!best || parsed.savedAt > best.savedAt) best = parsed;
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (!best) return null;
|
|
87
|
+
const { savedAt: _savedAt, ...ctx } = best;
|
|
88
|
+
return ctx;
|
|
89
|
+
}
|
|
35
90
|
function urlParams() {
|
|
36
91
|
try {
|
|
37
92
|
return new URLSearchParams(window.location.search);
|
|
@@ -51,18 +106,22 @@ function resolveBuilderContext() {
|
|
|
51
106
|
guide: params?.get(BUILDER_GUIDE_PARAM) ?? null,
|
|
52
107
|
panelPath: params?.get(BUILDER_PANEL_PATH_PARAM) ?? null
|
|
53
108
|
};
|
|
54
|
-
|
|
55
|
-
session()?.setItem(CTX_KEY, JSON.stringify(ctx));
|
|
56
|
-
} catch {
|
|
57
|
-
}
|
|
109
|
+
persist(ctx);
|
|
58
110
|
return ctx;
|
|
59
111
|
}
|
|
60
112
|
try {
|
|
61
113
|
const raw = session()?.getItem(CTX_KEY);
|
|
62
|
-
|
|
114
|
+
if (raw) return JSON.parse(raw);
|
|
63
115
|
} catch {
|
|
64
|
-
return null;
|
|
65
116
|
}
|
|
117
|
+
const fromLocal = readFreshFromLocal();
|
|
118
|
+
if (fromLocal) {
|
|
119
|
+
try {
|
|
120
|
+
session()?.setItem(CTX_KEY, JSON.stringify(fromLocal));
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return fromLocal;
|
|
66
125
|
}
|
|
67
126
|
function resolveBuilderToken() {
|
|
68
127
|
return resolveBuilderContext()?.token ?? null;
|
|
@@ -72,10 +131,20 @@ function isBuilderMode() {
|
|
|
72
131
|
}
|
|
73
132
|
function clearBuilderToken() {
|
|
74
133
|
if (!hasWindow()) return;
|
|
134
|
+
let guide = null;
|
|
135
|
+
try {
|
|
136
|
+
const raw = session()?.getItem(CTX_KEY);
|
|
137
|
+
if (raw) guide = JSON.parse(raw).guide ?? null;
|
|
138
|
+
} catch {
|
|
139
|
+
}
|
|
75
140
|
try {
|
|
76
141
|
session()?.removeItem(CTX_KEY);
|
|
77
142
|
} catch {
|
|
78
143
|
}
|
|
144
|
+
try {
|
|
145
|
+
local()?.removeItem(lsKey(guide));
|
|
146
|
+
} catch {
|
|
147
|
+
}
|
|
79
148
|
}
|
|
80
149
|
|
|
81
150
|
// src/plugins/guides/constants.ts
|
|
@@ -131,14 +200,17 @@ function buildStepContent(step, doc, callbacks) {
|
|
|
131
200
|
actions.appendChild(cta);
|
|
132
201
|
}
|
|
133
202
|
container.appendChild(actions);
|
|
203
|
+
container.appendChild(createCloseButton(doc, () => callbacks.onDismiss()));
|
|
204
|
+
return container;
|
|
205
|
+
}
|
|
206
|
+
function createCloseButton(doc, onClose, className = "veo-guide-close") {
|
|
134
207
|
const closeBtn = doc.createElement("button");
|
|
135
208
|
closeBtn.type = "button";
|
|
136
|
-
closeBtn.className =
|
|
209
|
+
closeBtn.className = className;
|
|
137
210
|
closeBtn.setAttribute("aria-label", "Cerrar");
|
|
138
211
|
closeBtn.textContent = "\xD7";
|
|
139
|
-
closeBtn.addEventListener("click",
|
|
140
|
-
|
|
141
|
-
return container;
|
|
212
|
+
closeBtn.addEventListener("click", onClose);
|
|
213
|
+
return closeBtn;
|
|
142
214
|
}
|
|
143
215
|
function isSafeUrl(url) {
|
|
144
216
|
if (typeof url !== "string" || url.length === 0) return false;
|
|
@@ -168,6 +240,16 @@ var ALIGN_JUSTIFY = {
|
|
|
168
240
|
center: "center",
|
|
169
241
|
right: "flex-end"
|
|
170
242
|
};
|
|
243
|
+
var ALIGN_SELF = {
|
|
244
|
+
left: "flex-start",
|
|
245
|
+
center: "center",
|
|
246
|
+
right: "flex-end"
|
|
247
|
+
};
|
|
248
|
+
var ELEMENT_ALIGN_MODE = {
|
|
249
|
+
title: "text",
|
|
250
|
+
text: "text",
|
|
251
|
+
image: "self"
|
|
252
|
+
};
|
|
171
253
|
var SHADOW = {
|
|
172
254
|
none: "none",
|
|
173
255
|
soft: "0 4px 14px rgba(0, 0, 0, 0.10)",
|
|
@@ -236,6 +318,43 @@ function applyDesignVars(host, style) {
|
|
|
236
318
|
host.style.setProperty("--veo-pos-x", `${px * 100}%`);
|
|
237
319
|
host.style.setProperty("--veo-pos-y", `${py * 100}%`);
|
|
238
320
|
}
|
|
321
|
+
if (s.elements && typeof s.elements === "object") {
|
|
322
|
+
const el = s.elements;
|
|
323
|
+
applyElementVars(host, "title", el.title);
|
|
324
|
+
applyElementVars(host, "text", el.text);
|
|
325
|
+
applyElementVars(host, "image", el.image);
|
|
326
|
+
const cta = el.cta;
|
|
327
|
+
if (cta && typeof cta.align === "string" && ALIGN_JUSTIFY[cta.align]) {
|
|
328
|
+
host.style.setProperty("--veo-actions-justify", ALIGN_JUSTIFY[cta.align]);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function applyElementVars(host, prefix, raw) {
|
|
333
|
+
if (!raw || typeof raw !== "object") return;
|
|
334
|
+
const el = raw;
|
|
335
|
+
if (typeof el.align === "string" && (el.align === "left" || el.align === "center" || el.align === "right")) {
|
|
336
|
+
const mode = ELEMENT_ALIGN_MODE[prefix] ?? "text";
|
|
337
|
+
const value = mode === "self" ? ALIGN_SELF[el.align] : el.align;
|
|
338
|
+
host.style.setProperty(`--veo-${prefix}-align`, value);
|
|
339
|
+
}
|
|
340
|
+
if (typeof el.color === "string" && COLOR_RE.test(el.color.trim())) {
|
|
341
|
+
host.style.setProperty(`--veo-${prefix}-color`, el.color.trim());
|
|
342
|
+
}
|
|
343
|
+
if (typeof el.fontSize === "number" && Number.isFinite(el.fontSize)) {
|
|
344
|
+
host.style.setProperty(`--veo-${prefix}-size`, `${clamp(el.fontSize, 8, 72)}px`);
|
|
345
|
+
}
|
|
346
|
+
if (typeof el.width === "number" && Number.isFinite(el.width)) {
|
|
347
|
+
host.style.setProperty(`--veo-${prefix}-width`, `${clamp(el.width, 10, 100)}%`);
|
|
348
|
+
}
|
|
349
|
+
if (typeof el.radius === "number" && Number.isFinite(el.radius)) {
|
|
350
|
+
host.style.setProperty(`--veo-${prefix}-radius`, `${clamp(el.radius, 0, 48)}px`);
|
|
351
|
+
}
|
|
352
|
+
if (typeof el.marginTop === "number" && Number.isFinite(el.marginTop)) {
|
|
353
|
+
host.style.setProperty(`--veo-${prefix}-mt`, `${clamp(el.marginTop, 0, 64)}px`);
|
|
354
|
+
}
|
|
355
|
+
if (typeof el.marginBottom === "number" && Number.isFinite(el.marginBottom)) {
|
|
356
|
+
host.style.setProperty(`--veo-${prefix}-mb`, `${clamp(el.marginBottom, 0, 64)}px`);
|
|
357
|
+
}
|
|
239
358
|
}
|
|
240
359
|
|
|
241
360
|
// src/plugins/guides/styles.ts
|
|
@@ -302,6 +421,15 @@ var GUIDE_STYLES = `
|
|
|
302
421
|
box-shadow: var(--veo-shadow, 0 8px 30px rgba(0, 0, 0, 0.18));
|
|
303
422
|
animation: veo-fade-in 150ms ease-out;
|
|
304
423
|
}
|
|
424
|
+
.veo-tooltip-arrow {
|
|
425
|
+
position: absolute;
|
|
426
|
+
width: 12px;
|
|
427
|
+
height: 12px;
|
|
428
|
+
background: var(--veo-bg);
|
|
429
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
430
|
+
transform: rotate(45deg);
|
|
431
|
+
pointer-events: none;
|
|
432
|
+
}
|
|
305
433
|
|
|
306
434
|
.veo-inline {
|
|
307
435
|
background: var(--veo-bg);
|
|
@@ -320,17 +448,25 @@ var GUIDE_STYLES = `
|
|
|
320
448
|
display: flex; flex-direction: column;
|
|
321
449
|
}
|
|
322
450
|
.veo-guide-image {
|
|
323
|
-
display: block;
|
|
324
|
-
|
|
325
|
-
|
|
451
|
+
display: block;
|
|
452
|
+
width: var(--veo-image-width, 100%);
|
|
453
|
+
max-height: 180px;
|
|
454
|
+
object-fit: cover;
|
|
455
|
+
align-self: var(--veo-image-align, stretch);
|
|
456
|
+
border-radius: var(--veo-image-radius, 8px);
|
|
457
|
+
margin: var(--veo-image-mt, 0) 0 var(--veo-image-mb, 12px);
|
|
326
458
|
}
|
|
327
459
|
.veo-guide-title {
|
|
328
|
-
font-size: 18px; font-weight: 600; line-height: 1.3;
|
|
329
|
-
|
|
460
|
+
font-size: var(--veo-title-size, 18px); font-weight: 600; line-height: 1.3;
|
|
461
|
+
text-align: var(--veo-title-align, left);
|
|
462
|
+
margin: var(--veo-title-mt, 0) 0 var(--veo-title-mb, 6px);
|
|
463
|
+
color: var(--veo-title-color, var(--veo-text));
|
|
330
464
|
}
|
|
331
465
|
.veo-guide-text {
|
|
332
|
-
font-size: 14px; line-height: 1.5;
|
|
333
|
-
|
|
466
|
+
font-size: var(--veo-text-size, 14px); line-height: 1.5;
|
|
467
|
+
text-align: var(--veo-text-align, left);
|
|
468
|
+
margin: var(--veo-text-mt, 0) 0 var(--veo-text-mb, 16px);
|
|
469
|
+
color: var(--veo-text-color, var(--veo-text-secondary));
|
|
334
470
|
}
|
|
335
471
|
.veo-guide-actions {
|
|
336
472
|
display: flex; gap: 8px; justify-content: var(--veo-actions-justify);
|
|
@@ -467,6 +603,7 @@ var GUIDE_STYLES = `
|
|
|
467
603
|
}
|
|
468
604
|
.veo-custom-inline {
|
|
469
605
|
display: block;
|
|
606
|
+
position: relative;
|
|
470
607
|
margin: 12px 0;
|
|
471
608
|
}
|
|
472
609
|
.veo-custom-frame {
|
|
@@ -476,6 +613,21 @@ var GUIDE_STYLES = `
|
|
|
476
613
|
background: transparent;
|
|
477
614
|
color-scheme: normal;
|
|
478
615
|
}
|
|
616
|
+
/*
|
|
617
|
+
* X de cerrar de las gu\xEDas custom: el HTML del cliente vive en un iframe
|
|
618
|
+
* sandbox, as\xED que el bot\xF3n lo pone el host POR ENCIMA del iframe. Con fondo
|
|
619
|
+
* propio para ser visible sobre cualquier contenido.
|
|
620
|
+
*/
|
|
621
|
+
.veo-custom-close {
|
|
622
|
+
position: absolute; top: 6px; right: 6px; z-index: 1;
|
|
623
|
+
width: 22px; height: 22px; padding: 0;
|
|
624
|
+
display: flex; align-items: center; justify-content: center;
|
|
625
|
+
font-size: 16px; line-height: 1; color: #6b7280;
|
|
626
|
+
background: rgba(255, 255, 255, 0.92);
|
|
627
|
+
border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 50%;
|
|
628
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); cursor: pointer;
|
|
629
|
+
}
|
|
630
|
+
.veo-custom-close:hover { color: #111827; }
|
|
479
631
|
|
|
480
632
|
@keyframes veo-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
481
633
|
@keyframes veo-slide-up {
|
|
@@ -648,7 +800,11 @@ function mountCustomFrame(doc, step, context, opts) {
|
|
|
648
800
|
const hasFixedHeight = opts.fixedHeight !== void 0 && opts.fixedHeight !== null;
|
|
649
801
|
if (hasFixedHeight) iframe.style.height = toCssSize(opts.fixedHeight);
|
|
650
802
|
const token = uuidv7();
|
|
651
|
-
|
|
803
|
+
const wantsTailwind = step.style?.tailwind === true;
|
|
804
|
+
iframe.srcdoc = buildSrcdoc(step.html ?? "", step.css ?? "", step.js ?? "", token, {
|
|
805
|
+
tokens: collectHostTokens(),
|
|
806
|
+
tailwind: wantsTailwind
|
|
807
|
+
});
|
|
652
808
|
const close = () => context.onClose();
|
|
653
809
|
const onMessage = (event) => {
|
|
654
810
|
if (event.source !== iframe.contentWindow) return;
|
|
@@ -697,12 +853,37 @@ function mountCustomFrame(doc, step, context, opts) {
|
|
|
697
853
|
function toCssSize(value) {
|
|
698
854
|
return typeof value === "number" ? `${value}px` : value;
|
|
699
855
|
}
|
|
856
|
+
function collectHostTokens() {
|
|
857
|
+
if (typeof window === "undefined" || typeof document === "undefined") return "";
|
|
858
|
+
try {
|
|
859
|
+
const rootStyle = getComputedStyle(document.documentElement);
|
|
860
|
+
const decls = [];
|
|
861
|
+
const seen = /* @__PURE__ */ new Set();
|
|
862
|
+
for (let i = 0; i < rootStyle.length && decls.length < 400; i++) {
|
|
863
|
+
const name = rootStyle.item(i);
|
|
864
|
+
if (!name.startsWith("--") || seen.has(name)) continue;
|
|
865
|
+
seen.add(name);
|
|
866
|
+
const value = rootStyle.getPropertyValue(name).trim();
|
|
867
|
+
if (!value || value.length > 200 || /[<>{}]/.test(value)) continue;
|
|
868
|
+
decls.push(`${name}:${value}`);
|
|
869
|
+
}
|
|
870
|
+
const bodyFont = getComputedStyle(document.body).fontFamily;
|
|
871
|
+
if (bodyFont && bodyFont.length <= 200 && !/[<>{}]/.test(bodyFont)) {
|
|
872
|
+
decls.push(`--veo-host-font:${bodyFont}`);
|
|
873
|
+
}
|
|
874
|
+
return decls.length ? `:root{${decls.join(";")}}` : "";
|
|
875
|
+
} catch {
|
|
876
|
+
return "";
|
|
877
|
+
}
|
|
878
|
+
}
|
|
700
879
|
function isRecord(value) {
|
|
701
880
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
702
881
|
}
|
|
703
|
-
function buildSrcdoc(html, css, js, token) {
|
|
882
|
+
function buildSrcdoc(html, css, js, token, opts) {
|
|
704
883
|
const bridge = `(function(){var T=${JSON.stringify(token)};function P(m){m.__veo=T;parent.postMessage(m,'*');}window.veo={dismiss:function(){P({type:'dismiss'});},cta:function(u){P({type:'cta',url:u});},track:function(n,p){P({type:'track',name:n,props:p||{}});},navigate:function(u){P({type:'navigate',url:u});}};document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a)return;var h=a.getAttribute('href');if(!h||h.charAt(0)==='#'||/^(javascript|mailto|tel):/i.test(h))return;e.preventDefault();if(a.target==='_blank'){P({type:'cta',url:a.href,close:false});}else{P({type:'navigate',url:h});}},true);function H(){P({type:'resize',height:Math.ceil(document.documentElement.scrollHeight)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){new ResizeObserver(H).observe(document.documentElement);}}catch(e){}})();`;
|
|
705
|
-
|
|
884
|
+
const tokensStyle = opts.tokens ? `<style>${escapeClosing(opts.tokens, "style")}</style>` : "";
|
|
885
|
+
const tailwind = opts.tailwind ? '<script src="https://cdn.tailwindcss.com"></script>' : "";
|
|
886
|
+
return '<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;font-family:var(--veo-host-font,system-ui,sans-serif);}</style>' + tokensStyle + tailwind + `<style>${escapeClosing(css, "style")}</style></head><body>${html}<script>${bridge}</script>` + (js ? `<script>${escapeClosing(js, "script")}</script>` : "") + "</body></html>";
|
|
706
887
|
}
|
|
707
888
|
function escapeClosing(code, tag) {
|
|
708
889
|
const rx = tag === "script" ? /<\/script/gi : /<\/style/gi;
|
|
@@ -735,6 +916,20 @@ var CustomRenderer = class extends BaseRenderer {
|
|
|
735
916
|
});
|
|
736
917
|
this.registerCleanup(cleanup);
|
|
737
918
|
wrapper.appendChild(iframe);
|
|
919
|
+
wrapper.appendChild(
|
|
920
|
+
createCloseButton(
|
|
921
|
+
doc,
|
|
922
|
+
() => {
|
|
923
|
+
context.onInteraction({
|
|
924
|
+
guideId: context.guide.guideId,
|
|
925
|
+
stepIndex: 0,
|
|
926
|
+
action: "dismissed"
|
|
927
|
+
});
|
|
928
|
+
context.onClose();
|
|
929
|
+
},
|
|
930
|
+
"veo-custom-close"
|
|
931
|
+
)
|
|
932
|
+
);
|
|
738
933
|
root.appendChild(wrapper);
|
|
739
934
|
if (placement.mode === "floating") {
|
|
740
935
|
applyFloatingPosition(wrapper, placement);
|
|
@@ -872,13 +1067,7 @@ function mountFormContent(card, context, doc) {
|
|
|
872
1067
|
});
|
|
873
1068
|
});
|
|
874
1069
|
content.appendChild(form);
|
|
875
|
-
|
|
876
|
-
closeBtn.type = "button";
|
|
877
|
-
closeBtn.className = "veo-guide-close";
|
|
878
|
-
closeBtn.setAttribute("aria-label", "Cerrar");
|
|
879
|
-
closeBtn.textContent = "\xD7";
|
|
880
|
-
closeBtn.addEventListener("click", dismiss);
|
|
881
|
-
content.appendChild(closeBtn);
|
|
1070
|
+
content.appendChild(createCloseButton(doc, dismiss));
|
|
882
1071
|
card.appendChild(content);
|
|
883
1072
|
}
|
|
884
1073
|
function showThanks(card, doc, note) {
|
|
@@ -1142,6 +1331,20 @@ var InlineCustomRenderer = class extends BaseRenderer {
|
|
|
1142
1331
|
const { iframe, cleanup } = mountCustomFrame(doc, step, context, { width: "100%" });
|
|
1143
1332
|
this.registerCleanup(cleanup);
|
|
1144
1333
|
wrapper.appendChild(iframe);
|
|
1334
|
+
wrapper.appendChild(
|
|
1335
|
+
createCloseButton(
|
|
1336
|
+
doc,
|
|
1337
|
+
() => {
|
|
1338
|
+
context.onInteraction({
|
|
1339
|
+
guideId: context.guide.guideId,
|
|
1340
|
+
stepIndex: 0,
|
|
1341
|
+
action: "dismissed"
|
|
1342
|
+
});
|
|
1343
|
+
context.onClose();
|
|
1344
|
+
},
|
|
1345
|
+
"veo-custom-close"
|
|
1346
|
+
)
|
|
1347
|
+
);
|
|
1145
1348
|
root.appendChild(wrapper);
|
|
1146
1349
|
context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
|
|
1147
1350
|
}
|
|
@@ -1249,6 +1452,25 @@ var ModalRenderer = class extends BaseRenderer {
|
|
|
1249
1452
|
});
|
|
1250
1453
|
}
|
|
1251
1454
|
};
|
|
1455
|
+
|
|
1456
|
+
// src/plugins/guides/renderers/floating-arrow.ts
|
|
1457
|
+
var STATIC_SIDE = {
|
|
1458
|
+
top: "bottom",
|
|
1459
|
+
bottom: "top",
|
|
1460
|
+
left: "right",
|
|
1461
|
+
right: "left"
|
|
1462
|
+
};
|
|
1463
|
+
function positionArrow(arrowEl, placement, data) {
|
|
1464
|
+
const side = STATIC_SIDE[placement.split("-")[0] ?? "bottom"] ?? "top";
|
|
1465
|
+
for (const prop of ["top", "bottom", "left", "right"]) {
|
|
1466
|
+
arrowEl.style.setProperty(prop, "");
|
|
1467
|
+
}
|
|
1468
|
+
if (data?.x != null) arrowEl.style.setProperty("left", `${data.x}px`);
|
|
1469
|
+
if (data?.y != null) arrowEl.style.setProperty("top", `${data.y}px`);
|
|
1470
|
+
arrowEl.style.setProperty(side, "-6px");
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
// src/plugins/guides/renderers/tooltip-renderer.ts
|
|
1252
1474
|
var TooltipRenderer = class extends BaseRenderer {
|
|
1253
1475
|
async render(context) {
|
|
1254
1476
|
const step = context.guide.guideSteps[0];
|
|
@@ -1278,14 +1500,18 @@ var TooltipRenderer = class extends BaseRenderer {
|
|
|
1278
1500
|
onDismiss: () => dismiss("dismissed")
|
|
1279
1501
|
});
|
|
1280
1502
|
tooltip.appendChild(content);
|
|
1503
|
+
const arrowEl = ownerDocument.createElement("div");
|
|
1504
|
+
arrowEl.className = "veo-tooltip-arrow";
|
|
1505
|
+
tooltip.appendChild(arrowEl);
|
|
1281
1506
|
root.appendChild(tooltip);
|
|
1282
1507
|
const updatePosition = async () => {
|
|
1283
|
-
const { x, y } = await computePosition(anchor, tooltip, {
|
|
1508
|
+
const { x, y, placement, middlewareData } = await computePosition(anchor, tooltip, {
|
|
1284
1509
|
placement: "bottom",
|
|
1285
|
-
middleware: [offset(
|
|
1510
|
+
middleware: [offset(10), flip(), shift({ padding: 8 }), arrow({ element: arrowEl })]
|
|
1286
1511
|
});
|
|
1287
1512
|
tooltip.style.left = `${x}px`;
|
|
1288
1513
|
tooltip.style.top = `${y}px`;
|
|
1514
|
+
positionArrow(arrowEl, placement, middlewareData.arrow);
|
|
1289
1515
|
};
|
|
1290
1516
|
await updatePosition();
|
|
1291
1517
|
const reposition = () => {
|
|
@@ -1373,6 +1599,7 @@ function buildWalkthroughStepContent(step, stepIndex, totalSteps, doc, callbacks
|
|
|
1373
1599
|
rightGroup.appendChild(primaryBtn);
|
|
1374
1600
|
actions.appendChild(rightGroup);
|
|
1375
1601
|
container.appendChild(actions);
|
|
1602
|
+
container.appendChild(createCloseButton(doc, () => callbacks.onSkip()));
|
|
1376
1603
|
return container;
|
|
1377
1604
|
}
|
|
1378
1605
|
|
|
@@ -1424,21 +1651,6 @@ var WalkthroughRenderer = class extends BaseRenderer {
|
|
|
1424
1651
|
return true;
|
|
1425
1652
|
}
|
|
1426
1653
|
};
|
|
1427
|
-
var STATIC_SIDE = {
|
|
1428
|
-
top: "bottom",
|
|
1429
|
-
bottom: "top",
|
|
1430
|
-
left: "right",
|
|
1431
|
-
right: "left"
|
|
1432
|
-
};
|
|
1433
|
-
function positionArrow(arrowEl, placement, data) {
|
|
1434
|
-
const side = STATIC_SIDE[placement.split("-")[0] ?? "bottom"] ?? "top";
|
|
1435
|
-
for (const prop of ["top", "bottom", "left", "right"]) {
|
|
1436
|
-
arrowEl.style.setProperty(prop, "");
|
|
1437
|
-
}
|
|
1438
|
-
if (data?.x != null) arrowEl.style.setProperty("left", `${data.x}px`);
|
|
1439
|
-
if (data?.y != null) arrowEl.style.setProperty("top", `${data.y}px`);
|
|
1440
|
-
arrowEl.style.setProperty(side, "-6px");
|
|
1441
|
-
}
|
|
1442
1654
|
|
|
1443
1655
|
// src/plugins/guides/guide-preview.ts
|
|
1444
1656
|
var PREVIEW_GUIDE_ID = "__veo_preview__";
|
|
@@ -1743,5 +1955,5 @@ function buildSelectorPath(element, maxAncestors = 5) {
|
|
|
1743
1955
|
}
|
|
1744
1956
|
|
|
1745
1957
|
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 };
|
|
1746
|
-
//# sourceMappingURL=chunk-
|
|
1747
|
-
//# sourceMappingURL=chunk-
|
|
1958
|
+
//# sourceMappingURL=chunk-FUMGOQJR.mjs.map
|
|
1959
|
+
//# sourceMappingURL=chunk-FUMGOQJR.mjs.map
|