saltfish 0.2.27 → 0.2.28

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.
@@ -1427,16 +1427,7 @@ const saltfishStore = createStore()(
1427
1427
  },
1428
1428
  completePlaylist: () => {
1429
1429
  set2((state) => {
1430
- var _a, _b;
1431
- const { manifest } = state;
1432
1430
  state.currentState = transitionState({ type: "COMPLETE_PLAYLIST" });
1433
- const playlistPersistence = ((_a = state.playlistOptions) == null ? void 0 : _a.persistence) ?? true;
1434
- if (manifest && playlistPersistence) {
1435
- delete state.progress[manifest.id];
1436
- const userId = (_b = state.user) == null ? void 0 : _b.id;
1437
- storageManager.setProgress(state.progress, userId);
1438
- log(`Store: Removed completed playlist ${manifest.id} from localStorage`);
1439
- }
1440
1431
  });
1441
1432
  },
1442
1433
  // Add new method to reset playlist state while preserving config and user data
@@ -3098,16 +3089,24 @@ class StateMachineActionHandler {
3098
3089
  }
3099
3090
  }
3100
3091
  handleTrackPlaylistComplete() {
3092
+ var _a, _b;
3101
3093
  const store = useSaltfishStore.getState();
3102
3094
  if (store.manifest && this.managers.eventManager) {
3103
- log(`StateMachineActionHandler: Triggering playlistEnded event for playlist ${store.manifest.id}`);
3095
+ const playlistId = store.manifest.id;
3104
3096
  this.managers.eventManager.trigger("playlistEnded", {
3105
3097
  timestamp: Date.now(),
3106
3098
  playlist: {
3107
- id: store.manifest.id,
3099
+ id: playlistId,
3108
3100
  title: store.manifest.name
3109
3101
  }
3110
3102
  });
3103
+ const playlistPersistence = ((_a = store.playlistOptions) == null ? void 0 : _a.persistence) ?? true;
3104
+ if (playlistPersistence && store.progress[playlistId]) {
3105
+ const updatedProgress = { ...store.progress };
3106
+ delete updatedProgress[playlistId];
3107
+ const userId = (_b = store.user) == null ? void 0 : _b.id;
3108
+ this.managers.storageManager.setProgress(updatedProgress, userId);
3109
+ }
3111
3110
  }
3112
3111
  }
3113
3112
  handleError(context) {