@matchain/matchid-sdk-react 0.1.44-alpha.1 → 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-L3G6YN2D.mjs → chunk-7PMDBILL.mjs} +2 -2
  4. package/dist/{chunk-KITTHHSR.mjs → chunk-YYO4X2NB.mjs} +59 -13
  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 +58 -12
  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-KITTHHSR.mjs.map +0 -1
  40. /package/dist/{chunk-L3G6YN2D.mjs.map → chunk-7PMDBILL.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties } from 'react';
3
- import { s as IconProps$1 } from '../../types-CVwZEgQ0.mjs';
3
+ import { s as IconProps$1 } from '../../types-E2MeOwmE.mjs';
4
4
 
5
5
  declare function BackIcon({ color, size, className, style }: {
6
6
  color?: string;
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties } from 'react';
3
- import { s as IconProps$1 } from '../../types-CVwZEgQ0.js';
3
+ import { s as IconProps$1 } from '../../types-E2MeOwmE.js';
4
4
 
5
5
  declare function BackIcon({ color, size, className, style }: {
6
6
  color?: string;
@@ -9,7 +9,7 @@ import {
9
9
  unBindWalletApi,
10
10
  useUserInfo,
11
11
  verifyPohApi
12
- } from "./chunk-KITTHHSR.mjs";
12
+ } from "./chunk-YYO4X2NB.mjs";
13
13
  import {
14
14
  __export
15
15
  } from "./chunk-J5LGTIGS.mjs";
@@ -90,4 +90,4 @@ export {
90
90
  user_exports,
91
91
  api_exports
92
92
  };
93
- //# sourceMappingURL=chunk-L3G6YN2D.mjs.map
93
+ //# sourceMappingURL=chunk-7PMDBILL.mjs.map
@@ -181,6 +181,7 @@ var matchlog = new Proxy(console, handler);
181
181
  var matchlog_default = matchlog;
182
182
 
183
183
  // src/api/request.ts
184
+ import axiosRetry from "axios-retry";
184
185
  var SUCCESS_CODE = 0;
185
186
  var isSuccess = (res) => {
186
187
  return res.code === SUCCESS_CODE;
@@ -222,6 +223,51 @@ var request = async (config) => {
222
223
  };
223
224
  }
224
225
  };
226
+ var retryInstance = axios.create({
227
+ timeout: 6e4,
228
+ validateStatus(status) {
229
+ return status >= 200 && status <= 500;
230
+ }
231
+ });
232
+ axiosRetry(retryInstance, {
233
+ retries: 3,
234
+ retryDelay: (retryCount) => retryCount * 1e3,
235
+ shouldResetTimeout: true,
236
+ retryCondition: (error) => {
237
+ return error.response.status >= 500 && error.response.status < 600 || error.code === "ECONNABORTED";
238
+ }
239
+ });
240
+ var retryRequest = async (config) => {
241
+ try {
242
+ const endpoints = getEndpoints();
243
+ const token = getToken();
244
+ instance.defaults.baseURL = `${endpoints.back}`;
245
+ instance.defaults.headers.common["Appid"] = getAppid();
246
+ if (token) {
247
+ instance.defaults.headers.common["Authorization"] = token;
248
+ }
249
+ instance.defaults.headers.common["Accept-Language"] = getLocale();
250
+ const { data } = await instance.request(config);
251
+ matchlog_default.log("api", data);
252
+ if (data.code == 401001) {
253
+ localStore.getState().logout();
254
+ throw new Error("Your session has expired, please log in again");
255
+ }
256
+ return data;
257
+ } catch (err) {
258
+ console.error("qwe-err", err);
259
+ const message = "Request Error";
260
+ console.error(message);
261
+ return {
262
+ code: -1,
263
+ data: null,
264
+ message,
265
+ success: false,
266
+ fail: true,
267
+ result: null
268
+ };
269
+ }
270
+ };
225
271
  var request_default = request;
226
272
 
227
273
  // src/api/index.ts
@@ -240,13 +286,13 @@ var verifyEmailCodeApi = ({ email, verification_key, verification_code }) => {
240
286
  });
241
287
  };
