@symbo.ls/sdk 2.32.12 → 2.32.14

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/cjs/index.js CHANGED
@@ -41,7 +41,8 @@ __export(index_exports, {
41
41
  createSubscriptionService: () => import_services3.createSubscriptionService,
42
42
  createTrackingService: () => import_services3.createTrackingService,
43
43
  default: () => index_default,
44
- environment: () => import_environment2.default
44
+ environment: () => import_environment2.default,
45
+ isLocalhost: () => isLocalhost
45
46
  });
46
47
  module.exports = __toCommonJS(index_exports);
47
48
  var import_services = require("./services/index.js");
@@ -50,6 +51,14 @@ var import_environment = __toESM(require("./config/environment.js"), 1);
50
51
  var import_rootEventBus = require("./state/rootEventBus.js");
51
52
  var import_services3 = require("./services/index.js");
52
53
  var import_environment2 = __toESM(require("./config/environment.js"), 1);
54
+ const isBrowserEnvironment = () => typeof window !== "undefined";
55
+ const isLocalhost = () => {
56
+ if (!isBrowserEnvironment()) {
57
+ return false;
58
+ }
59
+ const host = window.location && window.location.hostname;
60
+ return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
61
+ };
53
62
  class SDK {
54
63
  constructor(options = {}) {
55
64
  this._services = /* @__PURE__ */ new Map();
@@ -173,6 +182,8 @@ class SDK {
173
182
  this._services.set(name, service);
174
183
  }
175
184
  _validateOptions(options) {
185
+ const onLocalhost = isLocalhost();
186
+ const hasGrafanaUrl = Boolean(import_environment.default.grafanaUrl);
176
187
  const defaults = {
177
188
  useNewServices: true,
178
189
  // Use new service implementations by default
@@ -182,10 +193,11 @@ class SDK {
182
193
  retryAttempts: 3,
183
194
  debug: false,
184
195
  tracking: {
185
- enabled: import_environment.default.features.trackingEnabled
196
+ // Force-disabled on localhost or when no Grafana URL is configured
197
+ enabled: onLocalhost ? false : hasGrafanaUrl ? import_environment.default.features.trackingEnabled : false
186
198
  }
187
199
  };
188
- return {
200
+ const merged = {
189
201
  ...defaults,
190
202
  ...options,
191
203
  tracking: {
@@ -193,6 +205,10 @@ class SDK {
193
205
  ...options.tracking || {}
194
206
  }
195
207
  };
208
+ if (onLocalhost || !hasGrafanaUrl) {
209
+ merged.tracking.enabled = false;
210
+ }
211
+ return merged;
196
212
  }
197
213
  // Get service instance
198
214
  getService(name) {
@@ -34,16 +34,9 @@ var import_BaseService = require("./BaseService.js");
34
34
  var import_environment = __toESM(require("../config/environment.js"), 1);
35
35
  const DEFAULT_MAX_QUEUE_SIZE = 100;
36
36
  const isBrowserEnvironment = () => typeof window !== "undefined";
37
- const isLocalhost = () => {
38
- if (!isBrowserEnvironment()) {
39
- return false;
40
- }
41
- const host = window.location && window.location.hostname;
42
- return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
43
- };
44
37
  const DEFAULT_TRACKING_OPTIONS = {
45
- // Enabled by default unless explicitly disabled in env or when on localhost
46
- enabled: !isLocalhost(),
38
+ // Enabled by default unless explicitly disabled via SDK options or runtime config
39
+ enabled: true,
47
40
  sessionTracking: true,
48
41
  enableTracing: true,
49
42
  maxQueueSize: DEFAULT_MAX_QUEUE_SIZE,
package/dist/esm/index.js CHANGED
@@ -47508,16 +47508,9 @@ var ScreenshotService = class extends BaseService {
47508
47508
  // src/services/TrackingService.js
47509
47509
  var DEFAULT_MAX_QUEUE_SIZE = 100;
47510
47510
  var isBrowserEnvironment = () => typeof window !== "undefined";
47511
- var isLocalhost = () => {
47512
- if (!isBrowserEnvironment()) {
47513
- return false;
47514
- }
47515
- const host = window.location && window.location.hostname;
47516
- return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
47517
- };
47518
47511
  var DEFAULT_TRACKING_OPTIONS = {
47519
- // Enabled by default unless explicitly disabled in env or when on localhost
47520
- enabled: !isLocalhost(),
47512
+ // Enabled by default unless explicitly disabled via SDK options or runtime config
47513
+ enabled: true,
47521
47514
  sessionTracking: true,
47522
47515
  enableTracing: true,
47523
47516
  maxQueueSize: DEFAULT_MAX_QUEUE_SIZE,
@@ -48425,6 +48418,14 @@ var SERVICE_METHODS = {
48425
48418
  };
48426
48419
 
48427
48420
  // src/index.js
48421
+ var isBrowserEnvironment2 = () => typeof window !== "undefined";
48422
+ var isLocalhost = () => {
48423
+ if (!isBrowserEnvironment2()) {
48424
+ return false;
48425
+ }
48426
+ const host = window.location && window.location.hostname;
48427
+ return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
48428
+ };
48428
48429
  var SDK = class {
48429
48430
  constructor(options = {}) {
48430
48431
  this._services = /* @__PURE__ */ new Map();
@@ -48548,6 +48549,8 @@ var SDK = class {
48548
48549
  this._services.set(name, service);
48549
48550
  }
48550
48551
  _validateOptions(options) {
48552
+ const onLocalhost = isLocalhost();
48553
+ const hasGrafanaUrl = Boolean(environment_default.grafanaUrl);
48551
48554
  const defaults = {
48552
48555
  useNewServices: true,
48553
48556
  // Use new service implementations by default
@@ -48557,10 +48560,11 @@ var SDK = class {
48557
48560
  retryAttempts: 3,
48558
48561
  debug: false,
48559
48562
  tracking: {
48560
- enabled: environment_default.features.trackingEnabled
48563
+ // Force-disabled on localhost or when no Grafana URL is configured
48564
+ enabled: onLocalhost ? false : hasGrafanaUrl ? environment_default.features.trackingEnabled : false
48561
48565
  }
48562
48566
  };
48563
- return {
48567
+ const merged = {
48564
48568
  ...defaults,
48565
48569
  ...options,
48566
48570
  tracking: {
@@ -48568,6 +48572,10 @@ var SDK = class {
48568
48572
  ...options.tracking || {}
48569
48573
  }
48570
48574
  };
48575
+ if (onLocalhost || !hasGrafanaUrl) {
48576
+ merged.tracking.enabled = false;
48577
+ }
48578
+ return merged;
48571
48579
  }
48572
48580
  // Get service instance
48573
48581
  getService(name) {
@@ -48655,7 +48663,8 @@ export {
48655
48663
  createSubscriptionService,
48656
48664
  createTrackingService,
48657
48665
  index_default as default,
48658
- environment_default as environment
48666
+ environment_default as environment,
48667
+ isLocalhost
48659
48668
  };
48660
48669
  // @preserve-env
48661
48670
  /*! Bundled license information:
@@ -17689,16 +17689,9 @@ var BaseService = class {
17689
17689
  // src/services/TrackingService.js
17690
17690
  var DEFAULT_MAX_QUEUE_SIZE = 100;
17691
17691
  var isBrowserEnvironment = () => typeof window !== "undefined";
17692
- var isLocalhost = () => {
17693
- if (!isBrowserEnvironment()) {
17694
- return false;
17695
- }
17696
- const host = window.location && window.location.hostname;
17697
- return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
17698
- };
17699
17692
  var DEFAULT_TRACKING_OPTIONS = {
17700
- // Enabled by default unless explicitly disabled in env or when on localhost
17701
- enabled: !isLocalhost(),
17693
+ // Enabled by default unless explicitly disabled via SDK options or runtime config
17694
+ enabled: true,
17702
17695
  sessionTracking: true,
17703
17696
  enableTracing: true,
17704
17697
  maxQueueSize: DEFAULT_MAX_QUEUE_SIZE,
@@ -47508,16 +47508,9 @@ var ScreenshotService = class extends BaseService {
47508
47508
  // src/services/TrackingService.js
47509
47509
  var DEFAULT_MAX_QUEUE_SIZE = 100;
47510
47510
  var isBrowserEnvironment = () => typeof window !== "undefined";
47511
- var isLocalhost = () => {
47512
- if (!isBrowserEnvironment()) {
47513
- return false;
47514
- }
47515
- const host = window.location && window.location.hostname;
47516
- return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
47517
- };
47518
47511
  var DEFAULT_TRACKING_OPTIONS = {
47519
- // Enabled by default unless explicitly disabled in env or when on localhost
47520
- enabled: !isLocalhost(),
47512
+ // Enabled by default unless explicitly disabled via SDK options or runtime config
47513
+ enabled: true,
47521
47514
  sessionTracking: true,
47522
47515
  enableTracing: true,
47523
47516
  maxQueueSize: DEFAULT_MAX_QUEUE_SIZE,
@@ -16,6 +16,14 @@ import {
16
16
  import { SERVICE_METHODS } from "./utils/services.js";
17
17
  import environment from "./config/environment.js";
18
18
  import { rootBus } from "./state/rootEventBus.js";
19
+ const isBrowserEnvironment = () => typeof window !== "undefined";
20
+ const isLocalhost = () => {
21
+ if (!isBrowserEnvironment()) {
22
+ return false;
23
+ }
24
+ const host = window.location && window.location.hostname;
25
+ return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
26
+ };
19
27
  class SDK {
20
28
  constructor(options = {}) {
21
29
  this._services = /* @__PURE__ */ new Map();
@@ -139,6 +147,8 @@ class SDK {
139
147
  this._services.set(name, service);
140
148
  }
141
149
  _validateOptions(options) {
150
+ const onLocalhost = isLocalhost();
151
+ const hasGrafanaUrl = Boolean(environment.grafanaUrl);
142
152
  const defaults = {
143
153
  useNewServices: true,
144
154
  // Use new service implementations by default
@@ -148,10 +158,11 @@ class SDK {
148
158
  retryAttempts: 3,
149
159
  debug: false,
150
160
  tracking: {
151
- enabled: environment.features.trackingEnabled
161
+ // Force-disabled on localhost or when no Grafana URL is configured
162
+ enabled: onLocalhost ? false : hasGrafanaUrl ? environment.features.trackingEnabled : false
152
163
  }
153
164
  };
154
- return {
165
+ const merged = {
155
166
  ...defaults,
156
167
  ...options,
157
168
  tracking: {
@@ -159,6 +170,10 @@ class SDK {
159
170
  ...options.tracking || {}
160
171
  }
161
172
  };
173
+ if (onLocalhost || !hasGrafanaUrl) {
174
+ merged.tracking.enabled = false;
175
+ }
176
+ return merged;
162
177
  }
163
178
  // Get service instance
164
179
  getService(name) {
@@ -261,5 +276,6 @@ export {
261
276
  createSubscriptionService2 as createSubscriptionService,
262
277
  createTrackingService2 as createTrackingService,
263
278
  index_default as default,
264
- default2 as environment
279
+ default2 as environment,
280
+ isLocalhost
265
281
  };
@@ -2,16 +2,9 @@ import { BaseService } from "./BaseService.js";
2
2
  import environment from "../config/environment.js";
3
3
  const DEFAULT_MAX_QUEUE_SIZE = 100;
4
4
  const isBrowserEnvironment = () => typeof window !== "undefined";
5
- const isLocalhost = () => {
6
- if (!isBrowserEnvironment()) {
7
- return false;
8
- }
9
- const host = window.location && window.location.hostname;
10
- return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "" || !host;
11
- };
12
5
  const DEFAULT_TRACKING_OPTIONS = {
13
- // Enabled by default unless explicitly disabled in env or when on localhost
14
- enabled: !isLocalhost(),
6
+ // Enabled by default unless explicitly disabled via SDK options or runtime config
7
+ enabled: true,
15
8
  sessionTracking: true,
16
9
  enableTracing: true,
17
10
  maxQueueSize: DEFAULT_MAX_QUEUE_SIZE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/sdk",
3
- "version": "2.32.12",
3
+ "version": "2.32.14",
4
4
  "type": "module",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,12 +46,12 @@
46
46
  "test:user": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/user/*.test.js | tap-spec"
47
47
  },
48
48
  "dependencies": {
49
- "@domql/element": "^2.32.12",
50
- "@domql/utils": "^2.32.12",
49
+ "@domql/element": "^2.32.14",
50
+ "@domql/utils": "^2.32.14",
51
51
  "@grafana/faro-web-sdk": "^1.19.0",
52
52
  "@grafana/faro-web-tracing": "^1.19.0",
53
- "@symbo.ls/router": "^2.32.12",
54
- "@symbo.ls/socket": "^2.32.12",
53
+ "@symbo.ls/router": "^2.32.14",
54
+ "@symbo.ls/socket": "^2.32.14",
55
55
  "acorn": "^8.14.0",
56
56
  "acorn-walk": "^8.3.4",
57
57
  "dexie": "^4.0.11",
@@ -73,5 +73,5 @@
73
73
  "tap-spec": "^5.0.0",
74
74
  "tape": "^5.9.0"
75
75
  },
76
- "gitHead": "f8666aee255847f4080ae65b1f27d87eb2b8815e"
76
+ "gitHead": "b9c8c8e0b8c5a9172678236729c78f7b8a1ec116"
77
77
  }
package/src/index.js CHANGED
@@ -18,6 +18,16 @@ import { SERVICE_METHODS } from './utils/services.js'
18
18
  import environment from './config/environment.js'
19
19
  import { rootBus } from './state/rootEventBus.js'
20
20
 
21
+ const isBrowserEnvironment = () => typeof window !== 'undefined'
22
+
23
+ export const isLocalhost = () => {
24
+ if (!isBrowserEnvironment()) {
25
+ return false
26
+ }
27
+ const host = window.location && window.location.hostname
28
+ return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '' || !host
29
+ }
30
+
21
31
  export class SDK {
22
32
  constructor(options = {}) {
23
33
  this._services = new Map()
@@ -156,6 +166,8 @@ export class SDK {
156
166
  }
157
167
 
158
168
  _validateOptions(options) {
169
+ const onLocalhost = isLocalhost()
170
+ const hasGrafanaUrl = Boolean(environment.grafanaUrl)
159
171
  const defaults = {
160
172
  useNewServices: true, // Use new service implementations by default
161
173
  apiUrl: environment.apiUrl,
@@ -164,11 +176,12 @@ export class SDK {
164
176
  retryAttempts: 3,
165
177
  debug: false,
166
178
  tracking: {
167
- enabled: environment.features.trackingEnabled,
179
+ // Force-disabled on localhost or when no Grafana URL is configured
180
+ enabled: onLocalhost ? false : (hasGrafanaUrl ? environment.features.trackingEnabled : false),
168
181
  }
169
182
  }
170
183
 
171
- return {
184
+ const merged = {
172
185
  ...defaults,
173
186
  ...options,
174
187
  tracking: {
@@ -176,6 +189,13 @@ export class SDK {
176
189
  ...(options.tracking || {})
177
190
  }
178
191
  }
192
+
193
+ // Enforce disabled tracking on localhost or when no Grafana URL configured, even if overridden
194
+ if (onLocalhost || !hasGrafanaUrl) {
195
+ merged.tracking.enabled = false
196
+ }
197
+
198
+ return merged
179
199
  }
180
200
 
181
201
  // Get service instance
@@ -5,17 +5,9 @@ const DEFAULT_MAX_QUEUE_SIZE = 100
5
5
 
6
6
  const isBrowserEnvironment = () => typeof window !== 'undefined'
7
7
 
8
- const isLocalhost = () => {
9
- if (!isBrowserEnvironment()) {
10
- return false
11
- }
12
- const host = window.location && window.location.hostname
13
- return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '' || !host
14
- }
15
-
16
8
  const DEFAULT_TRACKING_OPTIONS = {
17
- // Enabled by default unless explicitly disabled in env or when on localhost
18
- enabled: !isLocalhost(),
9
+ // Enabled by default unless explicitly disabled via SDK options or runtime config
10
+ enabled: true,
19
11
  sessionTracking: true,
20
12
  enableTracing: true,
21
13
  maxQueueSize: DEFAULT_MAX_QUEUE_SIZE,