@traqio/web 0.2.2 → 0.3.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/build/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { type WebSource } from "./source";
2
+ export type { WebSource } from "./source";
1
3
  export declare const DEFAULT_ENDPOINT = "https://api.traqio.app";
2
4
  export interface WebInitOptions {
3
5
  /** The site's WEB key (`tq_web_…`), from the console. Public by design: it is held to the site's origins. */
@@ -18,7 +20,8 @@ export interface WebInitOptions {
18
20
  */
19
21
  waitForConsent?: boolean;
20
22
  /**
21
- * How long the trackID is kept after the click, in days. Default 30. Keeping it
23
+ * How long the trackID — and the visit's source (`getSource()`) — is kept after
24
+ * the landing, in days. Default 30. Keeping it
22
25
  * longer than the site's attribution window is harmless: the server refuses a
23
26
  * click outside the window.
24
27
  */
@@ -48,6 +51,7 @@ export declare class TraqioWeb {
48
51
  private readonly core;
49
52
  private store;
50
53
  private trackIds;
54
+ private sources;
51
55
  private waitForConsent;
52
56
  private started;
53
57
  /** A `setConsent()` made before `init()` — it decides whether init may store. */
@@ -78,6 +82,14 @@ export declare class TraqioWeb {
78
82
  * your backend cannot read the `traq_click` cookie itself.
79
83
  */
80
84
  getTrackId(): string | null;
85
+ /**
86
+ * Where the visitor came from when no Traqio link brought them — the landing's
87
+ * `utm_*`, an ad network's click id (`gclid`, `fbclid`, `ttclid`), the referring
88
+ * site — or null. Kept in the `traq_src` cookie your backend reads with the
89
+ * sign-up (`@traqio/node`: `sourceFromRequest(req)`); pass this to it instead
90
+ * when your backend is on another domain. A Traqio link click wins over it.
91
+ */
92
+ getSource(): WebSource | null;
81
93
  /**
82
94
  * GDPR erasure from the page: the server deletes what it holds about this browser
83
95
  * and user, and this SDK stops sending and forgets the trackID. Irreversible.
package/build/index.js CHANGED
@@ -636,7 +636,7 @@ var require_build = __commonJS({
636
636
  var adservices_1 = require_adservices();
637
637
  var deeplink_1 = require_deeplink();
638
638
  var adRevenue_1 = require_adRevenue();
639
- exports.SDK_VERSION = "0.5.0";
639
+ exports.SDK_VERSION = "0.5.1";
640
640
  var skan_2 = require_skan();
641
641
  Object.defineProperty(exports, "Skan", { enumerable: true, get: function() {
642
642
  return skan_2.Skan;
@@ -712,6 +712,7 @@ var require_build = __commonJS({
712
712
  var FLUSH_DELAY_MS = 3e3;
713
713
  var MAX_INSTALL_ATTEMPTS = 3;
714
714
  var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
715
+ var TRACKING_AUTHORIZATIONS = ["not_determined", "restricted", "denied", "authorized"];
715
716
  var MAX_PRECISION = {
716
717
  exact: "precise",
717
718
  publisher_defined: "publisher_provided",
@@ -782,6 +783,15 @@ var require_build = __commonJS({
782
783
  }
783
784
  return void 0;
784
785
  }
786
+ function reactNativeOs() {
787
+ var _a, _b;
788
+ try {
789
+ const os = (_b = (_a = (init_empty(), __toCommonJS(empty_exports))) == null ? void 0 : _a.Platform) == null ? void 0 : _b.OS;
790
+ return os === "ios" || os === "android" ? os : void 0;
791
+ } catch {
792
+ return void 0;
793
+ }
794
+ }
785
795
  var Client2 = class {
786
796
  constructor() {
787
797
  this.queue = [];
@@ -800,6 +810,7 @@ var require_build = __commonJS({
800
810
  this.undelivered = [];
801
811
  this.deferred = null;
802
812
  this.consent = null;
813
+ this.att = null;
803
814
  this.debug = false;
804
815
  this.maxRevenuePaid = (adInfo) => {
805
816
  try {
@@ -886,9 +897,18 @@ var require_build = __commonJS({
886
897
  if (props == null ? void 0 : props.value)
887
898
  this.skan.addRevenue(props.value);
888
899
  }
900
+ /**
901
+ * The store this app runs on: the native bridge's word, else React Native's
902
+ * `Platform.OS`, else UNKNOWN. Never a guess — until 2026-11 a missing bridge meant
903
+ * "android", and every bridgeless iPhone was filed as an Android install whose
904
+ * purchases then went to Meta with the Android package (todo cmwl6okn).
905
+ */
906
+ get hostPlatform() {
907
+ var _a, _b;
908
+ return (_b = (_a = this.opts.native) == null ? void 0 : _a.platform) != null ? _b : reactNativeOs();
909
+ }
889
910
  defaultStore() {
890
- var _a;
891
- const platform = (_a = this.opts.native) == null ? void 0 : _a.platform;
911
+ const platform = this.hostPlatform;
892
912
  return platform === "ios" ? "app_store" : platform === "android" ? "play_store" : void 0;
893
913
  }
894
914
  /**
@@ -1178,7 +1198,6 @@ var require_build = __commonJS({
1178
1198
  * (still counted as fresh, since the flag is only written on an answer).
1179
1199
  */
1180
1200
  async resolveDeferredOnce(freshInstall) {
1181
- var _a, _b;
1182
1201
  const store = this.opts.storage;
1183
1202
  try {
1184
1203
  const cached = await (store == null ? void 0 : store.getItem(DEFERRED_KEY));
@@ -1188,7 +1207,7 @@ var require_build = __commonJS({
1188
1207
  }
1189
1208
  if (!freshInstall && !await (store == null ? void 0 : store.getItem(`${DEFERRED_KEY}_pending`).catch(() => null)))
1190
1209
  return null;
1191
- const platform = (_b = (_a = this.opts.native) == null ? void 0 : _a.platform) != null ? _b : "android";
1210
+ const platform = this.hostPlatform;
1192
1211
  const referrer = platform === "android" ? await this.readReferrer() : null;
1193
1212
  await (store == null ? void 0 : store.setItem(`${DEFERRED_KEY}_pending`, "1").catch(() => void 0));
1194
1213
  const answer = await this.askDeferred(platform, referrer == null ? void 0 : referrer.referrer);
@@ -1225,7 +1244,7 @@ var require_build = __commonJS({
1225
1244
  * Never when a link is already known, never twice.
1226
1245
  */
1227
1246
  async retryDeferredWithConsent() {
1228
- var _a, _b, _c, _d;
1247
+ var _a, _b;
1229
1248
  const store = (_a = this.opts) == null ? void 0 : _a.storage;
1230
1249
  if (!store || this.consent !== "granted" || this.opts.deepLinking === false || this.isWeb)
1231
1250
  return null;
@@ -1238,10 +1257,10 @@ var require_build = __commonJS({
1238
1257
  const known = await this.storedDeferred();
1239
1258
  if (known)
1240
1259
  return known;
1241
- const link = (0, deeplink_1.toDeepLink)(await this.askDeferred((_c = (_b = this.opts.native) == null ? void 0 : _b.platform) != null ? _c : "ios", void 0), true);
1260
+ const link = (0, deeplink_1.toDeepLink)(await this.askDeferred(this.hostPlatform, void 0), true);
1242
1261
  if (!link)
1243
1262
  return null;
1244
- await ((_d = this.opts.storage) == null ? void 0 : _d.setItem(DEFERRED_KEY, JSON.stringify(link)).catch(() => void 0));
1263
+ await ((_b = this.opts.storage) == null ? void 0 : _b.setItem(DEFERRED_KEY, JSON.stringify(link)).catch(() => void 0));
1245
1264
  this.emitDeepLink(link);
1246
1265
  return link;
1247
1266
  }
@@ -1505,11 +1524,17 @@ var require_build = __commonJS({
1505
1524
  }
1506
1525
  }
1507
1526
  async sendInstallOnce() {
1508
- var _a, _b;
1509
1527
  const store = this.opts.storage;
1510
1528
  if (store && await store.getItem(this.installSentKey))
1511
1529
  return;
1512
- const platform = (_b = (_a = this.opts.native) == null ? void 0 : _a.platform) != null ? _b : "android";
1530
+ const platform = this.hostPlatform;
1531
+ if (!platform) {
1532
+ console.warn("[traqio] unknown platform \u2014 no native bridge and not React Native: the install is not reported. Pass `native: getNativeBridge()` (React Native / Expo) or your SDK's bridge to init().");
1533
+ return;
1534
+ }
1535
+ if (!this.opts.native) {
1536
+ console.warn(`[traqio] the Traqio native module is missing on ${platform} (Expo Go, or not linked in this build): install reported without its attribution signals. Use a development / EAS build.`);
1537
+ }
1513
1538
  const referrer = await this.readReferrer();
1514
1539
  if (referrer.retryable && store) {
1515
1540
  const attempts = Number(await store.getItem(INSTALL_ATTEMPTS_KEY)) || 0;
@@ -1633,6 +1658,21 @@ var require_build = __commonJS({
1633
1658
  keepalive() {
1634
1659
  return this.isWeb ? { keepalive: true } : {};
1635
1660
  }
1661
+ get asksTrackingAuthorization() {
1662
+ var _a;
1663
+ return ((_a = this.opts.native) == null ? void 0 : _a.platform) === "ios" && typeof this.opts.native.getTrackingAuthorization === "function";
1664
+ }
1665
+ /** iOS only; the last good answer when the bridge cannot give one now. */
1666
+ async readTrackingAuthorization() {
1667
+ var _a, _b;
1668
+ try {
1669
+ const status = await ((_b = (_a = this.opts.native) == null ? void 0 : _a.getTrackingAuthorization) == null ? void 0 : _b.call(_a));
1670
+ if (TRACKING_AUTHORIZATIONS.includes(status))
1671
+ this.att = status != null ? status : null;
1672
+ } catch {
1673
+ }
1674
+ return this.att;
1675
+ }
1636
1676
  async post(body, path = "/ingest") {
1637
1677
  return await this.send(body, path) === "ok";
1638
1678
  }
@@ -1644,11 +1684,18 @@ var require_build = __commonJS({
1644
1684
  */
1645
1685
  async send(body, path = "/ingest") {
1646
1686
  const consent = this.consent && (path === "/ingest" || path === "/ingest/session") ? { consent: this.consent } : {};
1687
+ const att = path === "/ingest" && this.asksTrackingAuthorization ? await this.readTrackingAuthorization() : null;
1647
1688
  try {
1648
1689
  const res = await fetch(`${this.opts.endpoint}${path}`, {
1649
1690
  method: "POST",
1650
1691
  headers: { "Content-Type": "application/json" },
1651
- body: JSON.stringify({ sdkKey: this.opts.sdkKey, ...body, ...consent, ...this.debugField() }),
1692
+ body: JSON.stringify({
1693
+ sdkKey: this.opts.sdkKey,
1694
+ ...body,
1695
+ ...consent,
1696
+ ...att ? { att } : {},
1697
+ ...this.debugField()
1698
+ }),
1652
1699
  ...this.keepalive()
1653
1700
  });
1654
1701
  if (res.ok)
@@ -1847,6 +1894,156 @@ var BrowserStore = class {
1847
1894
  }
1848
1895
  };
1849
1896
 
1897
+ // src/kept.ts
1898
+ var KeptValue = class {
1899
+ constructor(store, key, cookieDomain, cookies, valid) {
1900
+ this.store = store;
1901
+ this.key = key;
1902
+ this.cookieDomain = cookieDomain;
1903
+ this.cookies = cookies;
1904
+ this.valid = valid;
1905
+ }
1906
+ /** The kept value, or null once it has expired or was never there. */
1907
+ get(now = Date.now()) {
1908
+ const raw = this.store.getSync(this.key);
1909
+ if (raw) {
1910
+ try {
1911
+ const parsed = JSON.parse(raw);
1912
+ if (parsed && typeof parsed.id === "string" && parsed.exp > now) return parsed.id;
1913
+ } catch {
1914
+ }
1915
+ }
1916
+ if (this.cookies && this.store.isPersistent) {
1917
+ const fromCookie = readCookie(this.key);
1918
+ if (fromCookie && this.valid(fromCookie)) return fromCookie;
1919
+ }
1920
+ return null;
1921
+ }
1922
+ set(value, maxAgeMs, now = Date.now()) {
1923
+ const record = { id: value, exp: now + maxAgeMs };
1924
+ this.store.setSync(this.key, JSON.stringify(record));
1925
+ if (this.cookies && this.store.isPersistent) writeCookie(this.key, value, maxAgeMs / 1e3, this.cookieDomain());
1926
+ }
1927
+ /** Removes it everywhere — `forgetMe()`. */
1928
+ clear() {
1929
+ this.store.removeSync(this.key);
1930
+ if (this.cookies) deleteCookie(this.key, this.cookieDomain());
1931
+ }
1932
+ /** Writes the cookie half once storage becomes allowed (the localStorage half moves with the store). */
1933
+ persistCookie(now = Date.now()) {
1934
+ const raw = this.store.getSync(this.key);
1935
+ if (!raw || !this.cookies || !this.store.isPersistent) return;
1936
+ try {
1937
+ const parsed = JSON.parse(raw);
1938
+ if (parsed.exp > now) writeCookie(this.key, parsed.id, (parsed.exp - now) / 1e3, this.cookieDomain());
1939
+ } catch {
1940
+ }
1941
+ }
1942
+ };
1943
+
1944
+ // src/source.ts
1945
+ var SOURCE_KEY = "traq_src";
1946
+ var SOURCE_PARAMS = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gclid", "fbclid", "ttclid"];
1947
+ var MAX_VALUE_LENGTH = 200;
1948
+ var FIELD = {
1949
+ utm_source: "utmSource",
1950
+ utm_medium: "utmMedium",
1951
+ utm_campaign: "utmCampaign",
1952
+ utm_content: "utmContent",
1953
+ utm_term: "utmTerm",
1954
+ gclid: "gclid",
1955
+ fbclid: "fbclid",
1956
+ ttclid: "ttclid",
1957
+ referrer: "referrer"
1958
+ };
1959
+ var clean = (v) => {
1960
+ const t = v == null ? void 0 : v.trim();
1961
+ return t ? t.slice(0, MAX_VALUE_LENGTH) : null;
1962
+ };
1963
+ var bare = (host) => host.toLowerCase().replace(/^www\./, "");
1964
+ function sameSite(host, other) {
1965
+ const a = bare(host);
1966
+ const b = bare(other);
1967
+ return a === b || a.endsWith(`.${b}`) || b.endsWith(`.${a}`);
1968
+ }
1969
+ function referrerHost(referrer, pageHref) {
1970
+ if (!referrer) return null;
1971
+ try {
1972
+ const ref = new URL(referrer);
1973
+ if (ref.protocol !== "http:" && ref.protocol !== "https:") return null;
1974
+ if (sameSite(new URL(pageHref).hostname, ref.hostname)) return null;
1975
+ return clean(bare(ref.hostname));
1976
+ } catch {
1977
+ return null;
1978
+ }
1979
+ }
1980
+ function sourceFromLanding(href, referrer, now) {
1981
+ const out = new URLSearchParams();
1982
+ try {
1983
+ const params = new URL(href).searchParams;
1984
+ for (const key of SOURCE_PARAMS) {
1985
+ const v = clean(params.get(key));
1986
+ if (v) out.set(key, v);
1987
+ }
1988
+ } catch {
1989
+ return null;
1990
+ }
1991
+ const fromUrl = out.toString() !== "";
1992
+ const ref = referrerHost(referrer, href);
1993
+ if (ref) out.set("referrer", ref);
1994
+ if (out.toString() === "") return null;
1995
+ out.set("ts", String(now));
1996
+ return { query: out.toString(), fromUrl };
1997
+ }
1998
+ function parseSource(query) {
1999
+ let params;
2000
+ try {
2001
+ params = new URLSearchParams(query);
2002
+ } catch {
2003
+ return null;
2004
+ }
2005
+ const source = {};
2006
+ for (const [param, field] of Object.entries(FIELD)) {
2007
+ const v = clean(params.get(param));
2008
+ if (v) source[field] = v;
2009
+ }
2010
+ if (!Object.keys(source).length) return null;
2011
+ const ts = Number(params.get("ts"));
2012
+ if (Number.isFinite(ts) && ts > 0) source.landedAt = ts;
2013
+ return source;
2014
+ }
2015
+ var SourceKeeper = class {
2016
+ constructor(store, maxAgeMs, cookieDomain, cookies) {
2017
+ this.maxAgeMs = maxAgeMs;
2018
+ this.kept = new KeptValue(store, SOURCE_KEY, cookieDomain, cookies, (v) => parseSource(v) !== null);
2019
+ }
2020
+ /**
2021
+ * Reads the landing. URL parameters (`utm_*`, a click id) REPLACE what is kept:
2022
+ * the last campaign that brought the visitor is the one that counts, as for the
2023
+ * trackID. A referrer alone only fills an empty slot — the return from a payment
2024
+ * page or a webmail must not overwrite the campaign the visitor came from. A
2025
+ * landing with neither (a typed URL, an internal navigation) changes nothing.
2026
+ */
2027
+ capture(href, referrer, now = Date.now()) {
2028
+ const landing = sourceFromLanding(href, referrer, now);
2029
+ if (!landing) return null;
2030
+ if (!landing.fromUrl && this.kept.get(now) !== null) return null;
2031
+ this.kept.set(landing.query, this.maxAgeMs, now);
2032
+ return parseSource(landing.query);
2033
+ }
2034
+ /** The kept source, or null (none, or expired). */
2035
+ get(now = Date.now()) {
2036
+ const query = this.kept.get(now);
2037
+ return query === null ? null : parseSource(query);
2038
+ }
2039
+ clear() {
2040
+ this.kept.clear();
2041
+ }
2042
+ persistCookie(now = Date.now()) {
2043
+ this.kept.persistCookie(now);
2044
+ }
2045
+ };
2046
+
1850
2047
  // src/trackId.ts
1851
2048
  var CLICK_PARAM = "traq_click";
1852
2049
  var STORE_KEY = "traq_click";
@@ -1861,10 +2058,8 @@ function clickIdFromUrl(href) {
1861
2058
  }
1862
2059
  var TrackIdKeeper = class {
1863
2060
  constructor(store, maxAgeMs, cookieDomain, cookies) {
1864
- this.store = store;
1865
2061
  this.maxAgeMs = maxAgeMs;
1866
- this.cookieDomain = cookieDomain;
1867
- this.cookies = cookies;
2062
+ this.kept = new KeptValue(store, STORE_KEY, cookieDomain, cookies, (v) => CLICK_ID.test(v));
1868
2063
  }
1869
2064
  /**
1870
2065
  * Reads the landing URL. A new click REPLACES the kept one: the last ad clicked is
@@ -1873,44 +2068,20 @@ var TrackIdKeeper = class {
1873
2068
  */
1874
2069
  capture(href, now = Date.now()) {
1875
2070
  const id = clickIdFromUrl(href);
1876
- if (id) this.write(id, now);
2071
+ if (id) this.kept.set(id, this.maxAgeMs, now);
1877
2072
  return id;
1878
2073
  }
1879
2074
  /** The kept click id, or null once it has expired or was never there. */
1880
2075
  get(now = Date.now()) {
1881
- const raw = this.store.getSync(STORE_KEY);
1882
- if (raw) {
1883
- try {
1884
- const parsed = JSON.parse(raw);
1885
- if (parsed && typeof parsed.id === "string" && parsed.exp > now) return parsed.id;
1886
- } catch {
1887
- }
1888
- }
1889
- if (this.cookies && this.store.isPersistent) {
1890
- const fromCookie = readCookie(STORE_KEY);
1891
- if (fromCookie && CLICK_ID.test(fromCookie)) return fromCookie;
1892
- }
1893
- return null;
2076
+ return this.kept.get(now);
1894
2077
  }
1895
2078
  /** Removes it everywhere — `forgetMe()`. */
1896
2079
  clear() {
1897
- this.store.removeSync(STORE_KEY);
1898
- if (this.cookies) deleteCookie(STORE_KEY, this.cookieDomain());
2080
+ this.kept.clear();
1899
2081
  }
1900
2082
  /** Writes the cookie half once storage becomes allowed (the localStorage half moves with the store). */
1901
2083
  persistCookie(now = Date.now()) {
1902
- const raw = this.store.getSync(STORE_KEY);
1903
- if (!raw || !this.cookies || !this.store.isPersistent) return;
1904
- try {
1905
- const parsed = JSON.parse(raw);
1906
- if (parsed.exp > now) writeCookie(STORE_KEY, parsed.id, (parsed.exp - now) / 1e3, this.cookieDomain());
1907
- } catch {
1908
- }
1909
- }
1910
- write(id, now) {
1911
- const record = { id, exp: now + this.maxAgeMs };
1912
- this.store.setSync(STORE_KEY, JSON.stringify(record));
1913
- if (this.cookies && this.store.isPersistent) writeCookie(STORE_KEY, id, this.maxAgeMs / 1e3, this.cookieDomain());
2084
+ this.kept.persistCookie(now);
1914
2085
  }
1915
2086
  };
1916
2087
 
@@ -1933,6 +2104,7 @@ var TraqioWeb = class {
1933
2104
  this.core = new import_core.Client();
1934
2105
  this.store = null;
1935
2106
  this.trackIds = null;
2107
+ this.sources = null;
1936
2108
  this.waitForConsent = false;
1937
2109
  this.started = false;
1938
2110
  }
@@ -1953,8 +2125,11 @@ var TraqioWeb = class {
1953
2125
  const consent = (_a = opts.consent) != null ? _a : this.earlyConsent;
1954
2126
  const persistent = !this.waitForConsent || consent === true;
1955
2127
  this.store = new BrowserStore(persistent, cookieDomain, cookies);
1956
- this.trackIds = new TrackIdKeeper(this.store, ((_b = opts.trackIdDays) != null ? _b : DEFAULT_TRACK_ID_DAYS) * DAY_MS, cookieDomain, cookies);
2128
+ const keepMs = ((_b = opts.trackIdDays) != null ? _b : DEFAULT_TRACK_ID_DAYS) * DAY_MS;
2129
+ this.trackIds = new TrackIdKeeper(this.store, keepMs, cookieDomain, cookies);
1957
2130
  this.trackIds.capture(location.href);
2131
+ this.sources = new SourceKeeper(this.store, keepMs, cookieDomain, cookies);
2132
+ this.sources.capture(location.href, document.referrer);
1958
2133
  if (!this.store.getSync(DEVICE_ID_KEY)) {
1959
2134
  const id = randomId();
1960
2135
  if (id) this.store.setSync(DEVICE_ID_KEY, id);
@@ -1992,12 +2167,13 @@ var TraqioWeb = class {
1992
2167
  * stored on the device.
1993
2168
  */
1994
2169
  async setConsent(granted) {
1995
- var _a;
2170
+ var _a, _b;
1996
2171
  if (!this.started) this.earlyConsent = granted;
1997
2172
  if (this.store && this.waitForConsent) {
1998
2173
  if (granted) {
1999
2174
  this.store.enable();
2000
2175
  (_a = this.trackIds) == null ? void 0 : _a.persistCookie();
2176
+ (_b = this.sources) == null ? void 0 : _b.persistCookie();
2001
2177
  } else {
2002
2178
  this.store.disable();
2003
2179
  }
@@ -2013,15 +2189,29 @@ var TraqioWeb = class {
2013
2189
  var _a, _b;
2014
2190
  return (_b = (_a = this.trackIds) == null ? void 0 : _a.get()) != null ? _b : null;
2015
2191
  }
2192
+ /**
2193
+ * Where the visitor came from when no Traqio link brought them — the landing's
2194
+ * `utm_*`, an ad network's click id (`gclid`, `fbclid`, `ttclid`), the referring
2195
+ * site — or null. Kept in the `traq_src` cookie your backend reads with the
2196
+ * sign-up (`@traqio/node`: `sourceFromRequest(req)`); pass this to it instead
2197
+ * when your backend is on another domain. A Traqio link click wins over it.
2198
+ */
2199
+ getSource() {
2200
+ var _a, _b;
2201
+ return (_b = (_a = this.sources) == null ? void 0 : _a.get()) != null ? _b : null;
2202
+ }
2016
2203
  /**
2017
2204
  * GDPR erasure from the page: the server deletes what it holds about this browser
2018
2205
  * and user, and this SDK stops sending and forgets the trackID. Irreversible.
2019
2206
  * Resolves false when the request did not reach the server — then nothing changed.
2020
2207
  */
2021
2208
  async forgetMe() {
2022
- var _a;
2209
+ var _a, _b;
2023
2210
  const ok = await this.core.forgetMe();
2024
- if (ok) (_a = this.trackIds) == null ? void 0 : _a.clear();
2211
+ if (ok) {
2212
+ (_a = this.trackIds) == null ? void 0 : _a.clear();
2213
+ (_b = this.sources) == null ? void 0 : _b.clear();
2214
+ }
2025
2215
  return ok;
2026
2216
  }
2027
2217
  /** Send what is queued now. Already wired to tab hide and page exit. */