@coralogix/browser 1.6.0 → 2.0.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,25 @@
1
+ # 2.0.0 (2025-01-29)
2
+
3
+ ### 🚀 Features
4
+
5
+ - ⚠️ optimize SDK with rollup bundling and support ES5.
6
+
7
+ ### ⚠️ Breaking Changes
8
+
9
+ - Some imports from the library might be changed.
10
+ <br><br>
11
+ <b>For example:</b> <br>
12
+ <i>Before: </i> <br/>
13
+ `import { CoralogixLogSeverity } from '@coralogix/browser/src/types-external';` <br/> <br/>
14
+ <i> After: </i> <br/>
15
+ `import { CoralogixLogSeverity } from '@coralogix/browser';`
16
+
17
+ ## 1.7.0 (2025-01-21)
18
+
19
+ ### 🚀 Features
20
+
21
+ - Revert rollup bundling due to unexpected issues
22
+
1
23
  ## 1.6.0 (2025-01-19)
2
24
 
3
25
  ### 🚀 Features
package/README.md CHANGED
@@ -194,8 +194,7 @@ CoralogixRum.init({
194
194
  ### Sending Custom Logs
195
195
 
196
196
  ```javascript
197
- import { CoralogixRum } from '@coralogix/browser';
198
- import { CoralogixLogSeverity } from '@coralogix/browser/src/types-external';
197
+ import { CoralogixRum, CoralogixLogSeverity } from '@coralogix/browser';
199
198
 
200
199
  CoralogixRum.log(CoralogixLogSeverity.Info, 'this is a custom log');
201
200
 
@@ -1219,6 +1219,15 @@ function isEmpty(value) {
1219
1219
  }
1220
1220
  return false;
1221
1221
  }
1222
+ /**
1223
+ * Checks if a Set, Array, Map, or Object is not empty.
1224
+ *
1225
+ * @param value - The value to check.
1226
+ * @returns Returns false if the value is an empty Set, Map, Array, String or Object, else true.
1227
+ */
1228
+ function isNotEmpty(value) {
1229
+ return !isEmpty(value);
1230
+ }
1222
1231
 
1223
1232
  var WEB_VITALS_INSTRUMENTATION_NAME = 'web_vitals';
1224
1233
  var WEB_VITALS_INSTRUMENTATION_VERSION = '1.0.0';
@@ -5777,7 +5786,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
5777
5786
  return resolvedUrlBlueprinters;
5778
5787
  }
5779
5788
 
5780
- var SDK_VERSION = '1.6.0';
5789
+ var SDK_VERSION = '2.0.0';
5781
5790
 
5782
5791
  function shouldDropEvent(cxRumEvent, options) {
5783
5792
  if (isDocumentErrorWithoutMessage(cxRumEvent)) {
@@ -6632,4 +6641,53 @@ var CoralogixRum = {
6632
6641
  };
6633
6642
  window.CoralogixRum = CoralogixRum;
6634
6643
 
6635
- export { CoralogixRum };
6644
+ var UrlBasedLabelProvider = /** @class */ (function () {
6645
+ function UrlBasedLabelProvider(config) {
6646
+ var urlPatterns = config.urlPatterns, defaultLabels = config.defaultLabels, urlType = config.urlType;
6647
+ var compiledRegexps = urlPatterns.map(function (_a) {
6648
+ var regexps = _a.regexps;
6649
+ return regexps.map(function (regexp) { return new RegExp(regexp); });
6650
+ });
6651
+ this.urlType = urlType;
6652
+ this.providerFunc = function (url, _) {
6653
+ var e_1, _a;
6654
+ var providerLabels = {};
6655
+ try {
6656
+ outerLoop: for (var _b = __values$1(compiledRegexps.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
6657
+ var _d = __read$1(_c.value, 2), index = _d[0], compiledRegex = _d[1];
6658
+ var labels = urlPatterns[index].labels;
6659
+ if (compiledRegex.some(function (regexp) { return regexp.test(url); })) {
6660
+ providerLabels = __assign(__assign({}, providerLabels), labels);
6661
+ break outerLoop;
6662
+ }
6663
+ }
6664
+ }
6665
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
6666
+ finally {
6667
+ try {
6668
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6669
+ }
6670
+ finally { if (e_1) throw e_1.error; }
6671
+ }
6672
+ var shouldAddDefaultLabels = isEmpty(providerLabels) && isNotEmpty(defaultLabels);
6673
+ if (shouldAddDefaultLabels) {
6674
+ providerLabels = __assign(__assign({}, providerLabels), defaultLabels);
6675
+ }
6676
+ return providerLabels;
6677
+ };
6678
+ }
6679
+ return UrlBasedLabelProvider;
6680
+ }());
6681
+
6682
+ var SessionRecordingEventType;
6683
+ (function (SessionRecordingEventType) {
6684
+ SessionRecordingEventType[SessionRecordingEventType["DomContentLoaded"] = 0] = "DomContentLoaded";
6685
+ SessionRecordingEventType[SessionRecordingEventType["Load"] = 1] = "Load";
6686
+ SessionRecordingEventType[SessionRecordingEventType["FullSnapshot"] = 2] = "FullSnapshot";
6687
+ SessionRecordingEventType[SessionRecordingEventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
6688
+ SessionRecordingEventType[SessionRecordingEventType["Meta"] = 4] = "Meta";
6689
+ SessionRecordingEventType[SessionRecordingEventType["Custom"] = 5] = "Custom";
6690
+ SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
6691
+ })(SessionRecordingEventType || (SessionRecordingEventType = {}));
6692
+
6693
+ export { CoralogixEventType, CoralogixLogSeverity, CoralogixRum, OtelNetworkAttrs, PerformanceTypes, SessionRecordingEventType, UrlBasedLabelProvider, UrlType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "1.6.0",
3
+ "version": "2.0.0",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -36,8 +36,8 @@
36
36
  "peerDependencies": {
37
37
  "typescript": ">=4.4.2"
38
38
  },
39
- "module": "./coralogix-browser-sdk.esm.js",
39
+ "module": "./index.esm.js",
40
40
  "type": "module",
41
- "main": "./coralogix-browser-sdk.esm.js",
42
- "types": "./coralogix-browser-sdk.esm.d.ts"
41
+ "main": "./index.esm.js",
42
+ "types": "./index.esm.d.ts"
43
43
  }
@@ -0,0 +1,10 @@
1
+ import { CoralogixOtelWebType, CoralogixWindow } from './types';
2
+ import { MemoryUsageContext } from './instrumentations/memory-usage';
3
+ declare global {
4
+ interface Window extends CoralogixWindow {
5
+ }
6
+ interface Performance {
7
+ measureUserAgentSpecificMemory(): Promise<MemoryUsageContext>;
8
+ }
9
+ }
10
+ export declare const CoralogixRum: CoralogixOtelWebType;
package/src/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
- import { CoralogixOtelWebType, CoralogixWindow } from './types';
2
- import { MemoryUsageContext } from './instrumentations/memory-usage';
3
- declare global {
4
- interface Window extends CoralogixWindow {
5
- }
6
- interface Performance {
7
- measureUserAgentSpecificMemory(): Promise<MemoryUsageContext>;
8
- }
9
- }
10
- export declare const CoralogixRum: CoralogixOtelWebType;
1
+ export { CoralogixRum } from './coralogix-rum';
2
+ export { CoralogixLogSeverity } from './types-external';
3
+ export { UrlBasedLabelProvider } from './label-providers/url-based-label-provider';
4
+ export * from './types';
5
+ export { SessionRecordingEventType, RecordEvent, RecordPluginEvent, } from './session/session.model';
package/src/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.6.0";
1
+ export declare const SDK_VERSION = "2.0.0";