rivia 0.0.15 → 0.0.16

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 +19 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2839,6 +2839,22 @@ var RIVIA_TOUR = function() {
2839
2839
  }
2840
2840
  function nextStep() {
2841
2841
  if (STATE.tourIndex < STATE.tips.length - 1) {
2842
+ let getNextStepInfo3 = function(currentIndex2) {
2843
+ if (currentIndex2 >= STATE.tips.length - 1) {
2844
+ return { type: "end", index: currentIndex2 };
2845
+ }
2846
+ const nextStep2 = STATE.tips[currentIndex2 + 1];
2847
+ if (!nextStep2) return { type: "end", index: currentIndex2 };
2848
+ if (nextStep2.targetUrl && nextStep2.targetUrl.trim()) {
2849
+ console.log("WE reached navigation");
2850
+ return { type: "navigate", index: currentIndex2 + 1, url: nextStep2.targetUrl };
2851
+ }
2852
+ if (isStepAvailableOnCurrentPage(nextStep2)) {
2853
+ return { type: "show", index: currentIndex2 + 1 };
2854
+ }
2855
+ return getNextStepInfo3(currentIndex2 + 1);
2856
+ };
2857
+ var getNextStepInfo2 = getNextStepInfo3;
2842
2858
  const currentIndex = STATE.tourIndex;
2843
2859
  STATE.tourIndex++;
2844
2860
  const nextStepData = STATE.tips[STATE.tourIndex];
@@ -2857,22 +2873,7 @@ var RIVIA_TOUR = function() {
2857
2873
  window.location.href = navUrl;
2858
2874
  return;
2859
2875
  }
2860
- async function getNextStepInfo2(currentIndex2) {
2861
- if (currentIndex2 >= STATE.tips.length - 1) {
2862
- return { type: "end", index: currentIndex2 };
2863
- }
2864
- const nextStep2 = STATE.tips[currentIndex2 + 1];
2865
- if (!nextStep2) return { type: "end", index: currentIndex2 };
2866
- if (nextStep2.targetUrl && nextStep2.targetUrl.trim()) {
2867
- console.log("WE reached navigation");
2868
- return { type: "navigate", index: currentIndex2 + 1, url: nextStep2.targetUrl };
2869
- }
2870
- if (isStepAvailableOnCurrentPage(nextStep2)) {
2871
- return { type: "show", index: currentIndex2 + 1 };
2872
- }
2873
- return getNextStepInfo2(currentIndex2 + 1);
2874
- }
2875
- const nextStepInfo = getNextStepInfo2(currentIndex);
2876
+ const nextStepInfo = getNextStepInfo3(currentIndex);
2876
2877
  if (nextStepInfo.type === "navigate") {
2877
2878
  sessionStorage.setItem("rivia_tour_state", JSON.stringify({
2878
2879
  tourIndex: nextStepInfo.index,
@@ -2908,12 +2909,12 @@ var RIVIA_TOUR = function() {
2908
2909
  }
2909
2910
  return getNextStepInfo(currentIndex + 1);
2910
2911
  }
2911
- async function isStepAvailableOnCurrentPage(step) {
2912
+ function isStepAvailableOnCurrentPage(step) {
2912
2913
  if (!step) return false;
2913
2914
  if (!step.targetUrl || !step.targetUrl.trim()) return true;
2914
2915
  return urlMatches(step.targetUrl);
2915
2916
  }
2916
- async function urlMatches(pattern, currentUrl = window.location.href) {
2917
+ function urlMatches(pattern, currentUrl = window.location.href) {
2917
2918
  if (!pattern || !pattern.trim()) return true;
2918
2919
  const cleanPattern = pattern.trim();
2919
2920
  const cleanUrl = currentUrl.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivia",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",