@trustchex/react-native-sdk 1.214.0 → 1.245.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.
Files changed (48) hide show
  1. package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +2 -2
  2. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +2 -2
  3. package/lib/module/Screens/Static/ResultScreen.js +2 -2
  4. package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +148 -99
  5. package/lib/module/Shared/Components/EIDScanner.js +4 -4
  6. package/lib/module/Shared/Components/FaceCamera.js +4 -3
  7. package/lib/module/Shared/Components/IdentityDocumentCamera.js +4 -3
  8. package/lib/module/Shared/Components/QrCodeScannerCamera.js +2 -2
  9. package/lib/module/Shared/Components/StyledButton.js +30 -0
  10. package/lib/module/Shared/Constants/index.js +3 -0
  11. package/lib/module/Shared/Constants/validation.constants.js +24 -0
  12. package/lib/module/Shared/Libs/demo.utils.js +5 -3
  13. package/lib/module/Translation/Resources/en.js +50 -52
  14. package/lib/module/Translation/Resources/tr.js +48 -53
  15. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
  16. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
  17. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  18. package/lib/typescript/src/Shared/Components/StyledButton.d.ts +6 -0
  19. package/lib/typescript/src/Shared/Components/StyledButton.d.ts.map +1 -0
  20. package/lib/typescript/src/Shared/Constants/index.d.ts +2 -0
  21. package/lib/typescript/src/Shared/Constants/index.d.ts.map +1 -0
  22. package/lib/typescript/src/Shared/Constants/validation.constants.d.ts +20 -0
  23. package/lib/typescript/src/Shared/Constants/validation.constants.d.ts.map +1 -0
  24. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts +2 -2
  25. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
  26. package/lib/typescript/src/Translation/Resources/en.d.ts +1 -3
  27. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  28. package/lib/typescript/src/Translation/Resources/tr.d.ts +1 -6
  29. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +3 -3
  32. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +3 -3
  33. package/src/Screens/Static/ResultScreen.tsx +3 -3
  34. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +179 -123
  35. package/src/Shared/Components/EIDScanner.tsx +7 -7
  36. package/src/Shared/Components/FaceCamera.tsx +6 -5
  37. package/src/Shared/Components/IdentityDocumentCamera.tsx +6 -5
  38. package/src/Shared/Components/QrCodeScannerCamera.tsx +3 -3
  39. package/src/Shared/Components/StyledButton.tsx +35 -0
  40. package/src/Shared/Constants/index.ts +1 -0
  41. package/src/Shared/Constants/validation.constants.ts +24 -0
  42. package/src/Shared/Libs/demo.utils.ts +5 -4
  43. package/src/Translation/Resources/en.ts +51 -54
  44. package/src/Translation/Resources/tr.ts +50 -55
  45. package/lib/module/Shared/Components/OTPCodeInput.js +0 -74
  46. package/lib/typescript/src/Shared/Components/OTPCodeInput.d.ts +0 -10
  47. package/lib/typescript/src/Shared/Components/OTPCodeInput.d.ts.map +0 -1
  48. package/src/Shared/Components/OTPCodeInput.tsx +0 -93
@@ -6,7 +6,7 @@ import WebView from 'react-native-webview';
6
6
  import NavigationManager from "../../Shared/Components/NavigationManager.js";
7
7
  import AppContext from "../../Shared/Contexts/AppContext.js";
8
8
  import { getI18n, useTranslation } from 'react-i18next';
9
- import { Button } from 'react-native-paper';
9
+ import StyledButton from "../../Shared/Components/StyledButton.js";
10
10
  import NativeDeviceInfo from "../../Shared/Libs/native-device-info.utils.js";
