saltfish 0.3.59 → 0.3.61

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.
@@ -1155,17 +1155,6 @@ const _StorageManager = class _StorageManager {
1155
1155
  this.safeClearItem(STORAGE_KEYS.ANONYMOUS_USER);
1156
1156
  }
1157
1157
  // =============================================================================
1158
- // Anonymous User ID Methods
1159
- // =============================================================================
1160
- /**
1161
- * Get anonymous user ID from the anonymous user data object
1162
- * This reads from the same key as getAnonymousUserData() for consistency
1163
- */
1164
- getAnonymousUserId() {
1165
- const data = this.getAnonymousUserData();
1166
- return (data == null ? void 0 : data.userId) || null;
1167
- }
1168
- // =============================================================================
1169
1158
  // Utility Methods
1170
1159
  // =============================================================================
1171
1160
  /**
@@ -1176,33 +1165,6 @@ const _StorageManager = class _StorageManager {
1176
1165
  this.clearSession();
1177
1166
  this.clearAnonymousUserData();
1178
1167
  }
1179
- /**
1180
- * Get storage availability status
1181
- */
1182
- isStorageAvailable() {
1183
- return this.isLocalStorageAvailable;
1184
- }
1185
- /**
1186
- * Get storage usage information (if available)
1187
- */
1188
- getStorageInfo() {
1189
- const keys = [];
1190
- if (this.isLocalStorageAvailable) {
1191
- try {
1192
- for (let i = 0; i < localStorage.length; i++) {
1193
- const key = localStorage.key(i);
1194
- if (key && key.startsWith("saltfish_")) {
1195
- keys.push(key);
1196
- }
1197
- }
1198
- } catch (error2) {
1199
- }
1200
- }
1201
- return {
1202
- available: this.isLocalStorageAvailable,
1203
- keys
1204
- };
1205
- }
1206
1168
  };
1207
1169
  __publicField(_StorageManager, "instance", null);
1208
1170
  let StorageManager = _StorageManager;
@@ -4283,7 +4245,7 @@ class DeviceDetector {
4283
4245
  return this.cachedDeviceInfo;
4284
4246
  }
4285
4247
  const userAgent = typeof navigator !== "undefined" ? navigator.userAgent : "";
4286
- const isTouchDevice2 = this.detectTouchSupport();
4248
+ const isTouchDevice = this.detectTouchSupport();
4287
4249
  const { width, height } = this.getScreenDimensions();
4288
4250
  const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i;
4289
4251
  const tabletRegex = /iPad|Android(?!.*Mobile)|Tablet|tablet/i;
