@coralogix/browser 3.21.1 → 3.22.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 3.22.1 (2026-08-16)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - Report a network request under the view it started in — a request still in flight when the page changed was previously tagged with the next view's number
6
+ - Count full page loads as view changes in multi-page apps, where `view_number` previously stayed at 0 for the whole session (requires `sessionConfig.keepSessionAfterReload`)
7
+
8
+ ## 3.22.0 (2026-08-13)
9
+
10
+ ### 🚀 Features
11
+
12
+ - Support an explicit ingress URL via the new `coralogixDomainUrl` option, for accounts whose endpoint has no corresponding `coralogixDomain` key
13
+
14
+ ### 🩹 Fixes
15
+
16
+ - Abort initialization with a clear message when `coralogixDomain` is not a recognized region, instead of sending data to an invalid endpoint
17
+
1
18
  ## 3.21.1 (2026-08-11)
2
19
 
3
20
  ### 🩹 Fixes
package/README.md CHANGED
@@ -46,29 +46,30 @@
46
46
 
47
47
  - [ignoreProxyUrlParams](#ignoreproxyurlparams)
48
48
 
49
- 24. [Collect IP Data](#collect-ip-data)
50
- 25. [SDK Fetch Priority](#sdk-fetch-priority)
51
- 26. [Custom Measurement](#custom-measurement)
52
- 27. [Add Timing](#add-timing)
53
- 28. [Custom Time Measurement](#custom-time-measurement)
54
- 29. [Microfrontend Support](#microfrontend-support)
49
+ 24. [Ingress URL](#ingress-url)
50
+ 25. [Collect IP Data](#collect-ip-data)
51
+ 26. [SDK Fetch Priority](#sdk-fetch-priority)
52
+ 27. [Custom Measurement](#custom-measurement)
53
+ 28. [Add Timing](#add-timing)
54
+ 29. [Custom Time Measurement](#custom-time-measurement)
55
+ 30. [Microfrontend Support](#microfrontend-support)
55
56
 
56
57
  - [Pre Requisites](#pre-requisites)
57
58
 
58
- 30. [Custom Spans](#custom-spans)
59
+ 31. [Custom Spans](#custom-spans)
59
60
 
60
61
  - [Ignored Instruments](#ignored-instruments)
61
62
 
62
- 31. [OpenTelemetry Batch Configuration](#opentelemetry-batch-configuration)
63
- 32. [Soft Navigations (Experimental)](#soft-navigations--experimental)
64
- 33. [Memory Usage (Experimental)](#memory-usage---experimental)
65
- 34. [Web Worker Support](#web-worker-support)
63
+ 32. [OpenTelemetry Batch Configuration](#opentelemetry-batch-configuration)
64
+ 33. [Soft Navigations (Experimental)](#soft-navigations--experimental)
65
+ 34. [Memory Usage (Experimental)](#memory-usage---experimental)
66
+ 35. [Web Worker Support](#web-worker-support)
66
67
 
67
68
  - [Enabling Web Worker Support](#enabling-web-worker-support)
68
69
  - [Examples](#examples)
69
70
 
70
- 35. [Angular Zone.js Configuration](#angular-zonejs-configuration)
71
- 36. [CDN](#cdn)
71
+ 36. [Angular Zone.js Configuration](#angular-zonejs-configuration)
72
+ 37. [CDN](#cdn)
72
73
 
73
74
  - [Specific Version](#specific-version-recommended)
74
75
  - [ES5](#es5)
@@ -77,9 +78,7 @@
77
78
  - [Via JS File](#via-js-file)
78
79
  - [Via TS File](#via-ts-file)
79
80
 
80
- 37. [Flutter Web](#flutter-web)
81
-
82
- ---
81
+ 38. [Flutter Web](#flutter-web)
83
82
 
84
83
  </details>
85
84
 
@@ -554,7 +553,8 @@ CoralogixRum.init({
554
553
  });
555
554
  ```
556
555
 
557
- > **Note:** Higher values may have a performance impact, as the browser needs to capture more frames each time an error is created.
556
+ > [!NOTE]
557
+ > Higher values may have a performance impact, as the browser needs to capture more frames each time an error is created.
558
558
 
559
559
  ### Mask elements
560
560
 
@@ -608,7 +608,8 @@ The SDK uses various strategies to name click actions. For more control, define
608
608
  </nav>
609
609
  ```
610
610
 
611
- > **Note:** The `data-cx-action-name` attribute is never masked, even when the element has a mask class applied. This ensures your custom action names are always captured for tracking purposes.
611
+ > [!NOTE]
612
+ > The `data-cx-action-name` attribute is never masked, even when the element has a mask class applied. This ensures your custom action names are always captured for tracking purposes.
612
613
 
613
614
  ### Label Providers
614
615
 
@@ -872,6 +873,29 @@ CoralogixRum.init({
872
873
  });
873
874
  ```
874
875
 
876
+ ### Ingress URL
877
+
878
+ `coralogixDomain` resolves your account's ingress endpoint from the supported Coralogix regions and is
879
+ the standard way to configure it. `coralogixDomainUrl` accepts an explicit ingress URL, for accounts
880
+ whose endpoint has no corresponding `coralogixDomain` key:
881
+
882
+ ```javascript
883
+ CoralogixRum.init({
884
+ // ...
885
+ coralogixDomainUrl: 'https://ingress.<region>.rum-ingress-coralogix.com',
886
+ });
887
+ ```
888
+
889
+ One of `coralogixDomain` or `coralogixDomainUrl` is required; initialization is aborted with a console
890
+ error when neither is provided. When both are provided, `coralogixDomainUrl` takes precedence.
891
+
892
+ The value must be an absolute `http(s)` URL with no query string or fragment: the SDK appends its
893
+ endpoint paths to it, so a `?` or `#` would truncate the resulting request URL. A trailing slash is
894
+ accepted and normalized.
895
+
896
+ The option composes with [Proxy URL](#proxy-url): the configured ingress URL is the value the SDK
897
+ places in the request's `cxforward` parameter.
898
+
875
899
  ### Collect IP Data
876
900
 
877
901
  Determines whether the SDK should collect the user's IP address and corresponding geolocation data. Defaults to true.
@@ -896,7 +920,8 @@ CoralogixRum.init({
896
920
  });
897
921
  ```
898
922
 
899
- > **Note:** The `priority` hint only works in Chromium browsers (Chrome/Edge 101+) and is a no-op elsewhere. We type this option with our own `SdkFetchPriority` alias instead of the DOM `RequestPriority` type, so it still compiles on older TypeScript versions (the SDK supports `>= 4.4.2`).
923
+ > [!NOTE]
924
+ > The `priority` hint only works in Chromium browsers (Chrome/Edge 101+) and is a no-op elsewhere. We type this option with our own `SdkFetchPriority` alias instead of the DOM `RequestPriority` type, so it still compiles on older TypeScript versions (the SDK supports `>= 4.4.2`).
900
925
 
901
926
  ### Custom Measurement
902
927
 
@@ -1085,8 +1110,6 @@ Web Worker support enables the capture of events originating from Web Workers, i
1085
1110
 
1086
1111
  > By default, Web Worker support is **disabled**.
1087
1112
 
1088
- ---
1089
-
1090
1113
  ### Enabling Web Worker Support
1091
1114
 
1092
1115
  ```javascript
@@ -1095,8 +1118,6 @@ CoralogixRum.init({
1095
1118
  });
1096
1119
  ```
1097
1120
 
1098
- ---
1099
-
1100
1121
  #### Examples
1101
1122
 
1102
1123
  ```javascript
@@ -1124,8 +1145,6 @@ self.onmessage = (message) => {
1124
1145
  };
1125
1146
  ```
1126
1147
 
1127
- ---
1128
-
1129
1148
  ## Angular Zone.js Configuration
1130
1149
 
1131
1150
  By default, the SDK runs its internal timers outside Angular's Zone.js to prevent unnecessary change detection cycles. This improves performance by avoiding redundant UI updates triggered by the SDK's background operations.
@@ -1142,9 +1161,8 @@ CoralogixRum.init({
1142
1161
  | `true` | SDK timers run outside Zone.js, preventing change detection triggers. |
1143
1162
  | `false` | SDK timers run inside Zone.js, which may trigger change detection. |
1144
1163
 
1145
- > **Note:** In most cases, you should keep the default value (`true`) for optimal performance. Only set to `false` if you have a specific reason to include SDK operations in Angular's change detection.
1146
-
1147
- ---
1164
+ > [!NOTE]
1165
+ > In most cases, you should keep the default value (`true`) for optimal performance. Only set to `false` if you have a specific reason to include SDK operations in Angular's change detection.
1148
1166
 
1149
1167
  ## CDN
1150
1168
 
package/index.esm2.js CHANGED
@@ -228,6 +228,7 @@ var SESSION_MANAGER_KEY = 'rumSessionManager';
228
228
  var SESSION_RECORDER_KEY = 'rumSessionRecorder';
229
229
  var SESSION_RECORDER_SEGMENTS_MAP = 'rumSessionRecorderSegmentsMap';
230
230
  var VIEW_NUMBER_KEY = 'rum_view_number';
231
+ var CURRENT_PAGE_FRAGMENT_KEY = 'rum_current_page_fragment';
231
232
 
232
233
  var SNAPSHOT_MANAGER_KEY = 'rumSnapshotManager';
233
234
  var SNAPSHOT_KEY = 'rum_snapshot';
@@ -1260,6 +1261,9 @@ function coerceArray(value) {
1260
1261
  function isObject(value) {
1261
1262
  return typeof value === 'object';
1262
1263
  }
1264
+ function hasOwn(object, key) {
1265
+ return Object.prototype.hasOwnProperty.call(object, key);
1266
+ }
1263
1267
  function omit(object) {
1264
1268
  if (object === void 0) { object = {}; }
1265
1269
  var paths = [];
@@ -2986,7 +2990,7 @@ var CoralogixInternalInstrumentation = (function (_super) {
2986
2990
  span.setAttribute(CoralogixAttributes.SEVERITY, CoralogixLogSeverity.Info);
2987
2991
  switch (event) {
2988
2992
  case 'init': {
2989
- var config = omit(getSdkConfig(), 'public_key', 'coralogixDomain');
2993
+ var config = omit(getSdkConfig(), 'public_key', 'coralogixDomain', 'coralogixDomainUrl');
2990
2994
  data = this.stringifyConfig(config);
2991
2995
  break;
2992
2996
  }
@@ -3133,7 +3137,6 @@ var MAX_CHARACTERS = 1024;
3133
3137
  var REQUIRED_CONFIG_KEYS = [
3134
3138
  'application',
3135
3139
  'version',
3136
- 'coralogixDomain',
3137
3140
  ];
3138
3141
  var ID_MASK_KEY = '{id}';
3139
3142
  var UUID_REGEX = /[0-9a-fA-F-]{36}/g;
@@ -3299,6 +3302,7 @@ var CoralogixAttributes = {
3299
3302
  TIMESTAMP: 'timestamp',
3300
3303
  INTERNAL: 'internal',
3301
3304
  PAGE_CONTEXT: 'page_context',
3305
+ VIEW_NUMBER: 'view_number',
3302
3306
  IS_NAVIGATION_EVENT: 'is_navigation_event',
3303
3307
  IS_DEAD_CLICK: 'is_dead_click',
3304
3308
  IS_RAGE_CLICK: 'is_rage_click',
@@ -3316,6 +3320,8 @@ var CoralogixDomainsApiUrlMap = {
3316
3320
  AP3: 'https://ingress.ap3.rum-ingress-coralogix.com',
3317
3321
  STAGING: 'https://ingress.staging.rum-ingress-coralogix.com',
3318
3322
  };
3323
+ var ALLOWED_INGRESS_PROTOCOLS = ['http:', 'https:'];
3324
+ var TRAILING_SLASHES_REGEX = /\/+$/;
3319
3325
  var PROXY_CX_FORWARD_PARAMETER = 'cxforward';
3320
3326
  var CX_MAPPED_SPAN = 'cx_mapped_span';
3321
3327
  var BASE_PATH = '/';
@@ -4026,21 +4032,31 @@ var Request = (function () {
4026
4032
  this.init();
4027
4033
  }
4028
4034
  Request.prototype.getResolvedUrl = function (config) {
4029
- var coralogixDomain = config.coralogixDomain, proxyUrl = config.proxyUrl, ignoreProxyUrlParams = config.ignoreProxyUrlParams;
4030
- var cxEndpoint = "".concat(CoralogixDomainsApiUrlMap[coralogixDomain]).concat(this.requestConfig.suffix);
4035
+ var proxyUrl = config.proxyUrl, ignoreProxyUrlParams = config.ignoreProxyUrlParams;
4036
+ var cxEndpoint = "".concat(this.getIngressBaseUrl(config)).concat(this.requestConfig.suffix);
4031
4037
  if (!proxyUrl)
4032
4038
  return cxEndpoint;
4033
4039
  if (ignoreProxyUrlParams)
4034
4040
  return proxyUrl;
4035
4041
  return "".concat(proxyUrl, "?").concat(PROXY_CX_FORWARD_PARAMETER, "=").concat(encodeURIComponent(cxEndpoint));
4036
4042
  };
4043
+ Request.prototype.getIngressBaseUrl = function (config) {
4044
+ var coralogixDomain = config.coralogixDomain, coralogixDomainUrl = config.coralogixDomainUrl;
4045
+ if (coralogixDomainUrl) {
4046
+ return coralogixDomainUrl.replace(TRAILING_SLASHES_REGEX, '');
4047
+ }
4048
+ return coralogixDomain && hasOwn(CoralogixDomainsApiUrlMap, coralogixDomain)
4049
+ ? CoralogixDomainsApiUrlMap[coralogixDomain]
4050
+ : '';
4051
+ };
4037
4052
  Request.prototype.init = function () {
4038
- var _a = getSdkConfig(), proxyUrl = _a.proxyUrl, ignoreProxyUrlParams = _a.ignoreProxyUrlParams, coralogixDomain = _a.coralogixDomain, public_key = _a.public_key, sdkFetchPriority = _a.sdkFetchPriority;
4053
+ var _a = getSdkConfig(), proxyUrl = _a.proxyUrl, ignoreProxyUrlParams = _a.ignoreProxyUrlParams, coralogixDomain = _a.coralogixDomain, coralogixDomainUrl = _a.coralogixDomainUrl, public_key = _a.public_key, sdkFetchPriority = _a.sdkFetchPriority;
4039
4054
  var headers = this.requestConfig.headers;
4040
4055
  this.resolvedUrl = this.getResolvedUrl({
4041
4056
  proxyUrl: proxyUrl,
4042
4057
  ignoreProxyUrlParams: ignoreProxyUrlParams,
4043
4058
  coralogixDomain: coralogixDomain,
4059
+ coralogixDomainUrl: coralogixDomainUrl,
4044
4060
  });
4045
4061
  if (public_key) {
4046
4062
  headers['Authorization'] = "Bearer ".concat(public_key);
@@ -4708,6 +4724,7 @@ var SessionManager = (function (_super) {
4708
4724
  _this.initializeSession(recordConfig);
4709
4725
  if ((_b = _this._sessionConfig) === null || _b === void 0 ? void 0 : _b.keepSessionAfterReload) {
4710
4726
  _this.loadViewNumber();
4727
+ _this.loadCurrentPageFragment();
4711
4728
  }
4712
4729
  return _this;
4713
4730
  }
@@ -4796,11 +4813,12 @@ var SessionManager = (function (_super) {
4796
4813
  });
4797
4814
  SessionManager.prototype.updateCurrentPage = function (fragment) {
4798
4815
  if (this.isIdleActive) {
4799
- this._currentPageFragment = undefined;
4816
+ this.resetCurrentPageFragment();
4800
4817
  return;
4801
4818
  }
4802
4819
  this._currentPageFragment = fragment;
4803
4820
  this._currentPageTimestamp = getNowTime();
4821
+ this.persistCurrentPageFragment(fragment);
4804
4822
  };
4805
4823
  SessionManager.prototype.incrementViewNumber = function () {
4806
4824
  this._viewNumber++;
@@ -4822,6 +4840,22 @@ var SessionManager = (function (_super) {
4822
4840
  this._viewNumber = 0;
4823
4841
  (_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.removeItem(VIEW_NUMBER_KEY);
4824
4842
  };
4843
+ SessionManager.prototype.persistCurrentPageFragment = function (fragment) {
4844
+ var _a, _b;
4845
+ if ((_a = this._sessionConfig) === null || _a === void 0 ? void 0 : _a.keepSessionAfterReload) {
4846
+ (_b = CxGlobal.sessionStorage) === null || _b === void 0 ? void 0 : _b.setItem(CURRENT_PAGE_FRAGMENT_KEY, fragment);
4847
+ }
4848
+ };
4849
+ SessionManager.prototype.loadCurrentPageFragment = function () {
4850
+ var _a;
4851
+ this._currentPageFragment =
4852
+ ((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(CURRENT_PAGE_FRAGMENT_KEY)) || undefined;
4853
+ };
4854
+ SessionManager.prototype.resetCurrentPageFragment = function () {
4855
+ var _a;
4856
+ this._currentPageFragment = undefined;
4857
+ (_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.removeItem(CURRENT_PAGE_FRAGMENT_KEY);
4858
+ };
4825
4859
  SessionManager.prototype.getSessionKey = function () {
4826
4860
  return SESSION_KEY;
4827
4861
  };
@@ -4886,7 +4920,7 @@ var SessionManager = (function (_super) {
4886
4920
  (_d = getSnapshotManager()) === null || _d === void 0 ? void 0 : _d.resetSnapshot();
4887
4921
  clearStoredSnapshotState();
4888
4922
  (_e = getClickScreenshotManager()) === null || _e === void 0 ? void 0 : _e.reset();
4889
- this._currentPageFragment = undefined;
4923
+ this.resetCurrentPageFragment();
4890
4924
  this.resetViewNumber();
4891
4925
  (_f = this.sessionRecorder) === null || _f === void 0 ? void 0 : _f.stopRecording();
4892
4926
  (_g = CxGlobal.sessionStorage) === null || _g === void 0 ? void 0 : _g.removeItem(SESSION_KEY);
@@ -5084,8 +5118,39 @@ function isInitialConfigValid(initConfig) {
5084
5118
  }
5085
5119
  finally { if (e_1) throw e_1.error; }
5086
5120
  }
5121
+ if (!isIngressConfigValid(initConfig)) {
5122
+ return;
5123
+ }
5087
5124
  return true;
5088
5125
  }
5126
+ function isIngressConfigValid(_a) {
5127
+ var coralogixDomain = _a.coralogixDomain, coralogixDomainUrl = _a.coralogixDomainUrl;
5128
+ if (coralogixDomainUrl) {
5129
+ if (isIngressUrlValid(coralogixDomainUrl)) {
5130
+ return true;
5131
+ }
5132
+ console.error("CoralogixRum: Initialization aborted. \"coralogixDomainUrl\" must be an absolute http(s) URL with no query string or fragment, e.g. \"https://ingress.my-domain.com\". Received \"".concat(coralogixDomainUrl, "\"."));
5133
+ return false;
5134
+ }
5135
+ if (!coralogixDomain) {
5136
+ console.error('CoralogixRum: Initialization aborted. Please provide either "coralogixDomain" or "coralogixDomainUrl".');
5137
+ return false;
5138
+ }
5139
+ if (!hasOwn(CoralogixDomainsApiUrlMap, coralogixDomain)) {
5140
+ console.error("CoralogixRum: Initialization aborted. Unknown \"coralogixDomain\" value \"".concat(coralogixDomain, "\". Use one of: ").concat(Object.keys(CoralogixDomainsApiUrlMap).join(', '), " \u2014 or set \"coralogixDomainUrl\" to your ingress URL."));
5141
+ return false;
5142
+ }
5143
+ return true;
5144
+ }
5145
+ function isIngressUrlValid(url) {
5146
+ try {
5147
+ var _a = new URL(url), protocol = _a.protocol, search = _a.search, hash = _a.hash;
5148
+ return ALLOWED_INGRESS_PROTOCOLS.includes(protocol) && !search && !hash;
5149
+ }
5150
+ catch (_b) {
5151
+ return false;
5152
+ }
5153
+ }
5089
5154
  function validateAndResolveInitConfig(config) {
5090
5155
  var _a, _b, _c, _d;
5091
5156
  if (!isInitialConfigValid(config)) {
@@ -5131,7 +5196,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
5131
5196
  return resolvedUrlBlueprinters;
5132
5197
  }
5133
5198
 
5134
- var SDK_VERSION = '3.21.1';
5199
+ var SDK_VERSION = '3.22.1';
5135
5200
 
5136
5201
  function shouldDropEvent(cxRumEvent, options) {
5137
5202
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -5292,9 +5357,9 @@ var CoralogixSpanMapProcessor = (function () {
5292
5357
  return Promise.resolve(undefined);
5293
5358
  };
5294
5359
  CoralogixSpanMapProcessor.prototype._mapToCxSpan = function (span, session, prevSession, sessionHasRecording, sessionHasScreenshot, onlySessionWithErrorMode) {
5295
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5296
- var _m = session || {}, sessionId = _m.sessionId, sessionCreationDate = _m.sessionCreationDate;
5297
- var _o = prevSession || {}, prevSessionId = _o.sessionId, prevSessionCreationDate = _o.sessionCreationDate, prevSessionHasRecording = _o.hasRecording, prevSessionHasScreenshot = _o.hasScreenshot;
5360
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5361
+ var _o = session || {}, sessionId = _o.sessionId, sessionCreationDate = _o.sessionCreationDate;
5362
+ var _p = prevSession || {}, prevSessionId = _p.sessionId, prevSessionCreationDate = _p.sessionCreationDate, prevSessionHasRecording = _p.hasRecording, prevSessionHasScreenshot = _p.hasScreenshot;
5298
5363
  var attributes = span.attributes;
5299
5364
  var user_context = JSON.parse(attributes[CoralogixAttributes.USER_CONTEXT]);
5300
5365
  var application_context = JSON.parse(attributes[CoralogixAttributes.APPLICATION_CONTEXT]);
@@ -5336,14 +5401,14 @@ var CoralogixSpanMapProcessor = (function () {
5336
5401
  type: eventType,
5337
5402
  source: attributes[CoralogixAttributes.SOURCE],
5338
5403
  severity: severity,
5339
- }, labels: labels, environment: attributes[CoralogixAttributes.ENVIRONMENT] || '', view_number: getSessionManager().viewNumber, layout_context: {
5340
- viewport_width: (_c = window === null || window === void 0 ? void 0 : window.innerWidth) !== null && _c !== void 0 ? _c : 0,
5341
- viewport_height: (_d = window === null || window === void 0 ? void 0 : window.innerHeight) !== null && _d !== void 0 ? _d : 0,
5342
- view_width: (_f = (_e = document === null || document === void 0 ? void 0 : document.documentElement) === null || _e === void 0 ? void 0 : _e.scrollWidth) !== null && _f !== void 0 ? _f : 0,
5343
- view_height: (_h = (_g = document === null || document === void 0 ? void 0 : document.documentElement) === null || _g === void 0 ? void 0 : _g.scrollHeight) !== null && _h !== void 0 ? _h : 0,
5344
- device_pixel_ratio: (_j = window === null || window === void 0 ? void 0 : window.devicePixelRatio) !== null && _j !== void 0 ? _j : 1,
5345
- scroll_x: (_k = window === null || window === void 0 ? void 0 : window.scrollX) !== null && _k !== void 0 ? _k : 0,
5346
- scroll_y: (_l = window === null || window === void 0 ? void 0 : window.scrollY) !== null && _l !== void 0 ? _l : 0,
5404
+ }, labels: labels, environment: attributes[CoralogixAttributes.ENVIRONMENT] || '', view_number: (_c = span[CoralogixAttributes.VIEW_NUMBER]) !== null && _c !== void 0 ? _c : getSessionManager().viewNumber, layout_context: {
5405
+ viewport_width: (_d = window === null || window === void 0 ? void 0 : window.innerWidth) !== null && _d !== void 0 ? _d : 0,
5406
+ viewport_height: (_e = window === null || window === void 0 ? void 0 : window.innerHeight) !== null && _e !== void 0 ? _e : 0,
5407
+ view_width: (_g = (_f = document === null || document === void 0 ? void 0 : document.documentElement) === null || _f === void 0 ? void 0 : _f.scrollWidth) !== null && _g !== void 0 ? _g : 0,
5408
+ view_height: (_j = (_h = document === null || document === void 0 ? void 0 : document.documentElement) === null || _h === void 0 ? void 0 : _h.scrollHeight) !== null && _j !== void 0 ? _j : 0,
5409
+ device_pixel_ratio: (_k = window === null || window === void 0 ? void 0 : window.devicePixelRatio) !== null && _k !== void 0 ? _k : 1,
5410
+ scroll_x: (_l = window === null || window === void 0 ? void 0 : window.scrollX) !== null && _l !== void 0 ? _l : 0,
5411
+ scroll_y: (_m = window === null || window === void 0 ? void 0 : window.scrollY) !== null && _m !== void 0 ? _m : 0,
5347
5412
  } }),
5348
5413
  },
5349
5414
  };
@@ -5663,22 +5728,23 @@ var CoralogixNavigationProcessor = (function () {
5663
5728
  var pageContext = resolvePageContext(location.href);
5664
5729
  if (pageContext) {
5665
5730
  span[CoralogixAttributes.PAGE_CONTEXT] = pageContext;
5666
- var currentPageFragment = getSessionManager().currentPageFragment;
5731
+ var previousPageFragment = getSessionManager().currentPageFragment;
5667
5732
  var page_fragments = pageContext.page_fragments;
5668
- if (currentPageFragment !== page_fragments) {
5733
+ if (previousPageFragment !== page_fragments) {
5669
5734
  getSessionManager().updateCurrentPage(page_fragments);
5670
5735
  span[CoralogixAttributes.IS_NAVIGATION_EVENT] = true;
5671
- this.handlePageNavigation(currentPageFragment);
5736
+ this.handlePageNavigation(previousPageFragment);
5672
5737
  (_a = getClickScreenshotManager()) === null || _a === void 0 ? void 0 : _a.onNavigation();
5673
5738
  }
5739
+ span[CoralogixAttributes.VIEW_NUMBER] = getSessionManager().viewNumber;
5674
5740
  }
5675
5741
  }
5676
5742
  finally {
5677
5743
  this.isResolving = false;
5678
5744
  }
5679
5745
  };
5680
- CoralogixNavigationProcessor.prototype.handlePageNavigation = function (currentPageFragment) {
5681
- if (currentPageFragment) {
5746
+ CoralogixNavigationProcessor.prototype.handlePageNavigation = function (previousPageFragment) {
5747
+ if (previousPageFragment) {
5682
5748
  getSessionManager().incrementViewNumber();
5683
5749
  }
5684
5750
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.21.1",
3
+ "version": "3.22.1",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
package/src/Request.d.ts CHANGED
@@ -9,6 +9,7 @@ export declare class Request {
9
9
  private fetchPriority;
10
10
  constructor(requestConfig: RequestConfig);
11
11
  private getResolvedUrl;
12
+ private getIngressBaseUrl;
12
13
  private init;
13
14
  send(body: BodyInit): Promise<Response>;
14
15
  private isWithinKeepaliveQuota;
@@ -59,6 +59,7 @@ export declare const CoralogixAttributes: {
59
59
  TIMESTAMP: string;
60
60
  INTERNAL: string;
61
61
  PAGE_CONTEXT: string;
62
+ VIEW_NUMBER: string;
62
63
  IS_NAVIGATION_EVENT: string;
63
64
  IS_DEAD_CLICK: string;
64
65
  IS_RAGE_CLICK: string;
@@ -76,6 +77,8 @@ export declare const CoralogixDomainsApiUrlMap: {
76
77
  AP3: string;
77
78
  STAGING: string;
78
79
  };
80
+ export declare const ALLOWED_INGRESS_PROTOCOLS: string[];
81
+ export declare const TRAILING_SLASHES_REGEX: RegExp;
79
82
  export declare const PROXY_CX_FORWARD_PARAMETER = "cxforward";
80
83
  export declare const CX_MAPPED_SPAN = "cx_mapped_span";
81
84
  export declare const BASE_PATH = "/";
@@ -17,3 +17,4 @@ export declare const SESSION_MANAGER_KEY = "rumSessionManager";
17
17
  export declare const SESSION_RECORDER_KEY = "rumSessionRecorder";
18
18
  export declare const SESSION_RECORDER_SEGMENTS_MAP = "rumSessionRecorderSegmentsMap";
19
19
  export declare const VIEW_NUMBER_KEY = "rum_view_number";
20
+ export declare const CURRENT_PAGE_FRAGMENT_KEY = "rum_current_page_fragment";
@@ -32,6 +32,9 @@ export declare class SessionManager extends SessionIdle {
32
32
  private persistViewNumber;
33
33
  private loadViewNumber;
34
34
  private resetViewNumber;
35
+ private persistCurrentPageFragment;
36
+ private loadCurrentPageFragment;
37
+ private resetCurrentPageFragment;
35
38
  getSessionKey(): string;
36
39
  getActiveSession(): Session;
37
40
  start(): void;
package/src/types.d.ts CHANGED
@@ -142,7 +142,8 @@ export interface OtelConfig {
142
142
  export interface CoralogixBrowserSdkConfig {
143
143
  public_key?: string;
144
144
  application: string;
145
- coralogixDomain: CoralogixDomain;
145
+ coralogixDomain?: CoralogixDomain;
146
+ coralogixDomainUrl?: string;
146
147
  version: string;
147
148
  user_context?: UserContextConfig;
148
149
  debug?: boolean;
@@ -1,4 +1,5 @@
1
1
  export declare function isObject(value: unknown): boolean;
2
+ export declare function hasOwn(object: object, key: PropertyKey): boolean;
2
3
  type NestedKeyOf<ObjectType extends Record<string, any>> = {
3
4
  [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object ? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}` : `${Key}`;
4
5
  }[keyof ObjectType & (string | number)];
package/src/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.21.1";
1
+ export declare const SDK_VERSION = "3.22.1";