saltfish 0.3.73 → 0.3.74

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.
@@ -7025,6 +7025,32 @@ function isElementValid(element, expectedElement, expectedSize, config = DEFAULT
7025
7025
  }
7026
7026
  return true;
7027
7027
  }
7028
+ const RRWEB_SNAPSHOT_URL = "https://storage.saltfish.ai/libs/rrweb-snapshot-2.0.0-alpha.18.js";
7029
+ async function captureDOMSnapshot() {
7030
+ try {
7031
+ const rrwebSnapshot = await import(
7032
+ /* webpackIgnore: true */
7033
+ RRWEB_SNAPSHOT_URL
7034
+ );
7035
+ const domSnapshot = rrwebSnapshot.snapshot(document);
7036
+ return domSnapshot;
7037
+ } catch (error2) {
7038
+ console.warn("Failed to capture DOM snapshot:", error2);
7039
+ return null;
7040
+ }
7041
+ }
7042
+ async function captureDOMSnapshotAsString() {
7043
+ const snapshot = await captureDOMSnapshot();
7044
+ if (!snapshot) {
7045
+ return null;
7046
+ }
7047
+ try {
7048
+ return JSON.stringify(snapshot);
7049
+ } catch (error2) {
7050
+ console.warn("Failed to serialize DOM snapshot:", error2);
7051
+ return null;
7052
+ }
7053
+ }
7028
7054
  const API_URL = "https://player.saltfish.ai/element-errors";
7029
7055
  function determineFailureReason(selector, expectedElement, expectedSize) {
7030
7056
  const elements = document.querySelectorAll(selector);
@@ -7047,21 +7073,29 @@ function determineFailureReason(selector, expectedElement, expectedSize) {
7047
7073
  }
7048
7074
  function reportElementError(playlistId, stepId, selector, expectedElement, expectedSize) {
7049
7075
  const failureReason = determineFailureReason(selector, expectedElement, expectedSize);
7050
- const payload = {
7051
- playlistId,
7052
- stepId,
7053
- failureReason,
7054
- selector
7055
- };
7056
- fetch(API_URL, {
7057
- method: "POST",
7058
- headers: {
7059
- "Content-Type": "application/json"
7060
- },
7061
- body: JSON.stringify(payload)
7062
- }).catch((error2) => {
7063
- console.warn("Failed to report element error:", error2);
7064
- });
7076
+ (async () => {
7077
+ try {
7078
+ const payload = {
7079
+ playlistId,
7080
+ stepId,
7081
+ failureReason,
7082
+ selector
7083
+ };
7084
+ const domSnapshot = await captureDOMSnapshotAsString();
7085
+ if (domSnapshot) {
7086
+ payload.domSnapshot = domSnapshot;
7087
+ }
7088
+ await fetch(API_URL, {
7089
+ method: "POST",
7090
+ headers: {
7091
+ "Content-Type": "application/json"
7092
+ },
7093
+ body: JSON.stringify(payload)
7094
+ });
7095
+ } catch (error2) {
7096
+ console.warn("Failed to report element error:", error2);
7097
+ }
7098
+ })();
7065
7099
  }
7066
7100
  class CursorManager {
7067
7101
  constructor() {
@@ -12709,7 +12743,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
12709
12743
  __proto__: null,
12710
12744
  SaltfishPlayer
12711
12745
  }, Symbol.toStringTag, { value: "Module" }));
12712
- const version = "0.3.73";
12746
+ const version = "0.3.74";
12713
12747
  const packageJson = {
12714
12748
  version
12715
12749
  };