@account-kit/logging
Advanced tools
Comparing version 4.3.0 to 4.3.1
import { AnalyticsBrowser } from "@segment/analytics-next"; | ||
import { uuid } from "uuidv4"; | ||
import { v4 as uuid } from "uuid"; | ||
import { WRITE_IN_DEV } from "./_writeKey.js"; | ||
@@ -28,2 +28,7 @@ import { fetchRemoteWriteKey } from "./fetchRemoteWriteKey.js"; | ||
analytics.debug(isDev); | ||
if (isDev) { | ||
// Super weird behaviour, but if I don't add some kind of log here, | ||
// then I don't actually get logs in the console | ||
console.log(`[Metrics] metrics initialized for ${context.package}`); | ||
} | ||
// This lets us log events in the console | ||
@@ -58,6 +63,11 @@ if (isDev) { | ||
ready, | ||
anonId, | ||
}, | ||
trackEvent: async ({ name, data }) => { | ||
if (!(await writeKey)) { | ||
return noopLogger.trackEvent({ name, data }); | ||
return noopLogger.trackEvent({ | ||
name, | ||
// @ts-expect-error | ||
data, | ||
}); | ||
} | ||
@@ -64,0 +74,0 @@ await analytics.track(name, { ...data, ...context }); |
@@ -5,4 +5,5 @@ export const noopLogger = { | ||
ready: Promise.resolve(), | ||
anonId: "", | ||
}, | ||
}; | ||
//# sourceMappingURL=noop.js.map |
@@ -11,3 +11,5 @@ export type EventsSchema = readonly { | ||
name: Schema[K]["EventName"]; | ||
} & (Schema[K]["EventData"] extends undefined ? { | ||
} & ([undefined] extends [ | ||
Schema[K]["EventData"] | ||
] ? { | ||
data?: undefined; | ||
@@ -23,2 +25,3 @@ } : { | ||
ready: Promise<unknown>; | ||
anonId: string; | ||
}; | ||
@@ -25,0 +28,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "4.3.0"; | ||
export declare const VERSION = "4.3.1"; |
// This file is autogenerated by inject-version.ts. Any changes will be | ||
// overwritten on commit! | ||
export const VERSION = "4.3.0"; | ||
export const VERSION = "4.3.1"; | ||
//# sourceMappingURL=version.js.map |
@@ -11,3 +11,5 @@ export type EventsSchema = readonly { | ||
name: Schema[K]["EventName"]; | ||
} & (Schema[K]["EventData"] extends undefined ? { | ||
} & ([undefined] extends [ | ||
Schema[K]["EventData"] | ||
] ? { | ||
data?: undefined; | ||
@@ -23,2 +25,3 @@ } : { | ||
ready: Promise<unknown>; | ||
anonId: string; | ||
}; | ||
@@ -25,0 +28,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "4.3.0"; | ||
export declare const VERSION = "4.3.1"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "@account-kit/logging", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "Core logging library for Account Kit packages", | ||
@@ -62,5 +62,5 @@ "author": "Alchemy", | ||
"@segment/analytics-next": "^1.74.0", | ||
"uuidv4": "^6.2.13" | ||
"uuid": "^11.0.2" | ||
}, | ||
"gitHead": "78c86103afeee309748c9d604af58bc7707c8b16" | ||
"gitHead": "68052c506336d4c7eee1d2ee78e9b07892488351" | ||
} |
import { AnalyticsBrowser } from "@segment/analytics-next"; | ||
import { uuid } from "uuidv4"; | ||
import { v4 as uuid } from "uuid"; | ||
import { WRITE_IN_DEV } from "./_writeKey.js"; | ||
@@ -36,2 +36,8 @@ import { fetchRemoteWriteKey } from "./fetchRemoteWriteKey.js"; | ||
if (isDev) { | ||
// Super weird behaviour, but if I don't add some kind of log here, | ||
// then I don't actually get logs in the console | ||
console.log(`[Metrics] metrics initialized for ${context.package}`); | ||
} | ||
// This lets us log events in the console | ||
@@ -72,6 +78,11 @@ if (isDev) { | ||
ready, | ||
anonId, | ||
}, | ||
trackEvent: async ({ name, data }) => { | ||
if (!(await writeKey)) { | ||
return noopLogger.trackEvent({ name, data }); | ||
return noopLogger.trackEvent({ | ||
name, | ||
// @ts-expect-error | ||
data, | ||
}); | ||
} | ||
@@ -78,0 +89,0 @@ |
@@ -7,3 +7,4 @@ import type { InnerLogger } from "./types"; | ||
ready: Promise.resolve(), | ||
anonId: "", | ||
}, | ||
}; |
@@ -12,3 +12,5 @@ export type EventsSchema = readonly { | ||
[K in keyof Schema]: Prettify< | ||
{ name: Schema[K]["EventName"] } & (Schema[K]["EventData"] extends undefined | ||
{ name: Schema[K]["EventName"] } & ([undefined] extends [ | ||
Schema[K]["EventData"] | ||
] | ||
? { data?: undefined } | ||
@@ -29,2 +31,3 @@ : { data: Schema[K]["EventData"] }) | ||
ready: Promise<unknown>; | ||
anonId: string; | ||
}; | ||
@@ -31,0 +34,0 @@ } |
// This file is autogenerated by inject-version.ts. Any changes will be | ||
// overwritten on commit! | ||
export const VERSION = "4.3.0"; | ||
export const VERSION = "4.3.1"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45538
654
+ Addeduuid@^11.0.2
+ Addeduuid@11.0.5(transitive)
- Removeduuidv4@^6.2.13
- Removed@types/uuid@8.3.4(transitive)
- Removeduuid@8.3.2(transitive)
- Removeduuidv4@6.2.13(transitive)