@datadog/mobile-react-native-navigation 1.0.0-rc4 → 1.0.0-rc5
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/lib/commonjs/rum/instrumentation/DdRumReactNativeNavigationTracking.js +10 -4
- package/lib/commonjs/rum/instrumentation/DdRumReactNativeNavigationTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumReactNativeNavigationTracking.js +10 -4
- package/lib/module/rum/instrumentation/DdRumReactNativeNavigationTracking.js.map +1 -1
- package/lib/typescript/core/src/DdSdkReactNativeConfiguration.d.ts +2 -2
- package/lib/typescript/core/src/InternalLog.d.ts +6 -0
- package/lib/typescript/core/src/SdkVerbosity.d.ts +9 -0
- package/lib/typescript/core/src/index.d.ts +2 -1
- package/lib/typescript/core/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/lib/typescript/core/src/NativeSdkVerbosity.d.ts +0 -9
|
@@ -22,9 +22,11 @@ class DdRumReactNativeNavigationTracking {
|
|
|
22
22
|
/**
|
|
23
23
|
* Starts tracking the Navigation and sends a RUM View event every time a root View component appear/disappear.
|
|
24
24
|
*/
|
|
25
|
-
static startTracking(
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
static startTracking() {
|
|
26
|
+
let viewNamePredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (_event, trackedName) {
|
|
27
|
+
return trackedName;
|
|
28
|
+
};
|
|
29
|
+
|
|
28
30
|
// extra safety to avoid wrapping more than 1 time this function
|
|
29
31
|
if (DdRumReactNativeNavigationTracking.isTracking) {
|
|
30
32
|
return;
|
|
@@ -33,7 +35,7 @@ class DdRumReactNativeNavigationTracking {
|
|
|
33
35
|
const original = _react.default.createElement;
|
|
34
36
|
DdRumReactNativeNavigationTracking.originalCreateElement = original;
|
|
35
37
|
|
|
36
|
-
_react.default.createElement = (element, props
|
|
38
|
+
_react.default.createElement = function (element, props) {
|
|
37
39
|
if (props && props.componentId != undefined && !DdRumReactNativeNavigationTracking.trackedComponentIds.includes(props.componentId)) {
|
|
38
40
|
const componentId = props.componentId;
|
|
39
41
|
|
|
@@ -54,6 +56,10 @@ class DdRumReactNativeNavigationTracking {
|
|
|
54
56
|
DdRumReactNativeNavigationTracking.trackedComponentIds.push(componentId);
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
60
|
+
children[_key - 2] = arguments[_key];
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
return original(element, props, ...children);
|
|
58
64
|
};
|
|
59
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdRumReactNativeNavigationTracking.tsx"],"names":["DdRumReactNativeNavigationTracking","startTracking","viewNamePredicate","_event","trackedName","isTracking","original","React","createElement","originalCreateElement","element","props","
|
|
1
|
+
{"version":3,"sources":["DdRumReactNativeNavigationTracking.tsx"],"names":["DdRumReactNativeNavigationTracking","startTracking","viewNamePredicate","_event","trackedName","isTracking","original","React","createElement","originalCreateElement","element","props","componentId","undefined","trackedComponentIds","includes","Navigation","events","registerComponentListener","componentDidAppear","event","predicate","screenName","componentName","DdRum","startView","componentDidDisappear","stopView","push","children","stopTracking","splice","length"],"mappings":";;;;;;;AAMA;;AACA;;AACA;;;;;;AAIA;AACA;AACA;AACO,MAAMA,kCAAN,CAAyC;AAQ5C;AACJ;AACA;AACwB,SAAbC,aAAa,GAAuI;AAAA,QAAtIC,iBAAsI,uEAA/F,UAAUC,MAAV,EAA2CC,WAA3C,EAAgE;AAAE,aAAOA,WAAP;AAAqB,KAAQ;;AACvJ;AACA,QAAIJ,kCAAkC,CAACK,UAAvC,EAAmD;AAC/C;AACH;;AACD,UAAMC,QAAQ,GAAGC,eAAMC,aAAvB;AACAR,IAAAA,kCAAkC,CAACS,qBAAnC,GAA2DH,QAA3D;;AACAC,mBAAMC,aAAN,GAAsB,UAACE,OAAD,EAAeC,K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8D,CAA9D,EAAiE/B,kCAAkC,CAACc,mBAAnC,CAAuDkB,MAAxH;AACAhC,IAAAA,kCAAkC,CAACK,UAAnC,GAAgD,KAAhD;;AACAL,IAAAA,kCAAkC,CAACE,iBAAnC,GAAuD,UAAUC,MAAV,EAA2CC,WAA3C,EAAgE;AAAE,aAAOA,WAAP;AAAqB,KAA9I;AACH;;AA1D2C;;;;gBAAnCJ,kC,gBAEmB,K;;gBAFnBA,kC,yBAGyC,E;;gBAHzCA,kC,2BAImCa,S;;gBAJnCb,kC","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport React from 'react'\nimport { ComponentDidAppearEvent, Navigation } from 'react-native-navigation';\nimport { DdRum } from '@datadog/mobile-react-native';\n\nexport type ViewNamePredicate = (event: ComponentDidAppearEvent, trackedName: string) => string\n\n/**\n* Provides RUM integration for the [React Native Navigation](https://wix.github.io/react-native-navigation) API.\n*/\nexport class DdRumReactNativeNavigationTracking {\n\n private static isTracking = false\n private static trackedComponentIds : Array<any> = [];\n private static originalCreateElement: any = undefined\n\n private static viewNamePredicate: ViewNamePredicate;\n\n /**\n * Starts tracking the Navigation and sends a RUM View event every time a root View component appear/disappear.\n */\n static startTracking(viewNamePredicate: ViewNamePredicate = function (_event: ComponentDidAppearEvent, trackedName: string) { return trackedName; }): void {\n // extra safety to avoid wrapping more than 1 time this function\n if (DdRumReactNativeNavigationTracking.isTracking) {\n return\n }\n const original = React.createElement\n DdRumReactNativeNavigationTracking.originalCreateElement = original\n React.createElement = (element: any, props: any, ...children: any): any => {\n if (props && props.componentId != undefined \n && !DdRumReactNativeNavigationTracking.trackedComponentIds.includes(props.componentId)\n ) {\n const componentId = props.componentId\n Navigation.events().registerComponentListener(\n {\n componentDidAppear: (event: ComponentDidAppearEvent) => {\n const predicate = DdRumReactNativeNavigationTracking.viewNamePredicate;\n const screenName = predicate(event, event.componentName) ?? event.componentName;\n DdRum.startView(componentId, screenName);\n },\n componentDidDisappear: () => {\n DdRum.stopView(componentId);\n },\n },\n componentId\n );\n DdRumReactNativeNavigationTracking.trackedComponentIds.push(componentId);\n }\n\n return original(element, props, ...children)\n }\n DdRumReactNativeNavigationTracking.isTracking = true\n DdRumReactNativeNavigationTracking.viewNamePredicate = viewNamePredicate\n }\n\n /**\n * Stops tracking Navigation.\n */\n static stopTracking(): void {\n if (!DdRumReactNativeNavigationTracking.isTracking) {\n return\n }\n if (DdRumReactNativeNavigationTracking.originalCreateElement != undefined) {\n React.createElement = DdRumReactNativeNavigationTracking.originalCreateElement;\n }\n DdRumReactNativeNavigationTracking.trackedComponentIds.splice(0, DdRumReactNativeNavigationTracking.trackedComponentIds.length)\n DdRumReactNativeNavigationTracking.isTracking = false\n DdRumReactNativeNavigationTracking.viewNamePredicate = function (_event: ComponentDidAppearEvent, trackedName: string) { return trackedName; }\n }\n}"]}
|
|
@@ -16,9 +16,11 @@ export class DdRumReactNativeNavigationTracking {
|
|
|
16
16
|
/**
|
|
17
17
|
* Starts tracking the Navigation and sends a RUM View event every time a root View component appear/disappear.
|
|
18
18
|
*/
|
|
19
|
-
static startTracking(
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
static startTracking() {
|
|
20
|
+
let viewNamePredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (_event, trackedName) {
|
|
21
|
+
return trackedName;
|
|
22
|
+
};
|
|
23
|
+
|
|
22
24
|
// extra safety to avoid wrapping more than 1 time this function
|
|
23
25
|
if (DdRumReactNativeNavigationTracking.isTracking) {
|
|
24
26
|
return;
|
|
@@ -27,7 +29,7 @@ export class DdRumReactNativeNavigationTracking {
|
|
|
27
29
|
const original = React.createElement;
|
|
28
30
|
DdRumReactNativeNavigationTracking.originalCreateElement = original;
|
|
29
31
|
|
|
30
|
-
React.createElement = (element, props
|
|
32
|
+
React.createElement = function (element, props) {
|
|
31
33
|
if (props && props.componentId != undefined && !DdRumReactNativeNavigationTracking.trackedComponentIds.includes(props.componentId)) {
|
|
32
34
|
const componentId = props.componentId;
|
|
33
35
|
Navigation.events().registerComponentListener({
|
|
@@ -45,6 +47,10 @@ export class DdRumReactNativeNavigationTracking {
|
|
|
45
47
|
DdRumReactNativeNavigationTracking.trackedComponentIds.push(componentId);
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
51
|
+
children[_key - 2] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
return original(element, props, ...children);
|
|
49
55
|
};
|
|
50
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdRumReactNativeNavigationTracking.tsx"],"names":["React","Navigation","DdRum","DdRumReactNativeNavigationTracking","startTracking","viewNamePredicate","_event","trackedName","isTracking","original","createElement","originalCreateElement","element","props","
|
|
1
|
+
{"version":3,"sources":["DdRumReactNativeNavigationTracking.tsx"],"names":["React","Navigation","DdRum","DdRumReactNativeNavigationTracking","startTracking","viewNamePredicate","_event","trackedName","isTracking","original","createElement","originalCreateElement","element","props","componentId","undefined","trackedComponentIds","includes","events","registerComponentListener","componentDidAppear","event","predicate","screenName","componentName","startView","componentDidDisappear","stopView","push","children","stopTracking","splice","length"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAkCC,UAAlC,QAAoD,yBAApD;AACA,SAASC,KAAT,QAAsB,8BAAtB;;AAIA;AACA;AACA;AACA,OAAO,MAAMC,kCAAN,CAAyC;AAQ5C;AACJ;AACA;AACwB,SAAbC,aAAa,GAAuI;AAAA,QAAtIC,iBAAsI,uEAA/F,UAAUC,MAAV,EAA2CC,WAA3C,EAAgE;AAAE,aAAOA,WAAP;AAAqB,KAAQ;;AACvJ;AACA,QAAIJ,kCAAkC,CAACK,UAAvC,EAAmD;AA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AACK,UAAxC,EAAoD;AAChD;AACH;;AACD,QAAIL,kCAAkC,CAACQ,qBAAnC,IAA4DI,SAAhE,EAA2E;AACvEf,MAAAA,KAAK,CAACU,aAAN,GAAsBP,kCAAkC,CAACQ,qBAAzD;AACH;;AACDR,IAAAA,kCAAkC,CAACa,mBAAnC,CAAuDe,MAAvD,CAA8D,CAA9D,EAAiE5B,kCAAkC,CAACa,mBAAnC,CAAuDgB,MAAxH;AACA7B,IAAAA,kCAAkC,CAACK,UAAnC,GAAgD,KAAhD;;AACAL,IAAAA,kCAAkC,CAACE,iBAAnC,GAAuD,UAAUC,MAAV,EAA2CC,WAA3C,EAAgE;AAAE,aAAOA,WAAP;AAAqB,KAA9I;AACH;;AA1D2C;;gBAAnCJ,kC,gBAEmB,K;;gBAFnBA,kC,yBAGyC,E;;gBAHzCA,kC,2BAImCY,S;;gBAJnCZ,kC","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport React from 'react'\nimport { ComponentDidAppearEvent, Navigation } from 'react-native-navigation';\nimport { DdRum } from '@datadog/mobile-react-native';\n\nexport type ViewNamePredicate = (event: ComponentDidAppearEvent, trackedName: string) => string\n\n/**\n* Provides RUM integration for the [React Native Navigation](https://wix.github.io/react-native-navigation) API.\n*/\nexport class DdRumReactNativeNavigationTracking {\n\n private static isTracking = false\n private static trackedComponentIds : Array<any> = [];\n private static originalCreateElement: any = undefined\n\n private static viewNamePredicate: ViewNamePredicate;\n\n /**\n * Starts tracking the Navigation and sends a RUM View event every time a root View component appear/disappear.\n */\n static startTracking(viewNamePredicate: ViewNamePredicate = function (_event: ComponentDidAppearEvent, trackedName: string) { return trackedName; }): void {\n // extra safety to avoid wrapping more than 1 time this function\n if (DdRumReactNativeNavigationTracking.isTracking) {\n return\n }\n const original = React.createElement\n DdRumReactNativeNavigationTracking.originalCreateElement = original\n React.createElement = (element: any, props: any, ...children: any): any => {\n if (props && props.componentId != undefined \n && !DdRumReactNativeNavigationTracking.trackedComponentIds.includes(props.componentId)\n ) {\n const componentId = props.componentId\n Navigation.events().registerComponentListener(\n {\n componentDidAppear: (event: ComponentDidAppearEvent) => {\n const predicate = DdRumReactNativeNavigationTracking.viewNamePredicate;\n const screenName = predicate(event, event.componentName) ?? event.componentName;\n DdRum.startView(componentId, screenName);\n },\n componentDidDisappear: () => {\n DdRum.stopView(componentId);\n },\n },\n componentId\n );\n DdRumReactNativeNavigationTracking.trackedComponentIds.push(componentId);\n }\n\n return original(element, props, ...children)\n }\n DdRumReactNativeNavigationTracking.isTracking = true\n DdRumReactNativeNavigationTracking.viewNamePredicate = viewNamePredicate\n }\n\n /**\n * Stops tracking Navigation.\n */\n static stopTracking(): void {\n if (!DdRumReactNativeNavigationTracking.isTracking) {\n return\n }\n if (DdRumReactNativeNavigationTracking.originalCreateElement != undefined) {\n React.createElement = DdRumReactNativeNavigationTracking.originalCreateElement;\n }\n DdRumReactNativeNavigationTracking.trackedComponentIds.splice(0, DdRumReactNativeNavigationTracking.trackedComponentIds.length)\n DdRumReactNativeNavigationTracking.isTracking = false\n DdRumReactNativeNavigationTracking.viewNamePredicate = function (_event: ComponentDidAppearEvent, trackedName: string) { return trackedName; }\n }\n}"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TrackingConsent } from './TrackingConsent';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SdkVerbosity } from './SdkVerbosity';
|
|
3
3
|
import type { ProxyConfiguration } from './ProxyConfiguration';
|
|
4
4
|
/**
|
|
5
5
|
* The SDK configuration class.
|
|
@@ -16,7 +16,7 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
16
16
|
nativeCrashReportEnabled: boolean;
|
|
17
17
|
sampleRate: number;
|
|
18
18
|
site: string;
|
|
19
|
-
verbosity:
|
|
19
|
+
verbosity: SdkVerbosity | undefined;
|
|
20
20
|
nativeViewTracking: boolean;
|
|
21
21
|
proxyConfig?: ProxyConfiguration;
|
|
22
22
|
serviceName?: string;
|
|
@@ -3,4 +3,5 @@ import { DdSdkReactNativeConfiguration } from './DdSdkReactNativeConfiguration';
|
|
|
3
3
|
import { DdSdkReactNative } from './DdSdkReactNative';
|
|
4
4
|
import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
|
|
5
5
|
import { TrackingConsent } from './TrackingConsent';
|
|
6
|
-
|
|
6
|
+
import { SdkVerbosity } from './SdkVerbosity';
|
|
7
|
+
export { DdLogs, DdTrace, DdRum, DdSdkReactNativeConfiguration, DdSdkReactNative, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0.0-
|
|
1
|
+
export declare const version = "1.0.0-rc5";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/mobile-react-native-navigation",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc5",
|
|
4
4
|
"description": "A client-side React Native module to interact with Datadog",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datadog",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"prepare": "bob build"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@datadog/mobile-react-native": "^1.0.0-
|
|
39
|
+
"@datadog/mobile-react-native": "^1.0.0-rc5",
|
|
40
40
|
"react-native-gesture-handler": "1.10.3",
|
|
41
41
|
"react-native-navigation": "7.13.0"
|
|
42
42
|
},
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
]
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6be800b36e37b072e43a36a32fd058a1ba6fd889"
|
|
74
74
|
}
|