@getpara/react-sdk 1.4.4 → 1.5.1
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/{MoonPayEmbed-AVCVVVLY.js → MoonPayEmbed-Q2HP2BFI.js} +1 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
- package/dist/chunk-MMUBH76A.js +59 -0
- package/dist/chunk-MMUBH76A.js.br +0 -0
- package/dist/chunk-MMUBH76A.js.gz +0 -0
- package/dist/index.js +672 -580
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +2 -0
- package/package.json +5 -5
- package/dist/MoonPayEmbed-AVCVVVLY.js.br +0 -0
- package/dist/MoonPayEmbed-AVCVVVLY.js.gz +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async,
|
|
4
|
+
__objRest,
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues
|
|
7
|
+
} from "./chunk-MMUBH76A.js";
|
|
2
8
|
|
|
3
9
|
// src/modal/ParaModal.tsx
|
|
4
10
|
import { CpslAuthModal, defineCustomElements, generateTheme } from "@getpara/react-components";
|
|
@@ -10,8 +16,7 @@ import {
|
|
|
10
16
|
OnRampProvider as OnRampProvider4,
|
|
11
17
|
OnRampAsset as OnRampAsset3,
|
|
12
18
|
Network as Network3,
|
|
13
|
-
EnabledFlow as EnabledFlow3
|
|
14
|
-
isPasskeySupported as isPasskeySupported3
|
|
19
|
+
EnabledFlow as EnabledFlow3
|
|
15
20
|
} from "@getpara/web-sdk";
|
|
16
21
|
|
|
17
22
|
// src/modal/stores/modal/useModalStore.ts
|
|
@@ -179,9 +184,10 @@ var getActions = (set, get) => ({
|
|
|
179
184
|
const onModalStepChange = get().onModalStepChange;
|
|
180
185
|
const previousStep = get().step;
|
|
181
186
|
set({ step });
|
|
182
|
-
onModalStepChange
|
|
187
|
+
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep, currentStep: step, canGoBack: get().hasPreviousStep() });
|
|
183
188
|
},
|
|
184
189
|
decrementStep: () => {
|
|
190
|
+
var _a;
|
|
185
191
|
const onModalStepChange = get().onModalStepChange;
|
|
186
192
|
const isLogin = get().flow === "login";
|
|
187
193
|
const isAccount = get().flow === "account";
|
|
@@ -198,9 +204,9 @@ var getActions = (set, get) => ({
|
|
|
198
204
|
}
|
|
199
205
|
if (prevStep) {
|
|
200
206
|
set({ step: prevStep, stepDirection: -1 });
|
|
201
|
-
onModalStepChange
|
|
207
|
+
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep: currentStep, currentStep: prevStep, canGoBack: get().hasPreviousStep() });
|
|
202
208
|
}
|
|
203
|
-
refs.popupWindow.current
|
|
209
|
+
(_a = refs.popupWindow.current) == null ? void 0 : _a.close();
|
|
204
210
|
refs.popupWindow.current = void 0;
|
|
205
211
|
},
|
|
206
212
|
hasPreviousStep: () => {
|
|
@@ -216,7 +222,7 @@ var getActions = (set, get) => ({
|
|
|
216
222
|
setWebAuthURLForCreate: (url) => set({ webAuthURLForCreate: url }),
|
|
217
223
|
setPasswordUrlForLogin: (url) => set({ passwordUrlForLogin: url }),
|
|
218
224
|
setSupportedAuthMethods: (supportedAuthMethods) => set({ supportedAuthMethods }),
|
|
219
|
-
setOnRampPurchase: (onRampPurchase) => set((state) => ({ onRampPurchase: {
|
|
225
|
+
setOnRampPurchase: (onRampPurchase) => set((state) => ({ onRampPurchase: __spreadValues(__spreadValues({}, state.onRampPurchase || {}), onRampPurchase) })),
|
|
220
226
|
setOnRampConfig: (onRampConfig) => set({ onRampConfig }),
|
|
221
227
|
setIsFullyLoggedIn: (isFullyLoggedIn) => set({ isFullyLoggedIn }),
|
|
222
228
|
setAccountAddFundTab: (accountAddFundTab) => set({ accountAddFundTab }),
|
|
@@ -229,7 +235,8 @@ var getActions = (set, get) => ({
|
|
|
229
235
|
setBiometricLocationHints: (biometricLocationHints) => set({ biometricLocationHints }),
|
|
230
236
|
setIFrameUrl: (iFrameUrl) => set({ iFrameUrl }),
|
|
231
237
|
setIsIFrameReady: (isIFrameReady) => set({ isIFrameReady }),
|
|
232
|
-
setAuthStepRoute: (authStepRoute) => set({ authStepRoute })
|
|
238
|
+
setAuthStepRoute: (authStepRoute) => set({ authStepRoute }),
|
|
239
|
+
setIsPasskeySupported: (isPasskeySupported2) => set({ isPasskeySupported: isPasskeySupported2 })
|
|
233
240
|
});
|
|
234
241
|
|
|
235
242
|
// src/modal/stores/modal/useModalStore.ts
|
|
@@ -257,17 +264,16 @@ var DEFAULT_MODAL_STATE = {
|
|
|
257
264
|
poll: createRef(),
|
|
258
265
|
currentStep: createRef()
|
|
259
266
|
},
|
|
260
|
-
authStepRoute: void 0
|
|
267
|
+
authStepRoute: void 0,
|
|
268
|
+
isPasskeySupported: true
|
|
261
269
|
};
|
|
262
270
|
var useModalStore = create()(
|
|
263
271
|
persist(
|
|
264
|
-
(set, get) => ({
|
|
272
|
+
(set, get) => __spreadValues(__spreadValues({
|
|
265
273
|
step: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
266
274
|
onRampConfig: void 0,
|
|
267
|
-
activeWallet: void 0
|
|
268
|
-
|
|
269
|
-
...getActions(set, get)
|
|
270
|
-
}),
|
|
275
|
+
activeWallet: void 0
|
|
276
|
+
}, DEFAULT_MODAL_STATE), getActions(set, get)),
|
|
271
277
|
{
|
|
272
278
|
version: 1,
|
|
273
279
|
name: "@PARA/modalState",
|
|
@@ -281,7 +287,8 @@ var useModalStore = create()(
|
|
|
281
287
|
onRampPurchase: state.onRampPurchase,
|
|
282
288
|
selectedExternalWalletId: state.selectedExternalWalletId,
|
|
283
289
|
isUsingMobileConnector: state.isUsingMobileConnector,
|
|
284
|
-
supportedAuthMethods: state.supportedAuthMethods
|
|
290
|
+
supportedAuthMethods: state.supportedAuthMethods,
|
|
291
|
+
isPasskeySupported: state.isPasskeySupported
|
|
285
292
|
})
|
|
286
293
|
}
|
|
287
294
|
)
|
|
@@ -296,12 +303,13 @@ var getActions2 = (set, get) => ({
|
|
|
296
303
|
resetState: () => {
|
|
297
304
|
set(DEFAULT_USER_INFO_STATE);
|
|
298
305
|
},
|
|
299
|
-
setAuthInfo: (
|
|
306
|
+
setAuthInfo: (_a) => {
|
|
307
|
+
var _b = _a, { pfpUrl, displayName } = _b, auth = __objRest(_b, ["pfpUrl", "displayName"]);
|
|
300
308
|
set({ auth, pfpUrl: pfpUrl || null, displayName: displayName || null });
|
|
301
309
|
},
|
|
302
310
|
getAuthInfo: () => {
|
|
303
311
|
try {
|
|
304
|
-
return get().auth ? {
|
|
312
|
+
return get().auth ? __spreadProps(__spreadValues({}, extractAuthInfo(get().auth, { isRequired: true })), { pfpUrl: get().pfpUrl, displayName: get().displayName }) : null;
|
|
305
313
|
} catch (e) {
|
|
306
314
|
return null;
|
|
307
315
|
}
|
|
@@ -318,10 +326,7 @@ var DEFAULT_USER_INFO_STATE = {
|
|
|
318
326
|
pfpUrl: null,
|
|
319
327
|
displayName: null
|
|
320
328
|
};
|
|
321
|
-
var useUserInfoStore = create2((set, get) => ({
|
|
322
|
-
...DEFAULT_USER_INFO_STATE,
|
|
323
|
-
...getActions2(set, get)
|
|
324
|
-
}));
|
|
329
|
+
var useUserInfoStore = create2((set, get) => __spreadValues(__spreadValues({}, DEFAULT_USER_INFO_STATE), getActions2(set, get)));
|
|
325
330
|
|
|
326
331
|
// src/modal/stores/theme/useThemeStore.ts
|
|
327
332
|
import { create as create3 } from "zustand";
|
|
@@ -332,7 +337,8 @@ var getActions3 = (set, get) => ({
|
|
|
332
337
|
set(state);
|
|
333
338
|
},
|
|
334
339
|
getLogo: () => {
|
|
335
|
-
|
|
340
|
+
var _a;
|
|
341
|
+
return (_a = get().logo) != null ? _a : void 0;
|
|
336
342
|
},
|
|
337
343
|
setAuthLayout: (authLayout) => {
|
|
338
344
|
const types = [];
|
|
@@ -370,10 +376,7 @@ var DEFAULT_THEME = {
|
|
|
370
376
|
authLayout: ["AUTH:FULL" /* AUTH_FULL */, "EXTERNAL:FULL" /* EXTERNAL_FULL */],
|
|
371
377
|
hideWallets: false
|
|
372
378
|
};
|
|
373
|
-
var useThemeStore = create3((set, get) => ({
|
|
374
|
-
...DEFAULT_THEME,
|
|
375
|
-
...getActions3(set, get)
|
|
376
|
-
}));
|
|
379
|
+
var useThemeStore = create3((set, get) => __spreadValues(__spreadValues({}, DEFAULT_THEME), getActions3(set, get)));
|
|
377
380
|
|
|
378
381
|
// src/modal/components/Body/Body.tsx
|
|
379
382
|
import { styled as styled27 } from "styled-components";
|
|
@@ -483,11 +486,7 @@ var createWalletSlice = (set) => ({
|
|
|
483
486
|
import { createJSONStorage as createJSONStorage2, persist as persist2 } from "zustand/middleware";
|
|
484
487
|
var vanillaStore = createStore()(
|
|
485
488
|
persist2(
|
|
486
|
-
(...a) => ({
|
|
487
|
-
...createClientSlice(...a),
|
|
488
|
-
...createModalSlice(...a),
|
|
489
|
-
...createWalletSlice(...a)
|
|
490
|
-
}),
|
|
489
|
+
(...a) => __spreadValues(__spreadValues(__spreadValues({}, createClientSlice(...a)), createModalSlice(...a)), createWalletSlice(...a)),
|
|
491
490
|
{
|
|
492
491
|
version: 1,
|
|
493
492
|
name: "@PARA/web-state",
|
|
@@ -525,10 +524,11 @@ var VerificationCodeStep = () => {
|
|
|
525
524
|
const [resendStatus, setResendStatus] = useState("Resend.");
|
|
526
525
|
const [resendDisabled, setResendDisabled] = useState(false);
|
|
527
526
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
528
|
-
const isEmail = authInfo
|
|
527
|
+
const isEmail = (authInfo == null ? void 0 : authInfo.authType) === "email";
|
|
529
528
|
useEffect(() => {
|
|
530
529
|
setTimeout(() => {
|
|
531
|
-
|
|
530
|
+
var _a, _b;
|
|
531
|
+
(_b = (_a = inputRef.current.shadowRoot.querySelectorAll("input")) == null ? void 0 : _a[0]) == null ? void 0 : _b.focus();
|
|
532
532
|
}, 10);
|
|
533
533
|
}, []);
|
|
534
534
|
useEffect(() => {
|
|
@@ -536,46 +536,46 @@ var VerificationCodeStep = () => {
|
|
|
536
536
|
handleSubmitCode();
|
|
537
537
|
}
|
|
538
538
|
}, [code]);
|
|
539
|
-
const handleResendClick =
|
|
539
|
+
const handleResendClick = () => __async(void 0, null, function* () {
|
|
540
540
|
if (!resendDisabled) {
|
|
541
541
|
setResendStatus("Resent!");
|
|
542
542
|
setResendDisabled(true);
|
|
543
|
-
isEmail ?
|
|
543
|
+
isEmail ? yield para.resendVerificationCode() : yield para.resendVerificationCodeByPhone();
|
|
544
544
|
setTimeout(() => {
|
|
545
545
|
setResendStatus("Resend.");
|
|
546
546
|
setResendDisabled(false);
|
|
547
547
|
}, 3e3);
|
|
548
548
|
}
|
|
549
|
-
};
|
|
549
|
+
});
|
|
550
550
|
const handleCodeInput = (e) => {
|
|
551
551
|
if (codeError) {
|
|
552
552
|
setCodeError("");
|
|
553
553
|
}
|
|
554
554
|
setCode(e.detail.value.trim());
|
|
555
555
|
};
|
|
556
|
-
const handleSubmitCode =
|
|
556
|
+
const handleSubmitCode = () => __async(void 0, null, function* () {
|
|
557
557
|
setIsVerifying(true);
|
|
558
558
|
if (code.length === 6 && /^\d+$/.test(code)) {
|
|
559
559
|
try {
|
|
560
|
-
const supportedCreateAuthMethods =
|
|
560
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
561
561
|
if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod.PASSKEY)) {
|
|
562
562
|
setIsIFrameReady(false);
|
|
563
|
-
const webAuthUrl = isEmail ?
|
|
564
|
-
const passwordAuthUrl =
|
|
565
|
-
setWebAuthURLForCreate(
|
|
566
|
-
setIFrameUrl(
|
|
563
|
+
const webAuthUrl = isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
564
|
+
const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
565
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(webAuthUrl));
|
|
566
|
+
setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
|
|
567
567
|
setAuthStepRoute("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
568
568
|
return;
|
|
569
569
|
} else if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD)) {
|
|
570
570
|
setIsIFrameReady(false);
|
|
571
|
-
isEmail ?
|
|
572
|
-
const url =
|
|
573
|
-
setIFrameUrl(
|
|
571
|
+
isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
572
|
+
const url = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
573
|
+
setIFrameUrl(yield para.shortenLoginLink(url));
|
|
574
574
|
setAuthStepRoute("PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
575
575
|
return;
|
|
576
576
|
} else {
|
|
577
|
-
const url = isEmail ?
|
|
578
|
-
setWebAuthURLForCreate(
|
|
577
|
+
const url = isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
|
|
578
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
579
579
|
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
580
580
|
}
|
|
581
581
|
} catch (e) {
|
|
@@ -589,7 +589,7 @@ var VerificationCodeStep = () => {
|
|
|
589
589
|
setCodeError("Incorrect code.");
|
|
590
590
|
}
|
|
591
591
|
setIsVerifying(false);
|
|
592
|
-
};
|
|
592
|
+
});
|
|
593
593
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
594
594
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
595
595
|
/* @__PURE__ */ jsxs(Heading, { variant: "headingS", weight: "bold", children: [
|
|
@@ -598,17 +598,17 @@ var VerificationCodeStep = () => {
|
|
|
598
598
|
] }),
|
|
599
599
|
/* @__PURE__ */ jsxs(InlineText, { variant: "bodyS", color: "secondary", children: [
|
|
600
600
|
"Please enter the code we sent to ",
|
|
601
|
-
/* @__PURE__ */ jsx(InlineText, { variant: "bodyS", children: authInfo
|
|
601
|
+
/* @__PURE__ */ jsx(InlineText, { variant: "bodyS", children: authInfo == null ? void 0 : authInfo.identifier })
|
|
602
602
|
] })
|
|
603
603
|
] }),
|
|
604
604
|
/* @__PURE__ */ jsx(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
605
605
|
/* @__PURE__ */ jsx(
|
|
606
606
|
"form",
|
|
607
607
|
{
|
|
608
|
-
onSubmit:
|
|
608
|
+
onSubmit: (e) => __async(void 0, null, function* () {
|
|
609
609
|
e.preventDefault();
|
|
610
|
-
|
|
611
|
-
},
|
|
610
|
+
yield handleSubmitCode();
|
|
611
|
+
}),
|
|
612
612
|
children: /* @__PURE__ */ jsx(
|
|
613
613
|
StyledCodeInput,
|
|
614
614
|
{
|
|
@@ -618,7 +618,9 @@ var VerificationCodeStep = () => {
|
|
|
618
618
|
code,
|
|
619
619
|
onCpslInput: handleCodeInput,
|
|
620
620
|
errorText: codeError,
|
|
621
|
-
onKeyDown:
|
|
621
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
622
|
+
return e.key === "Enter" && (yield handleSubmitCode());
|
|
623
|
+
})
|
|
622
624
|
}
|
|
623
625
|
)
|
|
624
626
|
}
|
|
@@ -665,7 +667,7 @@ function openPopup({
|
|
|
665
667
|
if (typeof window === "undefined") {
|
|
666
668
|
return;
|
|
667
669
|
}
|
|
668
|
-
current
|
|
670
|
+
current == null ? void 0 : current.close();
|
|
669
671
|
const popUpWidth = 560;
|
|
670
672
|
let popUpHeight;
|
|
671
673
|
switch (type) {
|
|
@@ -714,7 +716,7 @@ function openPopup({
|
|
|
714
716
|
|
|
715
717
|
// src/modal/components/BiometricLoginStep/BiometricLoginStep.tsx
|
|
716
718
|
import styled3 from "styled-components";
|
|
717
|
-
import { AuthMethod as AuthMethod2, getPublicKeyHex
|
|
719
|
+
import { AuthMethod as AuthMethod2, getPublicKeyHex } from "@getpara/web-sdk";
|
|
718
720
|
import { formatBiometricHints, KnownDevices, UserIdentifier } from "@getpara/react-common";
|
|
719
721
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
720
722
|
var BiometricLoginStep = () => {
|
|
@@ -728,58 +730,60 @@ var BiometricLoginStep = () => {
|
|
|
728
730
|
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
729
731
|
const setWebAuthURLForLogin = useModalStore((state) => state.setWebAuthURLForLogin);
|
|
730
732
|
const setPasswordUrlForLogin = useModalStore((state) => state.setPasswordUrlForLogin);
|
|
731
|
-
const passkeysSupported =
|
|
733
|
+
const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
|
|
732
734
|
const formattedHints = useMemo(() => formatBiometricHints(biometricLocationHints), [biometricLocationHints]);
|
|
733
735
|
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
734
736
|
const [webAuthURLForKnownDeviceLogin, setWebAuthURLForKnownDeviceLogin] = useState2();
|
|
735
737
|
useEffect2(() => {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
738
|
+
function setLinks() {
|
|
739
|
+
return __async(this, null, function* () {
|
|
740
|
+
if (!(supportedAuthMethods == null ? void 0 : supportedAuthMethods.size) && para.getUserId()) {
|
|
741
|
+
const fetchedSupportedAuthMethods = yield para.supportedAuthMethods({ userId: para.getUserId() });
|
|
742
|
+
if (fetchedSupportedAuthMethods == null ? void 0 : fetchedSupportedAuthMethods.size) {
|
|
743
|
+
setSupportedAuthMethods(fetchedSupportedAuthMethods);
|
|
744
|
+
}
|
|
745
|
+
return;
|
|
741
746
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
setPasswordUrlForLogin(passwordAuthUrlForLogin);
|
|
747
|
+
if (!para.isEmail && !para.isPhone && !para.isFarcaster && !para.isTelegram) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (!para.loginEncryptionKeyPair) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
const authType = para.isEmail ? "email" : para.isPhone ? "phone" : para.isFarcaster ? "farcaster" : "telegram";
|
|
754
|
+
const res = yield para.touchSession();
|
|
755
|
+
const webAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSKEY) ? yield para.getWebAuthURLForLogin({
|
|
756
|
+
sessionId: res.data.sessionId,
|
|
757
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
758
|
+
partnerId: res.data.partnerId,
|
|
759
|
+
authType,
|
|
760
|
+
displayName: authInfo.displayName,
|
|
761
|
+
pfpUrl: authInfo.pfpUrl
|
|
762
|
+
}) : void 0;
|
|
763
|
+
const _webAuthURLForKnownDeviceLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSKEY) ? yield para.getWebAuthURLForLogin({
|
|
764
|
+
sessionId: res.data.sessionId,
|
|
765
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
766
|
+
partnerId: res.data.partnerId,
|
|
767
|
+
newDeviceSessionId: res.data.sessionLookupId,
|
|
768
|
+
newDeviceEncryptionKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
769
|
+
authType,
|
|
770
|
+
displayName: authInfo.displayName,
|
|
771
|
+
pfpUrl: authInfo.pfpUrl
|
|
772
|
+
}) : void 0;
|
|
773
|
+
const passwordAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSWORD) ? yield para.getPasswordURLForLogin({
|
|
774
|
+
sessionId: res.data.sessionId,
|
|
775
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
776
|
+
partnerId: res.data.partnerId,
|
|
777
|
+
authType,
|
|
778
|
+
displayName: authInfo.displayName,
|
|
779
|
+
pfpUrl: authInfo.pfpUrl
|
|
780
|
+
}) : void 0;
|
|
781
|
+
const shortWebAuthLoginLink = webAuthUrlForLogin ? yield para.shortenLoginLink(webAuthUrlForLogin) : void 0;
|
|
782
|
+
const shortWebAuthForKnownDeviceLoginLink = _webAuthURLForKnownDeviceLogin ? yield para.shortenLoginLink(_webAuthURLForKnownDeviceLogin) : void 0;
|
|
783
|
+
setWebAuthURLForKnownDeviceLogin(shortWebAuthForKnownDeviceLoginLink);
|
|
784
|
+
setWebAuthURLForLogin(shortWebAuthLoginLink);
|
|
785
|
+
setPasswordUrlForLogin(passwordAuthUrlForLogin);
|
|
786
|
+
});
|
|
783
787
|
}
|
|
784
788
|
setLinks();
|
|
785
789
|
}, [supportedAuthMethods, para]);
|
|
@@ -802,16 +806,16 @@ var BiometricLoginStep = () => {
|
|
|
802
806
|
setStep("AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */);
|
|
803
807
|
};
|
|
804
808
|
function shouldShowWelcomeBack() {
|
|
805
|
-
return !biometricLocationHints
|
|
809
|
+
return !(biometricLocationHints == null ? void 0 : biometricLocationHints.length) || passkeysSupported && formattedHints.isOnKnownDevice || (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSWORD);
|
|
806
810
|
}
|
|
807
811
|
return /* @__PURE__ */ jsxs2(StepContainer, { $wide: true, children: [
|
|
808
812
|
/* @__PURE__ */ jsxs2(InnerStepContainer, { children: [
|
|
809
813
|
shouldShowWelcomeBack() && /* @__PURE__ */ jsx2(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," }),
|
|
810
|
-
/* @__PURE__ */ jsx2(UserIdentifier, {
|
|
814
|
+
/* @__PURE__ */ jsx2(UserIdentifier, __spreadValues({}, authInfo))
|
|
811
815
|
] }),
|
|
812
816
|
/* @__PURE__ */ jsxs2(MainContainer, { children: [
|
|
813
|
-
supportedAuthMethods
|
|
814
|
-
supportedAuthMethods
|
|
817
|
+
(supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSWORD) && passwordUrlForLogin && /* @__PURE__ */ jsx2(PasswordOnly, { handlePasswordClick }),
|
|
818
|
+
(supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSKEY) && webAuthURLForLogin && webAuthURLForKnownDeviceLogin && /* @__PURE__ */ jsx2(
|
|
815
819
|
BiometricOnly,
|
|
816
820
|
{
|
|
817
821
|
handlePasskeyClick,
|
|
@@ -876,21 +880,24 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
876
880
|
const [codeError, setCodeError] = useState3("");
|
|
877
881
|
const [isVerifyingCode, setIsVerifyingCode] = useState3(false);
|
|
878
882
|
const params = qrCodeValue ? new URL(qrCodeValue).searchParams : void 0;
|
|
879
|
-
const secret = params
|
|
883
|
+
const secret = params == null ? void 0 : params.get("secret");
|
|
880
884
|
useEffect3(() => {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
885
|
+
function fetchOtpAuthUrl() {
|
|
886
|
+
return __async(this, null, function* () {
|
|
887
|
+
try {
|
|
888
|
+
const { uri } = yield para.setup2FA();
|
|
889
|
+
setQrCodeValue(uri);
|
|
890
|
+
} catch (error) {
|
|
891
|
+
console.error("Error fetching OTPAuth URL:", error);
|
|
892
|
+
}
|
|
893
|
+
});
|
|
888
894
|
}
|
|
889
895
|
fetchOtpAuthUrl();
|
|
890
896
|
}, []);
|
|
891
897
|
useEffect3(() => {
|
|
892
898
|
setTimeout(() => {
|
|
893
|
-
|
|
899
|
+
var _a, _b, _c;
|
|
900
|
+
(_c = (_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.shadowRoot.querySelectorAll("input")) == null ? void 0 : _b[0]) == null ? void 0 : _c.focus();
|
|
894
901
|
}, 10);
|
|
895
902
|
}, [isVerifying]);
|
|
896
903
|
useEffect3(() => {
|
|
@@ -914,11 +921,11 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
914
921
|
}
|
|
915
922
|
setCode(e.detail.value.trim());
|
|
916
923
|
};
|
|
917
|
-
const handleSubmitCode =
|
|
924
|
+
const handleSubmitCode = () => __async(void 0, null, function* () {
|
|
918
925
|
setIsVerifyingCode(true);
|
|
919
926
|
if (code.length === 6 && /^\d+$/.test(code)) {
|
|
920
927
|
try {
|
|
921
|
-
|
|
928
|
+
yield para.enable2FA({ verificationCode: code });
|
|
922
929
|
setStep("TWO_FACTOR_DONE" /* TWO_FACTOR_DONE */);
|
|
923
930
|
} catch (e) {
|
|
924
931
|
setCodeError("Incorrect Code");
|
|
@@ -927,7 +934,7 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
927
934
|
setCodeError("Incorrect Code");
|
|
928
935
|
}
|
|
929
936
|
setIsVerifyingCode(false);
|
|
930
|
-
};
|
|
937
|
+
});
|
|
931
938
|
const handleCopy = () => {
|
|
932
939
|
copy(secret);
|
|
933
940
|
};
|
|
@@ -939,10 +946,10 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
939
946
|
/* @__PURE__ */ jsx3(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx3(Fragment3, { children: isVerifyingCode ? /* @__PURE__ */ jsx3(CpslSpinner2, {}) : /* @__PURE__ */ jsx3(
|
|
940
947
|
"form",
|
|
941
948
|
{
|
|
942
|
-
onSubmit:
|
|
949
|
+
onSubmit: (e) => __async(void 0, null, function* () {
|
|
943
950
|
e.preventDefault();
|
|
944
|
-
|
|
945
|
-
},
|
|
951
|
+
yield handleSubmitCode();
|
|
952
|
+
}),
|
|
946
953
|
children: /* @__PURE__ */ jsx3(
|
|
947
954
|
StyledCodeInput2,
|
|
948
955
|
{
|
|
@@ -951,7 +958,9 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
951
958
|
onCpslInput: handleCodeInput,
|
|
952
959
|
errorText: codeError,
|
|
953
960
|
length: 6,
|
|
954
|
-
onKeyDown:
|
|
961
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
962
|
+
return e.key === "Enter" && (yield handleSubmitCode());
|
|
963
|
+
})
|
|
955
964
|
}
|
|
956
965
|
)
|
|
957
966
|
}
|
|
@@ -1042,8 +1051,8 @@ var useWalletState = () => {
|
|
|
1042
1051
|
import { useQuery } from "@tanstack/react-query";
|
|
1043
1052
|
|
|
1044
1053
|
// src/provider/actions/getAccount.ts
|
|
1045
|
-
var getAccount =
|
|
1046
|
-
const isLoggedIn =
|
|
1054
|
+
var getAccount = (para) => __async(void 0, null, function* () {
|
|
1055
|
+
const isLoggedIn = yield para == null ? void 0 : para.isFullyLoggedIn();
|
|
1047
1056
|
const resp = {
|
|
1048
1057
|
isConnected: !!isLoggedIn,
|
|
1049
1058
|
email: void 0,
|
|
@@ -1056,15 +1065,17 @@ var getAccount = async (para) => {
|
|
|
1056
1065
|
resp.wallets = para.getWallets();
|
|
1057
1066
|
}
|
|
1058
1067
|
return resp;
|
|
1059
|
-
};
|
|
1068
|
+
});
|
|
1060
1069
|
|
|
1061
1070
|
// src/provider/hooks/queries/useAccount.ts
|
|
1062
1071
|
var ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
1063
1072
|
var useAccount = () => {
|
|
1064
1073
|
const client = useClient();
|
|
1065
1074
|
return useQuery({
|
|
1066
|
-
queryKey: [ACCOUNT_BASE_KEY, client
|
|
1067
|
-
queryFn:
|
|
1075
|
+
queryKey: [ACCOUNT_BASE_KEY, client == null ? void 0 : client.getUserId()],
|
|
1076
|
+
queryFn: () => __async(void 0, null, function* () {
|
|
1077
|
+
return yield getAccount(client);
|
|
1078
|
+
})
|
|
1068
1079
|
});
|
|
1069
1080
|
};
|
|
1070
1081
|
|
|
@@ -1072,13 +1083,13 @@ var useAccount = () => {
|
|
|
1072
1083
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
1073
1084
|
|
|
1074
1085
|
// src/provider/actions/getWallet.ts
|
|
1075
|
-
var getWallet =
|
|
1076
|
-
const isLoggedIn =
|
|
1086
|
+
var getWallet = (para, selectedWallet) => __async(void 0, null, function* () {
|
|
1087
|
+
const isLoggedIn = yield para == null ? void 0 : para.isFullyLoggedIn();
|
|
1077
1088
|
if (!para || !isLoggedIn) {
|
|
1078
1089
|
return null;
|
|
1079
1090
|
}
|
|
1080
|
-
return para.findWallet(selectedWallet
|
|
1081
|
-
};
|
|
1091
|
+
return para.findWallet(selectedWallet == null ? void 0 : selectedWallet.id, selectedWallet == null ? void 0 : selectedWallet.type);
|
|
1092
|
+
});
|
|
1082
1093
|
|
|
1083
1094
|
// src/provider/hooks/queries/useWallet.ts
|
|
1084
1095
|
var WALLET_BASE_KEY = "PARA_WALLET";
|
|
@@ -1086,8 +1097,10 @@ var useWallet = () => {
|
|
|
1086
1097
|
const client = useClient();
|
|
1087
1098
|
const { selectedWallet } = useWalletState();
|
|
1088
1099
|
return useQuery2({
|
|
1089
|
-
queryKey: [WALLET_BASE_KEY, client
|
|
1090
|
-
queryFn:
|
|
1100
|
+
queryKey: [WALLET_BASE_KEY, client == null ? void 0 : client.getUserId(), selectedWallet.id, selectedWallet.type],
|
|
1101
|
+
queryFn: () => __async(void 0, null, function* () {
|
|
1102
|
+
return yield getWallet(client, selectedWallet);
|
|
1103
|
+
})
|
|
1091
1104
|
});
|
|
1092
1105
|
};
|
|
1093
1106
|
|
|
@@ -1095,7 +1108,7 @@ var useWallet = () => {
|
|
|
1095
1108
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
1096
1109
|
|
|
1097
1110
|
// src/provider/actions/waitForLoginAndSetup.ts
|
|
1098
|
-
var waitForLoginAndSetup =
|
|
1111
|
+
var waitForLoginAndSetup = (para, args) => __async(void 0, null, function* () {
|
|
1099
1112
|
if (!para) {
|
|
1100
1113
|
throw new Error("no para instance");
|
|
1101
1114
|
}
|
|
@@ -1103,7 +1116,7 @@ var waitForLoginAndSetup = async (para, args) => {
|
|
|
1103
1116
|
throw new Error("no valid args passed to waitForLoginAndSetup");
|
|
1104
1117
|
}
|
|
1105
1118
|
try {
|
|
1106
|
-
const resp =
|
|
1119
|
+
const resp = yield para.waitForLoginAndSetup(args);
|
|
1107
1120
|
if (resp.isError) {
|
|
1108
1121
|
throw new Error("error during waitForLoginAndSetup");
|
|
1109
1122
|
}
|
|
@@ -1111,19 +1124,16 @@ var waitForLoginAndSetup = async (para, args) => {
|
|
|
1111
1124
|
} catch (e) {
|
|
1112
1125
|
throw new Error(e);
|
|
1113
1126
|
}
|
|
1114
|
-
};
|
|
1127
|
+
});
|
|
1115
1128
|
|
|
1116
1129
|
// src/provider/utils/renameMutations.ts
|
|
1117
1130
|
function renameMutations(mutationObj, name) {
|
|
1118
|
-
const { mutate: _, mutateAsync: __,
|
|
1131
|
+
const _a = mutationObj, { mutate: _, mutateAsync: __ } = _a, mutationNoMutate = __objRest(_a, ["mutate", "mutateAsync"]);
|
|
1119
1132
|
const newMutations = {
|
|
1120
1133
|
[name]: mutationObj.mutate,
|
|
1121
1134
|
[`${name}Async`]: mutationObj.mutateAsync
|
|
1122
1135
|
};
|
|
1123
|
-
return {
|
|
1124
|
-
...newMutations,
|
|
1125
|
-
...mutationNoMutate
|
|
1126
|
-
};
|
|
1136
|
+
return __spreadValues(__spreadValues({}, newMutations), mutationNoMutate);
|
|
1127
1137
|
}
|
|
1128
1138
|
|
|
1129
1139
|
// src/provider/hooks/mutations/useWaitForLoginAndSetup.ts
|
|
@@ -1131,11 +1141,13 @@ var useWaitForLoginAndSetup = () => {
|
|
|
1131
1141
|
const client = useClient();
|
|
1132
1142
|
const queryClient = useQueryClient();
|
|
1133
1143
|
const mutation = useMutation({
|
|
1134
|
-
mutationFn:
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1144
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1145
|
+
return yield waitForLoginAndSetup(client, args);
|
|
1146
|
+
}),
|
|
1147
|
+
onSettled: () => __async(void 0, null, function* () {
|
|
1148
|
+
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
1149
|
+
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
1150
|
+
})
|
|
1139
1151
|
});
|
|
1140
1152
|
return renameMutations(
|
|
1141
1153
|
mutation,
|
|
@@ -1147,12 +1159,12 @@ var useWaitForLoginAndSetup = () => {
|
|
|
1147
1159
|
import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
1148
1160
|
|
|
1149
1161
|
// src/provider/actions/waitForAccountCreation.ts
|
|
1150
|
-
var waitForAccountCreation =
|
|
1162
|
+
var waitForAccountCreation = (para) => __async(void 0, null, function* () {
|
|
1151
1163
|
if (!para) {
|
|
1152
1164
|
throw new Error("no para instance");
|
|
1153
1165
|
}
|
|
1154
1166
|
try {
|
|
1155
|
-
const isComplete =
|
|
1167
|
+
const isComplete = yield para.waitForAccountCreation();
|
|
1156
1168
|
if (!isComplete) {
|
|
1157
1169
|
throw new Error("error during waitForAccountCreation");
|
|
1158
1170
|
}
|
|
@@ -1160,18 +1172,20 @@ var waitForAccountCreation = async (para) => {
|
|
|
1160
1172
|
} catch (e) {
|
|
1161
1173
|
throw new Error(e);
|
|
1162
1174
|
}
|
|
1163
|
-
};
|
|
1175
|
+
});
|
|
1164
1176
|
|
|
1165
1177
|
// src/provider/hooks/mutations/useWaitForAccountCreation.ts
|
|
1166
1178
|
var useWaitForAccountCreation = () => {
|
|
1167
1179
|
const client = useClient();
|
|
1168
1180
|
const queryClient = useQueryClient2();
|
|
1169
1181
|
const mutation = useMutation2({
|
|
1170
|
-
mutationFn:
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1182
|
+
mutationFn: () => __async(void 0, null, function* () {
|
|
1183
|
+
return yield waitForAccountCreation(client);
|
|
1184
|
+
}),
|
|
1185
|
+
onSettled: () => __async(void 0, null, function* () {
|
|
1186
|
+
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
1187
|
+
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
1188
|
+
})
|
|
1175
1189
|
});
|
|
1176
1190
|
return renameMutations(
|
|
1177
1191
|
mutation,
|
|
@@ -1183,12 +1197,12 @@ var useWaitForAccountCreation = () => {
|
|
|
1183
1197
|
import { useMutation as useMutation3, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1184
1198
|
|
|
1185
1199
|
// src/provider/actions/waitForPasskeyAndCreateWallet.ts
|
|
1186
|
-
var waitForPasskeyAndCreateWallet =
|
|
1200
|
+
var waitForPasskeyAndCreateWallet = (para) => __async(void 0, null, function* () {
|
|
1187
1201
|
if (!para) {
|
|
1188
1202
|
throw new Error("no para instance");
|
|
1189
1203
|
}
|
|
1190
1204
|
try {
|
|
1191
|
-
const resp =
|
|
1205
|
+
const resp = yield para.waitForPasskeyAndCreateWallet();
|
|
1192
1206
|
if (!resp) {
|
|
1193
1207
|
throw new Error("error during waitForAccountCreation");
|
|
1194
1208
|
}
|
|
@@ -1196,18 +1210,20 @@ var waitForPasskeyAndCreateWallet = async (para) => {
|
|
|
1196
1210
|
} catch (e) {
|
|
1197
1211
|
throw new Error(e);
|
|
1198
1212
|
}
|
|
1199
|
-
};
|
|
1213
|
+
});
|
|
1200
1214
|
|
|
1201
1215
|
// src/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.ts
|
|
1202
1216
|
var useWaitForPasskeyAndCreateWallet = () => {
|
|
1203
1217
|
const client = useClient();
|
|
1204
1218
|
const queryClient = useQueryClient3();
|
|
1205
1219
|
const mutation = useMutation3({
|
|
1206
|
-
mutationFn:
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1220
|
+
mutationFn: () => __async(void 0, null, function* () {
|
|
1221
|
+
return yield waitForPasskeyAndCreateWallet(client);
|
|
1222
|
+
}),
|
|
1223
|
+
onSettled: () => __async(void 0, null, function* () {
|
|
1224
|
+
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
1225
|
+
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
1226
|
+
})
|
|
1211
1227
|
});
|
|
1212
1228
|
return renameMutations(
|
|
1213
1229
|
mutation,
|
|
@@ -1219,7 +1235,7 @@ var useWaitForPasskeyAndCreateWallet = () => {
|
|
|
1219
1235
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
1220
1236
|
|
|
1221
1237
|
// src/provider/actions/createUser.ts
|
|
1222
|
-
var createUser =
|
|
1238
|
+
var createUser = (para, args) => __async(void 0, null, function* () {
|
|
1223
1239
|
if (!para) {
|
|
1224
1240
|
throw new Error("no para instance");
|
|
1225
1241
|
}
|
|
@@ -1227,17 +1243,19 @@ var createUser = async (para, args) => {
|
|
|
1227
1243
|
throw new Error("no valid args passed to createUser");
|
|
1228
1244
|
}
|
|
1229
1245
|
try {
|
|
1230
|
-
|
|
1246
|
+
yield args.type === "EMAIL" /* EMAIL */ ? para.createUser({ email: args.identifier }) : para.createUserByPhone({ phone: args.identifier, countryCode: args.countryCode });
|
|
1231
1247
|
} catch (e) {
|
|
1232
1248
|
throw new Error(e);
|
|
1233
1249
|
}
|
|
1234
|
-
};
|
|
1250
|
+
});
|
|
1235
1251
|
|
|
1236
1252
|
// src/provider/hooks/mutations/useCreateUser.ts
|
|
1237
1253
|
var useCreateUser = () => {
|
|
1238
1254
|
const client = useClient();
|
|
1239
1255
|
const mutation = useMutation4({
|
|
1240
|
-
mutationFn:
|
|
1256
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1257
|
+
return yield createUser(client, args);
|
|
1258
|
+
})
|
|
1241
1259
|
});
|
|
1242
1260
|
return renameMutations(mutation, "createUser");
|
|
1243
1261
|
};
|
|
@@ -1246,7 +1264,7 @@ var useCreateUser = () => {
|
|
|
1246
1264
|
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
1247
1265
|
|
|
1248
1266
|
// src/provider/actions/checkIfUserExists.ts
|
|
1249
|
-
var checkIfUserExists =
|
|
1267
|
+
var checkIfUserExists = (para, args) => __async(void 0, null, function* () {
|
|
1250
1268
|
if (!para) {
|
|
1251
1269
|
throw new Error("no para instance");
|
|
1252
1270
|
}
|
|
@@ -1254,17 +1272,19 @@ var checkIfUserExists = async (para, args) => {
|
|
|
1254
1272
|
throw new Error("no valid args passed to checkIfUserExists");
|
|
1255
1273
|
}
|
|
1256
1274
|
try {
|
|
1257
|
-
return
|
|
1275
|
+
return yield args.type === "EMAIL" /* EMAIL */ ? para.checkIfUserExists({ email: args.identifier }) : para.checkIfUserExistsByPhone({ phone: args.identifier, countryCode: args.countryCode });
|
|
1258
1276
|
} catch (e) {
|
|
1259
1277
|
throw new Error(e);
|
|
1260
1278
|
}
|
|
1261
|
-
};
|
|
1279
|
+
});
|
|
1262
1280
|
|
|
1263
1281
|
// src/provider/hooks/mutations/useCheckIfUserExists.ts
|
|
1264
1282
|
var useCheckIfUserExists = () => {
|
|
1265
1283
|
const client = useClient();
|
|
1266
1284
|
const mutation = useMutation5({
|
|
1267
|
-
mutationFn:
|
|
1285
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1286
|
+
return yield checkIfUserExists(client, args);
|
|
1287
|
+
})
|
|
1268
1288
|
});
|
|
1269
1289
|
return renameMutations(
|
|
1270
1290
|
mutation,
|
|
@@ -1276,7 +1296,7 @@ var useCheckIfUserExists = () => {
|
|
|
1276
1296
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
1277
1297
|
|
|
1278
1298
|
// src/provider/actions/initiateLogin.ts
|
|
1279
|
-
var initiateLogin =
|
|
1299
|
+
var initiateLogin = (para, args) => __async(void 0, null, function* () {
|
|
1280
1300
|
if (!para) {
|
|
1281
1301
|
throw new Error("no para instance");
|
|
1282
1302
|
}
|
|
@@ -1284,17 +1304,19 @@ var initiateLogin = async (para, args) => {
|
|
|
1284
1304
|
throw new Error("no valid args passed to initiateLogin");
|
|
1285
1305
|
}
|
|
1286
1306
|
try {
|
|
1287
|
-
return
|
|
1307
|
+
return yield para.initiateUserLoginV2(args);
|
|
1288
1308
|
} catch (e) {
|
|
1289
1309
|
throw new Error(e);
|
|
1290
1310
|
}
|
|
1291
|
-
};
|
|
1311
|
+
});
|
|
1292
1312
|
|
|
1293
1313
|
// src/provider/hooks/mutations/useInitiateLogin.ts
|
|
1294
1314
|
var useInitiateLogin = () => {
|
|
1295
1315
|
const client = useClient();
|
|
1296
1316
|
const mutation = useMutation6({
|
|
1297
|
-
mutationFn:
|
|
1317
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1318
|
+
return yield initiateLogin(client, args);
|
|
1319
|
+
})
|
|
1298
1320
|
});
|
|
1299
1321
|
return renameMutations(
|
|
1300
1322
|
mutation,
|
|
@@ -1306,16 +1328,16 @@ var useInitiateLogin = () => {
|
|
|
1306
1328
|
import { useMutation as useMutation7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
1307
1329
|
|
|
1308
1330
|
// src/provider/actions/logout.ts
|
|
1309
|
-
var logout =
|
|
1331
|
+
var logout = (para) => __async(void 0, null, function* () {
|
|
1310
1332
|
if (!para) {
|
|
1311
1333
|
throw new Error("no para instance");
|
|
1312
1334
|
}
|
|
1313
1335
|
try {
|
|
1314
|
-
|
|
1336
|
+
yield para.logout();
|
|
1315
1337
|
} catch (e) {
|
|
1316
1338
|
throw new Error(e);
|
|
1317
1339
|
}
|
|
1318
|
-
};
|
|
1340
|
+
});
|
|
1319
1341
|
|
|
1320
1342
|
// src/provider/hooks/mutations/useLogout.ts
|
|
1321
1343
|
var useLogout = () => {
|
|
@@ -1323,12 +1345,14 @@ var useLogout = () => {
|
|
|
1323
1345
|
const queryClient = useQueryClient4();
|
|
1324
1346
|
const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
|
|
1325
1347
|
const mutation = useMutation7({
|
|
1326
|
-
mutationFn:
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1348
|
+
mutationFn: () => __async(void 0, null, function* () {
|
|
1349
|
+
return yield logout(client);
|
|
1350
|
+
}),
|
|
1351
|
+
onSettled: () => __async(void 0, null, function* () {
|
|
1352
|
+
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
1353
|
+
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
1330
1354
|
clearSelectedWallet();
|
|
1331
|
-
}
|
|
1355
|
+
})
|
|
1332
1356
|
});
|
|
1333
1357
|
return renameMutations(mutation, "logout");
|
|
1334
1358
|
};
|
|
@@ -1337,25 +1361,27 @@ var useLogout = () => {
|
|
|
1337
1361
|
import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
1338
1362
|
|
|
1339
1363
|
// src/provider/actions/keepSessionAlive.ts
|
|
1340
|
-
var keepSessionAlive =
|
|
1364
|
+
var keepSessionAlive = (para) => __async(void 0, null, function* () {
|
|
1341
1365
|
if (!para) {
|
|
1342
1366
|
throw new Error("no para instance");
|
|
1343
1367
|
}
|
|
1344
1368
|
try {
|
|
1345
|
-
const resp =
|
|
1369
|
+
const resp = yield para.keepSessionAlive();
|
|
1346
1370
|
if (!resp) {
|
|
1347
1371
|
throw new Error("session expired");
|
|
1348
1372
|
}
|
|
1349
1373
|
} catch (e) {
|
|
1350
1374
|
throw new Error(e);
|
|
1351
1375
|
}
|
|
1352
|
-
};
|
|
1376
|
+
});
|
|
1353
1377
|
|
|
1354
1378
|
// src/provider/hooks/mutations/useKeepSessionAlive.ts
|
|
1355
1379
|
var useKeepSessionAlive = () => {
|
|
1356
1380
|
const client = useClient();
|
|
1357
1381
|
const mutation = useMutation8({
|
|
1358
|
-
mutationFn:
|
|
1382
|
+
mutationFn: () => __async(void 0, null, function* () {
|
|
1383
|
+
return yield keepSessionAlive(client);
|
|
1384
|
+
})
|
|
1359
1385
|
});
|
|
1360
1386
|
return renameMutations(mutation, "keepSessionAlive");
|
|
1361
1387
|
};
|
|
@@ -1364,7 +1390,7 @@ var useKeepSessionAlive = () => {
|
|
|
1364
1390
|
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
1365
1391
|
|
|
1366
1392
|
// src/provider/actions/signMessage.ts
|
|
1367
|
-
var signMessage =
|
|
1393
|
+
var signMessage = (para, args) => __async(void 0, null, function* () {
|
|
1368
1394
|
if (!para) {
|
|
1369
1395
|
throw new Error("no para instance");
|
|
1370
1396
|
}
|
|
@@ -1372,27 +1398,27 @@ var signMessage = async (para, args) => {
|
|
|
1372
1398
|
throw new Error("no valid args passed to signMessage");
|
|
1373
1399
|
}
|
|
1374
1400
|
try {
|
|
1375
|
-
return
|
|
1401
|
+
return yield para.signMessage(args);
|
|
1376
1402
|
} catch (e) {
|
|
1377
1403
|
throw new Error(e);
|
|
1378
1404
|
}
|
|
1379
|
-
};
|
|
1405
|
+
});
|
|
1380
1406
|
|
|
1381
1407
|
// src/provider/hooks/mutations/useSignMessage.ts
|
|
1382
1408
|
var useSignMessage = () => {
|
|
1383
1409
|
const client = useClient();
|
|
1384
1410
|
const { data: wallet } = useWallet();
|
|
1385
1411
|
const mutation = useMutation9({
|
|
1386
|
-
mutationFn:
|
|
1387
|
-
let walletId = args
|
|
1412
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1413
|
+
let walletId = args == null ? void 0 : args.walletId;
|
|
1388
1414
|
if (!walletId) {
|
|
1389
|
-
walletId = wallet
|
|
1415
|
+
walletId = wallet == null ? void 0 : wallet.id;
|
|
1390
1416
|
}
|
|
1391
1417
|
if (!walletId) {
|
|
1392
1418
|
throw Error("no wallet id found");
|
|
1393
1419
|
}
|
|
1394
|
-
return
|
|
1395
|
-
}
|
|
1420
|
+
return yield signMessage(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
1421
|
+
})
|
|
1396
1422
|
});
|
|
1397
1423
|
return renameMutations(
|
|
1398
1424
|
mutation,
|
|
@@ -1404,7 +1430,7 @@ var useSignMessage = () => {
|
|
|
1404
1430
|
import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
1405
1431
|
|
|
1406
1432
|
// src/provider/actions/signTransaction.ts
|
|
1407
|
-
var signTransaction =
|
|
1433
|
+
var signTransaction = (para, args) => __async(void 0, null, function* () {
|
|
1408
1434
|
if (!para) {
|
|
1409
1435
|
throw new Error("no para instance");
|
|
1410
1436
|
}
|
|
@@ -1412,27 +1438,27 @@ var signTransaction = async (para, args) => {
|
|
|
1412
1438
|
throw new Error("no valid args passed to signTransaction");
|
|
1413
1439
|
}
|
|
1414
1440
|
try {
|
|
1415
|
-
return
|
|
1441
|
+
return yield para.signTransaction(args);
|
|
1416
1442
|
} catch (e) {
|
|
1417
1443
|
throw new Error(e);
|
|
1418
1444
|
}
|
|
1419
|
-
};
|
|
1445
|
+
});
|
|
1420
1446
|
|
|
1421
1447
|
// src/provider/hooks/mutations/useSignTransaction.ts
|
|
1422
1448
|
var useSignTransaction = () => {
|
|
1423
1449
|
const client = useClient();
|
|
1424
1450
|
const { data: wallet } = useWallet();
|
|
1425
1451
|
const mutation = useMutation10({
|
|
1426
|
-
mutationFn:
|
|
1427
|
-
let walletId = args
|
|
1452
|
+
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1453
|
+
let walletId = args == null ? void 0 : args.walletId;
|
|
1428
1454
|
if (!walletId) {
|
|
1429
|
-
walletId = wallet
|
|
1455
|
+
walletId = wallet == null ? void 0 : wallet.id;
|
|
1430
1456
|
}
|
|
1431
1457
|
if (!walletId) {
|
|
1432
1458
|
throw Error("no wallet id found");
|
|
1433
1459
|
}
|
|
1434
|
-
return
|
|
1435
|
-
}
|
|
1460
|
+
return yield signTransaction(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
1461
|
+
})
|
|
1436
1462
|
});
|
|
1437
1463
|
return renameMutations(
|
|
1438
1464
|
mutation,
|
|
@@ -1454,50 +1480,50 @@ var useAutoSessionKeepAlive = ({ disabled }) => {
|
|
|
1454
1480
|
clearSessionMonitoring();
|
|
1455
1481
|
return;
|
|
1456
1482
|
}
|
|
1457
|
-
if (account
|
|
1483
|
+
if ((account == null ? void 0 : account.isConnected) && !client.isUsingExternalWallet()) {
|
|
1458
1484
|
setupSessionMonitoring();
|
|
1459
1485
|
} else {
|
|
1460
1486
|
clearSessionMonitoring();
|
|
1461
1487
|
}
|
|
1462
1488
|
return () => clearSessionMonitoring();
|
|
1463
1489
|
}, [client, account, disabled]);
|
|
1464
|
-
const getSessionExpiry =
|
|
1490
|
+
const getSessionExpiry = () => __async(void 0, null, function* () {
|
|
1465
1491
|
try {
|
|
1466
|
-
const sessionCookie =
|
|
1492
|
+
const sessionCookie = yield client.retrieveSessionCookie();
|
|
1467
1493
|
if (!sessionCookie) return null;
|
|
1468
1494
|
const expiresMatch = sessionCookie.match(/Expires=([^;]+)/);
|
|
1469
1495
|
return expiresMatch ? new Date(expiresMatch[1]) : null;
|
|
1470
1496
|
} catch (err) {
|
|
1471
1497
|
return null;
|
|
1472
1498
|
}
|
|
1473
|
-
};
|
|
1499
|
+
});
|
|
1474
1500
|
const setupSessionMonitoring = () => {
|
|
1475
1501
|
clearSessionMonitoring();
|
|
1476
|
-
sessionCheckInterval.current = setInterval(
|
|
1477
|
-
const expiry =
|
|
1502
|
+
sessionCheckInterval.current = setInterval(() => __async(void 0, null, function* () {
|
|
1503
|
+
const expiry = yield getSessionExpiry();
|
|
1478
1504
|
if (!expiry) {
|
|
1479
|
-
|
|
1505
|
+
yield logoutAsync();
|
|
1480
1506
|
clearSessionMonitoring();
|
|
1481
1507
|
return;
|
|
1482
1508
|
}
|
|
1483
1509
|
const timeUntilExpiry = expiry.getTime() - Date.now();
|
|
1484
1510
|
if (timeUntilExpiry <= 0) {
|
|
1485
|
-
|
|
1511
|
+
yield logoutAsync();
|
|
1486
1512
|
clearSessionMonitoring();
|
|
1487
1513
|
return;
|
|
1488
1514
|
}
|
|
1489
1515
|
if (timeUntilExpiry <= SESSION_REFRESH_THRESHOLD) {
|
|
1490
1516
|
try {
|
|
1491
|
-
|
|
1517
|
+
yield keepSessionAliveAsync();
|
|
1492
1518
|
setupSessionMonitoring();
|
|
1493
1519
|
} catch (err) {
|
|
1494
1520
|
console.error("Failed to keep session alive:", err);
|
|
1495
|
-
|
|
1521
|
+
yield logoutAsync();
|
|
1496
1522
|
clearSessionMonitoring();
|
|
1497
1523
|
}
|
|
1498
1524
|
return;
|
|
1499
1525
|
}
|
|
1500
|
-
}, SESSION_CHECK_INTERVAL);
|
|
1526
|
+
}), SESSION_CHECK_INTERVAL);
|
|
1501
1527
|
};
|
|
1502
1528
|
const clearSessionMonitoring = () => {
|
|
1503
1529
|
if (sessionCheckInterval.current) {
|
|
@@ -1530,52 +1556,52 @@ var useEventListeners = ({
|
|
|
1530
1556
|
const { selectedWallet, setSelectedWallet } = useWalletState();
|
|
1531
1557
|
const loginListener = (event) => {
|
|
1532
1558
|
loginOrSetupListener();
|
|
1533
|
-
onLogin
|
|
1559
|
+
onLogin == null ? void 0 : onLogin(event);
|
|
1534
1560
|
};
|
|
1535
1561
|
const accountSetupListener = (event) => {
|
|
1536
1562
|
loginOrSetupListener();
|
|
1537
|
-
onAccountSetup
|
|
1563
|
+
onAccountSetup == null ? void 0 : onAccountSetup(event);
|
|
1538
1564
|
};
|
|
1539
1565
|
const loginOrSetupListener = () => {
|
|
1540
1566
|
queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
1541
1567
|
queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
1542
1568
|
};
|
|
1543
1569
|
const accountCreationListener = (event) => {
|
|
1544
|
-
onAccountCreation
|
|
1570
|
+
onAccountCreation == null ? void 0 : onAccountCreation(event);
|
|
1545
1571
|
};
|
|
1546
1572
|
const logoutListener = (event) => {
|
|
1547
1573
|
queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
1548
1574
|
clearSelectedWallet();
|
|
1549
|
-
onLogout
|
|
1575
|
+
onLogout == null ? void 0 : onLogout(event);
|
|
1550
1576
|
};
|
|
1551
1577
|
const signMessageListener = (event) => {
|
|
1552
|
-
onSignMessage
|
|
1578
|
+
onSignMessage == null ? void 0 : onSignMessage(event);
|
|
1553
1579
|
};
|
|
1554
1580
|
const signTransactionListener = (event) => {
|
|
1555
|
-
onSignTransaction
|
|
1581
|
+
onSignTransaction == null ? void 0 : onSignTransaction(event);
|
|
1556
1582
|
};
|
|
1557
1583
|
const walletChangeListener = (event) => {
|
|
1558
1584
|
updateSelectedWallet();
|
|
1559
|
-
onWalletsChange
|
|
1585
|
+
onWalletsChange == null ? void 0 : onWalletsChange(event);
|
|
1560
1586
|
};
|
|
1561
1587
|
const externalWalletChangeListener = (event) => {
|
|
1562
1588
|
updateSelectedWallet();
|
|
1563
|
-
onExternalWalletChange
|
|
1589
|
+
onExternalWalletChange == null ? void 0 : onExternalWalletChange(event);
|
|
1564
1590
|
};
|
|
1565
1591
|
const walletCreatedListener = (event) => {
|
|
1566
|
-
onWalletCreated
|
|
1592
|
+
onWalletCreated == null ? void 0 : onWalletCreated(event);
|
|
1567
1593
|
};
|
|
1568
1594
|
const pregenWalletClaimedListener = (event) => {
|
|
1569
|
-
onPregenWalletClaimed
|
|
1595
|
+
onPregenWalletClaimed == null ? void 0 : onPregenWalletClaimed(event);
|
|
1570
1596
|
};
|
|
1571
1597
|
const updateSelectedWallet = () => {
|
|
1572
1598
|
if (!client) {
|
|
1573
1599
|
clearSelectedWallet();
|
|
1574
1600
|
return;
|
|
1575
1601
|
}
|
|
1576
|
-
if (!selectedWallet
|
|
1602
|
+
if (!(selectedWallet == null ? void 0 : selectedWallet.id) || !client.findWallet(selectedWallet == null ? void 0 : selectedWallet.id)) {
|
|
1577
1603
|
const defaultWallet = client.findWallet(void 0, void 0, { forbidPregen: true });
|
|
1578
|
-
setSelectedWallet({ id: defaultWallet
|
|
1604
|
+
setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
|
|
1579
1605
|
}
|
|
1580
1606
|
};
|
|
1581
1607
|
useEffect5(() => {
|
|
@@ -1612,7 +1638,8 @@ var ParaProvider = ({ children, paraClientConfig, callbacks, config = DEFAULT_CO
|
|
|
1612
1638
|
useAutoSessionKeepAlive({ disabled: config.disableAutoSessionKeepAlive });
|
|
1613
1639
|
const setClient = useStore((state) => state.setClient);
|
|
1614
1640
|
useEffect6(() => {
|
|
1615
|
-
|
|
1641
|
+
var _a;
|
|
1642
|
+
const newClient = (_a = config.paraClientOverride) != null ? _a : new ParaInternal(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts);
|
|
1616
1643
|
setClient(newClient);
|
|
1617
1644
|
}, [paraClientConfig, config.paraClientOverride]);
|
|
1618
1645
|
return children;
|
|
@@ -1642,6 +1669,7 @@ var ExternalWalletCard = ({ address, showAddFunds }) => {
|
|
|
1642
1669
|
);
|
|
1643
1670
|
};
|
|
1644
1671
|
var WalletCard = ({ id, type, showAddFunds }) => {
|
|
1672
|
+
var _a;
|
|
1645
1673
|
const para = useInternalClient();
|
|
1646
1674
|
const appName = useThemeStore((state) => state.appName);
|
|
1647
1675
|
const wallet = para.findWallet(id, type);
|
|
@@ -1655,7 +1683,7 @@ var WalletCard = ({ id, type, showAddFunds }) => {
|
|
|
1655
1683
|
id: wallet.id,
|
|
1656
1684
|
type: wallet.type,
|
|
1657
1685
|
address: truncateAddress(address, type, { prefix: para.cosmosPrefix }),
|
|
1658
|
-
name: wallet.name
|
|
1686
|
+
name: (_a = wallet.name) != null ? _a : `${appName ? `${appName} ` : ""}Wallet`,
|
|
1659
1687
|
identiconHash: para.getIdenticonHash(wallet.id, type),
|
|
1660
1688
|
showAddFunds
|
|
1661
1689
|
}
|
|
@@ -1740,6 +1768,7 @@ var AddFundsButton = styled5(CpslButton3)`
|
|
|
1740
1768
|
// src/modal/components/LoginDoneStep/LoginDoneStep.tsx
|
|
1741
1769
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1742
1770
|
var LoginDoneStep = ({ onClose }) => {
|
|
1771
|
+
var _a;
|
|
1743
1772
|
const para = useInternalClient();
|
|
1744
1773
|
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
1745
1774
|
useEffect7(() => {
|
|
@@ -1750,7 +1779,7 @@ var LoginDoneStep = ({ onClose }) => {
|
|
|
1750
1779
|
return /* @__PURE__ */ jsxs5(StepContainer, { children: [
|
|
1751
1780
|
/* @__PURE__ */ jsx5(HeroIcon, { icon: "checkCircleFilled" }),
|
|
1752
1781
|
/* @__PURE__ */ jsx5(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
|
|
1753
|
-
!hideWallets && /* @__PURE__ */ jsx5(WalletCards, { children: para.isUsingExternalWallet() ? /* @__PURE__ */ jsx5(ExternalWalletCard, { address: para.
|
|
1782
|
+
!hideWallets && /* @__PURE__ */ jsx5(WalletCards, { children: para.isUsingExternalWallet() ? /* @__PURE__ */ jsx5(ExternalWalletCard, { address: (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address }) : para.currentWalletIdsArray.map(([id, type]) => {
|
|
1754
1783
|
return /* @__PURE__ */ jsx5(WalletCard, { id, type }, `${id}-${type}`);
|
|
1755
1784
|
}) })
|
|
1756
1785
|
] });
|
|
@@ -1833,14 +1862,14 @@ var WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
|
1833
1862
|
const isLogin = useModalStore((state) => state.isLogin());
|
|
1834
1863
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
1835
1864
|
const para = useInternalClient();
|
|
1836
|
-
const isOnRampConfigured = onRampConfig
|
|
1837
|
-
const handleNext =
|
|
1865
|
+
const isOnRampConfigured = (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isWithdrawEnabled);
|
|
1866
|
+
const handleNext = () => __async(void 0, null, function* () {
|
|
1838
1867
|
if (isLogin) {
|
|
1839
1868
|
if (!twoFactorAuthEnabled) {
|
|
1840
1869
|
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
1841
1870
|
return;
|
|
1842
1871
|
}
|
|
1843
|
-
const is2FAComplete =
|
|
1872
|
+
const is2FAComplete = yield para.check2FAStatus();
|
|
1844
1873
|
setStep(is2FAComplete ? "LOGIN_DONE" /* LOGIN_DONE */ : "SETUP_2FA" /* SETUP_2FA */);
|
|
1845
1874
|
} else {
|
|
1846
1875
|
if (twoFactorAuthEnabled) {
|
|
@@ -1849,7 +1878,7 @@ var WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
|
1849
1878
|
onClose();
|
|
1850
1879
|
}
|
|
1851
1880
|
}
|
|
1852
|
-
};
|
|
1881
|
+
});
|
|
1853
1882
|
return /* @__PURE__ */ jsxs8(StepContainer, { $wide: true, children: [
|
|
1854
1883
|
/* @__PURE__ */ jsx9(CardContainer, { children: hideWallets ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1855
1884
|
/* @__PURE__ */ jsx9(HeroIcon, { icon: "checkCircleFilled" }),
|
|
@@ -1922,9 +1951,9 @@ var RecoverySecretStep = () => {
|
|
|
1922
1951
|
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
1923
1952
|
const recoveryShare = useUserInfoStore((state) => state.recoveryShare);
|
|
1924
1953
|
const backupDecryptionKey = JSON.parse(recoveryShare || "{}").backupDecryptionKey;
|
|
1925
|
-
const onComplete =
|
|
1954
|
+
const onComplete = () => __async(void 0, null, function* () {
|
|
1926
1955
|
setStep("WALLET_CREATION_DONE" /* WALLET_CREATION_DONE */);
|
|
1927
|
-
};
|
|
1956
|
+
});
|
|
1928
1957
|
return /* @__PURE__ */ jsxs9(StepContainer, { children: [
|
|
1929
1958
|
/* @__PURE__ */ jsxs9(InnerStepContainer, { children: [
|
|
1930
1959
|
/* @__PURE__ */ jsx10(Heading, { variant: "headingS", weight: "bold", children: hideWallets ? "Don't lose access" : "Don't lose your wallet" }),
|
|
@@ -1941,7 +1970,7 @@ var RecoverySecretStep = () => {
|
|
|
1941
1970
|
/* @__PURE__ */ jsx10(
|
|
1942
1971
|
SaveRecoverySecret,
|
|
1943
1972
|
{
|
|
1944
|
-
email: authInfo
|
|
1973
|
+
email: (authInfo == null ? void 0 : authInfo.authType) === "email" ? authInfo.identifier : void 0,
|
|
1945
1974
|
value: backupDecryptionKey,
|
|
1946
1975
|
onComplete
|
|
1947
1976
|
}
|
|
@@ -2062,10 +2091,11 @@ function ExternalWalletProvider({
|
|
|
2062
2091
|
(a, b) => walletSort.indexOf(a.id.toUpperCase()) - walletSort.indexOf(b.id.toUpperCase())
|
|
2063
2092
|
).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
2064
2093
|
const wallet = useMemo2(() => wallets.find((w) => w.id === selectedExternalWalletId), [wallets, selectedExternalWalletId]);
|
|
2065
|
-
const updateQrUri =
|
|
2066
|
-
|
|
2094
|
+
const updateQrUri = () => __async(this, null, function* () {
|
|
2095
|
+
var _a;
|
|
2096
|
+
const uri = yield (_a = wallet == null ? void 0 : wallet.getQrUri) == null ? void 0 : _a.call(wallet);
|
|
2067
2097
|
setQrUri(uri);
|
|
2068
|
-
};
|
|
2098
|
+
});
|
|
2069
2099
|
useEffect9(() => {
|
|
2070
2100
|
if (wallet) {
|
|
2071
2101
|
if (!qrUri) {
|
|
@@ -2076,7 +2106,8 @@ function ExternalWalletProvider({
|
|
|
2076
2106
|
}
|
|
2077
2107
|
}, [wallet]);
|
|
2078
2108
|
const chains = useMemo2(() => {
|
|
2079
|
-
|
|
2109
|
+
var _a;
|
|
2110
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2080
2111
|
switch (walletType) {
|
|
2081
2112
|
case WalletType2.COSMOS: {
|
|
2082
2113
|
return cosmosChains;
|
|
@@ -2090,13 +2121,14 @@ function ExternalWalletProvider({
|
|
|
2090
2121
|
}
|
|
2091
2122
|
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
2092
2123
|
const chainId = useMemo2(() => {
|
|
2093
|
-
|
|
2124
|
+
var _a;
|
|
2125
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2094
2126
|
switch (walletType) {
|
|
2095
2127
|
case WalletType2.COSMOS: {
|
|
2096
2128
|
return cosmosChainId;
|
|
2097
2129
|
}
|
|
2098
2130
|
case WalletType2.EVM: {
|
|
2099
|
-
return evmChainId
|
|
2131
|
+
return evmChainId == null ? void 0 : evmChainId.toString();
|
|
2100
2132
|
}
|
|
2101
2133
|
default: {
|
|
2102
2134
|
return void 0;
|
|
@@ -2104,8 +2136,9 @@ function ExternalWalletProvider({
|
|
|
2104
2136
|
}
|
|
2105
2137
|
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
2106
2138
|
const switchChain = useCallback(
|
|
2107
|
-
|
|
2108
|
-
|
|
2139
|
+
(chainId2) => __async(this, null, function* () {
|
|
2140
|
+
var _a;
|
|
2141
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2109
2142
|
if (walletType) {
|
|
2110
2143
|
let resp;
|
|
2111
2144
|
setExternalWalletError();
|
|
@@ -2113,12 +2146,12 @@ function ExternalWalletProvider({
|
|
|
2113
2146
|
switch (walletType) {
|
|
2114
2147
|
case WalletType2.COSMOS: {
|
|
2115
2148
|
setStep("CHAIN_SWITCH" /* CHAIN_SWITCH */);
|
|
2116
|
-
resp =
|
|
2149
|
+
resp = yield cosmosSwitchChain(chainId2);
|
|
2117
2150
|
break;
|
|
2118
2151
|
}
|
|
2119
2152
|
case WalletType2.EVM: {
|
|
2120
2153
|
setStep("CHAIN_SWITCH" /* CHAIN_SWITCH */);
|
|
2121
|
-
resp =
|
|
2154
|
+
resp = yield evmSwitchChain(parseInt(chainId2));
|
|
2122
2155
|
break;
|
|
2123
2156
|
}
|
|
2124
2157
|
default: {
|
|
@@ -2133,15 +2166,15 @@ function ExternalWalletProvider({
|
|
|
2133
2166
|
setStep("ACCOUNT_MAIN" /* ACCOUNT_MAIN */);
|
|
2134
2167
|
}
|
|
2135
2168
|
}
|
|
2136
|
-
},
|
|
2169
|
+
}),
|
|
2137
2170
|
[evmSwitchChain, cosmosSwitchChain]
|
|
2138
2171
|
);
|
|
2139
2172
|
const connectExternalWallet = useCallback(
|
|
2140
|
-
|
|
2173
|
+
(wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
|
|
2141
2174
|
if (isExternalWalletConnecting && isManualWalletConnect) {
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2175
|
+
yield evmDisconnect();
|
|
2176
|
+
yield solanaDisconnect();
|
|
2177
|
+
yield cosmosDisconnect();
|
|
2145
2178
|
setQrUri(void 0);
|
|
2146
2179
|
setIsExternalWalletConnecting(false);
|
|
2147
2180
|
}
|
|
@@ -2149,14 +2182,14 @@ function ExternalWalletProvider({
|
|
|
2149
2182
|
setExternalWalletError();
|
|
2150
2183
|
setIsExternalWalletConnecting(true);
|
|
2151
2184
|
setIsUsingMobileConnector(isMobileConnect);
|
|
2152
|
-
const { address, error } =
|
|
2185
|
+
const { address, error } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect) : wallet2.connect();
|
|
2153
2186
|
if (error) {
|
|
2154
2187
|
setExternalWalletError([error]);
|
|
2155
2188
|
setIsUsingMobileConnector();
|
|
2156
2189
|
if (isManualWalletConnect && error === "Connection request rejected") {
|
|
2157
2190
|
setExternalWalletError();
|
|
2158
|
-
|
|
2159
|
-
|
|
2191
|
+
yield connectExternalWallet(wallet2, false, false, true);
|
|
2192
|
+
yield updateQrUri();
|
|
2160
2193
|
return;
|
|
2161
2194
|
}
|
|
2162
2195
|
} else if (address) {
|
|
@@ -2164,29 +2197,29 @@ function ExternalWalletProvider({
|
|
|
2164
2197
|
}
|
|
2165
2198
|
setIsExternalWalletConnecting(false);
|
|
2166
2199
|
}
|
|
2167
|
-
},
|
|
2200
|
+
}),
|
|
2168
2201
|
[isExternalWalletConnecting]
|
|
2169
2202
|
);
|
|
2170
|
-
const disconnectExternalWallet =
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2203
|
+
const disconnectExternalWallet = () => __async(this, null, function* () {
|
|
2204
|
+
yield evmDisconnect();
|
|
2205
|
+
yield solanaDisconnect();
|
|
2206
|
+
yield cosmosDisconnect();
|
|
2174
2207
|
setSelectedExternalWalletId();
|
|
2175
|
-
};
|
|
2208
|
+
});
|
|
2176
2209
|
const walletDisplayHelpers = {
|
|
2177
2210
|
// Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
|
|
2178
2211
|
// Also show the extension connection if on desktop for a solana wallet (no walletConnect)
|
|
2179
|
-
showExtension: !isMobile() && (wallet
|
|
2212
|
+
showExtension: !isMobile() && ((wallet == null ? void 0 : wallet.isExtension) && (wallet == null ? void 0 : wallet.installed) || !(wallet == null ? void 0 : wallet.isMobile) || (wallet == null ? void 0 : wallet.type) === WalletType2.SOLANA),
|
|
2180
2213
|
// Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
|
|
2181
|
-
showMobile: isMobile() && wallet
|
|
2182
|
-
isSolanaMobileIOS: isIOS() && isMobile() && !isIOSWebview() && wallet
|
|
2183
|
-
isCosmosMobileWallet: wallet
|
|
2214
|
+
showMobile: isMobile() && (wallet == null ? void 0 : wallet.isMobile) || !isMobile() && !(wallet == null ? void 0 : wallet.installed),
|
|
2215
|
+
isSolanaMobileIOS: isIOS() && isMobile() && !isIOSWebview() && (wallet == null ? void 0 : wallet.type) === WalletType2.SOLANA,
|
|
2216
|
+
isCosmosMobileWallet: (wallet == null ? void 0 : wallet.type) === WalletType2.COSMOS && isUsingMobileConnector
|
|
2184
2217
|
};
|
|
2185
2218
|
const username = useMemo2(() => {
|
|
2186
2219
|
let username2;
|
|
2187
|
-
const storedExternalWallet = para.externalWallets[
|
|
2220
|
+
const storedExternalWallet = Object.values(para.externalWallets || {})[0];
|
|
2188
2221
|
if (storedExternalWallet) {
|
|
2189
|
-
const walletType = storedExternalWallet
|
|
2222
|
+
const walletType = storedExternalWallet == null ? void 0 : storedExternalWallet.type;
|
|
2190
2223
|
switch (walletType) {
|
|
2191
2224
|
case WalletType2.EVM: {
|
|
2192
2225
|
username2 = evmUsername ? evmUsername.startsWith("0x") ? truncateAddress2(evmUsername, "EVM") : evmUsername : void 0;
|
|
@@ -2201,7 +2234,8 @@ function ExternalWalletProvider({
|
|
|
2201
2234
|
return username2;
|
|
2202
2235
|
}, [evmUsername, wallet]);
|
|
2203
2236
|
const avatar = useMemo2(() => {
|
|
2204
|
-
|
|
2237
|
+
var _a;
|
|
2238
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2205
2239
|
if (walletType) {
|
|
2206
2240
|
switch (walletType) {
|
|
2207
2241
|
case WalletType2.EVM: {
|
|
@@ -2292,9 +2326,10 @@ function useCreateAccount() {
|
|
|
2292
2326
|
const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
|
|
2293
2327
|
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
2294
2328
|
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
2295
|
-
const awaitWalletCreationTransition =
|
|
2296
|
-
|
|
2297
|
-
|
|
2329
|
+
const awaitWalletCreationTransition = () => __async(this, null, function* () {
|
|
2330
|
+
var _a;
|
|
2331
|
+
const isComplete = yield para.waitForAccountCreation({ popupWindow: refs.popupWindow.current });
|
|
2332
|
+
window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
2298
2333
|
refs.poll.current = void 0;
|
|
2299
2334
|
refs.popupWindow.current = void 0;
|
|
2300
2335
|
if (isComplete) {
|
|
@@ -2304,13 +2339,14 @@ function useCreateAccount() {
|
|
|
2304
2339
|
} else if (refs.currentStep.current === "AWAITING_BIOMETRIC_CREATION" /* AWAITING_BIOMETRIC_CREATION */) {
|
|
2305
2340
|
goBack();
|
|
2306
2341
|
}
|
|
2307
|
-
};
|
|
2342
|
+
});
|
|
2308
2343
|
return {
|
|
2309
2344
|
withPasskey: () => {
|
|
2310
|
-
|
|
2345
|
+
var _a, _b;
|
|
2346
|
+
if (((_a = refs.poll.current) == null ? void 0 : _a.action) === "createPasskey") {
|
|
2311
2347
|
return;
|
|
2312
2348
|
}
|
|
2313
|
-
clearTimeout(refs.poll.current
|
|
2349
|
+
clearTimeout((_b = refs.poll.current) == null ? void 0 : _b.timeout);
|
|
2314
2350
|
refs.popupWindow.current = openPopup({
|
|
2315
2351
|
url: webAuthURLForCreate,
|
|
2316
2352
|
target: "ParaPasskey",
|
|
@@ -2326,10 +2362,11 @@ function useCreateAccount() {
|
|
|
2326
2362
|
}
|
|
2327
2363
|
},
|
|
2328
2364
|
withPassword: () => {
|
|
2329
|
-
|
|
2365
|
+
var _a, _b;
|
|
2366
|
+
if (((_a = refs.poll.current) == null ? void 0 : _a.action) === "createPassword") {
|
|
2330
2367
|
return;
|
|
2331
2368
|
}
|
|
2332
|
-
clearTimeout(refs.poll.current
|
|
2369
|
+
clearTimeout((_b = refs.poll.current) == null ? void 0 : _b.timeout);
|
|
2333
2370
|
refs.poll.current = {
|
|
2334
2371
|
action: "createPassword",
|
|
2335
2372
|
timeout: window.setTimeout(awaitWalletCreationTransition, DEFAULTS.POLLING_INTERVAL_MS)
|
|
@@ -2342,12 +2379,12 @@ function useCreateAccount() {
|
|
|
2342
2379
|
}
|
|
2343
2380
|
|
|
2344
2381
|
// src/modal/components/BiometricCreationStep/BiometricCreationStep.tsx
|
|
2345
|
-
import { isPasskeySupported as isPasskeySupported2 } from "@getpara/web-sdk";
|
|
2346
2382
|
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2347
2383
|
var BiometricCreationStep = () => {
|
|
2348
2384
|
const createAccount = useCreateAccount();
|
|
2349
2385
|
const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
|
|
2350
2386
|
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
2387
|
+
const isPasskeySupported2 = useModalStore((state) => state.isPasskeySupported);
|
|
2351
2388
|
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
2352
2389
|
const [isCopied, copy] = useCopyToClipboard3();
|
|
2353
2390
|
const handleCopy = () => {
|
|
@@ -2357,11 +2394,11 @@ var BiometricCreationStep = () => {
|
|
|
2357
2394
|
return /* @__PURE__ */ jsxs11(StepContainer, { $wide: true, children: [
|
|
2358
2395
|
/* @__PURE__ */ jsxs11(InnerStepContainer, { children: [
|
|
2359
2396
|
/* @__PURE__ */ jsx13(Heading, { variant: "headingS", weight: "bold", children: isBoth ? "Secure Your Account" : "Create Passkey" }),
|
|
2360
|
-
/* @__PURE__ */ jsx13(UserIdentifier2, {
|
|
2397
|
+
/* @__PURE__ */ jsx13(UserIdentifier2, __spreadValues({}, authInfo)),
|
|
2361
2398
|
/* @__PURE__ */ jsx13(CpslText10, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
|
|
2362
2399
|
] }),
|
|
2363
2400
|
/* @__PURE__ */ jsxs11(InnerStepContainer, { children: [
|
|
2364
|
-
isPasskeySupported2
|
|
2401
|
+
isPasskeySupported2 ? /* @__PURE__ */ jsxs11(CpslButton7, { fullWidth: true, onClick: createAccount.withPasskey, children: [
|
|
2365
2402
|
/* @__PURE__ */ jsx13(CpslIcon5, { slot: "start", icon: "key" }),
|
|
2366
2403
|
isBoth ? "Create Passkey" : "Create"
|
|
2367
2404
|
] }) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
@@ -2470,16 +2507,20 @@ var ON_RAMP_ASSETS = {
|
|
|
2470
2507
|
[OnRampAsset.CREAL]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" }
|
|
2471
2508
|
};
|
|
2472
2509
|
function getNetworkName(str) {
|
|
2473
|
-
|
|
2510
|
+
var _a, _b;
|
|
2511
|
+
return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
|
|
2474
2512
|
}
|
|
2475
2513
|
function getNetworkIcon(str) {
|
|
2476
|
-
|
|
2514
|
+
var _a, _b;
|
|
2515
|
+
return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.icon) != null ? _b : "globe";
|
|
2477
2516
|
}
|
|
2478
2517
|
function getAssetName(str) {
|
|
2479
|
-
|
|
2518
|
+
var _a, _b;
|
|
2519
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.code) != null ? _b : str;
|
|
2480
2520
|
}
|
|
2481
2521
|
function getAssetIcon(str) {
|
|
2482
|
-
|
|
2522
|
+
var _a, _b;
|
|
2523
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.icon) != null ? _b : "emptyCircle";
|
|
2483
2524
|
}
|
|
2484
2525
|
var MOBILE_SIZE = 480;
|
|
2485
2526
|
var NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
@@ -2516,11 +2557,11 @@ var OnRampProviderButton = ({ config, index, onClick: _onClick }) => {
|
|
|
2516
2557
|
const provider = config.providers[index];
|
|
2517
2558
|
const { feeLower, feeUpper, name, icon, backgroundColors } = ON_RAMP_PROVIDERS[provider];
|
|
2518
2559
|
const feeString = `Fee ${feeLower}% - ${feeUpper}%`;
|
|
2519
|
-
const onClick =
|
|
2560
|
+
const onClick = () => __async(void 0, null, function* () {
|
|
2520
2561
|
setIsLoading(true);
|
|
2521
|
-
|
|
2562
|
+
yield _onClick();
|
|
2522
2563
|
setIsLoading(false);
|
|
2523
|
-
};
|
|
2564
|
+
});
|
|
2524
2565
|
return /* @__PURE__ */ jsx15(StyledButton, { $gradientColors: backgroundColors, fullWidth: true, onClick, children: /* @__PURE__ */ jsxs12(Container2, { $backgroundColor: backgroundColors[1], children: [
|
|
2525
2566
|
/* @__PURE__ */ jsx15(IconContainer, { children: /* @__PURE__ */ jsx15(CpslIcon6, { icon }) }),
|
|
2526
2567
|
/* @__PURE__ */ jsxs12(ProviderInfoContainer, { children: [
|
|
@@ -2625,10 +2666,10 @@ var AddFunds = () => {
|
|
|
2625
2666
|
const activeWallet = useActiveWallet();
|
|
2626
2667
|
const tabs = TABS.filter(([, key]) => !!onRampConfig[key]);
|
|
2627
2668
|
const isMultiFlow = tabs.length > 1;
|
|
2628
|
-
const tab = storedTab
|
|
2669
|
+
const tab = storedTab != null ? storedTab : tabs[0][0];
|
|
2629
2670
|
const address = useMemo4(
|
|
2630
2671
|
() => activeWallet ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "",
|
|
2631
|
-
[para, activeWallet
|
|
2672
|
+
[para, activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type]
|
|
2632
2673
|
);
|
|
2633
2674
|
const onSetTab = (event) => {
|
|
2634
2675
|
setStep(getAddFundsStep(event.detail.tab));
|
|
@@ -2648,27 +2689,27 @@ var AddFunds = () => {
|
|
|
2648
2689
|
allowed: onRampConfig.allowedAssets ? Object.keys(onRampConfig.allowedAssets) : void 0
|
|
2649
2690
|
});
|
|
2650
2691
|
const allowedAssetsLookup = allowedNetworks2.reduce((acc, network) => {
|
|
2651
|
-
|
|
2692
|
+
var _a;
|
|
2693
|
+
const configValue = (_a = onRampConfig.allowedAssets) == null ? void 0 : _a[network];
|
|
2652
2694
|
const allowed = configValue === true ? void 0 : configValue;
|
|
2653
|
-
return {
|
|
2654
|
-
...acc,
|
|
2695
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
2655
2696
|
[network]: getOnRampAssets(onRampConfig.assetInfo, { walletType: activeWallet.type, network, allowed })
|
|
2656
|
-
};
|
|
2697
|
+
});
|
|
2657
2698
|
}, {});
|
|
2658
2699
|
const isProviderAllowed2 = onRampConfig.providers.reduce(
|
|
2659
2700
|
(acc, id) => {
|
|
2660
2701
|
const hasMatch = toAssetInfoArray(onRampConfig.assetInfo).some(([type, network, asset, validProviders]) => {
|
|
2661
|
-
|
|
2702
|
+
var _a, _b;
|
|
2703
|
+
return type === activeWallet.type && allowedNetworks2.includes(network) && (!allowedAssetsLookup[network] || allowedAssetsLookup[network].includes(asset)) && !!((_b = (_a = validProviders[id]) == null ? void 0 : _a[1]) == null ? void 0 : _b[action]);
|
|
2662
2704
|
});
|
|
2663
|
-
return {
|
|
2664
|
-
...acc,
|
|
2705
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
2665
2706
|
[id]: hasMatch
|
|
2666
|
-
};
|
|
2707
|
+
});
|
|
2667
2708
|
},
|
|
2668
2709
|
{}
|
|
2669
2710
|
);
|
|
2670
2711
|
return [allowedNetworks2, [...new Set(Object.values(allowedAssetsLookup).flat())], isProviderAllowed2];
|
|
2671
|
-
}, [activeWallet
|
|
2712
|
+
}, [activeWallet == null ? void 0 : activeWallet.type, activeWallet == null ? void 0 : activeWallet.isExternal, tab, onRampConfig.assetInfo, onRampConfig.allowedAssets, chainId]);
|
|
2672
2713
|
useEffect10(() => {
|
|
2673
2714
|
setOnRampPurchase(void 0);
|
|
2674
2715
|
}, []);
|
|
@@ -2708,10 +2749,11 @@ var AddFunds = () => {
|
|
|
2708
2749
|
{
|
|
2709
2750
|
config: onRampConfig,
|
|
2710
2751
|
index,
|
|
2711
|
-
onClick:
|
|
2712
|
-
|
|
2752
|
+
onClick: () => __async(void 0, null, function* () {
|
|
2753
|
+
var _a;
|
|
2754
|
+
if (!(activeWallet == null ? void 0 : activeWallet.type)) return;
|
|
2713
2755
|
const isPopup = id !== OnRampProvider2.RAMP;
|
|
2714
|
-
const { onRampPurchase: newOnRampPurchase } =
|
|
2756
|
+
const { onRampPurchase: newOnRampPurchase } = yield para.initiateOnRampTransaction({
|
|
2715
2757
|
walletId: activeWallet.isExternal ? void 0 : activeWallet.id,
|
|
2716
2758
|
externalWalletAddress: activeWallet.isExternal ? activeWallet.id : void 0,
|
|
2717
2759
|
shouldOpenPopup: isPopup,
|
|
@@ -2723,13 +2765,13 @@ var AddFunds = () => {
|
|
|
2723
2765
|
assets: allowedAssets,
|
|
2724
2766
|
defaultNetwork: onRampConfig.defaultOnRampNetwork,
|
|
2725
2767
|
defaultAsset: onRampConfig.defaultOnRampAsset,
|
|
2726
|
-
fiatQuantity: onRampConfig.defaultBuyAmount
|
|
2768
|
+
fiatQuantity: (_a = onRampConfig.defaultBuyAmount) == null ? void 0 : _a[0],
|
|
2727
2769
|
testMode: onRampConfig.testMode
|
|
2728
2770
|
}
|
|
2729
2771
|
});
|
|
2730
|
-
setOnRampPurchase({
|
|
2772
|
+
setOnRampPurchase(__spreadProps(__spreadValues({}, newOnRampPurchase), { fiat: "USD" }));
|
|
2731
2773
|
!isPopup && setStep("ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */);
|
|
2732
|
-
}
|
|
2774
|
+
})
|
|
2733
2775
|
},
|
|
2734
2776
|
id
|
|
2735
2777
|
)
|
|
@@ -2752,7 +2794,7 @@ var AddFunds = () => {
|
|
|
2752
2794
|
] }),
|
|
2753
2795
|
/* @__PURE__ */ jsxs13(InnerStepContainer, { children: [
|
|
2754
2796
|
/* @__PURE__ */ jsxs13(CenteredText, { weight: "semiBold", children: [
|
|
2755
|
-
!!onRampConfig.allowedAssets && allowedNetworks.length > 0 || hideWallets ? appName
|
|
2797
|
+
!!onRampConfig.allowedAssets && allowedNetworks.length > 0 || hideWallets ? appName != null ? appName : "This App" : "This Wallet",
|
|
2756
2798
|
" ",
|
|
2757
2799
|
"Only Supports:"
|
|
2758
2800
|
] }),
|
|
@@ -2810,31 +2852,31 @@ var AddFundsAwaiting = () => {
|
|
|
2810
2852
|
onClose: goBack
|
|
2811
2853
|
};
|
|
2812
2854
|
useEffect11(() => {
|
|
2813
|
-
const _MoonPayEmbed = lazy(() => import("./MoonPayEmbed-
|
|
2855
|
+
const _MoonPayEmbed = lazy(() => import("./MoonPayEmbed-Q2HP2BFI.js"));
|
|
2814
2856
|
setMoonPayEmbed(_MoonPayEmbed);
|
|
2815
2857
|
}, []);
|
|
2816
2858
|
const onRampEmbed = useMemo5(() => {
|
|
2817
2859
|
if (!onRampPurchase.id) {
|
|
2818
2860
|
return null;
|
|
2819
2861
|
}
|
|
2820
|
-
switch (onRampPurchase
|
|
2862
|
+
switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
|
|
2821
2863
|
case OnRampProvider3.STRIPE:
|
|
2822
|
-
return /* @__PURE__ */ jsx17(StripeEmbed, {
|
|
2864
|
+
return /* @__PURE__ */ jsx17(StripeEmbed, __spreadValues({}, props));
|
|
2823
2865
|
case OnRampProvider3.MOONPAY:
|
|
2824
|
-
return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx17(MoonPayEmbed, {
|
|
2866
|
+
return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx17(MoonPayEmbed, __spreadValues({}, props));
|
|
2825
2867
|
case OnRampProvider3.RAMP:
|
|
2826
|
-
return /* @__PURE__ */ jsx17(RampEmbed, { apiKey: onRampConfig.rampApiKey,
|
|
2868
|
+
return /* @__PURE__ */ jsx17(RampEmbed, __spreadValues({ apiKey: onRampConfig.rampApiKey }, props));
|
|
2827
2869
|
}
|
|
2828
|
-
}, [onRampPurchase
|
|
2870
|
+
}, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
|
|
2829
2871
|
useEffect11(() => {
|
|
2830
2872
|
let timeoutId;
|
|
2831
|
-
if (onRampPurchase
|
|
2873
|
+
if ((onRampPurchase == null ? void 0 : onRampPurchase.status) && ["CANCELLED", "FINISHED"].includes(onRampPurchase.status)) {
|
|
2832
2874
|
timeoutId = setTimeout(() => {
|
|
2833
2875
|
setStep(STEPS[onRampPurchase.status]);
|
|
2834
2876
|
}, 5e3);
|
|
2835
2877
|
}
|
|
2836
2878
|
return () => clearTimeout(timeoutId);
|
|
2837
|
-
}, [onRampPurchase
|
|
2879
|
+
}, [onRampPurchase == null ? void 0 : onRampPurchase.status]);
|
|
2838
2880
|
return /* @__PURE__ */ jsx17(Container3, { $wide: true, children: onRampEmbed });
|
|
2839
2881
|
};
|
|
2840
2882
|
var Container3 = styled10(StepContainer)`
|
|
@@ -2853,11 +2895,11 @@ var AddFundsDone = ({ isSuccess, onClose }) => {
|
|
|
2853
2895
|
const formatter = useMemo6(() => {
|
|
2854
2896
|
return new Intl.NumberFormat("en-US", {
|
|
2855
2897
|
style: "currency",
|
|
2856
|
-
currency: onRampPurchase
|
|
2898
|
+
currency: (onRampPurchase == null ? void 0 : onRampPurchase.fiat) || "USD"
|
|
2857
2899
|
});
|
|
2858
|
-
}, [onRampPurchase
|
|
2900
|
+
}, [onRampPurchase == null ? void 0 : onRampPurchase.fiat]);
|
|
2859
2901
|
const heading = isSuccess ? "Transaction Successful" : "Something Went Wrong";
|
|
2860
|
-
const text = isSuccess ? `${formatter.format(parseFloat(onRampPurchase
|
|
2902
|
+
const text = isSuccess ? `${formatter.format(parseFloat(onRampPurchase == null ? void 0 : onRampPurchase.fiatQuantity))} is now available in your ${hideWallets ? "account" : "wallet"}.` : `No funds were added to your ${hideWallets ? "account" : "wallet"}.`;
|
|
2861
2903
|
const buttonText = isSuccess ? "Done" : "Try Again";
|
|
2862
2904
|
return /* @__PURE__ */ jsxs14(StepContainer, { children: [
|
|
2863
2905
|
/* @__PURE__ */ jsx18(HeroIcon, { icon: "checkCircleFilled" }),
|
|
@@ -2899,34 +2941,34 @@ var FarcasterOAuthStep = () => {
|
|
|
2899
2941
|
const theme = useThemeStore((state) => state.theme);
|
|
2900
2942
|
useEffect12(() => {
|
|
2901
2943
|
if (farcasterConnectUri) {
|
|
2902
|
-
const pollStatus =
|
|
2903
|
-
const { userExists, username, pfpUrl } =
|
|
2944
|
+
const pollStatus = () => __async(void 0, null, function* () {
|
|
2945
|
+
const { userExists, username, pfpUrl } = yield para.waitForFarcasterStatus();
|
|
2904
2946
|
setAuthInfo({ farcasterUsername: username, pfpUrl });
|
|
2905
2947
|
if (userExists) {
|
|
2906
|
-
const supportedAuthMethods =
|
|
2948
|
+
const supportedAuthMethods = yield para.initiateUserLoginV2({ farcasterUsername: username });
|
|
2907
2949
|
if (supportedAuthMethods.size > 0) {
|
|
2908
2950
|
setSupportedAuthMethods(supportedAuthMethods);
|
|
2909
|
-
const biometricLocationHints = supportedAuthMethods.has(AuthMethod3.PASSKEY) ?
|
|
2951
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod3.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
2910
2952
|
setFlow("login");
|
|
2911
2953
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
2912
2954
|
setBiometricLocationHints(biometricLocationHints);
|
|
2913
2955
|
return;
|
|
2914
2956
|
}
|
|
2915
2957
|
}
|
|
2916
|
-
const supportedCreateAuthMethods =
|
|
2958
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
2917
2959
|
setIsIFrameReady(false);
|
|
2918
2960
|
setFlow("signUp");
|
|
2919
2961
|
const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod3.PASSKEY);
|
|
2920
2962
|
if (supportsPasskey) {
|
|
2921
|
-
setWebAuthURLForCreate(
|
|
2963
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "farcaster" })));
|
|
2922
2964
|
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
2923
2965
|
}
|
|
2924
2966
|
if (supportedCreateAuthMethods.has(AuthMethod3.PASSWORD)) {
|
|
2925
|
-
setIFrameUrl(
|
|
2967
|
+
setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "farcaster", theme })));
|
|
2926
2968
|
setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
2927
2969
|
}
|
|
2928
2970
|
return;
|
|
2929
|
-
};
|
|
2971
|
+
});
|
|
2930
2972
|
pollStatus();
|
|
2931
2973
|
return () => {
|
|
2932
2974
|
setFarcasterConnectUri(void 0);
|
|
@@ -3081,9 +3123,9 @@ var ExternalWallets = () => {
|
|
|
3081
3123
|
SearchInput,
|
|
3082
3124
|
{
|
|
3083
3125
|
placeholder: "Search for your wallet",
|
|
3084
|
-
onCpslInput:
|
|
3126
|
+
onCpslInput: (e) => __async(void 0, null, function* () {
|
|
3085
3127
|
setSearch(e.target.value);
|
|
3086
|
-
},
|
|
3128
|
+
}),
|
|
3087
3129
|
value: search,
|
|
3088
3130
|
style: { width: "100%" },
|
|
3089
3131
|
children: /* @__PURE__ */ jsx21(SearchIcon, { slot: "start", icon: "search" })
|
|
@@ -3305,13 +3347,13 @@ var OAuth = ({ methods }) => {
|
|
|
3305
3347
|
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
3306
3348
|
const theme = useThemeStore((state) => state.theme);
|
|
3307
3349
|
useEffect13(() => {
|
|
3308
|
-
const initializeFarcaster =
|
|
3350
|
+
const initializeFarcaster = () => __async(void 0, null, function* () {
|
|
3309
3351
|
if (!methods.includes(OAuthMethod.FARCASTER)) {
|
|
3310
3352
|
return;
|
|
3311
3353
|
}
|
|
3312
|
-
const connectUri =
|
|
3354
|
+
const connectUri = yield para.getFarcasterConnectURL();
|
|
3313
3355
|
setFarcasterConnectUri(connectUri);
|
|
3314
|
-
};
|
|
3356
|
+
});
|
|
3315
3357
|
initializeFarcaster();
|
|
3316
3358
|
}, []);
|
|
3317
3359
|
const hasMore = methods.length > HAS_MORE_LENGTH2;
|
|
@@ -3319,7 +3361,7 @@ var OAuth = ({ methods }) => {
|
|
|
3319
3361
|
const handleShowAll = () => {
|
|
3320
3362
|
setStep("AUTH_MORE" /* AUTH_MORE */);
|
|
3321
3363
|
};
|
|
3322
|
-
const handleMethodClick = (method) =>
|
|
3364
|
+
const handleMethodClick = (method) => () => __async(void 0, null, function* () {
|
|
3323
3365
|
switch (method) {
|
|
3324
3366
|
case OAuthMethod.FARCASTER:
|
|
3325
3367
|
if (!farcasterConnectUri) {
|
|
@@ -3333,14 +3375,14 @@ var OAuth = ({ methods }) => {
|
|
|
3333
3375
|
break;
|
|
3334
3376
|
default:
|
|
3335
3377
|
setStep("AWAITING_OAUTH" /* AWAITING_OAUTH */);
|
|
3336
|
-
const oAuthURL =
|
|
3378
|
+
const oAuthURL = yield para.getOAuthURL({ method });
|
|
3337
3379
|
refs.popupWindow.current = openPopup({
|
|
3338
3380
|
url: oAuthURL,
|
|
3339
3381
|
target: `${method}AuthPopup`,
|
|
3340
3382
|
type: "OAUTH",
|
|
3341
3383
|
current: refs.popupWindow.current
|
|
3342
3384
|
});
|
|
3343
|
-
const { email, isError, userExists } =
|
|
3385
|
+
const { email, isError, userExists } = yield para.waitForOAuth({ popupWindow: refs.popupWindow.current });
|
|
3344
3386
|
refs.popupWindow.current = void 0;
|
|
3345
3387
|
if ((isError || !email) && refs.currentStep.current === "AWAITING_OAUTH" /* AWAITING_OAUTH */) {
|
|
3346
3388
|
goBack();
|
|
@@ -3348,9 +3390,9 @@ var OAuth = ({ methods }) => {
|
|
|
3348
3390
|
}
|
|
3349
3391
|
setAuthInfo({ email });
|
|
3350
3392
|
if (userExists) {
|
|
3351
|
-
const supportedAuthMethods =
|
|
3393
|
+
const supportedAuthMethods = yield para.initiateUserLoginV2({ email });
|
|
3352
3394
|
if (supportedAuthMethods.size > 0) {
|
|
3353
|
-
const biometricLocationHints = supportedAuthMethods.has(AuthMethod4.PASSKEY) ?
|
|
3395
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod4.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
3354
3396
|
setFlow("login");
|
|
3355
3397
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
3356
3398
|
setSupportedAuthMethods(supportedAuthMethods);
|
|
@@ -3358,25 +3400,25 @@ var OAuth = ({ methods }) => {
|
|
|
3358
3400
|
return;
|
|
3359
3401
|
}
|
|
3360
3402
|
}
|
|
3361
|
-
const supportedCreateAuthMethods =
|
|
3403
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
3362
3404
|
setIsIFrameReady(false);
|
|
3363
3405
|
setFlow("signUp");
|
|
3364
3406
|
const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod4.PASSKEY);
|
|
3365
3407
|
const supportsPassword = supportedCreateAuthMethods.has(AuthMethod4.PASSWORD);
|
|
3366
3408
|
if (supportsPasskey) {
|
|
3367
|
-
setWebAuthURLForCreate(
|
|
3409
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "email" })));
|
|
3368
3410
|
if (!supportsPassword) {
|
|
3369
3411
|
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
3370
3412
|
return;
|
|
3371
3413
|
}
|
|
3372
3414
|
}
|
|
3373
3415
|
if (supportsPassword) {
|
|
3374
|
-
setIFrameUrl(
|
|
3416
|
+
setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "email", theme })));
|
|
3375
3417
|
}
|
|
3376
3418
|
setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
3377
3419
|
break;
|
|
3378
3420
|
}
|
|
3379
|
-
};
|
|
3421
|
+
});
|
|
3380
3422
|
const useBrandedLogos = oAuthLogoVariant === "default";
|
|
3381
3423
|
const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== "dark";
|
|
3382
3424
|
const showMoreButton = !showAll && hasMore;
|
|
@@ -3475,14 +3517,15 @@ var useDropdownPosition = (inputRef) => {
|
|
|
3475
3517
|
const [dropdownWidth, setDropdownWidth] = useState10();
|
|
3476
3518
|
const [mobileAnchor, setMobileAnchor] = useState10();
|
|
3477
3519
|
const resize = () => {
|
|
3520
|
+
var _a, _b, _c;
|
|
3478
3521
|
if (typeof window !== "undefined") {
|
|
3479
3522
|
const newMaxHeight = Math.max(
|
|
3480
|
-
window.innerHeight - inputRef
|
|
3523
|
+
window.innerHeight - ((_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.getBoundingClientRect().bottom) - 20,
|
|
3481
3524
|
window.innerHeight * 0.25
|
|
3482
3525
|
);
|
|
3483
3526
|
setDropdownMaxHeight(newMaxHeight);
|
|
3484
|
-
setDropdownWidth(inputRef
|
|
3485
|
-
setMobileAnchor(inputRef
|
|
3527
|
+
setDropdownWidth((_b = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _b.getBoundingClientRect().width);
|
|
3528
|
+
setMobileAnchor((_c = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _c.getBoundingClientRect().height);
|
|
3486
3529
|
}
|
|
3487
3530
|
};
|
|
3488
3531
|
if (inputRef.current && !dropdownMaxHeight) {
|
|
@@ -3754,6 +3797,7 @@ function isCcMatch(countryCode, option) {
|
|
|
3754
3797
|
return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
|
|
3755
3798
|
}
|
|
3756
3799
|
var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
3800
|
+
var _a, _b;
|
|
3757
3801
|
const inputRef = useRef5(null);
|
|
3758
3802
|
const { dropdownMaxHeight, dropdownWidth } = useDropdownPosition(inputRef);
|
|
3759
3803
|
const para = useInternalClient();
|
|
@@ -3764,7 +3808,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3764
3808
|
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
3765
3809
|
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
3766
3810
|
const [countryCode, setCountryCode] = useState11(
|
|
3767
|
-
authInfo
|
|
3811
|
+
(authInfo == null ? void 0 : authInfo.authType) === "phone" ? authInfo.auth.countryCode || "+1" : "+1"
|
|
3768
3812
|
);
|
|
3769
3813
|
const [identifier, setIdentifier] = useState11(
|
|
3770
3814
|
(() => {
|
|
@@ -3781,7 +3825,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3781
3825
|
authInfo && (authInfo.authType === "email" || authInfo.authType === "phone") ? authInfo.authType : void 0
|
|
3782
3826
|
);
|
|
3783
3827
|
const [matchedCountryCode, setMatchedCountryCode] = useState11(
|
|
3784
|
-
countryCodes_default.find((option) => isCcMatch(countryCode, option))
|
|
3828
|
+
(_a = countryCodes_default.find((option) => isCcMatch(countryCode, option))) != null ? _a : DEFAULT_COUNTRY
|
|
3785
3829
|
);
|
|
3786
3830
|
const [isLoggingIn, setIsLoggingIn] = useState11(false);
|
|
3787
3831
|
const [error, setError] = useState11("");
|
|
@@ -3820,7 +3864,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3820
3864
|
setCountryCode(matchedCountryCode2.value);
|
|
3821
3865
|
setMatchedCountryCode(matchedCountryCode2);
|
|
3822
3866
|
};
|
|
3823
|
-
const login =
|
|
3867
|
+
const login = () => __async(void 0, null, function* () {
|
|
3824
3868
|
setError("");
|
|
3825
3869
|
if (isUnknown) {
|
|
3826
3870
|
setError("Please enter a valid email or phone number!");
|
|
@@ -3832,29 +3876,29 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3832
3876
|
setError("Please enter a valid email!");
|
|
3833
3877
|
return;
|
|
3834
3878
|
}
|
|
3835
|
-
|
|
3879
|
+
yield para.logout();
|
|
3836
3880
|
auth = { email: identifier };
|
|
3837
3881
|
setAuthInfo(auth);
|
|
3838
|
-
const userExists =
|
|
3882
|
+
const userExists = yield para.checkIfUserExists({ email: identifier });
|
|
3839
3883
|
if (userExists) {
|
|
3840
|
-
const supportedAuthMethods =
|
|
3841
|
-
const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ?
|
|
3884
|
+
const supportedAuthMethods = yield para.initiateUserLoginV2(auth);
|
|
3885
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
3842
3886
|
setFlow("login");
|
|
3843
3887
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
3844
3888
|
setSupportedAuthMethods(supportedAuthMethods);
|
|
3845
3889
|
setBiometricLocationHints(biometricLocationHints);
|
|
3846
3890
|
return;
|
|
3847
3891
|
}
|
|
3848
|
-
|
|
3892
|
+
yield para.createUser(auth);
|
|
3849
3893
|
setFlow("signUp");
|
|
3850
3894
|
setStep("VERIFICATIONS" /* VERIFICATIONS */);
|
|
3851
3895
|
return;
|
|
3852
3896
|
}
|
|
3853
3897
|
if (isPhone) {
|
|
3854
|
-
|
|
3898
|
+
yield para.logout();
|
|
3855
3899
|
let userExists = false;
|
|
3856
3900
|
try {
|
|
3857
|
-
userExists =
|
|
3901
|
+
userExists = yield para.checkIfUserExistsByPhone({ phone: identifier, countryCode });
|
|
3858
3902
|
} catch (error2) {
|
|
3859
3903
|
setError("Please enter a valid phone number!");
|
|
3860
3904
|
return;
|
|
@@ -3862,35 +3906,35 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3862
3906
|
auth = { phone: identifier, countryCode };
|
|
3863
3907
|
setAuthInfo(auth);
|
|
3864
3908
|
if (userExists) {
|
|
3865
|
-
const supportedAuthMethods =
|
|
3866
|
-
const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ?
|
|
3909
|
+
const supportedAuthMethods = yield para.initiateUserLoginV2(auth);
|
|
3910
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
3867
3911
|
setFlow("login");
|
|
3868
3912
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
3869
3913
|
setSupportedAuthMethods(supportedAuthMethods);
|
|
3870
3914
|
setBiometricLocationHints(biometricLocationHints);
|
|
3871
3915
|
return;
|
|
3872
3916
|
}
|
|
3873
|
-
|
|
3917
|
+
yield para.createUserByPhone(auth);
|
|
3874
3918
|
setFlow("signUp");
|
|
3875
3919
|
setStep("VERIFICATIONS" /* VERIFICATIONS */);
|
|
3876
3920
|
return;
|
|
3877
3921
|
}
|
|
3878
|
-
};
|
|
3879
|
-
const handleSubmit =
|
|
3922
|
+
});
|
|
3923
|
+
const handleSubmit = () => __async(void 0, null, function* () {
|
|
3880
3924
|
setIsLoggingIn(true);
|
|
3881
|
-
|
|
3925
|
+
yield login();
|
|
3882
3926
|
setIsLoggingIn(false);
|
|
3883
|
-
};
|
|
3927
|
+
});
|
|
3884
3928
|
if (disableEmailLogin && disablePhoneLogin) {
|
|
3885
3929
|
return null;
|
|
3886
3930
|
}
|
|
3887
3931
|
return /* @__PURE__ */ jsx23(
|
|
3888
3932
|
"form",
|
|
3889
3933
|
{
|
|
3890
|
-
onSubmit:
|
|
3934
|
+
onSubmit: (e) => __async(void 0, null, function* () {
|
|
3891
3935
|
e.preventDefault();
|
|
3892
|
-
|
|
3893
|
-
},
|
|
3936
|
+
yield handleSubmit();
|
|
3937
|
+
}),
|
|
3894
3938
|
children: /* @__PURE__ */ jsxs18(
|
|
3895
3939
|
StyledInput,
|
|
3896
3940
|
{
|
|
@@ -3902,10 +3946,12 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3902
3946
|
errorText: error,
|
|
3903
3947
|
autofocus: true,
|
|
3904
3948
|
inputMode: "email",
|
|
3905
|
-
onKeyDown:
|
|
3949
|
+
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
3950
|
+
return e.key === "Enter" && handleSubmit();
|
|
3951
|
+
}),
|
|
3906
3952
|
contrastText: true,
|
|
3907
3953
|
isPhone,
|
|
3908
|
-
mask: identifierType === "phone" ? phoneMasks[matchedCountryCode.selectedLabel]
|
|
3954
|
+
mask: identifierType === "phone" ? (_b = phoneMasks[matchedCountryCode.selectedLabel]) != null ? _b : defaultPhoneMask : void 0,
|
|
3909
3955
|
enterkeyhint: "go",
|
|
3910
3956
|
noAutoDisable: true,
|
|
3911
3957
|
disabled: isLoggingIn,
|
|
@@ -4009,7 +4055,7 @@ var AuthOptions = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
|
4009
4055
|
const showAllOAuth = useModalStore((state) => state.step === "AUTH_MORE" /* AUTH_MORE */);
|
|
4010
4056
|
const Content = useMemo8(() => {
|
|
4011
4057
|
const Methods = [];
|
|
4012
|
-
if (!!oAuthMethods
|
|
4058
|
+
if (!!(oAuthMethods == null ? void 0 : oAuthMethods.length)) {
|
|
4013
4059
|
Methods.push(/* @__PURE__ */ jsx24(OAuth, { methods: oAuthMethods }, "oAuth"));
|
|
4014
4060
|
}
|
|
4015
4061
|
if (!disableEmailLogin || !disablePhoneLogin) {
|
|
@@ -4062,7 +4108,7 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4062
4108
|
}
|
|
4063
4109
|
case "AUTH:CONDENSED" /* AUTH_CONDENSED */: {
|
|
4064
4110
|
const icons = [];
|
|
4065
|
-
oAuthMethods
|
|
4111
|
+
oAuthMethods == null ? void 0 : oAuthMethods.forEach((method) => icons.push(useBrandedLogos ? brandedOAuthLogos[method] : oAuthLogos[method]));
|
|
4066
4112
|
methods.push([
|
|
4067
4113
|
/* @__PURE__ */ jsxs19(CondensedButton, { onClick: handleCondensedAuthClick, variant: "tertiary", fullWidth: true, children: [
|
|
4068
4114
|
/* @__PURE__ */ jsx25(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
@@ -4081,7 +4127,7 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4081
4127
|
}
|
|
4082
4128
|
case "EXTERNAL:CONDENSED" /* EXTERNAL_CONDENSED */: {
|
|
4083
4129
|
const icons = [];
|
|
4084
|
-
wallets
|
|
4130
|
+
wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
|
|
4085
4131
|
methods.push([
|
|
4086
4132
|
/* @__PURE__ */ jsxs19(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [
|
|
4087
4133
|
/* @__PURE__ */ jsx25(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
@@ -4177,14 +4223,14 @@ var Account = ({ onClose }) => {
|
|
|
4177
4223
|
const handleSellClick = () => {
|
|
4178
4224
|
setStep("ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */);
|
|
4179
4225
|
};
|
|
4180
|
-
const handleDisconnectClick =
|
|
4226
|
+
const handleDisconnectClick = () => __async(void 0, null, function* () {
|
|
4181
4227
|
setIsDisconnecting(true);
|
|
4182
|
-
|
|
4183
|
-
|
|
4228
|
+
yield para.logout();
|
|
4229
|
+
yield disconnectExternalWallet();
|
|
4184
4230
|
onClose();
|
|
4185
4231
|
setStep("AUTH_MAIN" /* AUTH_MAIN */);
|
|
4186
4232
|
setIsDisconnecting(false);
|
|
4187
|
-
};
|
|
4233
|
+
});
|
|
4188
4234
|
return /* @__PURE__ */ jsx27(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs21(InnerStepContainer, { children: [
|
|
4189
4235
|
/* @__PURE__ */ jsx27(ButtonContainer2, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs21(Fragment14, { children: [
|
|
4190
4236
|
onRampConfig.isBuyEnabled && /* @__PURE__ */ jsx27(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx27(CpslText17, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Buy Crypto" }) }),
|
|
@@ -4229,13 +4275,14 @@ var ExternalWalletStep = () => {
|
|
|
4229
4275
|
useEffect15(() => {
|
|
4230
4276
|
routeMobileExternalWallet(qrUri);
|
|
4231
4277
|
}, [qrUri]);
|
|
4232
|
-
const handleTryAgainClick =
|
|
4233
|
-
|
|
4234
|
-
};
|
|
4278
|
+
const handleTryAgainClick = () => __async(void 0, null, function* () {
|
|
4279
|
+
yield connectExternalWallet(wallet);
|
|
4280
|
+
});
|
|
4235
4281
|
const handleCopy = () => {
|
|
4236
4282
|
copy(qrUri);
|
|
4237
4283
|
};
|
|
4238
4284
|
const Content = useMemo10(() => {
|
|
4285
|
+
var _a, _b, _c;
|
|
4239
4286
|
if (!wallet) {
|
|
4240
4287
|
return null;
|
|
4241
4288
|
}
|
|
@@ -4254,15 +4301,15 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4254
4301
|
if (showExtension) {
|
|
4255
4302
|
const isInstalled = wallet.installed;
|
|
4256
4303
|
return /* @__PURE__ */ jsxs22(InnerStepContainer, { children: [
|
|
4257
|
-
isInstalled && !externalWalletError
|
|
4304
|
+
isInstalled && !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx28(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm connection request in the ${wallet.name} browser extension.` }) : /* @__PURE__ */ jsxs22(ErrorContainer, { children: [
|
|
4258
4305
|
/* @__PURE__ */ jsx28(ErrorIcon, { icon: "alertCircle" }),
|
|
4259
|
-
/* @__PURE__ */ jsx28(CpslText18, { weight: "semiBold", color: "error", children: isInstalled ? externalWalletError
|
|
4306
|
+
/* @__PURE__ */ jsx28(CpslText18, { weight: "semiBold", color: "error", children: isInstalled ? externalWalletError == null ? void 0 : externalWalletError[0] : `${wallet.name} not detected` })
|
|
4260
4307
|
] }),
|
|
4261
4308
|
/* @__PURE__ */ jsxs22(
|
|
4262
4309
|
CpslButton16,
|
|
4263
4310
|
{
|
|
4264
4311
|
as: isInstalled ? "button" : "a",
|
|
4265
|
-
href: wallet.downloadUrl
|
|
4312
|
+
href: (_a = wallet.downloadUrl) != null ? _a : "",
|
|
4266
4313
|
target: "_blank",
|
|
4267
4314
|
variant: "secondary",
|
|
4268
4315
|
onClick: handleTryAgainClick,
|
|
@@ -4281,16 +4328,16 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4281
4328
|
/* @__PURE__ */ jsx28(InnerStepContainer, { children: !isInstalled && /* @__PURE__ */ jsx28(CpslText18, { weight: "semiBold", color: "error", children: `${wallet.name} not detected` }) }),
|
|
4282
4329
|
wallet.id !== "walletConnect" && /* @__PURE__ */ jsxs22(InnerStepContainer, { children: [
|
|
4283
4330
|
/* @__PURE__ */ jsx28(CpslButton16, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }),
|
|
4284
|
-
/* @__PURE__ */ jsx28(Link, { href: wallet.downloadUrl
|
|
4331
|
+
/* @__PURE__ */ jsx28(Link, { href: (_b = wallet.downloadUrl) != null ? _b : "", target: "_blank", children: /* @__PURE__ */ jsxs22(ExternalButton, { variant: "secondary", children: [
|
|
4285
4332
|
`Get ${wallet.name}`,
|
|
4286
4333
|
/* @__PURE__ */ jsx28(ExternalIcon, { icon: "linkExternal" })
|
|
4287
4334
|
] }) })
|
|
4288
4335
|
] })
|
|
4289
4336
|
] });
|
|
4290
4337
|
}
|
|
4291
|
-
const openWCModal =
|
|
4292
|
-
|
|
4293
|
-
};
|
|
4338
|
+
const openWCModal = () => __async(void 0, null, function* () {
|
|
4339
|
+
yield connectExternalWallet(wallet, true, true);
|
|
4340
|
+
});
|
|
4294
4341
|
const GetWalletButton = /* @__PURE__ */ jsxs22(ExternalButton, { variant: "secondary", onClick: isWalletConnect ? openWCModal : void 0, children: [
|
|
4295
4342
|
`${isWalletConnect ? "Open" : "Get"} ${wallet.name}`,
|
|
4296
4343
|
/* @__PURE__ */ jsx28(ExternalIcon, { icon: "linkExternal" })
|
|
@@ -4304,7 +4351,7 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4304
4351
|
isCopied ? "Copied" : "Copy Link"
|
|
4305
4352
|
] })
|
|
4306
4353
|
] }),
|
|
4307
|
-
/* @__PURE__ */ jsx28(InnerStepContainer, { children: isWalletConnect ? /* @__PURE__ */ jsx28(Fragment15, { children: GetWalletButton }) : /* @__PURE__ */ jsx28(Link, { href: wallet.downloadUrl
|
|
4354
|
+
/* @__PURE__ */ jsx28(InnerStepContainer, { children: isWalletConnect ? /* @__PURE__ */ jsx28(Fragment15, { children: GetWalletButton }) : /* @__PURE__ */ jsx28(Link, { href: (_c = wallet.downloadUrl) != null ? _c : "", target: "_blank", children: GetWalletButton }) })
|
|
4308
4355
|
] });
|
|
4309
4356
|
}
|
|
4310
4357
|
}, [wallet, walletDisplayHelpers, externalWalletError, qrUri]);
|
|
@@ -4362,32 +4409,35 @@ import { isMobile as isMobile6 } from "@getpara/web-sdk";
|
|
|
4362
4409
|
import { Fragment as Fragment16, jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4363
4410
|
var getStepConfig = ({
|
|
4364
4411
|
externalWalletError
|
|
4365
|
-
}) =>
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4412
|
+
}) => {
|
|
4413
|
+
var _a;
|
|
4414
|
+
return {
|
|
4415
|
+
["EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */]: {
|
|
4416
|
+
variant: "externalWalletConnection",
|
|
4417
|
+
topOffset: 40,
|
|
4418
|
+
spacerHeight: 158,
|
|
4419
|
+
hideFadeOut: true
|
|
4420
|
+
},
|
|
4421
|
+
["CHAIN_SWITCH" /* CHAIN_SWITCH */]: {
|
|
4422
|
+
variant: ((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) === NETWORK_NOT_SUPPORTED_ERROR ? "failed" : "externalWalletConnection",
|
|
4423
|
+
topOffset: 20,
|
|
4424
|
+
spacerHeight: 158,
|
|
4425
|
+
hideFadeOut: true
|
|
4426
|
+
},
|
|
4427
|
+
["ACCOUNT_MAIN" /* ACCOUNT_MAIN */]: {
|
|
4428
|
+
variant: "customContent",
|
|
4429
|
+
topOffset: 0,
|
|
4430
|
+
spacerHeight: 104,
|
|
4431
|
+
hideFadeOut: true
|
|
4432
|
+
},
|
|
4433
|
+
["FARCASTER_OAUTH" /* FARCASTER_OAUTH */]: {
|
|
4434
|
+
variant: "externalWalletConnection",
|
|
4435
|
+
topOffset: 40,
|
|
4436
|
+
spacerHeight: 158,
|
|
4437
|
+
hideFadeOut: true
|
|
4438
|
+
}
|
|
4439
|
+
};
|
|
4440
|
+
};
|
|
4391
4441
|
var Hero = () => {
|
|
4392
4442
|
const para = useInternalClient();
|
|
4393
4443
|
const { wallet: connector, walletDisplayHelpers, avatar } = useExternalWallets();
|
|
@@ -4416,10 +4466,10 @@ var Hero = () => {
|
|
|
4416
4466
|
const isFarcasterStep = currentStep === "FARCASTER_OAUTH" /* FARCASTER_OAUTH */;
|
|
4417
4467
|
const { showExtension, isCosmosMobileWallet } = walletDisplayHelpers;
|
|
4418
4468
|
const shouldHide = !stepConfig || !isMobile6() && isExternalStep && !showExtension || !isMobile6() && isChainSwitchStep && isCosmosMobileWallet || !isMobile6() && isFarcasterStep;
|
|
4419
|
-
const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig
|
|
4469
|
+
const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig != null ? stepConfig : {};
|
|
4420
4470
|
return /* @__PURE__ */ jsxs23(Fragment16, { children: [
|
|
4421
4471
|
/* @__PURE__ */ jsx29(Container9, { $top: -45 + topOffset, children: shouldHide ? null : /* @__PURE__ */ jsxs23(StyledHero, { $isAccount: isAccountStep, hideFadeOut, variant, height: 480, withDefaultTheme: true, children: [
|
|
4422
|
-
(isExternalStep || isChainSwitchStep) && /* @__PURE__ */ jsx29(WalletLogo, { slot: "connectionLeft", src: connector
|
|
4472
|
+
(isExternalStep || isChainSwitchStep) && /* @__PURE__ */ jsx29(WalletLogo, { slot: "connectionLeft", src: connector == null ? void 0 : connector.iconUrl }),
|
|
4423
4473
|
isFarcasterStep && /* @__PURE__ */ jsx29(WalletLogo, { slot: "connectionLeft", icon: "farcasterBrand" }),
|
|
4424
4474
|
isAccountStep && (avatar ? /* @__PURE__ */ jsx29(Avatar, { slot: "image", src: avatar }) : activeWallet ? /* @__PURE__ */ jsx29(IconAvatar, { slot: "image", size: "100%", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }) : null)
|
|
4425
4475
|
] }) }),
|
|
@@ -4504,7 +4554,7 @@ var ChainSwitch = () => {
|
|
|
4504
4554
|
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
4505
4555
|
const { switchChain, wallet, qrUri, chainIdSwitchingTo, walletDisplayHelpers } = useExternalWallets();
|
|
4506
4556
|
useEffect18(() => {
|
|
4507
|
-
if (wallet
|
|
4557
|
+
if ((wallet == null ? void 0 : wallet.type) === WalletType5.COSMOS) {
|
|
4508
4558
|
routeMobileExternalWallet(qrUri);
|
|
4509
4559
|
}
|
|
4510
4560
|
}, [qrUri, wallet]);
|
|
@@ -4514,15 +4564,16 @@ var ChainSwitch = () => {
|
|
|
4514
4564
|
setStep("ACCOUNT_MAIN" /* ACCOUNT_MAIN */);
|
|
4515
4565
|
}
|
|
4516
4566
|
}, [wallet]);
|
|
4517
|
-
const handleTryAgainClick =
|
|
4567
|
+
const handleTryAgainClick = () => __async(void 0, null, function* () {
|
|
4518
4568
|
if (chainIdSwitchingTo) {
|
|
4519
|
-
|
|
4569
|
+
yield switchChain(chainIdSwitchingTo);
|
|
4520
4570
|
}
|
|
4521
|
-
};
|
|
4571
|
+
});
|
|
4522
4572
|
const handleCopy = () => {
|
|
4523
4573
|
copy(qrUri);
|
|
4524
4574
|
};
|
|
4525
4575
|
const Content = useMemo11(() => {
|
|
4576
|
+
var _a;
|
|
4526
4577
|
if (!wallet) {
|
|
4527
4578
|
return null;
|
|
4528
4579
|
}
|
|
@@ -4538,14 +4589,14 @@ var ChainSwitch = () => {
|
|
|
4538
4589
|
] }) });
|
|
4539
4590
|
}
|
|
4540
4591
|
return /* @__PURE__ */ jsxs24(InnerStepContainer, { children: [
|
|
4541
|
-
!externalWalletError
|
|
4592
|
+
!(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx31(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm the request to change networks in your ${wallet.name} wallet.` }) : /* @__PURE__ */ jsxs24(Fragment17, { children: [
|
|
4542
4593
|
/* @__PURE__ */ jsxs24(ErrorContainer2, { children: [
|
|
4543
4594
|
/* @__PURE__ */ jsx31(ErrorIcon2, { icon: "alertCircle" }),
|
|
4544
4595
|
/* @__PURE__ */ jsx31(CenteredText, { weight: "semiBold", color: "error", children: externalWalletError[0] })
|
|
4545
4596
|
] }),
|
|
4546
4597
|
externalWalletError[1] && /* @__PURE__ */ jsx31(CenteredText, { color: "secondary", weight: "medium", children: externalWalletError[1] })
|
|
4547
4598
|
] }),
|
|
4548
|
-
externalWalletError
|
|
4599
|
+
((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) !== NETWORK_NOT_SUPPORTED_ERROR && /* @__PURE__ */ jsxs24(CpslButton17, { variant: "secondary", onClick: handleTryAgainClick, children: [
|
|
4549
4600
|
/* @__PURE__ */ jsx31(CpslIcon14, { slot: "start", icon: "refresh" }),
|
|
4550
4601
|
"Try Again"
|
|
4551
4602
|
] })
|
|
@@ -4594,6 +4645,7 @@ var WALLET_TYPES = {
|
|
|
4594
4645
|
[WalletType6.COSMOS]: "Cosmos"
|
|
4595
4646
|
};
|
|
4596
4647
|
var ChainSelect = () => {
|
|
4648
|
+
var _a, _b;
|
|
4597
4649
|
const containerRef = useRef7(null);
|
|
4598
4650
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
4599
4651
|
const activeWallet = useActiveWallet();
|
|
@@ -4603,18 +4655,18 @@ var ChainSelect = () => {
|
|
|
4603
4655
|
resize();
|
|
4604
4656
|
}
|
|
4605
4657
|
}, [chainId, chainIdSwitchingTo, dropdownMaxHeight]);
|
|
4606
|
-
const handleChainChange =
|
|
4607
|
-
|
|
4608
|
-
};
|
|
4658
|
+
const handleChainChange = (chainId2) => __async(void 0, null, function* () {
|
|
4659
|
+
yield switchChain(chainId2);
|
|
4660
|
+
});
|
|
4609
4661
|
if (!activeWallet || !activeWallet.isExternal || activeWallet.type === WalletType6.SOLANA) {
|
|
4610
4662
|
return null;
|
|
4611
4663
|
}
|
|
4612
|
-
const chainIdToUse = chainIdSwitchingTo
|
|
4613
|
-
const selectedChainName = chains.find((c) => c.id.toString() === chainIdToUse)
|
|
4664
|
+
const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
|
|
4665
|
+
const selectedChainName = (_a = chains.find((c) => c.id.toString() === chainIdToUse)) == null ? void 0 : _a.name;
|
|
4614
4666
|
return /* @__PURE__ */ jsx32(Container12, { children: /* @__PURE__ */ jsx32(SelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs25(
|
|
4615
4667
|
StyledSelect,
|
|
4616
4668
|
{
|
|
4617
|
-
selectedValue: chainIdToUse
|
|
4669
|
+
selectedValue: (_b = chainIdToUse == null ? void 0 : chainIdToUse.toString()) != null ? _b : "",
|
|
4618
4670
|
onCpslSelectValueChange: (e) => {
|
|
4619
4671
|
handleChainChange(e.detail);
|
|
4620
4672
|
},
|
|
@@ -4628,7 +4680,7 @@ var ChainSelect = () => {
|
|
|
4628
4680
|
selectedItemVariant: "bodyXS",
|
|
4629
4681
|
children: [
|
|
4630
4682
|
chainIdToUse && /* @__PURE__ */ jsx32(ChainName, { variant: "bodyXS", color: "contrast", slot: "selected-item", children: selectedChainName }),
|
|
4631
|
-
chains
|
|
4683
|
+
chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx32(StyledSelectItem2, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx32(ChainName, { variant: "bodyXS", color: "contrast", children: chain.name }) }, chain.id))
|
|
4632
4684
|
]
|
|
4633
4685
|
}
|
|
4634
4686
|
) }) });
|
|
@@ -4641,7 +4693,7 @@ function getName(para, {
|
|
|
4641
4693
|
hideWallets = false
|
|
4642
4694
|
}) {
|
|
4643
4695
|
if (para.isMultiWallet) {
|
|
4644
|
-
return name
|
|
4696
|
+
return name != null ? name : `${isExternal ? "External " : ""}${WALLET_TYPES[type]}${!hideWallets && (isMenu || isExternal) ? " Wallet" : ""}`;
|
|
4645
4697
|
}
|
|
4646
4698
|
return hideWallets ? "My Account" : name || "My Wallet";
|
|
4647
4699
|
}
|
|
@@ -4654,18 +4706,18 @@ var AccountSelect = () => {
|
|
|
4654
4706
|
const activeWallet = useActiveWallet();
|
|
4655
4707
|
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs25(FlexRow, { slot: "selected-item", children: [
|
|
4656
4708
|
/* @__PURE__ */ jsx32(CpslIdenticon4, { variant: "avatar", size: "14px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
|
|
4657
|
-
/* @__PURE__ */ jsx32(WalletName, { variant: "bodyXS", color: "contrast", children: getName(para, {
|
|
4709
|
+
/* @__PURE__ */ jsx32(WalletName, { variant: "bodyXS", color: "contrast", children: getName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
|
|
4658
4710
|
!hideWallets && /* @__PURE__ */ jsx32(CpslText20, { variant: "bodyXS", color: "secondary", children: para.getDisplayAddress(activeWallet.id, { truncate: true, addressType: activeWallet.type }) })
|
|
4659
4711
|
] }) : null;
|
|
4660
4712
|
useEffect19(() => {
|
|
4661
|
-
if (dropdownMaxHeight && activeWallet
|
|
4713
|
+
if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
|
|
4662
4714
|
resize();
|
|
4663
4715
|
}
|
|
4664
4716
|
}, [activeWallet, para.availableWallets, dropdownMaxHeight]);
|
|
4665
4717
|
return /* @__PURE__ */ jsx32(Container12, { children: /* @__PURE__ */ jsx32(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: para.availableWallets.length > 1 ? /* @__PURE__ */ jsxs25(
|
|
4666
4718
|
StyledSelect,
|
|
4667
4719
|
{
|
|
4668
|
-
selectedValue: getValue(activeWallet
|
|
4720
|
+
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
4669
4721
|
onCpslSelectValueChange: (e) => {
|
|
4670
4722
|
const [id, type] = e.detail.split("~");
|
|
4671
4723
|
setSelectedWallet({ id, type });
|
|
@@ -4682,7 +4734,7 @@ var AccountSelect = () => {
|
|
|
4682
4734
|
activeWallet && ActiveWalletNode,
|
|
4683
4735
|
para.availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
|
|
4684
4736
|
const key = getValue(id, type);
|
|
4685
|
-
const name = _name
|
|
4737
|
+
const name = _name != null ? _name : getName(para, { type, isExternal, isMenu: true, hideWallets });
|
|
4686
4738
|
return /* @__PURE__ */ jsx32(StyledSelectItem2, { slot: "items", value: key, children: /* @__PURE__ */ jsxs25(FlexRow, { children: [
|
|
4687
4739
|
/* @__PURE__ */ jsx32(CpslIdenticon4, { size: "40px", hash: para.getIdenticonHash(id, type) }),
|
|
4688
4740
|
/* @__PURE__ */ jsxs25(FlexCol, { children: [
|
|
@@ -4874,7 +4926,7 @@ function TelegramOAuthStep() {
|
|
|
4874
4926
|
}
|
|
4875
4927
|
}, [url]);
|
|
4876
4928
|
useEffect20(() => {
|
|
4877
|
-
const updateState =
|
|
4929
|
+
const updateState = (event) => __async(this, null, function* () {
|
|
4878
4930
|
switch (event.data.type) {
|
|
4879
4931
|
case "TELEGRAM_LOGIN":
|
|
4880
4932
|
setIsWaiting(true);
|
|
@@ -4887,7 +4939,7 @@ function TelegramOAuthStep() {
|
|
|
4887
4939
|
case "TELEGRAM_SUCCESS":
|
|
4888
4940
|
if (!!event.data.payload) {
|
|
4889
4941
|
const authObject = event.data.payload;
|
|
4890
|
-
const result =
|
|
4942
|
+
const result = yield para.verifyTelegram(authObject);
|
|
4891
4943
|
if (!result.isValid) {
|
|
4892
4944
|
setIsWaiting(false);
|
|
4893
4945
|
setIsError(true);
|
|
@@ -4901,18 +4953,18 @@ function TelegramOAuthStep() {
|
|
|
4901
4953
|
displayName: authObject.username ? `@${authObject.username}` : authObject.first_name ? `${authObject.first_name}${authObject.last_name ? ` ${authObject.last_name}` : ""}` : `Telegram User @${telegramUserId}`
|
|
4902
4954
|
});
|
|
4903
4955
|
if (isNewUser) {
|
|
4904
|
-
const supportedCreateAuthMethods =
|
|
4956
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
4905
4957
|
setIsIFrameReady(false);
|
|
4906
4958
|
setFlow("signUp");
|
|
4907
4959
|
const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod6.PASSKEY);
|
|
4908
4960
|
if (supportsPasskey) {
|
|
4909
4961
|
setWebAuthURLForCreate(
|
|
4910
|
-
|
|
4962
|
+
yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "telegram" }))
|
|
4911
4963
|
);
|
|
4912
4964
|
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
4913
4965
|
}
|
|
4914
4966
|
if (supportedCreateAuthMethods.has(AuthMethod6.PASSWORD)) {
|
|
4915
|
-
setIFrameUrl(
|
|
4967
|
+
setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "telegram", theme })));
|
|
4916
4968
|
setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
4917
4969
|
}
|
|
4918
4970
|
} else {
|
|
@@ -4924,10 +4976,10 @@ function TelegramOAuthStep() {
|
|
|
4924
4976
|
}
|
|
4925
4977
|
break;
|
|
4926
4978
|
}
|
|
4927
|
-
};
|
|
4928
|
-
window
|
|
4979
|
+
});
|
|
4980
|
+
window == null ? void 0 : window.addEventListener("message", updateState, false);
|
|
4929
4981
|
return () => {
|
|
4930
|
-
window
|
|
4982
|
+
window == null ? void 0 : window.removeEventListener("message", updateState, false);
|
|
4931
4983
|
};
|
|
4932
4984
|
}, []);
|
|
4933
4985
|
return /* @__PURE__ */ jsxs27(Container14, { children: [
|
|
@@ -5046,7 +5098,7 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5046
5098
|
const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
|
|
5047
5099
|
const appName = useThemeStore((state) => state.appName);
|
|
5048
5100
|
const embeddedModal = useThemeStore((state) => state.embeddedModal);
|
|
5049
|
-
const [isTestModeAlert, setIsTestModeAlert] = useState16(onRampConfig
|
|
5101
|
+
const [isTestModeAlert, setIsTestModeAlert] = useState16(onRampConfig == null ? void 0 : onRampConfig.testMode);
|
|
5050
5102
|
const Content = () => {
|
|
5051
5103
|
switch (currentStep) {
|
|
5052
5104
|
case "AUTH_MAIN" /* AUTH_MAIN */: {
|
|
@@ -5148,10 +5200,10 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5148
5200
|
}
|
|
5149
5201
|
};
|
|
5150
5202
|
useEffect21(() => {
|
|
5151
|
-
if (!isTestModeAlert && onRampConfig
|
|
5203
|
+
if (!isTestModeAlert && (onRampConfig == null ? void 0 : onRampConfig.testMode)) {
|
|
5152
5204
|
setIsTestModeAlert(true);
|
|
5153
5205
|
}
|
|
5154
|
-
}, [onRampConfig
|
|
5206
|
+
}, [onRampConfig == null ? void 0 : onRampConfig.testMode]);
|
|
5155
5207
|
useEffect21(() => {
|
|
5156
5208
|
switch (currentStep) {
|
|
5157
5209
|
case "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */:
|
|
@@ -5201,7 +5253,7 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5201
5253
|
$isIFrameStep: IFrameSteps.includes(currentStep),
|
|
5202
5254
|
children: [
|
|
5203
5255
|
Content(),
|
|
5204
|
-
onRampConfig
|
|
5256
|
+
(onRampConfig == null ? void 0 : onRampConfig.testMode) && [
|
|
5205
5257
|
"ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */,
|
|
5206
5258
|
"ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */,
|
|
5207
5259
|
"ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */,
|
|
@@ -5248,12 +5300,24 @@ var InnerContainer2 = styled27.div`
|
|
|
5248
5300
|
flex-direction: column;
|
|
5249
5301
|
justify-content: flex-start;
|
|
5250
5302
|
gap: 24px;
|
|
5251
|
-
padding: ${({ $embeddedModal, $step, $isIFrameStep }) =>
|
|
5252
|
-
|
|
5253
|
-
|
|
5303
|
+
padding: ${({ $embeddedModal, $step, $isIFrameStep }) => {
|
|
5304
|
+
var _a, _b;
|
|
5305
|
+
return $isIFrameStep ? "0px" : $embeddedModal ? "12px 0px 0px" : `${(_a = PADDING_TOP[$step]) != null ? _a : "72px"} 72px ${(_b = PADDING_BOTTOM[$step]) != null ? _b : "32px"}`;
|
|
5306
|
+
}};
|
|
5307
|
+
min-height: ${({ $step }) => {
|
|
5308
|
+
var _a;
|
|
5309
|
+
return (_a = MIN_HEIGHT[$step]) != null ? _a : "auto";
|
|
5310
|
+
}};
|
|
5311
|
+
height: ${({ $step }) => {
|
|
5312
|
+
var _a;
|
|
5313
|
+
return (_a = MIN_HEIGHT[$step]) != null ? _a : "auto";
|
|
5314
|
+
}};
|
|
5254
5315
|
|
|
5255
5316
|
@media (max-width: ${MOBILE_SIZE}px) {
|
|
5256
|
-
padding: ${({ $embeddedModal, $step, $isIFrameStep }) =>
|
|
5317
|
+
padding: ${({ $embeddedModal, $step, $isIFrameStep }) => {
|
|
5318
|
+
var _a;
|
|
5319
|
+
return $isIFrameStep ? "0px" : $embeddedModal ? "12px 0px 0px" : `${(_a = PADDING_TOP[$step]) != null ? _a : "72px"} 16px 0px`;
|
|
5320
|
+
}};
|
|
5257
5321
|
}
|
|
5258
5322
|
|
|
5259
5323
|
cpsl-auth-modal.force-mobile-media & {
|
|
@@ -5389,10 +5453,7 @@ var DEFAULT_EX_WALLET_PROVIDER_STATE = {
|
|
|
5389
5453
|
connectParaEvmWallet: void 0,
|
|
5390
5454
|
connectParaCosmosWallet: void 0
|
|
5391
5455
|
};
|
|
5392
|
-
var useExternalWalletProviderStore = create4((set) => ({
|
|
5393
|
-
...DEFAULT_EX_WALLET_PROVIDER_STATE,
|
|
5394
|
-
...getActions4(set)
|
|
5395
|
-
}));
|
|
5456
|
+
var useExternalWalletProviderStore = create4((set) => __spreadValues(__spreadValues({}, DEFAULT_EX_WALLET_PROVIDER_STATE), getActions4(set)));
|
|
5396
5457
|
|
|
5397
5458
|
// src/modal/hooks/useEmbeddedExternalConnection.ts
|
|
5398
5459
|
var useEmbeddedExternalConnection = () => {
|
|
@@ -5402,10 +5463,10 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5402
5463
|
const connectParaCosmosWallet = useExternalWalletProviderStore((state) => state.connectParaCosmosWallet);
|
|
5403
5464
|
const CosmosProvider = useExternalWalletProviderStore((state) => state.CosmosProvider);
|
|
5404
5465
|
const cosmosContext = useExternalWalletProviderStore((state) => state.cosmosContext);
|
|
5405
|
-
const connectEmbeddedToExternalConnectors =
|
|
5466
|
+
const connectEmbeddedToExternalConnectors = () => __async(void 0, null, function* () {
|
|
5406
5467
|
if (evmContext && EvmProvider && connectParaEvmWallet) {
|
|
5407
5468
|
try {
|
|
5408
|
-
const { error } =
|
|
5469
|
+
const { error } = yield connectParaEvmWallet();
|
|
5409
5470
|
if (error) {
|
|
5410
5471
|
console.warn("Failed to connect Para EVM wallet to Wagmi:", error);
|
|
5411
5472
|
}
|
|
@@ -5415,7 +5476,7 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5415
5476
|
}
|
|
5416
5477
|
if (cosmosContext && CosmosProvider && connectParaCosmosWallet) {
|
|
5417
5478
|
try {
|
|
5418
|
-
const { error } =
|
|
5479
|
+
const { error } = yield connectParaCosmosWallet();
|
|
5419
5480
|
if (error) {
|
|
5420
5481
|
console.warn("Failed to connect Para Cosmos wallet to Graz:", error);
|
|
5421
5482
|
}
|
|
@@ -5423,7 +5484,7 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5423
5484
|
console.warn("Error calling connectParaCosmosWallet:", err);
|
|
5424
5485
|
}
|
|
5425
5486
|
}
|
|
5426
|
-
};
|
|
5487
|
+
});
|
|
5427
5488
|
return connectEmbeddedToExternalConnectors;
|
|
5428
5489
|
};
|
|
5429
5490
|
|
|
@@ -5463,6 +5524,7 @@ var ModalContent = forwardRef(
|
|
|
5463
5524
|
loginTransitionOverride,
|
|
5464
5525
|
createWalletOverride
|
|
5465
5526
|
}, ref) => {
|
|
5527
|
+
var _a;
|
|
5466
5528
|
const para = useInternalClient();
|
|
5467
5529
|
const refs = useModalStore((state) => state.refs);
|
|
5468
5530
|
const currentStep = useModalStore((state) => state.step);
|
|
@@ -5483,10 +5545,13 @@ var ModalContent = forwardRef(
|
|
|
5483
5545
|
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
5484
5546
|
const goBack = useGoBack();
|
|
5485
5547
|
const createAccount = useCreateAccount();
|
|
5486
|
-
const biometricLocationHints = useModalStore((state) =>
|
|
5548
|
+
const biometricLocationHints = useModalStore((state) => {
|
|
5549
|
+
var _a2;
|
|
5550
|
+
return (_a2 = state.biometricLocationHints) != null ? _a2 : [];
|
|
5551
|
+
});
|
|
5487
5552
|
const formattedHints = useMemo13(() => formatBiometricHints2(biometricLocationHints), [biometricLocationHints]);
|
|
5488
|
-
const passkeysSupported =
|
|
5489
|
-
const [hasHints, isOnKnownDevice] = [biometricLocationHints
|
|
5553
|
+
const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
|
|
5554
|
+
const [hasHints, isOnKnownDevice] = [(biometricLocationHints == null ? void 0 : biometricLocationHints.length) > 0, (_a = formattedHints == null ? void 0 : formattedHints.isOnKnownDevice) != null ? _a : false];
|
|
5490
5555
|
const [walletCreationInProgress, setWalletCreationInProgress] = useState17(false);
|
|
5491
5556
|
const connectEmbeddedToExternalConnectors = useEmbeddedExternalConnection();
|
|
5492
5557
|
useEffect22(() => {
|
|
@@ -5503,81 +5568,85 @@ var ModalContent = forwardRef(
|
|
|
5503
5568
|
}
|
|
5504
5569
|
};
|
|
5505
5570
|
}, []);
|
|
5506
|
-
const is2FASetup =
|
|
5571
|
+
const is2FASetup = () => __async(void 0, null, function* () {
|
|
5507
5572
|
if (!twoFactorAuthEnabled) {
|
|
5508
5573
|
return true;
|
|
5509
5574
|
}
|
|
5510
5575
|
try {
|
|
5511
|
-
const { isSetup } =
|
|
5576
|
+
const { isSetup } = yield para.check2FAStatus();
|
|
5512
5577
|
return isSetup;
|
|
5513
5578
|
} catch (error) {
|
|
5514
5579
|
console.error("An error occurred while checking 2FA:", error);
|
|
5515
5580
|
return false;
|
|
5516
5581
|
}
|
|
5517
|
-
};
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
if (await is2FASetup()) {
|
|
5539
|
-
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
5582
|
+
});
|
|
5583
|
+
function awaitLoginTransition() {
|
|
5584
|
+
return __async(this, null, function* () {
|
|
5585
|
+
var _a2;
|
|
5586
|
+
const { isComplete, isError, needsWallet } = yield para.waitForLoginAndSetup({
|
|
5587
|
+
popupWindow: refs.popupWindow.current
|
|
5588
|
+
});
|
|
5589
|
+
window.clearTimeout((_a2 = refs.poll.current) == null ? void 0 : _a2.timeout);
|
|
5590
|
+
refs.poll.current = void 0;
|
|
5591
|
+
refs.popupWindow.current = void 0;
|
|
5592
|
+
if (isError) {
|
|
5593
|
+
["AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */, "AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */].includes(refs.currentStep.current) && goBack();
|
|
5594
|
+
return;
|
|
5595
|
+
}
|
|
5596
|
+
if (isComplete) {
|
|
5597
|
+
setWebAuthURLForLogin("");
|
|
5598
|
+
setPasswordUrlForLogin("");
|
|
5599
|
+
setSupportedAuthMethods(/* @__PURE__ */ new Set());
|
|
5600
|
+
setBiometricLocationHints();
|
|
5601
|
+
if (needsWallet) {
|
|
5602
|
+
setStep("AWAITING_WALLET_CREATION" /* AWAITING_WALLET_CREATION */);
|
|
5540
5603
|
} else {
|
|
5541
|
-
|
|
5604
|
+
yield connectEmbeddedToExternalConnectors();
|
|
5605
|
+
if (yield is2FASetup()) {
|
|
5606
|
+
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
5607
|
+
} else {
|
|
5608
|
+
setStep("SETUP_2FA" /* SETUP_2FA */);
|
|
5609
|
+
}
|
|
5542
5610
|
}
|
|
5543
5611
|
}
|
|
5544
|
-
}
|
|
5612
|
+
});
|
|
5545
5613
|
}
|
|
5546
5614
|
useEffect22(() => {
|
|
5547
5615
|
if (currentStep !== "AWAITING_WALLET_CREATION" /* AWAITING_WALLET_CREATION */ || walletCreationInProgress) {
|
|
5548
5616
|
return;
|
|
5549
5617
|
}
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5618
|
+
function genWallet() {
|
|
5619
|
+
return __async(this, null, function* () {
|
|
5620
|
+
setWalletCreationInProgress(true);
|
|
5621
|
+
let recoverySecret, walletIds;
|
|
5622
|
+
if (!createWalletOverride) {
|
|
5623
|
+
const created = yield para.waitForPasskeyAndCreateWallet();
|
|
5624
|
+
recoverySecret = created.recoverySecret;
|
|
5625
|
+
walletIds = created.walletIds;
|
|
5626
|
+
} else {
|
|
5627
|
+
const created = yield createWalletOverride(para);
|
|
5628
|
+
const fetchedWallets = (yield para.fetchWallets()).filter((wallet) => !!wallet.address);
|
|
5629
|
+
const newWallets = {};
|
|
5630
|
+
for (const wallet of fetchedWallets) {
|
|
5631
|
+
newWallets[wallet.id] = __spreadProps(__spreadValues({}, entityToWallet(wallet)), {
|
|
5632
|
+
signer: ""
|
|
5633
|
+
});
|
|
5634
|
+
}
|
|
5635
|
+
para.setWallets(newWallets);
|
|
5636
|
+
recoverySecret = created.recoverySecret;
|
|
5637
|
+
walletIds = created.walletIds;
|
|
5566
5638
|
}
|
|
5567
|
-
para.
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
} else {
|
|
5579
|
-
setStep("SECRET" /* SECRET */);
|
|
5580
|
-
}
|
|
5639
|
+
yield para.setCurrentWalletIds(walletIds);
|
|
5640
|
+
if (recoverySecretStepEnabled) {
|
|
5641
|
+
setRecoveryShare(recoverySecret);
|
|
5642
|
+
}
|
|
5643
|
+
setWalletCreationInProgress(false);
|
|
5644
|
+
if (!recoverySecret || !recoverySecretStepEnabled) {
|
|
5645
|
+
setStep("WALLET_CREATION_DONE" /* WALLET_CREATION_DONE */);
|
|
5646
|
+
} else {
|
|
5647
|
+
setStep("SECRET" /* SECRET */);
|
|
5648
|
+
}
|
|
5649
|
+
});
|
|
5581
5650
|
}
|
|
5582
5651
|
genWallet();
|
|
5583
5652
|
}, [isLogin, currentStep]);
|
|
@@ -5589,17 +5658,19 @@ var ModalContent = forwardRef(
|
|
|
5589
5658
|
const userNeedsToLogin = isAwaitingLogin || isUnknownDeviceWithHints || isPasskeyUnsupported;
|
|
5590
5659
|
if (userNeedsToLogin && hasLoginURLs) {
|
|
5591
5660
|
if (loginTransitionOverride) {
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5661
|
+
function loginOverride() {
|
|
5662
|
+
return __async(this, null, function* () {
|
|
5663
|
+
yield loginTransitionOverride(para);
|
|
5664
|
+
setWebAuthURLForLogin("");
|
|
5665
|
+
setPasswordUrlForLogin("");
|
|
5666
|
+
setBiometricLocationHints();
|
|
5667
|
+
yield connectEmbeddedToExternalConnectors();
|
|
5668
|
+
if (yield is2FASetup()) {
|
|
5669
|
+
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
5670
|
+
} else {
|
|
5671
|
+
setStep("SETUP_2FA" /* SETUP_2FA */);
|
|
5672
|
+
}
|
|
5673
|
+
});
|
|
5603
5674
|
}
|
|
5604
5675
|
loginOverride();
|
|
5605
5676
|
return;
|
|
@@ -5611,8 +5682,9 @@ var ModalContent = forwardRef(
|
|
|
5611
5682
|
};
|
|
5612
5683
|
}
|
|
5613
5684
|
return () => {
|
|
5685
|
+
var _a2;
|
|
5614
5686
|
if (typeof window !== "undefined" && !!refs.poll.current) {
|
|
5615
|
-
window.clearTimeout(refs.poll.current
|
|
5687
|
+
window.clearTimeout((_a2 = refs.poll.current) == null ? void 0 : _a2.timeout);
|
|
5616
5688
|
}
|
|
5617
5689
|
para.exitLogin();
|
|
5618
5690
|
};
|
|
@@ -5622,15 +5694,16 @@ var ModalContent = forwardRef(
|
|
|
5622
5694
|
onClose();
|
|
5623
5695
|
};
|
|
5624
5696
|
useEffect22(() => {
|
|
5697
|
+
var _a2, _b, _c;
|
|
5625
5698
|
refs.currentStep.current = currentStep;
|
|
5626
5699
|
let resetPoll = false;
|
|
5627
5700
|
if (!["AWAITING_BIOMETRIC_CREATION" /* AWAITING_BIOMETRIC_CREATION */, "PASSWORD_CREATION" /* PASSWORD_CREATION */].includes(currentStep)) {
|
|
5628
5701
|
para.exitAccountCreation();
|
|
5629
|
-
resetPoll = ["createPassword", "createPasskey"].includes(refs.poll.current
|
|
5702
|
+
resetPoll = ["createPassword", "createPasskey"].includes((_a2 = refs.poll.current) == null ? void 0 : _a2.action);
|
|
5630
5703
|
}
|
|
5631
5704
|
if (!["AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */, "AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */].includes(currentStep)) {
|
|
5632
5705
|
para.exitLogin();
|
|
5633
|
-
resetPoll = refs.poll.current
|
|
5706
|
+
resetPoll = ((_b = refs.poll.current) == null ? void 0 : _b.action) === "login";
|
|
5634
5707
|
}
|
|
5635
5708
|
if (!["AWAITING_OAUTH" /* AWAITING_OAUTH */, "FARCASTER_OAUTH" /* FARCASTER_OAUTH */].includes(currentStep)) {
|
|
5636
5709
|
para.exitOAuth();
|
|
@@ -5639,13 +5712,14 @@ var ModalContent = forwardRef(
|
|
|
5639
5712
|
createAccount.withPassword();
|
|
5640
5713
|
}
|
|
5641
5714
|
if (resetPoll && typeof window !== "undefined") {
|
|
5642
|
-
window.clearTimeout(refs.poll.current
|
|
5715
|
+
window.clearTimeout((_c = refs.poll.current) == null ? void 0 : _c.timeout);
|
|
5643
5716
|
refs.poll.current = void 0;
|
|
5644
5717
|
}
|
|
5645
5718
|
}, [currentStep]);
|
|
5646
5719
|
useEffect22(() => {
|
|
5647
5720
|
if (!onRampConfig) {
|
|
5648
5721
|
para.ctx.client.getOnRampConfig().then((res) => {
|
|
5722
|
+
var _a2, _b;
|
|
5649
5723
|
let newOnRampConfig;
|
|
5650
5724
|
if (!!propsOnRampConfig) {
|
|
5651
5725
|
const { enabledFlows, network, asset, providers, testMode } = propsOnRampConfig;
|
|
@@ -5654,14 +5728,14 @@ var ModalContent = forwardRef(
|
|
|
5654
5728
|
isBuyEnabled: !enabledFlows || enabledFlows.some((str) => EnabledFlow3[str] === EnabledFlow3.BUY),
|
|
5655
5729
|
isReceiveEnabled: !enabledFlows || enabledFlows.some((str) => EnabledFlow3[str] === EnabledFlow3.RECEIVE),
|
|
5656
5730
|
isWithdrawEnabled: !enabledFlows || enabledFlows.some((str) => EnabledFlow3[str] === EnabledFlow3.WITHDRAW),
|
|
5657
|
-
allowedAssets: network ? { [Network3[network]]: asset ? [AssetMap[asset]] : true } : asset ? { [AssetNetworks[AssetMap[asset]]
|
|
5731
|
+
allowedAssets: network ? { [Network3[network]]: asset ? [AssetMap[asset]] : true } : asset ? { [(_a2 = AssetNetworks[AssetMap[asset]]) != null ? _a2 : Network3.ETHEREUM]: [AssetMap[asset]] } : res.allowedAssets,
|
|
5658
5732
|
assetInfo: res.assetInfo,
|
|
5659
5733
|
providers: providers.map(({ id }) => OnRampProvider4[id]),
|
|
5660
|
-
rampApiKey: rampConfig
|
|
5661
|
-
testMode: testMode
|
|
5734
|
+
rampApiKey: (_b = rampConfig == null ? void 0 : rampConfig.hostApiKey) != null ? _b : res.rampApiKey,
|
|
5735
|
+
testMode: testMode != null ? testMode : onRampTestMode
|
|
5662
5736
|
};
|
|
5663
5737
|
} else {
|
|
5664
|
-
newOnRampConfig = {
|
|
5738
|
+
newOnRampConfig = __spreadProps(__spreadValues({}, res), { testMode: onRampTestMode });
|
|
5665
5739
|
}
|
|
5666
5740
|
setOnRampConfig(newOnRampConfig);
|
|
5667
5741
|
if (!accountAddFundTab) {
|
|
@@ -5674,12 +5748,13 @@ var ModalContent = forwardRef(
|
|
|
5674
5748
|
}, []);
|
|
5675
5749
|
useEffect22(() => {
|
|
5676
5750
|
if (!!onRampConfig) {
|
|
5677
|
-
setOnRampConfig({
|
|
5751
|
+
setOnRampConfig(__spreadProps(__spreadValues({}, onRampConfig), { testMode: onRampTestMode }));
|
|
5678
5752
|
}
|
|
5679
5753
|
}, [onRampTestMode]);
|
|
5680
5754
|
useEffect22(() => {
|
|
5681
5755
|
return () => {
|
|
5682
|
-
|
|
5756
|
+
var _a2;
|
|
5757
|
+
window.clearTimeout((_a2 = refs.poll.current) == null ? void 0 : _a2.timeout);
|
|
5683
5758
|
para.exitLoops();
|
|
5684
5759
|
};
|
|
5685
5760
|
}, []);
|
|
@@ -5701,7 +5776,7 @@ var ModalContent = forwardRef(
|
|
|
5701
5776
|
|
|
5702
5777
|
// src/modal/ParaModal.tsx
|
|
5703
5778
|
import { forwardRef as forwardRef2, useEffect as useEffect24, useImperativeHandle as useImperativeHandle2, useRef as useRef9, useState as useState19 } from "react";
|
|
5704
|
-
import { ParaEvent as ParaEvent2 } from "@getpara/web-sdk";
|
|
5779
|
+
import { isPasskeySupported, ParaEvent as ParaEvent2 } from "@getpara/web-sdk";
|
|
5705
5780
|
|
|
5706
5781
|
// src/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.tsx
|
|
5707
5782
|
import { useEffect as useEffect23, useState as useState18 } from "react";
|
|
@@ -5760,11 +5835,7 @@ var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
|
|
|
5760
5835
|
CosmosWallet2["LEAP"] = "LEAP";
|
|
5761
5836
|
return CosmosWallet2;
|
|
5762
5837
|
})(CosmosWallet || {});
|
|
5763
|
-
var ExternalWallet = {
|
|
5764
|
-
...EvmWallet,
|
|
5765
|
-
...SolanaWallet,
|
|
5766
|
-
...CosmosWallet
|
|
5767
|
-
};
|
|
5838
|
+
var ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
|
|
5768
5839
|
|
|
5769
5840
|
// src/modal/providers/SolanaExternalWalletContextStub.tsx
|
|
5770
5841
|
import { createContext as createContext3, useMemo as useMemo15 } from "react";
|
|
@@ -5828,14 +5899,14 @@ var ExternalWalletsWrapper = ({ children, wallets }) => {
|
|
|
5828
5899
|
const [CosmosProvider, setCosmosProvider] = useState18(null);
|
|
5829
5900
|
const [cosmosContext, setCosmosContext] = useState18(null);
|
|
5830
5901
|
useEffect23(() => {
|
|
5831
|
-
const loadProviders =
|
|
5902
|
+
const loadProviders = () => __async(void 0, null, function* () {
|
|
5832
5903
|
let newEvmContext = EvmExternalWalletContext;
|
|
5833
5904
|
let newEvmProvider = EvmExternalWalletProvider;
|
|
5834
5905
|
let newSolanaContext = SolanaExternalWalletContext;
|
|
5835
5906
|
let newSolanaProvider = SolanaExternalWalletProvider;
|
|
5836
5907
|
let newCosmosContext = CosmosExternalWalletContext;
|
|
5837
5908
|
let newCosmosProvider = CosmosExternalWalletProvider;
|
|
5838
|
-
if (!wallets
|
|
5909
|
+
if (!(wallets == null ? void 0 : wallets.length)) {
|
|
5839
5910
|
newEvmContext = EvmExternalWalletContext;
|
|
5840
5911
|
newEvmProvider = EvmExternalWalletProvider;
|
|
5841
5912
|
newSolanaContext = SolanaExternalWalletContext;
|
|
@@ -5877,7 +5948,7 @@ var ExternalWalletsWrapper = ({ children, wallets }) => {
|
|
|
5877
5948
|
setSolanaProvider(() => newSolanaProvider);
|
|
5878
5949
|
setCosmosContext(newCosmosContext);
|
|
5879
5950
|
setCosmosProvider(() => newCosmosProvider);
|
|
5880
|
-
};
|
|
5951
|
+
});
|
|
5881
5952
|
loadProviders();
|
|
5882
5953
|
}, [
|
|
5883
5954
|
wallets,
|
|
@@ -5913,7 +5984,8 @@ var ExternalWalletsWrapper = ({ children, wallets }) => {
|
|
|
5913
5984
|
import styled29 from "styled-components";
|
|
5914
5985
|
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
5915
5986
|
defineCustomElements();
|
|
5916
|
-
var ParaModal = forwardRef2((
|
|
5987
|
+
var ParaModal = forwardRef2((_a, ref) => {
|
|
5988
|
+
var _b = _a, { para, isOpen } = _b, rest = __objRest(_b, ["para", "isOpen"]);
|
|
5917
5989
|
const [isInitialized, setIsInitialized] = useState19(false);
|
|
5918
5990
|
const setClient = useStore((state) => state.setClient);
|
|
5919
5991
|
const client = useStore((state) => state.client);
|
|
@@ -5935,27 +6007,43 @@ var ParaModal = forwardRef2(({ para, isOpen, ...rest }, ref) => {
|
|
|
5935
6007
|
if (!isInitialized) {
|
|
5936
6008
|
return null;
|
|
5937
6009
|
}
|
|
5938
|
-
return /* @__PURE__ */ jsx44(ParaModalInner, { ref, para,
|
|
6010
|
+
return /* @__PURE__ */ jsx44(ParaModalInner, __spreadValues({ ref, para }, rest));
|
|
5939
6011
|
});
|
|
5940
6012
|
var ParaModalInner = forwardRef2(
|
|
5941
|
-
({
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
6013
|
+
(_a, ref) => {
|
|
6014
|
+
var _b = _a, {
|
|
6015
|
+
theme,
|
|
6016
|
+
appName,
|
|
6017
|
+
logo,
|
|
6018
|
+
disableEmailLogin = false,
|
|
6019
|
+
disablePhoneLogin = false,
|
|
6020
|
+
oAuthMethods,
|
|
6021
|
+
bareModal = false,
|
|
6022
|
+
className,
|
|
6023
|
+
currentStepOverride,
|
|
6024
|
+
externalWallets,
|
|
6025
|
+
authLayout = ["AUTH:FULL" /* AUTH_FULL */, "EXTERNAL:FULL" /* EXTERNAL_FULL */],
|
|
6026
|
+
embeddedModal,
|
|
6027
|
+
onModalStepChange,
|
|
6028
|
+
hideWallets = false,
|
|
6029
|
+
onClose
|
|
6030
|
+
} = _b, rest = __objRest(_b, [
|
|
6031
|
+
"theme",
|
|
6032
|
+
"appName",
|
|
6033
|
+
"logo",
|
|
6034
|
+
"disableEmailLogin",
|
|
6035
|
+
"disablePhoneLogin",
|
|
6036
|
+
"oAuthMethods",
|
|
6037
|
+
"bareModal",
|
|
6038
|
+
"className",
|
|
6039
|
+
"currentStepOverride",
|
|
6040
|
+
"externalWallets",
|
|
6041
|
+
"authLayout",
|
|
6042
|
+
"embeddedModal",
|
|
6043
|
+
"onModalStepChange",
|
|
6044
|
+
"hideWallets",
|
|
6045
|
+
"onClose"
|
|
6046
|
+
]);
|
|
5959
6047
|
const modalContentRef = useRef9(null);
|
|
5960
6048
|
const updateThemeState = useThemeStore((state) => state.updateState);
|
|
5961
6049
|
const refs = useModalStore((state) => state.refs);
|
|
@@ -5979,6 +6067,7 @@ var ParaModalInner = forwardRef2(
|
|
|
5979
6067
|
const { isOpen, closeModal } = useModal();
|
|
5980
6068
|
const para = useInternalClient();
|
|
5981
6069
|
const { selectedWallet, setSelectedWallet } = useWalletState();
|
|
6070
|
+
const setIsPasskeySupported = useModalStore((state) => state.setIsPasskeySupported);
|
|
5982
6071
|
const [isModalMounted, setIsModalMounted] = useState19(false);
|
|
5983
6072
|
const [isInit, setIsInit] = useState19(false);
|
|
5984
6073
|
const [ready, setIsReady] = useState19(false);
|
|
@@ -5994,12 +6083,14 @@ var ParaModalInner = forwardRef2(
|
|
|
5994
6083
|
return currentStep;
|
|
5995
6084
|
},
|
|
5996
6085
|
handleModalClose() {
|
|
5997
|
-
|
|
6086
|
+
var _a2;
|
|
6087
|
+
(_a2 = modalContentRef == null ? void 0 : modalContentRef.current) == null ? void 0 : _a2.handleModalClose();
|
|
5998
6088
|
}
|
|
5999
6089
|
};
|
|
6000
6090
|
}, [hasPreviousStep, currentStep]);
|
|
6001
|
-
const initModal =
|
|
6002
|
-
const isAccount =
|
|
6091
|
+
const initModal = () => __async(void 0, null, function* () {
|
|
6092
|
+
const isAccount = yield para.isFullyLoggedIn();
|
|
6093
|
+
setIsPasskeySupported(yield isPasskeySupported());
|
|
6003
6094
|
if (currentStepOverride) {
|
|
6004
6095
|
setStep(ModalStep[currentStepOverride.toUpperCase()]);
|
|
6005
6096
|
} else if (isAccount) {
|
|
@@ -6014,7 +6105,7 @@ var ParaModalInner = forwardRef2(
|
|
|
6014
6105
|
setWebAuthURLForCreate();
|
|
6015
6106
|
setBiometricLocationHints();
|
|
6016
6107
|
}
|
|
6017
|
-
|
|
6108
|
+
yield disconnectExternalWallet();
|
|
6018
6109
|
setSelectedWallet({ id: void 0, type: void 0 });
|
|
6019
6110
|
setIsFullyLoggedIn(false);
|
|
6020
6111
|
}
|
|
@@ -6039,13 +6130,13 @@ var ParaModalInner = forwardRef2(
|
|
|
6039
6130
|
break;
|
|
6040
6131
|
}
|
|
6041
6132
|
setIsInit(true);
|
|
6042
|
-
};
|
|
6133
|
+
});
|
|
6043
6134
|
useEffect24(() => {
|
|
6044
6135
|
let _authLayout = authLayout;
|
|
6045
|
-
if (!externalWallets
|
|
6136
|
+
if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
|
|
6046
6137
|
_authLayout = _authLayout.filter((l) => !l.includes("EXTERNAL"));
|
|
6047
6138
|
}
|
|
6048
|
-
if (disableEmailLogin && disablePhoneLogin && !oAuthMethods
|
|
6139
|
+
if (disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout)) {
|
|
6049
6140
|
_authLayout = _authLayout.filter((l) => !l.includes("AUTH"));
|
|
6050
6141
|
}
|
|
6051
6142
|
if (JSON.stringify(storedAuthLayout) !== JSON.stringify(_authLayout)) {
|
|
@@ -6056,15 +6147,16 @@ var ParaModalInner = forwardRef2(
|
|
|
6056
6147
|
setOnModalStepChange(onModalStepChange);
|
|
6057
6148
|
}, [onModalStepChange]);
|
|
6058
6149
|
useEffect24(() => {
|
|
6150
|
+
var _a2;
|
|
6059
6151
|
updateThemeState({
|
|
6060
6152
|
logo,
|
|
6061
6153
|
appName,
|
|
6062
|
-
oAuthLogoVariant: theme
|
|
6154
|
+
oAuthLogoVariant: (_a2 = theme == null ? void 0 : theme.oAuthLogoVariant) != null ? _a2 : "default",
|
|
6063
6155
|
bareModal,
|
|
6064
6156
|
embeddedModal,
|
|
6065
6157
|
hideWallets
|
|
6066
6158
|
});
|
|
6067
|
-
}, [logo, appName, theme
|
|
6159
|
+
}, [logo, appName, theme == null ? void 0 : theme.oAuthLogoVariant, bareModal, embeddedModal, hideWallets]);
|
|
6068
6160
|
useEffect24(() => {
|
|
6069
6161
|
if (theme) {
|
|
6070
6162
|
generateTheme(theme);
|
|
@@ -6087,9 +6179,9 @@ var ParaModalInner = forwardRef2(
|
|
|
6087
6179
|
}
|
|
6088
6180
|
}, [isOpen]);
|
|
6089
6181
|
const updateActiveWallet = () => {
|
|
6090
|
-
if (!selectedWallet
|
|
6182
|
+
if (!(selectedWallet == null ? void 0 : selectedWallet.id) || !para.findWallet(selectedWallet == null ? void 0 : selectedWallet.id)) {
|
|
6091
6183
|
const defaultWallet = para.findWallet(void 0, void 0, { forbidPregen: true });
|
|
6092
|
-
setSelectedWallet({ id: defaultWallet
|
|
6184
|
+
setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
|
|
6093
6185
|
}
|
|
6094
6186
|
};
|
|
6095
6187
|
useEffect24(() => {
|
|
@@ -6097,7 +6189,8 @@ var ParaModalInner = forwardRef2(
|
|
|
6097
6189
|
}, [para]);
|
|
6098
6190
|
useEffect24(() => {
|
|
6099
6191
|
const closePopupWindow = () => {
|
|
6100
|
-
|
|
6192
|
+
var _a2;
|
|
6193
|
+
(_a2 = refs.popupWindow.current) == null ? void 0 : _a2.close();
|
|
6101
6194
|
};
|
|
6102
6195
|
if (typeof window !== "undefined") {
|
|
6103
6196
|
window.addEventListener(ParaEvent2.WALLETS_CHANGE_EVENT, updateActiveWallet);
|
|
@@ -6115,12 +6208,12 @@ var ParaModalInner = forwardRef2(
|
|
|
6115
6208
|
}, []);
|
|
6116
6209
|
const handleClose = () => {
|
|
6117
6210
|
closeModal();
|
|
6118
|
-
onClose
|
|
6211
|
+
onClose == null ? void 0 : onClose();
|
|
6119
6212
|
};
|
|
6120
6213
|
const handleModalEntering = () => {
|
|
6121
6214
|
setIsModalMounted(true);
|
|
6122
6215
|
};
|
|
6123
|
-
const handleModalExited =
|
|
6216
|
+
const handleModalExited = () => __async(void 0, null, function* () {
|
|
6124
6217
|
if (!bareModal) {
|
|
6125
6218
|
setIsModalMounted(false);
|
|
6126
6219
|
}
|
|
@@ -6132,13 +6225,13 @@ var ParaModalInner = forwardRef2(
|
|
|
6132
6225
|
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
6133
6226
|
}
|
|
6134
6227
|
if (para) {
|
|
6135
|
-
|
|
6228
|
+
yield initModal();
|
|
6136
6229
|
para.exitLoops();
|
|
6137
6230
|
}
|
|
6138
6231
|
if (!bareModal) {
|
|
6139
6232
|
setIsInit(false);
|
|
6140
6233
|
}
|
|
6141
|
-
};
|
|
6234
|
+
});
|
|
6142
6235
|
if (!ready) {
|
|
6143
6236
|
return null;
|
|
6144
6237
|
}
|
|
@@ -6146,9 +6239,9 @@ var ParaModalInner = forwardRef2(
|
|
|
6146
6239
|
console.error("A Para instance is required.");
|
|
6147
6240
|
return null;
|
|
6148
6241
|
}
|
|
6149
|
-
if (!storedAuthLayout
|
|
6150
|
-
const hasExternalWalletError = !externalWallets
|
|
6151
|
-
const hasEmbeddedWalletError = disableEmailLogin && disablePhoneLogin && !oAuthMethods
|
|
6242
|
+
if (!(storedAuthLayout == null ? void 0 : storedAuthLayout.length)) {
|
|
6243
|
+
const hasExternalWalletError = !(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout);
|
|
6244
|
+
const hasEmbeddedWalletError = disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout);
|
|
6152
6245
|
if (hasExternalWalletError || hasEmbeddedWalletError) {
|
|
6153
6246
|
if (hasExternalWalletError) {
|
|
6154
6247
|
console.error("At least one external wallet must be provided if external wallet auth is enabled.");
|
|
@@ -6178,13 +6271,12 @@ var ParaModalInner = forwardRef2(
|
|
|
6178
6271
|
$embeddedModal: embeddedModal,
|
|
6179
6272
|
children: isModalMounted && (isInit && embeddedModal || !embeddedModal) && /* @__PURE__ */ jsx44(
|
|
6180
6273
|
ModalContent,
|
|
6181
|
-
{
|
|
6274
|
+
__spreadValues({
|
|
6182
6275
|
oAuthMethods,
|
|
6183
6276
|
disableEmailLogin,
|
|
6184
6277
|
disablePhoneLogin,
|
|
6185
|
-
onClose: handleClose
|
|
6186
|
-
|
|
6187
|
-
}
|
|
6278
|
+
onClose: handleClose
|
|
6279
|
+
}, rest)
|
|
6188
6280
|
)
|
|
6189
6281
|
}
|
|
6190
6282
|
) });
|