saltfish 0.2.68 → 0.2.70
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 +28 -5
- 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/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- 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: [],
|
|
@@ -1765,6 +1767,7 @@ __publicField(ErrorHandler, "DEFAULT_OPTIONS", {
|
|
|
1765
1767
|
shouldTriggerEvent: false,
|
|
1766
1768
|
shouldDestroy: false
|
|
1767
1769
|
});
|
|
1770
|
+
const VERSION = "0.2.70";
|
|
1768
1771
|
class PlayerInitializationService {
|
|
1769
1772
|
constructor(managers) {
|
|
1770
1773
|
__publicField(this, "managers");
|
|
@@ -1805,7 +1808,10 @@ class PlayerInitializationService {
|
|
|
1805
1808
|
headers: {
|
|
1806
1809
|
"Content-Type": "application/json"
|
|
1807
1810
|
},
|
|
1808
|
-
body: JSON.stringify({
|
|
1811
|
+
body: JSON.stringify({
|
|
1812
|
+
token: config.token,
|
|
1813
|
+
playerVersion: VERSION
|
|
1814
|
+
})
|
|
1809
1815
|
});
|
|
1810
1816
|
const data = await response.json();
|
|
1811
1817
|
log("[PlayerInitializationService.initialize] Token validation response data:", data);
|
|
@@ -1828,17 +1834,25 @@ class PlayerInitializationService {
|
|
|
1828
1834
|
const store = useSaltfishStore.getState();
|
|
1829
1835
|
store.initialize(updatedConfig);
|
|
1830
1836
|
this.managers.analyticsManager.initialize(config, this.managers.sessionManager.getSessionId());
|
|
1837
|
+
if (data.isAdmin) {
|
|
1838
|
+
store.isAdmin = true;
|
|
1839
|
+
log("[PlayerInitializationService.initialize] Admin token detected");
|
|
1840
|
+
}
|
|
1831
1841
|
if (data.playlists && Array.isArray(data.playlists) && store.setBackendPlaylists) {
|
|
1832
1842
|
log("[PlayerInitializationService.initialize] Found data.playlists, attempting to store:", data.playlists);
|
|
1833
1843
|
store.setBackendPlaylists(data.playlists);
|
|
1834
1844
|
log("[PlayerInitializationService.initialize] Successfully called setBackendPlaylists with data.playlists.");
|
|
1835
|
-
|
|
1836
|
-
|
|
1845
|
+
if (data.playlists.length > 0) {
|
|
1846
|
+
this.managers.triggerManager.registerTriggers(data.playlists);
|
|
1847
|
+
log("[PlayerInitializationService.initialize] Registered playlist triggers");
|
|
1848
|
+
} else if (data.isAdmin) {
|
|
1849
|
+
log("[PlayerInitializationService.initialize] Admin token with empty playlists array - skipping trigger registration");
|
|
1850
|
+
}
|
|
1837
1851
|
if (data.abTests && Array.isArray(data.abTests)) {
|
|
1838
1852
|
log("[PlayerInitializationService.initialize] Initializing A/B tests:", data.abTests);
|
|
1839
1853
|
this.managers.abTestManager.initializeTests(data.abTests);
|
|
1840
1854
|
}
|
|
1841
|
-
} else {
|
|
1855
|
+
} else if (!data.isAdmin) {
|
|
1842
1856
|
throw ErrorHandler.handleInitializationError(
|
|
1843
1857
|
"Backend validation successful, but no playlists array provided in the response. Cannot initialize player.",
|
|
1844
1858
|
{
|
|
@@ -2275,6 +2289,15 @@ class PlaylistValidator {
|
|
|
2275
2289
|
error: "Saltfish Player must be initialized before starting a playlist"
|
|
2276
2290
|
};
|
|
2277
2291
|
}
|
|
2292
|
+
if (store.isAdmin === true) {
|
|
2293
|
+
log(`[PlaylistValidator] Admin token detected. Allowing direct access to playlist '${playlistId}'`);
|
|
2294
|
+
const manifestPath = `https://storage.saltfish.ai/flows2/drafts/${playlistId}.json`;
|
|
2295
|
+
return {
|
|
2296
|
+
isValid: true,
|
|
2297
|
+
manifestPath,
|
|
2298
|
+
updatedOptions: options
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2278
2301
|
const backendPlaylists = store.backendPlaylists;
|
|
2279
2302
|
if (!backendPlaylists || backendPlaylists.length === 0) {
|
|
2280
2303
|
ErrorHandler.handlePlaylistError(
|
|
@@ -10693,7 +10716,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
10693
10716
|
__proto__: null,
|
|
10694
10717
|
SaltfishPlayer
|
|
10695
10718
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10696
|
-
const version = "0.2.
|
|
10719
|
+
const version = "0.2.70";
|
|
10697
10720
|
const packageJson = {
|
|
10698
10721
|
version
|
|
10699
10722
|
};
|