@usertour/helpers 0.0.59 → 0.0.61
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/__tests__/convert-settings.test.cjs +1257 -0
- package/dist/__tests__/convert-settings.test.d.cts +2 -0
- package/dist/__tests__/convert-settings.test.d.ts +2 -0
- package/dist/__tests__/convert-settings.test.js +874 -0
- package/dist/chunk-XKSTKX45.js +336 -0
- package/dist/convert-settings.cjs +211 -116
- package/dist/convert-settings.js +2 -1
- package/dist/index.cjs +252 -167
- package/dist/index.js +6 -6
- package/package.json +2 -2
- package/dist/chunk-MA5IMKG6.js +0 -248
package/dist/index.cjs
CHANGED
|
@@ -332,128 +332,251 @@ var isFile = (x) => {
|
|
|
332
332
|
return x instanceof File;
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
-
// src/
|
|
336
|
-
var
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const data = mergeThemeDefaultSettings(settings);
|
|
343
|
-
if (settings.mainColor.hover === "Auto") {
|
|
344
|
-
data.mainColor.hover = settings.mainColor.autoHover;
|
|
345
|
-
}
|
|
346
|
-
if (settings.mainColor.active === "Auto") {
|
|
347
|
-
data.mainColor.active = settings.mainColor.autoActive;
|
|
348
|
-
}
|
|
349
|
-
if (settings.brandColor.hover === "Auto") {
|
|
350
|
-
data.brandColor.hover = settings.brandColor.autoHover;
|
|
351
|
-
}
|
|
352
|
-
if (settings.brandColor.active === "Auto") {
|
|
353
|
-
data.brandColor.active = settings.brandColor.autoActive;
|
|
354
|
-
}
|
|
355
|
-
if (settings.border.borderColor === "Auto") {
|
|
356
|
-
data.border.borderColor = settings.mainColor.color;
|
|
357
|
-
}
|
|
358
|
-
if (settings.buttons.primary.textColor.color === "Auto") {
|
|
359
|
-
data.buttons.primary.textColor.color = settings.brandColor.color;
|
|
360
|
-
}
|
|
361
|
-
if (settings.buttons.primary.textColor.hover === "Auto") {
|
|
362
|
-
data.buttons.primary.textColor.hover = settings.brandColor.color;
|
|
363
|
-
}
|
|
364
|
-
if (settings.buttons.primary.textColor.active === "Auto") {
|
|
365
|
-
data.buttons.primary.textColor.active = settings.brandColor.color;
|
|
366
|
-
}
|
|
367
|
-
if (settings.buttons.primary.backgroundColor.background === "Auto") {
|
|
368
|
-
data.buttons.primary.backgroundColor.background = settings.brandColor.background;
|
|
369
|
-
}
|
|
370
|
-
if (settings.buttons.primary.backgroundColor.hover === "Auto") {
|
|
371
|
-
data.buttons.primary.backgroundColor.hover = settings.brandColor.autoHover;
|
|
372
|
-
}
|
|
373
|
-
if (settings.buttons.primary.backgroundColor.active === "Auto") {
|
|
374
|
-
data.buttons.primary.backgroundColor.active = settings.brandColor.autoActive;
|
|
375
|
-
}
|
|
376
|
-
if (settings.buttons.primary.border.color.color === "Auto") {
|
|
377
|
-
data.buttons.primary.border.color.color = settings.brandColor.background;
|
|
378
|
-
}
|
|
379
|
-
if (settings.buttons.primary.border.color.hover === "Auto") {
|
|
380
|
-
data.buttons.primary.border.color.hover = settings.brandColor.autoHover;
|
|
381
|
-
}
|
|
382
|
-
if (settings.buttons.primary.border.color.active === "Auto") {
|
|
383
|
-
data.buttons.primary.border.color.active = settings.brandColor.autoActive;
|
|
384
|
-
}
|
|
385
|
-
if (settings.buttons.secondary.textColor.color === "Auto") {
|
|
386
|
-
data.buttons.secondary.textColor.color = settings.brandColor.background;
|
|
387
|
-
}
|
|
388
|
-
if (settings.buttons.secondary.textColor.hover === "Auto") {
|
|
389
|
-
data.buttons.secondary.textColor.hover = settings.brandColor.background;
|
|
390
|
-
}
|
|
391
|
-
if (settings.buttons.secondary.textColor.active === "Auto") {
|
|
392
|
-
data.buttons.secondary.textColor.active = settings.brandColor.background;
|
|
393
|
-
}
|
|
394
|
-
if (settings.buttons.secondary.backgroundColor.background === "Auto") {
|
|
395
|
-
data.buttons.secondary.backgroundColor.background = settings.mainColor.background;
|
|
396
|
-
}
|
|
397
|
-
if (settings.buttons.secondary.backgroundColor.hover === "Auto") {
|
|
398
|
-
data.buttons.secondary.backgroundColor.hover = settings.mainColor.autoHover;
|
|
399
|
-
}
|
|
400
|
-
if (settings.buttons.secondary.backgroundColor.active === "Auto") {
|
|
401
|
-
data.buttons.secondary.backgroundColor.active = settings.mainColor.autoActive;
|
|
402
|
-
}
|
|
403
|
-
if (settings.buttons.secondary.border.color.color === "Auto") {
|
|
404
|
-
data.buttons.secondary.border.color.color = settings.brandColor.background;
|
|
405
|
-
}
|
|
406
|
-
if (settings.buttons.secondary.border.color.hover === "Auto") {
|
|
407
|
-
data.buttons.secondary.border.color.hover = settings.brandColor.background;
|
|
408
|
-
}
|
|
409
|
-
if (settings.buttons.secondary.border.color.active === "Auto") {
|
|
410
|
-
data.buttons.secondary.border.color.active = settings.brandColor.background;
|
|
411
|
-
}
|
|
412
|
-
if (settings.font.linkColor === "Auto") {
|
|
413
|
-
data.font.linkColor = settings.brandColor.background;
|
|
414
|
-
}
|
|
415
|
-
if (settings.xbutton.color === "Auto") {
|
|
416
|
-
data.xbutton.color = settings.mainColor.color;
|
|
417
|
-
}
|
|
418
|
-
if (((_a = settings == null ? void 0 : settings.progress) == null ? void 0 : _a.color) === "Auto") {
|
|
419
|
-
data.progress.color = settings.brandColor.background;
|
|
420
|
-
}
|
|
421
|
-
if (((_b = settings == null ? void 0 : settings.launcherBeacon) == null ? void 0 : _b.color) === "Auto") {
|
|
422
|
-
data.launcherBeacon.color = settings.brandColor.background;
|
|
423
|
-
}
|
|
424
|
-
if (((_d = (_c = settings == null ? void 0 : settings.launcherIcon) == null ? void 0 : _c.color) == null ? void 0 : _d.color) === "Auto") {
|
|
425
|
-
data.launcherIcon.color.color = settings.brandColor.background;
|
|
426
|
-
}
|
|
427
|
-
if (((_f = (_e = settings == null ? void 0 : settings.launcherIcon) == null ? void 0 : _e.color) == null ? void 0 : _f.hover) === "Auto") {
|
|
428
|
-
data.launcherIcon.color.hover = settings.brandColor.autoHover;
|
|
429
|
-
}
|
|
430
|
-
if (((_h = (_g = settings == null ? void 0 : settings.launcherIcon) == null ? void 0 : _g.color) == null ? void 0 : _h.active) === "Auto") {
|
|
431
|
-
data.launcherIcon.color.active = settings.brandColor.autoActive;
|
|
335
|
+
// src/utils.ts
|
|
336
|
+
var deepClone = (obj) => {
|
|
337
|
+
try {
|
|
338
|
+
return structuredClone(obj);
|
|
339
|
+
} catch (error) {
|
|
340
|
+
console.warn("structuredClone failed, falling back to JSON method:", error);
|
|
341
|
+
return JSON.parse(JSON.stringify(obj));
|
|
432
342
|
}
|
|
433
|
-
|
|
434
|
-
|
|
343
|
+
};
|
|
344
|
+
var parseUrlParams = (url, paramName) => {
|
|
345
|
+
if (!url || !paramName) {
|
|
346
|
+
return null;
|
|
435
347
|
}
|
|
436
|
-
|
|
437
|
-
|
|
348
|
+
try {
|
|
349
|
+
const urlObj = new URL(url);
|
|
350
|
+
const searchParams = new URLSearchParams(urlObj.search);
|
|
351
|
+
if (searchParams.has(paramName)) {
|
|
352
|
+
return searchParams.get(paramName);
|
|
353
|
+
}
|
|
354
|
+
if (urlObj.hash) {
|
|
355
|
+
const hashSearch = urlObj.hash.split("?")[1];
|
|
356
|
+
if (hashSearch) {
|
|
357
|
+
const hashParams = new URLSearchParams(hashSearch);
|
|
358
|
+
if (hashParams.has(paramName)) {
|
|
359
|
+
return hashParams.get(paramName);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return null;
|
|
364
|
+
} catch (error) {
|
|
365
|
+
console.error("Error parsing URL:", error);
|
|
366
|
+
return null;
|
|
438
367
|
}
|
|
439
|
-
|
|
440
|
-
|
|
368
|
+
};
|
|
369
|
+
var wait = (seconds) => {
|
|
370
|
+
if (typeof seconds !== "number" || Number.isNaN(seconds)) {
|
|
371
|
+
return Promise.reject(new Error("Invalid wait time: must be a number"));
|
|
441
372
|
}
|
|
442
|
-
if (
|
|
443
|
-
|
|
373
|
+
if (seconds < 0) {
|
|
374
|
+
return Promise.reject(new Error("Invalid wait time: cannot be negative"));
|
|
444
375
|
}
|
|
445
|
-
if (
|
|
446
|
-
|
|
376
|
+
if (seconds === 0) {
|
|
377
|
+
return Promise.resolve();
|
|
447
378
|
}
|
|
448
|
-
|
|
449
|
-
|
|
379
|
+
return new Promise((resolve, reject) => {
|
|
380
|
+
try {
|
|
381
|
+
setTimeout(resolve, seconds * 1e3);
|
|
382
|
+
} catch (error) {
|
|
383
|
+
reject(error);
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/convert-settings.ts
|
|
389
|
+
var defaultFontFamily = '-apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
|
|
390
|
+
var mergeWithDefaults = (0, import_deepmerge_ts.deepmergeCustom)({
|
|
391
|
+
mergeOthers: (values) => {
|
|
392
|
+
const settingsValue = values[values.length - 1];
|
|
393
|
+
if (settingsValue === null || settingsValue === void 0) {
|
|
394
|
+
return values[0];
|
|
395
|
+
}
|
|
396
|
+
return settingsValue;
|
|
450
397
|
}
|
|
451
|
-
|
|
452
|
-
|
|
398
|
+
});
|
|
399
|
+
var resolveAutoValue = (value, fallback) => {
|
|
400
|
+
if (value === "Auto" || value === void 0 || value === null) {
|
|
401
|
+
return fallback;
|
|
453
402
|
}
|
|
454
|
-
|
|
403
|
+
return value;
|
|
404
|
+
};
|
|
405
|
+
var mergeThemeDefaultSettings = (settings) => {
|
|
406
|
+
const base = deepClone(import_types.defaultSettings);
|
|
407
|
+
return mergeWithDefaults(base, settings);
|
|
408
|
+
};
|
|
409
|
+
var convertSettings = (settings) => {
|
|
410
|
+
const data = mergeThemeDefaultSettings(settings);
|
|
411
|
+
data.mainColor.hover = resolveAutoValue(data.mainColor.hover, data.mainColor.autoHover);
|
|
412
|
+
data.mainColor.active = resolveAutoValue(
|
|
413
|
+
data.mainColor.active,
|
|
414
|
+
data.mainColor.autoActive
|
|
415
|
+
);
|
|
416
|
+
data.brandColor.hover = resolveAutoValue(
|
|
417
|
+
data.brandColor.hover,
|
|
418
|
+
data.brandColor.autoHover
|
|
419
|
+
);
|
|
420
|
+
data.brandColor.active = resolveAutoValue(
|
|
421
|
+
data.brandColor.active,
|
|
422
|
+
data.brandColor.autoActive
|
|
423
|
+
);
|
|
424
|
+
data.border.borderColor = resolveAutoValue(data.border.borderColor, data.mainColor.color);
|
|
425
|
+
data.buttons.primary.textColor.color = resolveAutoValue(
|
|
426
|
+
data.buttons.primary.textColor.color,
|
|
427
|
+
data.brandColor.color
|
|
428
|
+
);
|
|
429
|
+
data.buttons.primary.textColor.hover = resolveAutoValue(
|
|
430
|
+
data.buttons.primary.textColor.hover,
|
|
431
|
+
data.brandColor.color
|
|
432
|
+
);
|
|
433
|
+
data.buttons.primary.textColor.active = resolveAutoValue(
|
|
434
|
+
data.buttons.primary.textColor.active,
|
|
435
|
+
data.brandColor.color
|
|
436
|
+
);
|
|
437
|
+
data.buttons.primary.backgroundColor.background = resolveAutoValue(
|
|
438
|
+
data.buttons.primary.backgroundColor.background,
|
|
439
|
+
data.brandColor.background
|
|
440
|
+
);
|
|
441
|
+
data.buttons.primary.backgroundColor.hover = resolveAutoValue(
|
|
442
|
+
data.buttons.primary.backgroundColor.hover,
|
|
443
|
+
data.brandColor.autoHover
|
|
444
|
+
);
|
|
445
|
+
data.buttons.primary.backgroundColor.active = resolveAutoValue(
|
|
446
|
+
data.buttons.primary.backgroundColor.active,
|
|
447
|
+
data.brandColor.autoActive
|
|
448
|
+
);
|
|
449
|
+
data.buttons.primary.border.color.color = resolveAutoValue(
|
|
450
|
+
data.buttons.primary.border.color.color,
|
|
451
|
+
data.brandColor.background
|
|
452
|
+
);
|
|
453
|
+
data.buttons.primary.border.color.hover = resolveAutoValue(
|
|
454
|
+
data.buttons.primary.border.color.hover,
|
|
455
|
+
data.brandColor.autoHover
|
|
456
|
+
);
|
|
457
|
+
data.buttons.primary.border.color.active = resolveAutoValue(
|
|
458
|
+
data.buttons.primary.border.color.active,
|
|
459
|
+
data.brandColor.autoActive
|
|
460
|
+
);
|
|
461
|
+
data.buttons.secondary.textColor.color = resolveAutoValue(
|
|
462
|
+
data.buttons.secondary.textColor.color,
|
|
463
|
+
data.brandColor.background
|
|
464
|
+
);
|
|
465
|
+
data.buttons.secondary.textColor.hover = resolveAutoValue(
|
|
466
|
+
data.buttons.secondary.textColor.hover,
|
|
467
|
+
data.brandColor.background
|
|
468
|
+
);
|
|
469
|
+
data.buttons.secondary.textColor.active = resolveAutoValue(
|
|
470
|
+
data.buttons.secondary.textColor.active,
|
|
471
|
+
data.brandColor.background
|
|
472
|
+
);
|
|
473
|
+
data.buttons.secondary.backgroundColor.background = resolveAutoValue(
|
|
474
|
+
data.buttons.secondary.backgroundColor.background,
|
|
475
|
+
data.mainColor.background
|
|
476
|
+
);
|
|
477
|
+
data.buttons.secondary.backgroundColor.hover = resolveAutoValue(
|
|
478
|
+
data.buttons.secondary.backgroundColor.hover,
|
|
479
|
+
data.mainColor.autoHover
|
|
480
|
+
);
|
|
481
|
+
data.buttons.secondary.backgroundColor.active = resolveAutoValue(
|
|
482
|
+
data.buttons.secondary.backgroundColor.active,
|
|
483
|
+
data.mainColor.autoActive
|
|
484
|
+
);
|
|
485
|
+
data.buttons.secondary.border.color.color = resolveAutoValue(
|
|
486
|
+
data.buttons.secondary.border.color.color,
|
|
487
|
+
data.brandColor.background
|
|
488
|
+
);
|
|
489
|
+
data.buttons.secondary.border.color.hover = resolveAutoValue(
|
|
490
|
+
data.buttons.secondary.border.color.hover,
|
|
491
|
+
data.brandColor.background
|
|
492
|
+
);
|
|
493
|
+
data.buttons.secondary.border.color.active = resolveAutoValue(
|
|
494
|
+
data.buttons.secondary.border.color.active,
|
|
495
|
+
data.brandColor.background
|
|
496
|
+
);
|
|
497
|
+
data.font.linkColor = resolveAutoValue(data.font.linkColor, data.brandColor.background);
|
|
498
|
+
data.xbutton.color = resolveAutoValue(data.xbutton.color, data.mainColor.color);
|
|
499
|
+
data.progress.color = resolveAutoValue(data.progress.color, data.brandColor.background);
|
|
500
|
+
data.launcherBeacon.color = resolveAutoValue(
|
|
501
|
+
data.launcherBeacon.color,
|
|
502
|
+
data.brandColor.background
|
|
503
|
+
);
|
|
504
|
+
data.launcherIcon.color.color = resolveAutoValue(
|
|
505
|
+
data.launcherIcon.color.color,
|
|
506
|
+
data.brandColor.background
|
|
507
|
+
);
|
|
508
|
+
data.launcherIcon.color.hover = resolveAutoValue(
|
|
509
|
+
data.launcherIcon.color.hover,
|
|
510
|
+
data.brandColor.autoHover
|
|
511
|
+
);
|
|
512
|
+
data.launcherIcon.color.active = resolveAutoValue(
|
|
513
|
+
data.launcherIcon.color.active,
|
|
514
|
+
data.brandColor.autoActive
|
|
515
|
+
);
|
|
516
|
+
data.checklistLauncher.color.color = resolveAutoValue(
|
|
517
|
+
data.checklistLauncher.color.color,
|
|
518
|
+
data.brandColor.color
|
|
519
|
+
);
|
|
520
|
+
data.checklistLauncher.color.background = resolveAutoValue(
|
|
521
|
+
data.checklistLauncher.color.background,
|
|
522
|
+
data.brandColor.background
|
|
523
|
+
);
|
|
524
|
+
data.checklistLauncher.color.hover = resolveAutoValue(
|
|
525
|
+
data.checklistLauncher.color.hover,
|
|
526
|
+
data.brandColor.autoHover
|
|
527
|
+
);
|
|
528
|
+
data.checklistLauncher.color.active = resolveAutoValue(
|
|
529
|
+
data.checklistLauncher.color.active,
|
|
530
|
+
data.brandColor.autoActive
|
|
531
|
+
);
|
|
532
|
+
data.checklistLauncher.counter.color = resolveAutoValue(
|
|
533
|
+
data.checklistLauncher.counter.color,
|
|
534
|
+
data.brandColor.background
|
|
535
|
+
);
|
|
536
|
+
data.checklistLauncher.counter.background = resolveAutoValue(
|
|
537
|
+
data.checklistLauncher.counter.background,
|
|
538
|
+
data.brandColor.color
|
|
539
|
+
);
|
|
540
|
+
data.survey.color = resolveAutoValue(data.survey.color, data.brandColor.background);
|
|
541
|
+
data.launcherButtons.primary.textColor.color = resolveAutoValue(
|
|
542
|
+
data.launcherButtons.primary.textColor.color,
|
|
543
|
+
data.brandColor.color
|
|
544
|
+
);
|
|
545
|
+
data.launcherButtons.primary.textColor.hover = resolveAutoValue(
|
|
546
|
+
data.launcherButtons.primary.textColor.hover,
|
|
547
|
+
data.brandColor.color
|
|
548
|
+
);
|
|
549
|
+
data.launcherButtons.primary.textColor.active = resolveAutoValue(
|
|
550
|
+
data.launcherButtons.primary.textColor.active,
|
|
551
|
+
data.brandColor.color
|
|
552
|
+
);
|
|
553
|
+
data.launcherButtons.primary.backgroundColor.background = resolveAutoValue(
|
|
554
|
+
data.launcherButtons.primary.backgroundColor.background,
|
|
555
|
+
data.brandColor.background
|
|
556
|
+
);
|
|
557
|
+
data.launcherButtons.primary.backgroundColor.hover = resolveAutoValue(
|
|
558
|
+
data.launcherButtons.primary.backgroundColor.hover,
|
|
559
|
+
data.brandColor.autoHover
|
|
560
|
+
);
|
|
561
|
+
data.launcherButtons.primary.backgroundColor.active = resolveAutoValue(
|
|
562
|
+
data.launcherButtons.primary.backgroundColor.active,
|
|
563
|
+
data.brandColor.autoActive
|
|
564
|
+
);
|
|
565
|
+
data.launcherButtons.primary.border.color.color = resolveAutoValue(
|
|
566
|
+
data.launcherButtons.primary.border.color.color,
|
|
567
|
+
data.brandColor.background
|
|
568
|
+
);
|
|
569
|
+
data.launcherButtons.primary.border.color.hover = resolveAutoValue(
|
|
570
|
+
data.launcherButtons.primary.border.color.hover,
|
|
571
|
+
data.brandColor.autoHover
|
|
572
|
+
);
|
|
573
|
+
data.launcherButtons.primary.border.color.active = resolveAutoValue(
|
|
574
|
+
data.launcherButtons.primary.border.color.active,
|
|
575
|
+
data.brandColor.autoActive
|
|
576
|
+
);
|
|
577
|
+
if (data.font.fontFamily === "System font") {
|
|
455
578
|
data.font.fontFamily = defaultFontFamily;
|
|
456
|
-
} else {
|
|
579
|
+
} else if (!data.font.fontFamily.includes("sans-serif")) {
|
|
457
580
|
data.font.fontFamily += ", sans-serif;";
|
|
458
581
|
}
|
|
459
582
|
return data;
|
|
@@ -550,7 +673,22 @@ var convertToCssVars = (settings, type = "tooltip") => {
|
|
|
550
673
|
"--usertour-checkmark-background-color": settings.checklist.checkmarkColor,
|
|
551
674
|
"--usertour-checklist-trigger-height": `${settings.checklistLauncher.height}px`,
|
|
552
675
|
"--usertour-checklist-trigger-hover-background-color": settings.checklistLauncher.color.hover,
|
|
553
|
-
"--usertour-question-color": hexToHSLString(settings.survey.color)
|
|
676
|
+
"--usertour-question-color": hexToHSLString(settings.survey.color),
|
|
677
|
+
"--usertour-launcher-button-height": `${settings.launcherButtons.height}px`,
|
|
678
|
+
"--usertour-launcher-button-width": settings.launcherButtons.width === 0 ? "auto" : `${settings.launcherButtons.width}px`,
|
|
679
|
+
"--usertour-launcher-button-horizontal-padding": `${settings.launcherButtons.px}px`,
|
|
680
|
+
"--usertour-launcher-button-border-radius": `${settings.launcherButtons.borderRadius}px`,
|
|
681
|
+
"--usertour-launcher-button-background-color": settings.launcherButtons.primary.backgroundColor.background,
|
|
682
|
+
"--usertour-launcher-button-hover-background-color": settings.launcherButtons.primary.backgroundColor.hover,
|
|
683
|
+
"--usertour-launcher-button-active-background-color": settings.launcherButtons.primary.backgroundColor.active,
|
|
684
|
+
"--usertour-launcher-button-font-color": settings.launcherButtons.primary.textColor.color,
|
|
685
|
+
"--usertour-launcher-button-hover-font-color": settings.launcherButtons.primary.textColor.hover,
|
|
686
|
+
"--usertour-launcher-button-active-font-color": settings.launcherButtons.primary.textColor.active,
|
|
687
|
+
"--usertour-launcher-button-font-weight": settings.launcherButtons.primary.fontWeight,
|
|
688
|
+
"--usertour-launcher-button-border-width": settings.launcherButtons.primary.border.enabled ? `${settings.launcherButtons.primary.border.borderWidth}px` : "0px",
|
|
689
|
+
"--usertour-launcher-button-border-color": settings.launcherButtons.primary.border.color.color,
|
|
690
|
+
"--usertour-launcher-button-hover-border-color": settings.launcherButtons.primary.border.color.hover,
|
|
691
|
+
"--usertour-launcher-button-active-border-color": settings.launcherButtons.primary.border.color.active
|
|
554
692
|
};
|
|
555
693
|
if (settings.backdrop.highlight.type === "inside") {
|
|
556
694
|
cssMapping["--usertour-backdrop-highlight-inset"] = "inset";
|
|
@@ -1228,59 +1366,6 @@ var replaceUserAttr = (editorContents, userAttributes) => {
|
|
|
1228
1366
|
});
|
|
1229
1367
|
};
|
|
1230
1368
|
|
|
1231
|
-
// src/utils.ts
|
|
1232
|
-
var deepClone = (obj) => {
|
|
1233
|
-
try {
|
|
1234
|
-
return structuredClone(obj);
|
|
1235
|
-
} catch (error) {
|
|
1236
|
-
console.warn("structuredClone failed, falling back to JSON method:", error);
|
|
1237
|
-
return JSON.parse(JSON.stringify(obj));
|
|
1238
|
-
}
|
|
1239
|
-
};
|
|
1240
|
-
var parseUrlParams = (url, paramName) => {
|
|
1241
|
-
if (!url || !paramName) {
|
|
1242
|
-
return null;
|
|
1243
|
-
}
|
|
1244
|
-
try {
|
|
1245
|
-
const urlObj = new URL(url);
|
|
1246
|
-
const searchParams = new URLSearchParams(urlObj.search);
|
|
1247
|
-
if (searchParams.has(paramName)) {
|
|
1248
|
-
return searchParams.get(paramName);
|
|
1249
|
-
}
|
|
1250
|
-
if (urlObj.hash) {
|
|
1251
|
-
const hashSearch = urlObj.hash.split("?")[1];
|
|
1252
|
-
if (hashSearch) {
|
|
1253
|
-
const hashParams = new URLSearchParams(hashSearch);
|
|
1254
|
-
if (hashParams.has(paramName)) {
|
|
1255
|
-
return hashParams.get(paramName);
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
return null;
|
|
1260
|
-
} catch (error) {
|
|
1261
|
-
console.error("Error parsing URL:", error);
|
|
1262
|
-
return null;
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
var wait = (seconds) => {
|
|
1266
|
-
if (typeof seconds !== "number" || Number.isNaN(seconds)) {
|
|
1267
|
-
return Promise.reject(new Error("Invalid wait time: must be a number"));
|
|
1268
|
-
}
|
|
1269
|
-
if (seconds < 0) {
|
|
1270
|
-
return Promise.reject(new Error("Invalid wait time: cannot be negative"));
|
|
1271
|
-
}
|
|
1272
|
-
if (seconds === 0) {
|
|
1273
|
-
return Promise.resolve();
|
|
1274
|
-
}
|
|
1275
|
-
return new Promise((resolve, reject) => {
|
|
1276
|
-
try {
|
|
1277
|
-
setTimeout(resolve, seconds * 1e3);
|
|
1278
|
-
} catch (error) {
|
|
1279
|
-
reject(error);
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
};
|
|
1283
|
-
|
|
1284
1369
|
// src/helper.ts
|
|
1285
1370
|
var import_uuid = require("uuid");
|
|
1286
1371
|
var import_cuid2 = require("@paralleldrive/cuid2");
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,6 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
defaultStep
|
|
6
6
|
} from "./chunk-FW54TSA3.js";
|
|
7
|
-
import {
|
|
8
|
-
deepClone,
|
|
9
|
-
parseUrlParams,
|
|
10
|
-
wait
|
|
11
|
-
} from "./chunk-5C3J4DM2.js";
|
|
12
7
|
import {
|
|
13
8
|
capitalizeFirstLetter,
|
|
14
9
|
filterNullAttributes,
|
|
@@ -80,7 +75,12 @@ import {
|
|
|
80
75
|
convertSettings,
|
|
81
76
|
convertToCssVars,
|
|
82
77
|
mergeThemeDefaultSettings
|
|
83
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-XKSTKX45.js";
|
|
79
|
+
import {
|
|
80
|
+
deepClone,
|
|
81
|
+
parseUrlParams,
|
|
82
|
+
wait
|
|
83
|
+
} from "./chunk-5C3J4DM2.js";
|
|
84
84
|
import {
|
|
85
85
|
generateStateColors,
|
|
86
86
|
hexToHSLString,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usertour/helpers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Utility functions and helpers shared across the UserTour project",
|
|
6
6
|
"homepage": "https://www.usertour.io",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
32
|
-
"@usertour/types": "^0.0.
|
|
32
|
+
"@usertour/types": "^0.0.45",
|
|
33
33
|
"chroma-js": "^3.1.2",
|
|
34
34
|
"class-variance-authority": "^0.4.0",
|
|
35
35
|
"date-fns": "^2.30.0",
|