@spatialwalk/avatarkit 1.0.0-beta.41 → 1.0.0-beta.43

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/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0-beta.43] - 2025-12-29
9
+
10
+ ### 🔧 Improvements
11
+ - Remove some unnecessary telemetry reporting
12
+
13
+ ## [1.0.0-beta.42] - 2025-12-29
14
+
15
+ ### ✨ New Features
16
+ - **PostHog Telemetry Configuration** - PostHog telemetry reporting now supports separate configuration for domestic (CN) and international (INTL) environments:
17
+ - Separate PostHog hosts and API keys for CN and INTL environments
18
+ - Compression disabled for domestic self-hosted instance, enabled for international official PostHog
19
+ - Localhost domain filtering to avoid test data pollution
20
+
8
21
  ## [1.0.0-beta.41] - 2025-12-29
9
22
 
10
23
  ### 🔄 Breaking Changes
package/README.md CHANGED
@@ -49,6 +49,7 @@ const configuration: Configuration = {
49
49
  channelCount: 1, // Fixed to 1 (mono)
50
50
  sampleRate: 16000 // Supported: 8000, 16000, 22050, 24000, 32000, 44100, 48000 Hz
51
51
  }
52
+ // characterApiBaseUrl: 'https://custom-api.example.com' // Optional, internal debug config, can be ignored
52
53
  }
53
54
 
54
55
  await AvatarSDK.initialize('your-app-id', configuration)
@@ -450,6 +451,7 @@ interface Configuration {
450
451
  drivingServiceMode?: DrivingServiceMode // Optional, default is 'sdk' (SDK mode)
451
452
  logLevel?: LogLevel // Optional, default is 'off' (no logs)
452
453
  audioFormat?: AudioFormat // Optional, default is { channelCount: 1, sampleRate: 16000 }
454
+ characterApiBaseUrl?: string // Optional, internal debug config, can be ignored
453
455
  }
454
456
 
