@matchain/matchid-sdk-react 0.1.17 → 0.1.19

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,162 @@ 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/assets/icon/LinkedinIcon.tsx
517
+ var import_jsx_runtime25 = require("react/jsx-runtime");
518
+ function LinkedinIcon({
519
+ size = 40,
520
+ ...props
521
+ }) {
522
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("svg", { width: size, height: size, ...props, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { width: "40", height: "40", rx: "8", fill: "#0A66C2" }),
524
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
525
+ "path",
526
+ {
527
+ d: "M29.376 9H10.624C10.1933 9 9.78023 9.1711 9.47567 9.47567C9.1711 9.78023 9 10.1933 9 10.624V29.376C9 29.8067 9.1711 30.2198 9.47567 30.5243C9.78023 30.8289 10.1933 31 10.624 31H29.376C29.8067 31 30.2198 30.8289 30.5243 30.5243C30.8289 30.2198 31 29.8067 31 29.376V10.624C31 10.1933 30.8289 9.78023 30.5243 9.47567C30.2198 9.1711 29.8067 9 29.376 9ZM15.5572 27.7413H12.2496V17.2347H15.5572V27.7413ZM13.9011 15.7788C13.5259 15.7766 13.1598 15.6634 12.8488 15.4534C12.5379 15.2434 12.2962 14.946 12.1541 14.5987C12.0121 14.2514 11.9761 13.8699 12.0507 13.5022C12.1253 13.1345 12.3072 12.7971 12.5733 12.5326C12.8395 12.2682 13.178 12.0885 13.5462 12.0163C13.9144 11.944 14.2957 11.9825 14.642 12.1267C14.9884 12.271 15.2842 12.5147 15.4923 12.8269C15.7003 13.1392 15.8111 13.5061 15.8108 13.8813C15.8144 14.1324 15.7673 14.3818 15.6724 14.6144C15.5776 14.847 15.4368 15.0582 15.2586 15.2352C15.0804 15.4123 14.8684 15.5517 14.6351 15.6451C14.4019 15.7384 14.1523 15.7839 13.9011 15.7788ZM27.7489 27.7504H24.4428V22.0106C24.4428 20.3178 23.7232 19.7953 22.7943 19.7953C21.8135 19.7953 20.851 20.5347 20.851 22.0533V27.7504H17.5433V17.2424H20.7242V18.6983H20.7669C21.0863 18.0521 22.2046 16.9475 23.9111 16.9475C25.7567 16.9475 27.7504 18.0429 27.7504 21.2513L27.7489 27.7504Z",
528
+ fill: "white"
529
+ }
530
+ )
531
+ ] });
532
+ }
533
+
534
+ // src/components/Modal/index.tsx
535
+ var import_jsx_runtime26 = require("react/jsx-runtime");
397
536
  function Modal({
398
537
  children,
399
538
  isOpen,
400
539
  width = 480,
401
540
  className = ""
402
541
  }) {
403
- return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
542
+ return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
404
543
  "div",
405
544
  {
406
545
  className: "matchid-overlay",
407
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `matchid-modal ${className}`, style: {
546
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `matchid-modal ${className}`, style: {
408
547
  width
409
548
  }, children })
410
549
  }
411
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {});
550
+ ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, {});
412
551
  }
413
552
  function ModalWithHeader({
414
553
  children,
@@ -419,24 +558,24 @@ function ModalWithHeader({
419
558
  showClose = true,
420
559
  ...props
421
560
  }) {
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 })
561
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Modal, { ...props, children: [
562
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
563
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "matchid-modal-header-content", children: [
564
+ onBack && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowLeftIcon, { className: "matchid-modal-header-back", onClick: onBack }),
565
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "matchid-modal-header-title", children: title })
427
566
  ] }),
428
- onClose && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
567
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
429
568
  ] }),
430
569
  children
431
570
  ] });
432
571
  }
433
572
 
434
573
  // src/components/PasswordModal/index.tsx
435
- var import_react4 = require("react");
574
+ var import_react5 = require("react");
436
575
 
437
576
  // src/components/Input/index.tsx
438
577
  var import_react = require("react");
439
- var import_jsx_runtime21 = require("react/jsx-runtime");
578
+ var import_jsx_runtime27 = require("react/jsx-runtime");
440
579
  function Input({
441
580
  onChange,
442
581
  type,
@@ -445,22 +584,22 @@ function Input({
445
584
  ...props
446
585
  }) {
447
586
  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) => {
587
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `matchid-input-box ${props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`, children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
589
+ props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DeleteRoundIcon, { onClick: (e) => {
451
590
  if (onChange) {
452
591
  onChange({ target: { value: "" } });
453
592
  }
454
593
  }, 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: () => {
594
+ type === "password" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
456
595
  setInputType(inputType === "password" ? "text" : "password");
457
- }, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CloseEyeIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OpenEyeIcon, {}) }),
596
+ }, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CloseEyeIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OpenEyeIcon, {}) }),
458
597
  after
459
598
  ] });
460
599
  }
461
600
 
462
601
  // src/components/Field/index.tsx
463
- var import_jsx_runtime22 = require("react/jsx-runtime");
602
+ var import_jsx_runtime28 = require("react/jsx-runtime");
464
603
  function Field({
465
604
  label,
466
605
  children,
@@ -468,18 +607,18 @@ function Field({
468
607
  required,
469
608
  className = ""
470
609
  }) {
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: "*" }),
610
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `matchid-field-box ${className}`, children: [
611
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "matchid-field-label", children: [
612
+ required && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "matchid-field-required", children: "*" }),
474
613
  label
475
614
  ] }),
476
615
  children,
477
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "matchid-field-error", children: error })
616
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "matchid-field-error", children: error })
478
617
  ] });
479
618
  }
480
619
 
481
620
  // src/components/Button/index.tsx
