@transfergratis/react-native-sdk 0.1.24 → 0.1.26

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 (182) hide show
  1. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
  2. package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
  3. package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
  4. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  5. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  6. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
  7. package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
  8. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
  9. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  10. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  11. package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
  12. package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
  13. package/android/src/main/AndroidManifest.xml +22 -7
  14. package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
  15. package/build/components/EnhancedCameraView.web.js +76 -21
  16. package/build/components/EnhancedCameraView.web.js.map +1 -1
  17. package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
  18. package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
  19. package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
  20. package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
  21. package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
  22. package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
  23. package/build/components/KYCElements/EmailVerificationTemplate.js +212 -0
  24. package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
  25. package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  26. package/build/components/KYCElements/IDCardCapture.js +216 -14
  27. package/build/components/KYCElements/IDCardCapture.js.map +1 -1
  28. package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
  29. package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
  30. package/build/components/KYCElements/OrientationVideoCapture.js +2 -2
  31. package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
  32. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
  33. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
  34. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +2 -2
  35. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
  36. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
  37. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
  38. package/build/components/KYCElements/OrientationVideoCaptureFinal.js +2 -2
  39. package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
  40. package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
  41. package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
  42. package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
  43. package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
  44. package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
  45. package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
  46. package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
  47. package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
  48. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
  49. package/build/components/KYCElements/SelfieCaptureTemplate.js +7 -3
  50. package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
  51. package/build/components/KYCElements/WelcomeTemplate.js +2 -1
  52. package/build/components/KYCElements/WelcomeTemplate.js.map +1 -1
  53. package/build/components/OverLay/type.d.ts +2 -0
  54. package/build/components/OverLay/type.d.ts.map +1 -1
  55. package/build/components/OverLay/type.js.map +1 -1
  56. package/build/components/TemplateKYCExample.d.ts +10 -0
  57. package/build/components/TemplateKYCExample.d.ts.map +1 -1
  58. package/build/components/TemplateKYCExample.js +7 -30
  59. package/build/components/TemplateKYCExample.js.map +1 -1
  60. package/build/components/TemplateKYCFlowRefactored.d.ts +12 -0
  61. package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
  62. package/build/components/TemplateKYCFlowRefactored.js +25 -3
  63. package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
  64. package/build/config/KYCConfig.d.ts +14 -0
  65. package/build/config/KYCConfig.d.ts.map +1 -0
  66. package/build/config/KYCConfig.js +26 -0
  67. package/build/config/KYCConfig.js.map +1 -0
  68. package/build/config/allowedDomains.d.ts.map +1 -1
  69. package/build/config/allowedDomains.js +4 -19
  70. package/build/config/allowedDomains.js.map +1 -1
  71. package/build/hooks/useOrientationVideo.d.ts +2 -1
  72. package/build/hooks/useOrientationVideo.d.ts.map +1 -1
  73. package/build/hooks/useOrientationVideo.js +3 -3
  74. package/build/hooks/useOrientationVideo.js.map +1 -1
  75. package/build/hooks/useTemplateKYCFlow.d.ts +18 -1
  76. package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  77. package/build/hooks/useTemplateKYCFlow.js +410 -56
  78. package/build/hooks/useTemplateKYCFlow.js.map +1 -1
  79. package/build/i18n/en/index.d.ts +42 -0
  80. package/build/i18n/en/index.d.ts.map +1 -1
  81. package/build/i18n/en/index.js +44 -2
  82. package/build/i18n/en/index.js.map +1 -1
  83. package/build/i18n/fr/index.d.ts +28 -0
  84. package/build/i18n/fr/index.d.ts.map +1 -1
  85. package/build/i18n/fr/index.js +30 -2
  86. package/build/i18n/fr/index.js.map +1 -1
  87. package/build/i18n/types.d.ts +2 -0
  88. package/build/i18n/types.d.ts.map +1 -1
  89. package/build/i18n/types.js.map +1 -1
  90. package/build/index.d.ts +1 -0
  91. package/build/index.d.ts.map +1 -1
  92. package/build/index.js +2 -0
  93. package/build/index.js.map +1 -1
  94. package/build/modules/api/CardAuthentification.d.ts +24 -3
  95. package/build/modules/api/CardAuthentification.d.ts.map +1 -1
  96. package/build/modules/api/CardAuthentification.js +90 -12
  97. package/build/modules/api/CardAuthentification.js.map +1 -1
  98. package/build/modules/api/KYCService.d.ts +17 -7
  99. package/build/modules/api/KYCService.d.ts.map +1 -1
  100. package/build/modules/api/KYCService.js +125 -37
  101. package/build/modules/api/KYCService.js.map +1 -1
  102. package/build/modules/api/SelfieVerification.d.ts +3 -1
  103. package/build/modules/api/SelfieVerification.d.ts.map +1 -1
  104. package/build/modules/api/SelfieVerification.js +17 -1
  105. package/build/modules/api/SelfieVerification.js.map +1 -1
  106. package/build/modules/api/TemplateService.d.ts +0 -1
  107. package/build/modules/api/TemplateService.d.ts.map +1 -1
  108. package/build/modules/api/TemplateService.js +3 -3
  109. package/build/modules/api/TemplateService.js.map +1 -1
  110. package/build/modules/camera/VisionCameraModule.web.d.ts.map +1 -1
  111. package/build/modules/camera/VisionCameraModule.web.js +27 -8
  112. package/build/modules/camera/VisionCameraModule.web.js.map +1 -1
  113. package/build/types/KYC.types.d.ts +130 -5
  114. package/build/types/KYC.types.d.ts.map +1 -1
  115. package/build/types/KYC.types.js.map +1 -1
  116. package/build/types/env.types.d.ts +13 -0
  117. package/build/types/env.types.d.ts.map +1 -0
  118. package/build/types/env.types.js +2 -0
  119. package/build/types/env.types.js.map +1 -0
  120. package/build/utils/cropByObb.d.ts +7 -0
  121. package/build/utils/cropByObb.d.ts.map +1 -1
  122. package/build/utils/cropByObb.js +20 -1
  123. package/build/utils/cropByObb.js.map +1 -1
  124. package/build/utils/deviceDetection.d.ts +6 -0
  125. package/build/utils/deviceDetection.d.ts.map +1 -0
  126. package/build/utils/deviceDetection.js +12 -0
  127. package/build/utils/deviceDetection.js.map +1 -0
  128. package/build/utils/platformAlert.d.ts.map +1 -1
  129. package/build/utils/platformAlert.js.map +1 -1
  130. package/build/utils/template-transformer.d.ts.map +1 -1
  131. package/build/utils/template-transformer.js +12 -0
  132. package/build/utils/template-transformer.js.map +1 -1
  133. package/build/web/WebKYCEntry.d.ts.map +1 -1
  134. package/build/web/WebKYCEntry.js +88 -38
  135. package/build/web/WebKYCEntry.js.map +1 -1
  136. package/package.json +1 -1
  137. package/plugin/build/index.d.ts +1 -0
  138. package/plugin/build/index.js +3 -1
  139. package/plugin/build/withRemovePermissions.d.ts +3 -0
  140. package/plugin/build/withRemovePermissions.js +67 -0
  141. package/plugin/build/withVisionCamera.js +3 -4
  142. package/plugin/src/index.ts +2 -1
  143. package/plugin/src/withRemovePermissions.js +85 -0
  144. package/plugin/src/withRemovePermissions.ts +83 -0
  145. package/plugin/src/withVisionCamera.js +3 -4
  146. package/plugin/src/withVisionCamera.ts +3 -4
  147. package/plugin/tsconfig.tsbuildinfo +1 -1
  148. package/plugin.js +6 -1
  149. package/src/components/EnhancedCameraView.web.tsx +76 -21
  150. package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
  151. package/src/components/KYCElements/EmailVerificationTemplate.tsx +278 -0
  152. package/src/components/KYCElements/IDCardCapture.tsx +253 -21
  153. package/src/components/KYCElements/OrientationVideoCapture.tsx +4 -1
  154. package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +4 -1
  155. package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +4 -1
  156. package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
  157. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
  158. package/src/components/KYCElements/SelfieCaptureTemplate.tsx +6 -3
  159. package/src/components/KYCElements/WelcomeTemplate.tsx +2 -1
  160. package/src/components/OverLay/type.ts +2 -0
  161. package/src/components/TemplateKYCExample.tsx +35 -46
  162. package/src/components/TemplateKYCFlowRefactored.tsx +46 -2
  163. package/src/config/KYCConfig.ts +34 -0
  164. package/src/config/allowedDomains.ts +7 -26
  165. package/src/hooks/useOrientationVideo.ts +5 -4
  166. package/src/hooks/useTemplateKYCFlow.tsx +443 -56
  167. package/src/i18n/en/index.ts +46 -3
  168. package/src/i18n/fr/index.ts +31 -2
  169. package/src/i18n/types.ts +2 -0
  170. package/src/index.ts +3 -0
  171. package/src/modules/api/CardAuthentification.ts +98 -12
  172. package/src/modules/api/KYCService.ts +158 -37
  173. package/src/modules/api/SelfieVerification.ts +25 -3
  174. package/src/modules/api/TemplateService.ts +4 -4
  175. package/src/modules/camera/VisionCameraModule.web.ts +30 -12
  176. package/src/types/KYC.types.ts +153 -6
  177. package/src/types/env.types.ts +13 -0
  178. package/src/utils/cropByObb.ts +20 -1
  179. package/src/utils/deviceDetection.ts +11 -0
  180. package/src/utils/platformAlert.ts +1 -0
  181. package/src/utils/template-transformer.ts +20 -8
  182. package/src/web/WebKYCEntry.tsx +123 -61
