veo-sdk 0.5.2 → 0.5.4

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.
@@ -288,7 +288,15 @@ function buildStepContent(step, doc, callbacks) {
288
288
  function buildContentNodes(step, doc) {
289
289
  const blocks = normalizeBlocks(step);
290
290
  if (blocks) {
291
- return blocks.filter((b) => b.type !== "button").map((b) => buildContentBlock(b, doc)).filter((n) => n !== null);
291
+ const nodes2 = [];
292
+ for (const { block, idx } of blocks) {
293
+ if (block.type === "button") continue;
294
+ const node = buildContentBlock(block, doc);
295
+ if (!node) continue;
296
+ node.dataset.veoIdx = String(idx);
297
+ nodes2.push(node);
298
+ }
299
+ return nodes2;
292
300
  }
293
301
  const nodes = [];
294
302
  if (typeof step.imageUrl === "string" && step.imageUrl && isSafeUrl(step.imageUrl)) {
@@ -350,7 +358,8 @@ function renderLegacyStep(container, step, doc, callbacks) {
350
358
  }
351
359
  function normalizeBlocks(step) {
352
360
  if (!Array.isArray(step.blocks) || step.blocks.length === 0) return null;
353
- const valid = step.blocks.filter((b) => {
361
+ const valid = step.blocks.map((block, idx) => ({ block, idx })).filter((entry) => {
362
+ const b = entry.block;
354
363
  if (!b || typeof b !== "object") return false;
355
364
  if (b.type === "image") return typeof b.url === "string" && isSafeUrl(b.url);
356
365
  return b.type === "title" || b.type === "text" || b.type === "button";
@@ -360,13 +369,14 @@ function normalizeBlocks(step) {
360
369
  function renderBlocks(container, blocks, doc, callbacks) {
361
370
  let i = 0;
362
371
  while (i < blocks.length) {
363
- const block = blocks[i];
364
- if (block?.type === "button") {
372
+ const entry = blocks[i];
373
+ if (entry?.block.type === "button") {
365
374
  const actions = doc.createElement("div");
366
375
  actions.className = "veo-guide-actions";
376
+ actions.dataset.veoIdx = String(entry.idx);
367
377
  let rowAlign;
368
- while (i < blocks.length && blocks[i]?.type === "button") {
369
- const btnBlock = blocks[i];
378
+ while (i < blocks.length && blocks[i]?.block.type === "button") {
379
+ const btnBlock = blocks[i].block;
370
380
  if (!rowAlign) {
371
381
  const a = btnBlock.style?.align;
372
382
  if (a === "left" || a === "center" || a === "right") rowAlign = a;
@@ -378,8 +388,11 @@ function renderBlocks(container, blocks, doc, callbacks) {
378
388
  container.appendChild(actions);
379
389
  continue;
380
390
  }
381
- const node = buildContentBlock(block, doc);
382
- if (node) container.appendChild(node);
391
+ const node = entry ? buildContentBlock(entry.block, doc) : null;
392
+ if (node && entry) {
393
+ node.dataset.veoIdx = String(entry.idx);
394
+ container.appendChild(node);
395
+ }
383
396
  i++;
384
397
  }
385
398
  }
@@ -1551,7 +1564,7 @@ var BannerRenderer = class extends BaseRenderer {
1551
1564
  const step = context.guide.guideSteps[idx];
1552
1565
  if (!step) return;
1553
1566
  const position = step.style?.position === "bottom" ? "bottom" : "top";
1554
- const selector = context.nav ? null : step.selector?.trim() ?? null;
1567
+ const selector = step.selector?.trim() || null;
1555
1568
  let anchor = null;
1556
1569
  if (selector) {
1557
1570
  anchor = await waitForElement(selector);
@@ -2831,5 +2844,5 @@ function buildSelectorPath(element, maxAncestors = 5) {
2831
2844
  }
2832
2845
 
2833
2846
  export { ALWAYS_BLOCK_SELECTORS, BadgeRenderer, 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 };
2834
- //# sourceMappingURL=chunk-5QI3UUE5.mjs.map
2835
- //# sourceMappingURL=chunk-5QI3UUE5.mjs.map
2847
+ //# sourceMappingURL=chunk-JPA46JBS.mjs.map
2848
+ //# sourceMappingURL=chunk-JPA46JBS.mjs.map