@getpara/react-sdk-lite 2.0.0-dev.5 → 2.0.0-dev.7
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/modal/ParaModal.js +1 -1
- package/dist/modal/components/Account/Account.js +3 -3
- package/dist/modal/components/Account/AccountProfileLink.js +3 -3
- package/dist/modal/components/AddFunds/AddFunds.js +5 -7
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.d.ts +1 -0
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +20 -0
- package/dist/modal/components/Body/Body.js +4 -4
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +20 -1
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +6 -3
- package/dist/modal/components/Header/hooks/useStepTitle.js +2 -1
- package/dist/modal/components/OAuth/FarcasterLink.d.ts +2 -0
- package/dist/modal/components/OAuth/FarcasterLink.js +30 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -3
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +47 -26
- package/dist/modal/components/OAuth/OAuth.js +2 -2
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +35 -19
- package/dist/modal/constants/constants.js +1 -1
- package/dist/modal/hooks/useFarcasterLogin.d.ts +9 -0
- package/dist/modal/hooks/useFarcasterLogin.js +70 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +4 -3
- package/dist/modal/hooks/useTelegramLogin.js +11 -3
- package/dist/modal/stores/modal/useModalStore.js +2 -1
- package/dist/modal/utils/steps.d.ts +6 -3
- package/dist/modal/utils/steps.js +14 -8
- package/dist/provider/ParaProviderMin.js +3 -3
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +6 -3
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +9 -6
- package/dist/provider/providers/AuthProvider.d.ts +6 -4
- package/dist/provider/providers/AuthProvider.js +120 -52
- package/dist/provider/providers/ExternalWalletProvider.d.ts +2 -0
- package/dist/provider/providers/ExternalWalletProvider.js +23 -4
- package/dist/provider/stores/useStore.js +2 -1
- package/dist/provider/types/provider.d.ts +1 -1
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +1 -1
- package/dist/provider/utils/paraConfigTypeGuards.js +1 -1
- package/package.json +8 -8
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +0 -1
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +0 -12
|
@@ -40,7 +40,8 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
|
|
|
40
40
|
ModalStep2["ACCOUNT_PROFILE_ADD"] = "ACCOUNT_PROFILE_ADD";
|
|
41
41
|
ModalStep2["ACCOUNT_PROFILE_LIST"] = "ACCOUNT_PROFILE_LIST";
|
|
42
42
|
ModalStep2["ACCOUNT_PROFILE_REMOVE"] = "ACCOUNT_PROFILE_REMOVE";
|
|
43
|
-
ModalStep2["
|
|
43
|
+
ModalStep2["AWAITING_ACCOUNT"] = "AWAITING_ACCOUNT";
|
|
44
|
+
ModalStep2["OTP"] = "OTP";
|
|
44
45
|
return ModalStep2;
|
|
45
46
|
})(ModalStep || {});
|
|
46
47
|
var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
|
|
@@ -72,7 +73,7 @@ const RESET_TO_AUTH_STEPS = [
|
|
|
72
73
|
"AWAITING_BIOMETRIC_CREATION" /* AWAITING_BIOMETRIC_CREATION */,
|
|
73
74
|
"PASSWORD_CREATION" /* PASSWORD_CREATION */,
|
|
74
75
|
"AWAITING_PASSWORD_CREATION" /* AWAITING_PASSWORD_CREATION */,
|
|
75
|
-
"
|
|
76
|
+
"AWAITING_ACCOUNT" /* AWAITING_ACCOUNT */,
|
|
76
77
|
"BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */,
|
|
77
78
|
"EMBEDDED_PASSWORD_LOGIN" /* EMBEDDED_PASSWORD_LOGIN */,
|
|
78
79
|
"AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */,
|
|
@@ -83,7 +84,8 @@ const RESET_TO_AUTH_STEPS = [
|
|
|
83
84
|
"SETUP_2FA" /* SETUP_2FA */,
|
|
84
85
|
"VERIFY_2FA" /* VERIFY_2FA */,
|
|
85
86
|
"TWO_FACTOR_DONE" /* TWO_FACTOR_DONE */,
|
|
86
|
-
"LOGIN_DONE" /* LOGIN_DONE
|
|
87
|
+
"LOGIN_DONE" /* LOGIN_DONE */,
|
|
88
|
+
"OTP" /* OTP */
|
|
87
89
|
];
|
|
88
90
|
const RESET_TO_ACCOUNT_STEPS = [
|
|
89
91
|
"AUTH_GUEST_SIGNUP" /* AUTH_GUEST_SIGNUP */,
|
|
@@ -141,7 +143,8 @@ var SignUpModalStep = /* @__PURE__ */ ((SignUpModalStep2) => {
|
|
|
141
143
|
SignUpModalStep2["ADD_FUNDS_AWAITING"] = "ADD_FUNDS_AWAITING";
|
|
142
144
|
SignUpModalStep2["ADD_FUNDS_SUCCESS"] = "ADD_FUNDS_SUCCESS";
|
|
143
145
|
SignUpModalStep2["ADD_FUNDS_FAILURE"] = "ADD_FUNDS_FAILURE";
|
|
144
|
-
SignUpModalStep2["
|
|
146
|
+
SignUpModalStep2["AWAITING_ACCOUNT"] = "AWAITING_ACCOUNT";
|
|
147
|
+
SignUpModalStep2["OTP"] = "OTP";
|
|
145
148
|
return SignUpModalStep2;
|
|
146
149
|
})(SignUpModalStep || {});
|
|
147
150
|
const SignUpPreviousStep = {
|
|
@@ -171,7 +174,8 @@ const SignUpPreviousStep = {
|
|
|
171
174
|
["ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */]: "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */,
|
|
172
175
|
["ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */]: void 0,
|
|
173
176
|
["ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */]: void 0,
|
|
174
|
-
["
|
|
177
|
+
["AWAITING_ACCOUNT" /* AWAITING_ACCOUNT */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
178
|
+
["OTP" /* OTP */]: "AUTH_MAIN" /* AUTH_MAIN */
|
|
175
179
|
};
|
|
176
180
|
const GuestPreviousStep = Object.fromEntries([
|
|
177
181
|
...Object.entries(SignUpPreviousStep).map(([key, value]) => {
|
|
@@ -208,7 +212,8 @@ var LoginModalStep = /* @__PURE__ */ ((LoginModalStep2) => {
|
|
|
208
212
|
LoginModalStep2["ADD_FUNDS_AWAITING"] = "ADD_FUNDS_AWAITING";
|
|
209
213
|
LoginModalStep2["ADD_FUNDS_SUCCESS"] = "ADD_FUNDS_SUCCESS";
|
|
210
214
|
LoginModalStep2["ADD_FUNDS_FAILURE"] = "ADD_FUNDS_FAILURE";
|
|
211
|
-
LoginModalStep2["
|
|
215
|
+
LoginModalStep2["AWAITING_ACCOUNT"] = "AWAITING_ACCOUNT";
|
|
216
|
+
LoginModalStep2["OTP"] = "OTP";
|
|
212
217
|
return LoginModalStep2;
|
|
213
218
|
})(LoginModalStep || {});
|
|
214
219
|
const LoginPreviousStep = {
|
|
@@ -237,7 +242,8 @@ const LoginPreviousStep = {
|
|
|
237
242
|
["ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */]: "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */,
|
|
238
243
|
["ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */]: void 0,
|
|
239
244
|
["ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */]: void 0,
|
|
240
|
-
["
|
|
245
|
+
["AWAITING_ACCOUNT" /* AWAITING_ACCOUNT */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
246
|
+
["OTP" /* OTP */]: "AUTH_MAIN" /* AUTH_MAIN */
|
|
241
247
|
};
|
|
242
248
|
const getStepHasFooter = (step) => {
|
|
243
249
|
switch (step) {
|
|
@@ -264,7 +270,7 @@ function getAddFundsStep(currentTab) {
|
|
|
264
270
|
return "ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */;
|
|
265
271
|
}
|
|
266
272
|
}
|
|
267
|
-
const IFrameSteps = ["PASSWORD_CREATION" /* PASSWORD_CREATION */, "EMBEDDED_PASSWORD_LOGIN" /* EMBEDDED_PASSWORD_LOGIN */];
|
|
273
|
+
const IFrameSteps = ["PASSWORD_CREATION" /* PASSWORD_CREATION */, "EMBEDDED_PASSWORD_LOGIN" /* EMBEDDED_PASSWORD_LOGIN */, "OTP" /* OTP */];
|
|
268
274
|
export {
|
|
269
275
|
AccountPreviousStep,
|
|
270
276
|
GuestPreviousStep,
|
|
@@ -67,7 +67,7 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
67
67
|
useEffect(() => {
|
|
68
68
|
var _a, _b;
|
|
69
69
|
if (includeWalletVerification !== (externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification)) {
|
|
70
|
-
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (
|
|
70
|
+
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isParaWeb(paraClientConfig) ? paraClientConfig.externalWalletConnectionOnly : (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly)) {
|
|
71
71
|
console.warn("includeWalletVerification has no effect when using connection only external wallets");
|
|
72
72
|
setIncludeWalletVerification(false);
|
|
73
73
|
} else {
|
|
@@ -84,7 +84,7 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
84
84
|
useEffect(() => {
|
|
85
85
|
var _a, _b;
|
|
86
86
|
if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets)) {
|
|
87
|
-
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (
|
|
87
|
+
if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isParaWeb(paraClientConfig) ? paraClientConfig.externalWalletConnectionOnly : (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly)) {
|
|
88
88
|
console.warn("createLinkedEmbeddedForExternalWallets has no effect when using connection only external wallets");
|
|
89
89
|
setExternalWalletsWithFullAuth([]);
|
|
90
90
|
} else {
|
|
@@ -98,7 +98,7 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
98
98
|
if (!isConfigType(paraClientConfig) && !isParaWeb(paraClientConfig)) {
|
|
99
99
|
throw new Error("Invalid Para config");
|
|
100
100
|
}
|
|
101
|
-
const newClient =
|
|
101
|
+
const newClient = isParaWeb(paraClientConfig) ? paraClientConfig : new ParaWeb(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts);
|
|
102
102
|
if (newClient.isReady) {
|
|
103
103
|
setIsClientReady(true);
|
|
104
104
|
} else {
|
|
@@ -16,7 +16,7 @@ export declare const SIGN_UP_LOG_IN_KEY = "SIGN_UP_LOG_IN";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const useSignUpOrLogIn: () => {
|
|
18
18
|
status: "error" | "idle" | "pending" | "success";
|
|
19
|
-
data: Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/
|
|
19
|
+
data: Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/web-sdk").AuthStateVerify> | undefined;
|
|
20
20
|
isSuccess: boolean;
|
|
21
21
|
variables: {
|
|
22
22
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
@@ -33,12 +33,12 @@ export declare const useSignUpOrLogIn: () => {
|
|
|
33
33
|
failureReason: Error | null;
|
|
34
34
|
isPaused: boolean;
|
|
35
35
|
submittedAt: number;
|
|
36
|
-
signUpOrLogIn: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/
|
|
36
|
+
signUpOrLogIn: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/web-sdk").AuthStateVerify>, Error, {
|
|
37
37
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
38
38
|
useShortUrls?: boolean | undefined;
|
|
39
39
|
auth: import("@getpara/web-sdk").VerifiedAuth;
|
|
40
40
|
}, unknown>;
|
|
41
|
-
signUpOrLogInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/
|
|
41
|
+
signUpOrLogInAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/web-sdk").AuthStateVerify>, Error, {
|
|
42
42
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
43
43
|
useShortUrls?: boolean | undefined;
|
|
44
44
|
auth: import("@getpara/web-sdk").VerifiedAuth;
|
|
@@ -16,7 +16,7 @@ export declare const VERIFY_FARCASTER_KEY = "VERIFY_FARCASTER";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const useVerifyFarcaster: () => {
|
|
18
18
|
status: "error" | "idle" | "pending" | "success";
|
|
19
|
-
data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
19
|
+
data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone> | undefined;
|
|
20
20
|
isSuccess: boolean;
|
|
21
21
|
variables: void | {
|
|
22
22
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
@@ -25,6 +25,7 @@ export declare const useVerifyFarcaster: () => {
|
|
|
25
25
|
onCancel?: (() => void) | undefined;
|
|
26
26
|
isCanceled?: (() => boolean) | undefined;
|
|
27
27
|
onConnectUri?: ((uri: string) => void) | undefined;
|
|
28
|
+
serverAuthState?: import("@getpara/user-management-client").VerifyThirdPartyAuth | undefined;
|
|
28
29
|
} | undefined;
|
|
29
30
|
error: Error | null;
|
|
30
31
|
isError: boolean;
|
|
@@ -36,20 +37,22 @@ export declare const useVerifyFarcaster: () => {
|
|
|
36
37
|
failureReason: Error | null;
|
|
37
38
|
isPaused: boolean;
|
|
38
39
|
submittedAt: number;
|
|
39
|
-
verifyFarcaster: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
40
|
+
verifyFarcaster: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone>, Error, void | {
|
|
40
41
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
41
42
|
useShortUrls?: boolean | undefined;
|
|
42
43
|
onPoll?: (() => void) | undefined;
|
|
43
44
|
onCancel?: (() => void) | undefined;
|
|
44
45
|
isCanceled?: (() => boolean) | undefined;
|
|
45
46
|
onConnectUri?: ((uri: string) => void) | undefined;
|
|
47
|
+
serverAuthState?: import("@getpara/user-management-client").VerifyThirdPartyAuth | undefined;
|
|
46
48
|
}, unknown>;
|
|
47
|
-
verifyFarcasterAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
49
|
+
verifyFarcasterAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone>, Error, void | {
|
|
48
50
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
49
51
|
useShortUrls?: boolean | undefined;
|
|
50
52
|
onPoll?: (() => void) | undefined;
|
|
51
53
|
onCancel?: (() => void) | undefined;
|
|
52
54
|
isCanceled?: (() => boolean) | undefined;
|
|
53
55
|
onConnectUri?: ((uri: string) => void) | undefined;
|
|
56
|
+
serverAuthState?: import("@getpara/user-management-client").VerifyThirdPartyAuth | undefined;
|
|
54
57
|
}, unknown>;
|
|
55
58
|
};
|
|
@@ -16,7 +16,7 @@ export declare const VERIFY_OAUTH_KEY = "VERIFY_OAUTH";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const useVerifyOAuth: () => {
|
|
18
18
|
status: "error" | "idle" | "pending" | "success";
|
|
19
|
-
data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
19
|
+
data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone> | undefined;
|
|
20
20
|
isSuccess: boolean;
|
|
21
21
|
variables: {
|
|
22
22
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
@@ -39,7 +39,7 @@ export declare const useVerifyOAuth: () => {
|
|
|
39
39
|
failureReason: Error | null;
|
|
40
40
|
isPaused: boolean;
|
|
41
41
|
submittedAt: number;
|
|
42
|
-
verifyOAuth: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
42
|
+
verifyOAuth: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone>, Error, {
|
|
43
43
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
44
44
|
useShortUrls?: boolean | undefined;
|
|
45
45
|
method: Exclude<import("@getpara/web-sdk").TOAuthMethod, "TELEGRAM" | "FARCASTER">;
|
|
@@ -50,7 +50,7 @@ export declare const useVerifyOAuth: () => {
|
|
|
50
50
|
onOAuthUrl?: ((url: string) => void) | undefined;
|
|
51
51
|
onOAuthPopup?: ((popup: Window) => void) | undefined;
|
|
52
52
|
}, unknown>;
|
|
53
|
-
verifyOAuthAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
53
|
+
verifyOAuthAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone>, Error, {
|
|
54
54
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
55
55
|
useShortUrls?: boolean | undefined;
|
|
56
56
|
method: Exclude<import("@getpara/web-sdk").TOAuthMethod, "TELEGRAM" | "FARCASTER">;
|
|
@@ -16,12 +16,13 @@ export declare const VERIFY_TELEGRAM_KEY = "VERIFY_TELEGRAM";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const useVerifyTelegram: () => {
|
|
18
18
|
status: "error" | "idle" | "pending" | "success";
|
|
19
|
-
data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
19
|
+
data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone> | undefined;
|
|
20
20
|
isSuccess: boolean;
|
|
21
21
|
variables: {
|
|
22
22
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
23
23
|
useShortUrls?: boolean | undefined;
|
|
24
|
-
telegramAuthResponse
|
|
24
|
+
telegramAuthResponse?: import("@getpara/web-sdk").TelegramAuthResponse | undefined;
|
|
25
|
+
serverAuthState?: import("@getpara/user-management-client").VerifyThirdPartyAuth | undefined;
|
|
25
26
|
} | undefined;
|
|
26
27
|
error: Error | null;
|
|
27
28
|
isError: boolean;
|
|
@@ -33,14 +34,16 @@ export declare const useVerifyTelegram: () => {
|
|
|
33
34
|
failureReason: Error | null;
|
|
34
35
|
isPaused: boolean;
|
|
35
36
|
submittedAt: number;
|
|
36
|
-
verifyTelegram: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
37
|
+
verifyTelegram: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone>, Error, {
|
|
37
38
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
38
39
|
useShortUrls?: boolean | undefined;
|
|
39
|
-
telegramAuthResponse
|
|
40
|
+
telegramAuthResponse?: import("@getpara/web-sdk").TelegramAuthResponse | undefined;
|
|
41
|
+
serverAuthState?: import("@getpara/user-management-client").VerifyThirdPartyAuth | undefined;
|
|
40
42
|
}, unknown>;
|
|
41
|
-
verifyTelegramAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").
|
|
43
|
+
verifyTelegramAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateSignupOrLoginOrDone>, Error, {
|
|
42
44
|
portalTheme?: import("@getpara/web-sdk").Theme | undefined;
|
|
43
45
|
useShortUrls?: boolean | undefined;
|
|
44
|
-
telegramAuthResponse
|
|
46
|
+
telegramAuthResponse?: import("@getpara/web-sdk").TelegramAuthResponse | undefined;
|
|
47
|
+
serverAuthState?: import("@getpara/user-management-client").VerifyThirdPartyAuth | undefined;
|
|
45
48
|
}, unknown>;
|
|
46
49
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BiometricHints } from '@getpara/react-common';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { AuthMethod, CoreMethodParams, AuthState, AuthStateSignup, AuthStateLogin } from '@getpara/web-sdk';
|
|
3
|
+
import { AuthMethod, CoreMethodParams, AuthState, AuthStateSignup, AuthStateLogin, AuthStateVerify } from '@getpara/web-sdk';
|
|
4
4
|
import { ParaModalProps } from '../../modal/types/modalProps.js';
|
|
5
|
-
import {
|
|
5
|
+
import { VerifiedAuth, VerifyThirdPartyAuth } from '@getpara/user-management-client';
|
|
6
6
|
import { MutationStatus } from '@tanstack/react-query';
|
|
7
7
|
type Value = {
|
|
8
8
|
signUpOrLogIn: (_: VerifiedAuth) => void;
|
|
@@ -11,12 +11,14 @@ type Value = {
|
|
|
11
11
|
verifyNewAccountStatus: MutationStatus;
|
|
12
12
|
verifyNewAccountError: Error | null;
|
|
13
13
|
verifyOAuth: (_: CoreMethodParams<'verifyOAuth'>['method']) => void;
|
|
14
|
-
verifyFarcaster: () => void;
|
|
15
|
-
verifyTelegram: (_:
|
|
14
|
+
verifyFarcaster: (_?: VerifyThirdPartyAuth) => void;
|
|
15
|
+
verifyTelegram: (_: VerifyThirdPartyAuth) => void;
|
|
16
16
|
verifyTelegramStatus: MutationStatus;
|
|
17
|
+
verifyFarcasterStatus: MutationStatus;
|
|
17
18
|
onNewAuthState: (_: AuthState) => void;
|
|
18
19
|
presentSignupUi: (_: AuthMethod, __: AuthStateSignup) => void;
|
|
19
20
|
presentLoginUi: (_: AuthMethod, __: AuthStateLogin) => void;
|
|
21
|
+
presentVerifyUi: (_: AuthMethod, __: AuthStateVerify) => void;
|
|
20
22
|
isSetup2faPending: boolean;
|
|
21
23
|
createGuestWallets: () => void;
|
|
22
24
|
isCreateGuestWalletsPending: boolean;
|
|
@@ -51,6 +51,7 @@ const AuthContext = createContext({
|
|
|
51
51
|
verifyTelegram: () => {
|
|
52
52
|
},
|
|
53
53
|
verifyTelegramStatus: "idle",
|
|
54
|
+
verifyFarcasterStatus: "idle",
|
|
54
55
|
onNewAuthState: () => {
|
|
55
56
|
},
|
|
56
57
|
isSetup2faPending: false,
|
|
@@ -58,6 +59,8 @@ const AuthContext = createContext({
|
|
|
58
59
|
},
|
|
59
60
|
presentLoginUi: () => {
|
|
60
61
|
},
|
|
62
|
+
presentVerifyUi: () => {
|
|
63
|
+
},
|
|
61
64
|
createGuestWallets: () => {
|
|
62
65
|
},
|
|
63
66
|
isCreateGuestWalletsPending: false,
|
|
@@ -103,7 +106,7 @@ function AuthProvider({
|
|
|
103
106
|
error: verifyNewAccountError
|
|
104
107
|
} = useVerifyNewAccount();
|
|
105
108
|
const { verifyOAuth: mutateVerifyOAuth } = useVerifyOAuth();
|
|
106
|
-
const { verifyFarcaster: mutateVerifyFarcaster } = useVerifyFarcaster();
|
|
109
|
+
const { verifyFarcaster: mutateVerifyFarcaster, status: verifyFarcasterStatus } = useVerifyFarcaster();
|
|
107
110
|
const { verifyTelegram: mutateVerifyTelegram, status: verifyTelegramStatus } = useVerifyTelegram();
|
|
108
111
|
const { waitForLogin: mutateWaitForLogin } = useWaitForLogin();
|
|
109
112
|
const { waitForSignup: mutateWaitForSignup } = useWaitForSignup();
|
|
@@ -127,7 +130,8 @@ function AuthProvider({
|
|
|
127
130
|
window.addEventListener("message", function handleMessage(event) {
|
|
128
131
|
var _a;
|
|
129
132
|
const portalBase = getPortalBaseURL(para.ctx);
|
|
130
|
-
|
|
133
|
+
const portalLocalBase = getPortalBaseURL(para.ctx, true);
|
|
134
|
+
if (!event.origin.startsWith(portalBase) && !event.origin.startsWith(portalLocalBase)) {
|
|
131
135
|
return;
|
|
132
136
|
}
|
|
133
137
|
if (((_a = event.data) == null ? void 0 : _a.type) === "CLOSE_WINDOW") {
|
|
@@ -135,13 +139,13 @@ function AuthProvider({
|
|
|
135
139
|
setAuthStepRoute();
|
|
136
140
|
setIFrameUrl();
|
|
137
141
|
setIsIFrameReady(false);
|
|
138
|
-
setStep(ModalStep.
|
|
142
|
+
setStep(ModalStep.AWAITING_ACCOUNT);
|
|
139
143
|
}
|
|
140
144
|
window.removeEventListener("message", handleMessage);
|
|
141
145
|
}
|
|
142
146
|
});
|
|
143
147
|
};
|
|
144
|
-
const
|
|
148
|
+
const pollSignup = () => {
|
|
145
149
|
if (typeof window !== "undefined") {
|
|
146
150
|
refs.poll.current = {
|
|
147
151
|
action: "signup",
|
|
@@ -152,10 +156,11 @@ function AuthProvider({
|
|
|
152
156
|
ModalStep.BIOMETRIC_CREATION,
|
|
153
157
|
ModalStep.AWAITING_BIOMETRIC_CREATION,
|
|
154
158
|
ModalStep.PASSWORD_CREATION,
|
|
155
|
-
ModalStep.
|
|
159
|
+
ModalStep.AWAITING_ACCOUNT,
|
|
156
160
|
ModalStep.VERIFICATIONS,
|
|
157
161
|
ModalStep.AWAITING_OAUTH,
|
|
158
|
-
ModalStep.EXTERNAL_WALLET_VERIFICATION
|
|
162
|
+
ModalStep.EXTERNAL_WALLET_VERIFICATION,
|
|
163
|
+
ModalStep.OTP
|
|
159
164
|
]),
|
|
160
165
|
onPoll: () => {
|
|
161
166
|
goBackIfPopupClosedOnSteps([ModalStep.AWAITING_BIOMETRIC_CREATION]);
|
|
@@ -173,7 +178,7 @@ function AuthProvider({
|
|
|
173
178
|
}
|
|
174
179
|
},
|
|
175
180
|
onError: () => {
|
|
176
|
-
if (refs.currentStep.current && [ModalStep.AWAITING_BIOMETRIC_CREATION, ModalStep.PASSWORD_CREATION, ModalStep.
|
|
181
|
+
if (refs.currentStep.current && [ModalStep.AWAITING_BIOMETRIC_CREATION, ModalStep.PASSWORD_CREATION, ModalStep.AWAITING_ACCOUNT].includes(
|
|
177
182
|
refs.currentStep.current
|
|
178
183
|
)) {
|
|
179
184
|
goBack();
|
|
@@ -229,6 +234,23 @@ function AuthProvider({
|
|
|
229
234
|
},
|
|
230
235
|
[isIFrameReady]
|
|
231
236
|
);
|
|
237
|
+
const presentVerifyUi = useCallback(
|
|
238
|
+
(method, authState) => {
|
|
239
|
+
switch (method) {
|
|
240
|
+
case AuthMethod.SLO:
|
|
241
|
+
setupListener();
|
|
242
|
+
if (isIFrameReady) {
|
|
243
|
+
setStep(ModalStep.OTP);
|
|
244
|
+
} else {
|
|
245
|
+
setIFrameUrl(authState.loginUrl);
|
|
246
|
+
setIsIFrameReady(false);
|
|
247
|
+
setAuthStepRoute(ModalStep.OTP);
|
|
248
|
+
}
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
[isIFrameReady]
|
|
253
|
+
);
|
|
232
254
|
const login = (authState) => {
|
|
233
255
|
if (authState.isWalletSelectionNeeded || authState.passkeyUrl) {
|
|
234
256
|
setStep(ModalStep.BIOMETRIC_LOGIN);
|
|
@@ -238,47 +260,56 @@ function AuthProvider({
|
|
|
238
260
|
setIsIFrameReady(false);
|
|
239
261
|
setStep(ModalStep.EMBEDDED_PASSWORD_LOGIN);
|
|
240
262
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
onPoll: () => {
|
|
254
|
-
goBackIfPopupClosedOnSteps([
|
|
263
|
+
pollLogin();
|
|
264
|
+
};
|
|
265
|
+
const pollLogin = () => {
|
|
266
|
+
if (typeof window !== "undefined") {
|
|
267
|
+
refs.poll.current = {
|
|
268
|
+
action: "login",
|
|
269
|
+
timeout: window == null ? void 0 : window.setTimeout(() => __async(this, null, function* () {
|
|
270
|
+
mutateWaitForLogin(
|
|
271
|
+
{
|
|
272
|
+
isCanceled: () => cancelIfExitedSteps([
|
|
273
|
+
ModalStep.BIOMETRIC_LOGIN,
|
|
274
|
+
ModalStep.EMBEDDED_PASSWORD_LOGIN,
|
|
255
275
|
ModalStep.AWAITING_BIOMETRIC_LOGIN,
|
|
256
276
|
ModalStep.AWAITING_PASSWORD_LOGIN,
|
|
257
|
-
ModalStep.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
277
|
+
ModalStep.AWAITING_ACCOUNT,
|
|
278
|
+
ModalStep.OTP,
|
|
279
|
+
ModalStep.FARCASTER_OAUTH,
|
|
280
|
+
ModalStep.TELEGRAM_OAUTH
|
|
281
|
+
]),
|
|
282
|
+
onPoll: () => {
|
|
283
|
+
goBackIfPopupClosedOnSteps([
|
|
284
|
+
ModalStep.AWAITING_BIOMETRIC_LOGIN,
|
|
285
|
+
ModalStep.AWAITING_PASSWORD_LOGIN,
|
|
286
|
+
ModalStep.EMBEDDED_PASSWORD_LOGIN,
|
|
287
|
+
ModalStep.OTP
|
|
288
|
+
]);
|
|
270
289
|
}
|
|
271
290
|
},
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
291
|
+
{
|
|
292
|
+
onSuccess: ({ needsWallet }) => {
|
|
293
|
+
if (needsWallet && !para.isNoWalletConfig) {
|
|
294
|
+
createWallets();
|
|
295
|
+
} else {
|
|
296
|
+
onLoginComplete({
|
|
297
|
+
on2faSetupOrError: () => setStep(ModalStep.LOGIN_DONE),
|
|
298
|
+
on2faNotSetup: () => setStep(ModalStep.SETUP_2FA)
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
onSettled: () => {
|
|
303
|
+
var _a;
|
|
304
|
+
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
305
|
+
refs.poll.current = null;
|
|
306
|
+
refs.popupWindow.current = null;
|
|
307
|
+
}
|
|
277
308
|
}
|
|
278
|
-
|
|
279
|
-
)
|
|
280
|
-
}
|
|
281
|
-
}
|
|
309
|
+
);
|
|
310
|
+
}), DEFAULTS.LOGGIN_POLLING_DELAY_MS)
|
|
311
|
+
};
|
|
312
|
+
}
|
|
282
313
|
};
|
|
283
314
|
const presentLoginUi = useCallback(
|
|
284
315
|
(method, authState) => {
|
|
@@ -313,7 +344,20 @@ function AuthProvider({
|
|
|
313
344
|
if (isExternalWallet(authState.auth) && authState.signatureVerificationMessage) {
|
|
314
345
|
setStep(ModalStep.EXTERNAL_WALLET_VERIFICATION);
|
|
315
346
|
} else {
|
|
316
|
-
|
|
347
|
+
if (authState.nextStage === "login") {
|
|
348
|
+
setFlow("login");
|
|
349
|
+
pollLogin();
|
|
350
|
+
} else {
|
|
351
|
+
setFlow("signup");
|
|
352
|
+
pollSignup();
|
|
353
|
+
}
|
|
354
|
+
if (authState.loginUrl) {
|
|
355
|
+
setIFrameUrl(authState.loginUrl);
|
|
356
|
+
setIsIFrameReady(false);
|
|
357
|
+
presentVerifyUi(AuthMethod.SLO, authState);
|
|
358
|
+
} else {
|
|
359
|
+
setStep(ModalStep.VERIFICATIONS);
|
|
360
|
+
}
|
|
317
361
|
}
|
|
318
362
|
break;
|
|
319
363
|
case "login":
|
|
@@ -330,7 +374,7 @@ function AuthProvider({
|
|
|
330
374
|
setIFrameUrl(authState.passwordUrl || authState.pinUrl);
|
|
331
375
|
setIsIFrameReady(false);
|
|
332
376
|
}
|
|
333
|
-
|
|
377
|
+
pollSignup();
|
|
334
378
|
if (isPasswordOrPINOnly) {
|
|
335
379
|
presentSignupUi(isPassword ? AuthMethod.PASSWORD : AuthMethod.PIN, authState);
|
|
336
380
|
} else {
|
|
@@ -338,6 +382,18 @@ function AuthProvider({
|
|
|
338
382
|
}
|
|
339
383
|
}
|
|
340
384
|
break;
|
|
385
|
+
case "done":
|
|
386
|
+
if (authState.isNewUser) {
|
|
387
|
+
pollSignup();
|
|
388
|
+
setFlow("signup");
|
|
389
|
+
} else {
|
|
390
|
+
pollLogin();
|
|
391
|
+
setFlow("login");
|
|
392
|
+
}
|
|
393
|
+
if (!authState.isWalletSelectionNeeded) {
|
|
394
|
+
setStep(ModalStep.AWAITING_ACCOUNT);
|
|
395
|
+
}
|
|
396
|
+
break;
|
|
341
397
|
}
|
|
342
398
|
});
|
|
343
399
|
const signUpOrLogIn = (auth) => __async(this, null, function* () {
|
|
@@ -381,8 +437,12 @@ function AuthProvider({
|
|
|
381
437
|
}
|
|
382
438
|
);
|
|
383
439
|
});
|
|
384
|
-
const verifyFarcaster = () => __async(this, null, function* () {
|
|
385
|
-
|
|
440
|
+
const verifyFarcaster = (serverAuthState) => __async(this, null, function* () {
|
|
441
|
+
if (!serverAuthState) {
|
|
442
|
+
setStep(ModalStep.FARCASTER_OAUTH);
|
|
443
|
+
} else {
|
|
444
|
+
setupListener();
|
|
445
|
+
}
|
|
386
446
|
mutateVerifyFarcaster(
|
|
387
447
|
{
|
|
388
448
|
isCanceled: () => refs.currentStep.current !== ModalStep.FARCASTER_OAUTH,
|
|
@@ -390,7 +450,8 @@ function AuthProvider({
|
|
|
390
450
|
setFarcasterConnectUri(connectUri);
|
|
391
451
|
routeMobileExternalWallet(connectUri);
|
|
392
452
|
},
|
|
393
|
-
useShortUrls: true
|
|
453
|
+
useShortUrls: true,
|
|
454
|
+
serverAuthState
|
|
394
455
|
},
|
|
395
456
|
{
|
|
396
457
|
onSuccess: onNewAuthState,
|
|
@@ -402,10 +463,13 @@ function AuthProvider({
|
|
|
402
463
|
}
|
|
403
464
|
);
|
|
404
465
|
});
|
|
405
|
-
const verifyTelegram = (
|
|
466
|
+
const verifyTelegram = (serverAuthState) => __async(this, null, function* () {
|
|
467
|
+
if (serverAuthState) {
|
|
468
|
+
setupListener();
|
|
469
|
+
}
|
|
406
470
|
mutateVerifyTelegram(
|
|
407
471
|
{
|
|
408
|
-
|
|
472
|
+
serverAuthState,
|
|
409
473
|
useShortUrls: true
|
|
410
474
|
},
|
|
411
475
|
{
|
|
@@ -497,6 +561,7 @@ function AuthProvider({
|
|
|
497
561
|
() => ({
|
|
498
562
|
presentSignupUi,
|
|
499
563
|
presentLoginUi,
|
|
564
|
+
presentVerifyUi,
|
|
500
565
|
signUpOrLogIn,
|
|
501
566
|
isSignUpOrLogInPending,
|
|
502
567
|
verifyNewAccount,
|
|
@@ -511,11 +576,13 @@ function AuthProvider({
|
|
|
511
576
|
createGuestWallets,
|
|
512
577
|
isCreateGuestWalletsPending,
|
|
513
578
|
logout,
|
|
514
|
-
biometricHints: biometricHints || void 0
|
|
579
|
+
biometricHints: biometricHints || void 0,
|
|
580
|
+
verifyFarcasterStatus
|
|
515
581
|
}),
|
|
516
582
|
[
|
|
517
583
|
presentSignupUi,
|
|
518
584
|
presentLoginUi,
|
|
585
|
+
presentVerifyUi,
|
|
519
586
|
signUpOrLogIn,
|
|
520
587
|
isSignUpOrLogInPending,
|
|
521
588
|
verifyNewAccount,
|
|
@@ -531,7 +598,8 @@ function AuthProvider({
|
|
|
531
598
|
createGuestWallets,
|
|
532
599
|
isCreateGuestWalletsPending,
|
|
533
600
|
logout,
|
|
534
|
-
biometricHints
|
|
601
|
+
biometricHints,
|
|
602
|
+
verifyFarcasterStatus
|
|
535
603
|
]
|
|
536
604
|
);
|
|
537
605
|
useEffect(() => {
|
|
@@ -34,6 +34,7 @@ export declare const defaultExternalWallet: {
|
|
|
34
34
|
requestInfo: (_: string) => Promise<ExternalWalletInfo>;
|
|
35
35
|
disconnectBase: (_: string, __: TWalletType) => Promise<void>;
|
|
36
36
|
connectFarcasterMiniApp: () => Promise<void>;
|
|
37
|
+
verificationStage: undefined;
|
|
37
38
|
};
|
|
38
39
|
type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo' | 'disconnectBase'> & ChainManagement<string, void> & BalanceManagement & {
|
|
39
40
|
wallet?: CommonWallet;
|
|
@@ -55,6 +56,7 @@ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 's
|
|
|
55
56
|
requestInfo: (_: string, __: TWalletType) => Promise<ExternalWalletInfo>;
|
|
56
57
|
disconnectBase: (_: string, __: TWalletType) => Promise<void>;
|
|
57
58
|
connectFarcasterMiniApp: () => Promise<void>;
|
|
59
|
+
verificationStage?: 'verifying' | 'switchingChain';
|
|
58
60
|
};
|
|
59
61
|
export declare const ExternalWalletContext: import("react").Context<Value>;
|
|
60
62
|
export declare function ExternalWalletProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|