@matchain/matchid-sdk-react 0.1.44-alpha.2 → 0.1.44-alpha.4

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 (40) hide show
  1. package/dist/assets/icon/index.d.mts +1 -1
  2. package/dist/assets/icon/index.d.ts +1 -1
  3. package/dist/{chunk-Z3USECNP.mjs → chunk-24AMOG53.mjs} +2 -2
  4. package/dist/{chunk-7P4NHPH5.mjs → chunk-RAX4G26O.mjs} +56 -10
  5. package/dist/chunk-RAX4G26O.mjs.map +1 -0
  6. package/dist/components/index.d.mts +2 -2
  7. package/dist/components/index.d.ts +2 -2
  8. package/dist/components/index.js +52 -6
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/components/index.mjs +1 -1
  11. package/dist/hooks/api/index.d.mts +2 -2
  12. package/dist/hooks/api/index.d.ts +2 -2
  13. package/dist/hooks/api/index.js +52 -6
  14. package/dist/hooks/api/index.js.map +1 -1
  15. package/dist/hooks/api/index.mjs +2 -2
  16. package/dist/hooks/index.d.mts +2 -2
  17. package/dist/hooks/index.d.ts +2 -2
  18. package/dist/hooks/index.js +50 -4
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +1 -1
  21. package/dist/{index-Ca9nh_8s.d.ts → index-BQDL8XkC.d.ts} +1 -1
  22. package/dist/{index-DlhAHm_s.d.mts → index-C1NfMaCm.d.mts} +1 -1
  23. package/dist/{index-q5XDobUF.d.mts → index-DAj3aVo6.d.mts} +1 -1
  24. package/dist/{index-Bluim2ZP.d.mts → index-DnK10Gz7.d.mts} +1 -1
  25. package/dist/{index-BxS06a5O.d.ts → index-DzVjb4K-.d.ts} +1 -1
  26. package/dist/{index-DFZpfAfc.d.mts → index-Rb-jdkzE.d.mts} +1 -1
  27. package/dist/{index-EqksEEto.d.ts → index-ivTptZeo.d.ts} +1 -1
  28. package/dist/{index-CLvQH5gM.d.ts → index-x432SkFJ.d.ts} +1 -1
  29. package/dist/index.d.mts +5 -5
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +55 -9
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +5 -5
  34. package/dist/types/index.d.mts +1 -1
  35. package/dist/types/index.d.ts +1 -1
  36. package/dist/{types-CVwZEgQ0.d.mts → types-E2MeOwmE.d.mts} +1 -1
  37. package/dist/{types-CVwZEgQ0.d.ts → types-E2MeOwmE.d.ts} +1 -1
  38. package/package.json +2 -1
  39. package/dist/chunk-7P4NHPH5.mjs.map +0 -1
  40. /package/dist/{chunk-Z3USECNP.mjs.map → chunk-24AMOG53.mjs.map} +0 -0
@@ -2,8 +2,8 @@ import {
2
2
  bind_exports,
3
3
  poh_exports,
4
4
  user_exports
5
- } from "../../chunk-Z3USECNP.mjs";
6
- import "../../chunk-7P4NHPH5.mjs";
5
+ } from "../../chunk-24AMOG53.mjs";
6
+ import "../../chunk-RAX4G26O.mjs";
7
7
  import "../../chunk-SQIJR7RA.mjs";
8
8
  import "../../chunk-DPXMCLYK.mjs";
9
9
  import "../../chunk-J5LGTIGS.mjs";
@@ -1,5 +1,5 @@
1
- export { c as useCopyClipboard, d as useLayout, a as useMatchEvents, u as useUserInfo, b as useWallet } from '../index-Bluim2ZP.mjs';
2
- import '../types-CVwZEgQ0.mjs';
1
+ export { c as useCopyClipboard, d as useLayout, a as useMatchEvents, u as useUserInfo, b as useWallet } from '../index-DnK10Gz7.mjs';
2
+ import '../types-E2MeOwmE.mjs';
3
3
  import 'react';
4
4
  import 'viem';
5
5
  import '../mpc-CTbBWHld.mjs';