11
11
  import { speakWithDebounce } from "../../Shared/Libs/tts.utils.js";
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -84,7 +84,7 @@ const ContractAcceptanceScreen = () => {
84
84
  children: [/*#__PURE__*/_jsx(Text, {
85
85
  style: styles.footerText,
86
86
  children: t('termsOfUseAndDataPrivacyScreen.footerText')
87
- }), /*#__PURE__*/_jsx(Button, {
87
+ }), /*#__PURE__*/_jsx(StyledButton, {
88
88
  mode: "contained",
89
89
  disabled: !isEnabled,
90
90
  onPress: async () => {
@@ -10,7 +10,7 @@ import NavigationManager from "../../Shared/Components/NavigationManager.js";
10
10
  import AppContext from "../../Shared/Contexts/AppContext.js";
11
11
  import { contains } from "../../Shared/Libs/contains.js";
12
12
  import { useTranslation } from 'react-i18next';
13
- import { Button } from 'react-native-paper';
13
+ import StyledButton from "../../Shared/Components/StyledButton.js";
14
14
  import LottieView from 'lottie-react-native';
15
15
  import { speakWithDebounce } from "../../Shared/Libs/tts.utils.js";
16
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -415,7 +415,7 @@ const LivenessDetectionScreen = () => {
415
415
  style: styles.guideText,
416
416
  children: ["\u2022 ", t('livenessDetectionScreen.guidePoint4')]
417
417
  })]
418
- }), /*#__PURE__*/_jsx(Button, {
418
+ }), /*#__PURE__*/_jsx(StyledButton, {
419
419
  mode: "contained",
420
420
  onPress: () => {
421
421
  setHasGuideShown(true);
@@ -14,7 +14,7 @@ import { useTranslation } from 'react-i18next';
14
14
  import { Video as VideoCompressor } from 'react-native-compressor';
15
15
  import { encryptWithAes, getSessionKey } from "../../Shared/Libs/crypto.utils.js";
16
16
  import Video from 'react-native-video';
17
- import { Button } from 'react-native-paper';
17
+ import StyledButton from "../../Shared/Components/StyledButton.js";
18
18
  import NativeDeviceInfo from "../../Shared/Libs/native-device-info.utils.js";
19
19
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
20
  const ResultScreen = () => {
@@ -503,7 +503,7 @@ const ResultScreen = () => {
503
503
  })]
504
504
  })]
505
505
  })
