@matchain/matchid-sdk-react 0.1.56-alpha.9 → 0.1.57

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.
Files changed (42) hide show
  1. package/dist/api.js +44 -3
  2. package/dist/api.js.map +1 -1
  3. package/dist/api.mjs +3 -3
  4. package/dist/{chunk-FQ6PYZPD.mjs → chunk-7SUDHG7S.mjs} +1 -1
  5. package/dist/chunk-7SUDHG7S.mjs.map +1 -0
  6. package/dist/{chunk-JCMQBWWW.mjs → chunk-EUG3QRAG.mjs} +2 -2
  7. package/dist/{chunk-LOZCAT7A.mjs → chunk-QMV4FDUH.mjs} +283 -216
  8. package/dist/chunk-QMV4FDUH.mjs.map +1 -0
  9. package/dist/components.d.mts +1 -1
  10. package/dist/components.d.ts +1 -1
  11. package/dist/components.js +306 -261
  12. package/dist/components.js.map +1 -1
  13. package/dist/components.mjs +2 -2
  14. package/dist/hooks.d.mts +1 -1
  15. package/dist/hooks.d.ts +1 -1
  16. package/dist/hooks.js +81 -42
  17. package/dist/hooks.js.map +1 -1
  18. package/dist/hooks.mjs +2 -2
  19. package/dist/icon.js.map +1 -1
  20. package/dist/icon.mjs +1 -1
  21. package/dist/{index-DwmrgZa2.d.ts → index-B70k4Jpk.d.ts} +4 -0
  22. package/dist/{index-D2E53ZMV.d.mts → index-BJJ0Gb6v.d.mts} +4 -0
  23. package/dist/{index-qmC4zt6V.d.ts → index-C2hr7zlN.d.ts} +3 -1
  24. package/dist/{index-DVlulZhE.d.mts → index-CTHpnEoB.d.mts} +3 -1
  25. package/dist/index.d.mts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +87 -20
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +3 -3
  30. package/dist/ui.js +81 -70
  31. package/dist/ui.js.map +1 -1
  32. package/dist/ui.mjs +2 -2
  33. package/example/package-lock.json +2965 -0
  34. package/example/package.json +2 -1
  35. package/example/src/App.tsx +65 -60
  36. package/example/src/config/index.ts +8 -6
  37. package/example/src/pages/Wallet/index.tsx +2 -4
  38. package/example/yarn.lock +27 -2251
  39. package/package.json +3 -6
  40. package/dist/chunk-FQ6PYZPD.mjs.map +0 -1
  41. package/dist/chunk-LOZCAT7A.mjs.map +0 -1
  42. /package/dist/{chunk-JCMQBWWW.mjs.map → chunk-EUG3QRAG.mjs.map} +0 -0
package/dist/api.js CHANGED
@@ -1248,6 +1248,12 @@ var useWalletModalStore = (0, import_zustand5.create)((set) => ({
1248
1248
  open: (type, methods = DEFAULT_WALLET_METHODS) => set({ isOpen: true, type, methods }),
1249
1249
  close: () => set({ isOpen: false })
1250
1250
  }));
1251
+ var useEmailModalStore = (0, import_zustand5.create)((set) => ({
1252
+ isOpen: false,
1253
+ type: "",
1254
+ open: (type) => set({ isOpen: true, type }),
1255
+ close: () => set({ isOpen: false })
1256
+ }));
1251
1257
 
1252
1258
  // src/components/CEXBindModal/index.tsx
1253
1259
  var import_react38 = require("react");
@@ -1256,11 +1262,16 @@ var import_jsx_runtime101 = require("react/jsx-runtime");
1256
1262
 
1257
1263
  // src/context/BusinessProvider.tsx
1258
1264
  var import_react_query9 = require("@tanstack/react-query");
1265
+
1266
+ // src/components/BindEmailModal/index.tsx
1259
1267
  var import_jsx_runtime102 = require("react/jsx-runtime");
1260
1268
 
1261
- // src/context/index.tsx
1269
+ // src/context/BusinessProvider.tsx
1262
1270
  var import_jsx_runtime103 = require("react/jsx-runtime");