482
- var import_jsx_runtime23 = require("react/jsx-runtime");
621
+ var import_jsx_runtime29 = require("react/jsx-runtime");
483
622
  function Button({
484
623
  size = "df",
485
624
  disabled = false,
@@ -498,7 +637,7 @@ function Button({
498
637
  onClick && onClick();
499
638
  }
500
639
  };
501
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
640
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
502
641
  "button",
503
642
  {
504
643
  type,
@@ -508,7 +647,7 @@ function Button({
508
647
  ...style
509
648
  },
510
649
  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
650
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
512
651
  }
513
652
  );
514
653
  }
@@ -516,6 +655,7 @@ function Button({
516
655
  // src/hooks/index.tsx
517
656
  var hooks_exports = {};
518
657
  __export(hooks_exports, {
658
+ useCopyClipboard: () => useCopyClipboard,
519
659
  useMatchEvents: () => useMatchEvents,
520
660
  useUserInfo: () => useUserInfo,
521
661
  useWallet: () => useWallet
@@ -865,10 +1005,10 @@ function useUserInfo() {
865
1005
  events && events.onLogout && events.onLogout();
866
1006
  eventManager_default.emit("onLogout");
867
1007
  };
868
- const loginByMethod = (method) => {
1008
+ const loginByMethod = async (method) => {
869
1009
  const link = `${endpoints.back}api/v1/auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.auth + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
870
1010
  matchlog_default.log("link", link);
871
- const authWindow = window.open(
1011
+ return window.open(
872
1012
  link,
873
1013
  // Replace with the actual authorization URL
874
1014
  "authWindow",
@@ -876,10 +1016,42 @@ function useUserInfo() {
876
1016
  );
877
1017
  };
878
1018
  const loginByTwitter = () => {
879
- loginByMethod("twitter");
1019
+ return loginByMethod("twitter");
880
1020
  };
881
1021
  const loginByGoogle = () => {
882
- loginByMethod("google");
1022
+ return loginByMethod("google");
1023
+ };
1024
+ const loginByWallet = async () => {
1025
+ return window.open(
1026
+ `${endpoints.auth}login/wallet?appid=${appid}`,
1027
+ // Replace with the actual authorization URL
1028
+ "_blank"
1029
+ // 'width=800,height=600'
1030
+ );
1031
+ };
1032
+ const loginByTelegram = async () => {
1033
+ return window.open(
1034
+ `${endpoints.auth}login/telegram?appid=${appid}`,
1035
+ // Replace with the actual authorization URL
1036
+ "authWindow",
1037
+ "width=800,height=600"
1038
+ );
1039
+ };
1040
+ const loginMethod = async (method) => {
1041
+ switch (method) {
1042
+ case "wallet":
1043
+ return await loginByWallet();
1044
+ case "telegram":
1045
+ return await loginByTelegram();
1046
+ case "twitter":
1047
+ case "google":
1048
+ case "discord":
1049
+ case "github":
1050
+ case "linkedin":
1051
+ return await loginByMethod(method);
1052
+ default:
1053
+ throw new Error("unsupported method");
1054
+ }
883
1055
  };
884
1056
  const getLoginEmailCode = async (email) => {
885
1057
  const res = await getEmailCodeApi(email);
@@ -915,22 +1087,6 @@ function useUserInfo() {
915
1087
  }
916
1088
  return false;
917
1089
  };
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
1090
  const refreshOverview = async () => {
935
1091
  const res = await getOverviewInfoApi();
936
1092
  if (res.data) {
@@ -965,7 +1121,30 @@ function useUserInfo() {
965
1121
  }
966
1122
  throw new Error(res.message);
967
1123
  };
1124
+ const bind = async (method) => {
1125
+ switch (method) {
1126
+ case "wallet":
1127
+ return await bindWallet();
1128
+ case "telegram":
1129
+ return await bindTelegram();
1130
+ case "twitter":
1131
+ case "google":
1132
+ case "discord":
1133
+ case "github":
1134
+ case "linkedin":
1135
+ 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}`;
1136
+ matchlog_default.log("link", link);
1137
+ return window.open(
1138
+ link,
1139
+ "authWindow",
1140
+ "width=800,height=600"
1141
+ );
1142
+ default:
1143
+ throw new Error("unsupported method");
1144
+ }
1145
+ };
968
1146
  return {
1147
+ loginByMethod,
969
1148
  loginByTelegram,
970
1149
  loginByTwitter,
971
1150
  loginByGoogle,
@@ -983,7 +1162,9 @@ function useUserInfo() {
983
1162
  bindWallet,
984
1163
  bindTelegram,
985
1164
  username: overview?.username || "",
986
- auth
1165
+ auth,
1166
+ login: loginMethod,
1167
+ bind
987
1168
  };
988
1169
  }
989
1170
 
@@ -1152,8 +1333,31 @@ function useWallet() {
1152
1333
  };
1153
1334
  }
1154
1335
 
1336
+ // src/hooks/useCopyClipboard.ts
1337
+ var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
1338
+ var import_react4 = require("react");
1339
+ function useCopyClipboard(timeout = 500) {
1340
+ const [isCopied, setIsCopied] = (0, import_react4.useState)(false);
1341
+ const staticCopy = (0, import_react4.useCallback)((text) => {
1342
+ const didCopy = (0, import_copy_to_clipboard.default)(text);
1343
+ setIsCopied(didCopy);
1344
+ }, []);
1345
+ (0, import_react4.useEffect)(() => {
1346
+ if (isCopied) {
1347
+ const hide = setTimeout(() => {
1348
+ setIsCopied(false);
1349
+ }, timeout);
1350
+ return () => {
1351
+ clearTimeout(hide);
1352
+ };
1353
+ }
1354
+ return void 0;
1355
+ }, [isCopied, setIsCopied, timeout]);
1356
+ return [isCopied, staticCopy];
1357
+ }
1358
+
1155
1359
  // src/components/PasswordModal/index.tsx
1156
- var import_jsx_runtime24 = require("react/jsx-runtime");
1360
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1157
1361
  function PasswordModal({
1158
1362
  title,
1159
1363
  isOpen,
@@ -1162,27 +1366,27 @@ function PasswordModal({
1162
1366
  }) {
1163
1367
  const { refreshOverview } = useUserInfo();
1164
1368
  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)("");
1369
+ const [password, setPassword] = (0, import_react5.useState)("");
1370
+ const [rePassword, setRePassword] = (0, import_react5.useState)("");
1371
+ const [error, setError] = (0, import_react5.useState)("");
1168
1372
  const { generateWallet } = useWallet();
1169
- const passwordError = (0, import_react4.useMemo)(() => {
1373
+ const passwordError = (0, import_react5.useMemo)(() => {
1170
1374
  if (password.length < 6) return "Password must be at least 6 characters";
1171
1375
  return "";
1172
1376
  }, [password]);
1173
- const rePasswordError = (0, import_react4.useMemo)(() => {
1377
+ const rePasswordError = (0, import_react5.useMemo)(() => {
1174
1378
  if (rePassword != password) {
1175
1379
  return "The password you entered twice do not match";
1176
1380
  }
1177
1381
  return "";
1178
1382
  }, [rePassword, password]);
1179
- (0, import_react4.useEffect)(() => {
1383
+ (0, import_react5.useEffect)(() => {
1180
1384
  if (isOpen) {
1181
1385
  setPassword("");
1182
1386
  setRePassword("");
1183
1387
  }
1184
1388
  }, [isOpen]);
1185
- const [isSubmitting, setIsSubmitting] = (0, import_react4.useState)(false);
1389
+ const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1186
1390
  const onContinue = async () => {
1187
1391
  if (isSubmitting) return;
1188
1392
  try {
@@ -1199,13 +1403,13 @@ function PasswordModal({
1199
1403
  setIsSubmitting(false);
1200
1404
  }
1201
1405
  };
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" })
1406
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Set Password", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-password-box", children: [
1407
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-password-header", children: [
1408
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PasswordRoundIcon, {}) }),
1409
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "matchid-password-header-content", children: "Please set the wallet password that will be used to recover the wallet" })
1206
1410
  ] }),
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)(
1411
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "matchid-password-content", children: [
1412
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Field, { label: "Password", error: password.length > 0 && passwordError, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1209
1413
  Input,
1210
1414
  {
1211
1415
  placeholder: "Enter the Password",
@@ -1215,7 +1419,7 @@ function PasswordModal({
1215
1419
  value: password
1216
1420
  }
1217
1421
  ) }),
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)(
1422
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Field, { label: "Re Password", error: rePassword.length > 0 ? rePasswordError || error : error, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1219
1423
  Input,
1220
1424
  {
1221
1425
  placeholder: "Re Enter the Password",
@@ -1226,7 +1430,7 @@ function PasswordModal({
1226
1430
  }
1227
1431
  ) })
1228
1432
  ] }),
1229
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1433
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1230
1434
  Button,
1231
1435
  {
1232
1436
  disabled: password.length == 0 || !!passwordError || !!rePasswordError,
@@ -1242,8 +1446,8 @@ function PasswordModal({
1242
1446
  }
1243
1447
 
1244
1448
  // src/components/RecoveryModal/index.tsx
1245
- var import_react5 = require("react");
1246
- var import_jsx_runtime25 = require("react/jsx-runtime");
1449
+ var import_react6 = require("react");
1450
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1247
1451
  function RecoveryModal({
1248
1452
  title,
1249
1453
  isOpen,
@@ -1252,19 +1456,19 @@ function RecoveryModal({
1252
1456
  }) {
1253
1457
  const { refreshOverview } = useUserInfo();
1254
1458
  const { isLogin } = useUserInfo();
1255
- const [password, setPassword] = (0, import_react5.useState)("");
1459
+ const [password, setPassword] = (0, import_react6.useState)("");
1256
1460
  const { recoveryWallet } = useWallet();
1257
- const [error, setError] = (0, import_react5.useState)("");
1258
- const passwordError = (0, import_react5.useMemo)(() => {
1461
+ const [error, setError] = (0, import_react6.useState)("");
1462
+ const passwordError = (0, import_react6.useMemo)(() => {
1259
1463
  if (password.length < 6) return "Password must be at least 6 characters";
1260
1464
  return "";
1261
1465
  }, [password]);
1262
- (0, import_react5.useEffect)(() => {
1466
+ (0, import_react6.useEffect)(() => {
1263
1467
  if (isOpen) {
1264
1468
  setPassword("");
1265
1469
  }
1266
1470
  }, [isOpen]);
1267
- const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1471
+ const [isSubmitting, setIsSubmitting] = (0, import_react6.useState)(false);
1268
1472
  const onContinue = async () => {
1269
1473
  if (isSubmitting) return;
1270
1474
  try {
@@ -1279,12 +1483,12 @@ function RecoveryModal({
1279
1483
  setIsSubmitting(false);
1280
1484
  }
1281
1485
  };
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" })
1486
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Recover Wallet", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "matchid-password-box", children: [
1487
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "matchid-password-header", children: [
1488
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PasswordRoundIcon, {}) }),
1489
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "matchid-password-header-content", children: "Please enter your password to recover your wallet" })
1286
1490
  ] }),
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)(
1491
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "matchid-password-content", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Field, { label: "Password", error: password.length > 0 ? passwordError || error : error, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1288
1492
  Input,
1289
1493
  {
1290
1494
  placeholder: "Enter the Password",
@@ -1294,7 +1498,7 @@ function RecoveryModal({
1294
1498
  value: password
1295
1499
  }
1296
1500
  ) }) }),
1297
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1501
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1298
1502
  Button,
1299
1503
  {
1300
1504
  disabled: password.length == 0 || !!passwordError,
@@ -1310,13 +1514,13 @@ function RecoveryModal({
1310
1514
  }
1311
1515
 
1312
1516
  // src/context/BusinessProvider.tsx
1313
- var import_jsx_runtime26 = require("react/jsx-runtime");
1517
+ var import_jsx_runtime32 = require("react/jsx-runtime");
1314
1518
  function BusinessProvider({ children }) {
1315
1519
  const { overview, token } = useUserInfo();
1316
1520
  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)(
1521
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
1522
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PasswordModal, { isOpen: !!token && !!overview && !overview.address && !!overview.did, showClose: false }),
1523
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1320
1524
  RecoveryModal,
1321
1525
  {
1322
1526
  isOpen: !!token && !!overview && !!overview.address && recoveryModal.open,
@@ -1329,17 +1533,17 @@ function BusinessProvider({ children }) {
1329
1533
  }
1330
1534
 
1331
1535
  // src/context/index.tsx
1332
- var import_jsx_runtime27 = (
1536
+ var import_jsx_runtime33 = (
1333
1537
  // <MpcWalletProvider>
1334
1538
  require("react/jsx-runtime")
1335
1539
  );
1336
1540
  var Providers = ({ children }) => {
1337
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BusinessProvider, { children });
1541
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BusinessProvider, { children });
1338
1542
  };
1339
1543
  var context_default = Providers;
1340
1544
 
1341
1545
  // src/hooks/useWalletInit.ts
1342
- var import_react6 = require("react");
1546
+ var import_react7 = require("react");
1343
1547
  var AppClientId2 = "react-sdk-" + getVersion();
1344
1548
  function useWalletInit({
1345
1549
  refreshOverview
@@ -1348,10 +1552,10 @@ function useWalletInit({
1348
1552
  const getWalletIframe = () => {
1349
1553
  return document.getElementById("match-wallet");
1350
1554
  };
1351
- const [walletInited, setWalletInited] = (0, import_react6.useState)(false);
1555
+ const [walletInited, setWalletInited] = (0, import_react7.useState)(false);
1352
1556
  const { appid, token, overview } = useLocalStore_default();
1353
1557
  const { initWallet, generateWallet } = useWallet();
1354
- (0, import_react6.useEffect)(() => {
1558
+ (0, import_react7.useEffect)(() => {
1355
1559
  if (endpoints.auth) {
1356
1560
  if (!window.matchWalletMessageIdMap) {
1357
1561
  window.matchWalletMessageIdMap = {};
@@ -1409,7 +1613,7 @@ function useWalletInit({
1409
1613
  }
1410
1614
  }
1411
1615
  }, [endpoints.auth]);
1412
- (0, import_react6.useEffect)(() => {
1616
+ (0, import_react7.useEffect)(() => {
1413
1617
  const messageHandle = async (e) => {
1414
1618
  if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
1415
1619
  return;
@@ -1442,7 +1646,7 @@ function useWalletInit({
1442
1646
  window.removeEventListener("message", messageHandle);
1443
1647
  };
1444
1648
  }, []);
1445
- (0, import_react6.useEffect)(() => {
1649
+ (0, import_react7.useEffect)(() => {
1446
1650
  if (token && overview && overview.did && walletInited) {
1447
1651
  const did = overview.did.split(":")[2];
1448
1652
  const newUserInit = async () => {
@@ -1473,7 +1677,7 @@ function useWalletInit({
1473
1677
  }
1474
1678
 
1475
1679
  // src/hooks/useInit.tsx
1476
- var import_react7 = require("react");
1680
+ var import_react8 = require("react");
1477
1681
  function useInit({
1478
1682
  theme,
1479
1683
  appid,
@@ -1489,20 +1693,20 @@ function useInit({
1489
1693
  setOverview,
1490
1694
  setTheme
1491
1695
  } = useLocalStore_default();
1492
- const overviewLoadingRef = (0, import_react7.useRef)(false);
1696
+ const overviewLoadingRef = (0, import_react8.useRef)(false);
1493
1697
  const searchParams = new URLSearchParams(window.location.search);
1494
1698
  const matchToken = searchParams.get("matchToken");
1495
1699
  const realEndpoints = endpoints || env_default.endpoints;
1496
- (0, import_react7.useEffect)(() => {
1700
+ (0, import_react8.useEffect)(() => {
1497
1701
  setTheme(theme);
1498
1702
  }, [theme]);
1499
- (0, import_react7.useEffect)(() => {
1703
+ (0, import_react8.useEffect)(() => {
1500
1704
  setAppid(appid);
1501
1705
  }, [appid]);
1502
- (0, import_react7.useEffect)(() => {
1706
+ (0, import_react8.useEffect)(() => {
1503
1707
  setEndpoints(realEndpoints);
1504
1708
  }, [realEndpoints]);
1505
- (0, import_react7.useEffect)(() => {
1709
+ (0, import_react8.useEffect)(() => {
1506
1710
  if (matchToken) {
1507
1711
  const tokenData = JSON.parse(atob(matchToken));
1508
1712
  if (tokenData && tokenData.mid && tokenData.token) {
@@ -1513,7 +1717,7 @@ function useInit({
1513
1717
  }
1514
1718
  }
1515
1719
  }, [matchToken]);
1516
- (0, import_react7.useEffect)(() => {
1720
+ (0, import_react8.useEffect)(() => {
1517
1721
  const onLoginMessage = (event) => {
1518
1722
  const res = event.data;
1519
1723
  if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
@@ -1549,7 +1753,7 @@ function useInit({
1549
1753
  overviewLoadingRef.current = false;
1550
1754
  }
1551
1755
  };
1552
- (0, import_react7.useEffect)(() => {
1756
+ (0, import_react8.useEffect)(() => {
1553
1757
  if (token) {
1554
1758
  loadOverview();
1555
1759
  }
@@ -1580,9 +1784,9 @@ function useInit({
1580
1784
 
1581
1785
  // src/MatchContext.tsx
1582
1786
  var import_react_query = require("@tanstack/react-query");
1583
- var import_jsx_runtime28 = require("react/jsx-runtime");
1787
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1584
1788
  var queryClient = new import_react_query.QueryClient();
1585
- var MatchContext = (0, import_react8.createContext)(void 0);
1789
+ var MatchContext = (0, import_react9.createContext)(void 0);
1586
1790
  var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) => {
1587
1791
  const { loadOverview, login, endpoints: realEndPoints } = useInit({
1588
1792
  theme,
@@ -1593,7 +1797,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) =>
1593
1797
  useWalletInit({
1594
1798
  refreshOverview: loadOverview
1595
1799
  });
1596
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1800
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1597
1801
  MatchContext.Provider,
1598
1802
  {
1599
1803
  value: {
@@ -1603,12 +1807,12 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) =>
1603
1807
  login,
1604
1808
  theme
1605
1809
  },
1606
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(context_default, { children })
1810
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(context_default, { children })
1607
1811
  }
1608
1812
  ) });
1609
1813
  };
1610
1814
  var useMatch = () => {
1611
- const context = (0, import_react8.useContext)(MatchContext);
1815
+ const context = (0, import_react9.useContext)(MatchContext);
1612
1816
  if (context === void 0) {
1613
1817
  throw new Error("useMatch must be used within a MatchProvider");
1614
1818
  }
@@ -1629,30 +1833,31 @@ __export(components_exports, {
1629
1833
  Modal: () => Modal,
1630
1834
  ModalWithHeader: () => ModalWithHeader,
1631
1835
  PasswordModal: () => PasswordModal,
1836
+ Popover: () => Popover,
1632
1837
  UsernameModal: () => UsernameModal
1633
1838
  });
1634
1839
 
1635
1840
  // src/components/EmailModal/index.tsx
1636
- var import_react11 = require("react");
1841
+ var import_react12 = require("react");
1637
1842
 
1638
1843
  // src/components/EmailModal/StepEmail.tsx
1639
- var import_react9 = require("react");
1640
- var import_jsx_runtime29 = require("react/jsx-runtime");
1844
+ var import_react10 = require("react");
1845
+ var import_jsx_runtime35 = require("react/jsx-runtime");
1641
1846
  function StepEmail(props) {
1642
- const [emailVal, setEmailVal] = (0, import_react9.useState)("");
1643
- (0, import_react9.useEffect)(() => {
1847
+ const [emailVal, setEmailVal] = (0, import_react10.useState)("");
1848
+ (0, import_react10.useEffect)(() => {
1644
1849
  if (props.email) {
1645
1850
  setEmailVal(props.email);
1646
1851
  }
1647
1852
  }, []);
1648
- const canContinue = (0, import_react9.useMemo)(() => {
1853
+ const canContinue = (0, import_react10.useMemo)(() => {
1649
1854
  return isValidEmail(emailVal);
1650
1855
  }, [emailVal]);
1651
1856
  const onContinue = async () => {
1652
1857
  props.onContinue(emailVal);
1653
1858
  };
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)(
1859
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "matchid-email-email-box", children: [
1860
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Field, { label: "Email Address", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1656
1861
  Input,
1657
1862
  {
1658
1863
  placeholder: "Enter Your Email Address",
@@ -1660,32 +1865,32 @@ function StepEmail(props) {
1660
1865
  value: emailVal
1661
1866
  }
1662
1867
  ) }),
1663
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { disabled: !canContinue, style: {
1868
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { disabled: !canContinue, style: {
1664
1869
  marginTop: "64px"
1665
1870
  }, onClick: onContinue, size: "lg", block: true, highlight: true, children: "Continue" })
1666
1871
  ] });
1667
1872
  }
1668
1873
 
1669
1874
  // src/components/EmailModal/StepVerify.tsx
1670
- var import_react10 = require("react");
1875
+ var import_react11 = require("react");
1671
1876
 
1672
1877
  // src/config/index.tsx
1673
1878
  var EMAIL_INTERVAL = 60;
1674
1879
  var EMAIL_CODE_LENGTH = 6;
1675
1880
 
1676
1881
  // src/components/EmailModal/StepVerify.tsx
1677
- var import_jsx_runtime30 = require("react/jsx-runtime");
1882
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1678
1883
  function StepVerify(props) {
1679
1884
  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");
1885
+ const [error, setError] = (0, import_react11.useState)("");
1886
+ const [code, setCode] = (0, import_react11.useState)("");
1887
+ const [sending, setSending] = (0, import_react11.useState)(false);
1888
+ const [submitting, setSubmitting] = (0, import_react11.useState)(false);
1889
+ const sendTimeRef = (0, import_react11.useRef)(0);
1890
+ const [sendBtnText, setSendBtnText] = (0, import_react11.useState)("Send");
1686
1891
  const intervalTime = EMAIL_INTERVAL;
1687
1892
  const codeLength = EMAIL_CODE_LENGTH;
1688
- const intervalRef = (0, import_react10.useRef)(null);
1893
+ const intervalRef = (0, import_react11.useRef)(null);
1689
1894
  const onSend = async () => {
1690
1895
  if (sendTimeRef.current > 0) {
1691
1896
  return;
@@ -1711,7 +1916,7 @@ function StepVerify(props) {
1711
1916
  setSending(false);
1712
1917
  }
1713
1918
  };
1714
- (0, import_react10.useEffect)(() => {
1919
+ (0, import_react11.useEffect)(() => {
1715
1920
  onSend();
1716
1921
  return () => {
1717
1922
  if (intervalRef.current) {
@@ -1719,7 +1924,7 @@ function StepVerify(props) {
1719
1924
  }
1720
1925
  };
1721
1926
  }, []);
1722
- const canContinue = (0, import_react10.useMemo)(() => {
1927
+ const canContinue = (0, import_react11.useMemo)(() => {
1723
1928
  return code.length === codeLength;
1724
1929
  }, [code]);
1725
1930
  const onContinue = async () => {
@@ -1743,22 +1948,22 @@ function StepVerify(props) {
1743
1948
  setSubmitting(false);
1744
1949
  }
1745
1950
  };
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" })
1951
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "matchid-email-verify-box", children: [
1952
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "matchid-email-verify-header", children: [
1953
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmailLineIcon, {}) }),
1954
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "matchid-email-verify-header-content", children: [
1955
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "matchid-email-verify-header-value", children: props.email }),
1956
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "matchid-email-verify-header-tips", children: "We have sent a verification code to your email" })
1752
1957
  ] })
1753
1958
  ] }),
1754
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Field, { label: "Verification Code", error, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1959
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Field, { label: "Verification Code", error, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1755
1960
  Input,
1756
1961
  {
1757
1962
  placeholder: "Enter the code",
1758
1963
  maxLength: codeLength,
1759
1964
  onChange: (e) => setCode(e.target.value),
1760
1965
  value: code,
1761
- after: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1966
+ after: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1762
1967
  Button,
1763
1968
  {
1764
1969
  highlight: true,
@@ -1777,12 +1982,12 @@ function StepVerify(props) {
1777
1982
  )
1778
1983
  }
1779
1984
  ) }),
1780
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { disabled: !canContinue, highlight: true, block: true, size: "lg", onClick: onContinue, children: "Continue" })
1985
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { disabled: !canContinue, highlight: true, block: true, size: "lg", onClick: onContinue, children: "Continue" })
1781
1986
  ] });
1782
1987
  }
1783
1988
 
1784
1989
  // src/components/EmailModal/index.tsx
1785
- var import_jsx_runtime31 = require("react/jsx-runtime");
1990
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1786
1991
  function EmailModal({
1787
1992
  isOpen = false,
1788
1993
  width = 480,
@@ -1790,15 +1995,15 @@ function EmailModal({
1790
1995
  onBack,
1791
1996
  onLogin
1792
1997
  }) {
1793
- const [step, setStep] = (0, import_react11.useState)("input");
1794
- const [emailVal, setEmailVal] = (0, import_react11.useState)("");
1795
- (0, import_react11.useEffect)(() => {
1998
+ const [step, setStep] = (0, import_react12.useState)("input");
1999
+ const [emailVal, setEmailVal] = (0, import_react12.useState)("");
2000
+ (0, import_react12.useEffect)(() => {
1796
2001
  if (!isOpen) {
1797
2002
  setStep("input");
1798
2003
  setEmailVal("");
1799
2004
  }
1800
2005
  }, [isOpen]);
1801
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2006
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1802
2007
  ModalWithHeader,
1803
2008
  {
1804
2009
  isOpen,
@@ -1806,31 +2011,62 @@ function EmailModal({
1806
2011
  onClose,
1807
2012
  title: "Email",
1808
2013
  onBack: step == "verify" ? () => setStep("input") : onBack,
1809
- children: step === "input" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StepEmail, { email: emailVal, onContinue: (email) => {
2014
+ children: step === "input" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StepEmail, { email: emailVal, onContinue: (email) => {
1810
2015
  setEmailVal(email);
1811
2016
  setStep("verify");
1812
- } }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StepVerify, { email: emailVal, onSuccess: onLogin })
2017
+ } }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StepVerify, { email: emailVal, onSuccess: onLogin })
2018
+ }
2019
+ );
2020
+ }
2021
+
2022
+ // src/components/Popover/index.tsx
2023
+ var import_react13 = require("react");
2024
+ var import_jsx_runtime38 = require("react/jsx-runtime");
2025
+ function Popover({
2026
+ children,
2027
+ content,
2028
+ position = "right",
2029
+ type = "hover",
2030
+ className = "",
2031
+ gap = "20px"
2032
+ }) {
2033
+ const [active, setActive] = (0, import_react13.useState)(false);
2034
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
2035
+ "div",
2036
+ {
2037
+ onClick: () => {
2038
+ if (type == "click") {
2039
+ setActive(!active);
2040
+ }
2041
+ },
2042
+ className: `matchid-popover-box matchid-popover-${position} matchid-popover-${type} ${className} ${type == "click" && active ? "matchid-popover-click-active" : ""}`,
2043
+ children: [
2044
+ children,
2045
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: {
2046
+ paddingTop: gap
2047
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: `matchid-popover-content`, children: content }) })
2048
+ ]
1813
2049
  }
1814
2050
  );
1815
2051
  }
1816
2052
 
1817
2053
  // src/components/LoginBox/index.tsx
1818
- var import_react12 = require("react");
1819
- var import_jsx_runtime32 = require("react/jsx-runtime");
2054
+ var import_react14 = require("react");
2055
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1820
2056
  function LoginBox({
1821
2057
  methods,
1822
2058
  inModal = false
1823
2059
  }) {
1824
- const [emailOpen, setEmailOpen] = (0, import_react12.useState)(false);
1825
- const { loginByTelegram, loginByTwitter, loginByGoogle, loginByWallet } = useUserInfo();
2060
+ const [emailOpen, setEmailOpen] = (0, import_react14.useState)(false);
2061
+ const { login } = useUserInfo();
1826
2062
  const defaultMethods = [
1827
2063
  "wallet",
1828
2064
  "google",
1829
2065
  "email",
1830
2066
  "telegram",
1831
- "X"
2067
+ "twitter"
1832
2068
  ];
1833
- const methodList = (0, import_react12.useMemo)(() => {
2069
+ const methodList = (0, import_react14.useMemo)(() => {
1834
2070
  return methods || defaultMethods;
1835
2071
  }, [methods]);
1836
2072
  const LoginItem = ({
@@ -1838,56 +2074,71 @@ function LoginBox({
1838
2074
  name,
1839
2075
  onClick
1840
2076
  }) => {
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 })
2077
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "matchid-login-method", onClick, children: [
2078
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "matchid-login-method-content", children: [
2079
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "matchid-login-method-icon", children: icon }),
2080
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "matchid-login-method-name", children: name })
1845
2081
  ] }),
1846
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ArrowRightIcon, { className: "matchid-login-method-arrow", size: 20, color: "var(--matchid-arrow-color)" })
2082
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ArrowRightIcon, { className: "matchid-login-method-arrow", size: 20, color: "var(--matchid-arrow-color)" })
1847
2083
  ] });
1848
2084
  };
1849
2085
  const methodMap = {
1850
2086
  wallet: {
1851
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WalletIcon, {}),
2087
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WalletIcon, {}),
1852
2088
  name: "Wallet",
1853
- onClick: loginByWallet
2089
+ onClick: () => login("wallet")
1854
2090
  },
1855
2091
  email: {
1856
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmailIcon, {}),
2092
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EmailIcon, {}),
1857
2093
  name: "Email",
1858
2094
  onClick: () => {
1859
2095
  setEmailOpen(true);
1860
2096
  }
1861
2097
  },
1862
2098
  google: {
1863
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GoogleIcon, {}),
2099
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GoogleIcon, {}),
1864
2100
  name: "Google",
1865
- onClick: loginByGoogle
2101
+ onClick: () => login("google")
1866
2102
  },
1867
- X: {
1868
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(XIcon, {}),
2103
+ twitter: {
2104
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(XIcon, {}),
1869
2105
  name: "X",
1870
- onClick: loginByTwitter
2106
+ onClick: () => login("twitter")
1871
2107
  },
1872
2108
  telegram: {
1873
- icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TelegramIcon, {}),
2109
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TelegramIcon, {}),
1874
2110
  name: "Telegram",
1875
- onClick: loginByTelegram
2111
+ onClick: () => login("telegram")
2112
+ },
2113
+ github: {
2114
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GithubIcon, {}),
2115
+ name: "Github",
2116
+ onClick: () => login("github")
2117
+ },
2118
+ discord: {
2119
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DiscordIcon, {}),
2120
+ name: "Discord",
2121
+ onClick: () => login("discord")
2122
+ },
2123
+ linkedin: {
2124
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LinkedinIcon, {}),
2125
+ name: "Linkedin",
2126
+ onClick: () => login("linkedin")
1876
2127
  }
1877
2128
  };
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)(
2129
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
2130
+ (!inModal || !emailOpen) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "matchid-login-box", children: methodList.map((m) => {
2131
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1881
2132
  LoginItem,
1882
2133
  {
1883
- icon: methodMap[m].icon,
1884
- name: methodMap[m].name,
1885
- onClick: methodMap[m].onClick
2134
+ icon: methodMap[m]?.icon,
2135
+ name: methodMap[m]?.name,
2136
+ onClick: methodMap[m]?.onClick
1886
2137
  },
1887
2138
  m
1888
2139
  );
1889
2140
  }) }),
1890
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2141
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1891
2142
  EmailModal,
1892
2143
  {
1893
2144
  isOpen: emailOpen,
@@ -1903,83 +2154,174 @@ function LoginBox({
1903
2154
  }
1904
2155
 
1905
2156
  // src/components/LoginButton/index.tsx
1906
- var import_react13 = require("react");
2157
+ var import_react16 = require("react");
1907
2158
 
1908
2159
  // src/components/LoginPanel/index.tsx
1909
- var import_jsx_runtime33 = require("react/jsx-runtime");
2160
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1910
2161
  function LoginPanel({
1911
2162
  header,
1912
2163
  onClose,
1913
2164
  ...props
1914
2165
  }) {
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" })
2166
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "matchid-login-panel", children: [
2167
+ header ? header : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "matchid-login-panel-header", children: [
2168
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "matchid-login-panel-header-content", children: [
2169
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "matchid-login-panel-header-title", children: "Log in / Sign up" }),
2170
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "matchid-login-panel-header-subtilte", children: "You can use the following methods" })
1920
2171
  ] }),
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, {}) })
2172
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CloseRoundIcon, {}) })
1922
2173
  ] }),
1923
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "matchid-login-panel-divide" }),
1924
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LoginBox, { ...props })
2174
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "matchid-login-panel-divide" }),
2175
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LoginBox, { ...props })
1925
2176
  ] });
1926
2177
  }
1927
2178
 
1928
2179
  // src/components/LoginModal/index.tsx
1929
- var import_jsx_runtime34 = require("react/jsx-runtime");
2180
+ var import_jsx_runtime41 = require("react/jsx-runtime");
1930
2181
  function LoginModal({
1931
2182
  isOpen = false,
1932
2183
  width = 480,
1933
2184
  ...props
1934
2185
  }) {
1935
2186
  const { isLogin } = useUserInfo();
1936
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2187
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
1937
2188
  Modal,
1938
2189
  {
1939
2190
  isOpen: isOpen && !isLogin,
1940
2191
  width,
1941
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LoginPanel, { ...props, inModal: true })
2192
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LoginPanel, { ...props, inModal: true })
1942
2193
  }
