rivia 0.0.26 → 0.0.28

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -250,7 +250,7 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
250
250
  const border = it.color || cssConfig.borderColor1;
251
251
  const bg = it.color || cssConfig.lowerBackgroundColor;
252
252
  return `
253
- <div id="${it.id}"
253
+ <div id="${it.id}"
254
254
  class="onboard-step"
255
255
  style="position: relative; margin-bottom:16px; display:flex; align-items:flex-start; cursor:pointer; background-color:${bg}; padding:8px; border-radius:6px;">
256
256
 
@@ -920,8 +920,6 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
920
920
  const btnPercent2 = showBtn.querySelector("#progressFraction");
921
921
  if (labelPercent2) labelPercent2.textContent = percentText2;
922
922
  if (btnPercent2) btnPercent2.textContent = percentText2;
923
- if (labelPercent2) labelPercent2.style.width = `${progress2}%`;
924
- if (btnPercent2) btnPercent2.style.width = `${progress2}%`;
925
923
  const progressFraction2 = label.querySelector("#progressFraction");
926
924
  if (progressFraction2) {
927
925
  progressFraction2.textContent = `${completed2.length}/${items.length}`;
@@ -991,8 +989,6 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
991
989
  const btnPercent2 = showBtn.querySelector("#progressFraction");
992
990
  if (labelPercent2) labelPercent2.textContent = percentText2;
993
991
  if (btnPercent2) btnPercent2.textContent = percentText2;
994
- if (labelPercent2) labelPercent2.style.width = `${progress2}%`;
995
- if (btnPercent2) btnPercent2.style.width = `${progress2}%`;
996
992
  const progressFraction2 = label.querySelector("#progressFraction");
997
993
  if (progressFraction2) {
998
994
  progressFraction2.textContent = `${completed2.length}/${items.length}`;
@@ -1244,7 +1240,10 @@ var RIVIA_TOUR = function() {
1244
1240
  function restoreTourState() {
1245
1241
  if (typeof window === "undefined") return;
1246
1242
  const tourStateStr2 = window.sessionStorage.getItem("rivia_tour_state");
1247
- if (!tourStateStr2) return;
1243
+ if (!tourStateStr2 || STATE.tour_id) {
1244
+ return;
1245
+ }
1246
+ ;
1248
1247
  try {
1249
1248
  const tourState = JSON.parse(tourStateStr2);
1250
1249
  console.log("Restoring tour state:", tourState);
@@ -1495,10 +1494,10 @@ var RIVIA_TOUR = function() {
1495
1494
  if (!user_var) {
1496
1495
  return;
1497
1496
  }
1498
- if (sessionStorage.getItem("rivia_tour_state"))
1499
- return;
1500
1497
  user_var12 = user_var;
1501
1498
  STATE.tour_id = tourId;
1499
+ if (sessionStorage.getItem("rivia_tour_state"))
1500
+ return;
1502
1501
  console.log("Loading tips for tour ID:", tourId, "and user_var:", user_var12);
1503
1502
  try {
1504
1503
  if (!tourId) console.warn("Tour ID is required");
@@ -1510,6 +1509,7 @@ var RIVIA_TOUR = function() {
1510
1509
  if (res.status === 404) {
1511
1510
  console.warn("Invalid tour id");
1512
1511
  }
1512
+ return;
1513
1513
  }
1514
1514
  const data = await res.json();
1515
1515
  STATE.tips = data && data.tour && Array.isArray(data.tour.steps) ? data.tour.steps : [];
@@ -1518,9 +1518,6 @@ var RIVIA_TOUR = function() {
1518
1518
  const stripTrailing = (p) => p.replace(/\/+$/, "");
1519
1519
  console.log("STATE.url", STATE.url);
1520
1520
  console.log("window.location.pathname", window.location.href);
1521
- if (stripTrailing(STATE.url) !== stripTrailing(window.location.href)) {
1522
- return;
1523
- }
1524
1521
  console.log("user_var", user_var);
1525
1522
  console.log("data.tour?.user_data?.[user_var],", data.tour?.user_data?.[user_var]);
1526
1523
  if (!data.tour?.user_data?.[user_var]) {
@@ -3049,6 +3046,7 @@ var RIVIA_TOUR = function() {
3049
3046
  }
3050
3047
  STATE.savedTourIndex = STATE.tourIndex;
3051
3048
  STATE.isPreviewMode = true;
3049
+ console.log("\u{1F7E2} Starting tour preview mode...", STATE.tourIndex);
3052
3050
  updateUrlStatus();
3053
3051
  console.log("Cleaning up UI elements before preview...");
3054
3052
  document.querySelectorAll("[data-rivia-tip-id]").forEach((n) => n.remove());
@@ -3075,23 +3073,6 @@ var RIVIA_TOUR = function() {
3075
3073
  rightPanel.remove();
3076
3074
  }
3077
3075
  console.log("UI cleanup complete, starting preview...");
3078
- const firstStep = STATE.tips[0];
3079
- if (firstStep && firstStep.targetUrl) {
3080
- const cleanCurrentUrl = cleanUrlForStorage(window.location.href);
3081
- if (firstStep.targetUrl !== cleanCurrentUrl) {
3082
- const navUrl = addTourParamsToUrl(firstStep.targetUrl, STATE.tour_id);
3083
- sessionStorage.setItem("rivia_tour_state", JSON.stringify({
3084
- tourIndex: 0,
3085
- tourId: STATE.tour_id,
3086
- isPreviewMode: true,
3087
- tips: STATE.tips,
3088
- title: STATE.title || "Untitled Tour",
3089
- publish: STATE.publish
3090
- }));
3091
- console.log("\u{1F7E2} Starting preview - navigating to first step targetUrl:", navUrl);
3092
- return;
3093
- }
3094
- }
3095
3076
  showStep(STATE.tourIndex, true);
3096
3077
  }
3097
3078
  function cleanUrlForStorage(url) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivia",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",