@datadog/mobile-react-native-session-replay 2.4.3-alpha.0 → 2.5.0-alpha.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.
Files changed (56) hide show
  1. package/DatadogSDKReactNativeSessionReplay.podspec +1 -1
  2. package/android/build.gradle +16 -6
  3. package/android/consumer-proguard-rules.pro +3 -0
  4. package/android/gradle.properties +1 -1
  5. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplayImplementation.kt +34 -14
  6. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.kt +15 -4
  7. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ReactTextPropertiesResolver.kt +8 -10
  8. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplayPrivacySettings.kt +90 -0
  9. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplaySDKWrapper.kt +14 -0
  10. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/SessionReplayWrapper.kt +10 -0
  11. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/extensions/ReactDrawablesExt.kt +190 -0
  12. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactEditTextMapper.kt +84 -10
  13. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactNativeImageViewMapper.kt +106 -0
  14. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactViewGroupMapper.kt +4 -5
  15. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/resources/ReactDrawableCopier.kt +34 -0
  16. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/DrawableUtils.kt +10 -23
  17. package/android/src/newarch/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplay.kt +28 -4
  18. package/android/src/oldarch/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplay.kt +35 -3
  19. package/android/src/{main/kotlin/com/datadog/reactnative/sessionreplay/extensions/LongExt.kt → rn75/kotlin/com/datadog/reactnative/sessionreplay/extensions/LengthPercentageExt.kt} +6 -8
  20. package/android/src/rn75/kotlin/com/datadog/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +101 -0
  21. package/android/src/rn76/kotlin/com/datadog/reactnative/sessionreplay/extensions/LengthPercentageExt.kt +13 -0
  22. package/android/src/rn76/kotlin/com/datadog/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +101 -0
  23. package/android/src/rnlegacy/kotlin/com.datadog.reactnative.sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +88 -0
  24. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplayImplementationTest.kt +67 -9
  25. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupportTest.kt +7 -3
  26. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/ReactTextPropertiesResolverTest.kt +2 -7
  27. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactViewGroupMapperTest.kt +2 -7
  28. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/utils/DrawableUtilsTest.kt +2 -1
  29. package/ios/Sources/DdSessionReplay.mm +46 -4
  30. package/ios/Sources/DdSessionReplayImplementation.swift +83 -11
  31. package/ios/Sources/RCTTextViewRecorder.swift +1 -1
  32. package/lib/commonjs/SessionReplay.js +78 -10
  33. package/lib/commonjs/SessionReplay.js.map +1 -1
  34. package/lib/commonjs/index.js +18 -0
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/specs/NativeDdSessionReplay.js.map +1 -1
  37. package/lib/module/SessionReplay.js +77 -9
  38. package/lib/module/SessionReplay.js.map +1 -1
  39. package/lib/module/index.js +2 -2
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/specs/NativeDdSessionReplay.js.map +1 -1
  42. package/lib/typescript/SessionReplay.d.ts +73 -4
  43. package/lib/typescript/SessionReplay.d.ts.map +1 -1
  44. package/lib/typescript/index.d.ts +2 -2
  45. package/lib/typescript/index.d.ts.map +1 -1
  46. package/lib/typescript/nativeModulesTypes.d.ts +18 -3
  47. package/lib/typescript/nativeModulesTypes.d.ts.map +1 -1
  48. package/lib/typescript/specs/NativeDdSessionReplay.d.ts +15 -2
  49. package/lib/typescript/specs/NativeDdSessionReplay.d.ts.map +1 -1
  50. package/package.json +2 -1
  51. package/src/SessionReplay.ts +170 -23
  52. package/src/__tests__/SessionReplay.test.ts +94 -8
  53. package/src/index.ts +14 -2
  54. package/src/nativeModulesTypes.ts +27 -4
  55. package/src/specs/NativeDdSessionReplay.ts +21 -3
  56. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +0 -66
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SessionReplayWrapper = exports.SessionReplayPrivacy = exports.SessionReplay = void 0;
6
+ exports.TouchPrivacyLevel = exports.TextAndInputPrivacyLevel = exports.SessionReplayWrapper = exports.SessionReplayPrivacy = exports.SessionReplay = exports.ImagePrivacyLevel = void 0;
7
7
  /*
8
8
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
9
9
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
@@ -15,13 +15,34 @@ let SessionReplayPrivacy = exports.SessionReplayPrivacy = /*#__PURE__*/function
15
15
  SessionReplayPrivacy["MASK_USER_INPUT"] = "MASK_USER_INPUT";
16
16
  return SessionReplayPrivacy;
17
17
  }({});
18
+ let ImagePrivacyLevel = exports.ImagePrivacyLevel = /*#__PURE__*/function (ImagePrivacyLevel) {
19
+ ImagePrivacyLevel["MASK_NON_BUNDLED_ONLY"] = "MASK_NON_BUNDLED_ONLY";
20
+ ImagePrivacyLevel["MASK_ALL"] = "MASK_ALL";
21
+ ImagePrivacyLevel["MASK_NONE"] = "MASK_NONE";
22
+ return ImagePrivacyLevel;
23
+ }({});
24
+ let TouchPrivacyLevel = exports.TouchPrivacyLevel = /*#__PURE__*/function (TouchPrivacyLevel) {
25
+ TouchPrivacyLevel["SHOW"] = "SHOW";
26
+ TouchPrivacyLevel["HIDE"] = "HIDE";
27
+ return TouchPrivacyLevel;
28
+ }({});
29
+ let TextAndInputPrivacyLevel = exports.TextAndInputPrivacyLevel = /*#__PURE__*/function (TextAndInputPrivacyLevel) {
30
+ TextAndInputPrivacyLevel["MASK_SENSITIVE_INPUTS"] = "MASK_SENSITIVE_INPUTS";
31
+ TextAndInputPrivacyLevel["MASK_ALL_INPUTS"] = "MASK_ALL_INPUTS";
32
+ TextAndInputPrivacyLevel["MASK_ALL"] = "MASK_ALL";
33
+ return TextAndInputPrivacyLevel;
34
+ }({});
18
35
  /**
19
36
  * The Session Replay configuration object.
20
37
  */
