@matchain/matchid-sdk-react 0.1.17 → 0.1.18

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.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 import_react8 = require("react");
43
+ var import_react9 = require("react");
44
44
 
45
45
  // src/assets/icon/ArrowLeftIcon.tsx
46
46
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -187,7 +187,7 @@ var import_jsx_runtime8 = require("react/jsx-runtime");
187
187
  function EmailIcon({
188
188
  size = 40
189
189
  }) {
190
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", children: [
190
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 40 40", fill: "none", children: [
191
191
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("rect", { width: "40", height: "40", rx: "8", fill: "url(#paint0_linear_124_10994)" }),
192
192
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
193
193
  "path",
@@ -392,23 +392,144 @@ function DeleteRoundIcon({ height = 21, width = 20, color = "var(--matchid-error
392
392
  ] });
393
393
  }
394
394
 
395
- // src/components/Modal/index.tsx
395
+ // src/assets/icon/FacebookIcon.tsx
396
396
  var import_jsx_runtime20 = require("react/jsx-runtime");
397
+
398
+ // src/assets/icon/GithubIcon.tsx
399
+ var import_jsx_runtime21 = require("react/jsx-runtime");
400
+ function GithubIcon({
401
+ size = 40
402
+ }) {
403
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: size, height: size, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
404
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { width: "40", height: "40", rx: "8", fill: "black" }),
405
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
406
+ "path",
407
+ {
408
+ "fill-rule": "evenodd",
409
+ "clip-rule": "evenodd",
410
+ d: "M19.6836 7C16.434 7.00169 13.2909 8.15263 10.8165 10.247C8.34197 12.3414 6.69741 15.2427 6.17684 18.4321C5.65627 21.6215 6.29363 24.8911 7.97496 27.6561C9.6563 30.4211 12.272 32.5013 15.3542 33.5248C16.0343 33.651 16.2904 33.2295 16.2904 32.8712C16.2904 32.5128 16.2768 31.4738 16.2723 30.3379C12.4642 31.1606 11.6596 28.731 11.6596 28.731C11.0385 27.1533 10.1409 26.7386 10.1409 26.7386C8.89876 25.8957 10.2338 25.9115 10.2338 25.9115C11.6097 26.0084 12.3328 27.3156 12.3328 27.3156C13.5523 29.3958 15.5356 28.7941 16.3153 28.4425C16.4377 27.5613 16.7936 26.9618 17.1857 26.6214C14.1438 26.2789 10.9478 25.1114 10.9478 19.8961C10.929 18.5436 11.4338 17.2356 12.3577 16.2428C12.2172 15.9002 11.748 14.5164 12.4914 12.6367C12.4914 12.6367 13.6407 12.2716 16.2564 14.0318C18.5 13.4217 20.8672 13.4217 23.1108 14.0318C25.7243 12.2716 26.8712 12.6367 26.8712 12.6367C27.617 14.5119 27.1478 15.8957 27.0072 16.2428C27.9341 17.2358 28.4399 18.546 28.4194 19.9007C28.4194 25.1272 25.2166 26.2789 22.1701 26.6147C22.6597 27.0384 23.0972 27.8655 23.0972 29.1367C23.0972 30.9577 23.0814 32.4227 23.0814 32.8712C23.0814 33.234 23.3284 33.6577 24.022 33.5248C27.1047 32.5012 29.7206 30.4206 31.4019 27.6551C33.0832 24.8896 33.7202 21.6196 33.1991 18.4299C32.6779 15.2402 31.0325 12.3389 28.5572 10.2449C26.0819 8.15081 22.9381 7.00062 19.6881 7H19.6836Z",
411
+ fill: "white"
412
+ }
413
+ ),
414
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
415
+ "path",
416
+ {
417
+ d: "M11.1789 26.543C11.1495 26.6106 11.0407 26.6309 10.9523 26.5836C10.8639 26.5362 10.7982 26.4483 10.8299 26.3785C10.8616 26.3086 10.9682 26.2906 11.0566 26.3379C11.145 26.3852 11.2129 26.4754 11.1789 26.543Z",
418
+ fill: "white"
419
+ }
420
+ ),
421
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
422
+ "path",
423
+ {
424
+ d: "M11.7339 27.1582C11.687 27.1817 11.6333 27.1883 11.582 27.1768C11.5308 27.1652 11.4851 27.1364 11.4529 27.0951C11.3645 27.0004 11.3463 26.8697 11.4143 26.8111C11.4823 26.7525 11.6048 26.7796 11.6932 26.8742C11.7816 26.9689 11.8019 27.0996 11.7339 27.1582Z",
425
+ fill: "white"
426
+ }
427
+ ),
428
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
429
+ "path",
430
+ {
431
+ d: "M12.2738 27.9394C12.1899 27.998 12.0471 27.9394 11.9678 27.8222C11.9459 27.8012 11.9284 27.776 11.9165 27.7481C11.9046 27.7202 11.8984 27.6902 11.8984 27.6599C11.8984 27.6296 11.9046 27.5996 11.9165 27.5718C11.9284 27.5439 11.9459 27.5187 11.9678 27.4976C12.0517 27.4413 12.1945 27.4976 12.2738 27.6126C12.3531 27.7275 12.3554 27.8808 12.2738 27.9394Z",
432
+ fill: "white"
433
+ }
434
+ ),
435
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
436
+ "path",
437
+ {
438
+ d: "M13.0055 28.6975C12.9307 28.7809 12.7789 28.7584 12.6542 28.6457C12.5295 28.533 12.5001 28.3797 12.5749 28.2986C12.6497 28.2175 12.8015 28.24 12.9307 28.3505C13.0599 28.4609 13.0849 28.6164 13.0055 28.6975Z",
439
+ fill: "white"
440
+ }
441
+ ),
442
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
443
+ "path",
444
+ {
445
+ d: "M14.0325 29.1386C13.9985 29.2445 13.8444 29.2919 13.6902 29.2468C13.5361 29.2017 13.4341 29.0755 13.4636 28.9673C13.493 28.8591 13.6494 28.8095 13.8058 28.8591C13.9622 28.9087 14.062 29.0282 14.0325 29.1386Z",
446
+ fill: "white"
447
+ }
448
+ ),
449
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
450
+ "path",
451
+ {
452
+ d: "M15.1525 29.216C15.1525 29.3264 15.0256 29.421 14.8624 29.4233C14.6992 29.4256 14.5654 29.3354 14.5654 29.225C14.5654 29.1145 14.6924 29.0199 14.8556 29.0176C15.0188 29.0154 15.1525 29.1033 15.1525 29.216Z",
453
+ fill: "white"
454
+ }
455
+ ),
456
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
457
+ "path",
458
+ {
459
+ d: "M16.1947 29.0423C16.2151 29.1527 16.1018 29.2677 15.9386 29.2947C15.7754 29.3218 15.6326 29.2564 15.6122 29.1482C15.5918 29.0401 15.7096 28.9229 15.8683 28.8936C16.027 28.8643 16.1743 28.9319 16.1947 29.0423Z",
460
+ fill: "white"
461
+ }
462
+ )
463
+ ] });
464
+ }
465
+
466
+ // src/assets/icon/DiscordIcon.tsx
467
+ var import_jsx_runtime22 = require("react/jsx-runtime");
468
+ function DiscordIcon({
469
+ size = 40
470
+ }) {
471
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: size, height: size, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
472
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { width: "40", height: "40", rx: "8", fill: "#5865F2" }),
473
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
474
+ "path",
475
+ {
476
+ d: "M29.7032 10.8237C27.9186 9.97958 26.0048 9.35768 24.0039 9.00149C23.9674 8.99462 23.931 9.0118 23.9123 9.04616C23.6661 9.4974 23.3935 10.0861 23.2026 10.5488C21.0505 10.2167 18.9094 10.2167 16.8014 10.5488C16.6104 10.0758 16.3279 9.4974 16.0807 9.04616C16.0619 9.01295 16.0255 8.99577 15.9891 9.00149C13.9892 9.35654 12.0755 9.97844 10.2898 10.8237C10.2743 10.8306 10.261 10.842 10.2523 10.8569C6.62229 16.4471 5.62789 21.9 6.11571 27.2852C6.11792 27.3116 6.13226 27.3368 6.15213 27.3528C8.54708 29.1658 10.867 30.2664 13.1438 30.996C13.1803 31.0075 13.2189 30.9937 13.2421 30.9628C13.7806 30.2046 14.2607 29.4052 14.6724 28.5645C14.6967 28.5153 14.6735 28.4569 14.6238 28.4374C13.8623 28.1396 13.1372 27.7765 12.4397 27.3642C12.3845 27.331 12.3801 27.2497 12.4309 27.2107C12.5776 27.0974 12.7245 26.9794 12.8646 26.8603C12.89 26.8385 12.9253 26.8339 12.9551 26.8477C17.5375 29.0043 22.4985 29.0043 27.0268 26.8477C27.0566 26.8328 27.0919 26.8374 27.1184 26.8591C27.2586 26.9783 27.4054 27.0974 27.5533 27.2107C27.604 27.2497 27.6007 27.331 27.5455 27.3642C26.848 27.7845 26.1229 28.1396 25.3603 28.4362C25.3106 28.4557 25.2885 28.5153 25.3128 28.5645C25.7333 29.404 26.2134 30.2034 26.742 30.9616C26.7641 30.9937 26.8038 31.0075 26.8403 30.996C29.1282 30.2664 31.4481 29.1658 33.843 27.3528C33.864 27.3368 33.8772 27.3127 33.8794 27.2864C34.4633 21.0604 32.9016 15.6523 29.7396 10.858C29.7319 10.842 29.7186 10.8306 29.7032 10.8237ZM15.3567 24.0062C13.9771 24.0062 12.8403 22.7005 12.8403 21.0971C12.8403 19.4937 13.955 18.188 15.3567 18.188C16.7694 18.188 17.8951 19.5051 17.873 21.0971C17.873 22.7005 16.7583 24.0062 15.3567 24.0062ZM24.6605 24.0062C23.281 24.0062 22.1442 22.7005 22.1442 21.0971C22.1442 19.4937 23.2589 18.188 24.6605 18.188C26.0732 18.188 27.199 19.5051 27.1769 21.0971C27.1769 22.7005 26.0732 24.0062 24.6605 24.0062Z",
477
+ fill: "white"
478
+ }
479
+ )
480
+ ] });
481
+ }
482
+
483
+ // src/assets/icon/CheckIcon.tsx
484
+ var import_jsx_runtime23 = require("react/jsx-runtime");
485
+ function CheckIcon({
486
+ size = 20,
487
+ color = "black",
488
+ ...props
489
+ }) {
490
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
491
+ "path",
492
+ {
493
+ d: "M5 9.99996L8.33333 13.3333L15 6.66663",
494
+ stroke: color,
495
+ strokeWidth: "1.5",
496
+ strokeLinecap: "round",
497
+ strokeLinejoin: "round"
498
+ }
499
+ ) });
500
+ }
501
+
502
+ // src/assets/icon/CopyIcon.tsx
503
+ var import_jsx_runtime24 = require("react/jsx-runtime");
504
+ function CopyIcon({ size = 20, color = "black", ...props }) {
505
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
506
+ "path",
507
+ {
508
+ d: "M4.16673 12.5009C3.24625 12.5009 2.50006 11.7547 2.50006 10.8342V4.16752C2.50006 3.24705 3.24625 2.50085 4.16673 2.50085H10.8334C11.7539 2.50085 12.5001 3.24705 12.5001 4.16752M9.16673 17.5009H15.8334C16.7539 17.5009 17.5001 16.7547 17.5001 15.8342V9.16752C17.5001 8.24705 16.7539 7.50086 15.8334 7.50086H9.16673C8.24625 7.50086 7.50006 8.24705 7.50006 9.16752V15.8342C7.50006 16.7547 8.24625 17.5009 9.16673 17.5009Z",
509
+ stroke: color,
510
+ strokeWidth: "1.5",
511
+ strokeLinecap: "round"
512
+ }
513
+ ) });
514
+ }
515
+
516
+ // src/components/Modal/index.tsx
517
+ var import_jsx_runtime25 = require("react/jsx-runtime");
397
518
  function Modal({
398
519
  children,
399
520
  isOpen,
400
521
  width = 480,
401
522
  className = ""
402
523
  }) {
403
- return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
524
+ return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
404
525
  "div",
405
526
  {
406
527
  className: "matchid-overlay",
407
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `matchid-modal ${className}`, style: {
528
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `matchid-modal ${className}`, style: {
408
529
  width
409
530
  }, children })
410
531
  }