1943
2194
  );
1944
2195
  }
1945
2196
 
2197
+ // src/components/UserPopover/index.tsx
2198
+ var import_react15 = require("react");
2199
+
2200
+ // src/assets/icon/ProfileIcon.tsx
2201
+ var import_jsx_runtime42 = require("react/jsx-runtime");
2202
+ function ProfileIcon({ size = 24, color = "black", ...props }) {
2203
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2204
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2205
+ "path",
2206
+ {
2207
+ fillRule: "evenodd",
2208
+ clipRule: "evenodd",
2209
+ 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",
2210
+ fill: color
2211
+ }
2212
+ ),
2213
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2214
+ "path",
2215
+ {
2216
+ fillRule: "evenodd",
2217
+ clipRule: "evenodd",
2218
+ 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",
2219
+ fill: color
2220
+ }
2221
+ )
2222
+ ] });
2223
+ }
2224
+
2225
+ // src/components/UserPopover/index.tsx
2226
+ var import_jsx_runtime43 = require("react/jsx-runtime");
2227
+ function UserContent() {
2228
+ const { logout, address, username } = useUserInfo();
2229
+ const [logouting, setLogouting] = (0, import_react15.useState)(false);
2230
+ const onLogout = async () => {
2231
+ if (logouting) return;
2232
+ try {
2233
+ setLogouting(true);
2234
+ await logout();
2235
+ } catch (error) {
2236
+ console.error(error);
2237
+ } finally {
2238
+ setLogouting(false);
2239
+ }
2240
+ };
2241
+ const UserItem = ({
2242
+ children,
2243
+ icon,
2244
+ rightIcon,
2245
+ onClick
2246
+ }) => {
2247
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "matchid-user-popover-item", onClick, children: [
2248
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: `matchid-user-popover-item-content`, children: [
2249
+ icon,
2250
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "matchid-user-popover-item-text", children })
2251
+ ] }),
2252
+ rightIcon
2253
+ ] });
2254
+ };
2255
+ const UserDivider = () => {
2256
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `matchid-user-popover-divider` });
2257
+ };
2258
+ const [usernameOpen, setUsernameOpen] = (0, import_react15.useState)(false);
2259
+ const [copied, setCopied] = useCopyClipboard();
2260
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "matchid-user-popover-content", children: [
2261
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "matchid-user-popover-list", children: [
2262
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UserItem, { onClick: () => {
2263
+ setCopied(address);
2264
+ }, icon: copied ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckIcon, { size: 20, color: "#0ecb81" }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CopyIcon, { size: 20, color: "var(--icon-color)" }), rightIcon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckIcon, { size: 20, color: "var(--icon-color)" }), children: truncateAddress(address) }),
2265
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UserDivider, {}),
2266
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UserItem, { onClick: () => {
2267
+ setUsernameOpen(true);
2268
+ }, icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ProfileIcon, { size: 20, color: "var(--icon-color)" }), rightIcon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ArrowRightIcon, { size: 20, color: "var(--icon-color)" }), children: username || "Set a username" })
2269
+ ] }),
2270
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Button, { onClick: onLogout, loading: logouting, children: "Disconnect" }),
2271
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UsernameModal, { isOpen: usernameOpen, onClose: () => {
2272
+ setUsernameOpen(false);
2273
+ }, onSuccess: () => {
2274
+ setUsernameOpen(false);
2275
+ } })
2276
+ ] });
2277
+ }
2278
+ function UserPopover({
2279
+ children,
2280
+ ...props
2281
+ }) {
2282
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Popover, { ...props, content: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UserContent, {}), children });
2283
+ }
2284
+
1946
2285
  // src/components/LoginButton/index.tsx
