@spatialwalk/avatarkit 1.0.0-beta.48 → 1.0.0-beta.49

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,11 @@ 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.49] - 2025-01-05
9
+
10
+ ### 🐛 Bugfix
11
+ - **Template Cache Version** - Fixed issue where template cache would be incorrectly cleared when switching between different SDK versions. Now uses independent template resource version (1.0.0) instead of SDK version, allowing different SDK versions to share the same template cache when template resources are identical.
12
+
8
13
  ## [1.0.0-beta.48] - 2025-01-05
9
14
 
10
15
  ### ✨ New Features
@@ -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-C0EU_1kt.js";
4
+ import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-BoQe49oM.js";
5
5
  class StreamingAudioPlayer {
6
6
  constructor(options) {
7
7
  __publicField(this, "audioContext", null);
@@ -7576,7 +7576,7 @@ const _AnimationPlayer = class _AnimationPlayer {
7576
7576
  if (this.streamingPlayer) {
7577
7577
  return;
7578
7578
  }
7579
- const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-BCUbWwGa.js");
7579
+ const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-CeiNxmCv.js");
7580
7580
  const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
7581
7581
  const audioFormat = AvatarSDK2.getAudioFormat();
7582
7582
  this.streamingPlayer = new StreamingAudioPlayer({
@@ -8966,7 +8966,7 @@ class AvatarSDK {
8966
8966
  }
8967
8967
  __publicField(AvatarSDK, "_isInitialized", false);
8968
8968
  __publicField(AvatarSDK, "_configuration", null);
8969
- __publicField(AvatarSDK, "_version", "1.0.0-beta.48");
8969
+ __publicField(AvatarSDK, "_version", "1.0.0-beta.49");
8970
8970
  __publicField(AvatarSDK, "_avatarCore", null);
8971
8971
  __publicField(AvatarSDK, "_dynamicSdkConfig", null);
8972
8972
  const AvatarSDK$1 = Object.freeze(Object.defineProperty({
@@ -11725,16 +11725,21 @@ const _PwaCacheManager = class _PwaCacheManager {
11725
11725
  logger.warn(`[PwaCacheManager] Failed to clear character cache:`, error);
11726
11726
  }
11727
11727
  }
11728
- static async checkTemplateCacheVersion(newVersion) {
11728
+ static async checkTemplateCacheVersion() {
11729
11729
  if (!_PwaCacheManager.isSupported()) {
11730
11730
  return false;
11731
11731
  }
11732
11732
  try {
11733
+ const currentTemplateVersion = _PwaCacheManager.TEMPLATE_RESOURCE_VERSION;
11733
11734
  const storedVersion = localStorage.getItem(_PwaCacheManager.TEMPLATE_VERSION_STORAGE_KEY);
11734
- if (storedVersion !== newVersion) {
11735
- await caches.delete(_PwaCacheManager.TEMPLATE_CACHE_NAME);
11736
- localStorage.setItem(_PwaCacheManager.TEMPLATE_VERSION_STORAGE_KEY, newVersion);
11737
- logger.log(`[PwaCacheManager] Template cache version changed: ${storedVersion} -> ${newVersion}, cache cleared`);
11735
+ if (storedVersion !== currentTemplateVersion) {
11736
+ if (storedVersion) {
11737
+ const oldCacheName = `spatialwalk-sdk-template-cache-${storedVersion}`;
11738
+ await caches.delete(oldCacheName).catch(() => {
11739
+ });
11740
+ }
11741
+ localStorage.setItem(_PwaCacheManager.TEMPLATE_VERSION_STORAGE_KEY, currentTemplateVersion);
11742
+ logger.log(`[PwaCacheManager] Template cache version changed: ${storedVersion} -> ${currentTemplateVersion}, old cache cleared`);
11738
11743
  return true;
11739
11744
  }
11740
11745
  return false;
@@ -11744,8 +11749,8 @@ const _PwaCacheManager = class _PwaCacheManager {
11744
11749
  }
11745
11750
  }
11746
11751
  };
11747
- __publicField(_PwaCacheManager, "TEMPLATE_CACHE_VERSION", "v1");
11748
- __publicField(_PwaCacheManager, "TEMPLATE_CACHE_NAME", `spatialwalk-sdk-template-cache-${_PwaCacheManager.TEMPLATE_CACHE_VERSION}`);
11752
+ __publicField(_PwaCacheManager, "TEMPLATE_RESOURCE_VERSION", "1.0.0");
11753
+ __publicField(_PwaCacheManager, "TEMPLATE_CACHE_NAME", `spatialwalk-sdk-template-cache-${_PwaCacheManager.TEMPLATE_RESOURCE_VERSION}`);
11749
11754
  __publicField(_PwaCacheManager, "TEMPLATE_VERSION_STORAGE_KEY", "spatialwalk-sdk-template-cache-version");
11750
11755
  __publicField(_PwaCacheManager, "CHARACTER_CACHE_PREFIX", "spatialwalk-sdk-character-");
11751
11756
  __publicField(_PwaCacheManager, "CHARACTER_CACHE_SUFFIX", "-cache");
@@ -11841,8 +11846,7 @@ class AvatarDownloader {
11841
11846
  }
11842
11847
  async loadTemplateResources(flameResources, progressCallback = null) {
11843
11848
  var _a, _b, _c, _d;
11844
- const sdkVersion2 = AvatarSDK.version;
11845
- await PwaCacheManager.checkTemplateCacheVersion(sdkVersion2);
11849
+ await PwaCacheManager.checkTemplateCacheVersion();
11846
11850
  const useApiResources = flameResources && Object.keys(flameResources).length > 0;
11847
11851
  if (!useApiResources) {
11848
11852
  logger.log("Template resources not provided in CharacterMeta, using global CDN config");
@@ -11907,8 +11911,7 @@ class AvatarDownloader {
11907
11911
  return templateResources;
11908
11912
  }
11909
11913
  async loadGlobalFlameResources(progressCallback = null) {
11910
- const sdkVersion2 = AvatarSDK.version;
11911
- await PwaCacheManager.checkTemplateCacheVersion(sdkVersion2);
11914
+ await PwaCacheManager.checkTemplateCacheVersion();
11912
11915
  const startTime = Date.now();
11913
11916
  const { cdnBaseUrl, resources } = APP_CONFIG.flame;
11914
11917
  const templateFiles = {
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-C0EU_1kt.js";
1
+ import { b, c, f, d, j, g, C, i, D, E, k, h, L, R, S, m } from "./index-BoQe49oM.js";
2
2
  export {
3
3
  b as Avatar,
4
4
  c as AvatarController,
@@ -1,5 +1,5 @@
1
1
  export declare class PwaCacheManager {
2
- private static readonly TEMPLATE_CACHE_VERSION;
2
+ private static readonly TEMPLATE_RESOURCE_VERSION;
3
3
  private static readonly TEMPLATE_CACHE_NAME;
4
4
  private static readonly TEMPLATE_VERSION_STORAGE_KEY;
5
5
  private static readonly CHARACTER_CACHE_PREFIX;
@@ -12,5 +12,5 @@ export declare class PwaCacheManager {
12
12
  static getTemplateResource(url: string): Promise<ArrayBuffer | null>;
13
13
  static putTemplateResource(url: string, data: ArrayBuffer): Promise<void>;
14
14
  static clearCharacterCache(characterId: string): Promise<void>;
15
- static checkTemplateCacheVersion(newVersion: string): Promise<boolean>;
15
+ static checkTemplateCacheVersion(): Promise<boolean>;
16
16
  }
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.48",
4
+ "version": "1.0.0-beta.49",
5
5
  "packageManager": "pnpm@10.18.2",
6
6
  "description": "SPAvatar SDK - 3D Gaussian Splatting Avatar Rendering SDK",
7
7
  "author": "SPAvatar Team",