@hanzo/event 0.3.38 → 0.3.40

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 hanzo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/core.d.ts CHANGED
@@ -94,6 +94,19 @@ export declare class Analytics {
94
94
  private schedule;
95
95
  private clearTimer;
96
96
  }
97
+ /** resetClients drops the page's clients, so the next `createAnalytics` for a
98
+ * stream builds a fresh one.
99
+ *
100
+ * A real page loads once and never needs this. A TEST RUNNER is what it exists
101
+ * for: one document, many mounts, each meant to be its own page. The second one
102
+ * gets a client that already counted this location, so its pageview is
103
+ * correctly suppressed and the suite reads it as "nothing was emitted".
104
+ *
105
+ * It is exported so a suite calls this instead of reaching for the slot itself.
106
+ * A consumer that deletes the registry from its own code path takes the
107
+ * guarantee with it: `<Provider/>` unmount/remount is not a new page, and the
108
+ * fresh client it would get counts the same view again. */
109
+ export declare function resetClients(): void;
97
110
  /** createAnalytics returns the client for a stream, building it on first ask.
98
111
  * This is the ONE way to get a client: `new Analytics` bypasses the registry
99
112
  * and is for tests and for a deliberately separate instance. */
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AA2DA,OAAO,EAGL,aAAa,EAEb,SAAS,EAEV,MAAM,WAAW,CAAA;AAElB,OAAO,KAAK,EACV,eAAe,EAEf,mBAAmB,EACnB,MAAM,EAKN,SAAS,EACV,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,CAAA;AA2KlB,qBAAa,SAAS;IACpB,OAAO,CAAC,GAAG,CAGM;IACjB,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,QAAQ,CAAC,CAAQ;IACzB,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAQ;IACvB,0DAA0D;IAC1D,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,+DAA+D;IAC/D,OAAO,CAAC,GAAG,CAAY;IACvB,6EAA6E;IAC7E,OAAO,CAAC,SAAS,CAAQ;IAEzB,YAAY,MAAM,EAAE,eAAe,EAwClC;IAED;;;;8EAI0E;IAC1E,KAAK,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAQnC;IAED;;;mEAG+D;IAC/D,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED;4CACwC;IACxC,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED;;;kBAGc;IACd,IAAI,IAAI,IAAI,CAgCX;IAED,6EAA6E;IAC7E,QAAQ,CAAC,QA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CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAclE;IAED;uFACmF;IACnF,OAAO,CACL,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,QAAQ,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,GAC5E,IAAI,CAEN;IAED;;;;;;;;;;;;;0BAasB;IACtB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAuD9D;IAED;kCAC8B;IAC9B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE7B;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,UAAQ,GAAG,IAAI,CAmC1B;IAID;;;;;6CAKyC;IACzC,OAAO,CAAC,SAAS;IAiBjB;sEACkE;IAClE,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,KAAK;IA+Db,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,UAAU;CAMnB;AAiCD;;;;;;;;;;;4DAW4D;AAC5D,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAED;;iEAEiE;AACjE,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAmBlE;AAID,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAA"}
package/dist/index.cjs CHANGED
@@ -391,8 +391,11 @@ function uuidv7Time(id) {
391
391
  return parseInt(id.slice(0, 8) + id.slice(9, 13), 16);
392
392
  }
393
393
 
394
+ // package.json
395
+ var version = "0.3.40";
396
+
394
397
  // src/version.ts
395
- var VERSION = "0.3.37";
398
+ var VERSION = version;
396
399
 
397
400
  // src/sentry.ts
398
401
  var MAX_FRAMES = 50;
@@ -1139,6 +1142,10 @@ function registry() {
1139
1142
  g[CLIENTS] = fresh;
1140
1143
  return fresh;
1141
1144
  }
1145
+ function resetClients() {
1146
+ const g = globalThis;
1147
+ delete g[CLIENTS];
1148
+ }
1142
1149
  function createAnalytics(config) {
1143
1150
  if (!isBrowser() || config.enabled === false) return new Analytics(config);
1144
1151
  const key = (config.host ?? DEFAULT_HOST) + "\0" + config.product;
@@ -1265,6 +1272,7 @@ exports.orgOf = orgOf;
1265
1272
  exports.parseAttribution = parseAttribution;
1266
1273
  exports.parseDsn = parseDsn;
1267
1274
  exports.redactSecrets = redactSecrets;
1275
+ exports.resetClients = resetClients;
1268
1276
  exports.scrubPII = scrubPII;
1269
1277
  exports.scrubText = scrubText;
1270
1278
  exports.uuidv7 = hzUuidv7;