react-native-test-adx 0.1.14 → 0.1.15

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.
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
 
3
3
  /** Keep in sync with package.json "version" (published npm packages ship lib/ only). */
4
- export const SDK_VERSION = '0.1.14';
4
+ export const SDK_VERSION = '0.1.15';
@@ -54,8 +54,16 @@ function shouldCaptureMessage(input, level, structuredLogsUsed) {
54
54
  }
55
55
  return MESSAGE_FALLBACK_EVENTS.has(input.eventName);
56
56
  }
57
+
58
+ /** Sentry Logs + logger.* break Metro in dev; release native builds can use them. */
57
59
  function usesStructuredSentryLogs(platform) {
58
- return platform === 'web';
60
+ if (platform === 'web') {
61
+ return true;
62
+ }
63
+ return typeof __DEV__ !== 'undefined' && !__DEV__;
64
+ }
65
+ function usesMinimalNativeSentryInit(platform) {
66
+ return platform !== 'web' && (typeof __DEV__ === 'undefined' || __DEV__);
59
67
  }
60
68
  function emitStructuredLog(sentry, level, eventName, metadata) {
61
69
  const loggerFn = sentry.logger?.[level];
@@ -154,9 +162,8 @@ class AdaxonLoggerService {
154
162
  }
155
163
  } else {
156
164
  emitNativeActivityBreadcrumb(sentry, level, input.eventName, metadata);
157
- deliveredToSentry = true;
158
165
  }
159
- if (usesStructuredSentryLogs(this.platform) && shouldCaptureMessage(input, level, structuredLogSent) && typeof sentry.captureMessage === 'function') {
166
+ if (!usesMinimalNativeSentryInit(this.platform) && shouldCaptureMessage(input, level, structuredLogSent) && typeof sentry.captureMessage === 'function') {
160
167
  sentry.captureMessage(input.eventName, {
161
168
  level: sentryLevel(level, 'message'),
162
169
  tags,
@@ -185,28 +192,35 @@ class AdaxonLoggerService {
185
192
  if (!dsn?.trim()) {
186
193
  return;
187
194
  }
188
- const structuredLogs = usesStructuredSentryLogs(this.platform);
189
- sentry.init(structuredLogs ? {
190
- dsn: dsn.trim(),
191
- environment: testMode ? 'adaxon-sdk-test' : 'adaxon-sdk',
192
- enableLogs: true,
193
- enableAutoConsoleLogs: false,
194
- tracesSampleRate: 0,
195
- enableAutoSessionTracking: false,
196
- sendDefaultPii: false
197
- } : {
198
- dsn: dsn.trim(),
199
- environment: testMode ? 'adaxon-sdk-test' : 'adaxon-sdk',
200
- enableLogs: false,
201
- enableAutoConsoleLogs: false,
202
- enableNative: false,
203
- autoInitializeNativeSdk: false,
204
- defaultIntegrations: false,
205
- integrations: [],
206
- tracesSampleRate: 0,
207
- enableAutoSessionTracking: false,
208
- sendDefaultPii: false
209
- });
195
+ const environment = testMode ? 'adaxon-sdk-test' : 'adaxon-sdk';
196
+ const trimmedDsn = dsn.trim();
197
+ if (usesMinimalNativeSentryInit(this.platform)) {
198
+ // Dev / Metro: avoid Sentry Logs + default integrations (Metro "unknown module undefined").
199
+ sentry.init({
200
+ dsn: trimmedDsn,
201
+ environment,
202
+ enableLogs: false,
203
+ enableAutoConsoleLogs: false,
204
+ enableNative: false,
205
+ autoInitializeNativeSdk: false,
206
+ defaultIntegrations: false,
207
+ integrations: [],
208
+ tracesSampleRate: 0,
209
+ enableAutoSessionTracking: false,
210
+ sendDefaultPii: false
211
+ });
212
+ } else {
213
+ // Web + release native: structured logs reach Sentry (Logs product / logger API).
214
+ sentry.init({
215
+ dsn: trimmedDsn,
216
+ environment,
217
+ enableLogs: true,
218
+ enableAutoConsoleLogs: false,
219
+ tracesSampleRate: 0,
220
+ enableAutoSessionTracking: false,
221
+ sendDefaultPii: false
222
+ });
223
+ }
210
224
  }
211
225
  sentry.setTag('adaxon_sdk_version', SDK_VERSION);
212
226
  sentry.setTag('adaxon_platform', this.platform);
@@ -1,3 +1,3 @@
1
1
  /** Keep in sync with package.json "version" (published npm packages ship lib/ only). */
2
- export declare const SDK_VERSION = "0.1.14";
2
+ export declare const SDK_VERSION = "0.1.15";
3
3
  //# sourceMappingURL=sdkVersion.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-test-adx",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Adaxon React Native / Expo SDK for event tracking and offer recommendations.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",