21
38
  const DEFAULTS = {
22
39
  replaySampleRate: 0,
23
40
  defaultPrivacyLevel: SessionReplayPrivacy.MASK,
24
- customEndpoint: ''
41
+ customEndpoint: '',
42
+ imagePrivacyLevel: ImagePrivacyLevel.MASK_ALL,
43
+ touchPrivacyLevel: TouchPrivacyLevel.HIDE,
44
+ textAndInputPrivacyLevel: TextAndInputPrivacyLevel.MASK_ALL,
45
+ startRecordingImmediately: true
25
46
  };
26
47
  class SessionReplayWrapper {
27
48
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
@@ -32,13 +53,43 @@ class SessionReplayWrapper {
32
53
  }
33
54
  const {
34
55
  replaySampleRate,
35
- defaultPrivacyLevel,
36
- customEndpoint
56
+ customEndpoint,
57
+ startRecordingImmediately
37
58
  } = configuration;
38
- return {
59
+ const baseConfig = {
39
60
  replaySampleRate: replaySampleRate !== undefined ? replaySampleRate : DEFAULTS.replaySampleRate,
40
- defaultPrivacyLevel: defaultPrivacyLevel !== undefined ? defaultPrivacyLevel : DEFAULTS.defaultPrivacyLevel,
41
- customEndpoint: customEndpoint !== undefined ? customEndpoint : DEFAULTS.customEndpoint
61
+ customEndpoint: customEndpoint !== undefined ? customEndpoint : DEFAULTS.customEndpoint,
62
+ startRecordingImmediately: startRecordingImmediately !== undefined ? startRecordingImmediately : DEFAULTS.startRecordingImmediately
63
+ };
64
+ const privacyConfig = {
65
+ imagePrivacyLevel: configuration.imagePrivacyLevel ?? DEFAULTS.imagePrivacyLevel,
66
+ touchPrivacyLevel: configuration.touchPrivacyLevel ?? DEFAULTS.touchPrivacyLevel,
67
+ textAndInputPrivacyLevel: configuration.textAndInputPrivacyLevel ?? DEFAULTS.textAndInputPrivacyLevel
68
+ };
69
+
70
+ // Legacy Default Privacy Level property handling
71
+ if (configuration.defaultPrivacyLevel) {
72
+ switch (configuration.defaultPrivacyLevel) {
73
+ case SessionReplayPrivacy.MASK:
74
+ privacyConfig.imagePrivacyLevel = ImagePrivacyLevel.MASK_ALL;
75
+ privacyConfig.touchPrivacyLevel = TouchPrivacyLevel.HIDE;
76
+ privacyConfig.textAndInputPrivacyLevel = TextAndInputPrivacyLevel.MASK_ALL;
77
+ break;
78
+ case SessionReplayPrivacy.MASK_USER_INPUT:
79
+ privacyConfig.imagePrivacyLevel = ImagePrivacyLevel.MASK_NONE;
80
+ privacyConfig.touchPrivacyLevel = TouchPrivacyLevel.HIDE;
81
+ privacyConfig.textAndInputPrivacyLevel = TextAndInputPrivacyLevel.MASK_ALL_INPUTS;
82
+ break;
83
+ case SessionReplayPrivacy.ALLOW:
84
+ privacyConfig.imagePrivacyLevel = ImagePrivacyLevel.MASK_NONE;
85
+ privacyConfig.touchPrivacyLevel = TouchPrivacyLevel.SHOW;
86
+ privacyConfig.textAndInputPrivacyLevel = TextAndInputPrivacyLevel.MASK_SENSITIVE_INPUTS;
87
+ break;
88
+ }
89
+ }
90
+ return {
91
+ ...baseConfig,
92
+ ...privacyConfig
42
93
  };
43
94
  };
44
95
 
@@ -49,10 +100,27 @@ class SessionReplayWrapper {
49
100
  enable = configuration => {
50
101
  const {
51
102
  replaySampleRate,
52
- defaultPrivacyLevel,
53
- customEndpoint
103
+ customEndpoint,
104
+ imagePrivacyLevel,
105
+ touchPrivacyLevel,
106
+ textAndInputPrivacyLevel,
107
+ startRecordingImmediately
54
108
  } = this.buildConfiguration(configuration);
55
- return this.nativeSessionReplay.enable(replaySampleRate, defaultPrivacyLevel, customEndpoint);
109
+ return this.nativeSessionReplay.enable(replaySampleRate, customEndpoint, imagePrivacyLevel, touchPrivacyLevel, textAndInputPrivacyLevel, startRecordingImmediately);
110
+ };
111
+
112
+ /**
113
+ * Manually start the recording of the current session.
114
+ */
115
+ startRecording = () => {
116
+ return this.nativeSessionReplay.startRecording();
117
+ };
118
+
119
+ /**
120
+ * Manually stop the recording of the current session.
121
+ */
122
+ stopRecording = () => {
123
+ return this.nativeSessionReplay.stopRecording();
56
124
  };
57
125
  }
58
126
  exports.SessionReplayWrapper = SessionReplayWrapper;
@@ -1 +1 @@
1
- {"version":3,"names":["SessionReplayPrivacy","exports","DEFAULTS","replaySampleRate","defaultPrivacyLevel","MASK","customEndpoint","SessionReplayWrapper","nativeSessionReplay","require","default","buildConfiguration","configuration","undefined","enable","SessionReplay"],"sourceRoot":"../../src","sources":["SessionReplay.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAJA,IAQYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC;AACA;AACA;AAsBA,MAAME,QAAQ,GAAG;EACbC,gBAAgB,EAAE,CAAC;EACnBC,mBAAmB,EAAEJ,oBAAoB,CAACK,IAAI;EAC9CC,cAAc,EAAE;AACpB,CAAC;AAEM,MAAMC,oBAAoB,CAAC;EAC9B;EACQC,mBAAmB,GAA4BC,OAAO,CAAC,+BAA+B,CAAC,CAC1FC,OAAO;EAEJC,kBAAkB,GACtBC,aAA0C,IAKzC;IACD,IAAI,CAACA,aAAa,EAAE;MAChB,OAAOV,QAAQ;IACnB;IACA,MAAM;MACFC,gBAAgB;MAChBC,mBAAmB;MACnBE;IACJ,CAAC,GAAGM,aAAa;IACjB,OAAO;MACHT,gBAAgB,EACZA,gBAAgB,KAAKU,SAAS,GACxBV,gBAAgB,GAChBD,QAAQ,CAACC,gBAAgB;MACnCC,mBAAmB,EACfA,mBAAmB,KAAKS,SAAS,GAC3BT,mBAAmB,GACnBF,QAAQ,CAACE,mBAAmB;MACtCE,cAAc,EACVA,cAAc,KAAKO,SAAS,GACtBP,cAAc,GACdJ,QAAQ,CAACI;IACvB,CAAC;EACL,CAAC;;EAED;AACJ;AACA;AACA;EACIQ,MAAM,GAAIF,aAA0C,IAAoB;IACpE,MAAM;MACFT,gBAAgB;MAChBC,mBAAmB;MACnBE;IACJ,CAAC,GAAG,IAAI,CAACK,kBAAkB,CAACC,aAAa,CAAC;IAE1C,OAAO,IAAI,CAACJ,mBAAmB,CAACM,MAAM,CAClCX,gBAAgB,EAChBC,mBAAmB,EACnBE,cACJ,CAAC;EACL,CAAC;AACL;AAACL,OAAA,CAAAM,oBAAA,GAAAA,oBAAA;AAEM,MAAMQ,aAAa,GAAAd,OAAA,CAAAc,aAAA,GAAG,IAAIR,oBAAoB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["SessionReplayPrivacy","exports","ImagePrivacyLevel","TouchPrivacyLevel","TextAndInputPrivacyLevel","DEFAULTS","replaySampleRate","defaultPrivacyLevel","MASK","customEndpoint","imagePrivacyLevel","MASK_ALL","touchPrivacyLevel","HIDE","textAndInputPrivacyLevel","startRecordingImmediately","SessionReplayWrapper","nativeSessionReplay","require","default","buildConfiguration","configuration","baseConfig","undefined","privacyConfig","MASK_USER_INPUT","MASK_NONE","MASK_ALL_INPUTS","ALLOW","SHOW","MASK_SENSITIVE_INPUTS","enable","startRecording","stopRecording","SessionReplay"],"sourceRoot":"../../src","sources":["SessionReplay.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAJA,IAQYA,oBAAo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AC;;EAED;AACJ;AACA;AACA;EACIO,MAAM,GAAIV,aAA0C,IAAoB;IACpE,MAAM;MACFf,gBAAgB;MAChBG,cAAc;MACdC,iBAAiB;MACjBE,iBAAiB;MACjBE,wBAAwB;MACxBC;IACJ,CAAC,GAAG,IAAI,CAACK,kBAAkB,CAACC,aAAa,CAAC;IAE1C,OAAO,IAAI,CAACJ,mBAAmB,CAACc,MAAM,CAClCzB,gBAAgB,EAChBG,cAAc,EACdC,iBAAiB,EACjBE,iBAAiB,EACjBE,wBAAwB,EACxBC,yBACJ,CAAC;EACL,CAAC;;EAED;AACJ;AACA;EACIiB,cAAc,GAAGA,CAAA,KAAqB;IAClC,OAAO,IAAI,CAACf,mBAAmB,CAACe,cAAc,CAAC,CAAC;EACpD,CAAC;;EAED;AACJ;AACA;EACIC,aAAa,GAAGA,CAAA,KAAqB;IACjC,OAAO,IAAI,CAAChB,mBAAmB,CAACgB,aAAa,CAAC,CAAC;EACnD,CAAC;AACL;AAAChC,OAAA,CAAAe,oBAAA,GAAAA,oBAAA;AAEM,MAAMkB,aAAa,GAAAjC,OAAA,CAAAiC,aAAA,GAAG,IAAIlB,oBAAoB,CAAC,CAAC","ignoreList":[]}
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "ImagePrivacyLevel", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _SessionReplay.ImagePrivacyLevel;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "SessionReplay", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -15,5 +21,17 @@ Object.defineProperty(exports, "SessionReplayPrivacy", {
15
21
  return _SessionReplay.SessionReplayPrivacy;
16
22
  }
17
23
  });
24
+ Object.defineProperty(exports, "TextAndInputPrivacyLevel", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _SessionReplay.TextAndInputPrivacyLevel;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "TouchPrivacyLevel", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _SessionReplay.TouchPrivacyLevel;
34
+ }
35
+ });
18
36
  var _SessionReplay = require("./SessionReplay");