1947
- var import_jsx_runtime35 = require("react/jsx-runtime");
2286
+ var import_jsx_runtime44 = require("react/jsx-runtime");
1948
2287
  function LoginButton({
1949
2288
  loginRender,
1950
2289
  methods,
1951
2290
  onLoginClick,
2291
+ popoverPosition = "right",
2292
+ popoverType = "hover",
2293
+ popoverGap = 20,
1952
2294
  ...props
1953
2295
  }) {
1954
2296
  const { isLogin, username } = useUserInfo();
1955
- const [loginOpen, setLoginOpen] = (0, import_react13.useState)(false);
2297
+ const [loginOpen, setLoginOpen] = (0, import_react16.useState)(false);
1956
2298
  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" })
2299
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
2300
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(LoginModal, { methods, isOpen: loginOpen, onClose: () => setLoginOpen(false) }),
2301
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Button, { className: "matchid-unlogin-btn", ...props, highlight: true, onClick: () => setLoginOpen(true), children: [
2302
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(UnLoginIcon_default, {}),
2303
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Login" })
1962
2304
  ] })
1963
2305
  ] });
1964
2306
  }
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
- ] });
2307
+ return loginRender ? { loginRender } : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(UserPopover, { position: popoverPosition, type: popoverType, gap: popoverGap, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Button, { onClick: onLoginClick, className: "matchid-login-btn", ...props, children: [
2308
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(LoginIcon_default, {}),
2309
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: username ? truncateAddress(username) : "MatchID User" })
2310
+ ] }) });
1969
2311
  }
