@sailfish-ai/recorder 1.5.7 → 1.5.9

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/README.md CHANGED
@@ -1 +1,3 @@
1
1
  # JS/TS Record-Only Package
2
+
3
+ ## Force build
package/dist/index.js CHANGED
@@ -16,7 +16,6 @@ const DOMAINS_TO_NOT_PROPAGATE_HEADER_TO_DEFAULT = [
16
16
  "*.smooch.io", // Exclude smooch-related requests
17
17
  "*.zendesk.com", // Exclude zendesk-related requests
18
18
  ];
19
- const DOMAINS_TO_NOT_RECORD_NETWORK_REQUESTS_TO = [];
20
19
  export const DEFAULT_CAPTURE_SETTINGS = {
21
20
  recordCanvas: false,
22
21
  recordCrossOriginIframes: false,
@@ -39,7 +38,6 @@ export const DEFAULT_CONSOLE_RECORDING_SETTINGS = {
39
38
  },
40
39
  logger: "console",
41
40
  };
42
- const PERSIST_SESSION_FOR_REOPENING_TABS = false;
43
41
  // export const DEFAULT_NETWORK_CAPTURE_SETTINGS: NetworkRecordOptions = {
44
42
  // initiatorTypes: ["fetch", "xmlhttprequest"],
45
43
  // ignoreRequestFn: (request) => {
@@ -118,42 +116,13 @@ function getOrSetUserDeviceUuid() {
118
116
  }
119
117
  return userDeviceUuid;
120
118
  }
121
- // Function to generate a unique key for storing sessionId in localStorage
122
- function getTabKey() {
123
- let tabKey = sessionStorage.getItem("sailfishTabKey");
124
- if (!tabKey) {
125
- tabKey = uuidv4();
126
- sessionStorage.setItem("sailfishTabKey", tabKey);
127
- }
128
- return tabKey;
129
- }
130
- // Function to get or set the current sessionId in sessionStorage
131
- function getOrSetSessionId(forceNew = false) {
132
- let sessionId = sessionStorage.getItem("sailfishSessionId");
133
- if (!sessionId || forceNew) {
134
- const tabKey = getTabKey();
135
- const storedSessionId = PERSIST_SESSION_FOR_REOPENING_TABS
136
- ? localStorage.getItem(`sailfishSessionId_${tabKey}`)
137
- : null;
138
- if (storedSessionId && !forceNew) {
139
- sessionId = storedSessionId;
140
- }
141
- else {
142
- sessionId = uuidv4();
143
- }
144
- sessionStorage.setItem("sailfishSessionId", sessionId);
145
- }
146
- return sessionId;
147
- }
148
- // Function to store the current sessionId in localStorage on page unload
149
- function storeSessionId() {
150
- if (PERSIST_SESSION_FOR_REOPENING_TABS) {
151
- const tabKey = getTabKey();
152
- const sessionId = sessionStorage.getItem("sailfishSessionId");
153
- if (sessionId) {
154
- localStorage.setItem(`sailfishSessionId_${tabKey}`, sessionId);
155
- }
119
+ // Storing the sailfishSessionId in window.name, as window.name retains its value after a page refresh
120
+ // but resets when a new tab (including a duplicated tab) is opened.
121
+ function getOrSetSessionId() {
122
+ if (!window.name) {
123
+ window.name = uuidv4();
156
124
  }
125
+ return window.name;
157
126
  }
158
127
  // Function to handle resetting the sessionId when the page becomes visible again
159
128
  function handleVisibilityChange() {
@@ -163,7 +132,6 @@ function handleVisibilityChange() {
163
132
  }
164
133
  // Initialize event listeners for visibility change and page unload
165
134
  document.addEventListener("visibilitychange", handleVisibilityChange);
166
- window.addEventListener("beforeunload", storeSessionId);
167
135
  function storeCredentialsAndConnection({ apiKey, backendApi, }) {
168
136
  sessionStorage.setItem("sailfishApiKey", apiKey);
169
137
  sessionStorage.setItem("sailfishBackendApi", backendApi);