rampkit-expo-dev 0.0.39 → 0.0.40
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/build/RampkitOverlay.js +266 -296
- package/package.json +1 -1
package/build/RampkitOverlay.js
CHANGED
|
@@ -432,14 +432,9 @@ function Overlay(props) {
|
|
|
432
432
|
const [onboardingCompleted, setOnboardingCompleted] = (0, react_1.useState)(false);
|
|
433
433
|
const overlayOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
434
434
|
const fadeOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
435
|
-
// slideFade animation values
|
|
436
|
-
const
|
|
437
|
-
const
|
|
438
|
-
const slideFadeIncomingOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
439
|
-
const slideFadeIncomingTranslateX = (0, react_1.useRef)(new react_native_1.Animated.Value(SLIDE_FADE_OFFSET)).current;
|
|
440
|
-
const [slideFadeActive, setSlideFadeActive] = (0, react_1.useState)(false);
|
|
441
|
-
const [slideFadeOutgoingIndex, setSlideFadeOutgoingIndex] = (0, react_1.useState)(null);
|
|
442
|
-
const [slideFadeIncomingIndex, setSlideFadeIncomingIndex] = (0, react_1.useState)(null);
|
|
435
|
+
// slideFade animation values - animates the PagerView container
|
|
436
|
+
const pagerOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
|
|
437
|
+
const pagerTranslateX = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
443
438
|
const allLoaded = loadedCount >= props.screens.length;
|
|
444
439
|
const hasTrackedInitialScreen = (0, react_1.useRef)(false);
|
|
445
440
|
// shared vars across all webviews
|
|
@@ -521,68 +516,55 @@ function Overlay(props) {
|
|
|
521
516
|
});
|
|
522
517
|
return;
|
|
523
518
|
}
|
|
524
|
-
// slideFade animation:
|
|
525
|
-
//
|
|
519
|
+
// slideFade animation: smooth slide + fade transition
|
|
520
|
+
// Animates the PagerView container out, switches page, then animates back in
|
|
526
521
|
if (animationType === "slidefade") {
|
|
527
522
|
setIsTransitioning(true);
|
|
528
523
|
// Determine direction: forward (nextIndex > index) or backward
|
|
529
524
|
const isForward = nextIndex > index;
|
|
530
525
|
const direction = isForward ? 1 : -1;
|
|
531
|
-
|
|
532
|
-
setSlideFadeOutgoingIndex(index);
|
|
533
|
-
setSlideFadeIncomingIndex(nextIndex);
|
|
534
|
-
// Set initial positions for the animation
|
|
535
|
-
// Outgoing: starts visible at position 0
|
|
536
|
-
slideFadeOutgoingOpacity.setValue(1);
|
|
537
|
-
slideFadeOutgoingTranslateX.setValue(0);
|
|
538
|
-
// Incoming: starts invisible, offset in the direction we're navigating
|
|
539
|
-
slideFadeIncomingOpacity.setValue(0);
|
|
540
|
-
slideFadeIncomingTranslateX.setValue(SLIDE_FADE_OFFSET * direction);
|
|
541
|
-
// Activate the slideFade overlay
|
|
542
|
-
setSlideFadeActive(true);
|
|
543
|
-
// Switch the underlying PagerView immediately (without animation)
|
|
544
|
-
// so when the overlay fades away, the correct page is underneath
|
|
545
|
-
requestAnimationFrame(() => {
|
|
546
|
-
var _a, _b, _c, _d;
|
|
547
|
-
// @ts-ignore: method exists on PagerView instance
|
|
548
|
-
(_c = (_b = (_a = pagerRef.current) === null || _a === void 0 ? void 0 : _a.setPageWithoutAnimation) === null || _b === void 0 ? void 0 : _b.call(_a, nextIndex)) !== null && _c !== void 0 ? _c : (_d = pagerRef.current) === null || _d === void 0 ? void 0 : _d.setPage(nextIndex);
|
|
549
|
-
});
|
|
550
|
-
// Run all 4 animations simultaneously
|
|
526
|
+
const halfDuration = SLIDE_FADE_DURATION / 2;
|
|
551
527
|
const timingConfig = {
|
|
552
|
-
duration:
|
|
528
|
+
duration: halfDuration,
|
|
553
529
|
easing: react_native_1.Easing.out(react_native_1.Easing.ease),
|
|
554
530
|
useNativeDriver: true,
|
|
555
531
|
};
|
|
532
|
+
// Phase 1: Fade out and slide the current page in exit direction
|
|
556
533
|
react_native_1.Animated.parallel([
|
|
557
|
-
|
|
558
|
-
react_native_1.Animated.timing(slideFadeOutgoingOpacity, {
|
|
534
|
+
react_native_1.Animated.timing(pagerOpacity, {
|
|
559
535
|
toValue: 0,
|
|
560
536
|
...timingConfig,
|
|
561
537
|
}),
|
|
562
|
-
react_native_1.Animated.timing(
|
|
563
|
-
toValue: -SLIDE_FADE_OFFSET * direction,
|
|
564
|
-
...timingConfig,
|
|
565
|
-
}),
|
|
566
|
-
// Incoming: fade in and slide to center
|
|
567
|
-
react_native_1.Animated.timing(slideFadeIncomingOpacity, {
|
|
568
|
-
toValue: 1,
|
|
569
|
-
...timingConfig,
|
|
570
|
-
}),
|
|
571
|
-
react_native_1.Animated.timing(slideFadeIncomingTranslateX, {
|
|
572
|
-
toValue: 0,
|
|
538
|
+
react_native_1.Animated.timing(pagerTranslateX, {
|
|
539
|
+
toValue: -SLIDE_FADE_OFFSET * direction * 0.5, // Slide out in opposite direction
|
|
573
540
|
...timingConfig,
|
|
574
541
|
}),
|
|
575
542
|
]).start(() => {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
//
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
543
|
+
var _a, _b, _c, _d;
|
|
544
|
+
// Switch page instantly while invisible
|
|
545
|
+
// @ts-ignore: method exists on PagerView instance
|
|
546
|
+
(_c = (_b = (_a = pagerRef.current) === null || _a === void 0 ? void 0 : _a.setPageWithoutAnimation) === null || _b === void 0 ? void 0 : _b.call(_a, nextIndex)) !== null && _c !== void 0 ? _c : (_d = pagerRef.current) === null || _d === void 0 ? void 0 : _d.setPage(nextIndex);
|
|
547
|
+
// Set up for incoming animation - start from the direction we're navigating from
|
|
548
|
+
pagerTranslateX.setValue(SLIDE_FADE_OFFSET * direction * 0.5);
|
|
549
|
+
// Phase 2: Fade in and slide the new page to center
|
|
550
|
+
react_native_1.Animated.parallel([
|
|
551
|
+
react_native_1.Animated.timing(pagerOpacity, {
|
|
552
|
+
toValue: 1,
|
|
553
|
+
duration: halfDuration,
|
|
554
|
+
easing: react_native_1.Easing.out(react_native_1.Easing.ease),
|
|
555
|
+
useNativeDriver: true,
|
|
556
|
+
}),
|
|
557
|
+
react_native_1.Animated.timing(pagerTranslateX, {
|
|
558
|
+
toValue: 0,
|
|
559
|
+
duration: halfDuration,
|
|
560
|
+
easing: react_native_1.Easing.out(react_native_1.Easing.ease),
|
|
561
|
+
useNativeDriver: true,
|
|
562
|
+
}),
|
|
563
|
+
]).start(() => {
|
|
564
|
+
// Send vars to the new page
|
|
565
|
+
sendVarsToWebView(nextIndex);
|
|
566
|
+
setIsTransitioning(false);
|
|
567
|
+
});
|
|
586
568
|
});
|
|
587
569
|
return;
|
|
588
570
|
}
|
|
@@ -839,138 +821,166 @@ function Overlay(props) {
|
|
|
839
821
|
styles.root,
|
|
840
822
|
!visible && styles.invisible,
|
|
841
823
|
visible && { opacity: overlayOpacity },
|
|
842
|
-
], pointerEvents: visible && !isClosing ? "auto" : "none", children: [(0, jsx_runtime_1.jsx)(
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}, onMessage: (ev) => {
|
|
857
|
-
var _a, _b, _c, _d;
|
|
858
|
-
const raw = ev.nativeEvent.data;
|
|
859
|
-
console.log("raw", raw);
|
|
860
|
-
// Accept either raw strings or JSON payloads from your editor
|
|
861
|
-
try {
|
|
862
|
-
// JSON path
|
|
863
|
-
const data = JSON.parse(raw);
|
|
864
|
-
// 1) Variables from a page → update shared + broadcast to OTHER pages
|
|
865
|
-
// This mirrors the iOS SDK pattern with stale value filtering.
|
|
866
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:variables" &&
|
|
867
|
-
(data === null || data === void 0 ? void 0 : data.vars) &&
|
|
868
|
-
typeof data.vars === "object") {
|
|
869
|
-
if (__DEV__)
|
|
870
|
-
console.log("[Rampkit] received variables from page", i, data.vars);
|
|
871
|
-
// Check if this page is within the stale value window
|
|
872
|
-
// (we recently sent vars to it and it may be echoing back defaults)
|
|
873
|
-
const now = Date.now();
|
|
874
|
-
const lastSendTime = lastVarsSendTimeRef.current[i] || 0;
|
|
875
|
-
const timeSinceSend = now - lastSendTime;
|
|
876
|
-
const isWithinStaleWindow = timeSinceSend < STALE_VALUE_WINDOW_MS;
|
|
877
|
-
if (__DEV__) {
|
|
878
|
-
console.log("[Rampkit] stale check:", {
|
|
879
|
-
pageIndex: i,
|
|
880
|
-
isWithinStaleWindow,
|
|
881
|
-
timeSinceSend,
|
|
882
|
-
});
|
|
824
|
+
], pointerEvents: visible && !isClosing ? "auto" : "none", children: [(0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { style: [
|
|
825
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
826
|
+
{
|
|
827
|
+
opacity: pagerOpacity,
|
|
828
|
+
transform: [{ translateX: pagerTranslateX }],
|
|
829
|
+
},
|
|
830
|
+
], children: (0, jsx_runtime_1.jsx)(react_native_pager_view_1.default, { ref: pagerRef, style: react_native_1.StyleSheet.absoluteFill, scrollEnabled: false, initialPage: 0, onPageSelected: onPageSelected, offscreenPageLimit: props.screens.length, overScrollMode: "never", children: docs.map((doc, i) => ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.page, renderToHardwareTextureAndroid: true, children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { ref: (r) => (webviewsRef.current[i] = r), style: styles.webview, originWhitelist: ["*"], source: { html: doc }, injectedJavaScriptBeforeContentLoaded: exports.injectedHardening, injectedJavaScript: exports.injectedNoSelect + exports.injectedVarsHandler, automaticallyAdjustContentInsets: false, contentInsetAdjustmentBehavior: "never", bounces: false, scrollEnabled: false, overScrollMode: "never", scalesPageToFit: false, showsHorizontalScrollIndicator: false, dataDetectorTypes: "none", allowsLinkPreview: false, allowsInlineMediaPlayback: true, mediaPlaybackRequiresUserAction: false, cacheEnabled: true, javaScriptEnabled: true, domStorageEnabled: true, hideKeyboardAccessoryView: true, onLoadEnd: () => {
|
|
831
|
+
setLoadedCount((c) => c + 1);
|
|
832
|
+
if (i === 0) {
|
|
833
|
+
setFirstPageLoaded(true);
|
|
834
|
+
// Track initial screen view
|
|
835
|
+
if (!hasTrackedInitialScreen.current && props.onScreenChange && props.screens[0]) {
|
|
836
|
+
hasTrackedInitialScreen.current = true;
|
|
837
|
+
props.onScreenChange(0, props.screens[0].id);
|
|
883
838
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
839
|
+
}
|
|
840
|
+
// Initialize this page with current vars (isInitialLoad=true to enable stale filter)
|
|
841
|
+
if (__DEV__)
|
|
842
|
+
console.log("[Rampkit] onLoadEnd init send vars", i);
|
|
843
|
+
sendVarsToWebView(i, true);
|
|
844
|
+
}, onMessage: (ev) => {
|
|
845
|
+
var _a, _b, _c, _d;
|
|
846
|
+
const raw = ev.nativeEvent.data;
|
|
847
|
+
console.log("raw", raw);
|
|
848
|
+
// Accept either raw strings or JSON payloads from your editor
|
|
849
|
+
try {
|
|
850
|
+
// JSON path
|
|
851
|
+
const data = JSON.parse(raw);
|
|
852
|
+
// 1) Variables from a page → update shared + broadcast to OTHER pages
|
|
853
|
+
// This mirrors the iOS SDK pattern with stale value filtering.
|
|
854
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:variables" &&
|
|
855
|
+
(data === null || data === void 0 ? void 0 : data.vars) &&
|
|
856
|
+
typeof data.vars === "object") {
|
|
857
|
+
if (__DEV__)
|
|
858
|
+
console.log("[Rampkit] received variables from page", i, data.vars);
|
|
859
|
+
// Check if this page is within the stale value window
|
|
860
|
+
// (we recently sent vars to it and it may be echoing back defaults)
|
|
861
|
+
const now = Date.now();
|
|
862
|
+
const lastSendTime = lastVarsSendTimeRef.current[i] || 0;
|
|
863
|
+
const timeSinceSend = now - lastSendTime;
|
|
864
|
+
const isWithinStaleWindow = timeSinceSend < STALE_VALUE_WINDOW_MS;
|
|
865
|
+
if (__DEV__) {
|
|
866
|
+
console.log("[Rampkit] stale check:", {
|
|
867
|
+
pageIndex: i,
|
|
868
|
+
isWithinStaleWindow,
|
|
869
|
+
timeSinceSend,
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
let changed = false;
|
|
873
|
+
const newVars = {};
|
|
874
|
+
for (const [key, value] of Object.entries(data.vars)) {
|
|
875
|
+
const hasHostVal = Object.prototype.hasOwnProperty.call(varsRef.current, key);
|
|
876
|
+
const hostVal = varsRef.current[key];
|
|
877
|
+
// Stale value filtering (matches iOS SDK behavior):
|
|
878
|
+
// If we're within the stale window, don't let empty/default values
|
|
879
|
+
// overwrite existing non-empty host values.
|
|
880
|
+
// This prevents pages from clobbering user input with cached defaults
|
|
881
|
+
// when they first become active/visible.
|
|
882
|
+
if (isWithinStaleWindow && hasHostVal) {
|
|
883
|
+
const hostIsNonEmpty = hostVal !== "" && hostVal !== null && hostVal !== undefined;
|
|
884
|
+
const incomingIsEmpty = value === "" || value === null || value === undefined;
|
|
885
|
+
if (hostIsNonEmpty && incomingIsEmpty) {
|
|
886
|
+
if (__DEV__) {
|
|
887
|
+
console.log(`[Rampkit] filtering stale empty value for key "${key}": keeping "${hostVal}"`);
|
|
888
|
+
}
|
|
889
|
+
continue; // Skip this key, keep host value
|
|
900
890
|
}
|
|
901
|
-
|
|
891
|
+
}
|
|
892
|
+
// Accept the update if value is different
|
|
893
|
+
if (!hasHostVal || hostVal !== value) {
|
|
894
|
+
newVars[key] = value;
|
|
895
|
+
changed = true;
|
|
902
896
|
}
|
|
903
897
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
898
|
+
if (changed) {
|
|
899
|
+
varsRef.current = { ...varsRef.current, ...newVars };
|
|
900
|
+
// Broadcast to all WebViews EXCEPT the source (index i)
|
|
901
|
+
// This prevents echo loops and matches iOS SDK behavior
|
|
902
|
+
broadcastVars(i);
|
|
908
903
|
}
|
|
904
|
+
return;
|
|
909
905
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
906
|
+
// 2) A page asked for current vars → send only to that page
|
|
907
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-vars") {
|
|
908
|
+
if (__DEV__)
|
|
909
|
+
console.log("[Rampkit] request-vars from page", i);
|
|
910
|
+
sendVarsToWebView(i);
|
|
911
|
+
return;
|
|
915
912
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
// 3) A page requested an in-app review prompt
|
|
926
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-review" ||
|
|
927
|
-
(data === null || data === void 0 ? void 0 : data.type) === "rampkit:review") {
|
|
928
|
-
(async () => {
|
|
929
|
-
try {
|
|
930
|
-
const available = await RampKitNative_1.StoreReview.isAvailableAsync();
|
|
931
|
-
if (available) {
|
|
932
|
-
await RampKitNative_1.StoreReview.requestReview();
|
|
913
|
+
// 3) A page requested an in-app review prompt
|
|
914
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-review" ||
|
|
915
|
+
(data === null || data === void 0 ? void 0 : data.type) === "rampkit:review") {
|
|
916
|
+
(async () => {
|
|
917
|
+
try {
|
|
918
|
+
const available = await RampKitNative_1.StoreReview.isAvailableAsync();
|
|
919
|
+
if (available) {
|
|
920
|
+
await RampKitNative_1.StoreReview.requestReview();
|
|
921
|
+
}
|
|
933
922
|
}
|
|
923
|
+
catch (_) { }
|
|
924
|
+
})();
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
// 4) A page requested notification permission
|
|
928
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-notification-permission") {
|
|
929
|
+
handleNotificationPermissionRequest({
|
|
930
|
+
ios: data === null || data === void 0 ? void 0 : data.ios,
|
|
931
|
+
android: data === null || data === void 0 ? void 0 : data.android,
|
|
932
|
+
behavior: data === null || data === void 0 ? void 0 : data.behavior,
|
|
933
|
+
});
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
// 5) Onboarding finished event from page
|
|
937
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:onboarding-finished") {
|
|
938
|
+
setOnboardingCompleted(true);
|
|
939
|
+
try {
|
|
940
|
+
(_a = props.onOnboardingFinished) === null || _a === void 0 ? void 0 : _a.call(props, data === null || data === void 0 ? void 0 : data.payload);
|
|
934
941
|
}
|
|
935
942
|
catch (_) { }
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
// 4) A page requested notification permission
|
|
940
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-notification-permission") {
|
|
941
|
-
handleNotificationPermissionRequest({
|
|
942
|
-
ios: data === null || data === void 0 ? void 0 : data.ios,
|
|
943
|
-
android: data === null || data === void 0 ? void 0 : data.android,
|
|
944
|
-
behavior: data === null || data === void 0 ? void 0 : data.behavior,
|
|
945
|
-
});
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
// 5) Onboarding finished event from page
|
|
949
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:onboarding-finished") {
|
|
950
|
-
setOnboardingCompleted(true);
|
|
951
|
-
try {
|
|
952
|
-
(_a = props.onOnboardingFinished) === null || _a === void 0 ? void 0 : _a.call(props, data === null || data === void 0 ? void 0 : data.payload);
|
|
943
|
+
handleRequestClose({ completed: true });
|
|
944
|
+
return;
|
|
953
945
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
(_b = props.onShowPaywall) === null || _b === void 0 ? void 0 : _b.call(props, data === null || data === void 0 ? void 0 : data.payload);
|
|
946
|
+
// 6) Request to show paywall
|
|
947
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:show-paywall") {
|
|
948
|
+
try {
|
|
949
|
+
(_b = props.onShowPaywall) === null || _b === void 0 ? void 0 : _b.call(props, data === null || data === void 0 ? void 0 : data.payload);
|
|
950
|
+
}
|
|
951
|
+
catch (_) { }
|
|
952
|
+
return;
|
|
962
953
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
954
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:continue" ||
|
|
955
|
+
(data === null || data === void 0 ? void 0 : data.type) === "continue") {
|
|
956
|
+
handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:navigate") {
|
|
960
|
+
const target = data === null || data === void 0 ? void 0 : data.targetScreenId;
|
|
961
|
+
if (target === "__goBack__") {
|
|
962
|
+
if (i > 0) {
|
|
963
|
+
navigateToIndex(i - 1, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
handleRequestClose();
|
|
967
|
+
}
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (!target || target === "__continue__") {
|
|
971
|
+
handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
975
|
+
if (targetIndex >= 0) {
|
|
976
|
+
navigateToIndex(targetIndex, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
977
|
+
}
|
|
978
|
+
else {
|
|
979
|
+
handleAdvance(i);
|
|
980
|
+
}
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:goBack") {
|
|
974
984
|
if (i > 0) {
|
|
975
985
|
navigateToIndex(i - 1, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
976
986
|
}
|
|
@@ -979,89 +989,56 @@ function Overlay(props) {
|
|
|
979
989
|
}
|
|
980
990
|
return;
|
|
981
991
|
}
|
|
982
|
-
if (
|
|
983
|
-
|
|
992
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:close") {
|
|
993
|
+
handleRequestClose();
|
|
984
994
|
return;
|
|
985
995
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
996
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:haptic") {
|
|
997
|
+
performRampkitHaptic(data);
|
|
998
|
+
return;
|
|
989
999
|
}
|
|
990
|
-
|
|
1000
|
+
}
|
|
1001
|
+
catch (_e) {
|
|
1002
|
+
// String path
|
|
1003
|
+
if (raw === "rampkit:tap" ||
|
|
1004
|
+
raw === "next" ||
|
|
1005
|
+
raw === "continue") {
|
|
991
1006
|
handleAdvance(i);
|
|
1007
|
+
return;
|
|
992
1008
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1009
|
+
if (raw === "rampkit:request-review" || raw === "rampkit:review") {
|
|
1010
|
+
(async () => {
|
|
1011
|
+
try {
|
|
1012
|
+
const available = await RampKitNative_1.StoreReview.isAvailableAsync();
|
|
1013
|
+
if (available) {
|
|
1014
|
+
await RampKitNative_1.StoreReview.requestReview();
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
catch (_) { }
|
|
1018
|
+
})();
|
|
1019
|
+
return;
|
|
998
1020
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1021
|
+
if (raw === "rampkit:request-notification-permission") {
|
|
1022
|
+
handleNotificationPermissionRequest(undefined);
|
|
1023
|
+
return;
|
|
1001
1024
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:close") {
|
|
1005
|
-
handleRequestClose();
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:haptic") {
|
|
1009
|
-
performRampkitHaptic(data);
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
catch (_e) {
|
|
1014
|
-
// String path
|
|
1015
|
-
if (raw === "rampkit:tap" ||
|
|
1016
|
-
raw === "next" ||
|
|
1017
|
-
raw === "continue") {
|
|
1018
|
-
handleAdvance(i);
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
if (raw === "rampkit:request-review" || raw === "rampkit:review") {
|
|
1022
|
-
(async () => {
|
|
1025
|
+
if (raw === "rampkit:onboarding-finished") {
|
|
1026
|
+
setOnboardingCompleted(true);
|
|
1023
1027
|
try {
|
|
1024
|
-
|
|
1025
|
-
if (available) {
|
|
1026
|
-
await RampKitNative_1.StoreReview.requestReview();
|
|
1027
|
-
}
|
|
1028
|
+
(_c = props.onOnboardingFinished) === null || _c === void 0 ? void 0 : _c.call(props, undefined);
|
|
1028
1029
|
}
|
|
1029
1030
|
catch (_) { }
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
}
|
|
1033
|
-
if (raw === "rampkit:request-notification-permission") {
|
|
1034
|
-
handleNotificationPermissionRequest(undefined);
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
if (raw === "rampkit:onboarding-finished") {
|
|
1038
|
-
setOnboardingCompleted(true);
|
|
1039
|
-
try {
|
|
1040
|
-
(_c = props.onOnboardingFinished) === null || _c === void 0 ? void 0 : _c.call(props, undefined);
|
|
1041
|
-
}
|
|
1042
|
-
catch (_) { }
|
|
1043
|
-
handleRequestClose({ completed: true });
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
if (raw === "rampkit:show-paywall") {
|
|
1047
|
-
try {
|
|
1048
|
-
(_d = props.onShowPaywall) === null || _d === void 0 ? void 0 : _d.call(props);
|
|
1049
|
-
}
|
|
1050
|
-
catch (_) { }
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
if (raw === "rampkit:goBack") {
|
|
1054
|
-
if (i > 0) {
|
|
1055
|
-
navigateToIndex(i - 1);
|
|
1031
|
+
handleRequestClose({ completed: true });
|
|
1032
|
+
return;
|
|
1056
1033
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1034
|
+
if (raw === "rampkit:show-paywall") {
|
|
1035
|
+
try {
|
|
1036
|
+
(_d = props.onShowPaywall) === null || _d === void 0 ? void 0 : _d.call(props);
|
|
1037
|
+
}
|
|
1038
|
+
catch (_) { }
|
|
1039
|
+
return;
|
|
1059
1040
|
}
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
if (raw.startsWith("rampkit:navigate:")) {
|
|
1063
|
-
const target = raw.slice("rampkit:navigate:".length);
|
|
1064
|
-
if (target === "__goBack__") {
|
|
1041
|
+
if (raw === "rampkit:goBack") {
|
|
1065
1042
|
if (i > 0) {
|
|
1066
1043
|
navigateToIndex(i - 1);
|
|
1067
1044
|
}
|
|
@@ -1070,58 +1047,55 @@ function Overlay(props) {
|
|
|
1070
1047
|
}
|
|
1071
1048
|
return;
|
|
1072
1049
|
}
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1050
|
+
if (raw.startsWith("rampkit:navigate:")) {
|
|
1051
|
+
const target = raw.slice("rampkit:navigate:".length);
|
|
1052
|
+
if (target === "__goBack__") {
|
|
1053
|
+
if (i > 0) {
|
|
1054
|
+
navigateToIndex(i - 1);
|
|
1055
|
+
}
|
|
1056
|
+
else {
|
|
1057
|
+
handleRequestClose();
|
|
1058
|
+
}
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
if (!target || target === "__continue__") {
|
|
1062
|
+
handleAdvance(i);
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
1066
|
+
if (targetIndex >= 0) {
|
|
1067
|
+
navigateToIndex(targetIndex);
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
handleAdvance(i);
|
|
1071
|
+
}
|
|
1075
1072
|
return;
|
|
1076
1073
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1074
|
+
if (raw === "rampkit:close") {
|
|
1075
|
+
handleRequestClose();
|
|
1076
|
+
return;
|
|
1080
1077
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1078
|
+
if (raw.startsWith("haptic:")) {
|
|
1079
|
+
performRampkitHaptic({
|
|
1080
|
+
type: "rampkit:haptic",
|
|
1081
|
+
nodeId: null,
|
|
1082
|
+
nodeType: null,
|
|
1083
|
+
animation: "none",
|
|
1084
|
+
action: "haptic",
|
|
1085
|
+
hapticType: "impact",
|
|
1086
|
+
impactStyle: "Medium",
|
|
1087
|
+
notificationType: null,
|
|
1088
|
+
timestamp: Date.now(),
|
|
1089
|
+
});
|
|
1090
|
+
return;
|
|
1083
1091
|
}
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
if (raw === "rampkit:close") {
|
|
1087
|
-
handleRequestClose();
|
|
1088
|
-
return;
|
|
1089
1092
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
action: "haptic",
|
|
1097
|
-
hapticType: "impact",
|
|
1098
|
-
impactStyle: "Medium",
|
|
1099
|
-
notificationType: null,
|
|
1100
|
-
timestamp: Date.now(),
|
|
1101
|
-
});
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
// No-op for other messages, but useful to log while testing
|
|
1106
|
-
// console.log("WebView message:", raw);
|
|
1107
|
-
}, onError: (e) => {
|
|
1108
|
-
// You can surface an inline error UI here if you want
|
|
1109
|
-
console.warn("WebView error:", e.nativeEvent);
|
|
1110
|
-
} }) }, props.screens[i].id))) }), slideFadeActive && slideFadeOutgoingIndex !== null && slideFadeIncomingIndex !== null && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { pointerEvents: "none", style: [
|
|
1111
|
-
react_native_1.StyleSheet.absoluteFillObject,
|
|
1112
|
-
styles.slideFadeLayer,
|
|
1113
|
-
{
|
|
1114
|
-
opacity: slideFadeOutgoingOpacity,
|
|
1115
|
-
transform: [{ translateX: slideFadeOutgoingTranslateX }],
|
|
1116
|
-
},
|
|
1117
|
-
], children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { style: styles.webview, originWhitelist: ["*"], source: { html: docs[slideFadeOutgoingIndex] }, injectedJavaScriptBeforeContentLoaded: exports.injectedHardening, injectedJavaScript: exports.injectedNoSelect + exports.injectedVarsHandler, automaticallyAdjustContentInsets: false, contentInsetAdjustmentBehavior: "never", bounces: false, scrollEnabled: false, overScrollMode: "never", scalesPageToFit: false, showsHorizontalScrollIndicator: false, dataDetectorTypes: "none", allowsLinkPreview: false, allowsInlineMediaPlayback: true, mediaPlaybackRequiresUserAction: false, cacheEnabled: true, javaScriptEnabled: true, domStorageEnabled: true, hideKeyboardAccessoryView: true }) }), (0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { pointerEvents: "none", style: [
|
|
1118
|
-
react_native_1.StyleSheet.absoluteFillObject,
|
|
1119
|
-
styles.slideFadeLayer,
|
|
1120
|
-
{
|
|
1121
|
-
opacity: slideFadeIncomingOpacity,
|
|
1122
|
-
transform: [{ translateX: slideFadeIncomingTranslateX }],
|
|
1123
|
-
},
|
|
1124
|
-
], children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { style: styles.webview, originWhitelist: ["*"], source: { html: docs[slideFadeIncomingIndex] }, injectedJavaScriptBeforeContentLoaded: exports.injectedHardening, injectedJavaScript: exports.injectedNoSelect + exports.injectedVarsHandler, automaticallyAdjustContentInsets: false, contentInsetAdjustmentBehavior: "never", bounces: false, scrollEnabled: false, overScrollMode: "never", scalesPageToFit: false, showsHorizontalScrollIndicator: false, dataDetectorTypes: "none", allowsLinkPreview: false, allowsInlineMediaPlayback: true, mediaPlaybackRequiresUserAction: false, cacheEnabled: true, javaScriptEnabled: true, domStorageEnabled: true, hideKeyboardAccessoryView: true }) })] })), (0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { pointerEvents: isTransitioning ? "auto" : "none", style: [
|
|
1093
|
+
// No-op for other messages, but useful to log while testing
|
|
1094
|
+
// console.log("WebView message:", raw);
|
|
1095
|
+
}, onError: (e) => {
|
|
1096
|
+
// You can surface an inline error UI here if you want
|
|
1097
|
+
console.warn("WebView error:", e.nativeEvent);
|
|
1098
|
+
} }) }, props.screens[i].id))) }) }), (0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { pointerEvents: isTransitioning ? "auto" : "none", style: [
|
|
1125
1099
|
react_native_1.StyleSheet.absoluteFillObject,
|
|
1126
1100
|
styles.curtain,
|
|
1127
1101
|
{ opacity: fadeOpacity },
|
|
@@ -1144,9 +1118,5 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
1144
1118
|
center: { flex: 1, alignItems: "center", justifyContent: "center" },
|
|
1145
1119
|
webview: { flex: 1 },
|
|
1146
1120
|
curtain: { backgroundColor: "white" },
|
|
1147
|
-
slideFadeLayer: {
|
|
1148
|
-
backgroundColor: "white",
|
|
1149
|
-
zIndex: 10000,
|
|
1150
|
-
},
|
|
1151
1121
|
});
|
|
1152
1122
|
exports.default = Overlay;
|
package/package.json
CHANGED