@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.css CHANGED
@@ -767,3 +767,6 @@ body {
767
767
  }
768
768
 
769
769
  }
770
+ .matchid-email-verify-field{
771
+ padding-right: 0;
772
+ }
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseQueryOptions } from '@tanstack/react-query/src/types';
7
7
 
8
- type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook'
8
+ type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook'|'youtube'
9
9
  type LoginMethodType = 'evm' | 'sol' | 'email' | ISocialLoginMethod
10
10
  type OtherLoginMethodType = 'email' | ISocialLoginMethod
11
11
  type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseQueryOptions } from '@tanstack/react-query/src/types';
7
7
 
8
- type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook'
8
+ type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook'|'youtube'
9
9
  type LoginMethodType = 'evm' | 'sol' | 'email' | ISocialLoginMethod
10
10
  type OtherLoginMethodType = 'email' | ISocialLoginMethod
11
11
  type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
package/dist/index.js CHANGED
@@ -547,6 +547,19 @@ function LinkedinIcon({
547
547
 
548
548
  // src/assets/icon/YoutubeIcon.tsx
549
549
  var import_jsx_runtime26 = require("react/jsx-runtime");
550
+ function YoutubeIcon({ size = 40, ...props }) {
551
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("svg", { width: size, height: size, ...{ props }, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
552
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { width: "40", height: "40", rx: "8", fill: "#FF0000" }),
553
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
554
+ "path",
555
+ {
556
+ 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",
557
+ fill: "white"
558
+ }
559
+ ),
560
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M17.439 24.2867L24.8767 20.003L17.439 15.7192V24.2867Z", fill: "#FF0000" })
561
+ ] });
562
+ }
550
563
 
551
564
  // src/assets/icon/BTCDarkIcon.tsx
552
565
  var import_jsx_runtime27 = require("react/jsx-runtime");
