rivia 0.0.34 → 0.0.36
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 +691 -314
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
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 = {}, user_var, checklist_id) {
|
|
5
|
+
function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {}, customCSS = "", user_var, checklist_id) {
|
|
6
6
|
let usrn = targetingData?.targeting_data?.usernames ?? "Not Set";
|
|
7
7
|
let inc = targetingData?.targeting_data?.inclusion ?? "Not Set";
|
|
8
|
-
if (sessionStorage.getItem("dismissedChecklist") == "true") {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
8
|
const mymap = /* @__PURE__ */ new Map();
|
|
12
9
|
for (let i2 = 0; i2 < usrn.length; i2++) {
|
|
13
10
|
mymap.set(usrn[i2], true);
|
|
@@ -82,9 +79,9 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
82
79
|
user_var1 = "User_" + Math.random().toString(36).substring(2, 8);
|
|
83
80
|
sessionStorage.setItem(user_var, user_var1);
|
|
84
81
|
}
|
|
85
|
-
const backendUrl = `
|
|
82
|
+
const backendUrl = `http://localhost:5000/clients/${checklist_id}/${user_var1}`;
|
|
86
83
|
async function getUserProgress22() {
|
|
87
|
-
const backendUrl2 = `
|
|
84
|
+
const backendUrl2 = `http://localhost:5000/clients/${checklist_id}/${user_var1}`;
|
|
88
85
|
try {
|
|
89
86
|
const res = await fetch(backendUrl2, { credentials: "include" });
|
|
90
87
|
if (!res.ok) console.warn(`GET failed: ${res.status}`);
|
|
@@ -122,7 +119,7 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
122
119
|
}
|
|
123
120
|
storedVisited = sessionStorage.getItem("onboardingVisited");
|
|
124
121
|
async function getUserProgress22() {
|
|
125
|
-
const backendUrl2 = `
|
|
122
|
+
const backendUrl2 = `http://localhost:5000/clients/${checklist_id}/${user_var1}`;
|
|
126
123
|
try {
|
|
127
124
|
const res = await fetch(backendUrl2, { credentials: "include" });
|
|
128
125
|
if (!res.ok) console.warn(`GET failed: ${res.status}`);
|
|
@@ -181,7 +178,8 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
181
178
|
backendUrl,
|
|
182
179
|
progressData,
|
|
183
180
|
visitedPages,
|
|
184
|
-
cleanUrlItems
|
|
181
|
+
cleanUrlItems,
|
|
182
|
+
customCSS
|
|
185
183
|
);
|
|
186
184
|
});
|
|
187
185
|
} else {
|
|
@@ -240,85 +238,252 @@ function Onboarding(topTitle = "Get Started", subtitle, completion = 0, checklis
|
|
|
240
238
|
backendUrl,
|
|
241
239
|
[],
|
|
242
240
|
visitedPages,
|
|
243
|
-
cleanUrlItems
|
|
241
|
+
cleanUrlItems,
|
|
242
|
+
customCSS
|
|
244
243
|
);
|
|
245
244
|
}
|
|
246
245
|
}
|
|
247
|
-
async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {}, user_var, checklist_id, cssConfig = {}, items = [], storedVisited = [], backendUrl = "", progressData = {}, visitedPages = {}, cleanUrlItems = []) {
|
|
246
|
+
async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion = 0, checklistItems = [], cssText = [], targetingData = {}, user_var, checklist_id, cssConfig = {}, items = [], storedVisited = [], backendUrl = "", progressData = {}, visitedPages = {}, cleanUrlItems = [], custom_css = "") {
|
|
248
247
|
console.log("inside fetchWithTimeout", user_var);
|
|
249
248
|
if (!user_var)
|
|
250
249
|
return;
|
|
251
250
|
let i = 0;
|
|
252
251
|
const stepsHTML = items.map((it) => {
|
|
253
|
-
const border = it.color || cssConfig.borderColor1;
|
|
254
|
-
const bg = it.color || cssConfig.lowerBackgroundColor;
|
|
255
252
|
return `
|
|
256
|
-
<div id="${it.id}"
|
|
257
|
-
class="
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
<!-- left vertical selector bar -->
|
|
261
|
-
<div class="start-select"
|
|
262
|
-
style="position:absolute; top:0; left:-18px; width:10px; height:120%; background:rgba(247,143,7,0.9); border-radius:4px 0 0 4px; display:none;">
|
|
263
|
-
</div>
|
|
264
|
-
|
|
265
|
-
<div class="onboard-circle"
|
|
266
|
-
style="min-width:16px; min-height:16px; width:16px; height:16px; border-radius:50%;
|
|
267
|
-
border:2px solid ${cssConfig.lowerCheckboxColor}; margin-right:10px; box-sizing:border-box;"></div>
|
|
253
|
+
<div id="${it.id}" class="onboard-step">
|
|
254
|
+
<div class="start-select"></div>
|
|
255
|
+
|
|
256
|
+
<div class="onboard-circle"></div>
|
|
268
257
|
|
|
269
|
-
<div class="onboard-text"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
<small style="color:${cssConfig.lowerBodyColor};">${it.description || ""}</small>
|
|
258
|
+
<div class="onboard-text">
|
|
259
|
+
<strong class="onboard-title">${it.title}</strong><br />
|
|
260
|
+
<small class="onboard-desc">${it.description || ""}</small>
|
|
273
261
|
</div>
|
|
274
262
|
</div>
|
|
275
|
-
|
|
276
|
-
|
|
263
|
+
${i++ < items.length - 1 ? '<hr class="onboard-divider" />' : ""}
|
|
264
|
+
`;
|
|
277
265
|
}).join("");
|
|
278
266
|
const labelHTML = `
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
background: transparent;
|
|
289
|
-
border: none;
|
|
290
|
-
font-size: 28px;
|
|
291
|
-
cursor: pointer;
|
|
292
|
-
color: ${cssConfig.textColor};
|
|
293
|
-
line-height: 1;
|
|
294
|
-
">
|
|
295
|
-
×
|
|
296
|
-
</button>
|
|
297
|
-
|
|
298
|
-
<div style="background-color:${cssConfig.backgroundColor}; padding:16px; border-radius:8px 8px 0 0;">
|
|
299
|
-
<h3 style="margin:0;">${topTitle}</h3>
|
|
300
|
-
<p style="margin-top:8px;color: ${cssConfig.subtitleColor};">${subtitle}</p>
|
|
301
|
-
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
|
|
302
|
-
<div id="progressContainer" style="display: flex; gap: 4px; width: 300%; width: 800px; height: 10px;"></div>
|
|
267
|
+
<div id="checklistRoot" class="checklist-root">
|
|
268
|
+
<button id="checklistCloseBtn" class="checklist-close">×</button>
|
|
269
|
+
|
|
270
|
+
<div class="checklist-header">
|
|
271
|
+
<h3 class="checklist-title">${topTitle}</h3>
|
|
272
|
+
<p class="checklist-subtitle">${subtitle}</p>
|
|
273
|
+
|
|
274
|
+
<div class="checklist-progress">
|
|
275
|
+
<div id="progressContainer" style="display: flex; gap: 4px; width: 300px; height: 10px;"></div>
|
|
303
276
|
<span id="progressFraction" style="margin-left: 0px; font-size: 13px; color: ${cssConfig.textColor}; min-width: 20px; text-align: right;">0/0 </span>
|
|
277
|
+
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div class="checklist-body">
|
|
283
|
+
${stepsHTML}
|
|
284
|
+
<div style="text-align: right; margin-top: 10px; cursor: pointer; color: black; font-size: 12px;" id="dismissChecklist">Dismiss this checklist</div>
|
|
285
|
+
</div>
|
|
304
286
|
</div>
|
|
287
|
+
`;
|
|
288
|
+
function injectChecklistBaseCSS() {
|
|
289
|
+
if (document.getElementById("rivia-checklist-css")) return;
|
|
290
|
+
const style2 = document.createElement("style");
|
|
291
|
+
style2.id = "rivia-checklist-css";
|
|
292
|
+
style2.textContent = custom_css || `/* Root */
|
|
293
|
+
.checklist-root {
|
|
294
|
+
max-width: 500px;
|
|
295
|
+
margin: auto;
|
|
296
|
+
position: relative;
|
|
297
|
+
font-family: var(--font-family);
|
|
298
|
+
font-size: var(--font-size);
|
|
299
|
+
color: var(--text-color);
|
|
300
|
+
}
|
|
305
301
|
|
|
306
|
-
|
|
302
|
+
/* Close button */
|
|
303
|
+
.checklist-close {
|
|
304
|
+
position: absolute;
|
|
305
|
+
top: 8px;
|
|
306
|
+
right: 12px;
|
|
307
|
+
background: transparent;
|
|
308
|
+
border: none;
|
|
309
|
+
font-size: 28px;
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
color: var(--text-color);
|
|
312
|
+
}
|
|
307
313
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
/* Header */
|
|
315
|
+
.checklist-header {
|
|
316
|
+
background: var(--header-bg);
|
|
317
|
+
padding: 16px;
|
|
318
|
+
border-radius: 8px 8px 0 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.checklist-subtitle {
|
|
322
|
+
margin-top: 8px;
|
|
323
|
+
color: var(--subtitle-color);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* Progress */
|
|
327
|
+
.checklist-progress {
|
|
328
|
+
display: flex;
|
|
329
|
+
align-items: center;
|
|
330
|
+
justify-content: space-between;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.progress-fraction {
|
|
334
|
+
font-size: 13px;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* Body */
|
|
338
|
+
.checklist-body {
|
|
339
|
+
padding: 16px;
|
|
340
|
+
background: var(--lower-bg);
|
|
341
|
+
max-height: 340px;
|
|
342
|
+
overflow: auto;
|
|
343
|
+
border-radius: 0 0 8px 8px;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/* Steps */
|
|
347
|
+
.onboard-step {
|
|
348
|
+
position: relative;
|
|
349
|
+
display: flex;
|
|
350
|
+
align-items: flex-start;
|
|
351
|
+
cursor: pointer;
|
|
352
|
+
padding: 8px;
|
|
353
|
+
border-radius: 6px;
|
|
354
|
+
background: var(--step-bg);
|
|
355
|
+
margin-bottom: 16px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.start-select {
|
|
359
|
+
position: absolute;
|
|
360
|
+
top: 0;
|
|
361
|
+
left: -18px;
|
|
362
|
+
width: 10px;
|
|
363
|
+
height: 120%;
|
|
364
|
+
background: rgba(247,143,7,0.9);
|
|
365
|
+
border-radius: 4px 0 0 4px;
|
|
366
|
+
display: none;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.onboard-circle {
|
|
370
|
+
width: 16px;
|
|
371
|
+
height: 16px;
|
|
372
|
+
min-width: 16px;
|
|
373
|
+
min-height: 16px;
|
|
374
|
+
border-radius: 50%;
|
|
375
|
+
border: 2px solid var(--checkbox-color, #f78f07);
|
|
376
|
+
background: transparent;
|
|
377
|
+
margin-right: 10px;
|
|
378
|
+
box-sizing: border-box;
|
|
379
|
+
display: block;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.onboard-title {
|
|
383
|
+
color: var(--heading-color);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.onboard-desc {
|
|
387
|
+
color: var(--body-color);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.onboard-divider {
|
|
391
|
+
border: none;
|
|
392
|
+
border-top: 1px solid #9d9d9d;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.rivia-launcher {
|
|
396
|
+
position: fixed;
|
|
397
|
+
display: block;
|
|
398
|
+
z-index: 9999;
|
|
399
|
+
cursor: pointer;
|
|
400
|
+
border: none;
|
|
401
|
+
box-shadow: 0 2px 8px rgba(19, 20, 19, 0.2);
|
|
402
|
+
background: var(--launcher-bg);
|
|
403
|
+
color: var(--launcher-text);
|
|
404
|
+
font-weight: bold;
|
|
405
|
+
border-radius: 20px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.rivia-launcher .launcher-root {
|
|
409
|
+
display: flex;
|
|
410
|
+
align-items: center;
|
|
411
|
+
width: 100%;
|
|
412
|
+
height: 100%;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.rivia-launcher .launcher-left {
|
|
416
|
+
flex: 1;
|
|
417
|
+
display: flex;
|
|
418
|
+
flex-direction: column;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.rivia-launcher .launcher-title {
|
|
422
|
+
transform: translateY(-20%);
|
|
423
|
+
position: relative;
|
|
424
|
+
margin: 0;
|
|
425
|
+
line-height: 1;
|
|
426
|
+
text-align: center;
|
|
427
|
+
padding-left: 28px;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.rivia-launcher .launcher-icon {
|
|
431
|
+
position: absolute;
|
|
432
|
+
left: 10px;
|
|
433
|
+
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.rivia-launcher .launcher-text { font-size:var(--font-size);
|
|
437
|
+
display: block;
|
|
438
|
+
width: 100%;
|
|
439
|
+
padding-left: 5%;
|
|
440
|
+
text-align: center;
|
|
441
|
+
pointer-events: none;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.rivia-launcher .launcher-progress-wrap {
|
|
445
|
+
margin-top: 4px;
|
|
446
|
+
padding-left: 32px;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/* Text adjustment when progress bar is hidden */
|
|
450
|
+
.rivia-launcher.no-progress .launcher-text {
|
|
451
|
+
transform: translateY(50%);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.rivia-launcher .launcher-progress {
|
|
455
|
+
display: flex;
|
|
456
|
+
gap: 4px;
|
|
457
|
+
width: 100%;
|
|
458
|
+
padding: 5px;
|
|
459
|
+
height: 6px;
|
|
460
|
+
box-sizing: border-box;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.rivia-launcher .launcher-right {
|
|
464
|
+
flex-shrink: 0;
|
|
465
|
+
padding-right: 8px;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.rivia-launcher .launcher-fraction {
|
|
469
|
+
font-size: 13px;
|
|
470
|
+
white-space: nowrap;
|
|
471
|
+
}`;
|
|
472
|
+
document.head.appendChild(style2);
|
|
473
|
+
console.log("inside injectChecklistBaseCSS");
|
|
474
|
+
}
|
|
475
|
+
let label = document.getElementById("route-label");
|
|
476
|
+
if (!label) {
|
|
477
|
+
label = document.createElement("div");
|
|
478
|
+
label.id = "route-label";
|
|
479
|
+
label.innerHTML = labelHTML;
|
|
480
|
+
}
|
|
317
481
|
const closeElement = label.querySelector(`#checklistCloseBtn`);
|
|
318
482
|
closeElement.addEventListener("click", (e) => {
|
|
319
483
|
e.stopPropagation();
|
|
320
484
|
label.style.opacity = "0";
|
|
321
485
|
label.style.pointerEvents = "none";
|
|
486
|
+
sessionStorage.setItem("onboardingVisible", "false");
|
|
322
487
|
closeBtn.style.display = "none";
|
|
323
488
|
showBtn.style.display = "block";
|
|
324
489
|
});
|
|
@@ -356,39 +521,41 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
356
521
|
});
|
|
357
522
|
function createSlabs(n) {
|
|
358
523
|
const container = label.querySelector("#progressContainer");
|
|
524
|
+
if (!container) return;
|
|
359
525
|
container.innerHTML = "";
|
|
360
526
|
for (let i2 = 0; i2 < n; i2++) {
|
|
361
527
|
const slab = document.createElement("div");
|
|
362
|
-
slab.
|
|
528
|
+
slab.className = "slab";
|
|
363
529
|
container.appendChild(slab);
|
|
364
530
|
}
|
|
365
531
|
}
|
|
366
532
|
const style = document.createElement("style");
|
|
367
533
|
style.textContent = `
|
|
368
|
-
.slab {
|
|
369
|
-
flex: 1
|
|
534
|
+
.slab {
|
|
535
|
+
flex: 1 0 0%; /* \u{1F512} important */
|
|
536
|
+
min-width: 5px;
|
|
370
537
|
height: 8px;
|
|
371
538
|
background-color: #ccc;
|
|
372
539
|
border-radius: 4px;
|
|
373
|
-
transition: background-color 0.3s;
|
|
540
|
+
transition: background-color 0.3s ease;
|
|
374
541
|
}
|
|
375
542
|
.slab.active {
|
|
376
543
|
background-color: #4caf50;
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
544
|
+
}
|
|
545
|
+
#progressContainerBtn .slab {
|
|
546
|
+
height: 5px;
|
|
547
|
+
}
|
|
548
|
+
`;
|
|
382
549
|
label.appendChild(style);
|
|
383
550
|
function updateProgress(completed) {
|
|
384
551
|
const slabs = label.querySelectorAll(".slab");
|
|
385
552
|
slabs.forEach((slab, index) => {
|
|
386
|
-
|
|
387
|
-
slab.classList.add("active");
|
|
388
|
-
} else {
|
|
389
|
-
slab.classList.remove("active");
|
|
390
|
-
}
|
|
553
|
+
slab.classList.toggle("active", index < completed);
|
|
391
554
|
});
|
|
555
|
+
const fraction = label.querySelector("#progressFraction");
|
|
556
|
+
if (fraction) {
|
|
557
|
+
fraction.textContent = `${completed}/${slabs.length}`;
|
|
558
|
+
}
|
|
392
559
|
}
|
|
393
560
|
createSlabs(items.length);
|
|
394
561
|
if (storedVisited) updateProgress(storedVisited.length);
|
|
@@ -404,7 +571,7 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
404
571
|
fontSize: cssConfig.fontSize,
|
|
405
572
|
fontFamily: cssConfig.fontFamily,
|
|
406
573
|
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.2)",
|
|
407
|
-
width: "
|
|
574
|
+
width: "400px",
|
|
408
575
|
maxWidth: "400px",
|
|
409
576
|
maxHeight: "500px",
|
|
410
577
|
lineHeight: "1.5",
|
|
@@ -415,7 +582,11 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
415
582
|
display: "none",
|
|
416
583
|
pointerEvents: "none"
|
|
417
584
|
});
|
|
418
|
-
|
|
585
|
+
let showBtn = document.getElementById("show-tooltip-btn");
|
|
586
|
+
if (!showBtn) {
|
|
587
|
+
showBtn = document.createElement("button");
|
|
588
|
+
showBtn.id = "show-tooltip-btn";
|
|
589
|
+
}
|
|
419
590
|
function createS(n) {
|
|
420
591
|
const container2 = showBtn.querySelector("#progressContainerBtn");
|
|
421
592
|
if (!container2) return;
|
|
@@ -437,108 +608,93 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
437
608
|
});
|
|
438
609
|
}
|
|
439
610
|
showBtn.id = "show-tooltip-btn";
|
|
611
|
+
showBtn.className = "rivia-launcher";
|
|
440
612
|
const translateStyle = cssConfig.launcherProgressBar ? 'style="transform: translateY(10px);"' : "";
|
|
441
|
-
const
|
|
613
|
+
const isRight = cssConfig.launcherPosition === "right";
|
|
614
|
+
const iconHTML = cssConfig.launcherShowIcon ? `<svg class="launcher-icon" width="24" height="24" ${translateStyle} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
442
615
|
<path d="M8 10.167L12.123 6.043C13.248 4.919 13.811 4.356 14.431 3.903C15.7049 2.97403 17.1822 2.36274 18.74 2.12C19.499 2 20.293 2 21.885 2C21.968 2 22 2.038 22 2.115C22 3.705 22 4.501 21.881 5.26C21.638 6.81791 21.0263 8.29523 20.097 9.569C19.644 10.189 19.081 10.752 17.957 11.877L13.833 16" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
443
616
|
<path d="M10.341 8.098C8.638 8.098 6.498 7.738 4.904 8.398C3.737 8.88 2.878 10 2 10.878L5.306 12.296C6.182 12.671 5.646 13.776 5.501 14.502C5.34 15.31 5.349 15.34 5.931 15.922L8.078 18.068C8.66 18.651 8.69 18.66 9.498 18.498C10.223 18.353 11.329 17.818 11.704 18.694L13.121 22C13.999 21.122 15.119 20.263 15.602 19.096C16.262 17.502 15.902 15.362 15.902 13.659" stroke="white" stroke-width="1.5" stroke-linejoin="round"/>
|
|
444
617
|
<path d="M12 20L11 21M4 12L3 13" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
445
618
|
<path d="M15 4.08008C16.2 4.26008 17.46 4.74008 18.161 5.46008C19.058 6.25208 19.68 7.32008 19.92 9.00008" stroke="white" stroke-width="1.5" stroke-linecap="square"/>
|
|
446
619
|
<path d="M17.94 6.05957L16.5 7.49957" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
447
620
|
</svg>` : "";
|
|
448
|
-
const progressPaddingLeft = cssConfig.launcherShowIcon ? "28px" : "0px";
|
|
449
621
|
const textTranslateStyle = !cssConfig.launcherProgressBar ? " translateY(50%);" : "";
|
|
622
|
+
if (!cssConfig.launcherProgressBar) {
|
|
623
|
+
showBtn.classList.add("no-progress");
|
|
624
|
+
}
|
|
450
625
|
showBtn.innerHTML = `
|
|
451
|
-
<div
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
<h3 style="
|
|
458
|
-
margin:0;
|
|
459
|
-
position:relative;
|
|
460
|
-
line-height:1;
|
|
461
|
-
">
|
|
462
|
-
<!-- ICON: fixed original position -->
|
|
463
|
-
<span style="
|
|
464
|
-
position:absolute;
|
|
465
|
-
left:-20px;
|
|
466
|
-
transform:translateY(-50%);
|
|
467
|
-
display:flex;
|
|
468
|
-
align-items:center;
|
|
469
|
-
">
|
|
470
|
-
${iconHTML}
|
|
471
|
-
</span>
|
|
472
|
-
|
|
473
|
-
<!-- TEXT: centered over progress bar -->
|
|
474
|
-
<span style="
|
|
475
|
-
display:block;
|
|
476
|
-
width:100%;
|
|
477
|
-
padding-left:5%;
|
|
478
|
-
text-align:center;
|
|
479
|
-
margin-top:-10%;
|
|
480
|
-
transform: ${textTranslateStyle};
|
|
481
|
-
pointer-events:none;
|
|
482
|
-
font-size: ${cssConfig.fontSize};
|
|
483
|
-
">
|
|
484
|
-
${cssConfig.launcher_text}
|
|
485
|
-
</span>
|
|
626
|
+
<div class="launcher-root">
|
|
627
|
+
<div class="launcher-left">
|
|
628
|
+
|
|
629
|
+
<h3 class="launcher-title">
|
|
630
|
+
${iconHTML}
|
|
631
|
+
<span class="launcher-text">${cssConfig.launcher_text}</span>
|
|
486
632
|
</h3>
|
|
487
633
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
<div id="progressContainerBtn" style="
|
|
491
|
-
display:flex;
|
|
492
|
-
gap:4px;
|
|
493
|
-
width:100%;
|
|
494
|
-
padding:5px;
|
|
495
|
-
height:3px;
|
|
496
|
-
box-sizing:border-box;
|
|
497
|
-
"></div>
|
|
634
|
+
<div class="launcher-progress-wrap">
|
|
635
|
+
<div id="progressContainerBtn" class="launcher-progress"></div>
|
|
498
636
|
</div>
|
|
637
|
+
|
|
499
638
|
</div>
|
|
500
639
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
<span id="progressFraction" style="
|
|
504
|
-
font-size:13px;
|
|
505
|
-
white-space:nowrap;
|
|
506
|
-
color:${cssConfig.launcherTextColor};
|
|
507
|
-
padding-right:7px;
|
|
508
|
-
min-width:10px;
|
|
509
|
-
text-align:right;
|
|
510
|
-
margin-top:50%;
|
|
511
|
-
">
|
|
512
|
-
0/0
|
|
513
|
-
</span>
|
|
640
|
+
<div class="launcher-right">
|
|
641
|
+
<span id="progressFraction" class="launcher-fraction">0/0</span>
|
|
514
642
|
</div>
|
|
515
643
|
</div>
|
|
516
644
|
`;
|
|
517
|
-
|
|
645
|
+
function injectLauncherCSS() {
|
|
646
|
+
if (document.getElementById("rivia-launcher-css")) return;
|
|
647
|
+
const style2 = document.createElement("style");
|
|
648
|
+
style2.id = "rivia-launcher-css";
|
|
649
|
+
style2.textContent = `
|
|
650
|
+
/* Root */ .checklist-root { max-width: 500px; margin: auto; position: relative; font-family: var(--font-family); font-size: var(--font-size); color: var(--text-color); } /* Close button */ .checklist-close { position: absolute; top: 8px; right: 12px; background: transparent; border: none; font-size: 28px; cursor: pointer; color: var(--text-color); } /* Header */ .checklist-header { background: var(--header-bg); padding: 16px; border-radius: 8px 8px 0 0; } .checklist-subtitle { margin-top: 8px; color: var(--subtitle-color); } /* Progress */ .checklist-progress { display: flex; align-items: center; justify-content: space-between; } .progress-fraction { font-size: 13px; } /* Body */ .checklist-body { padding: 16px; background: var(--lower-bg); max-height: 340px; overflow: auto; border-radius: 0 0 8px 8px; } /* Steps */ .onboard-step { position: relative; display: flex; align-items: flex-start; cursor: pointer; padding: 8px; border-radius: 6px; background: var(--step-bg); margin-bottom: 16px; } .start-select { position: absolute; top: 0; left: -18px; width: 10px; height: 120%; background: rgba(247,143,7,0.9); border-radius: 4px 0 0 4px; display: none; } .onboard-circle { width: 16px; height: 16px; min-width: 16px; min-height: 16px; border-radius: 50%; border: 2px solid var(--checkbox-color, #f78f07); /* hardcoded for test */ background: transparent; margin-right: 10px; box-sizing: border-box; display: block; } .onboard-title { color: var(--heading-color); } .onboard-desc { color: var(--body-color); } .onboard-divider { border: none; border-top: 1px solid #9d9d9d; } .rivia-launcher { position: fixed; display: block; z-index: 9999; cursor: pointer; border: none; box-shadow: 0 2px 8px rgba(19, 20, 19, 0.2); background: var(--launcher-bg); color: var(--launcher-text); font-weight: bold; } .rivia-launcher .launcher-root { display: flex; align-items: center; width: 100%; height: 100%; } .rivia-launcher .launcher-left { flex: 1; display: flex; flex-direction: column; } .rivia-launcher .launcher-title { position: relative; margin: 0; line-height: 1; text-align: center; padding-left: 28px; } .rivia-launcher .launcher-icon { position: absolute; left: 10px; transform: translateY(50%); }
|
|
651
|
+
.rivia-launcher .launcher-text {font-size:var(--font-size); display: block; width: 100%; padding-left: 5%; text-align: center; pointer-events: none; }
|
|
652
|
+
.rivia-launcher .launcher-progress-wrap { margin-top: 4px; padding-left: 32px; } /* Text adjustment when progress bar is hidden */ .rivia-launcher.no-progress .launcher-text { transform: translateY(50%);font-size:var(--font-size); } .rivia-launcher .launcher-progress { display:flex; gap:4px; width:100%; padding:5px; height:3px; box-sizing:border-box; } .rivia-launcher .launcher-right { flex-shrink: 0; padding-right: 8px; } .rivia-launcher .launcher-fraction { font-size: 13px; white-space: nowrap; } /* Customer CSS */ .rivia-launcher { border-radius: 20px; } .rivia-launcher .launcher-progress { height: 6px; }
|
|
653
|
+
`;
|
|
654
|
+
document.head.appendChild(style2);
|
|
655
|
+
}
|
|
656
|
+
function applyChecklistTheme(root, cssConfig2) {
|
|
657
|
+
root.style.setProperty("--font-family", cssConfig2.fontFamily);
|
|
658
|
+
root.style.setProperty("--font-size", cssConfig2.fontSize);
|
|
659
|
+
root.style.setProperty("--text-color", cssConfig2.textColor);
|
|
660
|
+
root.style.setProperty("--subtitle-color", cssConfig2.subtitleColor);
|
|
661
|
+
root.style.setProperty("--header-bg", cssConfig2.backgroundColor);
|
|
662
|
+
root.style.setProperty("--lower-bg", cssConfig2.lowerBackgroundColor);
|
|
663
|
+
root.style.setProperty("--step-bg", cssConfig2.lowerBackgroundColor);
|
|
664
|
+
root.style.setProperty("--checkbox-color", cssConfig2.lowerCheckboxColor);
|
|
665
|
+
root.style.setProperty("--heading-color", cssConfig2.lowerHeadingColor);
|
|
666
|
+
root.style.setProperty("--body-color", cssConfig2.lowerBodyColor);
|
|
667
|
+
}
|
|
668
|
+
injectChecklistBaseCSS();
|
|
518
669
|
Object.assign(showBtn.style, {
|
|
519
|
-
position: "fixed",
|
|
520
670
|
bottom: cssConfig.launcherSpacingBottom || "20px",
|
|
521
|
-
// Horizontal positioning
|
|
522
671
|
left: isRight ? "auto" : cssConfig.launcherSpacingLeft || "20px",
|
|
523
672
|
right: isRight ? cssConfig.launcherSpacingRight || "20px" : "auto",
|
|
524
673
|
width: cssConfig.launcherWidth ? `${cssConfig.launcherWidth}px` : "150px",
|
|
525
674
|
height: cssConfig.launcherHeight ? `${cssConfig.launcherHeight}px` : "78px",
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
backgroundColor: cssConfig.launcherBackgroundColor,
|
|
529
|
-
color: cssConfig.launcherTextColor,
|
|
530
|
-
border: "none",
|
|
531
|
-
borderRadius: `${cssConfig.launcherBorderRadius}px` || "6px",
|
|
532
|
-
cursor: "pointer",
|
|
533
|
-
zIndex: 9999,
|
|
534
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)"
|
|
675
|
+
borderRadius: `${cssConfig.launcherBorderRadius || 6}px`
|
|
676
|
+
/* CSS variables */
|
|
535
677
|
});
|
|
536
|
-
|
|
678
|
+
showBtn.style.setProperty("--launcher-bg", cssConfig.launcherBackgroundColor || "#f78f07");
|
|
679
|
+
showBtn.style.setProperty("--launcher-text", cssConfig.launcherTextColor || "#ffffff");
|
|
680
|
+
showBtn.style.setProperty("--font-size", cssConfig.fontSize || "14px");
|
|
681
|
+
applyChecklistTheme(label, cssConfig);
|
|
682
|
+
injectChecklistBaseCSS();
|
|
683
|
+
if (!document.contains(showBtn))
|
|
684
|
+
document.body.appendChild(showBtn);
|
|
685
|
+
console.log("after applyChecklistTheme");
|
|
686
|
+
if (!document.contains(label))
|
|
687
|
+
document.body.appendChild(label);
|
|
537
688
|
if (!cssConfig.launcherProgressBar) {
|
|
538
|
-
document.getElementById("progressContainerBtn")
|
|
539
|
-
|
|
689
|
+
const progressContainerBtn = document.getElementById("progressContainerBtn");
|
|
690
|
+
if (progressContainerBtn) {
|
|
691
|
+
progressContainerBtn.style.display = "none";
|
|
692
|
+
}
|
|
693
|
+
const progressFraction = document.getElementById("progressFraction");
|
|
694
|
+
if (progressFraction) {
|
|
695
|
+
progressFraction.style.display = "none";
|
|
696
|
+
}
|
|
540
697
|
}
|
|
541
|
-
document.body.appendChild(label);
|
|
542
698
|
createS(items.length);
|
|
543
699
|
const closeBtn = document.createElement("button");
|
|
544
700
|
closeBtn.id = "tooltip-close-btn";
|
|
@@ -566,11 +722,6 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
566
722
|
}
|
|
567
723
|
let check = 0;
|
|
568
724
|
console.log("before");
|
|
569
|
-
const EVENT_SRC_URL = "https://demoapi.rivia.ai/events";
|
|
570
|
-
if (!window._onboardingEventSource) {
|
|
571
|
-
window._onboardingEventSource = new EventSource(EVENT_SRC_URL);
|
|
572
|
-
}
|
|
573
|
-
const eventSource = window._onboardingEventSource;
|
|
574
725
|
const STORAGE_KEY = "onboardingVisited";
|
|
575
726
|
const visitedSet = new Set(
|
|
576
727
|
JSON.parse(sessionStorage.getItem(STORAGE_KEY) || "[]")
|
|
@@ -605,70 +756,6 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
605
756
|
}
|
|
606
757
|
return true;
|
|
607
758
|
}
|
|
608
|
-
eventSource.onopen = () => console.log("SSE connected");
|
|
609
|
-
eventSource.onerror = (err) => console.log("SSE connection error:", err);
|
|
610
|
-
eventSource.onmessage = (event) => {
|
|
611
|
-
if (!event || !event.data) return;
|
|
612
|
-
check = 1;
|
|
613
|
-
let data;
|
|
614
|
-
try {
|
|
615
|
-
data = JSON.parse(event.data);
|
|
616
|
-
} catch (err) {
|
|
617
|
-
console.warn("Invalid SSE JSON:", event.data, err);
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
if (data.ping) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
const msg = data.message;
|
|
624
|
-
if (!msg) return;
|
|
625
|
-
if (processedMessages.has(msg)) {
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
processedMessages.add(msg);
|
|
629
|
-
const it = items.find((i2) => i2.event_name && i2.event_name === msg);
|
|
630
|
-
if (!it) {
|
|
631
|
-
console.log("SSE message doesn't match any item:", msg);
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
try {
|
|
635
|
-
const stepEl = label ? label.querySelector(`#${it.id}`) : null;
|
|
636
|
-
if (stepEl) {
|
|
637
|
-
const startSelect = stepEl.querySelector(".start-select");
|
|
638
|
-
if (startSelect) startSelect.style.display = "none";
|
|
639
|
-
}
|
|
640
|
-
} catch (err) {
|
|
641
|
-
}
|
|
642
|
-
const path = it.url || "";
|
|
643
|
-
const cleanUrl = path.startsWith("/") ? path.slice(1) : path;
|
|
644
|
-
handleVisit(cleanUrl, { source: "sse" });
|
|
645
|
-
if (storedVisited.length >= checklistItems.length) {
|
|
646
|
-
console.log("All items completed via SSE");
|
|
647
|
-
if (label && label.parentNode) label.remove();
|
|
648
|
-
if (showBtn && showBtn.parentNode) showBtn.remove();
|
|
649
|
-
const label3 = document.createElement("div");
|
|
650
|
-
label3.id = "route-label";
|
|
651
|
-
label3.innerText = "\u{1F389} Congrats! You've completed all items!";
|
|
652
|
-
Object.assign(label3.style, {
|
|
653
|
-
position: "fixed",
|
|
654
|
-
bottom: "20px",
|
|
655
|
-
left: "20px",
|
|
656
|
-
backgroundColor: "#4CAF50",
|
|
657
|
-
color: "white",
|
|
658
|
-
padding: "10px 20px",
|
|
659
|
-
borderRadius: "10px",
|
|
660
|
-
boxShadow: "0 4px 6px rgba(0,0,0,0.2)",
|
|
661
|
-
fontSize: "16px",
|
|
662
|
-
fontWeight: "bold",
|
|
663
|
-
zIndex: 9999,
|
|
664
|
-
opacity: 0,
|
|
665
|
-
transition: "opacity 0.5s ease"
|
|
666
|
-
});
|
|
667
|
-
document.body.appendChild(label3);
|
|
668
|
-
}
|
|
669
|
-
console.log("Received event (SSE):", msg);
|
|
670
|
-
};
|
|
671
|
-
console.log("after");
|
|
672
759
|
function findButtonByText(buttonText) {
|
|
673
760
|
if (!buttonText) return null;
|
|
674
761
|
const needle = buttonText.trim().toLowerCase();
|
|
@@ -760,91 +847,11 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
760
847
|
updateProgress2(visitedSet.size);
|
|
761
848
|
}
|
|
762
849
|
});
|
|
763
|
-
if (!window._onboardingEventSource) {
|
|
764
|
-
window._onboardingEventSource = new EventSource(EVENT_SRC_URL);
|
|
765
|
-
}
|
|
766
|
-
eventSource.onopen = () => console.log("SSE connected");
|
|
767
|
-
eventSource.onerror = (err) => console.log("SSE connection error:", err);
|
|
768
|
-
eventSource.onmessage = (event) => {
|
|
769
|
-
if (!event || !event.data) return;
|
|
770
|
-
check = 1;
|
|
771
|
-
let data;
|
|
772
|
-
try {
|
|
773
|
-
data = JSON.parse(event.data);
|
|
774
|
-
} catch (err) {
|
|
775
|
-
console.warn("Invalid SSE JSON:", event.data, err);
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
if (data.ping) {
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
const msg = data.message;
|
|
782
|
-
console.log("SSE message received:", msg);
|
|
783
|
-
if (!msg) return;
|
|
784
|
-
if (processedMessages.has(msg)) {
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
processedMessages.add(msg);
|
|
788
|
-
const it = items.find((i2) => i2.event_name && i2.event_name === msg);
|
|
789
|
-
if (!it) {
|
|
790
|
-
console.log("SSE message doesn't match any item:", msg);
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
const eventId = data.event_id;
|
|
794
|
-
try {
|
|
795
|
-
fetch("https://demoapi.rivia.ai/ack-event", {
|
|
796
|
-
method: "POST",
|
|
797
|
-
headers: { "Content-Type": "application/json" },
|
|
798
|
-
body: JSON.stringify({ event_id: eventId })
|
|
799
|
-
});
|
|
800
|
-
console.log("ACK sent for", eventId);
|
|
801
|
-
} catch (err) {
|
|
802
|
-
console.warn("Failed to ACK", eventId, err);
|
|
803
|
-
}
|
|
804
|
-
try {
|
|
805
|
-
const stepEl = label ? label.querySelector(`#${it.id}`) : null;
|
|
806
|
-
if (stepEl) {
|
|
807
|
-
const startSelect = stepEl.querySelector(".start-select");
|
|
808
|
-
if (startSelect) startSelect.style.display = "none";
|
|
809
|
-
}
|
|
810
|
-
} catch (err) {
|
|
811
|
-
}
|
|
812
|
-
const path = it.url || "";
|
|
813
|
-
const cleanUrl = path.startsWith("/") ? path.slice(1) : path;
|
|
814
|
-
handleVisit(cleanUrl, { source: "sse" });
|
|
815
|
-
if (storedVisited.length >= checklistItems.length) {
|
|
816
|
-
console.log("All items completed via SSE");
|
|
817
|
-
(() => {
|
|
818
|
-
if (label && label.parentNode) label.remove();
|
|
819
|
-
if (showBtn && showBtn.parentNode) showBtn.remove();
|
|
820
|
-
const label3 = document.createElement("div");
|
|
821
|
-
label3.id = "route-label";
|
|
822
|
-
label3.innerText = "\u{1F389} Congrats! You've completed all items!";
|
|
823
|
-
Object.assign(label3.style, {
|
|
824
|
-
position: "fixed",
|
|
825
|
-
bottom: "20px",
|
|
826
|
-
left: "20px",
|
|
827
|
-
backgroundColor: "#4CAF50",
|
|
828
|
-
color: "white",
|
|
829
|
-
padding: "10px 20px",
|
|
830
|
-
borderRadius: "10px",
|
|
831
|
-
boxShadow: "0 4px 6px rgba(0,0,0,0.2)",
|
|
832
|
-
fontSize: "16px",
|
|
833
|
-
fontWeight: "bold",
|
|
834
|
-
zIndex: 9999,
|
|
835
|
-
opacity: 0,
|
|
836
|
-
transition: "opacity 0.5s ease"
|
|
837
|
-
});
|
|
838
|
-
document.body.appendChild(label3);
|
|
839
|
-
})();
|
|
840
|
-
}
|
|
841
|
-
console.log("Received event (SSE):", msg);
|
|
842
|
-
};
|
|
843
850
|
let user_var2 = user_var;
|
|
844
851
|
function uploadVisitedPagesInBackground(completed2, touched = false) {
|
|
845
852
|
let activeStepId2 = sessionStorage.getItem("activeStepId") || null;
|
|
846
853
|
let user_var22 = user_var;
|
|
847
|
-
const backendUrl22 = `
|
|
854
|
+
const backendUrl22 = `http://localhost:5000/clients/${checklist_id}`;
|
|
848
855
|
try {
|
|
849
856
|
const payload = {
|
|
850
857
|
name: user_var22,
|
|
@@ -866,7 +873,6 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
866
873
|
console.warn("\u274C Error preparing background upload:", err);
|
|
867
874
|
}
|
|
868
875
|
}
|
|
869
|
-
if (check == 0) uploadVisitedPagesInBackground(storedVisited, false);
|
|
870
876
|
let activeStepId = sessionStorage.getItem("activeStepId") || null;
|
|
871
877
|
function updateUIFromVisited() {
|
|
872
878
|
storedVisited = JSON.parse(
|
|
@@ -876,7 +882,7 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
876
882
|
storedVisited = sessionStorage.getItem("onboardingVisited");
|
|
877
883
|
if (!storedVisited || storedVisited == "[]") {
|
|
878
884
|
async function getUserProgress22() {
|
|
879
|
-
const backendUrl2 = `
|
|
885
|
+
const backendUrl2 = `http://localhost:5000/clients/${checklist_id}/${user_var}`;
|
|
880
886
|
try {
|
|
881
887
|
const res = await fetch(backendUrl2, { credentials: "include" });
|
|
882
888
|
if (!res.ok) console.warn(`GET failed: ${res.status}`);
|
|
@@ -1150,6 +1156,7 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
1150
1156
|
label.style.pointerEvents = "auto";
|
|
1151
1157
|
closeBtn.style.display = "flex";
|
|
1152
1158
|
showBtn.style.display = "none";
|
|
1159
|
+
sessionStorage.setItem("onboardingVisible", "true");
|
|
1153
1160
|
positionCloseBtn();
|
|
1154
1161
|
requestAnimationFrame(() => {
|
|
1155
1162
|
label.style.opacity = "1";
|
|
@@ -1174,9 +1181,18 @@ async function fetchWithTimeout(topTitle = "Get Started", subtitle, completion =
|
|
|
1174
1181
|
const getStarted = document.querySelector("button#get-started");
|
|
1175
1182
|
if (getStarted) getStarted.click();
|
|
1176
1183
|
});
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1184
|
+
if (sessionStorage.getItem("onboardingVisible") === "true") {
|
|
1185
|
+
label.style.display = "block";
|
|
1186
|
+
label.style.pointerEvents = "auto";
|
|
1187
|
+
closeBtn.style.display = "flex";
|
|
1188
|
+
showBtn.style.display = "none";
|
|
1189
|
+
sessionStorage.setItem("onboardingVisible", "true");
|
|
1190
|
+
positionCloseBtn();
|
|
1191
|
+
} else {
|
|
1192
|
+
showBtn.style.display = "block";
|
|
1193
|
+
label.style.display = "none";
|
|
1194
|
+
}
|
|
1195
|
+
label.style.opacity = "1";
|
|
1180
1196
|
updateUIFromVisited();
|
|
1181
1197
|
window.addEventListener("resize", () => {
|
|
1182
1198
|
if (label.style.display !== "none") positionCloseBtn();
|
|
@@ -1186,7 +1202,7 @@ async function Checklist(checklist_id, user_var) {
|
|
|
1186
1202
|
try {
|
|
1187
1203
|
const cachedData = sessionStorage.getItem(`checklist_${checklist_id}`);
|
|
1188
1204
|
if (cachedData) {
|
|
1189
|
-
const { checklist: checklist2, cssConfig: cssConfig2, targetingData: targetingData2 } = JSON.parse(cachedData);
|
|
1205
|
+
const { checklist: checklist2, cssConfig: cssConfig2, targetingData: targetingData2, customCSS: customCSS2 } = JSON.parse(cachedData);
|
|
1190
1206
|
Onboarding(
|
|
1191
1207
|
checklist2.title || "Untitled Checklist",
|
|
1192
1208
|
checklist2.subtitle || "Describe the purpose of this checklist...",
|
|
@@ -1194,13 +1210,193 @@ async function Checklist(checklist_id, user_var) {
|
|
|
1194
1210
|
checklist2.items || [],
|
|
1195
1211
|
cssConfig2 || {},
|
|
1196
1212
|
targetingData2 || {},
|
|
1213
|
+
customCSS2 || `/* Root */
|
|
1214
|
+
.checklist-root {
|
|
1215
|
+
max-width: 500px;
|
|
1216
|
+
margin: auto;
|
|
1217
|
+
position: relative;
|
|
1218
|
+
font-family: var(--font-family);
|
|
1219
|
+
font-size: var(--font-size);
|
|
1220
|
+
color: var(--text-color);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/* Close button */
|
|
1224
|
+
.checklist-close {
|
|
1225
|
+
position: absolute;
|
|
1226
|
+
top: 8px;
|
|
1227
|
+
right: 12px;
|
|
1228
|
+
background: transparent;
|
|
1229
|
+
border: none;
|
|
1230
|
+
font-size: 28px;
|
|
1231
|
+
cursor: pointer;
|
|
1232
|
+
color: var(--text-color);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/* Header */
|
|
1236
|
+
.checklist-header {
|
|
1237
|
+
background: var(--header-bg);
|
|
1238
|
+
padding: 16px;
|
|
1239
|
+
border-radius: 8px 8px 0 0;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
.checklist-subtitle {
|
|
1243
|
+
margin-top: 8px;
|
|
1244
|
+
color: var(--subtitle-color);
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/* Progress */
|
|
1248
|
+
.checklist-progress {
|
|
1249
|
+
display: flex;
|
|
1250
|
+
align-items: center;
|
|
1251
|
+
justify-content: space-between;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
.progress-fraction {
|
|
1255
|
+
font-size: 13px;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/* Body */
|
|
1259
|
+
.checklist-body {
|
|
1260
|
+
padding: 16px;
|
|
1261
|
+
background: var(--lower-bg);
|
|
1262
|
+
max-height: 340px;
|
|
1263
|
+
overflow: auto;
|
|
1264
|
+
border-radius: 0 0 8px 8px;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/* Steps */
|
|
1268
|
+
.onboard-step {
|
|
1269
|
+
position: relative;
|
|
1270
|
+
display: flex;
|
|
1271
|
+
align-items: flex-start;
|
|
1272
|
+
cursor: pointer;
|
|
1273
|
+
padding: 8px;
|
|
1274
|
+
border-radius: 6px;
|
|
1275
|
+
background: var(--step-bg);
|
|
1276
|
+
margin-bottom: 16px;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
.start-select {
|
|
1280
|
+
position: absolute;
|
|
1281
|
+
top: 0;
|
|
1282
|
+
left: -18px;
|
|
1283
|
+
width: 10px;
|
|
1284
|
+
height: 120%;
|
|
1285
|
+
background: rgba(247,143,7,0.9);
|
|
1286
|
+
border-radius: 4px 0 0 4px;
|
|
1287
|
+
display: none;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
.onboard-circle {
|
|
1291
|
+
width: 16px;
|
|
1292
|
+
height: 16px;
|
|
1293
|
+
min-width: 16px;
|
|
1294
|
+
min-height: 16px;
|
|
1295
|
+
border-radius: 50%;
|
|
1296
|
+
border: 2px solid var(--checkbox-color, #f78f07);
|
|
1297
|
+
background: transparent;
|
|
1298
|
+
margin-right: 10px;
|
|
1299
|
+
box-sizing: border-box;
|
|
1300
|
+
display: block;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
.onboard-title {
|
|
1304
|
+
color: var(--heading-color);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
.onboard-desc {
|
|
1308
|
+
color: var(--body-color);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
.onboard-divider {
|
|
1312
|
+
border: none;
|
|
1313
|
+
border-top: 1px solid #9d9d9d;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
.rivia-launcher {
|
|
1317
|
+
position: fixed;
|
|
1318
|
+
display: block;
|
|
1319
|
+
z-index: 9999;
|
|
1320
|
+
cursor: pointer;
|
|
1321
|
+
border: none;
|
|
1322
|
+
box-shadow: 0 2px 8px rgba(19, 20, 19, 0.2);
|
|
1323
|
+
background: var(--launcher-bg);
|
|
1324
|
+
color: var(--launcher-text);
|
|
1325
|
+
font-weight: bold;
|
|
1326
|
+
border-radius: 20px;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.rivia-launcher .launcher-root {
|
|
1330
|
+
display: flex;
|
|
1331
|
+
align-items: center;
|
|
1332
|
+
width: 100%;
|
|
1333
|
+
height: 100%;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
.rivia-launcher .launcher-left {
|
|
1337
|
+
flex: 1;
|
|
1338
|
+
display: flex;
|
|
1339
|
+
flex-direction: column;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
.rivia-launcher .launcher-title {
|
|
1343
|
+
transform: translateY(-20%);
|
|
1344
|
+
position: relative;
|
|
1345
|
+
margin: 0;
|
|
1346
|
+
line-height: 1;
|
|
1347
|
+
text-align: center;
|
|
1348
|
+
padding-left: 28px;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
.rivia-launcher .launcher-icon {
|
|
1352
|
+
position: absolute;
|
|
1353
|
+
left: 10px;
|
|
1354
|
+
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.rivia-launcher .launcher-text { font-size:var(--font-size);
|
|
1358
|
+
display: block;
|
|
1359
|
+
width: 100%;
|
|
1360
|
+
padding-left: 5%;
|
|
1361
|
+
text-align: center;
|
|
1362
|
+
pointer-events: none;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
.rivia-launcher .launcher-progress-wrap {
|
|
1366
|
+
margin-top: 4px;
|
|
1367
|
+
padding-left: 32px;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/* Text adjustment when progress bar is hidden */
|
|
1371
|
+
.rivia-launcher.no-progress .launcher-text {
|
|
1372
|
+
transform: translateY(50%);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
.rivia-launcher .launcher-progress {
|
|
1376
|
+
display: flex;
|
|
1377
|
+
gap: 4px;
|
|
1378
|
+
width: 100%;
|
|
1379
|
+
padding: 5px;
|
|
1380
|
+
height: 6px;
|
|
1381
|
+
box-sizing: border-box;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.rivia-launcher .launcher-right {
|
|
1385
|
+
flex-shrink: 0;
|
|
1386
|
+
padding-right: 8px;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
.rivia-launcher .launcher-fraction {
|
|
1390
|
+
font-size: 13px;
|
|
1391
|
+
white-space: nowrap;
|
|
1392
|
+
}`,
|
|
1197
1393
|
user_var,
|
|
1198
1394
|
checklist_id
|
|
1199
1395
|
);
|
|
1200
1396
|
return checklist2;
|
|
1201
1397
|
}
|
|
1202
1398
|
const res = await fetch(
|
|
1203
|
-
`
|
|
1399
|
+
`http://localhost:5000/checklists2/${checklist_id}`,
|
|
1204
1400
|
{
|
|
1205
1401
|
method: "GET",
|
|
1206
1402
|
headers: { "Content-Type": "application/json" }
|
|
@@ -1221,7 +1417,187 @@ async function Checklist(checklist_id, user_var) {
|
|
|
1221
1417
|
const completion = checklist.completion || 0;
|
|
1222
1418
|
const cssConfig = checklist.branding_data || {};
|
|
1223
1419
|
const targetingData = checklist.targeting_data || {};
|
|
1224
|
-
const
|
|
1420
|
+
const customCSS = checklist.customCSS || `/* Root */
|
|
1421
|
+
.checklist-root {
|
|
1422
|
+
max-width: 500px;
|
|
1423
|
+
margin: auto;
|
|
1424
|
+
position: relative;
|
|
1425
|
+
font-family: var(--font-family);
|
|
1426
|
+
font-size: var(--font-size);
|
|
1427
|
+
color: var(--text-color);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/* Close button */
|
|
1431
|
+
.checklist-close {
|
|
1432
|
+
position: absolute;
|
|
1433
|
+
top: 8px;
|
|
1434
|
+
right: 12px;
|
|
1435
|
+
background: transparent;
|
|
1436
|
+
border: none;
|
|
1437
|
+
font-size: 28px;
|
|
1438
|
+
cursor: pointer;
|
|
1439
|
+
color: var(--text-color);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
/* Header */
|
|
1443
|
+
.checklist-header {
|
|
1444
|
+
background: var(--header-bg);
|
|
1445
|
+
padding: 16px;
|
|
1446
|
+
border-radius: 8px 8px 0 0;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
.checklist-subtitle {
|
|
1450
|
+
margin-top: 8px;
|
|
1451
|
+
color: var(--subtitle-color);
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/* Progress */
|
|
1455
|
+
.checklist-progress {
|
|
1456
|
+
display: flex;
|
|
1457
|
+
align-items: center;
|
|
1458
|
+
justify-content: space-between;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
.progress-fraction {
|
|
1462
|
+
font-size: 13px;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/* Body */
|
|
1466
|
+
.checklist-body {
|
|
1467
|
+
padding: 16px;
|
|
1468
|
+
background: var(--lower-bg);
|
|
1469
|
+
max-height: 340px;
|
|
1470
|
+
overflow: auto;
|
|
1471
|
+
border-radius: 0 0 8px 8px;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/* Steps */
|
|
1475
|
+
.onboard-step {
|
|
1476
|
+
position: relative;
|
|
1477
|
+
display: flex;
|
|
1478
|
+
align-items: flex-start;
|
|
1479
|
+
cursor: pointer;
|
|
1480
|
+
padding: 8px;
|
|
1481
|
+
border-radius: 6px;
|
|
1482
|
+
background: var(--step-bg);
|
|
1483
|
+
margin-bottom: 16px;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
.start-select {
|
|
1487
|
+
position: absolute;
|
|
1488
|
+
top: 0;
|
|
1489
|
+
left: -18px;
|
|
1490
|
+
width: 10px;
|
|
1491
|
+
height: 120%;
|
|
1492
|
+
background: rgba(247,143,7,0.9);
|
|
1493
|
+
border-radius: 4px 0 0 4px;
|
|
1494
|
+
display: none;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
.onboard-circle {
|
|
1498
|
+
width: 16px;
|
|
1499
|
+
height: 16px;
|
|
1500
|
+
min-width: 16px;
|
|
1501
|
+
min-height: 16px;
|
|
1502
|
+
border-radius: 50%;
|
|
1503
|
+
border: 2px solid var(--checkbox-color, #f78f07);
|
|
1504
|
+
background: transparent;
|
|
1505
|
+
margin-right: 10px;
|
|
1506
|
+
box-sizing: border-box;
|
|
1507
|
+
display: block;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
.onboard-title {
|
|
1511
|
+
color: var(--heading-color);
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
.onboard-desc {
|
|
1515
|
+
color: var(--body-color);
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
.onboard-divider {
|
|
1519
|
+
border: none;
|
|
1520
|
+
border-top: 1px solid #9d9d9d;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
.rivia-launcher {
|
|
1524
|
+
position: fixed;
|
|
1525
|
+
display: block;
|
|
1526
|
+
z-index: 9999;
|
|
1527
|
+
cursor: pointer;
|
|
1528
|
+
border: none;
|
|
1529
|
+
box-shadow: 0 2px 8px rgba(19, 20, 19, 0.2);
|
|
1530
|
+
background: var(--launcher-bg);
|
|
1531
|
+
color: var(--launcher-text);
|
|
1532
|
+
font-weight: bold;
|
|
1533
|
+
border-radius: 20px;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
.rivia-launcher .launcher-root {
|
|
1537
|
+
display: flex;
|
|
1538
|
+
align-items: center;
|
|
1539
|
+
width: 100%;
|
|
1540
|
+
height: 100%;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
.rivia-launcher .launcher-left {
|
|
1544
|
+
flex: 1;
|
|
1545
|
+
display: flex;
|
|
1546
|
+
flex-direction: column;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
.rivia-launcher .launcher-title {
|
|
1550
|
+
transform: translateY(-20%);
|
|
1551
|
+
position: relative;
|
|
1552
|
+
margin: 0;
|
|
1553
|
+
line-height: 1;
|
|
1554
|
+
text-align: center;
|
|
1555
|
+
padding-left: 28px;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
.rivia-launcher .launcher-icon {
|
|
1559
|
+
position: absolute;
|
|
1560
|
+
left: 10px;
|
|
1561
|
+
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
.rivia-launcher .launcher-text { font-size:var(--font-size);
|
|
1565
|
+
display: block;
|
|
1566
|
+
width: 100%;
|
|
1567
|
+
padding-left: 5%;
|
|
1568
|
+
text-align: center;
|
|
1569
|
+
pointer-events: none;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
.rivia-launcher .launcher-progress-wrap {
|
|
1573
|
+
margin-top: 4px;
|
|
1574
|
+
padding-left: 32px;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/* Text adjustment when progress bar is hidden */
|
|
1578
|
+
.rivia-launcher.no-progress .launcher-text {
|
|
1579
|
+
transform: translateY(50%);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.rivia-launcher .launcher-progress {
|
|
1583
|
+
display: flex;
|
|
1584
|
+
gap: 4px;
|
|
1585
|
+
width: 100%;
|
|
1586
|
+
padding: 5px;
|
|
1587
|
+
height: 6px;
|
|
1588
|
+
box-sizing: border-box;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
.rivia-launcher .launcher-right {
|
|
1592
|
+
flex-shrink: 0;
|
|
1593
|
+
padding-right: 8px;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
.rivia-launcher .launcher-fraction {
|
|
1597
|
+
font-size: 13px;
|
|
1598
|
+
white-space: nowrap;
|
|
1599
|
+
}`;
|
|
1600
|
+
const fullData = { checklist, cssConfig, targetingData, customCSS };
|
|
1225
1601
|
sessionStorage.setItem(
|
|
1226
1602
|
`checklist_${checklist_id}`,
|
|
1227
1603
|
JSON.stringify(fullData)
|
|
@@ -1233,6 +1609,7 @@ async function Checklist(checklist_id, user_var) {
|
|
|
1233
1609
|
items,
|
|
1234
1610
|
cssConfig,
|
|
1235
1611
|
targetingData,
|
|
1612
|
+
customCSS,
|
|
1236
1613
|
user_var,
|
|
1237
1614
|
checklist_id
|
|
1238
1615
|
);
|