saltfish 0.3.5 → 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.
- package/dist/core/services/PlayerInitializationService.d.ts.map +1 -1
- package/dist/managers/StorageManager.d.ts +2 -9
- package/dist/managers/StorageManager.d.ts.map +1 -1
- package/dist/player.js +2 -2
- package/dist/player.min.js +2 -2
- package/dist/saltfish-playlist-player.es.js +19 -44
- package/dist/saltfish-playlist-player.umd.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
1170
|
-
|
|
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
|
-
|
|
2127
|
-
if (
|
|
2128
|
-
|
|
2129
|
-
|
|
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() {
|
|
@@ -2958,7 +2933,7 @@ class StateMachineActionHandler {
|
|
|
2958
2933
|
return true;
|
|
2959
2934
|
}
|
|
2960
2935
|
const checkUrl = () => {
|
|
2961
|
-
const currentUrl = window.location.href
|
|
2936
|
+
const currentUrl = window.location.href;
|
|
2962
2937
|
const currentPath = window.location.pathname;
|
|
2963
2938
|
let matches = false;
|
|
2964
2939
|
if (matchType === "regex") {
|
|
@@ -8660,7 +8635,7 @@ class TransitionManager {
|
|
|
8660
8635
|
if (!pattern) {
|
|
8661
8636
|
return false;
|
|
8662
8637
|
}
|
|
8663
|
-
const currentUrl = window.location.href
|
|
8638
|
+
const currentUrl = window.location.href;
|
|
8664
8639
|
const currentPath = window.location.pathname;
|
|
8665
8640
|
const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8666
8641
|
const regexPattern = escapedPattern.replace(/\\\*/g, ".*");
|
|
@@ -8679,7 +8654,7 @@ class TransitionManager {
|
|
|
8679
8654
|
if (!pattern) {
|
|
8680
8655
|
return true;
|
|
8681
8656
|
}
|
|
8682
|
-
const currentUrl = window.location.href
|
|
8657
|
+
const currentUrl = window.location.href;
|
|
8683
8658
|
const currentPath = window.location.pathname;
|
|
8684
8659
|
if (matchType === "regex") {
|
|
8685
8660
|
try {
|
|
@@ -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.
|
|
11229
|
+
const version = "0.3.7";
|
|
11255
11230
|
const packageJson = {
|
|
11256
11231
|
version
|
|
11257
11232
|
};
|