@matchain/matchid-sdk-react 0.1.56-alpha.12 → 0.1.56-alpha.13

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 (56) hide show
  1. package/dist/api.d.mts +2 -2
  2. package/dist/api.d.ts +2 -2
  3. package/dist/api.js +83 -44
  4. package/dist/api.js.map +1 -1
  5. package/dist/api.mjs +2 -2
  6. package/dist/{chunk-44JQQ34F.mjs → chunk-7K4E64WH.mjs} +2 -2
  7. package/dist/{chunk-DUSDBXBT.mjs → chunk-RPATABCS.mjs} +164 -124
  8. package/dist/chunk-RPATABCS.mjs.map +1 -0
  9. package/dist/components.d.mts +3 -3
  10. package/dist/components.d.ts +3 -3
  11. package/dist/components.js +151 -122
  12. package/dist/components.js.map +1 -1
  13. package/dist/components.mjs +1 -1
  14. package/dist/hooks.d.mts +2 -2
  15. package/dist/hooks.d.ts +2 -2
  16. package/dist/hooks.js +39 -0
  17. package/dist/hooks.js.map +1 -1
  18. package/dist/hooks.mjs +1 -1
  19. package/dist/icon.d.mts +2 -2
  20. package/dist/icon.d.ts +2 -2
  21. package/dist/{index-DxHhOW24.d.mts → index-BLjGmf9p.d.mts} +2 -2
  22. package/dist/{index-BNqdFiOo.d.ts → index-BXhXRggh.d.ts} +1 -1
  23. package/dist/{index-uB9jBjgs.d.mts → index-Bjb30oE3.d.mts} +35 -31
  24. package/dist/{index-hz9v-CNJ.d.ts → index-CPnKc6o4.d.ts} +35 -31
  25. package/dist/{index-CcVHENNv.d.ts → index-CpJtux-G.d.ts} +1 -1
  26. package/dist/{index-DVlulZhE.d.mts → index-CqHlL6ue.d.mts} +3 -3
  27. package/dist/{index-DkijpM5Q.d.mts → index-CzCkxwOm.d.mts} +1 -1
  28. package/dist/{index-84CqVi2I.d.mts → index-DCyE39bg.d.mts} +1 -1
  29. package/dist/{index-BctnHnJp.d.ts → index-DGsB7f2H.d.ts} +1 -1
  30. package/dist/{index-Cqdz_5bE.d.ts → index-DQYg6bEA.d.ts} +2 -2
  31. package/dist/{index-qmC4zt6V.d.ts → index-DZpXCByF.d.ts} +3 -3
  32. package/dist/{index-Car1jFyN.d.mts → index-De8efmdb.d.mts} +1 -1
  33. package/dist/{index-BqI0PEIi.d.mts → index-DuCefmJ0.d.mts} +1 -1
  34. package/dist/{index-CvzpMw3N.d.ts → index-m2bn_W3Y.d.ts} +1 -1
  35. package/dist/index.d.mts +8 -8
  36. package/dist/index.d.ts +8 -8
  37. package/dist/index.js +163 -123
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +2 -2
  40. package/dist/{types-BrVeC0c8.d.mts → types-C8FLH1yn.d.mts} +1 -0
  41. package/dist/{types-BrVeC0c8.d.ts → types-C8FLH1yn.d.ts} +1 -0
  42. package/dist/types.d.mts +1 -1
  43. package/dist/types.d.ts +1 -1
  44. package/dist/ui.d.mts +3 -3
  45. package/dist/ui.d.ts +3 -3
  46. package/dist/ui.js +6 -0
  47. package/dist/ui.js.map +1 -1
  48. package/dist/ui.mjs +1 -1
  49. package/example/src/App.tsx +61 -61
  50. package/example/src/config/index.ts +8 -6
  51. package/example/src/pages/Home.tsx +15 -15
  52. package/example/src/store/useLocalStore.ts +19 -19
  53. package/example/yarn.lock +1384 -0
  54. package/package.json +1 -1
  55. package/dist/chunk-DUSDBXBT.mjs.map +0 -1
  56. /package/dist/{chunk-44JQQ34F.mjs.map → chunk-7K4E64WH.mjs.map} +0 -0
@@ -22,7 +22,7 @@ import {
22
22
  UsernameModal,
23
23
  WalletAsset,
24
24
  WalletModal
25
- } from "./chunk-DUSDBXBT.mjs";
25
+ } from "./chunk-RPATABCS.mjs";
26
26
  import "./chunk-UA6XHZHX.mjs";
