@saasquatch/squatch-js 2.3.2-2 → 2.3.2-3
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 +33 -6
- package/dist/squatch.min.js +3 -3
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/demo/toolbar.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component, useState, version } from "react";
|
|
1
|
+
import React, { Component, useRef, useState, version } from "react";
|
|
2
2
|
import { render } from "react-dom";
|
|
3
3
|
import squatch from "../dist/squatch";
|
|
4
4
|
|
|
@@ -298,7 +298,7 @@ function VersionList(props) {
|
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
async function getMockWidget(widget, engagementMedium) {
|
|
301
|
+
async function getMockWidget(widget, engagementMedium, element?: HTMLElement) {
|
|
302
302
|
window["mockWidget"] = widget;
|
|
303
303
|
window["sandbox"].initObj = {
|
|
304
304
|
...window["sandbox"].initObj,
|
|
@@ -318,7 +318,10 @@ async function getMockWidget(widget, engagementMedium) {
|
|
|
318
318
|
)
|
|
319
319
|
);
|
|
320
320
|
document.getElementById("squatchembed").innerHTML = "";
|
|
321
|
-
window["squatch"].widgets().upsertUser(
|
|
321
|
+
window["squatch"].widgets().upsertUser({
|
|
322
|
+
...window["sandbox"].initObj,
|
|
323
|
+
element,
|
|
324
|
+
});
|
|
322
325
|
}
|
|
323
326
|
|
|
324
327
|
async function getCustomWidget(engagementMedium) {
|
|
@@ -341,13 +344,17 @@ async function getCustomWidget(engagementMedium) {
|
|
|
341
344
|
)
|
|
342
345
|
);
|
|
343
346
|
document.getElementById("squatchembed").innerHTML = "";
|
|
344
|
-
window["squatch"].widgets().upsertUser(
|
|
347
|
+
window["squatch"].widgets().upsertUser({
|
|
348
|
+
...window["sandbox"].initObj,
|
|
349
|
+
element: <div className="sam"></div>,
|
|
350
|
+
});
|
|
345
351
|
}
|
|
346
352
|
|
|
347
353
|
function MockedWidgets(props) {
|
|
348
354
|
const { versions } = props;
|
|
349
|
-
|
|
350
355
|
const [engagementMedium, setEngagementMedium] = useState("EMBED");
|
|
356
|
+
const [showWidget, setShowWidget] = useState(false);
|
|
357
|
+
const [element, setElement] = useState(false);
|
|
351
358
|
return (
|
|
352
359
|
<details
|
|
353
360
|
title={"Version: " + window["sandbox"].version || "Head"}
|
|
@@ -371,6 +378,24 @@ function MockedWidgets(props) {
|
|
|
371
378
|
onClick={() => setEngagementMedium("POPUP")}
|
|
372
379
|
></input>
|
|
373
380
|
<br />
|
|
381
|
+
<button
|
|
382
|
+
onClick={() => {
|
|
383
|
+
if (showWidget) {
|
|
384
|
+
setShowWidget(false);
|
|
385
|
+
} else {
|
|
386
|
+
setShowWidget(true);
|
|
387
|
+
}
|
|
388
|
+
}}
|
|
389
|
+
>
|
|
390
|
+
{showWidget ? "hide widget" : "show widget"}
|
|
391
|
+
</button>
|
|
392
|
+
<div
|
|
393
|
+
style={{ display: showWidget ? "block" : "none" }}
|
|
394
|
+
ref={(el) => {
|
|
395
|
+
setElement(el);
|
|
396
|
+
}}
|
|
397
|
+
></div>
|
|
398
|
+
<br />
|
|
374
399
|
<button
|
|
375
400
|
onClick={() => getMockWidget("QuirksVanillaGA", engagementMedium)}
|
|
376
401
|
>
|
|
@@ -382,7 +407,9 @@ function MockedWidgets(props) {
|
|
|
382
407
|
<button onClick={() => getMockWidget("classic", engagementMedium)}>
|
|
383
408
|
Classic
|
|
384
409
|
</button>
|
|
385
|
-
<button
|
|
410
|
+
<button
|
|
411
|
+
onClick={() => getMockWidget("MintGA", engagementMedium, element)}
|
|
412
|
+
>
|
|
386
413
|
GA - Mint
|
|
387
414
|
</button>
|
|
388
415
|
<button onClick={() => getMockWidget("VanillaGA", engagementMedium)}>
|