New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@threekit/analytics

Package Overview
Dependencies
Maintainers
0
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@threekit/analytics - npm Package Compare versions

Comparing version 0.1.103 to 0.1.105

6

dist/sessions/Session.d.ts

@@ -27,2 +27,5 @@ import { ARStage, type AssetOption, Configuration, type Context, OptionInteractionType, OptionsType, PlayerType, type QuizOption, ShareType, type ThreekitAuthProps, type ValueOption, VisualInteractionType } from '@threekit/rest-api';

private pageLoadTime;
private debounceTimeout;
private eventDebounceTimers;
private eventsToDebounce;
log: boolean;

@@ -38,5 +41,6 @@ constructor({ auth, sessionId, userId, experienceName, experienceVersion, customUserId }: SessionProps);

errorLoopProtection: boolean;
private reportEvent;
private sendEvent;
errorCount: number;
maxErrorCount: number;
private reportEvent;
error({ error }: {

@@ -43,0 +47,0 @@ error: Error;

@@ -18,2 +18,13 @@ import { errorToString } from '@threekit/diagnostics';

pageLoadTime = 0;
debounceTimeout = 500;
eventDebounceTimers = new Map();
eventsToDebounce = new Set([
Event2Type.OptionInteraction,
Event2Type.Change,
Event2Type.ParametricValue,
Event2Type.PersonalizeText,
Event2Type.Error,
Event2Type.Stage,
Event2Type.VisualInteraction
]);
log = false;

@@ -112,3 +123,3 @@ constructor({ auth, sessionId = uuid.v4(), userId = uuid.v4(), experienceName, experienceVersion, customUserId }) {

// never await on this function! let it run in the background
reportEvent(event) {
sendEvent(event) {
// ensure we don't get in a recursive loop of errors

@@ -130,2 +141,16 @@ if (this.errorLoopProtection) {

maxErrorCount = 10;
reportEvent(event) {
if (!this.eventsToDebounce.has(event.eventType)) {
return this.sendEvent(event);
}
// otherwise debounce event, based on ChatGPT strategy here: https://chatgpt.com/share/e/de565b81-b8b0-4380-ab65-611454b0525d
if (this.eventDebounceTimers.has(event.eventType)) {
clearTimeout(this.eventDebounceTimers.get(event.eventType));
}
const timer = setTimeout(() => {
this.sendEvent(event);
this.eventDebounceTimers.delete(event.eventType); // Clean up after sending
}, this.debounceTimeout);
this.eventDebounceTimers.set(event.eventType, timer);
}
error({ error }) {

@@ -132,0 +157,0 @@ // ensure we don't spam the service with repeated errors when things are in a bad state

6

package.json
{
"name": "@threekit/analytics",
"version": "0.1.103",
"version": "0.1.105",
"type": "module",

@@ -9,7 +9,7 @@ "main": "dist/index.js",

"@threekit/diagnostics": "*",
"@threekit/rest-api": "^0.1.103",
"@threekit/rest-api": "^0.1.105",
"uuid": "^9.0.1"
},
"sideEffects": false,
"gitHead": "9a00149f48c3755dd5606d64739eb6b4411ef453"
"gitHead": "22c5d5b8d3eb89d4b9f8a92e911beeb440aec664"
}

@@ -9,4 +9,4 @@ {

"format": {},
"test": {}
"test:jest": {}
}
}

@@ -68,2 +68,15 @@ import { errorToString } from '@threekit/diagnostics';

private debounceTimeout = 500;
private eventDebounceTimers: Map<string, ReturnType<typeof setTimeout>> =
new Map();
private eventsToDebounce = new Set([
Event2Type.OptionInteraction,
Event2Type.Change,
Event2Type.ParametricValue,
Event2Type.PersonalizeText,
Event2Type.Error,
Event2Type.Stage,
Event2Type.VisualInteraction
]);
public log = false;

@@ -194,3 +207,3 @@

// never await on this function! let it run in the background
private reportEvent(event: Event2) {
private sendEvent(event: Event2) {
// ensure we don't get in a recursive loop of errors

@@ -216,2 +229,20 @@ if (this.errorLoopProtection) {

private reportEvent(event: Event2) {
if (!this.eventsToDebounce.has(event.eventType)) {
return this.sendEvent(event);
}
// otherwise debounce event, based on ChatGPT strategy here: https://chatgpt.com/share/e/de565b81-b8b0-4380-ab65-611454b0525d
if (this.eventDebounceTimers.has(event.eventType)) {
clearTimeout(this.eventDebounceTimers.get(event.eventType));
}
const timer = setTimeout(() => {
this.sendEvent(event);
this.eventDebounceTimers.delete(event.eventType); // Clean up after sending
}, this.debounceTimeout);
this.eventDebounceTimers.set(event.eventType, timer);
}
error({ error }: { error: Error }) {

@@ -218,0 +249,0 @@ // ensure we don't spam the service with repeated errors when things are in a bad state

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc