@formo/analytics 1.28.6 → 1.29.1
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/cjs/src/FormoAnalytics.d.ts +34 -0
- package/dist/cjs/src/FormoAnalytics.js +166 -47
- package/dist/cjs/src/constants/base.d.ts +9 -1
- package/dist/cjs/src/constants/base.js +10 -2
- package/dist/cjs/src/constants/config.d.ts +3 -58
- package/dist/cjs/src/constants/config.js +3 -73
- package/dist/cjs/src/event/EventFactory.d.ts +1 -0
- package/dist/cjs/src/event/EventFactory.js +30 -17
- package/dist/cjs/src/event/constants.d.ts +8 -2
- package/dist/cjs/src/event/constants.js +31 -5
- package/dist/cjs/src/types/events.d.ts +5 -1
- package/dist/cjs/src/version.d.ts +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/esm/src/FormoAnalytics.d.ts +34 -0
- package/dist/esm/src/FormoAnalytics.js +167 -48
- package/dist/esm/src/constants/base.d.ts +9 -1
- package/dist/esm/src/constants/base.js +9 -1
- package/dist/esm/src/constants/config.d.ts +3 -58
- package/dist/esm/src/constants/config.js +3 -73
- package/dist/esm/src/event/EventFactory.d.ts +1 -0
- package/dist/esm/src/event/EventFactory.js +31 -18
- package/dist/esm/src/event/constants.d.ts +8 -2
- package/dist/esm/src/event/constants.js +30 -5
- package/dist/esm/src/types/events.d.ts +5 -1
- package/dist/esm/src/version.d.ts +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +17 -16
|
@@ -52,6 +52,12 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
52
52
|
private isEvmDisabled;
|
|
53
53
|
/** Instance-level flag so multiple SDK instances don't interfere. */
|
|
54
54
|
private crossSubdomainCookies;
|
|
55
|
+
/** In-memory URL used to deduplicate SPA pageview events. */
|
|
56
|
+
private _currentUrl;
|
|
57
|
+
/** Page-hit hooks installed in trackPageHits() so cleanup() can undo them. */
|
|
58
|
+
private _onPopStateListener?;
|
|
59
|
+
private _onLocationChangeListener?;
|
|
60
|
+
private _pageHooksDisposed;
|
|
55
61
|
config: Config;
|
|
56
62
|
currentChainId?: ChainID;
|
|
57
63
|
currentAddress?: Address;
|
|
@@ -270,6 +276,12 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
270
276
|
private registerRequestListeners;
|
|
271
277
|
private onLocationChange;
|
|
272
278
|
private trackPageHits;
|
|
279
|
+
/**
|
|
280
|
+
* Wrap history.pushState / replaceState exactly once per `history` object,
|
|
281
|
+
* regardless of how many SDK instances are constructed. Uses a Symbol
|
|
282
|
+
* marker so we recognize our own wrapper across module reloads in HMR.
|
|
283
|
+
*/
|
|
284
|
+
private static installHistoryHooksOnce;
|
|
273
285
|
private trackPageHit;
|
|
274
286
|
private trackEvent;
|
|
275
287
|
/**
|
|
@@ -310,6 +322,15 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
310
322
|
private getCurrentChainId;
|
|
311
323
|
private buildSignatureEventPayload;
|
|
312
324
|
private buildTransactionEventPayload;
|
|
325
|
+
/**
|
|
326
|
+
* Persist an EVM address discovered through autocapture (signature / transaction)
|
|
327
|
+
* as the current EVM address when none is currently set. This lets subsequent
|
|
328
|
+
* track()/page() calls carry the address even when the underlying wallet never
|
|
329
|
+
* fires an EIP-1193 `accountsChanged` event (embedded wallets, smart accounts,
|
|
330
|
+
* social-login wrappers). If `accountsChanged` later fires it overwrites this
|
|
331
|
+
* value in the normal way; existing connections are never clobbered.
|
|
332
|
+
*/
|
|
333
|
+
private backfillActiveWallet;
|
|
313
334
|
/**
|
|
314
335
|
* Polls for transaction receipt and emits tx.status = CONFIRMED or REVERTED.
|
|
315
336
|
*/
|
|
@@ -365,6 +386,19 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
365
386
|
* Last-connected-chain-wins: _activeNamespace takes precedence.
|
|
366
387
|
*/
|
|
367
388
|
private syncDerivedState;
|
|
389
|
+
/**
|
|
390
|
+
* Persist (or clear) the current wallet snapshot in a cookie so that the
|
|
391
|
+
* SDK can repopulate `currentAddress`/`currentChainId` at init on the next
|
|
392
|
+
* page load — closing the gap between page-show and wagmi/EIP-1193
|
|
393
|
+
* reconnection during which track()/page() events would otherwise ship
|
|
394
|
+
* with an empty address.
|
|
395
|
+
*/
|
|
396
|
+
private persistActiveWallet;
|
|
397
|
+
/**
|
|
398
|
+
* Seed `currentAddress`/`currentChainId` from the persisted snapshot, if
|
|
399
|
+
* any. Called once during construction before the first page hit fires.
|
|
400
|
+
*/
|
|
401
|
+
private loadActiveWallet;
|
|
368
402
|
/**
|
|
369
403
|
* Helper method to clear the active provider state
|
|
370
404
|
* Centralizes provider clearing logic for consistency
|
|
@@ -122,6 +122,9 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
122
122
|
* When true, all EIP-1193/EIP-6963 detection and wrapping is skipped.
|
|
123
123
|
*/
|
|
124
124
|
this.isEvmDisabled = false;
|
|
125
|
+
/** In-memory URL used to deduplicate SPA pageview events. */
|
|
126
|
+
this._currentUrl = "";
|
|
127
|
+
this._pageHooksDisposed = false;
|
|
125
128
|
this.currentUserId = "";
|
|
126
129
|
this.config = {
|
|
127
130
|
writeKey: writeKey,
|
|
@@ -188,6 +191,11 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
188
191
|
if (options.solana) {
|
|
189
192
|
this.solanaManager = new SolanaManager_1.SolanaManager(this, options.solana);
|
|
190
193
|
}
|
|
194
|
+
this._currentUrl = window.location.href;
|
|
195
|
+
// Seed currentAddress/currentChainId from the persisted snapshot before
|
|
196
|
+
// the first page hit queues so reload-time track()/page() carry the
|
|
197
|
+
// wallet even before wagmi/EIP-1193 reconnection completes.
|
|
198
|
+
this.loadActiveWallet();
|
|
191
199
|
this.trackPageHit();
|
|
192
200
|
this.trackPageHits();
|
|
193
201
|
}
|
|
@@ -293,6 +301,7 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
293
301
|
(0, storage_1.cookie)().remove(constants_1.SESSION_USER_ID_KEY);
|
|
294
302
|
(0, storage_1.cookie)().remove(session_1.SESSION_WALLET_DETECTED_KEY);
|
|
295
303
|
(0, storage_1.cookie)().remove(session_1.SESSION_WALLET_IDENTIFIED_KEY);
|
|
304
|
+
(0, storage_1.cookie)().remove(constants_1.ACTIVE_WALLET_KEY);
|
|
296
305
|
};
|
|
297
306
|
/**
|
|
298
307
|
* Clean up resources and event listeners
|
|
@@ -318,6 +327,21 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
318
327
|
this.untrackProvider(provider);
|
|
319
328
|
}
|
|
320
329
|
}
|
|
330
|
+
// Tear down page-hit hooks: remove window listeners and silence the
|
|
331
|
+
// history.pushState/replaceState wrappers so an orphaned instance (e.g.
|
|
332
|
+
// from a re-mount in React Strict Mode / HMR) stops emitting page events
|
|
333
|
+
// with stale state.
|
|
334
|
+
this._pageHooksDisposed = true;
|
|
335
|
+
if (typeof window !== "undefined") {
|
|
336
|
+
if (this._onPopStateListener) {
|
|
337
|
+
window.removeEventListener("popstate", this._onPopStateListener);
|
|
338
|
+
this._onPopStateListener = undefined;
|
|
339
|
+
}
|
|
340
|
+
if (this._onLocationChangeListener) {
|
|
341
|
+
window.removeEventListener("locationchange", this._onLocationChangeListener);
|
|
342
|
+
this._onLocationChangeListener = undefined;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
321
345
|
logger_1.logger.debug("FormoAnalytics: Cleanup complete");
|
|
322
346
|
};
|
|
323
347
|
/**
|
|
@@ -597,6 +621,7 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
597
621
|
validAddress = (0, address_1.validateAddress)(address);
|
|
598
622
|
if (validAddress) {
|
|
599
623
|
this.currentAddress = validAddress;
|
|
624
|
+
this.persistActiveWallet();
|
|
600
625
|
}
|
|
601
626
|
else {
|
|
602
627
|
(_c = logger_1.logger.warn) === null || _c === void 0 ? void 0 : _c.call(logger_1.logger, "Invalid address provided to identify:", address);
|
|
@@ -1440,11 +1465,9 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1440
1465
|
};
|
|
1441
1466
|
FormoAnalytics.prototype.onLocationChange = function () {
|
|
1442
1467
|
return __awaiter(this, void 0, void 0, function () {
|
|
1443
|
-
var currentUrl;
|
|
1444
1468
|
return __generator(this, function (_a) {
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
(0, storage_1.cookie)().set(constants_1.SESSION_CURRENT_URL_KEY, window.location.href);
|
|
1469
|
+
if (this._currentUrl !== window.location.href) {
|
|
1470
|
+
this._currentUrl = window.location.href;
|
|
1448
1471
|
this.trackPageHit();
|
|
1449
1472
|
}
|
|
1450
1473
|
return [2 /*return*/];
|
|
@@ -1452,35 +1475,52 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1452
1475
|
});
|
|
1453
1476
|
};
|
|
1454
1477
|
FormoAnalytics.prototype.trackPageHits = function () {
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1478
|
+
var _this = this;
|
|
1479
|
+
// Install a single, instance-agnostic wrapper around history.pushState /
|
|
1480
|
+
// replaceState so concurrent SDK instances (React Strict Mode, HMR) don't
|
|
1481
|
+
// each stack their own wrapper — which would dispatch N synthetic events
|
|
1482
|
+
// per navigation and produce O(N^2) onLocationChange calls. The wrapper
|
|
1483
|
+
// dispatches once; per-instance bookkeeping is done by per-instance
|
|
1484
|
+
// listeners that each register/unregister themselves.
|
|
1485
|
+
FormoAnalytics.installHistoryHooksOnce();
|
|
1486
|
+
this._onPopStateListener = function () { return _this.onLocationChange(); };
|
|
1487
|
+
this._onLocationChangeListener = function () { return _this.onLocationChange(); };
|
|
1488
|
+
window.addEventListener("popstate", this._onPopStateListener);
|
|
1489
|
+
window.addEventListener("locationchange", this._onLocationChangeListener);
|
|
1490
|
+
};
|
|
1491
|
+
/**
|
|
1492
|
+
* Wrap history.pushState / replaceState exactly once per `history` object,
|
|
1493
|
+
* regardless of how many SDK instances are constructed. Uses a Symbol
|
|
1494
|
+
* marker so we recognize our own wrapper across module reloads in HMR.
|
|
1495
|
+
*/
|
|
1496
|
+
FormoAnalytics.installHistoryHooksOnce = function () {
|
|
1497
|
+
if (typeof history === "undefined" || typeof window === "undefined")
|
|
1498
|
+
return;
|
|
1499
|
+
var marker = Symbol.for("formo.historyWrapped");
|
|
1500
|
+
if (history[marker])
|
|
1501
|
+
return;
|
|
1502
|
+
history[marker] = true;
|
|
1503
|
+
var dispatch = function () { return window.dispatchEvent(new window.Event("locationchange")); };
|
|
1504
|
+
var oldPushState = history.pushState;
|
|
1505
|
+
history.pushState = function pushState() {
|
|
1506
|
+
var args = [];
|
|
1507
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1508
|
+
args[_i] = arguments[_i];
|
|
1509
|
+
}
|
|
1510
|
+
var ret = oldPushState.apply(this, args);
|
|
1511
|
+
dispatch();
|
|
1512
|
+
return ret;
|
|
1513
|
+
};
|
|
1514
|
+
var oldReplaceState = history.replaceState;
|
|
1515
|
+
history.replaceState = function replaceState() {
|
|
1516
|
+
var args = [];
|
|
1517
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1518
|
+
args[_i] = arguments[_i];
|
|
1519
|
+
}
|
|
1520
|
+
var ret = oldReplaceState.apply(this, args);
|
|
1521
|
+
dispatch();
|
|
1522
|
+
return ret;
|
|
1523
|
+
};
|
|
1484
1524
|
};
|
|
1485
1525
|
FormoAnalytics.prototype.trackPageHit = function (category, name, properties, context, callback) {
|
|
1486
1526
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1491,6 +1531,12 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1491
1531
|
return [2 /*return*/];
|
|
1492
1532
|
}
|
|
1493
1533
|
setTimeout(function () {
|
|
1534
|
+
// Drop in-flight page hits from an SDK instance that was torn down
|
|
1535
|
+
// between scheduling and firing (e.g. provider remount in React Strict
|
|
1536
|
+
// Mode / HMR). Otherwise the orphan instance would queue a page event
|
|
1537
|
+
// here with its stale, never-populated `currentAddress`.
|
|
1538
|
+
if (_this._pageHooksDisposed)
|
|
1539
|
+
return;
|
|
1494
1540
|
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1495
1541
|
var e_7;
|
|
1496
1542
|
return __generator(this, function (_a) {
|
|
@@ -1907,8 +1953,10 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1907
1953
|
if (!validAddress) {
|
|
1908
1954
|
throw new Error("Invalid address in signature payload: ".concat(rawAddress));
|
|
1909
1955
|
}
|
|
1956
|
+
var effectiveChainId = (_a = chainId !== null && chainId !== void 0 ? chainId : this._evmChainId) !== null && _a !== void 0 ? _a : undefined;
|
|
1957
|
+
this.backfillActiveWallet(validAddress, effectiveChainId);
|
|
1910
1958
|
var basePayload = {
|
|
1911
|
-
chainId:
|
|
1959
|
+
chainId: effectiveChainId,
|
|
1912
1960
|
address: validAddress,
|
|
1913
1961
|
};
|
|
1914
1962
|
if (method === "personal_sign") {
|
|
@@ -1919,33 +1967,48 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1919
1967
|
};
|
|
1920
1968
|
FormoAnalytics.prototype.buildTransactionEventPayload = function (params, provider) {
|
|
1921
1969
|
return __awaiter(this, void 0, void 0, function () {
|
|
1922
|
-
var _a, data, from, to, value, validAddress, _b;
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
switch (_d.label) {
|
|
1970
|
+
var _a, data, from, to, value, validAddress, chainId, _b;
|
|
1971
|
+
return __generator(this, function (_c) {
|
|
1972
|
+
switch (_c.label) {
|
|
1926
1973
|
case 0:
|
|
1927
1974
|
_a = params[0], data = _a.data, from = _a.from, to = _a.to, value = _a.value;
|
|
1928
1975
|
validAddress = (0, address_1.validateAndChecksumAddress)(from);
|
|
1929
1976
|
if (!validAddress) {
|
|
1930
1977
|
throw new Error("Invalid address in transaction payload: ".concat(from));
|
|
1931
1978
|
}
|
|
1932
|
-
_c = {};
|
|
1933
1979
|
_b = this._evmChainId;
|
|
1934
1980
|
if (_b) return [3 /*break*/, 2];
|
|
1935
1981
|
return [4 /*yield*/, this.getCurrentChainId(provider)];
|
|
1936
1982
|
case 1:
|
|
1937
|
-
_b = (
|
|
1938
|
-
|
|
1939
|
-
case 2:
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1983
|
+
_b = (_c.sent());
|
|
1984
|
+
_c.label = 2;
|
|
1985
|
+
case 2:
|
|
1986
|
+
chainId = _b;
|
|
1987
|
+
this.backfillActiveWallet(validAddress, chainId);
|
|
1988
|
+
return [2 /*return*/, {
|
|
1989
|
+
chainId: chainId,
|
|
1990
|
+
data: data,
|
|
1991
|
+
address: validAddress,
|
|
1992
|
+
to: to,
|
|
1993
|
+
value: value,
|
|
1994
|
+
}];
|
|
1945
1995
|
}
|
|
1946
1996
|
});
|
|
1947
1997
|
});
|
|
1948
1998
|
};
|
|
1999
|
+
/**
|
|
2000
|
+
* Persist an EVM address discovered through autocapture (signature / transaction)
|
|
2001
|
+
* as the current EVM address when none is currently set. This lets subsequent
|
|
2002
|
+
* track()/page() calls carry the address even when the underlying wallet never
|
|
2003
|
+
* fires an EIP-1193 `accountsChanged` event (embedded wallets, smart accounts,
|
|
2004
|
+
* social-login wrappers). If `accountsChanged` later fires it overwrites this
|
|
2005
|
+
* value in the normal way; existing connections are never clobbered.
|
|
2006
|
+
*/
|
|
2007
|
+
FormoAnalytics.prototype.backfillActiveWallet = function (address, chainId) {
|
|
2008
|
+
if (this._evmAddress)
|
|
2009
|
+
return;
|
|
2010
|
+
this.setChainState('evm', { address: address, chainId: chainId });
|
|
2011
|
+
};
|
|
1949
2012
|
/**
|
|
1950
2013
|
* Polls for transaction receipt and emits tx.status = CONFIRMED or REVERTED.
|
|
1951
2014
|
*/
|
|
@@ -2145,6 +2208,7 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
2145
2208
|
if (state.address || state.chainId) {
|
|
2146
2209
|
this.currentAddress = state.address;
|
|
2147
2210
|
this.currentChainId = state.chainId;
|
|
2211
|
+
this.persistActiveWallet();
|
|
2148
2212
|
return;
|
|
2149
2213
|
}
|
|
2150
2214
|
}
|
|
@@ -2155,10 +2219,65 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
2155
2219
|
this.currentAddress = otherState.address;
|
|
2156
2220
|
this.currentChainId = otherState.chainId;
|
|
2157
2221
|
this._activeNamespace = other;
|
|
2222
|
+
this.persistActiveWallet();
|
|
2158
2223
|
return;
|
|
2159
2224
|
}
|
|
2160
2225
|
this.currentAddress = undefined;
|
|
2161
2226
|
this.currentChainId = undefined;
|
|
2227
|
+
this.persistActiveWallet();
|
|
2228
|
+
};
|
|
2229
|
+
/**
|
|
2230
|
+
* Persist (or clear) the current wallet snapshot in a cookie so that the
|
|
2231
|
+
* SDK can repopulate `currentAddress`/`currentChainId` at init on the next
|
|
2232
|
+
* page load — closing the gap between page-show and wagmi/EIP-1193
|
|
2233
|
+
* reconnection during which track()/page() events would otherwise ship
|
|
2234
|
+
* with an empty address.
|
|
2235
|
+
*/
|
|
2236
|
+
FormoAnalytics.prototype.persistActiveWallet = function () {
|
|
2237
|
+
try {
|
|
2238
|
+
if (this.currentAddress) {
|
|
2239
|
+
var value = JSON.stringify(__assign({ address: this.currentAddress }, (this.currentChainId !== undefined && { chainId: this.currentChainId })));
|
|
2240
|
+
var domain = (0, cookiePolicy_1.getIdentityCookieDomain)(this.crossSubdomainCookies);
|
|
2241
|
+
(0, storage_1.cookie)().set(constants_1.ACTIVE_WALLET_KEY, value, __assign({ path: "/", expires: new Date(Date.now() + constants_1.ACTIVE_WALLET_TTL_MS).toUTCString() }, (domain ? { domain: domain } : {})));
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
(0, storage_1.cookie)().remove(constants_1.ACTIVE_WALLET_KEY);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
catch (err) {
|
|
2248
|
+
logger_1.logger.warn("Failed to persist current wallet snapshot", err);
|
|
2249
|
+
}
|
|
2250
|
+
};
|
|
2251
|
+
/**
|
|
2252
|
+
* Seed `currentAddress`/`currentChainId` from the persisted snapshot, if
|
|
2253
|
+
* any. Called once during construction before the first page hit fires.
|
|
2254
|
+
*/
|
|
2255
|
+
FormoAnalytics.prototype.loadActiveWallet = function () {
|
|
2256
|
+
try {
|
|
2257
|
+
var raw = (0, storage_1.cookie)().get(constants_1.ACTIVE_WALLET_KEY);
|
|
2258
|
+
if (!raw)
|
|
2259
|
+
return;
|
|
2260
|
+
var parsed = JSON.parse(raw);
|
|
2261
|
+
if (!(parsed === null || parsed === void 0 ? void 0 : parsed.address))
|
|
2262
|
+
return;
|
|
2263
|
+
var namespace = (0, solana_1.isSolanaChainId)(parsed.chainId) ? "solana" : "evm";
|
|
2264
|
+
var validated = (0, address_1.validateAddress)(parsed.address, parsed.chainId);
|
|
2265
|
+
if (!validated) {
|
|
2266
|
+
(0, storage_1.cookie)().remove(constants_1.ACTIVE_WALLET_KEY);
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
var ns = this._chainState[namespace];
|
|
2270
|
+
ns.address = validated;
|
|
2271
|
+
if (parsed.chainId !== undefined)
|
|
2272
|
+
ns.chainId = parsed.chainId;
|
|
2273
|
+
this._activeNamespace = namespace;
|
|
2274
|
+
this.currentAddress = validated;
|
|
2275
|
+
this.currentChainId = parsed.chainId;
|
|
2276
|
+
}
|
|
2277
|
+
catch (err) {
|
|
2278
|
+
logger_1.logger.warn("Failed to restore persisted wallet snapshot", err);
|
|
2279
|
+
(0, storage_1.cookie)().remove(constants_1.ACTIVE_WALLET_KEY);
|
|
2280
|
+
}
|
|
2162
2281
|
};
|
|
2163
2282
|
/**
|
|
2164
2283
|
* Helper method to clear the active provider state
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export declare const SESSION_TRAFFIC_SOURCE_KEY = "traffic-source";
|
|
2
|
-
export declare const SESSION_CURRENT_URL_KEY = "analytics-current-url";
|
|
3
2
|
export declare const SESSION_USER_ID_KEY = "user-id";
|
|
3
|
+
/**
|
|
4
|
+
* Persisted snapshot of the currently-active EVM/Solana wallet
|
|
5
|
+
* (address + chainId). Lets the SDK seed `currentAddress`/`currentChainId`
|
|
6
|
+
* at init so the first page hit after a reload carries the address, without
|
|
7
|
+
* having to wait for wagmi/EIP-1193 reconnection to fire.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ACTIVE_WALLET_KEY = "active-wallet";
|
|
10
|
+
/** TTL for the persisted active-wallet snapshot cookie. */
|
|
11
|
+
export declare const ACTIVE_WALLET_TTL_MS: number;
|
|
4
12
|
export declare const LOCAL_ANONYMOUS_ID_KEY = "anonymous-id";
|
|
5
13
|
export declare const CONSENT_OPT_OUT_KEY = "opt-out-tracking";
|
|
6
14
|
export declare const DEFAULT_PROVIDER_ICON = "data:image/svg+xml;base64,";
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BLOCKED_ADDRESSES = exports.DEAD_ADDRESS = exports.ZERO_ADDRESS = exports.DEFAULT_PROVIDER_ICON = exports.CONSENT_OPT_OUT_KEY = exports.LOCAL_ANONYMOUS_ID_KEY = exports.
|
|
3
|
+
exports.BLOCKED_ADDRESSES = exports.DEAD_ADDRESS = exports.ZERO_ADDRESS = exports.DEFAULT_PROVIDER_ICON = exports.CONSENT_OPT_OUT_KEY = exports.LOCAL_ANONYMOUS_ID_KEY = exports.ACTIVE_WALLET_TTL_MS = exports.ACTIVE_WALLET_KEY = exports.SESSION_USER_ID_KEY = exports.SESSION_TRAFFIC_SOURCE_KEY = void 0;
|
|
4
4
|
exports.SESSION_TRAFFIC_SOURCE_KEY = "traffic-source";
|
|
5
5
|
// SESSION_WALLET_DETECTED_KEY and SESSION_WALLET_IDENTIFIED_KEY
|
|
6
6
|
// are now defined in src/session/index.ts
|
|
7
|
-
exports.SESSION_CURRENT_URL_KEY = "analytics-current-url";
|
|
8
7
|
exports.SESSION_USER_ID_KEY = "user-id";
|
|
8
|
+
/**
|
|
9
|
+
* Persisted snapshot of the currently-active EVM/Solana wallet
|
|
10
|
+
* (address + chainId). Lets the SDK seed `currentAddress`/`currentChainId`
|
|
11
|
+
* at init so the first page hit after a reload carries the address, without
|
|
12
|
+
* having to wait for wagmi/EIP-1193 reconnection to fire.
|
|
13
|
+
*/
|
|
14
|
+
exports.ACTIVE_WALLET_KEY = "active-wallet";
|
|
15
|
+
/** TTL for the persisted active-wallet snapshot cookie. */
|
|
16
|
+
exports.ACTIVE_WALLET_TTL_MS = 24 * 60 * 60 * 1000;
|
|
9
17
|
exports.LOCAL_ANONYMOUS_ID_KEY = "anonymous-id";
|
|
10
18
|
// Consent management keys
|
|
11
19
|
exports.CONSENT_OPT_OUT_KEY = "opt-out-tracking";
|
|
@@ -186,7 +186,7 @@ export declare const COUNTRY_LIST: {
|
|
|
186
186
|
readonly "America/Panama": "PA";
|
|
187
187
|
readonly "America/Pangnirtung": "CA";
|
|
188
188
|
readonly "America/Paramaribo": "SR";
|
|
189
|
-
readonly "America/Phoenix": "US
|
|
189
|
+
readonly "America/Phoenix": "US";
|
|
190
190
|
readonly "America/Port-au-Prince": "HT";
|
|
191
191
|
readonly "America/Port_of_Spain": "TT";
|
|
192
192
|
readonly "America/Porto_Acre": "BR";
|
|
@@ -289,6 +289,7 @@ export declare const COUNTRY_LIST: {
|
|
|
289
289
|
readonly "Asia/Katmandu": "NP";
|
|
290
290
|
readonly "Asia/Khandyga": "RU";
|
|
291
291
|
readonly "Asia/Kolkata": "IN";
|
|
292
|
+
readonly "Asia/Kostanay": "KZ";
|
|
292
293
|
readonly "Asia/Krasnoyarsk": "RU";
|
|
293
294
|
readonly "Asia/Kuala_Lumpur": "MY";
|
|
294
295
|
readonly "Asia/Kuching": "MY";
|
|
@@ -386,51 +387,11 @@ export declare const COUNTRY_LIST: {
|
|
|
386
387
|
readonly "Canada/Pacific": "CA";
|
|
387
388
|
readonly "Canada/Saskatchewan": "CA";
|
|
388
389
|
readonly "Canada/Yukon": "CA";
|
|
389
|
-
readonly CET: "CET";
|
|
390
390
|
readonly "Chile/Continental": "CL";
|
|
391
391
|
readonly "Chile/EasterIsland": "CL";
|
|
392
|
-
readonly CST6CDT: "CST6CDT";
|
|
393
392
|
readonly Cuba: "CU";
|
|
394
|
-
readonly EET: "EET";
|
|
395
393
|
readonly Egypt: "EG";
|
|
396
394
|
readonly Eire: "IE";
|
|
397
|
-
readonly EST: "EST";
|
|
398
|
-
readonly EST5EDT: "EST5EDT";
|
|
399
|
-
readonly "Etc/GMT": "Etc/GMT";
|
|
400
|
-
readonly "Etc/GMT+0": "Etc/GMT+0";
|
|
401
|
-
readonly "Etc/GMT+1": "Etc/GMT+1";
|
|
402
|
-
readonly "Etc/GMT+10": "Etc/GMT+10";
|
|
403
|
-
readonly "Etc/GMT+11": "Etc/GMT+11";
|
|
404
|
-
readonly "Etc/GMT+12": "Etc/GMT+12";
|
|
405
|
-
readonly "Etc/GMT+2": "Etc/GMT+2";
|
|
406
|
-
readonly "Etc/GMT+3": "Etc/GMT+3";
|
|
407
|
-
readonly "Etc/GMT+4": "Etc/GMT+4";
|
|
408
|
-
readonly "Etc/GMT+5": "Etc/GMT+5";
|
|
409
|
-
readonly "Etc/GMT+6": "Etc/GMT+6";
|
|
410
|
-
readonly "Etc/GMT+7": "Etc/GMT+7";
|
|
411
|
-
readonly "Etc/GMT+8": "Etc/GMT+8";
|
|
412
|
-
readonly "Etc/GMT+9": "Etc/GMT+9";
|
|
413
|
-
readonly "Etc/GMT-0": "Etc/GMT-0";
|
|
414
|
-
readonly "Etc/GMT-1": "Etc/GMT-1";
|
|
415
|
-
readonly "Etc/GMT-10": "Etc/GMT-10";
|
|
416
|
-
readonly "Etc/GMT-11": "Etc/GMT-11";
|
|
417
|
-
readonly "Etc/GMT-12": "Etc/GMT-12";
|
|
418
|
-
readonly "Etc/GMT-13": "Etc/GMT-13";
|
|
419
|
-
readonly "Etc/GMT-14": "Etc/GMT-14";
|
|
420
|
-
readonly "Etc/GMT-2": "Etc/GMT-2";
|
|
421
|
-
readonly "Etc/GMT-3": "Etc/GMT-3";
|
|
422
|
-
readonly "Etc/GMT-4": "Etc/GMT-4";
|
|
423
|
-
readonly "Etc/GMT-5": "Etc/GMT-5";
|
|
424
|
-
readonly "Etc/GMT-6": "Etc/GMT-6";
|
|
425
|
-
readonly "Etc/GMT-7": "Etc/GMT-7";
|
|
426
|
-
readonly "Etc/GMT-8": "Etc/GMT-8";
|
|
427
|
-
readonly "Etc/GMT-9": "Etc/GMT-9";
|
|
428
|
-
readonly "Etc/GMT0": "Etc/GMT0";
|
|
429
|
-
readonly "Etc/Greenwich": "Etc/Greenwich";
|
|
430
|
-
readonly "Etc/UCT": "Etc/UCT";
|
|
431
|
-
readonly "Etc/UTC": "Etc/UTC";
|
|
432
|
-
readonly "Etc/Universal": "Etc/Universal";
|
|
433
|
-
readonly "Etc/Zulu": "Etc/Zulu";
|
|
434
395
|
readonly "Europe/Amsterdam": "NL";
|
|
435
396
|
readonly "Europe/Andorra": "AD";
|
|
436
397
|
readonly "Europe/Astrakhan": "RU";
|
|
@@ -495,16 +456,9 @@ export declare const COUNTRY_LIST: {
|
|
|
495
456
|
readonly "Europe/Zagreb": "HR";
|
|
496
457
|
readonly "Europe/Zaporozhye": "UA";
|
|
497
458
|
readonly "Europe/Zurich": "CH";
|
|
498
|
-
readonly Factory: "Factory";
|
|
499
459
|
readonly GB: "GB";
|
|
500
460
|
readonly "GB-Eire": "GB";
|
|
501
|
-
readonly GMT: "GMT";
|
|
502
|
-
readonly "GMT+0": "GMT+0";
|
|
503
|
-
readonly "GMT-0": "GMT-0";
|
|
504
|
-
readonly GMT0: "GMT0";
|
|
505
|
-
readonly Greenwich: "Greenwich";
|
|
506
461
|
readonly Hongkong: "HK";
|
|
507
|
-
readonly HST: "HST";
|
|
508
462
|
readonly Iceland: "IS";
|
|
509
463
|
readonly "Indian/Antananarivo": "MG";
|
|
510
464
|
readonly "Indian/Chagos": "IO";
|
|
@@ -523,12 +477,9 @@ export declare const COUNTRY_LIST: {
|
|
|
523
477
|
readonly Japan: "JP";
|
|
524
478
|
readonly Kwajalein: "MH";
|
|
525
479
|
readonly Libya: "LY";
|
|
526
|
-
readonly MET: "MET";
|
|
527
480
|
readonly "Mexico/BajaNorte": "MX";
|
|
528
481
|
readonly "Mexico/BajaSur": "MX";
|
|
529
482
|
readonly "Mexico/General": "MX";
|
|
530
|
-
readonly MST: "MST";
|
|
531
|
-
readonly MST7MDT: "MST7MDT";
|
|
532
483
|
readonly Navajo: "US";
|
|
533
484
|
readonly NZ: "NZ";
|
|
534
485
|
readonly "NZ-CHAT": "NZ";
|
|
@@ -546,7 +497,7 @@ export declare const COUNTRY_LIST: {
|
|
|
546
497
|
readonly "Pacific/Galapagos": "EC";
|
|
547
498
|
readonly "Pacific/Gambier": "PF";
|
|
548
499
|
readonly "Pacific/Guadalcanal": "SB";
|
|
549
|
-
readonly "Pacific/Guam": "GU
|
|
500
|
+
readonly "Pacific/Guam": "GU";
|
|
550
501
|
readonly "Pacific/Honolulu": "US";
|
|
551
502
|
readonly "Pacific/Johnston": "UM";
|
|
552
503
|
readonly "Pacific/Kanton": "KI";
|
|
@@ -579,13 +530,10 @@ export declare const COUNTRY_LIST: {
|
|
|
579
530
|
readonly Poland: "PL";
|
|
580
531
|
readonly Portugal: "PT";
|
|
581
532
|
readonly PRC: "CN";
|
|
582
|
-
readonly PST8PDT: "PST8PDT";
|
|
583
533
|
readonly ROC: "TW";
|
|
584
534
|
readonly ROK: "KR";
|
|
585
535
|
readonly Singapore: "SG";
|
|
586
536
|
readonly Turkey: "TR";
|
|
587
|
-
readonly UCT: "UCT";
|
|
588
|
-
readonly Universal: "Universal";
|
|
589
537
|
readonly "US/Alaska": "US";
|
|
590
538
|
readonly "US/Aleutian": "US";
|
|
591
539
|
readonly "US/Arizona": "US";
|
|
@@ -598,9 +546,6 @@ export declare const COUNTRY_LIST: {
|
|
|
598
546
|
readonly "US/Mountain": "US";
|
|
599
547
|
readonly "US/Pacific": "US";
|
|
600
548
|
readonly "US/Samoa": "AS";
|
|
601
|
-
readonly UTC: "UTC";
|
|
602
549
|
readonly "W-SU": "RU";
|
|
603
|
-
readonly WET: "WET";
|
|
604
|
-
readonly Zulu: "Zulu";
|
|
605
550
|
};
|
|
606
551
|
//# sourceMappingURL=config.d.ts.map
|