@dreamhorizonorg/pulse-react-native 0.0.1 → 0.0.2

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.
Files changed (135) hide show
  1. package/PulseReactNativeOtel.podspec +1 -1
  2. package/README.md +34 -879
  3. package/android/build.gradle +10 -15
  4. package/android/proguard-rules.pro +3 -99
  5. package/android/src/main/java/com/pulsereactnativeotel/Pulse.kt +87 -0
  6. package/android/src/main/java/com/pulsereactnativeotel/PulseOtelConstants.kt +1 -1
  7. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelLogger.kt +3 -1
  8. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelModule.kt +53 -3
  9. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelPackage.kt +1 -1
  10. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelTracer.kt +24 -8
  11. package/android/src/main/java/com/pulsereactnativeotel/ReactNativeScreenAttributesLogRecordProcessor.kt +21 -0
  12. package/android/src/main/java/com/pulsereactnativeotel/ReactNativeScreenAttributesSpanProcessor.kt +30 -0
  13. package/android/src/main/java/com/pulsereactnativeotel/ReactNativeScreenNameTracker.kt +17 -0
  14. package/app.plugin.js +1 -0
  15. package/ios/PulseReactNativeOtel.mm +7 -1
  16. package/lib/module/NativePulseReactNativeOtel.js.map +1 -1
  17. package/lib/module/config.js +29 -9
  18. package/lib/module/config.js.map +1 -1
  19. package/lib/module/errorBoundary.js.map +1 -1
  20. package/lib/module/events.js +6 -0
  21. package/lib/module/events.js.map +1 -1
  22. package/lib/module/index.js +4 -2
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/navigation/index.js +172 -0
  25. package/lib/module/navigation/index.js.map +1 -0
  26. package/lib/module/navigation/navigation.interface.js +2 -0
  27. package/lib/module/navigation/navigation.interface.js.map +1 -0
  28. package/lib/module/navigation/screen-interactive.js +101 -0
  29. package/lib/module/navigation/screen-interactive.js.map +1 -0
  30. package/lib/module/navigation/screen-load.js +68 -0
  31. package/lib/module/navigation/screen-load.js.map +1 -0
  32. package/lib/module/navigation/screen-session.js +60 -0
  33. package/lib/module/navigation/screen-session.js.map +1 -0
  34. package/lib/module/navigation/useNavigationTracking.js +33 -0
  35. package/lib/module/navigation/useNavigationTracking.js.map +1 -0
  36. package/lib/module/navigation/utils.js +17 -0
  37. package/lib/module/navigation/utils.js.map +1 -0
  38. package/lib/module/network-interceptor/graphql-helper.js +92 -0
  39. package/lib/module/network-interceptor/graphql-helper.js.map +1 -0
  40. package/lib/module/network-interceptor/request-tracker-xhr.js +2 -1
  41. package/lib/module/network-interceptor/request-tracker-xhr.js.map +1 -1
  42. package/lib/module/network-interceptor/span-helpers.js +24 -16
  43. package/lib/module/network-interceptor/span-helpers.js.map +1 -1
  44. package/lib/module/network-interceptor/url-helper.js +58 -2
  45. package/lib/module/network-interceptor/url-helper.js.map +1 -1
  46. package/lib/module/pulse.constants.js +42 -0
  47. package/lib/module/pulse.constants.js.map +1 -0
  48. package/lib/module/trace.js +17 -2
  49. package/lib/module/trace.js.map +1 -1
  50. package/lib/typescript/plugin/src/index.d.ts +5 -0
  51. package/lib/typescript/plugin/src/index.d.ts.map +1 -0
  52. package/lib/typescript/plugin/src/types.d.ts +27 -0
  53. package/lib/typescript/plugin/src/types.d.ts.map +1 -0
  54. package/lib/typescript/plugin/src/utils.d.ts +10 -0
  55. package/lib/typescript/plugin/src/utils.d.ts.map +1 -0
  56. package/lib/typescript/plugin/src/withAndroidPulse.d.ts +4 -0
  57. package/lib/typescript/plugin/src/withAndroidPulse.d.ts.map +1 -0
  58. package/lib/typescript/src/NativePulseReactNativeOtel.d.ts +8 -2
  59. package/lib/typescript/src/NativePulseReactNativeOtel.d.ts.map +1 -1
  60. package/lib/typescript/src/config.d.ts +8 -2
  61. package/lib/typescript/src/config.d.ts.map +1 -1
  62. package/lib/typescript/src/errorBoundary.d.ts.map +1 -1
  63. package/lib/typescript/src/events.d.ts.map +1 -1
  64. package/lib/typescript/src/index.d.ts +5 -3
  65. package/lib/typescript/src/index.d.ts.map +1 -1
  66. package/lib/typescript/src/navigation/index.d.ts +12 -0
  67. package/lib/typescript/src/navigation/index.d.ts.map +1 -0
  68. package/lib/typescript/src/navigation/navigation.interface.d.ts +17 -0
  69. package/lib/typescript/src/navigation/navigation.interface.d.ts.map +1 -0
  70. package/lib/typescript/src/navigation/screen-interactive.d.ts +16 -0
  71. package/lib/typescript/src/navigation/screen-interactive.d.ts.map +1 -0
  72. package/lib/typescript/src/navigation/screen-load.d.ts +13 -0
  73. package/lib/typescript/src/navigation/screen-load.d.ts.map +1 -0
  74. package/lib/typescript/src/navigation/screen-session.d.ts +15 -0
  75. package/lib/typescript/src/navigation/screen-session.d.ts.map +1 -0
  76. package/lib/typescript/src/navigation/useNavigationTracking.d.ts +5 -0
  77. package/lib/typescript/src/navigation/useNavigationTracking.d.ts.map +1 -0
  78. package/lib/typescript/src/navigation/utils.d.ts +8 -0
  79. package/lib/typescript/src/navigation/utils.d.ts.map +1 -0
  80. package/lib/typescript/src/network-interceptor/graphql-helper.d.ts +8 -0
  81. package/lib/typescript/src/network-interceptor/graphql-helper.d.ts.map +1 -0
  82. package/lib/typescript/src/network-interceptor/request-tracker-xhr.d.ts.map +1 -1
  83. package/lib/typescript/src/network-interceptor/span-helpers.d.ts +1 -1
  84. package/lib/typescript/src/network-interceptor/span-helpers.d.ts.map +1 -1
  85. package/lib/typescript/src/network-interceptor/url-helper.d.ts +9 -0
  86. package/lib/typescript/src/network-interceptor/url-helper.d.ts.map +1 -1
  87. package/lib/typescript/src/pulse.constants.d.ts +35 -0
  88. package/lib/typescript/src/pulse.constants.d.ts.map +1 -0
  89. package/lib/typescript/src/pulse.interface.d.ts +2 -1
  90. package/lib/typescript/src/pulse.interface.d.ts.map +1 -1
  91. package/lib/typescript/src/trace.d.ts +7 -0
  92. package/lib/typescript/src/trace.d.ts.map +1 -1
  93. package/package.json +29 -9
  94. package/plugin/build/index.d.ts +4 -0
  95. package/plugin/build/index.js +10 -0
  96. package/plugin/build/types.d.ts +26 -0
  97. package/plugin/build/types.js +2 -0
  98. package/plugin/build/utils.d.ts +9 -0
  99. package/plugin/build/utils.js +102 -0
  100. package/plugin/build/withAndroidPulse.d.ts +3 -0
  101. package/plugin/build/withAndroidPulse.js +53 -0
  102. package/scripts/pulse-cli.js +82 -0
  103. package/scripts/uploadService.js +122 -0
  104. package/scripts/utils.js +125 -0
  105. package/src/NativePulseReactNativeOtel.ts +11 -2
  106. package/src/config.ts +37 -8
  107. package/src/errorBoundary.tsx +11 -5
  108. package/src/events.ts +7 -0
  109. package/src/global.d.ts +0 -1
  110. package/src/index.tsx +6 -3
  111. package/src/navigation/index.ts +306 -0
  112. package/src/navigation/navigation.interface.ts +19 -0
  113. package/src/navigation/screen-interactive.ts +149 -0
  114. package/src/navigation/screen-load.ts +103 -0
  115. package/src/navigation/screen-session.ts +87 -0
  116. package/src/navigation/useNavigationTracking.ts +50 -0
  117. package/src/navigation/utils.ts +19 -0
  118. package/src/network-interceptor/graphql-helper.ts +110 -0
  119. package/src/network-interceptor/request-tracker-xhr.ts +3 -1
  120. package/src/network-interceptor/span-helpers.ts +27 -18
  121. package/src/network-interceptor/url-helper.ts +67 -1
  122. package/src/pulse.constants.ts +38 -0
  123. package/src/pulse.interface.ts +6 -1
  124. package/src/trace.ts +25 -2
  125. package/LICENSE +0 -20
  126. package/lib/module/network-interceptor/request-tracker-fetch.js +0 -72
  127. package/lib/module/network-interceptor/request-tracker-fetch.js.map +0 -1
  128. package/lib/module/reactNavigation.js +0 -100
  129. package/lib/module/reactNavigation.js.map +0 -1
  130. package/lib/typescript/src/network-interceptor/request-tracker-fetch.d.ts +0 -7
  131. package/lib/typescript/src/network-interceptor/request-tracker-fetch.d.ts.map +0 -1
  132. package/lib/typescript/src/reactNavigation.d.ts +0 -10
  133. package/lib/typescript/src/reactNavigation.d.ts.map +0 -1
  134. package/src/network-interceptor/request-tracker-fetch.ts +0 -96
  135. package/src/reactNavigation.tsx +0 -146
