@saasquatch/squatch-js 2.3.2-18 → 2.3.2-21
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/demo/toolbar.tsx +83 -45
- package/dist/squatch.min.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +2 -2
package/demo/toolbar.tsx
CHANGED
|
@@ -298,7 +298,12 @@ function VersionList(props) {
|
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
async function getMockWidget(
|
|
301
|
+
async function getMockWidget(
|
|
302
|
+
widget,
|
|
303
|
+
engagementMedium,
|
|
304
|
+
element?: HTMLElement,
|
|
305
|
+
showWidget?: boolean
|
|
306
|
+
) {
|
|
302
307
|
window["mockWidget"] = widget;
|
|
303
308
|
window["sandbox"].initObj = {
|
|
304
309
|
...window["sandbox"].initObj,
|
|
@@ -318,10 +323,13 @@ async function getMockWidget(widget, engagementMedium, element?: HTMLElement) {
|
|
|
318
323
|
)
|
|
319
324
|
);
|
|
320
325
|
document.getElementById("squatchembed").innerHTML = "";
|
|
321
|
-
|
|
326
|
+
|
|
327
|
+
await window["squatch"].widgets().upsertUser({
|
|
322
328
|
...window["sandbox"].initObj,
|
|
323
329
|
element,
|
|
324
330
|
});
|
|
331
|
+
|
|
332
|
+
if (showWidget) element.open();
|
|
325
333
|
}
|
|
326
334
|
|
|
327
335
|
async function getCustomWidget(engagementMedium) {
|
|
@@ -346,7 +354,6 @@ async function getCustomWidget(engagementMedium) {
|
|
|
346
354
|
document.getElementById("squatchembed").innerHTML = "";
|
|
347
355
|
window["squatch"].widgets().upsertUser({
|
|
348
356
|
...window["sandbox"].initObj,
|
|
349
|
-
element: <div className="sam"></div>,
|
|
350
357
|
});
|
|
351
358
|
}
|
|
352
359
|
|
|
@@ -358,7 +365,6 @@ function MockedWidgets(props) {
|
|
|
358
365
|
// const [element, setElement] = useState(false);
|
|
359
366
|
const element = usePreload && document.getElementById("squatchembed");
|
|
360
367
|
|
|
361
|
-
console.log("engagement medium?", engagementMedium);
|
|
362
368
|
return (
|
|
363
369
|
<details
|
|
364
370
|
title={"Version: " + window["sandbox"].version || "Head"}
|
|
@@ -367,38 +373,41 @@ function MockedWidgets(props) {
|
|
|
367
373
|
>
|
|
368
374
|
<summary>Mocked Widgets</summary>
|
|
369
375
|
<h4>Engagement Medium</h4>
|
|
370
|
-
<
|
|
371
|
-
|
|
372
|
-
type="radio"
|
|
373
|
-
name="embed"
|
|
374
|
-
checked={engagementMedium === "EMBED"}
|
|
375
|
-
onClick={() => setEngagementMedium("EMBED")}
|
|
376
|
-
></input>
|
|
376
|
+
<form onSubmit={(e) => e.preventDefault()}>
|
|
377
|
+
<label>Embed</label>
|
|
377
378
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
></input>
|
|
385
|
-
<br />
|
|
386
|
-
<h4>Preload</h4>
|
|
387
|
-
<label>true</label>
|
|
388
|
-
<input
|
|
389
|
-
type="radio"
|
|
390
|
-
name="preload"
|
|
391
|
-
checked={usePreload === true}
|
|
392
|
-
onClick={() => setUsePreload(true)}
|
|
393
|
-
></input>
|
|
379
|
+
<input
|
|
380
|
+
type="radio"
|
|
381
|
+
name="embed"
|
|
382
|
+
checked={engagementMedium === "EMBED"}
|
|
383
|
+
onClick={() => setEngagementMedium("EMBED")}
|
|
384
|
+
></input>
|
|
394
385
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
386
|
+
<label>Popup</label>
|
|
387
|
+
<input
|
|
388
|
+
type="radio"
|
|
389
|
+
name="popup"
|
|
390
|
+
checked={engagementMedium === "POPUP"}
|
|
391
|
+
onClick={() => setEngagementMedium("POPUP")}
|
|
392
|
+
></input>
|
|
393
|
+
<br />
|
|
394
|
+
<h4>Preload</h4>
|
|
395
|
+
<label>true</label>
|
|
396
|
+
<input
|
|
397
|
+
type="radio"
|
|
398
|
+
name="preload"
|
|
399
|
+
checked={usePreload === true}
|
|
400
|
+
onClick={() => setUsePreload(true)}
|
|
401
|
+
></input>
|
|
402
|
+
|
|
403
|
+
<label>false</label>
|
|
404
|
+
<input
|
|
405
|
+
type="radio"
|
|
406
|
+
name="noPreload"
|
|
407
|
+
checked={usePreload === false}
|
|
408
|
+
onClick={() => setUsePreload(false)}
|
|
409
|
+
></input>
|
|
410
|
+
</form>
|
|
402
411
|
<br />
|
|
403
412
|
<button
|
|
404
413
|
onClick={() => {
|
|
@@ -406,7 +415,6 @@ function MockedWidgets(props) {
|
|
|
406
415
|
setShowWidget(false);
|
|
407
416
|
element?.close();
|
|
408
417
|
} else {
|
|
409
|
-
console.log("element?", element);
|
|
410
418
|
setShowWidget(true);
|
|
411
419
|
element?.open();
|
|
412
420
|
}
|
|
@@ -417,41 +425,64 @@ function MockedWidgets(props) {
|
|
|
417
425
|
<br />
|
|
418
426
|
<button
|
|
419
427
|
onClick={() =>
|
|
420
|
-
getMockWidget(
|
|
428
|
+
getMockWidget(
|
|
429
|
+
"QuirksVanillaGA",
|
|
430
|
+
engagementMedium,
|
|
431
|
+
element,
|
|
432
|
+
showWidget
|
|
433
|
+
)
|
|
421
434
|
}
|
|
422
435
|
>
|
|
423
436
|
Quirks mode - Vanilla
|
|
424
437
|
</button>
|
|
425
438
|
<button
|
|
426
|
-
onClick={() =>
|
|
439
|
+
onClick={() =>
|
|
440
|
+
getMockWidget("QuirksMintGA", engagementMedium, element, showWidget)
|
|
441
|
+
}
|
|
427
442
|
>
|
|
428
443
|
Quirks mode - Mint
|
|
429
444
|
</button>
|
|
430
445
|
<button
|
|
431
|
-
onClick={() =>
|
|
446
|
+
onClick={() =>
|
|
447
|
+
getMockWidget("classic", engagementMedium, element, showWidget)
|
|
448
|
+
}
|
|
432
449
|
>
|
|
433
450
|
Classic
|
|
434
451
|
</button>
|
|
435
452
|
<button
|
|
436
|
-
onClick={() =>
|
|
453
|
+
onClick={() =>
|
|
454
|
+
getMockWidget("MintGA", engagementMedium, element, showWidget)
|
|
455
|
+
}
|
|
437
456
|
>
|
|
438
457
|
GA - Mint
|
|
439
458
|
</button>
|
|
440
459
|
<button
|
|
441
|
-
onClick={() =>
|
|
460
|
+
onClick={() =>
|
|
461
|
+
getMockWidget("VanillaGA", engagementMedium, element, showWidget)
|
|
462
|
+
}
|
|
442
463
|
>
|
|
443
464
|
GA - Vanilla
|
|
444
465
|
</button>
|
|
445
466
|
<button
|
|
446
467
|
onClick={() =>
|
|
447
|
-
getMockWidget(
|
|
468
|
+
getMockWidget(
|
|
469
|
+
"MintGAContainer",
|
|
470
|
+
engagementMedium,
|
|
471
|
+
element,
|
|
472
|
+
showWidget
|
|
473
|
+
)
|
|
448
474
|
}
|
|
449
475
|
>
|
|
450
476
|
Mint - With Container
|
|
451
477
|
</button>
|
|
452
478
|
<button
|
|
453
479
|
onClick={() =>
|
|
454
|
-
getMockWidget(
|
|
480
|
+
getMockWidget(
|
|
481
|
+
"QuirksMintGAContainer",
|
|
482
|
+
engagementMedium,
|
|
483
|
+
element,
|
|
484
|
+
showWidget
|
|
485
|
+
)
|
|
455
486
|
}
|
|
456
487
|
>
|
|
457
488
|
Quirks mode - Mint - With Container
|
|
@@ -461,7 +492,8 @@ function MockedWidgets(props) {
|
|
|
461
492
|
getMockWidget(
|
|
462
493
|
"MintGAContainerDisplayBlock",
|
|
463
494
|
engagementMedium,
|
|
464
|
-
element
|
|
495
|
+
element,
|
|
496
|
+
showWidget
|
|
465
497
|
)
|
|
466
498
|
}
|
|
467
499
|
>
|
|
@@ -472,7 +504,8 @@ function MockedWidgets(props) {
|
|
|
472
504
|
getMockWidget(
|
|
473
505
|
"QuirksMintGAContainerDisplayBlock",
|
|
474
506
|
engagementMedium,
|
|
475
|
-
element
|
|
507
|
+
element,
|
|
508
|
+
showWidget
|
|
476
509
|
)
|
|
477
510
|
}
|
|
478
511
|
>
|
|
@@ -480,7 +513,12 @@ function MockedWidgets(props) {
|
|
|
480
513
|
</button>
|
|
481
514
|
<button
|
|
482
515
|
onClick={() =>
|
|
483
|
-
getMockWidget(
|
|
516
|
+
getMockWidget(
|
|
517
|
+
"VanillaGANoContainer",
|
|
518
|
+
engagementMedium,
|
|
519
|
+
element,
|
|
520
|
+
showWidget
|
|
521
|
+
)
|
|
484
522
|
}
|
|
485
523
|
>
|
|
486
524
|
Vanilla - No Container
|