rivia 0.0.39 → 0.0.41

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 +21 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -696,6 +696,12 @@ transform: translateY(-20%);
696
696
  }
697
697
  }
698
698
  createS(items.length);
699
+ window.updateUIFromVisited = updateUIFromVisited;
700
+ window.updateProgress = updateProgress;
701
+ window.updateProgress2 = updateProgress2;
702
+ window.storedVisited = storedVisited;
703
+ window.uploadVisitedPagesInBackground = uploadVisitedPagesInBackground;
704
+ window.items = items;
699
705
  const closeBtn = document.createElement("button");
700
706
  closeBtn.id = "tooltip-close-btn";
701
707
  closeBtn.innerHTML = "\u2715";
@@ -1198,7 +1204,7 @@ transform: translateY(-20%);
1198
1204
  if (label.style.display !== "none") positionCloseBtn();
1199
1205
  });
1200
1206
  }
1201
- async function Checklist2(checklist_id, user_var) {
1207
+ async function Checklist(checklist_id, user_var) {
1202
1208
  window.checklist_id = checklist_id;
1203
1209
  window.user_var = user_var;
1204
1210
  try {
@@ -1621,7 +1627,7 @@ transform: translateY(-20%);
1621
1627
  throw err;
1622
1628
  }
1623
1629
  }
1624
- var rivia_default = Checklist2;
1630
+ var rivia_default = Checklist;
1625
1631
 
1626
1632
  // src/utils/rivia-tour.js
1627
1633
  var RIVIA_TOUR = function() {
@@ -4055,20 +4061,20 @@ var banner_default = Banner;
4055
4061
 
4056
4062
  // src/utils/trigger-event.js
4057
4063
  var triggerEvent = async (message) => {
4058
- let checklist_id = window.checklist_id;
4059
- let user_name = window.user_var;
4060
4064
  try {
4061
- const response = await fetch("https://staging-demoapi.rivia.ai/trigger-event", {
4062
- method: "POST",
4063
- headers: { "Content-Type": "application/json" },
4064
- body: JSON.stringify({ message, checklist_id, user_name })
4065
- });
4066
- if (!response.ok) throw new Error(`HTTP error!' Status: ${response.status}`);
4067
- sessionStorage.removeItem("onboardingVisited");
4068
- Checklist(checklist_id, user_name);
4069
- const data = await response.json();
4070
- console.log("\u2705 Event triggered:", data);
4071
- return data;
4065
+ let checklist_id = window.checklist_id;
4066
+ let user_name = window.user_var;
4067
+ for (let item of window.items) {
4068
+ console.log("Comparing:", item.event_name, "with", message);
4069
+ if (item.event_name === message) {
4070
+ window.storedVisited.push(item.url.startsWith("/") ? item.url.slice(1) : item.url);
4071
+ sessionStorage.setItem("onboardingVisited", JSON.stringify(window.storedVisited));
4072
+ window.updateProgress(window.storedVisited);
4073
+ window.updateProgress2(window.storedVisited);
4074
+ window.updateUIFromVisited();
4075
+ window.uploadVisitedPagesInBackground(window.storedVisited);
4076
+ }
4077
+ }
4072
4078
  } catch (error) {
4073
4079
  console.error("\u274C Error triggering event:", error);
4074
4080
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivia",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",