@moon-x/react-native-sdk 0.15.0 → 0.15.2
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/dist/ethereum.mjs +4 -2
- package/dist/index.js +81 -29
- package/dist/index.mjs +85 -31
- package/dist/solana.mjs +4 -2
- package/dist/tron.mjs +4 -2
- package/package.json +2 -2
package/dist/ethereum.mjs
CHANGED
|
@@ -162,13 +162,15 @@ import { PostMessageMethod as PostMessageMethod3, PostMessageType as PostMessage
|
|
|
162
162
|
|
|
163
163
|
// src/transport/webview-bridge.ts
|
|
164
164
|
import {
|
|
165
|
-
FORWARDED_ERROR_FIELDS
|
|
165
|
+
FORWARDED_ERROR_FIELDS,
|
|
166
|
+
getPostMessageRequestTimeout,
|
|
167
|
+
POST_MESSAGE_REQUEST_TIMEOUT_MS
|
|
166
168
|
} from "@moon-x/core/utils";
|
|
167
169
|
|
|
168
170
|
// src/provider.tsx
|
|
169
171
|
import { SDKProvider } from "@moon-x/core/react";
|
|
170
172
|
import { validatePublishableKey } from "@moon-x/core/lib";
|
|
171
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
173
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
172
174
|
var MoonXContext = createContext(null);
|
|
173
175
|
var useMoonXContext = () => {
|
|
174
176
|
const ctx = useContext(MoonXContext);
|
package/dist/index.js
CHANGED
|
@@ -428,7 +428,6 @@ var import_utils4 = require("@moon-x/core/utils");
|
|
|
428
428
|
|
|
429
429
|
// src/transport/webview-bridge.ts
|
|
430
430
|
var import_utils3 = require("@moon-x/core/utils");
|
|
431
|
-
var REQUEST_TIMEOUT_MS = 3e4;
|
|
432
431
|
var RETRYABLE_METHODS = /* @__PURE__ */ new Set([
|
|
433
432
|
"GET_APP_CONFIG",
|
|
434
433
|
"GET_BALANCE",
|
|
@@ -442,7 +441,11 @@ var RETRYABLE_METHODS = /* @__PURE__ */ new Set([
|
|
|
442
441
|
"GET_DEK_INFO",
|
|
443
442
|
"LIST_EPHEMERAL_SIGNERS"
|
|
444
443
|
]);
|
|
445
|
-
var RETRY_ATTEMPT_TIMEOUTS_MS = [
|
|
444
|
+
var RETRY_ATTEMPT_TIMEOUTS_MS = [
|
|
445
|
+
5e3,
|
|
446
|
+
1e4,
|
|
447
|
+
import_utils3.POST_MESSAGE_REQUEST_TIMEOUT_MS
|
|
448
|
+
];
|
|
446
449
|
var RETRY_BACKOFF_MS = [200, 400];
|
|
447
450
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
448
451
|
var TimeoutError = class extends Error {
|
|
@@ -584,7 +587,7 @@ var WebViewBridge = class {
|
|
|
584
587
|
type,
|
|
585
588
|
method,
|
|
586
589
|
payload,
|
|
587
|
-
|
|
590
|
+
(0, import_utils3.getPostMessageRequestTimeout)(method)
|
|
588
591
|
);
|
|
589
592
|
}
|
|
590
593
|
let lastError;
|
|
@@ -706,6 +709,29 @@ var webViewLifecycleReducer = (state, action) => {
|
|
|
706
709
|
}
|
|
707
710
|
};
|
|
708
711
|
|
|
712
|
+
// src/session-recovery.ts
|
|
713
|
+
var createSessionRevalidationGate = () => {
|
|
714
|
+
let inFlight = false;
|
|
715
|
+
let generation = 0;
|
|
716
|
+
return {
|
|
717
|
+
begin: () => {
|
|
718
|
+
inFlight = true;
|
|
719
|
+
generation += 1;
|
|
720
|
+
return generation;
|
|
721
|
+
},
|
|
722
|
+
request: ({ error, authFlowsInFlight, revalidate }) => {
|
|
723
|
+
if (error.message !== "no_session") return;
|
|
724
|
+
if (authFlowsInFlight > 0 || inFlight) return;
|
|
725
|
+
inFlight = true;
|
|
726
|
+
revalidate();
|
|
727
|
+
},
|
|
728
|
+
finish: (finishedGeneration) => {
|
|
729
|
+
if (finishedGeneration !== generation) return;
|
|
730
|
+
inFlight = false;
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
};
|
|
734
|
+
|
|
709
735
|
// src/provider.tsx
|
|
710
736
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
711
737
|
var DEFAULT_IFRAME_URL = "https://iframe.moonx-dev.com";
|
|
@@ -730,7 +756,9 @@ var MoonXProvider = ({
|
|
|
730
756
|
[bridge, publishableKey, relyingPartyOrigin]
|
|
731
757
|
);
|
|
732
758
|
const [sensitiveVisible, setSensitiveVisible] = (0, import_react.useState)(false);
|
|
759
|
+
const [captchaChallengeVisible, setCaptchaChallengeVisible] = (0, import_react.useState)(false);
|
|
733
760
|
const cancelRef = (0, import_react.useRef)(null);
|
|
761
|
+
const webViewVisible = sensitiveVisible || captchaChallengeVisible;
|
|
734
762
|
const [
|
|
735
763
|
{
|
|
736
764
|
ready,
|
|
@@ -744,6 +772,10 @@ var MoonXProvider = ({
|
|
|
744
772
|
const [revalidatedAt, setRevalidatedAt] = (0, import_react.useState)(0);
|
|
745
773
|
const [restoreNonce, setRestoreNonce] = (0, import_react.useState)(0);
|
|
746
774
|
const authFlowsInFlightRef = (0, import_react.useRef)(0);
|
|
775
|
+
const sessionRevalidationGate = (0, import_react.useMemo)(
|
|
776
|
+
() => createSessionRevalidationGate(),
|
|
777
|
+
[]
|
|
778
|
+
);
|
|
747
779
|
const beginAuthFlow = (0, import_react.useCallback)(() => {
|
|
748
780
|
authFlowsInFlightRef.current += 1;
|
|
749
781
|
let finished = false;
|
|
@@ -774,17 +806,17 @@ var MoonXProvider = ({
|
|
|
774
806
|
(0, import_react.useEffect)(() => {
|
|
775
807
|
import_react_native.Animated.parallel([
|
|
776
808
|
import_react_native.Animated.timing(sheetTranslateY, {
|
|
777
|
-
toValue:
|
|
809
|
+
toValue: webViewVisible ? 0 : screenHeight,
|
|
778
810
|
duration: 280,
|
|
779
811
|
useNativeDriver: true
|
|
780
812
|
}),
|
|
781
813
|
import_react_native.Animated.timing(backdropOpacity, {
|
|
782
|
-
toValue:
|
|
814
|
+
toValue: webViewVisible ? 0.5 : 0,
|
|
783
815
|
duration: 280,
|
|
784
816
|
useNativeDriver: true
|
|
785
817
|
})
|
|
786
818
|
]).start();
|
|
787
|
-
}, [
|
|
819
|
+
}, [webViewVisible, sheetTranslateY, backdropOpacity, screenHeight]);
|
|
788
820
|
const initialSourceUri = (0, import_react.useMemo)(() => {
|
|
789
821
|
const base = iframeUrl.replace(/\/$/, "");
|
|
790
822
|
const sep = base.includes("?") ? "&" : "?";
|
|
@@ -898,16 +930,28 @@ var MoonXProvider = ({
|
|
|
898
930
|
bridge.cleanup("provider_unmounted");
|
|
899
931
|
};
|
|
900
932
|
}, [bridge]);
|
|
933
|
+
(0, import_react.useEffect)(
|
|
934
|
+
() => bridge.register(
|
|
935
|
+
import_utils4.PostMessageType.INIT,
|
|
936
|
+
import_utils4.PostMessageMethod.CAPTCHA_CHALLENGE_VISIBILITY,
|
|
937
|
+
(payload) => {
|
|
938
|
+
if (typeof payload?.visible === "boolean") {
|
|
939
|
+
setCaptchaChallengeVisible(payload.visible);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
[bridge]
|
|
944
|
+
);
|
|
901
945
|
(0, import_react.useEffect)(() => {
|
|
902
946
|
const unsubscribe = bridge.onResponseError((error) => {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
947
|
+
sessionRevalidationGate.request({
|
|
948
|
+
error,
|
|
949
|
+
authFlowsInFlight: authFlowsInFlightRef.current,
|
|
950
|
+
revalidate: () => setRestoreNonce((value) => value + 1)
|
|
951
|
+
});
|
|
908
952
|
});
|
|
909
953
|
return unsubscribe;
|
|
910
|
-
}, [bridge]);
|
|
954
|
+
}, [bridge, sessionRevalidationGate]);
|
|
911
955
|
(0, import_react.useEffect)(() => {
|
|
912
956
|
let cancelled = false;
|
|
913
957
|
const unregister = bridge.register(
|
|
@@ -928,6 +972,7 @@ var MoonXProvider = ({
|
|
|
928
972
|
}, [bridge, webViewRecoveryNonce]);
|
|
929
973
|
(0, import_react.useEffect)(() => {
|
|
930
974
|
if (!ready) return;
|
|
975
|
+
const revalidationGeneration = sessionRevalidationGate.begin();
|
|
931
976
|
let cancelled = false;
|
|
932
977
|
let attempt = 0;
|
|
933
978
|
const maxAttempts = 5;
|
|
@@ -953,6 +998,7 @@ var MoonXProvider = ({
|
|
|
953
998
|
} catch {
|
|
954
999
|
}
|
|
955
1000
|
if (!cancelled) setRevalidatedAt(Date.now());
|
|
1001
|
+
sessionRevalidationGate.finish(revalidationGeneration);
|
|
956
1002
|
return;
|
|
957
1003
|
}
|
|
958
1004
|
if (attempt < maxAttempts) {
|
|
@@ -962,6 +1008,7 @@ var MoonXProvider = ({
|
|
|
962
1008
|
setIsAuthenticated(false);
|
|
963
1009
|
setUser(null);
|
|
964
1010
|
setRevalidatedAt(Date.now());
|
|
1011
|
+
sessionRevalidationGate.finish(revalidationGeneration);
|
|
965
1012
|
}
|
|
966
1013
|
} catch {
|
|
967
1014
|
if (authFlowsInFlightRef.current > 0) return;
|
|
@@ -970,6 +1017,7 @@ var MoonXProvider = ({
|
|
|
970
1017
|
schedule(tryRestore, delay);
|
|
971
1018
|
} else if (!cancelled) {
|
|
972
1019
|
setRevalidatedAt(Date.now());
|
|
1020
|
+
sessionRevalidationGate.finish(revalidationGeneration);
|
|
973
1021
|
}
|
|
974
1022
|
}
|
|
975
1023
|
};
|
|
@@ -979,7 +1027,7 @@ var MoonXProvider = ({
|
|
|
979
1027
|
timers.forEach(clearTimeout);
|
|
980
1028
|
timers.clear();
|
|
981
1029
|
};
|
|
982
|
-
}, [ready, restoreNonce]);
|
|
1030
|
+
}, [ready, restoreNonce, sessionRevalidationGate]);
|
|
983
1031
|
const contextValue = (0, import_react.useMemo)(
|
|
984
1032
|
() => ({
|
|
985
1033
|
sdk,
|
|
@@ -1005,12 +1053,14 @@ var MoonXProvider = ({
|
|
|
1005
1053
|
import_react_native.Animated.View,
|
|
1006
1054
|
{
|
|
1007
1055
|
style: [styles.backdrop, { opacity: backdropOpacity }],
|
|
1008
|
-
pointerEvents:
|
|
1056
|
+
pointerEvents: webViewVisible ? "auto" : "none",
|
|
1009
1057
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1010
1058
|
import_react_native.Pressable,
|
|
1011
1059
|
{
|
|
1012
1060
|
style: import_react_native.StyleSheet.absoluteFill,
|
|
1013
|
-
onPress: () =>
|
|
1061
|
+
onPress: () => {
|
|
1062
|
+
if (sensitiveVisible) cancelRef.current?.();
|
|
1063
|
+
}
|
|
1014
1064
|
}
|
|
1015
1065
|
)
|
|
1016
1066
|
}
|
|
@@ -1021,24 +1071,26 @@ var MoonXProvider = ({
|
|
|
1021
1071
|
style: [
|
|
1022
1072
|
styles.sheetContainer,
|
|
1023
1073
|
{
|
|
1024
|
-
top: SHEET_TOP_OFFSET,
|
|
1074
|
+
top: captchaChallengeVisible ? 0 : SHEET_TOP_OFFSET,
|
|
1025
1075
|
transform: [{ translateY: sheetTranslateY }]
|
|
1026
1076
|
}
|
|
1027
1077
|
],
|
|
1028
|
-
pointerEvents:
|
|
1078
|
+
pointerEvents: webViewVisible ? "auto" : "none",
|
|
1029
1079
|
children: [
|
|
1030
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1031
|
-
|
|
1032
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1080
|
+
sensitiveVisible && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, { style: styles.sheetGrabber }),
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native.View, { style: styles.modalChrome, children: [
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, { style: styles.modalTitleSpacer }),
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1085
|
+
import_react_native.Pressable,
|
|
1086
|
+
{
|
|
1087
|
+
onPress: () => cancelRef.current?.(),
|
|
1088
|
+
hitSlop: 12,
|
|
1089
|
+
style: styles.closeButton,
|
|
1090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { style: styles.closeButtonText, children: closeLabel })
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
] })
|
|
1042
1094
|
] }),
|
|
1043
1095
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1044
1096
|
import_react_native_webview.WebView,
|
package/dist/index.mjs
CHANGED
|
@@ -399,9 +399,10 @@ import { PostMessageMethod as PostMessageMethod3, PostMessageType as PostMessage
|
|
|
399
399
|
|
|
400
400
|
// src/transport/webview-bridge.ts
|
|
401
401
|
import {
|
|
402
|
-
FORWARDED_ERROR_FIELDS
|
|
402
|
+
FORWARDED_ERROR_FIELDS,
|
|
403
|
+
getPostMessageRequestTimeout,
|
|
404
|
+
POST_MESSAGE_REQUEST_TIMEOUT_MS
|
|
403
405
|
} from "@moon-x/core/utils";
|
|
404
|
-
var REQUEST_TIMEOUT_MS = 3e4;
|
|
405
406
|
var RETRYABLE_METHODS = /* @__PURE__ */ new Set([
|
|
406
407
|
"GET_APP_CONFIG",
|
|
407
408
|
"GET_BALANCE",
|
|
@@ -415,7 +416,11 @@ var RETRYABLE_METHODS = /* @__PURE__ */ new Set([
|
|
|
415
416
|
"GET_DEK_INFO",
|
|
416
417
|
"LIST_EPHEMERAL_SIGNERS"
|
|
417
418
|
]);
|
|
418
|
-
var RETRY_ATTEMPT_TIMEOUTS_MS = [
|
|
419
|
+
var RETRY_ATTEMPT_TIMEOUTS_MS = [
|
|
420
|
+
5e3,
|
|
421
|
+
1e4,
|
|
422
|
+
POST_MESSAGE_REQUEST_TIMEOUT_MS
|
|
423
|
+
];
|
|
419
424
|
var RETRY_BACKOFF_MS = [200, 400];
|
|
420
425
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
421
426
|
var TimeoutError = class extends Error {
|
|
@@ -557,7 +562,7 @@ var WebViewBridge = class {
|
|
|
557
562
|
type,
|
|
558
563
|
method,
|
|
559
564
|
payload,
|
|
560
|
-
|
|
565
|
+
getPostMessageRequestTimeout(method)
|
|
561
566
|
);
|
|
562
567
|
}
|
|
563
568
|
let lastError;
|
|
@@ -679,8 +684,31 @@ var webViewLifecycleReducer = (state, action) => {
|
|
|
679
684
|
}
|
|
680
685
|
};
|
|
681
686
|
|
|
687
|
+
// src/session-recovery.ts
|
|
688
|
+
var createSessionRevalidationGate = () => {
|
|
689
|
+
let inFlight = false;
|
|
690
|
+
let generation = 0;
|
|
691
|
+
return {
|
|
692
|
+
begin: () => {
|
|
693
|
+
inFlight = true;
|
|
694
|
+
generation += 1;
|
|
695
|
+
return generation;
|
|
696
|
+
},
|
|
697
|
+
request: ({ error, authFlowsInFlight, revalidate }) => {
|
|
698
|
+
if (error.message !== "no_session") return;
|
|
699
|
+
if (authFlowsInFlight > 0 || inFlight) return;
|
|
700
|
+
inFlight = true;
|
|
701
|
+
revalidate();
|
|
702
|
+
},
|
|
703
|
+
finish: (finishedGeneration) => {
|
|
704
|
+
if (finishedGeneration !== generation) return;
|
|
705
|
+
inFlight = false;
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
|
|
682
710
|
// src/provider.tsx
|
|
683
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
711
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
684
712
|
var DEFAULT_IFRAME_URL = "https://iframe.moonx-dev.com";
|
|
685
713
|
var MoonXContext = createContext(null);
|
|
686
714
|
var MoonXProvider = ({
|
|
@@ -703,7 +731,9 @@ var MoonXProvider = ({
|
|
|
703
731
|
[bridge, publishableKey, relyingPartyOrigin]
|
|
704
732
|
);
|
|
705
733
|
const [sensitiveVisible, setSensitiveVisible] = useState(false);
|
|
734
|
+
const [captchaChallengeVisible, setCaptchaChallengeVisible] = useState(false);
|
|
706
735
|
const cancelRef = useRef(null);
|
|
736
|
+
const webViewVisible = sensitiveVisible || captchaChallengeVisible;
|
|
707
737
|
const [
|
|
708
738
|
{
|
|
709
739
|
ready,
|
|
@@ -717,6 +747,10 @@ var MoonXProvider = ({
|
|
|
717
747
|
const [revalidatedAt, setRevalidatedAt] = useState(0);
|
|
718
748
|
const [restoreNonce, setRestoreNonce] = useState(0);
|
|
719
749
|
const authFlowsInFlightRef = useRef(0);
|
|
750
|
+
const sessionRevalidationGate = useMemo(
|
|
751
|
+
() => createSessionRevalidationGate(),
|
|
752
|
+
[]
|
|
753
|
+
);
|
|
720
754
|
const beginAuthFlow = useCallback(() => {
|
|
721
755
|
authFlowsInFlightRef.current += 1;
|
|
722
756
|
let finished = false;
|
|
@@ -747,17 +781,17 @@ var MoonXProvider = ({
|
|
|
747
781
|
useEffect(() => {
|
|
748
782
|
Animated.parallel([
|
|
749
783
|
Animated.timing(sheetTranslateY, {
|
|
750
|
-
toValue:
|
|
784
|
+
toValue: webViewVisible ? 0 : screenHeight,
|
|
751
785
|
duration: 280,
|
|
752
786
|
useNativeDriver: true
|
|
753
787
|
}),
|
|
754
788
|
Animated.timing(backdropOpacity, {
|
|
755
|
-
toValue:
|
|
789
|
+
toValue: webViewVisible ? 0.5 : 0,
|
|
756
790
|
duration: 280,
|
|
757
791
|
useNativeDriver: true
|
|
758
792
|
})
|
|
759
793
|
]).start();
|
|
760
|
-
}, [
|
|
794
|
+
}, [webViewVisible, sheetTranslateY, backdropOpacity, screenHeight]);
|
|
761
795
|
const initialSourceUri = useMemo(() => {
|
|
762
796
|
const base = iframeUrl.replace(/\/$/, "");
|
|
763
797
|
const sep = base.includes("?") ? "&" : "?";
|
|
@@ -871,16 +905,28 @@ var MoonXProvider = ({
|
|
|
871
905
|
bridge.cleanup("provider_unmounted");
|
|
872
906
|
};
|
|
873
907
|
}, [bridge]);
|
|
908
|
+
useEffect(
|
|
909
|
+
() => bridge.register(
|
|
910
|
+
PostMessageType3.INIT,
|
|
911
|
+
PostMessageMethod3.CAPTCHA_CHALLENGE_VISIBILITY,
|
|
912
|
+
(payload) => {
|
|
913
|
+
if (typeof payload?.visible === "boolean") {
|
|
914
|
+
setCaptchaChallengeVisible(payload.visible);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
[bridge]
|
|
919
|
+
);
|
|
874
920
|
useEffect(() => {
|
|
875
921
|
const unsubscribe = bridge.onResponseError((error) => {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
922
|
+
sessionRevalidationGate.request({
|
|
923
|
+
error,
|
|
924
|
+
authFlowsInFlight: authFlowsInFlightRef.current,
|
|
925
|
+
revalidate: () => setRestoreNonce((value) => value + 1)
|
|
926
|
+
});
|
|
881
927
|
});
|
|
882
928
|
return unsubscribe;
|
|
883
|
-
}, [bridge]);
|
|
929
|
+
}, [bridge, sessionRevalidationGate]);
|
|
884
930
|
useEffect(() => {
|
|
885
931
|
let cancelled = false;
|
|
886
932
|
const unregister = bridge.register(
|
|
@@ -901,6 +947,7 @@ var MoonXProvider = ({
|
|
|
901
947
|
}, [bridge, webViewRecoveryNonce]);
|
|
902
948
|
useEffect(() => {
|
|
903
949
|
if (!ready) return;
|
|
950
|
+
const revalidationGeneration = sessionRevalidationGate.begin();
|
|
904
951
|
let cancelled = false;
|
|
905
952
|
let attempt = 0;
|
|
906
953
|
const maxAttempts = 5;
|
|
@@ -926,6 +973,7 @@ var MoonXProvider = ({
|
|
|
926
973
|
} catch {
|
|
927
974
|
}
|
|
928
975
|
if (!cancelled) setRevalidatedAt(Date.now());
|
|
976
|
+
sessionRevalidationGate.finish(revalidationGeneration);
|
|
929
977
|
return;
|
|
930
978
|
}
|
|
931
979
|
if (attempt < maxAttempts) {
|
|
@@ -935,6 +983,7 @@ var MoonXProvider = ({
|
|
|
935
983
|
setIsAuthenticated(false);
|
|
936
984
|
setUser(null);
|
|
937
985
|
setRevalidatedAt(Date.now());
|
|
986
|
+
sessionRevalidationGate.finish(revalidationGeneration);
|
|
938
987
|
}
|
|
939
988
|
} catch {
|
|
940
989
|
if (authFlowsInFlightRef.current > 0) return;
|
|
@@ -943,6 +992,7 @@ var MoonXProvider = ({
|
|
|
943
992
|
schedule(tryRestore, delay);
|
|
944
993
|
} else if (!cancelled) {
|
|
945
994
|
setRevalidatedAt(Date.now());
|
|
995
|
+
sessionRevalidationGate.finish(revalidationGeneration);
|
|
946
996
|
}
|
|
947
997
|
}
|
|
948
998
|
};
|
|
@@ -952,7 +1002,7 @@ var MoonXProvider = ({
|
|
|
952
1002
|
timers.forEach(clearTimeout);
|
|
953
1003
|
timers.clear();
|
|
954
1004
|
};
|
|
955
|
-
}, [ready, restoreNonce]);
|
|
1005
|
+
}, [ready, restoreNonce, sessionRevalidationGate]);
|
|
956
1006
|
const contextValue = useMemo(
|
|
957
1007
|
() => ({
|
|
958
1008
|
sdk,
|
|
@@ -978,12 +1028,14 @@ var MoonXProvider = ({
|
|
|
978
1028
|
Animated.View,
|
|
979
1029
|
{
|
|
980
1030
|
style: [styles.backdrop, { opacity: backdropOpacity }],
|
|
981
|
-
pointerEvents:
|
|
1031
|
+
pointerEvents: webViewVisible ? "auto" : "none",
|
|
982
1032
|
children: /* @__PURE__ */ jsx(
|
|
983
1033
|
Pressable,
|
|
984
1034
|
{
|
|
985
1035
|
style: StyleSheet.absoluteFill,
|
|
986
|
-
onPress: () =>
|
|
1036
|
+
onPress: () => {
|
|
1037
|
+
if (sensitiveVisible) cancelRef.current?.();
|
|
1038
|
+
}
|
|
987
1039
|
}
|
|
988
1040
|
)
|
|
989
1041
|
}
|
|
@@ -994,24 +1046,26 @@ var MoonXProvider = ({
|
|
|
994
1046
|
style: [
|
|
995
1047
|
styles.sheetContainer,
|
|
996
1048
|
{
|
|
997
|
-
top: SHEET_TOP_OFFSET,
|
|
1049
|
+
top: captchaChallengeVisible ? 0 : SHEET_TOP_OFFSET,
|
|
998
1050
|
transform: [{ translateY: sheetTranslateY }]
|
|
999
1051
|
}
|
|
1000
1052
|
],
|
|
1001
|
-
pointerEvents:
|
|
1053
|
+
pointerEvents: webViewVisible ? "auto" : "none",
|
|
1002
1054
|
children: [
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1055
|
+
sensitiveVisible && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1056
|
+
/* @__PURE__ */ jsx(View, { style: styles.sheetGrabber }),
|
|
1057
|
+
/* @__PURE__ */ jsxs(View, { style: styles.modalChrome, children: [
|
|
1058
|
+
/* @__PURE__ */ jsx(View, { style: styles.modalTitleSpacer }),
|
|
1059
|
+
/* @__PURE__ */ jsx(
|
|
1060
|
+
Pressable,
|
|
1061
|
+
{
|
|
1062
|
+
onPress: () => cancelRef.current?.(),
|
|
1063
|
+
hitSlop: 12,
|
|
1064
|
+
style: styles.closeButton,
|
|
1065
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles.closeButtonText, children: closeLabel })
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
] })
|
|
1015
1069
|
] }),
|
|
1016
1070
|
/* @__PURE__ */ jsx(
|
|
1017
1071
|
WebView,
|
package/dist/solana.mjs
CHANGED
|
@@ -160,13 +160,15 @@ import { PostMessageMethod as PostMessageMethod3, PostMessageType as PostMessage
|
|
|
160
160
|
|
|
161
161
|
// src/transport/webview-bridge.ts
|
|
162
162
|
import {
|
|
163
|
-
FORWARDED_ERROR_FIELDS
|
|
163
|
+
FORWARDED_ERROR_FIELDS,
|
|
164
|
+
getPostMessageRequestTimeout,
|
|
165
|
+
POST_MESSAGE_REQUEST_TIMEOUT_MS
|
|
164
166
|
} from "@moon-x/core/utils";
|
|
165
167
|
|
|
166
168
|
// src/provider.tsx
|
|
167
169
|
import { SDKProvider } from "@moon-x/core/react";
|
|
168
170
|
import { validatePublishableKey } from "@moon-x/core/lib";
|
|
169
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
171
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
170
172
|
var MoonXContext = createContext(null);
|
|
171
173
|
var useMoonXContext = () => {
|
|
172
174
|
const ctx = useContext(MoonXContext);
|
package/dist/tron.mjs
CHANGED
|
@@ -159,13 +159,15 @@ import { PostMessageMethod as PostMessageMethod3, PostMessageType as PostMessage
|
|
|
159
159
|
|
|
160
160
|
// src/transport/webview-bridge.ts
|
|
161
161
|
import {
|
|
162
|
-
FORWARDED_ERROR_FIELDS
|
|
162
|
+
FORWARDED_ERROR_FIELDS,
|
|
163
|
+
getPostMessageRequestTimeout,
|
|
164
|
+
POST_MESSAGE_REQUEST_TIMEOUT_MS
|
|
163
165
|
} from "@moon-x/core/utils";
|
|
164
166
|
|
|
165
167
|
// src/provider.tsx
|
|
166
168
|
import { SDKProvider } from "@moon-x/core/react";
|
|
167
169
|
import { validatePublishableKey } from "@moon-x/core/lib";
|
|
168
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
170
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
169
171
|
var MoonXContext = createContext(null);
|
|
170
172
|
var useMoonXContext = () => {
|
|
171
173
|
const ctx = useContext(MoonXContext);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moon-x/react-native-sdk",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Headless MoonX React Native SDK with WebView-backed transport, native passkeys, and app-owned UI.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"vitest": "4.1.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@moon-x/core": "0.18.
|
|
60
|
+
"@moon-x/core": "0.18.1"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@expo/config-plugins": ">=10.0.0",
|