@amplitude/session-replay-react-native 0.1.0-beta.2 → 0.1.0-beta.4
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 +2 -43
- package/README.md +3 -113
- package/android/build.gradle +19 -127
- package/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +4 -62
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativePackage.kt +4 -2
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/fabric/AmpMaskViewManager.kt +48 -0
- package/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +0 -1
- package/ios/AMPNativeSessionReplay.mm +0 -2
- package/ios/AmpMaskApplier.h +22 -0
- package/ios/AmpMaskApplier.m +21 -0
- package/ios/NativeSessionReplay.swift +6 -41
- package/ios/fabric/AMPMaskComponentView.h +17 -0
- package/ios/fabric/AMPMaskComponentView.mm +78 -0
- package/lib/commonjs/amp-mask-view.js +9 -2
- package/lib/commonjs/amp-mask-view.js.map +1 -1
- package/lib/commonjs/index.js +0 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-module.js.map +1 -1
- package/lib/commonjs/plugin-session-replay.js +5 -34
- package/lib/commonjs/plugin-session-replay.js.map +1 -1
- package/lib/commonjs/session-replay-config.js +0 -1
- package/lib/commonjs/session-replay-config.js.map +1 -1
- package/lib/commonjs/session-replay.js +4 -35
- package/lib/commonjs/session-replay.js.map +1 -1
- package/lib/commonjs/specs/{SRMaskViewNativeComponent.js → AmpMaskViewNativeComponent.js} +7 -2
- package/lib/commonjs/specs/AmpMaskViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeAmpSessionReplay.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/amp-mask-view.js +8 -2
- package/lib/module/amp-mask-view.js.map +1 -1
- package/lib/module/index.js +1 -16
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-module.js.map +1 -1
- package/lib/module/plugin-session-replay.js +6 -35
- package/lib/module/plugin-session-replay.js.map +1 -1
- package/lib/module/session-replay-config.js +0 -1
- package/lib/module/session-replay-config.js.map +1 -1
- package/lib/module/session-replay.js +4 -34
- package/lib/module/session-replay.js.map +1 -1
- package/lib/module/specs/AmpMaskViewNativeComponent.js +10 -0
- package/lib/module/specs/AmpMaskViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeAmpSessionReplay.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/amp-mask-view.d.ts +4 -4
- package/lib/typescript/amp-mask-view.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -13
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-module.d.ts +0 -12
- package/lib/typescript/native-module.d.ts.map +1 -1
- package/lib/typescript/plugin-session-replay.d.ts +0 -16
- package/lib/typescript/plugin-session-replay.d.ts.map +1 -1
- package/lib/typescript/session-replay-config.d.ts +0 -5
- package/lib/typescript/session-replay-config.d.ts.map +1 -1
- package/lib/typescript/session-replay.d.ts +4 -28
- package/lib/typescript/session-replay.d.ts.map +1 -1
- package/lib/typescript/specs/{SRMaskViewNativeComponent.d.ts → AmpMaskViewNativeComponent.d.ts} +2 -4
- package/lib/typescript/specs/AmpMaskViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts +0 -1
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/amp-mask-view.tsx +11 -3
- package/src/index.tsx +2 -29
- package/src/native-module.ts +0 -14
- package/src/plugin-session-replay.ts +4 -33
- package/src/session-replay-config.ts +0 -7
- package/src/session-replay.ts +4 -37
- package/src/specs/AmpMaskViewNativeComponent.ts +17 -0
- package/src/specs/NativeAmpSessionReplay.ts +0 -1
- package/src/version.ts +1 -1
- package/android/src/androidTest/java/com/amplitude/sessionreplayreactnative/SRMaskViewTest.kt +0 -459
- package/android/src/main/java/com/amplitude/sessionreplayreactnative/SRDefaultMaskingPrimitive.kt +0 -36
- package/android/src/main/java/com/amplitude/sessionreplayreactnative/SRMaskingPrimitive.kt +0 -84
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/fabric/SRMaskView.kt +0 -174
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/fabric/SRMaskViewManager.kt +0 -44
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/fabric/SRMaskViewPointerEvents.java +0 -36
- package/cpp/SRMaskViewComponentDescriptor.h +0 -20
- package/cpp/SRMaskViewShadowNode.cpp +0 -54
- package/cpp/SRMaskViewShadowNode.h +0 -56
- package/ios/SRDefaultMaskingPrimitive.swift +0 -34
- package/ios/SRMaskingPrimitive.h +0 -26
- package/ios/SRMaskingRegistry.m +0 -105
- package/ios/fabric/SRMaskView.h +0 -10
- package/ios/fabric/SRMaskView.mm +0 -178
- package/lib/commonjs/Mask.types.js +0 -29
- package/lib/commonjs/Mask.types.js.map +0 -1
- package/lib/commonjs/fabric/MaskFabric.js +0 -92
- package/lib/commonjs/fabric/MaskFabric.js.map +0 -1
- package/lib/commonjs/mask-fallback.js +0 -53
- package/lib/commonjs/mask-fallback.js.map +0 -1
- package/lib/commonjs/paper/MaskPaper.js +0 -27
- package/lib/commonjs/paper/MaskPaper.js.map +0 -1
- package/lib/commonjs/specs/SRMaskViewNativeComponent.js.map +0 -1
- package/lib/module/Mask.types.js +0 -23
- package/lib/module/Mask.types.js.map +0 -1
- package/lib/module/fabric/MaskFabric.js +0 -85
- package/lib/module/fabric/MaskFabric.js.map +0 -1
- package/lib/module/mask-fallback.js +0 -45
- package/lib/module/mask-fallback.js.map +0 -1
- package/lib/module/paper/MaskPaper.js +0 -21
- package/lib/module/paper/MaskPaper.js.map +0 -1
- package/lib/module/specs/SRMaskViewNativeComponent.js +0 -5
- package/lib/module/specs/SRMaskViewNativeComponent.js.map +0 -1
- package/lib/typescript/Mask.types.d.ts +0 -38
- package/lib/typescript/Mask.types.d.ts.map +0 -1
- package/lib/typescript/fabric/MaskFabric.d.ts +0 -8
- package/lib/typescript/fabric/MaskFabric.d.ts.map +0 -1
- package/lib/typescript/mask-fallback.d.ts +0 -27
- package/lib/typescript/mask-fallback.d.ts.map +0 -1
- package/lib/typescript/paper/MaskPaper.d.ts +0 -10
- package/lib/typescript/paper/MaskPaper.d.ts.map +0 -1
- package/lib/typescript/specs/SRMaskViewNativeComponent.d.ts.map +0 -1
- package/src/Mask.types.ts +0 -45
- package/src/fabric/MaskFabric.tsx +0 -73
- package/src/mask-fallback.tsx +0 -60
- package/src/paper/MaskPaper.tsx +0 -24
- package/src/specs/SRMaskViewNativeComponent.ts +0 -12
|
@@ -16,14 +16,13 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@objc(setup:resolve:reject:)
|
|
19
|
-
func setup(_ config: NSDictionary, resolve:
|
|
19
|
+
func setup(_ config: NSDictionary, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
|
|
20
20
|
guard let apiKey = config["apiKey"] as? String,
|
|
21
21
|
let sessionId = config["sessionId"] as? NSNumber,
|
|
22
22
|
let serverZone = config["serverZone"] as? String,
|
|
23
23
|
let sampleRate = config["sampleRate"] as? NSNumber,
|
|
24
24
|
let enableRemoteConfig = config["enableRemoteConfig"] as? Bool,
|
|
25
25
|
let logLevel = config["logLevel"] as? Int,
|
|
26
|
-
let autoStart = config["autoStart"] as? Bool,
|
|
27
26
|
let maskLevel = config["maskLevel"] as? String,
|
|
28
27
|
let optOut = config["optOut"] as? Bool else {
|
|
29
28
|
reject("INVALID_CONFIG", "Invalid configuration parameters", nil)
|
|
@@ -44,7 +43,6 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
44
43
|
Sample Rate: \(sampleRate)
|
|
45
44
|
Enable Remote Config: \(enableRemoteConfig)
|
|
46
45
|
Log Level: \(logLevel)
|
|
47
|
-
Auto Start: \(autoStart)
|
|
48
46
|
Mask Level: \(maskLevel)
|
|
49
47
|
Opt Out: \(optOut)
|
|
50
48
|
"""
|
|
@@ -62,25 +60,7 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
62
60
|
enableRemoteConfig: enableRemoteConfig
|
|
63
61
|
)
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
// block: the registry is main-thread-only (setup runs on the RN
|
|
67
|
-
// native-modules queue), and registration must precede start() on the
|
|
68
|
-
// capture (main) thread so an early capture frame can't snapshot
|
|
69
|
-
// SRMaskView children before their masking intents apply.
|
|
70
|
-
// Re-registering on repeated setup() calls is harmless.
|
|
71
|
-
DispatchQueue.main.async {
|
|
72
|
-
// Invalidated (e.g. RN reload) before deferred setup ran — settle
|
|
73
|
-
// the promise so JS init() never hangs.
|
|
74
|
-
guard let sessionReplay = self.sessionReplay else {
|
|
75
|
-
reject("SETUP_ERROR", "Session Replay module was invalidated before setup completed", nil)
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
SRMaskingRegistry.primitive = SRDefaultMaskingPrimitive()
|
|
79
|
-
if (autoStart) {
|
|
80
|
-
sessionReplay.start()
|
|
81
|
-
}
|
|
82
|
-
resolve(nil)
|
|
83
|
-
}
|
|
63
|
+
resolve(nil)
|
|
84
64
|
}
|
|
85
65
|
|
|
86
66
|
@objc(setSessionId:resolve:reject:)
|
|
@@ -106,15 +86,6 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
106
86
|
resolve(NSNumber(value:sessionReplay.sessionId))
|
|
107
87
|
}
|
|
108
88
|
|
|
109
|
-
@objc(getSessionReplayProperties:reject:)
|
|
110
|
-
func getSessionReplayProperties(
|
|
111
|
-
_ resolve: RCTPromiseResolveBlock,
|
|
112
|
-
reject: RCTPromiseRejectBlock
|
|
113
|
-
) {
|
|
114
|
-
logger.debug(message: "getSessionReplayProperties")
|
|
115
|
-
resolve(sessionReplay.additionalEventProperties)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
89
|
@objc(start:reject:)
|
|
119
90
|
func start(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
|
|
120
91
|
logger.debug(message: "start")
|
|
@@ -142,16 +113,10 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
142
113
|
|
|
143
114
|
@objc(invalidate)
|
|
144
115
|
func invalidate() {
|
|
145
|
-
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
DispatchQueue.main.async {
|
|
150
|
-
print("invalidate")
|
|
151
|
-
// could be nil here
|
|
152
|
-
self.sessionReplay?.stop()
|
|
153
|
-
self.sessionReplay = nil
|
|
154
|
-
}
|
|
116
|
+
print("invalidate")
|
|
117
|
+
// could be nil here
|
|
118
|
+
sessionReplay?.stop()
|
|
119
|
+
sessionReplay = nil
|
|
155
120
|
}
|
|
156
121
|
}
|
|
157
122
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Whole file is guarded: the podspec compiles ios/** unconditionally, and this
|
|
2
|
+
// header must be a no-op on old-architecture installs where the Fabric headers
|
|
3
|
+
// (React/RCTViewComponentView.h) do not exist.
|
|
4
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
|
+
|
|
6
|
+
#import <React/RCTViewComponentView.h>
|
|
7
|
+
#import <UIKit/UIKit.h>
|
|
8
|
+
|
|
9
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
10
|
+
|
|
11
|
+
@interface AMPMaskComponentView : RCTViewComponentView
|
|
12
|
+
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_END
|
|
16
|
+
|
|
17
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Guard first (before any #import): the podspec compiles ios/** on both
|
|
2
|
+
// architectures and this file must be a no-op on old-arch installs.
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
|
|
5
|
+
#import "AMPMaskComponentView.h"
|
|
6
|
+
|
|
7
|
+
#import "../AmpMaskApplier.h"
|
|
8
|
+
|
|
9
|
+
#import <React/RCTComponentViewFactory.h>
|
|
10
|
+
#import <react/renderer/components/AmpSessionReplaySpec/ComponentDescriptors.h>
|
|
11
|
+
#import <react/renderer/components/AmpSessionReplaySpec/Props.h>
|
|
12
|
+
#import <react/renderer/components/AmpSessionReplaySpec/RCTComponentViewHelpers.h>
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
|
|
16
|
+
// Fabric host view for `<AmpMaskView>` (native name AMPMaskComponentView) on
|
|
17
|
+
// the New Architecture. A NORMAL layout node: default RCTViewComponentView
|
|
18
|
+
// layout, codegen-generated ComponentDescriptor (plain Yoga, no custom
|
|
19
|
+
// ShadowNode). Its only job is to tag ITSELF for the Session Replay recorder —
|
|
20
|
+
// the same self-tagging model as the legacy Paper manager
|
|
21
|
+
// (RCTAmpMaskViewManager.m), which keeps serving old-architecture apps under
|
|
22
|
+
// the same component name. Registering this class makes Fabric resolve the
|
|
23
|
+
// name here instead of falling back to the legacy-interop shim, whose
|
|
24
|
+
// out-of-band re-parenting mis-renders nested mask/unmask subtrees.
|
|
25
|
+
@interface AMPMaskComponentView () <RCTAMPMaskComponentViewViewProtocol>
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
@implementation AMPMaskComponentView
|
|
29
|
+
|
|
30
|
+
+ (void)load
|
|
31
|
+
{
|
|
32
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:self];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
36
|
+
{
|
|
37
|
+
if (self = [super initWithFrame:frame]) {
|
|
38
|
+
static const auto defaultProps = std::make_shared<const AMPMaskComponentViewProps>();
|
|
39
|
+
_props = defaultProps;
|
|
40
|
+
}
|
|
41
|
+
return self;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
45
|
+
{
|
|
46
|
+
return concreteComponentDescriptorProvider<AMPMaskComponentViewComponentDescriptor>();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
50
|
+
{
|
|
51
|
+
const auto &newViewProps = *std::static_pointer_cast<const AMPMaskComponentViewProps>(props);
|
|
52
|
+
[super updateProps:props oldProps:oldProps];
|
|
53
|
+
// Applied unconditionally (not diffed): a recycled instance is reset in
|
|
54
|
+
// prepareForRecycle and must be re-tagged on every (re)mount.
|
|
55
|
+
[AmpMaskApplier applyMask:[NSString stringWithUTF8String:newViewProps.mask.c_str()] toView:self];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void)prepareForRecycle
|
|
59
|
+
{
|
|
60
|
+
// Fabric reuses component-view instances under new tags; reset to the
|
|
61
|
+
// masked (fail-closed) state so a recycled view never inherits a stale
|
|
62
|
+
// UNMASKED marker before updateProps re-applies its real mask value.
|
|
63
|
+
[AmpMaskApplier resetView:self];
|
|
64
|
+
[super prepareForRecycle];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@end
|
|
68
|
+
|
|
69
|
+
// extern "C": RN <= 0.76 generates RCTThirdPartyFabricComponentsProvider.mm
|
|
70
|
+
// declaring this lookup function with C linkage; without it the app link on
|
|
71
|
+
// those versions fails with "Undefined symbols: _AMPMaskComponentViewCls".
|
|
72
|
+
// RN >= 0.77 resolves the class by name (NSClassFromString) and ignores this.
|
|
73
|
+
extern "C" Class AMPMaskComponentViewCls(void)
|
|
74
|
+
{
|
|
75
|
+
return AMPMaskComponentView.class;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AmpMaskView = void 0;
|
|
7
|
-
var
|
|
8
|
-
|
|
7
|
+
var _AmpMaskViewNativeComponent = _interopRequireDefault(require("./specs/AmpMaskViewNativeComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
// A normal layout node (lays out exactly like a plain <View>) that tags itself
|
|
10
|
+
// for the Session Replay recorder. On the New Architecture it is a real Fabric
|
|
11
|
+
// component, so it does not go through React Native's legacy-interop layer
|
|
12
|
+
// (whose out-of-band re-parenting mis-renders nested mask/unmask subtrees).
|
|
13
|
+
// The spec widens `mask` to string for codegen; the public prop stays required
|
|
14
|
+
// and union-typed.
|
|
15
|
+
const AmpMaskView = exports.AmpMaskView = _AmpMaskViewNativeComponent.default;
|
|
9
16
|
//# sourceMappingURL=amp-mask-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_AmpMaskViewNativeComponent","_interopRequireDefault","require","e","__esModule","default","AmpMaskView","exports","NativeAmpMaskView"],"sourceRoot":"../../src","sources":["amp-mask-view.tsx"],"mappings":";;;;;;AAEA,IAAAA,2BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMnE;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,mCAAoD","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.AmpMask = void 0;
|
|
7
6
|
Object.defineProperty(exports, "AmpMaskView", {
|
|
8
7
|
enumerable: true,
|
|
9
8
|
get: function () {
|
|
10
9
|
return _ampMaskView.AmpMaskView;
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
|
-
exports.AmpUnmask = void 0;
|
|
14
12
|
Object.defineProperty(exports, "SessionReplayPlugin", {
|
|
15
13
|
enumerable: true,
|
|
16
14
|
get: function () {
|
|
@@ -29,12 +27,6 @@ Object.defineProperty(exports, "getSessionId", {
|
|
|
29
27
|
return _sessionReplay.getSessionId;
|
|
30
28
|
}
|
|
31
29
|
});
|
|
32
|
-
Object.defineProperty(exports, "getSessionReplayProperties", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _sessionReplay.getSessionReplayProperties;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
30
|
Object.defineProperty(exports, "init", {
|
|
39
31
|
enumerable: true,
|
|
40
32
|
get: function () {
|
|
@@ -68,21 +60,4 @@ Object.defineProperty(exports, "stop", {
|
|
|
68
60
|
var _sessionReplay = require("./session-replay");
|
|
69
61
|
var _pluginSessionReplay = require("./plugin-session-replay");
|
|
70
62
|
var _ampMaskView = require("./amp-mask-view");
|
|
71
|
-
const g = global;
|
|
72
|
-
const isNewArch = g.RN$Bridgeless === true || g.nativeFabricUIManager != null;
|
|
73
|
-
/**
|
|
74
|
-
* Layout-transparent Session Replay masking.
|
|
75
|
-
* `<AmpMask>` masks its children; `<AmpUnmask>` exempts children inside a masked region.
|
|
76
|
-
* Requires the New Architecture (React Native >= 0.77). On the Old Architecture:
|
|
77
|
-
* throws in dev, falls back to `<AmpMaskView>` (masked but layout-unsafe) in prod.
|
|
78
|
-
* @experimental Subject to change while experimental.
|
|
79
|
-
*/
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
|
|
81
|
-
const {
|
|
82
|
-
AmpMask,
|
|
83
|
-
AmpUnmask
|
|
84
|
-
} = isNewArch ? require('./fabric/MaskFabric') : require('./paper/MaskPaper');
|
|
85
|
-
// Named AmpMaskLevel because `MaskLevel` is already exported from './session-replay-config'.
|
|
86
|
-
exports.AmpUnmask = AmpUnmask;
|
|
87
|
-
exports.AmpMask = AmpMask;
|
|
88
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_sessionReplay","require","_pluginSessionReplay","_ampMaskView"
|
|
1
|
+
{"version":3,"names":["_sessionReplay","require","_pluginSessionReplay","_ampMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAGA,IAAAE,YAAA,GAAAF,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_NativeAmpSessionReplay","_interopRequireDefault","e","__esModule","default","LINKING_ERROR","Platform","select","ios","NativeSessionReplay","exports","SessionReplaySpec","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/D,MAAMG,aAAa,GACjB,iGAAiG,GACjGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAIE,+BAAiB,IACnD,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeAmpSessionReplay","_interopRequireDefault","e","__esModule","default","LINKING_ERROR","Platform","select","ios","NativeSessionReplay","exports","SessionReplaySpec","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/D,MAAMG,aAAa,GACjB,iGAAiG,GACjGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAIE,+BAAiB,IACnD,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -64,13 +64,15 @@ class SessionReplayPlugin {
|
|
|
64
64
|
serverZone: config.serverZone,
|
|
65
65
|
sampleRate: this.sessionReplayConfig.sampleRate,
|
|
66
66
|
enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
|
|
67
|
-
logLevel: this.sessionReplayConfig.logLevel
|
|
68
|
-
autoStart: this.sessionReplayConfig.autoStart
|
|
67
|
+
logLevel: this.sessionReplayConfig.logLevel
|
|
69
68
|
}, this.logger);
|
|
70
69
|
this.isInitialized = true;
|
|
70
|
+
if (this.sessionReplayConfig.autoStart) {
|
|
71
|
+
await (0, _sessionReplay.start)();
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
74
|
async execute(event) {
|
|
73
|
-
var _this$config
|
|
75
|
+
var _this$config;
|
|
74
76
|
if (!this.isInitialized) {
|
|
75
77
|
return Promise.resolve(event);
|
|
76
78
|
}
|
|
@@ -81,15 +83,6 @@ class SessionReplayPlugin {
|
|
|
81
83
|
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.sessionId && this.config.sessionId !== (await (0, _sessionReplay.getSessionId)())) {
|
|
82
84
|
await (0, _sessionReplay.setSessionId)(this.config.sessionId);
|
|
83
85
|
}
|
|
84
|
-
// Treating config.sessionId as source of truth, if the event's session id doesn't match, the
|
|
85
|
-
// event is not of the current session (offline/late events). In that case, don't tag the events
|
|
86
|
-
if ((_this$config2 = this.config) !== null && _this$config2 !== void 0 && _this$config2.sessionId && this.config.sessionId === event.session_id) {
|
|
87
|
-
const sessionRecordingProperties = await (0, _sessionReplay.getSessionReplayProperties)();
|
|
88
|
-
event.event_properties = {
|
|
89
|
-
...event.event_properties,
|
|
90
|
-
...sessionRecordingProperties
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
86
|
return Promise.resolve(event);
|
|
94
87
|
}
|
|
95
88
|
|
|
@@ -123,28 +116,6 @@ class SessionReplayPlugin {
|
|
|
123
116
|
this.config = null;
|
|
124
117
|
this.isInitialized = false;
|
|
125
118
|
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Get session replay properties for manual event correlation.
|
|
129
|
-
* When you send events to Amplitude, call this method to get the most up-to-date session replay properties for the event.
|
|
130
|
-
*
|
|
131
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```typescript
|
|
135
|
-
* const sessionReplayProperties = await plugin.getSessionReplayProperties();
|
|
136
|
-
* analytics.track('Button Clicked', {
|
|
137
|
-
* buttonName: 'submit',
|
|
138
|
-
* ...sessionReplayProperties
|
|
139
|
-
* });
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
async getSessionReplayProperties() {
|
|
143
|
-
if (!this.isInitialized) {
|
|
144
|
-
return {};
|
|
145
|
-
}
|
|
146
|
-
return (0, _sessionReplay.getSessionReplayProperties)();
|
|
147
|
-
}
|
|
148
119
|
}
|
|
149
120
|
exports.SessionReplayPlugin = SessionReplayPlugin;
|
|
150
121
|
//# sourceMappingURL=plugin-session-replay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pluginSessionReplayConfig","require","_sessionReplay","_logger","SessionReplayPlugin","name","type","config","isInitialized","logger","createSessionReplayLogger","constructor","sessionReplayConfig","getDefaultSessionReplayPluginConfig","setLogLevel","logLevel","log","setup","_","privateInit","apiKey","deviceId","sessionId","serverZone","sampleRate","enableRemoteConfig","autoStart","execute","event","_this$config","
|
|
1
|
+
{"version":3,"names":["_pluginSessionReplayConfig","require","_sessionReplay","_logger","SessionReplayPlugin","name","type","config","isInitialized","logger","createSessionReplayLogger","constructor","sessionReplayConfig","getDefaultSessionReplayPluginConfig","setLogLevel","logLevel","log","setup","_","privateInit","apiKey","deviceId","sessionId","serverZone","sampleRate","enableRemoteConfig","autoStart","start","execute","event","_this$config","Promise","resolve","getSessionId","setSessionId","stop","teardown","exports"],"sourceRoot":"../../src","sources":["plugin-session-replay.ts"],"mappings":";;;;;;AAOA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,mBAAmB,CAAmE;EACjGC,IAAI,GAAG,+CAA+C;EACtDC,IAAI,GAAG,YAAY;EAEXC,MAAM,GAA6B,IAAI;EACvCC,aAAa,GAAG,KAAK;EAGrBC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;;EAE5C;AACF;AACA;AACA;AACA;AACA;AACA;A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AM,cAAAuB,YAAA,eAAXA,YAAA,CAAaR,SAAS,IAAI,IAAI,CAACf,MAAM,CAACe,SAAS,MAAM,MAAM,IAAAW,2BAAY,EAAC,CAAC,CAAC,EAAE;MAC9E,MAAM,IAAAC,2BAAY,EAAC,IAAI,CAAC3B,MAAM,CAACe,SAAS,CAAC;IAC3C;IACA,OAAOS,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMF,KAAKA,CAAA,EAAkB;IAC3B,IAAI,IAAI,CAACnB,aAAa,EAAE;MACtB,MAAM,IAAAmB,oBAAK,EAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMQ,IAAIA,CAAA,EAAkB;IAC1B,IAAI,IAAI,CAAC3B,aAAa,EAAE;MACtB,MAAM,IAAA2B,mBAAI,EAAC,CAAC;IACd;EACF;EAEA,MAAMC,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAAC5B,aAAa,EAAE;MACtB,MAAM,IAAA2B,mBAAI,EAAC,CAAC;IACd;IAEA,IAAI,CAAC5B,MAAM,GAAG,IAAI;IAClB,IAAI,CAACC,aAAa,GAAG,KAAK;EAC5B;AACF;AAAC6B,OAAA,CAAAjC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_analyticsTypes","require","getDefaultConfig","
|
|
1
|
+
{"version":3,"names":["_analyticsTypes","require","getDefaultConfig","deviceId","enableRemoteConfig","logLevel","LogLevel","Warn","optOut","privacyConfig","sampleRate","serverZone","sessionId","exports"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AAqEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,MAAMC,gBAA6E,GAAGA,CAAA,KAAM;EACjG,OAAO;IACLC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEC,wBAAQ,CAACC,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;AAACC,OAAA,CAAAX,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.flush = flush;
|
|
7
7
|
exports.getSessionId = getSessionId;
|
|
8
|
-
exports.getSessionReplayProperties = getSessionReplayProperties;
|
|
9
8
|
exports.init = init;
|
|
10
9
|
exports.privateInit = privateInit;
|
|
11
10
|
exports.setDeviceId = setDeviceId;
|
|
@@ -54,12 +53,12 @@ let isInitialized = false;
|
|
|
54
53
|
let logger = (0, _logger.createSessionReplayLogger)();
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
|
-
* Configure the SDK
|
|
56
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
58
57
|
* This function must be called before any other session replay operations.
|
|
59
58
|
*
|
|
60
59
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
61
|
-
* @returns Promise that resolves when initialization is complete
|
|
62
|
-
*
|
|
60
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
61
|
+
* failures are logged and do not reject the promise.
|
|
63
62
|
*
|
|
64
63
|
* @example
|
|
65
64
|
* ```typescript
|
|
@@ -159,35 +158,6 @@ async function getSessionId() {
|
|
|
159
158
|
return await _nativeModule.NativeSessionReplay.getSessionId();
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
/**
|
|
163
|
-
* Interface for session replay properties that should be attached to Amplitude events.
|
|
164
|
-
* These properties help correlate events with session recordings.
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* When you send events to Amplitude, call this function to get the most up-to-date session replay properties for the event.
|
|
169
|
-
* Collect Session Replay properties to send with other event properties.
|
|
170
|
-
*
|
|
171
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```typescript
|
|
175
|
-
* const sessionReplayProperties = await getSessionReplayProperties();
|
|
176
|
-
* analytics.track('Button Clicked', {
|
|
177
|
-
* buttonName: 'submit',
|
|
178
|
-
* ...sessionReplayProperties // Merge session replay properties
|
|
179
|
-
* });
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
async function getSessionReplayProperties() {
|
|
183
|
-
if (!isInitialized) {
|
|
184
|
-
logger.warn('SessionReplay is not initialized');
|
|
185
|
-
return {};
|
|
186
|
-
}
|
|
187
|
-
const properties = await _nativeModule.NativeSessionReplay.getSessionReplayProperties();
|
|
188
|
-
return properties;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
161
|
/**
|
|
192
162
|
* Flush any pending session replay data to the server.
|
|
193
163
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -211,13 +181,12 @@ async function flush() {
|
|
|
211
181
|
/**
|
|
212
182
|
* Start session replay recording.
|
|
213
183
|
* Begins capturing user interactions and screen content for replay.
|
|
214
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
215
184
|
*
|
|
216
185
|
* @returns Promise that resolves when recording starts
|
|
217
186
|
*
|
|
218
187
|
* @example
|
|
219
188
|
* ```typescript
|
|
220
|
-
* //
|
|
189
|
+
* // Recording starts only after this explicit call.
|
|
221
190
|
* await start();
|
|
222
191
|
* ```
|
|
223
192
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","createSessionReplayLogger","init","warn","getDefaultConfig","setLogLevel","logLevel","log","VERSION","NativeSessionReplay","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","
|
|
1
|
+
{"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","createSessionReplayLogger","init","warn","getDefaultConfig","setLogLevel","logLevel","log","VERSION","NativeSessionReplay","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","flush","start","stop","resolvedMaskLevel","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;;;;;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AALA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,eAAeA,CAACC,MAA2B,EAA+B;EACjF,MAAM;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACpD,IAAIE,aAAa,KAAKE,SAAS,EAAE;IAC/B,OAAO;MAAE,GAAGD,IAAI;MAAED;IAAc,CAAC;EACnC;EACA,IAAID,SAAS,KAAKG,SAAS,EAAE;IAC3B,OAAO;MAAE,GAAGD,IAAI;MAAED,aAAa,EAAE;QAAED;MAAU;IAAE,CAAC;EAClD;EACA,OAAOE,IAAI;AACb;AAEA,IAAIE,UAA8C,GAAG,IAAI;AACzD,IAAIC,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,IAAIA,CAACT,MAA2B,EAAiB;EACrE,IAAIM,aAAa,EAA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CAAC;AACrB","ignoreList":[]}
|
|
@@ -7,5 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/* eslint-disable import/namespace, import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// Same native name on both architectures: on the New Architecture this resolves
|
|
11
|
+
// to the Fabric AMPMaskComponentView (ios/fabric, android/src/newarch); on the
|
|
12
|
+
// old architecture codegenNativeComponent falls back to
|
|
13
|
+
// requireNativeComponent('AMPMaskComponentView'), which resolves to the
|
|
14
|
+
// unchanged legacy Paper view managers.
|
|
15
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)('AMPMaskComponentView');
|
|
16
|
+
//# sourceMappingURL=AmpMaskViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/AmpMaskViewNativeComponent.ts"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAH7F;AAWA;AACA;AACA;AACA;AACA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GACe,IAAAG,+BAAsB,EAAc,sBAAsB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import NativeAmpMaskView from './specs/AmpMaskViewNativeComponent';
|
|
2
|
+
// A normal layout node (lays out exactly like a plain <View>) that tags itself
|
|
3
|
+
// for the Session Replay recorder. On the New Architecture it is a real Fabric
|
|
4
|
+
// component, so it does not go through React Native's legacy-interop layer
|
|
5
|
+
// (whose out-of-band re-parenting mis-renders nested mask/unmask subtrees).
|
|
6
|
+
// The spec widens `mask` to string for codegen; the public prop stays required
|
|
7
|
+
// and union-typed.
|
|
8
|
+
export const AmpMaskView = NativeAmpMaskView;
|
|
3
9
|
//# sourceMappingURL=amp-mask-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["NativeAmpMaskView","AmpMaskView"],"sourceRoot":"../../src","sources":["amp-mask-view.tsx"],"mappings":"AAEA,OAAOA,iBAAiB,MAAM,oCAAoC;AAMlE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGD,iBAAoD","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
export { init, setSessionId, getSessionId,
|
|
1
|
+
export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
|
|
2
2
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
|
3
3
|
export { AmpMaskView } from './amp-mask-view';
|
|
4
|
-
const g = global;
|
|
5
|
-
const isNewArch = g.RN$Bridgeless === true || g.nativeFabricUIManager != null;
|
|
6
|
-
/**
|
|
7
|
-
* Layout-transparent Session Replay masking.
|
|
8
|
-
* `<AmpMask>` masks its children; `<AmpUnmask>` exempts children inside a masked region.
|
|
9
|
-
* Requires the New Architecture (React Native >= 0.77). On the Old Architecture:
|
|
10
|
-
* throws in dev, falls back to `<AmpMaskView>` (masked but layout-unsafe) in prod.
|
|
11
|
-
* @experimental Subject to change while experimental.
|
|
12
|
-
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
|
|
14
|
-
export const {
|
|
15
|
-
AmpMask,
|
|
16
|
-
AmpUnmask
|
|
17
|
-
} = isNewArch ? require('./fabric/MaskFabric') : require('./paper/MaskPaper');
|
|
18
|
-
// Named AmpMaskLevel because `MaskLevel` is already exported from './session-replay-config'.
|
|
19
4
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["init","setSessionId","getSessionId","
|
|
1
|
+
{"version":3,"names":["init","setSessionId","getSessionId","flush","start","stop","setDeviceId","SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,IAAI,EAAEC,YAAY,EAAEC,YAAY,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,WAAW,QAAQ,kBAAkB;AAGpG,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D,SAASC,WAAW,QAA+B,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","SessionReplaySpec","LINKING_ERROR","select","ios","default","NativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,iBAAiB,MAAM,gCAAgC;AAE9D,MAAMC,aAAa,GACjB,iGAAiG,GACjGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIL,iBAAiB,IACnD,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["Platform","SessionReplaySpec","LINKING_ERROR","select","ios","default","NativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,iBAAiB,MAAM,gCAAgC;AAE9D,MAAMC,aAAa,GACjB,iGAAiG,GACjGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIL,iBAAiB,IACnD,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultSessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
2
|
-
import { getSessionId,
|
|
2
|
+
import { getSessionId, privateInit, setSessionId, start, stop } from './session-replay';
|
|
3
3
|
import { createSessionReplayLogger } from './logger';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -59,13 +59,15 @@ export class SessionReplayPlugin {
|
|
|
59
59
|
serverZone: config.serverZone,
|
|
60
60
|
sampleRate: this.sessionReplayConfig.sampleRate,
|
|
61
61
|
enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
|
|
62
|
-
logLevel: this.sessionReplayConfig.logLevel
|
|
63
|
-
autoStart: this.sessionReplayConfig.autoStart
|
|
62
|
+
logLevel: this.sessionReplayConfig.logLevel
|
|
64
63
|
}, this.logger);
|
|
65
64
|
this.isInitialized = true;
|
|
65
|
+
if (this.sessionReplayConfig.autoStart) {
|
|
66
|
+
await start();
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
async execute(event) {
|
|
68
|
-
var _this$config
|
|
70
|
+
var _this$config;
|
|
69
71
|
if (!this.isInitialized) {
|
|
70
72
|
return Promise.resolve(event);
|
|
71
73
|
}
|
|
@@ -76,15 +78,6 @@ export class SessionReplayPlugin {
|
|
|
76
78
|
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.sessionId && this.config.sessionId !== (await getSessionId())) {
|
|
77
79
|
await setSessionId(this.config.sessionId);
|
|
78
80
|
}
|
|
79
|
-
// Treating config.sessionId as source of truth, if the event's session id doesn't match, the
|
|
80
|
-
// event is not of the current session (offline/late events). In that case, don't tag the events
|
|
81
|
-
if ((_this$config2 = this.config) !== null && _this$config2 !== void 0 && _this$config2.sessionId && this.config.sessionId === event.session_id) {
|
|
82
|
-
const sessionRecordingProperties = await getSessionReplayProperties();
|
|
83
|
-
event.event_properties = {
|
|
84
|
-
...event.event_properties,
|
|
85
|
-
...sessionRecordingProperties
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
81
|
return Promise.resolve(event);
|
|
89
82
|
}
|
|
90
83
|
|
|
@@ -118,27 +111,5 @@ export class SessionReplayPlugin {
|
|
|
118
111
|
this.config = null;
|
|
119
112
|
this.isInitialized = false;
|
|
120
113
|
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get session replay properties for manual event correlation.
|
|
124
|
-
* When you send events to Amplitude, call this method to get the most up-to-date session replay properties for the event.
|
|
125
|
-
*
|
|
126
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const sessionReplayProperties = await plugin.getSessionReplayProperties();
|
|
131
|
-
* analytics.track('Button Clicked', {
|
|
132
|
-
* buttonName: 'submit',
|
|
133
|
-
* ...sessionReplayProperties
|
|
134
|
-
* });
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
async getSessionReplayProperties() {
|
|
138
|
-
if (!this.isInitialized) {
|
|
139
|
-
return {};
|
|
140
|
-
}
|
|
141
|
-
return getSessionReplayProperties();
|
|
142
|
-
}
|
|
143
114
|
}
|
|
144
115
|
//# sourceMappingURL=plugin-session-replay.js.map
|