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