saltfish 0.3.53 → 0.3.55

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.
@@ -3243,10 +3243,6 @@ class StateMachineActionHandler {
3243
3243
  }
3244
3244
  try {
3245
3245
  this.managers.interactionManager.clearButtons();
3246
- this.managers.interactionManager.clearDOMInteractions();
3247
- if (currentStep.domInteractions) {
3248
- this.managers.interactionManager.setupDOMInteractions(currentStep.domInteractions);
3249
- }
3250
3246
  if (currentStep.buttons) {
3251
3247
  this.managers.interactionManager.createButtons(currentStep.buttons);
3252
3248
  }
@@ -3263,8 +3259,15 @@ class StateMachineActionHandler {
3263
3259
  var _a;
3264
3260
  const store = getSaltfishStore();
3265
3261
  if (!hasSpecialTransitions) {
3266
- log("StateMachineActionHandler: Setting up transitions after video ended");
3267
- this.managers.transitionManager.setupTransitions(currentStep, true);
3262
+ const timeoutTransition = currentStep.transitions.find((t) => t.type === "timeout");
3263
+ const hasNonZeroTimeout = timeoutTransition && timeoutTransition.timeout && timeoutTransition.timeout > 0;
3264
+ if (hasNonZeroTimeout) {
3265
+ log(`StateMachineActionHandler: Setting up transitions after video ended with ${timeoutTransition.timeout}ms delay`);
3266
+ this.managers.transitionManager.setupTransitions(currentStep, false);
3267
+ } else {
3268
+ log("StateMachineActionHandler: Setting up transitions after video ended (immediate)");
3269
+ this.managers.transitionManager.setupTransitions(currentStep, true);
3270
+ }
3268
3271
  const hasValidNextSteps = currentStep.transitions.some((transition) => {
3269
3272
  return store.manifest.steps.some((s) => s.id === transition.nextStep);
3270
3273
  });
@@ -3986,7 +3989,6 @@ const _ManagerOrchestrator = class _ManagerOrchestrator {
3986
3989
  }
3987
3990
  if (this.managers.interactionManager) {
3988
3991
  this.managers.interactionManager.clearButtons();
3989
- this.managers.interactionManager.clearDOMInteractions();
3990
3992
  }
3991
3993
  this.managers.uiManager.reset();
3992
3994
  log("ManagerOrchestrator: Current playlist cleanup completed");
@@ -8087,7 +8089,6 @@ class InteractionManager {
8087
8089
  __publicField(this, "buttons", []);
8088
8090
  __publicField(this, "buttonContainer", null);
8089
8091
  __publicField(this, "scrollIndicator", null);
8090
- __publicField(this, "domEventListeners", /* @__PURE__ */ new Map());
8091
8092
  __publicField(this, "storeUnsubscribe", null);
8092
8093
  __publicField(this, "storageManager", StorageManager.getInstance());
8093
8094
  /**
@@ -8266,52 +8267,6 @@ class InteractionManager {
8266
8267
  }
8267
8268
  }
8268
8269
  }
8269
- /**
8270
- * Sets up DOM interactions
8271
- * @param interactions - DOM interaction configurations
8272
- */
8273
- setupDOMInteractions(interactions) {
8274
- this.clearDOMInteractions();
8275
- interactions.forEach((interaction, index) => {
8276
- try {
8277
- const elements = document.querySelectorAll(interaction.selector);
8278
- if (elements.length === 0) {
8279
- log(`InteractionManager: No elements found matching selector "${interaction.selector}"`);
8280
- return;
8281
- }
8282
- log(`InteractionManager: Found ${elements.length} elements matching selector "${interaction.selector}"`);
8283
- elements.forEach((element, elementIndex) => {
8284
- const htmlElement = element;
8285
- const listenerId = `dom-interaction-${index}-${elementIndex}-${Date.now()}`;
8286
- const listener = (event) => {
8287
- this.handleDOMInteraction(event, interaction);
8288
- };
8289
- htmlElement.addEventListener(interaction.action, listener);
8290
- this.domEventListeners.set(listenerId, {
8291
- element: htmlElement,
8292
- listener,
8293
- type: interaction.action
8294
- });
8295
- log(`InteractionManager: Added ${interaction.action} listener to element with selector "${interaction.selector}"`);
8296
- });
8297
- } catch (error2) {
8298
- console.error(`InteractionManager: Error setting up DOM interaction for selector "${interaction.selector}":`, error2);
8299
- }
8300
- });
8301
- }
8302
- /**
8303
- * Clears all DOM interaction listeners
8304
- */
8305
- clearDOMInteractions() {
8306
- this.domEventListeners.forEach(({ element, listener, type }) => {
8307
- try {
8308
- element.removeEventListener(type, listener);
8309
- } catch (error2) {
8310
- console.error("InteractionManager: Error removing event listener:", error2);
8311
- }
8312
- });
8313
- this.domEventListeners.clear();
8314
- }
8315
8270
  /**
8316
8271
  * Handles button clicks
8317
8272
  * @param event - The click event
@@ -8455,35 +8410,6 @@ class InteractionManager {
8455
8410
  log(`InteractionManager: Tracked button interaction: ${JSON.stringify(analyticsData)}`);
8456
8411
  }
8457
8412
  }
8458
- /**
8459
- * Handles DOM interactions
8460
- * @param event - The event
8461
- * @param interaction - The interaction configuration
8462
- */
8463
- handleDOMInteraction(event, interaction) {
8464
- log(`InteractionManager: DOM interaction detected: ${interaction.action} on element with selector "${interaction.selector}"`);
8465
- if (interaction.waitFor) {
8466
- event.preventDefault();
8467
- event.stopPropagation();
8468
- log(`InteractionManager: Wait-for interaction "${interaction.selector}" detected, but interaction transitions are no longer supported`);
8469
- }
8470
- if (interaction.action === "input" && interaction.value) {
8471
- const inputElement = event.target;
8472
- if (inputElement) {
8473
- inputElement.value = interaction.value;
8474
- log(`InteractionManager: Set input value to "${interaction.value}"`);
8475
- }
8476
- }
8477
- const store = getSaltfishStore();
8478
- if (store.manifest) {
8479
- const analyticsData = {
8480
- selector: interaction.selector,
8481
- action: interaction.action,
8482
- value: interaction.value
8483
- };
8484
- log(`InteractionManager: Tracked DOM interaction: ${JSON.stringify(analyticsData)}`);
8485
- }
8486
- }
8487
8413
  /**
8488
8414
  * Checks if the current step is the last step in the playlist
8489
8415
  * @param store - The current store state
@@ -8520,7 +8446,6 @@ class InteractionManager {
8520
8446
  */
8521
8447
  reset() {
8522
8448
  this.clearButtons();
8523
- this.clearDOMInteractions();
8524
8449
  this.buttonContainer = null;
8525
8450
  this.scrollIndicator = null;
8526
8451
  if (this.container) {
@@ -8539,7 +8464,6 @@ class InteractionManager {
8539
8464
  this.container.removeEventListener("video90PercentReached", this.handleVideo90PercentReached);
8540
8465
  }
8541
8466
  this.clearButtons();
8542
- this.clearDOMInteractions();
8543
8467
  this.container = null;
8544
8468
  }
8545
8469
  }
@@ -12053,7 +11977,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
12053
11977
  __proto__: null,
12054
11978
  SaltfishPlayer
12055
11979
  }, Symbol.toStringTag, { value: "Module" }));
12056
- const version = "0.3.53";
11980
+ const version = "0.3.55";
12057
11981
  const packageJson = {
12058
11982
  version
12059
11983
  };