@xylabs/sdk-react 2.9.9 → 2.9.13
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/calcSpacing.js +3 -3
- package/dist/calcSpacing.js.map +1 -1
- package/dist/cjs5/components/Portal.d.ts +1 -0
- package/dist/cjs5/index.js +1127 -1651
- package/dist/cjs5/index.js.map +1 -1
- package/dist/components/AppBarEx/AppBarEx.js +7 -7
- package/dist/components/AppBarEx/AppBarEx.js.map +1 -1
- package/dist/components/AppBarEx/AppBarEx.stories.js +3 -4
- package/dist/components/AppBarEx/AppBarEx.stories.js.map +1 -1
- package/dist/components/Background.js +2 -3
- package/dist/components/Background.js.map +1 -1
- package/dist/components/BasePage/BasePage.js +7 -6
- package/dist/components/BasePage/BasePage.js.map +1 -1
- package/dist/components/BasePage/BasePage.stories.js +5 -6
- package/dist/components/BasePage/BasePage.stories.js.map +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsEx.js +12 -12
- package/dist/components/Breadcrumbs/BreadcrumbsEx.js.map +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsEx.stories.js +4 -5
- package/dist/components/Breadcrumbs/BreadcrumbsEx.stories.js.map +1 -1
- package/dist/components/BusyCircularProgress.js +5 -5
- package/dist/components/BusyCircularProgress.js.map +1 -1
- package/dist/components/BusyLinearProgress.js +5 -5
- package/dist/components/BusyLinearProgress.js.map +1 -1
- package/dist/components/ButtonEx/ButtonEx.js +5 -5
- package/dist/components/ButtonEx/ButtonEx.js.map +1 -1
- package/dist/components/ButtonEx/ButtonEx.stories.js +5 -6
- package/dist/components/ButtonEx/ButtonEx.stories.js.map +1 -1
- package/dist/components/ButtonEx/ButtonExBase.js +6 -6
- package/dist/components/ButtonEx/ButtonExBase.js.map +1 -1
- package/dist/components/ButtonEx/ButtonExTo.js +6 -6
- package/dist/components/ButtonEx/ButtonExTo.js.map +1 -1
- package/dist/components/CookieConsent/CookieConsent.js +5 -6
- package/dist/components/CookieConsent/CookieConsent.js.map +1 -1
- package/dist/components/CookieConsent/CookieConsent.stories.js +10 -11
- package/dist/components/CookieConsent/CookieConsent.stories.js.map +1 -1
- package/dist/components/CookieConsent/CookieConsentBody.js +11 -11
- package/dist/components/CookieConsent/CookieConsentBody.js.map +1 -1
- package/dist/components/CoverProgress.js +4 -5
- package/dist/components/CoverProgress.js.map +1 -1
- package/dist/components/Errors/ErrorViewer.js +5 -5
- package/dist/components/Errors/ErrorViewer.js.map +1 -1
- package/dist/components/Errors/ErrorViewer.stories.js +3 -4
- package/dist/components/Errors/ErrorViewer.stories.js.map +1 -1
- package/dist/components/Errors/ErrorsViewer.js +5 -5
- package/dist/components/Errors/ErrorsViewer.js.map +1 -1
- package/dist/components/Errors/ErrorsViewer.stories.js +3 -4
- package/dist/components/Errors/ErrorsViewer.stories.js.map +1 -1
- package/dist/components/EthAccount/EthAccount.js +12 -12
- package/dist/components/EthAccount/EthAccount.js.map +1 -1
- package/dist/components/EthAccount/EthAccount.stories.js +8 -9
- package/dist/components/EthAccount/EthAccount.stories.js.map +1 -1
- package/dist/components/EthBlock.js +3 -4
- package/dist/components/EthBlock.js.map +1 -1
- package/dist/components/Experiments/Experiment.js +2 -2
- package/dist/components/Experiments/Experiment.js.map +1 -1
- package/dist/components/Experiments/Experiments.js +43 -66
- package/dist/components/Experiments/Experiments.js.map +1 -1
- package/dist/components/Experiments/Experiments.stories.js +5 -6
- package/dist/components/Experiments/Experiments.stories.js.map +1 -1
- package/dist/components/Experiments/ExperimentsDebugger.js +20 -22
- package/dist/components/Experiments/ExperimentsDebugger.js.map +1 -1
- package/dist/components/Experiments/ExperimentsDebugger.stories.js +3 -4
- package/dist/components/Experiments/ExperimentsDebugger.stories.js.map +1 -1
- package/dist/components/Experiments/models/index.js +2 -2
- package/dist/components/Experiments/models/index.js.map +1 -1
- package/dist/components/FlexBox/BusyBox.js +6 -6
- package/dist/components/FlexBox/BusyBox.js.map +1 -1
- package/dist/components/FlexBox/BusyBox.stories.js +7 -8
- package/dist/components/FlexBox/BusyBox.stories.js.map +1 -1
- package/dist/components/FlexBox/FlexCol.js +4 -5
- package/dist/components/FlexBox/FlexCol.js.map +1 -1
- package/dist/components/FlexBox/FlexCol.stories.js +10 -11
- package/dist/components/FlexBox/FlexCol.stories.js.map +1 -1
- package/dist/components/FlexBox/FlexRow.js +4 -5
- package/dist/components/FlexBox/FlexRow.js.map +1 -1
- package/dist/components/FlexBox/FlexRow.stories.js +14 -15
- package/dist/components/FlexBox/FlexRow.stories.js.map +1 -1
- package/dist/components/HoverScale.js +12 -15
- package/dist/components/HoverScale.js.map +1 -1
- package/dist/components/Identicon.js +22 -22
- package/dist/components/Identicon.js.map +1 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeContext.js +1 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeContext.js.map +1 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.js +7 -9
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.js.map +1 -1
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.stories.js +3 -4
- package/dist/components/InvertableThemeProvider/InvertableThemeProvider.stories.js.map +1 -1
- package/dist/components/LinkEx/LinkToEx.js +4 -4
- package/dist/components/LinkEx/LinkToEx.js.map +1 -1
- package/dist/components/NumberStatus/NumberStatus.js +10 -10
- package/dist/components/NumberStatus/NumberStatus.js.map +1 -1
- package/dist/components/NumberStatus/NumberStatus.stories.js +11 -12
- package/dist/components/NumberStatus/NumberStatus.stories.js.map +1 -1
- package/dist/components/Portal.d.ts +1 -0
- package/dist/components/Portal.js +21 -0
- package/dist/components/Portal.js.map +1 -0
- package/dist/components/QuickTipButton/QuickTipButton.js +5 -5
- package/dist/components/QuickTipButton/QuickTipButton.js.map +1 -1
- package/dist/components/QuickTipButton/QuickTipButton.stories.js +3 -4
- package/dist/components/QuickTipButton/QuickTipButton.stories.js.map +1 -1
- package/dist/components/RedirectWithQuery.js +6 -8
- package/dist/components/RedirectWithQuery.js.map +1 -1
- package/dist/components/RichResult/RichResult.js +4 -5
- package/dist/components/RichResult/RichResult.js.map +1 -1
- package/dist/components/ScrollToTop.js +3 -3
- package/dist/components/ScrollToTop.js.map +1 -1
- package/dist/components/ScrollToTopButton.js +8 -8
- package/dist/components/ScrollToTopButton.js.map +1 -1
- package/dist/components/TokenAmount/TokenAmount.js +8 -8
- package/dist/components/TokenAmount/TokenAmount.js.map +1 -1
- package/dist/components/TokenAmount/TokenAmount.stories.js +9 -10
- package/dist/components/TokenAmount/TokenAmount.stories.js.map +1 -1
- package/dist/components/dialogs/ErrorDialog.js +12 -12
- package/dist/components/dialogs/ErrorDialog.js.map +1 -1
- package/dist/components/dialogs/ErrorDialog.stories.js +3 -4
- package/dist/components/dialogs/ErrorDialog.stories.js.map +1 -1
- package/dist/components/dialogs/MessageDialog.js +4 -4
- package/dist/components/dialogs/MessageDialog.js.map +1 -1
- package/dist/components/dialogs/MessageDialog.stories.js +3 -4
- package/dist/components/dialogs/MessageDialog.stories.js.map +1 -1
- package/dist/contexts/CookieConsent/Context.js +1 -1
- package/dist/contexts/CookieConsent/Context.js.map +1 -1
- package/dist/contexts/CookieConsent/Loader.js +8 -10
- package/dist/contexts/CookieConsent/Loader.js.map +1 -1
- package/dist/contexts/CookieConsent/use.js +1 -1
- package/dist/contexts/CookieConsent/use.js.map +1 -1
- package/dist/contexts/Ethers/Context.js +1 -1
- package/dist/contexts/Ethers/Context.js.map +1 -1
- package/dist/contexts/Ethers/Infura.js +8 -9
- package/dist/contexts/Ethers/Infura.js.map +1 -1
- package/dist/contexts/Ethers/Loader.js +3 -3
- package/dist/contexts/Ethers/Loader.js.map +1 -1
- package/dist/contexts/Ethers/MetaMask.js +73 -100
- package/dist/contexts/Ethers/MetaMask.js.map +1 -1
- package/dist/contexts/Ethers/MyEtherWallet.js +54 -80
- package/dist/contexts/Ethers/MyEtherWallet.js.map +1 -1
- package/dist/contexts/Ethers/Opera.js +39 -51
- package/dist/contexts/Ethers/Opera.js.map +1 -1
- package/dist/contexts/Ethers/Trust.js +30 -42
- package/dist/contexts/Ethers/Trust.js.map +1 -1
- package/dist/contexts/NetworkSettings/Context.js +1 -1
- package/dist/contexts/NetworkSettings/Context.js.map +1 -1
- package/dist/contexts/NetworkSettings/Loader.js +3 -4
- package/dist/contexts/NetworkSettings/Loader.js.map +1 -1
- package/dist/contexts/UserEvents/Context.js +1 -1
- package/dist/contexts/UserEvents/Context.js.map +1 -1
- package/dist/contexts/UserEvents/Loader.js +2 -4
- package/dist/contexts/UserEvents/Loader.js.map +1 -1
- package/dist/esm2015/components/Portal.d.ts +1 -0
- package/dist/esm2015/index.js +1127 -1651
- package/dist/esm2015/index.js.map +1 -1
- package/dist/esm2017/components/Portal.d.ts +1 -0
- package/dist/esm2017/index.js +1127 -1651
- package/dist/esm2017/index.js.map +1 -1
- package/dist/esm5/components/Portal.d.ts +1 -0
- package/dist/esm5/index.js +1127 -1651
- package/dist/esm5/index.js.map +1 -1
- package/dist/hooks/useBreakpoint.js +7 -7
- package/dist/hooks/useBreakpoint.js.map +1 -1
- package/dist/hooks/useLocalStorage.js +5 -6
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useMounted.js +5 -6
- package/dist/hooks/useMounted.js.map +1 -1
- package/dist/hooks/useNavigateToEthAddress.js +7 -7
- package/dist/hooks/useNavigateToEthAddress.js.map +1 -1
- package/dist/hooks/useSpacing.js +2 -2
- package/dist/hooks/useSpacing.js.map +1 -1
- package/dist/hooks/useUserEvents.js +5 -2
- package/dist/hooks/useUserEvents.js.map +1 -1
- package/dist/hooks/useWebP.js +19 -32
- package/dist/hooks/useWebP.js.map +1 -1
- package/dist/hooks/useWindowSize.js +4 -5
- package/dist/hooks/useWindowSize.js.map +1 -1
- package/dist/lib/Tracking/Drip/BaseEvent.js +18 -28
- package/dist/lib/Tracking/Drip/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Drip/CustomEvent.js +2 -8
- package/dist/lib/Tracking/Drip/CustomEvent.js.map +1 -1
- package/dist/lib/Tracking/Drip/StandardEvents.js +4 -7
- package/dist/lib/Tracking/Drip/StandardEvents.js.map +1 -1
- package/dist/lib/Tracking/Facebook/BaseEvent.js +8 -16
- package/dist/lib/Tracking/Facebook/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Facebook/CustomEvent.js +8 -21
- package/dist/lib/Tracking/Facebook/CustomEvent.js.map +1 -1
- package/dist/lib/Tracking/Facebook/Fbq.js +11 -13
- package/dist/lib/Tracking/Facebook/Fbq.js.map +1 -1
- package/dist/lib/Tracking/Facebook/StandardEvent.js +8 -21
- package/dist/lib/Tracking/Facebook/StandardEvent.js.map +1 -1
- package/dist/lib/Tracking/Facebook/StandardEvents.js +38 -42
- package/dist/lib/Tracking/Facebook/StandardEvents.js.map +1 -1
- package/dist/lib/Tracking/Facebook/UserEventHandler.js +23 -54
- package/dist/lib/Tracking/Facebook/UserEventHandler.js.map +1 -1
- package/dist/lib/Tracking/Google/BaseEvent.js +23 -45
- package/dist/lib/Tracking/Google/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Google/CustomEvent.js +2 -8
- package/dist/lib/Tracking/Google/CustomEvent.js.map +1 -1
- package/dist/lib/Tracking/Google/Gtag.js +37 -41
- package/dist/lib/Tracking/Google/Gtag.js.map +1 -1
- package/dist/lib/Tracking/Google/Gtm.js +18 -21
- package/dist/lib/Tracking/Google/Gtm.js.map +1 -1
- package/dist/lib/Tracking/Google/StandardEvent.js +2 -8
- package/dist/lib/Tracking/Google/StandardEvent.js.map +1 -1
- package/dist/lib/Tracking/Google/StandardEvents.js +62 -66
- package/dist/lib/Tracking/Google/StandardEvents.js.map +1 -1
- package/dist/lib/Tracking/Google/UserEventHandler.js +23 -54
- package/dist/lib/Tracking/Google/UserEventHandler.js.map +1 -1
- package/dist/lib/Tracking/Reddit/BaseEvent.js +8 -16
- package/dist/lib/Tracking/Reddit/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Reddit/CustomEvent.js +8 -21
- package/dist/lib/Tracking/Reddit/CustomEvent.js.map +1 -1
- package/dist/lib/Tracking/Reddit/Rdt.js +11 -15
- package/dist/lib/Tracking/Reddit/Rdt.js.map +1 -1
- package/dist/lib/Tracking/Reddit/StandardEvent.js +8 -21
- package/dist/lib/Tracking/Reddit/StandardEvent.js.map +1 -1
- package/dist/lib/Tracking/Reddit/StandardEvents.js +18 -21
- package/dist/lib/Tracking/Reddit/StandardEvents.js.map +1 -1
- package/dist/lib/Tracking/Referrer.js +12 -13
- package/dist/lib/Tracking/Referrer.js.map +1 -1
- package/dist/lib/Tracking/Snapchat/BaseEvent.js +8 -16
- package/dist/lib/Tracking/Snapchat/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Snapchat/Snaptr.js +10 -21
- package/dist/lib/Tracking/Snapchat/Snaptr.js.map +1 -1
- package/dist/lib/Tracking/Snapchat/StandardEvent.js +7 -19
- package/dist/lib/Tracking/Snapchat/StandardEvent.js.map +1 -1
- package/dist/lib/Tracking/Snapchat/StandardEvents.js +60 -64
- package/dist/lib/Tracking/Snapchat/StandardEvents.js.map +1 -1
- package/dist/lib/Tracking/Tiktok/BaseEvent.js +8 -16
- package/dist/lib/Tracking/Tiktok/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Tiktok/CustomEvent.js +8 -21
- package/dist/lib/Tracking/Tiktok/CustomEvent.js.map +1 -1
- package/dist/lib/Tracking/Tiktok/StandardEvent.js +8 -21
- package/dist/lib/Tracking/Tiktok/StandardEvent.js.map +1 -1
- package/dist/lib/Tracking/Tiktok/StandardEvents.js +34 -38
- package/dist/lib/Tracking/Tiktok/StandardEvents.js.map +1 -1
- package/dist/lib/Tracking/Tiktok/Ttq.js +14 -18
- package/dist/lib/Tracking/Tiktok/Ttq.js.map +1 -1
- package/dist/lib/Tracking/Xy/BaseEvent.js +8 -16
- package/dist/lib/Tracking/Xy/BaseEvent.js.map +1 -1
- package/dist/lib/Tracking/Xy/CustomEvent.js +2 -8
- package/dist/lib/Tracking/Xy/CustomEvent.js.map +1 -1
- package/dist/lib/Tracking/Xy/StandardEvent.js +2 -8
- package/dist/lib/Tracking/Xy/StandardEvent.js.map +1 -1
- package/dist/lib/Tracking/Xy/UserEventHandler.js +23 -54
- package/dist/lib/Tracking/Xy/UserEventHandler.js.map +1 -1
- package/dist/lib/Tracking/XyoUserEventHandler.js +22 -54
- package/dist/lib/Tracking/XyoUserEventHandler.js.map +1 -1
- package/dist/lib/getApiStage.js +1 -1
- package/dist/lib/getApiStage.js.map +1 -1
- package/dist/lib/global.js +1 -1
- package/dist/lib/global.js.map +1 -1
- package/dist/lib/isLocalHost.js +1 -1
- package/dist/lib/isLocalHost.js.map +1 -1
- package/dist/lib/profile.js +13 -22
- package/dist/lib/profile.js.map +1 -1
- package/dist/lib/safeLocalStorage.js +3 -3
- package/dist/lib/safeLocalStorage.js.map +1 -1
- package/dist/lib/safeSessionStorage.js +3 -3
- package/dist/lib/safeSessionStorage.js.map +1 -1
- package/dist/lib/useAsyncEffect.js +5 -5
- package/dist/lib/useAsyncEffect.js.map +1 -1
- package/dist/mergeBoxlikeStyles.js +19 -5
- package/dist/mergeBoxlikeStyles.js.map +1 -1
- package/dist/node/components/Portal.d.ts +1 -0
- package/dist/node/index.js +1127 -1651
- package/dist/node/index.js.map +1 -1
- package/dist/node-esm/components/Portal.d.ts +1 -0
- package/dist/node-esm/index.js +1127 -1651
- package/dist/node-esm/index.js.map +1 -1
- package/package.json +13 -12
- package/src/components/BasePage/BasePage.tsx +2 -0
- package/src/components/Portal.tsx +28 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/useUserEvents.ts +3 -0
package/dist/node-esm/index.js
CHANGED
|
@@ -30,33 +30,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
30
30
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
31
31
|
PERFORMANCE OF THIS SOFTWARE.
|
|
32
32
|
***************************************************************************** */
|
|
33
|
-
/* global Reflect, Promise */
|
|
34
|
-
|
|
35
|
-
var extendStatics = function(d, b) {
|
|
36
|
-
extendStatics = Object.setPrototypeOf ||
|
|
37
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
38
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
39
|
-
return extendStatics(d, b);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
function __extends(d, b) {
|
|
43
|
-
if (typeof b !== "function" && b !== null)
|
|
44
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
45
|
-
extendStatics(d, b);
|
|
46
|
-
function __() { this.constructor = d; }
|
|
47
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
var __assign = function() {
|
|
51
|
-
__assign = Object.assign || function __assign(t) {
|
|
52
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
53
|
-
s = arguments[i];
|
|
54
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
55
|
-
}
|
|
56
|
-
return t;
|
|
57
|
-
};
|
|
58
|
-
return __assign.apply(this, arguments);
|
|
59
|
-
};
|
|
60
33
|
|
|
61
34
|
function __rest(s, e) {
|
|
62
35
|
var t = {};
|
|
@@ -78,176 +51,107 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
78
51
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
79
52
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
80
53
|
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function __generator(thisArg, body) {
|
|
84
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
85
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
86
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
87
|
-
function step(op) {
|
|
88
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
-
while (_) try {
|
|
90
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
91
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
92
|
-
switch (op[0]) {
|
|
93
|
-
case 0: case 1: t = op; break;
|
|
94
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
95
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
96
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
97
|
-
default:
|
|
98
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
99
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
100
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
101
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
102
|
-
if (t[2]) _.ops.pop();
|
|
103
|
-
_.trys.pop(); continue;
|
|
104
|
-
}
|
|
105
|
-
op = body.call(thisArg, _);
|
|
106
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
107
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function __values(o) {
|
|
112
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
113
|
-
if (m) return m.call(o);
|
|
114
|
-
if (o && typeof o.length === "number") return {
|
|
115
|
-
next: function () {
|
|
116
|
-
if (o && i >= o.length) o = void 0;
|
|
117
|
-
return { value: o && o[i++], done: !o };
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function __read(o, n) {
|
|
124
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
125
|
-
if (!m) return o;
|
|
126
|
-
var i = m.call(o), r, ar = [], e;
|
|
127
|
-
try {
|
|
128
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
129
|
-
}
|
|
130
|
-
catch (error) { e = { error: error }; }
|
|
131
|
-
finally {
|
|
132
|
-
try {
|
|
133
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
134
|
-
}
|
|
135
|
-
finally { if (e) throw e.error; }
|
|
136
|
-
}
|
|
137
|
-
return ar;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function __spreadArray(to, from, pack) {
|
|
141
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
142
|
-
if (ar || !(i in from)) {
|
|
143
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
144
|
-
ar[i] = from[i];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
148
54
|
}
|
|
149
55
|
|
|
150
|
-
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
return (jsx(Box,
|
|
56
|
+
const BusyCircularProgress = (_a) => {
|
|
57
|
+
var { bgcolor, style, rounded, size, opacity = 0.85 } = _a, props = __rest(_a, ["bgcolor", "style", "rounded", "size", "opacity"]);
|
|
58
|
+
const theme = useTheme();
|
|
59
|
+
return (jsx(Box, Object.assign({ display: "flex", bgcolor: alpha(bgcolor !== null && bgcolor !== void 0 ? bgcolor : theme.palette.background.default, parseFloat(`${opacity}`)), flexGrow: 1, position: "absolute", left: 0, right: 0, top: 0, bottom: 0, justifyContent: "center", alignItems: "center", overflow: "hidden", style: Object.assign({ borderRadius: rounded ? theme.shape.borderRadius : 0 }, style) }, { children: jsx(CircularProgress, Object.assign({ size: size }, props), void 0) }), void 0));
|
|
154
60
|
};
|
|
155
61
|
|
|
156
|
-
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
return (jsx(Box,
|
|
62
|
+
const BusyLinearProgress = (_a) => {
|
|
63
|
+
var { bgcolor, style, rounded, opacity = 0.85 } = _a, props = __rest(_a, ["bgcolor", "style", "rounded", "opacity"]);
|
|
64
|
+
const theme = useTheme();
|
|
65
|
+
return (jsx(Box, Object.assign({ display: "flex", flexDirection: "column", bgcolor: alpha(bgcolor !== null && bgcolor !== void 0 ? bgcolor : theme.palette.background.default, parseFloat(`${opacity}`)), position: "absolute", left: 0, right: 0, top: 0, bottom: 0, justifyContent: "flex-start", alignItems: "stretch", overflow: "hidden", style: Object.assign({ borderRadius: rounded ? theme.shape.borderRadius : 0 }, style) }, { children: jsx(LinearProgress, Object.assign({}, props), void 0) }), void 0));
|
|
160
66
|
};
|
|
161
67
|
|
|
162
|
-
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
return (jsxs(Box,
|
|
166
|
-
?
|
|
68
|
+
const BusyBox = (_a) => {
|
|
69
|
+
var { background, children, component, busyVariant = 'circular', busySize, busyOpacity = 0.85, busyColor, busy, busyCircularProps, busyLinearProps, paper, style } = _a, props = __rest(_a, ["background", "children", "component", "busyVariant", "busySize", "busyOpacity", "busyColor", "busy", "busyCircularProps", "busyLinearProps", "paper", "style"]);
|
|
70
|
+
const theme = useTheme();
|
|
71
|
+
return (jsxs(Box, Object.assign({ component: paper ? Paper : component, position: "relative", style: background
|
|
72
|
+
? Object.assign({ backgroundColor: theme.palette.background.default, color: theme.palette.text.primary }, style) : style }, props, { children: [children, busy && busyVariant === 'linear' ? (jsx(BusyLinearProgress, Object.assign({ color: busyColor, opacity: busyOpacity }, busyLinearProps), void 0)) : null, busy && busyVariant === 'circular' ? (jsx(BusyCircularProgress, Object.assign({ color: busyColor, opacity: busyOpacity, size: busySize }, busyCircularProps), void 0)) : null] }), void 0));
|
|
167
73
|
};
|
|
168
74
|
|
|
169
|
-
|
|
170
|
-
return jsx(BusyBox,
|
|
75
|
+
const FlexCol = (props) => {
|
|
76
|
+
return jsx(BusyBox, Object.assign({ alignItems: "center", display: "flex", flexDirection: "column", justifyContent: "center" }, props), void 0);
|
|
171
77
|
};
|
|
172
|
-
|
|
173
|
-
return jsx(FlexCol,
|
|
78
|
+
const FlexGrowCol = (props) => {
|
|
79
|
+
return jsx(FlexCol, Object.assign({ flexGrow: 1 }, props), void 0);
|
|
174
80
|
};
|
|
175
81
|
|
|
176
|
-
|
|
177
|
-
return jsx(BusyBox,
|
|
82
|
+
const FlexRow = (props) => {
|
|
83
|
+
return jsx(BusyBox, Object.assign({ alignItems: "center", display: "flex", flexDirection: "row", justifyContent: "center" }, props), void 0);
|
|
178
84
|
};
|
|
179
|
-
|
|
180
|
-
return jsx(FlexRow,
|
|
85
|
+
const FlexGrowRow = (props) => {
|
|
86
|
+
return jsx(FlexRow, Object.assign({ flexGrow: 1 }, props), void 0);
|
|
181
87
|
};
|
|
182
88
|
|
|
183
89
|
/**
|
|
184
90
|
* @deprecated The functionality of Background is now part of FlexBox. Use the 'background' property to enable the background.
|
|
185
91
|
*/
|
|
186
|
-
|
|
187
|
-
return jsx(FlexRow,
|
|
92
|
+
const Background = (props) => {
|
|
93
|
+
return jsx(FlexRow, Object.assign({}, props), void 0);
|
|
188
94
|
};
|
|
189
95
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return (jsxs(FlexCol,
|
|
96
|
+
const ErrorViewer = (props) => {
|
|
97
|
+
const { error } = props, boxProps = __rest(props, ["error"]);
|
|
98
|
+
const theme = useTheme();
|
|
99
|
+
return (jsxs(FlexCol, Object.assign({ color: theme.palette.error.main }, boxProps, { children: [jsx(Typography, Object.assign({ align: "center", variant: "subtitle1" }, { children: error === null || error === void 0 ? void 0 : error.name }), void 0), jsx(Typography, Object.assign({ align: "center", variant: "body2" }, { children: error === null || error === void 0 ? void 0 : error.message }), void 0)] }), void 0));
|
|
194
100
|
};
|
|
195
101
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return (jsxs(FlexGrowCol,
|
|
102
|
+
const ErrorsViewer = (props) => {
|
|
103
|
+
const { onRetry, errors } = props, boxProps = __rest(props, ["onRetry", "errors"]);
|
|
104
|
+
return (jsxs(FlexGrowCol, Object.assign({ padding: 1 }, boxProps, { children: [errors === null || errors === void 0 ? void 0 : errors.map((error, index) => {
|
|
199
105
|
return jsx(ErrorViewer, { error: error }, index);
|
|
200
|
-
}), onRetry ? (jsx(IconButton,
|
|
106
|
+
}), onRetry ? (jsx(IconButton, Object.assign({ onClick: onRetry }, { children: jsx(AiOutlineReload, {}, void 0) }), void 0)) : null] }), void 0));
|
|
201
107
|
};
|
|
202
108
|
|
|
203
|
-
|
|
109
|
+
const CoverProgress = (props) => {
|
|
204
110
|
var _a;
|
|
205
|
-
|
|
206
|
-
|
|
111
|
+
const { paper = true, open, opacity = 0.25, errors, onRetry } = props;
|
|
112
|
+
const theme = useTheme();
|
|
207
113
|
if (open) {
|
|
208
|
-
return (jsx(FlexGrowRow,
|
|
114
|
+
return (jsx(FlexGrowRow, Object.assign({ position: "absolute", margin: -1, top: 0, bottom: 0, right: 0, left: 0, bgcolor: paper ? theme.palette.background.paper : theme.palette.background.default }, { children: ((_a = errors === null || errors === void 0 ? void 0 : errors.length) !== null && _a !== void 0 ? _a : 0) === 0 ? (jsx(CircularProgress, { style: { opacity } }, void 0)) : (jsx(ErrorsViewer, { margin: 1, errors: errors, onRetry: onRetry }, void 0)) }), void 0));
|
|
209
115
|
}
|
|
210
116
|
return null;
|
|
211
117
|
};
|
|
212
118
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
transitionTimingFunction: 'ease',
|
|
222
|
-
},
|
|
119
|
+
const HoverScale = (props) => {
|
|
120
|
+
const { children, scale = 1.1 } = props;
|
|
121
|
+
const useStyles = makeStyles(() => createStyles({
|
|
122
|
+
zoomdiv: {
|
|
123
|
+
'&:hover': {
|
|
124
|
+
transform: `scale(${scale})`,
|
|
125
|
+
transitionDuration: '0.2s',
|
|
126
|
+
transitionTimingFunction: 'ease',
|
|
223
127
|
},
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
return (jsx(FlexRow, { children: jsx(Box,
|
|
128
|
+
},
|
|
129
|
+
}));
|
|
130
|
+
const classes = useStyles();
|
|
131
|
+
return (jsx(FlexRow, { children: jsx(Box, Object.assign({ className: classes.zoomdiv }, { children: children }), void 0) }, void 0));
|
|
228
132
|
};
|
|
229
133
|
|
|
230
|
-
|
|
134
|
+
const range = (n, in_min, in_max, out_min, out_max) => {
|
|
231
135
|
return ((n - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min;
|
|
232
136
|
};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
137
|
+
const updateCanvas = (canvas, props) => {
|
|
138
|
+
const { value = '', size = 400, bg = 'transparent', count = 5, palette, iconPadding = 0 } = props;
|
|
139
|
+
let { fg } = props;
|
|
140
|
+
const hash = md5(value);
|
|
141
|
+
const block = Math.floor(size / count);
|
|
142
|
+
const hashcolor = hash.slice(0, 6);
|
|
143
|
+
const current = canvas.current;
|
|
240
144
|
if (!current) {
|
|
241
145
|
return;
|
|
242
146
|
}
|
|
243
147
|
if (palette && palette.length) {
|
|
244
|
-
|
|
148
|
+
const index = Math.floor(range(parseInt(hash.slice(-3), 16), 0, 4095, 0, palette.length));
|
|
245
149
|
fg = palette[index];
|
|
246
150
|
}
|
|
247
151
|
current.width = block * count + iconPadding;
|
|
248
152
|
current.height = block * count + iconPadding;
|
|
249
|
-
|
|
250
|
-
|
|
153
|
+
const arr = hash.split('').map((el) => {
|
|
154
|
+
const parsedEl = parseInt(el, 16);
|
|
251
155
|
if (parsedEl < 8) {
|
|
252
156
|
return 0;
|
|
253
157
|
}
|
|
@@ -255,16 +159,16 @@ var updateCanvas = function (canvas, props) {
|
|
|
255
159
|
return 1;
|
|
256
160
|
}
|
|
257
161
|
});
|
|
258
|
-
|
|
162
|
+
const map = [];
|
|
259
163
|
map[0] = map[4] = arr.slice(0, 5);
|
|
260
164
|
map[1] = map[3] = arr.slice(5, 10);
|
|
261
165
|
map[2] = arr.slice(10, 15);
|
|
262
|
-
|
|
166
|
+
const ctx = current.getContext('2d');
|
|
263
167
|
if (ctx) {
|
|
264
168
|
ctx.imageSmoothingEnabled = false;
|
|
265
169
|
ctx.clearRect(0, 0, current.width, current.height);
|
|
266
|
-
map.forEach(
|
|
267
|
-
row.forEach(
|
|
170
|
+
map.forEach((row, i) => {
|
|
171
|
+
row.forEach((el, j) => {
|
|
268
172
|
if (el) {
|
|
269
173
|
ctx.fillStyle = fg ? fg : '#' + hashcolor;
|
|
270
174
|
ctx.fillRect(block * i + iconPadding, block * j + iconPadding, block - iconPadding, block - iconPadding);
|
|
@@ -277,101 +181,99 @@ var updateCanvas = function (canvas, props) {
|
|
|
277
181
|
});
|
|
278
182
|
}
|
|
279
183
|
};
|
|
280
|
-
|
|
281
|
-
var
|
|
282
|
-
|
|
283
|
-
useEffect(
|
|
284
|
-
updateCanvas(canvas, { bg
|
|
184
|
+
const Identicon = (_a) => {
|
|
185
|
+
var { size = 400, className = 'identicon', bg, count, fg, iconPadding, palette, value } = _a, props = __rest(_a, ["size", "className", "bg", "count", "fg", "iconPadding", "palette", "value"]);
|
|
186
|
+
const canvas = useRef(null);
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
updateCanvas(canvas, { bg, className, count, fg, iconPadding, palette, size, value });
|
|
285
189
|
});
|
|
286
|
-
return (jsx(FlexRow,
|
|
190
|
+
return (jsx(FlexRow, Object.assign({}, props, { children: jsx("canvas", { className: className, ref: canvas, style: { height: size, width: size } }, void 0) }), void 0));
|
|
287
191
|
};
|
|
288
192
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
useEffect(function () {
|
|
193
|
+
const RedirectWithQuery = ({ to, toOptions }) => {
|
|
194
|
+
const newPath = `${to}${document.location.search}`;
|
|
195
|
+
const navigate = useNavigate();
|
|
196
|
+
const { pathname } = useLocation();
|
|
197
|
+
useEffect(() => {
|
|
295
198
|
if (newPath !== pathname) {
|
|
296
|
-
navigate(newPath,
|
|
199
|
+
navigate(newPath, Object.assign({ replace: true }, toOptions));
|
|
297
200
|
}
|
|
298
201
|
});
|
|
299
202
|
return jsx("div", {}, void 0);
|
|
300
203
|
};
|
|
301
204
|
|
|
302
|
-
|
|
303
|
-
var
|
|
304
|
-
|
|
205
|
+
const ScrollToTopButton = (_a) => {
|
|
206
|
+
var { children, anchorId } = _a, props = __rest(_a, ["children", "anchorId"]);
|
|
207
|
+
const trigger = useScrollTrigger({
|
|
305
208
|
disableHysteresis: true,
|
|
306
209
|
threshold: 100,
|
|
307
210
|
});
|
|
308
|
-
|
|
309
|
-
|
|
211
|
+
const handleClick = (event) => {
|
|
212
|
+
const anchor = (event.target.ownerDocument || document).querySelector(`#${anchorId}`);
|
|
310
213
|
if (anchor) {
|
|
311
214
|
anchor.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
312
215
|
}
|
|
313
216
|
};
|
|
314
|
-
|
|
315
|
-
return (jsx(Zoom,
|
|
217
|
+
const theme = useTheme();
|
|
218
|
+
return (jsx(Zoom, Object.assign({ in: trigger }, props, { children: jsx(Box, Object.assign({ zIndex: 10, position: "fixed", right: theme.spacing(2), bottom: theme.spacing(2), onClick: handleClick, role: "presentation" }, { children: children }), void 0) }), void 0));
|
|
316
219
|
};
|
|
317
220
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
return (jsxs(FlexGrowRow,
|
|
221
|
+
const AppBarEx = (props) => {
|
|
222
|
+
const { contextToolbar, systemToolbar, container, style } = props, appbarProps = __rest(props, ["contextToolbar", "systemToolbar", "container", "style"]);
|
|
223
|
+
const theme = useTheme();
|
|
224
|
+
const AppBarExInner = () => {
|
|
225
|
+
return (jsxs(FlexGrowRow, Object.assign({ justifyContent: "space-between" }, { children: [contextToolbar !== null && contextToolbar !== void 0 ? contextToolbar : jsx(Toolbar, {}, void 0), systemToolbar !== null && systemToolbar !== void 0 ? systemToolbar : jsx(Toolbar, {}, void 0)] }), void 0));
|
|
323
226
|
};
|
|
324
|
-
return (jsx(AppBar,
|
|
227
|
+
return (jsx(AppBar, Object.assign({ position: "static", style: Object.assign({ backgroundColor: theme.palette.background.paper, color: theme.palette.text.primary, display: 'flex' }, style) }, appbarProps, { children: container ? (jsx(Container, Object.assign({ maxWidth: container }, { children: jsx(AppBarExInner, {}, void 0) }), void 0)) : (jsx(AppBarExInner, {}, void 0)) }), void 0));
|
|
325
228
|
};
|
|
326
229
|
|
|
327
|
-
|
|
230
|
+
const CookieConsentContext = createContext({});
|
|
328
231
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
var getAcceptedFromLocalStorage = function () {
|
|
232
|
+
const CookiesAcceptedLocalStorageName = 'CookiesAccepted';
|
|
233
|
+
const CookieConsentLoader = ({ children }) => {
|
|
234
|
+
const getAcceptedFromLocalStorage = () => {
|
|
333
235
|
return localStorage.getItem(CookiesAcceptedLocalStorageName) === 'true';
|
|
334
236
|
};
|
|
335
|
-
|
|
237
|
+
const setAcceptedToLocalStorage = (accepted) => {
|
|
336
238
|
localStorage.setItem(CookiesAcceptedLocalStorageName, accepted ? 'true' : 'false');
|
|
337
239
|
};
|
|
338
|
-
|
|
339
|
-
|
|
240
|
+
const [accepted, setAccepted] = useState(getAcceptedFromLocalStorage());
|
|
241
|
+
const setAcceptedHandler = (accepted) => {
|
|
340
242
|
setAcceptedToLocalStorage(accepted);
|
|
341
243
|
setAccepted(accepted);
|
|
342
244
|
};
|
|
343
|
-
|
|
245
|
+
const clearAccepted = () => {
|
|
344
246
|
localStorage.removeItem(CookiesAcceptedLocalStorageName);
|
|
345
247
|
setAccepted(getAcceptedFromLocalStorage());
|
|
346
248
|
};
|
|
347
|
-
return (jsx(CookieConsentContext.Provider,
|
|
249
|
+
return (jsx(CookieConsentContext.Provider, Object.assign({ value: { accepted, clearAccepted, setAccepted: setAcceptedHandler, storageName: CookiesAcceptedLocalStorageName } }, { children: children }), void 0));
|
|
348
250
|
};
|
|
349
251
|
|
|
350
|
-
|
|
252
|
+
const useCookieConsent = () => {
|
|
351
253
|
return useContext(CookieConsentContext);
|
|
352
254
|
};
|
|
353
255
|
|
|
354
|
-
|
|
256
|
+
const EthersContext = createContext({});
|
|
355
257
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
return (jsx(EthersContext.Provider,
|
|
258
|
+
const infuraKey = '1d9f8053c65a49cfb99fafaa8ef201c0';
|
|
259
|
+
const InfuraEthersLoader = (props) => {
|
|
260
|
+
const { children } = props;
|
|
261
|
+
const chainId = 1;
|
|
262
|
+
const provider = new InfuraProvider(1, infuraKey);
|
|
263
|
+
return (jsx(EthersContext.Provider, Object.assign({ value: {
|
|
362
264
|
busy: false,
|
|
363
|
-
chainId
|
|
265
|
+
chainId,
|
|
364
266
|
isConnected: true,
|
|
365
|
-
provider
|
|
267
|
+
provider,
|
|
366
268
|
signer: null,
|
|
367
269
|
} }, { children: children }), void 0));
|
|
368
270
|
};
|
|
369
271
|
|
|
370
|
-
|
|
272
|
+
const getApiStage = () => {
|
|
371
273
|
return getApiStage$1(document.location.hostname);
|
|
372
274
|
};
|
|
373
275
|
|
|
374
|
-
|
|
276
|
+
const isLocalhost = !!(window.location.hostname === 'localhost' ||
|
|
375
277
|
// [::1] is the IPv6 localhost address.
|
|
376
278
|
window.location.hostname === '[::1]' ||
|
|
377
279
|
// 127.0.0.0/8 are considered localhost for IPv4.
|
|
@@ -380,18 +282,18 @@ var isLocalhost = !!(window.location.hostname === 'localhost' ||
|
|
|
380
282
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
381
283
|
function useAsyncEffect(effect, inputs) {
|
|
382
284
|
useEffect(function () {
|
|
383
|
-
|
|
384
|
-
|
|
285
|
+
let mounted = true;
|
|
286
|
+
const promise = effect(() => {
|
|
385
287
|
return mounted;
|
|
386
288
|
});
|
|
387
289
|
Promise.resolve(promise)
|
|
388
|
-
.then(
|
|
290
|
+
.then((callback) => {
|
|
389
291
|
if (callback) {
|
|
390
292
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
391
293
|
}
|
|
392
294
|
})
|
|
393
|
-
.catch(
|
|
394
|
-
console.log(
|
|
295
|
+
.catch((reason) => {
|
|
296
|
+
console.log(`useAsyncEffect Excepted: ${reason}`);
|
|
395
297
|
});
|
|
396
298
|
return function () {
|
|
397
299
|
mounted = false;
|
|
@@ -399,33 +301,24 @@ function useAsyncEffect(effect, inputs) {
|
|
|
399
301
|
}, inputs !== null && inputs !== void 0 ? inputs : []);
|
|
400
302
|
}
|
|
401
303
|
|
|
402
|
-
|
|
403
|
-
|
|
304
|
+
let logProfiling = false;
|
|
305
|
+
const enableProfileLogging = (enabled) => {
|
|
404
306
|
logProfiling = enabled;
|
|
405
307
|
};
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
endTime = Date.now();
|
|
417
|
-
profileResults.push({ endTime: endTime, name: name, startTime: startTime });
|
|
418
|
-
if (logProfiling) {
|
|
419
|
-
console.log("Timed ".concat(name, " [").concat(endTime - startTime, "ms]"));
|
|
420
|
-
}
|
|
421
|
-
return [2 /*return*/];
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
}); };
|
|
308
|
+
const profileResults = [];
|
|
309
|
+
const profileBlock = (name, closure) => __awaiter(void 0, void 0, void 0, function* () {
|
|
310
|
+
const startTime = Date.now();
|
|
311
|
+
yield closure();
|
|
312
|
+
const endTime = Date.now();
|
|
313
|
+
profileResults.push({ endTime, name, startTime });
|
|
314
|
+
if (logProfiling) {
|
|
315
|
+
console.log(`Timed ${name} [${endTime - startTime}ms]`);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
425
318
|
|
|
426
|
-
|
|
319
|
+
const getLocalStorageObject = (key, log) => {
|
|
427
320
|
var _a;
|
|
428
|
-
|
|
321
|
+
let result = {};
|
|
429
322
|
try {
|
|
430
323
|
result = JSON.parse((_a = localStorage.getItem(key)) !== null && _a !== void 0 ? _a : '{}');
|
|
431
324
|
}
|
|
@@ -434,7 +327,7 @@ var getLocalStorageObject = function (key, log) {
|
|
|
434
327
|
}
|
|
435
328
|
return result;
|
|
436
329
|
};
|
|
437
|
-
|
|
330
|
+
const setLocalStorageObject = (key, value, log) => {
|
|
438
331
|
try {
|
|
439
332
|
localStorage.setItem(key, JSON.stringify(value));
|
|
440
333
|
}
|
|
@@ -443,9 +336,9 @@ var setLocalStorageObject = function (key, value, log) {
|
|
|
443
336
|
}
|
|
444
337
|
};
|
|
445
338
|
|
|
446
|
-
|
|
339
|
+
const getSessionStorageObject = (key, log) => {
|
|
447
340
|
var _a;
|
|
448
|
-
|
|
341
|
+
let result = {};
|
|
449
342
|
try {
|
|
450
343
|
result = JSON.parse((_a = sessionStorage.getItem(key)) !== null && _a !== void 0 ? _a : '{}');
|
|
451
344
|
}
|
|
@@ -454,7 +347,7 @@ var getSessionStorageObject = function (key, log) {
|
|
|
454
347
|
}
|
|
455
348
|
return result;
|
|
456
349
|
};
|
|
457
|
-
|
|
350
|
+
const setSessionStorageObject = (key, value, log) => {
|
|
458
351
|
try {
|
|
459
352
|
sessionStorage.setItem(key, JSON.stringify(value));
|
|
460
353
|
}
|
|
@@ -463,161 +356,110 @@ var setSessionStorageObject = function (key, value, log) {
|
|
|
463
356
|
}
|
|
464
357
|
};
|
|
465
358
|
|
|
466
|
-
|
|
467
|
-
|
|
359
|
+
class Referrer {
|
|
360
|
+
constructor() {
|
|
468
361
|
var _a, _b;
|
|
469
362
|
this.session = (_a = this.getFromSession()) !== null && _a !== void 0 ? _a : document.referrer;
|
|
470
363
|
sessionStorage.setItem(Referrer.storageId, this.session);
|
|
471
364
|
this.local = (_b = this.getFromLocal()) !== null && _b !== void 0 ? _b : document.referrer;
|
|
472
365
|
localStorage.setItem(Referrer.storageId, this.local);
|
|
473
366
|
}
|
|
474
|
-
|
|
475
|
-
|
|
367
|
+
getFromLocal() {
|
|
368
|
+
const value = localStorage.getItem(Referrer.storageId);
|
|
476
369
|
if (value && value.length > 0) {
|
|
477
370
|
return value;
|
|
478
371
|
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
372
|
+
}
|
|
373
|
+
getFromSession() {
|
|
374
|
+
const value = sessionStorage.getItem(Referrer.storageId);
|
|
482
375
|
if (value && value.length > 0) {
|
|
483
376
|
return value;
|
|
484
377
|
}
|
|
485
|
-
}
|
|
486
|
-
|
|
378
|
+
}
|
|
379
|
+
toJson() {
|
|
487
380
|
if ((this.local && this.local.length > 0) || (this.session && this.session.length > 0)) {
|
|
488
381
|
return {
|
|
489
382
|
local: this.local,
|
|
490
383
|
session: this.session,
|
|
491
384
|
};
|
|
492
385
|
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
XyoUserEventHandler.prototype.testStarted = function (data) {
|
|
507
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
508
|
-
return __generator(this, function (_a) {
|
|
509
|
-
switch (_a.label) {
|
|
510
|
-
case 0: return [4 /*yield*/, Promise.allSettled(this.handlers.map(function (handler) { return handler.testStarted(data); }))];
|
|
511
|
-
case 1:
|
|
512
|
-
_a.sent();
|
|
513
|
-
return [2 /*return*/];
|
|
514
|
-
}
|
|
515
|
-
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
Referrer.storageId = '_coin_referrer';
|
|
389
|
+
|
|
390
|
+
class XyoUserEventHandler extends UserEventHandler {
|
|
391
|
+
constructor(handlers = []) {
|
|
392
|
+
super();
|
|
393
|
+
this.handlers = handlers;
|
|
394
|
+
}
|
|
395
|
+
testStarted(data) {
|
|
396
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
397
|
+
yield Promise.allSettled(this.handlers.map((handler) => handler.testStarted(data)));
|
|
516
398
|
});
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
520
|
-
|
|
521
|
-
switch (_a.label) {
|
|
522
|
-
case 0: return [4 /*yield*/, Promise.allSettled(this.handlers.map(function (handler) { return handler.funnelStarted(data); }))];
|
|
523
|
-
case 1:
|
|
524
|
-
_a.sent();
|
|
525
|
-
return [2 /*return*/];
|
|
526
|
-
}
|
|
527
|
-
});
|
|
399
|
+
}
|
|
400
|
+
funnelStarted(data) {
|
|
401
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
402
|
+
yield Promise.allSettled(this.handlers.map((handler) => handler.funnelStarted(data)));
|
|
528
403
|
});
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
532
|
-
|
|
533
|
-
switch (_a.label) {
|
|
534
|
-
case 0: return [4 /*yield*/, Promise.allSettled(this.handlers.map(function (handler) { return handler.viewContent(data); }))];
|
|
535
|
-
case 1:
|
|
536
|
-
_a.sent();
|
|
537
|
-
return [2 /*return*/];
|
|
538
|
-
}
|
|
539
|
-
});
|
|
404
|
+
}
|
|
405
|
+
viewContent(data) {
|
|
406
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
407
|
+
yield Promise.allSettled(this.handlers.map((handler) => handler.viewContent(data)));
|
|
540
408
|
});
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
544
|
-
|
|
545
|
-
switch (_a.label) {
|
|
546
|
-
case 0: return [4 /*yield*/, Promise.allSettled(this.handlers.map(function (handler) { return handler.userClick(data); }))];
|
|
547
|
-
case 1:
|
|
548
|
-
_a.sent();
|
|
549
|
-
return [2 /*return*/];
|
|
550
|
-
}
|
|
551
|
-
});
|
|
409
|
+
}
|
|
410
|
+
userClick(data) {
|
|
411
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
412
|
+
yield Promise.allSettled(this.handlers.map((handler) => handler.userClick(data)));
|
|
552
413
|
});
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
}(UserEventHandler));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
556
416
|
|
|
557
417
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
558
|
-
|
|
418
|
+
const global = window;
|
|
559
419
|
|
|
560
|
-
|
|
561
|
-
|
|
420
|
+
class DripBaseEvent {
|
|
421
|
+
constructor(name, param) {
|
|
562
422
|
this.name = name;
|
|
563
423
|
this.param = param;
|
|
564
424
|
this.dcq = this.getDcq();
|
|
565
425
|
this.dcs = this.getDcs();
|
|
566
426
|
}
|
|
567
|
-
|
|
568
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
payload.push(data);
|
|
578
|
-
this.dcq.push(payload);
|
|
579
|
-
return [4 /*yield*/, delay(0)];
|
|
580
|
-
case 1:
|
|
581
|
-
_a.sent();
|
|
582
|
-
return [2 /*return*/];
|
|
583
|
-
}
|
|
584
|
-
});
|
|
427
|
+
send(data) {
|
|
428
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
429
|
+
const payload = [this.name];
|
|
430
|
+
if (this.param) {
|
|
431
|
+
payload.push(this.param);
|
|
432
|
+
}
|
|
433
|
+
payload.push(data);
|
|
434
|
+
this.dcq.push(payload);
|
|
435
|
+
yield delay(0);
|
|
585
436
|
});
|
|
586
|
-
}
|
|
587
|
-
|
|
437
|
+
}
|
|
438
|
+
getDcq() {
|
|
588
439
|
if (!global._dcq) {
|
|
589
440
|
throw Error('DCQ not found');
|
|
590
441
|
}
|
|
591
442
|
return global._dcq;
|
|
592
|
-
}
|
|
593
|
-
|
|
443
|
+
}
|
|
444
|
+
getDcs() {
|
|
594
445
|
if (!global._dcs) {
|
|
595
446
|
throw Error('DCS not found');
|
|
596
447
|
}
|
|
597
448
|
return global._dcs;
|
|
598
|
-
};
|
|
599
|
-
return DripBaseEvent;
|
|
600
|
-
}());
|
|
601
|
-
|
|
602
|
-
var DripCustomEvent = /** @class */ (function (_super) {
|
|
603
|
-
__extends(DripCustomEvent, _super);
|
|
604
|
-
function DripCustomEvent() {
|
|
605
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
606
449
|
}
|
|
607
|
-
|
|
608
|
-
}(DripBaseEvent));
|
|
450
|
+
}
|
|
609
451
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
452
|
+
class DripCustomEvent extends DripBaseEvent {
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
class DripStandardEvents {
|
|
456
|
+
identify() {
|
|
614
457
|
return new DripBaseEvent('identify');
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
}());
|
|
458
|
+
}
|
|
459
|
+
}
|
|
618
460
|
|
|
619
|
-
|
|
620
|
-
|
|
461
|
+
class Fbq {
|
|
462
|
+
constructor(pixelId) {
|
|
621
463
|
this.pixelId = pixelId;
|
|
622
464
|
this.fbq = function () {
|
|
623
465
|
// eslint-disable-next-line prefer-rest-params,prefer-spread
|
|
@@ -633,147 +475,109 @@ var Fbq = /** @class */ (function () {
|
|
|
633
475
|
this.fbq('init', pixelId);
|
|
634
476
|
this.fbq('track', 'PageView');
|
|
635
477
|
}
|
|
636
|
-
|
|
478
|
+
static init(pixelId) {
|
|
637
479
|
if (!this.instance) {
|
|
638
480
|
this.instance = new Fbq(pixelId);
|
|
639
481
|
}
|
|
640
482
|
return this.instance;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
this.fbq('track', event,
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
this.fbq('trackCustom', event,
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
}());
|
|
483
|
+
}
|
|
484
|
+
track(event, data) {
|
|
485
|
+
this.fbq('track', event, Object.assign({}, data));
|
|
486
|
+
}
|
|
487
|
+
trackCustom(event, data) {
|
|
488
|
+
this.fbq('trackCustom', event, Object.assign({}, data));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
650
491
|
|
|
651
|
-
|
|
652
|
-
|
|
492
|
+
class FacebookBaseEvent {
|
|
493
|
+
constructor(name) {
|
|
653
494
|
this.name = name;
|
|
654
495
|
this.fbq = assertEx(Fbq.instance, 'Missing Fbq');
|
|
655
496
|
}
|
|
656
|
-
|
|
657
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
658
|
-
|
|
659
|
-
switch (_a.label) {
|
|
660
|
-
case 0: return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
661
|
-
case 1:
|
|
662
|
-
_a.sent(); //force async to increase reporting odds
|
|
663
|
-
return [2 /*return*/];
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
});
|
|
667
|
-
};
|
|
668
|
-
return FacebookBaseEvent;
|
|
669
|
-
}());
|
|
670
|
-
|
|
671
|
-
var FacebookCustomEvent = /** @class */ (function (_super) {
|
|
672
|
-
__extends(FacebookCustomEvent, _super);
|
|
673
|
-
function FacebookCustomEvent() {
|
|
674
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
675
|
-
}
|
|
676
|
-
FacebookCustomEvent.prototype.send = function (data) {
|
|
677
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
678
|
-
return __generator(this, function (_a) {
|
|
679
|
-
switch (_a.label) {
|
|
680
|
-
case 0:
|
|
681
|
-
this.fbq.trackCustom(this.name, data);
|
|
682
|
-
return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
683
|
-
case 1:
|
|
684
|
-
_a.sent(); //force async to increase reporting odds
|
|
685
|
-
return [2 /*return*/];
|
|
686
|
-
}
|
|
687
|
-
});
|
|
497
|
+
send(_data) {
|
|
498
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
499
|
+
yield delay(0); //force async to increase reporting odds
|
|
688
500
|
});
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
FacebookStandardEvent.prototype.send = function (data) {
|
|
699
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
700
|
-
return __generator(this, function (_a) {
|
|
701
|
-
switch (_a.label) {
|
|
702
|
-
case 0:
|
|
703
|
-
this.fbq.track(this.name, data);
|
|
704
|
-
return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
705
|
-
case 1:
|
|
706
|
-
_a.sent(); //force async to increase reporting odds
|
|
707
|
-
return [2 /*return*/];
|
|
708
|
-
}
|
|
709
|
-
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
class FacebookCustomEvent extends FacebookBaseEvent {
|
|
505
|
+
send(data) {
|
|
506
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
507
|
+
this.fbq.trackCustom(this.name, data);
|
|
508
|
+
yield delay(0); //force async to increase reporting odds
|
|
710
509
|
});
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
}(FacebookBaseEvent));
|
|
510
|
+
}
|
|
511
|
+
}
|
|
714
512
|
|
|
715
|
-
|
|
716
|
-
|
|
513
|
+
class FacebookStandardEvent extends FacebookBaseEvent {
|
|
514
|
+
send(data) {
|
|
515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
516
|
+
this.fbq.track(this.name, data);
|
|
517
|
+
yield delay(0); //force async to increase reporting odds
|
|
518
|
+
});
|
|
717
519
|
}
|
|
718
|
-
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
class FacebookStandardEvents {
|
|
523
|
+
addPaymentInfo() {
|
|
719
524
|
return new FacebookStandardEvent('AddPaymentInfo');
|
|
720
|
-
}
|
|
721
|
-
|
|
525
|
+
}
|
|
526
|
+
addToCart() {
|
|
722
527
|
return new FacebookStandardEvent('AddToCart');
|
|
723
|
-
}
|
|
724
|
-
|
|
528
|
+
}
|
|
529
|
+
addToWishList() {
|
|
725
530
|
return new FacebookStandardEvent('AddToWishList');
|
|
726
|
-
}
|
|
727
|
-
|
|
531
|
+
}
|
|
532
|
+
completedRegistration() {
|
|
728
533
|
return new FacebookStandardEvent('CompleteRegistration');
|
|
729
|
-
}
|
|
730
|
-
|
|
534
|
+
}
|
|
535
|
+
contact() {
|
|
731
536
|
return new FacebookStandardEvent('Contact');
|
|
732
|
-
}
|
|
733
|
-
|
|
537
|
+
}
|
|
538
|
+
customizeProduct() {
|
|
734
539
|
return new FacebookStandardEvent('CustomizeProduct');
|
|
735
|
-
}
|
|
736
|
-
|
|
540
|
+
}
|
|
541
|
+
donate() {
|
|
737
542
|
return new FacebookStandardEvent('Donate');
|
|
738
|
-
}
|
|
739
|
-
|
|
543
|
+
}
|
|
544
|
+
findLocation() {
|
|
740
545
|
return new FacebookStandardEvent('FindLocation');
|
|
741
|
-
}
|
|
742
|
-
|
|
546
|
+
}
|
|
547
|
+
initiateCheckout() {
|
|
743
548
|
return new FacebookStandardEvent('InitiateCheckout');
|
|
744
|
-
}
|
|
745
|
-
|
|
549
|
+
}
|
|
550
|
+
lead() {
|
|
746
551
|
return new FacebookStandardEvent('Lead');
|
|
747
|
-
}
|
|
748
|
-
|
|
552
|
+
}
|
|
553
|
+
pageView() {
|
|
749
554
|
return new FacebookStandardEvent('PageView');
|
|
750
|
-
}
|
|
751
|
-
|
|
555
|
+
}
|
|
556
|
+
purchase() {
|
|
752
557
|
return new FacebookStandardEvent('Purchase');
|
|
753
|
-
}
|
|
754
|
-
|
|
558
|
+
}
|
|
559
|
+
schedule() {
|
|
755
560
|
return new FacebookStandardEvent('Schedule');
|
|
756
|
-
}
|
|
757
|
-
|
|
561
|
+
}
|
|
562
|
+
search() {
|
|
758
563
|
return new FacebookStandardEvent('Search');
|
|
759
|
-
}
|
|
760
|
-
|
|
564
|
+
}
|
|
565
|
+
startTrial() {
|
|
761
566
|
return new FacebookStandardEvent('StartTrial');
|
|
762
|
-
}
|
|
763
|
-
|
|
567
|
+
}
|
|
568
|
+
submitApplication() {
|
|
764
569
|
return new FacebookStandardEvent('SubmitApplication');
|
|
765
|
-
}
|
|
766
|
-
|
|
570
|
+
}
|
|
571
|
+
subscribe() {
|
|
767
572
|
return new FacebookStandardEvent('Subscribe');
|
|
768
|
-
}
|
|
769
|
-
|
|
573
|
+
}
|
|
574
|
+
viewContent() {
|
|
770
575
|
return new FacebookStandardEvent('ViewContent');
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
}());
|
|
576
|
+
}
|
|
577
|
+
}
|
|
774
578
|
|
|
775
|
-
|
|
776
|
-
|
|
579
|
+
class Gtag {
|
|
580
|
+
constructor(ga4id, awid, domains) {
|
|
777
581
|
var _a, _b, _c, _d;
|
|
778
582
|
this.ga4id = ga4id;
|
|
779
583
|
this.awid = awid;
|
|
@@ -788,328 +592,255 @@ var Gtag = /** @class */ (function () {
|
|
|
788
592
|
this.gtag('js', new Date());
|
|
789
593
|
this.gtag('config', ga4id);
|
|
790
594
|
//this.gtag('config', awid) - this is configured in the Data Stream in Google Analytics
|
|
791
|
-
|
|
595
|
+
const parsedQueryString = parse(document.location.search);
|
|
792
596
|
//we handle the utm_referrer here incase a referrer was forwarded (special.coinapp.co does this)
|
|
793
597
|
sessionStorage.setItem('initialReferrer', decodeURIComponent((_d = (_c = parsedQueryString['utm_referrer']) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : document.referrer));
|
|
794
598
|
delete parsedQueryString['utm_referrer'];
|
|
795
|
-
|
|
599
|
+
const remainingSearch = parsedQueryString ? stringify(parsedQueryString) : '';
|
|
796
600
|
sessionStorage.setItem('initialQuery', remainingSearch);
|
|
797
601
|
sessionStorage.setItem('initialPage', document.location.href);
|
|
798
602
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
this.gtag('config', ga4id, { page_path:
|
|
804
|
-
}
|
|
603
|
+
updatePagePath(page_path) {
|
|
604
|
+
const ga4id = assertEx(this.ga4id, 'Missing GA4ID');
|
|
605
|
+
const pathOnly = page_path.split('?')[0];
|
|
606
|
+
const search = Gtag.getInitialQuery();
|
|
607
|
+
this.gtag('config', ga4id, { page_path: `${pathOnly}${search}` });
|
|
608
|
+
}
|
|
805
609
|
//
|
|
806
|
-
|
|
610
|
+
static getInitialQuery() {
|
|
807
611
|
return sessionStorage.getItem('initialQuery') || '';
|
|
808
|
-
}
|
|
809
|
-
|
|
612
|
+
}
|
|
613
|
+
static getInitialPage() {
|
|
810
614
|
return sessionStorage.getItem('initialPage') || '';
|
|
811
|
-
}
|
|
812
|
-
|
|
615
|
+
}
|
|
616
|
+
static getInitialReferrer() {
|
|
813
617
|
return sessionStorage.getItem('initialReferrer') || '';
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
|
|
618
|
+
}
|
|
619
|
+
static clearDataLayer() {
|
|
620
|
+
const dataLayer = global.dataLayer;
|
|
817
621
|
dataLayer.length = 0;
|
|
818
|
-
}
|
|
819
|
-
|
|
622
|
+
}
|
|
623
|
+
static init(ga4id, awid, domains) {
|
|
820
624
|
if (!this.instance) {
|
|
821
625
|
return this.reinit(ga4id, awid, domains);
|
|
822
626
|
}
|
|
823
627
|
return this.instance;
|
|
824
|
-
}
|
|
825
|
-
|
|
628
|
+
}
|
|
629
|
+
static reinit(ga4id, awid, domains) {
|
|
826
630
|
this.instance = new Gtag(ga4id, awid, domains);
|
|
827
631
|
return this.instance;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
632
|
+
}
|
|
633
|
+
static updatePagePath(page_path) {
|
|
634
|
+
const instance = assertEx(this.instance, 'Not initialized');
|
|
831
635
|
return instance.updatePagePath(page_path);
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
_this.gtag('event', event, __assign(__assign({}, data), { event_callback: function () {
|
|
636
|
+
}
|
|
637
|
+
sendAnalytics(event, data) {
|
|
638
|
+
return new Promise((resolve) => {
|
|
639
|
+
this.gtag('event', event, Object.assign(Object.assign({}, data), { event_callback: () => {
|
|
837
640
|
resolve();
|
|
838
|
-
}, event_timeout: 2000, page_location: Gtag.getInitialPage(), page_referrer: Gtag.getInitialReferrer(), send_to:
|
|
641
|
+
}, event_timeout: 2000, page_location: Gtag.getInitialPage(), page_referrer: Gtag.getInitialReferrer(), send_to: this.ga4id }));
|
|
839
642
|
});
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
_this.gtag('event', 'conversion', __assign(__assign({}, data), { event_callback: function () {
|
|
643
|
+
}
|
|
644
|
+
sendAdwords(event, data) {
|
|
645
|
+
return new Promise((resolve) => {
|
|
646
|
+
this.gtag('event', 'conversion', Object.assign(Object.assign({}, data), { event_callback: () => {
|
|
845
647
|
resolve();
|
|
846
|
-
}, event_timeout: 2000, send_to:
|
|
648
|
+
}, event_timeout: 2000, send_to: `${this.awid}/${event}` }));
|
|
847
649
|
});
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
}());
|
|
650
|
+
}
|
|
651
|
+
}
|
|
851
652
|
|
|
852
|
-
|
|
853
|
-
|
|
653
|
+
class Gtm {
|
|
654
|
+
constructor(containerId) {
|
|
854
655
|
this.containerId = containerId;
|
|
855
|
-
|
|
656
|
+
const global = window;
|
|
856
657
|
global.dataLayer = global.dataLayer || [];
|
|
857
658
|
global.dataLayer.push({ event: 'gtm.js', 'gtm.start': new Date().getTime() });
|
|
858
659
|
}
|
|
859
|
-
|
|
660
|
+
static getInitialQuery() {
|
|
860
661
|
return sessionStorage.getItem('initialQuery') || '';
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
662
|
+
}
|
|
663
|
+
static clearDataLayer() {
|
|
664
|
+
const global = window;
|
|
665
|
+
const dataLayer = global.dataLayer;
|
|
865
666
|
dataLayer.length = 0;
|
|
866
|
-
}
|
|
867
|
-
|
|
667
|
+
}
|
|
668
|
+
static init(containerId) {
|
|
868
669
|
if (!this.instance) {
|
|
869
670
|
this.instance = new Gtm(containerId);
|
|
870
671
|
}
|
|
871
672
|
return this.instance;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
return new Promise(function (resolve) {
|
|
673
|
+
}
|
|
674
|
+
send(event, data, eventTimeout = 500) {
|
|
675
|
+
return new Promise((resolve) => {
|
|
876
676
|
var _a;
|
|
877
|
-
|
|
878
|
-
(_a = global.dataLayer) === null || _a === void 0 ? void 0 : _a.push(
|
|
677
|
+
const global = window;
|
|
678
|
+
(_a = global.dataLayer) === null || _a === void 0 ? void 0 : _a.push(Object.assign(Object.assign({ event }, data), { eventCallback: () => {
|
|
879
679
|
resolve();
|
|
880
|
-
}, eventTimeout
|
|
680
|
+
}, eventTimeout }));
|
|
881
681
|
});
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
}());
|
|
682
|
+
}
|
|
683
|
+
}
|
|
885
684
|
|
|
886
|
-
|
|
887
|
-
|
|
685
|
+
class GoogleBaseEvent {
|
|
686
|
+
constructor(name, adwordConversionId) {
|
|
888
687
|
this.name = name;
|
|
889
688
|
this.adwordConversionId = adwordConversionId;
|
|
890
689
|
}
|
|
891
|
-
|
|
892
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
893
|
-
return
|
|
894
|
-
switch (_a.label) {
|
|
895
|
-
case 0: return [4 /*yield*/, this.sendGtag(data)];
|
|
896
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
897
|
-
}
|
|
898
|
-
});
|
|
690
|
+
send(data) {
|
|
691
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
692
|
+
return yield this.sendGtag(data);
|
|
899
693
|
});
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
_a.sent();
|
|
908
|
-
if (!this.adwordConversionId) return [3 /*break*/, 3];
|
|
909
|
-
return [4 /*yield*/, this.gtag().sendAdwords(this.adwordConversionId, data)];
|
|
910
|
-
case 2:
|
|
911
|
-
_a.sent();
|
|
912
|
-
_a.label = 3;
|
|
913
|
-
case 3: return [2 /*return*/];
|
|
914
|
-
}
|
|
915
|
-
});
|
|
694
|
+
}
|
|
695
|
+
sendGtag(data) {
|
|
696
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
697
|
+
yield this.gtag().sendAnalytics(this.name, data);
|
|
698
|
+
if (this.adwordConversionId) {
|
|
699
|
+
yield this.gtag().sendAdwords(this.adwordConversionId, data);
|
|
700
|
+
}
|
|
916
701
|
});
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
920
|
-
|
|
921
|
-
switch (_a.label) {
|
|
922
|
-
case 0: return [4 /*yield*/, this.gtm().send(this.name, data)];
|
|
923
|
-
case 1:
|
|
924
|
-
_a.sent();
|
|
925
|
-
return [2 /*return*/];
|
|
926
|
-
}
|
|
927
|
-
});
|
|
702
|
+
}
|
|
703
|
+
sendGtm(data) {
|
|
704
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
705
|
+
yield this.gtm().send(this.name, data);
|
|
928
706
|
});
|
|
929
|
-
}
|
|
930
|
-
|
|
707
|
+
}
|
|
708
|
+
gtag() {
|
|
931
709
|
return assertEx(Gtag.instance, 'Missing/uninitialized gtag');
|
|
932
|
-
}
|
|
933
|
-
|
|
710
|
+
}
|
|
711
|
+
gtm() {
|
|
934
712
|
return assertEx(Gtm.instance, 'Missing/uninitialized gtm');
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
var GoogleUserEventHandler = /** @class */ (function () {
|
|
948
|
-
function GoogleUserEventHandler() {
|
|
949
|
-
}
|
|
950
|
-
GoogleUserEventHandler.prototype.testStarted = function (data) {
|
|
951
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
952
|
-
var event;
|
|
953
|
-
return __generator(this, function (_a) {
|
|
954
|
-
switch (_a.label) {
|
|
955
|
-
case 0:
|
|
956
|
-
event = new GoogleCustomEvent('TestStarted');
|
|
957
|
-
return [4 /*yield*/, event.send(data)];
|
|
958
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
959
|
-
}
|
|
960
|
-
});
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
class GoogleCustomEvent extends GoogleBaseEvent {
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
class GoogleUserEventHandler {
|
|
720
|
+
testStarted(data) {
|
|
721
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
722
|
+
const event = new GoogleCustomEvent('TestStarted');
|
|
723
|
+
return yield event.send(data);
|
|
961
724
|
});
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
965
|
-
|
|
966
|
-
return
|
|
967
|
-
switch (_a.label) {
|
|
968
|
-
case 0:
|
|
969
|
-
event = new GoogleCustomEvent('FunnelStarted');
|
|
970
|
-
return [4 /*yield*/, event.send(data)];
|
|
971
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
972
|
-
}
|
|
973
|
-
});
|
|
725
|
+
}
|
|
726
|
+
funnelStarted(data) {
|
|
727
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
+
const event = new GoogleCustomEvent('FunnelStarted');
|
|
729
|
+
return yield event.send(data);
|
|
974
730
|
});
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
978
|
-
|
|
979
|
-
return
|
|
980
|
-
switch (_a.label) {
|
|
981
|
-
case 0:
|
|
982
|
-
event = new GoogleCustomEvent('ViewContent');
|
|
983
|
-
return [4 /*yield*/, event.send(data)];
|
|
984
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
985
|
-
}
|
|
986
|
-
});
|
|
731
|
+
}
|
|
732
|
+
viewContent(data) {
|
|
733
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
734
|
+
const event = new GoogleCustomEvent('ViewContent');
|
|
735
|
+
return yield event.send(data);
|
|
987
736
|
});
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
991
|
-
|
|
992
|
-
return
|
|
993
|
-
switch (_a.label) {
|
|
994
|
-
case 0:
|
|
995
|
-
event = new GoogleCustomEvent('UserClick');
|
|
996
|
-
return [4 /*yield*/, event.send(data)];
|
|
997
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
998
|
-
}
|
|
999
|
-
});
|
|
737
|
+
}
|
|
738
|
+
userClick(data) {
|
|
739
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
740
|
+
const event = new GoogleCustomEvent('UserClick');
|
|
741
|
+
return yield event.send(data);
|
|
1000
742
|
});
|
|
1001
|
-
};
|
|
1002
|
-
return GoogleUserEventHandler;
|
|
1003
|
-
}());
|
|
1004
|
-
|
|
1005
|
-
var GoogleStandardEvent = /** @class */ (function (_super) {
|
|
1006
|
-
__extends(GoogleStandardEvent, _super);
|
|
1007
|
-
function GoogleStandardEvent() {
|
|
1008
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1009
743
|
}
|
|
1010
|
-
|
|
1011
|
-
}(GoogleBaseEvent));
|
|
744
|
+
}
|
|
1012
745
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
746
|
+
class GoogleStandardEvent extends GoogleBaseEvent {
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
class GoogleStandardEvents {
|
|
750
|
+
addPaymentInfo() {
|
|
1017
751
|
return new GoogleStandardEvent('add_paymennt_info');
|
|
1018
|
-
}
|
|
1019
|
-
|
|
752
|
+
}
|
|
753
|
+
addShippingInfo() {
|
|
1020
754
|
return new GoogleStandardEvent('add_shipping_info');
|
|
1021
|
-
}
|
|
1022
|
-
|
|
755
|
+
}
|
|
756
|
+
addToCart() {
|
|
1023
757
|
return new GoogleStandardEvent('add_to_cart');
|
|
1024
|
-
}
|
|
1025
|
-
|
|
758
|
+
}
|
|
759
|
+
addToWishList() {
|
|
1026
760
|
return new GoogleStandardEvent('add_to_wishlist');
|
|
1027
|
-
}
|
|
1028
|
-
|
|
761
|
+
}
|
|
762
|
+
beginCheckout() {
|
|
1029
763
|
return new GoogleStandardEvent('begin_checkout');
|
|
1030
|
-
}
|
|
1031
|
-
|
|
764
|
+
}
|
|
765
|
+
earnVirtualCurrency() {
|
|
1032
766
|
return new GoogleStandardEvent('earn_virtual_currency');
|
|
1033
|
-
}
|
|
1034
|
-
|
|
767
|
+
}
|
|
768
|
+
generateLead() {
|
|
1035
769
|
return new GoogleStandardEvent('generate_lead');
|
|
1036
|
-
}
|
|
1037
|
-
|
|
770
|
+
}
|
|
771
|
+
joinGroup() {
|
|
1038
772
|
return new GoogleStandardEvent('join_group');
|
|
1039
|
-
}
|
|
1040
|
-
|
|
773
|
+
}
|
|
774
|
+
levelEnd() {
|
|
1041
775
|
return new GoogleStandardEvent('level_end');
|
|
1042
|
-
}
|
|
1043
|
-
|
|
776
|
+
}
|
|
777
|
+
levelStart() {
|
|
1044
778
|
return new GoogleStandardEvent('level_start');
|
|
1045
|
-
}
|
|
1046
|
-
|
|
779
|
+
}
|
|
780
|
+
levelUp() {
|
|
1047
781
|
return new GoogleStandardEvent('level_up');
|
|
1048
|
-
}
|
|
1049
|
-
|
|
782
|
+
}
|
|
783
|
+
login() {
|
|
1050
784
|
return new GoogleStandardEvent('login');
|
|
1051
|
-
}
|
|
1052
|
-
|
|
785
|
+
}
|
|
786
|
+
postScore() {
|
|
1053
787
|
return new GoogleStandardEvent('post_score');
|
|
1054
|
-
}
|
|
1055
|
-
|
|
788
|
+
}
|
|
789
|
+
purchase() {
|
|
1056
790
|
return new GoogleStandardEvent('purchase');
|
|
1057
|
-
}
|
|
1058
|
-
|
|
791
|
+
}
|
|
792
|
+
refund() {
|
|
1059
793
|
return new GoogleStandardEvent('refund');
|
|
1060
|
-
}
|
|
1061
|
-
|
|
794
|
+
}
|
|
795
|
+
removeFromCart() {
|
|
1062
796
|
return new GoogleStandardEvent('remove_from_cart');
|
|
1063
|
-
}
|
|
1064
|
-
|
|
797
|
+
}
|
|
798
|
+
search() {
|
|
1065
799
|
return new GoogleStandardEvent('search');
|
|
1066
|
-
}
|
|
1067
|
-
|
|
800
|
+
}
|
|
801
|
+
selectContent() {
|
|
1068
802
|
return new GoogleStandardEvent('select_content');
|
|
1069
|
-
}
|
|
1070
|
-
|
|
803
|
+
}
|
|
804
|
+
selectItem() {
|
|
1071
805
|
return new GoogleStandardEvent('select_item');
|
|
1072
|
-
}
|
|
1073
|
-
|
|
806
|
+
}
|
|
807
|
+
selectPromotion() {
|
|
1074
808
|
return new GoogleStandardEvent('select_promotion');
|
|
1075
|
-
}
|
|
1076
|
-
|
|
809
|
+
}
|
|
810
|
+
share() {
|
|
1077
811
|
return new GoogleStandardEvent('share');
|
|
1078
|
-
}
|
|
1079
|
-
|
|
812
|
+
}
|
|
813
|
+
signUp() {
|
|
1080
814
|
return new GoogleStandardEvent('sign_up');
|
|
1081
|
-
}
|
|
1082
|
-
|
|
815
|
+
}
|
|
816
|
+
spendVirtualCurrency() {
|
|
1083
817
|
return new GoogleStandardEvent('spend_virtual_currency');
|
|
1084
|
-
}
|
|
1085
|
-
|
|
818
|
+
}
|
|
819
|
+
tutorialBegin() {
|
|
1086
820
|
return new GoogleStandardEvent('tutorial_begin');
|
|
1087
|
-
}
|
|
1088
|
-
|
|
821
|
+
}
|
|
822
|
+
tutorialComplete() {
|
|
1089
823
|
return new GoogleStandardEvent('tutorial_complete');
|
|
1090
|
-
}
|
|
1091
|
-
|
|
824
|
+
}
|
|
825
|
+
unlockAchievement() {
|
|
1092
826
|
return new GoogleStandardEvent('unlock_achievement');
|
|
1093
|
-
}
|
|
1094
|
-
|
|
827
|
+
}
|
|
828
|
+
viewCart() {
|
|
1095
829
|
return new GoogleStandardEvent('view_cart');
|
|
1096
|
-
}
|
|
1097
|
-
|
|
830
|
+
}
|
|
831
|
+
viewItem() {
|
|
1098
832
|
return new GoogleStandardEvent('view_item');
|
|
1099
|
-
}
|
|
1100
|
-
|
|
833
|
+
}
|
|
834
|
+
viewItemList() {
|
|
1101
835
|
return new GoogleStandardEvent('view_item_list');
|
|
1102
|
-
}
|
|
1103
|
-
|
|
836
|
+
}
|
|
837
|
+
viewPromotion() {
|
|
1104
838
|
return new GoogleStandardEvent('view_promotion');
|
|
1105
|
-
};
|
|
1106
|
-
return GoogleStandardEvents;
|
|
1107
|
-
}());
|
|
1108
|
-
|
|
1109
|
-
var Rdt = /** @class */ (function () {
|
|
1110
|
-
function Rdt() {
|
|
1111
839
|
}
|
|
1112
|
-
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
class Rdt {
|
|
843
|
+
static init(pixelId) {
|
|
1113
844
|
try {
|
|
1114
845
|
Rdt.instance = new Rdt();
|
|
1115
846
|
Rdt.instance.load(pixelId);
|
|
@@ -1118,553 +849,391 @@ var Rdt = /** @class */ (function () {
|
|
|
1118
849
|
catch (ex) {
|
|
1119
850
|
console.error(ex);
|
|
1120
851
|
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
852
|
+
}
|
|
853
|
+
static getRdt() {
|
|
1123
854
|
if (global.rdt) {
|
|
1124
855
|
return global.rdt;
|
|
1125
856
|
}
|
|
1126
857
|
console.warn('Missing rdt');
|
|
1127
|
-
}
|
|
1128
|
-
|
|
858
|
+
}
|
|
859
|
+
load(id) {
|
|
1129
860
|
try {
|
|
1130
861
|
Rdt.getRdt()('init', id);
|
|
1131
862
|
}
|
|
1132
863
|
catch (ex) {
|
|
1133
864
|
console.error(ex);
|
|
1134
865
|
}
|
|
1135
|
-
}
|
|
1136
|
-
|
|
866
|
+
}
|
|
867
|
+
track(event, data) {
|
|
1137
868
|
try {
|
|
1138
|
-
Rdt.getRdt()('track', event,
|
|
869
|
+
Rdt.getRdt()('track', event, Object.assign({}, data));
|
|
1139
870
|
}
|
|
1140
871
|
catch (ex) {
|
|
1141
872
|
console.error(ex);
|
|
1142
873
|
}
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
}());
|
|
874
|
+
}
|
|
875
|
+
}
|
|
1146
876
|
|
|
1147
|
-
|
|
1148
|
-
|
|
877
|
+
class RedditBaseEvent {
|
|
878
|
+
constructor(name) {
|
|
1149
879
|
this.name = name;
|
|
1150
880
|
this.rdt = assertEx(Rdt.instance, 'Missing Rdt');
|
|
1151
881
|
}
|
|
1152
|
-
|
|
1153
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1154
|
-
|
|
1155
|
-
switch (_a.label) {
|
|
1156
|
-
case 0: return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1157
|
-
case 1:
|
|
1158
|
-
_a.sent(); //force async to increase reporting odds
|
|
1159
|
-
return [2 /*return*/];
|
|
1160
|
-
}
|
|
1161
|
-
});
|
|
1162
|
-
});
|
|
1163
|
-
};
|
|
1164
|
-
return RedditBaseEvent;
|
|
1165
|
-
}());
|
|
1166
|
-
|
|
1167
|
-
var RedditCustomEvent = /** @class */ (function (_super) {
|
|
1168
|
-
__extends(RedditCustomEvent, _super);
|
|
1169
|
-
function RedditCustomEvent() {
|
|
1170
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1171
|
-
}
|
|
1172
|
-
RedditCustomEvent.prototype.send = function (data) {
|
|
1173
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1174
|
-
return __generator(this, function (_a) {
|
|
1175
|
-
switch (_a.label) {
|
|
1176
|
-
case 0:
|
|
1177
|
-
this.rdt.track(this.name, data);
|
|
1178
|
-
return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1179
|
-
case 1:
|
|
1180
|
-
_a.sent(); //force async to increase reporting odds
|
|
1181
|
-
return [2 /*return*/];
|
|
1182
|
-
}
|
|
1183
|
-
});
|
|
882
|
+
send(_data) {
|
|
883
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
884
|
+
yield delay(0); //force async to increase reporting odds
|
|
1184
885
|
});
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
RedditStandardEvent.prototype.send = function (data) {
|
|
1195
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1196
|
-
return __generator(this, function (_a) {
|
|
1197
|
-
switch (_a.label) {
|
|
1198
|
-
case 0:
|
|
1199
|
-
this.rdt.track(this.name, data);
|
|
1200
|
-
return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1201
|
-
case 1:
|
|
1202
|
-
_a.sent(); //force async to increase reporting odds
|
|
1203
|
-
return [2 /*return*/];
|
|
1204
|
-
}
|
|
1205
|
-
});
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
class RedditCustomEvent extends RedditBaseEvent {
|
|
890
|
+
send(data) {
|
|
891
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
892
|
+
this.rdt.track(this.name, data);
|
|
893
|
+
yield delay(0); //force async to increase reporting odds
|
|
1206
894
|
});
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
}(RedditBaseEvent));
|
|
895
|
+
}
|
|
896
|
+
}
|
|
1210
897
|
|
|
1211
|
-
|
|
1212
|
-
|
|
898
|
+
class RedditStandardEvent extends RedditBaseEvent {
|
|
899
|
+
send(data) {
|
|
900
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
901
|
+
this.rdt.track(this.name, data);
|
|
902
|
+
yield delay(0); //force async to increase reporting odds
|
|
903
|
+
});
|
|
1213
904
|
}
|
|
1214
|
-
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
class RedditStandardEvents {
|
|
908
|
+
pageView() {
|
|
1215
909
|
return new RedditStandardEvent('PageView');
|
|
1216
|
-
}
|
|
1217
|
-
|
|
910
|
+
}
|
|
911
|
+
viewContent() {
|
|
1218
912
|
return new RedditStandardEvent('ViewContent');
|
|
1219
|
-
}
|
|
1220
|
-
|
|
913
|
+
}
|
|
914
|
+
addToCart() {
|
|
1221
915
|
return new RedditStandardEvent('AddToCart');
|
|
1222
|
-
}
|
|
1223
|
-
|
|
916
|
+
}
|
|
917
|
+
addToWishlist() {
|
|
1224
918
|
return new RedditStandardEvent('AddToWishlist');
|
|
1225
|
-
}
|
|
1226
|
-
|
|
919
|
+
}
|
|
920
|
+
purchase() {
|
|
1227
921
|
return new RedditStandardEvent('Purchase');
|
|
1228
|
-
}
|
|
1229
|
-
|
|
922
|
+
}
|
|
923
|
+
signup() {
|
|
1230
924
|
return new RedditStandardEvent('SignUp');
|
|
1231
|
-
}
|
|
1232
|
-
|
|
925
|
+
}
|
|
926
|
+
lead() {
|
|
1233
927
|
return new RedditStandardEvent('Lead');
|
|
1234
|
-
}
|
|
1235
|
-
|
|
928
|
+
}
|
|
929
|
+
search() {
|
|
1236
930
|
return new RedditStandardEvent('Search');
|
|
1237
|
-
};
|
|
1238
|
-
return RedditStandardEvents;
|
|
1239
|
-
}());
|
|
1240
|
-
|
|
1241
|
-
var SnapTr = /** @class */ (function () {
|
|
1242
|
-
function SnapTr() {
|
|
1243
931
|
}
|
|
1244
|
-
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
class SnapTr {
|
|
935
|
+
static getSnapTr() {
|
|
1245
936
|
if (global.snaptr) {
|
|
1246
937
|
return global.snaptr;
|
|
1247
938
|
}
|
|
1248
939
|
console.warn('Missing snaptr');
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
case 0:
|
|
1255
|
-
this.getSnapTr()('track', event, data);
|
|
1256
|
-
return [4 /*yield*/, delay(0)];
|
|
1257
|
-
case 1:
|
|
1258
|
-
_a.sent();
|
|
1259
|
-
return [2 /*return*/];
|
|
1260
|
-
}
|
|
1261
|
-
});
|
|
940
|
+
}
|
|
941
|
+
static track(event, data) {
|
|
942
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
943
|
+
this.getSnapTr()('track', event, data);
|
|
944
|
+
yield delay(0);
|
|
1262
945
|
});
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
}());
|
|
946
|
+
}
|
|
947
|
+
}
|
|
1266
948
|
|
|
1267
|
-
|
|
1268
|
-
|
|
949
|
+
class SnapchatBaseEvent {
|
|
950
|
+
constructor(name) {
|
|
1269
951
|
this.name = name;
|
|
1270
952
|
}
|
|
1271
|
-
|
|
1272
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1273
|
-
|
|
1274
|
-
switch (_a.label) {
|
|
1275
|
-
case 0: return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1276
|
-
case 1:
|
|
1277
|
-
_a.sent(); //force async to increase reporting odds
|
|
1278
|
-
return [2 /*return*/];
|
|
1279
|
-
}
|
|
1280
|
-
});
|
|
1281
|
-
});
|
|
1282
|
-
};
|
|
1283
|
-
return SnapchatBaseEvent;
|
|
1284
|
-
}());
|
|
1285
|
-
|
|
1286
|
-
var SnapchatStandardEvent = /** @class */ (function (_super) {
|
|
1287
|
-
__extends(SnapchatStandardEvent, _super);
|
|
1288
|
-
function SnapchatStandardEvent() {
|
|
1289
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1290
|
-
}
|
|
1291
|
-
SnapchatStandardEvent.prototype.send = function (data) {
|
|
1292
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1293
|
-
return __generator(this, function (_a) {
|
|
1294
|
-
switch (_a.label) {
|
|
1295
|
-
case 0: return [4 /*yield*/, SnapTr.track(this.name, data)];
|
|
1296
|
-
case 1:
|
|
1297
|
-
_a.sent();
|
|
1298
|
-
return [2 /*return*/];
|
|
1299
|
-
}
|
|
1300
|
-
});
|
|
953
|
+
send(_data) {
|
|
954
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
955
|
+
yield delay(0); //force async to increase reporting odds
|
|
1301
956
|
});
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
}(SnapchatBaseEvent));
|
|
957
|
+
}
|
|
958
|
+
}
|
|
1305
959
|
|
|
1306
|
-
|
|
1307
|
-
|
|
960
|
+
class SnapchatStandardEvent extends SnapchatBaseEvent {
|
|
961
|
+
send(data) {
|
|
962
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
963
|
+
yield SnapTr.track(this.name, data);
|
|
964
|
+
});
|
|
1308
965
|
}
|
|
1309
|
-
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
class SnapchatStandardEvents {
|
|
969
|
+
pageView() {
|
|
1310
970
|
return new SnapchatStandardEvent('PAGE_VIEW');
|
|
1311
|
-
}
|
|
1312
|
-
|
|
971
|
+
}
|
|
972
|
+
signUp() {
|
|
1313
973
|
return new SnapchatStandardEvent('SIGN_UP');
|
|
1314
|
-
}
|
|
1315
|
-
|
|
974
|
+
}
|
|
975
|
+
purchase() {
|
|
1316
976
|
return new SnapchatStandardEvent('PURCHASE');
|
|
1317
|
-
}
|
|
1318
|
-
|
|
977
|
+
}
|
|
978
|
+
save() {
|
|
1319
979
|
return new SnapchatStandardEvent('SAVE');
|
|
1320
|
-
}
|
|
1321
|
-
|
|
980
|
+
}
|
|
981
|
+
startCheckout() {
|
|
1322
982
|
return new SnapchatStandardEvent('START_CHECKOUT');
|
|
1323
|
-
}
|
|
1324
|
-
|
|
983
|
+
}
|
|
984
|
+
addCart() {
|
|
1325
985
|
return new SnapchatStandardEvent('ADD_CART');
|
|
1326
|
-
}
|
|
1327
|
-
|
|
986
|
+
}
|
|
987
|
+
openApp() {
|
|
1328
988
|
return new SnapchatStandardEvent('OPEN_APP');
|
|
1329
|
-
}
|
|
1330
|
-
|
|
989
|
+
}
|
|
990
|
+
viewContent() {
|
|
1331
991
|
return new SnapchatStandardEvent('VIEW_CONTENT');
|
|
1332
|
-
}
|
|
1333
|
-
|
|
992
|
+
}
|
|
993
|
+
addBilling() {
|
|
1334
994
|
return new SnapchatStandardEvent('ADD_BILLING');
|
|
1335
|
-
}
|
|
1336
|
-
|
|
995
|
+
}
|
|
996
|
+
search() {
|
|
1337
997
|
return new SnapchatStandardEvent('SEARCH');
|
|
1338
|
-
}
|
|
1339
|
-
|
|
998
|
+
}
|
|
999
|
+
subscribe() {
|
|
1340
1000
|
return new SnapchatStandardEvent('SUBSCRIBE');
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1001
|
+
}
|
|
1002
|
+
adClick() {
|
|
1343
1003
|
return new SnapchatStandardEvent('AD_CLICK');
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1004
|
+
}
|
|
1005
|
+
adView() {
|
|
1346
1006
|
return new SnapchatStandardEvent('AD_VIEW');
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1007
|
+
}
|
|
1008
|
+
completeTutorial() {
|
|
1349
1009
|
return new SnapchatStandardEvent('COMPLETE_TUTORIAL');
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1010
|
+
}
|
|
1011
|
+
invite() {
|
|
1352
1012
|
return new SnapchatStandardEvent('INVITE');
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1013
|
+
}
|
|
1014
|
+
login() {
|
|
1355
1015
|
return new SnapchatStandardEvent('LOGIN');
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1016
|
+
}
|
|
1017
|
+
share() {
|
|
1358
1018
|
return new SnapchatStandardEvent('SHARE');
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1019
|
+
}
|
|
1020
|
+
reserve() {
|
|
1361
1021
|
return new SnapchatStandardEvent('RESERVE');
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1022
|
+
}
|
|
1023
|
+
achievementUnlocked() {
|
|
1364
1024
|
return new SnapchatStandardEvent('ACHIEVEMENT_UNLOCKED');
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1025
|
+
}
|
|
1026
|
+
addToWishlist() {
|
|
1367
1027
|
return new SnapchatStandardEvent('ADD_TO_WISHLIST');
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1028
|
+
}
|
|
1029
|
+
spentCredits() {
|
|
1370
1030
|
return new SnapchatStandardEvent('SPENT_CREDITS');
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1031
|
+
}
|
|
1032
|
+
rate() {
|
|
1373
1033
|
return new SnapchatStandardEvent('RATE');
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1034
|
+
}
|
|
1035
|
+
startTrial() {
|
|
1376
1036
|
return new SnapchatStandardEvent('START_TRIAL');
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1037
|
+
}
|
|
1038
|
+
listView() {
|
|
1379
1039
|
return new SnapchatStandardEvent('LIST_VIEW');
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1040
|
+
}
|
|
1041
|
+
custom1() {
|
|
1382
1042
|
return new SnapchatStandardEvent('CUSTOM_EVENT_1');
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1043
|
+
}
|
|
1044
|
+
custom2() {
|
|
1385
1045
|
return new SnapchatStandardEvent('CUSTOM_EVENT_2');
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1046
|
+
}
|
|
1047
|
+
custom3() {
|
|
1388
1048
|
return new SnapchatStandardEvent('CUSTOM_EVENT_3');
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1049
|
+
}
|
|
1050
|
+
custom4() {
|
|
1391
1051
|
return new SnapchatStandardEvent('CUSTOM_EVENT_4');
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1052
|
+
}
|
|
1053
|
+
custom5() {
|
|
1394
1054
|
return new SnapchatStandardEvent('CUSTOM_EVENT_5');
|
|
1395
|
-
};
|
|
1396
|
-
return SnapchatStandardEvents;
|
|
1397
|
-
}());
|
|
1398
|
-
|
|
1399
|
-
var Ttq = /** @class */ (function () {
|
|
1400
|
-
function Ttq() {
|
|
1401
1055
|
}
|
|
1402
|
-
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
class Ttq {
|
|
1059
|
+
static init(pixelId) {
|
|
1403
1060
|
try {
|
|
1404
1061
|
Ttq.instance = new Ttq();
|
|
1405
1062
|
Ttq.getTtq().load(pixelId);
|
|
1406
1063
|
Ttq.page();
|
|
1407
1064
|
}
|
|
1408
1065
|
catch (ex) {
|
|
1409
|
-
console.error(
|
|
1066
|
+
console.error(`Ttq.init: ${ex}`);
|
|
1410
1067
|
}
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1068
|
+
}
|
|
1069
|
+
static getTtq() {
|
|
1413
1070
|
if (global.ttq) {
|
|
1414
1071
|
return global.ttq;
|
|
1415
1072
|
}
|
|
1416
1073
|
console.warn('Missing ttq');
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1074
|
+
}
|
|
1075
|
+
static page() {
|
|
1419
1076
|
try {
|
|
1420
1077
|
Ttq.getTtq().page();
|
|
1421
1078
|
}
|
|
1422
1079
|
catch (ex) {
|
|
1423
|
-
console.error(
|
|
1080
|
+
console.error(`Ttq.page: ${ex}`);
|
|
1424
1081
|
}
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1082
|
+
}
|
|
1083
|
+
track(event, data) {
|
|
1427
1084
|
try {
|
|
1428
|
-
Ttq.getTtq().track(event,
|
|
1085
|
+
Ttq.getTtq().track(event, Object.assign({}, data));
|
|
1429
1086
|
}
|
|
1430
1087
|
catch (ex) {
|
|
1431
|
-
console.error(
|
|
1088
|
+
console.error(`Ttq.track: ${ex}`);
|
|
1432
1089
|
}
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
}());
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1436
1092
|
|
|
1437
|
-
|
|
1438
|
-
|
|
1093
|
+
class TiktokBaseEvent {
|
|
1094
|
+
constructor(name) {
|
|
1439
1095
|
this.name = name;
|
|
1440
1096
|
this.ttq = assertEx(Ttq.instance, 'Missing Ttq');
|
|
1441
1097
|
}
|
|
1442
|
-
|
|
1443
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1444
|
-
|
|
1445
|
-
switch (_a.label) {
|
|
1446
|
-
case 0: return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1447
|
-
case 1:
|
|
1448
|
-
_a.sent(); //force async to increase reporting odds
|
|
1449
|
-
return [2 /*return*/];
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
});
|
|
1453
|
-
};
|
|
1454
|
-
return TiktokBaseEvent;
|
|
1455
|
-
}());
|
|
1456
|
-
|
|
1457
|
-
var TiktokCustomEvent = /** @class */ (function (_super) {
|
|
1458
|
-
__extends(TiktokCustomEvent, _super);
|
|
1459
|
-
function TiktokCustomEvent() {
|
|
1460
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1461
|
-
}
|
|
1462
|
-
TiktokCustomEvent.prototype.send = function (data) {
|
|
1463
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1464
|
-
return __generator(this, function (_a) {
|
|
1465
|
-
switch (_a.label) {
|
|
1466
|
-
case 0:
|
|
1467
|
-
this.ttq.track(this.name, data);
|
|
1468
|
-
return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1469
|
-
case 1:
|
|
1470
|
-
_a.sent(); //force async to increase reporting odds
|
|
1471
|
-
return [2 /*return*/];
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1098
|
+
send(_data) {
|
|
1099
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1100
|
+
yield delay(0); //force async to increase reporting odds
|
|
1474
1101
|
});
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
}
|
|
1484
|
-
TiktokStandardEvent.prototype.send = function (data) {
|
|
1485
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1486
|
-
return __generator(this, function (_a) {
|
|
1487
|
-
switch (_a.label) {
|
|
1488
|
-
case 0:
|
|
1489
|
-
this.ttq.track(this.name, data);
|
|
1490
|
-
return [4 /*yield*/, delay(0)]; //force async to increase reporting odds
|
|
1491
|
-
case 1:
|
|
1492
|
-
_a.sent(); //force async to increase reporting odds
|
|
1493
|
-
return [2 /*return*/];
|
|
1494
|
-
}
|
|
1495
|
-
});
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
class TiktokCustomEvent extends TiktokBaseEvent {
|
|
1106
|
+
send(data) {
|
|
1107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1108
|
+
this.ttq.track(this.name, data);
|
|
1109
|
+
yield delay(0); //force async to increase reporting odds
|
|
1496
1110
|
});
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
}(TiktokBaseEvent));
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1500
1113
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1114
|
+
class TiktokStandardEvent extends TiktokBaseEvent {
|
|
1115
|
+
send(data) {
|
|
1116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1117
|
+
this.ttq.track(this.name, data);
|
|
1118
|
+
yield delay(0); //force async to increase reporting odds
|
|
1119
|
+
});
|
|
1503
1120
|
}
|
|
1504
|
-
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
class TiktokStandardEvents {
|
|
1124
|
+
pageView() {
|
|
1505
1125
|
return new TiktokStandardEvent('Browse');
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1126
|
+
}
|
|
1127
|
+
viewContent() {
|
|
1508
1128
|
return new TiktokStandardEvent('ViewContent');
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1129
|
+
}
|
|
1130
|
+
addToCart() {
|
|
1511
1131
|
return new TiktokStandardEvent('AddToCart');
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1132
|
+
}
|
|
1133
|
+
checkout() {
|
|
1514
1134
|
return new TiktokStandardEvent('Checkout');
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1135
|
+
}
|
|
1136
|
+
purchase() {
|
|
1517
1137
|
return new TiktokStandardEvent('Purchase');
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1138
|
+
}
|
|
1139
|
+
registration() {
|
|
1520
1140
|
return new TiktokStandardEvent('Registration');
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1141
|
+
}
|
|
1142
|
+
startCheckout() {
|
|
1523
1143
|
return new TiktokStandardEvent('StartCheckout');
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1144
|
+
}
|
|
1145
|
+
addBilling() {
|
|
1526
1146
|
return new TiktokStandardEvent('AddBilling');
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1147
|
+
}
|
|
1148
|
+
search() {
|
|
1529
1149
|
return new TiktokStandardEvent('Search');
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1150
|
+
}
|
|
1151
|
+
viewForm() {
|
|
1532
1152
|
return new TiktokStandardEvent('ViewForm');
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1153
|
+
}
|
|
1154
|
+
clickForm() {
|
|
1535
1155
|
return new TiktokStandardEvent('ClickForm');
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1156
|
+
}
|
|
1157
|
+
submitForm() {
|
|
1538
1158
|
return new TiktokStandardEvent('SubmitForm');
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1159
|
+
}
|
|
1160
|
+
viewDownloadPage() {
|
|
1541
1161
|
return new TiktokStandardEvent('ViewDownloadPage');
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1162
|
+
}
|
|
1163
|
+
clickInDownloadPage() {
|
|
1544
1164
|
return new TiktokStandardEvent('ClickInDownloadPage');
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1165
|
+
}
|
|
1166
|
+
clickToDownload() {
|
|
1547
1167
|
return new TiktokStandardEvent('ClickToDownload');
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1168
|
+
}
|
|
1169
|
+
clickButton() {
|
|
1550
1170
|
return new TiktokStandardEvent('ClickButton');
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
}());
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1554
1173
|
|
|
1555
|
-
|
|
1556
|
-
|
|
1174
|
+
class XyBaseEvent {
|
|
1175
|
+
constructor(name) {
|
|
1557
1176
|
this.name = name;
|
|
1558
1177
|
}
|
|
1559
|
-
|
|
1560
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1561
|
-
|
|
1562
|
-
switch (_a.label) {
|
|
1563
|
-
case 0: return [4 /*yield*/, XyPixel.instance.send(this.name, fields)];
|
|
1564
|
-
case 1:
|
|
1565
|
-
_a.sent();
|
|
1566
|
-
return [2 /*return*/];
|
|
1567
|
-
}
|
|
1568
|
-
});
|
|
1178
|
+
send(fields) {
|
|
1179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1180
|
+
yield XyPixel.instance.send(this.name, fields);
|
|
1569
1181
|
});
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
var XyUserEventHandler = /** @class */ (function () {
|
|
1583
|
-
function XyUserEventHandler() {
|
|
1584
|
-
}
|
|
1585
|
-
XyUserEventHandler.prototype.testStarted = function (data) {
|
|
1586
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1587
|
-
var event;
|
|
1588
|
-
return __generator(this, function (_a) {
|
|
1589
|
-
switch (_a.label) {
|
|
1590
|
-
case 0:
|
|
1591
|
-
event = new XyCustomEvent('TestStarted');
|
|
1592
|
-
return [4 /*yield*/, event.send(data)];
|
|
1593
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
1594
|
-
}
|
|
1595
|
-
});
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
class XyCustomEvent extends XyBaseEvent {
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
class XyUserEventHandler {
|
|
1189
|
+
testStarted(data) {
|
|
1190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1191
|
+
const event = new XyCustomEvent('TestStarted');
|
|
1192
|
+
return yield event.send(data);
|
|
1596
1193
|
});
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1600
|
-
|
|
1601
|
-
return
|
|
1602
|
-
switch (_a.label) {
|
|
1603
|
-
case 0:
|
|
1604
|
-
event = new XyCustomEvent('FunnelStarted');
|
|
1605
|
-
return [4 /*yield*/, event.send(data)];
|
|
1606
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
1607
|
-
}
|
|
1608
|
-
});
|
|
1194
|
+
}
|
|
1195
|
+
funnelStarted(data) {
|
|
1196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1197
|
+
const event = new XyCustomEvent('FunnelStarted');
|
|
1198
|
+
return yield event.send(data);
|
|
1609
1199
|
});
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1613
|
-
|
|
1614
|
-
return
|
|
1615
|
-
switch (_a.label) {
|
|
1616
|
-
case 0:
|
|
1617
|
-
event = new XyCustomEvent('ViewContent');
|
|
1618
|
-
return [4 /*yield*/, event.send(data)];
|
|
1619
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
1620
|
-
}
|
|
1621
|
-
});
|
|
1200
|
+
}
|
|
1201
|
+
viewContent(data) {
|
|
1202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1203
|
+
const event = new XyCustomEvent('ViewContent');
|
|
1204
|
+
return yield event.send(data);
|
|
1622
1205
|
});
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1626
|
-
|
|
1627
|
-
return
|
|
1628
|
-
switch (_a.label) {
|
|
1629
|
-
case 0:
|
|
1630
|
-
event = new XyCustomEvent('UserClick');
|
|
1631
|
-
return [4 /*yield*/, event.send(data)];
|
|
1632
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
1633
|
-
}
|
|
1634
|
-
});
|
|
1206
|
+
}
|
|
1207
|
+
userClick(data) {
|
|
1208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1209
|
+
const event = new XyCustomEvent('UserClick');
|
|
1210
|
+
return yield event.send(data);
|
|
1635
1211
|
});
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
}());
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1639
1214
|
|
|
1640
|
-
|
|
1641
|
-
|
|
1215
|
+
const MetaMaskEthersLoader = (props) => {
|
|
1216
|
+
const { children, enabled = true } = props;
|
|
1642
1217
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1218
|
+
const global = window;
|
|
1219
|
+
const ethereum = global.ethereum;
|
|
1220
|
+
const [error, setError] = useState();
|
|
1221
|
+
const [localAddress, setLocalAddress] = useState();
|
|
1222
|
+
const [resetCount, setResetCount] = useState(0);
|
|
1223
|
+
const [providerName, setProviderName] = useState();
|
|
1649
1224
|
if (ethereum) {
|
|
1650
1225
|
ethereum.autoRefreshOnNetworkChange = false;
|
|
1651
1226
|
}
|
|
1652
|
-
|
|
1227
|
+
const connect = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1653
1228
|
var _a;
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
return [2 /*return*/, localAddress ? [localAddress.toString()] : []];
|
|
1660
|
-
}
|
|
1661
|
-
});
|
|
1662
|
-
}); };
|
|
1663
|
-
var _f = __read(useState(), 2), isConnected = _f[0], setIsConnected = _f[1];
|
|
1664
|
-
useEffect(function () {
|
|
1229
|
+
yield ((_a = global.ethereum) === null || _a === void 0 ? void 0 : _a.enable());
|
|
1230
|
+
return localAddress ? [localAddress.toString()] : [];
|
|
1231
|
+
});
|
|
1232
|
+
const [isConnected, setIsConnected] = useState();
|
|
1233
|
+
useEffect(() => {
|
|
1665
1234
|
if (ethereum && enabled) {
|
|
1666
|
-
ethereum.on('accountsChanged',
|
|
1667
|
-
console.log(
|
|
1235
|
+
ethereum.on('accountsChanged', (accounts) => {
|
|
1236
|
+
console.log(`accountsChanged: ${JSON.stringify(accounts)}`);
|
|
1668
1237
|
setResetCount(resetCount + 1);
|
|
1669
1238
|
if (accounts.length > 0) {
|
|
1670
1239
|
setLocalAddress(EthAddress.fromString(accounts[0]));
|
|
@@ -1673,7 +1242,7 @@ var MetaMaskEthersLoader = function (props) {
|
|
|
1673
1242
|
setLocalAddress(undefined);
|
|
1674
1243
|
}
|
|
1675
1244
|
});
|
|
1676
|
-
ethereum.on('chainChanged',
|
|
1245
|
+
ethereum.on('chainChanged', (chainId) => {
|
|
1677
1246
|
setResetCount(resetCount + 1);
|
|
1678
1247
|
if (chainId) {
|
|
1679
1248
|
setChainId(parseInt(chainId));
|
|
@@ -1684,130 +1253,103 @@ var MetaMaskEthersLoader = function (props) {
|
|
|
1684
1253
|
});
|
|
1685
1254
|
}
|
|
1686
1255
|
}, [ethereum, resetCount, enabled]);
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
useEffect(
|
|
1256
|
+
const [walletProvider, setWalletProvider] = useState();
|
|
1257
|
+
const [provider, setProvider] = useState();
|
|
1258
|
+
const [signer, setSigner] = useState();
|
|
1259
|
+
useEffect(() => {
|
|
1691
1260
|
if (enabled) {
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
if (
|
|
1696
|
-
|
|
1697
|
-
|
|
1261
|
+
const walletProvider = ethereum ? new Web3Provider(ethereum) : null;
|
|
1262
|
+
let provider = null;
|
|
1263
|
+
let providerName = null;
|
|
1264
|
+
if (walletProvider) {
|
|
1265
|
+
provider = walletProvider;
|
|
1266
|
+
providerName = 'Meta Mask';
|
|
1698
1267
|
}
|
|
1699
1268
|
else {
|
|
1700
|
-
|
|
1701
|
-
|
|
1269
|
+
provider = new InfuraProvider(1, infuraKey);
|
|
1270
|
+
providerName = 'Infura (Default)';
|
|
1702
1271
|
}
|
|
1703
|
-
|
|
1704
|
-
setProvider(
|
|
1705
|
-
setProviderName(
|
|
1706
|
-
setWalletProvider(
|
|
1707
|
-
|
|
1272
|
+
provider = walletProvider !== null && walletProvider !== void 0 ? walletProvider : provider;
|
|
1273
|
+
setProvider(provider);
|
|
1274
|
+
setProviderName(providerName);
|
|
1275
|
+
setWalletProvider(walletProvider);
|
|
1276
|
+
let signer = null;
|
|
1708
1277
|
try {
|
|
1709
|
-
|
|
1278
|
+
signer = walletProvider === null || walletProvider === void 0 ? void 0 : walletProvider.getSigner();
|
|
1710
1279
|
}
|
|
1711
1280
|
catch (ex) {
|
|
1712
1281
|
console.error(ex);
|
|
1713
1282
|
}
|
|
1714
|
-
setSigner(
|
|
1283
|
+
setSigner(signer);
|
|
1715
1284
|
}
|
|
1716
1285
|
}, [ethereum, isConnected, enabled]);
|
|
1717
|
-
useAsyncEffect(
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
_b = (_a = EthAddress).fromString;
|
|
1727
|
-
return [4 /*yield*/, signer.getAddress()];
|
|
1728
|
-
case 2:
|
|
1729
|
-
localAddress_1 = _b.apply(_a, [_c.sent()]);
|
|
1730
|
-
console.log("Setting Local Address: ".concat(localAddress_1));
|
|
1731
|
-
if (isMounted()) {
|
|
1732
|
-
setLocalAddress(localAddress_1);
|
|
1733
|
-
setIsConnected(true);
|
|
1734
|
-
}
|
|
1735
|
-
return [3 /*break*/, 4];
|
|
1736
|
-
case 3:
|
|
1737
|
-
ex_1 = _c.sent();
|
|
1738
|
-
if (isMounted()) {
|
|
1739
|
-
setError(Error("localAddress: ".concat(ex_1)));
|
|
1740
|
-
setLocalAddress(undefined);
|
|
1741
|
-
setIsConnected(false);
|
|
1742
|
-
}
|
|
1743
|
-
return [3 /*break*/, 4];
|
|
1744
|
-
case 4: return [2 /*return*/];
|
|
1286
|
+
useAsyncEffect((isMounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1287
|
+
if (signer && enabled) {
|
|
1288
|
+
try {
|
|
1289
|
+
const localAddress = EthAddress.fromString(yield signer.getAddress());
|
|
1290
|
+
console.log(`Setting Local Address: ${localAddress}`);
|
|
1291
|
+
if (isMounted()) {
|
|
1292
|
+
setLocalAddress(localAddress);
|
|
1293
|
+
setIsConnected(true);
|
|
1294
|
+
}
|
|
1745
1295
|
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
return __generator(this, function (_b) {
|
|
1753
|
-
switch (_b.label) {
|
|
1754
|
-
case 0:
|
|
1755
|
-
if (!enabled) return [3 /*break*/, 2];
|
|
1756
|
-
return [4 /*yield*/, (provider === null || provider === void 0 ? void 0 : provider.getNetwork())];
|
|
1757
|
-
case 1:
|
|
1758
|
-
chainId_1 = (_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
1759
|
-
if (!isMounted())
|
|
1760
|
-
return [2 /*return*/];
|
|
1761
|
-
setChainId(chainId_1);
|
|
1762
|
-
_b.label = 2;
|
|
1763
|
-
case 2: return [2 /*return*/];
|
|
1296
|
+
catch (ex) {
|
|
1297
|
+
if (isMounted()) {
|
|
1298
|
+
setError(Error(`localAddress: ${ex}`));
|
|
1299
|
+
setLocalAddress(undefined);
|
|
1300
|
+
setIsConnected(false);
|
|
1301
|
+
}
|
|
1764
1302
|
}
|
|
1765
|
-
}
|
|
1766
|
-
})
|
|
1767
|
-
|
|
1303
|
+
}
|
|
1304
|
+
}), [signer, resetCount, enabled]);
|
|
1305
|
+
const [chainId, setChainId] = useState();
|
|
1306
|
+
useAsyncEffect((isMounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1307
|
+
var _b;
|
|
1308
|
+
if (enabled) {
|
|
1309
|
+
const chainId = (_b = (yield (provider === null || provider === void 0 ? void 0 : provider.getNetwork()))) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
1310
|
+
if (!isMounted())
|
|
1311
|
+
return;
|
|
1312
|
+
setChainId(chainId);
|
|
1313
|
+
}
|
|
1314
|
+
}), [provider, enabled]);
|
|
1315
|
+
return (jsx(EthersContext.Provider, Object.assign({ value: {
|
|
1768
1316
|
busy: false,
|
|
1769
|
-
chainId
|
|
1770
|
-
connect
|
|
1771
|
-
error
|
|
1772
|
-
isConnected
|
|
1773
|
-
localAddress
|
|
1774
|
-
provider
|
|
1775
|
-
providerName
|
|
1317
|
+
chainId,
|
|
1318
|
+
connect,
|
|
1319
|
+
error,
|
|
1320
|
+
isConnected,
|
|
1321
|
+
localAddress,
|
|
1322
|
+
provider,
|
|
1323
|
+
providerName,
|
|
1776
1324
|
signer: isConnected ? signer : undefined,
|
|
1777
|
-
walletProvider
|
|
1325
|
+
walletProvider,
|
|
1778
1326
|
} }, { children: children }), void 0));
|
|
1779
1327
|
};
|
|
1780
1328
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1329
|
+
const MyEtherWalletEthersLoader = (props) => {
|
|
1330
|
+
const { children } = props;
|
|
1783
1331
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1332
|
+
const global = window;
|
|
1333
|
+
const ethereum = global.ethereum;
|
|
1334
|
+
const [error, setError] = useState();
|
|
1335
|
+
const [localAddress, setLocalAddress] = useState();
|
|
1336
|
+
const [providerName, setProviderName] = useState();
|
|
1789
1337
|
if (ethereum) {
|
|
1790
1338
|
ethereum.autoRefreshOnNetworkChange = false;
|
|
1791
1339
|
}
|
|
1792
|
-
|
|
1340
|
+
const connect = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1793
1341
|
var _a;
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
var _f = __read(useState(), 2), provider = _f[0], setProvider = _f[1];
|
|
1806
|
-
var _g = __read(useState(), 2), signer = _g[0], setSigner = _g[1];
|
|
1807
|
-
useEffect(function () {
|
|
1808
|
-
var walletProvider = ethereum ? new Web3Provider(ethereum) : null;
|
|
1809
|
-
var provider = null;
|
|
1810
|
-
var providerName = null;
|
|
1342
|
+
yield ((_a = global.ethereum) === null || _a === void 0 ? void 0 : _a.enable());
|
|
1343
|
+
return localAddress ? [localAddress.toString()] : [];
|
|
1344
|
+
});
|
|
1345
|
+
const [isConnected, setIsConnected] = useState();
|
|
1346
|
+
const [walletProvider, setWalletProvider] = useState();
|
|
1347
|
+
const [provider, setProvider] = useState();
|
|
1348
|
+
const [signer, setSigner] = useState();
|
|
1349
|
+
useEffect(() => {
|
|
1350
|
+
const walletProvider = ethereum ? new Web3Provider(ethereum) : null;
|
|
1351
|
+
let provider = null;
|
|
1352
|
+
let providerName = null;
|
|
1811
1353
|
if (walletProvider) {
|
|
1812
1354
|
provider = walletProvider;
|
|
1813
1355
|
providerName = 'MyEtherWallet';
|
|
@@ -1819,7 +1361,7 @@ var MyEtherWalletEthersLoader = function (props) {
|
|
|
1819
1361
|
setProvider(provider);
|
|
1820
1362
|
setProviderName(providerName);
|
|
1821
1363
|
setWalletProvider(walletProvider);
|
|
1822
|
-
|
|
1364
|
+
let signer = null;
|
|
1823
1365
|
try {
|
|
1824
1366
|
signer = walletProvider === null || walletProvider === void 0 ? void 0 : walletProvider.getSigner();
|
|
1825
1367
|
}
|
|
@@ -1828,175 +1370,131 @@ var MyEtherWalletEthersLoader = function (props) {
|
|
|
1828
1370
|
}
|
|
1829
1371
|
setSigner(signer);
|
|
1830
1372
|
}, [ethereum, isConnected]);
|
|
1831
|
-
useAsyncEffect(
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
_c.trys.push([1, 3, , 4]);
|
|
1840
|
-
_b = (_a = EthAddress).fromString;
|
|
1841
|
-
return [4 /*yield*/, signer.getAddress()];
|
|
1842
|
-
case 2:
|
|
1843
|
-
localAddress_1 = _b.apply(_a, [_c.sent()]);
|
|
1844
|
-
if (isMounted()) {
|
|
1845
|
-
setLocalAddress(localAddress_1);
|
|
1846
|
-
setIsConnected(true);
|
|
1847
|
-
}
|
|
1848
|
-
return [3 /*break*/, 4];
|
|
1849
|
-
case 3:
|
|
1850
|
-
ex_1 = _c.sent();
|
|
1851
|
-
if (isMounted()) {
|
|
1852
|
-
setError(Error("localAddress: ".concat(ex_1)));
|
|
1853
|
-
setLocalAddress(undefined);
|
|
1854
|
-
setIsConnected(false);
|
|
1855
|
-
}
|
|
1856
|
-
return [3 /*break*/, 4];
|
|
1857
|
-
case 4: return [2 /*return*/];
|
|
1373
|
+
useAsyncEffect((isMounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1374
|
+
if (signer) {
|
|
1375
|
+
try {
|
|
1376
|
+
const localAddress = EthAddress.fromString(yield signer.getAddress());
|
|
1377
|
+
if (isMounted()) {
|
|
1378
|
+
setLocalAddress(localAddress);
|
|
1379
|
+
setIsConnected(true);
|
|
1380
|
+
}
|
|
1858
1381
|
}
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
return __generator(this, function (_b) {
|
|
1866
|
-
switch (_b.label) {
|
|
1867
|
-
case 0: return [4 /*yield*/, (provider === null || provider === void 0 ? void 0 : provider.getNetwork())];
|
|
1868
|
-
case 1:
|
|
1869
|
-
chainId = (_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
1870
|
-
if (!isMounted())
|
|
1871
|
-
return [2 /*return*/];
|
|
1872
|
-
setChainId(chainId);
|
|
1873
|
-
return [2 /*return*/];
|
|
1382
|
+
catch (ex) {
|
|
1383
|
+
if (isMounted()) {
|
|
1384
|
+
setError(Error(`localAddress: ${ex}`));
|
|
1385
|
+
setLocalAddress(undefined);
|
|
1386
|
+
setIsConnected(false);
|
|
1387
|
+
}
|
|
1874
1388
|
}
|
|
1875
|
-
}
|
|
1876
|
-
})
|
|
1877
|
-
|
|
1389
|
+
}
|
|
1390
|
+
}), [signer]);
|
|
1391
|
+
const [chainId, setChainId] = useState();
|
|
1392
|
+
useAsyncEffect((isMounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1393
|
+
var _b;
|
|
1394
|
+
const chainId = (_b = (yield (provider === null || provider === void 0 ? void 0 : provider.getNetwork()))) === null || _b === void 0 ? void 0 : _b.chainId;
|
|
1395
|
+
if (!isMounted())
|
|
1396
|
+
return;
|
|
1397
|
+
setChainId(chainId);
|
|
1398
|
+
}), [provider]);
|
|
1399
|
+
return (jsx(EthersContext.Provider, Object.assign({ value: {
|
|
1878
1400
|
busy: false,
|
|
1879
|
-
chainId
|
|
1880
|
-
connect
|
|
1881
|
-
error
|
|
1882
|
-
isConnected
|
|
1883
|
-
localAddress
|
|
1884
|
-
provider
|
|
1885
|
-
providerName
|
|
1401
|
+
chainId,
|
|
1402
|
+
connect,
|
|
1403
|
+
error,
|
|
1404
|
+
isConnected,
|
|
1405
|
+
localAddress,
|
|
1406
|
+
provider,
|
|
1407
|
+
providerName,
|
|
1886
1408
|
signer: isConnected ? signer : undefined,
|
|
1887
|
-
walletProvider
|
|
1409
|
+
walletProvider,
|
|
1888
1410
|
} }, { children: children }), void 0));
|
|
1889
1411
|
};
|
|
1890
1412
|
|
|
1891
|
-
|
|
1413
|
+
const OperaEthersLoader = (props) => {
|
|
1892
1414
|
var _a, _b, _c, _d, _e, _f;
|
|
1893
|
-
|
|
1415
|
+
const { children } = props;
|
|
1894
1416
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
useAsyncEffect(
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
return [4 /*yield*/, signer_1.getAddress()];
|
|
1918
|
-
case 2:
|
|
1919
|
-
localAddress_1 = _b.apply(_a, [_c.sent()]);
|
|
1920
|
-
ethereum.autoRefreshOnNetworkChange = false;
|
|
1921
|
-
if (mounted()) {
|
|
1922
|
-
setSigner(signer_1);
|
|
1923
|
-
setProvider(provider_1);
|
|
1924
|
-
setLocalAddress(localAddress_1);
|
|
1925
|
-
}
|
|
1926
|
-
return [3 /*break*/, 4];
|
|
1927
|
-
case 3:
|
|
1928
|
-
ex_1 = _c.sent();
|
|
1929
|
-
if (mounted()) {
|
|
1930
|
-
setError(Error("localAddress: ".concat(ex_1)));
|
|
1931
|
-
}
|
|
1932
|
-
return [3 /*break*/, 4];
|
|
1933
|
-
case 4: return [2 /*return*/];
|
|
1417
|
+
const global = window;
|
|
1418
|
+
const ethereum = global.ethereum;
|
|
1419
|
+
const [error, setError] = useState();
|
|
1420
|
+
const [signer, setSigner] = useState();
|
|
1421
|
+
const [provider, setProvider] = useState();
|
|
1422
|
+
const [localAddress, setLocalAddress] = useState(((_c = (_b = (_a = global.ethereum) === null || _a === void 0 ? void 0 : _a.addresses) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0 ? EthAddress.fromString((_e = (_d = global.ethereum) === null || _d === void 0 ? void 0 : _d.addresses) === null || _e === void 0 ? void 0 : _e[0]) : null);
|
|
1423
|
+
const chainId = (ethereum === null || ethereum === void 0 ? void 0 : ethereum.chainId) ? parseInt(ethereum === null || ethereum === void 0 ? void 0 : ethereum.chainId) : 1;
|
|
1424
|
+
const isConnected = (_f = ethereum === null || ethereum === void 0 ? void 0 : ethereum.isConnected()) !== null && _f !== void 0 ? _f : false;
|
|
1425
|
+
useAsyncEffect((mounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1426
|
+
if (ethereum) {
|
|
1427
|
+
ethereum.enable();
|
|
1428
|
+
const operaProvider = new Web3Provider(ethereum);
|
|
1429
|
+
const provider = operaProvider;
|
|
1430
|
+
const signer = operaProvider.getSigner();
|
|
1431
|
+
try {
|
|
1432
|
+
const localAddress = EthAddress.fromString(yield signer.getAddress());
|
|
1433
|
+
ethereum.autoRefreshOnNetworkChange = false;
|
|
1434
|
+
if (mounted()) {
|
|
1435
|
+
setSigner(signer);
|
|
1436
|
+
setProvider(provider);
|
|
1437
|
+
setLocalAddress(localAddress);
|
|
1438
|
+
}
|
|
1934
1439
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1440
|
+
catch (ex) {
|
|
1441
|
+
if (mounted()) {
|
|
1442
|
+
setError(Error(`localAddress: ${ex}`));
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}), [ethereum]);
|
|
1447
|
+
return (jsx(EthersContext.Provider, Object.assign({ value: {
|
|
1938
1448
|
busy: false,
|
|
1939
|
-
chainId
|
|
1940
|
-
error
|
|
1941
|
-
isConnected
|
|
1942
|
-
localAddress
|
|
1943
|
-
provider
|
|
1944
|
-
signer
|
|
1449
|
+
chainId,
|
|
1450
|
+
error,
|
|
1451
|
+
isConnected,
|
|
1452
|
+
localAddress,
|
|
1453
|
+
provider,
|
|
1454
|
+
signer,
|
|
1945
1455
|
} }, { children: children }), void 0));
|
|
1946
1456
|
};
|
|
1947
1457
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1458
|
+
const TrustEthersLoader = (props) => {
|
|
1459
|
+
const { children } = props;
|
|
1950
1460
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
useAsyncEffect(
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
case 1:
|
|
1966
|
-
_c.trys.push([1, 3, , 4]);
|
|
1967
|
-
_b = (_a = EthAddress).fromString;
|
|
1968
|
-
return [4 /*yield*/, signer.getAddress()];
|
|
1969
|
-
case 2:
|
|
1970
|
-
localAddress_1 = _b.apply(_a, [_c.sent()]);
|
|
1971
|
-
if (mounted()) {
|
|
1972
|
-
setLocalAddress(localAddress_1);
|
|
1973
|
-
}
|
|
1974
|
-
return [3 /*break*/, 4];
|
|
1975
|
-
case 3:
|
|
1976
|
-
ex_1 = _c.sent();
|
|
1977
|
-
if (mounted()) {
|
|
1978
|
-
setError(Error("localAddress: ".concat(ex_1)));
|
|
1979
|
-
}
|
|
1980
|
-
return [3 /*break*/, 4];
|
|
1981
|
-
case 4: return [2 /*return*/];
|
|
1461
|
+
const global = window;
|
|
1462
|
+
const [error, setError] = useState();
|
|
1463
|
+
const [localAddress, setLocalAddress] = useState();
|
|
1464
|
+
const trustProvider = new Web3Provider(global.ethereum);
|
|
1465
|
+
const signer = trustProvider.getSigner();
|
|
1466
|
+
const chainId = 1;
|
|
1467
|
+
const provider = trustProvider;
|
|
1468
|
+
useAsyncEffect((mounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1469
|
+
if (signer) {
|
|
1470
|
+
try {
|
|
1471
|
+
const localAddress = EthAddress.fromString(yield signer.getAddress());
|
|
1472
|
+
if (mounted()) {
|
|
1473
|
+
setLocalAddress(localAddress);
|
|
1474
|
+
}
|
|
1982
1475
|
}
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1476
|
+
catch (ex) {
|
|
1477
|
+
if (mounted()) {
|
|
1478
|
+
setError(Error(`localAddress: ${ex}`));
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}), [signer]);
|
|
1483
|
+
return (jsx(EthersContext.Provider, Object.assign({ value: {
|
|
1986
1484
|
busy: false,
|
|
1987
|
-
chainId
|
|
1988
|
-
error
|
|
1989
|
-
localAddress
|
|
1990
|
-
provider
|
|
1991
|
-
signer
|
|
1485
|
+
chainId,
|
|
1486
|
+
error,
|
|
1487
|
+
localAddress,
|
|
1488
|
+
provider,
|
|
1489
|
+
signer,
|
|
1992
1490
|
} }, { children: children }), void 0));
|
|
1993
1491
|
};
|
|
1994
1492
|
|
|
1995
|
-
|
|
1493
|
+
const EthersLoader = (props) => {
|
|
1996
1494
|
var _a, _b, _c, _d;
|
|
1997
1495
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1998
|
-
|
|
1999
|
-
|
|
1496
|
+
const global = window;
|
|
1497
|
+
const { children } = props;
|
|
2000
1498
|
if ((_a = global.ethereum) === null || _a === void 0 ? void 0 : _a.isMetaMask) {
|
|
2001
1499
|
return jsx(MetaMaskEthersLoader, { children: children }, void 0);
|
|
2002
1500
|
}
|
|
@@ -2015,11 +1513,11 @@ var EthersLoader = function (props) {
|
|
|
2015
1513
|
return jsx(InfuraEthersLoader, { children: children }, void 0);
|
|
2016
1514
|
};
|
|
2017
1515
|
|
|
2018
|
-
|
|
1516
|
+
const NetworkSettingsContext = createContext({});
|
|
2019
1517
|
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
return (jsx(NetworkSettingsContext.Provider,
|
|
1518
|
+
const NetworkSettingsLoader = (props) => {
|
|
1519
|
+
const { children } = props;
|
|
1520
|
+
return (jsx(NetworkSettingsContext.Provider, Object.assign({ value: {
|
|
2023
1521
|
xyBondAddress: EthAddress.fromString('0x1a024A698EEBdB86ccf3fCaF2F589839bdc066AD'),
|
|
2024
1522
|
xyFhrMerkleSendAddress: EthAddress.fromString('0x46FEEBDffC8076D9E5fd8a11CF1508810472A79f'),
|
|
2025
1523
|
xyGovernanceAddress: EthAddress.fromString('0x01925d0fFE4a6a6162B51ba611e3D4780Fc2dF42'),
|
|
@@ -2027,16 +1525,15 @@ var NetworkSettingsLoader = function (props) {
|
|
|
2027
1525
|
} }, { children: children }), void 0));
|
|
2028
1526
|
};
|
|
2029
1527
|
|
|
2030
|
-
|
|
1528
|
+
const UserEventsContext = createContext({});
|
|
2031
1529
|
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
return jsx(UserEventsContext.Provider, __assign({ value: { userEvents: userEvents } }, { children: children }), void 0);
|
|
1530
|
+
const UserEventsLoader = ({ userEvents, children }) => {
|
|
1531
|
+
return jsx(UserEventsContext.Provider, Object.assign({ value: { userEvents } }, { children: children }), void 0);
|
|
2035
1532
|
};
|
|
2036
1533
|
|
|
2037
|
-
|
|
2038
|
-
for (
|
|
2039
|
-
|
|
1534
|
+
const calcSpacing = (theme, values) => {
|
|
1535
|
+
for (let i = 0; i < values.length; i++) {
|
|
1536
|
+
const value = values[i];
|
|
2040
1537
|
if (value !== undefined) {
|
|
2041
1538
|
if (typeof value === 'string') {
|
|
2042
1539
|
return value;
|
|
@@ -2048,63 +1545,77 @@ var calcSpacing = function (theme, values) {
|
|
|
2048
1545
|
}
|
|
2049
1546
|
};
|
|
2050
1547
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
1548
|
+
const mergeBoxlikeStyles = (theme, props, defaultProps) => {
|
|
1549
|
+
const _a = Object.assign(Object.assign({}, defaultProps), props), { alignContent, alignItems, alignSelf, bgcolor, border, borderColor, display, flexGrow, flexShrink, flexDirection, flexWrap, justifyContent, justifyItems, justifySelf, height, minHeight, minWidth, margin, marginX, marginY, marginTop, marginLeft, marginRight, marginBottom, padding, paddingX, paddingY, paddingTop, paddingLeft, paddingRight, paddingBottom, position, style, width } = _a, rootProps = __rest(_a, ["alignContent", "alignItems", "alignSelf", "bgcolor", "border", "borderColor", "display", "flexGrow", "flexShrink", "flexDirection", "flexWrap", "justifyContent", "justifyItems", "justifySelf", "height", "minHeight", "minWidth", "margin", "marginX", "marginY", "marginTop", "marginLeft", "marginRight", "marginBottom", "padding", "paddingX", "paddingY", "paddingTop", "paddingLeft", "paddingRight", "paddingBottom", "position", "style", "width"]);
|
|
1550
|
+
const mergedStyle = Object.assign({ alignContent,
|
|
1551
|
+
alignItems,
|
|
1552
|
+
alignSelf, backgroundColor: bgcolor, border,
|
|
1553
|
+
borderColor,
|
|
1554
|
+
display,
|
|
1555
|
+
flexDirection,
|
|
1556
|
+
flexGrow,
|
|
1557
|
+
flexShrink,
|
|
1558
|
+
flexWrap,
|
|
1559
|
+
height,
|
|
1560
|
+
justifyContent,
|
|
1561
|
+
justifyItems,
|
|
1562
|
+
justifySelf, marginBottom: calcSpacing(theme, [marginBottom, marginY, margin]), marginLeft: calcSpacing(theme, [marginLeft, marginX, margin]), marginRight: calcSpacing(theme, [marginRight, marginX, margin]), marginTop: calcSpacing(theme, [marginTop, marginY, margin]), minHeight,
|
|
1563
|
+
minWidth, paddingBottom: calcSpacing(theme, [paddingBottom, paddingY, padding]), paddingLeft: calcSpacing(theme, [paddingLeft, paddingX, padding]), paddingRight: calcSpacing(theme, [paddingRight, paddingX, padding]), paddingTop: calcSpacing(theme, [paddingTop, paddingY, padding]), position,
|
|
1564
|
+
width }, style);
|
|
1565
|
+
return Object.assign(Object.assign({}, rootProps), { style: mergedStyle });
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
const ButtonExBase = (props) => {
|
|
1569
|
+
const theme = useTheme();
|
|
1570
|
+
const _a = mergeBoxlikeStyles(theme, props), { busy, busyVariant = 'linear', busyOpacity, onClick, children } = _a, rootProps = __rest(_a, ["busy", "busyVariant", "busyOpacity", "onClick", "children"]);
|
|
1571
|
+
const localOnClick = (event) => {
|
|
2061
1572
|
if (!busy) {
|
|
2062
1573
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
2063
1574
|
}
|
|
2064
1575
|
};
|
|
2065
|
-
return (jsxs(Button,
|
|
1576
|
+
return (jsxs(Button, Object.assign({ onClick: localOnClick }, rootProps, { children: [busy && busyVariant === 'linear' ? jsx(BusyLinearProgress, { rounded: true, opacity: busyOpacity !== null && busyOpacity !== void 0 ? busyOpacity : 0 }, void 0) : null, busy && busyVariant === 'circular' ? (jsx(BusyCircularProgress, { rounded: true, size: 24, opacity: busyOpacity !== null && busyOpacity !== void 0 ? busyOpacity : 0.5 }, void 0)) : null, children] }), void 0));
|
|
2066
1577
|
};
|
|
2067
1578
|
|
|
2068
|
-
|
|
2069
|
-
var
|
|
2070
|
-
|
|
2071
|
-
|
|
1579
|
+
const ButtonExTo = (_a) => {
|
|
1580
|
+
var { to, toOptions, onClick } = _a, props = __rest(_a, ["to", "toOptions", "onClick"]);
|
|
1581
|
+
const navigate = useNavigate();
|
|
1582
|
+
const localOnClick = (event) => {
|
|
2072
1583
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
2073
1584
|
if (to) {
|
|
2074
1585
|
navigate(to, toOptions);
|
|
2075
1586
|
}
|
|
2076
1587
|
};
|
|
2077
|
-
return jsx(ButtonExBase,
|
|
1588
|
+
return jsx(ButtonExBase, Object.assign({ onClick: localOnClick }, props), void 0);
|
|
2078
1589
|
};
|
|
2079
1590
|
|
|
2080
|
-
|
|
2081
|
-
var to = _a
|
|
1591
|
+
const ButtonEx = (_a) => {
|
|
1592
|
+
var { to } = _a, props = __rest(_a, ["to"]);
|
|
2082
1593
|
if (to) {
|
|
2083
|
-
return jsx(ButtonExTo,
|
|
1594
|
+
return jsx(ButtonExTo, Object.assign({ to: to }, props), void 0);
|
|
2084
1595
|
}
|
|
2085
1596
|
else {
|
|
2086
|
-
return jsx(ButtonExBase,
|
|
1597
|
+
return jsx(ButtonExBase, Object.assign({}, props), void 0);
|
|
2087
1598
|
}
|
|
2088
1599
|
};
|
|
2089
1600
|
|
|
2090
|
-
|
|
2091
|
-
var
|
|
2092
|
-
|
|
2093
|
-
|
|
1601
|
+
const CookieConsentBody = (_a) => {
|
|
1602
|
+
var { acceptOnScroll, acceptOnTimer = 0, onAccept } = _a, props = __rest(_a, ["acceptOnScroll", "acceptOnTimer", "onAccept"]);
|
|
1603
|
+
const { accepted, setAccepted, storageName } = useCookieConsent();
|
|
1604
|
+
const onScroll = () => {
|
|
2094
1605
|
//hide it one the user has scrolled at least one page
|
|
2095
1606
|
if (window.scrollY > window.innerHeight && !accepted) {
|
|
2096
1607
|
onAcceptClick();
|
|
2097
1608
|
}
|
|
2098
1609
|
};
|
|
2099
|
-
useEffect(
|
|
1610
|
+
useEffect(() => {
|
|
2100
1611
|
if (acceptOnScroll) {
|
|
2101
1612
|
window.addEventListener('scroll', onScroll);
|
|
2102
|
-
return
|
|
1613
|
+
return () => {
|
|
2103
1614
|
window.removeEventListener('scroll', onScroll);
|
|
2104
1615
|
};
|
|
2105
1616
|
}
|
|
2106
1617
|
});
|
|
2107
|
-
|
|
1618
|
+
const onAcceptClick = () => {
|
|
2108
1619
|
if (setAccepted) {
|
|
2109
1620
|
setAccepted === null || setAccepted === void 0 ? void 0 : setAccepted(true);
|
|
2110
1621
|
}
|
|
@@ -2114,21 +1625,21 @@ var CookieConsentBody = function (_a) {
|
|
|
2114
1625
|
onAccept === null || onAccept === void 0 ? void 0 : onAccept(true);
|
|
2115
1626
|
};
|
|
2116
1627
|
if (acceptOnTimer > 0 && !accepted) {
|
|
2117
|
-
setTimeout(
|
|
1628
|
+
setTimeout(() => {
|
|
2118
1629
|
onAcceptClick();
|
|
2119
1630
|
}, acceptOnTimer);
|
|
2120
1631
|
}
|
|
2121
1632
|
if (!storageName) {
|
|
2122
|
-
return (jsx(FlexRow,
|
|
1633
|
+
return (jsx(FlexRow, Object.assign({ justifyContent: "center", paddingY: 2 }, props, { children: jsx(Typography, Object.assign({ color: "error", variant: "body1" }, { children: "Missing CookieConsentContext" }), void 0) }), void 0));
|
|
2123
1634
|
}
|
|
2124
|
-
return accepted ? null : (jsxs(FlexRow,
|
|
1635
|
+
return accepted ? null : (jsxs(FlexRow, Object.assign({ justifyContent: "space-between" }, props, { children: [jsxs(Typography, Object.assign({ variant: "body2", margin: 2 }, { children: ['This site uses ', jsx(Link, Object.assign({ href: "https://cookiesandyou.com/", rel: "noopener noreferrer", target: "_blank" }, { children: "cookies" }), void 0), ' and ', jsx(Link, Object.assign({ href: "https://policies.google.com/technologies/partner-sites", rel: "noopener noreferrer", target: "_blank" }, { children: "Google\u00A0tools" }), void 0), ' to analyze traffic and for ads measurement purposes.'] }), void 0), jsx(ButtonEx, Object.assign({ variant: "contained", color: "secondary", onClick: onAcceptClick, margin: 2 }, { children: "Accept" }), void 0)] }), void 0));
|
|
2125
1636
|
};
|
|
2126
1637
|
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
return accepted ? null : (jsx(CookieConsentBody,
|
|
1638
|
+
const CookieConsent = (props) => {
|
|
1639
|
+
const { storageName } = useCookieConsent();
|
|
1640
|
+
const Inner = () => {
|
|
1641
|
+
const { accepted } = useCookieConsent();
|
|
1642
|
+
return accepted ? null : (jsx(CookieConsentBody, Object.assign({ background: true, paper: true, position: "fixed", bottom: 0, maxWidth: "100vw", width: "100%", zIndex: 1000 }, props), void 0));
|
|
2132
1643
|
};
|
|
2133
1644
|
//if not inside a context, make a context
|
|
2134
1645
|
if (!storageName) {
|
|
@@ -2137,96 +1648,104 @@ var CookieConsent = function (props) {
|
|
|
2137
1648
|
return jsx(Inner, {}, void 0);
|
|
2138
1649
|
};
|
|
2139
1650
|
|
|
2140
|
-
|
|
1651
|
+
const InvertableThemeContext = createContext({
|
|
2141
1652
|
options: {},
|
|
2142
1653
|
});
|
|
2143
1654
|
|
|
2144
|
-
|
|
2145
|
-
var
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
clonedOptions.palette = (_c = clonedOptions.palette) !== null && _c !== void 0 ? _c : {};
|
|
1655
|
+
const InvertableThemeProvider = ({ options, children, dark, scoped = false, invert = false, noResponsiveFonts, }) => {
|
|
1656
|
+
var _a, _b;
|
|
1657
|
+
const contextInvertableTheme = useContext(InvertableThemeContext);
|
|
1658
|
+
const clonedOptions = clone((_a = options !== null && options !== void 0 ? options : contextInvertableTheme.options) !== null && _a !== void 0 ? _a : {});
|
|
1659
|
+
clonedOptions.palette = (_b = clonedOptions.palette) !== null && _b !== void 0 ? _b : {};
|
|
2150
1660
|
if (invert) {
|
|
2151
1661
|
clonedOptions.palette.mode = clonedOptions.palette.mode === 'dark' ? 'light' : 'dark';
|
|
2152
1662
|
}
|
|
2153
1663
|
if (dark !== undefined) {
|
|
2154
1664
|
clonedOptions.palette.mode = dark ? 'dark' : 'light';
|
|
2155
1665
|
}
|
|
2156
|
-
|
|
1666
|
+
let theme = createTheme(clonedOptions);
|
|
2157
1667
|
if (!noResponsiveFonts) {
|
|
2158
1668
|
theme = responsiveFontSizes(theme);
|
|
2159
1669
|
}
|
|
2160
|
-
return scoped ? (jsx(ScopedCssBaseline, { children: jsx(InvertableThemeContext.Provider,
|
|
1670
|
+
return scoped ? (jsx(ScopedCssBaseline, { children: jsx(InvertableThemeContext.Provider, Object.assign({ value: { options: clonedOptions } }, { children: jsx(ThemeProvider, Object.assign({ theme: theme }, { children: children }), void 0) }), void 0) }, void 0)) : (jsx(InvertableThemeContext.Provider, Object.assign({ value: { options: clonedOptions } }, { children: jsx(ThemeProvider, Object.assign({ theme: theme }, { children: children }), void 0) }), void 0));
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1673
|
+
// The point of this component it to return to the top of the page on any router navigate
|
|
1674
|
+
const ScrollToTop = () => {
|
|
1675
|
+
const { pathname } = useLocation();
|
|
1676
|
+
useEffect(() => {
|
|
1677
|
+
window.scrollTo(0, 0);
|
|
1678
|
+
}, [pathname]);
|
|
1679
|
+
return null;
|
|
2161
1680
|
};
|
|
2162
1681
|
|
|
2163
|
-
|
|
2164
|
-
var
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
return (jsxs(FlexCol,
|
|
1682
|
+
const BasePage = (_a) => {
|
|
1683
|
+
var { disableGutters, children, beta, container, hideFooter, appFooter, appBar, cookieConsent, filterBar, hideAppBar, hideFilterBar, noindex = false, scrollToTopButton = false, title } = _a, props = __rest(_a, ["disableGutters", "children", "beta", "container", "hideFooter", "appFooter", "appBar", "cookieConsent", "filterBar", "hideAppBar", "hideFilterBar", "noindex", "scrollToTopButton", "title"]);
|
|
1684
|
+
const theme = useTheme();
|
|
1685
|
+
const scrollToTopAnchorId = 'scroll-to-top-anchor';
|
|
1686
|
+
return (jsxs(FlexCol, Object.assign({ justifyContent: "flex-start", color: theme.palette.text.primary, alignItems: "stretch", width: "100%", maxWidth: "100vw", minHeight: "100vh" }, props, { children: [jsx(ScrollToTop, {}, void 0), jsx(Helmet, Object.assign({ title: title }, { children: noindex ? jsx("meta", { content: "noindex", name: "robots" }, void 0) : null }), void 0), scrollToTopButton ? jsx("div", { id: scrollToTopAnchorId }, void 0) : null, hideAppBar ? null : appBar, hideFilterBar ? null : filterBar, beta ? (jsx(FlexRow, Object.assign({ margin: 1, position: "absolute", top: 0, left: 0, bgcolor: "#cccccc88", paddingX: 1, style: { opacity: 0.5 } }, { children: jsx(Typography, Object.assign({ variant: "body2" }, { children: "Important: This page is a Beta page. It is possible that some information may not be correct." }), void 0) }), void 0)) : null, container ? (jsx(Container, Object.assign({ style: { alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1 }, maxWidth: container, disableGutters: disableGutters }, { children: children }), void 0)) : (children), hideFooter ? null : jsx("footer", { children: appFooter }, void 0), cookieConsent !== null && cookieConsent !== void 0 ? cookieConsent : (jsx(ScopedCssBaseline, { children: jsx(InvertableThemeProvider, Object.assign({ invert: true }, { children: jsx(CookieConsent, { borderRadius: 0 }, void 0) }), void 0) }, void 0)), scrollToTopButton ? (jsx(ScrollToTopButton, Object.assign({ anchorId: scrollToTopAnchorId }, { children: jsx(Fab, Object.assign({ "aria-label": "scroll to top", color: "secondary", size: "small" }, { children: jsx(KeyboardArrowUp, {}, void 0) }), void 0) }), void 0)) : null] }), void 0));
|
|
2168
1687
|
};
|
|
2169
1688
|
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
for (
|
|
2173
|
-
result.push(
|
|
1689
|
+
const getPartialPath = (pathParts, index) => {
|
|
1690
|
+
const result = [];
|
|
1691
|
+
for (let i = 0; i <= index; i++) {
|
|
1692
|
+
result.push(`${pathParts[i]}/`);
|
|
2174
1693
|
}
|
|
2175
1694
|
return result.join('');
|
|
2176
1695
|
};
|
|
2177
|
-
|
|
1696
|
+
const BreadcrumbsEx = (_a) => {
|
|
2178
1697
|
var _b;
|
|
2179
|
-
var
|
|
2180
|
-
|
|
1698
|
+
var { titles, path = document.location.pathname, separator = '|', logo, children } = _a, props = __rest(_a, ["titles", "path", "separator", "logo", "children"]);
|
|
1699
|
+
const pathParts = path.split('/');
|
|
2181
1700
|
//if the url has a trailing '/', remove the last part
|
|
2182
1701
|
if (((_b = pathParts[pathParts.length - 1]) === null || _b === void 0 ? void 0 : _b.length) === 0) {
|
|
2183
1702
|
pathParts.pop();
|
|
2184
1703
|
}
|
|
2185
|
-
assertEx(pathParts.length - 1 === (titles === null || titles === void 0 ? void 0 : titles.length),
|
|
2186
|
-
return (jsxs(Breadcrumbs,
|
|
2187
|
-
|
|
2188
|
-
return (jsx(Link,
|
|
1704
|
+
assertEx(pathParts.length - 1 === (titles === null || titles === void 0 ? void 0 : titles.length), `Path/Title length mismatch: ${JSON.stringify(titles)} with ${JSON.stringify(pathParts)}`);
|
|
1705
|
+
return (jsxs(Breadcrumbs, Object.assign({ separator: separator }, props, { children: [pathParts.map((_pathPart, index) => {
|
|
1706
|
+
const path = getPartialPath(pathParts, index);
|
|
1707
|
+
return (jsx(Link, Object.assign({ title: index > 0 ? titles === null || titles === void 0 ? void 0 : titles[index - 1] : 'COIN', color: index === pathParts.length - 1 ? 'textPrimary' : 'inherit', component: Link$1, to: path }, { children: index > 0 ? (titles === null || titles === void 0 ? void 0 : titles[index - 1]) : (jsx(FlexRow, { children: typeof logo === 'string' ? jsx("img", { src: logo }, void 0) : logo }, void 0)) }), path));
|
|
2189
1708
|
}), children] }), void 0));
|
|
2190
1709
|
};
|
|
2191
1710
|
|
|
2192
|
-
|
|
1711
|
+
const toAxiosError = (error) => {
|
|
2193
1712
|
return error.isAxiosError ? error : undefined;
|
|
2194
1713
|
};
|
|
2195
|
-
|
|
1714
|
+
const ErrorDialogOpen = (_a) => {
|
|
2196
1715
|
var _b, _c;
|
|
2197
|
-
var
|
|
2198
|
-
|
|
1716
|
+
var { onAction, title = 'Oops. Something went wrong.', error = Error('Unknown Error') } = _a, props = __rest(_a, ["onAction", "title", "error"]);
|
|
1717
|
+
const onCloseClicked = () => {
|
|
2199
1718
|
onAction === null || onAction === void 0 ? void 0 : onAction(false);
|
|
2200
1719
|
};
|
|
2201
|
-
|
|
1720
|
+
const onRetryClicked = () => {
|
|
2202
1721
|
onAction === null || onAction === void 0 ? void 0 : onAction(true);
|
|
2203
1722
|
};
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
return (jsxs(Dialog,
|
|
1723
|
+
const axiosError = toAxiosError(error);
|
|
1724
|
+
const message = (_b = error.message) !== null && _b !== void 0 ? _b : error.toString();
|
|
1725
|
+
return (jsxs(Dialog, Object.assign({}, props, { children: [jsx(DialogTitle, { children: title }, void 0), jsx(DialogContent, { children: jsx(FlexRow, { children: jsx(Typography, Object.assign({ color: "error" }, { children: axiosError ? `${message} [${(_c = axiosError === null || axiosError === void 0 ? void 0 : axiosError.code) !== null && _c !== void 0 ? _c : 'Connection Failure'}]` : `${message}` }), void 0) }, void 0) }, void 0), jsx(DialogActions, { children: jsxs(FlexRow, Object.assign({ justifyContent: "space-between", width: "100%", minWidth: "300px" }, { children: [jsx(ButtonEx, Object.assign({ onClick: onCloseClicked, variant: "text" }, { children: "Close" }), void 0), jsx(ButtonEx, Object.assign({ onClick: onRetryClicked, variant: "text" }, { children: "Retry" }), void 0)] }), void 0) }, void 0)] }), void 0));
|
|
2207
1726
|
};
|
|
2208
|
-
|
|
2209
|
-
var
|
|
1727
|
+
const ErrorDialog = (_a) => {
|
|
1728
|
+
var { open, error } = _a, props = __rest(_a, ["open", "error"]);
|
|
2210
1729
|
if (error) {
|
|
2211
|
-
return jsx(ErrorDialogOpen,
|
|
1730
|
+
return jsx(ErrorDialogOpen, Object.assign({ open: !!error || open, error: error }, props), void 0);
|
|
2212
1731
|
}
|
|
2213
1732
|
else {
|
|
2214
1733
|
return null;
|
|
2215
1734
|
}
|
|
2216
1735
|
};
|
|
2217
1736
|
|
|
2218
|
-
|
|
2219
|
-
var
|
|
2220
|
-
return (jsxs(Dialog,
|
|
1737
|
+
const MessageDialog = (_a) => {
|
|
1738
|
+
var { onOk, onCancel, children, title } = _a, props = __rest(_a, ["onOk", "onCancel", "children", "title"]);
|
|
1739
|
+
return (jsxs(Dialog, Object.assign({}, props, { children: [jsx(DialogTitle, { children: title }, void 0), jsx(DialogContent, { children: jsx(FlexCol, Object.assign({ alignItems: "stretch" }, { children: children }), void 0) }, void 0), jsx(DialogActions, { children: jsxs(FlexRow, Object.assign({ justifyContent: "space-between", width: "100%" }, { children: [jsx(Button, Object.assign({ onClick: onCancel, variant: "text" }, { children: "Cancel" }), void 0), jsx(Button, Object.assign({ onClick: onOk, variant: "text" }, { children: "Ok" }), void 0)] }), void 0) }, void 0)] }), void 0));
|
|
2221
1740
|
};
|
|
2222
1741
|
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
1742
|
+
const useBreakpoint = () => {
|
|
1743
|
+
const theme = useTheme();
|
|
1744
|
+
const xs = useMediaQuery(theme.breakpoints.only('xs'));
|
|
1745
|
+
const sm = useMediaQuery(theme.breakpoints.only('sm'));
|
|
1746
|
+
const md = useMediaQuery(theme.breakpoints.only('md'));
|
|
1747
|
+
const lg = useMediaQuery(theme.breakpoints.only('lg'));
|
|
1748
|
+
const xl = useMediaQuery(theme.breakpoints.only('xl'));
|
|
2230
1749
|
if (xs) {
|
|
2231
1750
|
return 'xs';
|
|
2232
1751
|
}
|
|
@@ -2244,18 +1763,18 @@ var useBreakpoint = function () {
|
|
|
2244
1763
|
}
|
|
2245
1764
|
};
|
|
2246
1765
|
|
|
2247
|
-
|
|
2248
|
-
|
|
1766
|
+
const useLocalStorage = (key, defaultValue) => {
|
|
1767
|
+
const [storedValue, setStoredValue] = useState(() => {
|
|
2249
1768
|
try {
|
|
2250
|
-
|
|
1769
|
+
const item = getLocalStorageObject(key);
|
|
2251
1770
|
return item || defaultValue;
|
|
2252
1771
|
}
|
|
2253
1772
|
catch (ex) {
|
|
2254
1773
|
//Error is already logged
|
|
2255
1774
|
return defaultValue;
|
|
2256
1775
|
}
|
|
2257
|
-
})
|
|
2258
|
-
|
|
1776
|
+
});
|
|
1777
|
+
const setValue = (value) => {
|
|
2259
1778
|
console.log('setValue', value);
|
|
2260
1779
|
setStoredValue(value);
|
|
2261
1780
|
setLocalStorageObject(key, value);
|
|
@@ -2264,30 +1783,30 @@ var useLocalStorage = function (key, defaultValue) {
|
|
|
2264
1783
|
return [storedValue, setValue];
|
|
2265
1784
|
};
|
|
2266
1785
|
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
useEffect(
|
|
1786
|
+
const useMounted = () => {
|
|
1787
|
+
const [mounted, setMounted] = useState(true);
|
|
1788
|
+
useEffect(() => {
|
|
2270
1789
|
setMounted(true);
|
|
2271
|
-
return
|
|
1790
|
+
return () => {
|
|
2272
1791
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2273
1792
|
setMounted(false);
|
|
2274
1793
|
};
|
|
2275
1794
|
}, []);
|
|
2276
|
-
return
|
|
1795
|
+
return () => {
|
|
2277
1796
|
return mounted;
|
|
2278
1797
|
};
|
|
2279
1798
|
};
|
|
2280
1799
|
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
1800
|
+
const useNavigateToEthAddress = () => {
|
|
1801
|
+
const navigate = useNavigate();
|
|
1802
|
+
const navigateToEthAddress = (address, event, page, to, toOptions, toEtherScan) => {
|
|
2284
1803
|
var _a;
|
|
2285
|
-
|
|
1804
|
+
const openInEtherScan = toEtherScan || (!to && !page);
|
|
2286
1805
|
if (openInEtherScan) {
|
|
2287
|
-
window.open(
|
|
1806
|
+
window.open(`https://etherscan.io/address/${address.toString()}`, '_blank');
|
|
2288
1807
|
}
|
|
2289
1808
|
else {
|
|
2290
|
-
|
|
1809
|
+
const path = (_a = to === null || to === void 0 ? void 0 : to.toString()) !== null && _a !== void 0 ? _a : `/${page}/${address.toString()}`;
|
|
2291
1810
|
if (event.metaKey || toEtherScan) {
|
|
2292
1811
|
window.open(path, '_blank');
|
|
2293
1812
|
}
|
|
@@ -2296,60 +1815,50 @@ var useNavigateToEthAddress = function () {
|
|
|
2296
1815
|
}
|
|
2297
1816
|
}
|
|
2298
1817
|
};
|
|
2299
|
-
return { navigateToEthAddress
|
|
1818
|
+
return { navigateToEthAddress };
|
|
2300
1819
|
};
|
|
2301
1820
|
|
|
2302
|
-
|
|
2303
|
-
|
|
1821
|
+
const useSpacing = (value) => {
|
|
1822
|
+
const theme = useTheme();
|
|
2304
1823
|
return theme.spacing(typeof value === 'string' ? parseInt(value) : value);
|
|
2305
1824
|
};
|
|
2306
1825
|
|
|
2307
|
-
|
|
2308
|
-
|
|
1826
|
+
const useUserEvents = () => {
|
|
1827
|
+
const { userEvents } = useContext(UserEventsContext);
|
|
1828
|
+
if (!userEvents) {
|
|
1829
|
+
console.error('useUserEvents must be called inside a UserEventsContext');
|
|
1830
|
+
}
|
|
2309
1831
|
return userEvents;
|
|
2310
1832
|
};
|
|
2311
1833
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
useAsyncEffect(
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
return [4 /*yield*/, getSupportsWebP()];
|
|
2321
|
-
case 1:
|
|
2322
|
-
supportsWebP = _a.sent();
|
|
2323
|
-
if (mounted()) {
|
|
2324
|
-
setImg(supportsWebP ? webp : alt);
|
|
2325
|
-
}
|
|
2326
|
-
_a.label = 2;
|
|
2327
|
-
case 2: return [2 /*return*/];
|
|
1834
|
+
let supportsWebP = undefined;
|
|
1835
|
+
const useWebP = (webp, alt) => {
|
|
1836
|
+
const [img, setImg] = useState(supportsWebP === true ? webp : supportsWebP === false ? alt : undefined);
|
|
1837
|
+
useAsyncEffect((mounted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1838
|
+
if (supportsWebP === undefined) {
|
|
1839
|
+
supportsWebP = yield getSupportsWebP();
|
|
1840
|
+
if (mounted()) {
|
|
1841
|
+
setImg(supportsWebP ? webp : alt);
|
|
2328
1842
|
}
|
|
2329
|
-
}
|
|
2330
|
-
})
|
|
1843
|
+
}
|
|
1844
|
+
}), [supportsWebP]);
|
|
2331
1845
|
return img;
|
|
2332
1846
|
};
|
|
2333
|
-
|
|
2334
|
-
return
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
}).catch(function () { return false; })];
|
|
2342
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
2343
|
-
}
|
|
2344
|
-
});
|
|
2345
|
-
}); };
|
|
1847
|
+
const getSupportsWebP = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1848
|
+
return yield new Promise((resolve) => {
|
|
1849
|
+
const image = new Image();
|
|
1850
|
+
image.onerror = () => resolve(false);
|
|
1851
|
+
image.onload = () => resolve(image.width === 1);
|
|
1852
|
+
image.src = 'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=';
|
|
1853
|
+
}).catch(() => false);
|
|
1854
|
+
});
|
|
2346
1855
|
|
|
2347
1856
|
function useWindowSize() {
|
|
2348
|
-
|
|
1857
|
+
const [windowSize, setWindowSize] = useState({
|
|
2349
1858
|
height: undefined,
|
|
2350
1859
|
width: undefined,
|
|
2351
|
-
})
|
|
2352
|
-
useEffect(
|
|
1860
|
+
});
|
|
1861
|
+
useEffect(() => {
|
|
2353
1862
|
function handleResize() {
|
|
2354
1863
|
setWindowSize({
|
|
2355
1864
|
height: window.innerHeight,
|
|
@@ -2358,25 +1867,25 @@ function useWindowSize() {
|
|
|
2358
1867
|
}
|
|
2359
1868
|
window.addEventListener('resize', handleResize);
|
|
2360
1869
|
handleResize();
|
|
2361
|
-
return
|
|
1870
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
2362
1871
|
}, []);
|
|
2363
1872
|
return windowSize;
|
|
2364
1873
|
}
|
|
2365
1874
|
|
|
2366
|
-
|
|
2367
|
-
var
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
1875
|
+
const EthAccount = (_a) => {
|
|
1876
|
+
var { address, icon = false, iconSize = 16, iconOnly = false, addressLength = 'auto', fontFamily = '"Source Code Pro",monospace', toEtherScan, onButtonClick } = _a, props = __rest(_a, ["address", "icon", "iconSize", "iconOnly", "addressLength", "fontFamily", "toEtherScan", "onButtonClick"]);
|
|
1877
|
+
const { localAddress } = useContext(EthersContext);
|
|
1878
|
+
const theme = useTheme();
|
|
1879
|
+
const large = useMediaQuery(theme.breakpoints.up('md'));
|
|
1880
|
+
const isLocalAddress = address ? (localAddress === null || localAddress === void 0 ? void 0 : localAddress.toString()) === address.toString() : false;
|
|
1881
|
+
const onClickLocal = (event) => {
|
|
2373
1882
|
onButtonClick === null || onButtonClick === void 0 ? void 0 : onButtonClick(event);
|
|
2374
1883
|
if (toEtherScan && address) {
|
|
2375
|
-
window.open(
|
|
1884
|
+
window.open(`https://etherscan.io/address/${address.toString()}`, '_blank');
|
|
2376
1885
|
}
|
|
2377
1886
|
};
|
|
2378
|
-
|
|
2379
|
-
|
|
1887
|
+
const addressToDisplay = assertEx(address !== null && address !== void 0 ? address : EthAddress.fromString('0x00'), 'Bad Eth Address');
|
|
1888
|
+
const testToDisplay = addressLength === 'long'
|
|
2380
1889
|
? addressToDisplay.toString()
|
|
2381
1890
|
: addressLength === 'short'
|
|
2382
1891
|
? addressToDisplay.toShortString()
|
|
@@ -2384,36 +1893,36 @@ var EthAccount = function (_a) {
|
|
|
2384
1893
|
? addressToDisplay.toString()
|
|
2385
1894
|
: addressToDisplay.toShortString();
|
|
2386
1895
|
// Note: We use the all zero address for spacing in case it is
|
|
2387
|
-
return (jsx(ButtonEx,
|
|
1896
|
+
return (jsx(ButtonEx, Object.assign({ onClick: onClickLocal, title: `0x${address === null || address === void 0 ? void 0 : address.toHex()}` }, props, { children: jsxs(FlexGrowRow, Object.assign({ justifyContent: "space-between", alignItems: "center" }, { children: [icon && address ? jsx(Identicon, { size: iconSize, value: address === null || address === void 0 ? void 0 : address.toHex() }, void 0) : null, iconOnly ? null : (jsxs(FlexRow, { children: [jsx(Typography, Object.assign({ marginLeft: icon ? 1 : 0, variant: "body1", fontFamily: fontFamily, visibility: address ? 'inherit' : 'hidden' }, { children: testToDisplay }), void 0), address ? null : (jsx(Typography, Object.assign({ position: "absolute", marginLeft: icon ? 1 : 0, variant: "body1", fontFamily: fontFamily }, { children: "-- --" }), void 0))] }, void 0)), isLocalAddress ? jsx(FlexRow, Object.assign({ marginLeft: 0.5 }, { children: "(You)" }), void 0) : null] }), void 0) }), void 0));
|
|
2388
1897
|
};
|
|
2389
1898
|
|
|
2390
|
-
|
|
2391
|
-
|
|
1899
|
+
const Experiment = (props) => {
|
|
1900
|
+
const { children } = props;
|
|
2392
1901
|
return jsx(Fragment, { children: children }, void 0);
|
|
2393
1902
|
};
|
|
2394
1903
|
|
|
2395
|
-
|
|
2396
|
-
|
|
1904
|
+
const OutcomesLocalStorageKey = 'outcomes';
|
|
1905
|
+
const ExperimentsLocalStorageKey = 'experiments';
|
|
2397
1906
|
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
1907
|
+
const defaultLocalStorageKey = 'testData';
|
|
1908
|
+
const experimentsTestData = {};
|
|
1909
|
+
let outcomes = {}; //prevent multi-outcome
|
|
1910
|
+
const saveOutcomes = () => {
|
|
2402
1911
|
setLocalStorageObject(OutcomesLocalStorageKey, outcomes);
|
|
2403
1912
|
};
|
|
2404
|
-
|
|
1913
|
+
const loadOutcomes = () => {
|
|
2405
1914
|
outcomes = getLocalStorageObject(OutcomesLocalStorageKey);
|
|
2406
1915
|
};
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
for (
|
|
2410
|
-
dataArray.push(
|
|
1916
|
+
const mergeData = (data, log) => {
|
|
1917
|
+
const dataArray = [];
|
|
1918
|
+
for (const key in data) {
|
|
1919
|
+
dataArray.push(`${key}-${data[key]}`);
|
|
2411
1920
|
}
|
|
2412
1921
|
log === null || log === void 0 ? void 0 : log.info('MergeData', dataArray.join('|'));
|
|
2413
1922
|
return dataArray.join('|');
|
|
2414
1923
|
};
|
|
2415
|
-
|
|
2416
|
-
|
|
1924
|
+
const missingKeyError = new Error('Experiment Elements must have Keys');
|
|
1925
|
+
const makeChildrenArray = (children) => {
|
|
2417
1926
|
if (Array.isArray(children)) {
|
|
2418
1927
|
return children;
|
|
2419
1928
|
}
|
|
@@ -2421,36 +1930,25 @@ var makeChildrenArray = function (children) {
|
|
|
2421
1930
|
return [children];
|
|
2422
1931
|
}
|
|
2423
1932
|
};
|
|
2424
|
-
|
|
1933
|
+
const buildLocalStorageKey = (localStorageProp) => {
|
|
2425
1934
|
return localStorageProp === true
|
|
2426
1935
|
? defaultLocalStorageKey
|
|
2427
1936
|
: typeof localStorageProp === 'string'
|
|
2428
1937
|
? localStorageProp !== null && localStorageProp !== void 0 ? localStorageProp : defaultLocalStorageKey
|
|
2429
1938
|
: '';
|
|
2430
1939
|
};
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
for (var childList_1 = __values(childList), childList_1_1 = childList_1.next(); !childList_1_1.done; childList_1_1 = childList_1.next()) {
|
|
2436
|
-
var child = childList_1_1.value;
|
|
2437
|
-
totalWeight += child.props.weight;
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2441
|
-
finally {
|
|
2442
|
-
try {
|
|
2443
|
-
if (childList_1_1 && !childList_1_1.done && (_a = childList_1.return)) _a.call(childList_1);
|
|
2444
|
-
}
|
|
2445
|
-
finally { if (e_1) throw e_1.error; }
|
|
1940
|
+
const calcTotalWeight = (childList) => {
|
|
1941
|
+
let totalWeight = 0;
|
|
1942
|
+
for (const child of childList) {
|
|
1943
|
+
totalWeight += child.props.weight;
|
|
2446
1944
|
}
|
|
2447
1945
|
return totalWeight;
|
|
2448
1946
|
};
|
|
2449
|
-
|
|
2450
|
-
|
|
1947
|
+
const saveExperimentDebugRanges = (name, totalWeight, childList) => {
|
|
1948
|
+
const experiments = getLocalStorageObject(ExperimentsLocalStorageKey) || {};
|
|
2451
1949
|
experiments[name] = {
|
|
2452
|
-
totalWeight
|
|
2453
|
-
variants: childList.map(
|
|
1950
|
+
totalWeight,
|
|
1951
|
+
variants: childList.map((child) => {
|
|
2454
1952
|
var _a;
|
|
2455
1953
|
return ({
|
|
2456
1954
|
name: (_a = child.key) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
@@ -2460,109 +1958,96 @@ var saveExperimentDebugRanges = function (name, totalWeight, childList) {
|
|
|
2460
1958
|
};
|
|
2461
1959
|
setLocalStorageObject(ExperimentsLocalStorageKey, experiments);
|
|
2462
1960
|
};
|
|
2463
|
-
|
|
2464
|
-
var
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
var userEvents = useUserEvents();
|
|
1961
|
+
const Experiments = (props) => {
|
|
1962
|
+
var _a, _b;
|
|
1963
|
+
const { name, children, localStorageProp = true } = props;
|
|
1964
|
+
const userEvents = useUserEvents();
|
|
2468
1965
|
loadOutcomes();
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
1966
|
+
const localStorageKey = buildLocalStorageKey(localStorageProp);
|
|
1967
|
+
const childList = makeChildrenArray(children);
|
|
1968
|
+
const totalWeight = calcTotalWeight(childList);
|
|
2472
1969
|
saveExperimentDebugRanges(name, totalWeight, childList);
|
|
2473
|
-
|
|
2474
|
-
|
|
1970
|
+
const firstTime = outcomes[name] === undefined;
|
|
1971
|
+
let targetWeight = (_a = outcomes[name]) !== null && _a !== void 0 ? _a : Math.random() * totalWeight;
|
|
2475
1972
|
outcomes[name] = targetWeight;
|
|
2476
1973
|
saveOutcomes();
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
1974
|
+
for (const child of childList) {
|
|
1975
|
+
targetWeight -= child.props.weight;
|
|
1976
|
+
if (targetWeight > 0)
|
|
1977
|
+
continue;
|
|
1978
|
+
if (!child.key) {
|
|
1979
|
+
throw missingKeyError;
|
|
1980
|
+
}
|
|
1981
|
+
experimentsTestData[name] = (_b = child.key) === null || _b === void 0 ? void 0 : _b.toString();
|
|
1982
|
+
if (firstTime) {
|
|
1983
|
+
if (localStorageProp !== false) {
|
|
1984
|
+
localStorage.setItem(localStorageKey, mergeData(experimentsTestData));
|
|
2485
1985
|
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
if (localStorageProp !== false) {
|
|
2489
|
-
localStorage.setItem(localStorageKey, mergeData(experimentsTestData));
|
|
2490
|
-
}
|
|
2491
|
-
if (userEvents) {
|
|
2492
|
-
forget(userEvents.testStarted({ name: name, variation: child.key }));
|
|
2493
|
-
}
|
|
1986
|
+
if (userEvents) {
|
|
1987
|
+
forget(userEvents.testStarted({ name, variation: child.key }));
|
|
2494
1988
|
}
|
|
2495
|
-
return child;
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2499
|
-
finally {
|
|
2500
|
-
try {
|
|
2501
|
-
if (childList_2_1 && !childList_2_1.done && (_a = childList_2.return)) _a.call(childList_2);
|
|
2502
1989
|
}
|
|
2503
|
-
|
|
1990
|
+
return child;
|
|
2504
1991
|
}
|
|
2505
1992
|
throw new Error('Experiment Choice Failed');
|
|
2506
1993
|
};
|
|
2507
1994
|
|
|
2508
|
-
|
|
1995
|
+
const ExperimentsDebugger = (_a) => {
|
|
2509
1996
|
var props = __rest(_a, []);
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
1997
|
+
const [experiments] = useLocalStorage(ExperimentsLocalStorageKey, {});
|
|
1998
|
+
const [outcomes, setOutcomes] = useLocalStorage(OutcomesLocalStorageKey, {});
|
|
1999
|
+
const sumUpVariants = (items) => items.reduce((acc, curr) => acc + curr.weight, 0);
|
|
2000
|
+
const experimentEntries = Object.entries(experiments);
|
|
2514
2001
|
if (!experiments || !experimentEntries.length) {
|
|
2515
|
-
return (jsxs(FlexCol,
|
|
2516
|
-
}
|
|
2517
|
-
return (jsx(FlexCol,
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
{ label:
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
return ({
|
|
2525
|
-
label: index === experiment.variants.length - 1 ? 'End' : "".concat(experiment.variants[index + 1].name, " | ").concat(weight),
|
|
2002
|
+
return (jsxs(FlexCol, Object.assign({ alignItems: "stretch" }, props, { children: [jsx(Typography, Object.assign({ variant: "subtitle1" }, { children: "No Experiments loaded" }), void 0), jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: "Visit a page with an experiment to load the data" }), void 0)] }), void 0));
|
|
2003
|
+
}
|
|
2004
|
+
return (jsx(FlexCol, Object.assign({ alignItems: "stretch" }, props, { children: Object.entries(experiments).map((data) => {
|
|
2005
|
+
const [name, experiment] = data;
|
|
2006
|
+
const outcome = (outcomes[name] || 0);
|
|
2007
|
+
const marks = [
|
|
2008
|
+
{ label: `${experiment.variants[0].name} | ${experiment.variants[0].weight}`, value: 0 },
|
|
2009
|
+
...experiment.variants.map(({ weight }, index) => ({
|
|
2010
|
+
label: index === experiment.variants.length - 1 ? 'End' : `${experiment.variants[index + 1].name} | ${weight}`,
|
|
2526
2011
|
value: index === 0 ? weight : sumUpVariants(experiment.variants.slice(0, index + 1)),
|
|
2527
|
-
})
|
|
2528
|
-
|
|
2529
|
-
return (jsxs(FlexCol,
|
|
2530
|
-
|
|
2012
|
+
})),
|
|
2013
|
+
];
|
|
2014
|
+
return (jsxs(FlexCol, Object.assign({ alignItems: "stretch", paddingX: 4, marginBottom: 4 }, props, { children: [jsxs(FlexRow, { children: [name, ":\u00A0", outcome] }, void 0), jsx(FlexRow, { children: jsx(Slider, { "aria-label": `Experiment ${name}`, defaultValue: outcome, value: outcome, marks: marks, onChange: (e, value) => {
|
|
2015
|
+
const truncated = Number((Array.isArray(value) ? value[0] : value).toFixed(2));
|
|
2531
2016
|
outcomes[name] = truncated;
|
|
2532
2017
|
// Spread operator triggers rerender
|
|
2533
|
-
setOutcomes(
|
|
2534
|
-
} }, void 0) }, void 0)] }),
|
|
2018
|
+
setOutcomes(Object.assign({}, outcomes));
|
|
2019
|
+
} }, void 0) }, void 0)] }), `experiment-${name}`));
|
|
2535
2020
|
}) }), void 0));
|
|
2536
2021
|
};
|
|
2537
2022
|
|
|
2538
|
-
|
|
2539
|
-
var to = _a
|
|
2540
|
-
return jsx(Link,
|
|
2023
|
+
const LinkToEx = (_a) => {
|
|
2024
|
+
var { to } = _a, props = __rest(_a, ["to"]);
|
|
2025
|
+
return jsx(Link, Object.assign({ component: Link$1, to: to }, props), void 0);
|
|
2541
2026
|
};
|
|
2542
2027
|
|
|
2543
|
-
|
|
2028
|
+
const NumberStatus = (_a) => {
|
|
2544
2029
|
var _b, _c;
|
|
2545
|
-
var
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
return (jsx(ButtonEx,
|
|
2030
|
+
var { error, format = '0[.]0a', color = 'primary', title, value, size, fontSize, rounded = false, autoWidth = false, style } = _a, props = __rest(_a, ["error", "format", "color", "title", "value", "size", "fontSize", "rounded", "autoWidth", "style"]);
|
|
2031
|
+
const theme = useTheme();
|
|
2032
|
+
const palette = color === 'inherit' ? undefined : theme.palette[color];
|
|
2033
|
+
const bgColorTop = (_b = palette === null || palette === void 0 ? void 0 : palette.dark) !== null && _b !== void 0 ? _b : theme.palette.background.paper;
|
|
2034
|
+
const bgColorBottom = (_c = palette === null || palette === void 0 ? void 0 : palette.main) !== null && _c !== void 0 ? _c : theme.palette.background.default;
|
|
2035
|
+
const sizePixels = size === 'large' ? 96 : size === 'small' ? 64 : 80;
|
|
2036
|
+
const calcFontSize = fontSize !== null && fontSize !== void 0 ? fontSize : sizePixels * 0.2;
|
|
2037
|
+
return (jsx(ButtonEx, Object.assign({ size: size, padding: 0, style: Object.assign({ borderRadius: rounded ? theme.shape.borderRadius : 0, overflow: rounded ? 'hidden' : undefined }, style) }, props, { children: jsxs(FlexCol, Object.assign({ alignItems: "stretch", height: sizePixels, width: autoWidth ? '100%' : sizePixels, busy: value === undefined && !error }, { children: [jsx(FlexGrowRow, Object.assign({ bgcolor: bgColorTop, color: theme.palette.getContrastText(bgColorTop), fontSize: calcFontSize, fontFamily: "Source Code Pro,monospace", alignItems: "center", height: sizePixels * 0.75 }, { children: numeral(value).format(format) }), void 0), jsx(FlexGrowRow, Object.assign({ bgcolor: bgColorBottom, borderTop: "1px", color: theme.palette.getContrastText(bgColorBottom), fontSize: sizePixels * 0.12, fontFamily: theme.typography.fontFamily, height: sizePixels * 0.25 }, { children: title }), void 0)] }), void 0) }), void 0));
|
|
2553
2038
|
};
|
|
2554
2039
|
|
|
2555
|
-
|
|
2556
|
-
var
|
|
2557
|
-
|
|
2558
|
-
return (jsxs(Fragment, { children: [jsx(IconButton,
|
|
2040
|
+
const QuickTipButton = (_a) => {
|
|
2041
|
+
var { title, children } = _a, props = __rest(_a, ["title", "children"]);
|
|
2042
|
+
const [messageOpen, setMessageOpen] = useState(false);
|
|
2043
|
+
return (jsxs(Fragment, { children: [jsx(IconButton, Object.assign({ onClick: () => setMessageOpen(true), size: "small" }, props, { children: jsx(AiOutlineQuestionCircle, { size: 16 }, void 0) }), void 0), jsx(MessageDialog, Object.assign({ onOk: () => setMessageOpen(false), onCancel: () => setMessageOpen(false), onClose: () => setMessageOpen(false), open: messageOpen, title: title !== null && title !== void 0 ? title : '' }, { children: children }), void 0)] }, void 0));
|
|
2559
2044
|
};
|
|
2560
2045
|
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2046
|
+
const RichResult = (props) => {
|
|
2047
|
+
const { thing } = props;
|
|
2048
|
+
const thingWithContext = thing;
|
|
2564
2049
|
thingWithContext['@context'] = 'https://schema.org';
|
|
2565
|
-
return jsx("script",
|
|
2050
|
+
return jsx("script", Object.assign({ type: "application/ld+json" }, { children: JSON.stringify(thingWithContext) }), void 0);
|
|
2566
2051
|
};
|
|
2567
2052
|
|
|
2568
2053
|
var ActionStatusType;
|
|
@@ -2609,19 +2094,10 @@ var MapCategoryType;
|
|
|
2609
2094
|
MapCategoryType["VenueMap"] = "VenueMap";
|
|
2610
2095
|
})(MapCategoryType || (MapCategoryType = {}));
|
|
2611
2096
|
|
|
2612
|
-
// The point of this component it to return to the top of the page on any router navigate
|
|
2613
|
-
var ScrollToTop = function () {
|
|
2614
|
-
var pathname = useLocation().pathname;
|
|
2615
|
-
useEffect(function () {
|
|
2616
|
-
window.scrollTo(0, 0);
|
|
2617
|
-
}, [pathname]);
|
|
2618
|
-
return null;
|
|
2619
|
-
};
|
|
2620
|
-
|
|
2621
2097
|
var img = "data:image/svg+xml,%3csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 238'%3e%3cdefs%3e%3cstyle%3e.cls-1%7bfill:%23999%3b%7d%3c/style%3e%3c/defs%3e%3ctitle%3eicon_gray%3c/title%3e%3cpath class='cls-1' d='M74.5%2c28.33%2c21.29%2c120.5%2c74.5%2c212.67H180.94l1.76-3%2c51.46-89.13L180.94%2c28.33ZM84.65%2c40.54h78.83L111.65%2c56.93a15.85%2c15.85%2c0%2c0%2c1%2c2%2c5l59.66-18.81L185.22%2c101a20.12%2c20.12%2c0%2c0%2c1%2c5.36-.78l-10-47.91%2c37.87%2c65.53h-7.62a24.21%2c24.21%2c0%2c0%2c1%2c.15%2c2.68%2c23.29%2c23.29%2c0%2c0%2c1-.15%2c2.68h7.62l-39.1%2c67.75%2c10.92-50.13A20.57%2c20.57%2c0%2c0%2c1%2c185%2c140l-12.88%2c59-58.37-19.53a17.61%2c17.61%2c0%2c0%2c1-1.7%2c5l47.5%2c15.92H84.65l4-6.85A20.17%2c20.17%2c0%2c0%2c1%2c83.93%2c191L80%2c197.78%2c42.67%2c133.13l37%2c32.66a20.52%2c20.52%2c0%2c0%2c1%2c3.6-4L36.69%2c120.66%2c85%2c77.79a17.45%2c17.45%2c0%2c0%2c1-3.19-4.32l-39.46%2c35L80%2c43.22l5.56%2c9.69A17.51%2c17.51%2c0%2c0%2c1%2c90.12%2c50Zm28.24%2c31.17a16.15%2c16.15%2c0%2c0%2c1-2.68%2c4.64l62%2c35.81a19.74%2c19.74%2c0%2c0%2c1%2c2.83-4.54Zm-20%2c10.51v75.33a18%2c18%2c0%2c0%2c1%2c2.47-.16%2c17.18%2c17.18%2c0%2c0%2c1%2c2.89.21v-75a11.21%2c11.21%2c0%2c0%2c1-1.29%2c0%2c17.57%2c17.57%2c0%2c0%2c1-4.07-.47Zm79.34%2c46.63-62.08%2c35.81a18.45%2c18.45%2c0%2c0%2c1%2c2.68%2c4.68l62.23-36a19.68%2c19.68%2c0%2c0%2c1-2.83-4.53Z'/%3e%3cpath class='cls-1' d='M97%2c48.58a17.06%2c17.06%2c0%2c1%2c0%2c17%2c17%2c17.08%2c17.08%2c0%2c0%2c0-17-17Zm0%2c5.36a11.7%2c11.7%2c0%2c1%2c1-11.7%2c11.69A11.65%2c11.65%2c0%2c0%2c1%2c97%2c53.94Z'/%3e%3cpath class='cls-1' d='M95.37%2c157.39a18.73%2c18.73%2c0%2c1%2c0%2c18.7%2c18.7%2c18.74%2c18.74%2c0%2c0%2c0-18.7-18.7Zm0%2c5.31A13.4%2c13.4%2c0%2c1%2c1%2c82%2c176.09a13.37%2c13.37%2c0%2c0%2c1%2c13.4-13.39Z'/%3e%3cpath class='cls-1' d='M190.73%2c100.2A20.3%2c20.3%2c0%2c1%2c0%2c211%2c120.5a20.34%2c20.34%2c0%2c0%2c0-20.3-20.3Zm0%2c5.36a14.94%2c14.94%2c0%2c1%2c1-14.94%2c14.94%2c14.88%2c14.88%2c0%2c0%2c1%2c14.94-14.94Z'/%3e%3c/svg%3e";
|
|
2622
2098
|
|
|
2623
|
-
|
|
2624
|
-
|
|
2099
|
+
const base10Shift = (bn, places) => {
|
|
2100
|
+
const factor = new BigNumber(10).pow(new BigNumber(Math.abs(places)));
|
|
2625
2101
|
if (places > 0) {
|
|
2626
2102
|
return bn.mul(factor);
|
|
2627
2103
|
}
|
|
@@ -2629,11 +2105,11 @@ var base10Shift = function (bn, places) {
|
|
|
2629
2105
|
return bn.div(factor);
|
|
2630
2106
|
}
|
|
2631
2107
|
};
|
|
2632
|
-
|
|
2633
|
-
var
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
return (jsx(ButtonEx,
|
|
2108
|
+
const TokenAmount = (_a) => {
|
|
2109
|
+
var { textFontFamily = '"Source Code Pro",monospace', textColor, statusColor, style, amount, places = -18, logo, label, onButtonClick } = _a, props = __rest(_a, ["textFontFamily", "textColor", "statusColor", "style", "amount", "places", "logo", "label", "onButtonClick"]);
|
|
2110
|
+
const adjustedAmount = amount ? base10Shift(amount, places).toNumber() : undefined;
|
|
2111
|
+
const amountString = adjustedAmount ? Math.trunc(adjustedAmount).toLocaleString() : '-';
|
|
2112
|
+
return (jsx(ButtonEx, Object.assign({ style: Object.assign({ backgroundColor: statusColor }, style), variant: "outlined", onClick: onButtonClick }, props, { children: jsxs(FlexRow, Object.assign({ justifyContent: "space-between", width: "100%", busy: amount === undefined, busySize: 16 }, { children: [jsxs(FlexRow, { children: [logo ? jsx("img", { src: img, height: 24 }, void 0) : null, label ? (jsx(Typography, Object.assign({ marginRight: 1, marginLeft: logo ? 1 : 0, noWrap: true, fontFamily: textFontFamily, variant: "caption" }, { children: label }), void 0)) : null] }, void 0), jsx(Typography, Object.assign({ color: textColor, noWrap: true, fontFamily: textFontFamily, variant: "body1", style: { textTransform: 'none' } }, { children: amountString }), void 0)] }), void 0) }), void 0));
|
|
2637
2113
|
};
|
|
2638
2114
|
|
|
2639
2115
|
export { ActionStatusType, AppBarEx, Background, BasePage, BreadcrumbsEx, BusyBox, ButtonEx, ContactPointOption, CookieConsent, CookieConsentBody, CookieConsentContext, CookieConsentLoader, CoverProgress, DripCustomEvent, DripStandardEvents, ErrorDialog, EthAccount, EthersContext, EthersLoader, Experiment, Experiments, ExperimentsDebugger, FacebookCustomEvent, FacebookStandardEvents, Fbq, FlexCol, FlexGrowCol, FlexGrowRow, FlexRow, GoogleBaseEvent, GoogleCustomEvent, GoogleStandardEvents, GoogleUserEventHandler, Gtag, Gtm, HoverScale, Identicon, InvertableThemeProvider, ItemAvailability, LinkToEx, MapCategoryType, MessageDialog, NetworkSettingsContext, NetworkSettingsLoader, NumberStatus, QuickTipButton, Rdt, RedditCustomEvent, RedditStandardEvents, RedirectWithQuery, Referrer, RichResult, ScrollToTop, ScrollToTopButton, SnapTr, SnapchatStandardEvents, TiktokCustomEvent, TiktokStandardEvents, TokenAmount, Ttq, UserEventsContext, UserEventsLoader, XyBaseEvent, XyCustomEvent, XyUserEventHandler, XyoUserEventHandler, enableProfileLogging, getApiStage, getLocalStorageObject, getSessionStorageObject, isLocalhost, profileBlock, profileResults, setLocalStorageObject, setSessionStorageObject, useAsyncEffect, useBreakpoint, useCookieConsent, useLocalStorage, useMounted, useNavigateToEthAddress, useSpacing, useUserEvents, useWebP, useWindowSize };
|