@hanzo/event 0.3.49 → 0.3.50
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/core.d.ts.map +1 -1
- package/dist/index.cjs +29 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +29 -8
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +8 -7
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +8 -7
- package/dist/react.mjs.map +1 -1
- package/dist/tags.d.ts +8 -0
- package/dist/tags.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core.test.ts +5 -5
- package/src/core.ts +15 -17
- package/src/index.ts +1 -1
- package/src/org.test.ts +9 -0
- package/src/org.ts +1 -1
- package/src/tags.ts +28 -0
package/dist/react.cjs
CHANGED
|
@@ -106,7 +106,7 @@ var ORG_DOMAIN = Object.freeze({
|
|
|
106
106
|
zoo: Object.freeze(["zoo.ngo", "zoo.network", "zoolabs.id", "zoolabs.io"])
|
|
107
107
|
});
|
|
108
108
|
var ORG_KEY = Object.freeze({
|
|
109
|
-
hanzo: "pk-
|
|
109
|
+
hanzo: "pk-CmfLA2K6kvsPflrS9DSkt06H_kSoQB_21sjedt6VJdc",
|
|
110
110
|
lux: "pk-gUZp6ZVfhJzSwK-rb4oLbVkpCnMBx5uSCpxf_5yEhQk",
|
|
111
111
|
zoo: "pk-3TKpKnERV9AQSsBUERWkZejC1O1mUxc1jRzsP3MPbs4"
|
|
112
112
|
});
|
|
@@ -623,7 +623,7 @@ function stripLink(href) {
|
|
|
623
623
|
}
|
|
624
624
|
|
|
625
625
|
// package.json
|
|
626
|
-
var version = "0.3.
|
|
626
|
+
var version = "0.3.50";
|
|
627
627
|
|
|
628
628
|
// src/version.ts
|
|
629
629
|
var VERSION = version;
|
|
@@ -647,6 +647,7 @@ function normalizeError2(err) {
|
|
|
647
647
|
const frames = framesFromStack(n.stack).slice(-50).map((f) => ({ function: f.function, file: f.filename, line: f.lineno, column: f.colno }));
|
|
648
648
|
return { type: n.name, message: n.message, stack: n.stack, frames };
|
|
649
649
|
}
|
|
650
|
+
var viewport = () => isBrowser() ? { screen: `${window.screen?.width ?? 0}x${window.screen?.height ?? 0}`, language: navigator.language || "" } : {};
|
|
650
651
|
var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
651
652
|
function serializeBatch(batch) {
|
|
652
653
|
try {
|
|
@@ -681,13 +682,13 @@ var DefaultTransport = class {
|
|
|
681
682
|
}
|
|
682
683
|
}
|
|
683
684
|
if (typeof fetch !== "function") return;
|
|
684
|
-
const simple = opts.ingestKey !== void 0 && opts.contentType === void 0;
|
|
685
|
+
const simple = opts.ingestKey !== void 0 && opts.token === void 0 && opts.contentType === void 0;
|
|
685
686
|
const headers = {
|
|
686
687
|
"Content-Type": simple ? BEACON_CONTENT_TYPE : opts.contentType ?? "application/json"
|
|
687
688
|
};
|
|
688
|
-
const bearer = simple ? void 0 : opts.
|
|
689
|
+
const bearer = simple ? void 0 : opts.token ?? opts.ingestKey;
|
|
689
690
|
if (bearer) headers.Authorization = `Bearer ${bearer}`;
|
|
690
|
-
void fetch(
|
|
691
|
+
void fetch(opts.ingestKey ? appendQuery(url, "ingest_key", opts.ingestKey) : url, {
|
|
691
692
|
method: "POST",
|
|
692
693
|
headers,
|
|
693
694
|
body,
|
|
@@ -827,7 +828,7 @@ var Analytics = class {
|
|
|
827
828
|
const view = (p ?? "") + "\0" + (isBrowser() ? window.location.href : "");
|
|
828
829
|
if (view === this.counted) return;
|
|
829
830
|
this.counted = view;
|
|
830
|
-
this.enqueue("pageview", events.PAGEVIEW, { path: p, properties });
|
|
831
|
+
this.enqueue("pageview", events.PAGEVIEW, { path: p, properties: { ...viewport(), ...properties } });
|
|
831
832
|
}
|
|
832
833
|
/** capture records a named product event with optional properties. Commerce
|
|
833
834
|
* fields (productId/quantity/revenue/currency) may be passed for order events. */
|
|
@@ -883,7 +884,7 @@ var Analytics = class {
|
|
|
883
884
|
this.queue = [];
|
|
884
885
|
this.clearTimer();
|
|
885
886
|
const token = this.cfg.getToken?.() ?? void 0;
|
|
886
|
-
const key =
|
|
887
|
+
const key = this.cfg.ingestKey?.trim() || void 0;
|
|
887
888
|
const useBeacon = beacon && !token;
|
|
888
889
|
const body = serializeBatch(batch);
|
|
889
890
|
if (body === null) {
|