455
457
  interface AudioFormat {
@@ -488,6 +490,7 @@ enum LogLevel {
488
490
  - `sampleRate`: Audio sample rate in Hz (default: 16000)
489
491
  - Supported values: 8000, 16000, 22050, 24000, 32000, 44100, 48000
490
492
  - The configured sample rate will be used for both audio recording and playback
493
+ - `characterApiBaseUrl`: Internal debug config, can be ignored
491
494
  - `sessionToken`: Set separately via `AvatarSDK.setSessionToken()`, not in Configuration
492
495
 
493
496
  ```typescript
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-CRKYjlwp.js";
4
+ import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-DiAM42qy.js";
5
5
  class StreamingAudioPlayer {
6
6
  constructor(options) {
7
7
  __publicField(this, "audioContext", null);
@@ -334,67 +334,6 @@ class StreamingAudioPlayer {
334
334
  audioContextState: this.audioContext.state
335
335
  });
336
336
  }
337
- seek(targetTime, referenceAudioContextTime) {
338
- if (!this.audioContext) {
339
- logger.warn("[StreamingAudioPlayer] Cannot seek: AudioContext not initialized");
340
- return;
341
- }
342
- if (this.isPaused && this.audioContext.state === "suspended") {
343
- this.audioContext.resume().catch(() => {
344
- });
345
- this.isPaused = false;
346
- }
347
- for (const source of this.activeSources) {
348
- source.onended = null;
349
- try {
350
- source.stop(0);
351
- } catch {
352
- }
353
- try {
354
- source.disconnect();
355
- } catch {
356
- }
357
- }
358
- this.activeSources.clear();
359
- let accumulatedDuration = 0;
360
- let targetChunkIndex = 0;
361
- let targetChunkOffset = 0;
362
- for (let i = 0; i < this.audioChunks.length; i++) {
363
- const chunk = this.audioChunks[i];
364
- const chunkDuration = chunk.data.length / (this.sampleRate * this.channelCount * 2);
365
- if (accumulatedDuration + chunkDuration >= targetTime) {
366
- targetChunkIndex = i;
367
- targetChunkOffset = targetTime - accumulatedDuration;
368
- break;
369
- }
370
- accumulatedDuration += chunkDuration;
371
- }
372
- if (targetTime >= accumulatedDuration) {
373
- targetChunkIndex = this.audioChunks.length;
374
- targetChunkOffset = 0;
375
- }
376
- this.scheduledChunks = targetChunkIndex;
377
- this.scheduledChunkInfo = [];
378
- const currentAudioTime = referenceAudioContextTime ?? this.audioContext.currentTime;
379
- this.sessionStartTime = currentAudioTime - targetTime;
380
- this.scheduledTime = currentAudioTime;
381
- if (targetChunkOffset > 0 && targetChunkIndex < this.audioChunks.length) {
382
- const offsetSamples = Math.floor(targetChunkOffset * this.sampleRate * this.channelCount * 2);
383
- if (offsetSamples > 0 && offsetSamples < this.audioChunks[targetChunkIndex].data.length) {
384
- this.audioChunks[targetChunkIndex].data = this.audioChunks[targetChunkIndex].data.slice(offsetSamples);
385
- }
386
- }
387
- if (this.isPlaying && !this.isPaused) {
388
- this.scheduleAllChunks();
389
- }
390
- this.log("Seeked to position", {
391
- targetTime,
392
- targetChunkIndex,
393
- targetChunkOffset,
394
- scheduledChunks: this.scheduledChunks,
395
- sessionStartTime: this.sessionStartTime
396
- });
397
- }
398
337
  stop() {
399
338
  if (!this.audioContext) {
400
339
  return;
@@ -43,7 +43,6 @@ export declare class StreamingAudioPlayer {
43
43
  getAudioContextTime(): number;
44
44
  pause(): void;
45
45
  resume(): Promise<void>;
46
- seek(targetTime: number, referenceAudioContextTime?: number): void;
47
46
  stop(): void;
48
47
  setAutoStart(enabled: boolean): void;
49
48
  play(): void;
@@ -1,7 +1,15 @@
1
- export declare const POSTHOG_HOST: string;
2
- export declare const POSTHOG_API_KEY: string;
1
+ import { Environment } from '../types';
2
+ export declare const POSTHOG_HOST_CN: string;
3
+ export declare const POSTHOG_API_KEY_CN: string;
4
+ export declare const POSTHOG_HOST_INTL: string;
5
+ export declare const POSTHOG_API_KEY_INTL: string;
3
6
  export declare const POSTHOG_TRACK_EVENTS: boolean;
4
7
  export declare const POSTHOG_PROJECT_NAME: string;
8
+ export declare function getPostHogConfig(environment: Environment): {
9
+ host: string;
10
+ apiKey: string;
11
+ disableCompression: boolean;
12
+ };
5
13
  export declare const ENV_TEST: boolean;
6
14
 
7
15
  export declare function isDebugMode(): boolean;
@@ -1253,9 +1253,101 @@ function base64FromBytes$1(arr) {
1253
1253
  function isSet$1(value) {
1254
1254
  return value !== null && value !== void 0;
1255
1255
  }
1256
- const POSTHOG_HOST = "https://i.spatialwalk.ai";
1257
- const POSTHOG_API_KEY = "phc_IFTLa6Z6VhTaNvsxB7klvG2JeNwcSpnnwz8YvZRC96Q";
1256
+ var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
1257
+ ResourceType2["CAMERA"] = "camera";
1258
+ ResourceType2["ANIMATION_IDLE"] = "frameIdle";
1259
+ ResourceType2["MODEL_SHAPE"] = "shape";
1260
+ ResourceType2["MODEL_GS"] = "gsStandard";
1261
+ return ResourceType2;
1262
+ })(ResourceType || {});
1263
+ function extractResourceUrls(meta) {
1264
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
1265
+ return {
1266
+ ["camera"]: ((_b = (_a = meta.camera) == null ? void 0 : _a.resource) == null ? void 0 : _b.remote) || null,
1267
+ ["frameIdle"]: ((_e2 = (_d = (_c = meta.animations) == null ? void 0 : _c.frameIdle) == null ? void 0 : _d.resource) == null ? void 0 : _e2.remote) || null,
1268
+ ["shape"]: ((_h = (_g = (_f = meta.models) == null ? void 0 : _f.shape) == null ? void 0 : _g.resource) == null ? void 0 : _h.remote) || null,
1269
+ ["gsStandard"]: ((_k = (_j = (_i2 = meta.models) == null ? void 0 : _i2.gsStandard) == null ? void 0 : _j.resource) == null ? void 0 : _k.remote) || null
1270
+ };
1271
+ }
1272
+ var Environment = /* @__PURE__ */ ((Environment2) => {
1273
+ Environment2["cn"] = "cn";
1274
+ Environment2["intl"] = "intl";
1275
+ return Environment2;
1276
+ })(Environment || {});
1277
+ var DrivingServiceMode = /* @__PURE__ */ ((DrivingServiceMode2) => {
1278
+ DrivingServiceMode2["sdk"] = "sdk";
1279
+ DrivingServiceMode2["host"] = "host";
1280
+ return DrivingServiceMode2;
1281
+ })(DrivingServiceMode || {});
1282
+ var LogLevel$1 = /* @__PURE__ */ ((LogLevel2) => {
1283
+ LogLevel2["off"] = "off";
1284
+ LogLevel2["error"] = "error";
1285
+ LogLevel2["warning"] = "warning";
1286
+ LogLevel2["all"] = "all";
1287
+ return LogLevel2;
1288
+ })(LogLevel$1 || {});
1289
+ var LoadProgress = /* @__PURE__ */ ((LoadProgress2) => {
1290
+ LoadProgress2["downloading"] = "downloading";
1291
+ LoadProgress2["completed"] = "completed";
1292
+ LoadProgress2["failed"] = "failed";
1293
+ return LoadProgress2;
1294
+ })(LoadProgress || {});
1295
+ var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
1296
+ ConnectionState2["disconnected"] = "disconnected";
1297
+ ConnectionState2["connecting"] = "connecting";
1298
+ ConnectionState2["connected"] = "connected";
1299
+ ConnectionState2["failed"] = "failed";
1300
+ return ConnectionState2;
1301
+ })(ConnectionState || {});
1302
+ var ConversationState = /* @__PURE__ */ ((ConversationState2) => {
1303
+ ConversationState2["idle"] = "idle";
1304
+ ConversationState2["playing"] = "playing";
1305
+ ConversationState2["pausing"] = "pausing";
1306
+ return ConversationState2;
1307
+ })(ConversationState || {});
1308
+ var AvatarState = /* @__PURE__ */ ((AvatarState2) => {
1309
+ AvatarState2["idle"] = "idle";
1310
+ AvatarState2["active"] = "active";
1311
+ AvatarState2["playing"] = "playing";
1312
+ AvatarState2["paused"] = "paused";
1313
+ return AvatarState2;
1314
+ })(AvatarState || {});
1315
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
1316
+ ErrorCode2["appIDUnrecognized"] = "appIDUnrecognized";
1317
+ ErrorCode2["avatarIDUnrecognized"] = "avatarIDUnrecognized";
1318
+ ErrorCode2["sessionTokenInvalid"] = "sessionTokenInvalid";
1319
+ ErrorCode2["sessionTokenExpired"] = "sessionTokenExpired";
1320
+ ErrorCode2["failedToFetchAvatarMetadata"] = "failedToFetchAvatarMetadata";
1321
+ ErrorCode2["failedToDownloadAvatarAssets"] = "failedToDownloadAvatarAssets";
1322
+ return ErrorCode2;
1323
+ })(ErrorCode || {});
1324
+ class SPAvatarError extends Error {
1325
+ constructor(message, code) {
1326
+ super(message);
1327
+ this.code = code;
1328
+ this.name = "SPAvatarError";
1329
+ }
1330
+ }
1331
+ const POSTHOG_HOST_CN = "https://analytics.spatialwalk.top";
1332
+ const POSTHOG_API_KEY_CN = "phc_BwD9QedcHpUJ1j8XwALx2xPWQAswvELygU17J4XO5ZB";
1333
+ const POSTHOG_HOST_INTL = "https://i.spatialwalk.ai";
1334
+ const POSTHOG_API_KEY_INTL = "phc_IFTLa6Z6VhTaNvsxB7klvG2JeNwcSpnnwz8YvZRC96Q";
1258
1335
  const POSTHOG_PROJECT_NAME = "sdk";
1336
+ function getPostHogConfig(environment) {
1337
+ if (environment === Environment.cn) {
1338
+ return {
1339
+ host: POSTHOG_HOST_CN,
1340
+ apiKey: POSTHOG_API_KEY_CN,
1341
+ disableCompression: true
1342
+ };
1343
+ } else {
1344
+ return {
1345
+ host: POSTHOG_HOST_INTL,
1346
+ apiKey: POSTHOG_API_KEY_INTL,
1347
+ disableCompression: false
1348
+ };
1349
+ }
1350
+ }
1259
1351
  function hasDebugParam() {
1260
1352
  if (typeof window === "undefined") {
1261
1353
  return false;
@@ -6514,14 +6606,14 @@ const mix = (del = delimiter) => {
6514
6606
  };
6515
6607
  const posix = /* @__PURE__ */ mix(":");
6516
6608
  const win32 = /* @__PURE__ */ mix(";");
6517
- var LogLevel$1 = /* @__PURE__ */ ((LogLevel2) => {
6609
+ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
6518
6610
  LogLevel2[LogLevel2["Error"] = 0] = "Error";
6519
6611
  LogLevel2[LogLevel2["Warning"] = 1] = "Warning";
6520
6612
  LogLevel2[LogLevel2["Log"] = 2] = "Log";
6521
6613
  LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";
6522
6614
  LogLevel2[LogLevel2["Debug"] = 4] = "Debug";
6523
6615
  return LogLevel2;
6524
- })(LogLevel$1 || {});
6616
+ })(LogLevel || {});
6525
6617
  var LogLevelString = /* @__PURE__ */ ((LogLevelString2) => {
6526
6618
  LogLevelString2["Error"] = "error";
6527
6619
  LogLevelString2["Warning"] = "warn";
@@ -6581,18 +6673,18 @@ function createColors(enabled = isColorSupported) {
6581
6673
  }
6582
6674
  const pc = createColors();
6583
6675
  const logLevelStringToLogLevelMap = {
6584
- [LogLevelString.Error]: LogLevel$1.Error,
6585
- [LogLevelString.Warning]: LogLevel$1.Warning,
6586
- [LogLevelString.Log]: LogLevel$1.Log,
6587
- [LogLevelString.Verbose]: LogLevel$1.Verbose,
6588
- [LogLevelString.Debug]: LogLevel$1.Debug
6676
+ [LogLevelString.Error]: LogLevel.Error,
6677
+ [LogLevelString.Warning]: LogLevel.Warning,
6678
+ [LogLevelString.Log]: LogLevel.Log,
6679
+ [LogLevelString.Verbose]: LogLevel.Verbose,
6680
+ [LogLevelString.Debug]: LogLevel.Debug
6589
6681
  };
6590
6682
  const logLevelToLogLevelStringMap = {
6591
- [LogLevel$1.Error]: LogLevelString.Error,
6592
- [LogLevel$1.Warning]: LogLevelString.Warning,
6593
- [LogLevel$1.Log]: LogLevelString.Log,
6594
- [LogLevel$1.Verbose]: LogLevelString.Verbose,
6595
- [LogLevel$1.Debug]: LogLevelString.Debug
6683
+ [LogLevel.Error]: LogLevelString.Error,
6684
+ [LogLevel.Warning]: LogLevelString.Warning,
6685
+ [LogLevel.Log]: LogLevelString.Log,
6686
+ [LogLevel.Verbose]: LogLevelString.Verbose,
6687
+ [LogLevel.Debug]: LogLevelString.Debug
6596
6688
  };
6597
6689
  const availableLogLevelStrings = [
6598
6690
  LogLevelString.Error,
@@ -6602,18 +6694,18 @@ const availableLogLevelStrings = [
6602
6694
  LogLevelString.Debug
6603
6695
  ];
6604
6696
  const logLevelToColorMap = {
6605
- [LogLevel$1.Error]: pc.red,
6606
- [LogLevel$1.Warning]: pc.yellow,
6607
- [LogLevel$1.Log]: pc.blue,
6608
- [LogLevel$1.Verbose]: pc.cyan,
6609
- [LogLevel$1.Debug]: pc.green
6697
+ [LogLevel.Error]: pc.red,
6698
+ [LogLevel.Warning]: pc.yellow,
6699
+ [LogLevel.Log]: pc.blue,
6700
+ [LogLevel.Verbose]: pc.cyan,
6701
+ [LogLevel.Debug]: pc.green
6610
6702
  };
6611
6703
  const availableLogLevels = [
6612
- LogLevel$1.Error,
6613
- LogLevel$1.Warning,
6614
- LogLevel$1.Log,
6615
- LogLevel$1.Verbose,
6616
- LogLevel$1.Debug
6704
+ LogLevel.Error,
6705
+ LogLevel.Warning,
6706
+ LogLevel.Log,
6707
+ LogLevel.Verbose,
6708
+ LogLevel.Debug
6617
6709
  ];
6618
6710
  const availableFormats = [Format.JSON, Format.Pretty];
6619
6711
  function parseErrorStacks(errorLike) {
@@ -6773,19 +6865,19 @@ ${log.error.stack}`;
6773
6865
  return message;
6774
6866
  }
6775
6867
  function shouldOutputDebugLevelLogWhenLogLevelIsOneOf(logLevel) {
6776
- return logLevel >= LogLevel$1.Debug;
6868
+ return logLevel >= LogLevel.Debug;
6777
6869
  }
6778
6870
  function shouldOutputVerboseLevelLogWhenLogLevelIsOneOf(logLevel) {
6779
- return logLevel >= LogLevel$1.Verbose;
6871
+ return logLevel >= LogLevel.Verbose;
6780
6872
  }
6781
6873
  function shouldOutputLogLevelLogWhenLogLevelIsOneOf(logLevel) {
6782
- return logLevel >= LogLevel$1.Log;
6874
+ return logLevel >= LogLevel.Log;
6783
6875
  }
6784
6876
  function shouldOutputWarningLevelLogWhenLogLevelIsOneOf(logLevel) {
6785
- return logLevel >= LogLevel$1.Warning;
6877
+ return logLevel >= LogLevel.Warning;
6786
6878
  }
6787
6879
  function shouldOutputErrorLevelLogWhenLogLevelIsOneOf(logLevel) {
6788
- return logLevel >= LogLevel$1.Error;
6880
+ return logLevel >= LogLevel.Error;
6789
6881
  }
6790
6882
  function isBrowser() {
6791
6883
  return typeof window !== "undefined";
@@ -6798,7 +6890,7 @@ function withHyperlink(basePath, context) {
6798
6890
  }
6799
6891
  const GLOBAL_CONFIG = {
6800
6892
  configured: false,
6801
- logLevel: LogLevel$1.Debug,
6893
+ logLevel: LogLevel.Debug,
6802
6894
  format: Format.JSON,
6803
6895
  timeFormatter: (inputDate) => inputDate.toISOString()
6804
6896
  };
@@ -6827,7 +6919,7 @@ function createLogg(context) {
6827
6919
  const logObj = {
6828
6920
  fields: {},
6829
6921
  context,
6830
- logLevel: LogLevel$1.Debug,
6922
+ logLevel: LogLevel.Debug,
6831
6923
  format: Format.JSON,
6832
6924
  shouldUseGlobalConfig: false,
6833
6925
  errorProcessor: (err) => err,
@@ -7093,83 +7185,8 @@ function createLogger(context) {
7093
7185
  return createLogg(withHyperlink(basePath, context));
7094
7186
  }
7095
7187
  const useLogger = (context) => createLogger(context).useGlobalConfig();
7096
- var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
7097
- ResourceType2["CAMERA"] = "camera";
7098
- ResourceType2["ANIMATION_IDLE"] = "frameIdle";
7099
- ResourceType2["MODEL_SHAPE"] = "shape";
7100
- ResourceType2["MODEL_GS"] = "gsStandard";
7101
- return ResourceType2;
7102
- })(ResourceType || {});
7103
- function extractResourceUrls(meta) {
7104
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
7105
- return {
7106
- ["camera"]: ((_b = (_a = meta.camera) == null ? void 0 : _a.resource) == null ? void 0 : _b.remote) || null,
7107
- ["frameIdle"]: ((_e2 = (_d = (_c = meta.animations) == null ? void 0 : _c.frameIdle) == null ? void 0 : _d.resource) == null ? void 0 : _e2.remote) || null,
7108
- ["shape"]: ((_h = (_g = (_f = meta.models) == null ? void 0 : _f.shape) == null ? void 0 : _g.resource) == null ? void 0 : _h.remote) || null,
7109
- ["gsStandard"]: ((_k = (_j = (_i2 = meta.models) == null ? void 0 : _i2.gsStandard) == null ? void 0 : _j.resource) == null ? void 0 : _k.remote) || null
7110
- };
7111
- }
7112
- var Environment = /* @__PURE__ */ ((Environment2) => {
7113
- Environment2["cn"] = "cn";
7114
- Environment2["intl"] = "intl";
7115
- return Environment2;
7116
- })(Environment || {});
7117
- var DrivingServiceMode = /* @__PURE__ */ ((DrivingServiceMode2) => {
7118
- DrivingServiceMode2["sdk"] = "sdk";
7119
- DrivingServiceMode2["host"] = "host";
7120
- return DrivingServiceMode2;
7121
- })(DrivingServiceMode || {});
7122
- var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
7123
- LogLevel2["off"] = "off";
7124
- LogLevel2["error"] = "error";
7125
- LogLevel2["warning"] = "warning";
7126
- LogLevel2["all"] = "all";
7127
- return LogLevel2;
7128
- })(LogLevel || {});
7129
- var LoadProgress = /* @__PURE__ */ ((LoadProgress2) => {
7130
- LoadProgress2["downloading"] = "downloading";
7131
- LoadProgress2["completed"] = "completed";
7132
- LoadProgress2["failed"] = "failed";
7133
- return LoadProgress2;
7134
- })(LoadProgress || {});
7135
- var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
7136
- ConnectionState2["disconnected"] = "disconnected";
7137
- ConnectionState2["connecting"] = "connecting";
7138
- ConnectionState2["connected"] = "connected";
7139
- ConnectionState2["failed"] = "failed";
7140
- return ConnectionState2;
7141
- })(ConnectionState || {});
7142
- var ConversationState = /* @__PURE__ */ ((ConversationState2) => {
7143
- ConversationState2["idle"] = "idle";
7144
- ConversationState2["playing"] = "playing";
7145
- ConversationState2["pausing"] = "pausing";
7146
- return ConversationState2;
7147
- })(ConversationState || {});
7148
- var AvatarState = /* @__PURE__ */ ((AvatarState2) => {
7149
- AvatarState2["idle"] = "idle";
7150
- AvatarState2["active"] = "active";
7151
- AvatarState2["playing"] = "playing";
7152
- AvatarState2["paused"] = "paused";
7153
- return AvatarState2;
7154
- })(AvatarState || {});
7155
- var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
7156
- ErrorCode2["appIDUnrecognized"] = "appIDUnrecognized";
7157
- ErrorCode2["avatarIDUnrecognized"] = "avatarIDUnrecognized";
7158
- ErrorCode2["sessionTokenInvalid"] = "sessionTokenInvalid";
7159
- ErrorCode2["sessionTokenExpired"] = "sessionTokenExpired";
7160
- ErrorCode2["failedToFetchAvatarMetadata"] = "failedToFetchAvatarMetadata";
7161
- ErrorCode2["failedToDownloadAvatarAssets"] = "failedToDownloadAvatarAssets";
7162
- return ErrorCode2;
7163
- })(ErrorCode || {});
7164
- class SPAvatarError extends Error {
7165
- constructor(message, code) {
7166
- super(message);
7167
- this.code = code;
7168
- this.name = "SPAvatarError";
7169
- }
7170
- }
7171
7188
  {
7172
- setGlobalLogLevel(LogLevel$1.Warning);
7189
+ setGlobalLogLevel(LogLevel.Warning);
7173
7190
  }
