@trustchex/react-native-sdk 1.266.1 → 1.334.0

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.
@@ -4,7 +4,7 @@ import React, { useCallback, useContext, useEffect, useMemo, useRef, useState }
4
4
  import { SafeAreaView, Text, StyleSheet, Alert, View, Image, Dimensions, KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
  import AppContext from "../../Shared/Contexts/AppContext.js";
7
- import httpClient, { BadRequestError, NotFoundError } from "../../Shared/Libs/http-client.js";
7
+ import httpClient, { BadRequestError, NotFoundError, TooManyRequestsError } from "../../Shared/Libs/http-client.js";
8
8
  import { useTranslation } from 'react-i18next';
9
9
  import LanguageSelector from "../../Shared/Components/LanguageSelector.js";
10
10
  import NavigationManager from "../../Shared/Components/NavigationManager.js";
@@ -90,6 +90,10 @@ const VerificationSessionCheckScreen = () => {
90
90
  if (error instanceof NotFoundError) {
91
91
  // Session expired or invalid - expected behavior, not actionable
92
92
  Alert.alert(t('general.error'), t('verificationSessionCheckScreen.noVerificationSessionFound'));
93
+ } else if (error instanceof TooManyRequestsError) {
94
+ // Code was already sent recently - this is expected behavior
95
+ // Return true since the code was already sent
96
+ return true;
93
97
  } else {
94
98
  trackError('VERIFICATION_CODE_SEND_FAILED', 'Failed to send verification code', 'verification_session_check', 'high', {
95
99
  recoverable: true,
@@ -26,6 +26,11 @@ export class BadRequestError extends HttpClientError {
26
26
  super(message ?? 'Bad request');
27
27
  }
28
28
  }
29
+ export class TooManyRequestsError extends HttpClientError {
30
+ constructor(message) {
31
+ super(message ?? 'Too many requests');
32
+ }
33
+ }
29
34
  export class InternalServerError extends HttpClientError {
30
35
  constructor(message) {
31
36
  super(message ?? 'Internal server error');
@@ -110,6 +115,9 @@ const request = async (httpMethod, url, body, simulatedResponse) => {
110
115
  if (response.status === 404) {
111
116
  throw new NotFoundError(message);
112
117
  }
118
+ if (response.status === 429) {
119
+ throw new TooManyRequestsError(message);
120
+ }
113
121
  if (response.status >= 500) {
114
122
  throw new InternalServerError(message);
115
123
  }
@@ -2,4 +2,4 @@
2
2
 
3
3
  // This file is auto-generated. Do not edit manually.
4
4
  // Version is synced from package.json during build.
5
- export const SDK_VERSION = '1.266.1';
5
+ export const SDK_VERSION = '1.334.0';
@@ -1 +1 @@
1
- {"version":3,"file":"VerificationSessionCheckScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/VerificationSessionCheckScreen.tsx"],"names":[],"mappings":"AAiDA,QAAA,MAAM,8BAA8B,+CA+anC,CAAC;AAuHF,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"VerificationSessionCheckScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/VerificationSessionCheckScreen.tsx"],"names":[],"mappings":"AAiDA,QAAA,MAAM,8BAA8B,+CAmbnC,CAAC;AAuHF,eAAe,8BAA8B,CAAC"}
@@ -13,6 +13,9 @@ export declare class NotFoundError extends HttpClientError {
13
13
  export declare class BadRequestError extends HttpClientError {
14
14
  constructor(message?: string);
15
15
  }
16
+ export declare class TooManyRequestsError extends HttpClientError {
17
+ constructor(message?: string);
18
+ }
16
19
  export declare class InternalServerError extends HttpClientError {
17
20
  constructor(message?: string);
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/http-client.ts"],"names":[],"mappings":"AAMA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,cAAe,SAAQ,eAAe;gBACrC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,aAAc,SAAQ,eAAe;gBACpC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,mBAAoB,SAAQ,eAAe;gBAC1C,OAAO,CAAC,EAAE,MAAM;CAG7B;;UAqIY,SAAS,OAAO,MAAM,sBAAsB,SAAS;WASpD,SAAS,EAAE,KAAK,OACvB,MAAM,SACJ,KAAK,sBACQ,SAAS;UAKlB,SAAS,EAAE,KAAK,OACtB,MAAM,SACJ,GAAG,sBACU,SAAS;UAKlB,SAAS,OAAO,MAAM,sBAAsB,SAAS;kBASvC,MAAM,QAAQ,IAAI;;AAc7C,wBAA+C"}
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/http-client.ts"],"names":[],"mappings":"AAMA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,cAAe,SAAQ,eAAe;gBACrC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,aAAc,SAAQ,eAAe;gBACpC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,oBAAqB,SAAQ,eAAe;gBAC3C,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,mBAAoB,SAAQ,eAAe;gBAC1C,OAAO,CAAC,EAAE,MAAM;CAG7B;;UAyIY,SAAS,OAAO,MAAM,sBAAsB,SAAS;WASpD,SAAS,EAAE,KAAK,OACvB,MAAM,SACJ,KAAK,sBACQ,SAAS;UAKlB,SAAS,EAAE,KAAK,OACtB,MAAM,SACJ,GAAG,sBACU,SAAS;UAKlB,SAAS,OAAO,MAAM,sBAAsB,SAAS;kBASvC,MAAM,QAAQ,IAAI;;AAc7C,wBAA+C"}
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "1.266.1";
1
+ export declare const SDK_VERSION = "1.334.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustchex/react-native-sdk",
3
- "version": "1.266.1",
3
+ "version": "1.334.0",
4
4
  "description": "Trustchex mobile app react native SDK for android or ios devices",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -20,7 +20,7 @@ import {
20
20
  } from 'react-native';
21
21
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
22
22
  import AppContext from '../../Shared/Contexts/AppContext';
23
- import httpClient, { BadRequestError, NotFoundError } from '../../Shared/Libs/http-client';
23
+ import httpClient, { BadRequestError, NotFoundError, TooManyRequestsError } from '../../Shared/Libs/http-client';
24
24
  import { useTranslation } from 'react-i18next';
25
25
  import LanguageSelector from '../../Shared/Components/LanguageSelector';
26
26
  import NavigationManager, {
@@ -169,6 +169,10 @@ const VerificationSessionCheckScreen = () => {
169
169
  t('general.error'),
170
170
  t('verificationSessionCheckScreen.noVerificationSessionFound')
171
171
  );
172
+ } else if (error instanceof TooManyRequestsError) {
173
+ // Code was already sent recently - this is expected behavior
174
+ // Return true since the code was already sent
175
+ return true;
172
176
  } else {
173
177
  trackError(
174
178
  'VERIFICATION_CODE_SEND_FAILED',
@@ -34,6 +34,12 @@ export class BadRequestError extends HttpClientError {
34
34
  }
35
35
  }
36
36
 
37
+ export class TooManyRequestsError extends HttpClientError {
38
+ constructor(message?: string) {
39
+ super(message ?? 'Too many requests');
40
+ }
41
+ }
42
+
37
43
  export class InternalServerError extends HttpClientError {
38
44
  constructor(message?: string) {
39
45
  super(message ?? 'Internal server error');
@@ -141,6 +147,10 @@ const request = async <TResponse, TBody>(
141
147
  throw new NotFoundError(message);
142
148
  }
143
149
 
150
+ if (response.status === 429) {
151
+ throw new TooManyRequestsError(message);
152
+ }
153
+
144
154
  if (response.status >= 500) {
145
155
  throw new InternalServerError(message);
146
156
  }
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Version is synced from package.json during build.
3
- export const SDK_VERSION = '1.266.1';
3
+ export const SDK_VERSION = '1.334.0';