1970
2312
 
1971
2313
  // src/components/UsernameModal/index.tsx
1972
- var import_react14 = require("react");
2314
+ var import_react17 = require("react");
1973
2315
 
1974
2316
  // src/assets/icon/InfoRoundIcon.tsx
1975
- var import_jsx_runtime36 = require("react/jsx-runtime");
2317
+ var import_jsx_runtime45 = require("react/jsx-runtime");
1976
2318
  function InfoRoundIcon({
1977
2319
  size,
1978
2320
  color = "#6E6E6E",
1979
2321
  ...props
1980
2322
  }) {
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)(
2323
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
2324
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("g", { clipPath: "url(#clip0_418_7746)", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
1983
2325
  "path",
1984
2326
  {
1985
2327
  fillRule: "evenodd",
@@ -1988,19 +2330,19 @@ function InfoRoundIcon({
1988
2330
  fill: color
1989
2331
  }
1990
2332
  ) }),
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" }) }) })
2333
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("clipPath", { id: "clip0_418_7746", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
1992
2334
  ] });
1993
2335
  }
1994
2336
 
1995
2337
  // src/components/UsernameModal/index.tsx
1996
- var import_jsx_runtime37 = require("react/jsx-runtime");
2338
+ var import_jsx_runtime46 = require("react/jsx-runtime");
1997
2339
  var ValidItem = ({
1998
2340
  success = false,
1999
2341
  text
2000
2342
  }) => {
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 })
2343
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
2344
+ success ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CheckRoundIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(InfoRoundIcon, { size: 16 }),
2345
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: text })
2004
2346
  ] });
