rivia 0.0.40 → 0.0.42

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 +18 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1204,7 +1204,7 @@ transform: translateY(-20%);
1204
1204
  if (label.style.display !== "none") positionCloseBtn();
1205
1205
  });
1206
1206
  }
1207
- async function Checklist2(checklist_id, user_var) {
1207
+ async function Checklist(checklist_id, user_var) {
1208
1208
  window.checklist_id = checklist_id;
1209
1209
  window.user_var = user_var;
1210
1210
  try {
@@ -1627,7 +1627,7 @@ transform: translateY(-20%);
1627
1627
  throw err;
1628
1628
  }
1629
1629
  }
1630
- var rivia_default = Checklist2;
1630
+ var rivia_default = Checklist;
1631
1631
 
1632
1632
  // src/utils/rivia-tour.js
1633
1633
  var RIVIA_TOUR = function() {
@@ -4061,20 +4061,23 @@ var banner_default = Banner;
4061
4061
 
4062
4062
  // src/utils/trigger-event.js
4063
4063
  var triggerEvent = async (message) => {
4064
- let checklist_id = window.checklist_id;
4065
- let user_name = window.user_var;
4066
4064
  try {
4067
- const response = await fetch("https://staging-demoapi.rivia.ai/trigger-event", {
4068
- method: "POST",
4069
- headers: { "Content-Type": "application/json" },
4070
- body: JSON.stringify({ message, checklist_id, user_name })
4071
- });
4072
- if (!response.ok) throw new Error(`HTTP error!' Status: ${response.status}`);
4073
- sessionStorage.removeItem("onboardingVisited");
4074
- Checklist(checklist_id, user_name);
4075
- const data = await response.json();
4076
- console.log("\u2705 Event triggered:", data);
4077
- 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
+ clean_item = item.url.startsWith("/") ? item.url.slice(1) : item.url;
4071
+ if (!window.storedVisited.includes(clean_item)) {
4072
+ window.storedVisited.push(clean_item);
4073
+ }
4074
+ sessionStorage.setItem("onboardingVisited", JSON.stringify(window.storedVisited));
4075
+ window.updateProgress(window.storedVisited);
4076
+ window.updateProgress2(window.storedVisited);
4077
+ window.updateUIFromVisited();
4078
+ window.uploadVisitedPagesInBackground(window.storedVisited);
4079
+ }
4080
+ }
4078
4081
  } catch (error) {
4079
4082
  console.error("\u274C Error triggering event:", error);
4080
4083
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivia",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",