411
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {});
532
+ ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, {});
412
533
  }
413
534
  function ModalWithHeader({
414
535
  children,
@@ -419,24 +540,24 @@ function ModalWithHeader({
419
540
  showClose = true,
420
541
  ...props
421
542
  }) {
422
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Modal, { ...props, children: [
423
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
424
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "matchid-modal-header-content", children: [
425
- onBack && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArrowLeftIcon, { className: "matchid-modal-header-back", onClick: onBack }),
426
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "matchid-modal-header-title", children: title })
543
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Modal, { ...props, children: [
544
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
545
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "matchid-modal-header-content", children: [
546
+ onBack && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArrowLeftIcon, { className: "matchid-modal-header-back", onClick: onBack }),
547
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "matchid-modal-header-title", children: title })
427
548
  ] }),
428
- onClose && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
549
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
429
550
  ] }),
430
551
  children
431
552
  ] });
432
553
  }
433
554
 
434
555
  // src/components/PasswordModal/index.tsx
435
- var import_react4 = require("react");
556
+ var import_react5 = require("react");
436
557
 
437
558
  // src/components/Input/index.tsx
438
559
  var import_react = require("react");
439
- var import_jsx_runtime21 = require("react/jsx-runtime");
560
+ var import_jsx_runtime26 = require("react/jsx-runtime");
440
561
  function Input({
441
562
  onChange,
442
563
  type,
@@ -445,22 +566,22 @@ function Input({
445
566
  ...props
446
567
  }) {
447
568
  const [inputType, setInputType] = (0, import_react.useState)(type);
448
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `matchid-input-box ${props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`, children: [
449
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
450
- props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DeleteRoundIcon, { onClick: (e) => {
569
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `matchid-input-box ${props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`, children: [
570
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
571
+ props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DeleteRoundIcon, { onClick: (e) => {
451
572
  if (onChange) {
452
573
  onChange({ target: { value: "" } });
453
574
  }
454
575
  }, className: "matchid-input-delete-icon", color: "var(--matchid-input-delete-icon-color)" }),
455
- type === "password" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
576
+ type === "password" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
456
577
  setInputType(inputType === "password" ? "text" : "password");
457
- }, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CloseEyeIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OpenEyeIcon, {}) }),
578
+ }, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CloseEyeIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(OpenEyeIcon, {}) }),
458
579
  after
459
580
  ] });
460
581
  }
461
582
 
462
583
  // src/components/Field/index.tsx
463
- var import_jsx_runtime22 = require("react/jsx-runtime");
584
+ var import_jsx_runtime27 = require("react/jsx-runtime");
464
585
  function Field({
465
586
  label,
466
587
  children,
@@ -468,18 +589,18 @@ function Field({
468
589
  required,
469
590
  className = ""
470
591
  }) {
471
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `matchid-field-box ${className}`, children: [
472
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "matchid-field-label", children: [
473
- required && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "matchid-field-required", children: "*" }),
592
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `matchid-field-box ${className}`, children: [
593
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "matchid-field-label", children: [
594
+ required && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "matchid-field-required", children: "*" }),
474
595
  label
475
596
  ] }),
476
597
  children,
477
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "matchid-field-error", children: error })
598
+ error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "matchid-field-error", children: error })
478
599
  ] });
479
600
  }
480
601
 
481
602
  // src/components/Button/index.tsx