@@ -1,5 +1,5 @@
1
- export { c as useCopyClipboard, d as useLayout, a as useMatchEvents, u as useUserInfo, b as useWallet } from '../index-EqksEEto.js';
2
- import '../types-CVwZEgQ0.js';
1
+ export { c as useCopyClipboard, d as useLayout, a as useMatchEvents, u as useUserInfo, b as useWallet } from '../index-ivTptZeo.js';
2
+ import '../types-E2MeOwmE.js';
3
3
  import 'react';
4
4
  import 'viem';
5
5
  import '../mpc-CTbBWHld.js';
@@ -164,6 +164,7 @@ var matchlog = new Proxy(console, handler);
164
164
  var matchlog_default = matchlog;
165
165
 
166
166
  // src/api/request.ts
167
+ var import_axios_retry = __toESM(require("axios-retry"));
167
168
  var SUCCESS_CODE = 0;
168
169
  var isSuccess = (res) => {
169
170
  return res.code === SUCCESS_CODE;
@@ -205,6 +206,51 @@ var request = async (config) => {
205
206
  };
206
207
  }
207
208
  };
209
+ var retryInstance = import_axios.default.create({
210
+ timeout: 6e4,
211
+ validateStatus(status) {
212
+ return status >= 200 && status <= 500;
213
+ }
214
+ });
215
+ (0, import_axios_retry.default)(retryInstance, {
216
+ retries: 3,
217
+ retryDelay: (retryCount) => retryCount * 1e3,
218
+ shouldResetTimeout: true,
219
+ retryCondition: (error) => {
220
+ return error.response.status >= 500 && error.response.status < 600 || error.code === "ECONNABORTED";
221
+ }
222
+ });
223
+ var retryRequest = async (config) => {
224
+ try {
225
+ const endpoints = getEndpoints();
226
+ const token = getToken();
227
+ retryInstance.defaults.baseURL = `${endpoints.back}`;
228
+ retryInstance.defaults.headers.common["Appid"] = getAppid();
229
+ if (token) {
230
+ retryInstance.defaults.headers.common["Authorization"] = token;
231
+ }
232
+ retryInstance.defaults.headers.common["Accept-Language"] = getLocale();
233
+ const { data } = await retryInstance.request(config);
234
+ matchlog_default.log("api", data);
235
+ if (data.code == 401001) {
236
+ localStore.getState().logout();
237
+ throw new Error("Your session has expired, please log in again");
238
+ }
239
+ return data;
240
+ } catch (err) {
241
+ console.error("qwe-err", err);
242
+ const message = "Request Error";
243
+ console.error(message);
244
+ return {
245
+ code: -1,
246
+ data: null,
247
+ message,
248
+ success: false,
249
+ fail: true,
250
+ result: null
251
+ };
252
+ }
253
+ };
208
254
  var request_default = request;
209
255
 
210
256
  // src/api/index.ts
@@ -223,19 +269,19 @@ var verifyEmailCodeApi = ({ email, verification_key, verification_code }) => {
223
269
  });
224
270
  };
225
271
  var getOverviewInfoApi = () => {
226
- return request_default({
272
+ return retryRequest({
227
273
  url: `/api/v1/user/overview`,
228
274
  method: "GET"
229
275
  });
230
276
  };
231
277
  var toLogoutApi = () => {
232
- return request_default({
278
+ return retryRequest({
233
279
  url: `/api/v1/user/logout`,
234
280
  method: "POST"
235
281
  });
236
282
  };
237
283
  var getAuthInfoApi = () => {
238
- return request_default({
284
+ return retryRequest({
239
285
  url: `/api/v1/user/auth`,
240
286
  method: "GET"
241
287
  });
@@ -897,7 +943,7 @@ function useWallet() {
897
943
  }) : void 0;
898
944
  }, [address]);
899
945
  (0, import_react24.useEffect)(() => {
900
- console.log("qwe-evmAccount", evmAccount);
946
+ matchlog_default.log("qwe-evmAccount", evmAccount);
901
947
  }, [evmAccount]);
902
948
  return {
903
949
  walletReady,