rampkit-expo-dev 0.0.38 → 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 +292 -225
- package/package.json +1 -1
package/build/RampkitOverlay.js
CHANGED
|
@@ -418,6 +418,9 @@ ${js}
|
|
|
418
418
|
</body>
|
|
419
419
|
</html>`;
|
|
420
420
|
}
|
|
421
|
+
// slideFade animation constants
|
|
422
|
+
const SLIDE_FADE_OFFSET = 200;
|
|
423
|
+
const SLIDE_FADE_DURATION = 320;
|
|
421
424
|
function Overlay(props) {
|
|
422
425
|
const pagerRef = (0, react_1.useRef)(null);
|
|
423
426
|
const [index, setIndex] = (0, react_1.useState)(0);
|
|
@@ -429,6 +432,9 @@ function Overlay(props) {
|
|
|
429
432
|
const [onboardingCompleted, setOnboardingCompleted] = (0, react_1.useState)(false);
|
|
430
433
|
const overlayOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
431
434
|
const fadeOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
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;
|
|
432
438
|
const allLoaded = loadedCount >= props.screens.length;
|
|
433
439
|
const hasTrackedInitialScreen = (0, react_1.useRef)(false);
|
|
434
440
|
// shared vars across all webviews
|
|
@@ -488,9 +494,11 @@ function Overlay(props) {
|
|
|
488
494
|
return;
|
|
489
495
|
if (isTransitioning)
|
|
490
496
|
return;
|
|
497
|
+
// Parse animation type case-insensitively
|
|
498
|
+
const animationType = (animation === null || animation === void 0 ? void 0 : animation.toLowerCase()) || "fade";
|
|
491
499
|
// Slide animation: use PagerView's built-in animated page change
|
|
492
500
|
// and skip the fade curtain overlay.
|
|
493
|
-
if (
|
|
501
|
+
if (animationType === "slide") {
|
|
494
502
|
// @ts-ignore: methods exist on PagerView instance
|
|
495
503
|
const pager = pagerRef.current;
|
|
496
504
|
if (!pager)
|
|
@@ -508,6 +516,59 @@ function Overlay(props) {
|
|
|
508
516
|
});
|
|
509
517
|
return;
|
|
510
518
|
}
|
|
519
|
+
// slideFade animation: smooth slide + fade transition
|
|
520
|
+
// Animates the PagerView container out, switches page, then animates back in
|
|
521
|
+
if (animationType === "slidefade") {
|
|
522
|
+
setIsTransitioning(true);
|
|
523
|
+
// Determine direction: forward (nextIndex > index) or backward
|
|
524
|
+
const isForward = nextIndex > index;
|
|
525
|
+
const direction = isForward ? 1 : -1;
|
|
526
|
+
const halfDuration = SLIDE_FADE_DURATION / 2;
|
|
527
|
+
const timingConfig = {
|
|
528
|
+
duration: halfDuration,
|
|
529
|
+
easing: react_native_1.Easing.out(react_native_1.Easing.ease),
|
|
530
|
+
useNativeDriver: true,
|
|
531
|
+
};
|
|
532
|
+
// Phase 1: Fade out and slide the current page in exit direction
|
|
533
|
+
react_native_1.Animated.parallel([
|
|
534
|
+
react_native_1.Animated.timing(pagerOpacity, {
|
|
535
|
+
toValue: 0,
|
|
536
|
+
...timingConfig,
|
|
537
|
+
}),
|
|
538
|
+
react_native_1.Animated.timing(pagerTranslateX, {
|
|
539
|
+
toValue: -SLIDE_FADE_OFFSET * direction * 0.5, // Slide out in opposite direction
|
|
540
|
+
...timingConfig,
|
|
541
|
+
}),
|
|
542
|
+
]).start(() => {
|
|
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
|
+
});
|
|
568
|
+
});
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
// Default fade animation: uses a white curtain overlay
|
|
511
572
|
setIsTransitioning(true);
|
|
512
573
|
react_native_1.Animated.timing(fadeOpacity, {
|
|
513
574
|
toValue: 1,
|
|
@@ -760,138 +821,166 @@ function Overlay(props) {
|
|
|
760
821
|
styles.root,
|
|
761
822
|
!visible && styles.invisible,
|
|
762
823
|
visible && { opacity: overlayOpacity },
|
|
763
|
-
], pointerEvents: visible && !isClosing ? "auto" : "none", children: [(0, jsx_runtime_1.jsx)(
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}, onMessage: (ev) => {
|
|
778
|
-
var _a, _b, _c, _d;
|
|
779
|
-
const raw = ev.nativeEvent.data;
|
|
780
|
-
console.log("raw", raw);
|
|
781
|
-
// Accept either raw strings or JSON payloads from your editor
|
|
782
|
-
try {
|
|
783
|
-
// JSON path
|
|
784
|
-
const data = JSON.parse(raw);
|
|
785
|
-
// 1) Variables from a page → update shared + broadcast to OTHER pages
|
|
786
|
-
// This mirrors the iOS SDK pattern with stale value filtering.
|
|
787
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:variables" &&
|
|
788
|
-
(data === null || data === void 0 ? void 0 : data.vars) &&
|
|
789
|
-
typeof data.vars === "object") {
|
|
790
|
-
if (__DEV__)
|
|
791
|
-
console.log("[Rampkit] received variables from page", i, data.vars);
|
|
792
|
-
// Check if this page is within the stale value window
|
|
793
|
-
// (we recently sent vars to it and it may be echoing back defaults)
|
|
794
|
-
const now = Date.now();
|
|
795
|
-
const lastSendTime = lastVarsSendTimeRef.current[i] || 0;
|
|
796
|
-
const timeSinceSend = now - lastSendTime;
|
|
797
|
-
const isWithinStaleWindow = timeSinceSend < STALE_VALUE_WINDOW_MS;
|
|
798
|
-
if (__DEV__) {
|
|
799
|
-
console.log("[Rampkit] stale check:", {
|
|
800
|
-
pageIndex: i,
|
|
801
|
-
isWithinStaleWindow,
|
|
802
|
-
timeSinceSend,
|
|
803
|
-
});
|
|
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);
|
|
804
838
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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
|
|
821
890
|
}
|
|
822
|
-
|
|
891
|
+
}
|
|
892
|
+
// Accept the update if value is different
|
|
893
|
+
if (!hasHostVal || hostVal !== value) {
|
|
894
|
+
newVars[key] = value;
|
|
895
|
+
changed = true;
|
|
823
896
|
}
|
|
824
897
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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);
|
|
829
903
|
}
|
|
904
|
+
return;
|
|
830
905
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
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;
|
|
836
912
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
// 3) A page requested an in-app review prompt
|
|
847
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-review" ||
|
|
848
|
-
(data === null || data === void 0 ? void 0 : data.type) === "rampkit:review") {
|
|
849
|
-
(async () => {
|
|
850
|
-
try {
|
|
851
|
-
const available = await RampKitNative_1.StoreReview.isAvailableAsync();
|
|
852
|
-
if (available) {
|
|
853
|
-
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
|
+
}
|
|
854
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);
|
|
855
941
|
}
|
|
856
942
|
catch (_) { }
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
// 4) A page requested notification permission
|
|
861
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:request-notification-permission") {
|
|
862
|
-
handleNotificationPermissionRequest({
|
|
863
|
-
ios: data === null || data === void 0 ? void 0 : data.ios,
|
|
864
|
-
android: data === null || data === void 0 ? void 0 : data.android,
|
|
865
|
-
behavior: data === null || data === void 0 ? void 0 : data.behavior,
|
|
866
|
-
});
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
// 5) Onboarding finished event from page
|
|
870
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:onboarding-finished") {
|
|
871
|
-
setOnboardingCompleted(true);
|
|
872
|
-
try {
|
|
873
|
-
(_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;
|
|
874
945
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
(_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;
|
|
883
953
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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") {
|
|
895
984
|
if (i > 0) {
|
|
896
985
|
navigateToIndex(i - 1, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
897
986
|
}
|
|
@@ -900,89 +989,56 @@ function Overlay(props) {
|
|
|
900
989
|
}
|
|
901
990
|
return;
|
|
902
991
|
}
|
|
903
|
-
if (
|
|
904
|
-
|
|
992
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:close") {
|
|
993
|
+
handleRequestClose();
|
|
905
994
|
return;
|
|
906
995
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
996
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:haptic") {
|
|
997
|
+
performRampkitHaptic(data);
|
|
998
|
+
return;
|
|
910
999
|
}
|
|
911
|
-
|
|
1000
|
+
}
|
|
1001
|
+
catch (_e) {
|
|
1002
|
+
// String path
|
|
1003
|
+
if (raw === "rampkit:tap" ||
|
|
1004
|
+
raw === "next" ||
|
|
1005
|
+
raw === "continue") {
|
|
912
1006
|
handleAdvance(i);
|
|
1007
|
+
return;
|
|
913
1008
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
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;
|
|
919
1020
|
}
|
|
920
|
-
|
|
921
|
-
|
|
1021
|
+
if (raw === "rampkit:request-notification-permission") {
|
|
1022
|
+
handleNotificationPermissionRequest(undefined);
|
|
1023
|
+
return;
|
|
922
1024
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:close") {
|
|
926
|
-
handleRequestClose();
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:haptic") {
|
|
930
|
-
performRampkitHaptic(data);
|
|
931
|
-
return;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
catch (_e) {
|
|
935
|
-
// String path
|
|
936
|
-
if (raw === "rampkit:tap" ||
|
|
937
|
-
raw === "next" ||
|
|
938
|
-
raw === "continue") {
|
|
939
|
-
handleAdvance(i);
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
if (raw === "rampkit:request-review" || raw === "rampkit:review") {
|
|
943
|
-
(async () => {
|
|
1025
|
+
if (raw === "rampkit:onboarding-finished") {
|
|
1026
|
+
setOnboardingCompleted(true);
|
|
944
1027
|
try {
|
|
945
|
-
|
|
946
|
-
if (available) {
|
|
947
|
-
await RampKitNative_1.StoreReview.requestReview();
|
|
948
|
-
}
|
|
1028
|
+
(_c = props.onOnboardingFinished) === null || _c === void 0 ? void 0 : _c.call(props, undefined);
|
|
949
1029
|
}
|
|
950
1030
|
catch (_) { }
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}
|
|
954
|
-
if (raw === "rampkit:request-notification-permission") {
|
|
955
|
-
handleNotificationPermissionRequest(undefined);
|
|
956
|
-
return;
|
|
957
|
-
}
|
|
958
|
-
if (raw === "rampkit:onboarding-finished") {
|
|
959
|
-
setOnboardingCompleted(true);
|
|
960
|
-
try {
|
|
961
|
-
(_c = props.onOnboardingFinished) === null || _c === void 0 ? void 0 : _c.call(props, undefined);
|
|
962
|
-
}
|
|
963
|
-
catch (_) { }
|
|
964
|
-
handleRequestClose({ completed: true });
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
if (raw === "rampkit:show-paywall") {
|
|
968
|
-
try {
|
|
969
|
-
(_d = props.onShowPaywall) === null || _d === void 0 ? void 0 : _d.call(props);
|
|
970
|
-
}
|
|
971
|
-
catch (_) { }
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
if (raw === "rampkit:goBack") {
|
|
975
|
-
if (i > 0) {
|
|
976
|
-
navigateToIndex(i - 1);
|
|
1031
|
+
handleRequestClose({ completed: true });
|
|
1032
|
+
return;
|
|
977
1033
|
}
|
|
978
|
-
|
|
979
|
-
|
|
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;
|
|
980
1040
|
}
|
|
981
|
-
|
|
982
|
-
}
|
|
983
|
-
if (raw.startsWith("rampkit:navigate:")) {
|
|
984
|
-
const target = raw.slice("rampkit:navigate:".length);
|
|
985
|
-
if (target === "__goBack__") {
|
|
1041
|
+
if (raw === "rampkit:goBack") {
|
|
986
1042
|
if (i > 0) {
|
|
987
1043
|
navigateToIndex(i - 1);
|
|
988
1044
|
}
|
|
@@ -991,44 +1047,55 @@ function Overlay(props) {
|
|
|
991
1047
|
}
|
|
992
1048
|
return;
|
|
993
1049
|
}
|
|
994
|
-
if (
|
|
995
|
-
|
|
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
|
+
}
|
|
996
1072
|
return;
|
|
997
1073
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1074
|
+
if (raw === "rampkit:close") {
|
|
1075
|
+
handleRequestClose();
|
|
1076
|
+
return;
|
|
1001
1077
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
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;
|
|
1004
1091
|
}
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
if (raw === "rampkit:close") {
|
|
1008
|
-
handleRequestClose();
|
|
1009
|
-
return;
|
|
1010
|
-
}
|
|
1011
|
-
if (raw.startsWith("haptic:")) {
|
|
1012
|
-
performRampkitHaptic({
|
|
1013
|
-
type: "rampkit:haptic",
|
|
1014
|
-
nodeId: null,
|
|
1015
|
-
nodeType: null,
|
|
1016
|
-
animation: "none",
|
|
1017
|
-
action: "haptic",
|
|
1018
|
-
hapticType: "impact",
|
|
1019
|
-
impactStyle: "Medium",
|
|
1020
|
-
notificationType: null,
|
|
1021
|
-
timestamp: Date.now(),
|
|
1022
|
-
});
|
|
1023
|
-
return;
|
|
1024
1092
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
} }) }, props.screens[i].id))) }), (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: [
|
|
1032
1099
|
react_native_1.StyleSheet.absoluteFillObject,
|
|
1033
1100
|
styles.curtain,
|
|
1034
1101
|
{ opacity: fadeOpacity },
|
package/package.json
CHANGED