@@ -14,6 +14,12 @@ import { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';
14
14
  import { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';
15
15
  import { useTemplateLoader } from '../hooks/useTemplateLoader';
16
16
  import { WelcomeTemplate } from './KYCElements/WelcomeTemplate';
17
+ import { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';
18
+ import { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';
19
+ import { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';
20
+ import { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';
21
+ import { KycEnvironment, BackendEnvironment } from '../types/env.types';
22
+ import KYCConfig from '../config/KYCConfig';
17
23
 
18
24
  interface TemplateKYCFlowProps {
19
25
  template?: KYCTemplate; // Format SDK direct (existing, now optional)
@@ -23,6 +29,13 @@ interface TemplateKYCFlowProps {
23
29
  language?: string;
24
30
  onCancel?: () => void;
25
31
  API_KEY?: string; // Required if templateId is used
32
+ env?: KycEnvironment; // Flow execution: PRODUCTION (full AI) or SANDBOX (skip AI)
33
+ serverEnv?: BackendEnvironment; // Backend to call: PRODUCTION or TEST (API URL)
34
+ existingSessionId?: string;
35
+ /** Index in template.components (0-based) to resume at — e.g. from URL component_index or template table */
36
+ initialComponentIndex?: number;
37
+ /** Pays / type de document depuis l'URL de reprise (reprise multi-appareil) */
38
+ initialCountryResume?: { code: string; documentType: string; region?: string };
26
39
  }
27
40
 
28
41
  export const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({
@@ -33,10 +46,22 @@ export const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({
33
46
  language = 'fr',
34
47
  onCancel,
35
48
  API_KEY,
49
+ env = 'PRODUCTION',
50
+ serverEnv,
51
+ existingSessionId,
52
+ initialComponentIndex,
53
+ initialCountryResume,
36
54
  }) => {
37
55
  const { t } = useI18n();
38
56
  const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();
39
57
 
58
+ // Which backend URL to call (independent from flow env)
59
+ useEffect(() => {
60
+ if (serverEnv !== undefined) {
61
+ KYCConfig.setBackendEnvironment(serverEnv);
62
+ }
63
+ }, [serverEnv]);
64
+
40
65
  // Validate props
41
66
  useEffect(() => {
42
67
  if (!providedTemplate && !templateId) {
@@ -123,6 +148,10 @@ export const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({
123
148
  onCancel={OnCancel}
124
149
  initialLanguage={language}
125
150
  apiKey={API_KEY}
151
+ env={env}
152
+ existingSessionId={existingSessionId}
153
+ initialComponentIndex={initialComponentIndex}
154
+ initialCountryResume={initialCountryResume}
126
155
  >
127
156
  <TemplateKYCFlowContent onCancel={OnCancel} />
128
157
  </TemplateKYCFlowProvider>
@@ -187,6 +216,18 @@ const TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel
187
216
  case 'review_submit':
188
217
  return <ReviewSubmitTemplate {...commonProps} />;
189
218
 
219
+ case 'email_verification':
220
+ return <EmailVerificationTemplate {...commonProps} />;
221
+
222
+ case 'phone_verification':
223
+ return <PhoneVerificationTemplate {...commonProps} />;
224
+
225
+ case 'personal_information':
226
+ return <PersonalInformationTemplate {...commonProps} />;
227
+
228
+ case 'additional_documents':
229
+ return <AdditionalDocumentsTemplate {...commonProps} />;
230
+
190
231
  case 'verification_progress':
191
232
  return <VerificationProgressTemplate {...commonProps} />;
192
233
 
@@ -215,7 +256,10 @@ const TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel
215
256
  {(state.showCustomStepper && state.session.isInitialized) ? (
216
257
  <View style={styles.header}>
217
258
  <Text style={styles.progressText}>
218
- {t('kyc.step', { current: state.currentComponentIndex + 1, total: state.template.components.length })}
259
+ {t('kyc.step', {
260
+ current: (state.template.components.findIndex(c => c.id === currentComponent.id) + 1) || (state.currentComponentIndex + 1),
261
+ total: state.template.components.length,
262
+ })}
219
263
  </Text>
220
264
  <View style={styles.progressContainer}>
221
265
  <View style={styles.progressBar}>
@@ -238,7 +282,7 @@ const TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel
238
282
  ) : null}
239
283
 
240
284
  {/* Contenu principal */}
241
- <ScrollView
285
+ <ScrollView
242
286
  style={styles.scrollView}
243
287
  contentContainerStyle={styles.content}
244
288
  showsVerticalScrollIndicator={Platform.OS === 'web'}
@@ -0,0 +1,34 @@
1
+ import { BackendEnvironment } from '../types/env.types';
2
+
3
+ class KYCConfig {
4
+ private static instance: KYCConfig;
5
+ private backendEnvironment: BackendEnvironment = 'PRODUCTION';
6
+
7
+ private backendUrls: Record<BackendEnvironment, string> = {
8
+ PRODUCTION: 'https://service.sanctumkey.com/api/v1',
9
+ TEST: 'https://kyc-backend.transfergratis.net/api/v1', // Placeholder URL
10
+ };
11
+
12
+ private constructor() { }
13
+
14
+ public static getInstance(): KYCConfig {
15
+ if (!KYCConfig.instance) {
16
+ KYCConfig.instance = new KYCConfig();
17
+ }
18
+ return KYCConfig.instance;
19
+ }
20
+
21
+ public setBackendEnvironment(env: BackendEnvironment) {
22
+ this.backendEnvironment = env;
23
+ }
24
+
25
+ public getBackendUrl(): string {
26
+ return this.backendUrls[this.backendEnvironment];
27
+ }
28
+
29
+ public getBackendEnvironment(): BackendEnvironment {
30
+ return this.backendEnvironment;
31
+ }
32
+ }
33
+
34
+ export default KYCConfig.getInstance();
@@ -16,6 +16,7 @@ const DEFAULT_CONFIG: AllowedDomainConfig = {
16
16
  'www.transfergratis.com',
17
17
  'admin.transfergratis.com',
18
18
  'dashboard.transfergratis.com',
19
+ 'preweb.transfergratis.net',
19
20
  // Add other trusted domains here
20
21
  ],
21
22
  enforceHttps: true,
@@ -45,7 +46,7 @@ export const getAllowedDomainsConfig = (): AllowedDomainConfig => {
45
46
  */
46
47
  export const isDomainAllowed = (domain: string): boolean => {
47
48
  const config = getAllowedDomainsConfig();
48
-
49
+
49
50
  // Allow localhost in development
50
51
  if (config.allowLocalhost && (domain === 'localhost' || domain.startsWith('127.0.0.1'))) {
51
52
  return true;
@@ -57,12 +58,12 @@ export const isDomainAllowed = (domain: string): boolean => {
57
58
  if (domain === allowedDomain) {
58
59
  return true;
59
60
  }
60
-
61
+
61
62
  // Subdomain match (e.g., app.transfergratis.com matches transfergratis.com)
62
63
  if (domain.endsWith('.' + allowedDomain)) {
63
64
  return true;
64
65
  }
65
-
66
+
66
67
  return false;
67
68
  });
68
69
  };
@@ -71,30 +72,10 @@ export const isDomainAllowed = (domain: string): boolean => {
71
72
  * Validate if a URL is allowed for callback
72
73
  */
73
74
  export const isCallbackUrlAllowed = (url: string): { allowed: boolean; reason?: string } => {
74
- const config = getAllowedDomainsConfig();
75
-
76
75
  try {
77
- const urlObj = new URL(url);
78
-
79
- // Check protocol
80
- if (config.enforceHttps && urlObj.protocol !== 'https:') {
81
- // Allow http for localhost in development
82
- if (!(config.allowLocalhost && (urlObj.hostname === 'localhost' || urlObj.hostname.startsWith('127.0.0.1')))) {
83
- return {
84
- allowed: false,
85
- reason: 'HTTPS required for callback URLs',
86
- };
87
- }
88
- }
89
-
90
- // Check domain
91
- if (!isDomainAllowed(urlObj.hostname)) {
92
- return {
93
- allowed: false,
94
- reason: `Domain '${urlObj.hostname}' is not in the allowed list`,
95
- };
96
- }
97
-
76
+ // Check if valid URL
77
+ new URL(url);
78
+ // Allow all URLs for redirection as requested
98
79
  return { allowed: true };
99
80
  } catch (error) {
100
81
  return {
@@ -6,6 +6,7 @@ import {
6
6
  OrientationVideoResult,
7
7
  OrientationType
8
8
  } from '../types/KYC.types';
9
+ import { KycEnvironment } from '../types/env.types';
9
10
  import kycService from '../modules/api/KYCService';
10
11
 
11
12
  export interface UseOrientationVideoReturn {
@@ -15,8 +16,8 @@ export interface UseOrientationVideoReturn {
15
16
  }
16
17
 
17
18
  export const useOrientationVideo = (
18
-
19
- config?: Partial<OrientationVideoConfig>
19
+ config?: Partial<OrientationVideoConfig>,
20
+ env: KycEnvironment = 'PRODUCTION'
20
21
  ): UseOrientationVideoReturn => {
21
22
  const defaultConfig: OrientationVideoConfig = {
22
23
  duration: 10,
@@ -66,7 +67,7 @@ export const useOrientationVideo = (
66
67
  setState(prev => ({ ...prev, isProcessing: true, error: null }));
67
68
 
68
69
  try {
69
- const result = await kycService.processOrientationVideo(state.recordedVideo);
70
+ const result = await kycService.processOrientationVideo(state.recordedVideo, env);
70
71
 
71
72
  if (result.success && result.data) {
72
73
  setState(prev => ({
@@ -93,7 +94,7 @@ export const useOrientationVideo = (
93
94
  }));
94
95
  throw error;
95
96
  }
96
- }, [state.recordedVideo, state.isProcessing, kycService]);
97
+ }, [state.recordedVideo, state.isProcessing, env]);
97
98
 
98
99
  const retake = useCallback(() => {
99
100
  if (state.retakeCount >= finalConfig.maxRetakes) {