@coralogix/react-native-plugin 0.5.0 → 0.6.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,15 @@
1
+ ## 0.6.1 (2026-06-09)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **rum:** guard log() and init() against invalid inputs
6
+
7
+ ## 0.6.0 (2026-06-04)
8
+
9
+ ### 🚀 Features
10
+
11
+ - bump natives + extend reportError with optional data (0.6.0)
12
+
1
13
  ## 0.5.0 (2026-05-17)
2
14
 
3
15
  ### 🚀 Features
package/CxSdk.podspec CHANGED
@@ -16,9 +16,9 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
- s.dependency 'Coralogix','2.6.4'
20
- s.dependency 'CoralogixInternal','2.6.4'
21
- s.dependency 'SessionReplay','2.6.4'
19
+ s.dependency 'Coralogix','2.7.0'
20
+ s.dependency 'CoralogixInternal','2.7.0'
21
+ s.dependency 'SessionReplay','2.7.0'
22
22
 
23
23
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
24
24
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -84,7 +84,7 @@ dependencies {
84
84
  implementation "com.facebook.react:react-android"
85
85
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
86
86
 
87
- implementation "com.coralogix:android-sdk:2.12.0"
87
+ implementation "com.coralogix:android-sdk:2.13.0"
88
88
 
89
89
  testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
90
90
  testImplementation "org.mockito:mockito-core:5.12.0"
@@ -175,12 +175,19 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
175
175
  }
176
176
  }.orEmpty()
177
177
 
178
+ val customAttributes: Map<String, Any>? = details.getMap("data")
179
+ ?.toStringAnyMap()
180
+ ?.filterValues { it != null }
181
+ ?.mapValues { it.value as Any }
182
+ ?.takeIf { it.isNotEmpty() }
183
+
178
184
  CoralogixRum.reportError(
179
185
  CoralogixErrorDecorator(
180
186
  errorType = errorType,
181
187
  errorMessage = message,
182
188
  errorStack = CoralogixStackTrace(parsedStackFrames),
183
- isCrash = isCrash
189
+ isCrash = isCrash,
190
+ customAttributes = customAttributes
184
191
  )
185
192
  )
186
193
  }
package/index.cjs.js CHANGED
@@ -537,7 +537,7 @@ function stopJsRefreshRateSampler() {
537
537
  appStateSub = null;
538
538
  }
539
539
 
540
- var version = "0.5.0";
540
+ var version = "0.6.1";
541
541
  var pkg = {
542
542
  version: version};
543
543
 
@@ -996,6 +996,16 @@ function createErrorProxy(errorMessage) {
996
996
  }
997
997
  let isInited = false;
998
998
  let fetchInstrumentation;