@@ -665,7 +678,7 @@ function ArrowDownIcon({ width = 20, height = 21, color = "black", ...props }) {
665
678
  {
666
679
  d: "M5 7.5L9.29289 11.7929C9.68342 12.1834 10.3166 12.1834 10.7071 11.7929L15 7.5",
667
680
  stroke: color,
668
- "stroke-width": "1.5",
681
+ strokeWidth: "1.5",
669
682
  strokeLinecap: "round",
670
683
  strokeLinejoin: "round"
671
684
  }
@@ -1174,6 +1187,9 @@ function truncateAddress(address) {
1174
1187
  const end = address.slice(-2);
1175
1188
  return `${start}...${end}`;
1176
1189
  }
1190
+ function getAppClientId() {
1191
+ return "react-sdk-" + getVersion();
1192
+ }
1177
1193
 
1178
1194
  // src/store/useModalStore.ts
1179
1195
  var import_zustand2 = require("zustand");
@@ -1211,7 +1227,7 @@ function useUserInfo() {
1211
1227
  eventManager_default.emit("onLogout");
1212
1228
  };
1213
1229
  const loginByMethod = async (method) => {
1214
- const link = `${endpoints.back}api/v1/auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.auth + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
1230
+ 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" : ""}`;
1215
1231
  matchlog_default.log("link", link);
1216
1232
  return window.open(
1217
1233
  link,
@@ -1245,6 +1261,7 @@ function useUserInfo() {
1245
1261
  return SOLOpen("login");
1246
1262
  case "telegram":
1247
1263
  return await loginByTelegram();
1264
+ case "youtube":
1248
1265
  case "twitter":
1249
1266
  case "google":
1250
1267
  case "discord":
@@ -1337,7 +1354,8 @@ function useUserInfo() {
1337
1354
  case "github":
1338
1355
  case "linkedin":
1339
1356
  case "facebook":
1340
- 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}`;
1357
+ case "youtube":
1358
+ 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" : ""}`;
1341
1359
  matchlog_default.log("link", link);
1342
1360
  return window.open(
1343
1361
  link,
@@ -1570,12 +1588,12 @@ function PasswordModal({
1570
1588
  onSuccess,
1571
1589
  ...props
1572
1590
  }) {
1573
- const { refreshOverview } = useUserInfo();
1591
+ const { refreshOverview, overview } = useUserInfo();
1574
1592
  const { isLogin, did } = useUserInfo();
1575
1593
  const [password, setPassword] = (0, import_react5.useState)("");
1576
1594
  const [rePassword, setRePassword] = (0, import_react5.useState)("");
1577
1595
  const [error, setError] = (0, import_react5.useState)("");
1578
- const { generateWallet } = useWallet();
1596
+ const { generateWallet, initWallet } = useWallet();
1579
1597
  const intl = (0, import_react_intl.useIntl)();
1580
1598
  const passwordError = (0, import_react5.useMemo)(() => {
1581
1599
  if (password.length < 6) return intl.formatMessage({
@@ -1594,11 +1612,16 @@ function PasswordModal({
1594
1612
  return "";
1595
1613
  }, [rePassword, password]);
1596
1614
  (0, import_react5.useEffect)(() => {
1597
- if (isOpen) {
1615
+ if (isOpen && overview) {
1598
1616
  setPassword("");
1599
1617
  setRePassword("");
1618
+ const did2 = overview.did.split(":")[2];
1619
+ initWallet({
1620
+ did: did2,
1621
+ address: ""
1622
+ });
1600
1623
  }
1601
- }, [isOpen]);
1624
+ }, [isOpen, overview]);
1602
1625
  const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1603
1626
  const onContinue = async () => {
1604
1627
  if (isSubmitting) return;
@@ -1675,9 +1698,9 @@ function RecoveryModal({
1675
1698
  ...props
1676
1699
  }) {
1677
1700
  const { refreshOverview } = useUserInfo();
1678
- const { isLogin } = useUserInfo();
1701
+ const { isLogin, overview } = useUserInfo();
1679
1702
  const [password, setPassword] = (0, import_react6.useState)("");
1680
- const { recoveryWallet } = useWallet();
1703
+ const { recoveryWallet, initWallet } = useWallet();
1681
1704
  const [error, setError] = (0, import_react6.useState)("");
1682
1705
  const intl = (0, import_react_intl2.useIntl)();
1683
1706
  const passwordError = (0, import_react6.useMemo)(() => {
@@ -1689,10 +1712,15 @@ function RecoveryModal({
1689
1712
  return "";
1690
1713
  }, [password]);
1691
1714
  (0, import_react6.useEffect)(() => {
1692
- if (isOpen) {
1715
+ if (isOpen && overview) {
1693
1716
  setPassword("");
1717
+ const did = overview.did.split(":")[2];
1718
+ initWallet({
1719
+ did,
1720
+ address: overview.address
1721
+ });
1694
1722
  }
1695
- }, [isOpen]);
1723
+ }, [isOpen, overview]);
1696
1724
  const [isSubmitting, setIsSubmitting] = (0, import_react6.useState)(false);
1697
1725
  const onContinue = async () => {
1698
1726
  if (isSubmitting) return;
@@ -1903,6 +1931,7 @@ function StepVerify(props) {
1903
1931
  placeholder: intl.formatMessage({
1904
1932
  id: "codePlaceholder"
1905
1933
  }),
1934
+ className: "matchid-email-verify-field",
1906
1935
  maxLength: codeLength,
1907
1936
  onChange: (e) => setCode(e.target.value),
1908
1937
  value: code,
@@ -2103,6 +2132,11 @@ function LoginBox({
2103
2132
  icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FacebookIcon, {}),
2104
2133
  name: "Facebook",
2105
2134
  onClick: () => login("facebook")
2135
+ },
2136
+ youtube: {
2137
+ icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(YoutubeIcon, {}),
2138
+ name: "Youtube",
2139
+ onClick: () => login("youtube")
2106
2140
  }
2107
2141
  };
2108
2142
  const walletMethods = [
@@ -2765,7 +2799,7 @@ var context_default = Providers;
2765
2799
 
2766
2800
  // src/hooks/useWalletInit.ts
2767
2801
  var import_react16 = require("react");
2768
- var AppClientId2 = "react-sdk-" + getVersion();
2802
+ var AppClientId2 = getAppClientId();
2769
2803
  function useWalletInit({
2770
2804
  refreshOverview
2771
2805
  }) {