1263
1271
 
1272
+ // src/context/index.tsx
1273
+ var import_jsx_runtime104 = require("react/jsx-runtime");
1274
+
1264
1275
  // src/hooks/useWalletInit.ts
1265
1276
  var import_react39 = require("react");
1266
1277
  var AppClientId2 = getAppClientId();
@@ -1339,7 +1350,7 @@ var matchTest = /* @__PURE__ */ (0, import_viem15.defineChain)({
1339
1350
 
1340
1351
  // src/MatchContext.tsx
1341
1352
  var import_wagmi3 = require("wagmi");
1342
- var import_jsx_runtime104 = require("react/jsx-runtime");
1353
+ var import_jsx_runtime105 = require("react/jsx-runtime");
1343
1354
  var queryClient = new import_react_query10.QueryClient();
1344
1355
  var wagmiConfig = (0, import_rainbowkit2.getDefaultConfig)({
1345
1356
  appName: "MatchID",
@@ -1391,6 +1402,7 @@ function useUserInfo() {
1391
1402
  const { open: BTCOpen } = useBTCModalStore();
1392
1403
  const { open: CEXBindOpen } = useCEXBindModalStore();
1393
1404
  const walletModalStore = useWalletModalStore();
1405
+ const emailModalStore = useEmailModalStore();
1394
1406
  const getRedirectUri = () => {
1395
1407
  return encodeURIComponent(window.location.href);
1396
1408
  };
@@ -1483,8 +1495,8 @@ function useUserInfo() {
1483
1495
  case "discord":
1484
1496
  case "github":
1485
1497
  case "linkedin":
1486
- case "kakao":
1487
1498
  case "facebook":
1499
+ case "kakao":
1488
1500
  return await loginByMethod(method);
1489
1501
  default:
1490
1502
  throw new Error("unsupported method");
@@ -1569,6 +1581,8 @@ function useUserInfo() {
1569
1581
  return TONOpen("bind");
1570
1582
  case "btc":
1571
1583
  return BTCOpen("bind");
1584
+ case "email":
1585
+ return emailModalStore.open("bind");
1572
1586
  case "telegram":
1573
1587
  return await bindTelegram();
1574
1588
  case "twitter":
@@ -1578,6 +1592,7 @@ function useUserInfo() {
1578
1592
  case "linkedin":
1579
1593
  case "facebook":
1580
1594
  case "youtube":
1595
+ case "kakao":
1581
1596
  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" : ""}`;
1582
1597
  matchlog_default.log("link", link);
1583
1598
  return window.open(
@@ -1592,6 +1607,31 @@ function useUserInfo() {
1592
1607
  const bindCex = (type) => {
1593
1608
  return CEXBindOpen(type);
1594
1609
  };
1610
+ const bindByEmail = async ({ email, code }) => {
1611
+ try {
1612
+ const obj = {
1613
+ email,
1614
+ verification_key: emailLoginKey,
1615
+ verification_code: code
1616
+ };
1617
+ const res = await verifyEmailCodeApi(obj);
1618
+ if (res && res.data && isSuccess(res)) {
1619
+ events.onBind && events.onBind({
1620
+ type: "email"
1621
+ });
1622
+ eventManager_default.emit("onBind", {
1623
+ type: "email"
1624
+ });
1625
+ return true;
1626
+ } else {
1627
+ throw new Error(res.message);
1628
+ }
1629
+ } catch (error) {
1630
+ console.error("bindByEmail", error);
1631
+ throw error;
1632
+ }
1633
+ return false;
1634
+ };
1595
1635
  const getAuthInfo = async (method) => {
1596
1636
  const element_id = "auth_iframe";
1597
1637
  if (document.getElementById(element_id)) {
@@ -1660,6 +1700,7 @@ function useUserInfo() {
1660
1700
  auth,
1661
1701
  login: loginMethod,
1662
1702
  bind,
1703
+ bindByEmail,
1663
1704
  getAuthInfo,
1664
1705
  invite
1665
1706
  };