999
+ function toSafeRecord(name, value) {
1000
+ if (value == null) {
1001
+ return {};
1002
+ }
1003
+ if (typeof value !== 'object' || Array.isArray(value)) {
1004
+ logger.warn(`CoralogixRum.log: \`${name}\` must be a plain object; received ${Array.isArray(value) ? 'array' : typeof value}. Ignoring.`);
1005
+ return {};
1006
+ }
1007
+ return value;
1008
+ }
999
1009
  const CoralogixRum = {
1000
1010
  get isInited() {
1001
1011
  return isInited;
@@ -1006,6 +1016,10 @@ const CoralogixRum = {
1006
1016
  console.warn('[Coralogix React Native SDK] - already initialized');
1007
1017
  return;
1008
1018
  }
1019
+ if (typeof (options == null ? void 0 : options.public_key) !== 'string' || options.public_key.length === 0) {
1020
+ console.warn('[Coralogix React Native SDK] - `public_key` is required and must be a non-empty string; initialization aborted.');
1021
+ return;
1022
+ }
1009
1023
  const resolvedOptions = resolveCoralogixOtelWebConfig(options);
1010
1024
  logger.shouldLog = (_resolvedOptions$debu = resolvedOptions.debug) != null ? _resolvedOptions$debu : false;
1011
1025
  const hasExcludeOverrides = ((_resolvedOptions$excl = (_resolvedOptions$excl2 = resolvedOptions.excludeFromSampling) == null ? void 0 : _resolvedOptions$excl2.length) != null ? _resolvedOptions$excl : 0) > 0;
@@ -1130,7 +1144,9 @@ const CoralogixRum = {
1130
1144
  logger.debug('CoralogixRum must be initiated before using log');
1131
1145
  return;
1132
1146
  }
1133
- CxSdk.log(severity, message, data != null ? data : {}, labels != null ? labels : {});
1147
+ const safeData = toSafeRecord('data', data);
1148
+ const safeLabels = toSafeRecord('labels', labels);
1149
+ CxSdk.log(severity, message, safeData, safeLabels);
1134
1150
  },
1135
1151
  debug(message, data) {
1136
1152
  this.log(CoralogixLogSeverity.Debug, message, data);
@@ -1187,7 +1203,7 @@ const CoralogixRum = {
1187
1203
  }
1188
1204
  CxSdk.endTimeMeasure(name);
1189
1205
  },
1190
- reportError: (error, isCrash) => {
1206
+ reportError: (error, isCrash, data) => {
1191
1207
  if (!isInited) {
1192
1208
  logger.debug('CoralogixRum must be initiated before error reporting');
1193
1209
  return;
@@ -1198,6 +1214,9 @@ const CoralogixRum = {
1198
1214
  stack_trace: parseErrorStack(error),
1199
1215
  is_crash: isCrash
1200
1216
  };
1217
+ if (data && Object.keys(data).length > 0) {
1218
+ errorDetails.data = data;
1219
+ }
1201
1220
  CxSdk.reportError(errorDetails);
1202
1221
  }
1203
1222
  };
package/index.esm.js CHANGED
@@ -535,7 +535,7 @@ function stopJsRefreshRateSampler() {
535
535
  appStateSub = null;
536
536
  }
537
537
 
538
- var version = "0.5.0";
538
+ var version = "0.6.1";
539
539
  var pkg = {
540
540
  version: version};
541
541
 
@@ -994,6 +994,16 @@ function createErrorProxy(errorMessage) {
994
994
  }
995
995
  let isInited = false;
996
996
  let fetchInstrumentation;
997
+ function toSafeRecord(name, value) {
998
+ if (value == null) {
999
+ return {};
1000
+ }
1001
+ if (typeof value !== 'object' || Array.isArray(value)) {
1002
+ logger.warn(`CoralogixRum.log: \`${name}\` must be a plain object; received ${Array.isArray(value) ? 'array' : typeof value}. Ignoring.`);
1003
+ return {};
1004
+ }
1005
+ return value;
1006
+ }
997
1007
  const CoralogixRum = {
998
1008
  get isInited() {
999
1009
  return isInited;
@@ -1004,6 +1014,10 @@ const CoralogixRum = {
1004
1014
  console.warn('[Coralogix React Native SDK] - already initialized');
1005
1015
  return;
1006
1016
  }
1017
+ if (typeof (options == null ? void 0 : options.public_key) !== 'string' || options.public_key.length === 0) {
1018
+ console.warn('[Coralogix React Native SDK] - `public_key` is required and must be a non-empty string; initialization aborted.');
1019
+ return;
1020
+ }
1007
1021
  const resolvedOptions = resolveCoralogixOtelWebConfig(options);
1008
1022
  logger.shouldLog = (_resolvedOptions$debu = resolvedOptions.debug) != null ? _resolvedOptions$debu : false;
1009
1023
  const hasExcludeOverrides = ((_resolvedOptions$excl = (_resolvedOptions$excl2 = resolvedOptions.excludeFromSampling) == null ? void 0 : _resolvedOptions$excl2.length) != null ? _resolvedOptions$excl : 0) > 0;
@@ -1128,7 +1142,9 @@ const CoralogixRum = {
1128
1142
  logger.debug('CoralogixRum must be initiated before using log');
1129
1143
  return;
1130
1144
  }
1131
- CxSdk.log(severity, message, data != null ? data : {}, labels != null ? labels : {});
1145
+ const safeData = toSafeRecord('data', data);
1146
+ const safeLabels = toSafeRecord('labels', labels);
1147
+ CxSdk.log(severity, message, safeData, safeLabels);
1132
1148
  },
1133
1149
  debug(message, data) {
1134
1150
  this.log(CoralogixLogSeverity.Debug, message, data);
@@ -1185,7 +1201,7 @@ const CoralogixRum = {
1185
1201
  }
1186
1202
  CxSdk.endTimeMeasure(name);
1187
1203
  },
1188
- reportError: (error, isCrash) => {
1204
+ reportError: (error, isCrash, data) => {
1189
1205
  if (!isInited) {
1190
1206
  logger.debug('CoralogixRum must be initiated before error reporting');
1191
1207
  return;
@@ -1196,6 +1212,9 @@ const CoralogixRum = {
1196
1212
  stack_trace: parseErrorStack(error),
1197
1213
  is_crash: isCrash
1198
1214
  };
1215
+ if (data && Object.keys(data).length > 0) {
1216
+ errorDetails.data = data;
1217
+ }
1199
1218
  CxSdk.reportError(errorDetails);
1200
1219
  }
1201
1220
  };
package/ios/CxSdk.swift CHANGED
@@ -226,11 +226,15 @@ class CxSdk: RCTEventEmitter {
226
226
  let message = dictionary[Keys.errorMessage.rawValue] as? String ?? ""
227
227
  let errorType = dictionary[Keys.errorType.rawValue] as? String ?? "5"
228
228
  let isCrash = dictionary[Keys.isCrash.rawValue] as? Bool ?? false
229
+ // Pass `data` only when non-empty — an empty dict would surface
230
+ // `error_context.data = {}` on the emitted RUM event.
231
+ let customAttributes = (dictionary["data"] as? [String: Any]).flatMap { $0.isEmpty ? nil : $0 }
229
232
 
230
233
  coralogixRum?.reportError(message: message,
231
234
  stackTrace: stackTrace,
232
235
  errorType: errorType,
233
- isCrash: isCrash)
236
+ isCrash: isCrash,
237
+ customAttributes: customAttributes)
234
238
  resolve("reportError success")
235
239
  }
236
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/react-native-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Official Coralogix React Native plugin",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
package/src/index.d.ts CHANGED
@@ -23,7 +23,7 @@ interface CxSdkClient {
23
23
  sendCustomMeasurement(measurement: CustomMeasurement): void;
24
24
  startTimeMeasure(name: string, labels: Record<string, unknown>): void;
25
25
  endTimeMeasure(name: string): void;
26
- reportError(details: Record<string, string>): void;
26
+ reportError(details: Record<string, unknown>): void;
27
27
  reportNetworkRequest(details: NetworkRequestDetails): void;
28
28
  shutdown(): Promise<boolean>;
29
29
  sendCxSpanData(results: CxSpan[]): void;
@@ -54,7 +54,7 @@ export interface CoralogixOtelWebType extends SendLog {
54
54
  * Unknown names are dropped silently by the native SDK.
55
55
  */
56
56
  endTimeMeasure: (name: string) => void;
57
- reportError: (error: Error, isCrash: boolean) => void;
57
+ reportError: (error: Error, isCrash: boolean, data?: Record<string, unknown>) => void;
58
58
  /**
59
59
  * Report a network request to the underlying Coralogix SDK
60
60
  * @param details