@saasquatch/squatch-js 2.3.1-5 → 2.3.2-0
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/CHANGELOG.md +6 -1
- package/demo/generate.tsx +2 -6
- package/demo/templates/MintGA.ts +53 -2
- package/demo/templates/MintGAContainer.ts +52 -2
- package/demo/templates/MintGAContainerDisplayBlock.ts +52 -2
- package/demo/templates/QuirksMintGA.ts +52 -2
- package/demo/templates/QuirksMintGAContainer.ts +52 -2
- package/demo/templates/QuirksMintGAContainerDisplayBlock.ts +52 -2
- package/demo/templates/VanillaGANoContainer.ts +1 -1
- package/demo/templates/classic.ts +1221 -121
- package/demo/toolbar.tsx +75 -20
- package/dist/squatch.min.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/demo/toolbar.tsx
CHANGED
|
@@ -298,11 +298,11 @@ function VersionList(props) {
|
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
async function getMockWidget(widget) {
|
|
301
|
+
async function getMockWidget(widget, engagementMedium) {
|
|
302
302
|
window["mockWidget"] = widget;
|
|
303
303
|
window["sandbox"].initObj = {
|
|
304
304
|
...window["sandbox"].initObj,
|
|
305
|
-
engagementMedium
|
|
305
|
+
engagementMedium,
|
|
306
306
|
};
|
|
307
307
|
|
|
308
308
|
worker.use(
|
|
@@ -318,14 +318,13 @@ async function getMockWidget(widget) {
|
|
|
318
318
|
)
|
|
319
319
|
);
|
|
320
320
|
document.getElementById("squatchembed").innerHTML = "";
|
|
321
|
-
window["squatch"].widgets().
|
|
322
|
-
// window.location.href = `/?widgetType=${widget}`;
|
|
321
|
+
window["squatch"].widgets().renderGA(window["sandbox"].initObj);
|
|
323
322
|
}
|
|
324
323
|
|
|
325
|
-
async function getCustomWidget() {
|
|
324
|
+
async function getCustomWidget(engagementMedium) {
|
|
326
325
|
window["sandbox"].initObj = {
|
|
327
326
|
...window["sandbox"].initObj,
|
|
328
|
-
engagementMedium
|
|
327
|
+
engagementMedium,
|
|
329
328
|
};
|
|
330
329
|
|
|
331
330
|
const value = document.getElementById("custom-widget")?.value;
|
|
@@ -342,13 +341,13 @@ async function getCustomWidget() {
|
|
|
342
341
|
)
|
|
343
342
|
);
|
|
344
343
|
document.getElementById("squatchembed").innerHTML = "";
|
|
345
|
-
window["squatch"].widgets().
|
|
346
|
-
// window.location.href = `/?widgetType=${widget}`;
|
|
344
|
+
window["squatch"].widgets().renderGA(window["sandbox"].initObj);
|
|
347
345
|
}
|
|
348
346
|
|
|
349
347
|
function MockedWidgets(props) {
|
|
350
348
|
const { versions } = props;
|
|
351
349
|
|
|
350
|
+
const [engagementMedium, setEngagementMedium] = useState("EMBED");
|
|
352
351
|
return (
|
|
353
352
|
<details
|
|
354
353
|
title={"Version: " + window["sandbox"].version || "Head"}
|
|
@@ -356,28 +355,66 @@ function MockedWidgets(props) {
|
|
|
356
355
|
id={`dropdown-basic-1`}
|
|
357
356
|
>
|
|
358
357
|
<summary>Mocked Widgets</summary>
|
|
359
|
-
<
|
|
358
|
+
<label>Embed</label>
|
|
359
|
+
<input
|
|
360
|
+
type="radio"
|
|
361
|
+
name="embed"
|
|
362
|
+
checked={engagementMedium === "EMBED"}
|
|
363
|
+
onClick={() => setEngagementMedium("EMBED")}
|
|
364
|
+
></input>
|
|
365
|
+
|
|
366
|
+
<label>Popup</label>
|
|
367
|
+
<input
|
|
368
|
+
type="radio"
|
|
369
|
+
name="popup"
|
|
370
|
+
checked={engagementMedium === "POPUP"}
|
|
371
|
+
onClick={() => setEngagementMedium("POPUP")}
|
|
372
|
+
></input>
|
|
373
|
+
<br />
|
|
374
|
+
<button
|
|
375
|
+
onClick={() => getMockWidget("QuirksVanillaGA", engagementMedium)}
|
|
376
|
+
>
|
|
360
377
|
Quirks mode - Vanilla
|
|
361
378
|
</button>
|
|
362
|
-
<button onClick={() => getMockWidget("QuirksMintGA")}>
|
|
379
|
+
<button onClick={() => getMockWidget("QuirksMintGA", engagementMedium)}>
|
|
363
380
|
Quirks mode - Mint
|
|
364
381
|
</button>
|
|
365
|
-
<button onClick={() => getMockWidget("classic")}>
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
<button onClick={() => getMockWidget("
|
|
382
|
+
<button onClick={() => getMockWidget("classic", engagementMedium)}>
|
|
383
|
+
Classic
|
|
384
|
+
</button>
|
|
385
|
+
<button onClick={() => getMockWidget("MintGA", engagementMedium)}>
|
|
386
|
+
GA - Mint
|
|
387
|
+
</button>
|
|
388
|
+
<button onClick={() => getMockWidget("VanillaGA", engagementMedium)}>
|
|
389
|
+
GA - Vanilla
|
|
390
|
+
</button>
|
|
391
|
+
<button
|
|
392
|
+
onClick={() => getMockWidget("MintGAContainer", engagementMedium)}
|
|
393
|
+
>
|
|
369
394
|
Mint - With Container
|
|
370
395
|
</button>
|
|
371
|
-
<button
|
|
396
|
+
<button
|
|
397
|
+
onClick={() => getMockWidget("QuirksMintGAContainer", engagementMedium)}
|
|
398
|
+
>
|
|
372
399
|
Quirks mode - Mint - With Container
|
|
373
400
|
</button>
|
|
374
|
-
<button
|
|
401
|
+
<button
|
|
402
|
+
onClick={() =>
|
|
403
|
+
getMockWidget("MintGAContainerDisplayBlock", engagementMedium)
|
|
404
|
+
}
|
|
405
|
+
>
|
|
375
406
|
Mint - With Container + Display Block
|
|
376
407
|
</button>
|
|
377
|
-
<button
|
|
408
|
+
<button
|
|
409
|
+
onClick={() =>
|
|
410
|
+
getMockWidget("QuirksMintGAContainerDisplayBlock", engagementMedium)
|
|
411
|
+
}
|
|
412
|
+
>
|
|
378
413
|
Quirks mode - Mint - With Container + Display Block
|
|
379
414
|
</button>
|
|
380
|
-
<button
|
|
415
|
+
<button
|
|
416
|
+
onClick={() => getMockWidget("VanillaGANoContainer", engagementMedium)}
|
|
417
|
+
>
|
|
381
418
|
Vanilla - No Container
|
|
382
419
|
</button>
|
|
383
420
|
</details>
|
|
@@ -386,7 +423,7 @@ function MockedWidgets(props) {
|
|
|
386
423
|
|
|
387
424
|
function CustomMockedWidget(props) {
|
|
388
425
|
const { versions } = props;
|
|
389
|
-
|
|
426
|
+
const [engagementMedium, setEngagementMedium] = useState("EMBED");
|
|
390
427
|
return (
|
|
391
428
|
<details
|
|
392
429
|
title={"Version: " + window["sandbox"].version || "Head"}
|
|
@@ -394,6 +431,22 @@ function CustomMockedWidget(props) {
|
|
|
394
431
|
id={`dropdown-basic-1`}
|
|
395
432
|
>
|
|
396
433
|
<summary>Custom Mocked Widget</summary>
|
|
434
|
+
<label>Embed</label>
|
|
435
|
+
<input
|
|
436
|
+
type="radio"
|
|
437
|
+
name="embed"
|
|
438
|
+
checked={engagementMedium === "EMBED"}
|
|
439
|
+
onClick={() => setEngagementMedium("EMBED")}
|
|
440
|
+
></input>
|
|
441
|
+
|
|
442
|
+
<label>Popup</label>
|
|
443
|
+
<input
|
|
444
|
+
type="radio"
|
|
445
|
+
name="popup"
|
|
446
|
+
checked={engagementMedium === "POPUP"}
|
|
447
|
+
onClick={() => setEngagementMedium("POPUP")}
|
|
448
|
+
></input>
|
|
449
|
+
<br />
|
|
397
450
|
<textarea
|
|
398
451
|
id="custom-widget"
|
|
399
452
|
rows={15}
|
|
@@ -401,7 +454,9 @@ function CustomMockedWidget(props) {
|
|
|
401
454
|
style={{ maxWidth: "100%" }}
|
|
402
455
|
></textarea>
|
|
403
456
|
<div>
|
|
404
|
-
<button onClick={() => getCustomWidget()}>
|
|
457
|
+
<button onClick={() => getCustomWidget(engagementMedium)}>
|
|
458
|
+
Load Widget
|
|
459
|
+
</button>
|
|
405
460
|
</div>
|
|
406
461
|
</details>
|
|
407
462
|
);
|