@amplitude/session-replay-react-native 0.0.1-beta.3 → 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AmplitudeSessionReplayReactNative.podspec +3 -3
- package/README.md +13 -0
- package/android/build.gradle +24 -18
- package/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +16 -11
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativePackage.kt +40 -0
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +7 -0
- package/android/src/{main → oldarch}/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativePackage.kt +2 -1
- package/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +20 -0
- package/ios/AMPNativeSessionReplay.mm +20 -0
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-module.js +10 -1
- package/lib/commonjs/native-module.js.map +1 -1
- package/lib/commonjs/session-replay-config.js +27 -18
- package/lib/commonjs/session-replay-config.js.map +1 -1
- package/lib/commonjs/session-replay.js +52 -4
- package/lib/commonjs/session-replay.js.map +1 -1
- package/lib/commonjs/specs/NativeAmpSessionReplay.js +22 -0
- package/lib/commonjs/specs/NativeAmpSessionReplay.js.map +1 -0
- package/lib/commonjs/version.js +1 -2
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-module.js +10 -2
- package/lib/module/native-module.js.map +1 -1
- package/lib/module/session-replay-config.js +24 -17
- package/lib/module/session-replay-config.js.map +1 -1
- package/lib/module/session-replay.js +52 -4
- package/lib/module/session-replay.js.map +1 -1
- package/lib/module/specs/NativeAmpSessionReplay.js +18 -0
- package/lib/module/specs/NativeAmpSessionReplay.js.map +1 -0
- package/lib/module/version.js +1 -2
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/amp-mask-view.d.ts +1 -1
- package/lib/typescript/amp-mask-view.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-module.d.ts.map +1 -1
- package/lib/typescript/session-replay-config.d.ts +31 -16
- package/lib/typescript/session-replay-config.d.ts.map +1 -1
- package/lib/typescript/session-replay.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts +15 -0
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +27 -20
- package/src/index.tsx +1 -1
- package/src/native-module.ts +16 -10
- package/src/session-replay-config.ts +39 -17
- package/src/session-replay.ts +42 -7
- package/src/specs/NativeAmpSessionReplay.ts +29 -0
- package/src/version.ts +1 -2
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { LogLevel } from '@amplitude/analytics-types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Masking levels for sensitive content in session replay
|
|
4
|
+
* Masking levels for sensitive content in session replay.
|
|
5
|
+
*
|
|
6
|
+
* Declared as a string-literal union (rather than an `enum`) to match the
|
|
7
|
+
* Session Replay browser SDK and avoid the const-enum inlining pitfalls of
|
|
8
|
+
* string enums under aggressive compilers.
|
|
9
|
+
*
|
|
10
|
+
* - `light`: mask only inputs that are always sensitive (password, etc.).
|
|
11
|
+
* - `medium`: mask all `<TextInput>` fields.
|
|
12
|
+
* - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
|
|
5
13
|
*/
|
|
6
|
-
export let MaskLevel = /*#__PURE__*/function (MaskLevel) {
|
|
7
|
-
/**
|
|
8
|
-
* Light masking - minimal content is masked
|
|
9
|
-
*/
|
|
10
|
-
MaskLevel["Light"] = "light";
|
|
11
|
-
/**
|
|
12
|
-
* Medium masking - balanced approach to content masking
|
|
13
|
-
*/
|
|
14
|
-
MaskLevel["Medium"] = "medium";
|
|
15
|
-
/**
|
|
16
|
-
* Conservative masking - maximum content masking for privacy
|
|
17
|
-
*/
|
|
18
|
-
MaskLevel["Conservative"] = "conservative";
|
|
19
|
-
return MaskLevel;
|
|
20
|
-
}({});
|
|
21
14
|
|
|
22
15
|
/**
|
|
23
16
|
* Configuration for Session Replay React Native SDK
|
|
24
17
|
*/
|
|
25
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Internal config shape used by the SDK after the public `SessionReplayConfig`
|
|
21
|
+
* is normalized at the input boundary. The deprecated top-level `maskLevel` is
|
|
22
|
+
* folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
|
|
23
|
+
* needs to know the deprecated field ever existed.
|
|
24
|
+
*
|
|
25
|
+
* Not exported from `index.tsx` on purpose — this is an implementation detail
|
|
26
|
+
* of the session replay module.
|
|
27
|
+
*/
|
|
28
|
+
|
|
26
29
|
export const getDefaultConfig = () => {
|
|
27
30
|
return {
|
|
28
31
|
autoStart: true,
|
|
29
32
|
deviceId: null,
|
|
30
33
|
enableRemoteConfig: true,
|
|
31
34
|
logLevel: LogLevel.Warn,
|
|
32
|
-
maskLevel: MaskLevel.Medium,
|
|
33
35
|
optOut: false,
|
|
36
|
+
// Intentionally left without a `maskLevel`: the effective default
|
|
37
|
+
// (`'medium'`) is resolved once at the native boundary in `nativeConfig()`.
|
|
38
|
+
// Baking it in here would make the deprecated top-level `maskLevel`
|
|
39
|
+
// unreachable through the `?? 'medium'` fallback (silent privacy downgrade).
|
|
40
|
+
privacyConfig: {},
|
|
34
41
|
sampleRate: 0,
|
|
35
42
|
serverZone: 'US',
|
|
36
43
|
sessionId: -1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LogLevel","
|
|
1
|
+
{"version":3,"names":["LogLevel","getDefaultConfig","autoStart","deviceId","enableRemoteConfig","logLevel","Warn","optOut","privacyConfig","sampleRate","serverZone","sessionId"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,4BAA4B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AA2EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,MAAMC,gBAA6E,GAAGA,CAAA,KAAM;EACjG,OAAO;IACLC,SAAS,EAAE,IAAI;IACfC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEL,QAAQ,CAACM,IAAI;IACvBC,MAAM,EAAE,KAAK;IACb;IACA;IACA;IACA;IACAC,aAAa,EAAE,CAAC,CAAC;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE,CAAC;EACd,CAAC;AACH,CAAC;AACD,SAASX,QAAQ","ignoreList":[]}
|
|
@@ -4,6 +4,37 @@ import { NativeSessionReplay } from './native-module';
|
|
|
4
4
|
import { getDefaultConfig } from './session-replay-config';
|
|
5
5
|
import { createSessionReplayLogger } from './logger';
|
|
6
6
|
import { VERSION } from './version';
|
|
7
|
+
/**
|
|
8
|
+
* Translates the public `SessionReplayConfig` into the internal shape by
|
|
9
|
+
* folding the deprecated top-level `maskLevel` into `privacyConfig`. After
|
|
10
|
+
* this step, the rest of the SDK only ever sees `privacyConfig`.
|
|
11
|
+
*
|
|
12
|
+
* `privacyConfig` wins when explicitly set; otherwise translate the
|
|
13
|
+
* deprecated `maskLevel`; otherwise leave the field out so the default
|
|
14
|
+
* supplied by `getDefaultConfig()` survives the shallow merge in `init()`.
|
|
15
|
+
*/
|
|
16
|
+
function normalizeConfig(config) {
|
|
17
|
+
const {
|
|
18
|
+
maskLevel,
|
|
19
|
+
privacyConfig,
|
|
20
|
+
...rest
|
|
21
|
+
} = config;
|
|
22
|
+
if (privacyConfig !== undefined) {
|
|
23
|
+
return {
|
|
24
|
+
...rest,
|
|
25
|
+
privacyConfig
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (maskLevel !== undefined) {
|
|
29
|
+
return {
|
|
30
|
+
...rest,
|
|
31
|
+
privacyConfig: {
|
|
32
|
+
maskLevel
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return rest;
|
|
37
|
+
}
|
|
7
38
|
let fullConfig = null;
|
|
8
39
|
let isInitialized = false;
|
|
9
40
|
let logger = createSessionReplayLogger();
|
|
@@ -31,9 +62,14 @@ export async function init(config) {
|
|
|
31
62
|
logger.warn('SessionReplay is already initialized');
|
|
32
63
|
return;
|
|
33
64
|
}
|
|
65
|
+
|
|
66
|
+
// TODO: this is a shallow merge — a user-supplied `privacyConfig` replaces
|
|
67
|
+
// the default object wholesale. That's fine while `PrivacyConfig` only
|
|
68
|
+
// carries `maskLevel`, but if it ever grows more fields a deeper merge will
|
|
69
|
+
// be needed so partial user configs don't drop defaults.
|
|
34
70
|
fullConfig = {
|
|
35
71
|
...getDefaultConfig(),
|
|
36
|
-
...config
|
|
72
|
+
...normalizeConfig(config)
|
|
37
73
|
};
|
|
38
74
|
logger.setLogLevel(fullConfig.logLevel);
|
|
39
75
|
logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `, fullConfig);
|
|
@@ -199,10 +235,22 @@ export async function stop() {
|
|
|
199
235
|
await NativeSessionReplay.stop();
|
|
200
236
|
}
|
|
201
237
|
function nativeConfig(config) {
|
|
238
|
+
// Resolve the effective mask level here — the single source of truth for the
|
|
239
|
+
// default. `normalizeConfig()` already folded the deprecated top-level
|
|
240
|
+
// `maskLevel` into `privacyConfig`, but `privacyConfig.maskLevel` can still be
|
|
241
|
+
// `undefined` (no user value and no baked-in default), so fall back to
|
|
242
|
+
// `'medium'`. Strip `privacyConfig` from the spread because the native bridge
|
|
243
|
+
// only takes a flat `maskLevel` string.
|
|
244
|
+
const {
|
|
245
|
+
privacyConfig,
|
|
246
|
+
...rest
|
|
247
|
+
} = config;
|
|
248
|
+
const resolvedMaskLevel = privacyConfig.maskLevel ?? 'medium';
|
|
202
249
|
return {
|
|
203
|
-
...
|
|
204
|
-
logLevel:
|
|
205
|
-
|
|
250
|
+
...rest,
|
|
251
|
+
logLevel: rest.logLevel,
|
|
252
|
+
// TODO(SDKRN-15): Migrate native bridge to accept the full privacyConfig object instead of a flat maskLevel string.
|
|
253
|
+
maskLevel: resolvedMaskLevel
|
|
206
254
|
};
|
|
207
255
|
}
|
|
208
256
|
export async function privateInit(config, newLogger) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","fullConfig","isInitialized","logger","init","
|
|
1
|
+
{"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","init","warn","setLogLevel","logLevel","log","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","getSessionReplayProperties","properties","flush","start","stop","resolvedMaskLevel","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
2
|
+
// The codegen types live in a Flow-typed file that eslint-plugin-import cannot parse.
|
|
3
|
+
// eslint-disable-next-line import/namespace
|
|
4
|
+
|
|
5
|
+
// Codegen TurboModule spec for the imperative Session Replay module.
|
|
6
|
+
//
|
|
7
|
+
// The config crosses the bridge as an untyped object: the native side already
|
|
8
|
+
// reads a ReadableMap / NSDictionary, and app-boundary type safety lives in the
|
|
9
|
+
// public `SessionReplayConfig`. See native-module.ts for the typed facade that
|
|
10
|
+
// JS callers actually use.
|
|
11
|
+
|
|
12
|
+
// Use non-enforcing `get` (returns null when the native module isn't linked)
|
|
13
|
+
// so importing the package never crashes app startup. The typed facade in
|
|
14
|
+
// native-module.ts throws a friendly linking error lazily on first use instead.
|
|
15
|
+
// Works on both architectures: JSI on the New Architecture, legacy NativeModules
|
|
16
|
+
// fallback on the old one.
|
|
17
|
+
export default TurboModuleRegistry.get('AMPNativeSessionReplay');
|
|
18
|
+
//# sourceMappingURL=NativeAmpSessionReplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAClD;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,cAAc","ignoreList":[]}
|
|
@@ -2,6 +2,6 @@ import { type ViewProps } from 'react-native';
|
|
|
2
2
|
interface AmpMaskViewProps extends ViewProps {
|
|
3
3
|
mask: 'amp-mask' | 'amp-unmask' | 'amp-block';
|
|
4
4
|
}
|
|
5
|
-
export declare const AmpMaskView: import("react-native").HostComponent<AmpMaskViewProps>;
|
|
5
|
+
export declare const AmpMaskView: import("react-native/types").HostComponent<AmpMaskViewProps>;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=amp-mask-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amp-mask-view.d.ts","sourceRoot":"","sources":["../../src/amp-mask-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,gBAAiB,SAAQ,SAAS;IAC1C,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;CAC/C;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"amp-mask-view.d.ts","sourceRoot":"","sources":["../../src/amp-mask-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,gBAAiB,SAAQ,SAAS;IAC1C,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;CAC/C;AAED,eAAO,MAAM,WAAW,8DAAmE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { init, setSessionId, getSessionId, getSessionReplayProperties, flush, start, stop, setDeviceId, } from './session-replay';
|
|
2
|
-
export { type SessionReplayConfig, MaskLevel } from './session-replay-config';
|
|
2
|
+
export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
|
|
3
3
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
|
4
4
|
export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
5
5
|
export { AmpMaskView } from './amp-mask-view';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.d.ts","sourceRoot":"","sources":["../../src/native-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-module.d.ts","sourceRoot":"","sources":["../../src/native-module.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,mBAAmB,yBAQU,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,SAAS,EAAE,OAAO,CAAC;IACnB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,0EAA0E;IAC1E,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oFAAoF;IACpF,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,kEAAkE;IAClE,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC;IAC/C,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAC5C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC1C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhC;;;;;OAKG;IACH,0BAA0B,IAAI,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAErE;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/C;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { LogLevel } from '@amplitude/analytics-types';
|
|
2
2
|
/**
|
|
3
|
-
* Masking levels for sensitive content in session replay
|
|
3
|
+
* Masking levels for sensitive content in session replay.
|
|
4
|
+
*
|
|
5
|
+
* Declared as a string-literal union (rather than an `enum`) to match the
|
|
6
|
+
* Session Replay browser SDK and avoid the const-enum inlining pitfalls of
|
|
7
|
+
* string enums under aggressive compilers.
|
|
8
|
+
*
|
|
9
|
+
* - `light`: mask only inputs that are always sensitive (password, etc.).
|
|
10
|
+
* - `medium`: mask all `<TextInput>` fields.
|
|
11
|
+
* - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
|
|
4
12
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
Light = "light",
|
|
10
|
-
/**
|
|
11
|
-
* Medium masking - balanced approach to content masking
|
|
12
|
-
*/
|
|
13
|
-
Medium = "medium",
|
|
14
|
-
/**
|
|
15
|
-
* Conservative masking - maximum content masking for privacy
|
|
16
|
-
*/
|
|
17
|
-
Conservative = "conservative"
|
|
13
|
+
export type MaskLevel = 'light' | 'medium' | 'conservative';
|
|
14
|
+
export interface PrivacyConfig {
|
|
15
|
+
maskLevel?: MaskLevel;
|
|
18
16
|
}
|
|
19
17
|
/**
|
|
20
18
|
* Configuration for Session Replay React Native SDK
|
|
@@ -48,9 +46,16 @@ export interface SessionReplayConfig {
|
|
|
48
46
|
logLevel?: LogLevel;
|
|
49
47
|
/**
|
|
50
48
|
* Level of masking applied to sensitive content
|
|
51
|
-
* @default
|
|
49
|
+
* @default 'medium'
|
|
50
|
+
* @deprecated Use `privacyConfig.maskLevel` instead.
|
|
52
51
|
*/
|
|
53
52
|
maskLevel?: MaskLevel;
|
|
53
|
+
/**
|
|
54
|
+
* Privacy configuration for session replay.
|
|
55
|
+
* When `maskLevel` is omitted it resolves to `'medium'` at the native boundary.
|
|
56
|
+
* @default {}
|
|
57
|
+
*/
|
|
58
|
+
privacyConfig?: PrivacyConfig;
|
|
54
59
|
/**
|
|
55
60
|
* Whether to opt out of session replay collection
|
|
56
61
|
* @default false
|
|
@@ -75,6 +80,16 @@ export interface SessionReplayConfig {
|
|
|
75
80
|
*/
|
|
76
81
|
sessionId?: number;
|
|
77
82
|
}
|
|
78
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Internal config shape used by the SDK after the public `SessionReplayConfig`
|
|
85
|
+
* is normalized at the input boundary. The deprecated top-level `maskLevel` is
|
|
86
|
+
* folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
|
|
87
|
+
* needs to know the deprecated field ever existed.
|
|
88
|
+
*
|
|
89
|
+
* Not exported from `index.tsx` on purpose — this is an implementation detail
|
|
90
|
+
* of the session replay module.
|
|
91
|
+
*/
|
|
92
|
+
export type SessionReplayConfigInternal = Omit<SessionReplayConfig, 'maskLevel'>;
|
|
93
|
+
export declare const getDefaultConfig: () => Required<Omit<SessionReplayConfigInternal, 'apiKey'>>;
|
|
79
94
|
export { LogLevel };
|
|
80
95
|
//# sourceMappingURL=session-replay-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAEjF,eAAO,MAAM,gBAAgB,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAgBxF,CAAC;AACF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,mBAAmB,EAA+B,MAAM,yBAAyB,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA6BrD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM3D;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAOnF;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAM3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAM3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAM1C;AAmBD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface Spec extends TurboModule {
|
|
4
|
+
setup(config: UnsafeObject): Promise<void>;
|
|
5
|
+
setSessionId(sessionId: number): Promise<void>;
|
|
6
|
+
setDeviceId(deviceId: string | null): Promise<void>;
|
|
7
|
+
getSessionId(): Promise<number>;
|
|
8
|
+
getSessionReplayProperties(): Promise<UnsafeObject>;
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
stop(): Promise<void>;
|
|
11
|
+
flush(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: Spec | null;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=NativeAmpSessionReplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeAmpSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeAmpSessionReplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAQ9E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,0BAA0B,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;;AAOD,wBAAuE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.0
|
|
1
|
+
export declare const VERSION = "0.1.0-beta.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/session-replay-react-native",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
4
|
"description": "Amplitude Session Replay for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics",
|
|
@@ -25,23 +25,6 @@
|
|
|
25
25
|
"type": "git",
|
|
26
26
|
"url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
|
|
27
27
|
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "bob build",
|
|
30
|
-
"clean": "rimraf node_modules lib coverage",
|
|
31
|
-
"fix": "yarn fix:eslint & yarn fix:prettier",
|
|
32
|
-
"fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
|
|
33
|
-
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
|
|
34
|
-
"lint": "yarn lint:prettier && yarn lint:eslint",
|
|
35
|
-
"lint:eslint": "eslint '{src,test}/**/*.ts'",
|
|
36
|
-
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
|
|
37
|
-
"test": "jest",
|
|
38
|
-
"typecheck": "tsc -p ./tsconfig.json",
|
|
39
|
-
"version": "yarn version-file && yarn build",
|
|
40
|
-
"version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts",
|
|
41
|
-
"typescript": "tsc --noEmit",
|
|
42
|
-
"example": "yarn workspace @amplitude/plugin-session-replay-react-native-example",
|
|
43
|
-
"pods": "cd example && pod-install --quiet"
|
|
44
|
-
},
|
|
45
28
|
"source": "src/index",
|
|
46
29
|
"files": [
|
|
47
30
|
"src",
|
|
@@ -78,6 +61,14 @@
|
|
|
78
61
|
"react": "*",
|
|
79
62
|
"react-native": "*"
|
|
80
63
|
},
|
|
64
|
+
"codegenConfig": {
|
|
65
|
+
"name": "AmpSessionReplaySpec",
|
|
66
|
+
"type": "modules",
|
|
67
|
+
"jsSrcsDir": "src/specs",
|
|
68
|
+
"android": {
|
|
69
|
+
"javaPackageName": "com.amplitude.sessionreplayreactnative"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
81
72
|
"react-native-builder-bob": {
|
|
82
73
|
"source": "src",
|
|
83
74
|
"output": "lib",
|
|
@@ -92,5 +83,21 @@
|
|
|
92
83
|
]
|
|
93
84
|
]
|
|
94
85
|
},
|
|
95
|
-
"
|
|
96
|
-
|
|
86
|
+
"scripts": {
|
|
87
|
+
"build": "bob build",
|
|
88
|
+
"clean": "rimraf node_modules lib coverage",
|
|
89
|
+
"fix": "pnpm fix:eslint & pnpm fix:prettier",
|
|
90
|
+
"fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
|
|
91
|
+
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
|
|
92
|
+
"lint": "pnpm lint:prettier && pnpm lint:eslint",
|
|
93
|
+
"lint:eslint": "eslint '{src,test}/**/*.ts'",
|
|
94
|
+
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
|
|
95
|
+
"test": "jest",
|
|
96
|
+
"typecheck": "tsc -p ./tsconfig.json --noEmit",
|
|
97
|
+
"version": "pnpm version-file && pnpm build",
|
|
98
|
+
"version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts",
|
|
99
|
+
"typescript": "tsc --noEmit",
|
|
100
|
+
"example": "yarn workspace @amplitude/plugin-session-replay-react-native-example",
|
|
101
|
+
"pods": "cd example && pod-install --quiet"
|
|
102
|
+
}
|
|
103
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@ export {
|
|
|
8
8
|
stop,
|
|
9
9
|
setDeviceId,
|
|
10
10
|
} from './session-replay';
|
|
11
|
-
export { type SessionReplayConfig, MaskLevel } from './session-replay-config';
|
|
11
|
+
export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
|
|
12
12
|
|
|
13
13
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
|
14
14
|
export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
|
package/src/native-module.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import SessionReplaySpec from './specs/NativeAmpSessionReplay';
|
|
2
3
|
|
|
3
4
|
const LINKING_ERROR =
|
|
4
5
|
`The package '@amplitude/session-replay-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -6,16 +7,21 @@ const LINKING_ERROR =
|
|
|
6
7
|
'- You rebuilt the app after installing the package\n' +
|
|
7
8
|
'- You are not using Expo Go\n';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
// JS callers use the rich, hand-written types below for full type safety; the
|
|
11
|
+
// codegen `Spec` is intentionally loose (`UnsafeObject`) at the native boundary.
|
|
12
|
+
// The spec resolves the native module via `TurboModuleRegistry.get` (both
|
|
13
|
+
// architectures). When the module isn't linked it resolves to null, so we fall
|
|
14
|
+
// back to a proxy that throws a descriptive linking error on first use rather
|
|
15
|
+
// than crashing app startup at import time.
|
|
16
|
+
export const NativeSessionReplay = (SessionReplaySpec ??
|
|
17
|
+
new Proxy(
|
|
18
|
+
{},
|
|
19
|
+
{
|
|
20
|
+
get() {
|
|
21
|
+
throw new Error(LINKING_ERROR);
|
|
17
22
|
},
|
|
18
|
-
|
|
23
|
+
},
|
|
24
|
+
)) as unknown as NativeSessionReplaySpec;
|
|
19
25
|
|
|
20
26
|
/**
|
|
21
27
|
* Configuration interface for setting up the native iOS and Android session replay modules.
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { LogLevel } from '@amplitude/analytics-types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Masking levels for sensitive content in session replay
|
|
4
|
+
* Masking levels for sensitive content in session replay.
|
|
5
|
+
*
|
|
6
|
+
* Declared as a string-literal union (rather than an `enum`) to match the
|
|
7
|
+
* Session Replay browser SDK and avoid the const-enum inlining pitfalls of
|
|
8
|
+
* string enums under aggressive compilers.
|
|
9
|
+
*
|
|
10
|
+
* - `light`: mask only inputs that are always sensitive (password, etc.).
|
|
11
|
+
* - `medium`: mask all `<TextInput>` fields.
|
|
12
|
+
* - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
|
|
5
13
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Light = 'light',
|
|
11
|
-
/**
|
|
12
|
-
* Medium masking - balanced approach to content masking
|
|
13
|
-
*/
|
|
14
|
-
Medium = 'medium',
|
|
15
|
-
/**
|
|
16
|
-
* Conservative masking - maximum content masking for privacy
|
|
17
|
-
*/
|
|
18
|
-
Conservative = 'conservative',
|
|
14
|
+
export type MaskLevel = 'light' | 'medium' | 'conservative';
|
|
15
|
+
|
|
16
|
+
export interface PrivacyConfig {
|
|
17
|
+
maskLevel?: MaskLevel;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -55,10 +54,18 @@ export interface SessionReplayConfig {
|
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
56
|
* Level of masking applied to sensitive content
|
|
58
|
-
* @default
|
|
57
|
+
* @default 'medium'
|
|
58
|
+
* @deprecated Use `privacyConfig.maskLevel` instead.
|
|
59
59
|
*/
|
|
60
60
|
maskLevel?: MaskLevel;
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Privacy configuration for session replay.
|
|
64
|
+
* When `maskLevel` is omitted it resolves to `'medium'` at the native boundary.
|
|
65
|
+
* @default {}
|
|
66
|
+
*/
|
|
67
|
+
privacyConfig?: PrivacyConfig;
|
|
68
|
+
|
|
62
69
|
/**
|
|
63
70
|
* Whether to opt out of session replay collection
|
|
64
71
|
* @default false
|
|
@@ -87,14 +94,29 @@ export interface SessionReplayConfig {
|
|
|
87
94
|
sessionId?: number;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Internal config shape used by the SDK after the public `SessionReplayConfig`
|
|
99
|
+
* is normalized at the input boundary. The deprecated top-level `maskLevel` is
|
|
100
|
+
* folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
|
|
101
|
+
* needs to know the deprecated field ever existed.
|
|
102
|
+
*
|
|
103
|
+
* Not exported from `index.tsx` on purpose — this is an implementation detail
|
|
104
|
+
* of the session replay module.
|
|
105
|
+
*/
|
|
106
|
+
export type SessionReplayConfigInternal = Omit<SessionReplayConfig, 'maskLevel'>;
|
|
107
|
+
|
|
108
|
+
export const getDefaultConfig: () => Required<Omit<SessionReplayConfigInternal, 'apiKey'>> = () => {
|
|
91
109
|
return {
|
|
92
110
|
autoStart: true,
|
|
93
111
|
deviceId: null,
|
|
94
112
|
enableRemoteConfig: true,
|
|
95
113
|
logLevel: LogLevel.Warn,
|
|
96
|
-
maskLevel: MaskLevel.Medium,
|
|
97
114
|
optOut: false,
|
|
115
|
+
// Intentionally left without a `maskLevel`: the effective default
|
|
116
|
+
// (`'medium'`) is resolved once at the native boundary in `nativeConfig()`.
|
|
117
|
+
// Baking it in here would make the deprecated top-level `maskLevel`
|
|
118
|
+
// unreachable through the `?? 'medium'` fallback (silent privacy downgrade).
|
|
119
|
+
privacyConfig: {},
|
|
98
120
|
sampleRate: 0,
|
|
99
121
|
serverZone: 'US',
|
|
100
122
|
sessionId: -1,
|