19
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_SessionReplay","require"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAOA,IAAAA,cAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_SessionReplay","require"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,cAAA,GAAAC,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdSessionReplay.ts"],"mappings":";;;;;;AAQA,IAAAA,YAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AAiBA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,GAAG,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdSessionReplay.ts"],"mappings":";;;;;;AAQA,IAAAA,YAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AAEA;AAIA;AACA;AACA;AAmCA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,GAAG,CAAO,iBAAiB,CAAC","ignoreList":[]}
@@ -10,6 +10,23 @@ export let SessionReplayPrivacy = /*#__PURE__*/function (SessionReplayPrivacy) {
10
10
  SessionReplayPrivacy["MASK_USER_INPUT"] = "MASK_USER_INPUT";
11
11
  return SessionReplayPrivacy;
12
12
  }({});
13
+ export let ImagePrivacyLevel = /*#__PURE__*/function (ImagePrivacyLevel) {
14
+ ImagePrivacyLevel["MASK_NON_BUNDLED_ONLY"] = "MASK_NON_BUNDLED_ONLY";
15
+ ImagePrivacyLevel["MASK_ALL"] = "MASK_ALL";
16
+ ImagePrivacyLevel["MASK_NONE"] = "MASK_NONE";
17
+ return ImagePrivacyLevel;
18
+ }({});
19
+ export let TouchPrivacyLevel = /*#__PURE__*/function (TouchPrivacyLevel) {
20
+ TouchPrivacyLevel["SHOW"] = "SHOW";
21
+ TouchPrivacyLevel["HIDE"] = "HIDE";
22
+ return TouchPrivacyLevel;
23
+ }({});
24
+ export let TextAndInputPrivacyLevel = /*#__PURE__*/function (TextAndInputPrivacyLevel) {
25
+ TextAndInputPrivacyLevel["MASK_SENSITIVE_INPUTS"] = "MASK_SENSITIVE_INPUTS";
26
+ TextAndInputPrivacyLevel["MASK_ALL_INPUTS"] = "MASK_ALL_INPUTS";
27
+ TextAndInputPrivacyLevel["MASK_ALL"] = "MASK_ALL";
28
+ return TextAndInputPrivacyLevel;
29
+ }({});
13
30
 
