rivia 0.0.36 → 0.0.39

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.
package/dist/index.js CHANGED
@@ -79,9 +79,9 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
79
79
  user_var1 = "User_" + Math.random().toString(36).substring(2, 8);
80
80
  sessionStorage.setItem(user_var, user_var1);
81
81
  }
82
- const backendUrl = `http://localhost:5000/clients/${checklist_id}/${user_var1}`;
82
+ const backendUrl = `https://demoapi.rivia.ai/clients/${checklist_id}/${user_var1}`;
83
83
  async function getUserProgress22() {
84
- const backendUrl2 = `http://localhost:5000/clients/${checklist_id}/${user_var1}`;
84
+ const backendUrl2 = `https://demoapi.rivia.ai/clients/${checklist_id}/${user_var1}`;
85
85
  try {
86
86
  const res = await fetch(backendUrl2, { credentials: "include" });
87
87
  if (!res.ok) console.warn(`GET failed: ${res.status}`);
@@ -119,7 +119,7 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
119
119
  }
120
120
  storedVisited = sessionStorage.getItem("onboardingVisited");
121
121
  async function getUserProgress22() {
122
- const backendUrl2 = `http://localhost:5000/clients/${checklist_id}/${user_var1}`;
122
+ const backendUrl2 = `https://demoapi.rivia.ai/clients/${checklist_id}/${user_var1}`;
123
123
  try {
124
124
  const res = await fetch(backendUrl2, { credentials: "include" });
125
125
  if (!res.ok) console.warn(`GET failed: ${res.status}`);
@@ -851,7 +851,7 @@ transform: translateY(-20%);
851
851
  function uploadVisitedPagesInBackground(completed2, touched = false) {
852
852
  let activeStepId2 = sessionStorage.getItem("activeStepId") || null;
853
853
  let user_var22 = user_var;
854
- const backendUrl22 = `http://localhost:5000/clients/${checklist_id}`;
854
+ const backendUrl22 = `https://demoapi.rivia.ai/clients/${checklist_id}`;
855
855
  try {
856
856
  const payload = {
857
857
  name: user_var22,
@@ -882,7 +882,7 @@ transform: translateY(-20%);
882
882
  storedVisited = sessionStorage.getItem("onboardingVisited");
883
883
  if (!storedVisited || storedVisited == "[]") {
884
884
  async function getUserProgress22() {
885
- const backendUrl2 = `http://localhost:5000/clients/${checklist_id}/${user_var}`;
885
+ const backendUrl2 = `https://demoapi.rivia.ai/clients/${checklist_id}/${user_var}`;
886
886
  try {
887
887
  const res = await fetch(backendUrl2, { credentials: "include" });
888
888
  if (!res.ok) console.warn(`GET failed: ${res.status}`);
@@ -1198,7 +1198,9 @@ transform: translateY(-20%);
1198
1198
  if (label.style.display !== "none") positionCloseBtn();
1199
1199
  });
1200
1200
  }
1201
- async function Checklist(checklist_id, user_var) {
1201
+ async function Checklist2(checklist_id, user_var) {
1202
+ window.checklist_id = checklist_id;
1203
+ window.user_var = user_var;
1202
1204
  try {
1203
1205
  const cachedData = sessionStorage.getItem(`checklist_${checklist_id}`);
1204
1206
  if (cachedData) {
@@ -1396,7 +1398,7 @@ transform: translateY(-20%);
1396
1398
  return checklist2;
1397
1399
  }
1398
1400
  const res = await fetch(
1399
- `http://localhost:5000/checklists2/${checklist_id}`,
1401
+ `https://demoapi.rivia.ai/checklists2/${checklist_id}`,
1400
1402
  {
1401
1403
  method: "GET",
1402
1404
  headers: { "Content-Type": "application/json" }
@@ -1619,7 +1621,7 @@ transform: translateY(-20%);
1619
1621
  throw err;
1620
1622
  }
1621
1623
  }
1622
- var rivia_default = Checklist;
1624
+ var rivia_default = Checklist2;
1623
1625
 
1624
1626
  // src/utils/rivia-tour.js
1625
1627
  var RIVIA_TOUR = function() {
@@ -4051,14 +4053,38 @@ async function Banner(bannerId, userId) {
4051
4053
  }
4052
4054
  var banner_default = Banner;
4053
4055
 
4056
+ // src/utils/trigger-event.js
4057
+ var triggerEvent = async (message) => {
4058
+ let checklist_id = window.checklist_id;
4059
+ let user_name = window.user_var;
4060
+ 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;
4072
+ } catch (error) {
4073
+ console.error("\u274C Error triggering event:", error);
4074
+ throw error;
4075
+ }
4076
+ };
4077
+
4054
4078
  // src/utils/index.js
4055
4079
  if (typeof window !== "undefined") {
4056
4080
  window.Checklist = rivia_default;
4057
4081
  window.Tours = rivia_tour_default;
4058
4082
  window.Banner = banner_default;
4083
+ window.triggerEvent = triggerEvent;
4059
4084
  }
4060
4085
  export {
4061
4086
  banner_default as Banner,
4062
4087
  rivia_default as Checklist,
4063
- rivia_tour_default as Tours
4088
+ rivia_tour_default as Tours,
4089
+ triggerEvent
4064
4090
  };
package/index.d.ts CHANGED
@@ -7,6 +7,22 @@ declare function Banner(
7
7
  userId: string
8
8
  ): void ;
9
9
 
10
+ export function triggerEvent(
11
+ message: string
12
+ ): Promise<{
13
+ status: string;
14
+ data: {
15
+ message: string;
16
+ source: string;
17
+ };
18
+ }>;
19
+
20
+ // Global typing (optional but recommended)
21
+ declare global {
22
+ interface Window {
23
+ triggerEvent: typeof triggerEvent;
24
+ }
25
+ }
10
26
 
11
27
  declare function Tours(tourId: string, userId: string): void ;
12
28
  export { Checklist,Banner, Tours };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivia",
3
- "version": "0.0.36",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",