rivia 0.0.37 → 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
@@ -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) {
@@ -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.37",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",