7174
7191
  const logger = useLogger("Web").withErrorProcessor((err) => {
7175
7192
  captureErrorContext("error", err);
@@ -7178,7 +7195,7 @@ const logger = useLogger("Web").withErrorProcessor((err) => {
7178
7195
  let originalLogger = null;
7179
7196
  function setLogLevel(level) {
7180
7197
  switch (level) {
7181
- case LogLevel.off:
7198
+ case LogLevel$1.off:
7182
7199
  if (!originalLogger) {
7183
7200
  originalLogger = { ...logger };
7184
7201
  }
@@ -7197,33 +7214,33 @@ function setLogLevel(level) {
7197
7214
  }
7198
7215
  });
7199
7216
  break;
7200
- case LogLevel.error:
7217
+ case LogLevel$1.error:
7201
7218
  if (originalLogger) {
7202
7219
  Object.assign(logger, originalLogger);
7203
7220
  originalLogger = null;
7204
7221
  }
7205
- setGlobalLogLevel(LogLevel$1.Error);
7222
+ setGlobalLogLevel(LogLevel.Error);
7206
7223
  break;
7207
- case LogLevel.warning:
7224
+ case LogLevel$1.warning:
7208
7225
  if (originalLogger) {
7209
7226
  Object.assign(logger, originalLogger);
7210
7227
  originalLogger = null;
7211
7228
  }
7212
- setGlobalLogLevel(LogLevel$1.Warning);
7229
+ setGlobalLogLevel(LogLevel.Warning);
7213
7230
  break;
7214
- case LogLevel.all:
7231
+ case LogLevel$1.all:
7215
7232
  if (originalLogger) {
7216
7233
  Object.assign(logger, originalLogger);
7217
7234
  originalLogger = null;
7218
7235
  }
7219
- setGlobalLogLevel(LogLevel$1.Debug);
7236
+ setGlobalLogLevel(LogLevel.Debug);
7220
7237
  break;
7221
7238
  default:
7222
7239
  if (originalLogger) {
7223
7240
  Object.assign(logger, originalLogger);
7224
7241
  originalLogger = null;
7225
7242
  }
7226
- setGlobalLogLevel(LogLevel$1.Warning);
7243
+ setGlobalLogLevel(LogLevel.Warning);
7227
7244
  break;
7228
7245
  }
7229
7246
  }
@@ -7373,7 +7390,23 @@ let sdkVersion = "1.0.0";
7373
7390
  let currentEnvironment = null;
7374
7391
  let isInitialized = false;
7375
7392
  const FILTERED_HOSTNAMES = ["localhost", "127.0.0.1", "0.0.0.0"];
7393
+ function shouldFilterHostname() {
7394
+ if (typeof window === "undefined") {
7395
+ return false;
7396
+ }
7397
+ const hostname = window.location.hostname;
7398
+ return FILTERED_HOSTNAMES.includes(hostname);
7399
+ }
7376
7400
  function initializePostHog(environment, version) {
7401
+ if (shouldFilterHostname()) {
7402
+ logger.log(`[PostHog] Tracking disabled due to filtered hostname: ${window.location.hostname}`);
7403
+ return;
7404
+ }
7405
+ const { host, apiKey, disableCompression } = getPostHogConfig(environment);
7406
+ if (!apiKey) {
7407
+ logger.warn(`[PostHog] API Key not configured for environment: ${environment}, tracking disabled`);
7408
+ return;
7409
+ }
7377
7410
  if (isInitialized) {
7378
7411
  logger.log("[PostHog] Already initialized, skipping");
7379
7412
  return;
@@ -7382,14 +7415,17 @@ function initializePostHog(environment, version) {
7382
7415
  sdkVersion = version;
7383
7416
  try {
7384
7417
  const logContext = idManager.getLogContext();
7385
- Vo.init(POSTHOG_API_KEY, {
7386
- api_host: POSTHOG_HOST,
7418
+ Vo.init(apiKey, {
7419
+ api_host: host,
7387
7420
  name: POSTHOG_PROJECT_NAME,
7388
7421
  person_profiles: "identified_only",
7389
7422
  capture_pageview: false,
7390
7423
  capture_pageleave: false,
7424
+ disable_compression: disableCompression,
7425
+ disable_session_recording: true,
7426
+ autocapture: false,
7391
7427
  loaded: (posthogInstance) => {
7392
- logger.log(`[PostHog] Initialized successfully - environment: ${environment}, project: ${POSTHOG_PROJECT_NAME}`);
7428
+ logger.log(`[PostHog] Initialized successfully - environment: ${environment}, host: ${host}, project: ${POSTHOG_PROJECT_NAME}`);
7393
7429
  isInitialized = true;
7394
7430
  if (logContext.user_id) {
7395
7431
  posthogInstance.identify(logContext.user_id, {
@@ -7415,11 +7451,8 @@ function initializePostHog(environment, version) {
7415
7451
  }
7416
7452
  }
7417
7453
  function trackEvent(event, level = "info", contents = {}) {
7418
- if (typeof window !== "undefined") {
7419
- const hostname = window.location.hostname;
7420
- if (FILTERED_HOSTNAMES.includes(hostname)) {
7421
- return;
7422
- }
7454
+ if (shouldFilterHostname()) {
7455
+ return;
7423
7456
  }
7424
7457
  if (typeof Vo === "undefined") {
7425
7458
  return;
@@ -7540,7 +7573,7 @@ const _AnimationPlayer = class _AnimationPlayer {
7540
7573
  if (this.streamingPlayer) {
7541
7574
  return;
7542
7575
  }
7543
- const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-BXytpr5T.js");
7576
+ const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-Dy3rj-Pp.js");
7544
7577
  const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
7545
7578
  const audioFormat = AvatarSDK2.getAudioFormat();
7546
7579
  this.streamingPlayer = new StreamingAudioPlayer({
@@ -7745,7 +7778,6 @@ function clearSdkConfigCache() {
7745
7778
  configCache.promise = null;
7746
7779
  }
7747
7780
  const FIRST_USE_KEY = "spavatar_first_use";
7748
- const LAST_ACTIVE_DATE_KEY = "spavatar_last_active_date";
7749
7781
  function isFirstUse() {
7750
7782
  try {
7751
7783
  const stored = localStorage.getItem(FIRST_USE_KEY);
@@ -7762,23 +7794,6 @@ function isFirstUse() {
7762
7794
  return false;
7763
7795
  }
7764
7796
  }
7765
- function isDailyActive() {
7766
- try {
7767
- const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
7768
- const lastActiveDate = localStorage.getItem(LAST_ACTIVE_DATE_KEY);
7769
- if (lastActiveDate === today) {
7770
- return false;
7771
- }
7772
- try {
7773
- localStorage.setItem(LAST_ACTIVE_DATE_KEY, today);
7774
- return true;
7775
- } catch {
7776
- return false;
7777
- }
7778
- } catch (error) {
7779
- return false;
7780
- }
7781
- }
7782
7797
  class HeartbeatManager {
7783
7798
  constructor() {
7784
7799
  __publicField(this, "heartbeatTimer", null);
@@ -8759,7 +8774,7 @@ class AvatarCoreAdapter {
8759
8774
  }
8760
8775
  class AvatarSDK {
8761
8776
  static async initialize(appId, configuration) {
8762
- var _a, _b;
8777
+ var _a;
8763
8778
  try {
8764
8779
  if (this._isInitialized) {
8765
8780
  logger.log(`[AvatarSDK] Re-initializing with new environment: ${configuration.environment}`);
@@ -8769,7 +8784,7 @@ class AvatarSDK {
8769
8784
  }
8770
8785
  logger.log(`[AvatarSDK] Initializing with appId: ${appId}, environment: ${configuration.environment}`);
8771
8786
  this._configuration = configuration;
8772
- setLogLevel(configuration.logLevel ?? LogLevel.off);
8787
+ setLogLevel(configuration.logLevel ?? LogLevel$1.off);
8773
8788
  idManager.setAppId(appId);
8774
8789
  logger.log(`[AvatarSDK] Client ID: ${idManager.getClientId()}`);
8775
8790
  initializePostHog(configuration.environment, this._version);
@@ -8790,12 +8805,6 @@ class AvatarSDK {
8790
8805
  environment: (_a = this._configuration) == null ? void 0 : _a.environment
8791
8806
  });
8792
8807
  }
8793
- if (isDailyActive()) {
8794
- logEvent("sdk_daily_active", "info", {
8795
- appId: idManager.getAppId(),
8796
- environment: (_b = this._configuration) == null ? void 0 : _b.environment
8797
- });
8798
- }
8799
8808
  heartbeatManager.start(this._configuration.environment);
8800
8809
  logger.log(`[AvatarSDK] Successfully initialized`);
8801
8810
  } catch (error) {
@@ -8954,7 +8963,7 @@ class AvatarSDK {
8954
8963
  }
8955
8964
  __publicField(AvatarSDK, "_isInitialized", false);
8956
8965
  __publicField(AvatarSDK, "_configuration", null);
8957
- __publicField(AvatarSDK, "_version", "1.0.0-beta.41");
8966
+ __publicField(AvatarSDK, "_version", "1.0.0-beta.43");
8958
8967
  __publicField(AvatarSDK, "_avatarCore", null);
8959
8968
  __publicField(AvatarSDK, "_dynamicSdkConfig", null);
8960
8969
  const AvatarSDK$1 = Object.freeze(Object.defineProperty({
@@ -9986,11 +9995,6 @@ class AnimationWebSocketClient extends EventEmitter {
9986
9995
  this.isConnecting = false;
9987
9996
  const message = error instanceof Error ? error.message : String(error);
9988
9997
  logger.error("[AnimationWebSocketClient] Connection failed:", message);
9989
- logEvent("character_animation_service", "error", {
9990
- characterId,
9991
- event: "connect_failed",
9992
- reason: message
9993
- });
9994
9998
  throw error;
9995
9999
  }
9996
10000
  }
@@ -10095,11 +10099,6 @@ class AnimationWebSocketClient extends EventEmitter {
10095
10099
  } else if (event.data instanceof Blob) {
10096
10100
  event.data.arrayBuffer().then(this.handleMessage.bind(this)).catch((err) => {
10097
10101
  logger.error("[AnimationWebSocketClient] Failed to convert Blob to ArrayBuffer:", err);
10098
- logEvent("character_animation_service", "error", {
10099
- characterId: this.currentCharacterId,
10100
- event: "decode_blob_failed",
10101
- reason: err instanceof Error ? err.message : String(err)
10102
- });
10103
10102
  this.emit("error", err);
10104
10103
  });
10105
10104
  } else {
@@ -10121,11 +10120,6 @@ class AnimationWebSocketClient extends EventEmitter {
10121
10120
  logger.warn(" 4. Network/firewall blocking the connection");
10122
10121
  logger.warn(` Please check browser Network tab for detailed error information`);
10123
10122
  }
10124
- logEvent("character_animation_service", "error", {
10125
- characterId: this.currentCharacterId,
10126
- event: "websocket_error",
10127
- reason: `ReadyState: ${readyState} (${readyStateText}), URL: ${urlForLog}`
10128
- });
10129
10123
  this.emit("error", new Error(`WebSocket error (readyState: ${readyState})`));
10130
10124
  if (!this.isManuallyDisconnected && this.currentRetryCount < this.reconnectAttempts) {
10131
10125
  this.scheduleReconnect();
@@ -10172,11 +10166,6 @@ class AnimationWebSocketClient extends EventEmitter {
10172
10166
  }
10173
10167
  if (event.code === 1006) {
10174
10168
  logger.warn("[AnimationWebSocketClient] Connection closed abnormally (1006) - possible causes: network issue, server rejection, or protocol mismatch");
10175
- logEvent("character_animation_service", "warning", {
10176
- characterId: this.currentCharacterId,
10177
- event: "websocket_abnormal_close",
10178
- reason: `Code: ${event.code}, URL: ${urlForLog}`
10179
- });
10180
10169
  }
10181
10170
  if (event.code === 1012) {
10182
10171
  logEvent("service_restarted", "warning", {
@@ -10267,10 +10256,6 @@ class AnimationWebSocketClient extends EventEmitter {
10267
10256
  }
10268
10257
  if (message.type === MessageType.MESSAGE_SERVER_ERROR) {
10269
10258
  logger.warn("[AnimationWebSocketClient] MESSAGE_SERVER_ERROR received but no error field in message");
10270
- logEvent("character_animation_service", "warning", {
10271
- characterId: this.currentCharacterId,
10272
- event: "message_error_without_payload"
10273
- });
10274
10259
  this.emit("error", new Error("Server returned error message without error details"));
10275
10260
  return;
10276
10261
  }
@@ -10340,11 +10325,6 @@ class NetworkLayer {
10340
10325
  if (!this.dataController.connected) {
10341
10326
  this.isFallbackMode = true;
10342
10327
  logger.warn(`[NetworkLayer] WebSocket connection timeout (${CONNECTION_TIMEOUT_MS}ms) - entering fallback mode`);
10343
- logEvent("character_manager", "warning", {
10344
- avatar_id: this.dataController.getAvatarId(),
10345
- event: "websocket_connection_timeout_fallback",
10346
- timeoutMs: CONNECTION_TIMEOUT_MS
10347
- });
10348
10328
  (_b2 = (_a2 = this.dataController).onConnectionState) == null ? void 0 : _b2.call(_a2, ConnectionState.failed);
10349
10329
  }
10350
10330
  resolve2();
@@ -10362,10 +10342,6 @@ class NetworkLayer {
10362
10342
  if (!this.isFallbackMode) {
10363
10343
  this.isFallbackMode = true;
10364
10344
  logger.warn("[NetworkLayer] WebSocket connection failed - entering fallback mode");
10365
- logEvent("character_manager", "warning", {
10366
- avatar_id: this.dataController.getAvatarId(),
10367
- event: "websocket_connection_failed_fallback"
10368
- });
10369
10345
  }
10370
10346
  (_d = (_c = this.dataController).onConnectionState) == null ? void 0 : _d.call(_c, ConnectionState.failed);
10371
10347
  throw error;
@@ -10465,20 +10441,12 @@ class NetworkLayer {
10465
10441
  this.isFallbackMode = false;
10466
10442
  this.dataController.setConnected(true);
10467
10443
  (_b = (_a = this.dataController).onConnectionState) == null ? void 0 : _b.call(_a, ConnectionState.connected);
10468
- logEvent("character_animation_service", "info", {
10469
- avatar_id: this.dataController.getAvatarId(),
10470
- event: "connected"
10471
- });
10472
10444
  });
10473
10445
  this.wsClient.on("disconnected", () => {
10474
10446
  var _a, _b;
10475
10447
  this.dataController.setConnected(false);
10476
10448
  idManager.clearConnectionId();
10477
10449
  (_b = (_a = this.dataController).onConnectionState) == null ? void 0 : _b.call(_a, ConnectionState.disconnected);
10478
- logEvent("character_animation_service", "warning", {
10479
- avatar_id: this.dataController.getAvatarId(),
10480
- event: "disconnected"
10481
- });
10482
10450
  });
10483
10451
  this.wsClient.on("reconnecting", () => {
10484
10452
  });
@@ -10486,11 +10454,6 @@ class NetworkLayer {
10486
10454
  var _a, _b, _c, _d;
10487
10455
  const message = error instanceof Error ? error.message : String(error);
10488
10456
  logger.error("[NetworkLayer] WebSocket error:", message);
10489
- logEvent("character_animation_service", "error", {
10490
- avatar_id: this.dataController.getAvatarId(),
10491
- event: "websocket_error",
10492
- reason: message
10493
- });
10494
10457
  (_b = (_a = this.dataController).onConnectionState) == null ? void 0 : _b.call(_a, ConnectionState.failed);
10495
10458
  (_d = (_c = this.dataController).onError) == null ? void 0 : _d.call(_c, error);
10496
10459
  });
@@ -10511,11 +10474,6 @@ class NetworkLayer {
10511
10474
  } catch (error) {
10512
10475
  const message2 = error instanceof Error ? error.message : String(error);
10513
10476
  logger.error("[NetworkLayer] Failed to handle message:", message2);
10514
- logEvent("character_manager", "error", {
10515
- avatar_id: this.dataController.getAvatarId(),
10516
- event: "handle_message_failed",
10517
- reason: message2
10518
- });
10519
10477
  }
10520
10478
  }
10521
10479
  handleAnimationMessage(message) {
@@ -14248,7 +14206,7 @@ export {
14248
14206
  ConnectionState as C,
14249
14207
  DrivingServiceMode as D,
14250
14208
  Environment as E,
14251
- LogLevel as L,
14209
+ LogLevel$1 as L,
14252
14210
  ResourceType as R,
14253
14211
  SPAvatarError as S,
14254
14212
  logger as a,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b, c, f, d, j, g, C, i, D, E, k, h, L, R, S, m } from "./index-CRKYjlwp.js";
1
+ import { b, c, f, d, j, g, C, i, D, E, k, h, L, R, S, m } from "./index-DiAM42qy.js";
2
2
  export {
3
3
  b as Avatar,
4
4
  c as AvatarController,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spatialwalk/avatarkit",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.41",
4
+ "version": "1.0.0-beta.43",
5
5
  "description": "SPAvatar SDK - 3D Gaussian Splatting Avatar Rendering SDK",
6
6
  "author": "SPAvatar Team",
7
7
  "license": "MIT",