242
288
  var getOverviewInfoApi = () => {
243
- return request_default({
289
+ return retryRequest({
244
290
  url: `/api/v1/user/overview`,
245
291
  method: "GET"
246
292
  });
247
293
  };
248
294
  var toLogoutApi = () => {
249
- return request_default({
295
+ return retryRequest({
250
296
  url: `/api/v1/user/logout`,
251
297
  method: "POST"
252
298
  });
@@ -259,19 +305,19 @@ var setUserNameApi = (data) => {
259
305
  });
260
306
  };
261
307
  var getBindListApi = () => {
262
- return request_default({
308
+ return retryRequest({
263
309
  url: `/api/v1/bind/list`,
264
310
  method: "GET"
265
311
  });
266
312
  };
267
313
  var getPohListApi = () => {
268
- return request_default({
314
+ return retryRequest({
269
315
  url: `/api/v1/poh/list`,
270
316
  method: "GET"
271
317
  });
272
318
  };
273
319
  var getBindInfoApi = () => {
274
- return request_default({
320
+ return retryRequest({
275
321
  url: `/api/v1/bind`,
276
322
  method: "GET"
277
323
  });
@@ -338,13 +384,13 @@ var mintPassportNftApi = () => {
338
384
  });
339
385
  };
340
386
  var getAuthInfoApi = () => {
341
- return request_default({
387
+ return retryRequest({
342
388
  url: `/api/v1/user/auth`,
343
389
  method: "GET"
344
390
  });
345
391
  };
346
392
  var getWalletNonceApi = (data) => {
347
- return request_default({
393
+ return retryRequest({
348
394
  url: `/api/v1/login/wallet/init`,
349
395
  method: "POST",
350
396
  data
@@ -365,7 +411,7 @@ var loginByWalletApi = ({
365
411
  });
366
412
  };
367
413
  var getWalletInitApi = (data) => {
368
- return request_default({
414
+ return retryRequest({
369
415
  url: `/api/v1/wallet/init`,
370
416
  method: "POST",
371
417
  data
@@ -3145,7 +3191,7 @@ function HashPanel_default(props) {
3145
3191
  import { Fragment as Fragment5, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
3146
3192
  function BusinessProvider({ children }) {
3147
3193
  const { overview, token, refreshOverview } = useUserInfo();
3148
- const { recoveryModal } = useStore_default();
3194
+ const { recoveryModal, walletReady } = useStore_default();
3149
3195
  const { wallet: walletConfig } = useLocalStore_default();
3150
3196
  const { generateEmbeddedWallets, initCore } = useWallet();
3151
3197
  const { type: SOLType, isOpen: SOLIsOpen, close: SOLClose } = useSOLModalStore();
@@ -3156,7 +3202,7 @@ function BusinessProvider({ children }) {
3156
3202
  const WalletModalStore = useWalletModalStore();
3157
3203
  const { close: HashPanelClose, ...hashPanelProps } = useHashPanelStore();
3158
3204
  useEffect17(() => {
3159
- if (token && overview && !overview.address && overview.did && walletConfig.type == "Base") {
3205
+ if (token && overview && !overview.address && overview.did && walletConfig.type == "Base" && walletReady) {
3160
3206
  const onGenerate = async () => {
3161
3207
  const did = overview ? overview.did.split(":")[2] : "";
3162
3208
  await initCore({
@@ -3172,7 +3218,7 @@ function BusinessProvider({ children }) {
3172
3218
  };
3173
3219
  onGenerate();
3174
3220
  }
3175
- }, [token, overview, walletConfig]);
3221
+ }, [token, overview, walletConfig, walletReady]);
3176
3222
  const walletModalClose = (func) => {
3177
3223
  WalletModalStore.close();
3178
3224
  func();
@@ -3436,7 +3482,7 @@ function useWallet() {
3436
3482
  }) : void 0;
3437
3483
  }, [address]);
3438
3484
  useEffect18(() => {
3439
- console.log("qwe-evmAccount", evmAccount);
3485
+ matchlog_default.log("qwe-evmAccount", evmAccount);
3440
3486
  }, [evmAccount]);
3441
3487
  return {
3442
3488
  walletReady,
@@ -4754,4 +4800,4 @@ export {
4754
4800
  MatchProvider,
4755
4801
  useMatch
4756
4802
  };
4757
- //# sourceMappingURL=chunk-KITTHHSR.mjs.map
4803
+ //# sourceMappingURL=chunk-YYO4X2NB.mjs.map