@matchain/matchid-sdk-react 0.1.34 → 0.1.36
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 +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +160 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -98
- package/dist/index.mjs.map +1 -1
- 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 = ({
|
|
@@ -2081,75 +2121,76 @@ function LoginBox({
|
|
|
2081
2121
|
walletMethods = ["evm"],
|
|
2082
2122
|
inModal = false
|
|
2083
2123
|
}) {
|
|
2084
|
-
const [emailOpen, setEmailOpen] = (0,
|
|
2124
|
+
const [emailOpen, setEmailOpen] = (0, import_react12.useState)(false);
|
|
2085
2125
|
const { login } = useUserInfo();
|
|
2086
|
-
const [showWallet, setShowWallet] = (0,
|
|
2126
|
+
const [showWallet, setShowWallet] = (0, import_react12.useState)(false);
|
|
2087
2127
|
const intl = (0, import_react_intl6.useIntl)();
|
|
2128
|
+
const isDownMd = useDownMd();
|
|
2088
2129
|
const methodMap = {
|
|
2089
2130
|
wallet: {
|
|
2090
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WalletIcon, {}),
|
|
2131
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WalletIcon, { size: isDownMd ? 36 : 40 }),
|
|
2091
2132
|
name: intl.formatMessage({ id: "wallet" }),
|
|
2092
2133
|
onClick: () => setShowWallet(!showWallet),
|
|
2093
2134
|
type: "wallet"
|
|
2094
2135
|
},
|
|
2095
2136
|
email: {
|
|
2096
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EmailIcon, {}),
|
|
2137
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EmailIcon, { size: isDownMd ? 36 : 40 }),
|
|
2097
2138
|
name: intl.formatMessage({ id: "email" }),
|
|
2098
2139
|
onClick: () => {
|
|
2099
2140
|
setEmailOpen(true);
|
|
2100
2141
|
}
|
|
2101
2142
|
},
|
|
2102
2143
|
google: {
|
|
2103
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GoogleIcon, {}),
|
|
2144
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GoogleIcon, { size: isDownMd ? 36 : 40 }),
|
|
2104
2145
|
name: "Google",
|
|
2105
2146
|
onClick: () => login("google")
|
|
2106
2147
|
},
|
|
2107
2148
|
twitter: {
|
|
2108
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(XIcon, {}),
|
|
2149
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(XIcon, { size: isDownMd ? 36 : 40 }),
|
|
2109
2150
|
name: "X",
|
|
2110
2151
|
onClick: () => login("twitter")
|
|
2111
2152
|
},
|
|
2112
2153
|
telegram: {
|
|
2113
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TelegramIcon, {}),
|
|
2154
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TelegramIcon, { size: isDownMd ? 36 : 40 }),
|
|
2114
2155
|
name: "Telegram",
|
|
2115
2156
|
onClick: () => login("telegram")
|
|
2116
2157
|
},
|
|
2117
2158
|
github: {
|
|
2118
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GithubIcon, {}),
|
|
2159
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GithubIcon, { size: isDownMd ? 36 : 40 }),
|
|
2119
2160
|
name: "Github",
|
|
2120
2161
|
onClick: () => login("github")
|
|
2121
2162
|
},
|
|
2122
2163
|
discord: {
|
|
2123
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DiscordIcon, {}),
|
|
2164
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DiscordIcon, { size: isDownMd ? 36 : 40 }),
|
|
2124
2165
|
name: "Discord",
|
|
2125
2166
|
onClick: () => login("discord")
|
|
2126
2167
|
},
|
|
2127
2168
|
linkedin: {
|
|
2128
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LinkedinIcon, {}),
|
|
2169
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LinkedinIcon, { size: isDownMd ? 36 : 40 }),
|
|
2129
2170
|
name: "LinkedIn",
|
|
2130
2171
|
onClick: () => login("linkedin")
|
|
2131
2172
|
},
|
|
2132
2173
|
facebook: {
|
|
2133
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FacebookIcon, {}),
|
|
2174
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FacebookIcon, { size: isDownMd ? 36 : 40 }),
|
|
2134
2175
|
name: "Facebook",
|
|
2135
2176
|
onClick: () => login("facebook")
|
|
2136
2177
|
},
|
|
2137
2178
|
youtube: {
|
|
2138
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(YoutubeIcon, {}),
|
|
2179
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(YoutubeIcon, { size: isDownMd ? 36 : 40 }),
|
|
2139
2180
|
name: "Youtube",
|
|
2140
2181
|
onClick: () => login("youtube")
|
|
2141
2182
|
}
|
|
2142
2183
|
};
|
|
2143
2184
|
const walletMap = {
|
|
2144
2185
|
evm: {
|
|
2145
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EVMDarkIcon, {}),
|
|
2146
|
-
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EVMLightIcon, {}),
|
|
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 }),
|
|
2147
2188
|
name: "EVM",
|
|
2148
2189
|
onClick: () => login("evm")
|
|
2149
2190
|
},
|
|
2150
2191
|
sol: {
|
|
2151
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SOLDarkIcon, {}),
|
|
2152
|
-
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SOLLightIcon, {}),
|
|
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 }),
|
|
2153
2194
|
name: "SOL",
|
|
2154
2195
|
onClick: () => login("sol")
|
|
2155
2196
|
}
|
|
@@ -2241,7 +2282,7 @@ function LoginBox({
|
|
|
2241
2282
|
}
|
|
2242
2283
|
|
|
2243
2284
|
// src/components/LoginButton/index.tsx
|
|
2244
|
-
var
|
|
2285
|
+
var import_react14 = require("react");
|
|
2245
2286
|
|
|
2246
2287
|
// src/components/LoginPanel/index.tsx
|
|
2247
2288
|
var import_react_intl7 = require("react-intl");
|
|
@@ -2251,13 +2292,14 @@ function LoginPanel({
|
|
|
2251
2292
|
onClose,
|
|
2252
2293
|
...props
|
|
2253
2294
|
}) {
|
|
2295
|
+
const isDownMd = useDownMd();
|
|
2254
2296
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "matchid-login-panel", children: [
|
|
2255
2297
|
header ? header : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "matchid-login-panel-header", children: [
|
|
2256
2298
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "matchid-login-panel-header-content", children: [
|
|
2257
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" }) }),
|
|
2258
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" }) })
|
|
2259
2301
|
] }),
|
|
2260
|
-
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 }) })
|
|
2261
2303
|
] }),
|
|
2262
2304
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-divide" }),
|
|
2263
2305
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "matchid-login-panel-box", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LoginBox, { ...props }) })
|
|
@@ -2283,7 +2325,7 @@ function LoginModal({
|
|
|
2283
2325
|
}
|
|
2284
2326
|
|
|
2285
2327
|
// src/components/UserPopover/index.tsx
|
|
2286
|
-
var
|
|
2328
|
+
var import_react13 = require("react");
|
|
2287
2329
|
|
|
2288
2330
|
// src/assets/icon/ProfileIcon.tsx
|
|
2289
2331
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
@@ -2315,7 +2357,7 @@ var import_react_intl8 = require("react-intl");
|
|
|
2315
2357
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2316
2358
|
function UserContent() {
|
|
2317
2359
|
const { logout, address, username } = useUserInfo();
|
|
2318
|
-
const [logouting, setLogouting] = (0,
|
|
2360
|
+
const [logouting, setLogouting] = (0, import_react13.useState)(false);
|
|
2319
2361
|
const onLogout = async () => {
|
|
2320
2362
|
if (logouting) return;
|
|
2321
2363
|
try {
|
|
@@ -2344,7 +2386,7 @@ function UserContent() {
|
|
|
2344
2386
|
const UserDivider = () => {
|
|
2345
2387
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `matchid-user-popover-divider` });
|
|
2346
2388
|
};
|
|
2347
|
-
const [usernameOpen, setUsernameOpen] = (0,
|
|
2389
|
+
const [usernameOpen, setUsernameOpen] = (0, import_react13.useState)(false);
|
|
2348
2390
|
const [copied, setCopied] = useCopyClipboard();
|
|
2349
2391
|
const intl = (0, import_react_intl8.useIntl)();
|
|
2350
2392
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "matchid-user-popover-content", children: [
|
|
@@ -2390,7 +2432,7 @@ function LoginButton({
|
|
|
2390
2432
|
}) {
|
|
2391
2433
|
const intl = (0, import_react_intl9.useIntl)();
|
|
2392
2434
|
const { isLogin, username } = useUserInfo();
|
|
2393
|
-
const [loginOpen, setLoginOpen] = (0,
|
|
2435
|
+
const [loginOpen, setLoginOpen] = (0, import_react14.useState)(false);
|
|
2394
2436
|
if (!isLogin) {
|
|
2395
2437
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
2396
2438
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -2418,7 +2460,7 @@ function LoginButton({
|
|
|
2418
2460
|
}
|
|
2419
2461
|
|
|
2420
2462
|
// src/components/UsernameModal/index.tsx
|
|
2421
|
-
var
|
|
2463
|
+
var import_react15 = require("react");
|
|
2422
2464
|
|
|
2423
2465
|
// src/assets/icon/InfoRoundIcon.tsx
|
|
2424
2466
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -2448,8 +2490,9 @@ var ValidItem = ({
|
|
|
2448
2490
|
success = false,
|
|
2449
2491
|
text
|
|
2450
2492
|
}) => {
|
|
2493
|
+
const isDownMd = useDownMd();
|
|
2451
2494
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
|
|
2452
|
-
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 }),
|
|
2453
2496
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: text })
|
|
2454
2497
|
] });
|
|
2455
2498
|
};
|
|
@@ -2461,22 +2504,23 @@ function UsernameModal({
|
|
|
2461
2504
|
}) {
|
|
2462
2505
|
const { username, refreshOverview } = useUserInfo();
|
|
2463
2506
|
const { isLogin } = useUserInfo();
|
|
2464
|
-
const [val, setVal] = (0,
|
|
2465
|
-
const [error, setError] = (0,
|
|
2466
|
-
|
|
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)(() => {
|
|
2467
2511
|
if (isOpen) {
|
|
2468
2512
|
setVal(username);
|
|
2469
2513
|
setError("");
|
|
2470
2514
|
}
|
|
2471
2515
|
}, [isOpen]);
|
|
2472
|
-
const isValid = (0,
|
|
2516
|
+
const isValid = (0, import_react15.useMemo)(() => {
|
|
2473
2517
|
return isValidUsername(val);
|
|
2474
2518
|
}, [val]);
|
|
2475
|
-
const isLength = (0,
|
|
2519
|
+
const isLength = (0, import_react15.useMemo)(() => {
|
|
2476
2520
|
return val.length >= 2 && val.length <= 32;
|
|
2477
2521
|
}, [val]);
|
|
2478
2522
|
const isSafe = isValid && isLength;
|
|
2479
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
2523
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react15.useState)(false);
|
|
2480
2524
|
const onSubmit = async () => {
|
|
2481
2525
|
if (isSubmitting) return;
|
|
2482
2526
|
try {
|
|
@@ -2530,10 +2574,10 @@ function UsernameModal({
|
|
|
2530
2574
|
}) })
|
|
2531
2575
|
] }),
|
|
2532
2576
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { disabled: !isSafe, loading: isSubmitting, style: {
|
|
2533
|
-
marginTop: "64px"
|
|
2577
|
+
marginTop: isDownMd ? "36px" : "64px"
|
|
2534
2578
|
}, onClick: onSubmit, size: "lg", block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_intl10.FormattedMessage, { id: "confirm" }) }),
|
|
2535
2579
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { style: {
|
|
2536
|
-
marginTop: "24px"
|
|
2580
|
+
marginTop: isDownMd ? "12px" : "24px"
|
|
2537
2581
|
}, onClick: props.onClose, size: "lg", block: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_intl10.FormattedMessage, { id: "nextTime" }) })
|
|
2538
2582
|
] }) });
|
|
2539
2583
|
}
|
|
@@ -2572,17 +2616,17 @@ function WalletContent({
|
|
|
2572
2616
|
const { setVisible, visible } = (0, import_wallet_adapter_react_ui.useWalletModal)();
|
|
2573
2617
|
const wallet = (0, import_wallet_adapter_react.useWallet)();
|
|
2574
2618
|
const { events, login } = useMatch();
|
|
2575
|
-
const [status, setStatus] = (0,
|
|
2576
|
-
const statusRef =
|
|
2577
|
-
const [error, setError] = (0,
|
|
2578
|
-
(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)(() => {
|
|
2579
2623
|
const init = async () => {
|
|
2580
2624
|
await wallet.disconnect();
|
|
2581
2625
|
setVisible(true);
|
|
2582
2626
|
};
|
|
2583
2627
|
init();
|
|
2584
2628
|
}, []);
|
|
2585
|
-
(0,
|
|
2629
|
+
(0, import_react16.useEffect)(() => {
|
|
2586
2630
|
if (wallet.connected) {
|
|
2587
2631
|
console.log("wallet.connected", wallet.connected);
|
|
2588
2632
|
toLoginInWallet();
|
|
@@ -2643,7 +2687,7 @@ function WalletContent({
|
|
|
2643
2687
|
statusRef.current = "";
|
|
2644
2688
|
}
|
|
2645
2689
|
};
|
|
2646
|
-
const pageData = (0,
|
|
2690
|
+
const pageData = (0, import_react16.useMemo)(() => {
|
|
2647
2691
|
if (status == "success") {
|
|
2648
2692
|
return {
|
|
2649
2693
|
btnText: "Disconnect Wallet",
|
|
@@ -2810,7 +2854,7 @@ var Providers = ({ children }) => {
|
|
|
2810
2854
|
var context_default = Providers;
|
|
2811
2855
|
|
|
2812
2856
|
// src/hooks/useWalletInit.ts
|
|
2813
|
-
var
|
|
2857
|
+
var import_react17 = require("react");
|
|
2814
2858
|
var AppClientId2 = getAppClientId();
|
|
2815
2859
|
function useWalletInit({
|
|
2816
2860
|
refreshOverview
|
|
@@ -2819,10 +2863,10 @@ function useWalletInit({
|
|
|
2819
2863
|
const getWalletIframe = () => {
|
|
2820
2864
|
return document.getElementById("match-wallet");
|
|
2821
2865
|
};
|
|
2822
|
-
const [walletInited, setWalletInited] = (0,
|
|
2866
|
+
const [walletInited, setWalletInited] = (0, import_react17.useState)(false);
|
|
2823
2867
|
const { appid, token, overview } = useLocalStore_default();
|
|
2824
2868
|
const { initWallet, generateWallet } = useWallet();
|
|
2825
|
-
(0,
|
|
2869
|
+
(0, import_react17.useEffect)(() => {
|
|
2826
2870
|
if (endpoints.auth) {
|
|
2827
2871
|
if (!window.matchWalletMessageIdMap) {
|
|
2828
2872
|
window.matchWalletMessageIdMap = {};
|
|
@@ -2880,7 +2924,7 @@ function useWalletInit({
|
|
|
2880
2924
|
}
|
|
2881
2925
|
}
|
|
2882
2926
|
}, [endpoints.auth]);
|
|
2883
|
-
(0,
|
|
2927
|
+
(0, import_react17.useEffect)(() => {
|
|
2884
2928
|
const messageHandle = async (e) => {
|
|
2885
2929
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
2886
2930
|
return;
|
|
@@ -2913,7 +2957,7 @@ function useWalletInit({
|
|
|
2913
2957
|
window.removeEventListener("message", messageHandle);
|
|
2914
2958
|
};
|
|
2915
2959
|
}, []);
|
|
2916
|
-
(0,
|
|
2960
|
+
(0, import_react17.useEffect)(() => {
|
|
2917
2961
|
if (token && overview && overview.did && walletInited) {
|
|
2918
2962
|
const did = overview.did.split(":")[2];
|
|
2919
2963
|
const newUserInit = async () => {
|
|
@@ -2944,7 +2988,7 @@ function useWalletInit({
|
|
|
2944
2988
|
}
|
|
2945
2989
|
|
|
2946
2990
|
// src/hooks/useInit.tsx
|
|
2947
|
-
var
|
|
2991
|
+
var import_react18 = require("react");
|
|
2948
2992
|
function useInit({
|
|
2949
2993
|
theme,
|
|
2950
2994
|
appid,
|
|
@@ -2963,23 +3007,23 @@ function useInit({
|
|
|
2963
3007
|
setLocale,
|
|
2964
3008
|
locale: realLocale
|
|
2965
3009
|
} = useLocalStore_default();
|
|
2966
|
-
const overviewLoadingRef = (0,
|
|
3010
|
+
const overviewLoadingRef = (0, import_react18.useRef)(false);
|
|
2967
3011
|
const searchParams = new URLSearchParams(window.location.search);
|
|
2968
3012
|
const matchToken = searchParams.get("matchToken");
|
|
2969
3013
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
2970
|
-
(0,
|
|
3014
|
+
(0, import_react18.useEffect)(() => {
|
|
2971
3015
|
setTheme(theme);
|
|
2972
3016
|
}, [theme]);
|
|
2973
|
-
(0,
|
|
3017
|
+
(0, import_react18.useEffect)(() => {
|
|
2974
3018
|
setAppid(appid);
|
|
2975
3019
|
}, [appid]);
|
|
2976
|
-
(0,
|
|
3020
|
+
(0, import_react18.useEffect)(() => {
|
|
2977
3021
|
setEndpoints(realEndpoints);
|
|
2978
3022
|
}, [realEndpoints]);
|
|
2979
|
-
(0,
|
|
3023
|
+
(0, import_react18.useEffect)(() => {
|
|
2980
3024
|
setLocale(locale || "en");
|
|
2981
3025
|
}, [locale]);
|
|
2982
|
-
(0,
|
|
3026
|
+
(0, import_react18.useEffect)(() => {
|
|
2983
3027
|
if (matchToken) {
|
|
2984
3028
|
const tokenData = JSON.parse(atob(matchToken));
|
|
2985
3029
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -2990,7 +3034,7 @@ function useInit({
|
|
|
2990
3034
|
}
|
|
2991
3035
|
}
|
|
2992
3036
|
}, [matchToken]);
|
|
2993
|
-
(0,
|
|
3037
|
+
(0, import_react18.useEffect)(() => {
|
|
2994
3038
|
const onLoginMessage = (event) => {
|
|
2995
3039
|
const res = event.data;
|
|
2996
3040
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -3026,7 +3070,7 @@ function useInit({
|
|
|
3026
3070
|
overviewLoadingRef.current = false;
|
|
3027
3071
|
}
|
|
3028
3072
|
};
|
|
3029
|
-
(0,
|
|
3073
|
+
(0, import_react18.useEffect)(() => {
|
|
3030
3074
|
if (token) {
|
|
3031
3075
|
loadOverview();
|
|
3032
3076
|
}
|
|
@@ -3454,7 +3498,7 @@ var messages = {
|
|
|
3454
3498
|
// src/MatchContext.tsx
|
|
3455
3499
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3456
3500
|
var queryClient = new import_react_query.QueryClient();
|
|
3457
|
-
var MatchContext = (0,
|
|
3501
|
+
var MatchContext = (0, import_react19.createContext)(void 0);
|
|
3458
3502
|
var MatchProvider = ({ children, appid, events, theme = "light", endpoints, locale }) => {
|
|
3459
3503
|
const { loadOverview, login, endpoints: realEndPoints, locale: realLocale } = useInit({
|
|
3460
3504
|
theme,
|
|
@@ -3489,7 +3533,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints, loca
|
|
|
3489
3533
|
) }) });
|
|
3490
3534
|
};
|
|
3491
3535
|
var useMatch = () => {
|
|
3492
|
-
const context = (0,
|
|
3536
|
+
const context = (0, import_react19.useContext)(MatchContext);
|
|
3493
3537
|
if (context === void 0) {
|
|
3494
3538
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
3495
3539
|
}
|