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

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-7PMDBILL.mjs} +2 -2
  4. package/dist/{chunk-7P4NHPH5.mjs → chunk-YYO4X2NB.mjs} +56 -10
  5. package/dist/chunk-YYO4X2NB.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-7PMDBILL.mjs.map} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  TRONModal,
19
19
  UsernameModal,
20
20
  WalletModal
21
- } from "../chunk-7P4NHPH5.mjs";
21
+ } from "../chunk-YYO4X2NB.mjs";
22
22
  import "../chunk-SQIJR7RA.mjs";
23
23
  import "../chunk-DPXMCLYK.mjs";
24
24
  import "../chunk-J5LGTIGS.mjs";
@@ -1,5 +1,5 @@
1
- export { b as bind, p as poh, u as user } from '../../index-DFZpfAfc.mjs';
1
+ export { b as bind, p as poh, u as user } from '../../index-Rb-jdkzE.mjs';
2
2
  import '@tanstack/react-query';
3
3
  import '@tanstack/react-query/src/types';
4
- import '../../types-CVwZEgQ0.mjs';
4
+ import '../../types-E2MeOwmE.mjs';
5
5
  import 'react';
@@ -1,5 +1,5 @@
1
- export { b as bind, p as poh, u as user } from '../../index-Ca9nh_8s.js';
1
+ export { b as bind, p as poh, u as user } from '../../index-BQDL8XkC.js';
2
2
  import '@tanstack/react-query';
3
3
  import '@tanstack/react-query/src/types';
4
- import '../../types-CVwZEgQ0.js';
4
+ import '../../types-E2MeOwmE.js';
5
5
  import 'react';
@@ -173,6 +173,7 @@ var matchlog = new Proxy(console, handler);
173
173
  var matchlog_default = matchlog;
174
174
 
175
175
  // src/api/request.ts
176
+ var import_axios_retry = __toESM(require("axios-retry"));
176
177
  var SUCCESS_CODE = 0;
177
178
  var isSuccess = (res) => {
178
179
  return res.code === SUCCESS_CODE;
@@ -214,6 +215,51 @@ var request = async (config) => {
214
215
  };
215
216
  }
216
217
  };
218
+ var retryInstance = import_axios.default.create({
219
+ timeout: 6e4,
220
+ validateStatus(status) {
221
+ return status >= 200 && status <= 500;
222
+ }
223
+ });
224
+ (0, import_axios_retry.default)(retryInstance, {
225
+ retries: 3,
226
+ retryDelay: (retryCount) => retryCount * 1e3,
227
+ shouldResetTimeout: true,
228
+ retryCondition: (error) => {
229
+ return error.response.status >= 500 && error.response.status < 600 || error.code === "ECONNABORTED";
230
+ }
231
+ });
232
+ var retryRequest = async (config) => {
233
+ try {
234
+ const endpoints = getEndpoints();
235
+ const token = getToken();
236
+ instance.defaults.baseURL = `${endpoints.back}`;
237
+ instance.defaults.headers.common["Appid"] = getAppid();
238
+ if (token) {
239
+ instance.defaults.headers.common["Authorization"] = token;
240
+ }
241
+ instance.defaults.headers.common["Accept-Language"] = getLocale();
242
+ const { data } = await instance.request(config);
243
+ matchlog_default.log("api", data);
244
+ if (data.code == 401001) {
245
+ localStore.getState().logout();
246
+ throw new Error("Your session has expired, please log in again");
247
+ }
248
+ return data;
249
+ } catch (err) {
250
+ console.error("qwe-err", err);
251
+ const message = "Request Error";
252
+ console.error(message);
253
+ return {
254
+ code: -1,
255
+ data: null,
256
+ message,
257
+ success: false,
258
+ fail: true,
259
+ result: null
260
+ };
261
+ }
262
+ };
217
263
  var request_default = request;
218
264
 
219
265
  // src/api/index.ts
@@ -232,31 +278,31 @@ var verifyEmailCodeApi = ({ email, verification_key, verification_code }) => {
232
278
  });
233
279
  };
234
280
  var getOverviewInfoApi = () => {
235
- return request_default({
281
+ return retryRequest({
236
282
  url: `/api/v1/user/overview`,
237
283
  method: "GET"
238
284
  });
239
285
  };
240
286
  var toLogoutApi = () => {
241
- return request_default({
287
+ return retryRequest({
242
288
  url: `/api/v1/user/logout`,
243
289
  method: "POST"
244
290
  });
245
291
  };
246
292
  var getBindListApi = () => {
247
- return request_default({
293
+ return retryRequest({
248
294
  url: `/api/v1/bind/list`,
249
295
  method: "GET"
250
296
  });
251
297
  };
252
298
  var getPohListApi = () => {
253
- return request_default({
299
+ return retryRequest({
254
300
  url: `/api/v1/poh/list`,
255
301
  method: "GET"
256
302
  });
257
303
  };
258
304
  var getBindInfoApi = () => {
259
- return request_default({
305
+ return retryRequest({
260
306
  url: `/api/v1/bind`,
261
307
  method: "GET"
262
308
  });
@@ -323,7 +369,7 @@ var mintPassportNftApi = () => {
323
369
  });
324
370
  };
325
371
  var getAuthInfoApi = () => {
326
- return request_default({
372
+ return retryRequest({
327
373
  url: `/api/v1/user/auth`,
328
374
  method: "GET"
329
375
  });