@coralogix/browser 3.21.1 → 3.22.0

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,13 @@
1
+ ## 3.22.0 (2026-08-13)
2
+
3
+ ### 🚀 Features
4
+
5
+ - Support an explicit ingress URL via the new `coralogixDomainUrl` option, for accounts whose endpoint has no corresponding `coralogixDomain` key
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - Abort initialization with a clear message when `coralogixDomain` is not a recognized region, instead of sending data to an invalid endpoint
10
+
1
11
  ## 3.21.1 (2026-08-11)
2
12
 
3
13
  ### 🩹 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,7 +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
+ 38. [Flutter Web](#flutter-web)
81
82
 
82
83
  ---
83
84
 
@@ -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.
package/index.esm2.js CHANGED
@@ -1260,6 +1260,9 @@ function coerceArray(value) {
1260
1260
  function isObject(value) {
1261
1261
  return typeof value === 'object';
1262
1262
  }
1263
+ function hasOwn(object, key) {
1264
+ return Object.prototype.hasOwnProperty.call(object, key);
1265
+ }
1263
1266
  function omit(object) {
1264
1267
  if (object === void 0) { object = {}; }
1265
1268
  var paths = [];
@@ -2986,7 +2989,7 @@ var CoralogixInternalInstrumentation = (function (_super) {
2986
2989
  span.setAttribute(CoralogixAttributes.SEVERITY, CoralogixLogSeverity.Info);
2987
2990
  switch (event) {
2988
2991
  case 'init': {
2989
- var config = omit(getSdkConfig(), 'public_key', 'coralogixDomain');
2992
+ var config = omit(getSdkConfig(), 'public_key', 'coralogixDomain', 'coralogixDomainUrl');
2990
2993
  data = this.stringifyConfig(config);
2991
2994
  break;
2992
2995
  }
@@ -3133,7 +3136,6 @@ var MAX_CHARACTERS = 1024;
3133
3136
  var REQUIRED_CONFIG_KEYS = [
3134
3137
  'application',
3135
3138
  'version',
3136
- 'coralogixDomain',
3137
3139
  ];
3138
3140
  var ID_MASK_KEY = '{id}';
3139
3141
  var UUID_REGEX = /[0-9a-fA-F-]{36}/g;
@@ -3316,6 +3318,8 @@ var CoralogixDomainsApiUrlMap = {
3316
3318
  AP3: 'https://ingress.ap3.rum-ingress-coralogix.com',
3317
3319
  STAGING: 'https://ingress.staging.rum-ingress-coralogix.com',
3318
3320
  };
3321
+ var ALLOWED_INGRESS_PROTOCOLS = ['http:', 'https:'];
3322
+ var TRAILING_SLASHES_REGEX = /\/+$/;
3319
3323
  var PROXY_CX_FORWARD_PARAMETER = 'cxforward';
3320
3324
  var CX_MAPPED_SPAN = 'cx_mapped_span';
3321
3325
  var BASE_PATH = '/';
@@ -4026,21 +4030,31 @@ var Request = (function () {
4026
4030
  this.init();
4027
4031
  }
4028
4032
  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);
4033
+ var proxyUrl = config.proxyUrl, ignoreProxyUrlParams = config.ignoreProxyUrlParams;
4034
+ var cxEndpoint = "".concat(this.getIngressBaseUrl(config)).concat(this.requestConfig.suffix);
4031
4035
  if (!proxyUrl)
4032
4036
  return cxEndpoint;
4033
4037
  if (ignoreProxyUrlParams)
4034
4038
  return proxyUrl;
4035
4039
  return "".concat(proxyUrl, "?").concat(PROXY_CX_FORWARD_PARAMETER, "=").concat(encodeURIComponent(cxEndpoint));
4036
4040
  };
4041
+ Request.prototype.getIngressBaseUrl = function (config) {
4042
+ var coralogixDomain = config.coralogixDomain, coralogixDomainUrl = config.coralogixDomainUrl;
4043
+ if (coralogixDomainUrl) {
4044
+ return coralogixDomainUrl.replace(TRAILING_SLASHES_REGEX, '');
4045
+ }
4046
+ return coralogixDomain && hasOwn(CoralogixDomainsApiUrlMap, coralogixDomain)
4047
+ ? CoralogixDomainsApiUrlMap[coralogixDomain]
4048
+ : '';
4049
+ };
4037
4050
  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;
4051
+ var _a = getSdkConfig(), proxyUrl = _a.proxyUrl, ignoreProxyUrlParams = _a.ignoreProxyUrlParams, coralogixDomain = _a.coralogixDomain, coralogixDomainUrl = _a.coralogixDomainUrl, public_key = _a.public_key, sdkFetchPriority = _a.sdkFetchPriority;
4039
4052
  var headers = this.requestConfig.headers;
4040
4053
  this.resolvedUrl = this.getResolvedUrl({
4041
4054
  proxyUrl: proxyUrl,
4042
4055
  ignoreProxyUrlParams: ignoreProxyUrlParams,
4043
4056
  coralogixDomain: coralogixDomain,
4057
+ coralogixDomainUrl: coralogixDomainUrl,
4044
4058
  });
4045
4059
  if (public_key) {
4046
4060
  headers['Authorization'] = "Bearer ".concat(public_key);
@@ -5084,8 +5098,39 @@ function isInitialConfigValid(initConfig) {
5084
5098
  }
5085
5099
  finally { if (e_1) throw e_1.error; }
5086
5100
  }
5101
+ if (!isIngressConfigValid(initConfig)) {
5102
+ return;
5103
+ }
5087
5104
  return true;
5088
5105
  }
5106
+ function isIngressConfigValid(_a) {
5107
+ var coralogixDomain = _a.coralogixDomain, coralogixDomainUrl = _a.coralogixDomainUrl;
5108
+ if (coralogixDomainUrl) {
5109
+ if (isIngressUrlValid(coralogixDomainUrl)) {
5110
+ return true;
5111
+ }
5112
+ 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, "\"."));
5113
+ return false;
5114
+ }
5115
+ if (!coralogixDomain) {
5116
+ console.error('CoralogixRum: Initialization aborted. Please provide either "coralogixDomain" or "coralogixDomainUrl".');
5117
+ return false;
5118
+ }
5119
+ if (!hasOwn(CoralogixDomainsApiUrlMap, coralogixDomain)) {
5120
+ 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."));
5121
+ return false;
5122
+ }
5123
+ return true;
5124
+ }
5125
+ function isIngressUrlValid(url) {
5126
+ try {
5127
+ var _a = new URL(url), protocol = _a.protocol, search = _a.search, hash = _a.hash;
5128
+ return ALLOWED_INGRESS_PROTOCOLS.includes(protocol) && !search && !hash;
5129
+ }
5130
+ catch (_b) {
5131
+ return false;
5132
+ }
5133
+ }
5089
5134
  function validateAndResolveInitConfig(config) {
5090
5135
  var _a, _b, _c, _d;
5091
5136
  if (!isInitialConfigValid(config)) {
@@ -5131,7 +5176,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
5131
5176
  return resolvedUrlBlueprinters;
5132
5177
  }
5133
5178
 
5134
- var SDK_VERSION = '3.21.1';
5179
+ var SDK_VERSION = '3.22.0';
5135
5180
 
5136
5181
  function shouldDropEvent(cxRumEvent, options) {
5137
5182
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.21.1",
3
+ "version": "3.22.0",
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;
@@ -76,6 +76,8 @@ export declare const CoralogixDomainsApiUrlMap: {
76
76
  AP3: string;
77
77
  STAGING: string;
78
78
  };
79
+ export declare const ALLOWED_INGRESS_PROTOCOLS: string[];
80
+ export declare const TRAILING_SLASHES_REGEX: RegExp;
79
81
  export declare const PROXY_CX_FORWARD_PARAMETER = "cxforward";
80
82
  export declare const CX_MAPPED_SPAN = "cx_mapped_span";
81
83
  export declare const BASE_PATH = "/";
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.0";