2005
2347
  };
2006
2348
  function UsernameModal({
@@ -2011,22 +2353,22 @@ function UsernameModal({
2011
2353
  }) {
2012
2354
  const { username, refreshOverview } = useUserInfo();
2013
2355
  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)(() => {
2356
+ const [val, setVal] = (0, import_react17.useState)(username);
2357
+ const [error, setError] = (0, import_react17.useState)("");
2358
+ (0, import_react17.useEffect)(() => {
2017
2359
  if (isOpen) {
2018
2360
  setVal(username);
2019
2361
  setError("");
2020
2362
  }
2021
2363
  }, [isOpen]);
2022
- const isValid = (0, import_react14.useMemo)(() => {
2364
+ const isValid = (0, import_react17.useMemo)(() => {
2023
2365
  return isValidUsername(val);
2024
2366
  }, [val]);
2025
- const isLength = (0, import_react14.useMemo)(() => {
2367
+ const isLength = (0, import_react17.useMemo)(() => {
2026
2368
  return val.length >= 2 && val.length <= 32;
2027
2369
  }, [val]);
2028
2370
  const isSafe = isValid && isLength;
2029
- const [isSubmitting, setIsSubmitting] = (0, import_react14.useState)(false);
2371
+ const [isSubmitting, setIsSubmitting] = (0, import_react17.useState)(false);
2030
2372
  const onSubmit = async () => {
2031
2373
  if (isSubmitting) return;
2032
2374
  try {
@@ -2046,8 +2388,8 @@ function UsernameModal({
2046
2388
  setIsSubmitting(false);
2047
2389
  }
2048
2390
  };
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)(
2391
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || (username ? "Edit User Name" : "Set User Name"), children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "matchid-username-box", children: [
2392
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Field, { label: "User Name", error, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2051
2393
  Input,
2052
2394
  {
2053
2395
  placeholder: "Enter Your User Name",
@@ -2058,20 +2400,20 @@ function UsernameModal({
2058
2400
  value: val
2059
2401
  }
2060
2402
  ) }),
2061
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "matchid-valid", children: [
2062
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2403
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "matchid-valid", children: [
2404
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
2063
2405
  ValidItem,
2064
2406
  {
2065
2407
  success: isValid,
2066
2408
  text: "Name can be composed of numbers and letters as well as characters"
2067
2409
  }
2068
2410
  ),
2069
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ValidItem, { success: isLength, text: "No less than 2 characters" })
2411
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ValidItem, { success: isLength, text: "No less than 2 characters" })
2070
2412
  ] }),
2071
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { disabled: !isSafe, loading: isSubmitting, style: {
2413
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Button, { disabled: !isSafe, loading: isSubmitting, style: {
2072
2414
  marginTop: "64px"
2073
2415
  }, onClick: onSubmit, size: "lg", block: true, highlight: true, children: "Confirm" }),
2074
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { style: {
2416
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Button, { style: {
2075
2417
  marginTop: "24px"
2076
2418
  }, onClick: props.onClose, size: "lg", block: true, children: "Next Time" })
2077
2419
  ] }) });