@matchain/matchid-sdk-react 0.1.31 → 0.1.33

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.mjs CHANGED
@@ -512,6 +512,19 @@ function LinkedinIcon({
512
512
 
513
513
  // src/assets/icon/YoutubeIcon.tsx
514
514
  import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
515
+ function YoutubeIcon({ size = 40, ...props }) {
516
+ return /* @__PURE__ */ jsxs16("svg", { width: size, height: size, ...{ props }, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
517
+ /* @__PURE__ */ jsx26("rect", { width: "40", height: "40", rx: "8", fill: "#FF0000" }),
518
+ /* @__PURE__ */ jsx26(
519
+ "path",
520
+ {
521
+ d: "M33.9855 13.1304C33.656 11.9065 32.691 10.9415 31.4671 10.612C29.231 10 20.287 10 20.287 10C20.287 10 11.3429 10 9.10689 10.5884C7.9065 10.9179 6.91794 11.9065 6.58843 13.1304C6 15.3664 6 20.0032 6 20.0032C6 20.0032 6 24.6636 6.58843 26.876C6.91794 28.1 7.88296 29.065 9.10689 29.3945C11.3664 30.0065 20.287 30.0065 20.287 30.0065C20.287 30.0065 29.231 30.0065 31.4671 29.418C32.691 29.0885 33.656 28.1235 33.9855 26.8996C34.5739 24.6636 34.5739 20.0268 34.5739 20.0268C34.5739 20.0268 34.5975 15.3664 33.9855 13.1304Z",
522
+ fill: "white"
523
+ }
524
+ ),
525
+ /* @__PURE__ */ jsx26("path", { d: "M17.439 24.2867L24.8767 20.003L17.439 15.7192V24.2867Z", fill: "#FF0000" })
526
+ ] });
527
+ }
515
528
 
516
529
  // src/assets/icon/BTCDarkIcon.tsx
517
530
  import { jsx as jsx27 } from "react/jsx-runtime";
@@ -630,7 +643,7 @@ function ArrowDownIcon({ width = 20, height = 21, color = "black", ...props }) {
630
643
  {
631
644
  d: "M5 7.5L9.29289 11.7929C9.68342 12.1834 10.3166 12.1834 10.7071 11.7929L15 7.5",
632
645
  stroke: color,
633
- "stroke-width": "1.5",
646
+ strokeWidth: "1.5",
634
647
  strokeLinecap: "round",
635
648
  strokeLinejoin: "round"
636
649
  }
@@ -1139,6 +1152,9 @@ function truncateAddress(address) {
1139
1152
  const end = address.slice(-2);
1140
1153
  return `${start}...${end}`;
1141
1154
  }
1155
+ function getAppClientId() {
1156
+ return "react-sdk-" + getVersion();
1157
+ }
1142
1158
 
1143
1159
  // src/store/useModalStore.ts
1144
1160
  import { create as create2 } from "zustand";
@@ -1176,7 +1192,7 @@ function useUserInfo() {
1176
1192
  eventManager_default.emit("onLogout");
1177
1193
  };
1178
1194
  const loginByMethod = async (method) => {
1179
- const link = `${endpoints.back}api/v1/auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.auth + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
1195
+ const link = `${endpoints.back}api/v1/auth/${method == "youtube" ? "google" : method}?appid=${appid}&provider=${method == "youtube" ? "google" : method}&redirect=${encodeURIComponent(endpoints.auth + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}${method == "youtube" ? "&auth_type=youtube" : ""}`;
1180
1196
  matchlog_default.log("link", link);
1181
1197
  return window.open(
1182
1198
  link,
@@ -1210,6 +1226,7 @@ function useUserInfo() {
1210
1226
  return SOLOpen("login");
1211
1227
  case "telegram":
1212
1228
  return await loginByTelegram();
1229
+ case "youtube":
1213
1230
  case "twitter":
1214
1231
  case "google":
1215
1232
  case "discord":
@@ -1302,7 +1319,8 @@ function useUserInfo() {
1302
1319
  case "github":
1303
1320
  case "linkedin":
1304
1321
  case "facebook":
1305
- 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}`;
1322
+ case "youtube":
1323
+ const link = `${endpoints.back}api/v1/auth/${method == "youtube" ? "google" : method}?appid=${appid}&provider=${method == "youtube" ? "google" : method}&redirect=${encodeURIComponent(endpoints.auth + "bind/" + method)}&authorization=${token.includes("Bearer ") ? token.split(" ")[1] : token}${method == "youtube" ? "&auth_type=youtube" : ""}`;
1306
1324
  matchlog_default.log("link", link);
1307
1325
  return window.open(
1308
1326
  link,
@@ -1535,12 +1553,12 @@ function PasswordModal({
1535
1553
  onSuccess,
1536
1554
  ...props
1537
1555
  }) {
1538
- const { refreshOverview } = useUserInfo();
1556
+ const { refreshOverview, overview } = useUserInfo();
1539
1557
  const { isLogin, did } = useUserInfo();
1540
1558
  const [password, setPassword] = useState3("");
1541
1559
  const [rePassword, setRePassword] = useState3("");
1542
1560
  const [error, setError] = useState3("");
1543
- const { generateWallet } = useWallet();
1561
+ const { generateWallet, initWallet } = useWallet();
1544
1562
  const intl = useIntl();
1545
1563
  const passwordError = useMemo2(() => {
1546
1564
  if (password.length < 6) return intl.formatMessage({
@@ -1559,11 +1577,16 @@ function PasswordModal({
1559
1577
  return "";
1560
1578
  }, [rePassword, password]);
1561
1579
  useEffect3(() => {
1562
- if (isOpen) {
1580
+ if (isOpen && overview) {
1563
1581
  setPassword("");
1564
1582
  setRePassword("");
1583
+ const did2 = overview.did.split(":")[2];
1584
+ initWallet({
1585
+ did: did2,
1586
+ address: ""
1587
+ });
1565
1588
  }
1566
- }, [isOpen]);
1589
+ }, [isOpen, overview]);
1567
1590
  const [isSubmitting, setIsSubmitting] = useState3(false);
1568
1591
  const onContinue = async () => {
1569
1592
  if (isSubmitting) return;
@@ -1640,9 +1663,9 @@ function RecoveryModal({
1640
1663
  ...props
1641
1664
  }) {
1642
1665
  const { refreshOverview } = useUserInfo();
1643
- const { isLogin } = useUserInfo();
1666
+ const { isLogin, overview } = useUserInfo();
1644
1667
  const [password, setPassword] = useState4("");
1645
- const { recoveryWallet } = useWallet();
1668
+ const { recoveryWallet, initWallet } = useWallet();
1646
1669
  const [error, setError] = useState4("");
1647
1670
  const intl = useIntl2();
1648
1671
  const passwordError = useMemo3(() => {
@@ -1654,10 +1677,15 @@ function RecoveryModal({
1654
1677
  return "";
1655
1678
  }, [password]);
1656
1679
  useEffect4(() => {
1657
- if (isOpen) {
1680
+ if (isOpen && overview) {
1658
1681
  setPassword("");
1682
+ const did = overview.did.split(":")[2];
1683
+ initWallet({
1684
+ did,
1685
+ address: overview.address
1686
+ });
1659
1687
  }
1660
- }, [isOpen]);
1688
+ }, [isOpen, overview]);
1661
1689
  const [isSubmitting, setIsSubmitting] = useState4(false);
1662
1690
  const onContinue = async () => {
1663
1691
  if (isSubmitting) return;
@@ -1868,6 +1896,7 @@ function StepVerify(props) {
1868
1896
  placeholder: intl.formatMessage({
1869
1897
  id: "codePlaceholder"
1870
1898
  }),
1899
+ className: "matchid-email-verify-field",
1871
1900
  maxLength: codeLength,
1872
1901
  onChange: (e) => setCode(e.target.value),
1873
1902
  value: code,
@@ -2068,6 +2097,11 @@ function LoginBox({
2068
2097
  icon: /* @__PURE__ */ jsx46(FacebookIcon, {}),
2069
2098
  name: "Facebook",
2070
2099
  onClick: () => login("facebook")
2100
+ },
2101
+ youtube: {
2102
+ icon: /* @__PURE__ */ jsx46(YoutubeIcon, {}),
2103
+ name: "Youtube",
2104
+ onClick: () => login("youtube")
2071
2105
  }
2072
2106
  };
2073
2107
  const walletMethods = [
@@ -2765,7 +2799,7 @@ var context_default = Providers;
2765
2799
 
2766
2800
  // src/hooks/useWalletInit.ts
2767
2801
  import { useEffect as useEffect10, useState as useState14 } from "react";
2768
- var AppClientId2 = "react-sdk-" + getVersion();
2802
+ var AppClientId2 = getAppClientId();
2769
2803
  function useWalletInit({
2770
2804
  refreshOverview
2771
2805
  }) {