rivia 0.0.7 → 0.0.9

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 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1149,7 +1149,7 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
1149
1149
  if (label.style.display !== "none") positionCloseBtn();
1150
1150
  });
1151
1151
  }
1152
- async function OnboardingPopup(checklist_id, user_var) {
1152
+ async function Checklist(checklist_id, user_var) {
1153
1153
  try {
1154
1154
  const cachedData = sessionStorage.getItem(`checklist_${checklist_id}`);
1155
1155
  if (cachedData) {
@@ -1174,6 +1174,9 @@ async function OnboardingPopup(checklist_id, user_var) {
1174
1174
  }
1175
1175
  );
1176
1176
  if (!res.ok) {
1177
+ if (res.status === 404) {
1178
+ throw new Error("Invalid checklist id");
1179
+ }
1177
1180
  console.error("\u274C Failed to fetch checklist");
1178
1181
  return;
1179
1182
  }
@@ -1206,7 +1209,7 @@ async function OnboardingPopup(checklist_id, user_var) {
1206
1209
  throw err;
1207
1210
  }
1208
1211
  }
1209
- var rivia_default = OnboardingPopup;
1212
+ var rivia_default = Checklist;
1210
1213
 
1211
1214
  // src/utils/rivia-tour.js
1212
1215
  var RIVIA_TOUR = function() {
@@ -1481,12 +1484,12 @@ var RIVIA_TOUR = function() {
1481
1484
  body: JSON.stringify(payload),
1482
1485
  keepalive: true
1483
1486
  }).then((res) => {
1484
- if (!res.ok) throw new Error(`Upload failed: ${res.status}`);
1487
+ if (res.status === 404) {
1488
+ throw new Error("Invalid tour id");
1489
+ }
1485
1490
  }).catch((err) => {
1486
- console.error("\u26A0\uFE0F Background PUT upload failed:", err);
1487
1491
  });
1488
1492
  } catch (err) {
1489
- console.error("\u274C Error preparing background upload:", err);
1490
1493
  }
1491
1494
  }
1492
1495
  async function loadTips(tourId, user_var) {
@@ -1504,7 +1507,11 @@ var RIVIA_TOUR = function() {
1504
1507
  method: "GET",
1505
1508
  headers: { "Content-Type": "application/json" }
1506
1509
  });
1507
- if (!res.ok) throw new Error("Failed to fetch tour: " + res.statusText);
1510
+ if (!res.ok) {
1511
+ if (res.status === 404) {
1512
+ throw new Error("Invalid tour id");
1513
+ }
1514
+ }
1508
1515
  const data = await res.json();
1509
1516
  STATE.tips = data && data.tour && Array.isArray(data.tour.steps) ? data.tour.steps : [];
1510
1517
  STATE.publish = data.tour.publish;
@@ -3583,7 +3590,9 @@ async function Banner(bannerId, userId) {
3583
3590
  try {
3584
3591
  const response = await fetch(`http://localhost:5000/banners2/${bannerId}`);
3585
3592
  if (!response.ok) {
3586
- throw new Error("Failed to fetch banner");
3593
+ if (response.status === 404) {
3594
+ throw new Error("Invalid Banner id");
3595
+ }
3587
3596
  }
3588
3597
  const data = await response.json();
3589
3598
  if (data && data.banner && data.banner.user_data && data.banner.user_data[userId] && data.banner.user_data[userId].is_completed) {
@@ -3597,7 +3606,7 @@ async function Banner(bannerId, userId) {
3597
3606
  console.log("Fetched banner:", bannerFromBackend);
3598
3607
  return bannerFromBackend;
3599
3608
  } catch (error) {
3600
- console.error("Error fetching banner:", error);
3609
+ console.error("Invalid banner id:", error);
3601
3610
  }
3602
3611
  }
3603
3612
  var banner_default = Banner;
@@ -3610,6 +3619,6 @@ if (typeof window !== "undefined") {
3610
3619
  }
3611
3620
  export {
3612
3621
  banner_default as Banner,
3613
- rivia_default as OnboardingPopup,
3622
+ rivia_default as Checklist,
3614
3623
  rivia_tour_default as tours
3615
3624
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivia",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",