saltfish 0.3.67 → 0.3.68
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.
|
@@ -3311,6 +3311,7 @@ class StateMachineActionHandler {
|
|
|
3311
3311
|
}
|
|
3312
3312
|
// Private action handler methods
|
|
3313
3313
|
async handleStartVideoPlayback(context) {
|
|
3314
|
+
var _a, _b, _c;
|
|
3314
3315
|
if (!context.currentStep) {
|
|
3315
3316
|
return;
|
|
3316
3317
|
}
|
|
@@ -3323,12 +3324,18 @@ class StateMachineActionHandler {
|
|
|
3323
3324
|
}
|
|
3324
3325
|
}
|
|
3325
3326
|
this.managers.uiManager.updatePosition();
|
|
3327
|
+
const store = getSaltfishStore();
|
|
3328
|
+
const isFirstStep = store.manifest && store.currentStepId === ((_a = store.manifest.steps[0]) == null ? void 0 : _a.id);
|
|
3329
|
+
if (isFirstStep && ((_b = store.manifest) == null ? void 0 : _b.idleMode) && ((_c = store.manifest) == null ? void 0 : _c.compactFirstStep)) {
|
|
3330
|
+
const playerElement = this.managers.uiManager.getPlayerElement();
|
|
3331
|
+
playerElement == null ? void 0 : playerElement.classList.add("sf-player--compact");
|
|
3332
|
+
}
|
|
3326
3333
|
this.managers.uiManager.showPlayer();
|
|
3327
3334
|
const videoUrl = this.getVideoUrl(currentStep);
|
|
3328
3335
|
const isAudioFallback = this.isUsingAudioFallback(currentStep);
|
|
3329
3336
|
if (isAudioFallback) {
|
|
3330
|
-
const
|
|
3331
|
-
const manifest =
|
|
3337
|
+
const store2 = getSaltfishStore();
|
|
3338
|
+
const manifest = store2.manifest;
|
|
3332
3339
|
const posterUrl = currentStep.gifUrl;
|
|
3333
3340
|
const avatarThumbnailUrl = manifest == null ? void 0 : manifest.avatarThumbnailUrl;
|
|
3334
3341
|
this.managers.videoManager.showAudioFallbackOverlay(posterUrl, avatarThumbnailUrl);
|
|
@@ -3350,8 +3357,8 @@ class StateMachineActionHandler {
|
|
|
3350
3357
|
this.managers.transitionManager.setupTransitions(currentStep, false, true);
|
|
3351
3358
|
}
|
|
3352
3359
|
this.managers.videoManager.setCompletionPolicy(completionPolicy, () => {
|
|
3353
|
-
var
|
|
3354
|
-
const
|
|
3360
|
+
var _a2;
|
|
3361
|
+
const store2 = getSaltfishStore();
|
|
3355
3362
|
if (!hasSpecialTransitions) {
|
|
3356
3363
|
const timeoutTransition = currentStep.transitions.find((t) => t.type === "timeout");
|
|
3357
3364
|
const hasNonZeroTimeout = timeoutTransition && timeoutTransition.timeout && timeoutTransition.timeout > 0;
|
|
@@ -3363,33 +3370,33 @@ class StateMachineActionHandler {
|
|
|
3363
3370
|
this.managers.transitionManager.setupTransitions(currentStep, true);
|
|
3364
3371
|
}
|
|
3365
3372
|
const hasValidNextSteps = currentStep.transitions.some((transition) => {
|
|
3366
|
-
return
|
|
3373
|
+
return store2.manifest.steps.some((s) => s.id === transition.nextStep);
|
|
3367
3374
|
});
|
|
3368
3375
|
if (!hasValidNextSteps) {
|
|
3369
3376
|
log("StateMachineActionHandler: No valid next steps found, completing playlist");
|
|
3370
|
-
|
|
3377
|
+
store2.sendStateMachineEvent({
|
|
3371
3378
|
type: "COMPLETE_PLAYLIST"
|
|
3372
3379
|
});
|
|
3373
3380
|
}
|
|
3374
3381
|
} else {
|
|
3375
3382
|
const timeoutTransition = currentStep.transitions.find((t) => t.type === "timeout");
|
|
3376
|
-
const hasStepTransitionButtons = (
|
|
3383
|
+
const hasStepTransitionButtons = (_a2 = currentStep.buttons) == null ? void 0 : _a2.some(
|
|
3377
3384
|
(button) => button.action.type === "goto" || button.action.type === "next"
|
|
3378
3385
|
);
|
|
3379
3386
|
if (timeoutTransition && !hasStepTransitionButtons) {
|
|
3380
3387
|
const timeout = timeoutTransition.timeout || 0;
|
|
3381
3388
|
log(`StateMachineActionHandler: Video ended, setting up timeout transition to ${timeoutTransition.nextStep} with ${timeout}ms delay`);
|
|
3382
3389
|
setTimeout(() => {
|
|
3383
|
-
var
|
|
3390
|
+
var _a3;
|
|
3384
3391
|
const currentStore = getSaltfishStore();
|
|
3385
3392
|
if (currentStore.currentStepId === currentStep.id && (currentStore.currentState === "waitingForInteraction" || currentStore.currentState === "playing")) {
|
|
3386
3393
|
log(`StateMachineActionHandler: Timeout expired (${timeout}ms), transitioning to ${timeoutTransition.nextStep}`);
|
|
3387
|
-
(
|
|
3394
|
+
(_a3 = currentStore.goToStep) == null ? void 0 : _a3.call(currentStore, timeoutTransition.nextStep);
|
|
3388
3395
|
} else {
|
|
3389
3396
|
log(`StateMachineActionHandler: Timeout cancelled - step changed or state is ${currentStore.currentState}`);
|
|
3390
3397
|
}
|
|
3391
3398
|
}, timeout);
|
|
3392
|
-
|
|
3399
|
+
store2.sendStateMachineEvent({
|
|
3393
3400
|
type: "VIDEO_FINISHED_WAIT",
|
|
3394
3401
|
step: currentStep
|
|
3395
3402
|
});
|
|
@@ -3399,7 +3406,7 @@ class StateMachineActionHandler {
|
|
|
3399
3406
|
} else {
|
|
3400
3407
|
log("StateMachineActionHandler: Video ended, waiting for user interaction");
|
|
3401
3408
|
}
|
|
3402
|
-
|
|
3409
|
+
store2.sendStateMachineEvent({
|
|
3403
3410
|
type: "VIDEO_FINISHED_WAIT",
|
|
3404
3411
|
step: currentStep
|
|
3405
3412
|
});
|
|
@@ -3408,10 +3415,10 @@ class StateMachineActionHandler {
|
|
|
3408
3415
|
});
|
|
3409
3416
|
log("StateMachineActionHandler: Starting async video load");
|
|
3410
3417
|
const loadTranscriptForStep = () => {
|
|
3411
|
-
var
|
|
3412
|
-
const
|
|
3413
|
-
const captionsEnabled = ((
|
|
3414
|
-
const language = (
|
|
3418
|
+
var _a2, _b2;
|
|
3419
|
+
const store2 = getSaltfishStore();
|
|
3420
|
+
const captionsEnabled = ((_a2 = store2.manifest) == null ? void 0 : _a2.captions) ?? true;
|
|
3421
|
+
const language = (_b2 = store2.userData) == null ? void 0 : _b2.language;
|
|
3415
3422
|
let transcript = currentStep.transcript;
|
|
3416
3423
|
if (language && currentStep.translations && currentStep.translations[language]) {
|
|
3417
3424
|
const translatedTranscript = currentStep.translations[language].transcript;
|
|
@@ -3456,18 +3463,18 @@ class StateMachineActionHandler {
|
|
|
3456
3463
|
this.managers.videoManager.preloadNextVideo(nextVideoUrl);
|
|
3457
3464
|
}
|
|
3458
3465
|
}).catch((error2) => {
|
|
3459
|
-
var
|
|
3466
|
+
var _a2;
|
|
3460
3467
|
log(`StateMachineActionHandler: Error loading video: ${error2}`);
|
|
3461
3468
|
this.managers.uiManager.showError(
|
|
3462
3469
|
error2 instanceof Error ? error2 : new Error(`Failed to load video: ${error2}`),
|
|
3463
3470
|
"video"
|
|
3464
3471
|
);
|
|
3465
|
-
const
|
|
3472
|
+
const store2 = getSaltfishStore();
|
|
3466
3473
|
const errorObj = error2 instanceof Error ? error2 : new Error(`Failed to load video: ${error2}`);
|
|
3467
3474
|
const enrichedError = error2;
|
|
3468
3475
|
this.managers.eventManager.trigger("error", {
|
|
3469
3476
|
timestamp: Date.now(),
|
|
3470
|
-
playlistId: ((
|
|
3477
|
+
playlistId: ((_a2 = store2.manifest) == null ? void 0 : _a2.id) || void 0,
|
|
3471
3478
|
stepId: currentStep.id,
|
|
3472
3479
|
error: errorObj,
|
|
3473
3480
|
errorType: "video",
|
|
@@ -12566,7 +12573,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
12566
12573
|
__proto__: null,
|
|
12567
12574
|
SaltfishPlayer
|
|
12568
12575
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
12569
|
-
const version = "0.3.
|
|
12576
|
+
const version = "0.3.68";
|
|
12570
12577
|
const packageJson = {
|
|
12571
12578
|
version
|
|
12572
12579
|
};
|