saltfish 0.3.91 → 0.3.92

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.
@@ -10440,8 +10440,11 @@ class TriggerManager {
10440
10440
  }
10441
10441
  /**
10442
10442
  * Evaluates the playlistSeen condition
10443
- * User must have completed ALL specified playlists
10444
- * @param requiredPlaylists - Array of playlist IDs that user must have completed
10443
+ * User must have seen ALL specified playlists. A playlist counts as seen once
10444
+ * the user has started it (any watched status: in_progress, completed, dismissed)
10445
+ * except while it is the playlist currently on screen, so a dependent playlist
10446
+ * never tears down the session that is satisfying its condition.
10447
+ * @param requiredPlaylists - Array of playlist IDs that user must have seen
10445
10448
  * @param watchedPlaylists - User's watched playlists data
10446
10449
  */
10447
10450
  evaluatePlaylistSeenCondition(requiredPlaylists, watchedPlaylists) {
@@ -10453,12 +10456,30 @@ class TriggerManager {
10453
10456
  }
10454
10457
  for (const playlistId of requiredPlaylists) {
10455
10458
  const playlistData = watchedPlaylists[playlistId];
10456
- if (!playlistData || playlistData.status !== "completed") {
10459
+ if (!playlistData) {
10460
+ return false;
10461
+ }
10462
+ if (this.isPlaylistCurrentlyActive(playlistId)) {
10457
10463
  return false;
10458
10464
  }
10459
10465
  }
10460
10466
  return true;
10461
10467
  }
10468
+ /**
10469
+ * Checks whether a playlist is the one currently being shown to the user.
10470
+ * After a playlist ends, is dismissed, or is closed by navigation, the store's
10471
+ * manifest is cleared (or the state machine reaches a terminal state), so this
10472
+ * returns false and the playlist can satisfy playlistSeen conditions again.
10473
+ */
10474
+ isPlaylistCurrentlyActive(playlistId) {
10475
+ var _a;
10476
+ const store = getSaltfishStore();
10477
+ if (((_a = store.manifest) == null ? void 0 : _a.id) !== playlistId) {
10478
+ return false;
10479
+ }
10480
+ const terminalStates = ["idle", "completed", "closing", "error"];
10481
+ return !terminalStates.includes(store.currentState);
10482
+ }
10462
10483
  /**
10463
10484
  * Evaluates the playlistNotSeen condition
10464
10485
  * User must NOT have seen ANY of the specified playlists
@@ -12755,7 +12776,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
12755
12776
  __proto__: null,
12756
12777
  SaltfishPlayer
12757
12778
  }, Symbol.toStringTag, { value: "Module" }));
12758
- const version = "0.3.91";
12779
+ const version = "0.3.92";
12759
12780
  const packageJson = {
12760
12781
  version
12761
12782
  };