rivia 0.0.37 → 0.0.40
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 +35 -3
- package/index.d.ts +16 -0
- 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,9 @@ transform: translateY(-20%);
|
|
|
1198
1204
|
if (label.style.display !== "none") positionCloseBtn();
|
|
1199
1205
|
});
|
|
1200
1206
|
}
|
|
1201
|
-
async function
|
|
1207
|
+
async function Checklist2(checklist_id, user_var) {
|
|
1208
|
+
window.checklist_id = checklist_id;
|
|
1209
|
+
window.user_var = user_var;
|
|
1202
1210
|
try {
|
|
1203
1211
|
const cachedData = sessionStorage.getItem(`checklist_${checklist_id}`);
|
|
1204
1212
|
if (cachedData) {
|
|
@@ -1619,7 +1627,7 @@ transform: translateY(-20%);
|
|
|
1619
1627
|
throw err;
|
|
1620
1628
|
}
|
|
1621
1629
|
}
|
|
1622
|
-
var rivia_default =
|
|
1630
|
+
var rivia_default = Checklist2;
|
|
1623
1631
|
|
|
1624
1632
|
// src/utils/rivia-tour.js
|
|
1625
1633
|
var RIVIA_TOUR = function() {
|
|
@@ -4051,14 +4059,38 @@ async function Banner(bannerId, userId) {
|
|
|
4051
4059
|
}
|
|
4052
4060
|
var banner_default = Banner;
|
|
4053
4061
|
|
|
4062
|
+
// src/utils/trigger-event.js
|
|
4063
|
+
var triggerEvent = async (message) => {
|
|
4064
|
+
let checklist_id = window.checklist_id;
|
|
4065
|
+
let user_name = window.user_var;
|
|
4066
|
+
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;
|
|
4078
|
+
} catch (error) {
|
|
4079
|
+
console.error("\u274C Error triggering event:", error);
|
|
4080
|
+
throw error;
|
|
4081
|
+
}
|
|
4082
|
+
};
|
|
4083
|
+
|
|
4054
4084
|
// src/utils/index.js
|
|
4055
4085
|
if (typeof window !== "undefined") {
|
|
4056
4086
|
window.Checklist = rivia_default;
|
|
4057
4087
|
window.Tours = rivia_tour_default;
|
|
4058
4088
|
window.Banner = banner_default;
|
|
4089
|
+
window.triggerEvent = triggerEvent;
|
|
4059
4090
|
}
|
|
4060
4091
|
export {
|
|
4061
4092
|
banner_default as Banner,
|
|
4062
4093
|
rivia_default as Checklist,
|
|
4063
|
-
rivia_tour_default as Tours
|
|
4094
|
+
rivia_tour_default as Tours,
|
|
4095
|
+
triggerEvent
|
|
4064
4096
|
};
|
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 };
|