482
- var import_jsx_runtime23 = require("react/jsx-runtime");
603
+ var import_jsx_runtime28 = require("react/jsx-runtime");
483
604
  function Button({
484
605
  size = "df",
485
606
  disabled = false,
@@ -498,7 +619,7 @@ function Button({
498
619
  onClick && onClick();
499
620
  }
500
621
  };
501
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
622
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
502
623
  "button",
503
624
  {
504
625
  type,
@@ -508,7 +629,7 @@ function Button({
508
629
  ...style
509
630
  },
510
631
  onClick: onAction,
511
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
632
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
512
633
  }
513
634
  );
514
635
  }
@@ -516,6 +637,7 @@ function Button({
516
637
  // src/hooks/index.tsx
517
638
  var hooks_exports = {};
518
639
  __export(hooks_exports, {
640
+ useCopyClipboard: () => useCopyClipboard,
519
641
  useMatchEvents: () => useMatchEvents,
520
642
  useUserInfo: () => useUserInfo,
521
643
  useWallet: () => useWallet
@@ -865,10 +987,10 @@ function useUserInfo() {
865
987
  events && events.onLogout && events.onLogout();
866
988
  eventManager_default.emit("onLogout");
867
989
  };
868
- const loginByMethod = (method) => {
990
+ const loginByMethod = async (method) => {
869
991
  const link = `${endpoints.back}api/v1/auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.auth + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
870
992
  matchlog_default.log("link", link);
871
- const authWindow = window.open(
993
+ return window.open(
872
994
  link,
873
995
  // Replace with the actual authorization URL
874
996
  "authWindow",
@@ -876,10 +998,42 @@ function useUserInfo() {
876
998
  );
877
999
  };
878
1000
  const loginByTwitter = () => {
879
- loginByMethod("twitter");
1001
+ return loginByMethod("twitter");
880
1002
  };
881
1003
  const loginByGoogle = () => {
882
- loginByMethod("google");
1004
+ return loginByMethod("google");
1005
+ };
1006
+ const loginByWallet = async () => {
1007
+ return window.open(
1008
+ `${endpoints.auth}login/wallet?appid=${appid}`,
1009
+ // Replace with the actual authorization URL
1010
+ "_blank"
1011
+ // 'width=800,height=600'
1012
+ );
1013
+ };
1014
+ const loginByTelegram = async () => {
1015
+ return window.open(
1016
+ `${endpoints.auth}login/telegram?appid=${appid}`,
1017
+ // Replace with the actual authorization URL
1018
+ "authWindow",
1019
+ "width=800,height=600"
1020
+ );
1021
+ };
1022
+ const loginMethod = async (method) => {
1023
+ switch (method) {
1024
+ case "wallet":
1025
+ return await loginByWallet();
1026
+ case "telegram":
1027
+ return await loginByTelegram();
1028
+ case "twitter":
1029
+ case "google":
1030
+ case "discord":
1031
+ case "github":
1032
+ case "linkedin":
1033
+ return await loginByMethod(method);
1034
+ default:
1035
+ throw new Error("unsupported method");
1036
+ }
883
1037
  };
884
1038
  const getLoginEmailCode = async (email) => {
885
1039
  const res = await getEmailCodeApi(email);
@@ -915,22 +1069,6 @@ function useUserInfo() {
915
1069
  }
916
1070
  return false;
917
1071
  };
918
- const loginByWallet = () => {
919
- const authWindow = window.open(
920
- `${endpoints.auth}login/wallet?appid=${appid}`,
921
- // Replace with the actual authorization URL
922
- "_blank"
923
- // 'width=800,height=600'
924
- );
925
- };
926
- const loginByTelegram = () => {
927
- const authWindow = window.open(
928
- `${endpoints.auth}login/telegram?appid=${appid}`,
929
- // Replace with the actual authorization URL
930
- "authWindow",
931
- "width=800,height=600"
932
- );
933
- };
934
1072
  const refreshOverview = async () => {
935
1073
  const res = await getOverviewInfoApi();
936
1074
  if (res.data) {
@@ -965,7 +1103,30 @@ function useUserInfo() {
965
1103
  }
966
1104
  throw new Error(res.message);
967
1105
  };
1106
+ const bind = async (method) => {
1107
+ switch (method) {
1108
+ case "wallet":
1109
+ return await bindWallet();
1110
+ case "telegram":
1111
+ return await bindTelegram();
1112
+ case "twitter":
1113
+ case "google":
1114
+ case "discord":
1115
+ case "github":
1116
+ case "linkedin":
1117
+ const link = `${endpoints.back}api/v1/auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.auth + "bind/" + method)}&authorization=${token.includes("Bearer ") ? token.split(" ")[1] : token}`;
1118
+ matchlog_default.log("link", link);
1119
+ return window.open(
1120
+ link,
1121
+ "authWindow",
1122
+ "width=800,height=600"
1123
+ );
1124
+ default:
1125
+ throw new Error("unsupported method");
1126
+ }
1127
+ };
968
1128
  return {
1129
+ loginByMethod,
969
1130
  loginByTelegram,
970
1131
  loginByTwitter,
971
1132
  loginByGoogle,
@@ -983,7 +1144,9 @@ function useUserInfo() {
983
1144
  bindWallet,
984
1145
  bindTelegram,
985
1146
  username: overview?.username || "",
986
- auth
1147
+ auth,
1148
+ login: loginMethod,
1149
+ bind
987
1150
  };
988
1151
  }
989
1152
 
@@ -1152,8 +1315,31 @@ function useWallet() {
1152
1315
  };
1153
1316
  }
1154
1317
 
1318
+ // src/hooks/useCopyClipboard.ts
1319
+ var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
1320
+ var import_react4 = require("react");
1321
+ function useCopyClipboard(timeout = 500) {
1322
+ const [isCopied, setIsCopied] = (0, import_react4.useState)(false);
1323
+ const staticCopy = (0, import_react4.useCallback)((text) => {
1324
+ const didCopy = (0, import_copy_to_clipboard.default)(text);
1325
+ setIsCopied(didCopy);
1326
+ }, []);
1327
+ (0, import_react4.useEffect)(() => {
1328
+ if (isCopied) {
1329
+ const hide = setTimeout(() => {
1330
+ setIsCopied(false);
1331
+ }, timeout);
1332
+ return () => {
1333
+ clearTimeout(hide);
1334
+ };
1335
+ }
1336
+ return void 0;
1337
+ }, [isCopied, setIsCopied, timeout]);
1338
+ return [isCopied, staticCopy];
1339
+ }
1340
+
1155
1341
  // src/components/PasswordModal/index.tsx
1156
- var import_jsx_runtime24 = require("react/jsx-runtime");
1342
+ var import_jsx_runtime29 = require("react/jsx-runtime");
1157
1343
  function PasswordModal({
1158
1344
  title,
1159
1345
  isOpen,
@@ -1162,27 +1348,27 @@ function PasswordModal({
1162
1348
  }) {
1163
1349
  const { refreshOverview } = useUserInfo();
1164
1350
  const { isLogin, did } = useUserInfo();
1165
- const [password, setPassword] = (0, import_react4.useState)("");
1166
- const [rePassword, setRePassword] = (0, import_react4.useState)("");
1167
- const [error, setError] = (0, import_react4.useState)("");
1351
+ const [password, setPassword] = (0, import_react5.useState)("");
1352
+ const [rePassword, setRePassword] = (0, import_react5.useState)("");
1353
+ const [error, setError] = (0, import_react5.useState)("");
1168
1354
  const { generateWallet } = useWallet();
1169
- const passwordError = (0, import_react4.useMemo)(() => {
1355
+ const passwordError = (0, import_react5.useMemo)(() => {
1170
1356
  if (password.length < 6) return "Password must be at least 6 characters";
1171
1357
  return "";
1172
1358
  }, [password]);
1173
- const rePasswordError = (0, import_react4.useMemo)(() => {
1359
+ const rePasswordError = (0, import_react5.useMemo)(() => {
1174
1360
  if (rePassword != password) {
1175
1361
  return "The password you entered twice do not match";
1176
1362
  }
1177
1363
  return "";
1178
1364
  }, [rePassword, password]);
1179
- (0, import_react4.useEffect)(() => {
1365
+ (0, import_react5.useEffect)(() => {
1180
1366
  if (isOpen) {
1181
1367
  setPassword("");
1182
1368
  setRePassword("");
1183
1369
  }
1184
1370
  }, [isOpen]);
1185
- const [isSubmitting, setIsSubmitting] = (0, import_react4.useState)(false);
1371
+ const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1186
1372
  const onContinue = async () => {
1187
1373
  if (isSubmitting) return;
1188
1374
  try {
@@ -1199,13 +1385,13 @@ function PasswordModal({
1199
1385
  setIsSubmitting(false);
1200
1386
  }
1201
1387
  };
1202
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Set Password", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "matchid-password-box", children: [
1203
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "matchid-password-header", children: [
1204
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PasswordRoundIcon, {}) }),
1205
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "matchid-password-header-content", children: "Please set the wallet password that will be used to recover the wallet" })
1388
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Set Password", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "matchid-password-box", children: [
1389
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "matchid-password-header", children: [
1390
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PasswordRoundIcon, {}) }),
1391
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "matchid-password-header-content", children: "Please set the wallet password that will be used to recover the wallet" })
1206
1392
  ] }),
1207
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "matchid-password-content", children: [
1208
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Field, { label: "Password", error: password.length > 0 && passwordError, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1393
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "matchid-password-content", children: [
1394
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Field, { label: "Password", error: password.length > 0 && passwordError, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1209
1395
  Input,
1210
1396
  {
1211
1397
  placeholder: "Enter the Password",
@@ -1215,7 +1401,7 @@ function PasswordModal({
1215
1401
  value: password
1216
1402
  }
1217
1403
  ) }),
1218
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Field, { label: "Re Password", error: rePassword.length > 0 ? rePasswordError || error : error, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1404
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Field, { label: "Re Password", error: rePassword.length > 0 ? rePasswordError || error : error, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1219
1405
  Input,
1220
1406
  {
1221
1407
  placeholder: "Re Enter the Password",
@@ -1226,7 +1412,7 @@ function PasswordModal({
1226
1412
  }
1227
1413
  ) })
1228
1414
  ] }),
1229
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1415
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1230
1416
  Button,
1231
1417
  {
1232
1418
  disabled: password.length == 0 || !!passwordError || !!rePasswordError,
@@ -1242,8 +1428,8 @@ function PasswordModal({
1242
1428
  }
1243
1429
 
1244
1430
  // src/components/RecoveryModal/index.tsx
1245
- var import_react5 = require("react");
1246
- var import_jsx_runtime25 = require("react/jsx-runtime");
1431
+ var import_react6 = require("react");
1432
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1247
1433
  function RecoveryModal({
1248
1434
  title,
1249
1435
  isOpen,
@@ -1252,19 +1438,19 @@ function RecoveryModal({
1252
1438
  }) {
1253
1439
  const { refreshOverview } = useUserInfo();
1254
1440
  const { isLogin } = useUserInfo();
1255
- const [password, setPassword] = (0, import_react5.useState)("");
1441
+ const [password, setPassword] = (0, import_react6.useState)("");
1256
1442
  const { recoveryWallet } = useWallet();
1257
- const [error, setError] = (0, import_react5.useState)("");
1258
- const passwordError = (0, import_react5.useMemo)(() => {
1443
+ const [error, setError] = (0, import_react6.useState)("");
1444
+ const passwordError = (0, import_react6.useMemo)(() => {
1259
1445
  if (password.length < 6) return "Password must be at least 6 characters";
1260
1446
  return "";
1261
1447
  }, [password]);
1262
- (0, import_react5.useEffect)(() => {
1448
+ (0, import_react6.useEffect)(() => {
1263
1449
  if (isOpen) {
1264
1450
  setPassword("");
1265
1451
  }
1266
1452
  }, [isOpen]);
1267
- const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1453
+ const [isSubmitting, setIsSubmitting] = (0, import_react6.useState)(false);
1268
1454
  const onContinue = async () => {
1269
1455
  if (isSubmitting) return;
1270
1456
  try {
@@ -1279,12 +1465,12 @@ function RecoveryModal({
1279
1465
  setIsSubmitting(false);
1280
1466
  }
1281
1467
  };
1282
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Recover Wallet", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "matchid-password-box", children: [
1283
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "matchid-password-header", children: [
1284
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PasswordRoundIcon, {}) }),
1285
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "matchid-password-header-content", children: "Please enter your password to recover your wallet" })
1468
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Recover Wallet", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-password-box", children: [
1469
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-password-header", children: [
1470
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PasswordRoundIcon, {}) }),
1471
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-password-header-content", children: "Please enter your password to recover your wallet" })
1286
1472
  ] }),
1287
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "matchid-password-content", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Field, { label: "Password", error: password.length > 0 ? passwordError || error : error, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1473
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-password-content", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Field, { label: "Password", error: password.length > 0 ? passwordError || error : error, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1288
1474
  Input,
1289
1475
  {
1290
1476
  placeholder: "Enter the Password",
@@ -1294,7 +1480,7 @@ function RecoveryModal({
1294
1480
  value: password
1295
1481
  }
1296
1482
  ) }) }),
1297
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1483
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1298
1484
  Button,
1299
1485
  {
1300
1486
  disabled: password.length == 0 || !!passwordError,
@@ -1310,13 +1496,13 @@ function RecoveryModal({
1310
1496
  }
1311
1497
 
1312
1498
  // src/context/BusinessProvider.tsx
1313
- var import_jsx_runtime26 = require("react/jsx-runtime");
1499
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1314
1500
  function BusinessProvider({ children }) {
1315
1501
  const { overview, token } = useUserInfo();
1316
1502
  const { recoveryModal } = useStore_default();
1317
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
1318
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PasswordModal, { isOpen: !!token && !!overview && !overview.address && !!overview.did, showClose: false }),
1319
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1503
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
1504
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PasswordModal, { isOpen: !!token && !!overview && !overview.address && !!overview.did, showClose: false }),
1505
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1320
1506
  RecoveryModal,
1321
1507
  {
1322
1508
  isOpen: !!token && !!overview && !!overview.address && recoveryModal.open,
@@ -1329,17 +1515,17 @@ function BusinessProvider({ children }) {
1329
1515
  }
1330
1516
 
1331
1517
  // src/context/index.tsx
1332
- var import_jsx_runtime27 = (
1518
+ var import_jsx_runtime32 = (
1333
1519
  // <MpcWalletProvider>
1334
1520
  require("react/jsx-runtime")
1335
1521
  );
1336
1522
  var Providers = ({ children }) => {
1337
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BusinessProvider, { children });
1523
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BusinessProvider, { children });
1338
1524
  };
1339
1525
  var context_default = Providers;
1340
1526
 
1341
1527
  // src/hooks/useWalletInit.ts
1342
- var import_react6 = require("react");
1528
+ var import_react7 = require("react");
1343
1529
  var AppClientId2 = "react-sdk-" + getVersion();
1344
1530
  function useWalletInit({
1345
1531
  refreshOverview
@@ -1348,10 +1534,10 @@ function useWalletInit({
1348
1534
  const getWalletIframe = () => {
1349
1535
  return document.getElementById("match-wallet");
1350
1536
  };
1351
- const [walletInited, setWalletInited] = (0, import_react6.useState)(false);
1537
+ const [walletInited, setWalletInited] = (0, import_react7.useState)(false);
1352
1538
  const { appid, token, overview } = useLocalStore_default();
1353
1539
  const { initWallet, generateWallet } = useWallet();
1354
- (0, import_react6.useEffect)(() => {
1540
+ (0, import_react7.useEffect)(() => {
1355
1541
  if (endpoints.auth) {
1356
1542
  if (!window.matchWalletMessageIdMap) {
1357
1543
  window.matchWalletMessageIdMap = {};
@@ -1409,7 +1595,7 @@ function useWalletInit({
1409
1595
  }
1410
1596
  }
1411
1597
  }, [endpoints.auth]);
1412
- (0, import_react6.useEffect)(() => {
1598
+ (0, import_react7.useEffect)(() => {
1413
1599
  const messageHandle = async (e) => {
1414
1600
  if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
1415
1601
  return;
@@ -1442,7 +1628,7 @@ function useWalletInit({
1442
1628
  window.removeEventListener("message", messageHandle);
1443
1629
  };
1444
1630
  }, []);
1445
- (0, import_react6.useEffect)(() => {
1631
+ (0, import_react7.useEffect)(() => {
1446
1632
  if (token && overview && overview.did && walletInited) {
1447
1633
  const did = overview.did.split(":")[2];
1448
1634
  const newUserInit = async () => {
@@ -1473,7 +1659,7 @@ function useWalletInit({
1473
1659
  }
1474
1660
 
1475
1661
  // src/hooks/useInit.tsx
1476
- var import_react7 = require("react");
1662
+ var import_react8 = require("react");
1477
1663
  function useInit({
1478
1664
  theme,
1479
1665
  appid,
@@ -1489,20 +1675,20 @@ function useInit({
1489
1675
  setOverview,
1490
1676
  setTheme
1491
1677
  } = useLocalStore_default();
1492
- const overviewLoadingRef = (0, import_react7.useRef)(false);
1678
+ const overviewLoadingRef = (0, import_react8.useRef)(false);
1493
1679
  const searchParams = new URLSearchParams(window.location.search);
1494
1680
  const matchToken = searchParams.get("matchToken");
1495
1681
  const realEndpoints = endpoints || env_default.endpoints;
1496
- (0, import_react7.useEffect)(() => {
1682
+ (0, import_react8.useEffect)(() => {
1497
1683
  setTheme(theme);
1498
1684
  }, [theme]);
1499
- (0, import_react7.useEffect)(() => {
1685
+ (0, import_react8.useEffect)(() => {
1500
1686
  setAppid(appid);
1501
1687
  }, [appid]);
1502
- (0, import_react7.useEffect)(() => {
1688
+ (0, import_react8.useEffect)(() => {
1503
1689
  setEndpoints(realEndpoints);
1504
1690
  }, [realEndpoints]);
1505
- (0, import_react7.useEffect)(() => {
1691
+ (0, import_react8.useEffect)(() => {
1506
1692
  if (matchToken) {
1507
1693
  const tokenData = JSON.parse(atob(matchToken));
1508
1694
  if (tokenData && tokenData.mid && tokenData.token) {
@@ -1513,7 +1699,7 @@ function useInit({
1513
1699
  }
1514
1700
  }
1515
1701
  }, [matchToken]);
1516
- (0, import_react7.useEffect)(() => {
1702
+ (0, import_react8.useEffect)(() => {
1517
1703
  const onLoginMessage = (event) => {
1518
1704
  const res = event.data;
1519
1705
  if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
@@ -1549,7 +1735,7 @@ function useInit({
1549
1735
  overviewLoadingRef.current = false;
1550
1736
  }
1551
1737
  };
1552
- (0, import_react7.useEffect)(() => {
1738
+ (0, import_react8.useEffect)(() => {
1553
1739
  if (token) {
1554
1740
  loadOverview();
1555
1741
  }
@@ -1580,9 +1766,9 @@ function useInit({
1580
1766
 
1581
1767
  // src/MatchContext.tsx
1582
1768
  var import_react_query = require("@tanstack/react-query");
1583
- var import_jsx_runtime28 = require("react/jsx-runtime");
1769
+ var import_jsx_runtime33 = require("react/jsx-runtime");
1584
1770
  var queryClient = new import_react_query.QueryClient();
1585
- var MatchContext = (0, import_react8.createContext)(void 0);
1771
+ var MatchContext = (0, import_react9.createContext)(void 0);
1586
1772
  var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) => {
1587
1773
  const { loadOverview, login, endpoints: realEndPoints } = useInit({
1588
1774
  theme,
@@ -1593,7 +1779,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) =>
1593
1779
  useWalletInit({
1594
1780
  refreshOverview: loadOverview
1595
1781
  });
1596
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1782
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1597
1783
  MatchContext.Provider,
1598
1784
  {
1599
1785
  value: {
@@ -1603,12 +1789,12 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) =>
1603
1789
  login,
1604
1790
  theme
1605
1791
  },
1606
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(context_default, { children })
1792
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(context_default, { children })
1607
1793
  }
1608
1794
  ) });
1609
1795
  };
1610
1796
  var useMatch = () => {
1611
- const context = (0, import_react8.useContext)(MatchContext);
1797
+ const context = (0, import_react9.useContext)(MatchContext);
1612
1798
  if (context === void 0) {
1613
1799
  throw new Error("useMatch must be used within a MatchProvider");
1614
1800
  }
@@ -1629,30 +1815,31 @@ __export(components_exports, {
1629
1815
  Modal: () => Modal,
1630
1816
  ModalWithHeader: () => ModalWithHeader,
1631
1817
  PasswordModal: () => PasswordModal,
1818
+ Popover: () => Popover,
1632
1819
  UsernameModal: () => UsernameModal
1633
1820
  });
1634
1821
 
1635
1822
  // src/components/EmailModal/index.tsx
1636
- var import_react11 = require("react");
1823
+ var import_react12 = require("react");
1637
1824
 
1638
1825
  // src/components/EmailModal/StepEmail.tsx
1639
- var import_react9 = require("react");
1640
- var import_jsx_runtime29 = require("react/jsx-runtime");
1826
+ var import_react10 = require("react");
1827
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1641
1828
  function StepEmail(props) {
1642
- const [emailVal, setEmailVal] = (0, import_react9.useState)("");
1643
- (0, import_react9.useEffect)(() => {
1829
+ const [emailVal, setEmailVal] = (0, import_react10.useState)("");
1830
+ (0, import_react10.useEffect)(() => {
1644
1831
  if (props.email) {
1645
1832
  setEmailVal(props.email);
1646
1833
  }
1647
1834
  }, []);
1648
- const canContinue = (0, import_react9.useMemo)(() => {
1835
+ const canContinue = (0, import_react10.useMemo)(() => {
1649
1836
  return isValidEmail(emailVal);
1650
1837
  }, [emailVal]);
1651
1838
  const onContinue = async () => {
1652
1839
  props.onContinue(emailVal);
1653
1840
  };
1654
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "matchid-email-email-box", children: [
1655
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Field, { label: "Email Address", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1841
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "matchid-email-email-box", children: [
1842
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Field, { label: "Email Address", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1656
1843
  Input,
1657
1844
  {
1658
1845
  placeholder: "Enter Your Email Address",
@@ -1660,32 +1847,32 @@ function StepEmail(props) {
1660
1847
  value: emailVal
1661
1848
  }
1662
1849
  ) }),
1663
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { disabled: !canContinue, style: {
1850
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { disabled: !canContinue, style: {
1664
1851
  marginTop: "64px"
1665
1852
  }, onClick: onContinue, size: "lg", block: true, highlight: true, children: "Continue" })
1666
1853
  ] });
1667
1854
  }
1668
1855
 
1669
1856
  // src/components/EmailModal/StepVerify.tsx
1670
- var import_react10 = require("react");
1857
+ var import_react11 = require("react");
1671
1858
 
1672
1859
  // src/config/index.tsx
1673
1860
  var EMAIL_INTERVAL = 60;
1674
1861
  var EMAIL_CODE_LENGTH = 6;
1675
1862
 
1676
1863
  // src/components/EmailModal/StepVerify.tsx
1677
- var import_jsx_runtime30 = require("react/jsx-runtime");
1864
+ var import_jsx_runtime35 = require("react/jsx-runtime");
1678
1865
  function StepVerify(props) {
1679
1866
  const { getLoginEmailCode, loginByEmail } = useUserInfo();
1680
- const [error, setError] = (0, import_react10.useState)("");
1681
- const [code, setCode] = (0, import_react10.useState)("");
1682
- const [sending, setSending] = (0, import_react10.useState)(false);
1683
- const [submitting, setSubmitting] = (0, import_react10.useState)(false);
1684
- const sendTimeRef = (0, import_react10.useRef)(0);
1685
- const [sendBtnText, setSendBtnText] = (0, import_react10.useState)("Send");
1867
+ const [error, setError] = (0, import_react11.useState)("");
1868
+ const [code, setCode] = (0, import_react11.useState)("");
1869
+ const [sending, setSending] = (0, import_react11.useState)(false);
1870
+ const [submitting, setSubmitting] = (0, import_react11.useState)(false);
1871
+ const sendTimeRef = (0, import_react11.useRef)(0);
1872
+ const [sendBtnText, setSendBtnText] = (0, import_react11.useState)("Send");
1686
1873
  const intervalTime = EMAIL_INTERVAL;
1687
1874
  const codeLength = EMAIL_CODE_LENGTH;
1688
- const intervalRef = (0, import_react10.useRef)(null);
1875
+ const intervalRef = (0, import_react11.useRef)(null);
1689
1876
  const onSend = async () => {
1690
1877
  if (sendTimeRef.current > 0) {
1691
1878
  return;
@@ -1711,7 +1898,7 @@ function StepVerify(props) {
1711
1898
  setSending(false);
1712
1899
  }
1713
1900
  };
1714
- (0, import_react10.useEffect)(() => {
1901
+ (0, import_react11.useEffect)(() => {
1715
1902
  onSend();
1716
1903
  return () => {
1717
1904
  if (intervalRef.current) {
@@ -1719,7 +1906,7 @@ function StepVerify(props) {
1719
1906
  }
1720
1907
  };
1721
1908
  }, []);
1722
- const canContinue = (0, import_react10.useMemo)(() => {
1909
+ const canContinue = (0, import_react11.useMemo)(() => {
1723
1910
  return code.length === codeLength;
1724
1911
  }, [code]);
1725
1912
  const onContinue = async () => {
@@ -1743,22 +1930,22 @@ function StepVerify(props) {
1743
1930
  setSubmitting(false);
1744
1931
  }
1745
1932
  };
1746
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-email-verify-box", children: [
1747
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-email-verify-header", children: [
1748
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EmailLineIcon, {}) }),
1749
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-email-verify-header-content", children: [
1750
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-email-verify-header-value", children: props.email }),
1751
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-email-verify-header-tips", children: "We have sent a verification code to your email" })
1933
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "matchid-email-verify-box", children: [
1934
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "matchid-email-verify-header", children: [
1935
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(EmailLineIcon, {}) }),
1936
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "matchid-email-verify-header-content", children: [
1937
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "matchid-email-verify-header-value", children: props.email }),
1938
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "matchid-email-verify-header-tips", children: "We have sent a verification code to your email" })
1752
1939
  ] })
1753
1940
  ] }),
1754
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Field, { label: "Verification Code", error, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1941
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Field, { label: "Verification Code", error, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1755
1942
  Input,
1756
1943
  {
1757
1944
  placeholder: "Enter the code",
1758
1945
  maxLength: codeLength,
1759
1946
  onChange: (e) => setCode(e.target.value),
1760
1947
  value: code,
1761
- after: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1948
+ after: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1762
1949
  Button,
1763
1950
  {
1764
1951
  highlight: true,
@@ -1777,12 +1964,12 @@ function StepVerify(props) {
1777
1964
  )
1778
1965
  }
1779
1966
  ) }),
1780
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { disabled: !canContinue, highlight: true, block: true, size: "lg", onClick: onContinue, children: "Continue" })
1967
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { disabled: !canContinue, highlight: true, block: true, size: "lg", onClick: onContinue, children: "Continue" })
1781
1968
  ] });
1782
1969
  }
1783
1970
 
1784
1971
  // src/components/EmailModal/index.tsx
1785
- var import_jsx_runtime31 = require("react/jsx-runtime");
1972
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1786
1973
  function EmailModal({
1787
1974
  isOpen = false,
1788
1975
  width = 480,
@@ -1790,15 +1977,15 @@ function EmailModal({
1790
1977
  onBack,
1791
1978
  onLogin
1792
1979
  }) {
1793
- const [step, setStep] = (0, import_react11.useState)("input");
1794
- const [emailVal, setEmailVal] = (0, import_react11.useState)("");
1795
- (0, import_react11.useEffect)(() => {
1980
+ const [step, setStep] = (0, import_react12.useState)("input");
1981
+ const [emailVal, setEmailVal] = (0, import_react12.useState)("");
1982
+ (0, import_react12.useEffect)(() => {
1796
1983
  if (!isOpen) {
1797
1984
  setStep("input");
1798
1985
  setEmailVal("");
1799
1986
  }
1800
1987
  }, [isOpen]);
1801
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1988
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1802
1989
  ModalWithHeader,
1803
1990
  {
1804
1991
  isOpen,
@@ -1806,31 +1993,62 @@ function EmailModal({
1806
1993
  onClose,
1807
1994
  title: "Email",
1808
1995
  onBack: step == "verify" ? () => setStep("input") : onBack,
1809
- children: step === "input" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StepEmail, { email: emailVal, onContinue: (email) => {
1996
+ children: step === "input" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StepEmail, { email: emailVal, onContinue: (email) => {
1810
1997
  setEmailVal(email);
1811
1998
  setStep("verify");
1812
- } }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StepVerify, { email: emailVal, onSuccess: onLogin })
1999
+ } }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StepVerify, { email: emailVal, onSuccess: onLogin })
2000
+ }
2001
+ );
2002
+ }
2003
+
2004
+ // src/components/Popover/index.tsx
2005
+ var import_react13 = require("react");
2006
+ var import_jsx_runtime37 = require("react/jsx-runtime");
2007
+ function Popover({
2008
+ children,
2009
+ content,
2010
+ position = "right",
2011
+ type = "hover",
2012
+ className = "",
2013
+ gap = "20px"
2014
+ }) {
2015
+ const [active, setActive] = (0, import_react13.useState)(false);
2016
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
2017
+ "div",
2018
+ {
2019
+ onClick: () => {
2020
+ if (type == "click") {
2021
+ setActive(!active);
2022
+ }
2023
+ },
2024
+ className: `matchid-popover-box matchid-popover-${position} matchid-popover-${type} ${className} ${type == "click" && active ? "matchid-popover-click-active" : ""}`,
2025
+ children: [
2026
+ children,
2027
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: {
2028
+ paddingTop: gap
2029
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `matchid-popover-content`, children: content }) })
2030
+ ]
1813
2031
  }
1814
2032
  );
1815
2033
  }
1816
2034
 
1817
2035
  // src/components/LoginBox/index.tsx
1818
- var import_react12 = require("react");
1819
- var import_jsx_runtime32 = require("react/jsx-runtime");
2036
+ var import_react14 = require("react");
2037
+ var import_jsx_runtime38 = require("react/jsx-runtime");
1820
2038
  function LoginBox({
1821
2039
  methods,
1822
2040
  inModal = false
1823
2041
  }) {
1824
- const [emailOpen, setEmailOpen] = (0, import_react12.useState)(false);
1825
- const { loginByTelegram, loginByTwitter, loginByGoogle, loginByWallet } = useUserInfo();
2042
+ const [emailOpen, setEmailOpen] = (0, import_react14.useState)(false);
2043
+ const { login } = useUserInfo();
1826
2044
  const defaultMethods = [
1827
2045
  "wallet",
1828
2046
  "google",
1829
2047
  "email",
1830
2048
  "telegram",
1831
- "X"
2049
+ "twitter"
1832
2050
  ];
1833
- const methodList = (0, import_react12.useMemo)(() => {
2051
+ const methodList = (0, import_react14.useMemo)(() => {
1834
2052
  return methods || defaultMethods;
1835
2053
  }, [methods]);
1836
2054
  const LoginItem = ({
@@ -1838,46 +2056,56 @@ function LoginBox({
1838
2056
  name,
1839
2057
  onClick
1840
2058
  }) => {
1841
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "matchid-login-method", onClick, children: [
1842
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "matchid-login-method-content", children: [
1843
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "matchid-login-method-icon", children: icon }),
1844
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "matchid-login-method-name", children: name })
2059
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "matchid-login-method", onClick, children: [
2060
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "matchid-login-method-content", children: [
2061
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "matchid-login-method-icon", children: icon }),
2062
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "matchid-login-method-name", children: name })
1845
2063
  ] }),
1846
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ArrowRightIcon, { className: "matchid-login-method-arrow", size: 20, color: "var(--matchid-arrow-color)" })
2064
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ArrowRightIcon, { className: "matchid-login-method-arrow", size: 20, color: "var(--matchid-arrow-color)" })
1847
2065
  ] });
1848
2066
  };
1849
2067
  const methodMap = {
1850
2068
  wallet: {
1851
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WalletIcon, {}),
2069
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WalletIcon, {}),
1852
2070
  name: "Wallet",
1853
- onClick: loginByWallet
2071
+ onClick: () => login("wallet")
1854
2072
  },
1855
2073
  email: {
1856
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmailIcon, {}),
2074
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(EmailIcon, {}),
1857
2075
  name: "Email",
1858
2076
  onClick: () => {
1859
2077
  setEmailOpen(true);
1860
2078
  }
1861
2079
  },
1862
2080
  google: {
1863
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GoogleIcon, {}),
2081
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GoogleIcon, {}),
1864
2082
  name: "Google",
1865
- onClick: loginByGoogle
2083
+ onClick: () => login("google")
1866
2084
  },
1867
- X: {
1868
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(XIcon, {}),
2085
+ twitter: {
2086
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(XIcon, {}),
1869
2087
  name: "X",
1870
- onClick: loginByTwitter
2088
+ onClick: () => login("twitter")
1871
2089
  },
1872
2090
  telegram: {
1873
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TelegramIcon, {}),
2091
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TelegramIcon, {}),
1874
2092
  name: "Telegram",
1875
- onClick: loginByTelegram
2093
+ onClick: () => login("telegram")
2094
+ },
2095
+ github: {
2096
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GithubIcon, {}),
2097
+ name: "Github",
2098
+ onClick: () => login("github")
2099
+ },
2100
+ discord: {
2101
+ icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DiscordIcon, {}),
2102
+ name: "Discord",
2103
+ onClick: () => login("discord")
1876
2104
  }
1877
2105
  };
1878
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
1879
- (!inModal || !emailOpen) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "matchid-login-box", children: methodList.map((m) => {
1880
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2106
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
2107
+ (!inModal || !emailOpen) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "matchid-login-box", children: methodList.map((m) => {
2108
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1881
2109
  LoginItem,
1882
2110
  {
1883
2111
  icon: methodMap[m].icon,
@@ -1887,7 +2115,7 @@ function LoginBox({
1887
2115
  m
1888
2116
  );
1889
2117
  }) }),
1890
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2118
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1891
2119
  EmailModal,
1892
2120
  {
1893
2121
  isOpen: emailOpen,
@@ -1903,83 +2131,174 @@ function LoginBox({
1903
2131
  }
1904
2132
 
1905
2133
  // src/components/LoginButton/index.tsx
1906
- var import_react13 = require("react");
2134
+ var import_react16 = require("react");
1907
2135
 
1908
2136
  // src/components/LoginPanel/index.tsx
1909
- var import_jsx_runtime33 = require("react/jsx-runtime");
2137
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1910
2138
  function LoginPanel({
1911
2139
  header,
1912
2140
  onClose,
1913
2141
  ...props
1914
2142
  }) {
1915
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "matchid-login-panel", children: [
1916
- header ? header : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "matchid-login-panel-header", children: [
1917
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "matchid-login-panel-header-content", children: [
1918
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "matchid-login-panel-header-title", children: "Log in / Sign up" }),
1919
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "matchid-login-panel-header-subtilte", children: "You can use the following methods" })
2143
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "matchid-login-panel", children: [
2144
+ header ? header : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "matchid-login-panel-header", children: [
2145
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "matchid-login-panel-header-content", children: [
2146
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "matchid-login-panel-header-title", children: "Log in / Sign up" }),
2147
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "matchid-login-panel-header-subtilte", children: "You can use the following methods" })
1920
2148
  ] }),
1921
- onClose && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CloseRoundIcon, {}) })
2149
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CloseRoundIcon, {}) })
1922
2150
  ] }),
1923
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "matchid-login-panel-divide" }),
1924
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LoginBox, { ...props })
2151
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "matchid-login-panel-divide" }),
2152
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LoginBox, { ...props })
1925
2153
  ] });
1926
2154
  }
1927
2155
 
1928
2156
  // src/components/LoginModal/index.tsx
1929
- var import_jsx_runtime34 = require("react/jsx-runtime");
2157
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1930
2158
  function LoginModal({
1931
2159
  isOpen = false,
1932
2160
  width = 480,
1933
2161
  ...props
1934
2162
  }) {
1935
2163
  const { isLogin } = useUserInfo();
1936
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2164
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
1937
2165
  Modal,
1938
2166
  {
1939
2167
  isOpen: isOpen && !isLogin,
1940
2168
  width,
1941
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LoginPanel, { ...props, inModal: true })
2169
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LoginPanel, { ...props, inModal: true })
1942
2170
  }
1943
2171
  );
1944
2172
  }
1945
2173
 
2174
+ // src/components/UserPopover/index.tsx
2175
+ var import_react15 = require("react");
2176
+
2177
+ // src/assets/icon/ProfileIcon.tsx
2178
+ var import_jsx_runtime41 = require("react/jsx-runtime");
2179
+ function ProfileIcon({ size = 24, color = "black", ...props }) {
2180
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2181
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2182
+ "path",
2183
+ {
2184
+ fillRule: "evenodd",
2185
+ clipRule: "evenodd",
2186
+ d: "M7.5 6.75C7.5 4.95507 8.95507 3.5 10.75 3.5C12.5449 3.5 14 4.95507 14 6.75C14 8.54493 12.5449 10 10.75 10C8.95507 10 7.5 8.54493 7.5 6.75ZM10.75 2C8.12665 2 6 4.12665 6 6.75C6 9.37335 8.12665 11.5 10.75 11.5C13.3734 11.5 15.5 9.37335 15.5 6.75C15.5 4.12665 13.3734 2 10.75 2ZM8.75 13C5.57436 13 3 15.5744 3 18.75V19.75C3 20.7165 3.7835 21.5 4.75 21.5H13.6646L13.0292 20.8646C12.7764 20.6118 12.5733 20.3185 12.4263 20H4.75C4.61193 20 4.5 19.8881 4.5 19.75V18.75C4.5 16.4028 6.40279 14.5 8.75 14.5H12.6452C13.0508 13.8858 13.676 13.4295 14.4091 13.243C13.8838 13.0849 13.3268 13 12.75 13H8.75Z",
2187
+ fill: color
2188
+ }
2189
+ ),
2190
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2191
+ "path",
2192
+ {
2193
+ fillRule: "evenodd",
2194
+ clipRule: "evenodd",
2195
+ d: "M19.0677 22.4771L21.4771 20.0677C21.841 19.7038 21.841 19.1139 21.4771 18.75L17.75 15.0229C17.5753 14.8482 17.3383 14.75 17.0911 14.75H14.6818C14.1672 14.75 13.75 15.1672 13.75 15.6818V18.0911C13.75 18.3383 13.8482 18.5753 14.0229 18.75L17.75 22.4771C18.1139 22.841 18.7038 22.841 19.0677 22.4771ZM15.6135 17.3124C15.9995 17.3124 16.3124 16.9995 16.3124 16.6135C16.3124 16.2276 15.9995 15.9147 15.6135 15.9147C15.2276 15.9147 14.9147 16.2276 14.9147 16.6135C14.9147 16.9995 15.2276 17.3124 15.6135 17.3124Z",
2196
+ fill: color
2197
+ }
2198
+ )
2199
+ ] });
2200
+ }
2201
+
2202
+ // src/components/UserPopover/index.tsx
2203
+ var import_jsx_runtime42 = require("react/jsx-runtime");
2204
+ function UserContent() {
2205
+ const { logout, address, username } = useUserInfo();
2206
+ const [logouting, setLogouting] = (0, import_react15.useState)(false);
2207
+ const onLogout = async () => {
2208
+ if (logouting) return;
2209
+ try {
2210
+ setLogouting(true);
2211
+ await logout();
2212
+ } catch (error) {
2213
+ console.error(error);
2214
+ } finally {
2215
+ setLogouting(false);
2216
+ }
2217
+ };
2218
+ const UserItem = ({
2219
+ children,
2220
+ icon,
2221
+ rightIcon,
2222
+ onClick
2223
+ }) => {
2224
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "matchid-user-popover-item", onClick, children: [
2225
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `matchid-user-popover-item-content`, children: [
2226
+ icon,
2227
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "matchid-user-popover-item-text", children })
2228
+ ] }),
2229
+ rightIcon
2230
+ ] });
2231
+ };
2232
+ const UserDivider = () => {
2233
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: `matchid-user-popover-divider` });
2234
+ };
2235
+ const [usernameOpen, setUsernameOpen] = (0, import_react15.useState)(false);
2236
+ const [copied, setCopied] = useCopyClipboard();
2237
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "matchid-user-popover-content", children: [
2238
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "matchid-user-popover-list", children: [
2239
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UserItem, { onClick: () => {
2240
+ setCopied(address);
2241
+ }, icon: copied ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckIcon, { size: 20, color: "#0ecb81" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CopyIcon, { size: 20, color: "var(--icon-color)" }), rightIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckIcon, { size: 20, color: "var(--icon-color)" }), children: truncateAddress(address) }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UserDivider, {}),
2243
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UserItem, { onClick: () => {
2244
+ setUsernameOpen(true);
2245
+ }, icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ProfileIcon, { size: 20, color: "var(--icon-color)" }), rightIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ArrowRightIcon, { size: 20, color: "var(--icon-color)" }), children: username || "Set a username" })
2246
+ ] }),
2247
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { onClick: onLogout, loading: logouting, children: "Disconnect" }),
2248
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UsernameModal, { isOpen: usernameOpen, onClose: () => {
2249
+ setUsernameOpen(false);
2250
+ }, onSuccess: () => {
2251
+ setUsernameOpen(false);
2252
+ } })
2253
+ ] });
2254
+ }
2255
+ function UserPopover({
2256
+ children,
2257
+ ...props
2258
+ }) {
2259
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover, { ...props, content: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UserContent, {}), children });
2260
+ }
2261
+
1946
2262
  // src/components/LoginButton/index.tsx
1947
- var import_jsx_runtime35 = require("react/jsx-runtime");
2263
+ var import_jsx_runtime43 = require("react/jsx-runtime");
1948
2264
  function LoginButton({
1949
2265
  loginRender,
1950
2266
  methods,
1951
2267
  onLoginClick,
2268
+ popoverPosition = "right",
2269
+ popoverType = "hover",
2270
+ popoverGap = 20,
1952
2271
  ...props
1953
2272
  }) {
1954
2273
  const { isLogin, username } = useUserInfo();
1955
- const [loginOpen, setLoginOpen] = (0, import_react13.useState)(false);
2274
+ const [loginOpen, setLoginOpen] = (0, import_react16.useState)(false);
1956
2275
  if (!isLogin) {
1957
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
1958
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LoginModal, { methods, isOpen: loginOpen, onClose: () => setLoginOpen(false) }),
1959
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Button, { className: "matchid-unlogin-btn", ...props, highlight: true, onClick: () => setLoginOpen(true), children: [
1960
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UnLoginIcon_default, {}),
1961
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Login" })
2276
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
2277
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LoginModal, { methods, isOpen: loginOpen, onClose: () => setLoginOpen(false) }),
2278
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Button, { className: "matchid-unlogin-btn", ...props, highlight: true, onClick: () => setLoginOpen(true), children: [
2279
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UnLoginIcon_default, {}),
2280
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Login" })
1962
2281
  ] })
1963
2282
  ] });
1964
2283
  }
1965
- return loginRender ? loginRender() : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Button, { onClick: onLoginClick, className: "matchid-login-btn", ...props, children: [
1966
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LoginIcon_default, {}),
1967
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: username ? truncateAddress(username) : "MatchID User" })
1968
- ] });
2284
+ return loginRender ? { loginRender } : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UserPopover, { position: popoverPosition, type: popoverType, gap: popoverGap, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Button, { onClick: onLoginClick, className: "matchid-login-btn", ...props, children: [
2285
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LoginIcon_default, {}),
2286
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: username ? truncateAddress(username) : "MatchID User" })
2287
+ ] }) });
1969
2288
  }
1970
2289
 
1971
2290
  // src/components/UsernameModal/index.tsx
1972
- var import_react14 = require("react");
2291
+ var import_react17 = require("react");
1973
2292
 
1974
2293
  // src/assets/icon/InfoRoundIcon.tsx
1975
- var import_jsx_runtime36 = require("react/jsx-runtime");
2294
+ var import_jsx_runtime44 = require("react/jsx-runtime");
1976
2295
  function InfoRoundIcon({
1977
2296
  size,
1978
2297
  color = "#6E6E6E",
1979
2298
  ...props
1980
2299
  }) {
1981
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
1982
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("g", { clipPath: "url(#clip0_418_7746)", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2300
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
2301
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("g", { clipPath: "url(#clip0_418_7746)", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
1983
2302
  "path",
1984
2303
  {
1985
2304
  fillRule: "evenodd",
@@ -1988,19 +2307,19 @@ function InfoRoundIcon({
1988
2307
  fill: color
1989
2308
  }
1990
2309
  ) }),
1991
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("clipPath", { id: "clip0_418_7746", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
2310
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("clipPath", { id: "clip0_418_7746", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
1992
2311
  ] });
1993
2312
  }
1994
2313
 
1995
2314
  // src/components/UsernameModal/index.tsx
1996
- var import_jsx_runtime37 = require("react/jsx-runtime");
2315
+ var import_jsx_runtime45 = require("react/jsx-runtime");
1997
2316
  var ValidItem = ({
1998
2317
  success = false,
1999
2318
  text
2000
2319
  }) => {
2001
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
2002
- success ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CheckRoundIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(InfoRoundIcon, { size: 16 }),
2003
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: text })
2320
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
2321
+ success ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CheckRoundIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(InfoRoundIcon, { size: 16 }),
2322
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: text })
2004
2323
  ] });
2005
2324
  };
2006
2325
  function UsernameModal({
@@ -2011,22 +2330,22 @@ function UsernameModal({
2011
2330
  }) {
2012
2331
  const { username, refreshOverview } = useUserInfo();
2013
2332
  const { isLogin } = useUserInfo();
2014
- const [val, setVal] = (0, import_react14.useState)(username);
2015
- const [error, setError] = (0, import_react14.useState)("");
2016
- (0, import_react14.useEffect)(() => {
2333
+ const [val, setVal] = (0, import_react17.useState)(username);
2334
+ const [error, setError] = (0, import_react17.useState)("");
2335
+ (0, import_react17.useEffect)(() => {
2017
2336
  if (isOpen) {
2018
2337
  setVal(username);
2019
2338
  setError("");
2020
2339
  }
2021
2340
  }, [isOpen]);
2022
- const isValid = (0, import_react14.useMemo)(() => {
2341
+ const isValid = (0, import_react17.useMemo)(() => {
2023
2342
  return isValidUsername(val);
2024
2343
  }, [val]);
2025
- const isLength = (0, import_react14.useMemo)(() => {
2344
+ const isLength = (0, import_react17.useMemo)(() => {
2026
2345
  return val.length >= 2 && val.length <= 32;
2027
2346
  }, [val]);
2028
2347
  const isSafe = isValid && isLength;
2029
- const [isSubmitting, setIsSubmitting] = (0, import_react14.useState)(false);
2348
+ const [isSubmitting, setIsSubmitting] = (0, import_react17.useState)(false);
2030
2349
  const onSubmit = async () => {
2031
2350
  if (isSubmitting) return;
2032
2351
  try {
@@ -2046,8 +2365,8 @@ function UsernameModal({
2046
2365
  setIsSubmitting(false);
2047
2366
  }
2048
2367
  };
2049
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Set User Name", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "matchid-username-box", children: [
2050
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Field, { label: "User Name", error, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2368
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || (username ? "Edit User Name" : "Set User Name"), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "matchid-username-box", children: [
2369
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Field, { label: "User Name", error, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2051
2370
  Input,
2052
2371
  {
2053
2372
  placeholder: "Enter Your User Name",
@@ -2058,20 +2377,20 @@ function UsernameModal({
2058
2377
  value: val
2059
2378
  }
2060
2379
  ) }),
2061
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "matchid-valid", children: [
2062
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2380
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "matchid-valid", children: [
2381
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
2063
2382
  ValidItem,
2064
2383
  {
2065
2384
  success: isValid,
2066
2385
  text: "Name can be composed of numbers and letters as well as characters"
2067
2386
  }
2068
2387
  ),
2069
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ValidItem, { success: isLength, text: "No less than 2 characters" })
2388
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ValidItem, { success: isLength, text: "No less than 2 characters" })
2070
2389
  ] }),
2071
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { disabled: !isSafe, loading: isSubmitting, style: {
2390
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { disabled: !isSafe, loading: isSubmitting, style: {
2072
2391
  marginTop: "64px"
2073
2392
  }, onClick: onSubmit, size: "lg", block: true, highlight: true, children: "Confirm" }),
2074
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { style: {
2393
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { style: {
2075
2394
  marginTop: "24px"
2076
2395
  }, onClick: props.onClose, size: "lg", block: true, children: "Next Time" })
2077
2396
  ] }) });