@amplitude/session-replay-react-native 0.1.0-beta.1 → 0.1.0-beta.3
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 +3 -1
- package/android/build.gradle +10 -0
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativePackage.kt +4 -1
- package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/fabric/AmpMaskViewManager.kt +48 -0
- package/ios/AmpMaskApplier.h +22 -0
- package/ios/AmpMaskApplier.m +21 -0
- 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/specs/AmpMaskViewNativeComponent.js +16 -0
- package/lib/commonjs/specs/AmpMaskViewNativeComponent.js.map +1 -0
- 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.map +1 -1
- package/lib/module/specs/AmpMaskViewNativeComponent.js +10 -0
- package/lib/module/specs/AmpMaskViewNativeComponent.js.map +1 -0
- 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 +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/AmpMaskViewNativeComponent.d.ts +9 -0
- package/lib/typescript/specs/AmpMaskViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +11 -6
- package/src/amp-mask-view.tsx +11 -3
- package/src/index.tsx +1 -1
- package/src/specs/AmpMaskViewNativeComponent.ts +17 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,9 @@ await add(new SessionReplayPlugin(config)).promise;
|
|
|
58
58
|
|
|
59
59
|
## Masking views
|
|
60
60
|
|
|
61
|
-
To
|
|
61
|
+
To mask certain views, add the `AmpMaskView` tag with the mask property `amp-mask` around the section to be masked
|
|
62
|
+
|
|
63
|
+
`<AmpMaskView>` lays out exactly like a plain `<View>` and works on both React Native architectures: on the New Architecture it is a native Fabric component, on the old architecture it uses the classic view managers.
|
|
62
64
|
|
|
63
65
|
```js
|
|
64
66
|
import { AmpMaskView } from '@amplitude/session-replay-react-native';
|
package/android/build.gradle
CHANGED
|
@@ -7,6 +7,16 @@ def isNewArchitectureEnabled() {
|
|
|
7
7
|
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
// Gradle configures projects alphabetically, so this project sorts before ':app'.
|
|
11
|
+
// If the app doesn't apply RN's 'com.facebook.react.rootproject' plugin, the RN gradle
|
|
12
|
+
// plugin's jvmToolchain(17) sweep reaches this project after AGP has already finalized
|
|
13
|
+
// its Java toolchain, failing with "property 'languageVersion' is final" (issue #1510).
|
|
14
|
+
// Configuring ':app' first (as rootproject would) keeps the sweep ahead of finalization.
|
|
15
|
+
// When the app already applies that plugin, this block is a harmless no-op (both force ':app' first).
|
|
16
|
+
if (findProject(':app') != null) {
|
|
17
|
+
evaluationDependsOn(':app')
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
apply plugin: "com.android.library"
|
|
11
21
|
apply plugin: "kotlin-android"
|
|
12
22
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.amplitude.sessionreplayreactnative
|
|
2
2
|
|
|
3
|
+
import com.amplitude.sessionreplayreactnative.fabric.AmpMaskViewManager
|
|
3
4
|
import com.facebook.react.BaseReactPackage
|
|
4
5
|
import com.facebook.react.bridge.NativeModule
|
|
5
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -35,6 +36,8 @@ class SessionReplayReactNativePackage : BaseReactPackage() {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
38
|
-
|
|
39
|
+
// Fabric-native AMPMaskComponentView; the legacy Paper manager of the same
|
|
40
|
+
// name is registered only by the oldarch package.
|
|
41
|
+
return listOf(AmpMaskViewManager())
|
|
39
42
|
}
|
|
40
43
|
}
|
package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/fabric/AmpMaskViewManager.kt
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package com.amplitude.sessionreplayreactnative.fabric
|
|
2
|
+
|
|
3
|
+
import com.amplitude.android.sessionreplay.SessionReplay
|
|
4
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
6
|
+
import com.facebook.react.viewmanagers.AMPMaskComponentViewManagerDelegate
|
|
7
|
+
import com.facebook.react.viewmanagers.AMPMaskComponentViewManagerInterface
|
|
8
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
9
|
+
import com.facebook.react.views.view.ReactViewManager
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* New-Architecture manager for `<AmpMaskView>` (native name AMPMaskComponentView).
|
|
13
|
+
* Registered by the newarch [com.amplitude.sessionreplayreactnative.SessionReplayReactNativePackage]
|
|
14
|
+
* in place of the legacy [com.amplitude.sessionreplayreactnative.SessionReplayReactNativeViewManager],
|
|
15
|
+
* which keeps serving old-architecture builds unchanged (oldarch source set).
|
|
16
|
+
*
|
|
17
|
+
* Same base class ([ReactViewManager] — the host view is a bare [ReactViewGroup],
|
|
18
|
+
* a NORMAL layout node) and same self-tagging model as the legacy manager; the
|
|
19
|
+
* codegen [AMPMaskComponentViewManagerDelegate] routes the `mask` prop on Fabric.
|
|
20
|
+
*/
|
|
21
|
+
@ReactModule(name = AmpMaskViewManager.NAME)
|
|
22
|
+
class AmpMaskViewManager :
|
|
23
|
+
ReactViewManager(),
|
|
24
|
+
AMPMaskComponentViewManagerInterface<ReactViewGroup> {
|
|
25
|
+
|
|
26
|
+
private val delegate = AMPMaskComponentViewManagerDelegate(this)
|
|
27
|
+
|
|
28
|
+
override fun getDelegate(): ViewManagerDelegate<ReactViewGroup> = delegate
|
|
29
|
+
|
|
30
|
+
override fun getName(): String = NAME
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Same mask values as the legacy `mask` prop: `amp-mask`/`amp-block` mask or
|
|
34
|
+
* block this subtree, `amp-unmask` exempts it. Unknown values fail safe to
|
|
35
|
+
* masking.
|
|
36
|
+
*/
|
|
37
|
+
override fun setMask(view: ReactViewGroup, value: String?) {
|
|
38
|
+
when (value) {
|
|
39
|
+
"amp-unmask" -> SessionReplay.unmask(view)
|
|
40
|
+
"amp-block" -> SessionReplay.block(view)
|
|
41
|
+
else -> SessionReplay.mask(view)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
companion object {
|
|
46
|
+
const val NAME = "AMPMaskComponentView"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
+
|
|
5
|
+
// Plain-ObjC seam between the Fabric AMPMaskComponentView (ObjC++) and the
|
|
6
|
+
// AmplitudeSessionReplay Swift pod: `@import AmplitudeSessionReplay` is only
|
|
7
|
+
// reliable from ObjC (.m) translation units, so the amp_isBlocked calls live
|
|
8
|
+
// here instead of in the .mm.
|
|
9
|
+
@interface AmpMaskApplier : NSObject
|
|
10
|
+
|
|
11
|
+
// 'amp-unmask' exempts the view; 'amp-mask'/'amp-block'/unknown values fail
|
|
12
|
+
// safe to masking. Same mapping as the legacy AMPMaskComponentViewManager.
|
|
13
|
+
+ (void)applyMask:(NSString *)mask toView:(UIView *)view;
|
|
14
|
+
|
|
15
|
+
// Resets a view about to be recycled to the masked (fail-closed) state, so a
|
|
16
|
+
// reused native instance cannot inherit a previous incarnation's UNMASKED
|
|
17
|
+
// marker and expose content before updateProps re-applies its real mask value.
|
|
18
|
+
+ (void)resetView:(UIView *)view;
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#import "AmpMaskApplier.h"
|
|
2
|
+
@import AmplitudeSessionReplay;
|
|
3
|
+
|
|
4
|
+
@implementation AmpMaskApplier
|
|
5
|
+
|
|
6
|
+
+ (void)applyMask:(NSString *)mask toView:(UIView *)view
|
|
7
|
+
{
|
|
8
|
+
view.amp_isBlocked = ![mask isEqualToString:@"amp-unmask"];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
+ (void)resetView:(UIView *)view
|
|
12
|
+
{
|
|
13
|
+
// Fail closed: amp_isBlocked is a bool with no "inherit/none" state, so a
|
|
14
|
+
// recycled view can only be reset to masked or unmasked. Reset to masked so
|
|
15
|
+
// that if a reused instance is ever captured before updateProps re-applies
|
|
16
|
+
// its real mask value, it errs toward hiding content, never exposing it.
|
|
17
|
+
// Matches applyMask's unknown-value policy and the component's masked default.
|
|
18
|
+
view.amp_isBlocked = true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -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":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/* eslint-disable import/namespace, import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
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":[]}
|
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["init","setSessionId","getSessionId","getSessionReplayProperties","flush","start","stop","setDeviceId","SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,WAAW,QACN,kBAAkB;AAGzB,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D,SAASC,WAAW,
|
|
1
|
+
{"version":3,"names":["init","setSessionId","getSessionId","getSessionReplayProperties","flush","start","stop","setDeviceId","SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,WAAW,QACN,kBAAkB;AAGzB,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D,SAASC,WAAW,QAA+B,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable import/namespace, import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
2
|
+
|
|
3
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
4
|
+
// Same native name on both architectures: on the New Architecture this resolves
|
|
5
|
+
// to the Fabric AMPMaskComponentView (ios/fabric, android/src/newarch); on the
|
|
6
|
+
// old architecture codegenNativeComponent falls back to
|
|
7
|
+
// requireNativeComponent('AMPMaskComponentView'), which resolves to the
|
|
8
|
+
// unchanged legacy Paper view managers.
|
|
9
|
+
export default codegenNativeComponent('AMPMaskComponentView');
|
|
10
|
+
//# sourceMappingURL=AmpMaskViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/AmpMaskViewNativeComponent.ts"],"mappings":"AAAA;;AAGA,OAAOA,sBAAsB,MAAM,yDAAyD;AAQ5F;AACA;AACA;AACA;AACA;AACA,eAAeA,sBAAsB,CAAc,sBAAsB,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-beta.
|
|
1
|
+
export const VERSION = '0.1.0-beta.3';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
export interface AmpMaskViewProps extends ViewProps {
|
|
3
4
|
mask: 'amp-mask' | 'amp-unmask' | 'amp-block';
|
|
4
5
|
}
|
|
5
|
-
export declare const AmpMaskView:
|
|
6
|
-
export {};
|
|
6
|
+
export declare const AmpMaskView: ComponentType<AmpMaskViewProps>;
|
|
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,
|
|
1
|
+
{"version":3,"file":"amp-mask-view.d.ts","sourceRoot":"","sources":["../../src/amp-mask-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;CAC/C;AAQD,eAAO,MAAM,WAAW,iCAAuD,CAAC"}
|
|
@@ -2,5 +2,5 @@ export { init, setSessionId, getSessionId, getSessionReplayProperties, flush, st
|
|
|
2
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
|
-
export { AmpMaskView } from './amp-mask-view';
|
|
5
|
+
export { AmpMaskView, type AmpMaskViewProps } from './amp-mask-view';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,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
|
+
{"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,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react-native/types/modules/Codegen" />
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type { WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
export interface NativeProps extends ViewProps {
|
|
5
|
+
mask?: WithDefault<string, 'amp-mask'>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=AmpMaskViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmpMaskViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/specs/AmpMaskViewNativeComponent.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAG7E,MAAM,WAAW,WAAY,SAAQ,SAAS;IAG5C,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACxC;;AAOD,wBAA2E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-beta.
|
|
1
|
+
export declare const VERSION = "0.1.0-beta.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/session-replay-react-native",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
4
|
"description": "Amplitude Session Replay for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics",
|
|
@@ -63,10 +63,15 @@
|
|
|
63
63
|
},
|
|
64
64
|
"codegenConfig": {
|
|
65
65
|
"name": "AmpSessionReplaySpec",
|
|
66
|
-
"type": "
|
|
66
|
+
"type": "all",
|
|
67
67
|
"jsSrcsDir": "src/specs",
|
|
68
68
|
"android": {
|
|
69
69
|
"javaPackageName": "com.amplitude.sessionreplayreactnative"
|
|
70
|
+
},
|
|
71
|
+
"ios": {
|
|
72
|
+
"componentProvider": {
|
|
73
|
+
"AMPMaskComponentView": "AMPMaskComponentView"
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
},
|
|
72
77
|
"react-native-builder-bob": {
|
|
@@ -87,11 +92,11 @@
|
|
|
87
92
|
"build": "bob build",
|
|
88
93
|
"clean": "rimraf node_modules lib coverage",
|
|
89
94
|
"fix": "pnpm fix:eslint & pnpm fix:prettier",
|
|
90
|
-
"fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
|
|
91
|
-
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
|
|
95
|
+
"fix:eslint": "eslint '{src,test}/**/*.{ts,tsx}' --fix",
|
|
96
|
+
"fix:prettier": "prettier --write \"{src,test}/**/*.{ts,tsx}\"",
|
|
92
97
|
"lint": "pnpm lint:prettier && pnpm lint:eslint",
|
|
93
|
-
"lint:eslint": "eslint '{src,test}/**/*.ts'",
|
|
94
|
-
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
|
|
98
|
+
"lint:eslint": "eslint '{src,test}/**/*.{ts,tsx}'",
|
|
99
|
+
"lint:prettier": "prettier --check \"{src,test}/**/*.{ts,tsx}\"",
|
|
95
100
|
"test": "jest",
|
|
96
101
|
"typecheck": "tsc -p ./tsconfig.json --noEmit",
|
|
97
102
|
"version": "pnpm version-file && pnpm build",
|
package/src/amp-mask-view.tsx
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import NativeAmpMaskView from './specs/AmpMaskViewNativeComponent';
|
|
2
4
|
|
|
3
|
-
interface AmpMaskViewProps extends ViewProps {
|
|
5
|
+
export interface AmpMaskViewProps extends ViewProps {
|
|
4
6
|
mask: 'amp-mask' | 'amp-unmask' | 'amp-block';
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
|
|
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
|
+
export const AmpMaskView = NativeAmpMaskView as ComponentType<AmpMaskViewProps>;
|
package/src/index.tsx
CHANGED
|
@@ -13,4 +13,4 @@ export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './
|
|
|
13
13
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
|
14
14
|
export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
15
15
|
|
|
16
|
-
export { AmpMaskView } from './amp-mask-view';
|
|
16
|
+
export { AmpMaskView, type AmpMaskViewProps } from './amp-mask-view';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable import/namespace, import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type { WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
5
|
+
|
|
6
|
+
export interface NativeProps extends ViewProps {
|
|
7
|
+
// 'amp-mask' | 'amp-unmask' | 'amp-block' as a codegen-compatible string;
|
|
8
|
+
// unknown values fail safe to masking.
|
|
9
|
+
mask?: WithDefault<string, 'amp-mask'>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Same native name on both architectures: on the New Architecture this resolves
|
|
13
|
+
// to the Fabric AMPMaskComponentView (ios/fabric, android/src/newarch); on the
|
|
14
|
+
// old architecture codegenNativeComponent falls back to
|
|
15
|
+
// requireNativeComponent('AMPMaskComponentView'), which resolves to the
|
|
16
|
+
// unchanged legacy Paper view managers.
|
|
17
|
+
export default codegenNativeComponent<NativeProps>('AMPMaskComponentView');
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-beta.
|
|
1
|
+
export const VERSION = '0.1.0-beta.3';
|