saltfish 0.3.6 → 0.3.7

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.
@@ -1163,43 +1163,12 @@ const _StorageManager = class _StorageManager {
1163
1163
  // Anonymous User ID Methods
1164
1164
  // =============================================================================
1165
1165
  /**
1166
- * Get anonymous user ID
1166
+ * Get anonymous user ID from the anonymous user data object
1167
+ * This reads from the same key as getAnonymousUserData() for consistency
1167
1168
  */
1168
1169
  getAnonymousUserId() {
1169
- if (!this.isLocalStorageAvailable) {
1170
- return null;
1171
- }
1172
- try {
1173
- return localStorage.getItem("saltfish_anonymous_user_id");
1174
- } catch (error2) {
1175
- return null;
1176
- }
1177
- }
1178
- /**
1179
- * Set anonymous user ID
1180
- */
1181
- setAnonymousUserId(userId) {
1182
- if (!this.isLocalStorageAvailable) {
1183
- return false;
1184
- }
1185
- try {
1186
- localStorage.setItem("saltfish_anonymous_user_id", userId);
1187
- return true;
1188
- } catch (error2) {
1189
- return false;
1190
- }
1191
- }
1192
- /**
1193
- * Clear anonymous user ID
1194
- */
1195
- clearAnonymousUserId() {
1196
- if (!this.isLocalStorageAvailable) {
1197
- return;
1198
- }
1199
- try {
1200
- localStorage.removeItem("saltfish_anonymous_user_id");
1201
- } catch (error2) {
1202
- }
1170
+ const data = this.getAnonymousUserData();
1171
+ return (data == null ? void 0 : data.userId) || null;
1203
1172
  }
1204
1173
  // =============================================================================
1205
1174
  // Utility Methods
@@ -1211,7 +1180,6 @@ const _StorageManager = class _StorageManager {
1211
1180
  this.clearProgress();
1212
1181
  this.clearSession();
1213
1182
  this.clearAnonymousUserData();
1214
- this.clearAnonymousUserId();
1215
1183
  }
1216
1184
  /**
1217
1185
  * Get storage availability status
@@ -2123,11 +2091,18 @@ class PlayerInitializationService {
2123
2091
  if (typeof window === "undefined") {
2124
2092
  return `anonymous_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
2125
2093
  }
2126
- let anonymousUserId = this.managers.storageManager.getAnonymousUserId();
2127
- if (!anonymousUserId) {
2128
- anonymousUserId = `anonymous_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
2129
- this.managers.storageManager.setAnonymousUserId(anonymousUserId);
2094
+ const existingData = this.managers.storageManager.getAnonymousUserData();
2095
+ if (existingData == null ? void 0 : existingData.userId) {
2096
+ log(`[PlayerInitializationService.getOrCreateAnonymousUserId] Using existing anonymous user ID: ${existingData.userId}`);
2097
+ return existingData.userId;
2130
2098
  }
2099
+ const anonymousUserId = `anonymous_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
2100
+ this.managers.storageManager.setAnonymousUserData({
2101
+ userId: anonymousUserId,
2102
+ userData: {},
2103
+ watchedPlaylists: {},
2104
+ timestamp: Date.now()
2105
+ });
2131
2106
  return anonymousUserId;
2132
2107
  }
2133
2108
  destroy() {
@@ -11251,7 +11226,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
11251
11226
  __proto__: null,
11252
11227
  SaltfishPlayer
11253
11228
  }, Symbol.toStringTag, { value: "Module" }));
11254
- const version = "0.3.6";
11229
+ const version = "0.3.7";
11255
11230
  const packageJson = {
11256
11231
  version
11257
11232
  };