saltfish 0.2.13 → 0.2.15
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/managers/InteractionManager.d.ts +1 -0
- package/dist/managers/InteractionManager.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 +31 -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/package.json +2 -1
|
@@ -6744,6 +6744,7 @@ class InteractionManager {
|
|
|
6744
6744
|
__publicField(this, "scrollIndicator", null);
|
|
6745
6745
|
__publicField(this, "domEventListeners", /* @__PURE__ */ new Map());
|
|
6746
6746
|
__publicField(this, "storeUnsubscribe", null);
|
|
6747
|
+
__publicField(this, "storageManager", new StorageManager());
|
|
6747
6748
|
/**
|
|
6748
6749
|
* Handles the video90PercentReached event
|
|
6749
6750
|
* @param _event - The custom event dispatched when video reaches 90%
|
|
@@ -6963,6 +6964,7 @@ class InteractionManager {
|
|
|
6963
6964
|
* @param buttonConfig - The button configuration
|
|
6964
6965
|
*/
|
|
6965
6966
|
async handleButtonClick(event, buttonConfig) {
|
|
6967
|
+
var _a, _b;
|
|
6966
6968
|
log(`InteractionManager: Button click detected on button "${buttonConfig.id}"`);
|
|
6967
6969
|
event.preventDefault();
|
|
6968
6970
|
event.stopPropagation();
|
|
@@ -6972,8 +6974,35 @@ class InteractionManager {
|
|
|
6972
6974
|
store.play();
|
|
6973
6975
|
break;
|
|
6974
6976
|
case "goto":
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
+
if (buttonConfig.action.url) {
|
|
6978
|
+
log(`InteractionManager: Goto button with URL redirect - updating to step "${buttonConfig.action.target}" then redirecting to "${buttonConfig.action.url}"`);
|
|
6979
|
+
await this.flushAnalytics();
|
|
6980
|
+
const currentStore = useSaltfishStore.getState();
|
|
6981
|
+
if (currentStore.manifest) {
|
|
6982
|
+
useSaltfishStore.setState((state) => {
|
|
6983
|
+
state.currentStepId = buttonConfig.action.target;
|
|
6984
|
+
if (state.manifest) {
|
|
6985
|
+
state.progress[state.manifest.id] = {
|
|
6986
|
+
...state.progress[state.manifest.id],
|
|
6987
|
+
lastStepId: buttonConfig.action.target,
|
|
6988
|
+
lastVisited: (/* @__PURE__ */ new Date()).toISOString()
|
|
6989
|
+
};
|
|
6990
|
+
}
|
|
6991
|
+
});
|
|
6992
|
+
const playlistPersistence = ((_a = currentStore.playlistOptions) == null ? void 0 : _a.persistence) ?? true;
|
|
6993
|
+
if (playlistPersistence) {
|
|
6994
|
+
const userId = (_b = currentStore.user) == null ? void 0 : _b.id;
|
|
6995
|
+
const updatedStore = useSaltfishStore.getState();
|
|
6996
|
+
this.storageManager.setProgress(updatedStore.progress, userId);
|
|
6997
|
+
log(`InteractionManager: Saved progress for step ${buttonConfig.action.target} before URL redirect`);
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
log(`InteractionManager: Redirecting to ${buttonConfig.action.url}`);
|
|
7001
|
+
window.location.href = buttonConfig.action.url;
|
|
7002
|
+
} else {
|
|
7003
|
+
log(`InteractionManager: Goto button clicked, going to step "${buttonConfig.action.target}"`);
|
|
7004
|
+
store.goToStep(buttonConfig.action.target);
|
|
7005
|
+
}
|
|
6977
7006
|
break;
|
|
6978
7007
|
case "url":
|
|
6979
7008
|
log(`InteractionManager: URL button clicked, opening "${buttonConfig.action.target}"`);
|