saltfish 0.2.51 → 0.2.53

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.
@@ -8946,7 +8946,6 @@ class PlaylistLoader {
8946
8946
  * @returns The step ID to start from
8947
8947
  */
8948
8948
  determineStartStep(manifest, options, savedProgress) {
8949
- var _a;
8950
8949
  const isPersistenceEnabled = options.persistence ?? manifest.isPersistent ?? true;
8951
8950
  const manifestIdForProgress = manifest.id;
8952
8951
  let startStepId = manifest.startStep;
@@ -8958,15 +8957,17 @@ class PlaylistLoader {
8958
8957
  } else {
8959
8958
  log(`PlaylistLoader: Custom start node '${options.startNodeId}' not found, using default start step`);
8960
8959
  }
8961
- } else if (isPersistenceEnabled && savedProgress && ((_a = savedProgress[manifestIdForProgress]) == null ? void 0 : _a.lastStepId)) {
8960
+ } else if (isPersistenceEnabled && savedProgress && savedProgress[manifestIdForProgress]) {
8962
8961
  const progressData = savedProgress[manifestIdForProgress];
8963
- const lastStepId = progressData.lastStepId;
8964
- if (progressData.completedWaitingForInteraction) {
8962
+ if (progressData.status === "completed") {
8965
8963
  startStepId = manifest.startStep;
8966
8964
  } else {
8967
- const savedStep = manifest.steps.find((step) => step.id === lastStepId);
8968
- if (savedStep) {
8969
- startStepId = lastStepId;
8965
+ const lastStepId = progressData.currentStepId || progressData.lastStepId;
8966
+ if (lastStepId) {
8967
+ const savedStep = manifest.steps.find((step) => step.id === lastStepId);
8968
+ if (savedStep) {
8969
+ startStepId = lastStepId;
8970
+ }
8970
8971
  }
8971
8972
  }
8972
8973
  }
@@ -9056,7 +9057,8 @@ class PlaylistManager {
9056
9057
  const currentWatchedPlaylists = currentUserData.watchedPlaylists || {};
9057
9058
  const updatedPlaylistData = {
9058
9059
  status,
9059
- currentStepId: currentStepId || store.currentStepId || null,
9060
+ // Don't save currentStepId for completed playlists - they should restart from beginning
9061
+ currentStepId: status === "completed" ? null : currentStepId || store.currentStepId || null,
9060
9062
  timestamp: Date.now(),
9061
9063
  // Use timestamp for consistency with checkAndResumeInProgressPlaylist
9062
9064
  lastProgressAt: Date.now()
@@ -9136,12 +9138,15 @@ class PlaylistManager {
9136
9138
  * @param options - Playlist configuration options
9137
9139
  */
9138
9140
  async load(playlistId, options) {
9141
+ var _a, _b;
9139
9142
  try {
9140
9143
  const store = useSaltfishStore.getState();
9144
+ const isAnonymous = ((_a = store.user) == null ? void 0 : _a.__isAnonymous) === true;
9145
+ const savedProgress = isAnonymous ? store.progress : ((_b = store.userData) == null ? void 0 : _b.watchedPlaylists) || store.progress;
9141
9146
  const loadResult = await this.playlistLoader.loadManifest({
9142
9147
  manifestPath: playlistId,
9143
9148
  playlistOptions: options,
9144
- savedProgress: store.progress
9149
+ savedProgress
9145
9150
  });
9146
9151
  const { manifest, startStepId } = loadResult;
9147
9152
  const firstStep = manifest.steps.find((step) => step.id === startStepId);
@@ -10318,7 +10323,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
10318
10323
  __proto__: null,
10319
10324
  SaltfishPlayer
10320
10325
  }, Symbol.toStringTag, { value: "Module" }));
10321
- const version = "0.2.51";
10326
+ const version = "0.2.53";
10322
10327
  const packageJson = {
10323
10328
  version
10324
10329
  };