@transfergratis/react-native-sdk 0.1.23 → 0.1.25
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/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
- package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
- package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
- package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
- package/android/src/main/AndroidManifest.xml +13 -5
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +26 -3
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.web.js +21 -0
- package/build/components/EnhancedCameraView.web.js.map +1 -1
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
- package/build/components/KYCElements/CameraCapture.d.ts.map +1 -1
- package/build/components/KYCElements/CameraCapture.js +4 -3
- package/build/components/KYCElements/CameraCapture.js.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts +5 -2
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +360 -101
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/FileUpload.d.ts.map +1 -1
- package/build/components/KYCElements/FileUpload.js +5 -4
- package/build/components/KYCElements/FileUpload.js.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.js +5 -4
- package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +356 -227
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.js +78 -37
- package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.js +5 -4
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCapture.js +4 -3
- package/build/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +189 -42
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/WelcomeTemplate.d.ts +12 -0
- package/build/components/KYCElements/WelcomeTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/WelcomeTemplate.js +243 -0
- package/build/components/KYCElements/WelcomeTemplate.js.map +1 -0
- package/build/components/TemplateKYCExample.d.ts +8 -2
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +10 -97
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +6 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +108 -11
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/components/example/DynamicTemplateExample.d.ts +10 -0
- package/build/components/example/DynamicTemplateExample.d.ts.map +1 -0
- package/build/components/example/DynamicTemplateExample.js +241 -0
- package/build/components/example/DynamicTemplateExample.js.map +1 -0
- package/build/config/KYCConfig.d.ts +14 -0
- package/build/config/KYCConfig.d.ts.map +1 -0
- package/build/config/KYCConfig.js +26 -0
- package/build/config/KYCConfig.js.map +1 -0
- package/build/config/allowedDomains.d.ts +30 -0
- package/build/config/allowedDomains.d.ts.map +1 -0
- package/build/config/allowedDomains.js +112 -0
- package/build/config/allowedDomains.js.map +1 -0
- package/build/hooks/useOrientationVideo.d.ts +2 -1
- package/build/hooks/useOrientationVideo.d.ts.map +1 -1
- package/build/hooks/useOrientationVideo.js +3 -3
- package/build/hooks/useOrientationVideo.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +317 -34
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/hooks/useTemplateLoader.d.ts +14 -0
- package/build/hooks/useTemplateLoader.d.ts.map +1 -0
- package/build/hooks/useTemplateLoader.js +85 -0
- package/build/hooks/useTemplateLoader.js.map +1 -0
- package/build/i18n/en/index.d.ts +49 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +50 -1
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +35 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +36 -1
- package/build/i18n/fr/index.js.map +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts +24 -3
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +69 -10
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +7 -7
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +108 -39
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/SelfieVerification.d.ts +3 -1
- package/build/modules/api/SelfieVerification.d.ts.map +1 -1
- package/build/modules/api/SelfieVerification.js +17 -1
- package/build/modules/api/SelfieVerification.js.map +1 -1
- package/build/modules/api/TemplateService.d.ts +44 -0
- package/build/modules/api/TemplateService.d.ts.map +1 -0
- package/build/modules/api/TemplateService.js +145 -0
- package/build/modules/api/TemplateService.js.map +1 -0
- package/build/types/KYC.types.d.ts +265 -4
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js +15 -0
- package/build/types/KYC.types.js.map +1 -1
- package/build/types/env.types.d.ts +13 -0
- package/build/types/env.types.d.ts.map +1 -0
- package/build/types/env.types.js +2 -0
- package/build/types/env.types.js.map +1 -0
- package/build/utils/cropByObb.d.ts +1 -0
- package/build/utils/cropByObb.d.ts.map +1 -1
- package/build/utils/cropByObb.js +70 -0
- package/build/utils/cropByObb.js.map +1 -1
- package/build/utils/deviceDetection.d.ts +6 -0
- package/build/utils/deviceDetection.d.ts.map +1 -0
- package/build/utils/deviceDetection.js +12 -0
- package/build/utils/deviceDetection.js.map +1 -0
- package/build/utils/platformAlert.d.ts +20 -0
- package/build/utils/platformAlert.d.ts.map +1 -0
- package/build/utils/platformAlert.js +67 -0
- package/build/utils/platformAlert.js.map +1 -0
- package/build/utils/template-transformer.d.ts +10 -0
- package/build/utils/template-transformer.d.ts.map +1 -0
- package/build/utils/template-transformer.js +365 -0
- package/build/utils/template-transformer.js.map +1 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -1
- package/build/web/WebKYCEntry.js +158 -32
- package/build/web/WebKYCEntry.js.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.ts +3 -4
- package/src/components/EnhancedCameraView.tsx +31 -2
- package/src/components/EnhancedCameraView.web.tsx +24 -0
- package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
- package/src/components/KYCElements/CameraCapture.tsx +4 -3
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
- package/src/components/KYCElements/FileUpload.tsx +5 -4
- package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
- package/src/components/KYCElements/IDCardCapture.tsx +397 -254
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
- package/src/components/KYCElements/OrientationVideoCapture.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +6 -3
- package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
- package/src/components/KYCElements/SelfieCapture.tsx +4 -3
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +201 -44
- package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
- package/src/components/TemplateKYCExample.tsx +37 -108
- package/src/components/TemplateKYCFlowRefactored.tsx +148 -12
- package/src/components/example/DynamicTemplateExample.tsx +289 -0
- package/src/config/KYCConfig.ts +34 -0
- package/src/config/allowedDomains.ts +133 -0
- package/src/hooks/useOrientationVideo.ts +5 -4
- package/src/hooks/useTemplateKYCFlow.tsx +347 -32
- package/src/hooks/useTemplateLoader.ts +102 -0
- package/src/i18n/en/index.ts +53 -2
- package/src/i18n/fr/index.ts +37 -1
- package/src/index.ts +14 -0
- package/src/modules/api/CardAuthentification.ts +76 -11
- package/src/modules/api/KYCService.ts +129 -45
- package/src/modules/api/SelfieVerification.ts +25 -3
- package/src/modules/api/TemplateService.ts +167 -0
- package/src/types/KYC.types.ts +331 -3
- package/src/types/env.types.ts +13 -0
- package/src/utils/cropByObb.ts +83 -3
- package/src/utils/deviceDetection.ts +11 -0
- package/src/utils/platformAlert.ts +86 -0
- package/src/utils/template-transformer.ts +445 -0
- package/src/web/WebKYCEntry.tsx +199 -50
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowed domains configuration for callback URL validation
|
|
3
|
+
* These domains are permitted to receive KYC completion callbacks
|
|
4
|
+
*/
|
|
5
|
+
export interface AllowedDomainConfig {
|
|
6
|
+
domains: string[];
|
|
7
|
+
enforceHttps: boolean;
|
|
8
|
+
allowLocalhost: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get allowed domains from environment or use defaults
|
|
12
|
+
*/
|
|
13
|
+
export declare const getAllowedDomainsConfig: () => AllowedDomainConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a domain is in the allowed list
|
|
16
|
+
*/
|
|
17
|
+
export declare const isDomainAllowed: (domain: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Validate if a URL is allowed for callback
|
|
20
|
+
*/
|
|
21
|
+
export declare const isCallbackUrlAllowed: (url: string) => {
|
|
22
|
+
allowed: boolean;
|
|
23
|
+
reason?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Generate a signature for the callback URL parameters
|
|
27
|
+
* This can be used to verify the integrity of the callback
|
|
28
|
+
*/
|
|
29
|
+
export declare const generateCallbackSignature: (params: Record<string, string>, secret?: string) => Promise<string>;
|
|
30
|
+
//# sourceMappingURL=allowedDomains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowedDomains.d.ts","sourceRoot":"","sources":["../../src/config/allowedDomains.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;CACzB;AAgBD;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,mBAa1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,OAsBhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,KAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAYrF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,SAAS,MAAM,KACd,OAAO,CAAC,MAAM,CAqChB,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowed domains configuration for callback URL validation
|
|
3
|
+
* These domains are permitted to receive KYC completion callbacks
|
|
4
|
+
*/
|
|
5
|
+
// Default configuration - can be overridden via environment variables
|
|
6
|
+
const DEFAULT_CONFIG = {
|
|
7
|
+
domains: [
|
|
8
|
+
'transfergratis.com',
|
|
9
|
+
'www.transfergratis.com',
|
|
10
|
+
'admin.transfergratis.com',
|
|
11
|
+
'dashboard.transfergratis.com',
|
|
12
|
+
'preweb.transfergratis.net',
|
|
13
|
+
// Add other trusted domains here
|
|
14
|
+
],
|
|
15
|
+
enforceHttps: true,
|
|
16
|
+
allowLocalhost: true, // Allow localhost for development
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Get allowed domains from environment or use defaults
|
|
20
|
+
*/
|
|
21
|
+
export const getAllowedDomainsConfig = () => {
|
|
22
|
+
// Check for environment variable override
|
|
23
|
+
if (typeof window !== 'undefined' && window.KYC_ALLOWED_DOMAINS) {
|
|
24
|
+
const envDomains = window.KYC_ALLOWED_DOMAINS;
|
|
25
|
+
if (Array.isArray(envDomains)) {
|
|
26
|
+
return {
|
|
27
|
+
...DEFAULT_CONFIG,
|
|
28
|
+
domains: envDomains,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return DEFAULT_CONFIG;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Check if a domain is in the allowed list
|
|
36
|
+
*/
|
|
37
|
+
export const isDomainAllowed = (domain) => {
|
|
38
|
+
const config = getAllowedDomainsConfig();
|
|
39
|
+
// Allow localhost in development
|
|
40
|
+
if (config.allowLocalhost && (domain === 'localhost' || domain.startsWith('127.0.0.1'))) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
// Check if domain matches any in the allowed list
|
|
44
|
+
return config.domains.some(allowedDomain => {
|
|
45
|
+
// Exact match
|
|
46
|
+
if (domain === allowedDomain) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
// Subdomain match (e.g., app.transfergratis.com matches transfergratis.com)
|
|
50
|
+
if (domain.endsWith('.' + allowedDomain)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Validate if a URL is allowed for callback
|
|
58
|
+
*/
|
|
59
|
+
export const isCallbackUrlAllowed = (url) => {
|
|
60
|
+
try {
|
|
61
|
+
// Check if valid URL
|
|
62
|
+
new URL(url);
|
|
63
|
+
// Allow all URLs for redirection as requested
|
|
64
|
+
return { allowed: true };
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return {
|
|
68
|
+
allowed: false,
|
|
69
|
+
reason: 'Invalid URL format',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Generate a signature for the callback URL parameters
|
|
75
|
+
* This can be used to verify the integrity of the callback
|
|
76
|
+
*/
|
|
77
|
+
export const generateCallbackSignature = async (params, secret) => {
|
|
78
|
+
// Only generate signature if secret is provided
|
|
79
|
+
if (!secret) {
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
// Sort params for consistent signature
|
|
83
|
+
const sortedParams = Object.keys(params)
|
|
84
|
+
.sort()
|
|
85
|
+
.map(key => `${key}=${params[key]}`)
|
|
86
|
+
.join('&');
|
|
87
|
+
const data = `${sortedParams}:${secret}`;
|
|
88
|
+
// Use Web Crypto API for signature generation
|
|
89
|
+
if (typeof window !== 'undefined' && window.crypto && window.crypto.subtle) {
|
|
90
|
+
try {
|
|
91
|
+
const encoder = new TextEncoder();
|
|
92
|
+
const dataBuffer = encoder.encode(data);
|
|
93
|
+
const hashBuffer = await window.crypto.subtle.digest('SHA-256', dataBuffer);
|
|
94
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
95
|
+
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
96
|
+
return hashHex;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
console.error('Error generating signature:', error);
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Fallback: simple hash for environments without Web Crypto API
|
|
104
|
+
let hash = 0;
|
|
105
|
+
for (let i = 0; i < data.length; i++) {
|
|
106
|
+
const char = data.charCodeAt(i);
|
|
107
|
+
hash = ((hash << 5) - hash) + char;
|
|
108
|
+
hash = hash & hash;
|
|
109
|
+
}
|
|
110
|
+
return Math.abs(hash).toString(16);
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=allowedDomains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowedDomains.js","sourceRoot":"","sources":["../../src/config/allowedDomains.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,sEAAsE;AACtE,MAAM,cAAc,GAAwB;IAC1C,OAAO,EAAE;QACP,oBAAoB;QACpB,wBAAwB;QACxB,0BAA0B;QAC1B,8BAA8B;QAC9B,2BAA2B;QAC3B,iCAAiC;KAClC;IACD,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI,EAAE,kCAAkC;CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAwB,EAAE;IAC/D,0CAA0C;IAC1C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAK,MAAc,CAAC,mBAAmB,EAAE,CAAC;QACzE,MAAM,UAAU,GA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C;YACpD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,gEAAgE;IAChE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QACnC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["/**\n * Allowed domains configuration for callback URL validation\n * These domains are permitted to receive KYC completion callbacks\n */\n\nexport interface AllowedDomainConfig {\n domains: string[];\n enforceHttps: boolean;\n allowLocalhost: boolean;\n}\n\n// Default configuration - can be overridden via environment variables\nconst DEFAULT_CONFIG: AllowedDomainConfig = {\n domains: [\n 'transfergratis.com',\n 'www.transfergratis.com',\n 'admin.transfergratis.com',\n 'dashboard.transfergratis.com',\n 'preweb.transfergratis.net',\n // Add other trusted domains here\n ],\n enforceHttps: true,\n allowLocalhost: true, // Allow localhost for development\n};\n\n/**\n * Get allowed domains from environment or use defaults\n */\nexport const getAllowedDomainsConfig = (): AllowedDomainConfig => {\n // Check for environment variable override\n if (typeof window !== 'undefined' && (window as any).KYC_ALLOWED_DOMAINS) {\n const envDomains = (window as any).KYC_ALLOWED_DOMAINS;\n if (Array.isArray(envDomains)) {\n return {\n ...DEFAULT_CONFIG,\n domains: envDomains,\n };\n }\n }\n\n return DEFAULT_CONFIG;\n};\n\n/**\n * Check if a domain is in the allowed list\n */\nexport const isDomainAllowed = (domain: string): boolean => {\n const config = getAllowedDomainsConfig();\n\n // Allow localhost in development\n if (config.allowLocalhost && (domain === 'localhost' || domain.startsWith('127.0.0.1'))) {\n return true;\n }\n\n // Check if domain matches any in the allowed list\n return config.domains.some(allowedDomain => {\n // Exact match\n if (domain === allowedDomain) {\n return true;\n }\n\n // Subdomain match (e.g., app.transfergratis.com matches transfergratis.com)\n if (domain.endsWith('.' + allowedDomain)) {\n return true;\n }\n\n return false;\n });\n};\n\n/**\n * Validate if a URL is allowed for callback\n */\nexport const isCallbackUrlAllowed = (url: string): { allowed: boolean; reason?: string } => {\n try {\n // Check if valid URL\n new URL(url);\n // Allow all URLs for redirection as requested\n return { allowed: true };\n } catch (error) {\n return {\n allowed: false,\n reason: 'Invalid URL format',\n };\n }\n};\n\n/**\n * Generate a signature for the callback URL parameters\n * This can be used to verify the integrity of the callback\n */\nexport const generateCallbackSignature = async (\n params: Record<string, string>,\n secret?: string\n): Promise<string> => {\n // Only generate signature if secret is provided\n if (!secret) {\n return '';\n }\n\n // Sort params for consistent signature\n const sortedParams = Object.keys(params)\n .sort()\n .map(key => `${key}=${params[key]}`)\n .join('&');\n\n const data = `${sortedParams}:${secret}`;\n\n // Use Web Crypto API for signature generation\n if (typeof window !== 'undefined' && window.crypto && window.crypto.subtle) {\n try {\n const encoder = new TextEncoder();\n const dataBuffer = encoder.encode(data);\n const hashBuffer = await window.crypto.subtle.digest('SHA-256', dataBuffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n return hashHex;\n } catch (error) {\n console.error('Error generating signature:', error);\n return '';\n }\n }\n\n // Fallback: simple hash for environments without Web Crypto API\n let hash = 0;\n for (let i = 0; i < data.length; i++) {\n const char = data.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash;\n }\n return Math.abs(hash).toString(16);\n};\n\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { OrientationVideoState, OrientationVideoActions, OrientationVideoConfig } from '../types/KYC.types';
|
|
2
|
+
import { KycEnvironment } from '../types/env.types';
|
|
2
3
|
export interface UseOrientationVideoReturn {
|
|
3
4
|
state: OrientationVideoState;
|
|
4
5
|
actions: OrientationVideoActions;
|
|
5
6
|
config: OrientationVideoConfig;
|
|
6
7
|
}
|
|
7
|
-
export declare const useOrientationVideo: (config?: Partial<OrientationVideoConfig
|
|
8
|
+
export declare const useOrientationVideo: (config?: Partial<OrientationVideoConfig>, env?: KycEnvironment) => UseOrientationVideoReturn;
|
|
8
9
|
export default useOrientationVideo;
|
|
9
10
|
//# sourceMappingURL=useOrientationVideo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrientationVideo.d.ts","sourceRoot":"","sources":["../../src/hooks/useOrientationVideo.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"useOrientationVideo.d.ts","sourceRoot":"","sources":["../../src/hooks/useOrientationVideo.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,EAAE,uBAAuB,CAAC;IACjC,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,CAAC,sBAAsB,CAAC,EACxC,MAAK,cAA6B,KACjC,yBA8HF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
import kycService from '../modules/api/KYCService';
|
|
3
|
-
export const useOrientationVideo = (config) => {
|
|
3
|
+
export const useOrientationVideo = (config, env = 'PRODUCTION') => {
|
|
4
4
|
const defaultConfig = {
|
|
5
5
|
duration: 10,
|
|
6
6
|
orientations: ['center', 'left', 'right'],
|
|
@@ -42,7 +42,7 @@ export const useOrientationVideo = (config) => {
|
|
|
42
42
|
}
|
|
43
43
|
setState(prev => ({ ...prev, isProcessing: true, error: null }));
|
|
44
44
|
try {
|
|
45
|
-
const result = await kycService.processOrientationVideo(state.recordedVideo);
|
|
45
|
+
const result = await kycService.processOrientationVideo(state.recordedVideo, env);
|
|
46
46
|
if (result.success && result.data) {
|
|
47
47
|
setState(prev => ({
|
|
48
48
|
...prev,
|
|
@@ -70,7 +70,7 @@ export const useOrientationVideo = (config) => {
|
|
|
70
70
|
}));
|
|
71
71
|
throw error;
|
|
72
72
|
}
|
|
73
|
-
}, [state.recordedVideo, state.isProcessing,
|
|
73
|
+
}, [state.recordedVideo, state.isProcessing, env]);
|
|
74
74
|
const retake = useCallback(() => {
|
|
75
75
|
if (state.retakeCount >= finalConfig.maxRetakes) {
|
|
76
76
|
throw new Error('Maximum retakes reached');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrientationVideo.js","sourceRoot":"","sources":["../../src/hooks/useOrientationVideo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useOrientationVideo.js","sourceRoot":"","sources":["../../src/hooks/useOrientationVideo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAS9C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAQnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAAwC,EACxC,MAAsB,YAAY,EACP,EAAE;IAC7B,MAAM,aAAa,GAA2B;QAC5C,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,YAAY,EAAE;YACZ,MAAM,EAAE,mCAAmC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useCallback } from 'react';\nimport { \n OrientationVideoState, \n OrientationVideoActions, \n OrientationVideoConfig,\n OrientationVideoResult,\n OrientationType \n} from '../types/KYC.types';\nimport { KycEnvironment } from '../types/env.types';\nimport kycService from '../modules/api/KYCService';\n\nexport interface UseOrientationVideoReturn {\n state: OrientationVideoState;\n actions: OrientationVideoActions;\n config: OrientationVideoConfig;\n}\n\nexport const useOrientationVideo = (\n config?: Partial<OrientationVideoConfig>,\n env: KycEnvironment = 'PRODUCTION'\n): UseOrientationVideoReturn => {\n const defaultConfig: OrientationVideoConfig = {\n duration: 10,\n orientations: ['center', 'left', 'right'],\n instructions: {\n center: 'Look straight ahead at the camera',\n left: 'Turn your head to the left',\n right: 'Turn your head to the right',\n },\n showPreview: true,\n allowRetake: true,\n maxRetakes: 3,\n quality: 0.8,\n aspectRatio: 16 / 9,\n };\n\n const finalConfig = { ...defaultConfig, ...config };\n\n const [state, setState] = useState<OrientationVideoState>({\n isRecording: false,\n currentOrientation: null,\n recordedVideo: null,\n processingResult: null,\n isProcessing: false,\n error: null,\n retakeCount: 0,\n });\n\n const startRecording = useCallback(() => {\n setState(prev => ({ \n ...prev, \n isRecording: true, \n error: null,\n currentOrientation: 'center' // Start with center orientation\n }));\n }, []);\n\n const stopRecording = useCallback(() => {\n setState(prev => ({ ...prev, isRecording: false }));\n }, []);\n\n const processVideo = useCallback(async (): Promise<OrientationVideoResult> => {\n if (!state.recordedVideo || state.isProcessing) {\n throw new Error('No video to process or already processing');\n }\n\n setState(prev => ({ ...prev, isProcessing: true, error: null }));\n\n try {\n const result = await kycService.processOrientationVideo(state.recordedVideo, env);\n \n if (result.success && result.data) {\n setState(prev => ({ \n ...prev, \n processingResult: result.data || null,\n isProcessing: false \n }));\n return result.data;\n } else {\n const errorMessage = result.message || 'Processing failed';\n setState(prev => ({ \n ...prev, \n isProcessing: false,\n error: errorMessage \n }));\n throw new Error(errorMessage);\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';\n setState(prev => ({ \n ...prev, \n isProcessing: false,\n error: errorMessage \n }));\n throw error;\n }\n }, [state.recordedVideo, state.isProcessing, env]);\n\n const retake = useCallback(() => {\n if (state.retakeCount >= finalConfig.maxRetakes) {\n throw new Error('Maximum retakes reached');\n }\n\n setState(prev => ({ \n ...prev, \n recordedVideo: null,\n processingResult: null,\n error: null,\n retakeCount: prev.retakeCount + 1 \n }));\n }, [state.retakeCount, finalConfig.maxRetakes]);\n\n const reset = useCallback(() => {\n setState({\n isRecording: false,\n currentOrientation: null,\n recordedVideo: null,\n processingResult: null,\n isProcessing: false,\n error: null,\n retakeCount: 0,\n });\n }, []);\n\n const setCurrentOrientation = useCallback((orientation: OrientationType) => {\n setState(prev => ({ ...prev, currentOrientation: orientation }));\n }, []);\n\n // const setRecordedVideo = useCallback((videoUri: string) => {\n // setState(prev => ({ ...prev, recordedVideo: videoUri }));\n // }, []);\n\n const actions: OrientationVideoActions = {\n startRecording,\n stopRecording,\n processVideo,\n retake,\n reset,\n setCurrentOrientation,\n };\n\n return {\n state,\n actions,\n config: finalConfig,\n };\n};\n\nexport default useOrientationVideo; "]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { KYCTemplate, TemplateState, TemplateActions, UseTemplateReturn, VerificationState } from '../types/KYC.types';
|
|
3
|
+
import { KycEnvironment } from '../types/env.types';
|
|
3
4
|
interface TemplateKYCFlowContextType {
|
|
4
5
|
state: TemplateState;
|
|
5
6
|
actions: TemplateActions;
|
|
@@ -14,6 +15,7 @@ interface TemplateKYCFlowContextType {
|
|
|
14
15
|
[key: string]: string;
|
|
15
16
|
}) => string;
|
|
16
17
|
initializeSession: () => Promise<void>;
|
|
18
|
+
env: KycEnvironment;
|
|
17
19
|
}
|
|
18
20
|
interface TemplateKYCFlowProviderProps {
|
|
19
21
|
children: ReactNode;
|
|
@@ -23,9 +25,12 @@ interface TemplateKYCFlowProviderProps {
|
|
|
23
25
|
onCancel?: () => void;
|
|
24
26
|
initialLanguage?: string;
|
|
25
27
|
apiKey?: string;
|
|
28
|
+
env?: KycEnvironment;
|
|
29
|
+
existingSessionId?: string;
|
|
30
|
+
initialStep?: number;
|
|
26
31
|
}
|
|
27
32
|
export declare const TemplateKYCFlowProvider: React.FC<TemplateKYCFlowProviderProps>;
|
|
28
33
|
export declare const useTemplateKYCFlowContext: () => TemplateKYCFlowContextType;
|
|
29
|
-
export declare const useTemplateKYCFlow: (template: KYCTemplate, onComplete?: (data: VerificationState) => void, onError?: (error: string) => void, onCancel?: () => void, initialLanguage?: string, apiKey?: string) => UseTemplateReturn;
|
|
34
|
+
export declare const useTemplateKYCFlow: (template: KYCTemplate, onComplete?: (data: VerificationState) => void, onError?: (error: string) => void, onCancel?: () => void, initialLanguage?: string, apiKey?: string, env?: KycEnvironment, existingSessionId?: string, initialStep?: number) => UseTemplateReturn;
|
|
30
35
|
export {};
|
|
31
36
|
//# sourceMappingURL=useTemplateKYCFlow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTemplateKYCFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useTemplateKYCFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6D,SAAS,EAAa,MAAM,OAAO,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAA6C,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTemplateKYCFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useTemplateKYCFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6D,SAAS,EAAa,MAAM,OAAO,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAA6C,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClK,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC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