27
27
  import "./chunk-IZOOVZAD.mjs";
28
28
  import "./chunk-FQ6PYZPD.mjs";
package/dist/hooks.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { c as useCopyClipboard, n as useHash, o as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from './index-uB9jBjgs.mjs';
1
+ export { c as useCopyClipboard, n as useHash, o as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from './index-Bjb30oE3.mjs';
2
2
  import './request-B0CyrGFT.mjs';
3
- import './types-BrVeC0c8.mjs';
3
+ import './types-C8FLH1yn.mjs';
4
4
  import 'react';
5
5
  import '@tanstack/react-query/src/types';
6
6
  import 'viem';
package/dist/hooks.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { c as useCopyClipboard, n as useHash, o as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from './index-hz9v-CNJ.js';
1
+ export { c as useCopyClipboard, n as useHash, o as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from './index-CPnKc6o4.js';
2
2
  import './request-B0CyrGFT.js';
3
- import './types-BrVeC0c8.js';
3
+ import './types-C8FLH1yn.js';
4
4
  import 'react';
5
5
  import '@tanstack/react-query/src/types';
6
6
  import 'viem';
package/dist/hooks.js CHANGED
@@ -720,6 +720,12 @@ var useWalletModalStore = (0, import_zustand2.create)((set) => ({
720
720
  open: (type, methods = DEFAULT_WALLET_METHODS) => set({ isOpen: true, type, methods }),
721
721
  close: () => set({ isOpen: false })
722
722
  }));
723
+ var useEmailModalStore = (0, import_zustand2.create)((set) => ({
724
+ isOpen: false,
725
+ type: "login",
726
+ open: (type) => set({ isOpen: true, type }),
727
+ close: () => set({ isOpen: false })
728
+ }));
723
729
 
724
730
  // src/components/EmailModal/index.tsx
725
731
  var import_react7 = require("react");
@@ -1929,6 +1935,7 @@ function useUserInfo() {
1929
1935
  const { open: TONOpen } = useTONModalStore();
1930
1936
  const { open: BTCOpen } = useBTCModalStore();
1931
1937
  const { open: CEXBindOpen } = useCEXBindModalStore();
1938
+ const { open: EmailOpen } = useEmailModalStore();
1932
1939
  const walletModalStore = useWalletModalStore();
1933
1940
  const getRedirectUri = () => {
1934
1941
  return encodeURIComponent(window.location.href);
@@ -2063,6 +2070,34 @@ function useUserInfo() {
2063
2070
  }
2064
2071
  return false;
2065
2072
  };
2073
+ const bindByEmail = async ({
2074
+ email,
2075
+ code
2076
+ }) => {
2077
+ try {
2078
+ const obj = {
2079
+ email,
2080
+ verification_key: emailLoginKey,
2081
+ verification_code: code
2082
+ };
2083
+ const res = await verifyEmailCodeApi(obj);
2084
+ if (res && res.data && isSuccess(res)) {
2085
+ events.onBind && events.onBind({
2086
+ type: "email"
2087
+ });
2088
+ eventManager_default.emit("onBind", {
2089
+ type: "email"
2090
+ });
2091
+ return true;
2092
+ } else {
2093
+ throw new Error(res.message);
2094
+ }
2095
+ } catch (error) {
2096
+ console.error("bindByEmail", error);
2097
+ throw error;
2098
+ }
2099
+ return false;
2100
+ };
2066
2101
  const bindWallet = async () => {
2067
2102
  if (!token) {
2068
2103
  throw new Error("You must login first");
@@ -2110,12 +2145,15 @@ function useUserInfo() {
2110
2145
  return BTCOpen("bind");
2111
2146
  case "telegram":
2112
2147
  return await bindTelegram();
2148
+ case "email":
2149
+ return EmailOpen("bind");
2113
2150
  case "twitter":
2114
2151
  case "google":
2115
2152
  case "discord":
2116
2153
  case "github":
2117
2154
  case "linkedin":
2118
2155
  case "facebook":
2156
+ case "kakao":
2119
2157
  case "youtube":
2120
2158
  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" : ""}`;
2121
2159
  matchlog_default.log("link", link);
@@ -2199,6 +2237,7 @@ function useUserInfo() {
2199
2237
  auth,
2200
2238
  login: loginMethod,
2201
2239
  bind,
2240
+ bindByEmail,
2202
2241
  getAuthInfo,
2203
2242
  invite
2204
2243
  };