rivia 0.0.57 → 0.0.58
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 +27 -27
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
function slugify(text) {
|
|
3
3
|
return "/" + String(text || "").trim().toLowerCase().replace(/[^a-z0-9\-_\s]/g, "").replace(/\s+/g, "-");
|
|
4
4
|
}
|
|
5
|
-
function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {}, customCSS = "",
|
|
5
|
+
function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {}, customCSS = "", user_var2, checklist_id) {
|
|
6
6
|
let usrn = targetingData?.targeting_data?.usernames ?? "Not Set";
|
|
7
7
|
let inc = targetingData?.targeting_data?.inclusion ?? "Not Set";
|
|
8
8
|
const mymap = /* @__PURE__ */ new Map();
|
|
@@ -77,10 +77,10 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
77
77
|
sessionStorage.getItem("onboardingVisited") || "[]"
|
|
78
78
|
);
|
|
79
79
|
if (!Array.isArray(storedVisited2)) storedVisited2 = [];
|
|
80
|
-
let user_var1 =
|
|
80
|
+
let user_var1 = user_var2;
|
|
81
81
|
if (!user_var1) {
|
|
82
82
|
user_var1 = "User_" + Math.random().toString(36).substring(2, 8);
|
|
83
|
-
sessionStorage.setItem(
|
|
83
|
+
sessionStorage.setItem(user_var2, user_var1);
|
|
84
84
|
}
|
|
85
85
|
const backendUrl = `https://demoapi.rivia.ai/clients/${checklist_id}/${user_var1}`;
|
|
86
86
|
async function getUserProgress22() {
|
|
@@ -173,7 +173,7 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
173
173
|
checklistItems,
|
|
174
174
|
cssText,
|
|
175
175
|
targetingData,
|
|
176
|
-
|
|
176
|
+
user_var2,
|
|
177
177
|
checklist_id,
|
|
178
178
|
cssConfig,
|
|
179
179
|
items,
|
|
@@ -233,7 +233,7 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
233
233
|
checklistItems,
|
|
234
234
|
cssText,
|
|
235
235
|
targetingData,
|
|
236
|
-
|
|
236
|
+
user_var2,
|
|
237
237
|
checklist_id,
|
|
238
238
|
cssConfig,
|
|
239
239
|
items,
|
|
@@ -246,9 +246,9 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {},
|
|
250
|
-
console.log("inside fetchWithTimeout",
|
|
251
|
-
if (!
|
|
249
|
+
async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {}, user_var2, checklist_id, cssConfig = {}, items = [], storedVisited2 = [], backendUrl = "", progressData = {}, visitedPages = {}, cleanUrlItems = [], custom_css = "") {
|
|
250
|
+
console.log("inside fetchWithTimeout", user_var2);
|
|
251
|
+
if (!user_var2)
|
|
252
252
|
return;
|
|
253
253
|
let i = 0;
|
|
254
254
|
const stepsHTML = items.map((it) => {
|
|
@@ -858,14 +858,14 @@ transform: translateY(-20%);
|
|
|
858
858
|
updateProgress2(visitedSet.size);
|
|
859
859
|
}
|
|
860
860
|
});
|
|
861
|
-
let
|
|
861
|
+
let user_var22 = user_var2;
|
|
862
862
|
function uploadVisitedPagesInBackground(completed2, touched = false) {
|
|
863
863
|
let activeStepId2 = sessionStorage.getItem("activeStepId") || null;
|
|
864
|
-
let
|
|
864
|
+
let user_var222 = user_var2;
|
|
865
865
|
const backendUrl22 = `https://demoapi.rivia.ai/clients/${checklist_id}`;
|
|
866
866
|
try {
|
|
867
867
|
const payload = {
|
|
868
|
-
name:
|
|
868
|
+
name: user_var222,
|
|
869
869
|
completed_items: completed2,
|
|
870
870
|
touched
|
|
871
871
|
};
|
|
@@ -893,12 +893,12 @@ transform: translateY(-20%);
|
|
|
893
893
|
storedVisited2 = sessionStorage.getItem("onboardingVisited");
|
|
894
894
|
if (!storedVisited2 || storedVisited2 == "[]") {
|
|
895
895
|
async function getUserProgress22() {
|
|
896
|
-
const backendUrl2 = `https://demoapi.rivia.ai/clients/${checklist_id}/${
|
|
896
|
+
const backendUrl2 = `https://demoapi.rivia.ai/clients/${checklist_id}/${user_var2}`;
|
|
897
897
|
try {
|
|
898
898
|
const res = await fetch(backendUrl2, { credentials: "include" });
|
|
899
899
|
if (!res.ok) console.warn(`GET failed: ${res.status}`);
|
|
900
900
|
const data2 = await res.json();
|
|
901
|
-
let userData = data2[
|
|
901
|
+
let userData = data2[user_var2];
|
|
902
902
|
if (Array.isArray(userData)) {
|
|
903
903
|
storedVisited2 = userData;
|
|
904
904
|
} else if (typeof userData === "object" && userData !== null && Array.isArray(userData.completed_items)) {
|
|
@@ -1209,9 +1209,9 @@ transform: translateY(-20%);
|
|
|
1209
1209
|
if (label.style.display !== "none") positionCloseBtn();
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
|
-
async function Checklist(workspace_id,
|
|
1212
|
+
async function Checklist(workspace_id, obj) {
|
|
1213
1213
|
window.workspace_id = workspace_id;
|
|
1214
|
-
window.user_var = user_var;
|
|
1214
|
+
window.user_var = obj.user_var;
|
|
1215
1215
|
try {
|
|
1216
1216
|
let doesRouteMatch2 = function(routes) {
|
|
1217
1217
|
if (!Array.isArray(routes)) return false;
|
|
@@ -1556,13 +1556,13 @@ var RIVIA_TOUR = function() {
|
|
|
1556
1556
|
tip.style.left = left + window.scrollX + "px";
|
|
1557
1557
|
tip.style.top = top + window.scrollY + "px";
|
|
1558
1558
|
}
|
|
1559
|
-
function uploadVisitedPagesInBackground(tourId,
|
|
1559
|
+
function uploadVisitedPagesInBackground(tourId, user_var2, tourIndex) {
|
|
1560
1560
|
console.log("Uploading visited pages in background for tour ID:", tourIndex, "and user_var:", user_var1);
|
|
1561
|
-
let
|
|
1561
|
+
let user_var22 = user_var1;
|
|
1562
1562
|
const backendUrl22 = `https://demoapi.rivia.ai/tours_clients/${tourId}`;
|
|
1563
1563
|
try {
|
|
1564
1564
|
const payload = {
|
|
1565
|
-
name:
|
|
1565
|
+
name: user_var22,
|
|
1566
1566
|
tourIndex
|
|
1567
1567
|
};
|
|
1568
1568
|
fetch(backendUrl22, {
|
|
@@ -1580,11 +1580,11 @@ var RIVIA_TOUR = function() {
|
|
|
1580
1580
|
} catch (err) {
|
|
1581
1581
|
}
|
|
1582
1582
|
}
|
|
1583
|
-
async function loadTips(tourId,
|
|
1584
|
-
if (!
|
|
1583
|
+
async function loadTips(tourId, user_var2) {
|
|
1584
|
+
if (!user_var2) {
|
|
1585
1585
|
return;
|
|
1586
1586
|
}
|
|
1587
|
-
user_var1 =
|
|
1587
|
+
user_var1 = user_var2;
|
|
1588
1588
|
STATE.tour_id = tourId;
|
|
1589
1589
|
if (sessionStorage.getItem("rivia_tour_state"))
|
|
1590
1590
|
return;
|
|
@@ -1608,15 +1608,15 @@ var RIVIA_TOUR = function() {
|
|
|
1608
1608
|
const stripTrailing = (p) => p.replace(/\/+$/, "");
|
|
1609
1609
|
console.log("STATE.url", STATE.url);
|
|
1610
1610
|
console.log("window.location.pathname", window.location.href);
|
|
1611
|
-
console.log("user_var",
|
|
1612
|
-
console.log("data.tour?.user_data?.[user_var],", data.tour?.user_data?.[
|
|
1613
|
-
if (!data.tour?.user_data?.[
|
|
1614
|
-
uploadVisitedPagesInBackground(tourId,
|
|
1611
|
+
console.log("user_var", user_var2);
|
|
1612
|
+
console.log("data.tour?.user_data?.[user_var],", data.tour?.user_data?.[user_var2]);
|
|
1613
|
+
if (!data.tour?.user_data?.[user_var2]) {
|
|
1614
|
+
uploadVisitedPagesInBackground(tourId, user_var2, 0);
|
|
1615
1615
|
} else {
|
|
1616
|
-
STATE.tourIndex = data.tour.user_data[
|
|
1616
|
+
STATE.tourIndex = data.tour.user_data[user_var2].tourIndex || 0;
|
|
1617
1617
|
console.log("STATE.tourIndex ", STATE.tourIndex);
|
|
1618
1618
|
}
|
|
1619
|
-
STATE.is_completed = data.tour.user_data && data.tour.user_data[
|
|
1619
|
+
STATE.is_completed = data.tour.user_data && data.tour.user_data[user_var2] && data.tour.user_data[user_var2].is_completed ? data.tour.user_data[user_var2].is_completed : false;
|
|
1620
1620
|
if (STATE.is_completed) {
|
|
1621
1621
|
return;
|
|
1622
1622
|
}
|
package/index.d.ts
CHANGED