@@ -1,21 +1,23 @@
1
1
  import { startSpan, trackSpan } from './trace';
2
2
  import { reportException } from './errorHandler';
3
3
  import { trackEvent } from './events';
4
- import { start, createNavigationIntegrationWithConfig } from './config';
4
+ import { start } from './config';
5
5
  import { isInitialized } from './initialization';
6
6
  import { setGlobalAttribute } from './globalAttributes';
7
7
  import { setUserId, setUserProperty, setUserProperties } from './user';
8
8
  import { ErrorBoundary, withErrorBoundary } from './errorBoundary';
9
+ import { useNavigationTracking, markContentReady } from './navigation';
9
10
  export type { Span } from './trace';
10
11
  export type { PulseConfig, PulseStartOptions } from './config';
11
12
  export type { PulseAttributes, PulseAttributeValue } from './pulse.interface';
12
- export type { ReactNavigationIntegration, NavigationRoute, } from './reactNavigation';
13
+ export type { ReactNavigationIntegration, NavigationRoute, NavigationIntegrationOptions, } from './navigation';
13
14
  export type { ErrorBoundaryProps, FallbackRender } from './errorBoundary';
14
15
  export { SpanStatusCode } from './trace';
15
16
  export declare const Pulse: {
16
17
  start: typeof start;
17
18
  isInitialized: typeof isInitialized;
18
- createNavigationIntegration: typeof createNavigationIntegrationWithConfig;
19
+ useNavigationTracking: typeof useNavigationTracking;
20
+ markContentReady: typeof markContentReady;
19
21
  trackEvent: typeof trackEvent;
20
22
  reportException: typeof reportException;
21
23
  trackSpan: typeof trackSpan;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB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AiB,EAAE,MAAM,UAAU,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,YAAY,EACV,0BAA0B,EAC1B,eAAe,EACf,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;CAejB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { RefObject } from 'react';
2
+ import type { NavigationIntegrationOptions, NavigationRoute } from './navigation.interface';
3
+ import { markContentReady } from './screen-interactive';
4
+ export type { NavigationRoute, NavigationIntegrationOptions };
5
+ export interface ReactNavigationIntegration {
6
+ registerNavigationContainer: (maybeNavigationContainer: unknown) => () => void;
7
+ markContentReady: () => void;
8
+ }
9
+ export declare function createReactNavigationIntegration(options?: NavigationIntegrationOptions): ReactNavigationIntegration;
10
+ export { markContentReady };
11
+ export declare function useNavigationTracking(navigationRef: RefObject<any>, options?: NavigationIntegrationOptions): () => void;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/navigation/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAEV,4BAA4B,EAC5B,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAEL,gBAAgB,EAIjB,MAAM,sBAAsB,CAAC;AAW9B,YAAY,EAAE,eAAe,EAAE,4BAA4B,EAAE,CAAC;AAE9D,MAAM,WAAW,0BAA0B;IACzC,2BAA2B,EAAE,CAC3B,wBAAwB,EAAE,OAAO,KAC9B,MAAM,IAAI,CAAC;IAChB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,CAAC,EAAE,4BAA4B,GACrC,0BAA0B,CAyP5B;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,EAC7B,OAAO,CAAC,EAAE,4BAA4B,GACrC,MAAM,IAAI,CAOZ"}
@@ -0,0 +1,17 @@
1
+ export interface NavigationRoute {
2
+ name: string;
3
+ key: string;
4
+ params?: Record<string, any>;
5
+ }
6
+ export interface NavigationContainer {
7
+ addListener: (type: string, listener: (event?: unknown) => void) => {
8
+ remove: () => void;
9
+ } | void;
10
+ getCurrentRoute: () => NavigationRoute | undefined;
11
+ }
12
+ export interface NavigationIntegrationOptions {
13
+ screenSessionTracking?: boolean;
14
+ screenNavigationTracking?: boolean;
15
+ screenInteractiveTracking?: boolean;
16
+ }
17
+ //# sourceMappingURL=navigation.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.interface.d.ts","sourceRoot":"","sources":["../../../../src/navigation/navigation.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,CACX,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,KAChC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,eAAe,GAAG,SAAS,CAAC;CACpD;AAED,MAAM,WAAW,4BAA4B;IAC3C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC"}
@@ -0,0 +1,16 @@
1
+ import { type Span } from '../index';
2
+ import type { NavigationRoute, NavigationContainer } from './navigation.interface';
3
+ export interface ScreenInteractiveState {
4
+ screenInteractiveSpan: Span | undefined;
5
+ currentInteractiveRouteKey: string | undefined;
6
+ }
7
+ export declare const INITIAL_SCREEN_INTERACTIVE_STATE: ScreenInteractiveState;
8
+ export declare function createScreenInteractiveTracker(enabled: boolean, state: ScreenInteractiveState, navigationContainer: NavigationContainer | undefined): {
9
+ startScreenInteractive: (route: NavigationRoute) => void;
10
+ endScreenInteractive: (routeName?: string) => void;
11
+ discardScreenInteractive: (reason: string) => void;
12
+ markContentReady: () => void;
13
+ };
14
+ export declare function markContentReady(): void;
15
+ export declare function clearGlobalMarkContentReady(markContentReadyFn: () => void): void;
16
+ //# sourceMappingURL=screen-interactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-interactive.d.ts","sourceRoot":"","sources":["../../../../src/navigation/screen-interactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,UAAU,CAAC;AAI5C,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,sBAAsB;IACrC,qBAAqB,EAAE,IAAI,GAAG,SAAS,CAAC;IACxC,0BAA0B,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,eAAO,MAAM,gCAAgC,EAAE,sBAG9C,CAAC;AAIF,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,sBAAsB,EAC7B,mBAAmB,EAAE,mBAAmB,GAAG,SAAS;oCAeb,eAAe,KAAG,IAAI;uCAgCnB,MAAM,KAAG,IAAI;uCA7Cb,MAAM,KAAG,IAAI;4BAwDpB,IAAI;EA+CxC;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAQvC;AAED,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,MAAM,IAAI,GAC7B,IAAI,CAIN"}
@@ -0,0 +1,13 @@
1
+ import { type Span } from '../index';
2
+ import type { NavigationRoute } from './navigation.interface';
3
+ export interface ScreenLoadState {
4
+ navigationSpan: Span | undefined;
5
+ latestRoute: NavigationRoute | undefined;
6
+ }
7
+ export declare const INITIAL_SCREEN_LOAD_STATE: ScreenLoadState;
8
+ export declare function createScreenLoadTracker(enabled: boolean, state: ScreenLoadState, getRecentRouteKeys: () => string[], pushRecentRouteKey: (key: string) => void, onLoadEnd?: (route: NavigationRoute) => void): {
9
+ startNavigationSpan: () => void;
10
+ endNavigationSpan: (currentRoute?: NavigationRoute, previousRoute?: NavigationRoute, routeHasBeenSeen?: boolean) => void;
11
+ handleStateChange: (currentRoute: NavigationRoute) => void;
12
+ };
13
+ //# sourceMappingURL=screen-load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-load.d.ts","sourceRoot":"","sources":["../../../../src/navigation/screen-load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,UAAU,CAAC;AAQ5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,IAAI,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,eAAe,GAAG,SAAS,CAAC;CAC1C;AAED,eAAO,MAAM,yBAAyB,EAAE,eAGvC,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,eAAe,EACtB,kBAAkB,EAAE,MAAM,MAAM,EAAE,EAClC,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EACzC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI;+BAEZ,IAAI;uCAgBnB,eAAe,kBACd,eAAe,qBACZ,OAAO,KACzB,IAAI;sCA8BkC,eAAe,KAAG,IAAI;EAyBhE"}
@@ -0,0 +1,15 @@
1
+ import { type Span } from '../index';
2
+ import { type AppStateStatus } from 'react-native';
3
+ import type { NavigationRoute, NavigationContainer } from './navigation.interface';
4
+ export interface ScreenSessionState {
5
+ screenSessionSpan: Span | undefined;
6
+ currentScreenKey: string | undefined;
7
+ }
8
+ export declare const INITIAL_SCREEN_SESSION_STATE: ScreenSessionState;
9
+ export declare function createScreenSessionTracker(enabled: boolean, state: ScreenSessionState): {
10
+ startScreenSession: (route: NavigationRoute) => void;
11
+ endScreenSession: (routeName?: string) => void;
12
+ handleAppStateChange: (nextAppState: AppStateStatus, navigationContainer: NavigationContainer | undefined) => void;
13
+ shouldStartSession: (currentRoute: NavigationRoute, appState: AppStateStatus) => boolean;
14
+ };
15
+ //# sourceMappingURL=screen-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-session.d.ts","sourceRoot":"","sources":["../../../../src/navigation/screen-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,IAAI,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,eAAO,MAAM,4BAA4B,EAAE,kBAG1C,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,kBAAkB;gCAEU,eAAe,KAAG,IAAI;mCAanB,MAAM,KAAG,IAAI;yCAYnC,cAAc,uBACP,mBAAmB,GAAG,SAAS,KACnD,IAAI;uCAmBS,eAAe,YACnB,cAAc,KACvB,OAAO;EAeX"}
@@ -0,0 +1,5 @@
1
+ import { type RefObject } from 'react';
2
+ import type { NavigationIntegrationOptions } from './navigation.interface';
3
+ import type { ReactNavigationIntegration } from './index';
4
+ export declare function useNavigationTracking(navigationRef: RefObject<any>, options?: NavigationIntegrationOptions, createIntegration?: (options?: NavigationIntegrationOptions) => ReactNavigationIntegration): () => void;
5
+ //# sourceMappingURL=useNavigationTracking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNavigationTracking.d.ts","sourceRoot":"","sources":["../../../../src/navigation/useNavigationTracking.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,EAC7B,OAAO,CAAC,EAAE,4BAA4B,EACtC,iBAAiB,CAAC,EAAE,CAClB,OAAO,CAAC,EAAE,4BAA4B,KACnC,0BAA0B,GAC9B,MAAM,IAAI,CAuCZ"}
@@ -0,0 +1,8 @@
1
+ export declare const LOG_TAGS: {
2
+ readonly NAVIGATION: "[Pulse Navigation]";
3
+ readonly SCREEN_LOAD: "[Pulse Screen Load]";
4
+ readonly SCREEN_SESSION: "[Pulse Screen Session]";
5
+ readonly SCREEN_INTERACTIVE: "[Pulse Screen Interactive]";
6
+ };
7
+ export declare function pushRecentRouteKey(recentRouteKeys: string[], key: string): string[];
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/navigation/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EAAE,EACzB,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAMV"}
@@ -0,0 +1,8 @@
1
+ import type { PulseAttributes } from '../pulse.interface';
2
+ export interface GraphQLOperationData {
3
+ operationName?: string;
4
+ operationType?: string;
5
+ }
6
+ export declare function isGraphQLRequest(url: string): boolean;
7
+ export declare function updateAttributesWithGraphQLData(url: string, body?: Document | XMLHttpRequestBodyInit | null): PulseAttributes;
8
+ //# sourceMappingURL=graphql-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-helper.d.ts","sourceRoot":"","sources":["../../../../src/network-interceptor/graphql-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI1D,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKrD;AAqED,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,QAAQ,GAAG,sBAAsB,GAAG,IAAI,GAC9C,eAAe,CAuBjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"request-tracker-xhr.d.ts","sourceRoot":"","sources":["../../../../src/network-interceptor/request-tracker-xhr.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAcnD,iBAAS,2BAA2B,CAClC,GAAG,EAAE,OAAO,cAAc,GACzB,cAAc,CAqFhB;AAED,eAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"request-tracker-xhr.d.ts","sourceRoot":"","sources":["../../../../src/network-interceptor/request-tracker-xhr.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAcnD,iBAAS,2BAA2B,CAClC,GAAG,EAAE,OAAO,cAAc,GACzB,cAAc,CAuFhB;AAED,eAAe,2BAA2B,CAAC"}
@@ -2,6 +2,6 @@ import type { RequestStartContext, RequestEndContext } from './network.interface
2
2
  import type { Span } from '../index';
3
3
  import type { PulseAttributes } from '../pulse.interface';
4
4
  export declare function setNetworkSpanAttributes(span: Span, startContext: RequestStartContext, endContext: RequestEndContext): PulseAttributes;
5
- export declare function createNetworkSpan(startContext: RequestStartContext, interceptorType: 'fetch' | 'xmlhttprequest'): Span;
5
+ export declare function createNetworkSpan(startContext: RequestStartContext, interceptorType: 'fetch' | 'xmlhttprequest', body?: Document | XMLHttpRequestBodyInit | null): Span;
6
6
  export declare function completeNetworkSpan(span: Span, startContext: RequestStartContext, endContext: RequestEndContext, isError: boolean): void;
7
7
  //# sourceMappingURL=span-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"span-helpers.d.ts","sourceRoot":"","sources":["../../../../src/network-interceptor/span-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,iBAAiB,GAC5B,eAAe,CA+BjB;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,mBAAmB,EACjC,eAAe,EAAE,OAAO,GAAG,gBAAgB,GAC1C,IAAI,CAcN;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,OAAO,GACf,IAAI,CAYN"}
1
+ {"version":3,"file":"span-helpers.d.ts","sourceRoot":"","sources":["../../../../src/network-interceptor/span-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAK1D,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,iBAAiB,GAC5B,eAAe,CA+BjB;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,mBAAmB,EACjC,eAAe,EAAE,OAAO,GAAG,gBAAgB,EAC3C,IAAI,CAAC,EAAE,QAAQ,GAAG,sBAAsB,GAAG,IAAI,GAC9C,IAAI,CAoBN;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,OAAO,GACf,IAAI,CAYN"}
@@ -7,6 +7,14 @@
7
7
  *
8
8
  * Based on: https://github.com/facebook/react-native/blob/v0.80.0/packages/react-native/Libraries/Blob/URL.js
9
9
  */
10
+ export declare class SearchParams {
11
+ private params;
12
+ constructor(search: string);
13
+ get(name: string): string | null;
14
+ has(name: string): boolean;
15
+ keys(): string[];
16
+ values(): string[];
17
+ }
10
18
  export interface ParsedUrl {
11
19
  protocol: string;
12
20
  hostname: string;
@@ -16,6 +24,7 @@ export interface ParsedUrl {
16
24
  search: string;
17
25
  hash: string;
18
26
  href: string;
27
+ searchParams: SearchParams;
19
28
  }
20
29
  /**
21
30
  * Parse a URL string into its components
@@ -1 +1 @@
1
- {"version":3,"file":"url-helper.d.ts","sourceRoot":"","sources":["../../../../src/network-interceptor/url-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,I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AAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CA6CA"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Constants for Pulse React Native OpenTelemetry integration
3
+ */
4
+ export declare enum SPAN_NAMES {
5
+ SCREEN_SESSION = "ScreenSession",
6
+ NAVIGATED = "Navigated",
7
+ SCREEN_INTERACTIVE = "ScreenInteractive"
8
+ }
9
+ export declare enum ATTRIBUTE_KEYS {
10
+ PULSE_TYPE = "pulse.type",
11
+ SCREEN_NAME = "screen.name",
12
+ ROUTE_KEY = "routeKey",
13
+ PHASE = "phase",
14
+ LAST_SCREEN_NAME = "last.screen.name",
15
+ ROUTE_HAS_BEEN_SEEN = "routeHasBeenSeen",
16
+ PLATFORM = "platform",
17
+ GRAPHQL_OPERATION_NAME = "graphql.operation.name",
18
+ GRAPHQL_OPERATION_TYPE = "graphql.operation.type",
19
+ HTTP_METHOD = "http.method",
20
+ HTTP_URL = "http.url",
21
+ HTTP_STATUS_CODE = "http.status_code",
22
+ HTTP_REQUEST_TYPE = "http.request.type",
23
+ ERROR_MESSAGE = "error.message",
24
+ ERROR_STACK = "error.stack"
25
+ }
26
+ export declare enum PULSE_TYPES {
27
+ SCREEN_SESSION = "screen_session",
28
+ SCREEN_LOAD = "screen_load",
29
+ SCREEN_INTERACTIVE = "screen_interactive"
30
+ }
31
+ export declare enum PHASE_VALUES {
32
+ START = "start",
33
+ NETWORK = "network"
34
+ }
35
+ //# sourceMappingURL=pulse.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulse.constants.d.ts","sourceRoot":"","sources":["../../../src/pulse.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,UAAU;IACpB,cAAc,kBAAkB;IAChC,SAAS,cAAc;IACvB,kBAAkB,sBAAsB;CACzC;AAED,oBAAY,cAAc;IACxB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,SAAS,aAAa;IACtB,KAAK,UAAU;IACf,gBAAgB,qBAAqB;IACrC,mBAAmB,qBAAqB;IACxC,QAAQ,aAAa;IACrB,sBAAsB,2BAA2B;IACjD,sBAAsB,2BAA2B;IACjD,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;CAC5B;AAED,oBAAY,WAAW;IACrB,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;CAC1C;AAED,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB"}
@@ -4,5 +4,6 @@
4
4
  * @see https://github.com/open-telemetry/opentelemetry-js/blob/main/api/src/common/Attributes.ts
5
5
  */
6
6
  export type PulseAttributeValue = string | number | boolean | string[] | number[] | boolean[];
7
- export type PulseAttributes = Record<string, PulseAttributeValue | undefined>;
7
+ export type PulseAttributes = Record<string, PulseAttributeValue | undefined | null>;
8
+ export type PulseFeatureConfig = Record<string, boolean> | null;
8
9
  //# sourceMappingURL=pulse.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pulse.interface.d.ts","sourceRoot":"","sources":["../../../src/pulse.interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,EAAE,GACR,MAAM,EAAE,GACR,OAAO,EAAE,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"pulse.interface.d.ts","sourceRoot":"","sources":["../../../src/pulse.interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,EAAE,GACR,MAAM,EAAE,GACR,OAAO,EAAE,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,mBAAmB,GAAG,SAAS,GAAG,IAAI,CACvC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC"}
@@ -1,6 +1,12 @@
1
1
  import type { PulseAttributes } from './pulse.interface';
2
+ /**
3
+ * Options for starting a span.
4
+ * @param attributes - Attributes to set on the span.
5
+ * @param inheritContext - Controls whether or not the new span will be parented in the existing (current) context. If false, a new context is created.
6
+ */
2
7
  export type SpanOptions = {
3
8
  attributes?: PulseAttributes;
9
+ inheritContext?: boolean;
4
10
  };
5
11
  export declare enum SpanStatusCode {
6
12
  OK = "OK",
@@ -16,4 +22,5 @@ export type Span = {
16
22
  };
17
23
  export declare function startSpan(name: string, options?: SpanOptions): Span;
18
24
  export declare function trackSpan<T>(name: string, options: SpanOptions, fn: () => T | Promise<T>): T | Promise<T>;
25
+ export declare function discardSpan(spanId: string): void;
19
26
  //# sourceMappingURL=trace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,oBAAY,cAAc;IACxB,EAAE,OAAO;IACT,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/D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,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAiCnE;AAED,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAuBhB;AAMD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAKhD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamhorizonorg/pulse-react-native",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Production-grade observability SDK for React Native applications with OpenTelemetry support. Real-time monitoring, error tracking, performance insights, and distributed tracing.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -10,15 +10,22 @@
10
10
  "types": "./lib/typescript/src/index.d.ts",
11
11
  "default": "./lib/module/index.js"
12
12
  },
13
- "./package.json": "./package.json"
13
+ "./package.json": "./package.json",
14
+ "./app.plugin.js": "./app.plugin.js"
15
+ },
16
+ "bin": {
17
+ "pulse-cli": "./scripts/pulse-cli.js"
14
18
  },
15
19
  "files": [
16
20
  "src",
17
21
  "lib",
22
+ "scripts",
18
23
  "android",
19
24
  "ios",
20
25
  "cpp",
21
26
  "*.podspec",
27
+ "*.plugin.js",
28
+ "plugin/build",
22
29
  "react-native.config.js",
23
30
  "!ios/build",
24
31
  "!android/build",
@@ -36,9 +43,11 @@
36
43
  "test": "jest",
37
44
  "typecheck": "tsc",
38
45
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
- "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
- "prepare": "bob build",
41
- "release": "release-it --only-version"
46
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib plugin/build",
47
+ "build:plugin": "tsc -p plugin/tsconfig.json",
48
+ "prepare": "npm run build:plugin && bob build",
49
+ "release": "release-it --only-version",
50
+ "pulse-cli": "node scripts/pulse-cli.js"
42
51
  },
43
52
  "keywords": [
44
53
  "react-native",
@@ -72,6 +81,7 @@
72
81
  "@eslint/eslintrc": "^3.3.1",
73
82
  "@eslint/js": "^9.35.0",
74
83
  "@evilmartians/lefthook": "^1.12.3",
84
+ "@expo/config-plugins": "^54.0.0",
75
85
  "@react-native-community/cli": "20.0.1",
76
86
  "@react-native/babel-preset": "0.81.1",
77
87
  "@react-native/eslint-config": "^0.81.1",
@@ -82,7 +92,9 @@
82
92
  "del-cli": "^6.0.0",
83
93
  "eslint": "^9.35.0",
84
94
  "eslint-config-prettier": "^10.1.8",
95
+ "eslint-plugin-jest": "^29.11.0",
85
96
  "eslint-plugin-prettier": "^5.5.4",
97
+ "expo-module-scripts": "^5.0.8",
86
98
  "jest": "^29.7.0",
87
99
  "prettier": "^3.6.2",
88
100
  "react": "19.1.0",
@@ -92,10 +104,6 @@
92
104
  "turbo": "^2.5.6",
93
105
  "typescript": "^5.9.2"
94
106
  },
95
- "peerDependencies": {
96
- "react": "*",
97
- "react-native": "*"
98
- },
99
107
  "workspaces": [
100
108
  "example"
101
109
  ],
@@ -161,5 +169,17 @@
161
169
  "languages": "kotlin-objc",
162
170
  "type": "turbo-module",
163
171
  "version": "0.54.8"
172
+ },
173
+ "dependencies": {
174
+ "commander": "^14.0.2"
175
+ },
176
+ "engines": {
177
+ "node": ">=18.0.0"
178
+ },
179
+ "app.plugin.js": "./app.plugin.js",
180
+ "peerDependencies": {
181
+ "@expo/config-plugins": "*",
182
+ "react": "*",
183
+ "react-native": "*"
164
184
  }
165
185
  }
