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

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,14 @@ 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.42] - 2025-12-29
9
+
10
+ ### ✨ New Features
11
+ - **PostHog Telemetry Configuration** - PostHog telemetry reporting now supports separate configuration for domestic (CN) and international (INTL) environments:
12
+ - Separate PostHog hosts and API keys for CN and INTL environments
13
+ - Compression disabled for domestic self-hosted instance, enabled for international official PostHog
14
+ - Localhost domain filtering to avoid test data pollution
15
+
8
16
  ## [1.0.0-beta.41] - 2025-12-29
9
17
 
10
18
  ### 🔄 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-Bgw-52f-.js";
5
5
  class StreamingAudioPlayer {
6
6
  constructor(options) {
7
7
  __publicField(this, "audioContext", null);
@@ -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-C2x7CaOj.js");
7544
7577
  const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
7545
7578
  const audioFormat = AvatarSDK2.getAudioFormat();
7546
7579
  this.streamingPlayer = new StreamingAudioPlayer({
@@ -8769,7 +8802,7 @@ class AvatarSDK {
8769
8802
  }
8770
8803
  logger.log(`[AvatarSDK] Initializing with appId: ${appId}, environment: ${configuration.environment}`);
8771
8804
  this._configuration = configuration;
8772
- setLogLevel(configuration.logLevel ?? LogLevel.off);
8805
+ setLogLevel(configuration.logLevel ?? LogLevel$1.off);
8773
8806
  idManager.setAppId(appId);
8774
8807
  logger.log(`[AvatarSDK] Client ID: ${idManager.getClientId()}`);
8775
8808
  initializePostHog(configuration.environment, this._version);
@@ -8954,7 +8987,7 @@ class AvatarSDK {
8954
8987
  }
8955
8988
  __publicField(AvatarSDK, "_isInitialized", false);
8956
8989
  __publicField(AvatarSDK, "_configuration", null);
8957
- __publicField(AvatarSDK, "_version", "1.0.0-beta.41");
8990
+ __publicField(AvatarSDK, "_version", "1.0.0-beta.42");
8958
8991
  __publicField(AvatarSDK, "_avatarCore", null);
8959
8992
  __publicField(AvatarSDK, "_dynamicSdkConfig", null);
8960
8993
  const AvatarSDK$1 = Object.freeze(Object.defineProperty({
@@ -14248,7 +14281,7 @@ export {
14248
14281
  ConnectionState as C,
14249
14282
  DrivingServiceMode as D,
14250
14283
  Environment as E,
14251
- LogLevel as L,
14284
+ LogLevel$1 as L,
14252
14285
  ResourceType as R,
14253
14286
  SPAvatarError as S,
14254
14287
  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-Bgw-52f-.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.42",
5
5
  "description": "SPAvatar SDK - 3D Gaussian Splatting Avatar Rendering SDK",
6
6
  "author": "SPAvatar Team",
7
7
  "license": "MIT",