@@ -4292,14 +4254,14 @@ class DeviceDetector {
4292
4254
  const screenSize = this.getScreenSize(width, height);
4293
4255
  const isMobileByScreen = screenSize === "small" && Math.min(width, height) < 768;
4294
4256
  const isTabletByScreen = screenSize === "medium" && !isMobileByScreen;
4295
- const isMobile2 = isMobileUserAgent || isMobileByScreen && isTouchDevice2;
4296
- const isTablet2 = isTabletUserAgent || isTabletByScreen && isTouchDevice2 && !isMobile2;
4297
- const isDesktop2 = !isMobile2 && !isTablet2;
4257
+ const isMobile = isMobileUserAgent || isMobileByScreen && isTouchDevice;
4258
+ const isTablet = isTabletUserAgent || isTabletByScreen && isTouchDevice && !isMobile;
4259
+ const isDesktop = !isMobile && !isTablet;
4298
4260
  const deviceInfo = {
4299
- isMobile: isMobile2,
4300
- isTablet: isTablet2,
4301
- isDesktop: isDesktop2,
4302
- isTouchDevice: isTouchDevice2,
4261
+ isMobile,
4262
+ isTablet,
4263
+ isDesktop,
4264
+ isTouchDevice,
4303
4265
  screenSize,
4304
4266
  orientation: this.detectOrientation(),
4305
4267
  userAgent
@@ -6876,6 +6838,44 @@ function isElementValid(element, expectedElement, expectedSize, config = DEFAULT
6876
6838
  }
6877
6839
  return true;
6878
6840
  }
6841
+ const API_URL = "https://player.saltfish.ai/element-errors";
6842
+ function determineFailureReason(selector, expectedElement, expectedSize) {
6843
+ const elements = document.querySelectorAll(selector);
6844
+ if (elements.length === 0) {
6845
+ return "no_elements";
6846
+ }
6847
+ if (expectedElement) {
6848
+ const hasMatchingTag = Array.from(elements).some(
6849
+ (el) => el.tagName.toUpperCase() === expectedElement.tagName.toUpperCase()
6850
+ );
6851
+ if (!hasMatchingTag) {
6852
+ return "tag_mismatch";
6853
+ }
6854
+ return "text_mismatch";
6855
+ }
6856
+ if (expectedSize) {
6857
+ return "size_mismatch";
6858
+ }
6859
+ return "no_elements";
6860
+ }
6861
+ function reportElementError(playlistId, stepId, selector, expectedElement, expectedSize) {
6862
+ const failureReason = determineFailureReason(selector, expectedElement, expectedSize);
6863
+ const payload = {
6864
+ playlistId,
6865
+ stepId,
6866
+ failureReason,
6867
+ selector
6868
+ };
6869
+ fetch(API_URL, {
6870
+ method: "POST",
6871
+ headers: {
6872
+ "Content-Type": "application/json"
6873
+ },
6874
+ body: JSON.stringify(payload)
6875
+ }).catch((error2) => {
6876
+ console.warn("Failed to report element error:", error2);
6877
+ });
6878
+ }
6879
6879
  class CursorManager {
6880
6880
  constructor() {
6881
6881
  __publicField(this, "cursor", null);
@@ -7060,6 +7060,18 @@ class CursorManager {
7060
7060
  const MAX_RETRIES = 10;
7061
7061
  let retryCount = 0;
7062
7062
  let periodicCheckId = null;
7063
+ let errorReported = false;
7064
+ const reportFailure = () => {
7065
+ var _a;
7066
+ if (errorReported) return;
7067
+ errorReported = true;
7068
+ const state = saltfishStore.getState();
7069
+ const playlistId = (_a = state.manifest) == null ? void 0 : _a.id;
7070
+ const stepId = state.currentStepId;
7071
+ if (playlistId && stepId) {
7072
+ reportElementError(playlistId, stepId, selector, expectedElement, expectedSize);
7073
+ }
7074
+ };
7063
7075
  const cleanupWatchers = () => {
7064
7076
  if (this.targetMutationObserver) {
7065
7077
  this.targetMutationObserver.disconnect();
@@ -7074,6 +7086,7 @@ class CursorManager {
7074
7086
  retryCount++;
7075
7087
  if (retryCount > MAX_RETRIES) {
7076
7088
  console.warn(`CursorManager: Stopped waiting for element '${selector}' after ${MAX_RETRIES} attempts`);
7089
+ reportFailure();
7077
7090
  cleanupWatchers();
7078
7091
  return null;
7079
7092
  }
@@ -7099,6 +7112,7 @@ class CursorManager {
7099
7112
  retryCount++;
7100
7113
  if (retryCount > MAX_RETRIES) {
7101
7114
  console.warn(`CursorManager: Stopped waiting for element '${selector}' after ${MAX_RETRIES} attempts`);
7115
+ reportFailure();
7102
7116
  cleanupWatchers();
7103
7117
  return;
7104
7118
  }
@@ -12254,7 +12268,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
12254
12268
  __proto__: null,
12255
12269
  SaltfishPlayer
12256
12270
  }, Symbol.toStringTag, { value: "Module" }));
12257
- const version = "0.3.59";
12271
+ const version = "0.3.61";
12258
12272
  const packageJson = {
12259
12273
  version
12260
12274
  };