@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.js
CHANGED
|
@@ -40,7 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
module.exports = __toCommonJS(src_exports);
|
|
41
41
|
|
|
42
42
|
// src/MatchContext.tsx
|
|
43
|
-
var
|
|
43
|
+
var import_react19 = require("react");
|
|
44
44
|
|
|
45
45
|
// src/assets/icon/ArrowLeftIcon.tsx
|
|
46
46
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -360,24 +360,30 @@ function PasswordRoundIcon() {
|
|
|
360
360
|
|
|
361
361
|
// src/assets/icon/CloseEyeIcon.tsx
|
|
362
362
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
363
|
-
function CloseEyeIcon(
|
|
364
|
-
|
|
363
|
+
function CloseEyeIcon({
|
|
364
|
+
size = 20,
|
|
365
|
+
color = "#6E6E6E"
|
|
366
|
+
}) {
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
365
368
|
"path",
|
|
366
369
|
{
|
|
367
370
|
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",
|
|
368
|
-
fill:
|
|
371
|
+
fill: color
|
|
369
372
|
}
|
|
370
373
|
) });
|
|
371
374
|
}
|
|
372
375
|
|
|
373
376
|
// src/assets/icon/OpenEyeIcon.tsx
|
|
374
377
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
375
|
-
function OpenEyeIcon(
|
|
376
|
-
|
|
378
|
+
function OpenEyeIcon({
|
|
379
|
+
size = 20,
|
|
380
|
+
color = "#6E6E6E"
|
|
381
|
+
}) {
|
|
382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
377
383
|
"path",
|
|
378
384
|
{
|
|
379
385
|
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",
|
|
380
|
-
fill:
|
|
386
|
+
fill: color
|
|
381
387
|
}
|
|
382
388
|
) });
|
|
383
389
|
}
|
|
@@ -685,6 +691,26 @@ function ArrowDownIcon({ width = 20, height = 21, color = "black", ...props }) {
|
|
|
685
691
|
) });
|
|
686
692
|
}
|
|
687
693
|
|
|
694
|
+
// src/hooks/useLayout.tsx
|
|
695
|
+
var useLayout_exports = {};
|
|
696
|
+
__export(useLayout_exports, {
|
|
697
|
+
useDownMd: () => useDownMd
|
|
698
|
+
});
|
|
699
|
+
var import_react = require("react");
|
|
700
|
+
function useDownMd() {
|
|
701
|
+
const [isBelowMd, setIsBelowMd] = (0, import_react.useState)(window.matchMedia("(max-width: 767px)").matches);
|
|
702
|
+
(0, import_react.useEffect)(() => {
|
|
703
|
+
const handleResize = () => {
|
|
704
|
+
setIsBelowMd(window.matchMedia("(max-width: 767px)").matches);
|
|
705
|
+
};
|
|
706
|
+
window.addEventListener("resize", handleResize);
|
|
707
|
+
return () => {
|
|
708
|
+
window.removeEventListener("resize", handleResize);
|
|
709
|
+
};
|
|
710
|
+
}, []);
|
|
711
|
+
return isBelowMd;
|
|
712
|
+
}
|
|
713
|
+
|
|
688
714
|
// src/components/Modal/index.tsx
|
|
689
715
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
690
716
|
function Modal({
|
|
@@ -701,9 +727,12 @@ function Modal({
|
|
|
701
727
|
style: {
|
|
702
728
|
zIndex
|
|
703
729
|
},
|
|
704
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.
|
|
730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `matchid-modal ${className}`, style: {
|
|
705
731
|
width
|
|
706
|
-
}, children
|
|
732
|
+
}, children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "matchid-modal-mobile-header" }),
|
|
734
|
+
children
|
|
735
|
+
] })
|
|
707
736
|
}
|
|
708
737
|
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {});
|
|
709
738
|
}
|
|
@@ -716,23 +745,24 @@ function ModalWithHeader({
|
|
|
716
745
|
showClose = true,
|
|
717
746
|
...props
|
|
718
747
|
}) {
|
|
748
|
+
const isDownMd = useDownMd();
|
|
719
749
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Modal, { ...props, children: [
|
|
720
750
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
|
|
721
751
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "matchid-modal-header-content", children: [
|
|
722
|
-
onBack && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ArrowLeftIcon, { className: "matchid-modal-header-back", onClick: onBack }),
|
|
752
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ArrowLeftIcon, { height: isDownMd ? 20 : 25, width: isDownMd ? 20 : 24, className: "matchid-modal-header-back", onClick: onBack }),
|
|
723
753
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "matchid-modal-header-title", children: title })
|
|
724
754
|
] }),
|
|
725
|
-
onClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
|
|
755
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CloseRoundIcon, { size: isDownMd ? 24 : 30, className: "matchid-modal-header-close", onClick: onClose })
|
|
726
756
|
] }),
|
|
727
757
|
children
|
|
728
758
|
] });
|
|
729
759
|
}
|
|
730
760
|
|
|
731
761
|
// src/components/PasswordModal/index.tsx
|
|
732
|
-
var
|
|
762
|
+
var import_react6 = require("react");
|
|
733
763
|
|
|
734
764
|
// src/components/Input/index.tsx
|
|
735
|
-
var
|
|
765
|
+
var import_react2 = require("react");
|
|
736
766
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
737
767
|
function Input({
|
|
738
768
|
onChange,
|
|
@@ -741,21 +771,29 @@ function Input({
|
|
|
741
771
|
className = "",
|
|
742
772
|
...props
|
|
743
773
|
}) {
|
|
744
|
-
const [inputType, setInputType] = (0,
|
|
774
|
+
const [inputType, setInputType] = (0, import_react2.useState)(type);
|
|
775
|
+
const isDownMd = useDownMd();
|
|
745
776
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
746
777
|
"div",
|
|
747
778
|
{
|
|
748
|
-
className: `matchid-input-box ${props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
|
|
779
|
+
className: `matchid-input-box ${props.value && props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
|
|
749
780
|
children: [
|
|
750
781
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
|
|
751
|
-
props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "matchid-input-delete-icon", onClick: (e) => {
|
|
782
|
+
props.value && props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "matchid-input-delete-icon", onClick: (e) => {
|
|
752
783
|
if (onChange) {
|
|
753
784
|
onChange({ target: { value: "" } });
|
|
754
785
|
}
|
|
755
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
786
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
787
|
+
DeleteRoundIcon,
|
|
788
|
+
{
|
|
789
|
+
height: isDownMd ? 16 : 21,
|
|
790
|
+
width: isDownMd ? 16 : 20,
|
|
791
|
+
color: "var(--matchid-input-delete-icon-color)"
|
|
792
|
+
}
|
|
793
|
+
) }),
|
|
756
794
|
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
|
|
757
795
|
setInputType(inputType === "password" ? "text" : "password");
|
|
758
|
-
}, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CloseEyeIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(OpenEyeIcon, {}) }),
|
|
796
|
+
}, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CloseEyeIcon, { size: isDownMd ? 16 : 20 }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(OpenEyeIcon, { size: isDownMd ? 16 : 20 }) }),
|
|
759
797
|
after
|
|
760
798
|
]
|
|
761
799
|
}
|
|
@@ -820,6 +858,7 @@ function Button({
|
|
|
820
858
|
var hooks_exports = {};
|
|
821
859
|
__export(hooks_exports, {
|
|
822
860
|
useCopyClipboard: () => useCopyClipboard,
|
|
861
|
+
useLayout: () => useLayout_exports,
|
|
823
862
|
useMatchEvents: () => useMatchEvents,
|
|
824
863
|
useUserInfo: () => useUserInfo,
|
|
825
864
|
useWallet: () => useWallet
|
|
@@ -865,7 +904,7 @@ var localStore = useLocalStore;
|
|
|
865
904
|
var useLocalStore_default = useLocalStore;
|
|
866
905
|
|
|
867
906
|
// src/hooks/useUserInfo.tsx
|
|
868
|
-
var
|
|
907
|
+
var import_react3 = require("react");
|
|
869
908
|
|
|
870
909
|
// src/api/request.ts
|
|
871
910
|
var import_axios = __toESM(require("axios"));
|
|
@@ -1215,7 +1254,7 @@ function useUserInfo() {
|
|
|
1215
1254
|
} = useLocalStore_default();
|
|
1216
1255
|
const { events, login } = useMatch();
|
|
1217
1256
|
const { open: SOLOpen } = useSOLModalStore();
|
|
1218
|
-
const isLogin = (0,
|
|
1257
|
+
const isLogin = (0, import_react3.useMemo)(() => !!token, [token]);
|
|
1219
1258
|
const logout = async () => {
|
|
1220
1259
|
try {
|
|
1221
1260
|
await toLogoutApi();
|
|
@@ -1392,9 +1431,9 @@ function useUserInfo() {
|
|
|
1392
1431
|
}
|
|
1393
1432
|
|
|
1394
1433
|
// src/hooks/useMatchEvents.ts
|
|
1395
|
-
var
|
|
1434
|
+
var import_react4 = require("react");
|
|
1396
1435
|
function useMatchEvents(handlers) {
|
|
1397
|
-
(0,
|
|
1436
|
+
(0, import_react4.useEffect)(() => {
|
|
1398
1437
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
1399
1438
|
if (handler2) {
|
|
1400
1439
|
eventManager_default.on(event, handler2);
|
|
@@ -1558,14 +1597,14 @@ function useWallet() {
|
|
|
1558
1597
|
|
|
1559
1598
|
// src/hooks/useCopyClipboard.ts
|
|
1560
1599
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
1561
|
-
var
|
|
1600
|
+
var import_react5 = require("react");
|
|
1562
1601
|
function useCopyClipboard(timeout = 500) {
|
|
1563
|
-
const [isCopied, setIsCopied] = (0,
|
|
1564
|
-
const staticCopy = (0,
|
|
1602
|
+
const [isCopied, setIsCopied] = (0, import_react5.useState)(false);
|
|
1603
|
+
const staticCopy = (0, import_react5.useCallback)((text) => {
|
|
1565
1604
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
1566
1605
|
setIsCopied(didCopy);
|
|
1567
1606
|
}, []);
|
|
1568
|
-
(0,
|
|
1607
|
+
(0, import_react5.useEffect)(() => {
|
|
1569
1608
|
if (isCopied) {
|
|
1570
1609
|
const hide = setTimeout(() => {
|
|
1571
1610
|
setIsCopied(false);
|
|
@@ -1590,12 +1629,12 @@ function PasswordModal({
|
|
|
1590
1629
|
}) {
|
|
1591
1630
|
const { refreshOverview, overview } = useUserInfo();
|
|
1592
1631
|
const { isLogin, did } = useUserInfo();
|
|
1593
|
-
const [password, setPassword] = (0,
|
|
1594
|
-
const [rePassword, setRePassword] = (0,
|
|
1595
|
-
const [error, setError] = (0,
|
|
1632
|
+
const [password, setPassword] = (0, import_react6.useState)("");
|
|
1633
|
+
const [rePassword, setRePassword] = (0, import_react6.useState)("");
|
|
1634
|
+
const [error, setError] = (0, import_react6.useState)("");
|
|
1596
1635
|
const { generateWallet, initWallet } = useWallet();
|
|
1597
1636
|
const intl = (0, import_react_intl.useIntl)();
|
|
1598
|
-
const passwordError = (0,
|
|
1637
|
+
const passwordError = (0, import_react6.useMemo)(() => {
|
|
1599
1638
|
if (password.length < 6) return intl.formatMessage({
|
|
1600
1639
|
id: "passwordMinError"
|
|
1601
1640
|
}, {
|
|
@@ -1603,7 +1642,7 @@ function PasswordModal({
|
|
|
1603
1642
|
});
|
|
1604
1643
|
return "";
|
|
1605
1644
|
}, [password]);
|
|
1606
|
-
const rePasswordError = (0,
|
|
1645
|
+
const rePasswordError = (0, import_react6.useMemo)(() => {
|
|
1607
1646
|
if (rePassword != password) {
|
|
1608
1647
|
return intl.formatMessage({
|
|
1609
1648
|
id: "passwordMatchError"
|
|
@@ -1611,7 +1650,7 @@ function PasswordModal({
|
|
|
1611
1650
|
}
|
|
1612
1651
|
return "";
|
|
1613
1652
|
}, [rePassword, password]);
|
|
1614
|
-
(0,
|
|
1653
|
+
(0, import_react6.useEffect)(() => {
|
|
1615
1654
|
if (isOpen && overview) {
|
|
1616
1655
|
setPassword("");
|
|
1617
1656
|
setRePassword("");
|
|
@@ -1622,7 +1661,7 @@ function PasswordModal({
|
|
|
1622
1661
|
});
|
|
1623
1662
|
}
|
|
1624
1663
|
}, [isOpen, overview]);
|
|
1625
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
1664
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react6.useState)(false);
|
|
1626
1665
|
const onContinue = async () => {
|
|
1627
1666
|
if (isSubmitting) return;
|
|
1628
1667
|
try {
|
|
@@ -1688,7 +1727,7 @@ function PasswordModal({
|
|
|
1688
1727
|
}
|
|
1689
1728
|
|
|
1690
1729
|
// src/components/RecoveryModal/index.tsx
|
|
1691
|
-
var
|
|
1730
|
+
var import_react7 = require("react");
|
|
1692
1731
|
var import_react_intl2 = require("react-intl");
|
|
1693
1732
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1694
1733
|
function RecoveryModal({
|
|
@@ -1699,11 +1738,11 @@ function RecoveryModal({
|
|
|
1699
1738
|
}) {
|
|
1700
1739
|
const { refreshOverview } = useUserInfo();
|
|
1701
1740
|
const { isLogin, overview } = useUserInfo();
|
|
1702
|
-
const [password, setPassword] = (0,
|
|
1741
|
+
const [password, setPassword] = (0, import_react7.useState)("");
|
|
1703
1742
|
const { recoveryWallet, initWallet } = useWallet();
|
|
1704
|
-
const [error, setError] = (0,
|
|
1743
|
+
const [error, setError] = (0, import_react7.useState)("");
|
|
1705
1744
|
const intl = (0, import_react_intl2.useIntl)();
|
|
1706
|
-
const passwordError = (0,
|
|
1745
|
+
const passwordError = (0, import_react7.useMemo)(() => {
|
|
1707
1746
|
if (password.length < 6) return intl.formatMessage({
|
|
1708
1747
|
id: "passwordMinError"
|
|
1709
1748
|
}, {
|
|
@@ -1711,7 +1750,7 @@ function RecoveryModal({
|
|
|
1711
1750
|
});
|
|
1712
1751
|
return "";
|
|
1713
1752
|
}, [password]);
|
|
1714
|
-
(0,
|
|
1753
|
+
(0, import_react7.useEffect)(() => {
|
|
1715
1754
|
if (isOpen && overview) {
|
|
1716
1755
|
setPassword("");
|
|
1717
1756
|
const did = overview.did.split(":")[2];
|
|
@@ -1721,7 +1760,7 @@ function RecoveryModal({
|
|
|
1721
1760
|
});
|
|
1722
1761
|
}
|
|
1723
1762
|
}, [isOpen, overview]);
|
|
1724
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
1763
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react7.useState)(false);
|
|
1725
1764
|
const onContinue = async () => {
|
|
1726
1765
|
if (isSubmitting) return;
|
|
1727
1766
|
try {
|
|
@@ -1769,7 +1808,7 @@ function RecoveryModal({
|
|
|
1769
1808
|
}
|
|
1770
1809
|
|
|
1771
1810
|
// src/components/SOLModal/index.tsx
|
|
1772
|
-
var
|
|
1811
|
+
var import_react16 = __toESM(require("react"));
|
|
1773
1812
|
|
|
1774
1813
|
// src/components/index.tsx
|
|
1775
1814
|
var components_exports = {};
|
|
@@ -1791,21 +1830,21 @@ __export(components_exports, {
|
|
|
1791
1830
|
});
|
|
1792
1831
|
|
|
1793
1832
|
// src/components/EmailModal/index.tsx
|
|
1794
|
-
var
|
|
1833
|
+
var import_react10 = require("react");
|
|
1795
1834
|
|
|
1796
1835
|
// src/components/EmailModal/StepEmail.tsx
|
|
1797
|
-
var
|
|
1836
|
+
var import_react8 = require("react");
|
|
1798
1837
|
var import_react_intl3 = require("react-intl");
|
|
1799
1838
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1800
1839
|
function StepEmail(props) {
|
|
1801
1840
|
const intl = (0, import_react_intl3.useIntl)();
|
|
1802
|
-
const [emailVal, setEmailVal] = (0,
|
|
1803
|
-
(0,
|
|
1841
|
+
const [emailVal, setEmailVal] = (0, import_react8.useState)("");
|
|
1842
|
+
(0, import_react8.useEffect)(() => {
|
|
1804
1843
|
if (props.email) {
|
|
1805
1844
|
setEmailVal(props.email);
|
|
1806
1845
|
}
|
|
1807
1846
|
}, []);
|
|
1808
|
-
const canContinue = (0,
|
|
1847
|
+
const canContinue = (0, import_react8.useMemo)(() => {
|
|
1809
1848
|
return isValidEmail(emailVal);
|
|
1810
1849
|
}, [emailVal]);
|
|
1811
1850
|
const onContinue = async () => {
|
|
@@ -1831,7 +1870,7 @@ function StepEmail(props) {
|
|
|
1831
1870
|
}
|
|
1832
1871
|
|
|
1833
1872
|
// src/components/EmailModal/StepVerify.tsx
|
|
1834
|
-
var
|
|
1873
|
+
var import_react9 = require("react");
|
|
1835
1874
|
|
|
1836
1875
|
// src/config/index.tsx
|
|
1837
1876
|
var EMAIL_INTERVAL = 60;
|
|
@@ -1843,17 +1882,18 @@ var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
|
1843
1882
|
function StepVerify(props) {
|
|
1844
1883
|
const intl = (0, import_react_intl4.useIntl)();
|
|
1845
1884
|
const { getLoginEmailCode, loginByEmail } = useUserInfo();
|
|
1846
|
-
const [error, setError] = (0,
|
|
1847
|
-
const [code, setCode] = (0,
|
|
1848
|
-
const [sending, setSending] = (0,
|
|
1849
|
-
const [submitting, setSubmitting] = (0,
|
|
1850
|
-
const sendTimeRef = (0,
|
|
1851
|
-
const [sendBtnText, setSendBtnText] = (0,
|
|
1885
|
+
const [error, setError] = (0, import_react9.useState)("");
|
|
1886
|
+
const [code, setCode] = (0, import_react9.useState)("");
|
|
1887
|
+
const [sending, setSending] = (0, import_react9.useState)(false);
|
|
1888
|
+
const [submitting, setSubmitting] = (0, import_react9.useState)(false);
|
|
1889
|
+
const sendTimeRef = (0, import_react9.useRef)(0);
|
|
1890
|
+
const [sendBtnText, setSendBtnText] = (0, import_react9.useState)(intl.formatMessage({
|
|
1852
1891
|
id: "send"
|
|
1853
1892
|
}));
|
|
1854
1893
|
const intervalTime = EMAIL_INTERVAL;
|
|
1855
1894
|
const codeLength = EMAIL_CODE_LENGTH;
|
|
1856
|
-
const intervalRef = (0,
|
|
1895
|
+
const intervalRef = (0, import_react9.useRef)(null);
|
|
1896
|
+
const isDownMd = useDownMd();
|
|
1857
1897
|
const onSend = async () => {
|
|
1858
1898
|
if (sendTimeRef.current > 0) {
|
|
1859
1899
|
return;
|
|
@@ -1883,7 +1923,7 @@ function StepVerify(props) {
|
|
|
1883
1923
|
setSending(false);
|
|
1884
1924
|
}
|
|
1885
1925
|
};
|
|
1886
|
-
(0,
|
|
1926
|
+
(0, import_react9.useEffect)(() => {
|
|
1887
1927
|
onSend();
|
|
1888
1928
|
return () => {
|
|
1889
1929
|
if (intervalRef.current) {
|
|
@@ -1891,7 +1931,7 @@ function StepVerify(props) {
|
|
|
1891
1931
|
}
|
|
1892
1932
|
};
|
|
1893
1933
|
}, []);
|
|
1894
|
-
const canContinue = (0,
|
|
1934
|
+
const canContinue = (0, import_react9.useMemo)(() => {
|
|
1895
1935
|
return code.length === codeLength;
|
|
1896
1936
|
}, [code]);
|
|
1897
1937
|
const onContinue = async () => {
|
|
@@ -1917,7 +1957,7 @@ function StepVerify(props) {
|
|
|
1917
1957
|
};
|
|
1918
1958
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "matchid-email-verify-box", children: [
|
|
1919
1959
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "matchid-email-verify-header", children: [
|
|
1920
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EmailLineIcon, {}) }),
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EmailLineIcon, { size: isDownMd ? 19 : 24 }) }),
|
|
1921
1961
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "matchid-email-verify-header-content", children: [
|
|
1922
1962
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "matchid-email-verify-header-value", children: props.email }),
|
|
1923
1963
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "matchid-email-verify-header-tips", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_intl4.FormattedMessage, { id: "sendEmailTips" }) })
|
|
@@ -1968,10 +2008,10 @@ function EmailModal({
|
|
|
1968
2008
|
onBack,
|
|
1969
2009
|
onLogin
|
|
1970
2010
|
}) {
|
|
1971
|
-
const [step, setStep] = (0,
|
|
1972
|
-
const [emailVal, setEmailVal] = (0,
|
|
2011
|
+
const [step, setStep] = (0, import_react10.useState)("input");
|
|
2012
|
+
const [emailVal, setEmailVal] = (0, import_react10.useState)("");
|
|
1973
2013
|
const intl = (0, import_react_intl5.useIntl)();
|
|
1974
|
-
(0,
|
|
2014
|
+
(0, import_react10.useEffect)(() => {
|
|
1975
2015
|
if (!isOpen) {
|
|
1976
2016
|
setStep("input");
|
|
1977
2017
|
setEmailVal("");
|
|
@@ -1996,7 +2036,7 @@ function EmailModal({
|
|
|
1996
2036
|
}
|
|
1997
2037
|
|
|
1998
2038
|
// src/components/Popover/index.tsx
|
|
1999
|
-
var
|
|
2039
|
+
var import_react11 = require("react");
|
|
2000
2040
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2001
2041
|
function Popover({
|
|
2002
2042
|
children,
|
|
@@ -2006,7 +2046,7 @@ function Popover({
|
|
|
2006
2046
|
className = "",
|
|
2007
2047
|
gap = "20px"
|
|
2008
2048
|
}) {
|
|
2009
|
-
const [active, setActive] = (0,
|
|
2049
|
+
const [active, setActive] = (0, import_react11.useState)(false);
|
|
2010
2050
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
2011
2051
|
"div",
|
|
2012
2052
|
{
|
|
@@ -2027,7 +2067,7 @@ function Popover({
|
|
|
2027
2067
|
}
|
|
2028
2068
|
|
|
2029
2069
|
// src/components/LoginBox/index.tsx
|
|
2030
|
-
var
|
|
2070
|
+
var import_react12 = require("react");
|
|
2031
2071
|
var import_react_intl6 = require("react-intl");
|
|
2032
2072
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2033
2073
|
var RecommendItem = ({
|
|
@@ -2078,81 +2118,83 @@ function LoginBox({
|
|
|
2078
2118
|
"telegram",
|
|
2079
2119
|
"twitter"
|
|
2080
2120
|
],
|
|
2121
|
+
walletMethods = ["evm"],
|
|
2081
2122
|
inModal = false
|
|
2082
2123
|
}) {
|
|
2083
|
-
const [emailOpen, setEmailOpen] = (0,
|
|
2124
|
+
const [emailOpen, setEmailOpen] = (0, import_react12.useState)(false);
|
|
2084
2125
|
const { login } = useUserInfo();
|
|
2085
|
-
const [showWallet, setShowWallet] = (0,
|
|
2126
|
+
const [showWallet, setShowWallet] = (0, import_react12.useState)(false);
|
|
2086
2127
|
const intl = (0, import_react_intl6.useIntl)();
|
|
2128
|
+
const isDownMd = useDownMd();
|
|
2087
2129
|
const methodMap = {
|
|
2088
2130
|
wallet: {
|
|
2089
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WalletIcon, {}),
|
|
2131
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WalletIcon, { size: isDownMd ? 36 : 40 }),
|
|
2090
2132
|
name: intl.formatMessage({ id: "wallet" }),
|
|
2091
2133
|
onClick: () => setShowWallet(!showWallet),
|
|
2092
2134
|
type: "wallet"
|
|
2093
2135
|
},
|
|
2094
2136
|
email: {
|
|
2095
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EmailIcon, {}),
|
|
2137
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EmailIcon, { size: isDownMd ? 36 : 40 }),
|
|
2096
2138
|
name: intl.formatMessage({ id: "email" }),
|
|
2097
2139
|
onClick: () => {
|
|
2098
2140
|
setEmailOpen(true);
|
|
2099
2141
|
}
|
|
2100
2142
|
},
|
|
2101
2143
|
google: {
|
|
2102
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GoogleIcon, {}),
|
|
2144
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GoogleIcon, { size: isDownMd ? 36 : 40 }),
|
|
2103
2145
|
name: "Google",
|
|
2104
2146
|
onClick: () => login("google")
|
|
2105
2147
|
},
|
|
2106
2148
|
twitter: {
|
|
2107
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(XIcon, {}),
|
|
2149
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(XIcon, { size: isDownMd ? 36 : 40 }),
|
|
2108
2150
|
name: "X",
|
|
2109
2151
|
onClick: () => login("twitter")
|
|
2110
2152
|
},
|
|
2111
2153
|
telegram: {
|
|
2112
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TelegramIcon, {}),
|
|
2154
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TelegramIcon, { size: isDownMd ? 36 : 40 }),
|
|
2113
2155
|
name: "Telegram",
|
|
2114
2156
|
onClick: () => login("telegram")
|
|
2115
2157
|
},
|
|
2116
2158
|
github: {
|
|
2117
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GithubIcon, {}),
|
|
2159
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GithubIcon, { size: isDownMd ? 36 : 40 }),
|
|
2118
2160
|
name: "Github",
|
|
2119
2161
|
onClick: () => login("github")
|
|
2120
2162
|
},
|
|
2121
2163
|
discord: {
|
|
2122
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DiscordIcon, {}),
|
|
2164
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DiscordIcon, { size: isDownMd ? 36 : 40 }),
|
|
2123
2165
|
name: "Discord",
|
|
2124
2166
|
onClick: () => login("discord")
|
|
2125
2167
|
},
|
|
2126
2168
|
linkedin: {
|
|
2127
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LinkedinIcon, {}),
|
|
2169
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LinkedinIcon, { size: isDownMd ? 36 : 40 }),
|
|
2128
2170
|
name: "LinkedIn",
|
|
2129
2171
|
onClick: () => login("linkedin")
|
|
2130
2172
|
},
|
|
2131
2173
|
facebook: {
|
|
2132
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FacebookIcon, {}),
|
|
2174
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FacebookIcon, { size: isDownMd ? 36 : 40 }),
|
|
2133
2175
|
name: "Facebook",
|
|
2134
2176
|
onClick: () => login("facebook")
|
|
2135
2177
|
},
|
|
2136
2178
|
youtube: {
|
|
2137
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(YoutubeIcon, {}),
|
|
2179
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(YoutubeIcon, { size: isDownMd ? 36 : 40 }),
|
|
2138
2180
|
name: "Youtube",
|
|
2139
2181
|
onClick: () => login("youtube")
|
|
2140
2182
|
}
|
|
2141
2183
|
};
|
|
2142
|
-
const
|
|
2143
|
-
{
|
|
2144
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EVMDarkIcon, {}),
|
|
2145
|
-
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EVMLightIcon, {}),
|
|
2184
|
+
const walletMap = {
|
|
2185
|
+
evm: {
|
|
2186
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EVMDarkIcon, { size: isDownMd ? 36 : 40 }),
|
|
2187
|
+
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EVMLightIcon, { size: isDownMd ? 36 : 40 }),
|
|
2146
2188
|
name: "EVM",
|
|
2147
2189
|
onClick: () => login("evm")
|
|
2148
2190
|
},
|
|
2149
|
-
{
|
|
2150
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SOLDarkIcon, {}),
|
|
2151
|
-
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SOLLightIcon, {}),
|
|
2191
|
+
sol: {
|
|
2192
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SOLDarkIcon, { size: isDownMd ? 36 : 40 }),
|
|
2193
|
+
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SOLLightIcon, { size: isDownMd ? 36 : 40 }),
|
|
2152
2194
|
name: "SOL",
|
|
2153
2195
|
onClick: () => login("sol")
|
|
2154
2196
|
}
|
|
2155
|
-
|
|
2197
|
+
};
|
|
2156
2198
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
2157
2199
|
(!inModal || !emailOpen) && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "matchid-login-box", children: [
|
|
2158
2200
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "matchid-login-recommend-list", children: recommendMethods.map((m) => {
|
|
@@ -2165,7 +2207,8 @@ function LoginBox({
|
|
|
2165
2207
|
showChildren: m == "wallet" && showWallet,
|
|
2166
2208
|
children: m == "wallet" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
2167
2209
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "matchid-login-recommend-wallet-divider" }),
|
|
2168
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "matchid-login-recommend-wallet-list", children: walletMethods.map((
|
|
2210
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "matchid-login-recommend-wallet-list", children: walletMethods.map((n) => {
|
|
2211
|
+
const m2 = walletMap[n];
|
|
2169
2212
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
2170
2213
|
"div",
|
|
2171
2214
|
{
|
|
@@ -2239,7 +2282,7 @@ function LoginBox({
|
|
|
2239
2282
|
}
|
|
2240
2283
|
|
|
2241
2284
|
// src/components/LoginButton/index.tsx
|
|
2242
|
-
var
|
|
2285
|
+
var import_react14 = require("react");
|
|
2243
2286
|
|
|
2244
2287
|
// src/components/LoginPanel/index.tsx
|
|
2245
2288
|
var import_react_intl7 = require("react-intl");
|
|
@@ -2249,13 +2292,14 @@ function LoginPanel({
|
|
|
2249
2292
|
onClose,
|
|
2250
2293
|
...props
|
|
2251
2294
|
}) {
|
|
2295
|
+
const isDownMd = useDownMd();
|
|
2252
2296
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "matchid-login-panel", children: [
|
|
2253
2297
|
header ? header : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "matchid-login-panel-header", children: [
|
|
2254
2298
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "matchid-login-panel-header-content", children: [
|
|
2255
2299
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-header-title", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_intl7.FormattedMessage, { id: "loginTitle" }) }),
|
|
2256
2300
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-header-subtilte", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_intl7.FormattedMessage, { id: "loginTips" }) })
|
|
2257
2301
|
] }),
|
|
2258
|
-
onClose && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseRoundIcon, {}) })
|
|
2302
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CloseRoundIcon, { size: isDownMd ? 24 : 30 }) })
|
|
2259
2303
|
] }),
|
|
2260
2304
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-divide" }),
|
|
2261
2305
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-box", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LoginBox, { ...props }) })
|
|
@@ -2281,7 +2325,7 @@ function LoginModal({
|
|
|
2281
2325
|
}
|
|
2282
2326
|
|
|
2283
2327
|
// src/components/UserPopover/index.tsx
|
|
2284
|
-
var
|
|
2328
|
+
var import_react13 = require("react");
|
|
2285
2329
|
|
|
2286
2330
|
// src/assets/icon/ProfileIcon.tsx
|
|
2287
2331
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
@@ -2313,7 +2357,7 @@ var import_react_intl8 = require("react-intl");
|
|
|
2313
2357
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2314
2358
|
function UserContent() {
|
|
2315
2359
|
const { logout, address, username } = useUserInfo();
|
|
2316
|
-
const [logouting, setLogouting] = (0,
|
|
2360
|
+
const [logouting, setLogouting] = (0, import_react13.useState)(false);
|
|
2317
2361
|
const onLogout = async () => {
|
|
2318
2362
|
if (logouting) return;
|
|
2319
2363
|
try {
|
|
@@ -2342,7 +2386,7 @@ function UserContent() {
|
|
|
2342
2386
|
const UserDivider = () => {
|
|
2343
2387
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `matchid-user-popover-divider` });
|
|
2344
2388
|
};
|
|
2345
|
-
const [usernameOpen, setUsernameOpen] = (0,
|
|
2389
|
+
const [usernameOpen, setUsernameOpen] = (0, import_react13.useState)(false);
|
|
2346
2390
|
const [copied, setCopied] = useCopyClipboard();
|
|
2347
2391
|
const intl = (0, import_react_intl8.useIntl)();
|
|
2348
2392
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "matchid-user-popover-content", children: [
|
|
@@ -2383,14 +2427,24 @@ function LoginButton({
|
|
|
2383
2427
|
popoverPosition = "right",
|
|
2384
2428
|
popoverType = "hover",
|
|
2385
2429
|
popoverGap = 20,
|
|
2430
|
+
walletMethods,
|
|
2386
2431
|
...props
|
|
2387
2432
|
}) {
|
|
2388
2433
|
const intl = (0, import_react_intl9.useIntl)();
|
|
2389
2434
|
const { isLogin, username } = useUserInfo();
|
|
2390
|
-
const [loginOpen, setLoginOpen] = (0,
|
|
2435
|
+
const [loginOpen, setLoginOpen] = (0, import_react14.useState)(false);
|
|
2391
2436
|
if (!isLogin) {
|
|
2392
2437
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
2393
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2439
|
+
LoginModal,
|
|
2440
|
+
{
|
|
2441
|
+
methods,
|
|
2442
|
+
walletMethods,
|
|
2443
|
+
recommendMethods,
|
|
2444
|
+
isOpen: loginOpen,
|
|
2445
|
+
onClose: () => setLoginOpen(false)
|
|
2446
|
+
}
|
|
2447
|
+
),
|
|
2394
2448
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Button, { className: "matchid-unlogin-btn", ...props, highlight: true, onClick: () => setLoginOpen(true), children: [
|
|
2395
2449
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(UnLoginIcon_default, {}),
|
|
2396
2450
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_intl9.FormattedMessage, { id: "login" }) })
|
|
@@ -2406,7 +2460,7 @@ function LoginButton({
|
|
|
2406
2460
|
}
|
|
2407
2461
|
|
|
2408
2462
|
// src/components/UsernameModal/index.tsx
|
|
2409
|
-
var
|
|
2463
|
+
var import_react15 = require("react");
|
|
2410
2464
|
|
|
2411
2465
|
// src/assets/icon/InfoRoundIcon.tsx
|
|
2412
2466
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -2436,8 +2490,9 @@ var ValidItem = ({
|
|
|
2436
2490
|
success = false,
|
|
2437
2491
|
text
|
|
2438
2492
|
}) => {
|
|
2493
|
+
const isDownMd = useDownMd();
|
|
2439
2494
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
|
|
2440
|
-
success ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CheckRoundIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(InfoRoundIcon, { size: 16 }),
|
|
2495
|
+
success ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CheckRoundIcon, { size: isDownMd ? 12 : 16 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(InfoRoundIcon, { size: isDownMd ? 12 : 16 }),
|
|
2441
2496
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: text })
|
|
2442
2497
|
] });
|
|
2443
2498
|
};
|
|
@@ -2449,22 +2504,23 @@ function UsernameModal({
|
|
|
2449
2504
|
}) {
|
|
2450
2505
|
const { username, refreshOverview } = useUserInfo();
|
|
2451
2506
|
const { isLogin } = useUserInfo();
|
|
2452
|
-
const [val, setVal] = (0,
|
|
2453
|
-
const [error, setError] = (0,
|
|
2454
|
-
|
|
2507
|
+
const [val, setVal] = (0, import_react15.useState)(username);
|
|
2508
|
+
const [error, setError] = (0, import_react15.useState)("");
|
|
2509
|
+
const isDownMd = useDownMd();
|
|
2510
|
+
(0, import_react15.useEffect)(() => {
|
|
2455
2511
|
if (isOpen) {
|
|
2456
2512
|
setVal(username);
|
|
2457
2513
|
setError("");
|
|
2458
2514
|
}
|
|
2459
2515
|
}, [isOpen]);
|
|
2460
|
-
const isValid = (0,
|
|
2516
|
+
const isValid = (0, import_react15.useMemo)(() => {
|
|
2461
2517
|
return isValidUsername(val);
|
|
2462
2518
|
}, [val]);
|
|
2463
|
-
const isLength = (0,
|
|
2519
|
+
const isLength = (0, import_react15.useMemo)(() => {
|
|
2464
2520
|
return val.length >= 2 && val.length <= 32;
|
|
2465
2521
|
}, [val]);
|
|
2466
2522
|
const isSafe = isValid && isLength;
|
|
2467
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
2523
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react15.useState)(false);
|
|
2468
2524
|
const onSubmit = async () => {
|
|
2469
2525
|
if (isSubmitting) return;
|
|
2470
2526
|
try {
|
|
@@ -2518,10 +2574,10 @@ function UsernameModal({
|
|
|
2518
2574
|
}) })
|
|
2519
2575
|
] }),
|
|
2520
2576
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { disabled: !isSafe, loading: isSubmitting, style: {
|
|
2521
|
-
marginTop: "64px"
|
|
2577
|
+
marginTop: isDownMd ? "36px" : "64px"
|
|
2522
2578
|
}, onClick: onSubmit, size: "lg", block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_intl10.FormattedMessage, { id: "confirm" }) }),
|
|
2523
2579
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { style: {
|
|
2524
|
-
marginTop: "24px"
|
|
2580
|
+
marginTop: isDownMd ? "12px" : "24px"
|
|
2525
2581
|
}, onClick: props.onClose, size: "lg", block: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_intl10.FormattedMessage, { id: "nextTime" }) })
|
|
2526
2582
|
] }) });
|
|
2527
2583
|
}
|
|
@@ -2560,17 +2616,17 @@ function WalletContent({
|
|
|
2560
2616
|
const { setVisible, visible } = (0, import_wallet_adapter_react_ui.useWalletModal)();
|
|
2561
2617
|
const wallet = (0, import_wallet_adapter_react.useWallet)();
|
|
2562
2618
|
const { events, login } = useMatch();
|
|
2563
|
-
const [status, setStatus] = (0,
|
|
2564
|
-
const statusRef =
|
|
2565
|
-
const [error, setError] = (0,
|
|
2566
|
-
(0,
|
|
2619
|
+
const [status, setStatus] = (0, import_react16.useState)("");
|
|
2620
|
+
const statusRef = import_react16.default.useRef(status);
|
|
2621
|
+
const [error, setError] = (0, import_react16.useState)("");
|
|
2622
|
+
(0, import_react16.useEffect)(() => {
|
|
2567
2623
|
const init = async () => {
|
|
2568
2624
|
await wallet.disconnect();
|
|
2569
2625
|
setVisible(true);
|
|
2570
2626
|
};
|
|
2571
2627
|
init();
|
|
2572
2628
|
}, []);
|
|
2573
|
-
(0,
|
|
2629
|
+
(0, import_react16.useEffect)(() => {
|
|
2574
2630
|
if (wallet.connected) {
|
|
2575
2631
|
console.log("wallet.connected", wallet.connected);
|
|
2576
2632
|
toLoginInWallet();
|
|
@@ -2631,7 +2687,7 @@ function WalletContent({
|
|
|
2631
2687
|
statusRef.current = "";
|
|
2632
2688
|
}
|
|
2633
2689
|
};
|
|
2634
|
-
const pageData = (0,
|
|
2690
|
+
const pageData = (0, import_react16.useMemo)(() => {
|
|
2635
2691
|
if (status == "success") {
|
|
2636
2692
|
return {
|
|
2637
2693
|
btnText: "Disconnect Wallet",
|
|
@@ -2798,7 +2854,7 @@ var Providers = ({ children }) => {
|
|
|
2798
2854
|
var context_default = Providers;
|
|
2799
2855
|
|
|
2800
2856
|
// src/hooks/useWalletInit.ts
|
|
2801
|
-
var
|
|
2857
|
+
var import_react17 = require("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] = (0,
|
|
2866
|
+
const [walletInited, setWalletInited] = (0, import_react17.useState)(false);
|
|
2811
2867
|
const { appid, token, overview } = useLocalStore_default();
|
|
2812
2868
|
const { initWallet, generateWallet } = useWallet();
|
|
2813
|
-
(0,
|
|
2869
|
+
(0, import_react17.useEffect)(() => {
|
|
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
|
-
(0,
|
|
2927
|
+
(0, import_react17.useEffect)(() => {
|
|
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
|
-
(0,
|
|
2960
|
+
(0, import_react17.useEffect)(() => {
|
|
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
|
-
var
|
|
2991
|
+
var import_react18 = require("react");
|
|
2936
2992
|
function useInit({
|
|
2937
2993
|
theme,
|
|
2938
2994
|
appid,
|
|
@@ -2951,23 +3007,23 @@ function useInit({
|
|
|
2951
3007
|
setLocale,
|
|
2952
3008
|
locale: realLocale
|
|
2953
3009
|
} = useLocalStore_default();
|
|
2954
|
-
const overviewLoadingRef = (0,
|
|
3010
|
+
const overviewLoadingRef = (0, import_react18.useRef)(false);
|
|
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
|
-
(0,
|
|
3014
|
+
(0, import_react18.useEffect)(() => {
|
|
2959
3015
|
setTheme(theme);
|
|
2960
3016
|
}, [theme]);
|
|
2961
|
-
(0,
|
|
3017
|
+
(0, import_react18.useEffect)(() => {
|
|
2962
3018
|
setAppid(appid);
|
|
2963
3019
|
}, [appid]);
|
|
2964
|
-
(0,
|
|
3020
|
+
(0, import_react18.useEffect)(() => {
|
|
2965
3021
|
setEndpoints(realEndpoints);
|
|
2966
3022
|
}, [realEndpoints]);
|
|
2967
|
-
(0,
|
|
3023
|
+
(0, import_react18.useEffect)(() => {
|
|
2968
3024
|
setLocale(locale || "en");
|
|
2969
3025
|
}, [locale]);
|
|
2970
|
-
(0,
|
|
3026
|
+
(0, import_react18.useEffect)(() => {
|
|
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
|
-
(0,
|
|
3037
|
+
(0, import_react18.useEffect)(() => {
|
|
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
|
-
(0,
|
|
3073
|
+
(0, import_react18.useEffect)(() => {
|
|
3018
3074
|
if (token) {
|
|
3019
3075
|
loadOverview();
|
|
3020
3076
|
}
|
|
@@ -3442,7 +3498,7 @@ var messages = {
|
|
|
3442
3498
|
// src/MatchContext.tsx
|
|
3443
3499
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3444
3500
|
var queryClient = new import_react_query.QueryClient();
|
|
3445
|
-
var MatchContext = (0,
|
|
3501
|
+
var MatchContext = (0, import_react19.createContext)(void 0);
|
|
3446
3502
|
var MatchProvider = ({ children, appid, events, theme = "light", endpoints, locale }) => {
|
|
3447
3503
|
const { loadOverview, login, endpoints: realEndPoints, locale: realLocale } = useInit({
|
|
3448
3504
|
theme,
|
|
@@ -3477,7 +3533,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints, loca
|
|
|
3477
3533
|
) }) });
|
|
3478
3534
|
};
|
|
3479
3535
|
var useMatch = () => {
|
|
3480
|
-
const context = (0,
|
|
3536
|
+
const context = (0, import_react19.useContext)(MatchContext);
|
|
3481
3537
|
if (context === void 0) {
|
|
3482
3538
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
3483
3539
|
}
|