@amplitude/plugin-session-replay-react-native 0.2.0 → 0.2.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/README.md +6 -1
- package/android/src/main/java/com/amplitude/pluginsessionreplayreactnative/PluginSessionReplayReactNativeModule.kt +3 -3
- package/ios/PluginSessionReplayReactNative.mm +1 -1
- package/ios/PluginSessionReplayReactNative.swift +5 -5
- package/lib/commonjs/{AmpMaskView.js → app-mask-view.js} +1 -1
- package/lib/commonjs/app-mask-view.js.map +1 -0
- package/lib/commonjs/index.js +9 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/session-replay-config.js +14 -0
- package/lib/commonjs/session-replay-config.js.map +1 -0
- package/lib/commonjs/session-replay.js +10 -3
- package/lib/commonjs/session-replay.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/{AmpMaskView.js → app-mask-view.js} +1 -1
- package/lib/module/app-mask-view.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/session-replay-config.js +7 -0
- package/lib/module/session-replay-config.js.map +1 -0
- package/lib/module/session-replay.js +10 -3
- package/lib/module/session-replay.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/{AmpMaskView.d.ts → app-mask-view.d.ts} +1 -1
- package/lib/typescript/app-mask-view.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/session-replay-config.d.ts +9 -0
- package/lib/typescript/session-replay-config.d.ts.map +1 -0
- package/lib/typescript/session-replay.d.ts +3 -1
- package/lib/typescript/session-replay.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/index.tsx +3 -1
- package/src/session-replay-config.tsx +11 -0
- package/src/session-replay.ts +16 -3
- package/src/version.ts +1 -1
- package/lib/commonjs/AmpMaskView.js.map +0 -1
- package/lib/module/AmpMaskView.js.map +0 -1
- package/lib/typescript/AmpMaskView.d.ts.map +0 -1
- /package/src/{AmpMaskView.tsx → app-mask-view.tsx} +0 -0
package/README.md
CHANGED
|
@@ -16,11 +16,16 @@ import { SessionReplayPlugin } from '@amplitude/plugin-session-replay-react-nati
|
|
|
16
16
|
|
|
17
17
|
// ...
|
|
18
18
|
|
|
19
|
+
const config: SessionReplayConfig = {
|
|
20
|
+
enableRemoteConfig: true, // default true
|
|
21
|
+
sampleRate: 1, // default 0
|
|
22
|
+
};
|
|
19
23
|
await init('YOUR_API_KEY').promise;
|
|
20
|
-
await add(new SessionReplayPlugin()).promise;
|
|
24
|
+
await add(new SessionReplayPlugin(config)).promise;
|
|
21
25
|
|
|
22
26
|
```
|
|
23
27
|
|
|
28
|
+
|
|
24
29
|
## Masking views
|
|
25
30
|
To maks certain views, add the `AmpMaskView` tag with the mask property `amp-mask` around the section to be masked
|
|
26
31
|
|
|
@@ -19,7 +19,7 @@ class PluginSessionReplayReactNativeModule(private val reactContext: ReactApplic
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
@ReactMethod
|
|
22
|
-
fun setup(apiKey: String, deviceId: String?, sessionId: Double) {
|
|
22
|
+
fun setup(apiKey: String, deviceId: String?, sessionId: Double, sampleRate: Double, enableRemoteConfig: Boolean) {
|
|
23
23
|
LogcatLogger.logger.logMode = Logger.LogMode.DEBUG
|
|
24
24
|
sessionReplay = SessionReplay(
|
|
25
25
|
apiKey,
|
|
@@ -27,8 +27,8 @@ class PluginSessionReplayReactNativeModule(private val reactContext: ReactApplic
|
|
|
27
27
|
deviceId ?: "",
|
|
28
28
|
sessionId.toLong(),
|
|
29
29
|
logger = LogcatLogger.logger,
|
|
30
|
-
sampleRate =
|
|
31
|
-
enableRemoteConfig =
|
|
30
|
+
sampleRate = sampleRate,
|
|
31
|
+
enableRemoteConfig = enableRemoteConfig,
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(PluginSessionReplayReactNative, NSObject)
|
|
4
4
|
|
|
5
|
-
RCT_EXTERN_METHOD(setup:(NSString)apiKey deviceId:(NSString)deviceId sessionId:(nonnull NSNumber)sessionId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
5
|
+
RCT_EXTERN_METHOD(setup:(NSString)apiKey deviceId:(NSString)deviceId sessionId:(nonnull NSNumber)sessionId sampleRate:(float)sampleRate enableRemoteConfig:(BOOL)enableRemoteConfig resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
6
6
|
|
|
7
7
|
RCT_EXTERN_METHOD(setSessionId:(nonnull NSNumber) resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
8
8
|
|
|
@@ -6,15 +6,15 @@ class PluginSessionReplayReactNative: NSObject {
|
|
|
6
6
|
|
|
7
7
|
var sessionReplay: SessionReplay!
|
|
8
8
|
|
|
9
|
-
@objc(setup:deviceId:sessionId:resolve:reject:)
|
|
10
|
-
func setup(_ apiKey: String, deviceId: String, sessionId: NSNumber, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
|
|
11
|
-
print("setup: \(apiKey) \(deviceId) \(sessionId)")
|
|
9
|
+
@objc(setup:deviceId:sessionId:sampleRate:enableRemoteConfig:resolve:reject:)
|
|
10
|
+
func setup(_ apiKey: String, deviceId: String, sessionId: NSNumber, sampleRate: Float, enableRemoteConfig: Bool, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
|
|
11
|
+
print("setup: API Key: \(apiKey) Device Id: \(deviceId) Session Id: \(sessionId) Sample Rate: \(sampleRate) Enable Remote Config: \(enableRemoteConfig)")
|
|
12
12
|
sessionReplay = SessionReplay(apiKey:apiKey,
|
|
13
13
|
deviceId: deviceId,
|
|
14
14
|
sessionId: sessionId.int64Value,
|
|
15
|
-
sampleRate:
|
|
15
|
+
sampleRate: sampleRate,
|
|
16
16
|
logger:ConsoleLogger(logLevel: LogLevelEnum.DEBUG.rawValue),
|
|
17
|
-
enableRemoteConfig:
|
|
17
|
+
enableRemoteConfig: enableRemoteConfig)
|
|
18
18
|
sessionReplay.start()
|
|
19
19
|
resolve(nil)
|
|
20
20
|
}
|
|
@@ -7,4 +7,4 @@ exports.AmpMaskView = void 0;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
const AmpMaskView = (0, _reactNative.requireNativeComponent)('RCTAmpMaskView');
|
|
9
9
|
exports.AmpMaskView = AmpMaskView;
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=app-mask-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AmpMaskView","requireNativeComponent"],"sourceRoot":"../../src","sources":["app-mask-view.tsx"],"mappings":";;;;;;AAAA;AAMO,MAAMA,WAAW,GACtB,IAAAC,mCAAsB,EAAmB,gBAAgB,CAAC;AAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "AmpMaskView", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _appMaskView.AmpMaskView;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SessionReplayConfig", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _sessionReplayConfig.SessionReplayConfig;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
18
|
Object.defineProperty(exports, "SessionReplayPlugin", {
|
|
@@ -16,5 +22,6 @@ Object.defineProperty(exports, "SessionReplayPlugin", {
|
|
|
16
22
|
}
|
|
17
23
|
});
|
|
18
24
|
var _sessionReplay = require("./session-replay");
|
|
19
|
-
var
|
|
25
|
+
var _appMaskView = require("./app-mask-view");
|
|
26
|
+
var _sessionReplayConfig = require("./session-replay-config");
|
|
20
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AAEA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDefaultConfig = void 0;
|
|
7
|
+
const getDefaultConfig = () => {
|
|
8
|
+
return {
|
|
9
|
+
sampleRate: 0,
|
|
10
|
+
enableRemoteConfig: true
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
14
|
+
//# sourceMappingURL=session-replay-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getDefaultConfig","sampleRate","enableRemoteConfig"],"sourceRoot":"../../src","sources":["session-replay-config.tsx"],"mappings":";;;;;;AAKO,MAAMA,gBAAgB,GAAG,MAAM;EAClC,OAAO;IACHC,UAAU,EAAE,CAAC;IACbC,kBAAkB,EAAE;EACxB,CAAC;AACL,CAAC;AAAA"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.SessionReplayPlugin = void 0;
|
|
7
7
|
var _nativeModule = require("./native-module");
|
|
8
8
|
var _version = require("./version");
|
|
9
|
+
var _sessionReplayConfig = require("./session-replay-config");
|
|
9
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
11
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
12
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -15,15 +16,21 @@ class SessionReplayPlugin {
|
|
|
15
16
|
// @ts-ignore
|
|
16
17
|
|
|
17
18
|
constructor() {
|
|
19
|
+
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
20
|
_defineProperty(this, "name", '@amplitude/plugin-session-replay-react-native');
|
|
19
21
|
_defineProperty(this, "type", 'enrichment');
|
|
20
22
|
_defineProperty(this, "config", void 0);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
_defineProperty(this, "sessionReplayConfig", void 0);
|
|
24
|
+
this.sessionReplayConfig = {
|
|
25
|
+
...(0, _sessionReplayConfig.getDefaultConfig)(),
|
|
26
|
+
...config
|
|
27
|
+
};
|
|
28
|
+
console.log('Initializing SessionReplayPlugin with config: ', this.sessionReplayConfig);
|
|
29
|
+
}
|
|
23
30
|
async setup(config, _) {
|
|
24
31
|
this.config = config;
|
|
25
32
|
console.log(`Installing @amplitude/plugin-session-replay-react-native, version ${_version.VERSION}.`);
|
|
26
|
-
await _nativeModule.PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId);
|
|
33
|
+
await _nativeModule.PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId, this.sessionReplayConfig.sampleRate ?? 1, this.sessionReplayConfig.enableRemoteConfig ?? true);
|
|
27
34
|
}
|
|
28
35
|
async execute(event) {
|
|
29
36
|
// On event, synchronize the session id to the what's on the browserConfig (source of truth)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SessionReplayPlugin","constructor","
|
|
1
|
+
{"version":3,"names":["SessionReplayPlugin","constructor","config","sessionReplayConfig","getDefaultConfig","console","log","setup","_","VERSION","PluginSessionReplayReactNative","apiKey","deviceId","sessionId","sampleRate","enableRemoteConfig","execute","event","getSessionId","setSessionId","session_id","sessionRecordingProperties","getSessionReplayProperties","event_properties","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;;;;AAOA;AACA;AACA;AAAgF;AAAA;AAAA;AAEzE,MAAMA,mBAAmB,CAAmE;EAGjG;;EAEA;;EAKAC,WAAW,GAAmC;IAAA,IAAlCC,MAA2B,uEAAG,CAAC,CAAC;IAAA,8BATrC,+CAA+C;IAAA,8BAC/C,YAAY;IAAA;IAAA;IASjB,IAAI,CAACC,mBAAmB,GAAG;MACzB,GAAG,IAAAC,qCAAgB,GAAE;MACrB,GAAGF;IACL,CAAC;IACDG,OAAO,CAACC,GAAG,CAAC,gDAAgD,EAAE,IAAI,CAACH,mBAAmB,CAAC;EACzF;EAEA,MAAMI,KAAK,CAACL,MAAyB,EAAEM,CAAoB,EAAiB;IAC1E,IAAI,CAACN,MAAM,GAAGA,MAAM;IACpBG,OAAO,CAACC,GAAG,CAAE,qEAAoEG,gBAAQ,GAAE,CAAC;IAC5F,MAAMC,4CAA8B,CAACH,KAAK,CACxCL,MAAM,CAACS,MAAM,EACbT,MAAM,CAACU,QAAQ,EACfV,MAAM,CAACW,SAAS,EAChB,IAAI,CAACV,mBAAmB,CAACW,UAAU,IAAI,CAAC,EACxC,IAAI,CAACX,mBAAmB,CAACY,kBAAkB,IAAI,IAAI,CACpD;EACH;EAEA,MAAMC,OAAO,CAACC,KAAY,EAAyB;IACjD;IACA;IACA;IACA,IAAI,IAAI,CAACf,MAAM,CAACW,SAAS,IAAI,IAAI,CAACX,MAAM,CAACW,SAAS,MAAM,MAAMH,4CAA8B,CAACQ,YAAY,EAAE,CAAC,EAAE;MAC5G,MAAMR,4CAA8B,CAACS,YAAY,CAAC,IAAI,CAACjB,MAAM,CAACW,SAAS,CAAC;IAC1E;IACA;IACA;IACA,IAAI,IAAI,CAACX,MAAM,CAACW,SAAS,IAAI,IAAI,CAACX,MAAM,CAACW,SAAS,KAAKI,KAAK,CAACG,UAAU,EAAE;MACvE,MAAMC,0BAA0B,GAAG,MAAMX,4CAA8B,CAACY,0BAA0B,EAAE;MACpGL,KAAK,CAACM,gBAAgB,GAAG;QACvB,GAAGN,KAAK,CAACM,gBAAgB;QACzB,GAAGF;MACL,CAAC;IACH;IACA,OAAOG,OAAO,CAACC,OAAO,CAACR,KAAK,CAAC;EAC/B;EAEA,MAAMS,QAAQ,GAAkB;IAC9B,MAAMhB,4CAA8B,CAACgB,QAAQ,EAAE;IAC/C;IACA;;IAEA;IACA,IAAI,CAACxB,MAAM,GAAG,IAAI;EACpB;EAEA,MAAMoB,0BAA0B,GAAG;IACjC,OAAOZ,4CAA8B,CAACY,0BAA0B,EAAE;EACpE;AACF;AAAC"}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","AmpMaskView"],"sourceRoot":"../../src","sources":["app-mask-view.tsx"],"mappings":"AAAA,SAASA,sBAAsB,QAAwB,cAAc;AAMrE,OAAO,MAAMC,WAAW,GACtBD,sBAAsB,CAAmB,gBAAgB,CAAC"}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,kBAAkB;AAEtD,SAASC,WAAW,QAAQ,
|
|
1
|
+
{"version":3,"names":["SessionReplayPlugin","AmpMaskView","SessionReplayConfig"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,kBAAkB;AAEtD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SAASC,mBAAmB,QAAQ,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getDefaultConfig","sampleRate","enableRemoteConfig"],"sourceRoot":"../../src","sources":["session-replay-config.tsx"],"mappings":"AAKA,OAAO,MAAMA,gBAAgB,GAAG,MAAM;EAClC,OAAO;IACHC,UAAU,EAAE,CAAC;IACbC,kBAAkB,EAAE;EACxB,CAAC;AACL,CAAC"}
|
|
@@ -9,21 +9,28 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
9
9
|
|
|
10
10
|
import { PluginSessionReplayReactNative } from './native-module';
|
|
11
11
|
import { VERSION } from './version';
|
|
12
|
+
import { getDefaultConfig } from './session-replay-config';
|
|
12
13
|
export class SessionReplayPlugin {
|
|
13
14
|
// this.config is defined in setup() which will always be called first
|
|
14
15
|
|
|
15
16
|
// @ts-ignore
|
|
16
17
|
|
|
17
18
|
constructor() {
|
|
19
|
+
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
20
|
_defineProperty(this, "name", '@amplitude/plugin-session-replay-react-native');
|
|
19
21
|
_defineProperty(this, "type", 'enrichment');
|
|
20
22
|
_defineProperty(this, "config", void 0);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
_defineProperty(this, "sessionReplayConfig", void 0);
|
|
24
|
+
this.sessionReplayConfig = {
|
|
25
|
+
...getDefaultConfig(),
|
|
26
|
+
...config
|
|
27
|
+
};
|
|
28
|
+
console.log('Initializing SessionReplayPlugin with config: ', this.sessionReplayConfig);
|
|
29
|
+
}
|
|
23
30
|
async setup(config, _) {
|
|
24
31
|
this.config = config;
|
|
25
32
|
console.log(`Installing @amplitude/plugin-session-replay-react-native, version ${VERSION}.`);
|
|
26
|
-
await PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId);
|
|
33
|
+
await PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId, this.sessionReplayConfig.sampleRate ?? 1, this.sessionReplayConfig.enableRemoteConfig ?? true);
|
|
27
34
|
}
|
|
28
35
|
async execute(event) {
|
|
29
36
|
// On event, synchronize the session id to the what's on the browserConfig (source of truth)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PluginSessionReplayReactNative","VERSION","
|
|
1
|
+
{"version":3,"names":["PluginSessionReplayReactNative","VERSION","getDefaultConfig","SessionReplayPlugin","constructor","config","sessionReplayConfig","console","log","setup","_","apiKey","deviceId","sessionId","sampleRate","enableRemoteConfig","execute","event","getSessionId","setSessionId","session_id","sessionRecordingProperties","getSessionReplayProperties","event_properties","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;;AAGA,SAASA,8BAA8B,QAAQ,iBAAiB;AAChE,SAASC,OAAO,QAAQ,WAAW;AACnC,SAA8BC,gBAAgB,QAAQ,yBAAyB;AAE/E,OAAO,MAAMC,mBAAmB,CAAmE;EAGjG;;EAEA;;EAKAC,WAAW,GAAmC;IAAA,IAAlCC,MAA2B,uEAAG,CAAC,CAAC;IAAA,8BATrC,+CAA+C;IAAA,8BAC/C,YAAY;IAAA;IAAA;IASjB,IAAI,CAACC,mBAAmB,GAAG;MACzB,GAAGJ,gBAAgB,EAAE;MACrB,GAAGG;IACL,CAAC;IACDE,OAAO,CAACC,GAAG,CAAC,gDAAgD,EAAE,IAAI,CAACF,mBAAmB,CAAC;EACzF;EAEA,MAAMG,KAAK,CAACJ,MAAyB,EAAEK,CAAoB,EAAiB;IAC1E,IAAI,CAACL,MAAM,GAAGA,MAAM;IACpBE,OAAO,CAACC,GAAG,CAAE,qEAAoEP,OAAQ,GAAE,CAAC;IAC5F,MAAMD,8BAA8B,CAACS,KAAK,CACxCJ,MAAM,CAACM,MAAM,EACbN,MAAM,CAACO,QAAQ,EACfP,MAAM,CAACQ,SAAS,EAChB,IAAI,CAACP,mBAAmB,CAACQ,UAAU,IAAI,CAAC,EACxC,IAAI,CAACR,mBAAmB,CAACS,kBAAkB,IAAI,IAAI,CACpD;EACH;EAEA,MAAMC,OAAO,CAACC,KAAY,EAAyB;IACjD;IACA;IACA;IACA,IAAI,IAAI,CAACZ,MAAM,CAACQ,SAAS,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,MAAM,MAAMb,8BAA8B,CAACkB,YAAY,EAAE,CAAC,EAAE;MAC5G,MAAMlB,8BAA8B,CAACmB,YAAY,CAAC,IAAI,CAACd,MAAM,CAACQ,SAAS,CAAC;IAC1E;IACA;IACA;IACA,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,KAAKI,KAAK,CAACG,UAAU,EAAE;MACvE,MAAMC,0BAA0B,GAAG,MAAMrB,8BAA8B,CAACsB,0BAA0B,EAAE;MACpGL,KAAK,CAACM,gBAAgB,GAAG;QACvB,GAAGN,KAAK,CAACM,gBAAgB;QACzB,GAAGF;MACL,CAAC;IACH;IACA,OAAOG,OAAO,CAACC,OAAO,CAACR,KAAK,CAAC;EAC/B;EAEA,MAAMS,QAAQ,GAAkB;IAC9B,MAAM1B,8BAA8B,CAAC0B,QAAQ,EAAE;IAC/C;IACA;;IAEA;IACA,IAAI,CAACrB,MAAM,GAAG,IAAI;EACpB;EAEA,MAAMiB,0BAA0B,GAAG;IACjC,OAAOtB,8BAA8B,CAACsB,0BAA0B,EAAE;EACpE;AACF"}
|
package/lib/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.1';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-mask-view.d.ts","sourceRoot":"","sources":["../../src/app-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,wDACoC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,gBAAgB;;;CAK5B,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { EnrichmentPlugin, Event, ReactNativeClient, ReactNativeConfig } from '@amplitude/analytics-types';
|
|
2
|
+
import { SessionReplayConfig } from './session-replay-config';
|
|
2
3
|
export declare class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient, ReactNativeConfig> {
|
|
3
4
|
name: string;
|
|
4
5
|
type: "enrichment";
|
|
5
6
|
config: ReactNativeConfig;
|
|
6
|
-
|
|
7
|
+
sessionReplayConfig: SessionReplayConfig;
|
|
8
|
+
constructor(config?: SessionReplayConfig);
|
|
7
9
|
setup(config: ReactNativeConfig, _: ReactNativeClient): Promise<void>;
|
|
8
10
|
execute(event: Event): Promise<Event | null>;
|
|
9
11
|
teardown(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIhH,OAAO,EAAE,mBAAmB,EAAoB,MAAM,yBAAyB,CAAC;AAEhF,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAChG,IAAI,SAAmD;IACvD,IAAI,eAAyB;IAI7B,MAAM,EAAE,iBAAiB,CAAC;IAE1B,mBAAmB,EAAE,mBAAmB,CAAC;gBAE7B,MAAM,GAAE,mBAAwB;IAQtC,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrE,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAmB5C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IASzB,0BAA0B;CAGjC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.
|
|
1
|
+
export declare const VERSION = "0.2.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/plugin-session-replay-react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Amplitude Session Replay plugin for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
]
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "34737cd410d0144d618a800b1f5e9822f555e55f"
|
|
96
96
|
}
|
package/src/index.tsx
CHANGED
package/src/session-replay.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { EnrichmentPlugin, Event, ReactNativeClient, ReactNativeConfig } fr
|
|
|
7
7
|
|
|
8
8
|
import { PluginSessionReplayReactNative } from './native-module';
|
|
9
9
|
import { VERSION } from './version';
|
|
10
|
+
import { SessionReplayConfig, getDefaultConfig } from './session-replay-config';
|
|
10
11
|
|
|
11
12
|
export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient, ReactNativeConfig> {
|
|
12
13
|
name = '@amplitude/plugin-session-replay-react-native';
|
|
@@ -16,14 +17,26 @@ export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient,
|
|
|
16
17
|
// @ts-ignore
|
|
17
18
|
config: ReactNativeConfig;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
sessionReplayConfig: SessionReplayConfig;
|
|
21
|
+
|
|
22
|
+
constructor(config: SessionReplayConfig = {}) {
|
|
23
|
+
this.sessionReplayConfig = {
|
|
24
|
+
...getDefaultConfig(),
|
|
25
|
+
...config,
|
|
26
|
+
};
|
|
27
|
+
console.log('Initializing SessionReplayPlugin with config: ', this.sessionReplayConfig);
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
async setup(config: ReactNativeConfig, _: ReactNativeClient): Promise<void> {
|
|
24
31
|
this.config = config;
|
|
25
32
|
console.log(`Installing @amplitude/plugin-session-replay-react-native, version ${VERSION}.`);
|
|
26
|
-
await PluginSessionReplayReactNative.setup(
|
|
33
|
+
await PluginSessionReplayReactNative.setup(
|
|
34
|
+
config.apiKey,
|
|
35
|
+
config.deviceId,
|
|
36
|
+
config.sessionId,
|
|
37
|
+
this.sessionReplayConfig.sampleRate ?? 1,
|
|
38
|
+
this.sessionReplayConfig.enableRemoteConfig ?? true,
|
|
39
|
+
);
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
async execute(event: Event): Promise<Event | null> {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.1';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AmpMaskView","requireNativeComponent"],"sourceRoot":"../../src","sources":["AmpMaskView.tsx"],"mappings":";;;;;;AAAA;AAMO,MAAMA,WAAW,GACtB,IAAAC,mCAAsB,EAAmB,gBAAgB,CAAC;AAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["requireNativeComponent","AmpMaskView"],"sourceRoot":"../../src","sources":["AmpMaskView.tsx"],"mappings":"AAAA,SAASA,sBAAsB,QAAwB,cAAc;AAMrE,OAAO,MAAMC,WAAW,GACtBD,sBAAsB,CAAmB,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AmpMaskView.d.ts","sourceRoot":"","sources":["../../src/AmpMaskView.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,wDACoC,CAAC"}
|
|
File without changes
|