@@ -0,0 +1,4 @@
1
+ import { type ConfigPlugin } from '@expo/config-plugins';
2
+ import type { PulsePluginProps } from './types';
3
+ declare const _default: ConfigPlugin<PulsePluginProps>;
4
+ export default _default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_plugins_1 = require("@expo/config-plugins");
4
+ const withAndroidPulse_1 = require("./withAndroidPulse");
5
+ const pkg = require('../../package.json');
6
+ const withPulsePlugin = (config, props) => {
7
+ config = (0, withAndroidPulse_1.withAndroidPulse)(config, props);
8
+ return config;
9
+ };
10
+ exports.default = (0, config_plugins_1.createRunOncePlugin)(withPulsePlugin, pkg.name, pkg.version);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * OpenTelemetry attribute value types.
3
+ * Based on OpenTelemetry JavaScript SDK attribute types.
4
+ * @see https://github.com/open-telemetry/opentelemetry-js/blob/main/api/src/common/Attributes.ts
5
+ */
6
+ export type PulseAttributeValue = string | number | boolean | string[] | number[] | boolean[];
7
+ export type PulseAttributes = Record<string, PulseAttributeValue | undefined | null>;
8
+ interface IInteractionConfig {
9
+ enabled: boolean;
10
+ url?: string;
11
+ }
12
+ export interface PulsePluginProps {
13
+ endpointBaseUrl: string;
14
+ endpointHeaders?: Record<string, string>;
15
+ globalAttributes?: PulseAttributes;
16
+ instrumentation?: {
17
+ interaction?: IInteractionConfig;
18
+ activity?: boolean;
19
+ network?: boolean;
20
+ anr?: boolean;
21
+ crash?: boolean;
22
+ slowRendering?: boolean;
23
+ fragment?: boolean;
24
+ };
25
+ }
26
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export declare const PULSE_IMPORT = "import com.pulsereactnativeotel.Pulse\n";
2
+ export declare const ATTRIBUTES_IMPORT = "import io.opentelemetry.api.common.Attributes\nimport io.opentelemetry.api.common.AttributeKey\n";
3
+ import type { PulsePluginProps } from './types';
4
+ export declare function buildPulseInitializationCode(options: {
5
+ endpointBaseUrl: string;
6
+ endpointHeaders?: Record<string, string>;
7
+ globalAttributes?: PulsePluginProps['globalAttributes'];
8
+ instrumentation?: PulsePluginProps['instrumentation'];
9
+ }): string;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ATTRIBUTES_IMPORT = exports.PULSE_IMPORT = void 0;
4
+ exports.buildPulseInitializationCode = buildPulseInitializationCode;
5
+ exports.PULSE_IMPORT = 'import com.pulsereactnativeotel.Pulse\n';
6
+ exports.ATTRIBUTES_IMPORT = 'import io.opentelemetry.api.common.Attributes\nimport io.opentelemetry.api.common.AttributeKey\n';
7
+ function buildEndpointHeadersMap(headers) {
8
+ const entries = Object.entries(headers).map(([k, v]) => {
9
+ return '"' + k + '" to "' + v + '"';
10
+ });
11
+ return `mapOf(${entries.join(', ')})`;
12
+ }
13
+ function buildGlobalAttributesLambda(attributes) {
14
+ const puts = [];
15
+ Object.entries(attributes)
16
+ .filter(([, value]) => {
17
+ if (value === null || value === undefined)
18
+ return false;
19
+ if (typeof value === 'string' && value === '')
20
+ return false;
21
+ if (Array.isArray(value) && value.length === 0)
22
+ return false;
23
+ return true;
24
+ })
25
+ .forEach(([k, v]) => {
26
+ if (typeof v === 'string') {
27
+ puts.push(`put(AttributeKey.stringKey("${k}"), "${v}")`);
28
+ }
29
+ else if (typeof v === 'number') {
30
+ puts.push(`put(AttributeKey.${Number.isInteger(v) ? 'long' : 'double'}Key("${k}"), ${v}${Number.isInteger(v) ? 'L' : ''})`);
31
+ }
32
+ else if (typeof v === 'boolean') {
33
+ puts.push(`put(AttributeKey.booleanKey("${k}"), ${v})`);
34
+ }
35
+ else if (Array.isArray(v)) {
36
+ const first = v[0];
37
+ if (typeof first === 'string') {
38
+ puts.push(`put(AttributeKey.stringArrayKey("${k}"), listOf(${v.map((x) => `"${x}"`).join(', ')}))`);
39
+ }
40
+ else if (typeof first === 'number') {
41
+ const allInts = v.every((x) => Number.isInteger(x));
42
+ const values = allInts
43
+ ? v.map((x) => `${x}L`).join(', ')
44
+ : v
45
+ .map((x) => (Number.isInteger(x) ? `${x}.0` : `${x}`))
46
+ .join(', ');
47
+ puts.push(`put(AttributeKey.${allInts ? 'long' : 'double'}ArrayKey("${k}"), listOf(${values}))`);
48
+ }
49
+ else if (typeof first === 'boolean') {
50
+ puts.push(`put(AttributeKey.booleanArrayKey("${k}"), listOf(${v.join(', ')}))`);
51
+ }
52
+ }
53
+ });
54
+ if (puts.length === 0)
55
+ return 'null';
56
+ const formatted = puts
57
+ .map((put) => ` ${put}`)
58
+ .join('\n');
59
+ return `{\n Attributes.builder().apply {\n${formatted}\n }.build()\n }`;
60
+ }
61
+ function buildPulseInitializationCode(options) {
62
+ const { endpointBaseUrl, endpointHeaders, globalAttributes, instrumentation, } = options;
63
+ const params = [];
64
+ if (endpointHeaders && Object.keys(endpointHeaders).length > 0) {
65
+ params.push(`endpointHeaders = ${buildEndpointHeadersMap(endpointHeaders)}`);
66
+ }
67
+ const attributesLambda = globalAttributes
68
+ ? buildGlobalAttributesLambda(globalAttributes)
69
+ : null;
70
+ if (attributesLambda && attributesLambda !== 'null') {
71
+ params.push(`globalAttributes = ${attributesLambda}`);
72
+ }
73
+ let code = `\n Pulse.initialize(\n this,\n "${endpointBaseUrl}"${params.length > 0 ? `,\n ${params.join(',\n ')}` : ''}\n ) {\n`;
74
+ if (instrumentation?.interaction !== undefined) {
75
+ if (instrumentation.interaction.url) {
76
+ code += ` interaction { enabled(${instrumentation.interaction.enabled}); setConfigUrl { "${instrumentation.interaction.url}" } }\n`;
77
+ }
78
+ else {
79
+ code += ` interaction { enabled(${instrumentation.interaction.enabled}) }\n`;
80
+ }
81
+ }
82
+ if (instrumentation?.activity !== undefined) {
83
+ code += ` activity { enabled(${instrumentation.activity}) }\n`;
84
+ }
85
+ if (instrumentation?.network !== undefined) {
86
+ code += ` networkMonitoring { enabled(${instrumentation.network}) }\n`;
87
+ }
88
+ if (instrumentation?.anr !== undefined) {
89
+ code += ` anrReporter { enabled(${instrumentation.anr}) }\n`;
90
+ }
91
+ if (instrumentation?.slowRendering !== undefined) {
92
+ code += ` slowRenderingReporter { enabled(${instrumentation.slowRendering}) }\n`;
93
+ }
94
+ if (instrumentation?.fragment !== undefined) {
95
+ code += ` fragment { enabled(${instrumentation.fragment}) }\n`;
96
+ }
97
+ if (instrumentation?.crash !== undefined) {
98
+ code += ` crashReporter { enabled(${instrumentation.crash}) }\n`;
99
+ }
100
+ code += ' }\n';
101
+ return code;
102
+ }
@@ -0,0 +1,3 @@
1
+ import type { ConfigPlugin } from '@expo/config-plugins';
2
+ import type { PulsePluginProps } from './types';
3
+ export declare const withAndroidPulse: ConfigPlugin<PulsePluginProps>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withAndroidPulse = void 0;
4
+ const config_plugins_1 = require("@expo/config-plugins");
5
+ const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
6
+ const utils_1 = require("./utils");
7
+ const withAndroidPulse = (config, props) => {
8
+ return (0, config_plugins_1.withMainApplication)(config, (modConfig) => {
9
+ try {
10
+ const { endpointBaseUrl, endpointHeaders, globalAttributes, instrumentation, } = props;
11
+ // 1. Add import statements
12
+ modConfig.modResults.contents = (0, generateCode_1.mergeContents)({
13
+ src: modConfig.modResults.contents,
14
+ newSrc: utils_1.PULSE_IMPORT,
15
+ tag: 'pulse-sdk-import',
16
+ comment: '//',
17
+ anchor: /import\s+com\.facebook\.react\.ReactApplication/,
18
+ offset: 1,
19
+ }).contents;
20
+ if (globalAttributes && Object.keys(globalAttributes).length > 0) {
21
+ modConfig.modResults.contents = (0, generateCode_1.mergeContents)({
22
+ src: modConfig.modResults.contents,
23
+ newSrc: utils_1.ATTRIBUTES_IMPORT,
24
+ tag: 'pulse-attributes-import',
25
+ comment: '//',
26
+ anchor: /import\s+com\.pulsereactnativeotel\.Pulse/,
27
+ offset: 1,
28
+ }).contents;
29
+ }
30
+ const initCode = (0, utils_1.buildPulseInitializationCode)({
31
+ endpointBaseUrl,
32
+ endpointHeaders,
33
+ globalAttributes,
34
+ instrumentation,
35
+ });
36
+ // 2. Add initialization code after super.onCreate()
37
+ modConfig.modResults.contents = (0, generateCode_1.mergeContents)({
38
+ src: modConfig.modResults.contents,
39
+ newSrc: initCode,
40
+ tag: 'pulse-sdk-initialization',
41
+ comment: '//',
42
+ anchor: /super\.onCreate\(\)/,
43
+ offset: 1,
44
+ }).contents;
45
+ return modConfig;
46
+ }
47
+ catch (error) {
48
+ console.error('Error modifying MainApplication:', error);
49
+ return modConfig;
50
+ }
51
+ });
52
+ };
53
+ exports.withAndroidPulse = withAndroidPulse;