@sailfish-ai/recorder 1.6.4 → 1.6.6

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.
package/dist/index.js CHANGED
@@ -133,7 +133,7 @@ function handleVisibilityChange() {
133
133
  // Initialize event listeners for visibility change and page unload
134
134
  document.addEventListener("visibilitychange", handleVisibilityChange);
135
135
  // Clearing window.name on refresh to generate and retain a new sessionId
136
- window.addEventListener("beforeunload", () => window.name = "");
136
+ window.addEventListener("beforeunload", () => (window.name = ""));
137
137
  function storeCredentialsAndConnection({ apiKey, backendApi, }) {
138
138
  sessionStorage.setItem("sailfishApiKey", apiKey);
139
139
  sessionStorage.setItem("sailfishBackendApi", backendApi);
@@ -355,6 +355,14 @@ export async function startRecording({ apiKey, backendApi = "https://api-service
355
355
  console.error("Error starting recording:", error);
356
356
  }
357
357
  }
358
+ export const initRecorder = async (options) => {
359
+ // Only run on the client (browser) environment
360
+ if (typeof window === "undefined") {
361
+ return;
362
+ }
363
+ // Directly invoke the startRecording function from within the same package
364
+ return startRecording(options);
365
+ };
358
366
  // Re-export from other modules
359
367
  export * from "./eventCache";
360
368
  export * from "./graphql";