@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.css +194 -63
- package/dist/index.d.mts +41 -16
- package/dist/index.d.ts +41 -16
- package/dist/index.js +553 -211
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -197
- package/dist/index.mjs.map +1 -1
- package/example/src/components/Login/index.tsx +14 -19
- package/example/src/config/index.ts +9 -0
- package/example/src/pages/User.tsx +29 -22
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -152,7 +152,7 @@ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
|
152
152
|
function EmailIcon({
|
|
153
153
|
size = 40
|
|
154
154
|
}) {
|
|
155
|
-
return /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.org/2000/svg", width:
|
|
155
|
+
return /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 40 40", fill: "none", children: [
|
|
156
156
|
/* @__PURE__ */ jsx8("rect", { width: "40", height: "40", rx: "8", fill: "url(#paint0_linear_124_10994)" }),
|
|
157
157
|
/* @__PURE__ */ jsx8(
|
|
158
158
|
"path",
|
|
@@ -357,23 +357,162 @@ function DeleteRoundIcon({ height = 21, width = 20, color = "var(--matchid-error
|
|
|
357
357
|
] });
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
// src/assets/icon/FacebookIcon.tsx
|
|
361
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
362
|
+
|
|
363
|
+
// src/assets/icon/GithubIcon.tsx
|
|
364
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
365
|
+
function GithubIcon({
|
|
366
|
+
size = 40
|
|
367
|
+
}) {
|
|
368
|
+
return /* @__PURE__ */ jsxs13("svg", { width: size, height: size, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
369
|
+
/* @__PURE__ */ jsx21("rect", { width: "40", height: "40", rx: "8", fill: "black" }),
|
|
370
|
+
/* @__PURE__ */ jsx21(
|
|
371
|
+
"path",
|
|
372
|
+
{
|
|
373
|
+
"fill-rule": "evenodd",
|
|
374
|
+
"clip-rule": "evenodd",
|
|
375
|
+
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",
|
|
376
|
+
fill: "white"
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ jsx21(
|
|
380
|
+
"path",
|
|
381
|
+
{
|
|
382
|
+
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",
|
|
383
|
+
fill: "white"
|
|
384
|
+
}
|
|
385
|
+
),
|
|
386
|
+
/* @__PURE__ */ jsx21(
|
|
387
|
+
"path",
|
|
388
|
+
{
|
|
389
|
+
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",
|
|
390
|
+
fill: "white"
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
/* @__PURE__ */ jsx21(
|
|
394
|
+
"path",
|
|
395
|
+
{
|
|
396
|
+
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",
|
|
397
|
+
fill: "white"
|
|
398
|
+
}
|
|
399
|
+
),
|
|
400
|
+
/* @__PURE__ */ jsx21(
|
|
401
|
+
"path",
|
|
402
|
+
{
|
|
403
|
+
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",
|
|
404
|
+
fill: "white"
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsx21(
|
|
408
|
+
"path",
|
|
409
|
+
{
|
|
410
|
+
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",
|
|
411
|
+
fill: "white"
|
|
412
|
+
}
|
|
413
|
+
),
|
|
414
|
+
/* @__PURE__ */ jsx21(
|
|
415
|
+
"path",
|
|
416
|
+
{
|
|
417
|
+
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",
|
|
418
|
+
fill: "white"
|
|
419
|
+
}
|
|
420
|
+
),
|
|
421
|
+
/* @__PURE__ */ jsx21(
|
|
422
|
+
"path",
|
|
423
|
+
{
|
|
424
|
+
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",
|
|
425
|
+
fill: "white"
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
] });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/assets/icon/DiscordIcon.tsx
|
|
432
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
433
|
+
function DiscordIcon({
|
|
434
|
+
size = 40
|
|
435
|
+
}) {
|
|
436
|
+
return /* @__PURE__ */ jsxs14("svg", { width: size, height: size, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
437
|
+
/* @__PURE__ */ jsx22("rect", { width: "40", height: "40", rx: "8", fill: "#5865F2" }),
|
|
438
|
+
/* @__PURE__ */ jsx22(
|
|
439
|
+
"path",
|
|
440
|
+
{
|
|
441
|
+
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",
|
|
442
|
+
fill: "white"
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] });
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// src/assets/icon/CheckIcon.tsx
|
|
449
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
450
|
+
function CheckIcon({
|
|
451
|
+
size = 20,
|
|
452
|
+
color = "black",
|
|
453
|
+
...props
|
|
454
|
+
}) {
|
|
455
|
+
return /* @__PURE__ */ jsx23("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx23(
|
|
456
|
+
"path",
|
|
457
|
+
{
|
|
458
|
+
d: "M5 9.99996L8.33333 13.3333L15 6.66663",
|
|
459
|
+
stroke: color,
|
|
460
|
+
strokeWidth: "1.5",
|
|
461
|
+
strokeLinecap: "round",
|
|
462
|
+
strokeLinejoin: "round"
|
|
463
|
+
}
|
|
464
|
+
) });
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/assets/icon/CopyIcon.tsx
|
|
468
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
469
|
+
function CopyIcon({ size = 20, color = "black", ...props }) {
|
|
470
|
+
return /* @__PURE__ */ jsx24("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx24(
|
|
471
|
+
"path",
|
|
472
|
+
{
|
|
473
|
+
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",
|
|
474
|
+
stroke: color,
|
|
475
|
+
strokeWidth: "1.5",
|
|
476
|
+
strokeLinecap: "round"
|
|
477
|
+
}
|
|
478
|
+
) });
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// src/assets/icon/LinkedinIcon.tsx
|
|
482
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
483
|
+
function LinkedinIcon({
|
|
484
|
+
size = 40,
|
|
485
|
+
...props
|
|
486
|
+
}) {
|
|
487
|
+
return /* @__PURE__ */ jsxs15("svg", { width: size, height: size, ...props, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
488
|
+
/* @__PURE__ */ jsx25("rect", { width: "40", height: "40", rx: "8", fill: "#0A66C2" }),
|
|
489
|
+
/* @__PURE__ */ jsx25(
|
|
490
|
+
"path",
|
|
491
|
+
{
|
|
492
|
+
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",
|
|
493
|
+
fill: "white"
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] });
|
|
497
|
+
}
|
|
498
|
+
|
|
360
499
|
// src/components/Modal/index.tsx
|
|
361
|
-
import { Fragment, jsx as
|
|
500
|
+
import { Fragment, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
362
501
|
function Modal({
|
|
363
502
|
children,
|
|
364
503
|
isOpen,
|
|
365
504
|
width = 480,
|
|
366
505
|
className = ""
|
|
367
506
|
}) {
|
|
368
|
-
return isOpen ? /* @__PURE__ */
|
|
507
|
+
return isOpen ? /* @__PURE__ */ jsx26(
|
|
369
508
|
"div",
|
|
370
509
|
{
|
|
371
510
|
className: "matchid-overlay",
|
|
372
|
-
children: /* @__PURE__ */
|
|
511
|
+
children: /* @__PURE__ */ jsx26("div", { className: `matchid-modal ${className}`, style: {
|
|
373
512
|
width
|
|
374
513
|
}, children })
|
|
375
514
|
}
|
|
376
|
-
) : /* @__PURE__ */
|
|
515
|
+
) : /* @__PURE__ */ jsx26(Fragment, {});
|
|
377
516
|
}
|
|
378
517
|
function ModalWithHeader({
|
|
379
518
|
children,
|
|
@@ -384,24 +523,24 @@ function ModalWithHeader({
|
|
|
384
523
|
showClose = true,
|
|
385
524
|
...props
|
|
386
525
|
}) {
|
|
387
|
-
return /* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
onBack && /* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ jsxs16(Modal, { ...props, children: [
|
|
527
|
+
/* @__PURE__ */ jsxs16("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
|
|
528
|
+
/* @__PURE__ */ jsxs16("div", { className: "matchid-modal-header-content", children: [
|
|
529
|
+
onBack && /* @__PURE__ */ jsx26(ArrowLeftIcon, { className: "matchid-modal-header-back", onClick: onBack }),
|
|
530
|
+
/* @__PURE__ */ jsx26("span", { className: "matchid-modal-header-title", children: title })
|
|
392
531
|
] }),
|
|
393
|
-
onClose && /* @__PURE__ */
|
|
532
|
+
onClose && /* @__PURE__ */ jsx26(CloseRoundIcon, { className: "matchid-modal-header-close", onClick: onClose })
|
|
394
533
|
] }),
|
|
395
534
|
children
|
|
396
535
|
] });
|
|
397
536
|
}
|
|
398
537
|
|
|
399
538
|
// src/components/PasswordModal/index.tsx
|
|
400
|
-
import { useEffect as
|
|
539
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useState as useState3 } from "react";
|
|
401
540
|
|
|
402
541
|
// src/components/Input/index.tsx
|
|
403
542
|
import { useState } from "react";
|
|
404
|
-
import { jsx as
|
|
543
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
405
544
|
function Input({
|
|
406
545
|
onChange,
|
|
407
546
|
type,
|
|
@@ -410,22 +549,22 @@ function Input({
|
|
|
410
549
|
...props
|
|
411
550
|
}) {
|
|
412
551
|
const [inputType, setInputType] = useState(type);
|
|
413
|
-
return /* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
props.value.length > 0 && /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ jsxs17("div", { className: `matchid-input-box ${props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`, children: [
|
|
553
|
+
/* @__PURE__ */ jsx27("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
|
|
554
|
+
props.value.length > 0 && /* @__PURE__ */ jsx27(DeleteRoundIcon, { onClick: (e) => {
|
|
416
555
|
if (onChange) {
|
|
417
556
|
onChange({ target: { value: "" } });
|
|
418
557
|
}
|
|
419
558
|
}, className: "matchid-input-delete-icon", color: "var(--matchid-input-delete-icon-color)" }),
|
|
420
|
-
type === "password" && /* @__PURE__ */
|
|
559
|
+
type === "password" && /* @__PURE__ */ jsx27("div", { className: "matchid-input-eye-icon", onClick: () => {
|
|
421
560
|
setInputType(inputType === "password" ? "text" : "password");
|
|
422
|
-
}, children: inputType === "password" ? /* @__PURE__ */
|
|
561
|
+
}, children: inputType === "password" ? /* @__PURE__ */ jsx27(CloseEyeIcon, {}) : /* @__PURE__ */ jsx27(OpenEyeIcon, {}) }),
|
|
423
562
|
after
|
|
424
563
|
] });
|
|
425
564
|
}
|
|
426
565
|
|
|
427
566
|
// src/components/Field/index.tsx
|
|
428
|
-
import { jsx as
|
|
567
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
429
568
|
function Field({
|
|
430
569
|
label,
|
|
431
570
|
children,
|
|
@@ -433,18 +572,18 @@ function Field({
|
|
|
433
572
|
required,
|
|
434
573
|
className = ""
|
|
435
574
|
}) {
|
|
436
|
-
return /* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
required && /* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ jsxs18("div", { className: `matchid-field-box ${className}`, children: [
|
|
576
|
+
/* @__PURE__ */ jsxs18("div", { className: "matchid-field-label", children: [
|
|
577
|
+
required && /* @__PURE__ */ jsx28("span", { className: "matchid-field-required", children: "*" }),
|
|
439
578
|
label
|
|
440
579
|
] }),
|
|
441
580
|
children,
|
|
442
|
-
error && /* @__PURE__ */
|
|
581
|
+
error && /* @__PURE__ */ jsx28("div", { className: "matchid-field-error", children: error })
|
|
443
582
|
] });
|
|
444
583
|
}
|
|
445
584
|
|
|
446
585
|
// src/components/Button/index.tsx
|
|
447
|
-
import { jsx as
|
|
586
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
448
587
|
function Button({
|
|
449
588
|
size = "df",
|
|
450
589
|
disabled = false,
|
|
@@ -463,7 +602,7 @@ function Button({
|
|
|
463
602
|
onClick && onClick();
|
|
464
603
|
}
|
|
465
604
|
};
|
|
466
|
-
return /* @__PURE__ */
|
|
605
|
+
return /* @__PURE__ */ jsx29(
|
|
467
606
|
"button",
|
|
468
607
|
{
|
|
469
608
|
type,
|
|
@@ -473,7 +612,7 @@ function Button({
|
|
|
473
612
|
...style
|
|
474
613
|
},
|
|
475
614
|
onClick: onAction,
|
|
476
|
-
children: loading ? /* @__PURE__ */
|
|
615
|
+
children: loading ? /* @__PURE__ */ jsx29(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
|
|
477
616
|
}
|
|
478
617
|
);
|
|
479
618
|
}
|
|
@@ -481,6 +620,7 @@ function Button({
|
|
|
481
620
|
// src/hooks/index.tsx
|
|
482
621
|
var hooks_exports = {};
|
|
483
622
|
__export(hooks_exports, {
|
|
623
|
+
useCopyClipboard: () => useCopyClipboard,
|
|
484
624
|
useMatchEvents: () => useMatchEvents,
|
|
485
625
|
useUserInfo: () => useUserInfo,
|
|
486
626
|
useWallet: () => useWallet
|
|
@@ -830,10 +970,10 @@ function useUserInfo() {
|
|
|
830
970
|
events && events.onLogout && events.onLogout();
|
|
831
971
|
eventManager_default.emit("onLogout");
|
|
832
972
|
};
|
|
833
|
-
const loginByMethod = (method) => {
|
|
973
|
+
const loginByMethod = async (method) => {
|
|
834
974
|
const link = `${endpoints.back}api/v1/auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.auth + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
835
975
|
matchlog_default.log("link", link);
|
|
836
|
-
|
|
976
|
+
return window.open(
|
|
837
977
|
link,
|
|
838
978
|
// Replace with the actual authorization URL
|
|
839
979
|
"authWindow",
|
|
@@ -841,10 +981,42 @@ function useUserInfo() {
|
|
|
841
981
|
);
|
|
842
982
|
};
|
|
843
983
|
const loginByTwitter = () => {
|
|
844
|
-
loginByMethod("twitter");
|
|
984
|
+
return loginByMethod("twitter");
|
|
845
985
|
};
|
|
846
986
|
const loginByGoogle = () => {
|
|
847
|
-
loginByMethod("google");
|
|
987
|
+
return loginByMethod("google");
|
|
988
|
+
};
|
|
989
|
+
const loginByWallet = async () => {
|
|
990
|
+
return window.open(
|
|
991
|
+
`${endpoints.auth}login/wallet?appid=${appid}`,
|
|
992
|
+
// Replace with the actual authorization URL
|
|
993
|
+
"_blank"
|
|
994
|
+
// 'width=800,height=600'
|
|
995
|
+
);
|
|
996
|
+
};
|
|
997
|
+
const loginByTelegram = async () => {
|
|
998
|
+
return window.open(
|
|
999
|
+
`${endpoints.auth}login/telegram?appid=${appid}`,
|
|
1000
|
+
// Replace with the actual authorization URL
|
|
1001
|
+
"authWindow",
|
|
1002
|
+
"width=800,height=600"
|
|
1003
|
+
);
|
|
1004
|
+
};
|
|
1005
|
+
const loginMethod = async (method) => {
|
|
1006
|
+
switch (method) {
|
|
1007
|
+
case "wallet":
|
|
1008
|
+
return await loginByWallet();
|
|
1009
|
+
case "telegram":
|
|
1010
|
+
return await loginByTelegram();
|
|
1011
|
+
case "twitter":
|
|
1012
|
+
case "google":
|
|
1013
|
+
case "discord":
|
|
1014
|
+
case "github":
|
|
1015
|
+
case "linkedin":
|
|
1016
|
+
return await loginByMethod(method);
|
|
1017
|
+
default:
|
|
1018
|
+
throw new Error("unsupported method");
|
|
1019
|
+
}
|
|
848
1020
|
};
|
|
849
1021
|
const getLoginEmailCode = async (email) => {
|
|
850
1022
|
const res = await getEmailCodeApi(email);
|
|
@@ -880,22 +1052,6 @@ function useUserInfo() {
|
|
|
880
1052
|
}
|
|
881
1053
|
return false;
|
|
882
1054
|
};
|
|
883
|
-
const loginByWallet = () => {
|
|
884
|
-
const authWindow = window.open(
|
|
885
|
-
`${endpoints.auth}login/wallet?appid=${appid}`,
|
|
886
|
-
// Replace with the actual authorization URL
|
|
887
|
-
"_blank"
|
|
888
|
-
// 'width=800,height=600'
|
|
889
|
-
);
|
|
890
|
-
};
|
|
891
|
-
const loginByTelegram = () => {
|
|
892
|
-
const authWindow = window.open(
|
|
893
|
-
`${endpoints.auth}login/telegram?appid=${appid}`,
|
|
894
|
-
// Replace with the actual authorization URL
|
|
895
|
-
"authWindow",
|
|
896
|
-
"width=800,height=600"
|
|
897
|
-
);
|
|
898
|
-
};
|
|
899
1055
|
const refreshOverview = async () => {
|
|
900
1056
|
const res = await getOverviewInfoApi();
|
|
901
1057
|
if (res.data) {
|
|
@@ -930,7 +1086,30 @@ function useUserInfo() {
|
|
|
930
1086
|
}
|
|
931
1087
|
throw new Error(res.message);
|
|
932
1088
|
};
|
|
1089
|
+
const bind = async (method) => {
|
|
1090
|
+
switch (method) {
|
|
1091
|
+
case "wallet":
|
|
1092
|
+
return await bindWallet();
|
|
1093
|
+
case "telegram":
|
|
1094
|
+
return await bindTelegram();
|
|
1095
|
+
case "twitter":
|
|
1096
|
+
case "google":
|
|
1097
|
+
case "discord":
|
|
1098
|
+
case "github":
|
|
1099
|
+
case "linkedin":
|
|
1100
|
+
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}`;
|
|
1101
|
+
matchlog_default.log("link", link);
|
|
1102
|
+
return window.open(
|
|
1103
|
+
link,
|
|
1104
|
+
"authWindow",
|
|
1105
|
+
"width=800,height=600"
|
|
1106
|
+
);
|
|
1107
|
+
default:
|
|
1108
|
+
throw new Error("unsupported method");
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
933
1111
|
return {
|
|
1112
|
+
loginByMethod,
|
|
934
1113
|
loginByTelegram,
|
|
935
1114
|
loginByTwitter,
|
|
936
1115
|
loginByGoogle,
|
|
@@ -948,7 +1127,9 @@ function useUserInfo() {
|
|
|
948
1127
|
bindWallet,
|
|
949
1128
|
bindTelegram,
|
|
950
1129
|
username: overview?.username || "",
|
|
951
|
-
auth
|
|
1130
|
+
auth,
|
|
1131
|
+
login: loginMethod,
|
|
1132
|
+
bind
|
|
952
1133
|
};
|
|
953
1134
|
}
|
|
954
1135
|
|
|
@@ -1117,8 +1298,31 @@ function useWallet() {
|
|
|
1117
1298
|
};
|
|
1118
1299
|
}
|
|
1119
1300
|
|
|
1301
|
+
// src/hooks/useCopyClipboard.ts
|
|
1302
|
+
import copy from "copy-to-clipboard";
|
|
1303
|
+
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
1304
|
+
function useCopyClipboard(timeout = 500) {
|
|
1305
|
+
const [isCopied, setIsCopied] = useState2(false);
|
|
1306
|
+
const staticCopy = useCallback((text) => {
|
|
1307
|
+
const didCopy = copy(text);
|
|
1308
|
+
setIsCopied(didCopy);
|
|
1309
|
+
}, []);
|
|
1310
|
+
useEffect2(() => {
|
|
1311
|
+
if (isCopied) {
|
|
1312
|
+
const hide = setTimeout(() => {
|
|
1313
|
+
setIsCopied(false);
|
|
1314
|
+
}, timeout);
|
|
1315
|
+
return () => {
|
|
1316
|
+
clearTimeout(hide);
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
return void 0;
|
|
1320
|
+
}, [isCopied, setIsCopied, timeout]);
|
|
1321
|
+
return [isCopied, staticCopy];
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1120
1324
|
// src/components/PasswordModal/index.tsx
|
|
1121
|
-
import { jsx as
|
|
1325
|
+
import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1122
1326
|
function PasswordModal({
|
|
1123
1327
|
title,
|
|
1124
1328
|
isOpen,
|
|
@@ -1127,9 +1331,9 @@ function PasswordModal({
|
|
|
1127
1331
|
}) {
|
|
1128
1332
|
const { refreshOverview } = useUserInfo();
|
|
1129
1333
|
const { isLogin, did } = useUserInfo();
|
|
1130
|
-
const [password, setPassword] =
|
|
1131
|
-
const [rePassword, setRePassword] =
|
|
1132
|
-
const [error, setError] =
|
|
1334
|
+
const [password, setPassword] = useState3("");
|
|
1335
|
+
const [rePassword, setRePassword] = useState3("");
|
|
1336
|
+
const [error, setError] = useState3("");
|
|
1133
1337
|
const { generateWallet } = useWallet();
|
|
1134
1338
|
const passwordError = useMemo2(() => {
|
|
1135
1339
|
if (password.length < 6) return "Password must be at least 6 characters";
|
|
@@ -1141,13 +1345,13 @@ function PasswordModal({
|
|
|
1141
1345
|
}
|
|
1142
1346
|
return "";
|
|
1143
1347
|
}, [rePassword, password]);
|
|
1144
|
-
|
|
1348
|
+
useEffect3(() => {
|
|
1145
1349
|
if (isOpen) {
|
|
1146
1350
|
setPassword("");
|
|
1147
1351
|
setRePassword("");
|
|
1148
1352
|
}
|
|
1149
1353
|
}, [isOpen]);
|
|
1150
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1354
|
+
const [isSubmitting, setIsSubmitting] = useState3(false);
|
|
1151
1355
|
const onContinue = async () => {
|
|
1152
1356
|
if (isSubmitting) return;
|
|
1153
1357
|
try {
|
|
@@ -1164,13 +1368,13 @@ function PasswordModal({
|
|
|
1164
1368
|
setIsSubmitting(false);
|
|
1165
1369
|
}
|
|
1166
1370
|
};
|
|
1167
|
-
return /* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
/* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ jsx30(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Set Password", children: /* @__PURE__ */ jsxs19("div", { className: "matchid-password-box", children: [
|
|
1372
|
+
/* @__PURE__ */ jsxs19("div", { className: "matchid-password-header", children: [
|
|
1373
|
+
/* @__PURE__ */ jsx30("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ jsx30(PasswordRoundIcon, {}) }),
|
|
1374
|
+
/* @__PURE__ */ jsx30("div", { className: "matchid-password-header-content", children: "Please set the wallet password that will be used to recover the wallet" })
|
|
1171
1375
|
] }),
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ jsxs19("div", { className: "matchid-password-content", children: [
|
|
1377
|
+
/* @__PURE__ */ jsx30(Field, { label: "Password", error: password.length > 0 && passwordError, children: /* @__PURE__ */ jsx30(
|
|
1174
1378
|
Input,
|
|
1175
1379
|
{
|
|
1176
1380
|
placeholder: "Enter the Password",
|
|
@@ -1180,7 +1384,7 @@ function PasswordModal({
|
|
|
1180
1384
|
value: password
|
|
1181
1385
|
}
|
|
1182
1386
|
) }),
|
|
1183
|
-
/* @__PURE__ */
|
|
1387
|
+
/* @__PURE__ */ jsx30(Field, { label: "Re Password", error: rePassword.length > 0 ? rePasswordError || error : error, children: /* @__PURE__ */ jsx30(
|
|
1184
1388
|
Input,
|
|
1185
1389
|
{
|
|
1186
1390
|
placeholder: "Re Enter the Password",
|
|
@@ -1191,7 +1395,7 @@ function PasswordModal({
|
|
|
1191
1395
|
}
|
|
1192
1396
|
) })
|
|
1193
1397
|
] }),
|
|
1194
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ jsx30(
|
|
1195
1399
|
Button,
|
|
1196
1400
|
{
|
|
1197
1401
|
disabled: password.length == 0 || !!passwordError || !!rePasswordError,
|
|
@@ -1207,8 +1411,8 @@ function PasswordModal({
|
|
|
1207
1411
|
}
|
|
1208
1412
|
|
|
1209
1413
|
// src/components/RecoveryModal/index.tsx
|
|
1210
|
-
import { useEffect as
|
|
1211
|
-
import { jsx as
|
|
1414
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState4 } from "react";
|
|
1415
|
+
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1212
1416
|
function RecoveryModal({
|
|
1213
1417
|
title,
|
|
1214
1418
|
isOpen,
|
|
@@ -1217,19 +1421,19 @@ function RecoveryModal({
|
|
|
1217
1421
|
}) {
|
|
1218
1422
|
const { refreshOverview } = useUserInfo();
|
|
1219
1423
|
const { isLogin } = useUserInfo();
|
|
1220
|
-
const [password, setPassword] =
|
|
1424
|
+
const [password, setPassword] = useState4("");
|
|
1221
1425
|
const { recoveryWallet } = useWallet();
|
|
1222
|
-
const [error, setError] =
|
|
1426
|
+
const [error, setError] = useState4("");
|
|
1223
1427
|
const passwordError = useMemo3(() => {
|
|
1224
1428
|
if (password.length < 6) return "Password must be at least 6 characters";
|
|
1225
1429
|
return "";
|
|
1226
1430
|
}, [password]);
|
|
1227
|
-
|
|
1431
|
+
useEffect4(() => {
|
|
1228
1432
|
if (isOpen) {
|
|
1229
1433
|
setPassword("");
|
|
1230
1434
|
}
|
|
1231
1435
|
}, [isOpen]);
|
|
1232
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1436
|
+
const [isSubmitting, setIsSubmitting] = useState4(false);
|
|
1233
1437
|
const onContinue = async () => {
|
|
1234
1438
|
if (isSubmitting) return;
|
|
1235
1439
|
try {
|
|
@@ -1244,12 +1448,12 @@ function RecoveryModal({
|
|
|
1244
1448
|
setIsSubmitting(false);
|
|
1245
1449
|
}
|
|
1246
1450
|
};
|
|
1247
|
-
return /* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ jsx31(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || "Recover Wallet", children: /* @__PURE__ */ jsxs20("div", { className: "matchid-password-box", children: [
|
|
1452
|
+
/* @__PURE__ */ jsxs20("div", { className: "matchid-password-header", children: [
|
|
1453
|
+
/* @__PURE__ */ jsx31("div", { className: "matchid-password-header-icon", children: /* @__PURE__ */ jsx31(PasswordRoundIcon, {}) }),
|
|
1454
|
+
/* @__PURE__ */ jsx31("div", { className: "matchid-password-header-content", children: "Please enter your password to recover your wallet" })
|
|
1251
1455
|
] }),
|
|
1252
|
-
/* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ jsx31("div", { className: "matchid-password-content", children: /* @__PURE__ */ jsx31(Field, { label: "Password", error: password.length > 0 ? passwordError || error : error, children: /* @__PURE__ */ jsx31(
|
|
1253
1457
|
Input,
|
|
1254
1458
|
{
|
|
1255
1459
|
placeholder: "Enter the Password",
|
|
@@ -1259,7 +1463,7 @@ function RecoveryModal({
|
|
|
1259
1463
|
value: password
|
|
1260
1464
|
}
|
|
1261
1465
|
) }) }),
|
|
1262
|
-
/* @__PURE__ */
|
|
1466
|
+
/* @__PURE__ */ jsx31(
|
|
1263
1467
|
Button,
|
|
1264
1468
|
{
|
|
1265
1469
|
disabled: password.length == 0 || !!passwordError,
|
|
@@ -1275,13 +1479,13 @@ function RecoveryModal({
|
|
|
1275
1479
|
}
|
|
1276
1480
|
|
|
1277
1481
|
// src/context/BusinessProvider.tsx
|
|
1278
|
-
import { Fragment as Fragment2, jsx as
|
|
1482
|
+
import { Fragment as Fragment2, jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1279
1483
|
function BusinessProvider({ children }) {
|
|
1280
1484
|
const { overview, token } = useUserInfo();
|
|
1281
1485
|
const { recoveryModal } = useStore_default();
|
|
1282
|
-
return /* @__PURE__ */
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1486
|
+
return /* @__PURE__ */ jsxs21(Fragment2, { children: [
|
|
1487
|
+
/* @__PURE__ */ jsx32(PasswordModal, { isOpen: !!token && !!overview && !overview.address && !!overview.did, showClose: false }),
|
|
1488
|
+
/* @__PURE__ */ jsx32(
|
|
1285
1489
|
RecoveryModal,
|
|
1286
1490
|
{
|
|
1287
1491
|
isOpen: !!token && !!overview && !!overview.address && recoveryModal.open,
|
|
@@ -1294,17 +1498,17 @@ function BusinessProvider({ children }) {
|
|
|
1294
1498
|
}
|
|
1295
1499
|
|
|
1296
1500
|
// src/context/index.tsx
|
|
1297
|
-
import { jsx as
|
|
1501
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1298
1502
|
var Providers = ({ children }) => {
|
|
1299
1503
|
return (
|
|
1300
1504
|
// <MpcWalletProvider>
|
|
1301
|
-
/* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ jsx33(BusinessProvider, { children })
|
|
1302
1506
|
);
|
|
1303
1507
|
};
|
|
1304
1508
|
var context_default = Providers;
|
|
1305
1509
|
|
|
1306
1510
|
// src/hooks/useWalletInit.ts
|
|
1307
|
-
import { useEffect as
|
|
1511
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
1308
1512
|
var AppClientId2 = "react-sdk-" + getVersion();
|
|
1309
1513
|
function useWalletInit({
|
|
1310
1514
|
refreshOverview
|
|
@@ -1313,10 +1517,10 @@ function useWalletInit({
|
|
|
1313
1517
|
const getWalletIframe = () => {
|
|
1314
1518
|
return document.getElementById("match-wallet");
|
|
1315
1519
|
};
|
|
1316
|
-
const [walletInited, setWalletInited] =
|
|
1520
|
+
const [walletInited, setWalletInited] = useState5(false);
|
|
1317
1521
|
const { appid, token, overview } = useLocalStore_default();
|
|
1318
1522
|
const { initWallet, generateWallet } = useWallet();
|
|
1319
|
-
|
|
1523
|
+
useEffect5(() => {
|
|
1320
1524
|
if (endpoints.auth) {
|
|
1321
1525
|
if (!window.matchWalletMessageIdMap) {
|
|
1322
1526
|
window.matchWalletMessageIdMap = {};
|
|
@@ -1374,7 +1578,7 @@ function useWalletInit({
|
|
|
1374
1578
|
}
|
|
1375
1579
|
}
|
|
1376
1580
|
}, [endpoints.auth]);
|
|
1377
|
-
|
|
1581
|
+
useEffect5(() => {
|
|
1378
1582
|
const messageHandle = async (e) => {
|
|
1379
1583
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
1380
1584
|
return;
|
|
@@ -1407,7 +1611,7 @@ function useWalletInit({
|
|
|
1407
1611
|
window.removeEventListener("message", messageHandle);
|
|
1408
1612
|
};
|
|
1409
1613
|
}, []);
|
|
1410
|
-
|
|
1614
|
+
useEffect5(() => {
|
|
1411
1615
|
if (token && overview && overview.did && walletInited) {
|
|
1412
1616
|
const did = overview.did.split(":")[2];
|
|
1413
1617
|
const newUserInit = async () => {
|
|
@@ -1438,7 +1642,7 @@ function useWalletInit({
|
|
|
1438
1642
|
}
|
|
1439
1643
|
|
|
1440
1644
|
// src/hooks/useInit.tsx
|
|
1441
|
-
import { useEffect as
|
|
1645
|
+
import { useEffect as useEffect6, useRef } from "react";
|
|
1442
1646
|
function useInit({
|
|
1443
1647
|
theme,
|
|
1444
1648
|
appid,
|
|
@@ -1458,16 +1662,16 @@ function useInit({
|
|
|
1458
1662
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1459
1663
|
const matchToken = searchParams.get("matchToken");
|
|
1460
1664
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
1461
|
-
|
|
1665
|
+
useEffect6(() => {
|
|
1462
1666
|
setTheme(theme);
|
|
1463
1667
|
}, [theme]);
|
|
1464
|
-
|
|
1668
|
+
useEffect6(() => {
|
|
1465
1669
|
setAppid(appid);
|
|
1466
1670
|
}, [appid]);
|
|
1467
|
-
|
|
1671
|
+
useEffect6(() => {
|
|
1468
1672
|
setEndpoints(realEndpoints);
|
|
1469
1673
|
}, [realEndpoints]);
|
|
1470
|
-
|
|
1674
|
+
useEffect6(() => {
|
|
1471
1675
|
if (matchToken) {
|
|
1472
1676
|
const tokenData = JSON.parse(atob(matchToken));
|
|
1473
1677
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -1478,7 +1682,7 @@ function useInit({
|
|
|
1478
1682
|
}
|
|
1479
1683
|
}
|
|
1480
1684
|
}, [matchToken]);
|
|
1481
|
-
|
|
1685
|
+
useEffect6(() => {
|
|
1482
1686
|
const onLoginMessage = (event) => {
|
|
1483
1687
|
const res = event.data;
|
|
1484
1688
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -1514,7 +1718,7 @@ function useInit({
|
|
|
1514
1718
|
overviewLoadingRef.current = false;
|
|
1515
1719
|
}
|
|
1516
1720
|
};
|
|
1517
|
-
|
|
1721
|
+
useEffect6(() => {
|
|
1518
1722
|
if (token) {
|
|
1519
1723
|
loadOverview();
|
|
1520
1724
|
}
|
|
@@ -1545,7 +1749,7 @@ function useInit({
|
|
|
1545
1749
|
|
|
1546
1750
|
// src/MatchContext.tsx
|
|
1547
1751
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
1548
|
-
import { jsx as
|
|
1752
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1549
1753
|
var queryClient = new QueryClient();
|
|
1550
1754
|
var MatchContext = createContext(void 0);
|
|
1551
1755
|
var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) => {
|
|
@@ -1558,7 +1762,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) =>
|
|
|
1558
1762
|
useWalletInit({
|
|
1559
1763
|
refreshOverview: loadOverview
|
|
1560
1764
|
});
|
|
1561
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ jsx34(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx34(
|
|
1562
1766
|
MatchContext.Provider,
|
|
1563
1767
|
{
|
|
1564
1768
|
value: {
|
|
@@ -1568,7 +1772,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints }) =>
|
|
|
1568
1772
|
login,
|
|
1569
1773
|
theme
|
|
1570
1774
|
},
|
|
1571
|
-
children: /* @__PURE__ */
|
|
1775
|
+
children: /* @__PURE__ */ jsx34(context_default, { children })
|
|
1572
1776
|
}
|
|
1573
1777
|
) });
|
|
1574
1778
|
};
|
|
@@ -1594,18 +1798,19 @@ __export(components_exports, {
|
|
|
1594
1798
|
Modal: () => Modal,
|
|
1595
1799
|
ModalWithHeader: () => ModalWithHeader,
|
|
1596
1800
|
PasswordModal: () => PasswordModal,
|
|
1801
|
+
Popover: () => Popover,
|
|
1597
1802
|
UsernameModal: () => UsernameModal
|
|
1598
1803
|
});
|
|
1599
1804
|
|
|
1600
1805
|
// src/components/EmailModal/index.tsx
|
|
1601
|
-
import { useEffect as
|
|
1806
|
+
import { useEffect as useEffect10, useState as useState9 } from "react";
|
|
1602
1807
|
|
|
1603
1808
|
// src/components/EmailModal/StepEmail.tsx
|
|
1604
|
-
import { useEffect as
|
|
1605
|
-
import { jsx as
|
|
1809
|
+
import { useEffect as useEffect8, useMemo as useMemo4, useState as useState7 } from "react";
|
|
1810
|
+
import { jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1606
1811
|
function StepEmail(props) {
|
|
1607
|
-
const [emailVal, setEmailVal] =
|
|
1608
|
-
|
|
1812
|
+
const [emailVal, setEmailVal] = useState7("");
|
|
1813
|
+
useEffect8(() => {
|
|
1609
1814
|
if (props.email) {
|
|
1610
1815
|
setEmailVal(props.email);
|
|
1611
1816
|
}
|
|
@@ -1616,8 +1821,8 @@ function StepEmail(props) {
|
|
|
1616
1821
|
const onContinue = async () => {
|
|
1617
1822
|
props.onContinue(emailVal);
|
|
1618
1823
|
};
|
|
1619
|
-
return /* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1824
|
+
return /* @__PURE__ */ jsxs22("div", { className: "matchid-email-email-box", children: [
|
|
1825
|
+
/* @__PURE__ */ jsx35(Field, { label: "Email Address", children: /* @__PURE__ */ jsx35(
|
|
1621
1826
|
Input,
|
|
1622
1827
|
{
|
|
1623
1828
|
placeholder: "Enter Your Email Address",
|
|
@@ -1625,29 +1830,29 @@ function StepEmail(props) {
|
|
|
1625
1830
|
value: emailVal
|
|
1626
1831
|
}
|
|
1627
1832
|
) }),
|
|
1628
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ jsx35(Button, { disabled: !canContinue, style: {
|
|
1629
1834
|
marginTop: "64px"
|
|
1630
1835
|
}, onClick: onContinue, size: "lg", block: true, highlight: true, children: "Continue" })
|
|
1631
1836
|
] });
|
|
1632
1837
|
}
|
|
1633
1838
|
|
|
1634
1839
|
// src/components/EmailModal/StepVerify.tsx
|
|
1635
|
-
import { useEffect as
|
|
1840
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef3, useState as useState8 } from "react";
|
|
1636
1841
|
|
|
1637
1842
|
// src/config/index.tsx
|
|
1638
1843
|
var EMAIL_INTERVAL = 60;
|
|
1639
1844
|
var EMAIL_CODE_LENGTH = 6;
|
|
1640
1845
|
|
|
1641
1846
|
// src/components/EmailModal/StepVerify.tsx
|
|
1642
|
-
import { jsx as
|
|
1847
|
+
import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1643
1848
|
function StepVerify(props) {
|
|
1644
1849
|
const { getLoginEmailCode, loginByEmail } = useUserInfo();
|
|
1645
|
-
const [error, setError] =
|
|
1646
|
-
const [code, setCode] =
|
|
1647
|
-
const [sending, setSending] =
|
|
1648
|
-
const [submitting, setSubmitting] =
|
|
1850
|
+
const [error, setError] = useState8("");
|
|
1851
|
+
const [code, setCode] = useState8("");
|
|
1852
|
+
const [sending, setSending] = useState8(false);
|
|
1853
|
+
const [submitting, setSubmitting] = useState8(false);
|
|
1649
1854
|
const sendTimeRef = useRef3(0);
|
|
1650
|
-
const [sendBtnText, setSendBtnText] =
|
|
1855
|
+
const [sendBtnText, setSendBtnText] = useState8("Send");
|
|
1651
1856
|
const intervalTime = EMAIL_INTERVAL;
|
|
1652
1857
|
const codeLength = EMAIL_CODE_LENGTH;
|
|
1653
1858
|
const intervalRef = useRef3(null);
|
|
@@ -1676,7 +1881,7 @@ function StepVerify(props) {
|
|
|
1676
1881
|
setSending(false);
|
|
1677
1882
|
}
|
|
1678
1883
|
};
|
|
1679
|
-
|
|
1884
|
+
useEffect9(() => {
|
|
1680
1885
|
onSend();
|
|
1681
1886
|
return () => {
|
|
1682
1887
|
if (intervalRef.current) {
|
|
@@ -1708,22 +1913,22 @@ function StepVerify(props) {
|
|
|
1708
1913
|
setSubmitting(false);
|
|
1709
1914
|
}
|
|
1710
1915
|
};
|
|
1711
|
-
return /* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsxs23("div", { className: "matchid-email-verify-box", children: [
|
|
1917
|
+
/* @__PURE__ */ jsxs23("div", { className: "matchid-email-verify-header", children: [
|
|
1918
|
+
/* @__PURE__ */ jsx36("div", { className: "matchid-email-verify-header-icon", children: /* @__PURE__ */ jsx36(EmailLineIcon, {}) }),
|
|
1919
|
+
/* @__PURE__ */ jsxs23("div", { className: "matchid-email-verify-header-content", children: [
|
|
1920
|
+
/* @__PURE__ */ jsx36("div", { className: "matchid-email-verify-header-value", children: props.email }),
|
|
1921
|
+
/* @__PURE__ */ jsx36("div", { className: "matchid-email-verify-header-tips", children: "We have sent a verification code to your email" })
|
|
1717
1922
|
] })
|
|
1718
1923
|
] }),
|
|
1719
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ jsx36(Field, { label: "Verification Code", error, children: /* @__PURE__ */ jsx36(
|
|
1720
1925
|
Input,
|
|
1721
1926
|
{
|
|
1722
1927
|
placeholder: "Enter the code",
|
|
1723
1928
|
maxLength: codeLength,
|
|
1724
1929
|
onChange: (e) => setCode(e.target.value),
|
|
1725
1930
|
value: code,
|
|
1726
|
-
after: /* @__PURE__ */
|
|
1931
|
+
after: /* @__PURE__ */ jsx36(
|
|
1727
1932
|
Button,
|
|
1728
1933
|
{
|
|
1729
1934
|
highlight: true,
|
|
@@ -1742,12 +1947,12 @@ function StepVerify(props) {
|
|
|
1742
1947
|
)
|
|
1743
1948
|
}
|
|
1744
1949
|
) }),
|
|
1745
|
-
/* @__PURE__ */
|
|
1950
|
+
/* @__PURE__ */ jsx36(Button, { disabled: !canContinue, highlight: true, block: true, size: "lg", onClick: onContinue, children: "Continue" })
|
|
1746
1951
|
] });
|
|
1747
1952
|
}
|
|
1748
1953
|
|
|
1749
1954
|
// src/components/EmailModal/index.tsx
|
|
1750
|
-
import { jsx as
|
|
1955
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1751
1956
|
function EmailModal({
|
|
1752
1957
|
isOpen = false,
|
|
1753
1958
|
width = 480,
|
|
@@ -1755,15 +1960,15 @@ function EmailModal({
|
|
|
1755
1960
|
onBack,
|
|
1756
1961
|
onLogin
|
|
1757
1962
|
}) {
|
|
1758
|
-
const [step, setStep] =
|
|
1759
|
-
const [emailVal, setEmailVal] =
|
|
1760
|
-
|
|
1963
|
+
const [step, setStep] = useState9("input");
|
|
1964
|
+
const [emailVal, setEmailVal] = useState9("");
|
|
1965
|
+
useEffect10(() => {
|
|
1761
1966
|
if (!isOpen) {
|
|
1762
1967
|
setStep("input");
|
|
1763
1968
|
setEmailVal("");
|
|
1764
1969
|
}
|
|
1765
1970
|
}, [isOpen]);
|
|
1766
|
-
return /* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ jsx37(
|
|
1767
1972
|
ModalWithHeader,
|
|
1768
1973
|
{
|
|
1769
1974
|
isOpen,
|
|
@@ -1771,29 +1976,60 @@ function EmailModal({
|
|
|
1771
1976
|
onClose,
|
|
1772
1977
|
title: "Email",
|
|
1773
1978
|
onBack: step == "verify" ? () => setStep("input") : onBack,
|
|
1774
|
-
children: step === "input" ? /* @__PURE__ */
|
|
1979
|
+
children: step === "input" ? /* @__PURE__ */ jsx37(StepEmail, { email: emailVal, onContinue: (email) => {
|
|
1775
1980
|
setEmailVal(email);
|
|
1776
1981
|
setStep("verify");
|
|
1777
|
-
} }) : /* @__PURE__ */
|
|
1982
|
+
} }) : /* @__PURE__ */ jsx37(StepVerify, { email: emailVal, onSuccess: onLogin })
|
|
1983
|
+
}
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
// src/components/Popover/index.tsx
|
|
1988
|
+
import { useState as useState10 } from "react";
|
|
1989
|
+
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1990
|
+
function Popover({
|
|
1991
|
+
children,
|
|
1992
|
+
content,
|
|
1993
|
+
position = "right",
|
|
1994
|
+
type = "hover",
|
|
1995
|
+
className = "",
|
|
1996
|
+
gap = "20px"
|
|
1997
|
+
}) {
|
|
1998
|
+
const [active, setActive] = useState10(false);
|
|
1999
|
+
return /* @__PURE__ */ jsxs24(
|
|
2000
|
+
"div",
|
|
2001
|
+
{
|
|
2002
|
+
onClick: () => {
|
|
2003
|
+
if (type == "click") {
|
|
2004
|
+
setActive(!active);
|
|
2005
|
+
}
|
|
2006
|
+
},
|
|
2007
|
+
className: `matchid-popover-box matchid-popover-${position} matchid-popover-${type} ${className} ${type == "click" && active ? "matchid-popover-click-active" : ""}`,
|
|
2008
|
+
children: [
|
|
2009
|
+
children,
|
|
2010
|
+
/* @__PURE__ */ jsx38("div", { style: {
|
|
2011
|
+
paddingTop: gap
|
|
2012
|
+
}, children: /* @__PURE__ */ jsx38("div", { className: `matchid-popover-content`, children: content }) })
|
|
2013
|
+
]
|
|
1778
2014
|
}
|
|
1779
2015
|
);
|
|
1780
2016
|
}
|
|
1781
2017
|
|
|
1782
2018
|
// src/components/LoginBox/index.tsx
|
|
1783
|
-
import { useMemo as useMemo6, useState as
|
|
1784
|
-
import { Fragment as Fragment3, jsx as
|
|
2019
|
+
import { useMemo as useMemo6, useState as useState11 } from "react";
|
|
2020
|
+
import { Fragment as Fragment3, jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1785
2021
|
function LoginBox({
|
|
1786
2022
|
methods,
|
|
1787
2023
|
inModal = false
|
|
1788
2024
|
}) {
|
|
1789
|
-
const [emailOpen, setEmailOpen] =
|
|
1790
|
-
const {
|
|
2025
|
+
const [emailOpen, setEmailOpen] = useState11(false);
|
|
2026
|
+
const { login } = useUserInfo();
|
|
1791
2027
|
const defaultMethods = [
|
|
1792
2028
|
"wallet",
|
|
1793
2029
|
"google",
|
|
1794
2030
|
"email",
|
|
1795
2031
|
"telegram",
|
|
1796
|
-
"
|
|
2032
|
+
"twitter"
|
|
1797
2033
|
];
|
|
1798
2034
|
const methodList = useMemo6(() => {
|
|
1799
2035
|
return methods || defaultMethods;
|
|
@@ -1803,56 +2039,71 @@ function LoginBox({
|
|
|
1803
2039
|
name,
|
|
1804
2040
|
onClick
|
|
1805
2041
|
}) => {
|
|
1806
|
-
return /* @__PURE__ */
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
2042
|
+
return /* @__PURE__ */ jsxs25("div", { className: "matchid-login-method", onClick, children: [
|
|
2043
|
+
/* @__PURE__ */ jsxs25("div", { className: "matchid-login-method-content", children: [
|
|
2044
|
+
/* @__PURE__ */ jsx39("div", { className: "matchid-login-method-icon", children: icon }),
|
|
2045
|
+
/* @__PURE__ */ jsx39("span", { className: "matchid-login-method-name", children: name })
|
|
1810
2046
|
] }),
|
|
1811
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsx39(ArrowRightIcon, { className: "matchid-login-method-arrow", size: 20, color: "var(--matchid-arrow-color)" })
|
|
1812
2048
|
] });
|
|
1813
2049
|
};
|
|
1814
2050
|
const methodMap = {
|
|
1815
2051
|
wallet: {
|
|
1816
|
-
icon: /* @__PURE__ */
|
|
2052
|
+
icon: /* @__PURE__ */ jsx39(WalletIcon, {}),
|
|
1817
2053
|
name: "Wallet",
|
|
1818
|
-
onClick:
|
|
2054
|
+
onClick: () => login("wallet")
|
|
1819
2055
|
},
|
|
1820
2056
|
email: {
|
|
1821
|
-
icon: /* @__PURE__ */
|
|
2057
|
+
icon: /* @__PURE__ */ jsx39(EmailIcon, {}),
|
|
1822
2058
|
name: "Email",
|
|
1823
2059
|
onClick: () => {
|
|
1824
2060
|
setEmailOpen(true);
|
|
1825
2061
|
}
|
|
1826
2062
|
},
|
|
1827
2063
|
google: {
|
|
1828
|
-
icon: /* @__PURE__ */
|
|
2064
|
+
icon: /* @__PURE__ */ jsx39(GoogleIcon, {}),
|
|
1829
2065
|
name: "Google",
|
|
1830
|
-
onClick:
|
|
2066
|
+
onClick: () => login("google")
|
|
1831
2067
|
},
|
|
1832
|
-
|
|
1833
|
-
icon: /* @__PURE__ */
|
|
2068
|
+
twitter: {
|
|
2069
|
+
icon: /* @__PURE__ */ jsx39(XIcon, {}),
|
|
1834
2070
|
name: "X",
|
|
1835
|
-
onClick:
|
|
2071
|
+
onClick: () => login("twitter")
|
|
1836
2072
|
},
|
|
1837
2073
|
telegram: {
|
|
1838
|
-
icon: /* @__PURE__ */
|
|
2074
|
+
icon: /* @__PURE__ */ jsx39(TelegramIcon, {}),
|
|
1839
2075
|
name: "Telegram",
|
|
1840
|
-
onClick:
|
|
2076
|
+
onClick: () => login("telegram")
|
|
2077
|
+
},
|
|
2078
|
+
github: {
|
|
2079
|
+
icon: /* @__PURE__ */ jsx39(GithubIcon, {}),
|
|
2080
|
+
name: "Github",
|
|
2081
|
+
onClick: () => login("github")
|
|
2082
|
+
},
|
|
2083
|
+
discord: {
|
|
2084
|
+
icon: /* @__PURE__ */ jsx39(DiscordIcon, {}),
|
|
2085
|
+
name: "Discord",
|
|
2086
|
+
onClick: () => login("discord")
|
|
2087
|
+
},
|
|
2088
|
+
linkedin: {
|
|
2089
|
+
icon: /* @__PURE__ */ jsx39(LinkedinIcon, {}),
|
|
2090
|
+
name: "Linkedin",
|
|
2091
|
+
onClick: () => login("linkedin")
|
|
1841
2092
|
}
|
|
1842
2093
|
};
|
|
1843
|
-
return /* @__PURE__ */
|
|
1844
|
-
(!inModal || !emailOpen) && /* @__PURE__ */
|
|
1845
|
-
return /* @__PURE__ */
|
|
2094
|
+
return /* @__PURE__ */ jsxs25(Fragment3, { children: [
|
|
2095
|
+
(!inModal || !emailOpen) && /* @__PURE__ */ jsx39("div", { className: "matchid-login-box", children: methodList.map((m) => {
|
|
2096
|
+
return /* @__PURE__ */ jsx39(
|
|
1846
2097
|
LoginItem,
|
|
1847
2098
|
{
|
|
1848
|
-
icon: methodMap[m]
|
|
1849
|
-
name: methodMap[m]
|
|
1850
|
-
onClick: methodMap[m]
|
|
2099
|
+
icon: methodMap[m]?.icon,
|
|
2100
|
+
name: methodMap[m]?.name,
|
|
2101
|
+
onClick: methodMap[m]?.onClick
|
|
1851
2102
|
},
|
|
1852
2103
|
m
|
|
1853
2104
|
);
|
|
1854
2105
|
}) }),
|
|
1855
|
-
/* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ jsx39(
|
|
1856
2107
|
EmailModal,
|
|
1857
2108
|
{
|
|
1858
2109
|
isOpen: emailOpen,
|
|
@@ -1868,83 +2119,174 @@ function LoginBox({
|
|
|
1868
2119
|
}
|
|
1869
2120
|
|
|
1870
2121
|
// src/components/LoginButton/index.tsx
|
|
1871
|
-
import { useState as
|
|
2122
|
+
import { useState as useState13 } from "react";
|
|
1872
2123
|
|
|
1873
2124
|
// src/components/LoginPanel/index.tsx
|
|
1874
|
-
import { jsx as
|
|
2125
|
+
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1875
2126
|
function LoginPanel({
|
|
1876
2127
|
header,
|
|
1877
2128
|
onClose,
|
|
1878
2129
|
...props
|
|
1879
2130
|
}) {
|
|
1880
|
-
return /* @__PURE__ */
|
|
1881
|
-
header ? header : /* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
2131
|
+
return /* @__PURE__ */ jsxs26("div", { className: "matchid-login-panel", children: [
|
|
2132
|
+
header ? header : /* @__PURE__ */ jsxs26("div", { className: "matchid-login-panel-header", children: [
|
|
2133
|
+
/* @__PURE__ */ jsxs26("div", { className: "matchid-login-panel-header-content", children: [
|
|
2134
|
+
/* @__PURE__ */ jsx40("div", { className: "matchid-login-panel-header-title", children: "Log in / Sign up" }),
|
|
2135
|
+
/* @__PURE__ */ jsx40("div", { className: "matchid-login-panel-header-subtilte", children: "You can use the following methods" })
|
|
1885
2136
|
] }),
|
|
1886
|
-
onClose && /* @__PURE__ */
|
|
2137
|
+
onClose && /* @__PURE__ */ jsx40("div", { className: "matchid-login-panel-header-close", onClick: onClose, children: /* @__PURE__ */ jsx40(CloseRoundIcon, {}) })
|
|
1887
2138
|
] }),
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
2139
|
+
/* @__PURE__ */ jsx40("div", { className: "matchid-login-panel-divide" }),
|
|
2140
|
+
/* @__PURE__ */ jsx40(LoginBox, { ...props })
|
|
1890
2141
|
] });
|
|
1891
2142
|
}
|
|
1892
2143
|
|
|
1893
2144
|
// src/components/LoginModal/index.tsx
|
|
1894
|
-
import { jsx as
|
|
2145
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
1895
2146
|
function LoginModal({
|
|
1896
2147
|
isOpen = false,
|
|
1897
2148
|
width = 480,
|
|
1898
2149
|
...props
|
|
1899
2150
|
}) {
|
|
1900
2151
|
const { isLogin } = useUserInfo();
|
|
1901
|
-
return /* @__PURE__ */
|
|
2152
|
+
return /* @__PURE__ */ jsx41(
|
|
1902
2153
|
Modal,
|
|
1903
2154
|
{
|
|
1904
2155
|
isOpen: isOpen && !isLogin,
|
|
1905
2156
|
width,
|
|
1906
|
-
children: /* @__PURE__ */
|
|
2157
|
+
children: /* @__PURE__ */ jsx41(LoginPanel, { ...props, inModal: true })
|
|
1907
2158
|
}
|
|
1908
2159
|
);
|
|
1909
2160
|
}
|
|
1910
2161
|
|
|
2162
|
+
// src/components/UserPopover/index.tsx
|
|
2163
|
+
import { useState as useState12 } from "react";
|
|
2164
|
+
|
|
2165
|
+
// src/assets/icon/ProfileIcon.tsx
|
|
2166
|
+
import { jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2167
|
+
function ProfileIcon({ size = 24, color = "black", ...props }) {
|
|
2168
|
+
return /* @__PURE__ */ jsxs27("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2169
|
+
/* @__PURE__ */ jsx42(
|
|
2170
|
+
"path",
|
|
2171
|
+
{
|
|
2172
|
+
fillRule: "evenodd",
|
|
2173
|
+
clipRule: "evenodd",
|
|
2174
|
+
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",
|
|
2175
|
+
fill: color
|
|
2176
|
+
}
|
|
2177
|
+
),
|
|
2178
|
+
/* @__PURE__ */ jsx42(
|
|
2179
|
+
"path",
|
|
2180
|
+
{
|
|
2181
|
+
fillRule: "evenodd",
|
|
2182
|
+
clipRule: "evenodd",
|
|
2183
|
+
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",
|
|
2184
|
+
fill: color
|
|
2185
|
+
}
|
|
2186
|
+
)
|
|
2187
|
+
] });
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
// src/components/UserPopover/index.tsx
|
|
2191
|
+
import { jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2192
|
+
function UserContent() {
|
|
2193
|
+
const { logout, address, username } = useUserInfo();
|
|
2194
|
+
const [logouting, setLogouting] = useState12(false);
|
|
2195
|
+
const onLogout = async () => {
|
|
2196
|
+
if (logouting) return;
|
|
2197
|
+
try {
|
|
2198
|
+
setLogouting(true);
|
|
2199
|
+
await logout();
|
|
2200
|
+
} catch (error) {
|
|
2201
|
+
console.error(error);
|
|
2202
|
+
} finally {
|
|
2203
|
+
setLogouting(false);
|
|
2204
|
+
}
|
|
2205
|
+
};
|
|
2206
|
+
const UserItem = ({
|
|
2207
|
+
children,
|
|
2208
|
+
icon,
|
|
2209
|
+
rightIcon,
|
|
2210
|
+
onClick
|
|
2211
|
+
}) => {
|
|
2212
|
+
return /* @__PURE__ */ jsxs28("div", { className: "matchid-user-popover-item", onClick, children: [
|
|
2213
|
+
/* @__PURE__ */ jsxs28("div", { className: `matchid-user-popover-item-content`, children: [
|
|
2214
|
+
icon,
|
|
2215
|
+
/* @__PURE__ */ jsx43("div", { className: "matchid-user-popover-item-text", children })
|
|
2216
|
+
] }),
|
|
2217
|
+
rightIcon
|
|
2218
|
+
] });
|
|
2219
|
+
};
|
|
2220
|
+
const UserDivider = () => {
|
|
2221
|
+
return /* @__PURE__ */ jsx43("div", { className: `matchid-user-popover-divider` });
|
|
2222
|
+
};
|
|
2223
|
+
const [usernameOpen, setUsernameOpen] = useState12(false);
|
|
2224
|
+
const [copied, setCopied] = useCopyClipboard();
|
|
2225
|
+
return /* @__PURE__ */ jsxs28("div", { className: "matchid-user-popover-content", children: [
|
|
2226
|
+
/* @__PURE__ */ jsxs28("div", { className: "matchid-user-popover-list", children: [
|
|
2227
|
+
/* @__PURE__ */ jsx43(UserItem, { onClick: () => {
|
|
2228
|
+
setCopied(address);
|
|
2229
|
+
}, icon: copied ? /* @__PURE__ */ jsx43(CheckIcon, { size: 20, color: "#0ecb81" }) : /* @__PURE__ */ jsx43(CopyIcon, { size: 20, color: "var(--icon-color)" }), rightIcon: /* @__PURE__ */ jsx43(CheckIcon, { size: 20, color: "var(--icon-color)" }), children: truncateAddress(address) }),
|
|
2230
|
+
/* @__PURE__ */ jsx43(UserDivider, {}),
|
|
2231
|
+
/* @__PURE__ */ jsx43(UserItem, { onClick: () => {
|
|
2232
|
+
setUsernameOpen(true);
|
|
2233
|
+
}, icon: /* @__PURE__ */ jsx43(ProfileIcon, { size: 20, color: "var(--icon-color)" }), rightIcon: /* @__PURE__ */ jsx43(ArrowRightIcon, { size: 20, color: "var(--icon-color)" }), children: username || "Set a username" })
|
|
2234
|
+
] }),
|
|
2235
|
+
/* @__PURE__ */ jsx43(Button, { onClick: onLogout, loading: logouting, children: "Disconnect" }),
|
|
2236
|
+
/* @__PURE__ */ jsx43(UsernameModal, { isOpen: usernameOpen, onClose: () => {
|
|
2237
|
+
setUsernameOpen(false);
|
|
2238
|
+
}, onSuccess: () => {
|
|
2239
|
+
setUsernameOpen(false);
|
|
2240
|
+
} })
|
|
2241
|
+
] });
|
|
2242
|
+
}
|
|
2243
|
+
function UserPopover({
|
|
2244
|
+
children,
|
|
2245
|
+
...props
|
|
2246
|
+
}) {
|
|
2247
|
+
return /* @__PURE__ */ jsx43(Popover, { ...props, content: /* @__PURE__ */ jsx43(UserContent, {}), children });
|
|
2248
|
+
}
|
|
2249
|
+
|
|
1911
2250
|
// src/components/LoginButton/index.tsx
|
|
1912
|
-
import { Fragment as Fragment4, jsx as
|
|
2251
|
+
import { Fragment as Fragment4, jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
1913
2252
|
function LoginButton({
|
|
1914
2253
|
loginRender,
|
|
1915
2254
|
methods,
|
|
1916
2255
|
onLoginClick,
|
|
2256
|
+
popoverPosition = "right",
|
|
2257
|
+
popoverType = "hover",
|
|
2258
|
+
popoverGap = 20,
|
|
1917
2259
|
...props
|
|
1918
2260
|
}) {
|
|
1919
2261
|
const { isLogin, username } = useUserInfo();
|
|
1920
|
-
const [loginOpen, setLoginOpen] =
|
|
2262
|
+
const [loginOpen, setLoginOpen] = useState13(false);
|
|
1921
2263
|
if (!isLogin) {
|
|
1922
|
-
return /* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
2264
|
+
return /* @__PURE__ */ jsxs29(Fragment4, { children: [
|
|
2265
|
+
/* @__PURE__ */ jsx44(LoginModal, { methods, isOpen: loginOpen, onClose: () => setLoginOpen(false) }),
|
|
2266
|
+
/* @__PURE__ */ jsxs29(Button, { className: "matchid-unlogin-btn", ...props, highlight: true, onClick: () => setLoginOpen(true), children: [
|
|
2267
|
+
/* @__PURE__ */ jsx44(UnLoginIcon_default, {}),
|
|
2268
|
+
/* @__PURE__ */ jsx44("span", { children: "Login" })
|
|
1927
2269
|
] })
|
|
1928
2270
|
] });
|
|
1929
2271
|
}
|
|
1930
|
-
return loginRender ? loginRender(
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
] });
|
|
2272
|
+
return loginRender ? { loginRender } : /* @__PURE__ */ jsx44(UserPopover, { position: popoverPosition, type: popoverType, gap: popoverGap, children: /* @__PURE__ */ jsxs29(Button, { onClick: onLoginClick, className: "matchid-login-btn", ...props, children: [
|
|
2273
|
+
/* @__PURE__ */ jsx44(LoginIcon_default, {}),
|
|
2274
|
+
/* @__PURE__ */ jsx44("span", { children: username ? truncateAddress(username) : "MatchID User" })
|
|
2275
|
+
] }) });
|
|
1934
2276
|
}
|
|
1935
2277
|
|
|
1936
2278
|
// src/components/UsernameModal/index.tsx
|
|
1937
|
-
import { useEffect as
|
|
2279
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useState as useState14 } from "react";
|
|
1938
2280
|
|
|
1939
2281
|
// src/assets/icon/InfoRoundIcon.tsx
|
|
1940
|
-
import { jsx as
|
|
2282
|
+
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
1941
2283
|
function InfoRoundIcon({
|
|
1942
2284
|
size,
|
|
1943
2285
|
color = "#6E6E6E",
|
|
1944
2286
|
...props
|
|
1945
2287
|
}) {
|
|
1946
|
-
return /* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
2288
|
+
return /* @__PURE__ */ jsxs30("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
2289
|
+
/* @__PURE__ */ jsx45("g", { clipPath: "url(#clip0_418_7746)", children: /* @__PURE__ */ jsx45(
|
|
1948
2290
|
"path",
|
|
1949
2291
|
{
|
|
1950
2292
|
fillRule: "evenodd",
|
|
@@ -1953,19 +2295,19 @@ function InfoRoundIcon({
|
|
|
1953
2295
|
fill: color
|
|
1954
2296
|
}
|
|
1955
2297
|
) }),
|
|
1956
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ jsx45("defs", { children: /* @__PURE__ */ jsx45("clipPath", { id: "clip0_418_7746", children: /* @__PURE__ */ jsx45("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
1957
2299
|
] });
|
|
1958
2300
|
}
|
|
1959
2301
|
|
|
1960
2302
|
// src/components/UsernameModal/index.tsx
|
|
1961
|
-
import { jsx as
|
|
2303
|
+
import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
1962
2304
|
var ValidItem = ({
|
|
1963
2305
|
success = false,
|
|
1964
2306
|
text
|
|
1965
2307
|
}) => {
|
|
1966
|
-
return /* @__PURE__ */
|
|
1967
|
-
success ? /* @__PURE__ */
|
|
1968
|
-
/* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ jsxs31("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
|
|
2309
|
+
success ? /* @__PURE__ */ jsx46(CheckRoundIcon, { size: 16 }) : /* @__PURE__ */ jsx46(InfoRoundIcon, { size: 16 }),
|
|
2310
|
+
/* @__PURE__ */ jsx46("span", { children: text })
|
|
1969
2311
|
] });
|
|
1970
2312
|
};
|
|
1971
2313
|
function UsernameModal({
|
|
@@ -1976,9 +2318,9 @@ function UsernameModal({
|
|
|
1976
2318
|
}) {
|
|
1977
2319
|
const { username, refreshOverview } = useUserInfo();
|
|
1978
2320
|
const { isLogin } = useUserInfo();
|
|
1979
|
-
const [val, setVal] =
|
|
1980
|
-
const [error, setError] =
|
|
1981
|
-
|
|
2321
|
+
const [val, setVal] = useState14(username);
|
|
2322
|
+
const [error, setError] = useState14("");
|
|
2323
|
+
useEffect11(() => {
|
|
1982
2324
|
if (isOpen) {
|
|
1983
2325
|
setVal(username);
|
|
1984
2326
|
setError("");
|
|
@@ -1991,7 +2333,7 @@ function UsernameModal({
|
|
|
1991
2333
|
return val.length >= 2 && val.length <= 32;
|
|
1992
2334
|
}, [val]);
|
|
1993
2335
|
const isSafe = isValid && isLength;
|
|
1994
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2336
|
+
const [isSubmitting, setIsSubmitting] = useState14(false);
|
|
1995
2337
|
const onSubmit = async () => {
|
|
1996
2338
|
if (isSubmitting) return;
|
|
1997
2339
|
try {
|
|
@@ -2011,8 +2353,8 @@ function UsernameModal({
|
|
|
2011
2353
|
setIsSubmitting(false);
|
|
2012
2354
|
}
|
|
2013
2355
|
};
|
|
2014
|
-
return /* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2356
|
+
return /* @__PURE__ */ jsx46(ModalWithHeader, { isOpen: isOpen && isLogin, ...props, title: title || (username ? "Edit User Name" : "Set User Name"), children: /* @__PURE__ */ jsxs31("div", { className: "matchid-username-box", children: [
|
|
2357
|
+
/* @__PURE__ */ jsx46(Field, { label: "User Name", error, children: /* @__PURE__ */ jsx46(
|
|
2016
2358
|
Input,
|
|
2017
2359
|
{
|
|
2018
2360
|
placeholder: "Enter Your User Name",
|
|
@@ -2023,20 +2365,20 @@ function UsernameModal({
|
|
|
2023
2365
|
value: val
|
|
2024
2366
|
}
|
|
2025
2367
|
) }),
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2368
|
+
/* @__PURE__ */ jsxs31("div", { className: "matchid-valid", children: [
|
|
2369
|
+
/* @__PURE__ */ jsx46(
|
|
2028
2370
|
ValidItem,
|
|
2029
2371
|
{
|
|
2030
2372
|
success: isValid,
|
|
2031
2373
|
text: "Name can be composed of numbers and letters as well as characters"
|
|
2032
2374
|
}
|
|
2033
2375
|
),
|
|
2034
|
-
/* @__PURE__ */
|
|
2376
|
+
/* @__PURE__ */ jsx46(ValidItem, { success: isLength, text: "No less than 2 characters" })
|
|
2035
2377
|
] }),
|
|
2036
|
-
/* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ jsx46(Button, { disabled: !isSafe, loading: isSubmitting, style: {
|
|
2037
2379
|
marginTop: "64px"
|
|
2038
2380
|
}, onClick: onSubmit, size: "lg", block: true, highlight: true, children: "Confirm" }),
|
|
2039
|
-
/* @__PURE__ */
|
|
2381
|
+
/* @__PURE__ */ jsx46(Button, { style: {
|
|
2040
2382
|
marginTop: "24px"
|
|
2041
2383
|
}, onClick: props.onClose, size: "lg", block: true, children: "Next Time" })
|
|
2042
2384
|
] }) });
|