506
- }), /*#__PURE__*/_jsx(Button, {
506
+ }), /*#__PURE__*/_jsx(StyledButton, {
507
507
  mode: "contained",
508
508
  onPress: () => {
509
509
  appContext.onCompleted?.();
@@ -5,19 +5,19 @@ import { SafeAreaView, Text, StyleSheet, Alert, View, Image, Dimensions, Keyboar
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
  import AppContext from "../../Shared/Contexts/AppContext.js";
7
7
  import httpClient, { NotFoundError } from "../../Shared/Libs/http-client.js";
8
- import OTPCodeInput from "../../Shared/Components/OTPCodeInput.js";
9
8
  import { useTranslation } from 'react-i18next';
10
9
  import LanguageSelector from "../../Shared/Components/LanguageSelector.js";
11
10
  import NavigationManager from "../../Shared/Components/NavigationManager.js";
12
- import { Button, TextInput, useTheme } from 'react-native-paper';
11
+ import { TextInput, useTheme } from 'react-native-paper';
12
+ import StyledButton from "../../Shared/Components/StyledButton.js";
13
13
  import LottieView from 'lottie-react-native';
14
14
  import { getSimulatedDemoData, isDemoSession } from "../../Shared/Libs/demo.utils.js";
15
15
  import { useNavigation } from '@react-navigation/native';
16
+ import { SESSION_CODE_CHARSET_PATTERN, SESSION_CODE_VALIDATION_PATTERN } from "../../Shared/Constants/validation.constants.js";
16
17
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
18
  const VerificationSessionCheckScreen = () => {
18
- const [emailOrPhone, setEmailOrPhone] = useState('');
19
+ const [sessionCode, setSessionCode] = useState('');
19
20
  const [code, setCode] = useState('');
20
- const [isEnabled, setIsEnabled] = useState(false);
21
21
  const [isCheckingSession, setIsCheckingSession] = useState(false);
22
22
  const [isSendAgainEnabled, setIsSendAgainEnabled] = useState(false);
23
23
  const [isCodeSent, setIsCodeSent] = useState(false);
@@ -37,13 +37,8 @@ const VerificationSessionCheckScreen = () => {
37
37
  setApiUrl(`${appContext.baseUrl}/api/app/mobile`);
38
38
  }
39
39
  }, [appContext.baseUrl]);
40
- const validateEmail = useCallback(value => {
41
- const re = /\S+@\S+\.\S+/;
42
- return re.test(value);
43
- }, []);
44
- const validatePhoneNumber = useCallback(value => {
45
- const re = /^(5(\d{9}))/;
46
- return re.test(value);
40
+ const validateSessionCode = useCallback(value => {
41
+ return SESSION_CODE_VALIDATION_PATTERN.test(value.toUpperCase());
47
42
  }, []);
48
43
  const getSession = useCallback(async id => {
49
44
  try {
@@ -55,18 +50,11 @@ const VerificationSessionCheckScreen = () => {
55
50
  }
56
51
  }
57
52
  }, [apiUrl, appContext.isDemoSession, t]);
58
- const getSessions = useCallback(async value => {
53
+ const getSessionByCode = useCallback(async inputCode => {
59
54
  try {
60
- const isEmail = validateEmail(value);
61
- const isPhoneNumber = validatePhoneNumber(value);
62
- let response = [];
63
- if (isEmail) {
64
- appContext.isDemoSession = isDemoSession(value);
65
- response = await httpClient.get(`${apiUrl}/verification-sessions?email=${value}`, appContext.isDemoSession ? getSimulatedDemoData('VERIFICATION_SESSIONS') : undefined);
66
- } else if (isPhoneNumber) {
67
- response = await httpClient.get(`${apiUrl}/verification-sessions?phoneNumber=${value}`);
68
- }
69
- if (!response || response.length === 0) {
55
+ appContext.isDemoSession = isDemoSession(inputCode);
56
+ const response = await httpClient.get(`${apiUrl}/verification-sessions?sessionCode=${inputCode.toUpperCase()}`, appContext.isDemoSession ? getSimulatedDemoData('GET_SESSION_BY_CODE') : undefined);
57
+ if (!response || !response.id) {
70
58
  throw new NotFoundError();
71
59
  }
72
60
  return response;
@@ -75,7 +63,7 @@ const VerificationSessionCheckScreen = () => {
75
63
  Alert.alert(t('general.error'), t('verificationSessionCheckScreen.noVerificationSessionFound'));
76
64
  }
77
65
  }
78
- }, [apiUrl, appContext, t, validateEmail, validatePhoneNumber]);
66
+ }, [apiUrl, appContext, t]);
79
67
  const sendVerificationCode = useCallback(async sessionId => {
80
68
  try {
81
69
  await httpClient.post(`${apiUrl}/verification-sessions/${sessionId}`, {}, appContext.isDemoSession ? getSimulatedDemoData('SEND_VERIFICATION_CODE') : undefined);
@@ -103,7 +91,7 @@ const VerificationSessionCheckScreen = () => {
103
91
  }
104
92
  }
105
93
  }, [apiUrl, appContext.isDemoSession, t]);
106
- const sendCode = useCallback(async sessionId => {
94
+ const sendOTPCode = useCallback(async sessionId => {
107
95
  if (!sessionId) {
108
96
  return false;
109
97
  }
@@ -131,7 +119,7 @@ const VerificationSessionCheckScreen = () => {
131
119
  theme.colors.tertiary = appContext.branding.tertiaryColor;
132
120
  }
133
121
  if (session?.sendOTP) {
134
- return sendCode(session.id);
122
+ return sendOTPCode(session.id);
135
123
  } else if (session?.identificationId) {
136
124
  appContext.identificationInfo.identificationId = session?.identificationId;
137
125
  navigationManagerRef.current?.navigateToNextStep();
@@ -142,7 +130,7 @@ const VerificationSessionCheckScreen = () => {
142
130
  }, 1000);
143
131
  });
144
132
  }
145
- }, [appContext, appContext.identificationInfo.sessionId, getSession, sendCode, theme.colors, theme.colors.primary, theme.colors.secondary, theme.colors.tertiary]);
133
+ }, [appContext, appContext.identificationInfo.sessionId, getSession, sendOTPCode, theme.colors, theme.colors.primary, theme.colors.secondary, theme.colors.tertiary]);
146
134
  return /*#__PURE__*/_jsx(SafeAreaView, {
147
135
  style: styles.safeAreaContainer,
148
136
  children: /*#__PURE__*/_jsx(KeyboardAvoidingView, {
@@ -177,87 +165,111 @@ const VerificationSessionCheckScreen = () => {
177
165
  children: [/*#__PURE__*/_jsx(Text, {
178
166
  style: styles.mainText,
179
167
  children: t('verificationSessionCheckScreen.mainText')
180
- }), /*#__PURE__*/_jsx(TextInput, {
181
- mode: "outlined",
182
- autoCapitalize: "none",
183
- placeholder: t('verificationSessionCheckScreen.inputPlaceholder'),
184
- onChangeText: text => {
185
- setEmailOrPhone(text);
186
- if (validateEmail(text) || validatePhoneNumber(text)) {
187
- setIsEnabled(true);
188
- } else {
189
- setIsEnabled(false);
190
- }
191
- }
192
- }), /*#__PURE__*/_jsx(Button, {
193
- mode: "contained",
194
- disabled: !isEnabled,
195
- onPress: async () => {
196
- try {
197
- setIsCheckingSession(true);
198
- const sessions = await getSessions(emailOrPhone);
199
- if (sessions && sessions.length > 0) {
200
- appContext.identificationInfo.sessionId = sessions[0].id;
168
+ }), /*#__PURE__*/_jsxs(View, {
169
+ style: styles.inputContainer,
170
+ children: [/*#__PURE__*/_jsx(TextInput, {
171
+ mode: "outlined",
172
+ autoCapitalize: "characters",
173
+ placeholder: "",
174
+ outlineColor: theme.colors.primary,
175
+ activeOutlineColor: theme.colors.primary,
176
+ style: styles.sessionCodeTextInput,
177
+ contentStyle: styles.sessionCodeInputWithText,
178
+ onChangeText: async text => {
179
+ const alphanumericText = text.toUpperCase().replace(SESSION_CODE_CHARSET_PATTERN, '');
180
+ if (alphanumericText.length <= 8) {
181
+ setSessionCode(alphanumericText);
182
+ if (validateSessionCode(alphanumericText) && alphanumericText.length === 8) {
183
+ try {
184
+ setIsCheckingSession(true);
185
+ const session = await getSessionByCode(alphanumericText);
186
+ if (session?.id) {
187
+ appContext.identificationInfo.sessionId = session.id;
188
+ } else {
189
+ setSessionCode('');
190
+ }
191
+ } catch {
192
+ setSessionCode('');
193
+ } finally {
194
+ setTimeout(() => {
195
+ setIsCheckingSession(false);
196
+ }, 1000);
197
+ }
198
+ }
201
199
  }
202
- } catch {
203
- // Do nothing
204
- } finally {
205
- setTimeout(() => {
206
- setIsCheckingSession(false);
207
- setIsEnabled(false);
208
- }, 1000);
209
- }
210
- },
211
- children: t('verificationSessionCheckScreen.continue')
212
- }), !isEnabled && /*#__PURE__*/_jsxs(_Fragment, {
213
- children: [/*#__PURE__*/_jsxs(View, {
214
- style: styles.horizontalLineContainer,
215
- children: [/*#__PURE__*/_jsx(View, {
216
- style: styles.horizontalLine
217
- }), /*#__PURE__*/_jsx(Text, {
218
- style: styles.mainText,
219
- children: t('verificationSessionCheckScreen.or')
220
- }), /*#__PURE__*/_jsx(View, {
221
- style: styles.horizontalLine
222
- })]
223
- }), /*#__PURE__*/_jsx(Button, {
224
- mode: "contained",
225
- onPress: () => {
226
- navigation.navigate('QrCodeScanningScreen');
227
200
  },
228
- children: t('verificationSessionCheckScreen.scanQRCode')
201
+ value: sessionCode.toUpperCase(),
202
+ maxLength: 8
203
+ }), !sessionCode && /*#__PURE__*/_jsx(Text, {
204
+ style: styles.placeholderText,
205
+ children: t('verificationSessionCheckScreen.enterSessionCode')
206
+ })]
207
+ }), /*#__PURE__*/_jsxs(View, {
208
+ style: styles.horizontalLineContainer,
209
+ children: [/*#__PURE__*/_jsx(View, {
210
+ style: [styles.horizontalLine, {
211
+ backgroundColor: theme.colors.primary
212
+ }]
213
+ }), /*#__PURE__*/_jsx(Text, {
214
+ style: styles.mainText,
215
+ children: t('verificationSessionCheckScreen.or')
216
+ }), /*#__PURE__*/_jsx(View, {
217
+ style: [styles.horizontalLine, {
218
+ backgroundColor: theme.colors.primary
219
+ }]
229
220
  })]
221
+ }), /*#__PURE__*/_jsx(StyledButton, {
222
+ mode: "contained",
223
+ onPress: () => {
224
+ navigation.navigate('QrCodeScanningScreen');
225
+ },
226
+ children: t('verificationSessionCheckScreen.scanQRCode')
230
227
  })]
231
228
  }) : /*#__PURE__*/_jsxs(_Fragment, {
232
229
  children: [/*#__PURE__*/_jsx(Text, {
233
230
  style: styles.mainText,
234
231
  children: t('verificationSessionCheckScreen.codeText')
235
- }), /*#__PURE__*/_jsx(OTPCodeInput, {
236
- value: code,
232
+ }), /*#__PURE__*/_jsx(TextInput, {
233
+ mode: "outlined",
234
+ autoFocus: true,
235
+ placeholder: "",
236
+ outlineColor: theme.colors.primary,
237
+ activeOutlineColor: theme.colors.primary,
238
+ style: styles.otpCodeTextInput,
239
+ contentStyle: styles.otpCodeInputWithText,
240
+ keyboardType: "number-pad",
241
+ textContentType: "oneTimeCode",
242
+ autoComplete: "sms-otp",
243
+ maxLength: 6,
237
244
  onChangeText: text => {
238
- setCode(text);
239
- },
240
- codeLength: 6,
241
- onCodeFilled: async value => {
242
- setIsCodeGettingVerified(true);
243
- const verifiedSession = await getVerifiedSession(appContext.identificationInfo.sessionId, value);
244
- if (verifiedSession?.identificationId) {
245
- appContext.identificationInfo.identificationId = verifiedSession?.identificationId;
246
- setCode('');
247
- setIsCodeSent(false);
248
- navigationManagerRef.current?.navigateToNextStep();
249
- } else {
250
- appContext.onError?.('Invalid OTP code');
251
- Alert.alert(t('general.error'), t('verificationSessionCheckScreen.codeError'));
252
- setCode('');
253
- setIsCodeGettingVerified(false);
245
+ const numericText = text.replace(/[^0-9]/g, '');
246
+ if (numericText.length <= 6) {
247
+ setCode(numericText);
248
+ if (numericText.length === 6) {
249
+ (async () => {
250
+ setIsCodeGettingVerified(true);
251
+ const verifiedSession = await getVerifiedSession(appContext.identificationInfo.sessionId, numericText);
252
+ if (verifiedSession?.identificationId) {
253
+ appContext.identificationInfo.identificationId = verifiedSession?.identificationId;
254
+ setCode('');
255
+ setIsCodeSent(false);
256
+ navigationManagerRef.current?.navigateToNextStep();
257
+ } else {
258
+ appContext.onError?.('Invalid OTP code');
259
+ Alert.alert(t('general.error'), t('verificationSessionCheckScreen.codeError'));
260
+ setCode('');
261
+ setIsCodeGettingVerified(false);
262
+ }
263
+ })();
264
+ }
254
265
  }
255
- }
256
- }), /*#__PURE__*/_jsx(Button, {
266
+ },
267
+ value: code
268
+ }), /*#__PURE__*/_jsx(StyledButton, {
257
269
  mode: "contained",
258
270
  disabled: !isSendAgainEnabled,
259
271
  onPress: () => {
260
- sendCode(appContext.identificationInfo.sessionId);
272
+ sendOTPCode(appContext.identificationInfo.sessionId);
261
273
  },
262
274
  children: t('verificationSessionCheckScreen.sendCodeAgain')
263
275
  })]
@@ -298,17 +310,15 @@ const styles = StyleSheet.create({
298
310
  justifyContent: 'center'
299
311
  },
300
312
  horizontalLineContainer: {
301
- display: 'flex',
302
313
  flexDirection: 'row',
303
314
  alignItems: 'center',
304
- justifyContent: 'center',
315
+ justifyContent: 'space-between',
305
316
  gap: 10,
306
- padding: 10
317
+ paddingVertical: 10
307
318
  },
308
319
  horizontalLine: {
309
320
  flex: 1,
310
- height: 1,
311
- backgroundColor: '#aaa'
321
+ height: 2
312
322
  },
313
323
  loadingAnimation: {
314
324
  width: '100%',
@@ -376,6 +386,45 @@ const styles = StyleSheet.create({
376
386
  justifyContent: 'center',
377
387
  alignItems: 'center',
378
388
  position: 'absolute'
389
+ },
390
+ inputContainer: {
391
+ position: 'relative',
392
+ width: '100%'
393
+ },
394
+ sessionCodeTextInput: {
395
+ backgroundColor: 'white'
396
+ },
397
+ sessionCodeInputWithText: {
398
+ textTransform: 'uppercase',
399
+ fontWeight: '800',
400
+ fontSize: 28,
401
+ textAlign: 'center',
402
+ letterSpacing: 8
403
+ },
404
+ placeholderText: {
405
+ position: 'absolute',
406
+ top: 0,
407
+ left: 0,
408
+ right: 0,
409
+ height: '100%',
410
+ lineHeight: 56,
411
+ fontSize: 16,
412
+ color: '#666',
413
+ textAlign: 'center',
414
+ pointerEvents: 'none'
415
+ },
416
+ sessionCodeInputPlaceholder: {
417
+ fontSize: 16,
418
+ textAlign: 'center'
419
+ },
420
+ otpCodeTextInput: {
421
+ backgroundColor: 'white'
422
+ },
423
+ otpCodeInputWithText: {
424
+ fontWeight: '800',
425
+ fontSize: 28,
426
+ textAlign: 'center',
427
+ letterSpacing: 8
379
428
  }
380
429
  });
381
430
  export default VerificationSessionCheckScreen;
@@ -7,7 +7,7 @@ import { eidReader } from "../EIDReader/eidReader.js";
7
7
  import NativeProgressBar from "./NativeProgressBar.js";
8
8
  import { useTranslation } from 'react-i18next';
9
9
  import AppContext from "../Contexts/AppContext.js";
10
- import { Button } from 'react-native-paper';
10
+ import StyledButton from "./StyledButton.js";
11
11
  import LottieView from 'lottie-react-native';
12
12
  import { useKeepAwake } from "../Libs/native-keep-awake.utils.js";
13
13
  import { speakWithDebounce } from "../Libs/tts.utils.js";
@@ -136,7 +136,7 @@ const EIDScanner = ({
136
136
  style: styles.guideText,
137
137
  children: t('eidScannerScreen.guideText')
138
138
  })
139
- }), /*#__PURE__*/_jsx(Button, {
139
+ }), /*#__PURE__*/_jsx(StyledButton, {
140
140
  mode: "contained",
141
141
  onPress: () => {
142
142
  setHasGuideShown(true);
@@ -250,7 +250,7 @@ const EIDScanner = ({
250
250
  children: [/*#__PURE__*/_jsx(Text, {
251
251
  style: styles.mainText,
252
252
  children: t('eidScannerScreen.nfcNotEnabled')
253
- }), /*#__PURE__*/_jsx(Button, {
253
+ }), /*#__PURE__*/_jsx(StyledButton, {
254
254
  mode: "contained",
255
255
  onPress: async () => {
256
256
  await NFCManager.goToNfcSetting();
@@ -283,7 +283,7 @@ const EIDScanner = ({
283
283
  color: appContext.branding.primaryColor
284
284
  }), hasNfc && isEnabled && isScanned && /*#__PURE__*/_jsx(View, {
285
285
  style: styles.buttonsContainer,
286
- children: /*#__PURE__*/_jsx(Button, {
286
+ children: /*#__PURE__*/_jsx(StyledButton, {
287
287
  mode: "contained",
288
288
  disabled: !documentFaceImage || !documentMRZInfo,
289
289
  onPress: () => {
@@ -11,7 +11,8 @@ import { Worklets, useSharedValue } from 'react-native-worklets-core';
11
11
  import { crop } from "../VisionCameraPlugins/Cropper/index.js";
12
12
  import { isFrameBright } from "../Libs/camera.utils.js";
13
13
  import { useTranslation } from 'react-i18next';
14
- import { ActivityIndicator, Button } from 'react-native-paper';
14
+ import { ActivityIndicator } from 'react-native-paper';
15
+ import StyledButton from "./StyledButton.js";
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const VIDEO_WIDTH = 1280;
17
18
  const VIDEO_HEIGHT = 720;
@@ -141,7 +142,7 @@ const FaceCamera = ({
141
142
  children: [/*#__PURE__*/_jsx(Text, {
142
143
  style: styles.permissionText,
143
144
  children: t('general.noCameraPermissionGiven')
144
- }), /*#__PURE__*/_jsx(Button, {
145
+ }), /*#__PURE__*/_jsx(StyledButton, {
145
146
  mode: "contained",
146
147
  onPress: () => {
147
148
  Linking.openSettings();
@@ -156,7 +157,7 @@ const FaceCamera = ({
156
157
  children: [/*#__PURE__*/_jsx(Text, {
157
158
  style: styles.permissionText,
158
159
  children: t('general.noMicrophonePermissionGiven')
159
- }), /*#__PURE__*/_jsx(Button, {
160
+ }), /*#__PURE__*/_jsx(StyledButton, {
160
161
  mode: "contained",
161
162
  onPress: () => {
162
163
  Linking.openSettings();
@@ -17,7 +17,8 @@ import { AdaptiveThresholdTypes, ColorConversionCodes, DataTypes, ObjectType, Op
17
17
  import { getAverageBrightness } from "../Libs/camera.utils.js";
18
18
  import { useTranslation } from 'react-i18next';
19
19
  import LottieView from 'lottie-react-native';
20
- import { ActivityIndicator, Button } from 'react-native-paper';
20
+ import { ActivityIndicator } from 'react-native-paper';
21
+ import StyledButton from "./StyledButton.js";
21
22
  import { scanCodes } from "../VisionCameraPlugins/BarcodeScanner/index.js";
22
23
  import { speakWithDebounce } from "../Libs/tts.utils.js";
23
24
  import AppContext from "../Contexts/AppContext.js";
@@ -631,7 +632,7 @@ const IdentityDocumentCamera = ({
631
632
  children: [/*#__PURE__*/_jsx(Text, {
632
633
  style: styles.permissionText,
633
634
  children: t('general.noCameraPermissionGiven')
634
- }), /*#__PURE__*/_jsx(Button, {
635
+ }), /*#__PURE__*/_jsx(StyledButton, {
635
636
  mode: "contained",
636
637
  onPress: () => {
637
638
  Linking.openSettings();
@@ -692,7 +693,7 @@ const IdentityDocumentCamera = ({
692
693
  style: styles.guideText,
693
694
  children: ["\u2022 ", t('identityDocumentCamera.guidePoint3')]
694
695
  })]
695
- }), /*#__PURE__*/_jsx(Button, {
696
+ }), /*#__PURE__*/_jsx(StyledButton, {
696
697
  mode: "contained",
697
698
  onPress: () => {
698
699
  setHasGuideShown(true);
@@ -9,7 +9,7 @@ import { useIsFocused } from '@react-navigation/native';
9
9
  import { useTranslation } from 'react-i18next';
10
10
  import LottieView from 'lottie-react-native';
11
11
  import { scanCodes } from "../VisionCameraPlugins/BarcodeScanner/index.js";
12
- import { Button } from 'react-native-paper';
12
+ import StyledButton from "./StyledButton.js";
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  const QrCodeScannerCamera = ({
15
15
  onQrCodeScanned
@@ -133,7 +133,7 @@ const QrCodeScannerCamera = ({
133
133
  children: [/*#__PURE__*/_jsx(Text, {
134
134
  style: styles.permissionText,
135
135
  children: t('general.noCameraPermissionGiven')
136
- }), /*#__PURE__*/_jsx(Button, {
136
+ }), /*#__PURE__*/_jsx(StyledButton, {
137
137
  mode: "contained",
138
138
  onPress: () => {
139
139
  Linking.openSettings();
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { Button } from 'react-native-paper';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const StyledButton = ({
8
+ style,
9
+ labelStyle,
10
+ ...props
11
+ }) => {
12
+ return /*#__PURE__*/_jsx(Button, {
13
+ ...props,
14
+ style: [styles.button, style],
15
+ labelStyle: [styles.label, labelStyle]
16
+ });
17
+ };
18
+ const styles = StyleSheet.create({
19
+ button: {
20
+ borderRadius: 8,
21
+ height: 56,
22
+ justifyContent: 'center',
23
+ elevation: 2
24
+ },
25
+ label: {
26
+ fontWeight: 'bold',
27
+ fontSize: 16
28
+ }
29
+ });
30
+ export default StyledButton;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export * from "./validation.constants.js";
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Validation constants used throughout the SDK.
5
+ * These constants ensure consistency between frontend and backend validation.
6
+ */
7
+
8
+ /**
9
+ * Character set for session codes.
10
+ * Excludes ambiguous characters (0, 1, I, O) to prevent confusion.
11
+ */
12
+ export const SESSION_CODE_CHARSET = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
13
+
14
+ /**
15
+ * Regular expression pattern for validating session code characters.
16
+ * Matches only characters from SESSION_CODE_CHARSET.
17
+ */
18
+ export const SESSION_CODE_CHARSET_PATTERN = /[^ABCDEFGHJKLMNPQRSTUVWXYZ23456789]/g;
19
+
20
+ /**
21
+ * Regular expression for validating complete session codes.
22
+ * Session codes must be exactly 8 characters from SESSION_CODE_CHARSET.
23
+ */
24
+ export const SESSION_CODE_VALIDATION_PATTERN = /^[ABCDEFGHJKLMNPQRSTUVWXYZ23456789]{8}$/;
@@ -38,11 +38,13 @@ const demoSession = {
38
38
  required: false
39
39
  }]
40
40
  };
41
- const isDemoSession = email => email === 'demo@trustchex.com';
41
+ const isDemoSession = sessionCode => sessionCode.toUpperCase() === 'DEMXCXDE';
42
42
  const getSimulatedDemoData = (dataType, body) => {
43
43
  switch (dataType) {
44
- case 'VERIFICATION_SESSIONS':
45
- return [demoSession];
44
+ case 'GET_SESSION_BY_CODE':
45
+ return {
46
+ id: demoSession.id
47
+ };
46
48
  case 'GET_SESSION':
47
49
  return demoSession;
48
50
  case 'SEND_VERIFICATION_CODE':