14
31
  /**
15
32
  * The Session Replay configuration object.
@@ -18,7 +35,11 @@ export let SessionReplayPrivacy = /*#__PURE__*/function (SessionReplayPrivacy) {
18
35
  const DEFAULTS = {
19
36
  replaySampleRate: 0,
20
37
  defaultPrivacyLevel: SessionReplayPrivacy.MASK,
21
- customEndpoint: ''
38
+ customEndpoint: '',
39
+ imagePrivacyLevel: ImagePrivacyLevel.MASK_ALL,
40
+ touchPrivacyLevel: TouchPrivacyLevel.HIDE,
41
+ textAndInputPrivacyLevel: TextAndInputPrivacyLevel.MASK_ALL,
42
+ startRecordingImmediately: true
22
43
  };
23
44
  export class SessionReplayWrapper {
24
45
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
@@ -29,13 +50,43 @@ export class SessionReplayWrapper {
29
50
  }
30
51
  const {
31
52
  replaySampleRate,
32
- defaultPrivacyLevel,
33
- customEndpoint
53
+ customEndpoint,
54
+ startRecordingImmediately
34
55
  } = configuration;
35
- return {
56
+ const baseConfig = {
36
57
  replaySampleRate: replaySampleRate !== undefined ? replaySampleRate : DEFAULTS.replaySampleRate,
37
- defaultPrivacyLevel: defaultPrivacyLevel !== undefined ? defaultPrivacyLevel : DEFAULTS.defaultPrivacyLevel,
38
- customEndpoint: customEndpoint !== undefined ? customEndpoint : DEFAULTS.customEndpoint
58
+ customEndpoint: customEndpoint !== undefined ? customEndpoint : DEFAULTS.customEndpoint,
59
+ startRecordingImmediately: startRecordingImmediately !== undefined ? startRecordingImmediately : DEFAULTS.startRecordingImmediately
60
+ };
61
+ const privacyConfig = {
62
+ imagePrivacyLevel: configuration.imagePrivacyLevel ?? DEFAULTS.imagePrivacyLevel,
63
+ touchPrivacyLevel: configuration.touchPrivacyLevel ?? DEFAULTS.touchPrivacyLevel,
64
+ textAndInputPrivacyLevel: configuration.textAndInputPrivacyLevel ?? DEFAULTS.textAndInputPrivacyLevel
65
+ };
66
+
67
+ // Legacy Default Privacy Level property handling
68
+ if (configuration.defaultPrivacyLevel) {
69
+ switch (configuration.defaultPrivacyLevel) {
70
+ case SessionReplayPrivacy.MASK:
71
+ privacyConfig.imagePrivacyLevel = ImagePrivacyLevel.MASK_ALL;
72
+ privacyConfig.touchPrivacyLevel = TouchPrivacyLevel.HIDE;
73
+ privacyConfig.textAndInputPrivacyLevel = TextAndInputPrivacyLevel.MASK_ALL;
74
+ break;
75
+ case SessionReplayPrivacy.MASK_USER_INPUT:
76
+ privacyConfig.imagePrivacyLevel = ImagePrivacyLevel.MASK_NONE;
77
+ privacyConfig.touchPrivacyLevel = TouchPrivacyLevel.HIDE;
78
+ privacyConfig.textAndInputPrivacyLevel = TextAndInputPrivacyLevel.MASK_ALL_INPUTS;
79
+ break;
80
+ case SessionReplayPrivacy.ALLOW:
81
+ privacyConfig.imagePrivacyLevel = ImagePrivacyLevel.MASK_NONE;
82
+ privacyConfig.touchPrivacyLevel = TouchPrivacyLevel.SHOW;
83
+ privacyConfig.textAndInputPrivacyLevel = TextAndInputPrivacyLevel.MASK_SENSITIVE_INPUTS;
84
+ break;
85
+ }
86
+ }
87
+ return {
88
+ ...baseConfig,
89
+ ...privacyConfig
39
90
  };
40
91
  };
41
92
 
@@ -46,10 +97,27 @@ export class SessionReplayWrapper {
46
97
  enable = configuration => {
47
98
  const {
48
99
  replaySampleRate,
49
- defaultPrivacyLevel,
50
- customEndpoint
100
+ customEndpoint,
101
+ imagePrivacyLevel,
102
+ touchPrivacyLevel,
103
+ textAndInputPrivacyLevel,
104
+ startRecordingImmediately
51
105
  } = this.buildConfiguration(configuration);
52
- return this.nativeSessionReplay.enable(replaySampleRate, defaultPrivacyLevel, customEndpoint);
106
+ return this.nativeSessionReplay.enable(replaySampleRate, customEndpoint, imagePrivacyLevel, touchPrivacyLevel, textAndInputPrivacyLevel, startRecordingImmediately);
107
+ };
108
+
109
+ /**
110
+ * Manually start the recording of the current session.
111
+ */
112
+ startRecording = () => {
113
+ return this.nativeSessionReplay.startRecording();
114
+ };
115
+
116
+ /**
117
+ * Manually stop the recording of the current session.
118
+ */
119
+ stopRecording = () => {
120
+ return this.nativeSessionReplay.stopRecording();
53
121
  };
54
122
  }
55
123
  export const SessionReplay = new SessionReplayWrapper();
@@ -1 +1 @@
1
- {"version":3,"names":["SessionReplayPrivacy","DEFAULTS","replaySampleRate","defaultPrivacyLevel","MASK","customEndpoint","SessionReplayWrapper","nativeSessionReplay","require","default","buildConfiguration","configuration","undefined","enable","SessionReplay"],"sourceRoot":"../../src","sources":["SessionReplay.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAIA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AAMhC;AACA;AACA;;AAsBA,MAAMC,QAAQ,GAAG;EACbC,gBAAgB,EAAE,CAAC;EACnBC,mBAAmB,EAAEH,oBAAoB,CAACI,IAAI;EAC9CC,cAAc,EAAE;AACpB,CAAC;AAED,OAAO,MAAMC,oBAAoB,CAAC;EAC9B;EACQC,mBAAmB,GAA4BC,OAAO,CAAC,+BAA+B,CAAC,CAC1FC,OAAO;EAEJC,kBAAkB,GACtBC,aAA0C,IAKzC;IACD,IAAI,CAACA,aAAa,EAAE;MAChB,OAAOV,QAAQ;IACnB;IACA,MAAM;MACFC,gBAAgB;MAChBC,mBAAmB;MACnBE;IACJ,CAAC,GAAGM,aAAa;IACjB,OAAO;MACHT,gBAAgB,EACZA,gBAAgB,KAAKU,SAAS,GACxBV,gBAAgB,GAChBD,QAAQ,CAACC,gBAAgB;MACnCC,mBAAmB,EACfA,mBAAmB,KAAKS,SAAS,GAC3BT,mBAAmB,GACnBF,QAAQ,CAACE,mBAAmB;MACtCE,cAAc,EACVA,cAAc,KAAKO,SAAS,GACtBP,cAAc,GACdJ,QAAQ,CAACI;IACvB,CAAC;EACL,CAAC;;EAED;AACJ;AACA;AACA;EACIQ,MAAM,GAAIF,aAA0C,IAAoB;IACpE,MAAM;MACFT,gBAAgB;MAChBC,mBAAmB;MACnBE;IACJ,CAAC,GAAG,IAAI,CAACK,kBAAkB,CAACC,aAAa,CAAC;IAE1C,OAAO,IAAI,CAACJ,mBAAmB,CAACM,MAAM,CAClCX,gBAAgB,EAChBC,mBAAmB,EACnBE,cACJ,CAAC;EACL,CAAC;AACL;AAEA,OAAO,MAAMS,aAAa,GAAG,IAAIR,oBAAoB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["SessionReplayPrivacy","ImagePrivacyLevel","TouchPrivacyLevel","TextAndInputPrivacyLevel","DEFAULTS","replaySampleRate","defaultPrivacyLevel","MASK","customEndpoint","imagePrivacyLevel","MASK_ALL","touchPrivacyLevel","HIDE","textAndInputPrivacyLevel","startRecordingImmediately","SessionReplayWrapper","nativeSessionReplay","require","default","buildConfiguration","configuration","baseConfig","undefined","privacyConfig","MASK_USER_INPUT","MASK_NONE","MASK_ALL_INPUTS","ALLOW","SHOW","MASK_SENSITIVE_INPUTS","enable","startRecording","stopRecording","SessionReplay"],"sourceRoot":"../../src","sources":["SessionReplay.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAIA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAiB7B,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAW7B,WAAYC,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;;AAepC;AACA;AACA;;AAgEA,MAAMC,QAEL,GAAG;EACAC,gBAAgB,EAAE,CAAC;EACnBC,mBAAmB,EAAEN,oBAAoB,CAACO,IAAI;EAC9CC,cAAc,EAAE,EAAE;EAClBC,iBAAiB,EAAER,iBAAiB,CAACS,QAAQ;EAC7CC,iBAAiB,EAAET,iBAAiB,CAACU,IAAI;EACzCC,wBAAwB,EAAEV,wBAAwB,CAACO,QAAQ;EAC3DI,yBAAyB,EAAE;AAC/B,CAAC;AAED,OAAO,MAAMC,oBAAoB,CAAC;EAC9B;EACQC,mBAAmB,GAA4BC,OAAO,CAAC,+BAA+B,CAAC,CAC1FC,OAAO;EAEJC,kBAAkB,GACtBC,aAA0C,IACL;IACrC,IAAI,CAACA,aAAa,EAAE;MAChB,OAAOhB,QAAQ;IACnB;IACA,MAAM;MACFC,gBAAgB;MAChBG,cAAc;MACdM;IACJ,CAAC,GAAGM,aAAa;IAEjB,MAAMC,UAAkD,GAAG;MACvDhB,gBAAgB,EACZA,gBAAgB,KAAKiB,SAAS,GACxBjB,gBAAgB,GAChBD,QAAQ,C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C9C,CAAC;;EAED;AACJ;AACA;AACA;EACIO,MAAM,GAAIV,aAA0C,IAAoB;IACpE,MAAM;MACFf,gBAAgB;MAChBG,cAAc;MACdC,iBAAiB;MACjBE,iBAAiB;MACjBE,wBAAwB;MACxBC;IACJ,CAAC,GAAG,IAAI,CAACK,kBAAkB,CAACC,aAAa,CAAC;IAE1C,OAAO,IAAI,CAACJ,mBAAmB,CAACc,MAAM,CAClCzB,gBAAgB,EAChBG,cAAc,EACdC,iBAAiB,EACjBE,iBAAiB,EACjBE,wBAAwB,EACxBC,yBACJ,CAAC;EACL,CAAC;;EAED;AACJ;AACA;EACIiB,cAAc,GAAGA,CAAA,KAAqB;IAClC,OAAO,IAAI,CAACf,mBAAmB,CAACe,cAAc,CAAC,CAAC;EACpD,CAAC;;EAED;AACJ;AACA;EACIC,aAAa,GAAGA,CAAA,KAAqB;IACjC,OAAO,IAAI,CAAChB,mBAAmB,CAACgB,aAAa,CAAC,CAAC;EACnD,CAAC;AACL;AAEA,OAAO,MAAMC,aAAa,GAAG,IAAIlB,oBAAoB,CAAC,CAAC","ignoreList":[]}
@@ -4,6 +4,6 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import { SessionReplay, SessionReplayPrivacy } from './SessionReplay';
8
- export { SessionReplay, SessionReplayPrivacy };
7
+ import { SessionReplay, SessionReplayPrivacy, ImagePrivacyLevel, TouchPrivacyLevel, TextAndInputPrivacyLevel } from './SessionReplay';
8
+ export { SessionReplay, SessionReplayPrivacy, ImagePrivacyLevel, TouchPrivacyLevel, TextAndInputPrivacyLevel };
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SessionReplay","SessionReplayPrivacy"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAGA,SAASA,aAAa,EAAEC,oBAAoB,QAAQ,iBAAiB;AAErE,SAASD,aAAa,EAAEC,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["SessionReplay","SessionReplayPrivacy","ImagePrivacyLevel","TouchPrivacyLevel","TextAndInputPrivacyLevel"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAGA,SACIA,aAAa,EACbC,oBAAoB,EACpBC,iBAAiB,EACjBC,iBAAiB,EACjBC,wBAAwB,QACrB,iBAAiB;AAExB,SACIJ,aAAa,EACbC,oBAAoB,EACpBC,iBAAiB,EACjBC,iBAAiB,EACjBC,wBAAwB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdSessionReplay.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAiBA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdSessionReplay.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAmCA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,iBAAiB,CAAC","ignoreList":[]}
@@ -3,6 +3,46 @@ export declare enum SessionReplayPrivacy {
3
3
  ALLOW = "ALLOW",
4
4
  MASK_USER_INPUT = "MASK_USER_INPUT"
5
5
  }
6
+ export declare enum ImagePrivacyLevel {
7
+ /**
8
+ * Only images that are bundled within the application will be recorded.
9
+ *
10
+ * On Android, all images larger than 100x100 dp will be masked, as we consider them non-bundled images.
11
+ */
12
+ MASK_NON_BUNDLED_ONLY = "MASK_NON_BUNDLED_ONLY",
13
+ /**
14
+ * No images will be recorded.
15
+ */
16
+ MASK_ALL = "MASK_ALL",
17
+ /**
18
+ * All images will be recorded, including the ones downloaded from the Internet or generated during the app runtime.
19
+ */
20
+ MASK_NONE = "MASK_NONE"
21
+ }
22
+ export declare enum TouchPrivacyLevel {
23
+ /**
24
+ * Show all user touches.
25
+ */
26
+ SHOW = "SHOW",
27
+ /**
28
+ * Hide all user touches.
29
+ */
30
+ HIDE = "HIDE"
31
+ }
32
+ export declare enum TextAndInputPrivacyLevel {
33
+ /**
34
+ * Show all texts except sensitive inputs (e.g password fields).
35
+ */
36
+ MASK_SENSITIVE_INPUTS = "MASK_SENSITIVE_INPUTS",
37
+ /**
38
+ * Mask all input fields (e.g text fields, switches, checkboxes).
39
+ */
40
+ MASK_ALL_INPUTS = "MASK_ALL_INPUTS",
41
+ /**
42
+ * Mask all texts and inputs (e.g labels).
43
+ */
44
+ MASK_ALL = "MASK_ALL"
45
+ }
6
46
  /**
7
47
  * The Session Replay configuration object.
8
48
  */
@@ -16,15 +56,36 @@ export interface SessionReplayConfiguration {
16
56
  */
17
57
  replaySampleRate?: number;
18
58
  /**
19
- * Defines the way sensitive content (e.g. text) should be masked.
20
- *
21
- * Default `SessionReplayPrivacy.MASK`.
59
+ * Defines the way images should be masked (Default: `MASK_ALL`)
22
60
  */
23
- defaultPrivacyLevel?: SessionReplayPrivacy;
61
+ imagePrivacyLevel?: ImagePrivacyLevel;
62
+ /**
63
+ * Defines the way user touches (e.g tap) should be masked (Default: `HIDE`)
64
+ */
65
+ touchPrivacyLevel?: TouchPrivacyLevel;
66
+ /**
67
+ * Defines the way text and input (e.g text fields, checkboxes) should be masked (Default: `MASK_ALL`)
68
+ */
69
+ textAndInputPrivacyLevel?: TextAndInputPrivacyLevel;
24
70
  /**
25
71
  * Custom server url for sending replay data.
26
72
  */
27
73
  customEndpoint?: string;
74
+ /**
75
+ * Whether the recording should start automatically when the feature is enabled.
76
+ * When `true`, the recording starts automatically.
77
+ * when `false` it doesn't, and the recording will need to be started manually.
78
+ * Default: `true`.
79
+ */
80
+ startRecordingImmediately?: boolean;
81
+ /**
82
+ * Defines the way sensitive content (e.g. text) should be masked.
83
+ *
84
+ * Default `SessionReplayPrivacy.MASK`.
85
+ * @deprecated Use {@link imagePrivacyLevel}, {@link touchPrivacyLevel} and {@link textAndInputPrivacyLevel} instead.
86
+ * Note: setting this property (`defaultPrivacyLevel`) will override the individual privacy levels.
87
+ */
88
+ defaultPrivacyLevel?: SessionReplayPrivacy;
28
89
  }
29
90
  export declare class SessionReplayWrapper {
30
91
  private nativeSessionReplay;
@@ -34,6 +95,14 @@ export declare class SessionReplayWrapper {
34
95
  * @param configuration: The session replay configuration.
35
96
  */
36
97
  enable: (configuration?: SessionReplayConfiguration) => Promise<void>;
98
+ /**
99
+ * Manually start the recording of the current session.
100
+ */
101
+ startRecording: () => Promise<void>;
102
+ /**
103
+ * Manually stop the recording of the current session.
104
+ */
105
+ stopRecording: () => Promise<void>;
37
106
  }
38
107
  export declare const SessionReplay: SessionReplayWrapper;
39
108
  //# sourceMappingURL=SessionReplay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionReplay.d.ts","sourceRoot":"","sources":["../../src/SessionReplay.ts"],"names":[],"mappings":"AAQA,oBAAY,oBAAoB;IAC5B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,eAAe,oBAAoB;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAC3C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAQD,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,mBAAmB,CACd;IAEb,OAAO,CAAC,kBAAkB,CA6BxB;IAEF;;;OAGG;IACH,MAAM,mBAAoB,0BAA0B,KAAG,QAAQ,IAAI,CAAC,CAYlE;CACL;AAED,eAAO,MAAM,aAAa,sBAA6B,CAAC"}
1
+ {"version":3,"file":"SessionReplay.d.ts","sourceRoot":"","sources":["../../src/SessionReplay.ts"],"names":[],"mappings":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SessionReplay, SessionReplayPrivacy } from './SessionReplay';
3
- export { SessionReplay, SessionReplayPrivacy };
2
+ import { SessionReplay, SessionReplayPrivacy, ImagePrivacyLevel, TouchPrivacyLevel, TextAndInputPrivacyLevel } from './SessionReplay';
3
+ export { SessionReplay, SessionReplayPrivacy, ImagePrivacyLevel, TouchPrivacyLevel, TextAndInputPrivacyLevel };
4
4
  export type { SessionReplayConfiguration };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC;AAE/C,YAAY,EAAE,0BAA0B,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACH,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EAC3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EAC3B,CAAC;AAEF,YAAY,EAAE,0BAA0B,EAAE,CAAC"}
@@ -3,7 +3,9 @@ import type { Spec as NativeDdSessionReplay } from './specs/NativeDdSessionRepla
3
3
  * In this file, native modules types extend the specs for TurboModules.
4
4
  * As we cannot use enums or classes in the specs, we override methods using them here.
5
5
  */
6
- type PrivacyLevel = 'MASK' | 'MASK_USER_INPUT' | 'ALLOW';
6
+ type ImagePrivacyLevel = 'MASK_NON_BUNDLED_ONLY' | 'MASK_ALL' | 'MASK_NONE';
7
+ type TouchPrivacyLevel = 'SHOW' | 'HIDE';
8
+ type TextAndInputPrivacyLevel = 'MASK_SENSITIVE_INPUTS' | 'MASK_ALL_INPUTS' | 'MASK_ALL';
7
9
  /**
8
10
  * The entry point to use Datadog's Session Replay feature.
9
11
  */
@@ -11,10 +13,23 @@ export interface NativeSessionReplayType extends NativeDdSessionReplay {
11
13
  /**
12
14
  * Enable session replay and start recording session.
13
15
  * @param replaySampleRate: The sample rate applied for session replay.
14
- * @param defaultPrivacyLevel: The privacy level used for replay.
15
16
  * @param customEndpoint: Custom server url for sending replay data.
17
+ * @param imagePrivacyLevel: Defines the way images should be masked.
18
+ * @param touchPrivacyLevel: Defines the way user touches should be masked.
19
+ * @param textAndInputPrivacyLevel: Defines the way text and input should be masked.
20
+ * @param startRecordingImmediately: Whether the recording should start automatically when the feature is enabled.
21
+ * When `true`, the recording starts automatically; when `false` it doesn't, and the recording will need
22
+ * to be started manually. Default: `true`.
16
23
  */
17
- enable(replaySampleRate: number, defaultPrivacyLevel: PrivacyLevel, customEndpoint: string): Promise<void>;
24
+ enable(replaySampleRate: number, customEndpoint: string, imagePrivacyLevel: ImagePrivacyLevel, touchPrivacyLevel: TouchPrivacyLevel, textAndInputPrivacyLevel: TextAndInputPrivacyLevel, startRecordingImmediately: boolean): Promise<void>;
25
+ /**
26
+ * Manually start the recording of the current session.
27
+ */
28
+ startRecording(): Promise<void>;
29
+ /**
30
+ * Manually stop the recording of the current session.
31
+ */
32
+ stopRecording(): Promise<void>;
18
33
  }
19
34
  export {};
20
35
  //# sourceMappingURL=nativeModulesTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeModulesTypes.d.ts","sourceRoot":"","sources":["../../src/nativeModulesTypes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEnF;;;GAGG;AAEH,KAAK,YAAY,GAAG,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IAClE;;;;;OAKG;IACH,MAAM,CACF,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,YAAY,EACjC,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
1
+ {"version":3,"file":"nativeModulesTypes.d.ts","sourceRoot":"","sources":["../../src/nativeModulesTypes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEnF;;;GAGG;AAEH,KAAK,iBAAiB,GAAG,uBAAuB,GAAG,UAAU,GAAG,WAAW,CAAC;AAC5E,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AACzC,KAAK,wBAAwB,GACvB,uBAAuB,GACvB,iBAAiB,GACjB,UAAU,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IAClE;;;;;;;;;;OAUG;IACH,MAAM,CACF,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,wBAAwB,EAAE,wBAAwB,EAClD,yBAAyB,EAAE,OAAO,GACnC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC"}
@@ -7,10 +7,23 @@ export interface Spec extends TurboModule {
7
7
  /**
8
8
  * Enable session replay and start recording session.
9
9
  * @param replaySampleRate: The sample rate applied for session replay.
10
- * @param defaultPrivacyLevel: The privacy level used for replay.
11
10
  * @param customEndpoint: Custom server url for sending replay data.
11
+ * @param imagePrivacyLevel: Defines the way images should be masked.
12
+ * @param touchPrivacyLevel: Defines the way user touches should be masked.
13
+ * @param textAndInputPrivacyLevel: Defines the way text and input should be masked.
14
+ * @param startRecordingImmediately: Whether the recording should start automatically when the feature is enabled.
15
+ * When `true`, the recording starts automatically; when `false` it doesn't,
16
+ * and the recording will need to be started manually. Default: `true`.
12
17
  */
13
- enable(replaySampleRate: number, defaultPrivacyLevel: string, customEndpoint: string): Promise<void>;
18
+ enable(replaySampleRate: number, customEndpoint: string, imagePrivacyLevel: string, touchPrivacyLevel: string, textAndInputPrivacyLevel: string, startRecordingImmediately: boolean): Promise<void>;
19
+ /**
20
+ * Manually start the recording of the current session.
21
+ */
22
+ startRecording(): Promise<void>;
23
+ /**
24
+ * Manually stop the recording of the current session.
25
+ */
26
+ stopRecording(): Promise<void>;
14
27
  }
15
28
  declare const _default: Spec | null;
16
29
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeDdSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeDdSessionReplay.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;GAEG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAEhC;;;;;OAKG;IACH,MAAM,CACF,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;;AAGD,wBAAgE"}
1
+ {"version":3,"file":"NativeDdSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeDdSessionReplay.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;GAEG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,MAAM,CACF,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,EACzB,iBAAiB,EAAE,MAAM,EACzB,wBAAwB,EAAE,MAAM,EAChC,yBAAyB,EAAE,OAAO,GACnC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;;AAGD,wBAAgE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native-session-replay",
3
- "version": "2.4.3-alpha.0",
3
+ "version": "2.5.0-alpha.0",
4
4
  "description": "A client-side React Native module to enable session replay with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -22,6 +22,7 @@
22
22
  "android/build.gradle",
23
23
  "android/detekt.yml",
24
24
  "android/gradle.properties",
25
+ "android/consumer-proguard-rules.pro",
25
26
  "android/src/**",
26
27
  "ios/Sources/**",
27
28
  "ios/DatadogSDKReactNativeSessionReplay.xcodeproj/project.xcworkspace/xcsharedata",