@sailfish-ai/recorder 1.3.2 → 1.4.3

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
@@ -38,6 +38,7 @@ export const DEFAULT_CONSOLE_RECORDING_SETTINGS = {
38
38
  },
39
39
  logger: "console",
40
40
  };
41
+ const PERSIST_SESSION_FOR_REOPENING_TABS = false;
41
42
  // export const DEFAULT_NETWORK_CAPTURE_SETTINGS: NetworkRecordOptions = {
42
43
  // initiatorTypes: ["fetch", "xmlhttprequest"],
43
44
  // ignoreRequestFn: (request) => {
@@ -56,8 +57,26 @@ export const DEFAULT_CONSOLE_RECORDING_SETTINGS = {
56
57
  // recordBody: true,
57
58
  // recordInitialRequests: false,
58
59
  // };
59
- const PERSIST_SESSION_FOR_REOPENING_TABS = false;
60
60
  // Functions
61
+ function sendUserDeviceUuid() {
62
+ const userDeviceUuid = getOrSetUserDeviceUuid();
63
+ const message = {
64
+ type: "userDeviceUuid",
65
+ userDeviceUuid,
66
+ };
67
+ sendMessage(message);
68
+ }
69
+ function sendTimeZone() {
70
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
71
+ const message = {
72
+ type: "timeZone",
73
+ timezone,
74
+ };
75
+ sendMessage(message);
76
+ }
77
+ // Send standard information like userDeviceUuid and timeZone
78
+ sendUserDeviceUuid();
79
+ sendTimeZone();
61
80
  // Function to get or set the device & program UUID in localStorage
62
81
  function getOrSetUserDeviceUuid() {
63
82
  let userDeviceUuid = localStorage.getItem("sailfishUserDeviceUuid");
@@ -113,15 +132,6 @@ function handleVisibilityChange() {
113
132
  // Initialize event listeners for visibility change and page unload
114
133
  document.addEventListener("visibilitychange", handleVisibilityChange);
115
134
  window.addEventListener("beforeunload", storeSessionId);
116
- export function sendUserUuid() {
117
- const userDeviceUuid = getOrSetUserDeviceUuid();
118
- const message = {
119
- type: "userDeviceUuid",
120
- userDeviceUuid,
121
- };
122
- sendMessage(message);
123
- }
124
- sendUserUuid();
125
135
  function storeCredentialsAndConnection({ apiKey, backendApi, }) {
126
136
  sessionStorage.setItem("sailfishApiKey", apiKey);
127
137
  sessionStorage.setItem("sailfishBackendApi", backendApi);
@@ -309,7 +319,7 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo, domainsToPropagat
309
319
  }
310
320
  }
311
321
  // Main Recording Function
312
- export async function startRecording({ apiKey, backendApi, domainsToPropagateHeaderTo = [], domainsToNotPropagateHeaderTo = [], }) {
322
+ export async function startRecording({ apiKey, backendApi = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo = [], domainsToNotPropagateHeaderTo = [], }) {
313
323
  let sessionId = getOrSetSessionId();
314
324
  storeCredentialsAndConnection({ apiKey, backendApi });
315
325
  // Non-blocking GraphQL request to send the domains if provided
@@ -0,0 +1,16 @@
1
+ // mapUuid.tsx
2
+ import { sendMessage } from "./websocket";
3
+ export function sendMapUuidIfAvailable() {
4
+ if (window.sfMapUuid) {
5
+ const mapUuidMessage = {
6
+ type: "mapUuid",
7
+ data: {
8
+ mapUuid: window.sfMapUuid,
9
+ },
10
+ };
11
+ sendMessage(mapUuidMessage);
12
+ }
13
+ else {
14
+ console.log("window.sfMapUuid is not set. Please install @sailfish/sf-map-utils as a dev dependency and include it in your build process.");
15
+ }
16
+ }