@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
package/ios/fabric/SRMaskView.mm
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#import "SRMaskView.h"
|
|
2
|
-
|
|
3
|
-
#import "../SRMaskingPrimitive.h"
|
|
4
|
-
#import "../../cpp/SRMaskViewComponentDescriptor.h"
|
|
5
|
-
|
|
6
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
7
|
-
|
|
8
|
-
#import <React/RCTComponentViewFactory.h>
|
|
9
|
-
#import <react/renderer/components/AmpSessionReplaySpec/EventEmitters.h>
|
|
10
|
-
#import <react/renderer/components/AmpSessionReplaySpec/Props.h>
|
|
11
|
-
#import <react/renderer/components/AmpSessionReplaySpec/RCTComponentViewHelpers.h>
|
|
12
|
-
|
|
13
|
-
using namespace facebook::react;
|
|
14
|
-
|
|
15
|
-
@interface SRMaskView () <RCTSRMaskViewViewProtocol>
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
@implementation SRMaskView {
|
|
19
|
-
BOOL _enabled;
|
|
20
|
-
BOOL _unmask;
|
|
21
|
-
NSString *_maskLevel;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
+ (void)load
|
|
25
|
-
{
|
|
26
|
-
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:self];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
- (instancetype)initWithFrame:(CGRect)frame
|
|
30
|
-
{
|
|
31
|
-
if (self = [super initWithFrame:frame]) {
|
|
32
|
-
static const auto defaultProps = std::make_shared<const SRMaskViewProps>();
|
|
33
|
-
_props = defaultProps;
|
|
34
|
-
_enabled = YES;
|
|
35
|
-
_unmask = NO;
|
|
36
|
-
_maskLevel = @"mask";
|
|
37
|
-
self.clipsToBounds = NO;
|
|
38
|
-
}
|
|
39
|
-
return self;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
43
|
-
{
|
|
44
|
-
return concreteComponentDescriptorProvider<SRMaskViewComponentDescriptor>();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
48
|
-
{
|
|
49
|
-
const auto &newViewProps = *std::static_pointer_cast<const SRMaskViewProps>(props);
|
|
50
|
-
|
|
51
|
-
_enabled = newViewProps.enabled;
|
|
52
|
-
_unmask = newViewProps.unmask;
|
|
53
|
-
_maskLevel = [NSString stringWithUTF8String:newViewProps.maskLevel.c_str()];
|
|
54
|
-
|
|
55
|
-
[super updateProps:props oldProps:oldProps];
|
|
56
|
-
[self reapplyMaskingToAllChildren];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
60
|
-
{
|
|
61
|
-
[super mountChildComponentView:childComponentView index:index];
|
|
62
|
-
[self applyMaskingToChild:childComponentView];
|
|
63
|
-
[self expandFrameToChildrenUnion];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
67
|
-
{
|
|
68
|
-
[SRMaskingRegistry resetView:childComponentView];
|
|
69
|
-
[super unmountChildComponentView:childComponentView index:index];
|
|
70
|
-
[self expandFrameToChildrenUnion];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
- (void)prepareForRecycle
|
|
74
|
-
{
|
|
75
|
-
for (UIView *subview in self.subviews) {
|
|
76
|
-
[SRMaskingRegistry resetView:subview];
|
|
77
|
-
}
|
|
78
|
-
[super prepareForRecycle];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
- (void)reapplyMaskingToAllChildren
|
|
82
|
-
{
|
|
83
|
-
for (UIView *subview in self.subviews) {
|
|
84
|
-
[self applyMaskingToChild:subview];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
- (void)applyMaskingToChild:(UIView *)childView
|
|
89
|
-
{
|
|
90
|
-
if (!_enabled) {
|
|
91
|
-
[SRMaskingRegistry resetView:childView];
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (_unmask) {
|
|
96
|
-
[SRMaskingRegistry unmaskView:childView];
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
[SRMaskingRegistry maskView:childView level:_maskLevel ?: @"mask"];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
#pragma mark - Frame widening (accessibility)
|
|
104
|
-
|
|
105
|
-
// This host is intentionally zero-sized: its Yoga node is display:contents-style
|
|
106
|
-
// layout-transparent, so Fabric assigns it a degenerate (w=0,h=0) frame while the
|
|
107
|
-
// children keep real host-relative frames outside our bounds (clipsToBounds=NO).
|
|
108
|
-
// iOS's accessibility machinery prunes zero-sized views TOGETHER WITH their
|
|
109
|
-
// descendants, which made everything inside <AmpMask>/<AmpUnmask> invisible to
|
|
110
|
-
// VoiceOver/XCUITest/a11y tree dumps. Accessibility-only remedies do not work:
|
|
111
|
-
// overriding -accessibilityFrame and/or -accessibilityElements was verified
|
|
112
|
-
// ineffective on-device — the AX snapshot culls this host by its REAL frame
|
|
113
|
-
// before consulting either API. So mirror the Android fix (SRMaskView.kt
|
|
114
|
-
// expandBoundsToChildrenUnion): widen the host's real frame to enclose its
|
|
115
|
-
// children without ever moving its origin (children are host-relative; moving
|
|
116
|
-
// the origin would shift them on screen). Yoga layout is unaffected (UIKit
|
|
117
|
-
// frames never feed back into Fabric layout), and the widened frame cannot
|
|
118
|
-
// swallow touches because -hitTest:withEvent: below returns nil whenever the
|
|
119
|
-
// host itself would be the target (the iOS analogue of Android's BOX_NONE).
|
|
120
|
-
// Re-widen wherever the degenerate frame can be (re)applied or the children's
|
|
121
|
-
// extent can change: host layout metrics updates, child mount/unmount, and
|
|
122
|
-
// -layoutSubviews (UIKit marks the host as needing layout when a subview's
|
|
123
|
-
// frame changes, which covers child-only Fabric layout transactions).
|
|
124
|
-
- (void)expandFrameToChildrenUnion
|
|
125
|
-
{
|
|
126
|
-
if (self.subviews.count == 0) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
CGFloat maxChildRight = 0;
|
|
131
|
-
CGFloat maxChildBottom = 0;
|
|
132
|
-
for (UIView *child in self.subviews) {
|
|
133
|
-
maxChildRight = MAX(maxChildRight, CGRectGetMaxX(child.frame));
|
|
134
|
-
maxChildBottom = MAX(maxChildBottom, CGRectGetMaxY(child.frame));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Children are host-relative, so the enclosing size is just their max extent.
|
|
138
|
-
// Clamp to a 1pt minimum so a child at fully negative coordinates can never
|
|
139
|
-
// produce a degenerate frame that the accessibility traversal would prune.
|
|
140
|
-
CGSize newSize = CGSizeMake(MAX(maxChildRight, 1), MAX(maxChildBottom, 1));
|
|
141
|
-
CGRect frame = self.frame;
|
|
142
|
-
if (!CGSizeEqualToSize(frame.size, newSize)) {
|
|
143
|
-
frame.size = newSize;
|
|
144
|
-
self.frame = frame;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
|
149
|
-
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
|
150
|
-
{
|
|
151
|
-
// super re-applies the degenerate Fabric frame; widen right after.
|
|
152
|
-
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
153
|
-
[self expandFrameToChildrenUnion];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
- (void)layoutSubviews
|
|
157
|
-
{
|
|
158
|
-
[super layoutSubviews];
|
|
159
|
-
[self expandFrameToChildrenUnion];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
|
163
|
-
{
|
|
164
|
-
UIView *hitView = [super hitTest:point withEvent:event];
|
|
165
|
-
if (hitView == self) {
|
|
166
|
-
return nil;
|
|
167
|
-
}
|
|
168
|
-
return hitView;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@end
|
|
172
|
-
|
|
173
|
-
Class SRMaskViewCls(void)
|
|
174
|
-
{
|
|
175
|
-
return SRMaskView.class;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ampMaskViewMaskProp = ampMaskViewMaskProp;
|
|
7
|
-
/** Masking level for `<AmpMask>`. See {@link MaskProps.maskLevel}. */
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Props for `<AmpMask>`, which masks its children in Session Replay
|
|
11
|
-
* recordings without affecting their layout.
|
|
12
|
-
*
|
|
13
|
-
* `style` is not supported: the wrapper is layout-transparent and never
|
|
14
|
-
* carries a layout box of its own, so styles would have no effect.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Props for `<AmpUnmask>`, which exempts its children from masking inside a
|
|
19
|
-
* masked region, without affecting their layout.
|
|
20
|
-
*
|
|
21
|
-
* `style` is not supported: the wrapper is layout-transparent and never
|
|
22
|
-
* carries a layout box of its own, so styles would have no effect.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/** Maps the public {@link AmpMaskLevel} to the `<AmpMaskView>` `mask` prop value. */
|
|
26
|
-
function ampMaskViewMaskProp(level) {
|
|
27
|
-
return level === 'block' ? 'amp-block' : 'amp-mask';
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=Mask.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ampMaskViewMaskProp","level"],"sourceRoot":"../../src","sources":["Mask.types.ts"],"mappings":";;;;;;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACO,SAASA,mBAAmBA,CAACC,KAAoB,EAA4B;EAClF,OAAOA,KAAK,KAAK,OAAO,GAAG,WAAW,GAAG,UAAU;AACrD","ignoreList":[]}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AmpUnmask = exports.AmpMask = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _SRMaskViewNativeComponent = _interopRequireDefault(require("../specs/SRMaskViewNativeComponent"));
|
|
10
|
-
var _maskFallback = require("../mask-fallback");
|
|
11
|
-
var _UIManager$hasViewMan, _UIManager$hasViewMan2, _TurboModuleRegistry$;
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
-
// Three-tier fail-closed probe. We never fall open (unmasked) unless the
|
|
15
|
-
// package's native code is entirely absent — i.e. the recorder itself cannot
|
|
16
|
-
// run and nothing can be captured:
|
|
17
|
-
// 1. SRMaskView registered -> use it directly, layout-transparent.
|
|
18
|
-
// 2. Only the Paper AMPMaskComponentView registered (Fabric sources not
|
|
19
|
-
// built) -> render through <AmpMaskView>: masked, layout-unsafe.
|
|
20
|
-
// 3. Neither registered -> behavior depends on RECORDER_PRESENT below.
|
|
21
|
-
const FABRIC_AVAILABLE = ((_UIManager$hasViewMan = _reactNative.UIManager.hasViewManagerConfig) === null || _UIManager$hasViewMan === void 0 ? void 0 : _UIManager$hasViewMan.call(_reactNative.UIManager, 'SRMaskView')) ?? false;
|
|
22
|
-
const PAPER_MASK_AVAILABLE = ((_UIManager$hasViewMan2 = _reactNative.UIManager.hasViewManagerConfig) === null || _UIManager$hasViewMan2 === void 0 ? void 0 : _UIManager$hasViewMan2.call(_reactNative.UIManager, 'AMPMaskComponentView')) ?? false;
|
|
23
|
-
// Whether the Session Replay native module is linked. Must be resolved the
|
|
24
|
-
// same way src/native-module.ts resolves it (TurboModuleRegistry.get, then the
|
|
25
|
-
// legacy NativeModules interop proxy) so this gate can never disagree with the
|
|
26
|
-
// recorder's actual availability.
|
|
27
|
-
const RECORDER_PRESENT = ((_reactNative.TurboModuleRegistry === null || _reactNative.TurboModuleRegistry === void 0 || (_TurboModuleRegistry$ = _reactNative.TurboModuleRegistry.get) === null || _TurboModuleRegistry$ === void 0 ? void 0 : _TurboModuleRegistry$.call(_reactNative.TurboModuleRegistry, 'AMPNativeSessionReplay')) ?? (_reactNative.NativeModules === null || _reactNative.NativeModules === void 0 ? void 0 : _reactNative.NativeModules.AMPNativeSessionReplay)) != null;
|
|
28
|
-
const contents = {
|
|
29
|
-
display: 'contents'
|
|
30
|
-
}; // zero-box hint; C++ adopt() is authoritative
|
|
31
|
-
|
|
32
|
-
function MaskImpl({
|
|
33
|
-
enabled = true,
|
|
34
|
-
maskLevel = 'mask',
|
|
35
|
-
children,
|
|
36
|
-
...vp
|
|
37
|
-
}) {
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement(_SRMaskViewNativeComponent.default, _extends({}, vp, {
|
|
39
|
-
enabled: enabled,
|
|
40
|
-
unmask: false,
|
|
41
|
-
maskLevel: maskLevel,
|
|
42
|
-
style: contents
|
|
43
|
-
}), children);
|
|
44
|
-
}
|
|
45
|
-
function UnmaskImpl({
|
|
46
|
-
children,
|
|
47
|
-
...vp
|
|
48
|
-
}) {
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_SRMaskViewNativeComponent.default, _extends({}, vp, {
|
|
50
|
-
enabled: true,
|
|
51
|
-
unmask: true,
|
|
52
|
-
maskLevel: "mask",
|
|
53
|
-
style: contents
|
|
54
|
-
}), children);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Tier 2: masked but not layout-transparent. `enabled` is intentionally
|
|
58
|
-
// ignored (over-mask), matching the Old-Arch prod fallback in MaskPaper.
|
|
59
|
-
const FALLBACK_WARNING = '[AmpMask] New Architecture detected but the native SRMaskView component is unavailable — falling back to <AmpMaskView> (content stays MASKED but layout transparency is lost). Verify the Fabric masking sources were built (new architecture + RN >= 0.77) and codegen ran. Note: Fabric without bridgeless (bridge mode) cannot detect SRMaskView on iOS and always uses this fallback.';
|
|
60
|
-
const FallbackMask = (0, _maskFallback.createAmpMaskViewFallback)({
|
|
61
|
-
mask: 'from-maskLevel',
|
|
62
|
-
warning: FALLBACK_WARNING
|
|
63
|
-
});
|
|
64
|
-
const FallbackUnmask = (0, _maskFallback.createAmpMaskViewFallback)({
|
|
65
|
-
mask: 'amp-unmask',
|
|
66
|
-
warning: FALLBACK_WARNING
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Tier 3: no masking-capable native view exists, so children render directly.
|
|
70
|
-
// Safe only when the recorder is absent too (nothing can be captured); when
|
|
71
|
-
// the recorder IS present this is a build error we must not infer our way
|
|
72
|
-
// past — throw in dev, warn loudly in prod.
|
|
73
|
-
const UNMASKED_WARNING = '[AmpMask] New Architecture detected but the native SRMaskView component is unavailable — <AmpMask>/<AmpUnmask> render children UNMASKED. Verify the Fabric masking sources were built (new architecture + RN >= 0.77) and codegen ran.';
|
|
74
|
-
const UNMASKABLE_MSG = '<AmpMask> cannot mask: the Session Replay native module is present but neither SRMaskView nor AMPMaskComponentView is registered. Fix the build before shipping.';
|
|
75
|
-
const UNMASKABLE_WARNING = '[AmpMask] The Session Replay native module is present but neither SRMaskView nor AMPMaskComponentView is registered — <AmpMask>/<AmpUnmask> render children UNMASKED. This is a build error (not an expected environment) — fix the build before shipping.';
|
|
76
|
-
function createPassthrough(warning, devThrowMessage) {
|
|
77
|
-
return function PassthroughChildren({
|
|
78
|
-
children
|
|
79
|
-
}) {
|
|
80
|
-
if (devThrowMessage !== undefined && __DEV__) {
|
|
81
|
-
throw new Error(devThrowMessage);
|
|
82
|
-
}
|
|
83
|
-
(0, _maskFallback.warnOnce)(warning);
|
|
84
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const Passthrough = createPassthrough(UNMASKED_WARNING);
|
|
88
|
-
const UnmaskableGuard = createPassthrough(UNMASKABLE_WARNING, UNMASKABLE_MSG);
|
|
89
|
-
const NeitherAvailable = RECORDER_PRESENT ? UnmaskableGuard : Passthrough;
|
|
90
|
-
const AmpMask = exports.AmpMask = FABRIC_AVAILABLE ? MaskImpl : PAPER_MASK_AVAILABLE ? FallbackMask : NeitherAvailable;
|
|
91
|
-
const AmpUnmask = exports.AmpUnmask = FABRIC_AVAILABLE ? UnmaskImpl : PAPER_MASK_AVAILABLE ? FallbackUnmask : NeitherAvailable;
|
|
92
|
-
//# sourceMappingURL=MaskFabric.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_SRMaskViewNativeComponent","_maskFallback","_UIManager$hasViewMan","_UIManager$hasViewMan2","_TurboModuleRegistry$","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","FABRIC_AVAILABLE","UIManager","hasViewManagerConfig","PAPER_MASK_AVAILABLE","RECORDER_PRESENT","TurboModuleRegistry","get","NativeModules","AMPNativeSessionReplay","contents","display","MaskImpl","enabled","maskLevel","children","vp","createElement","unmask","style","UnmaskImpl","FALLBACK_WARNING","FallbackMask","createAmpMaskViewFallback","mask","warning","FallbackUnmask","UNMASKED_WARNING","UNMASKABLE_MSG","UNMASKABLE_WARNING","createPassthrough","devThrowMessage","PassthroughChildren","undefined","__DEV__","Error","warnOnce","Fragment","Passthrough","UnmaskableGuard","NeitherAvailable","AmpMask","exports","AmpUnmask"],"sourceRoot":"../../../src","sources":["fabric/MaskFabric.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAAuE,IAAAI,qBAAA,EAAAC,sBAAA,EAAAC,qBAAA;AAAA,SAAAP,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CA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GxC,gBAAgB,GAAGW,QAAQ,GAAGR,oBAAoB,GAAGkB,YAAY,GAAGkB,gBAAgB;AACpG,MAAMG,SAAS,GAAAD,OAAA,CAAAC,SAAA,GAAG1C,gBAAgB,GAAGmB,UAAU,GAAGhB,oBAAoB,GAAGsB,cAAc,GAAGc,gBAAgB","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createAmpMaskViewFallback = createAmpMaskViewFallback;
|
|
7
|
-
exports.warnOnce = warnOnce;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _ampMaskView = require("./amp-mask-view");
|
|
10
|
-
var _Mask = require("./Mask.types");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
-
let warned = false;
|
|
14
|
-
|
|
15
|
-
/** Logs at most one degraded-masking error per app session, across all fallback paths. */
|
|
16
|
-
function warnOnce(message) {
|
|
17
|
-
if (!warned) {
|
|
18
|
-
warned = true;
|
|
19
|
-
console.error(message);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Builds an `<AmpMask>`/`<AmpUnmask>` stand-in that renders through the Paper
|
|
24
|
-
* `<AmpMaskView>`: privacy-safe (content stays masked) but not
|
|
25
|
-
* layout-transparent. Used when the Fabric `SRMaskView` isn't available —
|
|
26
|
-
* Old-Architecture apps and New-Architecture build misconfigurations.
|
|
27
|
-
*
|
|
28
|
-
* Fail-closed rules, enforced at runtime because untyped callers can spread
|
|
29
|
-
* arbitrary props even though the public types omit them:
|
|
30
|
-
* `style`/`enabled`/`mask` are stripped, and the forced `mask` value is
|
|
31
|
-
* applied after the caller's props so it can never be overridden.
|
|
32
|
-
*/
|
|
33
|
-
function createAmpMaskViewFallback(options) {
|
|
34
|
-
return function AmpMaskViewFallback(props) {
|
|
35
|
-
if (options.devThrowMessage !== undefined && __DEV__) {
|
|
36
|
-
throw new Error(options.devThrowMessage);
|
|
37
|
-
}
|
|
38
|
-
warnOnce(options.warning);
|
|
39
|
-
const {
|
|
40
|
-
children,
|
|
41
|
-
maskLevel,
|
|
42
|
-
style: _style,
|
|
43
|
-
enabled: _enabled,
|
|
44
|
-
mask: _mask,
|
|
45
|
-
...safeProps
|
|
46
|
-
} = props;
|
|
47
|
-
const mask = options.mask === 'amp-unmask' ? 'amp-unmask' : (0, _Mask.ampMaskViewMaskProp)(maskLevel);
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_ampMaskView.AmpMaskView, _extends({}, safeProps, {
|
|
49
|
-
mask: mask
|
|
50
|
-
}), children);
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=mask-fallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_ampMaskView","_Mask","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","warned","warnOnce","message","console","error","createAmpMaskViewFallback","options","AmpMaskViewFallback","props","devThrowMessage","undefined","__DEV__","Error","warning","children","maskLevel","style","_style","enabled","_enabled","mask","_mask","safeProps","ampMaskViewMaskProp","createElement","AmpMaskView"],"sourceRoot":"../../src","sources":["mask-fallback.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAmD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,K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,aAAA,CAACzC,YAAA,CAAA0C,WAAW,EAAArC,QAAA,KAAKkC,SAAS;MAAEF,IAAI,EAAEA;IAAK,IACpCN,QACU,CAAC;EAElB,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AmpUnmask = exports.AmpMask = void 0;
|
|
7
|
-
var _maskFallback = require("../mask-fallback");
|
|
8
|
-
const MSG = '<AmpMask> requires the New Architecture. Use <AmpMaskView> on the Old Architecture.';
|
|
9
|
-
const WARNING = '[AmpMask] Old Architecture detected — falling back to AmpMaskView (layout-unsafe). Use <AmpMaskView> on Old Arch.';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Old-Architecture guard: dev builds throw (the developer is using an
|
|
13
|
-
* unsupported component); production falls back to `<AmpMaskView>` —
|
|
14
|
-
* privacy-safe but layout-unsafe. `enabled` is ignored: the fallback fails
|
|
15
|
-
* toward privacy.
|
|
16
|
-
*/
|
|
17
|
-
const AmpMask = exports.AmpMask = (0, _maskFallback.createAmpMaskViewFallback)({
|
|
18
|
-
mask: 'from-maskLevel',
|
|
19
|
-
warning: WARNING,
|
|
20
|
-
devThrowMessage: MSG
|
|
21
|
-
});
|
|
22
|
-
const AmpUnmask = exports.AmpUnmask = (0, _maskFallback.createAmpMaskViewFallback)({
|
|
23
|
-
mask: 'amp-unmask',
|
|
24
|
-
warning: WARNING,
|
|
25
|
-
devThrowMessage: MSG
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=MaskPaper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_maskFallback","require","MSG","WARNING","AmpMask","exports","createAmpMaskViewFallback","mask","warning","devThrowMessage","AmpUnmask"],"sourceRoot":"../../../src","sources":["paper/MaskPaper.tsx"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGA,MAAMC,GAAG,GAAG,qFAAqF;AACjG,MAAMC,OAAO,GACX,mHAAmH;;AAErH;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,IAAAE,uCAAyB,EAAY;EAC1DC,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEL,OAAO;EAChBM,eAAe,EAAEP;AACnB,CAAC,CAAC;AAEK,MAAMQ,SAAS,GAAAL,OAAA,CAAAK,SAAA,GAAG,IAAAJ,uCAAyB,EAAc;EAC9DC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEL,OAAO;EAChBM,eAAe,EAAEP;AACnB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/SRMaskViewNativeComponent.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;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAWe,IAAAG,+BAAsB,EAAc,YAAY,CAAC","ignoreList":[]}
|
package/lib/module/Mask.types.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** Masking level for `<AmpMask>`. See {@link MaskProps.maskLevel}. */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Props for `<AmpMask>`, which masks its children in Session Replay
|
|
5
|
-
* recordings without affecting their layout.
|
|
6
|
-
*
|
|
7
|
-
* `style` is not supported: the wrapper is layout-transparent and never
|
|
8
|
-
* carries a layout box of its own, so styles would have no effect.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Props for `<AmpUnmask>`, which exempts its children from masking inside a
|
|
13
|
-
* masked region, without affecting their layout.
|
|
14
|
-
*
|
|
15
|
-
* `style` is not supported: the wrapper is layout-transparent and never
|
|
16
|
-
* carries a layout box of its own, so styles would have no effect.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/** Maps the public {@link AmpMaskLevel} to the `<AmpMaskView>` `mask` prop value. */
|
|
20
|
-
export function ampMaskViewMaskProp(level) {
|
|
21
|
-
return level === 'block' ? 'amp-block' : 'amp-mask';
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=Mask.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ampMaskViewMaskProp","level"],"sourceRoot":"../../src","sources":["Mask.types.ts"],"mappings":"AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,OAAO,SAASA,mBAAmBA,CAACC,KAAoB,EAA4B;EAClF,OAAOA,KAAK,KAAK,OAAO,GAAG,WAAW,GAAG,UAAU;AACrD","ignoreList":[]}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
var _UIManager$hasViewMan, _UIManager$hasViewMan2, _TurboModuleRegistry$;
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { NativeModules, TurboModuleRegistry, UIManager } from 'react-native';
|
|
5
|
-
import SRMaskViewNative from '../specs/SRMaskViewNativeComponent';
|
|
6
|
-
import { createAmpMaskViewFallback, warnOnce } from '../mask-fallback';
|
|
7
|
-
// Three-tier fail-closed probe. We never fall open (unmasked) unless the
|
|
8
|
-
// package's native code is entirely absent — i.e. the recorder itself cannot
|
|
9
|
-
// run and nothing can be captured:
|
|
10
|
-
// 1. SRMaskView registered -> use it directly, layout-transparent.
|
|
11
|
-
// 2. Only the Paper AMPMaskComponentView registered (Fabric sources not
|
|
12
|
-
// built) -> render through <AmpMaskView>: masked, layout-unsafe.
|
|
13
|
-
// 3. Neither registered -> behavior depends on RECORDER_PRESENT below.
|
|
14
|
-
const FABRIC_AVAILABLE = ((_UIManager$hasViewMan = UIManager.hasViewManagerConfig) === null || _UIManager$hasViewMan === void 0 ? void 0 : _UIManager$hasViewMan.call(UIManager, 'SRMaskView')) ?? false;
|
|
15
|
-
const PAPER_MASK_AVAILABLE = ((_UIManager$hasViewMan2 = UIManager.hasViewManagerConfig) === null || _UIManager$hasViewMan2 === void 0 ? void 0 : _UIManager$hasViewMan2.call(UIManager, 'AMPMaskComponentView')) ?? false;
|
|
16
|
-
// Whether the Session Replay native module is linked. Must be resolved the
|
|
17
|
-
// same way src/native-module.ts resolves it (TurboModuleRegistry.get, then the
|
|
18
|
-
// legacy NativeModules interop proxy) so this gate can never disagree with the
|
|
19
|
-
// recorder's actual availability.
|
|
20
|
-
const RECORDER_PRESENT = ((TurboModuleRegistry === null || TurboModuleRegistry === void 0 || (_TurboModuleRegistry$ = TurboModuleRegistry.get) === null || _TurboModuleRegistry$ === void 0 ? void 0 : _TurboModuleRegistry$.call(TurboModuleRegistry, 'AMPNativeSessionReplay')) ?? (NativeModules === null || NativeModules === void 0 ? void 0 : NativeModules.AMPNativeSessionReplay)) != null;
|
|
21
|
-
const contents = {
|
|
22
|
-
display: 'contents'
|
|
23
|
-
}; // zero-box hint; C++ adopt() is authoritative
|
|
24
|
-
|
|
25
|
-
function MaskImpl({
|
|
26
|
-
enabled = true,
|
|
27
|
-
maskLevel = 'mask',
|
|
28
|
-
children,
|
|
29
|
-
...vp
|
|
30
|
-
}) {
|
|
31
|
-
return /*#__PURE__*/React.createElement(SRMaskViewNative, _extends({}, vp, {
|
|
32
|
-
enabled: enabled,
|
|
33
|
-
unmask: false,
|
|
34
|
-
maskLevel: maskLevel,
|
|
35
|
-
style: contents
|
|
36
|
-
}), children);
|
|
37
|
-
}
|
|
38
|
-
function UnmaskImpl({
|
|
39
|
-
children,
|
|
40
|
-
...vp
|
|
41
|
-
}) {
|
|
42
|
-
return /*#__PURE__*/React.createElement(SRMaskViewNative, _extends({}, vp, {
|
|
43
|
-
enabled: true,
|
|
44
|
-
unmask: true,
|
|
45
|
-
maskLevel: "mask",
|
|
46
|
-
style: contents
|
|
47
|
-
}), children);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Tier 2: masked but not layout-transparent. `enabled` is intentionally
|
|
51
|
-
// ignored (over-mask), matching the Old-Arch prod fallback in MaskPaper.
|
|
52
|
-
const FALLBACK_WARNING = '[AmpMask] New Architecture detected but the native SRMaskView component is unavailable — falling back to <AmpMaskView> (content stays MASKED but layout transparency is lost). Verify the Fabric masking sources were built (new architecture + RN >= 0.77) and codegen ran. Note: Fabric without bridgeless (bridge mode) cannot detect SRMaskView on iOS and always uses this fallback.';
|
|
53
|
-
const FallbackMask = createAmpMaskViewFallback({
|
|
54
|
-
mask: 'from-maskLevel',
|
|
55
|
-
warning: FALLBACK_WARNING
|
|
56
|
-
});
|
|
57
|
-
const FallbackUnmask = createAmpMaskViewFallback({
|
|
58
|
-
mask: 'amp-unmask',
|
|
59
|
-
warning: FALLBACK_WARNING
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Tier 3: no masking-capable native view exists, so children render directly.
|
|
63
|
-
// Safe only when the recorder is absent too (nothing can be captured); when
|
|
64
|
-
// the recorder IS present this is a build error we must not infer our way
|
|
65
|
-
// past — throw in dev, warn loudly in prod.
|
|
66
|
-
const UNMASKED_WARNING = '[AmpMask] New Architecture detected but the native SRMaskView component is unavailable — <AmpMask>/<AmpUnmask> render children UNMASKED. Verify the Fabric masking sources were built (new architecture + RN >= 0.77) and codegen ran.';
|
|
67
|
-
const UNMASKABLE_MSG = '<AmpMask> cannot mask: the Session Replay native module is present but neither SRMaskView nor AMPMaskComponentView is registered. Fix the build before shipping.';
|
|
68
|
-
const UNMASKABLE_WARNING = '[AmpMask] The Session Replay native module is present but neither SRMaskView nor AMPMaskComponentView is registered — <AmpMask>/<AmpUnmask> render children UNMASKED. This is a build error (not an expected environment) — fix the build before shipping.';
|
|
69
|
-
function createPassthrough(warning, devThrowMessage) {
|
|
70
|
-
return function PassthroughChildren({
|
|
71
|
-
children
|
|
72
|
-
}) {
|
|
73
|
-
if (devThrowMessage !== undefined && __DEV__) {
|
|
74
|
-
throw new Error(devThrowMessage);
|
|
75
|
-
}
|
|
76
|
-
warnOnce(warning);
|
|
77
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
const Passthrough = createPassthrough(UNMASKED_WARNING);
|
|
81
|
-
const UnmaskableGuard = createPassthrough(UNMASKABLE_WARNING, UNMASKABLE_MSG);
|
|
82
|
-
const NeitherAvailable = RECORDER_PRESENT ? UnmaskableGuard : Passthrough;
|
|
83
|
-
export const AmpMask = FABRIC_AVAILABLE ? MaskImpl : PAPER_MASK_AVAILABLE ? FallbackMask : NeitherAvailable;
|
|
84
|
-
export const AmpUnmask = FABRIC_AVAILABLE ? UnmaskImpl : PAPER_MASK_AVAILABLE ? FallbackUnmask : NeitherAvailable;
|
|
85
|
-
//# sourceMappingURL=MaskFabric.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","NativeModules","TurboModuleRegistry","UIManager","SRMaskViewNative","createAmpMaskViewFallback","warnOnce","FABRIC_AVAILABLE","_UIManager$hasViewMan","hasViewManagerConfig","call","PAPER_MASK_AVAILABLE","_UIManager$hasViewMan2","RECORDER_PRESENT","_TurboModuleRegistry$","get","AMPNativeSessionReplay","contents","display","MaskImpl","enabled","maskLevel","children","vp","createElement","_extends","unmask","style","UnmaskImpl","FALLBACK_WARNING","FallbackMask","mask","warning","FallbackUnmask","UNMASKED_WARNING","UNMASKABLE_MSG","UNMASKABLE_WARNING","createPassthrough","devThrowMessage","PassthroughChildren","undefined","__DEV__","Error","Fragment","Passthrough","UnmaskableGuard","NeitherAvailable","AmpMask","AmpUnmask"],"sourceRoot":"../../../src","sources":["fabric/MaskFabric.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,EAAEC,mBAAmB,EAAEC,SAAS,QAAQ,cAAc;AAC5E,OAAOC,gBAAgB,MAAM,oCAAoC;AACjE,SAASC,yBAAyB,EAAEC,QAAQ,QAAQ,kBAAkB;AAGtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,EAAAC,qBAAA,GAAAL,SAAS,CAACM,oBAAoB,cAAAD,qBAAA,uBAA9BA,qBAAA,CAAAE,IAAA,CAAAP,SAAS,EAAwB,YAAY,CAAC,KAAI,KAAK;AAChF,MAAMQ,oBAAoB,GAAG,EAAAC,sBAAA,GAAAT,SAAS,CAACM,oBAAoB,cAAAG,sBAAA,uBAA9BA,sBAAA,CAAAF,IAAA,CAAAP,SAAS,EAAwB,sBAAsB,CAAC,KAAI,KAAK;AAC9F;AACA;AACA;AACA;AACA,MAAMU,gBAAgB,GACpB,CAAC,CAAAX,mBAAmB,aAAnBA,mBAAmB,gBAAAY,qBAAA,GAAnBZ,mBAAmB,CAAEa,GAAG,cAAAD,qBAAA,uBAAxBA,qBAAA,CAAAJ,IAAA,CAAAR,mBAAmB,EAAQ,wBAAwB,CAAC,MAAID,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEe,sBAAsB,MAAK,IAAI;AAEzG,MAAMC,QAAQ,GAAG;EAAEC,OAAO,EAAE;AAAgC,CAAC,CAAC,CAAC;;AAE/D,SAASC,QAAQA,CAAC;EAAEC,OAAO,GAAG,IAAI;EAAEC,SAAS,GAAG,MAAM;EAAEC,QAAQ;EAAE,GAAGC;AAAc,CAAC,EAAE;EACpF,oBACEvB,KAAA,CAAAwB,aAAA,CAACpB,gBAAgB,EAAA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AGR,iBAAiB,CAACD,kBAAkB,EAAED,cAAc,CAAC;AAE7E,MAAMW,gBAAgB,GAAGjC,gBAAgB,GAAGgC,eAAe,GAAGD,WAAW;AAEzE,OAAO,MAAMG,OAAO,GAAGxC,gBAAgB,GAAGY,QAAQ,GAAGR,oBAAoB,GAAGmB,YAAY,GAAGgB,gBAAgB;AAC3G,OAAO,MAAME,SAAS,GAAGzC,gBAAgB,GAAGqB,UAAU,GAAGjB,oBAAoB,GAAGsB,cAAc,GAAGa,gBAAgB","ignoreList":[]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AmpMaskView } from './amp-mask-view';
|
|
4
|
-
import { ampMaskViewMaskProp } from './Mask.types';
|
|
5
|
-
let warned = false;
|
|
6
|
-
|
|
7
|
-
/** Logs at most one degraded-masking error per app session, across all fallback paths. */
|
|
8
|
-
export function warnOnce(message) {
|
|
9
|
-
if (!warned) {
|
|
10
|
-
warned = true;
|
|
11
|
-
console.error(message);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Builds an `<AmpMask>`/`<AmpUnmask>` stand-in that renders through the Paper
|
|
16
|
-
* `<AmpMaskView>`: privacy-safe (content stays masked) but not
|
|
17
|
-
* layout-transparent. Used when the Fabric `SRMaskView` isn't available —
|
|
18
|
-
* Old-Architecture apps and New-Architecture build misconfigurations.
|
|
19
|
-
*
|
|
20
|
-
* Fail-closed rules, enforced at runtime because untyped callers can spread
|
|
21
|
-
* arbitrary props even though the public types omit them:
|
|
22
|
-
* `style`/`enabled`/`mask` are stripped, and the forced `mask` value is
|
|
23
|
-
* applied after the caller's props so it can never be overridden.
|
|
24
|
-
*/
|
|
25
|
-
export function createAmpMaskViewFallback(options) {
|
|
26
|
-
return function AmpMaskViewFallback(props) {
|
|
27
|
-
if (options.devThrowMessage !== undefined && __DEV__) {
|
|
28
|
-
throw new Error(options.devThrowMessage);
|
|
29
|
-
}
|
|
30
|
-
warnOnce(options.warning);
|
|
31
|
-
const {
|
|
32
|
-
children,
|
|
33
|
-
maskLevel,
|
|
34
|
-
style: _style,
|
|
35
|
-
enabled: _enabled,
|
|
36
|
-
mask: _mask,
|
|
37
|
-
...safeProps
|
|
38
|
-
} = props;
|
|
39
|
-
const mask = options.mask === 'amp-unmask' ? 'amp-unmask' : ampMaskViewMaskProp(maskLevel);
|
|
40
|
-
return /*#__PURE__*/React.createElement(AmpMaskView, _extends({}, safeProps, {
|
|
41
|
-
mask: mask
|
|
42
|
-
}), children);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=mask-fallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","AmpMaskView","ampMaskViewMaskProp","warned","warnOnce","message","console","error","createAmpMaskViewFallback","options","AmpMaskViewFallback","props","devThrowMessage","undefined","__DEV__","Error","warning","children","maskLevel","style","_style","enabled","_enabled","mask","_mask","safeProps","createElement","_extends"],"sourceRoot":"../../src","sources":["mask-fallback.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,mBAAmB,QAAQ,cAAc;AAGlD,IAAIC,MAAM,GAAG,KAAK;;AAElB;AACA,OAAO,SAASC,QAAQA,CAACC,OAAe,EAAE;EACxC,IAAI,CAACF,MAAM,EAAE;IACXA,MAAM,GAAG,IAAI;IACbG,OAAO,CAACC,KAAK,CAACF,OAAO,CAAC;EACxB;AACF;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,yBAAyBA,CACvCC,OAAwB,EACI;EAC5B,OAAO,SAASC,mBAAmBA,CAACC,KAAQ,EAAE;IAC5C,IAAIF,OAAO,CAACG,eAAe,KAAKC,SAAS,IAAIC,OAAO,EAAE;MACpD,MAAM,IAAIC,KAAK,CAACN,OAAO,CAACG,eAAe,CAAC;IAC1C;IACAR,QAAQ,CAACK,OAAO,CAACO,OAAO,CAAC;IACzB,MAAM;MACJC,QAAQ;MACRC,SAAS;MACTC,KAAK,EAAEC,MAAM;MACbC,OAAO,EAAEC,QAAQ;MACjBC,IAAI,EAAEC,KAAK;MACX,GAAGC;IACL,CAAC,GAAGd,KAA6F;IACjG,MAAMY,IAAI,GAAGd,OAAO,CAACc,IAAI,KAAK,YAAY,GAAG,YAAY,GAAGrB,mBAAmB,CAACgB,SAAS,CAAC;IAC1F,oBACElB,KAAA,CAAA0B,aAAA,CAACzB,WAAW,EAAA0B,QAAA,KAAKF,SAAS;MAAEF,IAAI,EAAEA;IAAK,IACpCN,QACU,CAAC;EAElB,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createAmpMaskViewFallback } from '../mask-fallback';
|
|
2
|
-
const MSG = '<AmpMask> requires the New Architecture. Use <AmpMaskView> on the Old Architecture.';
|
|
3
|
-
const WARNING = '[AmpMask] Old Architecture detected — falling back to AmpMaskView (layout-unsafe). Use <AmpMaskView> on Old Arch.';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Old-Architecture guard: dev builds throw (the developer is using an
|
|
7
|
-
* unsupported component); production falls back to `<AmpMaskView>` —
|
|
8
|
-
* privacy-safe but layout-unsafe. `enabled` is ignored: the fallback fails
|
|
9
|
-
* toward privacy.
|
|
10
|
-
*/
|
|
11
|
-
export const AmpMask = createAmpMaskViewFallback({
|
|
12
|
-
mask: 'from-maskLevel',
|
|
13
|
-
warning: WARNING,
|
|
14
|
-
devThrowMessage: MSG
|
|
15
|
-
});
|
|
16
|
-
export const AmpUnmask = createAmpMaskViewFallback({
|
|
17
|
-
mask: 'amp-unmask',
|
|
18
|
-
warning: WARNING,
|
|
19
|
-
devThrowMessage: MSG
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=MaskPaper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createAmpMaskViewFallback","MSG","WARNING","AmpMask","mask","warning","devThrowMessage","AmpUnmask"],"sourceRoot":"../../../src","sources":["paper/MaskPaper.tsx"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,kBAAkB;AAG5D,MAAMC,GAAG,GAAG,qFAAqF;AACjG,MAAMC,OAAO,GACX,mHAAmH;;AAErH;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAGH,yBAAyB,CAAY;EAC1DI,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEH,OAAO;EAChBI,eAAe,EAAEL;AACnB,CAAC,CAAC;AAEF,OAAO,MAAMM,SAAS,GAAGP,yBAAyB,CAAc;EAC9DI,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAEH,OAAO;EAChBI,eAAe,EAAEL;AACnB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +0,0 @@
|
|
|
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
|
-
export default codegenNativeComponent('SRMaskView');
|
|
5
|
-
//# sourceMappingURL=SRMaskViewNativeComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/SRMaskViewNativeComponent.ts"],"mappings":"AAAA;;AAGA,OAAOA,sBAAsB,MAAM,yDAAyD;AAQ5F,eAAeA,sBAAsB,CAAc,YAAY,CAAC","ignoreList":[]}
|