saltfish 0.2.28 → 0.2.30
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/ManagerOrchestrator.d.ts.map +1 -1
- package/dist/core/services/StateMachineActionHandler.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 +88 -101
- package/dist/saltfish-playlist-player.umd.js +1 -1
- package/package.json +1 -1
|
@@ -2876,94 +2876,89 @@ class StateMachineActionHandler {
|
|
|
2876
2876
|
if (!context.currentStep) {
|
|
2877
2877
|
return;
|
|
2878
2878
|
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2879
|
+
const currentStep = context.currentStep;
|
|
2880
|
+
if (currentStep.urlRequirement) {
|
|
2881
|
+
log(`StateMachineActionHandler: Validating URL requirement for step ${currentStep.id}`);
|
|
2882
|
+
const isValid = this.validateStepUrlRequirement(currentStep);
|
|
2882
2883
|
if (!isValid) {
|
|
2883
2884
|
return;
|
|
2884
2885
|
}
|
|
2885
2886
|
}
|
|
2886
|
-
const videoUrl = this.getVideoUrl(
|
|
2887
|
+
const videoUrl = this.getVideoUrl(currentStep);
|
|
2887
2888
|
try {
|
|
2888
2889
|
this.managers.interactionManager.clearButtons();
|
|
2889
2890
|
this.managers.interactionManager.clearDOMInteractions();
|
|
2890
|
-
if (
|
|
2891
|
-
this.managers.interactionManager.setupDOMInteractions(
|
|
2891
|
+
if (currentStep.domInteractions) {
|
|
2892
|
+
this.managers.interactionManager.setupDOMInteractions(currentStep.domInteractions);
|
|
2892
2893
|
}
|
|
2893
|
-
if (
|
|
2894
|
-
this.managers.interactionManager.createButtons(
|
|
2894
|
+
if (currentStep.buttons) {
|
|
2895
|
+
this.managers.interactionManager.createButtons(currentStep.buttons);
|
|
2895
2896
|
}
|
|
2896
|
-
log(`StateMachineActionHandler: Processing cursor animations for step ${
|
|
2897
|
-
log(`StateMachineActionHandler: Step has cursor animations: ${!!(
|
|
2898
|
-
if (
|
|
2899
|
-
log(`StateMachineActionHandler: Setting cursor visibility to true for step ${
|
|
2897
|
+
log(`StateMachineActionHandler: Processing cursor animations for step ${currentStep.id}`);
|
|
2898
|
+
log(`StateMachineActionHandler: Step has cursor animations: ${!!(currentStep.cursorAnimations && currentStep.cursorAnimations.length > 0)}`);
|
|
2899
|
+
if (currentStep.cursorAnimations && currentStep.cursorAnimations.length > 0) {
|
|
2900
|
+
log(`StateMachineActionHandler: Setting cursor visibility to true for step ${currentStep.id}`);
|
|
2900
2901
|
this.managers.cursorManager.setShouldShowCursor(true);
|
|
2901
|
-
log(`StateMachineActionHandler: Starting cursor animation for step ${
|
|
2902
|
-
this.managers.cursorManager.animate(
|
|
2902
|
+
log(`StateMachineActionHandler: Starting cursor animation for step ${currentStep.id} with target: ${currentStep.cursorAnimations[0].targetSelector || "no target"}`);
|
|
2903
|
+
this.managers.cursorManager.animate(currentStep.cursorAnimations[0]);
|
|
2903
2904
|
} else {
|
|
2904
|
-
log(`StateMachineActionHandler: Setting cursor visibility to false for step ${
|
|
2905
|
+
log(`StateMachineActionHandler: Setting cursor visibility to false for step ${currentStep.id} - step has no cursor animations`);
|
|
2905
2906
|
this.managers.cursorManager.setShouldShowCursor(false);
|
|
2906
2907
|
}
|
|
2907
|
-
const hasSpecialTransitions =
|
|
2908
|
+
const hasSpecialTransitions = currentStep.buttons && currentStep.buttons.length > 0 || currentStep.transitions.some(
|
|
2908
2909
|
(t) => t.type === "dom-click" || t.type === "url-path" || t.type === "dom-element-visible"
|
|
2909
2910
|
);
|
|
2910
2911
|
const completionPolicy = hasSpecialTransitions ? "manual" : "auto";
|
|
2911
2912
|
if (hasSpecialTransitions) {
|
|
2912
2913
|
log("StateMachineActionHandler: Setting up transitions immediately for step with special transitions");
|
|
2913
|
-
this.managers.transitionManager.setupTransitions(
|
|
2914
|
+
this.managers.transitionManager.setupTransitions(currentStep, false);
|
|
2914
2915
|
}
|
|
2915
2916
|
this.managers.videoManager.setCompletionPolicy(completionPolicy, () => {
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
log("StateMachineActionHandler: No valid next steps found, completing playlist");
|
|
2926
|
-
store.sendStateMachineEvent({
|
|
2927
|
-
type: "COMPLETE_PLAYLIST"
|
|
2928
|
-
});
|
|
2929
|
-
}
|
|
2930
|
-
} else {
|
|
2917
|
+
const store = useSaltfishStore.getState();
|
|
2918
|
+
if (!hasSpecialTransitions) {
|
|
2919
|
+
log("StateMachineActionHandler: Setting up transitions after video ended");
|
|
2920
|
+
this.managers.transitionManager.setupTransitions(currentStep, true);
|
|
2921
|
+
const hasValidNextSteps = currentStep.transitions.some((transition) => {
|
|
2922
|
+
return store.manifest.steps.some((s) => s.id === transition.nextStep);
|
|
2923
|
+
});
|
|
2924
|
+
if (!hasValidNextSteps) {
|
|
2925
|
+
log("StateMachineActionHandler: No valid next steps found, completing playlist");
|
|
2931
2926
|
store.sendStateMachineEvent({
|
|
2932
|
-
type: "
|
|
2933
|
-
step: context.currentStep
|
|
2927
|
+
type: "COMPLETE_PLAYLIST"
|
|
2934
2928
|
});
|
|
2935
2929
|
}
|
|
2930
|
+
} else {
|
|
2931
|
+
store.sendStateMachineEvent({
|
|
2932
|
+
type: "VIDEO_FINISHED_WAIT",
|
|
2933
|
+
step: currentStep
|
|
2934
|
+
});
|
|
2936
2935
|
}
|
|
2937
2936
|
});
|
|
2938
2937
|
log("StateMachineActionHandler: Starting async video load");
|
|
2939
2938
|
const loadTranscriptForStep = () => {
|
|
2940
2939
|
var _a, _b, _c;
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
log(`StateMachineActionHandler: Loading translated transcript for step ${context.currentStep.id} in language ${language}`);
|
|
2953
|
-
} else {
|
|
2954
|
-
log(`StateMachineActionHandler: No translated transcript found for language ${language}, using default`);
|
|
2955
|
-
}
|
|
2956
|
-
} else if (language) {
|
|
2957
|
-
log(`StateMachineActionHandler: No translation available for language ${language}, using default transcript`);
|
|
2958
|
-
}
|
|
2959
|
-
if (transcript) {
|
|
2960
|
-
log(`StateMachineActionHandler: Loading transcript for step ${context.currentStep.id}, initially visible: ${captionsEnabled}`);
|
|
2961
|
-
this.managers.videoManager.loadTranscript(transcript, captionsEnabled);
|
|
2940
|
+
const store = useSaltfishStore.getState();
|
|
2941
|
+
const currentPlaylistId = (_a = store.manifest) == null ? void 0 : _a.id;
|
|
2942
|
+
const currentPlaylist = (_b = store.backendPlaylists) == null ? void 0 : _b.find((p) => p.id === currentPlaylistId);
|
|
2943
|
+
const captionsEnabled = (currentPlaylist == null ? void 0 : currentPlaylist.captions) === true;
|
|
2944
|
+
const language = (_c = store.config) == null ? void 0 : _c.language;
|
|
2945
|
+
let transcript = currentStep.transcript;
|
|
2946
|
+
if (language && currentStep.translations && currentStep.translations[language]) {
|
|
2947
|
+
const translatedTranscript = currentStep.translations[language].transcript;
|
|
2948
|
+
if (translatedTranscript) {
|
|
2949
|
+
transcript = translatedTranscript;
|
|
2950
|
+
log(`StateMachineActionHandler: Loading translated transcript for step ${currentStep.id} in language ${language}`);
|
|
2962
2951
|
} else {
|
|
2963
|
-
log(`StateMachineActionHandler: No transcript
|
|
2964
|
-
this.managers.videoManager.loadTranscript(null, true);
|
|
2952
|
+
log(`StateMachineActionHandler: No translated transcript found for language ${language}, using default`);
|
|
2965
2953
|
}
|
|
2954
|
+
} else if (language) {
|
|
2955
|
+
log(`StateMachineActionHandler: No translation available for language ${language}, using default transcript`);
|
|
2956
|
+
}
|
|
2957
|
+
if (transcript) {
|
|
2958
|
+
log(`StateMachineActionHandler: Loading transcript for step ${currentStep.id}, initially visible: ${captionsEnabled}`);
|
|
2959
|
+
this.managers.videoManager.loadTranscript(transcript, captionsEnabled);
|
|
2966
2960
|
} else {
|
|
2961
|
+
log(`StateMachineActionHandler: No transcript available for step ${currentStep.id}`);
|
|
2967
2962
|
this.managers.videoManager.loadTranscript(null, true);
|
|
2968
2963
|
}
|
|
2969
2964
|
};
|
|
@@ -2971,15 +2966,13 @@ class StateMachineActionHandler {
|
|
|
2971
2966
|
log("StateMachineActionHandler: Video loaded successfully, playing");
|
|
2972
2967
|
loadTranscriptForStep();
|
|
2973
2968
|
this.managers.videoManager.play();
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
this.managers.videoManager.preloadNextVideo(nextVideoUrl);
|
|
2979
|
-
}
|
|
2969
|
+
const nextVideoUrl = this.findNextVideoUrl(currentStep);
|
|
2970
|
+
if (nextVideoUrl) {
|
|
2971
|
+
log(`StateMachineActionHandler: Preloading next video: ${nextVideoUrl}`);
|
|
2972
|
+
this.managers.videoManager.preloadNextVideo(nextVideoUrl);
|
|
2980
2973
|
}
|
|
2981
2974
|
}).catch((error2) => {
|
|
2982
|
-
var _a
|
|
2975
|
+
var _a;
|
|
2983
2976
|
log(`StateMachineActionHandler: Error loading video: ${error2}`);
|
|
2984
2977
|
this.managers.uiManager.showError(
|
|
2985
2978
|
error2 instanceof Error ? error2 : new Error(`Failed to load video: ${error2}`),
|
|
@@ -2991,7 +2984,7 @@ class StateMachineActionHandler {
|
|
|
2991
2984
|
this.managers.eventManager.trigger("error", {
|
|
2992
2985
|
timestamp: Date.now(),
|
|
2993
2986
|
playlistId: ((_a = store.manifest) == null ? void 0 : _a.id) || void 0,
|
|
2994
|
-
stepId:
|
|
2987
|
+
stepId: currentStep.id,
|
|
2995
2988
|
error: errorObj,
|
|
2996
2989
|
errorType: "video",
|
|
2997
2990
|
videoUrl: enrichedError == null ? void 0 : enrichedError.videoUrl,
|
|
@@ -3019,34 +3012,35 @@ class StateMachineActionHandler {
|
|
|
3019
3012
|
if (!context.currentStep) {
|
|
3020
3013
|
return;
|
|
3021
3014
|
}
|
|
3022
|
-
const
|
|
3015
|
+
const currentStep = context.currentStep;
|
|
3016
|
+
const videoUrl = this.getVideoUrl(currentStep);
|
|
3023
3017
|
try {
|
|
3024
3018
|
this.managers.interactionManager.clearButtons();
|
|
3025
3019
|
this.managers.interactionManager.clearDOMInteractions();
|
|
3026
|
-
if (
|
|
3027
|
-
this.managers.interactionManager.setupDOMInteractions(
|
|
3020
|
+
if (currentStep.domInteractions) {
|
|
3021
|
+
this.managers.interactionManager.setupDOMInteractions(currentStep.domInteractions);
|
|
3028
3022
|
}
|
|
3029
|
-
if (
|
|
3030
|
-
this.managers.interactionManager.createButtons(
|
|
3023
|
+
if (currentStep.buttons) {
|
|
3024
|
+
this.managers.interactionManager.createButtons(currentStep.buttons);
|
|
3031
3025
|
}
|
|
3032
|
-
if (
|
|
3033
|
-
log(`StateMachineActionHandler: Setting up cursor animations for idle mode step ${
|
|
3026
|
+
if (currentStep.cursorAnimations && currentStep.cursorAnimations.length > 0) {
|
|
3027
|
+
log(`StateMachineActionHandler: Setting up cursor animations for idle mode step ${currentStep.id}`);
|
|
3034
3028
|
this.managers.cursorManager.setShouldShowCursor(true);
|
|
3035
|
-
this.managers.cursorManager.animate(
|
|
3029
|
+
this.managers.cursorManager.animate(currentStep.cursorAnimations[0]);
|
|
3036
3030
|
} else {
|
|
3037
3031
|
this.managers.cursorManager.setShouldShowCursor(false);
|
|
3038
3032
|
}
|
|
3039
|
-
const hasSpecialTransitions =
|
|
3033
|
+
const hasSpecialTransitions = currentStep.buttons && currentStep.buttons.length > 0 || currentStep.transitions.some(
|
|
3040
3034
|
(t) => t.type === "dom-click" || t.type === "url-path"
|
|
3041
3035
|
);
|
|
3042
3036
|
const completionPolicy = hasSpecialTransitions ? "manual" : "auto";
|
|
3043
3037
|
if (hasSpecialTransitions) {
|
|
3044
3038
|
log("StateMachineActionHandler: Setting up transitions for idle mode step with special transitions");
|
|
3045
|
-
this.managers.transitionManager.setupTransitions(
|
|
3039
|
+
this.managers.transitionManager.setupTransitions(currentStep, false);
|
|
3046
3040
|
}
|
|
3047
3041
|
this.managers.videoManager.setCompletionPolicy(completionPolicy, () => {
|
|
3048
|
-
if (
|
|
3049
|
-
this.managers.transitionManager.setupTransitions(
|
|
3042
|
+
if (!hasSpecialTransitions) {
|
|
3043
|
+
this.managers.transitionManager.setupTransitions(currentStep, true);
|
|
3050
3044
|
}
|
|
3051
3045
|
});
|
|
3052
3046
|
log("StateMachineActionHandler: Starting async idle mode video load");
|
|
@@ -3061,27 +3055,25 @@ class StateMachineActionHandler {
|
|
|
3061
3055
|
log("StateMachineActionHandler: Idle mode video play failed");
|
|
3062
3056
|
});
|
|
3063
3057
|
}
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
log(`StateMachineActionHandler: Using translated transcript for idle mode, language: ${language}`);
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
if (transcript) {
|
|
3079
|
-
log(`StateMachineActionHandler: Loading transcript for idle mode step ${context.currentStep.id}, initially visible: ${captionsEnabled}`);
|
|
3080
|
-
this.managers.videoManager.loadTranscript(transcript, captionsEnabled);
|
|
3081
|
-
} else {
|
|
3082
|
-
this.managers.videoManager.loadTranscript(null, true);
|
|
3058
|
+
const store = useSaltfishStore.getState();
|
|
3059
|
+
const currentPlaylistId = (_a = store.manifest) == null ? void 0 : _a.id;
|
|
3060
|
+
const currentPlaylist = (_b = store.backendPlaylists) == null ? void 0 : _b.find((p) => p.id === currentPlaylistId);
|
|
3061
|
+
const captionsEnabled = (currentPlaylist == null ? void 0 : currentPlaylist.captions) === true;
|
|
3062
|
+
const language = (_c = store.config) == null ? void 0 : _c.language;
|
|
3063
|
+
let transcript = currentStep.transcript;
|
|
3064
|
+
if (language && currentStep.translations && currentStep.translations[language]) {
|
|
3065
|
+
const translation = currentStep.translations[language];
|
|
3066
|
+
if (translation.transcript) {
|
|
3067
|
+
transcript = translation.transcript;
|
|
3068
|
+
log(`StateMachineActionHandler: Using translated transcript for idle mode, language: ${language}`);
|
|
3083
3069
|
}
|
|
3084
3070
|
}
|
|
3071
|
+
if (transcript) {
|
|
3072
|
+
log(`StateMachineActionHandler: Loading transcript for idle mode step ${currentStep.id}, initially visible: ${captionsEnabled}`);
|
|
3073
|
+
this.managers.videoManager.loadTranscript(transcript, captionsEnabled);
|
|
3074
|
+
} else {
|
|
3075
|
+
this.managers.videoManager.loadTranscript(null, true);
|
|
3076
|
+
}
|
|
3085
3077
|
}).catch((error2) => {
|
|
3086
3078
|
log(`StateMachineActionHandler: Error loading idle mode video: ${error2}`);
|
|
3087
3079
|
});
|
|
@@ -3575,10 +3567,6 @@ const _ManagerOrchestrator = class _ManagerOrchestrator {
|
|
|
3575
3567
|
this.uiUpdaterUnsubscribe();
|
|
3576
3568
|
this.uiUpdaterUnsubscribe = null;
|
|
3577
3569
|
}
|
|
3578
|
-
if (this.eventUpdaterUnsubscribe) {
|
|
3579
|
-
this.eventUpdaterUnsubscribe();
|
|
3580
|
-
this.eventUpdaterUnsubscribe = null;
|
|
3581
|
-
}
|
|
3582
3570
|
this.managers.transitionManager.destroy();
|
|
3583
3571
|
this.managers.videoManager.destroy();
|
|
3584
3572
|
this.managers.cursorManager.destroy();
|
|
@@ -3586,7 +3574,6 @@ const _ManagerOrchestrator = class _ManagerOrchestrator {
|
|
|
3586
3574
|
this.managers.playlistManager.destroy();
|
|
3587
3575
|
this.managers.stepTimeoutManager.destroy();
|
|
3588
3576
|
this.managers.uiManager.destroy();
|
|
3589
|
-
store.resetForNewPlaylist();
|
|
3590
3577
|
log("ManagerOrchestrator: Playlist cleanup completed, trigger monitoring preserved");
|
|
3591
3578
|
} catch (error2) {
|
|
3592
3579
|
ErrorHandler.handleCleanupError(
|