@getpara/react-sdk-lite 2.0.0-alpha.52 → 2.0.0-alpha.54
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/cli/cli.mjs +0 -0
- package/dist/modal/ParaModal.js +5 -5
- package/dist/modal/components/Account/Account.js +4 -3
- package/dist/modal/components/Account/AccountHeader.js +10 -16
- package/dist/modal/components/Account/AccountProfile.js +33 -4
- package/dist/modal/components/Account/AccountProfileLink.js +3 -3
- package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -2
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
- 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 +88 -37
- 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/components/common.d.ts +3 -3
- package/dist/modal/constants/constants.d.ts +8 -8
- package/dist/modal/constants/constants.js +25 -25
- 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/actions.js +1 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +2 -0
- package/dist/modal/stores/modal/useModalStore.js +1 -0
- package/dist/modal/types/modalProps.d.ts +5 -1
- package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
- package/dist/modal/utils/renderTextWithLinks.js +34 -0
- package/dist/modal/utils/steps.d.ts +6 -3
- package/dist/modal/utils/steps.js +14 -8
- package/dist/modal/utils/stringFormatters.d.ts +2 -3
- package/dist/modal/utils/stringFormatters.js +0 -5
- package/dist/provider/ParaProviderMin.js +6 -2
- package/dist/provider/actions/index.d.ts +9 -9
- package/dist/provider/components/ExternalWalletWrapper.js +5 -0
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +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/useVerifyNewAccount.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +9 -6
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +2 -0
- package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
- package/dist/provider/hooks/queries/useProfileBalance.d.ts +25 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +60 -0
- package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
- package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
- package/dist/provider/hooks/utils/useEventListeners.js +11 -1
- package/dist/provider/hooks/utils/useModal.js +3 -3
- package/dist/provider/providers/AssetsProvider.d.ts +14 -0
- package/dist/provider/providers/AssetsProvider.js +68 -0
- package/dist/provider/providers/AuthProvider.d.ts +6 -4
- package/dist/provider/providers/AuthProvider.js +120 -52
- package/dist/provider/stores/slices/modal.js +4 -1
- package/dist/provider/stores/types.d.ts +4 -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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, useContext, useMemo } from "react";
|
|
5
|
+
import { formatCurrency, formatAssetQuantity } from "@getpara/web-sdk";
|
|
6
|
+
import { useAssetInfo } from "../hooks/utils/useAssetInfo.js";
|
|
7
|
+
import { useStore } from "../stores/useStore.js";
|
|
8
|
+
import { useProfileBalance } from "../hooks/queries/index.js";
|
|
9
|
+
const AssetsContext = createContext({
|
|
10
|
+
displayCurrency: "USD",
|
|
11
|
+
profileBalance: null,
|
|
12
|
+
profileBalanceIsPending: true,
|
|
13
|
+
assetMetadata: null,
|
|
14
|
+
assetMetadataIsPending: true,
|
|
15
|
+
totalBalance: void 0
|
|
16
|
+
});
|
|
17
|
+
function AssetsProvider({ children }) {
|
|
18
|
+
const balancesConfig = useStore((state) => {
|
|
19
|
+
var _a;
|
|
20
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.balances;
|
|
21
|
+
});
|
|
22
|
+
const { data: profileBalance, isPending: profileBalanceIsPending } = useProfileBalance();
|
|
23
|
+
const { data: assetMetadata, isPending: assetMetadataIsPending } = useAssetInfo();
|
|
24
|
+
const totalBalance = useMemo(() => {
|
|
25
|
+
switch (true) {
|
|
26
|
+
case !balancesConfig:
|
|
27
|
+
case (balancesConfig == null ? void 0 : balancesConfig.displayType) === "AGGREGATED":
|
|
28
|
+
if (!(profileBalance == null ? void 0 : profileBalance.value)) {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
return formatCurrency(profileBalance.value);
|
|
32
|
+
default: {
|
|
33
|
+
if (!profileBalance) {
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
const assetQuantity = profileBalance.wallets.reduce((acc, wallet) => {
|
|
37
|
+
const asset = wallet.assets.find((a) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return ((_a = a.metadata) == null ? void 0 : _a.symbol) === balancesConfig.asset.symbol;
|
|
40
|
+
});
|
|
41
|
+
if (!asset) {
|
|
42
|
+
return acc;
|
|
43
|
+
}
|
|
44
|
+
return acc + asset.quantity;
|
|
45
|
+
}, 0);
|
|
46
|
+
return formatAssetQuantity({ quantity: assetQuantity, symbol: balancesConfig.asset.symbol });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [balancesConfig, profileBalance]);
|
|
50
|
+
const value = useMemo(
|
|
51
|
+
() => ({
|
|
52
|
+
displayCurrency: "USD",
|
|
53
|
+
profileBalance: profileBalance || null,
|
|
54
|
+
profileBalanceIsPending,
|
|
55
|
+
assetMetadata: assetMetadata || null,
|
|
56
|
+
assetMetadataIsPending,
|
|
57
|
+
totalBalance
|
|
58
|
+
}),
|
|
59
|
+
[profileBalance, totalBalance, profileBalanceIsPending, assetMetadata, assetMetadataIsPending]
|
|
60
|
+
);
|
|
61
|
+
return /* @__PURE__ */ jsx(AssetsContext.Provider, { value, children });
|
|
62
|
+
}
|
|
63
|
+
const useAssets = () => useContext(AssetsContext);
|
|
64
|
+
export {
|
|
65
|
+
AssetsContext,
|
|
66
|
+
AssetsProvider,
|
|
67
|
+
useAssets
|
|
68
|
+
};
|
|
@@ -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.BASIC_LOGIN:
|
|
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.BASIC_LOGIN, 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(() => {
|
|
@@ -15,7 +15,10 @@ const createModalSlice = (set) => ({
|
|
|
15
15
|
oAuthLogoVariant: "default",
|
|
16
16
|
isOpen: false,
|
|
17
17
|
setIsOpen: (isOpen) => set({ isOpen }),
|
|
18
|
-
|
|
18
|
+
refs: {
|
|
19
|
+
openedToStep: createRef(),
|
|
20
|
+
balancesInvalidationTime: createRef()
|
|
21
|
+
}
|
|
19
22
|
});
|
|
20
23
|
export {
|
|
21
24
|
createModalSlice
|
|
@@ -36,7 +36,10 @@ export interface ModalSlice {
|
|
|
36
36
|
oAuthLogoVariant: OAuthLogoVariantType;
|
|
37
37
|
isOpen: boolean;
|
|
38
38
|
setIsOpen: (_: boolean) => void;
|
|
39
|
-
|
|
39
|
+
refs: {
|
|
40
|
+
openedToStep: MutableRefObject<ModalStep | null>;
|
|
41
|
+
balancesInvalidationTime: MutableRefObject<number | null>;
|
|
42
|
+
};
|
|
40
43
|
}
|
|
41
44
|
export interface WalletSlice {
|
|
42
45
|
rpcUrl?: string;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk-lite",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.54",
|
|
4
4
|
"bin": {
|
|
5
5
|
"setup-para": "dist/cli/cli.mjs"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
9
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
10
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
8
|
+
"@getpara/react-common": "2.0.0-alpha.54",
|
|
9
|
+
"@getpara/react-components": "2.0.0-alpha.54",
|
|
10
|
+
"@getpara/web-sdk": "2.0.0-alpha.54",
|
|
11
11
|
"date-fns": "^3.6.0",
|
|
12
12
|
"framer-motion": "^11.3.31",
|
|
13
13
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"zustand-sync-tabs": "^0.2.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.
|
|
20
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.
|
|
21
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.
|
|
19
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.54",
|
|
20
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.54",
|
|
21
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.54",
|
|
22
22
|
"@tanstack/react-query": "^5.74.0",
|
|
23
23
|
"@testing-library/dom": "^10.4.0",
|
|
24
24
|
"@testing-library/react": "^16.3.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"package.json",
|
|
39
39
|
"styles.css"
|
|
40
40
|
],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "680049700f7b36b7ef407cab0fbfadad8c069d74",
|
|
42
42
|
"main": "dist/index.js",
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@tanstack/react-query": ">=5.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AwaitingIFrameStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useModalStore } from "../../stores/index.js";
|
|
5
|
-
import { Waiting } from "../Waiting/Waiting.js";
|
|
6
|
-
const AwaitingIFrameStep = () => {
|
|
7
|
-
const isLogin = useModalStore((state) => state.isLogin());
|
|
8
|
-
return /* @__PURE__ */ jsx(Waiting, { heading: isLogin ? "Logging you in..." : "Creating your account..." });
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
AwaitingIFrameStep
|
|
12
|
-
};
|