@matchain/matchid-sdk-react 0.1.33 → 0.1.35
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/index.css +406 -235
- package/dist/index.d.mts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +178 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -104
- package/dist/index.mjs.map +1 -1
- package/example/src/components/Login/index.tsx +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -325,24 +325,30 @@ function PasswordRoundIcon() {
|
|
|
325
325
|
|
|
326
326
|
// src/assets/icon/CloseEyeIcon.tsx
|
|
327
327
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
328
|
-
function CloseEyeIcon(
|
|
329
|
-
|
|
328
|
+
function CloseEyeIcon({
|
|
329
|
+
size = 20,
|
|
330
|
+
color = "#6E6E6E"
|
|
331
|
+
}) {
|
|
332
|
+
return /* @__PURE__ */ jsx17("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx17(
|
|
330
333
|
"path",
|
|
331
334
|
{
|
|
332
335
|
d: "M9.15132 12.5568V11.5464C8.21031 11.4949 7.28023 11.3193 6.38524 11.024L6.04233 11.9579C6.00626 12.0669 5.94867 12.1676 5.87299 12.2539C5.79731 12.3403 5.70508 12.4106 5.60174 12.4607C5.4984 12.5108 5.38607 12.5396 5.27139 12.5455C5.15671 12.5514 5.04201 12.5342 4.93409 12.4949C4.82617 12.4557 4.72722 12.3952 4.6431 12.317C4.55898 12.2389 4.49139 12.1446 4.44435 12.0399C4.3973 11.9351 4.37175 11.822 4.36921 11.7072C4.36667 11.5924 4.38719 11.4783 4.42955 11.3715L4.80788 10.3268C4.04603 9.88461 3.32634 9.37345 2.65789 8.79975C2.54358 8.70488 2.42928 8.61687 2.32184 8.52772C2.1442 8.38554 2.03031 8.17862 2.00523 7.95247C1.98015 7.72633 2.04593 7.49948 2.18811 7.32184C2.33028 7.1442 2.5372 7.03031 2.76335 7.00523C2.98949 6.98015 3.21634 7.04593 3.39398 7.18811C3.50828 7.27955 3.62258 7.37099 3.73689 7.47043C5.46065 9.00826 7.68996 9.85815 10 9.85815C12.31 9.85815 14.5393 9.00826 16.2631 7.47043C16.3774 7.37099 16.4917 7.27955 16.606 7.18811C16.694 7.11771 16.7949 7.06533 16.9031 7.03395C17.0114 7.00257 17.1247 6.99281 17.2367 7.00523C17.3486 7.01765 17.4571 7.052 17.5558 7.10632C17.6545 7.16065 17.7415 7.23388 17.8119 7.32184C17.8823 7.4098 17.9347 7.51077 17.9661 7.61897C17.9974 7.72717 18.0072 7.8405 17.9948 7.95247C17.9824 8.06445 17.948 8.17288 17.8937 8.27158C17.8394 8.37028 17.7661 8.45732 17.6782 8.52772L17.3421 8.79975C16.6737 9.37354 15.954 9.88471 15.1921 10.3268L15.5705 11.3715C15.6128 11.4783 15.6333 11.5924 15.6308 11.7072C15.6283 11.822 15.6027 11.9351 15.5557 12.0399C15.5086 12.1446 15.441 12.2389 15.3569 12.317C15.2728 12.3952 15.1738 12.4557 15.0659 12.4949C14.958 12.5342 14.8433 12.5514 14.7286 12.5455C14.6139 12.5396 14.5016 12.5108 14.3983 12.4607C14.2949 12.4106 14.2027 12.3403 14.127 12.2539C14.0513 12.1676 13.9937 12.0669 13.9577 11.9579L13.6148 11.024C12.7198 11.3193 11.7897 11.4949 10.8487 11.5464V12.5568C10.8487 12.7842 10.7584 13.0022 10.5976 13.163C10.4368 13.3238 10.2188 13.4141 9.99143 13.4141C9.76407 13.4141 9.54602 13.3238 9.38526 13.163C9.22449 13.0022 9.13417 12.7842 9.13417 12.5568H9.15132Z",
|
|
333
|
-
fill:
|
|
336
|
+
fill: color
|
|
334
337
|
}
|
|
335
338
|
) });
|
|
336
339
|
}
|
|
337
340
|
|
|
338
341
|
// src/assets/icon/OpenEyeIcon.tsx
|
|
339
342
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
340
|
-
function OpenEyeIcon(
|
|
341
|
-
|
|
343
|
+
function OpenEyeIcon({
|
|
344
|
+
size = 20,
|
|
345
|
+
color = "#6E6E6E"
|
|
346
|
+
}) {
|
|
347
|
+
return /* @__PURE__ */ jsx18("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx18(
|
|
342
348
|
"path",
|
|
343
349
|
{
|
|
344
350
|
d: "M10 6.4543C11.3373 6.44986 12.6486 6.82287 13.7834 7.53047C14.9181 8.23806 15.8301 9.25151 16.4145 10.4543C15.2145 12.9052 12.7564 14.4543 10 14.4543C7.24364 14.4543 4.78545 12.9052 3.58545 10.4543C4.1699 9.25151 5.08191 8.23806 6.21664 7.53047C7.35136 6.82287 8.66274 6.44986 10 6.4543ZM10 4.99976C6.36364 4.99976 3.25818 7.26157 2 10.4543C3.25818 13.647 6.36364 15.9088 10 15.9088C13.6364 15.9088 16.7418 13.647 18 10.4543C16.7418 7.26157 13.6364 4.99976 10 4.99976ZM10 8.63612C10.4822 8.63617 10.9446 8.82774 11.2855 9.16871C11.6265 9.50968 11.818 9.97212 11.818 10.4543C11.818 10.9365 11.6265 11.3989 11.2855 11.7399C10.9446 12.0809 10.4822 12.2724 10 12.2725C9.51782 12.2724 9.0554 12.0809 8.71447 11.7399C8.37353 11.3989 8.18199 10.9365 8.18199 10.4543C8.18199 9.97212 8.37353 9.50968 8.71447 9.16871C9.0554 8.82774 9.51782 8.63617 10 8.63612ZM10 7.18157C8.19636 7.18157 6.72727 8.65066 6.72727 10.4543C6.72727 12.2579 8.19636 13.727 10 13.727C11.8036 13.727 13.2727 12.2579 13.2727 10.4543C13.2727 8.65066 11.8036 7.18157 10 7.18157Z",
|
|
345
|
-
fill:
|
|
351
|
+
fill: color
|
|
346
352
|
}
|
|
347
353
|
) });
|
|
348
354
|
}
|
|
@@ -650,6 +656,26 @@ function ArrowDownIcon({ width = 20, height = 21, color = "black", ...props }) {
|
|
|
650
656
|
) });
|
|
651
657
|
}
|
|
652
658
|
|
|
659
|
+
// src/hooks/useLayout.tsx
|
|
660
|
+
var useLayout_exports = {};
|
|
661
|
+
__export(useLayout_exports, {
|
|
662
|
+
useDownMd: () => useDownMd
|
|
663
|
+
});
|
|
664
|
+
import { useState, useEffect } from "react";
|
|
665
|
+
function useDownMd() {
|
|
666
|
+
const [isBelowMd, setIsBelowMd] = useState(window.matchMedia("(max-width: 767px)").matches);
|
|
667
|
+
useEffect(() => {
|
|
668
|
+
const handleResize = () => {
|
|
669
|
+
setIsBelowMd(window.matchMedia("(max-width: 767px)").matches);
|
|
670
|
+
};
|
|
671
|
+
window.addEventListener("resize", handleResize);
|
|
672
|
+
return () => {
|
|
673
|
+
window.removeEventListener("resize", handleResize);
|
|
674
|
+
};
|
|
675
|
+
}, []);
|
|
676
|
+
return isBelowMd;
|
|
677
|
+
}
|
|
678
|
+
|
|
653
679
|
// src/components/Modal/index.tsx
|
|
654
680
|
import { Fragment, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
655
681
|
function Modal({
|
|
@@ -666,9 +692,12 @@ function Modal({
|
|
|
666
692
|
style: {
|
|
667
693
|
zIndex
|
|
668
694
|
},
|
|
669
|
-
children: /* @__PURE__ */
|
|
695
|
+
children: /* @__PURE__ */ jsxs23("div", { className: `matchid-modal ${className}`, style: {
|
|
670
696
|
width
|
|
671
|
-
}, children
|
|
697
|
+
}, children: [
|
|
698
|
+
/* @__PURE__ */ jsx36("div", { className: "matchid-modal-mobile-header" }),
|
|
699
|
+
children
|
|
700
|
+
] })
|
|
672
701
|
}
|
|
673
702
|
) : /* @__PURE__ */ jsx36(Fragment, {});
|
|
674
703
|
}
|
|
@@ -681,23 +710,24 @@ function ModalWithHeader({
|
|
|
681
710
|
showClose = true,
|
|
682
711
|
...props
|
|
683
712
|
}) {
|
|
713
|
+
const isDownMd = useDownMd();
|
|
684
714
|
return /* @__PURE__ */ jsxs23(Modal, { ...props, children: [
|
|
685
715
|
/* @__PURE__ */ jsxs23("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
|
|
686
716
|
/* @__PURE__ */ jsxs23("div", { className: "matchid-modal-header-content", children: [
|
|
687
|
-
onBack && /* @__PURE__ */ jsx36(ArrowLeftIcon, { className: "matchid-modal-header-back", onClick: onBack }),
|
|
717
|
+
onBack && /* @__PURE__ */ jsx36(ArrowLeftIcon, { height: isDownMd ? 20 : 25, width: isDownMd ? 20 : 24, className: "matchid-modal-header-back", onClick: onBack }),
|
|
688
718
|
/* @__PURE__ */ jsx36("span", { className: "matchid-modal-header-title", children: title })
|
|
689
719
|
] }),
|
|
690
|
-
onClose && /* @__PURE__ */ jsx36(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
|
|
720
|
+
onClose && /* @__PURE__ */ jsx36(CloseRoundIcon, { size: isDownMd ? 24 : 30, className: "matchid-modal-header-close", onClick: onClose })
|
|
691
721
|
] }),
|
|
692
722
|
children
|
|
693
723
|
] });
|
|
694
724
|
}
|
|
695
725
|
|
|
696
726
|
// src/components/PasswordModal/index.tsx
|
|
697
|
-
import { useEffect as
|
|
727
|
+
import { useEffect as useEffect4, useMemo as useMemo2, useState as useState4 } from "react";
|
|
698
728
|
|
|
699
729
|
// src/components/Input/index.tsx
|
|
700
|
-
import { useState } from "react";
|
|
730
|
+
import { useState as useState2 } from "react";
|
|
701
731
|
import { jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
702
732
|
function Input({
|
|
703
733
|
onChange,
|
|
@@ -706,21 +736,29 @@ function Input({
|
|
|
706
736
|
className = "",
|
|
707
737
|
...props
|
|
708
738
|
}) {
|
|
709
|
-
const [inputType, setInputType] =
|
|
739
|
+
const [inputType, setInputType] = useState2(type);
|
|
740
|
+
const isDownMd = useDownMd();
|
|
710
741
|
return /* @__PURE__ */ jsxs24(
|
|
711
742
|
"div",
|
|
712
743
|
{
|
|
713
|
-
className: `matchid-input-box ${props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
|
|
744
|
+
className: `matchid-input-box ${props.value && props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
|
|
714
745
|
children: [
|
|
715
746
|
/* @__PURE__ */ jsx37("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
|
|
716
|
-
props.value.length > 0 && /* @__PURE__ */ jsx37("div", { className: "matchid-input-delete-icon", onClick: (e) => {
|
|
747
|
+
props.value && props.value.length > 0 && /* @__PURE__ */ jsx37("div", { className: "matchid-input-delete-icon", onClick: (e) => {
|
|
717
748
|
if (onChange) {
|
|
718
749
|
onChange({ target: { value: "" } });
|
|
719
750
|
}
|
|
720
|
-
}, children: /* @__PURE__ */ jsx37(
|
|
751
|
+
}, children: /* @__PURE__ */ jsx37(
|
|
752
|
+
DeleteRoundIcon,
|
|
753
|
+
{
|
|
754
|
+
height: isDownMd ? 16 : 21,
|
|
755
|
+
width: isDownMd ? 16 : 20,
|
|
756
|
+
color: "var(--matchid-input-delete-icon-color)"
|
|
757
|
+
}
|
|
758
|
+
) }),
|
|
721
759
|
type === "password" && /* @__PURE__ */ jsx37("div", { className: "matchid-input-eye-icon", onClick: () => {
|
|
722
760
|
setInputType(inputType === "password" ? "text" : "password");
|
|
723
|
-
}, children: inputType === "password" ? /* @__PURE__ */ jsx37(CloseEyeIcon, {}) : /* @__PURE__ */ jsx37(OpenEyeIcon, {}) }),
|
|
761
|
+
}, children: inputType === "password" ? /* @__PURE__ */ jsx37(CloseEyeIcon, { size: isDownMd ? 16 : 20 }) : /* @__PURE__ */ jsx37(OpenEyeIcon, { size: isDownMd ? 16 : 20 }) }),
|
|
724
762
|
after
|
|
725
763
|
]
|
|
726
764
|
}
|
|
@@ -785,6 +823,7 @@ function Button({
|
|
|
785
823
|
var hooks_exports = {};
|
|
786
824
|
__export(hooks_exports, {
|
|
787
825
|
useCopyClipboard: () => useCopyClipboard,
|
|
826
|
+
useLayout: () => useLayout_exports,
|
|
788
827
|
useMatchEvents: () => useMatchEvents,
|
|
789
828
|
useUserInfo: () => useUserInfo,
|
|
790
829
|
useWallet: () => useWallet
|
|
@@ -1357,9 +1396,9 @@ function useUserInfo() {
|
|
|
1357
1396
|
}
|
|
1358
1397
|
|
|
1359
1398
|
// src/hooks/useMatchEvents.ts
|
|
1360
|
-
import { useEffect } from "react";
|
|
1399
|
+
import { useEffect as useEffect2 } from "react";
|
|
1361
1400
|
function useMatchEvents(handlers) {
|
|
1362
|
-
|
|
1401
|
+
useEffect2(() => {
|
|
1363
1402
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
1364
1403
|
if (handler2) {
|
|
1365
1404
|
eventManager_default.on(event, handler2);
|
|
@@ -1523,14 +1562,14 @@ function useWallet() {
|
|
|
1523
1562
|
|
|
1524
1563
|
// src/hooks/useCopyClipboard.ts
|
|
1525
1564
|
import copy from "copy-to-clipboard";
|
|
1526
|
-
import { useCallback, useEffect as
|
|
1565
|
+
import { useCallback, useEffect as useEffect3, useState as useState3 } from "react";
|
|
1527
1566
|
function useCopyClipboard(timeout = 500) {
|
|
1528
|
-
const [isCopied, setIsCopied] =
|
|
1567
|
+
const [isCopied, setIsCopied] = useState3(false);
|
|
1529
1568
|
const staticCopy = useCallback((text) => {
|
|
1530
1569
|
const didCopy = copy(text);
|
|
1531
1570
|
setIsCopied(didCopy);
|
|
1532
1571
|
}, []);
|
|
1533
|
-
|
|
1572
|
+
useEffect3(() => {
|
|
1534
1573
|
if (isCopied) {
|
|
1535
1574
|
const hide = setTimeout(() => {
|
|
1536
1575
|
setIsCopied(false);
|
|
@@ -1555,9 +1594,9 @@ function PasswordModal({
|
|
|
1555
1594
|
}) {
|
|
1556
1595
|
const { refreshOverview, overview } = useUserInfo();
|
|
1557
1596
|
const { isLogin, did } = useUserInfo();
|
|
1558
|
-
const [password, setPassword] =
|
|
1559
|
-
const [rePassword, setRePassword] =
|
|
1560
|
-
const [error, setError] =
|
|
1597
|
+
const [password, setPassword] = useState4("");
|
|
1598
|
+
const [rePassword, setRePassword] = useState4("");
|
|
1599
|
+
const [error, setError] = useState4("");
|
|
1561
1600
|
const { generateWallet, initWallet } = useWallet();
|
|
1562
1601
|
const intl = useIntl();
|
|
1563
1602
|
const passwordError = useMemo2(() => {
|
|
@@ -1576,7 +1615,7 @@ function PasswordModal({
|
|
|
1576
1615
|
}
|
|
1577
1616
|
return "";
|
|
1578
1617
|
}, [rePassword, password]);
|
|
1579
|
-
|
|
1618
|
+
useEffect4(() => {
|
|
1580
1619
|
if (isOpen && overview) {
|
|
1581
1620
|
setPassword("");
|
|
1582
1621
|
setRePassword("");
|
|
@@ -1587,7 +1626,7 @@ function PasswordModal({
|
|
|
1587
1626
|
});
|
|
1588
1627
|
}
|
|
1589
1628
|
}, [isOpen, overview]);
|
|
1590
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1629
|
+
const [isSubmitting, setIsSubmitting] = useState4(false);
|
|
1591
1630
|
const onContinue = async () => {
|
|
1592
1631
|
if (isSubmitting) return;
|
|
1593
1632
|
try {
|
|
@@ -1653,7 +1692,7 @@ function PasswordModal({
|
|
|
1653
1692
|
}
|
|
1654
1693
|
|
|
1655
1694
|
// src/components/RecoveryModal/index.tsx
|
|
1656
|
-
import { useEffect as
|
|
1695
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useState as useState5 } from "react";
|
|
1657
1696
|
import { FormattedMessage as FormattedMessage2, useIntl as useIntl2 } from "react-intl";
|
|
1658
1697
|
import { jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
1659
1698
|
function RecoveryModal({
|
|
@@ -1664,9 +1703,9 @@ function RecoveryModal({
|
|
|
1664
1703
|
}) {
|
|
1665
1704
|
const { refreshOverview } = useUserInfo();
|
|
1666
1705
|
const { isLogin, overview } = useUserInfo();
|
|
1667
|
-
const [password, setPassword] =
|
|
1706
|
+
const [password, setPassword] = useState5("");
|
|
1668
1707
|
const { recoveryWallet, initWallet } = useWallet();
|
|
1669
|
-
const [error, setError] =
|
|
1708
|
+
const [error, setError] = useState5("");
|
|
1670
1709
|
const intl = useIntl2();
|
|
1671
1710
|
const passwordError = useMemo3(() => {
|
|
1672
1711
|
if (password.length < 6) return intl.formatMessage({
|
|
@@ -1676,7 +1715,7 @@ function RecoveryModal({
|
|
|
1676
1715
|
});
|
|
1677
1716
|
return "";
|
|
1678
1717
|
}, [password]);
|
|
1679
|
-
|
|
1718
|
+
useEffect5(() => {
|
|
1680
1719
|
if (isOpen && overview) {
|
|
1681
1720
|
setPassword("");
|
|
1682
1721
|
const did = overview.did.split(":")[2];
|
|
@@ -1686,7 +1725,7 @@ function RecoveryModal({
|
|
|
1686
1725
|
});
|
|
1687
1726
|
}
|
|
1688
1727
|
}, [isOpen, overview]);
|
|
1689
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1728
|
+
const [isSubmitting, setIsSubmitting] = useState5(false);
|
|
1690
1729
|
const onContinue = async () => {
|
|
1691
1730
|
if (isSubmitting) return;
|
|
1692
1731
|
try {
|
|
@@ -1734,7 +1773,7 @@ function RecoveryModal({
|
|
|
1734
1773
|
}
|
|
1735
1774
|
|
|
1736
1775
|
// src/components/SOLModal/index.tsx
|
|
1737
|
-
import React2, { useEffect as
|
|
1776
|
+
import React2, { useEffect as useEffect10, useMemo as useMemo7, useState as useState14 } from "react";
|
|
1738
1777
|
|
|
1739
1778
|
// src/components/index.tsx
|
|
1740
1779
|
var components_exports = {};
|
|
@@ -1756,16 +1795,16 @@ __export(components_exports, {
|
|
|
1756
1795
|
});
|
|
1757
1796
|
|
|
1758
1797
|
// src/components/EmailModal/index.tsx
|
|
1759
|
-
import { useEffect as
|
|
1798
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
1760
1799
|
|
|
1761
1800
|
// src/components/EmailModal/StepEmail.tsx
|
|
1762
|
-
import { useEffect as
|
|
1801
|
+
import { useEffect as useEffect6, useMemo as useMemo4, useState as useState6 } from "react";
|
|
1763
1802
|
import { FormattedMessage as FormattedMessage3, useIntl as useIntl3 } from "react-intl";
|
|
1764
1803
|
import { jsx as jsx42, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
1765
1804
|
function StepEmail(props) {
|
|
1766
1805
|
const intl = useIntl3();
|
|
1767
|
-
const [emailVal, setEmailVal] =
|
|
1768
|
-
|
|
1806
|
+
const [emailVal, setEmailVal] = useState6("");
|
|
1807
|
+
useEffect6(() => {
|
|
1769
1808
|
if (props.email) {
|
|
1770
1809
|
setEmailVal(props.email);
|
|
1771
1810
|
}
|
|
@@ -1796,7 +1835,7 @@ function StepEmail(props) {
|
|
|
1796
1835
|
}
|
|
1797
1836
|
|
|
1798
1837
|
// src/components/EmailModal/StepVerify.tsx
|
|
1799
|
-
import { useEffect as
|
|
1838
|
+
import { useEffect as useEffect7, useMemo as useMemo5, useRef, useState as useState7 } from "react";
|
|
1800
1839
|
|
|
1801
1840
|
// src/config/index.tsx
|
|
1802
1841
|
var EMAIL_INTERVAL = 60;
|
|
@@ -1808,17 +1847,18 @@ import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
|
1808
1847
|
function StepVerify(props) {
|
|
1809
1848
|
const intl = useIntl4();
|
|
1810
1849
|
const { getLoginEmailCode, loginByEmail } = useUserInfo();
|
|
1811
|
-
const [error, setError] =
|
|
1812
|
-
const [code, setCode] =
|
|
1813
|
-
const [sending, setSending] =
|
|
1814
|
-
const [submitting, setSubmitting] =
|
|
1850
|
+
const [error, setError] = useState7("");
|
|
1851
|
+
const [code, setCode] = useState7("");
|
|
1852
|
+
const [sending, setSending] = useState7(false);
|
|
1853
|
+
const [submitting, setSubmitting] = useState7(false);
|
|
1815
1854
|
const sendTimeRef = useRef(0);
|
|
1816
|
-
const [sendBtnText, setSendBtnText] =
|
|
1855
|
+
const [sendBtnText, setSendBtnText] = useState7(intl.formatMessage({
|
|
1817
1856
|
id: "send"
|
|
1818
1857
|
}));
|
|
1819
1858
|
const intervalTime = EMAIL_INTERVAL;
|
|
1820
1859
|
const codeLength = EMAIL_CODE_LENGTH;
|
|
1821
1860
|
const intervalRef = useRef(null);
|
|
1861
|
+
const isDownMd = useDownMd();
|
|
1822
1862
|
const onSend = async () => {
|
|
1823
1863
|
if (sendTimeRef.current > 0) {
|
|
1824
1864
|
return;
|
|
@@ -1848,7 +1888,7 @@ function StepVerify(props) {
|
|
|
1848
1888
|
setSending(false);
|
|
1849
1889
|
}
|
|
1850
1890
|
};
|
|
1851
|
-
|
|
1891
|
+
useEffect7(() => {
|
|
1852
1892
|
onSend();
|
|
1853
1893
|
return () => {
|
|
1854
1894
|
if (intervalRef.current) {
|
|
@@ -1882,7 +1922,7 @@ function StepVerify(props) {
|
|
|
1882
1922
|
};
|
|
1883
1923
|
return /* @__PURE__ */ jsxs29("div", { className: "matchid-email-verify-box", children: [
|
|
1884
1924
|
/* @__PURE__ */ jsxs29("div", { className: "matchid-email-verify-header", children: [
|
|
1885
|
-
/* @__PURE__ */ jsx43("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ jsx43(EmailLineIcon, {}) }),
|
|
1925
|
+
/* @__PURE__ */ jsx43("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ jsx43(EmailLineIcon, { size: isDownMd ? 19 : 24 }) }),
|
|
1886
1926
|
/* @__PURE__ */ jsxs29("div", { className: "matchid-email-verify-header-content", children: [
|
|
1887
1927
|
/* @__PURE__ */ jsx43("div", { className: "matchid-email-verify-header-value", children: props.email }),
|
|
1888
1928
|
/* @__PURE__ */ jsx43("div", { className: "matchid-email-verify-header-tips", children: /* @__PURE__ */ jsx43(FormattedMessage4, { id: "sendEmailTips" }) })
|
|
@@ -1933,10 +1973,10 @@ function EmailModal({
|
|
|
1933
1973
|
onBack,
|
|
1934
1974
|
onLogin
|
|
1935
1975
|
}) {
|
|
1936
|
-
const [step, setStep] =
|
|
1937
|
-
const [emailVal, setEmailVal] =
|
|
1976
|
+
const [step, setStep] = useState8("input");
|
|
1977
|
+
const [emailVal, setEmailVal] = useState8("");
|
|
1938
1978
|
const intl = useIntl5();
|
|
1939
|
-
|
|
1979
|
+
useEffect8(() => {
|
|
1940
1980
|
if (!isOpen) {
|
|
1941
1981
|
setStep("input");
|
|
1942
1982
|
setEmailVal("");
|
|
@@ -1961,7 +2001,7 @@ function EmailModal({
|
|
|
1961
2001
|
}
|
|
1962
2002
|
|
|
1963
2003
|
// src/components/Popover/index.tsx
|
|
1964
|
-
import { useState as
|
|
2004
|
+
import { useState as useState9 } from "react";
|
|
1965
2005
|
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
1966
2006
|
function Popover({
|
|
1967
2007
|
children,
|
|
@@ -1971,7 +2011,7 @@ function Popover({
|
|
|
1971
2011
|
className = "",
|
|
1972
2012
|
gap = "20px"
|
|
1973
2013
|
}) {
|
|
1974
|
-
const [active, setActive] =
|
|
2014
|
+
const [active, setActive] = useState9(false);
|
|
1975
2015
|
return /* @__PURE__ */ jsxs30(
|
|
1976
2016
|
"div",
|
|
1977
2017
|
{
|
|
@@ -1992,7 +2032,7 @@ function Popover({
|
|
|
1992
2032
|
}
|
|
1993
2033
|
|
|
1994
2034
|
// src/components/LoginBox/index.tsx
|
|
1995
|
-
import { useState as
|
|
2035
|
+
import { useState as useState10 } from "react";
|
|
1996
2036
|
import { FormattedMessage as FormattedMessage5, useIntl as useIntl6 } from "react-intl";
|
|
1997
2037
|
import { Fragment as Fragment2, jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
1998
2038
|
var RecommendItem = ({
|
|
@@ -2043,81 +2083,83 @@ function LoginBox({
|
|
|
2043
2083
|
"telegram",
|
|
2044
2084
|
"twitter"
|
|
2045
2085
|
],
|
|
2086
|
+
walletMethods = ["evm"],
|
|
2046
2087
|
inModal = false
|
|
2047
2088
|
}) {
|
|
2048
|
-
const [emailOpen, setEmailOpen] =
|
|
2089
|
+
const [emailOpen, setEmailOpen] = useState10(false);
|
|
2049
2090
|
const { login } = useUserInfo();
|
|
2050
|
-
const [showWallet, setShowWallet] =
|
|
2091
|
+
const [showWallet, setShowWallet] = useState10(false);
|
|
2051
2092
|
const intl = useIntl6();
|
|
2093
|
+
const isDownMd = useDownMd();
|
|
2052
2094
|
const methodMap = {
|
|
2053
2095
|
wallet: {
|
|
2054
|
-
icon: /* @__PURE__ */ jsx46(WalletIcon, {}),
|
|
2096
|
+
icon: /* @__PURE__ */ jsx46(WalletIcon, { size: isDownMd ? 36 : 40 }),
|
|
2055
2097
|
name: intl.formatMessage({ id: "wallet" }),
|
|
2056
2098
|
onClick: () => setShowWallet(!showWallet),
|
|
2057
2099
|
type: "wallet"
|
|
2058
2100
|
},
|
|
2059
2101
|
email: {
|
|
2060
|
-
icon: /* @__PURE__ */ jsx46(EmailIcon, {}),
|
|
2102
|
+
icon: /* @__PURE__ */ jsx46(EmailIcon, { size: isDownMd ? 36 : 40 }),
|
|
2061
2103
|
name: intl.formatMessage({ id: "email" }),
|
|
2062
2104
|
onClick: () => {
|
|
2063
2105
|
setEmailOpen(true);
|
|
2064
2106
|
}
|
|
2065
2107
|
},
|
|
2066
2108
|
google: {
|
|
2067
|
-
icon: /* @__PURE__ */ jsx46(GoogleIcon, {}),
|
|
2109
|
+
icon: /* @__PURE__ */ jsx46(GoogleIcon, { size: isDownMd ? 36 : 40 }),
|
|
2068
2110
|
name: "Google",
|
|
2069
2111
|
onClick: () => login("google")
|
|
2070
2112
|
},
|
|
2071
2113
|
twitter: {
|
|
2072
|
-
icon: /* @__PURE__ */ jsx46(XIcon, {}),
|
|
2114
|
+
icon: /* @__PURE__ */ jsx46(XIcon, { size: isDownMd ? 36 : 40 }),
|
|
2073
2115
|
name: "X",
|
|
2074
2116
|
onClick: () => login("twitter")
|
|
2075
2117
|
},
|
|
2076
2118
|
telegram: {
|
|
2077
|
-
icon: /* @__PURE__ */ jsx46(TelegramIcon, {}),
|
|
2119
|
+
icon: /* @__PURE__ */ jsx46(TelegramIcon, { size: isDownMd ? 36 : 40 }),
|
|
2078
2120
|
name: "Telegram",
|
|
2079
2121
|
onClick: () => login("telegram")
|
|
2080
2122
|
},
|
|
2081
2123
|
github: {
|
|
2082
|
-
icon: /* @__PURE__ */ jsx46(GithubIcon, {}),
|
|
2124
|
+
icon: /* @__PURE__ */ jsx46(GithubIcon, { size: isDownMd ? 36 : 40 }),
|
|
2083
2125
|
name: "Github",
|
|
2084
2126
|
onClick: () => login("github")
|
|
2085
2127
|
},
|
|
2086
2128
|
discord: {
|
|
2087
|
-
icon: /* @__PURE__ */ jsx46(DiscordIcon, {}),
|
|
2129
|
+
icon: /* @__PURE__ */ jsx46(DiscordIcon, { size: isDownMd ? 36 : 40 }),
|
|
2088
2130
|
name: "Discord",
|
|
2089
2131
|
onClick: () => login("discord")
|
|
2090
2132
|
},
|
|
2091
2133
|
linkedin: {
|
|
2092
|
-
icon: /* @__PURE__ */ jsx46(LinkedinIcon, {}),
|
|
2134
|
+
icon: /* @__PURE__ */ jsx46(LinkedinIcon, { size: isDownMd ? 36 : 40 }),
|
|
2093
2135
|
name: "LinkedIn",
|
|
2094
2136
|
onClick: () => login("linkedin")
|
|
2095
2137
|
},
|
|
2096
2138
|
facebook: {
|
|
2097
|
-
icon: /* @__PURE__ */ jsx46(FacebookIcon, {}),
|
|
2139
|
+
icon: /* @__PURE__ */ jsx46(FacebookIcon, { size: isDownMd ? 36 : 40 }),
|
|
2098
2140
|
name: "Facebook",
|
|
2099
2141
|
onClick: () => login("facebook")
|
|
2100
2142
|
},
|
|
2101
2143
|
youtube: {
|
|
2102
|
-
icon: /* @__PURE__ */ jsx46(YoutubeIcon, {}),
|
|
2144
|
+
icon: /* @__PURE__ */ jsx46(YoutubeIcon, { size: isDownMd ? 36 : 40 }),
|
|
2103
2145
|
name: "Youtube",
|
|
2104
2146
|
onClick: () => login("youtube")
|
|
2105
2147
|
}
|
|
2106
2148
|
};
|
|
2107
|
-
const
|
|
2108
|
-
{
|
|
2109
|
-
icon: /* @__PURE__ */ jsx46(EVMDarkIcon, {}),
|
|
2110
|
-
activeIcon: /* @__PURE__ */ jsx46(EVMLightIcon, {}),
|
|
2149
|
+
const walletMap = {
|
|
2150
|
+
evm: {
|
|
2151
|
+
icon: /* @__PURE__ */ jsx46(EVMDarkIcon, { size: isDownMd ? 36 : 40 }),
|
|
2152
|
+
activeIcon: /* @__PURE__ */ jsx46(EVMLightIcon, { size: isDownMd ? 36 : 40 }),
|
|
2111
2153
|
name: "EVM",
|
|
2112
2154
|
onClick: () => login("evm")
|
|
2113
2155
|
},
|
|
2114
|
-
{
|
|
2115
|
-
icon: /* @__PURE__ */ jsx46(SOLDarkIcon, {}),
|
|
2116
|
-
activeIcon: /* @__PURE__ */ jsx46(SOLLightIcon, {}),
|
|
2156
|
+
sol: {
|
|
2157
|
+
icon: /* @__PURE__ */ jsx46(SOLDarkIcon, { size: isDownMd ? 36 : 40 }),
|
|
2158
|
+
activeIcon: /* @__PURE__ */ jsx46(SOLLightIcon, { size: isDownMd ? 36 : 40 }),
|
|
2117
2159
|
name: "SOL",
|
|
2118
2160
|
onClick: () => login("sol")
|
|
2119
2161
|
}
|
|
2120
|
-
|
|
2162
|
+
};
|
|
2121
2163
|
return /* @__PURE__ */ jsxs31(Fragment2, { children: [
|
|
2122
2164
|
(!inModal || !emailOpen) && /* @__PURE__ */ jsxs31("div", { className: "matchid-login-box", children: [
|
|
2123
2165
|
/* @__PURE__ */ jsx46("div", { className: "matchid-login-recommend-list", children: recommendMethods.map((m) => {
|
|
@@ -2130,7 +2172,8 @@ function LoginBox({
|
|
|
2130
2172
|
showChildren: m == "wallet" && showWallet,
|
|
2131
2173
|
children: m == "wallet" && /* @__PURE__ */ jsxs31(Fragment2, { children: [
|
|
2132
2174
|
/* @__PURE__ */ jsx46("div", { className: "matchid-login-recommend-wallet-divider" }),
|
|
2133
|
-
/* @__PURE__ */ jsx46("div", { className: "matchid-login-recommend-wallet-list", children: walletMethods.map((
|
|
2175
|
+
/* @__PURE__ */ jsx46("div", { className: "matchid-login-recommend-wallet-list", children: walletMethods.map((n) => {
|
|
2176
|
+
const m2 = walletMap[n];
|
|
2134
2177
|
return /* @__PURE__ */ jsxs31(
|
|
2135
2178
|
"div",
|
|
2136
2179
|
{
|
|
@@ -2204,7 +2247,7 @@ function LoginBox({
|
|
|
2204
2247
|
}
|
|
2205
2248
|
|
|
2206
2249
|
// src/components/LoginButton/index.tsx
|
|
2207
|
-
import { useState as
|
|
2250
|
+
import { useState as useState12 } from "react";
|
|
2208
2251
|
|
|
2209
2252
|
// src/components/LoginPanel/index.tsx
|
|
2210
2253
|
import { FormattedMessage as FormattedMessage6 } from "react-intl";
|
|
@@ -2214,13 +2257,14 @@ function LoginPanel({
|
|
|
2214
2257
|
onClose,
|
|
2215
2258
|
...props
|
|
2216
2259
|
}) {
|
|
2260
|
+
const isDownMd = useDownMd();
|
|
2217
2261
|
return /* @__PURE__ */ jsxs32("div", { className: "matchid-login-panel", children: [
|
|
2218
2262
|
header ? header : /* @__PURE__ */ jsxs32("div", { className: "matchid-login-panel-header", children: [
|
|
2219
2263
|
/* @__PURE__ */ jsxs32("div", { className: "matchid-login-panel-header-content", children: [
|
|
2220
2264
|
/* @__PURE__ */ jsx47("div", { className: "matchid-login-panel-header-title", children: /* @__PURE__ */ jsx47(FormattedMessage6, { id: "loginTitle" }) }),
|
|
2221
2265
|
/* @__PURE__ */ jsx47("div", { className: "matchid-login-panel-header-subtilte", children: /* @__PURE__ */ jsx47(FormattedMessage6, { id: "loginTips" }) })
|
|
2222
2266
|
] }),
|
|
2223
|
-
onClose && /* @__PURE__ */ jsx47("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ jsx47(CloseRoundIcon, {}) })
|
|
2267
|
+
onClose && /* @__PURE__ */ jsx47("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ jsx47(CloseRoundIcon, { size: isDownMd ? 24 : 30 }) })
|
|
2224
2268
|
] }),
|
|
2225
2269
|
/* @__PURE__ */ jsx47("div", { className: "matchid-login-panel-divide" }),
|
|
2226
2270
|
/* @__PURE__ */ jsx47("div", { className: "matchid-login-panel-box", children: /* @__PURE__ */ jsx47(LoginBox, { ...props }) })
|
|
@@ -2246,7 +2290,7 @@ function LoginModal({
|
|
|
2246
2290
|
}
|
|
2247
2291
|
|
|
2248
2292
|
// src/components/UserPopover/index.tsx
|
|
2249
|
-
import { useState as
|
|
2293
|
+
import { useState as useState11 } from "react";
|
|
2250
2294
|
|
|
2251
2295
|
// src/assets/icon/ProfileIcon.tsx
|
|
2252
2296
|
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
@@ -2278,7 +2322,7 @@ import { FormattedMessage as FormattedMessage7, useIntl as useIntl7 } from "reac
|
|
|
2278
2322
|
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2279
2323
|
function UserContent() {
|
|
2280
2324
|
const { logout, address, username } = useUserInfo();
|
|
2281
|
-
const [logouting, setLogouting] =
|
|
2325
|
+
const [logouting, setLogouting] = useState11(false);
|
|
2282
2326
|
const onLogout = async () => {
|
|
2283
2327
|
if (logouting) return;
|
|
2284
2328
|
try {
|
|
@@ -2307,7 +2351,7 @@ function UserContent() {
|
|
|
2307
2351
|
const UserDivider = () => {
|
|
2308
2352
|
return /* @__PURE__ */ jsx50("div", { className: `matchid-user-popover-divider` });
|
|
2309
2353
|
};
|
|
2310
|
-
const [usernameOpen, setUsernameOpen] =
|
|
2354
|
+
const [usernameOpen, setUsernameOpen] = useState11(false);
|
|
2311
2355
|
const [copied, setCopied] = useCopyClipboard();
|
|
2312
2356
|
const intl = useIntl7();
|
|
2313
2357
|
return /* @__PURE__ */ jsxs34("div", { className: "matchid-user-popover-content", children: [
|
|
@@ -2348,14 +2392,24 @@ function LoginButton({
|
|
|
2348
2392
|
popoverPosition = "right",
|
|
2349
2393
|
popoverType = "hover",
|
|
2350
2394
|
popoverGap = 20,
|
|
2395
|
+
walletMethods,
|
|
2351
2396
|
...props
|
|
2352
2397
|
}) {
|
|
2353
2398
|
const intl = useIntl8();
|
|
2354
2399
|
const { isLogin, username } = useUserInfo();
|
|
2355
|
-
const [loginOpen, setLoginOpen] =
|
|
2400
|
+
const [loginOpen, setLoginOpen] = useState12(false);
|
|
2356
2401
|
if (!isLogin) {
|
|
2357
2402
|
return /* @__PURE__ */ jsxs35(Fragment3, { children: [
|
|
2358
|
-
/* @__PURE__ */ jsx51(
|
|
2403
|
+
/* @__PURE__ */ jsx51(
|
|
2404
|
+
LoginModal,
|
|
2405
|
+
{
|
|
2406
|
+
methods,
|
|
2407
|
+
walletMethods,
|
|
2408
|
+
recommendMethods,
|
|
2409
|
+
isOpen: loginOpen,
|
|
2410
|
+
onClose: () => setLoginOpen(false)
|
|
2411
|
+
}
|
|
2412
|
+
),
|
|
2359
2413
|
/* @__PURE__ */ jsxs35(Button, { className: "matchid-unlogin-btn", ...props, highlight: true, onClick: () => setLoginOpen(true), children: [
|
|
2360
2414
|
/* @__PURE__ */ jsx51(UnLoginIcon_default, {}),
|
|
2361
2415
|
/* @__PURE__ */ jsx51("span", { children: /* @__PURE__ */ jsx51(FormattedMessage8, { id: "login" }) })
|
|
@@ -2371,7 +2425,7 @@ function LoginButton({
|
|
|
2371
2425
|
}
|
|
2372
2426
|
|
|
2373
2427
|
// src/components/UsernameModal/index.tsx
|
|
2374
|
-
import { useEffect as
|
|
2428
|
+
import { useEffect as useEffect9, useMemo as useMemo6, useState as useState13 } from "react";
|
|
2375
2429
|
|
|
2376
2430
|
// src/assets/icon/InfoRoundIcon.tsx
|
|
2377
2431
|
import { jsx as jsx52, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
@@ -2401,8 +2455,9 @@ var ValidItem = ({
|
|
|
2401
2455
|
success = false,
|
|
2402
2456
|
text
|
|
2403
2457
|
}) => {
|
|
2458
|
+
const isDownMd = useDownMd();
|
|
2404
2459
|
return /* @__PURE__ */ jsxs37("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
|
|
2405
|
-
success ? /* @__PURE__ */ jsx53(CheckRoundIcon, { size: 16 }) : /* @__PURE__ */ jsx53(InfoRoundIcon, { size: 16 }),
|
|
2460
|
+
success ? /* @__PURE__ */ jsx53(CheckRoundIcon, { size: isDownMd ? 12 : 16 }) : /* @__PURE__ */ jsx53(InfoRoundIcon, { size: isDownMd ? 12 : 16 }),
|
|
2406
2461
|
/* @__PURE__ */ jsx53("span", { children: text })
|
|
2407
2462
|
] });
|
|
2408
2463
|
};
|
|
@@ -2414,9 +2469,10 @@ function UsernameModal({
|
|
|
2414
2469
|
}) {
|
|
2415
2470
|
const { username, refreshOverview } = useUserInfo();
|
|
2416
2471
|
const { isLogin } = useUserInfo();
|
|
2417
|
-
const [val, setVal] =
|
|
2418
|
-
const [error, setError] =
|
|
2419
|
-
|
|
2472
|
+
const [val, setVal] = useState13(username);
|
|
2473
|
+
const [error, setError] = useState13("");
|
|
2474
|
+
const isDownMd = useDownMd();
|
|
2475
|
+
useEffect9(() => {
|
|
2420
2476
|
if (isOpen) {
|
|
2421
2477
|
setVal(username);
|
|
2422
2478
|
setError("");
|
|
@@ -2429,7 +2485,7 @@ function UsernameModal({
|
|
|
2429
2485
|
return val.length >= 2 && val.length <= 32;
|
|
2430
2486
|
}, [val]);
|
|
2431
2487
|
const isSafe = isValid && isLength;
|
|
2432
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2488
|
+
const [isSubmitting, setIsSubmitting] = useState13(false);
|
|
2433
2489
|
const onSubmit = async () => {
|
|
2434
2490
|
if (isSubmitting) return;
|
|
2435
2491
|
try {
|
|
@@ -2483,10 +2539,10 @@ function UsernameModal({
|
|
|
2483
2539
|
}) })
|
|
2484
2540
|
] }),
|
|
2485
2541
|
/* @__PURE__ */ jsx53(Button, { disabled: !isSafe, loading: isSubmitting, style: {
|
|
2486
|
-
marginTop: "64px"
|
|
2542
|
+
marginTop: isDownMd ? "36px" : "64px"
|
|
2487
2543
|
}, onClick: onSubmit, size: "lg", block: true, highlight: true, children: /* @__PURE__ */ jsx53(FormattedMessage9, { id: "confirm" }) }),
|
|
2488
2544
|
/* @__PURE__ */ jsx53(Button, { style: {
|
|
2489
|
-
marginTop: "24px"
|
|
2545
|
+
marginTop: isDownMd ? "12px" : "24px"
|
|
2490
2546
|
}, onClick: props.onClose, size: "lg", block: true, children: /* @__PURE__ */ jsx53(FormattedMessage9, { id: "nextTime" }) })
|
|
2491
2547
|
] }) });
|
|
2492
2548
|
}
|
|
@@ -2560,17 +2616,17 @@ function WalletContent({
|
|
|
2560
2616
|
const { setVisible, visible } = useWalletModal();
|
|
2561
2617
|
const wallet = useWallet2();
|
|
2562
2618
|
const { events, login } = useMatch();
|
|
2563
|
-
const [status, setStatus] =
|
|
2619
|
+
const [status, setStatus] = useState14("");
|
|
2564
2620
|
const statusRef = React2.useRef(status);
|
|
2565
|
-
const [error, setError] =
|
|
2566
|
-
|
|
2621
|
+
const [error, setError] = useState14("");
|
|
2622
|
+
useEffect10(() => {
|
|
2567
2623
|
const init = async () => {
|
|
2568
2624
|
await wallet.disconnect();
|
|
2569
2625
|
setVisible(true);
|
|
2570
2626
|
};
|
|
2571
2627
|
init();
|
|
2572
2628
|
}, []);
|
|
2573
|
-
|
|
2629
|
+
useEffect10(() => {
|
|
2574
2630
|
if (wallet.connected) {
|
|
2575
2631
|
console.log("wallet.connected", wallet.connected);
|
|
2576
2632
|
toLoginInWallet();
|
|
@@ -2798,7 +2854,7 @@ var Providers = ({ children }) => {
|
|
|
2798
2854
|
var context_default = Providers;
|
|
2799
2855
|
|
|
2800
2856
|
// src/hooks/useWalletInit.ts
|
|
2801
|
-
import { useEffect as
|
|
2857
|
+
import { useEffect as useEffect11, useState as useState15 } from "react";
|
|
2802
2858
|
var AppClientId2 = getAppClientId();
|
|
2803
2859
|
function useWalletInit({
|
|
2804
2860
|
refreshOverview
|
|
@@ -2807,10 +2863,10 @@ function useWalletInit({
|
|
|
2807
2863
|
const getWalletIframe = () => {
|
|
2808
2864
|
return document.getElementById("match-wallet");
|
|
2809
2865
|
};
|
|
2810
|
-
const [walletInited, setWalletInited] =
|
|
2866
|
+
const [walletInited, setWalletInited] = useState15(false);
|
|
2811
2867
|
const { appid, token, overview } = useLocalStore_default();
|
|
2812
2868
|
const { initWallet, generateWallet } = useWallet();
|
|
2813
|
-
|
|
2869
|
+
useEffect11(() => {
|
|
2814
2870
|
if (endpoints.auth) {
|
|
2815
2871
|
if (!window.matchWalletMessageIdMap) {
|
|
2816
2872
|
window.matchWalletMessageIdMap = {};
|
|
@@ -2868,7 +2924,7 @@ function useWalletInit({
|
|
|
2868
2924
|
}
|
|
2869
2925
|
}
|
|
2870
2926
|
}, [endpoints.auth]);
|
|
2871
|
-
|
|
2927
|
+
useEffect11(() => {
|
|
2872
2928
|
const messageHandle = async (e) => {
|
|
2873
2929
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
2874
2930
|
return;
|
|
@@ -2901,7 +2957,7 @@ function useWalletInit({
|
|
|
2901
2957
|
window.removeEventListener("message", messageHandle);
|
|
2902
2958
|
};
|
|
2903
2959
|
}, []);
|
|
2904
|
-
|
|
2960
|
+
useEffect11(() => {
|
|
2905
2961
|
if (token && overview && overview.did && walletInited) {
|
|
2906
2962
|
const did = overview.did.split(":")[2];
|
|
2907
2963
|
const newUserInit = async () => {
|
|
@@ -2932,7 +2988,7 @@ function useWalletInit({
|
|
|
2932
2988
|
}
|
|
2933
2989
|
|
|
2934
2990
|
// src/hooks/useInit.tsx
|
|
2935
|
-
import { useEffect as
|
|
2991
|
+
import { useEffect as useEffect12, useRef as useRef2 } from "react";
|
|
2936
2992
|
function useInit({
|
|
2937
2993
|
theme,
|
|
2938
2994
|
appid,
|
|
@@ -2955,19 +3011,19 @@ function useInit({
|
|
|
2955
3011
|
const searchParams = new URLSearchParams(window.location.search);
|
|
2956
3012
|
const matchToken = searchParams.get("matchToken");
|
|
2957
3013
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
2958
|
-
|
|
3014
|
+
useEffect12(() => {
|
|
2959
3015
|
setTheme(theme);
|
|
2960
3016
|
}, [theme]);
|
|
2961
|
-
|
|
3017
|
+
useEffect12(() => {
|
|
2962
3018
|
setAppid(appid);
|
|
2963
3019
|
}, [appid]);
|
|
2964
|
-
|
|
3020
|
+
useEffect12(() => {
|
|
2965
3021
|
setEndpoints(realEndpoints);
|
|
2966
3022
|
}, [realEndpoints]);
|
|
2967
|
-
|
|
3023
|
+
useEffect12(() => {
|
|
2968
3024
|
setLocale(locale || "en");
|
|
2969
3025
|
}, [locale]);
|
|
2970
|
-
|
|
3026
|
+
useEffect12(() => {
|
|
2971
3027
|
if (matchToken) {
|
|
2972
3028
|
const tokenData = JSON.parse(atob(matchToken));
|
|
2973
3029
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -2978,7 +3034,7 @@ function useInit({
|
|
|
2978
3034
|
}
|
|
2979
3035
|
}
|
|
2980
3036
|
}, [matchToken]);
|
|
2981
|
-
|
|
3037
|
+
useEffect12(() => {
|
|
2982
3038
|
const onLoginMessage = (event) => {
|
|
2983
3039
|
const res = event.data;
|
|
2984
3040
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -3014,7 +3070,7 @@ function useInit({
|
|
|
3014
3070
|
overviewLoadingRef.current = false;
|
|
3015
3071
|
}
|
|
3016
3072
|
};
|
|
3017
|
-
|
|
3073
|
+
useEffect12(() => {
|
|
3018
3074
|
if (token) {
|
|
3019
3075
|
loadOverview();
|
|
3020
3076
|
}
|