saltfish 0.3.26 → 0.3.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.
@@ -957,13 +957,6 @@ const STORAGE_KEYS = {
957
957
  SESSION: "saltfish_session",
958
958
  ANONYMOUS_USER: "saltfish_anonymous_user_data"
959
959
  };
960
- const TIMING$1 = {
961
- // 5 seconds
962
- STEP_TIMEOUT: 12e4,
963
- // Session persistence
964
- SESSION_EXPIRY: 30 * 60 * 1e3
965
- // 30 minutes in milliseconds
966
- };
967
960
  const API = {
968
961
  BASE_URL: "https://player.saltfish.ai",
969
962
  SHARE_BASE_URL: "https://studio-api.saltfish.ai/studio/flows2/share",
@@ -1877,9 +1870,7 @@ class PlayerInitializationService {
1877
1870
  constructor(managers) {
1878
1871
  __publicField(this, "managers");
1879
1872
  __publicField(this, "userManagementService");
1880
- // Will be injected
1881
1873
  __publicField(this, "playlistOrchestrator");
1882
- // Will be injected
1883
1874
  __publicField(this, "shareLinkService");
1884
1875
  // Store the last config for potential reinitialization
1885
1876
  __publicField(this, "lastConfig", null);
@@ -2042,7 +2033,7 @@ class PlayerInitializationService {
2042
2033
  const resumedPlaylist = await this.checkAndResumeInProgressPlaylist(data.watchedPlaylists || {});
2043
2034
  if (!resumedPlaylist) {
2044
2035
  const shareData = await this.shareLinkService.shouldAutoStartSharePlaylist();
2045
- if (shareData) {
2036
+ if (shareData && this.playlistOrchestrator) {
2046
2037
  log("[PlayerInitializationService.fetchUserData] Share link detected, auto-starting playlist:", shareData.flowId);
2047
2038
  await this.playlistOrchestrator.startPlaylist(shareData.flowId, {
2048
2039
  once: false,
@@ -2129,7 +2120,7 @@ class PlayerInitializationService {
2129
2120
  const resumedPlaylist = await this.checkAndResumeInProgressPlaylist(watchedPlaylists);
2130
2121
  if (!resumedPlaylist) {
2131
2122
  const shareData = await this.shareLinkService.shouldAutoStartSharePlaylist();
2132
- if (shareData) {
2123
+ if (shareData && this.playlistOrchestrator) {
2133
2124
  log("[PlayerInitializationService.loadAnonymousUserData] Share link detected, auto-starting playlist:", shareData.flowId);
2134
2125
  await this.playlistOrchestrator.startPlaylist(shareData.flowId, {
2135
2126
  once: false,
@@ -2254,7 +2245,6 @@ class UserManagementService {
2254
2245
  constructor(managers) {
2255
2246
  __publicField(this, "managers");
2256
2247
  __publicField(this, "playerInitializationService");
2257
- // Will be injected
2258
2248
  // State for managing user data loading promise
2259
2249
  __publicField(this, "userDataLoadedPromise", null);
2260
2250
  __publicField(this, "userDataLoadedResolve", null);
@@ -2645,15 +2635,11 @@ class PlaylistValidator {
2645
2635
  }
2646
2636
  }
2647
2637
  class PlaylistOrchestrator {
2648
- // Will be injected
2649
2638
  constructor(managers) {
2650
2639
  __publicField(this, "managers");
2651
2640
  __publicField(this, "userManagementService");
2652
- // Will be injected
2653
2641
  __publicField(this, "managerOrchestrator");
2654
- // Will be injected
2655
2642
  __publicField(this, "playerInitializationService");
2656
- // Will be injected
2657
2643
  __publicField(this, "stateMachineActionHandler");
2658
2644
  this.managers = managers;
2659
2645
  }
@@ -2694,7 +2680,7 @@ class PlaylistOrchestrator {
2694
2680
  try {
2695
2681
  await this.playerInitializationService.initialize(lastConfig);
2696
2682
  const lastUserIdentification = (_a = this.userManagementService) == null ? void 0 : _a.getLastUserIdentification();
2697
- if (lastUserIdentification) {
2683
+ if (lastUserIdentification && this.userManagementService) {
2698
2684
  this.userManagementService.identifyUser(
2699
2685
  lastUserIdentification.userId,
2700
2686
  lastUserIdentification.userData
@@ -6439,14 +6425,34 @@ const ANALYTICS = {
6439
6425
  FLUSH_INTERVAL_MS: 3e4
6440
6426
  };
6441
6427
  const TIMING = {
6428
+ // Polling and updates
6429
+ /** Video progress polling interval (50ms) */
6430
+ VIDEO_PROGRESS_POLL_INTERVAL: 50,
6431
+ /** Cursor position update throttle interval (100ms) */
6432
+ CURSOR_UPDATE_THROTTLE: 100,
6433
+ /** Delay for state processing operations (100ms) */
6434
+ STATE_PROCESSING_DELAY_MS: 100,
6435
+ // Analytics
6436
+ /** Analytics event flush interval (30 seconds) */
6437
+ ANALYTICS_FLUSH_INTERVAL: 3e4,
6438
+ // Timeouts
6439
+ /** User data loading timeout (5 seconds) */
6440
+ USER_DATA_TIMEOUT: 5e3,
6441
+ /** Step timeout - player will be destroyed if user stays on same step (120 seconds) */
6442
+ STEP_TIMEOUT: 12e4,
6443
+ /** Retry delay for failed operations (0.5 seconds) */
6444
+ RETRY_DELAY_MS: 500,
6445
+ // DOM and cursor operations
6442
6446
  /** Delay for DOM stabilization before cursor operations (0.5 seconds) */
6443
6447
  DOM_STABILIZATION_DELAY_MS: 500,
6444
- /** Delay for state processing operations (100 milliseconds) */
6445
- STATE_PROCESSING_DELAY_MS: 100,
6448
+ /** Default cursor animation distance in pixels */
6449
+ CURSOR_DEFAULT_DISTANCE: 100,
6450
+ // URL monitoring
6446
6451
  /** Interval for checking URL path changes (5 seconds) */
6447
6452
  URL_PATH_CHECK_INTERVAL_MS: 5e3,
6448
- /** Retry delay for failed operations (0.5 seconds) */
6449
- RETRY_DELAY_MS: 500
6453
+ // Session persistence
6454
+ /** Session expiry time (30 minutes) */
6455
+ SESSION_EXPIRY: 30 * 60 * 1e3
6450
6456
  };
6451
6457
  const THRESHOLDS = {
6452
6458
  /** Minimum scroll distance in pixels to trigger scroll events */
@@ -8576,7 +8582,7 @@ class SessionManager {
8576
8582
  const sessionData = this.storageManager.getSession();
8577
8583
  if (sessionData) {
8578
8584
  const now = Date.now();
8579
- if (now - sessionData.lastActivity < TIMING$1.SESSION_EXPIRY) {
8585
+ if (now - sessionData.lastActivity < TIMING.SESSION_EXPIRY) {
8580
8586
  log(`SessionManager: Using existing session: ${sessionData.sessionId}`);
8581
8587
  this.updateSessionActivity(sessionData.sessionId);
8582
8588
  return sessionData.sessionId;
@@ -11350,7 +11356,7 @@ const _StepTimeoutManager = class _StepTimeoutManager {
11350
11356
  this.destroyCallback = null;
11351
11357
  }
11352
11358
  };
11353
- __publicField(_StepTimeoutManager, "STEP_TIMEOUT_MS", TIMING$1.STEP_TIMEOUT);
11359
+ __publicField(_StepTimeoutManager, "STEP_TIMEOUT_MS", TIMING.STEP_TIMEOUT);
11354
11360
  let StepTimeoutManager = _StepTimeoutManager;
11355
11361
  class ManagerFactory {
11356
11362
  /**
@@ -11608,7 +11614,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
11608
11614
  __proto__: null,
11609
11615
  SaltfishPlayer
11610
11616
  }, Symbol.toStringTag, { value: "Module" }));
11611
- const version = "0.3.26";
11617
+ const version = "0.3.28";
11612
11618
  const packageJson = {
11613
11619
  version
11614
11620
  };