saltfish 0.2.67 → 0.2.69
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/core/store.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 +24 -2
- package/dist/saltfish-playlist-player.umd.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/validators/PlaylistValidator.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1256,6 +1256,8 @@ const saltfishStore = createStore()(
|
|
|
1256
1256
|
playlistOptions: null,
|
|
1257
1257
|
backendPlaylists: [],
|
|
1258
1258
|
// Renamed state for playlists from backend
|
|
1259
|
+
isAdmin: false,
|
|
1260
|
+
// Admin privileges flag from backend
|
|
1259
1261
|
isMuted: false,
|
|
1260
1262
|
// Global mute state that persists across video transitions
|
|
1261
1263
|
abTests: [],
|
|
@@ -1828,6 +1830,10 @@ class PlayerInitializationService {
|
|
|
1828
1830
|
const store = useSaltfishStore.getState();
|
|
1829
1831
|
store.initialize(updatedConfig);
|
|
1830
1832
|
this.managers.analyticsManager.initialize(config, this.managers.sessionManager.getSessionId());
|
|
1833
|
+
if (data.isAdmin) {
|
|
1834
|
+
store.isAdmin = true;
|
|
1835
|
+
log("[PlayerInitializationService.initialize] Admin token detected");
|
|
1836
|
+
}
|
|
1831
1837
|
if (data.playlists && Array.isArray(data.playlists) && store.setBackendPlaylists) {
|
|
1832
1838
|
log("[PlayerInitializationService.initialize] Found data.playlists, attempting to store:", data.playlists);
|
|
1833
1839
|
store.setBackendPlaylists(data.playlists);
|
|
@@ -1838,7 +1844,7 @@ class PlayerInitializationService {
|
|
|
1838
1844
|
log("[PlayerInitializationService.initialize] Initializing A/B tests:", data.abTests);
|
|
1839
1845
|
this.managers.abTestManager.initializeTests(data.abTests);
|
|
1840
1846
|
}
|
|
1841
|
-
} else {
|
|
1847
|
+
} else if (!data.isAdmin) {
|
|
1842
1848
|
throw ErrorHandler.handleInitializationError(
|
|
1843
1849
|
"Backend validation successful, but no playlists array provided in the response. Cannot initialize player.",
|
|
1844
1850
|
{
|
|
@@ -2012,9 +2018,16 @@ class PlayerInitializationService {
|
|
|
2012
2018
|
* Check for in-progress playlists and resume them
|
|
2013
2019
|
*/
|
|
2014
2020
|
async checkAndResumeInProgressPlaylist(watchedPlaylists) {
|
|
2021
|
+
var _a;
|
|
2015
2022
|
if (!watchedPlaylists) {
|
|
2016
2023
|
return false;
|
|
2017
2024
|
}
|
|
2025
|
+
const store = useSaltfishStore.getState();
|
|
2026
|
+
const currentManifestId = (_a = store.manifest) == null ? void 0 : _a.id;
|
|
2027
|
+
const currentState = store.currentState;
|
|
2028
|
+
if (currentManifestId && currentState !== "idle" && currentState !== "error") {
|
|
2029
|
+
return false;
|
|
2030
|
+
}
|
|
2018
2031
|
const currentTime = Date.now();
|
|
2019
2032
|
const MAX_AGE_MS = 6e3;
|
|
2020
2033
|
const inProgressEntry = Object.entries(watchedPlaylists).find(([playlistId, status]) => {
|
|
@@ -2268,6 +2281,15 @@ class PlaylistValidator {
|
|
|
2268
2281
|
error: "Saltfish Player must be initialized before starting a playlist"
|
|
2269
2282
|
};
|
|
2270
2283
|
}
|
|
2284
|
+
if (store.isAdmin === true) {
|
|
2285
|
+
log(`[PlaylistValidator] Admin token detected. Allowing direct access to playlist '${playlistId}'`);
|
|
2286
|
+
const manifestPath = `https://storage.saltfish.ai/flows2/drafts/${playlistId}.json`;
|
|
2287
|
+
return {
|
|
2288
|
+
isValid: true,
|
|
2289
|
+
manifestPath,
|
|
2290
|
+
updatedOptions: options
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2271
2293
|
const backendPlaylists = store.backendPlaylists;
|
|
2272
2294
|
if (!backendPlaylists || backendPlaylists.length === 0) {
|
|
2273
2295
|
ErrorHandler.handlePlaylistError(
|
|
@@ -10686,7 +10708,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
10686
10708
|
__proto__: null,
|
|
10687
10709
|
SaltfishPlayer
|
|
10688
10710
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10689
|
-
const version = "0.2.
|
|
10711
|
+
const version = "0.2.69";
|
|
10690
10712
|
const packageJson = {
|
|
10691
10713
|
version
|
|
10692
10714
|
};
|