@trustchex/react-native-sdk 1.266.0 → 1.267.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.
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +5 -1
- package/lib/module/Shared/Libs/http-client.js +8 -0
- package/lib/module/Shared/Services/AnalyticsService.js +3 -3
- package/lib/module/version.js +5 -0
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts +3 -0
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +2 -0
- package/lib/typescript/src/version.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +5 -1
- package/src/Shared/Libs/http-client.ts +10 -0
- package/src/Shared/Services/AnalyticsService.ts +3 -3
- package/src/version.ts +3 -0
|
@@ -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
|
}
|
|
@@ -10,7 +10,7 @@ import DeviceInfo from 'react-native-device-info';
|
|
|
10
10
|
import RNFS from 'react-native-fs';
|
|
11
11
|
import 'react-native-get-random-values';
|
|
12
12
|
import { v4 as uuidv4 } from 'uuid';
|
|
13
|
-
import
|
|
13
|
+
import { SDK_VERSION } from "../../version.js";
|
|
14
14
|
import { AnalyticsEventName } from "../Types/analytics.types.js";
|
|
15
15
|
class AnalyticsService {
|
|
16
16
|
config = null;
|
|
@@ -317,7 +317,7 @@ class AnalyticsService {
|
|
|
317
317
|
platform: platform,
|
|
318
318
|
osVersion: DeviceInfo.getSystemVersion(),
|
|
319
319
|
appVersion: DeviceInfo.getVersion(),
|
|
320
|
-
sdkVersion:
|
|
320
|
+
sdkVersion: SDK_VERSION,
|
|
321
321
|
locale: 'en',
|
|
322
322
|
// Will be set from app context
|
|
323
323
|
timezone: new Date().toTimeString().split(' ')[1] || 'UTC',
|
|
@@ -330,7 +330,7 @@ class AnalyticsService {
|
|
|
330
330
|
platform: 'android',
|
|
331
331
|
osVersion: 'unknown',
|
|
332
332
|
appVersion: 'unknown',
|
|
333
|
-
sdkVersion:
|
|
333
|
+
sdkVersion: SDK_VERSION,
|
|
334
334
|
locale: 'en',
|
|
335
335
|
timezone: 'UTC',
|
|
336
336
|
screenResolution: 'unknown'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerificationSessionCheckScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/VerificationSessionCheckScreen.tsx"],"names":[],"mappings":"AAiDA,QAAA,MAAM,8BAA8B,+
|
|
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;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
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -8,7 +8,7 @@ import DeviceInfo from 'react-native-device-info';
|
|
|
8
8
|
import RNFS from 'react-native-fs';
|
|
9
9
|
import 'react-native-get-random-values';
|
|
10
10
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
-
import
|
|
11
|
+
import { SDK_VERSION } from '../../version';
|
|
12
12
|
import {
|
|
13
13
|
AnalyticsEventCategory,
|
|
14
14
|
AnalyticsEventName,
|
|
@@ -352,7 +352,7 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
352
352
|
platform: platform as 'ios' | 'android',
|
|
353
353
|
osVersion: DeviceInfo.getSystemVersion(),
|
|
354
354
|
appVersion: DeviceInfo.getVersion(),
|
|
355
|
-
sdkVersion:
|
|
355
|
+
sdkVersion: SDK_VERSION,
|
|
356
356
|
locale: 'en', // Will be set from app context
|
|
357
357
|
timezone: new Date().toTimeString().split(' ')[1] || 'UTC',
|
|
358
358
|
screenResolution: `${DeviceInfo.getDeviceType()}`,
|
|
@@ -364,7 +364,7 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
364
364
|
platform: 'android',
|
|
365
365
|
osVersion: 'unknown',
|
|
366
366
|
appVersion: 'unknown',
|
|
367
|
-
sdkVersion:
|
|
367
|
+
sdkVersion: SDK_VERSION,
|
|
368
368
|
locale: 'en',
|
|
369
369
|
timezone: 'UTC',
|
|
370
370
|
screenResolution: 'unknown',
|
package/src/version.ts
ADDED